From: "Måns Rullgård" <mans@mansr.com>
To: Vladimir Oltean <olteanv@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Juergen Borleis <jbe@pengutronix.de>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: dsa: lan9303: handle hwaccel VLAN tags
Date: Wed, 16 Feb 2022 12:48:03 +0000 [thread overview]
Message-ID: <yw1xee432d18.fsf@mansr.com> (raw)
In-Reply-To: <20220215203606.5hipm6p7b34ja3ed@skbuf> (Vladimir Oltean's message of "Tue, 15 Feb 2022 22:36:06 +0200")
Vladimir Oltean <olteanv@gmail.com> writes:
> On Tue, Feb 15, 2022 at 02:59:13PM +0000, Mans Rullgard wrote:
>> Check for a hwaccel VLAN tag on rx and use it if present. Otherwise,
>> use __skb_vlan_pop() like the other tag parsers do. This fixes the case
>> where the VLAN tag has already been consumed by the master.
>>
>> Signed-off-by: Mans Rullgard <mans@mansr.com>
>> ---
>> net/dsa/tag_lan9303.c | 21 +++++++--------------
>> 1 file changed, 7 insertions(+), 14 deletions(-)
>>
>> diff --git a/net/dsa/tag_lan9303.c b/net/dsa/tag_lan9303.c
>> index cb548188f813..7fe180941ac4 100644
>> --- a/net/dsa/tag_lan9303.c
>> +++ b/net/dsa/tag_lan9303.c
>> @@ -77,7 +77,6 @@ static struct sk_buff *lan9303_xmit(struct sk_buff *skb, struct net_device *dev)
>>
>> static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev)
>> {
>> - __be16 *lan9303_tag;
>> u16 lan9303_tag1;
>> unsigned int source_port;
>>
>> @@ -87,14 +86,15 @@ static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev)
>> return NULL;
>> }
>>
>> - lan9303_tag = dsa_etype_header_pos_rx(skb);
>> -
>> - if (lan9303_tag[0] != htons(ETH_P_8021Q)) {
>> - dev_warn_ratelimited(&dev->dev, "Dropping packet due to invalid VLAN marker\n");
>> - return NULL;
>> + skb_push_rcsum(skb, ETH_HLEN);
>> + if (skb_vlan_tag_present(skb)) {
>> + lan9303_tag1 = skb_vlan_tag_get(skb);
>> + __vlan_hwaccel_clear_tag(skb);
>> + } else {
>> + __skb_vlan_pop(skb, &lan9303_tag1);
>
> Sorry for the bad example, there is no reason to call skb_push_rcsum()
> and skb_pull_rcsum() if we go through the skb_vlan_tag_present() code
> path, just the "else" branch.
I could have realised that myself, had I not simply blindly copied the
example. Anyway, new patch sent.
--
Måns Rullgård
prev parent reply other threads:[~2022-02-16 12:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-15 14:59 [PATCH] net: dsa: lan9303: handle hwaccel VLAN tags Mans Rullgard
2022-02-15 20:36 ` Vladimir Oltean
2022-02-16 12:48 ` Måns Rullgård [this message]
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=yw1xee432d18.fsf@mansr.com \
--to=mans@mansr.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=jbe@pengutronix.de \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=vivien.didelot@gmail.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).