From patchwork Thu Apr 20 22:55:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13219264 X-Patchwork-Delegate: kuba@kernel.org 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 CD8CEC77B7E for ; Thu, 20 Apr 2023 22:56:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233109AbjDTW4T (ORCPT ); Thu, 20 Apr 2023 18:56:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231562AbjDTW4S (ORCPT ); Thu, 20 Apr 2023 18:56:18 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2063.outbound.protection.outlook.com [40.107.21.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36E7F3C06; Thu, 20 Apr 2023 15:56:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZmUgpYLuQaBnoYtTAdiRGaCI/sqBojfhuk6At3vfWTHLjAQnqu7bnVpUKtoY/27fYg/EkMbJRATlHzV9pzABRYGM1RVAVRrCRvRfsb5EvA42xHjVvXQF+souaT6wezjKpfk6/lkJsPJDEihZwjBOMwRYQaC4ihC3mLMzkT6N4yYy1IOzu+DqcaaIB5GRp3PbGcu6gCYZ8tVTtxgf2/Rhp6o3PVLrGBhJvjyzBpFdghvofeoiJsn/R5l5U3QnQBf6XEd06+an6lPeW8noIRuX4Jlk+6okuSemENaid4z0Kn6wawFMsb4PCIA5xneGSfBQw0tTx2Y03+dPLqEOYBtotg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BbCd/MGRniqdetASdFqizhW2CBDY8IEYUP3mWHYLPXU=; b=hxbJTyXT39TrWSTyltH7YYTabRDJGvbbz5nW5jRgQIxTXbaPEGtAxxM3yRcwtW8Ziva40bgyM5nGSFH6kN2bB+83w5xkb9ksgh3a5z3fdjRmPw/2kgCLL6rogouDf5Sykc3crsVlUCIZAwaPT+djHoDGQfhNUL1hl9ZR6dprK3nf2AZNGBOHHZKBmRTEKFx+acVEYR1TYGvx4SYULnW1dmKQPMun02JcQ9v4u+IZOV4Y6KeSPhtPkevqtVM3KrkQgy+FbbQrotM40d4V+fMffpZ49KSZ81gWJHsnsje/LdethqxrJ1umg+lW9qUqDCWhAtQvwqE0vs9YXi0MuVWUdA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BbCd/MGRniqdetASdFqizhW2CBDY8IEYUP3mWHYLPXU=; b=B2wkNpSY2GvtHM5mAfB33IaHOVh55S9eOMALLWY9UmBD+aH+Tj4A+htJj6vcDR8YDyNHSkB2Jdj8aeM+1YoZUSLIPmpVpfIK6FS/OLrxxvmen/CKzT6jz1J+VThaCLhwmgTvC18ZjN7WTZRPZnKOZJ4Lispm3BtYDMDH+4GPKng= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by GV1PR04MB9213.eurprd04.prod.outlook.com (2603:10a6:150:28::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Thu, 20 Apr 2023 22:56:13 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::245a:9272:b30a:a21c]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::245a:9272:b30a:a21c%3]) with mapi id 15.20.6319.022; Thu, 20 Apr 2023 22:56:13 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , linux-kernel@vger.kernel.org, Simon Horman Subject: [PATCH v2 net-next 1/9] net: vlan: don't adjust MAC header in __vlan_insert_inner_tag() unless set Date: Fri, 21 Apr 2023 01:55:53 +0300 Message-Id: <20230420225601.2358327-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230420225601.2358327-1-vladimir.oltean@nxp.com> References: <20230420225601.2358327-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR03CA0088.eurprd03.prod.outlook.com (2603:10a6:208:69::29) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|GV1PR04MB9213:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b0d48ca-7637-4674-a67d-08db41f27081 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bculxy5lMfUnY0R7xr/cV4xx3aNh/jgTwasYVsdKgdpkQuvqlZx1GlaqdSpLVLYOSnq4jUoh8yICi3PtUn6n+/8W2TbgtWuBBVKfMJp4TB9OVLFMnF/tLHkhn3f7S2LOk3QNMqS0xRB8uz8en8yyEOPcou5E9bXQMWTrIQRoym+NHaed/IhsD7tHapl+5ZEkpL1qt2SHRkJNk72z5G3aAm+c94qzKN/srocVikz2tLSGZmUqopuELfsscw+kHyu0HffAGR1gZXCx76mAEflzeTRNuiyTo1Iy2fQB8uMEzOHlSWcE9nlLWvAC7BVSClQGkFwM4rPRX+nzITv9Wgo6aWv9teJH0aqeBDIeR0uLPoP1d8U0+l9E9AW1sYto5MiH7Q+2nMN/tnkwkbbes/7WSzBKdeImH4eABVIBF3vIeSNm+x5DAUR7vwUnjzD9Uiu1yLg5URFvjzOv27bNMet5opDM12sAPRKr53uggoYOmwyl0FiFaZXCb9KJSrKiT6yx+7UGUjjDMmRe0GB9VPtq//HmTk+rrmPmN1ugGUn3eeJfsILI0s/5dHxm3YRgFjQJHmgi3qB12LXmez+gjpwiGbIULqbgH/TP71wXBwLJcxzDOjMWVQFrI+/10HQUhKdv X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(376002)(346002)(396003)(366004)(136003)(39860400002)(451199021)(2906002)(38350700002)(38100700002)(86362001)(478600001)(54906003)(316002)(41300700001)(66476007)(66946007)(66556008)(6916009)(4326008)(26005)(1076003)(6506007)(6512007)(6666004)(6486002)(52116002)(186003)(36756003)(8936002)(8676002)(83380400001)(5660300002)(2616005)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: T46/nrInAgsV9YpHhwlNybpGThHwEPTOVWgGkIBwK6b9mEiQpbNHEgiqiYxpbSlJuPor7qqwLE0YU2diZM9LDsamfDqn+Sl9rE50LZLbuhVPDs1r7XVM1r4GJXGIYyh2wrtuFm2sbJxG2f7B7iSxfFPjeuHVOZt0bKOnbwrlxPvhEbr1pmS31t30JdgQv9CzYZZAspT7FaGj/MTQOrKBPEDyK6Ydc4cvQgOhjG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ITwrp788sUBaMs65lFu9BvreNulxiHYFa5PtqFUmOLYV4td4h8cmnr05JpdNzh5ER/eYkqJfrO59LIHMhU6w3tgu0jpzve1J/XLH8Q08plpnBkzxtpj9h3y4regCTw0dolQoXQXFdCzREngxTXhFJHkWvaGEAy5JR4rfSoapGG8XL/oYi4tVvme6PaIlokZmrlIjenTk6LGIN3mYGcqvlMJkEYI9GqJq84nLiqThYztZSOYHHvYB8rGPxt1vJ2i3XiKDXEMnuWJNSWBihQSnWARBiq48FyvC/Aq+SqLISL4mUQ9tKicj9FS+yig== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9b0d48ca-7637-4674-a67d-08db41f27081 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2023 22:56:13.0029 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9fZiXbFr3hdJJ4wveZgW25U0pL4/ZSffIaxi4GPHC92FyW9dJEHebr2eBG4YPZgG0tl08lWh6dHLmk1lhvCwww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB9213 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This is a preparatory change for the deletion of skb_reset_mac_header(skb) from __dev_queue_xmit(). After that deletion, skb_mac_header(skb) will no longer be set in TX paths, from which __vlan_insert_inner_tag() can still be called (perhaps indirectly). If we don't make this change, then an unset MAC header (equal to ~0U) will become set after the adjustment with VLAN_HLEN. Signed-off-by: Vladimir Oltean Reviewed-by: Eric Dumazet Reviewed-by: Simon Horman Reviewed-by: Florian Fainelli --- include/linux/if_vlan.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 6864b89ef868..90b76d63c11c 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h @@ -351,7 +351,8 @@ static inline int __vlan_insert_inner_tag(struct sk_buff *skb, /* Move the mac header sans proto to the beginning of the new header. */ if (likely(mac_len > ETH_TLEN)) memmove(skb->data, skb->data + VLAN_HLEN, mac_len - ETH_TLEN); - skb->mac_header -= VLAN_HLEN; + if (skb_mac_header_was_set(skb)) + skb->mac_header -= VLAN_HLEN; veth = (struct vlan_ethhdr *)(skb->data + mac_len - ETH_HLEN);