Skip to contentSkip to conversation

netdev: introduce new NETIF_F_HW_SWITCH_OFFLOAD feature flag for switch device offloads

PATCH Superseded [email protected] 7 participants 18 messages Dec 5, 2014 – Dec 6, 2014

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 netdev: introduce new NETIF_F_HW_SWITCH_OFFLOAD feature flag for switch device offloads

From: Roopa Prabhu <[email protected]>

This is a generic high level feature flag for all switch asic features today.

switch drivers set this flag on switch ports. Logical devices like bridge, bonds, vxlans can inherit this flag from their slaves/ports.

I had to use SWITCH in the name to avoid ambiguity with other feature flags. But, since i have been harping about not calling it 'switch', I am welcome to any suggestions :)

An alternative to using a feature flag is to use a IFF_HW_OFFLOAD in net_device_flags.

---
 include/linux/netdev_features.h |    2 ++
 1 file changed, 2 insertions(+)
include/linux/netdev_features.h +2 -0
index 8e30685..68db1de 100644
@@ -66,6 +66,7 @@ enum {
 	NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN STAGs */
 	NETIF_F_HW_L2FW_DOFFLOAD_BIT,	/* Allow L2 Forwarding in Hardware */
 	NETIF_F_BUSY_POLL_BIT,		/* Busy poll */
+	NETIF_F_HW_SWITCH_OFFLOAD_BIT,  /* HW switch offload */
 
 	/*
 	 * Add your fresh new feature above and remember to update
@@ -124,6 +125,7 @@ enum {
 #define NETIF_F_HW_VLAN_STAG_TX	__NETIF_F(HW_VLAN_STAG_TX)
 #define NETIF_F_HW_L2FW_DOFFLOAD	__NETIF_F(HW_L2FW_DOFFLOAD)
 #define NETIF_F_BUSY_POLL	__NETIF_F(BUSY_POLL)
+#define NETIF_F_HW_SWITCH_OFFLOAD	__NETIF_F(HW_SWITCH_OFFLOAD)
 
 /* Features valid for ethtool to change */
 /* = all defined minus driver/device-class-related */
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 22 lines · 在 2014年12月05日 10:26, [email protected] 写道:

From: Roopa Prabhu <[email protected]>

This is a generic high level feature flag for all switch asic features today.

switch drivers set this flag on switch ports. Logical devices like bridge, bonds, vxlans can inherit this flag from their slaves/ports.

I had to use SWITCH in the name to avoid ambiguity with other feature flags. But, since i have been harping about not calling it 'switch', I am welcome to any suggestions :)

An alternative to using a feature flag is to use a IFF_HW_OFFLOAD in net_device_flags.

---
  include/linux/netdev_features.h |    2 ++
  1 file changed, 2 insertions(+)
include/linux/netdev_features.h +0 -0
index 8e30685..68db1de 100644

