#StackBounty: #networking Does Linux network device have its own queue to hold incoming and outgoing packets?

Bounty: 50

I am trying to understand how Linux handles packets for ingress and egress through any device.

Taking a simple example of a veth pair (say veth1 and veth2), when a packet is sent via veth1, it will be received at veth2. Now veth has its own kernel module and for transmitting through veth1, kernel will invoke its xmit() function where it will forward the packet to veth2.

Looking at the code for dev_forward_skb() and the invoked call to netif_rx_internal() function, as far as memory being used to hold the packet, the only role I see the device veth2 playing is to tell which CPU’s queue the packet should be placed in (via enqueue_to_backlog() for further processing. The process_backlog() function goes on send packet to the network stack.

My question is this: does the device veth2 hold any queue of its own where it actually holds the packet (for ingress or egress), or does the device simply tell which CPU to use ? I see the structure netdev_rx_queue, but I only find code so far that uses its map and flow table members.

The question extends to other devices like loopback, tun/tap and eth as well


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.