Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: dsa: prepare 'dsa_tag_8021q_bridge_join' for standalone use

The 'dsa_tag_8021q_bridge_join' could be used as a generic implementation
of the 'ds->ops->port_bridge_join()' function. However, it is necessary
to synchronize their arguments.

This patch also moves the 'tx_fwd_offload' flag configuration line into
'dsa_tag_8021q_bridge_join' body. Currently, every (sja1105) driver sets
it, and the future vsc73xx implementation will also need it for
simplification.

Suggested-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Link: https://patch.msgid.link/20240713211620.1125910-11-paweldembicki@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Pawel Dembicki and committed by
Jakub Kicinski
85aabd1f ce20fdd6

+8 -5
+2 -3
drivers/net/dsa/sja1105/sja1105_main.c
··· 2133 2133 if (rc) 2134 2134 return rc; 2135 2135 2136 - rc = dsa_tag_8021q_bridge_join(ds, port, bridge); 2136 + rc = dsa_tag_8021q_bridge_join(ds, port, bridge, tx_fwd_offload, 2137 + extack); 2137 2138 if (rc) { 2138 2139 sja1105_bridge_member(ds, port, bridge, false); 2139 2140 return rc; 2140 2141 } 2141 - 2142 - *tx_fwd_offload = true; 2143 2142 2144 2143 return 0; 2145 2144 }
+2 -1
include/linux/dsa/8021q.h
··· 18 18 void dsa_tag_8021q_unregister(struct dsa_switch *ds); 19 19 20 20 int dsa_tag_8021q_bridge_join(struct dsa_switch *ds, int port, 21 - struct dsa_bridge bridge); 21 + struct dsa_bridge bridge, bool *tx_fwd_offload, 22 + struct netlink_ext_ack *extack); 22 23 23 24 void dsa_tag_8021q_bridge_leave(struct dsa_switch *ds, int port, 24 25 struct dsa_bridge bridge);
+4 -1
net/dsa/tag_8021q.c
··· 286 286 * be used for VLAN-unaware bridging. 287 287 */ 288 288 int dsa_tag_8021q_bridge_join(struct dsa_switch *ds, int port, 289 - struct dsa_bridge bridge) 289 + struct dsa_bridge bridge, bool *tx_fwd_offload, 290 + struct netlink_ext_ack *extack) 290 291 { 291 292 struct dsa_port *dp = dsa_to_port(ds, port); 292 293 u16 standalone_vid, bridge_vid; ··· 304 303 return err; 305 304 306 305 dsa_port_tag_8021q_vlan_del(dp, standalone_vid, false); 306 + 307 + *tx_fwd_offload = true; 307 308 308 309 return 0; 309 310 }