All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next-2.6] vlan: lockless transmit path
@ 2010-11-11  9:42 Eric Dumazet
  2010-11-11 17:40 ` Jesse Gross
  2010-11-16 19:24 ` [PATCH net-next-2.6] vlan: lockless transmit path David Miller
  0 siblings, 2 replies; 11+ messages in thread
From: Eric Dumazet @ 2010-11-11  9:42 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Patrick McHardy

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 (new_dev == NULL)
 		return -ENOBUFS;
 
-	netif_copy_real_num_queues(new_dev, real_dev);
 	dev_net_set(new_dev, net);
 	/* need 4 bytes for extra VLAN header info,
 	 * hope the underlying device can handle it.
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h
index db01b31..a2dafb1 100644
--- a/net/8021q/vlan.h
+++ b/net/8021q/vlan.h
@@ -19,19 +19,25 @@ struct vlan_priority_tci_mapping {
 
 
 /**
- *	struct vlan_rx_stats - VLAN percpu rx stats
+ *	struct vlan_pcpu_stats - VLAN percpu rx/tx stats
  *	@rx_packets: number of received packets
  *	@rx_bytes: number of received bytes
  *	@rx_multicast: number of received multicast packets
+ *	@tx_packets: number of transmitted packets
+ *	@tx_bytes: number of transmitted bytes
  *	@syncp: synchronization point for 64bit counters
- *	@rx_errors: number of errors
+ *	@rx_errors: number of rx errors
+ *	@tx_dropped: number of tx drops
  */
