All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/7] Stacked vlan TSO
@ 2015-03-26  5:01 Toshiaki Makita
  2015-03-26  5:01 ` [PATCH net-next 1/7] vlan: Add features for stacked vlan device Toshiaki Makita
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: Toshiaki Makita @ 2015-03-26  5:01 UTC (permalink / raw)
  To: David S . Miller, Patrick McHardy, Ariel Elior, Amir Vadai,
	Shahed Shaikh, Dept-GELinuxNICDev, Jay Vosburgh,
	Veaceslav Falico, Andy Gospodarek, Jiri Pirko, Linux NICS
  Cc: Vlad Yasevich, netdev, e1000-devel, Toshiaki Makita

On the basis of Netdev 0.1 discussion[1], I made a patch set to enable
TSO for packets with multiple vlans.

Currently, packets with multiple vlans are always segmented by software,
which is caused by that netif_skb_features() drops most feature flags
for multiple tagged packets.

To allow NICs to segment them, we need to get rid of that check from core.
Fortunately, recently introduced ndo_features_check() can be used to
move the check to each driver, and this patch set is based on the idea.

For the initial patch set, I chose 3 drivers, bonding, team, and igb, as
candidates to enable TSO. I tested them and confirmed they works fine
with this change.

Here are samples of performance test results. As I expected, %sys gets
pretty lower than before.

* TEST1: vlan (.1Q) on vlan (.1ad) on igb (I350)

- before

$ netperf -t TCP_STREAM -H 192.168.10.1 -l 60
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

 87380  16384  16384    60.02     933.72

Average:        CPU     %user     %nice   %system   %iowait    %steal     %idle
Average:        all      0.13      0.00     11.28      0.01      0.00     88.58

- after

$ netperf -t TCP_STREAM -H 192.168.10.1 -l 60
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

 87380  16384  16384    60.01     936.13

Average:        CPU     %user     %nice   %system   %iowait    %steal     %idle
Average:        all      0.24      0.00      4.17      0.01      0.00     95.58


* TEST2: vlan (.1Q) on bridge (.1ad vlan filtering) on team on igb (I350)

- before

$ netperf -t TCP_STREAM -H 192.168.10.1 -l 60
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

 87380  16384  16384    60.01     936.28

Average:        CPU     %user     %nice   %system   %iowait    %steal     %idle
Average:        all      0.41      0.00     11.57      0.01      0.00     88.01

- after

$ netperf -t TCP_STREAM -H 192.168.10.1 -l 60
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

 87380  16384  16384    60.02     935.72

Average:        CPU     %user     %nice   %system   %iowait    %steal     %idle
Average:        all      0.14      0.00      7.66      0.01      0.00     92.19


In addition to above, I tested these configurations:
- vlan (.1Q) on vlan (1.ad) on bonding on igb (I350)
- vlan (.1Q) on vlan (1.Q) on igb (I350)
- vlan (.1Q) on vlan (1.Q) on team on igb (I350)
And didn't find any problem.


[1] https://netdev01.org/sessions/18
    https://netdev01.org/docs/netdev01_bof_8021ad_makita_150212.pdf

Toshiaki Makita (7):
  vlan: Add features for stacked vlan device
  vlan: Introduce helper functions to check if skb is tagged
  net: Move check for multiple vlans to drivers
  net: Introduce passthru_features_check
  bonding: Don't segment multiple tagged packets on bonding device
  team: Don't segment multiple tagged packets on team device
  igb: Enable TSO for stacked vlan

 drivers/net/bonding/bond_main.c                  |  1 +
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |  1 +
 drivers/net/ethernet/intel/igb/igb_main.c        |  1 +
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c   |  1 +
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c |  1 +
 drivers/net/team/team.c                          |  1 +
 include/linux/if_vlan.h                          | 67 ++++++++++++++++++++++++
 include/linux/netdevice.h                        |  3 ++
 net/8021q/vlan_dev.c                             |  1 +
 net/core/dev.c                                   | 41 +++++++--------
 10 files changed, 96 insertions(+), 22 deletions(-)

-- 
1.8.1.2



------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired

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

* [PATCH net-next 1/7] vlan: Add features for stacked vlan device
  2015-03-26  5:01 [PATCH net-next 0/7] Stacked vlan TSO Toshiaki Makita
@ 2015-03-26  5:01 ` Toshiaki Makita
  2015-03-26  5:01 ` [PATCH net-next 2/7] vlan: Introduce helper functions to check if skb is tagged Toshiaki Makita
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Toshiaki Makita @ 2015-03-26  5:01 UTC (permalink / raw)
  To: David S . Miller, Patrick McHardy, Ariel Elior, Amir Vadai,
	Shahed Shaikh, Dept-GELinuxNICDev, Jay Vosburgh,
	Veaceslav Falico, Andy Gospodarek, Jiri Pirko, Linux NICS
  Cc: Vlad Yasevich, netdev, e1000-devel, Toshiaki Makita

Stacked vlan devices curretly have few features (GRO, HIGHDMA, LLTX).
Since we have software fallbacks in case the NIC can not handle some
features for multiple vlans, we can add the same features as the lower
vlan devices for stacked vlan devices.

This allows stacked vlan devices to create large (GSO) packets and not to
segment packets. Those packets will be segmented by software on the real
device, or even can be segmented by the NIC once TSO for multiple vlans
becomes enabled by the following patches.

The exception is those related to FCoE, which does not have a software
fallback.

Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
---
 net/8021q/vlan_dev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index f196552..8b5ab90 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -554,6 +554,7 @@ static int vlan_dev_init(struct net_device *dev)
 	if (dev->features & NETIF_F_VLAN_FEATURES)
 		netdev_warn(real_dev, "VLAN features are set incorrectly.  Q-in-Q configurations may not work correctly.\n");
 
+	dev->vlan_features = real_dev->vlan_features & ~NETIF_F_ALL_FCOE;
 
 	/* ipv6 shared card related stuff */
 	dev->dev_id = real_dev->dev_id;
-- 
1.8.1.2



------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

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

* [PATCH net-next 2/7] vlan: Introduce helper functions to check if skb is tagged
  2015-03-26  5:01 [PATCH net-next 0/7] Stacked vlan TSO Toshiaki Makita
  2015-03-26  5:01 ` [PATCH net-next 1/7] vlan: Add features for stacked vlan device Toshiaki Makita