include/linux/netdev_features.h enum { · line 69

Quoted 4 lines
include/linux/netdev_features.h +1 -0
@@ -66,6 +66,7 @@ enum {
  	NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN STAGs */
  	NETIF_F_HW_L2FW_DOFFLOAD_BIT,	/* Allow L2 Forwarding in Hardware */
  	NETIF_F_BUSY_POLL_BIT,		/* Busy poll */
+	NETIF_F_HW_SWITCH_OFFLOAD_BIT,  /* HW switch offload */

I am interested in this flag very much, but I am not very clear how many offload capabilities does this flag imply. If this flag belongs to a general flag and can be accepted by all vendors, I will reuse this flag to introduce another out going data traffics distribution offload method to bonding driver.

Thanks & B.R.
Jianhua

Quoted 11 lines
include/linux/netdev_features.h +1 -0
  	/*
  	 * Add your fresh new feature above and remember to update
@@ -124,6 +125,7 @@ enum {
  #define NETIF_F_HW_VLAN_STAG_TX	__NETIF_F(HW_VLAN_STAG_TX)
  #define NETIF_F_HW_L2FW_DOFFLOAD	__NETIF_F(HW_L2FW_DOFFLOAD)
  #define NETIF_F_BUSY_POLL	__NETIF_F(BUSY_POLL)
+#define NETIF_F_HW_SWITCH_OFFLOAD	__NETIF_F(HW_SWITCH_OFFLOAD)
 
  /* Features valid for ethtool to change */
  /* = all defined minus driver/device-class-related */
#2 lore raw
Quoted 19 lines · Jianhua Xie
Quoted 17 lines · 在 2014年12月05日 10:26, [email protected] 写道:

From: Roopa Prabhu <[email protected]>

This is a generic high level feature flag for all switch asic features today.

switch drivers set this flag on switch ports. Logical devices like bridge, bonds, vxlans can inherit this flag from their slaves/ports.

I had to use SWITCH in the name to avoid ambiguity with other feature flags. But, since i have been harping about not calling it 'switch', I am welcome to any suggestions :)

An alternative to using a feature flag is to use a IFF_HW_OFFLOAD in net_device_flags.

---
  include/linux/netdev_features.h |    2 ++
  1 file changed, 2 insertions(+)
Quoted 16 lines
Quoted 11 lines
include/linux/netdev_features.h +0 -0
index 8e30685..68db1de 100644
@@ -66,6 +66,7 @@ enum {
      NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN 

STAGs */
NETIF_F_HW_L2FW_DOFFLOAD_BIT, /* Allow L2 Forwarding in
Hardware */
NETIF_F_BUSY_POLL_BIT, /* Busy poll */
+ NETIF_F_HW_SWITCH_OFFLOAD_BIT, /* HW switch offload */

I am interested in this flag very much, but I am not very clear how many offload capabilities does this flag imply. If this flag belongs to a general flag and can be accepted by all vendors, I will reuse this flag to introduce another out going data traffics distribution offload method to bonding driver.

Right now its a one global offload flag for switch asics. Some may not want to tune it more. But others may and so i do expect more flags in this category.

Thanks,
Roopa

#3 lore raw
Quoted 36 lines · Roopa Prabhu
Quoted 19 lines · Jianhua Xie
Quoted 17 lines · 在 2014年12月05日 10:26, [email protected] 写道:

From: Roopa Prabhu <[email protected]>

This is a generic high level feature flag for all switch asic features today.

switch drivers set this flag on switch ports. Logical devices like bridge, bonds, vxlans can inherit this flag from their slaves/ports.

I had to use SWITCH in the name to avoid ambiguity with other feature flags. But, since i have been harping about not calling it 'switch', I am welcome to any suggestions :)

An alternative to using a feature flag is to use a IFF_HW_OFFLOAD in net_device_flags.

---
  include/linux/netdev_features.h |    2 ++
  1 file changed, 2 insertions(+)
Quoted 16 lines
Quoted 11 lines
include/linux/netdev_features.h +0 -0
index 8e30685..68db1de 100644
@@ -66,6 +66,7 @@ enum {
      NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN 

STAGs */
NETIF_F_HW_L2FW_DOFFLOAD_BIT, /* Allow L2 Forwarding in
Hardware */
NETIF_F_BUSY_POLL_BIT, /* Busy poll */
+ NETIF_F_HW_SWITCH_OFFLOAD_BIT, /* HW switch offload */

I am interested in this flag very much, but I am not very clear how many offload capabilities does this flag imply. If this flag belongs to a general flag and can be accepted by all vendors, I will reuse this flag to introduce another out going data traffics distribution offload method to bonding driver.

Quoted 2 lines

Right now its a one global offload flag for switch asics. Some may not want to tune it more. But others may and so i do expect more flags in this category.

Got it with thanks.
Best Regards.

Quoted 3 lines

Thanks,
Roopa

#4 lore raw
In reply to [email protected]
Quoted 30 lines · On Thu, Dec 4, 2014 at 6:26 PM, <[email protected]> wrote:

From: Roopa Prabhu <[email protected]>

This is a generic high level feature flag for all switch asic features today.

switch drivers set this flag on switch ports. Logical devices like bridge, bonds, vxlans can inherit this flag from their slaves/ports.

I had to use SWITCH in the name to avoid ambiguity with other feature flags. But, since i have been harping about not calling it 'switch', I am welcome to any suggestions :)

An alternative to using a feature flag is to use a IFF_HW_OFFLOAD in net_device_flags.

---
 include/linux/netdev_features.h |    2 ++
 1 file changed, 2 insertions(+)
include/linux/netdev_features.h +1 -0
index 8e30685..68db1de 100644
@@ -66,6 +66,7 @@ enum {
        NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN STAGs */
        NETIF_F_HW_L2FW_DOFFLOAD_BIT,   /* Allow L2 Forwarding in Hardware */
        NETIF_F_BUSY_POLL_BIT,          /* Busy poll */
+       NETIF_F_HW_SWITCH_OFFLOAD_BIT,  /* HW switch offload */
 
        /*
         * Add your fresh new feature above and remember to update

include/linux/netdev_features.h enum { · line 128

Quoted 4 lines
include/linux/netdev_features.h +1 -0
@@ -124,6 +125,7 @@ enum {
 #define NETIF_F_HW_VLAN_STAG_TX        __NETIF_F(HW_VLAN_STAG_TX)
 #define NETIF_F_HW_L2FW_DOFFLOAD       __NETIF_F(HW_L2FW_DOFFLOAD)
 #define NETIF_F_BUSY_POLL      __NETIF_F(BUSY_POLL)
+#define NETIF_F_HW_SWITCH_OFFLOAD      __NETIF_F(HW_SWITCH_OFFLOAD)

Can we use existing flag NETIF_F_HW_L2FW_DOFFLOAD? The comment above on that flag suggests it would be perfect for what we're doing with L2
bridging: offloading the L2 forwarding path in HW.

NETIF_F_HW_L2FW_DOFFLOAD seems to be orphaned in current net-next, so I'm not sure of it's status, but see if it makes sense to recycle it.

I could see a NETIF_F_HW_L3FW_DOFFLOAD for L3 fwd offload, down the road.

Quoted 5 lines
include/linux/netdev_features.h +0 -1
 /* Features valid for ethtool to change */
 /* = all defined minus driver/device-class-related */
--

1.7.10.4

#5 lore raw
Quoted 40 lines · Scott Feldman
Quoted 30 lines · On Thu, Dec 4, 2014 at 6:26 PM, <[email protected]> wrote:

From: Roopa Prabhu <[email protected]>

This is a generic high level feature flag for all switch asic features today.

switch drivers set this flag on switch ports. Logical devices like bridge, bonds, vxlans can inherit this flag from their slaves/ports.

I had to use SWITCH in the name to avoid ambiguity with other feature flags. But, since i have been harping about not calling it 'switch', I am welcome to any suggestions :)

An alternative to using a feature flag is to use a IFF_HW_OFFLOAD in net_device_flags.

---
  include/linux/netdev_features.h |    2 ++
  1 file changed, 2 insertions(+)
include/linux/netdev_features.h +1 -0
index 8e30685..68db1de 100644
@@ -66,6 +66,7 @@ enum {
         NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN STAGs */
         NETIF_F_HW_L2FW_DOFFLOAD_BIT,   /* Allow L2 Forwarding in Hardware */
         NETIF_F_BUSY_POLL_BIT,          /* Busy poll */
+       NETIF_F_HW_SWITCH_OFFLOAD_BIT,  /* HW switch offload */
 
         /*
          * Add your fresh new feature above and remember to update

include/linux/netdev_features.h enum { · line 128

Quoted 4 lines
include/linux/netdev_features.h +1 -0
@@ -124,6 +125,7 @@ enum {
  #define NETIF_F_HW_VLAN_STAG_TX        __NETIF_F(HW_VLAN_STAG_TX)
  #define NETIF_F_HW_L2FW_DOFFLOAD       __NETIF_F(HW_L2FW_DOFFLOAD)
  #define NETIF_F_BUSY_POLL      __NETIF_F(BUSY_POLL)
+#define NETIF_F_HW_SWITCH_OFFLOAD      __NETIF_F(HW_SWITCH_OFFLOAD)

Can we use existing flag NETIF_F_HW_L2FW_DOFFLOAD? The comment above on that flag suggests it would be perfect for what we're doing with L2
bridging: offloading the L2 forwarding path in HW.

Quoted 5 lines

NETIF_F_HW_L2FW_DOFFLOAD seems to be orphaned in current net-next, so I'm not sure of it's status, but see if it makes sense to recycle it.

I could see a NETIF_F_HW_L3FW_DOFFLOAD for L3 fwd offload, down the road.

Its not orphaned its used by the macvlan device to indicate that the port switching should be done in hardware. For example put macvlan in VEPA mode and the hardware will deliver the packets directly to the netdev and get the pruning right. In VEB mode the hardware will forward packets correctly between macvlan netdevs. The implementation on ixgbe for example is to give a set of hardware queues per macvlan netdev. I still need to add offloaded QOS to make this more interesting.

I could support a l3vlan device as well even on some of the host nics.

The issue with generalizing it is at the moment it is used by ixgbe
which can't forward between two physical ports. It works on macvlan
because each macvlan netdev uses the same physical uplink. I think switching between different ports is going to require another feature bit like its done here.

.John

Quoted 6 lines
Quoted 6 lines
include/linux/netdev_features.h +0 -1
  /* Features valid for ethtool to change */
  /* = all defined minus driver/device-class-related */
--

1.7.10.4

Signature · 1 line
John Fastabend         Intel Corporation
#6 lore raw
Quoted 62 lines · John Fastabend
Quoted 47 lines · Scott Feldman
Quoted 35 lines · On Thu, Dec 4, 2014 at 6:26 PM, <[email protected]> wrote:

From: Roopa Prabhu <[email protected]>

This is a generic high level feature flag for all switch asic features today.

switch drivers set this flag on switch ports. Logical devices like bridge, bonds, vxlans can inherit this flag from their slaves/ports.

I had to use SWITCH in the name to avoid ambiguity with other feature flags. But, since i have been harping about not calling it 'switch', I am welcome to any suggestions :)

An alternative to using a feature flag is to use a IFF_HW_OFFLOAD in net_device_flags.

---
  include/linux/netdev_features.h |    2 ++
  1 file changed, 2 insertions(+)
include/linux/netdev_features.h +0 -0
index 8e30685..68db1de 100644
@@ -66,6 +66,7 @@ enum {
         NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN

STAGs */
NETIF_F_HW_L2FW_DOFFLOAD_BIT, /* Allow L2 Forwarding in
Hardware */
NETIF_F_BUSY_POLL_BIT, /* Busy poll */

include/linux/netdev_features.h +1 -0
+       NETIF_F_HW_SWITCH_OFFLOAD_BIT,  /* HW switch offload */
 
         /*
          * Add your fresh new feature above and remember to update

include/linux/netdev_features.h enum { · line 128

Quoted 4 lines
include/linux/netdev_features.h +1 -0
@@ -124,6 +125,7 @@ enum {
  #define NETIF_F_HW_VLAN_STAG_TX        __NETIF_F(HW_VLAN_STAG_TX)
  #define NETIF_F_HW_L2FW_DOFFLOAD       __NETIF_F(HW_L2FW_DOFFLOAD)
  #define NETIF_F_BUSY_POLL      __NETIF_F(BUSY_POLL)
+#define NETIF_F_HW_SWITCH_OFFLOAD      __NETIF_F(HW_SWITCH_OFFLOAD)

Can we use existing flag NETIF_F_HW_L2FW_DOFFLOAD? The comment above on that flag suggests it would be perfect for what we're doing with L2
bridging: offloading the L2 forwarding path in HW.

Quoted 5 lines

NETIF_F_HW_L2FW_DOFFLOAD seems to be orphaned in current net-next, so I'm not sure of it's status, but see if it makes sense to recycle it.

I could see a NETIF_F_HW_L3FW_DOFFLOAD for L3 fwd offload, down the road.

Its not orphaned its used by the macvlan device to indicate that the port switching should be done in hardware. For example put macvlan in VEPA mode and the hardware will deliver the packets directly to the netdev and get the pruning right. In VEB mode the hardware will forward packets correctly between macvlan netdevs. The implementation on ixgbe for example is to give a set of hardware queues per macvlan netdev. I still need to add offloaded QOS to make this more interesting.

Quoted 7 lines

I could support a l3vlan device as well even on some of the host nics.

The issue with generalizing it is at the moment it is used by ixgbe which can't forward between two physical ports. It works on macvlan because each macvlan netdev uses the same physical uplink. I think switching between different ports is going to require another feature
bit like its done here.

My bad...I grepped for the _BIT variant and missed the usage in macvlan, etc. Sorry about that.

Quoted 14 lines

.John

Quoted 6 lines
Quoted 6 lines
include/linux/netdev_features.h +0 -1
  /* Features valid for ethtool to change */
  /* = all defined minus driver/device-class-related */
--

1.7.10.4

--
John Fastabend Intel Corporation

#7 lore raw
In reply to [email protected]
Quoted 6 lines · Fri, Dec 05, 2014 at 03:26:39AM CET, [email protected] wrote:

From: Roopa Prabhu <[email protected]>

This is a generic high level feature flag for all switch asic features today.

switch drivers set this flag on switch ports. Logical devices like bridge, bonds, vxlans can inherit this flag from their slaves/ports.

Can you please elaborate on how exactly would this inheritance look like?

Quoted 34 lines

I had to use SWITCH in the name to avoid ambiguity with other feature flags. But, since i have been harping about not calling it 'switch', I am welcome to any suggestions :)

An alternative to using a feature flag is to use a IFF_HW_OFFLOAD in net_device_flags.
---
include/linux/netdev_features.h | 2 ++

1 file changed, 2 insertions(+)
include/linux/netdev_features.h +2 -0
index 8e30685..68db1de 100644
@@ -66,6 +66,7 @@ enum {
 	NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN STAGs */
 	NETIF_F_HW_L2FW_DOFFLOAD_BIT,	/* Allow L2 Forwarding in Hardware */
 	NETIF_F_BUSY_POLL_BIT,		/* Busy poll */
+	NETIF_F_HW_SWITCH_OFFLOAD_BIT,  /* HW switch offload */
 
 	/*
 	 * Add your fresh new feature above and remember to update
@@ -124,6 +125,7 @@ enum {
 #define NETIF_F_HW_VLAN_STAG_TX	__NETIF_F(HW_VLAN_STAG_TX)
 #define NETIF_F_HW_L2FW_DOFFLOAD	__NETIF_F(HW_L2FW_DOFFLOAD)
 #define NETIF_F_BUSY_POLL	__NETIF_F(BUSY_POLL)
+#define NETIF_F_HW_SWITCH_OFFLOAD	__NETIF_F(HW_SWITCH_OFFLOAD)
 
 /* Features valid for ethtool to change */
 /* = all defined minus driver/device-class-related */
Signature · 1 line
1.7.10.4
#8 lore raw
Quoted 10 lines · Jiri Pirko
Quoted 6 lines · Fri, Dec 05, 2014 at 03:26:39AM CET, [email protected] wrote:

From: Roopa Prabhu <[email protected]>

This is a generic high level feature flag for all switch asic features today.

switch drivers set this flag on switch ports. Logical devices like bridge, bonds, vxlans can inherit this flag from their slaves/ports.

Can you please elaborate on how exactly would this inheritance look like?

My thought there was, when a port with the hw offload flag is added to the bridge, the same flag gets set on the bridge. And, for any bridge attributes (not port attributes), this flag on the bridge can be used to offload those bridge attributes. bridge attribute examples: IFLA_BR_FORWARD_DELAY, IFLA_BR_HELLO_TIME, IFLA_BR_MAX_AGE.
I don't think offloads for these are handled today. I was going to look at them as part of continued work on this.
The current patches only target bridge port attributes and the flag for this is already set by the port driver.

I believe netdev_update_features() takes care of the updating the flag on the bridge part. I plan to check on that.

Quoted 35 lines
Quoted 35 lines

I had to use SWITCH in the name to avoid ambiguity with other feature flags. But, since i have been harping about not calling it 'switch', I am welcome to any suggestions :)

An alternative to using a feature flag is to use a IFF_HW_OFFLOAD in net_device_flags.
---
include/linux/netdev_features.h | 2 ++

1 file changed, 2 insertions(+)
include/linux/netdev_features.h +2 -0
index 8e30685..68db1de 100644
@@ -66,6 +66,7 @@ enum {
 	NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN STAGs */
 	NETIF_F_HW_L2FW_DOFFLOAD_BIT,	/* Allow L2 Forwarding in Hardware */
 	NETIF_F_BUSY_POLL_BIT,		/* Busy poll */
+	NETIF_F_HW_SWITCH_OFFLOAD_BIT,  /* HW switch offload */
 
 	/*
 	 * Add your fresh new feature above and remember to update
@@ -124,6 +125,7 @@ enum {
 #define NETIF_F_HW_VLAN_STAG_TX	__NETIF_F(HW_VLAN_STAG_TX)
 #define NETIF_F_HW_L2FW_DOFFLOAD	__NETIF_F(HW_L2FW_DOFFLOAD)
 #define NETIF_F_BUSY_POLL	__NETIF_F(BUSY_POLL)
+#define NETIF_F_HW_SWITCH_OFFLOAD	__NETIF_F(HW_SWITCH_OFFLOAD)
 
 /* Features valid for ethtool to change */
 /* = all defined minus driver/device-class-related */
Signature · 1 line
1.7.10.4
#9 lore raw
Quoted 17 lines · Roopa Prabhu
Quoted 8 lines · Jiri Pirko
Quoted 6 lines · Fri, Dec 05, 2014 at 03:26:39AM CET, [email protected] wrote:

From: Roopa Prabhu <[email protected]>

This is a generic high level feature flag for all switch asic features today.

Quoted 6 lines
Quoted 2 lines

switch drivers set this flag on switch ports. Logical devices like bridge, bonds, vxlans can inherit this flag from their slaves/ports.

Can you please elaborate on how exactly would this inheritance look like?

Quoted 6 lines

My thought there was, when a port with the hw offload flag is added to the bridge, the same flag gets set on the bridge. And, for any bridge attributes (not port attributes), this flag on the bridge can be used to offload those bridge attributes.
bridge attribute examples: IFLA_BR_FORWARD_DELAY, IFLA_BR_HELLO_TIME, IFLA_BR_MAX_AGE.

Ah, wait, why do those need to be pushed down to driver/HW? Letting the bridge (or external process like mstpd) own the ctrl-plane means HW isn't running STP machine or aging out FDB entries. Let Linux take care of that.

Same goes for bonding, since that was mentioned earlier. Keep LACP ctrl processing in the kernel/bonding driver, and there is no need to push bonding settings down to port driver/hw. driver/hw just need to know port membership and LACP status.

Quoted 49 lines

I don't think offloads for these are handled today. I was going to look at them as part of continued work on this.
The current patches only target bridge port attributes and the flag for this is already set by the port driver.

I believe netdev_update_features() takes care of the updating the flag on the bridge part. I plan to check on that.

Quoted 38 lines
Quoted 38 lines

I had to use SWITCH in the name to avoid ambiguity with other feature flags. But, since i have been harping about not calling it 'switch', I am welcome to any suggestions :)

An alternative to using a feature flag is to use a IFF_HW_OFFLOAD in net_device_flags.
---
include/linux/netdev_features.h | 2 ++

1 file changed, 2 insertions(+)
include/linux/netdev_features.h +0 -0
index 8e30685..68db1de 100644
@@ -66,6 +66,7 @@ enum {
        NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN

STAGs */
NETIF_F_HW_L2FW_DOFFLOAD_BIT, /* Allow L2 Forwarding in
Hardware */
NETIF_F_BUSY_POLL_BIT, /* Busy poll */

include/linux/netdev_features.h +2 -1
+       NETIF_F_HW_SWITCH_OFFLOAD_BIT,  /* HW switch offload */
 
        /*
         * Add your fresh new feature above and remember to update
@@ -124,6 +125,7 @@ enum {
 #define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX)
 #define NETIF_F_HW_L2FW_DOFFLOAD        __NETIF_F(HW_L2FW_DOFFLOAD)
 #define NETIF_F_BUSY_POLL       __NETIF_F(BUSY_POLL)
+#define NETIF_F_HW_SWITCH_OFFLOAD      __NETIF_F(HW_SWITCH_OFFLOAD)
 
 /* Features valid for ethtool to change */
 /* = all defined minus driver/device-class-related */
--

1.7.10.4

#10 lore raw
Quoted 25 lines · Scott Feldman
Quoted 13 lines · Roopa Prabhu
Quoted 11 lines · Jiri Pirko
Quoted 7 lines · Fri, Dec 05, 2014 at 03:26:39AM CET, [email protected] wrote:

From: Roopa Prabhu <[email protected]>

This is a generic high level feature flag for all switch asic features today.

switch drivers set this flag on switch ports. Logical devices like bridge, bonds, vxlans can inherit this flag from their slaves/ports.

Can you please elaborate on how exactly would this inheritance look like?

Quoted 6 lines

My thought there was, when a port with the hw offload flag is added to the bridge, the same flag gets set on the bridge. And, for any bridge attributes (not port attributes), this flag on the bridge can be used to offload those bridge attributes.
bridge attribute examples: IFLA_BR_FORWARD_DELAY, IFLA_BR_HELLO_TIME, IFLA_BR_MAX_AGE.

Ah, wait, why do those need to be pushed down to driver/HW? Letting the bridge (or external process like mstpd) own the ctrl-plane means HW isn't running STP machine or aging out FDB entries. Let Linux take care of that.

Quoted 4 lines

Same goes for bonding, since that was mentioned earlier. Keep LACP ctrl processing in the kernel/bonding driver, and there is no need to push bonding settings down to port driver/hw. driver/hw just need to know port membership and LACP status.

scott, agreed these are stp attributes. Wont go into hardware. I picked the wrong example. But, I was just trying to point out that there maybe bridge attributes that need to be passed to hw. Like the bridge ageing timer etc. We don't use it today. But others may in the future. I was just trying to say that ...this maybe useful in the future. The current in-kernel implementation nor my patches do anything for this. We can add it in the future if need be.

#11 lore raw
In reply to [email protected]
Quoted 11 lines · On 12/04/14 21:26, [email protected] wrote:

From: Roopa Prabhu <[email protected]>

This is a generic high level feature flag for all switch asic features today.

switch drivers set this flag on switch ports. Logical devices like bridge, bonds, vxlans can inherit this flag from their slaves/ports.

I had to use SWITCH in the name to avoid ambiguity with other feature flags. But, since i have been harping about not calling it 'switch', I am welcome to any suggestions :)

I know in this use case it is a switch. But please dont use that term for things that we are going to use as generic offload descriptors. How about just simple: NETIF_F_HW_DEV_OFFLOAD_BIT
BTW: Didnt you already have a netdev specific offload feature flag?

cheers,
jamal

Quoted 27 lines

An alternative to using a feature flag is to use a IFF_HW_OFFLOAD in net_device_flags.

---
  include/linux/netdev_features.h |    2 ++
  1 file changed, 2 insertions(+)
include/linux/netdev_features.h +2 -0
index 8e30685..68db1de 100644
@@ -66,6 +66,7 @@ enum {
  	NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN STAGs */
  	NETIF_F_HW_L2FW_DOFFLOAD_BIT,	/* Allow L2 Forwarding in Hardware */
  	NETIF_F_BUSY_POLL_BIT,		/* Busy poll */
+	NETIF_F_HW_SWITCH_OFFLOAD_BIT,  /* HW switch offload */
 
  	/*
  	 * Add your fresh new feature above and remember to update
@@ -124,6 +125,7 @@ enum {
  #define NETIF_F_HW_VLAN_STAG_TX	__NETIF_F(HW_VLAN_STAG_TX)
  #define NETIF_F_HW_L2FW_DOFFLOAD	__NETIF_F(HW_L2FW_DOFFLOAD)
  #define NETIF_F_BUSY_POLL	__NETIF_F(BUSY_POLL)
+#define NETIF_F_HW_SWITCH_OFFLOAD	__NETIF_F(HW_SWITCH_OFFLOAD)
 
  /* Features valid for ethtool to change */
  /* = all defined minus driver/device-class-related */
#12 lore raw
Quoted 8 lines · Fri, Dec 05, 2014 at 01:06:50PM CET, [email protected] wrote:
Quoted 7 lines · On 12/04/14 21:26, [email protected] wrote:

From: Roopa Prabhu <[email protected]>

This is a generic high level feature flag for all switch asic features today.

switch drivers set this flag on switch ports. Logical devices like bridge, bonds, vxlans can inherit this flag from their slaves/ports.

Quoted 8 lines
Quoted 4 lines

I had to use SWITCH in the name to avoid ambiguity with other feature flags. But, since i have been harping about not calling it 'switch', I am welcome to any suggestions :)

I know in this use case it is a switch. But please dont use that term for things that we are going to use as generic offload descriptors. How about just simple: NETIF_F_HW_DEV_OFFLOAD_BIT

What that should tell it stands for? I think we need something more specific.

Quoted 33 lines

BTW: Didnt you already have a netdev specific offload feature flag?

cheers,
jamal

Quoted 27 lines

An alternative to using a feature flag is to use a IFF_HW_OFFLOAD in net_device_flags.

---
 include/linux/netdev_features.h |    2 ++
 1 file changed, 2 insertions(+)
include/linux/netdev_features.h +2 -0
index 8e30685..68db1de 100644
@@ -66,6 +66,7 @@ enum {
 	NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN STAGs */
 	NETIF_F_HW_L2FW_DOFFLOAD_BIT,	/* Allow L2 Forwarding in Hardware */
 	NETIF_F_BUSY_POLL_BIT,		/* Busy poll */
+	NETIF_F_HW_SWITCH_OFFLOAD_BIT,  /* HW switch offload */
 
 	/*
 	 * Add your fresh new feature above and remember to update
@@ -124,6 +125,7 @@ enum {
 #define NETIF_F_HW_VLAN_STAG_TX	__NETIF_F(HW_VLAN_STAG_TX)
 #define NETIF_F_HW_L2FW_DOFFLOAD	__NETIF_F(HW_L2FW_DOFFLOAD)
 #define NETIF_F_BUSY_POLL	__NETIF_F(BUSY_POLL)
+#define NETIF_F_HW_SWITCH_OFFLOAD	__NETIF_F(HW_SWITCH_OFFLOAD)
 
 /* Features valid for ethtool to change */
 /* = all defined minus driver/device-class-related */
#13 lore raw
Quoted 14 lines · Jiri Pirko
Quoted 13 lines · Fri, Dec 05, 2014 at 01:06:50PM CET, [email protected] wrote:
Quoted 11 lines · On 12/04/14 21:26, [email protected] wrote:

From: Roopa Prabhu <[email protected]>

This is a generic high level feature flag for all switch asic features today.

switch drivers set this flag on switch ports. Logical devices like bridge, bonds, vxlans can inherit this flag from their slaves/ports.

I had to use SWITCH in the name to avoid ambiguity with other feature flags. But, since i have been harping about not calling it 'switch', I am welcome to any suggestions :)

Quoted 7 lines
Quoted 3 lines

I know in this use case it is a switch. But please dont use that term for things that we are going to use as generic offload descriptors. How about just simple: NETIF_F_HW_DEV_OFFLOAD_BIT

What that should tell it stands for? I think we need something more specific.

Ok, the use case in this instance is very specific. My blinders go off anytime i see switch or sw or swdev.
In which case maybe what Scott suggested but changing L2FWD with FDB?

cheers,
jamal

#14 lore raw
In reply to [email protected]
Quoted 7 lines · On 12/04/14 at 06:26pm, [email protected] wrote:

From: Roopa Prabhu <[email protected]>

This is a generic high level feature flag for all switch asic features today.

switch drivers set this flag on switch ports. Logical devices like bridge, bonds, vxlans can inherit this flag from their slaves/ports.

Quoted 6 lines

I had to use SWITCH in the name to avoid ambiguity with other feature flags. But, since i have been harping about not calling it 'switch', I am welcome to any suggestions :)

