与内核中的数据包遍历相关的查询

时间:2013-04-04 06:37:36

标签: network-programming linux-kernel linux-device-driver kernel

阅读“了解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->协议的决定

这是什么,数据包传输过程我的意思是什么时候分配sk_buff和所有。

请指导

0 个答案:

没有答案