@ 2015-03-26  5:01 ` Toshiaki Makita
  2015-03-26 11:53   ` Eric Dumazet
  2015-03-26  5:01 ` [PATCH net-next 3/7] net: Move check for multiple vlans to drivers Toshiaki Makita
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 12+ messages in thread
From: Toshiaki Makita @ 2015-03-26  5:01 UTC (permalink / raw)
  To: David S . Miller, Patrick McHardy, Ariel Elior, Amir Vadai,
	Shahed Shaikh, Dept-GELinuxNICDev, Jay Vosburgh,
	Veaceslav Falico, Andy Gospodarek, Jiri Pirko, Linux NICS
  Cc: Vlad Yasevich, netdev, e1000-devel, Toshiaki Makita

Separate the two checks for single vlan and multiple vlans in
netif_skb_features().  This allows us to move the check for multiple
vlans to another function later.

Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
---
 include/linux/if_vlan.h | 45 +++++++++++++++++++++++++++++++++++++++++++++
 net/core/dev.c          | 24 ++++++++----------------
 2 files changed, 53 insertions(+), 16 deletions(-)

diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index b11b28a..bc649dd 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -561,4 +561,49 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb,
 		skb->protocol = htons(ETH_P_802_2);
 }
 
+/**
+ * skb_vlan_tagged - check if skb is vlan tagged.
+ * @skb: skbuff to query
+ *
+ * Returns true if the skb is tagged, regardless of whether it is hardware
+ * accelerated or not.
+ */
+static inline bool skb_vlan_tagged(struct sk_buff *skb)
+{
+	if (!skb_vlan_tag_present(skb) &&
+	    likely(skb->protocol != htons(ETH_P_8021Q) &&
+		   skb->protocol != htons(ETH_P_8021AD)))
+		return false;
+
+	return true;
+}
+
+/**
+ * skb_vlan_tagged_multi - check if skb is vlan tagged with multiple headers.
+ * @skb: skbuff to query
+ *
+ * Returns true if the skb is tagged with multiple vlan headers, regardless
+ * of whether it is hardware accelerated or not.
+ */
+static inline bool skb_vlan_tagged_multi(struct sk_buff *skb)
+{
+	__be16 protocol = skb->protocol;
+
+	if (!skb_vlan_tag_present(skb)) {
+		struct vlan_ethhdr *veh;
+
+		if (likely(protocol != htons(ETH_P_8021Q) &&
+			   protocol != htons(ETH_P_8021AD)))
+			return false;
+
+		veh = (struct vlan_ethhdr *)skb->data;
+		protocol = veh->h_vlan_encapsulated_proto;
+	}
+
+	if (protocol != htons(ETH_P_8021Q) && protocol != htons(ETH_P_8021AD))
+		return false;
+
+	return true;
+}
+
 #endif /* !(_LINUX_IF_VLAN_H_) */
diff --git a/net/core/dev.c b/net/core/dev.c
index a0408d4..04bffcd 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2567,7 +2567,6 @@ netdev_features_t netif_skb_features(struct sk_buff *skb)
 	struct net_device *dev = skb->dev;
 	netdev_features_t features = dev->features;
 	u16 gso_segs = skb_shinfo(skb)->gso_segs;
-	__be16 protocol = skb->protocol;
 
 	if (gso_segs > dev->gso_max_segs || gso_segs < dev->gso_min_segs)
 		features &= ~NETIF_F_GSO_MASK;
@@ -2579,22 +2578,15 @@ netdev_features_t netif_skb_features(struct sk_buff *skb)
 	if (skb->encapsulation)
 		features &= dev->hw_enc_features;
 
-	if (!skb_vlan_tag_present(skb)) {
-		if (unlikely(protocol == htons(ETH_P_8021Q) ||
-			     protocol == htons(ETH_P_8021AD))) {
-			struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;
-			protocol = veh->h_vlan_encapsulated_proto;
-		} else {
-			goto finalize;
-		}
-	}
-
-	features = netdev_intersect_features(features,
-					     dev->vlan_features |
-					     NETIF_F_HW_VLAN_CTAG_TX |
-					     NETIF_F_HW_VLAN_STAG_TX);
+	if (skb_vlan_tagged(skb))
+		features = netdev_intersect_features(features,
+						     dev->vlan_features |
+						     NETIF_F_HW_VLAN_CTAG_TX |
+						     NETIF_F_HW_VLAN_STAG_TX);
+	else
+		goto finalize;
 
-	if (protocol == htons(ETH_P_8021Q) || protocol == htons(ETH_P_8021AD))
+	if (skb_vlan_tagged_multi(skb))
 		features = netdev_intersect_features(features,
 						     NETIF_F_SG |
 						     NETIF_F_HIGHDMA |
-- 
1.8.1.2



------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

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

* [PATCH net-next 3/7] net: Move check for multiple vlans to drivers
  2015-03-26  5:01 [PATCH net-next 0/7] Stacked vlan TSO Toshiaki Makita
  2015-03-26  5:01 ` [PATCH net-next 1/7] vlan: Add features for stacked vlan device Toshiaki Makita
  2015-03-26  5:01 ` [PATCH net-next 2/7] vlan: Introduce helper functions to check if skb is tagged Toshiaki Makita
@ 2015-03-26  5:01 ` Toshiaki Makita
  2015-03-26 11:55   ` Eric Dumazet
  2015-03-26  5:01 ` [PATCH net-next 4/7] net: Introduce passthru_features_check Toshiaki Makita
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 12+ messages in thread
From: Toshiaki Makita @ 2015-03-26  5:01 UTC (permalink / raw)
  To: David S . Miller, Patrick McHardy, Ariel Elior, Amir Vadai,
	Shahed Shaikh, Dept-GELinuxNICDev, Jay Vosburgh,
	Veaceslav Falico, Andy Gospodarek, Jiri Pirko, Linux NICS
  Cc: Vlad Yasevich, netdev, e1000-devel, Toshiaki Makita