An alternative to using a feature flag is to use a IFF_HW_OFFLOAD in net_device_flags.

What does this flag indicate specifically? What driver would implement ndo_bridge_setlink() but not set this flag?

I think it should be clearly documented when this flag is to bet set.

#15 lore raw
Quoted 12 lines · Thomas Graf
Quoted 11 lines · On 12/04/14 at 06:26pm, [email protected] wrote:

From: Roopa Prabhu <[email protected]>

This is a generic high level feature flag for all switch asic features today.

switch drivers set this flag on switch ports. Logical devices like bridge, bonds, vxlans can inherit this flag from their slaves/ports.

I had to use SWITCH in the name to avoid ambiguity with other feature flags. But, since i have been harping about not calling it 'switch', I am welcome to any suggestions :)

Quoted 6 lines
Quoted 2 lines

An alternative to using a feature flag is to use a IFF_HW_OFFLOAD in net_device_flags.

What does this flag indicate specifically? What driver would implement ndo_bridge_setlink() but not set this flag?

I think it should be clearly documented when this flag is to bet set.

I mentioned it as an alternative because it was there in my RFC patch. There is no code for it yet. And I will get rid of the comment in v2.

#16 lore raw
Quoted 15 lines · Roopa Prabhu
Quoted 14 lines · Thomas Graf
Quoted 13 lines · On 12/04/14 at 06:26pm, [email protected] wrote:

