summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-11-01 21:30:24 +0900
committerDavid S. Miller <davem@davemloft.net>2017-11-01 21:30:24 +0900
commit1f2c897cb1ceb97cd6060eac353754fe926cb3be (patch)
treeb545bef2c57085b3566c09ee6b0a8d95f3abad9d
parenta95157d72d638913422773ea6faa384ebe4d366d (diff)
parentf849772915e5501c25f69f4815daa8cd86194634 (diff)
downloadlinux-1f2c897cb1ceb97cd6060eac353754fe926cb3be.tar.bz2
Merge branch 'lan9303-Fix-STP-and-flooding-issues'
Egil Hjelmeland says: ==================== net: dsa: lan9303: Fix STP and flooding issues This patch set finishes the STP support, and fixes flooding issues. Patch 1 fixes a flooding issue in the previous patch set. Patch 2 finishes STP support by adding a ALR entry. Patch 3 prevent duplicate flooding in HW and SW bridge. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/dsa/lan9303-core.c2
-rw-r--r--include/linux/dsa/lan9303.h2
-rw-r--r--net/dsa/tag_lan9303.c7
3 files changed, 8 insertions, 3 deletions
diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c
index 4c412bd52319..c4afc8f1a66d 100644
--- a/drivers/net/dsa/lan9303-core.c
+++ b/drivers/net/dsa/lan9303-core.c
@@ -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)
diff --git a/include/linux/dsa/lan9303.h b/include/linux/dsa/lan9303.h
index 05d8d136baab..b2110e69630f 100644
--- a/include/linux/dsa/lan9303.h
+++ b/include/linux/dsa/lan9303.h
@@ -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
diff --git a/net/dsa/tag_lan9303.c b/net/dsa/tag_lan9303.c
index 64092325aac3..e526c8967b98 100644
--- a/net/dsa/tag_lan9303.c
+++ b/net/dsa/tag_lan9303.c
@@ -42,11 +42,10 @@
#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.
- * If the two external ports are bridged and the packet is not STP BPDU,
+ * If the two external ports are bridged and the frame is unicast,
* then use ALR lookup to allow ALR learning on CPU port.
* Otherwise transmit directly to port with STP state override.
* See also: lan9303_separate_ports() and lan9303.pdf 6.4.10.1
@@ -55,7 +54,7 @@ static int lan9303_xmit_use_arl(struct dsa_port *dp, u8 *dest_addr)
{
struct lan9303 *chip = dp->ds->priv;
- return chip->is_bridged && !ether_addr_equal(dest_addr, eth_stp_addr);
+ return chip->is_bridged && !is_multicast_ether_addr(dest_addr);
}
static struct sk_buff *lan9303_xmit(struct sk_buff *skb, struct net_device *dev)
@@ -127,6 +126,8 @@ static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev,
skb_pull_rcsum(skb, 2 + 2);
memmove(skb->data - ETH_HLEN, skb->data - (ETH_HLEN + LAN9303_TAG_LEN),
2 * ETH_ALEN);
+ skb->offload_fwd_mark = !ether_addr_equal(skb->data - ETH_HLEN,
+ eth_stp_addr);
return skb;
}