Re: Netfilter hooks on SMP?

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

 




On Mar 20 2008 14:42, strawks wrote:

This hook should be executed in a softirq, and so could be run by multiple
CPUs at the same time.

This seems to be the case when 2 NICs are used (tested on a dual Xeon,
85%"load on each CPU).

But when there is only one NIC, only one CPU is used.

Correct, each network card has an assigned interrupt, and when that fires,
the CPU assigned for this interrupt will process the NIC buffer
(which may have multiple packets).

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