diff options
author | David S. Miller <davem@davemloft.net> | 2017-11-11 21:50:15 +0900 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-11-11 21:50:15 +0900 |
commit | f444ef510350c262a0532b95592df9e3899053e3 (patch) | |
tree | 7aae1b637fe1a69a312243476657dcd9917ec370 /net | |
parent | 940c9c458866725e0ade96d5c1c7dbe5fcf1cf85 (diff) | |
parent | 4672cd36053e4a8480f7ca796758d56ef23ccb78 (diff) | |
download | op-kernel-dev-f444ef510350c262a0532b95592df9e3899053e3.zip op-kernel-dev-f444ef510350c262a0532b95592df9e3899053e3.tar.gz |
Merge branch 'dsa-lan9303-IGMP-handling'
Egil Hjelmeland says:
====================
net: dsa: lan9303: IGMP handling
Set up the HW switch to trap IGMP packets to CPU port.
And make sure skb->offload_fwd_mark is cleared for incoming IGMP packets.
skb->offload_fwd_mark calculation is a candidate for consolidation into the
DSA core. The calculation can probably be more polished when done at a point
where DSA has updated skb.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/dsa/tag_lan9303.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/net/dsa/tag_lan9303.c b/net/dsa/tag_lan9303.c index 5ba01fc..b8c5e52b 100644 --- a/net/dsa/tag_lan9303.c +++ b/net/dsa/tag_lan9303.c @@ -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, @@ -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; } |