Skip to contentSkip to conversation

motive for sending Ethernet packets in soft-irq context

DISCUSSION Parav Pandit 2 participants 2 messages May 2, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

What is the motive to send the ethernet packets to the NIC driver by invoking hard_xmit() in the soft-irq context?

What I understand is,
It is not done into the process context of send() system call beacause,
1. Calling it in soft-irq context eliminates any delays incurred by the process switching, lower task priorities etc.

Can't it be done by raising the process priority to highest until the NIC driver hand over the packet to the hardware? This will avoid time incurred in process to soft-irq switching time.

Are there any other performance, security reasons?

Regards,
Parav Pandit

      ____________________________________________________________________________________

Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

maintainer
#1 lore raw

From: Parav Pandit <[email protected]>
Date: Fri, 2 May 2008 02:16:07 -0700 (PDT)

[ Your question belongs on netdev, that's where the kernel
networking developers hang out, CC:'d ]

Quoted 2 lines

What I understand is,
It is not done into the process context of send() system call beacause,

Where did you obtain this understanding? It's not accurate :-)

It is actually done in the send() system call thread of execution most of the time. soft-irqs are simply disabled during the ->hard_start_xmit() driver call so that input packet processing cannot execute on the local cpu while this happens.

However, many packets are sent in response to received packets. In this case, since receive packets are processed in soft-irq context, the response will be sent in such a context too.

This applies for TCP data queued up waiting for the congestion window or TCP window to open up. When an ACK arrives which satisfies the necessary conditions, queued up socket data packets are send, again in soft-irq context.

So whether we send to the network card in soft-irq context or not is entirely situation dependent.