To allow drivers to handle the features check for multiple tags,
move the check to ndo_features_check().
As no drivers currently handle multiple tagged TSO, introduce
dflt_features_check() and call it if the driver does not have
ndo_features_check().

Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |  1 +
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c   |  1 +
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c |  1 +
 include/linux/if_vlan.h                          | 22 ++++++++++++++++++++++
 net/core/dev.c                                   | 21 +++++++++------------
 5 files changed, 34 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 9677431..039b0c1 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -12557,6 +12557,7 @@ static netdev_features_t bnx2x_features_check(struct sk_buff *skb,
 					      struct net_device *dev,
 					      netdev_features_t features)
 {
+	features = vlan_features_check(skb, features);
 	return vxlan_features_check(skb, features);
 }
 
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index a8339e9..ebc93a1 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -2373,6 +2373,7 @@ static netdev_features_t mlx4_en_features_check(struct sk_buff *skb,
 						struct net_device *dev,
 						netdev_features_t features)
 {
+	features = vlan_features_check(skb, features);
 	return vxlan_features_check(skb, features);
 }
 #endif
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index a430a34a..367f397 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -507,6 +507,7 @@ static netdev_features_t qlcnic_features_check(struct sk_buff *skb,
 					       struct net_device *dev,
 					       netdev_features_t features)
 {
+	features = vlan_features_check(skb, features);
 	return vxlan_features_check(skb, features);
 }
 #endif
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index bc649dd..5ceb38f 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -606,4 +606,26 @@ static inline bool skb_vlan_tagged_multi(struct sk_buff *skb)
 	return true;
 }
 
