From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDD00C433EF for ; Wed, 16 Feb 2022 12:48:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233406AbiBPMsS convert rfc822-to-8bit (ORCPT ); Wed, 16 Feb 2022 07:48:18 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229479AbiBPMsR (ORCPT ); Wed, 16 Feb 2022 07:48:17 -0500 Received: from unicorn.mansr.com (unicorn.mansr.com [81.2.72.234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 560F4202077; Wed, 16 Feb 2022 04:48:05 -0800 (PST) Received: from raven.mansr.com (raven.mansr.com [81.2.72.235]) by unicorn.mansr.com (Postfix) with ESMTPS id A047415360; Wed, 16 Feb 2022 12:48:03 +0000 (GMT) Received: by raven.mansr.com (Postfix, from userid 51770) id 9D701219C0A; Wed, 16 Feb 2022 12:48:03 +0000 (GMT) From: =?iso-8859-1?Q?M=E5ns_Rullg=E5rd?= To: Vladimir Oltean Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Juergen Borleis , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: dsa: lan9303: handle hwaccel VLAN tags References: <20220215145913.10694-1-mans@mansr.com> <20220215203606.5hipm6p7b34ja3ed@skbuf> Date: Wed, 16 Feb 2022 12:48:03 +0000 In-Reply-To: <20220215203606.5hipm6p7b34ja3ed@skbuf> (Vladimir Oltean's message of "Tue, 15 Feb 2022 22:36:06 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Vladimir Oltean 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 >> --- >> 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