阅读《了解 Linux 网络内部结构》一书后。我开始了解我们如何从网络获取数据包的一些概念:-
> When working in interrupt driven model, the nic registers an
> interrupt handler;
> • This interrupt handler will be called when a frame is received;
> • Typically in the handler, we allocate sk buff by calling
> dev alloc skb();
> • Copies data from nic’s buffer to this struct just created;
> • nic call generic reception routine netif rx();
> • netif rx() put frame in per cpu queue;
> • if queue is full, drop!
> • net rx action() decision based on skb->protocol;
> • This function basically dequeues the frame and delivery a copy
> for every protocol handler;
> • ptype all and ptype base queues
> ip v4 rcv() will receive the ip datagram (if is a ipv4 packet);
•ip checksum, check ip headers, ....
• ip rcv finish() makes route decision (ip forward() or ip local delivery())
现在我有一些与之相关的查询:-关于链接http://lxr.free-electrons.com/source/net/core/dev.c#L3075上的 netif_rx() 代码,该代码表示它提供了框架到上层
关于 net_rx_action() http://lxr.free-electrons.com/source/net/core/dev.c#L4041哪个代码说它根据 skb->protocol 做出决定
我的意思是什么时候分配 sk_buff 以及所有的数据包传输过程。
请指导