+/**
+ * vlan_features_check - drop unsafe features for skb with multiple tags.
+ * @skb: skbuff to query
+ * @features: features to be checked
+ *
+ * Returns features without unsafe ones if the skb has multiple tags.
+ */
+static inline netdev_features_t vlan_features_check(struct sk_buff *skb,
+						    netdev_features_t features)
+{
+	if (skb_vlan_tagged_multi(skb))
+		features = netdev_intersect_features(features,
+						     NETIF_F_SG |
+						     NETIF_F_HIGHDMA |
+						     NETIF_F_FRAGLIST |
+						     NETIF_F_GEN_CSUM |
+						     NETIF_F_HW_VLAN_CTAG_TX |
+						     NETIF_F_HW_VLAN_STAG_TX);
+
+	return features;
+}
+
 #endif /* !(_LINUX_IF_VLAN_H_) */
diff --git a/net/core/dev.c b/net/core/dev.c
index 04bffcd..41d0db55 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2562,6 +2562,13 @@ static netdev_features_t harmonize_features(struct sk_buff *skb,
 	return features;
 }
 
+static netdev_features_t dflt_features_check(struct sk_buff *skb,
+					     struct net_device *dev,
+					     netdev_features_t features)
+{
+	return vlan_features_check(skb, features);
+}
+
 netdev_features_t netif_skb_features(struct sk_buff *skb)
 {
 	struct net_device *dev = skb->dev;
@@ -2583,22 +2590,12 @@ netdev_features_t netif_skb_features(struct sk_buff *skb)
 						     dev->vlan_features |
 						     NETIF_F_HW_VLAN_CTAG_TX |
 						     NETIF_F_HW_VLAN_STAG_TX);
-	else
-		goto finalize;
 
-	if (skb_vlan_tagged_multi(skb))
-		features = netdev_intersect_features(features,
-						     NETIF_F_SG |
-						     NETIF_F_HIGHDMA |
-						     NETIF_F_FRAGLIST |
-						     NETIF_F_GEN_CSUM |
-						     NETIF_F_HW_VLAN_CTAG_TX |
-						     NETIF_F_HW_VLAN_STAG_TX);
-
-finalize:
 	if (dev->netdev_ops->ndo_features_check)
 		features &= dev->netdev_ops->ndo_features_check(skb, dev,
 								features);
+	else
+		features &= dflt_features_check(skb, dev, features);
 
 	return harmonize_features(skb, features);
 }
-- 
1.8.1.2



------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

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

* [PATCH net-next 4/7] net: Introduce passthru_features_check
  2015-03-26  5:01 [PATCH net-next 0/7] Stacked vlan TSO Toshiaki Makita
                   ` (2 preceding siblings ...)
  2015-03-26  5:01 ` [PATCH net-next 3/7] net: Move check for multiple vlans to drivers Toshiaki Makita
@ 2015-03-26  5:01 ` Toshiaki Makita
  2015-03-26  5:01 ` [PATCH net-next 5/7] bonding: Don't segment multiple tagged packets on bonding device Toshiaki Makita
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Toshiaki Makita @ 2015-03-26  5:01 UTC (permalink / raw)
  To: David S . Miller, Patrick McHardy, Ariel Elior, Amir Vadai,
	Shahed Shaikh, Dept-GELinuxNICDev, Jay Vosburgh,
	Veaceslav Falico, Andy Gospodarek, Jiri Pirko, Linux NICS
  Cc: Vlad Yasevich, netdev, e1000-devel, Toshiaki Makita

As there are a number of (especially virtual) devices that don't
need the multiple vlan check, introduce passthru_features_check() for
convenience.

Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
---
 include/linux/netdevice.h | 3 +++
 net/core/dev.c            | 8 ++++++++
 2 files changed, 11 insertions(+)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 08c4ab3..967bb4c 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3657,6 +3657,9 @@ void netdev_change_features(struct net_device *dev);
 void netif_stacked_transfer_operstate(const struct net_device *rootdev,
 					struct net_device *dev);
 
+netdev_features_t passthru_features_check(struct sk_buff *skb,
+					  struct net_device *dev,
+					  netdev_features_t features);
 netdev_features_t netif_skb_features(struct sk_buff *skb);
 
 static inline bool net_gso_ok(netdev_features_t features, int gso_type)
diff --git a/net/core/dev.c b/net/core/dev.c
index 41d0db55..b4cc929 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2562,6 +2562,14 @@ static netdev_features_t harmonize_features(struct sk_buff *skb,
 	return features;
 }
 
+netdev_features_t passthru_features_check(struct sk_buff *skb,
+					  struct net_device *dev,
+					  netdev_features_t features)
+{
+	return features;
+}
+EXPORT_SYMBOL(passthru_features_check);
+
 static netdev_features_t dflt_features_check(struct sk_buff *skb,
 					     struct net_device *dev,
 					     netdev_features_t features)
-- 
1.8.1.2



------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

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

* [PATCH net-next 5/7] bonding: Don't segment multiple tagged packets on bonding device
  2015-03-26  5:01 [PATCH net-next 0/7] Stacked vlan TSO Toshiaki Makita
                   ` (3 preceding siblings ...)
  2015-03-26  5:01 ` [PATCH net-next 4/7] net: Introduce passthru_features_check Toshiaki Makita
@ 2015-03-26  5:01 ` Toshiaki Makita
  2015-03-26  5:01 ` [PATCH net-next 6/7] team: Don't segment multiple tagged packets on team device Toshiaki Makita
  2015-03-26  5:01 ` [PATCH net-next 7/7] igb: Enable TSO for stacked vlan Toshiaki Makita
  6 siblings, 0 replies; 12+ messages in thread
From: Toshiaki Makita @ 2015-03-26  5:01 UTC (permalink / raw)
  To: David S . Miller, Patrick McHardy, Ariel Elior, Amir Vadai,
	Shahed Shaikh, Dept-GELinuxNICDev, Jay Vosburgh,
	Veaceslav Falico, Andy Gospodarek, Jiri Pirko, Linux NICS
  Cc: Vlad Yasevich, netdev, e1000-devel, Toshiaki Makita

Bonding devices don't need to segment multiple tagged packets since their
slaves can segment them.

Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
---
 drivers/net/bonding/bond_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index c026ce9..7b4684c 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4038,6 +4038,7 @@ static const struct net_device_ops bond_netdev_ops = {
 	.ndo_fix_features	= bond_fix_features,
 	.ndo_bridge_setlink	= ndo_dflt_netdev_switch_port_bridge_setlink,
 	.ndo_bridge_dellink	= ndo_dflt_netdev_switch_port_bridge_dellink,
+	.ndo_features_check	= passthru_features_check,
 };
 
 static const struct device_type bond_type = {
-- 
1.8.1.2



------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

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

* [PATCH net-next 6/7] team: Don't segment multiple tagged packets on team device
  2015-03-26  5:01 [PATCH net-next 0/7] Stacked vlan TSO Toshiaki Makita
                   ` (4 preceding siblings ...)
  2015-03-26  5:01 ` [PATCH net-next 5/7] bonding: Don't segment multiple tagged packets on bonding device Toshiaki Makita
@ 2015-03-26  5:01 ` Toshiaki Makita
  2015-03-26  5:01 ` [PATCH net-next 7/7] igb: Enable TSO for stacked vlan Toshiaki Makita
  6 siblings, 0 replies; 12+ messages in thread
From: Toshiaki Makita @ 2015-03-26  5:01 UTC (permalink / raw)
  To: David S . Miller, Patrick McHardy, Ariel Elior, Amir Vadai,
	Shahed Shaikh, Dept-GELinuxNICDev, Jay Vosburgh,
	Veaceslav Falico, Andy Gospodarek, Jiri Pirko, Linux NICS
  Cc: Vlad Yasevich, netdev, e1000-devel, Toshiaki Makita

Team devices don't need to segment multiple tagged packets since their
slaves can segment them.

Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
---
 drivers/net/team/team.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index a23319f..6928448 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -1979,6 +1979,7 @@ static const struct net_device_ops team_netdev_ops = {
 	.ndo_change_carrier     = team_change_carrier,
 	.ndo_bridge_setlink     = ndo_dflt_netdev_switch_port_bridge_setlink,
 	.ndo_bridge_dellink     = ndo_dflt_netdev_switch_port_bridge_dellink,
+	.ndo_features_check	= passthru_features_check,
 };
 
 /***********************
-- 
1.8.1.2



------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

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

* [PATCH net-next 7/7] igb: Enable TSO for stacked vlan
  2015-03-26  5:01 [PATCH net-next 0/7] Stacked vlan TSO Toshiaki Makita
                   ` (5 preceding siblings ...)
  2015-03-26  5:01 ` [PATCH net-next 6/7] team: Don't segment multiple tagged packets on team device Toshiaki Makita
@ 2015-03-26  5:01 ` Toshiaki Makita
  2015-03-27  4:48   ` [linux-nics] " Jeff Kirsher
  6 siblings, 1 reply; 12+ messages in thread
From: Toshiaki Makita @ 2015-03-26  5:01 UTC (permalink / raw)
  To: David S . Miller, Patrick McHardy, Ariel Elior, Amir Vadai,
	Shahed Shaikh, Dept-GELinuxNICDev, Jay Vosburgh,
	Veaceslav Falico, Andy Gospodarek, Jiri Pirko, Linux NICS
  Cc: Vlad Yasevich, netdev, e1000-devel, Toshiaki Makita

As datasheets for igb (I210, I350, 82576, etc.) say, maclen can be from
14 to 127, which is enough for reasonable number of vlan tags.
My netperf test showed I350's TSO works pretty fine with multiple vlans.

Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
---
 drivers/net/ethernet/intel/igb/igb_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 0e07545..8457d03 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -2093,6 +2093,7 @@ static const struct net_device_ops igb_netdev_ops = {
 #endif
 	.ndo_fix_features	= igb_fix_features,
 	.ndo_set_features	= igb_set_features,
+	.ndo_features_check	= passthru_features_check,
 };
 
 /**
-- 
1.8.1.2



------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

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

* Re: [PATCH net-next 2/7] vlan: Introduce helper functions to check if skb is tagged
  2015-03-26  5:01 ` [PATCH net-next 2/7] vlan: Introduce helper functions to check if skb is tagged Toshiaki Makita
