Tell the tagger which link-local groups the KSZ9477 family and LAN937x trap to the CPU. The tagger then no longer marks these frames as forwarded, and the bridge can forward them to the other ports of the switch, as group_fwd_mask and the STP state allow. With STP off, the bridge now also relays STP BPDUs (01:80:C2:00:00:00) between the switch ports, as a software bridge does. Tested on a KSZ9893: with the group_fwd_mask bit for 01:80:C2:00:00:0E set, the bridge relayed 20 of 20 frames to that group from lan1 to lan2 with this change, and 0 of 20 without it. Signed-off-by: Oleksij Rempel --- Changes in v2: - Commit message: say that the bridge relays BPDUs with STP off (sashiko). - Drop the helper comment; the field comment covers it. --- drivers/net/dsa/microchip/ksz9477.c | 1 + drivers/net/dsa/microchip/ksz_common.h | 8 ++++++++ drivers/net/dsa/microchip/lan937x_main.c | 1 + 3 files changed, 10 insertions(+) diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c index 095830fb5273ed4164af7955a5485290bf1e9c6e..17c55e4311eadcfb7974219c351aa7d88ea2819a 100644 --- a/drivers/net/dsa/microchip/ksz9477.c +++ b/drivers/net/dsa/microchip/ksz9477.c @@ -2127,6 +2127,7 @@ static int ksz9477_connect_tag_protocol(struct dsa_switch *ds, tagger_data = ksz_tagger_data(ds); tagger_data->xmit_work_fn = ksz_port_deferred_xmit; + ksz_tagger_set_link_local_to_cpu(ds); return 0; } diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h index 7b96d110b1f64f4226ee7a371da38cd7e5b3767a..76f08e4dd9235912b9515b6431284745f68c4341 100644 --- a/drivers/net/dsa/microchip/ksz_common.h +++ b/drivers/net/dsa/microchip/ksz_common.h @@ -7,6 +7,7 @@ #ifndef __KSZ_COMMON_H #define __KSZ_COMMON_H +#include #include #include #include @@ -836,6 +837,13 @@ static inline bool is_lan937x_tx_phy(struct ksz_device *dev, int port) dev->chip_id == LAN9372_CHIP_ID) && port == KSZ_PORT_4; } +static inline void ksz_tagger_set_link_local_to_cpu(struct dsa_switch *ds) +{ + struct ksz_device *dev = ds->priv; + + ksz_tagger_data(ds)->link_local_to_cpu = dev->link_local_to_cpu; +} + static inline int ksz_get_sgmii_port(struct ksz_device *dev) { return dev->info->sgmii_port - 1; diff --git a/drivers/net/dsa/microchip/lan937x_main.c b/drivers/net/dsa/microchip/lan937x_main.c index 6e95630f99008ea2c02fc4998a004a34d732b2dd..ddb495a0082a237199fc3c6aa35faea85bd4cb4a 100644 --- a/drivers/net/dsa/microchip/lan937x_main.c +++ b/drivers/net/dsa/microchip/lan937x_main.c @@ -916,6 +916,7 @@ static int lan937x_connect_tag_protocol(struct dsa_switch *ds, tagger_data = ksz_tagger_data(ds); tagger_data->xmit_work_fn = ksz_port_deferred_xmit; + ksz_tagger_set_link_local_to_cpu(ds); return 0; } -- 2.47.3