diff mbox series

[net-next,3/3] net: dsa: lan9303: lan9303_rcv set skb->offload_fwd_mark

Message ID 20171031144802.12686-4-privat@egil-hjelmeland.no
State Accepted, archived
Delegated to: David Miller
Headers show
Series net: dsa: lan9303: Fix STP and flooding issues | expand

Commit Message

Egil Hjelmeland Oct. 31, 2017, 2:48 p.m. UTC
The chip flood broadcast and unknown multicast frames.
On receive set skb->offload_fwd_mark to prevent the SW from flooding to the
same ports.

One exception: Because the ALR is set up to forward STP BPDUs only to CPU,
the SW bridge should flood STP BPDUs if local STP is not enabled.
This is archived by not setting skb->offload_fwd_mark on STP BPDUs.

Signed-off-by: Egil Hjelmeland <privat@egil-hjelmeland.no>
---
 net/dsa/tag_lan9303.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Andrew Lunn Nov. 1, 2017, 12:03 p.m. UTC | #1
> One exception: Because the ALR is set up to forward STP BPDUs only to CPU,
> the SW bridge should flood STP BPDUs if local STP is not enabled.
> This is archived by not setting skb->offload_fwd_mark on STP BPDUs.

Hi Egil

This bit is interesting. I had not thought about that.

I think we need a few more drivers to set offload_fwd_mark, and then
maybe try to consolidate it into the core. But it is too early now.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
diff mbox series

Patch

diff --git a/net/dsa/tag_lan9303.c b/net/dsa/tag_lan9303.c
index 18f45cd9f625..e526c8967b98 100644
--- a/net/dsa/tag_lan9303.c
+++ b/net/dsa/tag_lan9303.c
@@ -126,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;
 }