-struct vlan_rx_stats {
+struct vlan_pcpu_stats {
 	u64			rx_packets;
 	u64			rx_bytes;
 	u64			rx_multicast;
+	u64			tx_packets;
+	u64			tx_bytes;
 	struct u64_stats_sync	syncp;
-	unsigned long		rx_errors;
+	u32			rx_errors;
+	u32			tx_dropped;
 };
 
 /**
@@ -64,7 +70,7 @@ struct vlan_dev_info {
 	struct proc_dir_entry			*dent;
 	unsigned long				cnt_inc_headroom_on_tx;
 	unsigned long				cnt_encap_on_xmit;
-	struct vlan_rx_stats __percpu		*vlan_rx_stats;
+	struct vlan_pcpu_stats __percpu		*vlan_pcpu_stats;
 };
 
 static inline struct vlan_dev_info *vlan_dev_info(const struct net_device *dev)
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
index 69b2f79..ce8e3ab 100644
--- a/net/8021q/vlan_core.c
+++ b/net/8021q/vlan_core.c
@@ -9,7 +9,7 @@ bool vlan_hwaccel_do_receive(struct sk_buff **skbp)
 	struct sk_buff *skb = *skbp;
 	u16 vlan_id = skb->vlan_tci & VLAN_VID_MASK;
 	struct net_device *vlan_dev;
-	struct vlan_rx_stats *rx_stats;
+	struct vlan_pcpu_stats *rx_stats;
 
 	vlan_dev = vlan_find_dev(skb->dev, vlan_id);
 	if (!vlan_dev) {
@@ -26,7 +26,7 @@ bool vlan_hwaccel_do_receive(struct sk_buff **skbp)
 	skb->priority = vlan_get_ingress_priority(vlan_dev, skb->vlan_tci);
 	skb->vlan_tci = 0;
 
-	rx_stats = this_cpu_ptr(vlan_dev_info(vlan_dev)->vlan_rx_stats);
+	rx_stats = this_cpu_ptr(vlan_dev_info(vlan_dev)->vlan_pcpu_stats);
 
 	u64_stats_update_begin(&rx_stats->syncp);
 	rx_stats->rx_packets++;
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 14e3d1f..3a67483 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -141,7 +141,7 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
 		  struct packet_type *ptype, struct net_device *orig_dev)
 {
 	struct vlan_hdr *vhdr;
-	struct vlan_rx_stats *rx_stats;
+	struct vlan_pcpu_stats *rx_stats;
 	struct net_device *vlan_dev;
 	u16 vlan_id;
 	u16 vlan_tci;
@@ -177,7 +177,7 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
 	} else {
 		skb->dev = vlan_dev;
 
-		rx_stats = this_cpu_ptr(vlan_dev_info(skb->dev)->vlan_rx_stats);
+		rx_stats = this_cpu_ptr(vlan_dev_info(skb->dev)->vlan_pcpu_stats);
 
 		u64_stats_update_begin(&rx_stats->syncp);
 		rx_stats->rx_packets++;
@@ -313,8 +313,6 @@ static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
 static netdev_tx_t vlan_dev_hard_start_xmit(struct sk_buff *skb,
 					    struct net_device *dev)
 {
-	int i = skb_get_queue_mapping(skb);
-	struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
 	struct vlan_ethhdr *veth = (struct vlan_ethhdr *)(skb->data);
 	unsigned int len;
 	int ret;
@@ -335,7 +333,7 @@ static netdev_tx_t vlan_dev_hard_start_xmit(struct sk_buff *skb,
 		vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb);
 		skb = __vlan_put_tag(skb, vlan_tci);
 		if (!skb) {
-			txq->tx_dropped++;
+			this_cpu_inc(vlan_dev_info(dev)->vlan_pcpu_stats->tx_dropped);
 			return NETDEV_TX_OK;
 		}
 
@@ -349,19 +347,22 @@ static netdev_tx_t vlan_dev_hard_start_xmit(struct sk_buff *skb,
 	ret = dev_queue_xmit(skb);
 
 	if (likely(ret == NET_XMIT_SUCCESS || ret == NET_XMIT_CN)) {
-		txq->tx_packets++;
-		txq->tx_bytes += len;
-	} else
-		txq->tx_dropped++;
+		struct vlan_pcpu_stats *stats;
 
+		stats = this_cpu_ptr(vlan_dev_info(dev)->vlan_pcpu_stats);
+		u64_stats_update_begin(&stats->syncp);
+		stats->tx_packets++;
+		stats->tx_bytes += len;
+		u64_stats_update_begin(&stats->syncp);
+	} else {
+		this_cpu_inc(vlan_dev_info(dev)->vlan_pcpu_stats->tx_dropped);
+	}
 	return ret;
 }
 
 static netdev_tx_t vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb,
 						    struct net_device *dev)
 {
-	int i = skb_get_queue_mapping(skb);
-	struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
 	u16 vlan_tci;
 	unsigned int len;
 	int ret;
@@ -375,10 +376,16 @@ static netdev_tx_t vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb,
 	ret = dev_queue_xmit(skb);
 
 	if (likely(ret == NET_XMIT_SUCCESS || ret == NET_XMIT_CN)) {
-		txq->tx_packets++;
-		txq->tx_bytes += len;
-	} else
-		txq->tx_dropped++;
+		struct vlan_pcpu_stats *stats;
+
+		stats = this_cpu_ptr(vlan_dev_info(dev)->vlan_pcpu_stats);
+		u64_stats_update_begin(&stats->syncp);
+		stats->tx_packets++;
+		stats->tx_bytes += len;
+		u64_stats_update_begin(&stats->syncp);
+	} else {
+		this_cpu_inc(vlan_dev_info(dev)->vlan_pcpu_stats->tx_dropped);
+	}
 
 	return ret;
 }
@@ -738,6 +745,7 @@ static int vlan_dev_init(struct net_device *dev)
 		      (1<<__LINK_STATE_PRESENT);
 
 	dev->features |= real_dev->features & real_dev->vlan_features;
+	dev->features |= NETIF_F_LLTX;
 	dev->gso_max_size = real_dev->gso_max_size;
 
 	/* ipv6 shared card related stuff */
@@ -773,8 +781,8 @@ static int vlan_dev_init(struct net_device *dev)
 
 	vlan_dev_set_lockdep_class(dev, subclass);
 
-	vlan_dev_info(dev)->vlan_rx_stats = alloc_percpu(struct vlan_rx_stats);
-	if (!vlan_dev_info(dev)->vlan_rx_stats)
+	vlan_dev_info(dev)->vlan_pcpu_stats = alloc_percpu(struct vlan_pcpu_stats);
+	if (!vlan_dev_info(dev)->vlan_pcpu_stats)
 		return -ENOMEM;
 
 	return 0;
@@ -786,8 +794,8 @@ static void vlan_dev_uninit(struct net_device *dev)
 	struct vlan_dev_info *vlan = vlan_dev_info(dev);
 	int i;
 
-	free_percpu(vlan->vlan_rx_stats);
-	vlan->vlan_rx_stats = NULL;
+	free_percpu(vlan->vlan_pcpu_stats);
+	vlan->vlan_pcpu_stats = NULL;
 	for (i = 0; i < ARRAY_SIZE(vlan->egress_priority_map); i++) {
 		while ((pm = vlan->egress_priority_map[i]) != NULL) {
 			vlan->egress_priority_map[i] = pm->next;
@@ -825,33 +833,37 @@ static u32 vlan_ethtool_get_flags(struct net_device *dev)
 
 static struct rtnl_link_stats64 *vlan_dev_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
 {
-	dev_txq_stats_fold(dev, stats);
 
-	if (vlan_dev_info(dev)->vlan_rx_stats) {
-		struct vlan_rx_stats *p, accum = {0};
+	if (vlan_dev_info(dev)->vlan_pcpu_stats) {
+		struct vlan_pcpu_stats *p;
+		u32 rx_errors = 0, tx_dropped = 0;
 		int i;
 
 		for_each_possible_cpu(i) {
-			u64 rxpackets, rxbytes, rxmulticast;
+			u64 rxpackets, rxbytes, rxmulticast, txpackets, txbytes;
 			unsigned int start;
 
-			p = per_cpu_ptr(vlan_dev_info(dev)->vlan_rx_stats, i);
+			p = per_cpu_ptr(vlan_dev_info(dev)->vlan_pcpu_stats, i);
 			do {
 				start = u64_stats_fetch_begin_bh(&p->syncp);
 				rxpackets	= p->rx_packets;
 				rxbytes		= p->rx_bytes;
 				rxmulticast	= p->rx_multicast;
+				txpackets	= p->tx_packets;
+				txbytes		= p->tx_bytes;
 			} while (u64_stats_fetch_retry_bh(&p->syncp, start));
-			accum.rx_packets += rxpackets;
-			accum.rx_bytes   += rxbytes;
-			accum.rx_multicast += rxmulticast;
-			/* rx_errors is ulong, not protected by syncp */
-			accum.rx_errors  += p->rx_errors;
+
+			stats->rx_packets	+= rxpackets;
+			stats->rx_bytes		+= rxbytes;
+			stats->multicast	+= rxmulticast;
+			stats->tx_packets	+= txpackets;
+			stats->tx_bytes		+= txbytes;
+			/* rx_errors & tx_dropped are u32 */
+			rx_errors	+= p->rx_errors;
+			tx_dropped	+= p->tx_dropped;
 		}
-		stats->rx_packets = accum.rx_packets;
-		stats->rx_bytes   = accum.rx_bytes;
-		stats->rx_errors  = accum.rx_errors;
-		stats->multicast  = accum.rx_multicast;
+		stats->rx_errors  = rx_errors;
+		stats->tx_dropped = tx_dropped;
 	}
 	return stats;
 }
diff --git a/net/8021q/vlan_netlink.c b/net/8021q/vlan_netlink.c
index ddc1057..be9a5c1 100644
--- a/net/8021q/vlan_netlink.c
+++ b/net/8021q/vlan_netlink.c
@@ -101,25 +101,6 @@ static int vlan_changelink(struct net_device *dev,
 	return 0;
 }
 
-static int vlan_get_tx_queues(struct net *net,
-			      struct nlattr *tb[],
-			      unsigned int *num_tx_queues,
-			      unsigned int *real_num_tx_queues)
-{
-	struct net_device *real_dev;
-
-	if (!tb[IFLA_LINK])
-		return -EINVAL;
-
-	real_dev = __dev_get_by_index(net, nla_get_u32(tb[IFLA_LINK]));
-	if (!real_dev)
-		return -ENODEV;
-
-	*num_tx_queues      = real_dev->num_tx_queues;
-	*real_num_tx_queues = real_dev->real_num_tx_queues;
-	return 0;
-}
-
 static int vlan_newlink(struct net *src_net, struct net_device *dev,
 			struct nlattr *tb[], struct nlattr *data[])
 {
@@ -237,7 +218,6 @@ struct rtnl_link_ops vlan_link_ops __read_mostly = {
 	.maxtype	= IFLA_VLAN_MAX,
 	.policy		= vlan_policy,
 	.priv_size	= sizeof(struct vlan_dev_info),
-	.get_tx_queues  = vlan_get_tx_queues,
 	.setup		= vlan_setup,
 	.validate	= vlan_validate,
 	.newlink	= vlan_newlink,



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH net-next-2.6] vlan: lockless transmit path
  2010-11-11  9:42 [PATCH net-next-2.6] vlan: lockless transmit path Eric Dumazet
@ 2010-11-11 17:40 ` Jesse Gross
  2010-11-11 17:52   ` Eric Dumazet
  2010-11-16 19:24 ` [PATCH net-next-2.6] vlan: lockless transmit path David Miller
  1 sibling, 1 reply; 11+ messages in thread
From: Jesse Gross @ 2010-11-11 17:40 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev, Patrick McHardy

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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net-next-2.6] vlan: lockless transmit path
  2010-11-11 17:40 ` Jesse Gross
@ 2010-11-11 17:52   ` Eric Dumazet
  2010-11-11 18:56     ` Jesse Gross
  0 siblings, 1 reply; 11+ messages in thread
From: Eric Dumazet @ 2010-11-11 17:52 UTC (permalink / raw)
  To: Jesse Gross; +Cc: David Miller, netdev, Patrick McHardy

Le jeudi 11 novembre 2010 à 09:40 -0800, Jesse Gross a écrit :

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

Hmm, you refer to old kernels dont you ?

My patch is for net-next

The plan is that after last Tom Herbert patches, dev_pick_tx()  wont
call do_select_queue() on mono queue device.

http://patchwork.ozlabs.org/patch/70369/


This logicaly is a second cleanup patch I believe.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net-next-2.6] vlan: lockless transmit path
  2010-11-11 17:52   ` Eric Dumazet
@ 2010-11-11 18:56     ` Jesse Gross
  2010-11-11 19:42       ` [PATCH net-next-2.6] vlan: remove ndo_select_queue() logic Eric Dumazet
  0 siblings, 1 reply; 11+ messages in thread
From: Jesse Gross @ 2010-11-11 18:56 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev, Patrick McHardy

On Thu, Nov 11, 2010 at 9:52 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> Le jeudi 11 novembre 2010 à 09:40 -0800, Jesse Gross a écrit :
>
>> 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.
>
> Hmm, you refer to old kernels dont you ?
>
> My patch is for net-next

Well, I was referring to checked-in code.

>
> The plan is that after last Tom Herbert patches, dev_pick_tx()  wont
> call do_select_queue() on mono queue device.
>
> http://patchwork.ozlabs.org/patch/70369/

Before Tom's patch, a warning will be generated if a single queue vlan
device is stacked on top of a multiqueue physical device that
implements ndo_select_queue().  After Tom's patch, we avoid the
warning so vlan_dev_select_queue() is merely dead code.  Either way,
what's the benefit in keeping it?

>
>
> This logicaly is a second cleanup patch I believe.

I'm not arguing against your patch, I just think it should go a step further.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH net-next-2.6] vlan: remove ndo_select_queue() logic
  2010-11-11 18:56     ` Jesse Gross
@ 2010-11-11 19:42       ` Eric Dumazet
  2010-11-11 22:24         ` Jesse Gross
                           ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Eric Dumazet @ 2010-11-11 19:42 UTC (permalink / raw)
  To: Jesse Gross; +Cc: David Miller, netdev, Patrick McHardy

Le jeudi 11 novembre 2010 à 10:56 -0800, Jesse Gross a écrit :
> On Thu, Nov 11, 2010 at 9:52 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:

> Before Tom's patch, a warning will be generated if a single queue vlan
> device is stacked on top of a multiqueue physical device that
> implements ndo_select_queue().  After Tom's patch, we avoid the
> warning so vlan_dev_select_queue() is merely dead code.  Either way,
> what's the benefit in keeping it?
> 
> >
> >
> > This logicaly is a second cleanup patch I believe.
> 
> I'm not arguing against your patch, I just think it should go a step further.

Sure ! Here is the thing ;)

Thanks

[PATCH] vlan: remove ndo_select_queue() logic

Now vlan are lockless, we dont need special ndo_select_queue() logic.
dev_pick_tx() will do the multiqueue stuff on the real device transmit.

Suggested-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 net/8021q/vlan_dev.c |   71 +----------------------------------------
 1 files changed, 3 insertions(+), 68 deletions(-)

diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 3a67483..99d6910 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -390,14 +390,6 @@ static netdev_tx_t vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb,
 	return ret;
 }
 
-static u16 vlan_dev_select_queue(struct net_device *dev, struct sk_buff *skb)
-{
-	struct net_device *rdev = vlan_dev_info(dev)->real_dev;
-	const struct net_device_ops *ops = rdev->netdev_ops;
-
-	return ops->ndo_select_queue(rdev, skb);
-}
-
 static int vlan_dev_change_mtu(struct net_device *dev, int new_mtu)
 {
 	/* TODO: gotta make sure the underlying layer can handle it,
@@ -726,8 +718,7 @@ static const struct header_ops vlan_header_ops = {
 	.parse	 = eth_header_parse,
 };
 
-static const struct net_device_ops vlan_netdev_ops, vlan_netdev_accel_ops,
-		    vlan_netdev_ops_sq, vlan_netdev_accel_ops_sq;
+static const struct net_device_ops vlan_netdev_ops, vlan_netdev_accel_ops;
 
 static int vlan_dev_init(struct net_device *dev)
 {
@@ -763,17 +754,11 @@ static int vlan_dev_init(struct net_device *dev)
 	if (real_dev->features & NETIF_F_HW_VLAN_TX) {
 		dev->header_ops      = real_dev->header_ops;
 		dev->hard_header_len = real_dev->hard_header_len;
-		if (real_dev->netdev_ops->ndo_select_queue)
-			dev->netdev_ops = &vlan_netdev_accel_ops_sq;
-		else
-			dev->netdev_ops = &vlan_netdev_accel_ops;
+		dev->netdev_ops = &vlan_netdev_accel_ops;
 	} else {
 		dev->header_ops      = &vlan_header_ops;
 		dev->hard_header_len = real_dev->hard_header_len + VLAN_HLEN;
-		if (real_dev->netdev_ops->ndo_select_queue)
-			dev->netdev_ops = &vlan_netdev_ops_sq;
-		else
-			dev->netdev_ops = &vlan_netdev_ops;
+		dev->netdev_ops = &vlan_netdev_ops;
 	}
 
 	if (is_vlan_dev(real_dev))
@@ -944,56 +929,6 @@ static const struct net_device_ops vlan_netdev_accel_ops = {
 #endif
 };
 
-static const struct net_device_ops vlan_netdev_ops_sq = {
-	.ndo_select_queue	= vlan_dev_select_queue,
-	.ndo_change_mtu		= vlan_dev_change_mtu,
-	.ndo_init		= vlan_dev_init,
-	.ndo_uninit		= vlan_dev_uninit,
-	.ndo_open		= vlan_dev_open,
-	.ndo_stop		= vlan_dev_stop,
-	.ndo_start_xmit =  vlan_dev_hard_start_xmit,
-	.ndo_validate_addr	= eth_validate_addr,
-	.ndo_set_mac_address	= vlan_dev_set_mac_address,
-	.ndo_set_rx_mode	= vlan_dev_set_rx_mode,
-	.ndo_set_multicast_list	= vlan_dev_set_rx_mode,
-	.ndo_change_rx_flags	= vlan_dev_change_rx_flags,
-	.ndo_do_ioctl		= vlan_dev_ioctl,
-	.ndo_neigh_setup	= vlan_dev_neigh_setup,
-	.ndo_get_stats64	= vlan_dev_get_stats64,
-#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
-	.ndo_fcoe_ddp_setup	= vlan_dev_fcoe_ddp_setup,
-	.ndo_fcoe_ddp_done	= vlan_dev_fcoe_ddp_done,
-	.ndo_fcoe_enable	= vlan_dev_fcoe_enable,
-	.ndo_fcoe_disable	= vlan_dev_fcoe_disable,
-	.ndo_fcoe_get_wwn	= vlan_dev_fcoe_get_wwn,
-#endif
-};
-
-static const struct net_device_ops vlan_netdev_accel_ops_sq = {
-	.ndo_select_queue	= vlan_dev_select_queue,
-	.ndo_change_mtu		= vlan_dev_change_mtu,
-	.ndo_init		= vlan_dev_init,
-	.ndo_uninit		= vlan_dev_uninit,
-	.ndo_open		= vlan_dev_open,
-	.ndo_stop		= vlan_dev_stop,
-	.ndo_start_xmit =  vlan_dev_hwaccel_hard_start_xmit,
-	.ndo_validate_addr	= eth_validate_addr,
-	.ndo_set_mac_address	= vlan_dev_set_mac_address,
-	.ndo_set_rx_mode	= vlan_dev_set_rx_mode,
-	.ndo_set_multicast_list	= vlan_dev_set_rx_mode,
-	.ndo_change_rx_flags	= vlan_dev_change_rx_flags,
-	.ndo_do_ioctl		= vlan_dev_ioctl,
-	.ndo_neigh_setup	= vlan_dev_neigh_setup,
-	.ndo_get_stats64	= vlan_dev_get_stats64,
-#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
-	.ndo_fcoe_ddp_setup	= vlan_dev_fcoe_ddp_setup,
-	.ndo_fcoe_ddp_done	= vlan_dev_fcoe_ddp_done,
-	.ndo_fcoe_enable	= vlan_dev_fcoe_enable,
-	.ndo_fcoe_disable	= vlan_dev_fcoe_disable,
-	.ndo_fcoe_get_wwn	= vlan_dev_fcoe_get_wwn,
-#endif
-};
-
 void vlan_setup(struct net_device *dev)
 {
 	ether_setup(dev);



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH net-next-2.6] vlan: remove ndo_select_queue() logic
  2010-11-11 19:42       ` [PATCH net-next-2.6] vlan: remove ndo_select_queue() logic Eric Dumazet
@ 2010-11-11 22:24         ` Jesse Gross
  2010-11-12 15:50         ` Patrick McHardy
  2010-11-16 19:24         ` David Miller
  2 siblings, 0 replies; 11+ messages in thread
From: Jesse Gross @ 2010-11-11 22:24 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev, Patrick McHardy

On Thu, Nov 11, 2010 at 11:42 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> Le jeudi 11 novembre 2010 à 10:56 -0800, Jesse Gross a écrit :
>> On Thu, Nov 11, 2010 at 9:52 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
>> Before Tom's patch, a warning will be generated if a single queue vlan
>> device is stacked on top of a multiqueue physical device that
>> implements ndo_select_queue().  After Tom's patch, we avoid the
>> warning so vlan_dev_select_queue() is merely dead code.  Either way,
>> what's the benefit in keeping it?
>>
>> >
>> >
>> > This logicaly is a second cleanup patch I believe.
>>
>> I'm not arguing against your patch, I just think it should go a step further.
>
> Sure ! Here is the thing ;)
>
> Thanks
>
> [PATCH] vlan: remove ndo_select_queue() logic
>
> Now vlan are lockless, we dont need special ndo_select_queue() logic.
> dev_pick_tx() will do the multiqueue stuff on the real device transmit.
>
> Suggested-by: Jesse Gross <jesse@nicira.com>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Yes, that's what I was thinking of.  Thanks Eric.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net-next-2.6] vlan: remove ndo_select_queue() logic
  2010-11-11 19:42       ` [PATCH net-next-2.6] vlan: remove ndo_select_queue() logic Eric Dumazet
  2010-11-11 22:24         ` Jesse Gross
@ 2010-11-12 15:50         ` Patrick McHardy
  2010-11-16 19:24         ` David Miller
  2 siblings, 0 replies; 11+ messages in thread
From: Patrick McHardy @ 2010-11-12 15:50 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Jesse Gross, David Miller, netdev

Am 11.11.2010 20:42, schrieb Eric Dumazet:
> [PATCH] vlan: remove ndo_select_queue() logic
> 
> Now vlan are lockless, we dont need special ndo_select_queue() logic.
> dev_pick_tx() will do the multiqueue stuff on the real device transmit.
> 
> Suggested-by: Jesse Gross <jesse@nicira.com>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Both patches look good to me.

Acked-by: Patrick McHardy <kaber@trash.net>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net-next-2.6] vlan: lockless transmit path
  2010-11-11  9:42 [PATCH net-next-2.6] vlan: lockless transmit path Eric Dumazet
  2010-11-11 17:40 ` Jesse Gross
@ 2010-11-16 19:24 ` David Miller
  1 sibling, 0 replies; 11+ messages in thread
From: David Miller @ 2010-11-16 19:24 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, kaber

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 11 Nov 2010 10:42:00 +0100

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

Applied, although there were some conflicts since John Fastabend
made some vlan changes recently.

Please double check my work.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net-next-2.6] vlan: remove ndo_select_queue() logic
  2010-11-11 19:42       ` [PATCH net-next-2.6] vlan: remove ndo_select_queue() logic Eric Dumazet
  2010-11-11 22:24         ` Jesse Gross
  2010-11-12 15:50         ` Patrick McHardy
@ 2010-11-16 19:24         ` David Miller
  2010-11-16 19:54           ` Eric Dumazet
  2 siblings, 1 reply; 11+ messages in thread
From: David Miller @ 2010-11-16 19:24 UTC (permalink / raw)
  To: eric.dumazet; +Cc: jesse, netdev, kaber

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 11 Nov 2010 20:42:45 +0100

> [PATCH] vlan: remove ndo_select_queue() logic
> 
> Now vlan are lockless, we dont need special ndo_select_queue() logic.
> dev_pick_tx() will do the multiqueue stuff on the real device transmit.
> 
> Suggested-by: Jesse Gross <jesse@nicira.com>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Also applied, but again there were conflicts I had to resolve,
please check that I got it right.

Thanks.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net-next-2.6] vlan: remove ndo_select_queue() logic
  2010-11-16 19:24         ` David Miller
@ 2010-11-16 19:54           ` Eric Dumazet
  2010-11-17  4:12             ` John Fastabend
  0 siblings, 1 reply; 11+ messages in thread
From: Eric Dumazet @ 2010-11-16 19:54 UTC (permalink / raw)
  To: David Miller; +Cc: jesse, netdev, kaber

Le mardi 16 novembre 2010 à 11:24 -0800, David Miller a écrit :
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Thu, 11 Nov 2010 20:42:45 +0100
> 
> > [PATCH] vlan: remove ndo_select_queue() logic
> > 
> > Now vlan are lockless, we dont need special ndo_select_queue() logic.
> > dev_pick_tx() will do the multiqueue stuff on the real device transmit.
> > 
> > Suggested-by: Jesse Gross <jesse@nicira.com>
> > Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> 
> Also applied, but again there were conflicts I had to resolve,
> please check that I got it right.
> 

Both patches seem fine to me.

I am going to test them.

Thanks !



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net-next-2.6] vlan: remove ndo_select_queue() logic
  2010-11-16 19:54           ` Eric Dumazet
@ 2010-11-17  4:12             ` John Fastabend
  0 siblings, 0 replies; 11+ messages in thread
From: John Fastabend @ 2010-11-17  4:12 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, jesse, netdev, kaber

On 11/16/2010 11:54 AM, Eric Dumazet wrote:
> Le mardi 16 novembre 2010 à 11:24 -0800, David Miller a écrit :
>> From: Eric Dumazet <eric.dumazet@gmail.com>
>> Date: Thu, 11 Nov 2010 20:42:45 +0100
>>
>>> [PATCH] vlan: remove ndo_select_queue() logic
>>>
>>> Now vlan are lockless, we dont need special ndo_select_queue() logic.
>>> dev_pick_tx() will do the multiqueue stuff on the real device transmit.
>>>
>>> Suggested-by: Jesse Gross <jesse@nicira.com>
>>> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
>>
>> Also applied, but again there were conflicts I had to resolve,
>> please check that I got it right.
>>
> 
> Both patches seem fine to me.
> 
> I am going to test them.
> 
> Thanks !
> 
> 

Everything seems in order as far as I can tell. I've had io running over 50 VLANs for a few hours now. 

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-11-17  4:12 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-11  9:42 [PATCH net-next-2.6] vlan: lockless transmit path Eric Dumazet
2010-11-11 17:40 ` Jesse Gross
2010-11-11 17:52   ` Eric Dumazet
2010-11-11 18:56     ` Jesse Gross
2010-11-11 19:42       ` [PATCH net-next-2.6] vlan: remove ndo_select_queue() logic Eric Dumazet
2010-11-11 22:24         ` Jesse Gross
2010-11-12 15:50         ` Patrick McHardy
2010-11-16 19:24         ` David Miller
2010-11-16 19:54           ` Eric Dumazet
2010-11-17  4:12             ` John Fastabend
2010-11-16 19:24 ` [PATCH net-next-2.6] vlan: lockless transmit path David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.