@ 2015-03-26 11:53   ` Eric Dumazet
  0 siblings, 0 replies; 12+ messages in thread
From: Eric Dumazet @ 2015-03-26 11:53 UTC (permalink / raw)
  To: Toshiaki Makita
  Cc: David S . Miller, Patrick McHardy, Ariel Elior, Amir Vadai,
	Shahed Shaikh, Dept-GELinuxNICDev, Jay Vosburgh,
	Veaceslav Falico, Andy Gospodarek, Jiri Pirko, Linux NICS,
	Vlad Yasevich, netdev, e1000-devel

On Thu, 2015-03-26 at 14:01 +0900, Toshiaki Makita wrote:
> Separate the two checks for single vlan and multiple vlans in
> netif_skb_features().  This allows us to move the check for multiple
> vlans to another function later.
> 
> Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
> ---
>  include/linux/if_vlan.h | 45 +++++++++++++++++++++++++++++++++++++++++++++
>  net/core/dev.c          | 24 ++++++++----------------
>  2 files changed, 53 insertions(+), 16 deletions(-)
> 
> diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
> index b11b28a..bc649dd 100644
> --- a/include/linux/if_vlan.h
> +++ b/include/linux/if_vlan.h
> @@ -561,4 +561,49 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb,
>  		skb->protocol = htons(ETH_P_802_2);
>  }
>  
> +/**
> + * skb_vlan_tagged - check if skb is vlan tagged.
> + * @skb: skbuff to query
> + *
> + * Returns true if the skb is tagged, regardless of whether it is hardware
> + * accelerated or not.
> + */
> +static inline bool skb_vlan_tagged(struct sk_buff *skb)

const struct sk_buff *skb

> +{
> +	if (!skb_vlan_tag_present(skb) &&
> +	    likely(skb->protocol != htons(ETH_P_8021Q) &&
> +		   skb->protocol != htons(ETH_P_8021AD)))
> +		return false;
> +
> +	return true;
> +}
> +
> +/**
> + * skb_vlan_tagged_multi - check if skb is vlan tagged with multiple headers.
> + * @skb: skbuff to query
> + *
> + * Returns true if the skb is tagged with multiple vlan headers, regardless
> + * of whether it is hardware accelerated or not.
> + */
> +static inline bool skb_vlan_tagged_multi(struct sk_buff *skb)


const struct sk_buff *skb

> +{
> +	__be16 protocol = skb->protocol;
> +
> +	if (!skb_vlan_tag_present(skb)) {
> +		struct vlan_ethhdr *veh;
> +
> +		if (likely(protocol != htons(ETH_P_8021Q) &&
> +			   protocol != htons(ETH_P_8021AD)))
> +			return false;
> +
> +		veh = (struct vlan_ethhdr *)skb->data;
> +		protocol = veh->h_vlan_encapsulated_proto;
> +	}
> +
> +	if (protocol != htons(ETH_P_8021Q) && protocol != htons(ETH_P_8021AD))
> +		return false;
> +
> +	return true;
> +}
> +

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

* Re: [PATCH net-next 3/7] net: Move check for multiple vlans to drivers
  2015-03-26  5:01 ` [PATCH net-next 3/7] net: Move check for multiple vlans to drivers Toshiaki Makita
@ 2015-03-26 11:55   ` Eric Dumazet
  2015-03-27  5:28     ` Toshiaki Makita
  0 siblings, 1 reply; 12+ messages in thread
From: Eric Dumazet @ 2015-03-26 11:55 UTC (permalink / raw)
  To: Toshiaki Makita
  Cc: David S . Miller, Patrick McHardy, Ariel Elior, Amir Vadai,
	Shahed Shaikh, Dept-GELinuxNICDev, Jay Vosburgh,
	Veaceslav Falico, Andy Gospodarek, Jiri Pirko, Linux NICS,
	Vlad Yasevich, netdev, e1000-devel

On Thu, 2015-03-26 at 14:01 +0900, Toshiaki Makita wrote:
> To allow drivers to handle the features check for multiple tags,
> move the check to ndo_features_check().
> As no drivers currently handle multiple tagged TSO, introduce
> dflt_features_check() and call it if the driver does not have
> ndo_features_check().
> 
> Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
> ---


> diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
> index bc649dd..5ceb38f 100644
> --- a/include/linux/if_vlan.h
> +++ b/include/linux/if_vlan.h
> @@ -606,4 +606,26 @@ static inline bool skb_vlan_tagged_multi(struct sk_buff *skb)
>  	return true;
>  }
>  
> +/**
> + * vlan_features_check - drop unsafe features for skb with multiple tags.
> + * @skb: skbuff to query
> + * @features: features to be checked
> + *
> + * Returns features without unsafe ones if the skb has multiple tags.
> + */
> +static inline netdev_features_t vlan_features_check(struct sk_buff *skb,

const struct sk_buff *skb

> +						    netdev_features_t features)
> +{
> +	if (skb_vlan_tagged_multi(skb))
> +		features = netdev_intersect_features(features,
> +						     NETIF_F_SG |
> +						     NETIF_F_HIGHDMA |
> +						     NETIF_F_FRAGLIST |
> +						     NETIF_F_GEN_CSUM |
> +						     NETIF_F_HW_VLAN_CTAG_TX |
> +						     NETIF_F_HW_VLAN_STAG_TX);
> +
> +	return features;
> +}
> +
>  #endif /* !(_LINUX_IF_VLAN_H_) */
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 04bffcd..41d0db55 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -2562,6 +2562,13 @@ static netdev_features_t harmonize_features(struct sk_buff *skb,
>  	return features;
>  }
>  
> +static netdev_features_t dflt_features_check(struct sk_buff *skb,

const struct sk_buff *skb

> +					     struct net_device *dev,
> +					     netdev_features_t features)
> +{
> +	return vlan_features_check(skb, features);
> +}
> +

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

* Re: [linux-nics] [PATCH net-next 7/7] igb: Enable TSO for stacked vlan
  2015-03-26  5:01 ` [PATCH net-next 7/7] igb: Enable TSO for stacked vlan Toshiaki Makita
@ 2015-03-27  4:48   ` Jeff Kirsher
  0 siblings, 0 replies; 12+ messages in thread
From: Jeff Kirsher @ 2015-03-27  4:48 UTC (permalink / raw)
  To: Toshiaki Makita
  Cc: David S . Miller, Patrick McHardy, Ariel Elior, Amir Vadai,
	Shahed Shaikh, Dept-GELinuxNICDev, Jay Vosburgh,
	Veaceslav Falico, Andy Gospodarek, Jiri Pirko, Linux NICS,
	Vlad Yasevich, netdev, e1000-devel

[-- Attachment #1: Type: text/plain, Size: 508 bytes --]

On Thu, 2015-03-26 at 14:01 +0900, Toshiaki Makita wrote:
> As datasheets for igb (I210, I350, 82576, etc.) say, maclen can be
> from
> 14 to 127, which is enough for reasonable number of vlan tags.
> My netperf test showed I350's TSO works pretty fine with multiple
> vlans.
> 
> Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>

Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

> ---
>  drivers/net/ethernet/intel/igb/igb_main.c | 1 +
>  1 file changed, 1 insertion(+)



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH net-next 3/7] net: Move check for multiple vlans to drivers
  2015-03-26 11:55   ` Eric Dumazet
@ 2015-03-27  5:28     ` Toshiaki Makita
  0 siblings, 0 replies; 12+ messages in thread
From: Toshiaki Makita @ 2015-03-27  5:28 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Vlad Yasevich, Jiri Pirko, Shahed Shaikh, e1000-devel,
	Jay Vosburgh, Amir Vadai, Patrick McHardy, netdev,
	Veaceslav Falico, Ariel Elior, Andy Gospodarek, Linux NICS,
	Dept-GELinuxNICDev, David S . Miller

On 2015/03/26 20:55, Eric Dumazet wrote:
...
>> +/**
>> + * vlan_features_check - drop unsafe features for skb with multiple tags.
>> + * @skb: skbuff to query
>> + * @features: features to be checked
>> + *
>> + * Returns features without unsafe ones if the skb has multiple tags.
>> + */
>> +static inline netdev_features_t vlan_features_check(struct sk_buff *skb,
> 
> const struct sk_buff *skb
> 
>> +						    netdev_features_t features)
>> +{
>> +	if (skb_vlan_tagged_multi(skb))
...
>> @@ -2562,6 +2562,13 @@ static netdev_features_t harmonize_features(struct sk_buff *skb,
>>  	return features;
>>  }
>>  
>> +static netdev_features_t dflt_features_check(struct sk_buff *skb,
> 
> const struct sk_buff *skb

Thank you, I fixed them and your another feedback for patch 2.
will send v2.

Toshiaki Makita


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

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

end of thread, other threads:[~2015-03-27  5:28 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-26  5:01 [PATCH net-next 0/7] Stacked vlan TSO Toshiaki Makita
2015-03-26  5:01 ` [PATCH net-next 1/7] vlan: Add features for stacked vlan device Toshiaki Makita
2015-03-26  5:01 ` [PATCH net-next 2/7] vlan: Introduce helper functions to check if skb is tagged Toshiaki Makita
2015-03-26 11:53   ` Eric Dumazet
2015-03-26  5:01 ` [PATCH net-next 3/7] net: Move check for multiple vlans to drivers Toshiaki Makita
2015-03-26 11:55   ` Eric Dumazet
2015-03-27  5:28     ` Toshiaki Makita
2015-03-26  5:01 ` [PATCH net-next 4/7] net: Introduce passthru_features_check Toshiaki Makita
2015-03-26  5:01 ` [PATCH net-next 5/7] bonding: Don't segment multiple tagged packets on bonding device Toshiaki Makita
2015-03-26  5:01 ` [PATCH net-next 6/7] team: Don't segment multiple tagged packets on team device Toshiaki Makita
2015-03-26  5:01 ` [PATCH net-next 7/7] igb: Enable TSO for stacked vlan Toshiaki Makita
2015-03-27  4:48   ` [linux-nics] " Jeff Kirsher

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.