Re: [PATCH net-next-2.6] vlan: lockless transmit path

Jesse Gross
2010-11-11T17:47:21Z

On Thu, Nov 11, 2010 at 1:42 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> vlan is a stacked device, like tunnels. We should use the lockless
> mechanism we are using in tunnels and loopback.
>
> This patch completely removes locking in TX path.
>
> tx stat counters are added into existing percpu stat structure, renamed
> from vlan_rx_stats to vlan_pcpu_stats.
>
> Note : this partially reverts commit 2e59af3dcbdf (vlan: multiqueue vlan
> device)
>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> Cc: Patrick McHardy <kaber@trash.net>
> ---
>  net/8021q/vlan.c         |    4 -
>  net/8021q/vlan.h         |   16 +++++--
>  net/8021q/vlan_core.c    |    4 -
>  net/8021q/vlan_dev.c     |   78 +++++++++++++++++++++----------------
>  net/8021q/vlan_netlink.c |   20 ---------
>  5 files changed, 59 insertions(+), 63 deletions(-)
>
> diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
> index 52077ca..2f54ce8 100644
> --- a/net/8021q/vlan.c
> +++ b/net/8021q/vlan.c
> @@ -272,13 +272,11 @@ static int register_vlan_device(struct net_device *real_dev, u16 vlan_id)
>                snprintf(name, IFNAMSIZ, "vlan%.4i", vlan_id);
>        }
>
> -       new_dev = alloc_netdev_mq(sizeof(struct vlan_dev_info), name,
> -                                 vlan_setup, real_dev->num_tx_queues);
> +       new_dev = alloc_netdev(sizeof(struct vlan_dev_info), name, vlan_setup);

If we're only allocating a single queue then we should also drop
vlan_dev_select_queue() and the netdev_ops that call it. If the
underlying device is multiqueue and has its own select_queue function
then it can pick a queue number that is larger than what the vlan
device has. The problem will be caught by dev_cap_txqueue() but it's
not right and it would also be nice to get rid of half of those
netdev_ops.