Skip to content

Commit

Permalink
net: dsa: lan9303: Clear offload_fwd_mark for IGMP
Browse files Browse the repository at this point in the history
Now that IGMP packets no longer is flooded in HW, we want the SW bridge to
forward packets based on bridge configuration. To make that happen,
IGMP packets must have skb->offload_fwd_mark = 0.

Signed-off-by: Egil Hjelmeland <privat@egil-hjelmeland.no>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Egil Hjelmeland authored and David S. Miller committed Nov 11, 2017
1 parent 2aee430 commit 4672cd3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions net/dsa/tag_lan9303.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev,
{
u16 *lan9303_tag;
unsigned int source_port;
u16 ether_type_nw;
u8 ip_protocol;

if (unlikely(!pskb_may_pull(skb, LAN9303_TAG_LEN))) {
dev_warn_ratelimited(&dev->dev,
Expand Down Expand Up @@ -129,6 +131,17 @@ static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev,
skb->offload_fwd_mark = !ether_addr_equal(skb->data - ETH_HLEN,
eth_stp_addr);

/* We also need IGMP packets to have skb->offload_fwd_mark = 0.
* Solving this for all conceivable situations would add more cost to
* every packet. Instead we handle just the common case:
* No VLAN tag + Ethernet II framing.
* Test least probable term first.
*/
ether_type_nw = lan9303_tag[2];
ip_protocol = *(skb->data + 9);
if (ip_protocol == IPPROTO_IGMP && ether_type_nw == htons(ETH_P_IP))
skb->offload_fwd_mark = 0;

return skb;
}

Expand Down

0 comments on commit 4672cd3

Please sign in to comment.