Relationship between Rx/Tx ring and Skbuff.
Hi, I would like to understand the journey of the packet in Linux kernel. There are many resources that explain this differently but as I have understood it on a high level, when a packet is received in a NIC, DMA moves the packets from the NIC frame buffer into the RX ring buffer in the driver. A hardware interrupt is then raised and the top half moves the packet to the RX ring buffer. Is it right to understand that the bottom half tasklets then drain the buffer and move the packets to sk_buff data structure? Are the RX/TX buffers different from sk_buff in terms of memory regions or the sk_buff simply points to the physical address of the packets residing in the RX ring and then does the manipulation of the pointers to send it up in the kernel IP stack? I know this is a broad topic but I would like to seek clarification from the experts on my understanding of packet movement inside the kernel. Or can you point me to a resource which can be a close explanation about the implementation on how the kernel handles in > 4.x ? Thanks, Vasu
On Wed, 05 Aug 2020 11:34:52 -0700, Vasu M said:
it on a high level, when a packet is received in a NIC, DMA moves the packets from the NIC frame buffer into the RX ring buffer in the driver. A hardware interrupt is then raised and the top half moves the packet to the RX ring buffer.
Umm... I would expect the packet to be moved to the RX ring buffer exactly once, not twice...
On Wed, 05 Aug 2020 11:34:52 -0700, Vasu M said:
it on a high level, when a packet is received in a NIC, DMA moves the packets from the NIC frame buffer into the RX ring buffer in the driver. A hardware interrupt is then raised and the top half moves the packet to the RX ring buffer.
Umm... I would expect the packet to be moved to the RX ring buffer exactly once, not twice...
I am sorry, yes, thats a mistake and it makes sense. If the DMA moves the packet to the RX ring, the top half just acknowledges the interrupt and schedules the softirq to drain the packets from RX. Subsequently, after the packets go through sk_buff, they get queued in the socket recv buffer and get to user space memory finally? I suppose I am only scratching the surface leaving so many details.
Hi, Fortunately I wrote a seminar paper some years ago at university about exactly that topic. It might help and should still be up to date in all important regards. https://github.com/richi235/ftrace-paper I used ftrace to trace the way of a packet, the pdf is in Document/ Cheers, -- Richard
On Fri, Aug 28, 2020 at 8:44 PM Richard Sailer < richard_siegfried@systemli.org> wrote:
Hi,
Fortunately I wrote a seminar paper some years ago at university about exactly that topic. It might help and should still be up to date in all important regards. https://github.com/richi235/ftrace-paper
I used ftrace to trace the way of a packet, the pdf is in Document/
Cheers, -- Richard
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Great work!!!!! -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaig...> Virus-free. www.avast.com <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaig...> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
participants (4)
-
Mulyadi Santosa -
Richard Sailer -
Valdis Klētnieks -
Vasu M