Re: Ethernet packets vs kernel speed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 30 Nov 2004 11:17:03 -0800 (PST), Alaios <alaios@xxxxxxxxx> wrote:
> Hi.... Today a really strange problem appeared in my
> mind...
> 
> Lets take the following example..
> We have ethernet packets of 1250 bytes/packet...
> (i use the 1250 number because i make the calculation
> simpler)
> 
> We have 1250*8bits=10.000 bits..
> My pc has an 100Mbit ethernet card this means
> 100.000.000 bits per second... So our ethernet card
> must transmit data in 100.000.000/10.000= 10.000
> packets per second...
That is not a problem. Some earlier measurements have shown that a
P-II based PC can handle around 60K packets per seconds.  In your
calculation you have taken the size of each packets as 1250 Bytes but
the real problem would come from a large number of tinygrams. Too many
interrupts would be generated and even if the CPU is powerful enough
to handle them, it will result in a lot of CPU time wastage in the
interrupt handler.

> 
> I am trying to figure out how a kernel can tolerate
> with so much traffic... I think/suppose that a packet
> needs some ms for being handled (i wiil check it
> later).. If this is true how a kernel can send so much
> packets when there is not enough time? 1000ms == 1
> sec.
Up till kernel 2.4.20 every arriving packet generated an interrupt
which obviously is a problem if there are too many incoming packets.
>From kernel 2.4.20 onwards a new mechanism called NAPI was
implemented. In this new strategy the network interface instead of
interrupting the CPU for each packet received, it registers itself on
the device poll list and its interrupts are disabled. The CPU goes
through the poll list and finds the NIC with unfinished work. It then
processes all the queued packets or till a maximum quota for the
device whichever is less.  If the NIC queue becomes empty, it's
interrupts are enabled else it is put back on the poll list.

Hope this helps. I am a kernel newbie and just sharing my knowledge. I
would be glad if someone finds and points out any inaccuracy in the
explanation.

Shourya

> 
> PS: I know that the 100Mbit is only a theory based
> speed and you can not achieve such a number... But
> stil l my question has not been answered...
> Thx a lot...
> I hope that your answers will satisfy eveyone :)
> Have a nice day
> 
> __________________________________
> Do you Yahoo!?
> All your favorites on one personal page â Try My Yahoo!
> http://my.yahoo.com
> 
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> 
>

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux