All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC 0/2] Support MPLS features in bonding and vlan net devices
@ 2019-05-24 22:27 Ariel Levkovich
  2019-05-24 22:27 ` [PATCH RFC 1/2] net: bonding: Inherit MPLS features from slave devices Ariel Levkovich
  2019-05-24 22:27 ` [PATCH RFC 2/2] net: vlan: Inherit MPLS features from parent device Ariel Levkovich
  0 siblings, 2 replies; 3+ messages in thread
From: Ariel Levkovich @ 2019-05-24 22:27 UTC (permalink / raw)
  To: netdev; +Cc: Ariel Levkovich

Netdevice HW MPLS features are not passed from device driver's netdevice to
upper netdevice, specifically VLAN and bonding netdevice which are created
by the kernel when needed.

This prevents enablement and usage of HW offloads, such as TSO and checksumming
for MPLS tagged traffic when running via VLAN or bonding interface.

The patches introduce changes to the initialization steps of the VLAN and bonding
netdevices to inherit the MPLS features from lower netdevices to allow the HW
offloads.

Ariel Levkovich (2):
  net: bonding: Inherit MPLS features from slave devices
  net: vlan: Inherit MPLS features from parent device

 drivers/net/bonding/bond_main.c | 11 +++++++++++
 net/8021q/vlan_dev.c            |  1 +
 2 files changed, 12 insertions(+)

-- 
1.8.3.1


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

* [PATCH RFC 1/2] net: bonding: Inherit MPLS features from slave devices
  2019-05-24 22:27 [PATCH RFC 0/2] Support MPLS features in bonding and vlan net devices Ariel Levkovich
@ 2019-05-24 22:27 ` Ariel Levkovich
  2019-05-24 22:27 ` [PATCH RFC 2/2] net: vlan: Inherit MPLS features from parent device Ariel Levkovich
  1 sibling, 0 replies; 3+ messages in thread
From: Ariel Levkovich @ 2019-05-24 22:27 UTC (permalink / raw)
  To: netdev; +Cc: Ariel Levkovich, Jay Vosburgh, Veaceslav Falico, Andy Gospodarek

When setting the bonding interface net device features,
the kernel code doesn't address the slaves' MPLS features
and doesn't inherit them.

Therefore, HW offloads that enhance performance such as
checksumming and TSO are disabled for MPLS tagged traffic
flowing via the bonding interface.

The patch add the inheritance of the MPLS features from the
slave devices with a similar logic to setting the bonding device's
VLAN and encapsulation features.

CC: Jay Vosburgh <j.vosburgh@gmail.com>
CC: Veaceslav Falico <vfalico@gmail.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Ariel Levkovich <lariel@mellanox.com>
---
 drivers/net/bonding/bond_main.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 062fa7e..46b5f6d 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1077,12 +1077,16 @@ static netdev_features_t bond_fix_features(struct net_device *dev,
 #define BOND_ENC_FEATURES	(NETIF_F_HW_CSUM | NETIF_F_SG | \
 				 NETIF_F_RXCSUM | NETIF_F_ALL_TSO)
 
+#define BOND_MPLS_FEATURES	(NETIF_F_HW_CSUM | NETIF_F_SG | \
+				 NETIF_F_ALL_TSO)
+
 static void bond_compute_features(struct bonding *bond)
 {
 	unsigned int dst_release_flag = IFF_XMIT_DST_RELEASE |
 					IFF_XMIT_DST_RELEASE_PERM;
 	netdev_features_t vlan_features = BOND_VLAN_FEATURES;
 	netdev_features_t enc_features  = BOND_ENC_FEATURES;
+	netdev_features_t mpls_features  = BOND_MPLS_FEATURES;
 	struct net_device *bond_dev = bond->dev;
 	struct list_head *iter;
 	struct slave *slave;
@@ -1093,6 +1097,7 @@ static void bond_compute_features(struct bonding *bond)
 	if (!bond_has_slaves(bond))
 		goto done;
 	vlan_features &= NETIF_F_ALL_FOR_ALL;
+	mpls_features &= NETIF_F_ALL_FOR_ALL;
 
 	bond_for_each_slave(bond, slave, iter) {
 		vlan_features = netdev_increment_features(vlan_features,
@@ -1101,6 +1106,11 @@ static void bond_compute_features(struct bonding *bond)
 		enc_features = netdev_increment_features(enc_features,
 							 slave->dev->hw_enc_features,
 							 BOND_ENC_FEATURES);
+
+		mpls_features = netdev_increment_features(mpls_features,
+							  slave->dev->mpls_features,
+							  BOND_MPLS_FEATURES);
+
 		dst_release_flag &= slave->dev->priv_flags;
 		if (slave->dev->hard_header_len > max_hard_header_len)
 			max_hard_header_len = slave->dev->hard_header_len;
@@ -1114,6 +1124,7 @@ static void bond_compute_features(struct bonding *bond)
 	bond_dev->vlan_features = vlan_features;
 	bond_dev->hw_enc_features = enc_features | NETIF_F_GSO_ENCAP_ALL |
 				    NETIF_F_GSO_UDP_L4;
+	bond_dev->mpls_features = mpls_features;
 	bond_dev->gso_max_segs = gso_max_segs;
 	netif_set_gso_max_size(bond_dev, gso_max_size);
 
-- 
1.8.3.1


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

* [PATCH RFC 2/2] net: vlan: Inherit MPLS features from parent device
  2019-05-24 22:27 [PATCH RFC 0/2] Support MPLS features in bonding and vlan net devices Ariel Levkovich
  2019-05-24 22:27 ` [PATCH RFC 1/2] net: bonding: Inherit MPLS features from slave devices Ariel Levkovich
@ 2019-05-24 22:27 ` Ariel Levkovich
  1 sibling, 0 replies; 3+ messages in thread
From: Ariel Levkovich @ 2019-05-24 22:27 UTC (permalink / raw)
  To: netdev; +Cc: Ariel Levkovich

During the creation of the VLAN interface net device,
the various device features and offloads are being set based
on the parent device's features.
The code initiates the basic, vlan and encapsulation features
but doesn't address the MPLS features set and they remain blank.
As a result, all device offloads that have significant performance
effect are disabled for MPLS traffic going via this VLAN device such
as checksumming and TSO.

This patch makes sure that MPLS features are also set for the
VLAN device based on the parent which will allow HW offloads of
checksumming and TSO to be performed on MPLS tagged packets.

Signed-off-by: Ariel Levkovich <lariel@mellanox.com>
---
 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 f044ae5..585e73d 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -582,6 +582,7 @@ static int vlan_dev_init(struct net_device *dev)
 
 	dev->vlan_features = real_dev->vlan_features & ~NETIF_F_ALL_FCOE;
 	dev->hw_enc_features = vlan_tnl_features(real_dev);
+	dev->mpls_features = real_dev->mpls_features;
 
 	/* ipv6 shared card related stuff */
 	dev->dev_id = real_dev->dev_id;
-- 
1.8.3.1


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

end of thread, other threads:[~2019-05-24 22:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-24 22:27 [PATCH RFC 0/2] Support MPLS features in bonding and vlan net devices Ariel Levkovich
2019-05-24 22:27 ` [PATCH RFC 1/2] net: bonding: Inherit MPLS features from slave devices Ariel Levkovich
2019-05-24 22:27 ` [PATCH RFC 2/2] net: vlan: Inherit MPLS features from parent device Ariel Levkovich

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.