net: bridge: switchdev: allow port isolation to be offloaded
Subsystems (3)
PATCH 1/1 net: bridge: switchdev: allow port isolation to be offloaded
Add BR_ISOLATED flag to BR_PORT_FLAGS_HW_OFFLOAD, to allow switchdev drivers to offload port isolation.
--- net/bridge/br_switchdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/bridge/br_switchdev.c +2 -1
@@ -71,7 +71,8 @@ bool nbp_switchdev_allowed_egress(const struct net_bridge_port *p,/* Flags that can be offloaded to hardware */ #define BR_PORT_FLAGS_HW_OFFLOAD (BR_LEARNING | BR_FLOOD | \ - BR_MCAST_FLOOD | BR_BCAST_FLOOD) + BR_MCAST_FLOOD | BR_BCAST_FLOOD | \ + BR_ISOLATED) int br_switchdev_set_port_flag(struct net_bridge_port *p, unsigned long flags,
Signature · 1 line
2.25.1
Quoted 14 lines · DENG Qingfang
Add
BR_ISOLATEDflag toBR_PORT_FLAGS_HW_OFFLOAD, to allow switchdev drivers to offload port isolation.Suggested-by Vladimir Oltean <[email protected]>Signed-off-by DENG Qingfang <[email protected]>--- net/bridge/br_switchdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)net/bridge/br_switchdev.c +0
-0
net/bridge/br_switchdev.c bool nbp_switchdev_allowed_egress(const struct net_bridge_port *p, · line 75
Quoted 6 lines
net/bridge/br_switchdev.c +2
-1@@ -71,7 +71,8 @@ bool nbp_switchdev_allowed_egress(const struct net_bridge_port *p,/* Flags that can be offloaded to hardware */ #define BR_PORT_FLAGS_HW_OFFLOAD (BR_LEARNING | BR_FLOOD | \ - BR_MCAST_FLOOD | BR_BCAST_FLOOD) + BR_MCAST_FLOOD | BR_BCAST_FLOOD | \ + BR_ISOLATED)
Why add it now and not as part of a patchset that actually makes use of the flag in a driver that offloads port isolation?
Quoted 6 lines
net/bridge/br_switchdev.c +0
-0int br_switchdev_set_port_flag(struct net_bridge_port *p, unsigned long flags,Signature · 1 line
2.25.1
Quoted 16 lines · Ido Schimmel
Quoted 15 lines · DENG Qingfang
Add
BR_ISOLATEDflag toBR_PORT_FLAGS_HW_OFFLOAD, to allow switchdev drivers to offload port isolation.Suggested-by Vladimir Oltean <[email protected]>Signed-off-by DENG Qingfang <[email protected]>--- net/bridge/br_switchdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)net/bridge/br_switchdev.c +0
-0@@ -71,7 +71,8 @@ bool nbp_switchdev_allowed_egress(const struct net_bridge_port *p,
Quoted 8 lines
net/bridge/br_switchdev.c bool nbp_switchdev_allowed_egress(const struct net_bridge_port *p, · line 75
Quoted 5 lines
net/bridge/br_switchdev.c +2
-1/* Flags that can be offloaded to hardware */ #define BR_PORT_FLAGS_HW_OFFLOAD (BR_LEARNING | BR_FLOOD | \ - BR_MCAST_FLOOD | BR_BCAST_FLOOD) + BR_MCAST_FLOOD | BR_BCAST_FLOOD | \ + BR_ISOLATED)Why add it now and not as part of a patchset that actually makes use of the flag in a driver that offloads port isolation?
The way the information got transmitted is a bit unfortunate.
Making BR_ISOLATED part of BR_PORT_FLAGS_HW_OFFLOAD is a matter of correctness when switchdev offloads the data path. Since this feature will not work correctly without driver intervention, it makes sense that drivers should reject it currently, which is exactly what this patch accomplishes - it makes the code path go through the SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS driver handlers, which return -EINVAL for everything they don't recognize.
(yes, we do still have a problem for drivers that don't catch SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS at all, switchdev will return -EOPNOTSUPP for those which is then ignored, but those are in the minority)
Quoted 28 lines · Vladimir Oltean
Quoted 16 lines · Ido Schimmel
Quoted 15 lines · DENG Qingfang
Add
BR_ISOLATEDflag toBR_PORT_FLAGS_HW_OFFLOAD, to allow switchdev drivers to offload port isolation.Suggested-by Vladimir Oltean <[email protected]>Signed-off-by DENG Qingfang <[email protected]>--- net/bridge/br_switchdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)net/bridge/br_switchdev.c +0
-0@@ -71,7 +71,8 @@ bool nbp_switchdev_allowed_egress(const struct net_bridge_port *p,Quoted 8 lines
net/bridge/br_switchdev.c bool nbp_switchdev_allowed_egress(const struct net_bridge_port *p, · line 75
Quoted 5 lines
net/bridge/br_switchdev.c +2
-1/* Flags that can be offloaded to hardware */ #define BR_PORT_FLAGS_HW_OFFLOAD (BR_LEARNING | BR_FLOOD | \ - BR_MCAST_FLOOD | BR_BCAST_FLOOD) + BR_MCAST_FLOOD | BR_BCAST_FLOOD | \ + BR_ISOLATED)Why add it now and not as part of a patchset that actually makes use of the flag in a driver that offloads port isolation?
The way the information got transmitted is a bit unfortunate.
Quoted 7 lines
Making
BR_ISOLATEDpart ofBR_PORT_FLAGS_HW_OFFLOADis a matter of correctness when switchdev offloads the data path. Since this feature will not work correctly without driver intervention, it makes sense that drivers should reject it currently, which is exactly what this patch accomplishes - it makes the code path go through theSWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGSdriver handlers, which return-EINVALfor everything they don't recognize.
If the purpose is correctness, then this is not the only flag that was missed. BR_HAIRPIN_MODE is also relevant for the data path, for example.
Anyway, the commit message needs to be reworded to reflect the true purpose of the patch.
Quoted 5 lines
(yes, we do still have a problem for drivers that don't catch
SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGSat all, switchdev will return-EOPNOTSUPPfor those which is then ignored, but those are in the minority)
Quoted 37 lines · Ido Schimmel
Quoted 28 lines · Vladimir Oltean
Quoted 16 lines · Ido Schimmel
Quoted 15 lines · DENG Qingfang
Add
BR_ISOLATEDflag toBR_PORT_FLAGS_HW_OFFLOAD, to allow switchdev drivers to offload port isolation.Suggested-by Vladimir Oltean <[email protected]>Signed-off-by DENG Qingfang <[email protected]>--- net/bridge/br_switchdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)net/bridge/br_switchdev.c +0
-0@@ -71,7 +71,8 @@ bool nbp_switchdev_allowed_egress(const struct net_bridge_port *p,Quoted 8 lines
net/bridge/br_switchdev.c bool nbp_switchdev_allowed_egress(const struct net_bridge_port *p, · line 75
Quoted 5 lines
net/bridge/br_switchdev.c +2
-1/* Flags that can be offloaded to hardware */ #define BR_PORT_FLAGS_HW_OFFLOAD (BR_LEARNING | BR_FLOOD | \ - BR_MCAST_FLOOD | BR_BCAST_FLOOD) + BR_MCAST_FLOOD | BR_BCAST_FLOOD | \ + BR_ISOLATED)Why add it now and not as part of a patchset that actually makes use of the flag in a driver that offloads port isolation?
The way the information got transmitted is a bit unfortunate.
Quoted 7 lines
Making
BR_ISOLATEDpart ofBR_PORT_FLAGS_HW_OFFLOADis a matter of correctness when switchdev offloads the data path. Since this feature will not work correctly without driver intervention, it makes sense that drivers should reject it currently, which is exactly what this patch accomplishes - it makes the code path go through theSWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGSdriver handlers, which return-EINVALfor everything they don't recognize.
Quoted 2 lines
If the purpose is correctness, then this is not the only flag that was missed.
BR_HAIRPIN_MODEis also relevant for the data path, for example.
I never wanted to suggest that I'm giving a comprehensive answer, I just answered Qingfang's punctual question here:
https://lore.kernel.org/netdev/CALW65jbotyW0MSOd-bd1TH_mkiBWhhRCQ29jgn+d12rXdj2pZA@mail.gmail.com/
Tobias also pointed out the same issue about BR_MULTICAST_TO_UNICAST in conjunction with tx_fwd_offload (although the same is probably true even without it):
https://patchwork.kernel.org/project/netdevbpf/cover/[email protected]/
Quoted 2 lines
Anyway, the commit message needs to be reworded to reflect the true purpose of the patch.
Agree, and potentially extended with all the bridge port flags which are broken without switchdev driver intervention.
Quoted 14 lines · Vladimir Oltean
Quoted 3 lines · Ido Schimmel
If the purpose is correctness, then this is not the only flag that was missed.
BR_HAIRPIN_MODEis also relevant for the data path, for example.I never wanted to suggest that I'm giving a comprehensive answer, I just answered Qingfang's punctual question here:
https://lore.kernel.org/netdev/CALW65jbotyW0MSOd-bd1TH_mkiBWhhRCQ29jgn+d12rXdj2pZA@mail.gmail.com/Tobias also pointed out the same issue about
BR_MULTICAST_TO_UNICASTin conjunction withtx_fwd_offload(although the same is probably true even without it):
https://patchwork.kernel.org/project/netdevbpf/cover/[email protected]/
Quoted 5 lines
Quoted 2 lines
Anyway, the commit message needs to be reworded to reflect the true purpose of the patch.
Agree, and potentially extended with all the bridge port flags which are broken without switchdev driver intervention.
So, what else flags should be added to BR_PORT_FLAGS_HW_OFFLOAD?
Quoted 15 lines · DENG Qingfang
Quoted 14 lines · Vladimir Oltean
Quoted 3 lines · Ido Schimmel
If the purpose is correctness, then this is not the only flag that was missed.
BR_HAIRPIN_MODEis also relevant for the data path, for example.I never wanted to suggest that I'm giving a comprehensive answer, I just answered Qingfang's punctual question here:
https://lore.kernel.org/netdev/CALW65jbotyW0MSOd-bd1TH_mkiBWhhRCQ29jgn+d12rXdj2pZA@mail.gmail.com/Tobias also pointed out the same issue about
BR_MULTICAST_TO_UNICASTin conjunction withtx_fwd_offload(although the same is probably true even without it):
https://patchwork.kernel.org/project/netdevbpf/cover/[email protected]/
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Anyway, the commit message needs to be reworded to reflect the true purpose of the patch.
Agree, and potentially extended with all the bridge port flags which are broken without switchdev driver intervention.
So, what else flags should be added to
BR_PORT_FLAGS_HW_OFFLOAD?
I can't think of others beside these 3, BR_ISOLATED, BR_HAIRPIN_MODE and BR_MULTICAST_TO_UNICAST.