Re: Netfilter hooks on SMP?

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

 




On Thu, 20 Mar 2008 15:17:19 +0100 (CET), Jan Engelhardt
<jengelh@xxxxxxxxxxxxxxx> wrote:
> On Mar 20 2008 14:42, strawks wrote:
>> Is there a way to make packets coming from a single NIC handled by
> multiple
>> CPUs?
> 
> Possibly. I think the netif_rx() function in net/core/dev.c
> is the sweet spot:
> 
>          queue = &__get_cpu_var(softnet_data);
> 
> include/linux/netdevice.h tells us about softnet_data:
> 
>  	/*
>  	 * Incoming packets are placed on per-cpu queues so that
>  	 * no locking is needed.
>  	 */
> 
> which means if you distribute packets across CPUs (by using
> something else than __get_cpu_var), you need additional locking
> or rcu.

Thanks for your reply!

netif_rx is called by the NIC driver, by the IRQ handler (maybe I'm wrong
since NAPI may work differently), to queue packets which will be handled by
the softirq.

So when the driver exits the IRQ handler for its device, IRQ are reenabled.
If a packet comes before the softirq has finished with the previous
packet(s), an IRQ is raised again. It appears that this IRQ will be handled
by the same CPU. But is it possible that the second IRQ should be handled
by another CPU? I don't really know how IRQs are handled on SMP (nor I know
how irq-balance works)
-- 
Regards,
strawks



--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux