net: dsa: lan9303: Add STP ALR entry on port 0
authorEgil Hjelmeland <privat@egil-hjelmeland.no>
Tue, 31 Oct 2017 14:48:01 +0000 (15:48 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 1 Nov 2017 12:30:24 +0000 (21:30 +0900)
STP BPDUs arriving on user ports must sent to CPU port only,
for processing by the SW bridge.

Add an ALR entry with STP state override to fix that.

Signed-off-by: Egil Hjelmeland <privat@egil-hjelmeland.no>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/lan9303-core.c
include/linux/dsa/lan9303.h
net/dsa/tag_lan9303.c

index 4c412bd52319d88e51a035cf7dd2689d4a035bd7..c4afc8f1a66dfdc1b76bf53a6dfeb5950703ec1c 100644 (file)
@@ -773,6 +773,7 @@ static int lan9303_separate_ports(struct lan9303 *chip)
 {
        int ret;
 
+       lan9303_alr_del_port(chip, eth_stp_addr, 0);
        ret = lan9303_write_switch_reg(chip, LAN9303_SWE_PORT_MIRROR,
                                LAN9303_SWE_PORT_MIRROR_SNIFFER_PORT0 |
                                LAN9303_SWE_PORT_MIRROR_MIRRORED_PORT1 |
@@ -797,6 +798,7 @@ static void lan9303_bridge_ports(struct lan9303 *chip)
 
        lan9303_write_switch_reg(chip, LAN9303_SWE_PORT_STATE,
                                 chip->swe_port_state);
+       lan9303_alr_add_port(chip, eth_stp_addr, 0, true);
 }
 
 static int lan9303_handle_reset(struct lan9303 *chip)
index 05d8d136baab96b7b332e8822f00229c824499cd..b2110e69630ff902e422d69a11afc315a91bfbaf 100644 (file)
@@ -34,3 +34,5 @@ struct lan9303 {
         **/
        struct lan9303_alr_cache_entry alr_cache[LAN9303_NUM_ALR_RECORDS];
 };
+
+#define eth_stp_addr eth_reserved_addr_base
index 537ca991fafed4aa0a4607dfe45a66bb5382cd2d..18f45cd9f625f4aac8f68db92bcab117cf291033 100644 (file)
@@ -42,7 +42,6 @@
 #define LAN9303_TAG_LEN 4
 # define LAN9303_TAG_TX_USE_ALR BIT(3)
 # define LAN9303_TAG_TX_STP_OVERRIDE BIT(4)
-#define eth_stp_addr eth_reserved_addr_base
 
 /* Decide whether to transmit using ALR lookup, or transmit directly to
  * port using tag. ALR learning is performed only when using ALR lookup.