From: Roopa Prabhu <[email protected]>

This is a generic high level feature flag for all switch asic features today.

switch drivers set this flag on switch ports. Logical devices like bridge, bonds, vxlans can inherit this flag from their slaves/ports.

I had to use SWITCH in the name to avoid ambiguity with other feature flags. But, since i have been harping about not calling it 'switch', I am welcome to any suggestions :)

An alternative to using a feature flag is to use a IFF_HW_OFFLOAD in net_device_flags.

Quoted 7 lines
Quoted 4 lines

What does this flag indicate specifically? What driver would implement ndo_bridge_setlink() but not set this flag?

I think it should be clearly documented when this flag is to bet set.

I mentioned it as an alternative because it was there in my RFC patch. There is no code for it yet.
And I will get rid of the comment in v2.

Sorry, I was referring to NETIF_F_HW_SWITCH_OFFLOAD. I do not understand the scope of this bit/flag yet. Can you give examples when to set this bit? At what point would the existing ixgbe FDB offload set this bit? Is there a case when ndo_bridge_setlink() is implemented but this bit is not set?

#17 lore raw
Quoted 16 lines · Thomas Graf
Quoted 15 lines · Roopa Prabhu
Quoted 14 lines · Thomas Graf
Quoted 13 lines · On 12/04/14 at 06:26pm, [email protected] wrote:

