kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* Relationship between Rx/Tx ring and Skbuff.
@ 2020-08-05 18:34 Vasu M
  2020-08-06  1:43 ` Valdis Klētnieks
  2020-08-28 13:43 ` Richard Sailer
  0 siblings, 2 replies; 5+ messages in thread
From: Vasu M @ 2020-08-05 18:34 UTC (permalink / raw)
  To: kernelnewbies


[-- Attachment #1.1: Type: text/plain, Size: 1055 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 1178 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Relationship between Rx/Tx ring and Skbuff.
  2020-08-05 18:34 Relationship between Rx/Tx ring and Skbuff Vasu M
@ 2020-08-06  1:43 ` Valdis Klētnieks
  2020-08-06  4:52   ` Vasu M
  2020-08-28 13:43 ` Richard Sailer
  1 sibling, 1 reply; 5+ messages in thread
From: Valdis Klētnieks @ 2020-08-06  1:43 UTC (permalink / raw)
  To: Vasu M; +Cc: kernelnewbies


[-- Attachment #1.1: Type: text/plain, Size: 390 bytes --]

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...

[-- Attachment #1.2: Type: application/pgp-signature, Size: 832 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Relationship between Rx/Tx ring and Skbuff.
  2020-08-06  1:43 ` Valdis Klētnieks
@ 2020-08-06  4:52   ` Vasu M
  0 siblings, 0 replies; 5+ messages in thread
From: Vasu M @ 2020-08-06  4:52 UTC (permalink / raw)
  To: Valdis Klētnieks; +Cc: kernelnewbies


[-- Attachment #1.1: Type: text/plain, Size: 813 bytes --]

> 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.

[-- Attachment #1.2: Type: text/html, Size: 1112 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Relationship between Rx/Tx ring and Skbuff.
  2020-08-05 18:34 Relationship between Rx/Tx ring and Skbuff Vasu M
  2020-08-06  1:43 ` Valdis Klētnieks
@ 2020-08-28 13:43 ` Richard Sailer
  2020-09-04  5:31   ` Mulyadi Santosa
  1 sibling, 1 reply; 5+ messages in thread
From: Richard Sailer @ 2020-08-28 13:43 UTC (permalink / raw)
  To: kernelnewbies


[-- Attachment #1.1.1: Type: text/plain, Size: 309 bytes --]

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


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Relationship between Rx/Tx ring and Skbuff.
  2020-08-28 13:43 ` Richard Sailer
@ 2020-09-04  5:31   ` Mulyadi Santosa
  0 siblings, 0 replies; 5+ messages in thread
From: Mulyadi Santosa @ 2020-09-04  5:31 UTC (permalink / raw)
  To: kernelnewbies


[-- Attachment #1.1: Type: text/plain, Size: 1027 bytes --]

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_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

[-- Attachment #1.2: Type: text/html, Size: 2515 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-09-04  5:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-05 18:34 Relationship between Rx/Tx ring and Skbuff Vasu M
2020-08-06  1:43 ` Valdis Klētnieks
2020-08-06  4:52   ` Vasu M
2020-08-28 13:43 ` Richard Sailer
2020-09-04  5:31   ` Mulyadi Santosa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).