Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp802195pxb; Wed, 16 Feb 2022 04:54:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJzyhM5hd3pjfHskBMyt/cnEjwc5SRwD8cFXy36KieTnl/CvoTL3x2wBif9y9Ye7PmdMjexr X-Received: by 2002:a05:6402:c10:b0:40f:33cd:a39 with SMTP id co16-20020a0564020c1000b0040f33cd0a39mr2836565edb.234.1645016065707; Wed, 16 Feb 2022 04:54:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645016065; cv=none; d=google.com; s=arc-20160816; b=fmPdEERw7gH8tPjRsFwM2CCeEIPeIw6Urxh0GqMbrZvIh8DFlA3Ti7FZ44A21VVwki Lq9AjzW1iMCrENKqZCwvvbfbhhzyfz+9wYHR/84AC6v5j6mbJbvJXOnUW120CZ9k/wHY W0pZV6KAFZkPpKQEBhS5+4zPUS3lQve0C6F58yxxTEIov6FIxzFpzzaEjjjrJFELeG6V RA8kB+ksZ+O++d/lSbIioTvGElTcqtQ3VX+wd79IUV/+flj7sZxCEbZGWchm1a56501y 0pOCkmTYYfECt7r0kDB/WUlBnxVBFhw/Ufwh7gjr2NPN0/ilBoEdMNH7GLLzwNZ8IrEX ZS3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:message-id:in-reply-to:date:references:subject:cc:to :from; bh=eLx5HbLakaFVkTYbZqCg0aJKDl6vjfjCAGTMAbzHd6s=; b=xuBntMyGdMQq6PDOpCvG1ALF9sjQNagRE0HQ9Av7I4WHNG8x8qBJODPIFu2GfgaXRX hFVypXkT2rh4ci6WErqkkeY95G4VZgcxvFsnM7S+B0d6IcZT7w0+iB0JZjWB9LTHs1bf lZ//7tcbylrnSEVizps6Mh28I17Lzg6qnCjKzQDZ+rq8j5p2S1ukoEeUVrgFsDOu5skq GQau4HOV4ff2voa2R9gMcDOvb+YBrPqffBzhIcfswRBpFiJz4Juj9Dh3L+a0RNCcwVPW 5O1BtzVpu7ZO/SP3IH/xfC1zuEAHThrXRGsXVNNHOTpslmvyAK97cmoAHSK++2j3VQBL /Tyw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ek26si1735679edb.292.2022.02.16.04.54.02; Wed, 16 Feb 2022 04:54:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233411AbiBPMsS convert rfc822-to-8bit (ORCPT + 99 others); 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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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