From patchwork Wed Mar 22 23:38:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 73699 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2631809wrt; Wed, 22 Mar 2023 16:49:37 -0700 (PDT) X-Google-Smtp-Source: AK7set9hzZ7cbco7nQj5OW6AaG9rE6JoGqw/hXOxx53zJVGft6/S81nqOH8yMXj0EVicTLuccZWL X-Received: by 2002:a05:6a20:699b:b0:db:7ae5:648e with SMTP id t27-20020a056a20699b00b000db7ae5648emr1139793pzk.21.1679528977615; Wed, 22 Mar 2023 16:49:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1679528977; cv=pass; d=google.com; s=arc-20160816; b=QpqLk+GCagWAofEj5uYJfI9fwZR1MaGZY8yxNbIe9tnXmT0xfc+CcIwIXxIR5a9rls l3AgkG/7BPJnsRsN078/2J2cxXBlwc0PwZ9T6fr1LaiLJ1HOHTRbIJReodhBgvomq9dv 4wlSc7NkS1L7GvAjpYjm/1qpCHreSC7A72SLbhbhqMO1tOs3h3ql34ybENq95hikFPCF IJt88fU2xV4Imn9c0FODc91kHKETmvUCaVas0I568jcZJHC5HXGv/slCI8RF+63JYkZu fTjHwZE5yCRd0rbXmBUfFsMYpeXy5M0o1Vm79ekhnq+EUfvYInP5livPH/fVWUvrHhHL q4FA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=u0nwgOzUkDp4+jLwDdKrO0jKDyMN991pliSwvJEgiJQ=; b=JZZuXGMiBegUJrGvGy4hFP7oFcZYq1p42Fo/I1uCtpSiF4FrXEP+jqAuPTuM5xrcrx Yjph5uClVf6SshWXH7+C5y63BmgboId3wVYMrM3q1cPfTKzFYZF7D1s6oraTLpv4qKek LryBlk3TimWLiVeEYxDYaHXws6WHdNy6e3gIKk/4dzSzlzzx0vL4KhwOXH39Bjn1WCCJ /PPeCjXOq7tIGRllQMyeVtex2LRTHjEGviweuSZKu+6Fi5RmXi/LtzLZs6tTa4CXEJJw JNGaSodmoF64o0DUketZ31HNg7Oq/Ph1mGmkRjX37whE7Xp+YufTA2W132tDDKFhdKXJ 5Bbw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=sO63j0a7; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w69-20020a638248000000b0050fae5d3584si5130637pgd.570.2023.03.22.16.49.24; Wed, 22 Mar 2023 16:49:37 -0700 (PDT) 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; dkim=pass header.i=@nxp.com header.s=selector2 header.b=sO63j0a7; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230109AbjCVXiq (ORCPT + 99 others); Wed, 22 Mar 2023 19:38:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230031AbjCVXil (ORCPT ); Wed, 22 Mar 2023 19:38:41 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2048.outbound.protection.outlook.com [40.107.8.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A9C919B1; Wed, 22 Mar 2023 16:38:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RNz57Caoj4S9mx3cRy4OYyhFkuG2+reKeTKWHnVfQpTa8ESCWGTPdtUcmJgfDb1CQCblFPpkgwjLZArp26U9DiE7l0FpRMcfaxaxFNryVZ5NYKmGXxoIxzyPCgLkU9KoC4tZhJarTVq1XtAY2UaOdGoTSw67Obq0fECUuTQsfA5F7iZIlnZ09ygKoLUxsE7mi3jJf20xHB95gjzl35hv02pQzdASv+BH9aMLyWTL+Acf6UGa1gZucS8NyRMxNv4lN7j7o3IybGnDqUBzlFpjGaQH8g6Ds94wS+q85K6rT/pnA47RfwVbQFOqALfuqIN1BJkNIhCP8eteMZdbhQMU0Q== 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=u0nwgOzUkDp4+jLwDdKrO0jKDyMN991pliSwvJEgiJQ=; b=lPnMRDxsgaOrT1JMvHjXvUDcng8sWTNX6titFO/2vO//OrlJLBTLcyanHGW/VZxO3xpb8JrnUmUmSjNScPt6g1wpTH7JtC9wWMK1IfP+3XfBwGqzDyGWNO/xJNFKR1ZUA8tYILrv7RqczoBtk8rsV6NGCVa0FOl5hZEIBjj6CPmXkfGkTDWbEKqwzhU28M5xU6a50TjS5nGrTS+DX3IRG7I1HlKr2Unyjy/XTIArxHnoilzPrAwGVw9SnCK0s07tqB0JhTTu0UtSQZs6iGtXv4gjcsiWRXRc+S5MG3j42s0E0FslDM9Xc1R/uQkEMKC53r3GEJFXoOvJmctfy+KRxA== 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=u0nwgOzUkDp4+jLwDdKrO0jKDyMN991pliSwvJEgiJQ=; b=sO63j0a74m2ae2iMjUA7aeUnQtP6Jn1o4IZgSAcZPl4DCDIdZsUBS8aE9/kuEy6+kHGQVkGVlbqnaaDXtnsdXe0KPEpd+cfqSlvikl6P1mqbRTwFuXnUsSVXJb9f0ItHopJ22ZAscPb5uSBYUI/Eu8zz1NJ7rfOz/6Vq7fCczrc= 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 VE1PR04MB7263.eurprd04.prod.outlook.com (2603:10a6:800:1af::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Wed, 22 Mar 2023 23:38:37 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::29a3:120c:7d42:3ca8]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::29a3:120c:7d42:3ca8%7]) with mapi id 15.20.6178.038; Wed, 22 Mar 2023 23:38:36 +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 Subject: [PATCH net-next 1/9] net: vlan: don't adjust MAC header in __vlan_insert_inner_tag() unless set Date: Thu, 23 Mar 2023 01:38:15 +0200 Message-Id: <20230322233823.1806736-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230322233823.1806736-1-vladimir.oltean@nxp.com> References: <20230322233823.1806736-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: FR2P281CA0081.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9a::8) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|VE1PR04MB7263:EE_ X-MS-Office365-Filtering-Correlation-Id: 0ef91e27-6a3f-48f6-7c16-08db2b2e8ebe X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n8MNN0q+wZ3YoGxc29TcxFqHFPMPtt/eON+jS8ehL3mX9cLGMttF/sUtGOguuR9yfD3kBEo00vdTMAkghDowmy6EwSuJx0M5TOWF0yISWwaEuzXChWeVOc4hvMfouc305BWep95qZc9KxJpGki/Juyoz/aQSC50NEGcvKdyp8N+dsnNzi084Xtgvag02jW4U3P8Ito+LmzUYOSFNP0Yx67H62ItyQYz8SQQXRIknm31WQOell/WggHIip7caw7QE5CSRHYBsAXaeI4Jv6CqQrvQugzGMfGotazwQ4RaOfwmYQFeBamacVz1UbcnyevYx79H/AFCxje7zNlN47t0+cvDQjZi+YNSv+rmd5FrUbnDxWSKH/f1p6W5XOQoThUYALjq6JVvCG/mfhGrnjjvTypvUuhi/1CSqJHjw+i9qaAiMCt+KccmovJkfbLuh9Ucc+mcwbevz7Wd+2guyvENZ9TYN7tatDP878UEIO4ybySX/i7If2MD7nODKlEEr8++/ICs5X3uzelMuTijPQWlaA9z8evzLK6zqcONb7LtRxI+K7v0UXfh8bojLB0GbUnE7SLTyNWGylM0y3bhwg+PyAbc9EnUij1jILTU+3JghdAARAwSUPhWBqxbyzN6JJWElRzLUgzYhgUZs2PRFjojjQ+SY1l4VZOaqrrPLC2DeVOssdWzSV65VAE434Eqm/EB9ht/xiG7QS8zKJA5npYipJHZZrh039rsIg3rNZgyVl/18EgYC4fUnC3GOnwySSKD7 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:(13230025)(4636009)(346002)(376002)(39860400002)(136003)(366004)(396003)(451199018)(54906003)(66556008)(6486002)(6916009)(316002)(66476007)(8676002)(66946007)(478600001)(6666004)(4326008)(52116002)(41300700001)(6506007)(1076003)(6512007)(26005)(8936002)(186003)(44832011)(5660300002)(2906002)(2616005)(36756003)(83380400001)(38100700002)(38350700002)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9TCiQQKEUDuXb4s5SL3NLQN4gc62T30HolErvfPwpbgXa7fvr6DnZshmWxTz2IJPZdSMFswX/JxHdA9uRkJoxA3MAqUkQvHx8s57TAiLMsGV4TD0CtBC7v/MN1ue5D4ShGLwZb+osTrPqnDyKoNEwolO+tJDpjK30ADQ+Z7ASW+Sx8c/IcAuiE9XVqQ/ZWhORUO6B2C3IZxde+Hzl490Vv/6KKUWPKEvwWKn3E47FKx5rgtzdcXnYwUJeU3+jPae+jw8m+KdkwKnBVQWgI6J70QCcsCXRCZYdmS62bhBi03z1wnz+plK+VIDAPd+ZnonzH2tUq4ezKkeQbSvhzZBD5ej003PCxbRHRHkv59ZFte2RRaKTE+SxEIEhr/2lxI0WRclvjJafFJuIROQuY2sl4Z8ExRNsChbp0u/jCaCOvGoWy8T2O+ZYQWBTXdg0iR1wPxUQDJaQdN8TxM0j6aHjCC+CNVbL51mqHbV7qHEgGU/esbQg/va6nguio7bv+TygZ5Omhb1hg1hRG9+Habc6wTuOniXm02Fh2nQRjLsaKzNnCH6bWU//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CrossTenant-Network-Message-Id: 0ef91e27-6a3f-48f6-7c16-08db2b2e8ebe X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2023 23:38:36.9207 (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: WRFDoVVswj2UM6BfqLDo/rPF38nQ+JTMZqoYK0EVHUf9v5pxvU9kK6O+TNXTDJud4K9c2vdux5rv5L2M69hy+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7263 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761113777226281799?= X-GMAIL-MSGID: =?utf-8?q?1761113777226281799?= 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: 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);