From: Egil Hjelmeland <privat@egil-hjelmeland.no>
To: andrew@lunn.ch, vivien.didelot@savoirfairelinux.com,
f.fainelli@gmail.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 2/2] net: dsa: lan9303: Clear offload_fwd_mark for IGMP
Date: Mon, 13 Nov 2017 12:00:17 +0100 [thread overview]
Message-ID: <2e0d170e-08f6-4009-e422-6faea463a0c2@egil-hjelmeland.no> (raw)
In-Reply-To: <20171110115435.4261-3-privat@egil-hjelmeland.no>
On 10. nov. 2017 12:54, Egil Hjelmeland wrote:
> 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>
> ---
> net/dsa/tag_lan9303.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/net/dsa/tag_lan9303.c b/net/dsa/tag_lan9303.c
> index 5ba01fc3c6ba..b8c5e52b2eff 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;
> }
>
>
RTFM, my bad. The lan9303 has both STP and IGMP bits in the receive tag.
It is as simple as:
u16 lan9303_tag1 = ntohs(lan9303_tag[1]);
skb->offload_fwd_mark = !(lan9303_tag1 & 0x18);
Egil
next prev parent reply other threads:[~2017-11-13 11:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-10 11:54 [PATCH net-next 0/2] net: dsa: lan9303: IGMP handling Egil Hjelmeland
2017-11-10 11:54 ` [PATCH net-next 1/2] net: dsa: lan9303: Set up trapping of IGMP to CPU port Egil Hjelmeland
2017-11-10 14:10 ` Andrew Lunn
2017-11-10 11:54 ` [PATCH net-next 2/2] net: dsa: lan9303: Clear offload_fwd_mark for IGMP Egil Hjelmeland
2017-11-13 11:00 ` Egil Hjelmeland [this message]
2017-11-13 13:02 ` Andrew Lunn
2017-11-13 13:04 ` Egil Hjelmeland
2017-11-10 14:07 ` [PATCH net-next 0/2] net: dsa: lan9303: IGMP handling Andrew Lunn
2017-11-10 18:22 ` Egil Hjelmeland
2017-11-11 12:50 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2e0d170e-08f6-4009-e422-6faea463a0c2@egil-hjelmeland.no \
--to=privat@egil-hjelmeland.no \
--cc=andrew@lunn.ch \
--cc=f.fainelli@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=vivien.didelot@savoirfairelinux.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).