From: Roopa Prabhu <[email protected]>

This is a generic high level feature flag for all switch asic features today.

switch drivers set this flag on switch ports. Logical devices like bridge, bonds, vxlans can inherit this flag from their slaves/ports.

I had to use SWITCH in the name to avoid ambiguity with other feature flags. But, since i have been harping about not calling it 'switch', I am welcome to any suggestions :)

An alternative to using a feature flag is to use a IFF_HW_OFFLOAD in net_device_flags.

Quoted 8 lines
Quoted 7 lines
Quoted 4 lines

What does this flag indicate specifically? What driver would implement ndo_bridge_setlink() but not set this flag?

I think it should be clearly documented when this flag is to bet set.

I mentioned it as an alternative because it was there in my RFC patch. There is no code for it yet.
And I will get rid of the comment in v2.

Sorry, I was referring to NETIF_F_HW_SWITCH_OFFLOAD.

Ah, ok.

Quoted 6 lines

I do not
understand the scope of this bit/flag yet.
Can you give examples
when to set this bit? At what point would the existing ixgbe FDB offload set this bit? Is there a case when ndo_bridge_setlink() is implemented but this bit is not set?

The switch asic drivers will set this flag on the switch ports. This flag will be used when you want to offload kernel networking to hardware or in other words accelerate the corresponding kernel network function.
In the context of current patches it is the bridge driver. A kernel
bridge that has any of these switch asic ports
as bridge ports can inherit this flag and use this flag on the ports to
call the switch driver ndo ops to offload state to hw and thus hw accelerate the bridging function.

The existing l2 offload flags, example the hwmode and self flags used for nic drivers bridge/l2 offload, does not help switch asic hardware completely. AFAICT, those are used today to manage the bridge in nic hw directly. They don't involve the bridge driver.

And the most important thing is they require the user to specify this additional flag to offload.

In my proposal,
- The flag/bit helps switch asic drivers to indicate that they accelerate the kernel networking objects/functions
- The user does not have to specify a new flag to do so. A bridge created with switch asic ports will thus be accelerated if the switch driver supports it.
- The user can continue to directly manage l2 in nics (ixgbe) using the existing hwmode/self flags
- And it also does not stop users from using the 'self' flag to talk to the switch asic driver directly
- And involving the bridge driver makes sure the add/del notifications to user space go out after both kernel and hardware are programmed

Regarding ixgbe driver setting this flag: For the current vepa and veb modes I don't see a need for it. But if there is a use case in the future to indicate hw accelerating the bridge driver, ixgbe driver can set this flag