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: 13184737 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 748A0C6FD1C for ; Wed, 22 Mar 2023 23:38:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230083AbjCVXin (ORCPT ); Wed, 22 Mar 2023 19:38:43 -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//IgQO+KK3EMzphT9zp5n54klejJqeOxDGQaqEzYzWXmHpE1hWC1lQvje0RSl5Ey/mtf8kv/Nw7l8pTiwQe5w5XIQMVmxaNyj3wj7xw2ibn5mAs/NhaoBzRUvVC65Bl6AiL0heZcQFuH6NdY0pRJeyrDP7YgrwHql2qd7M8DeFKSJBZruOTrqDWn2x11gY0pZM7fkxs6eAZIFZhbdRwkeeqh76hssamNM3Jnj588XaN7TDn5s6MXxe6hcDJDM0vDZIFKcBfURXljL3hEOBjELOeA6xIkreMhd5RzniflRAFdH4fK33HhyGaJ3i9HvhlW9znWLs2bJ+CE7TclCN2SCOPa8xROFUkUrVBCMvRievIjl+GnJVtT4qu4UGt9AXK1vxbPCHRg4RBzcvuBmzJzcOYUzQbYstb13gYcLET1hMmpy1i6c7/CWNKT8HTQozdQ9z3/I/Za8ZyebSIaqCr3jKmLkhoywdhDGI1x36d3M/JC3spdjfIWXpNyGxnbHrDwKyT6C7giqoJB+bJP6wGC9MBo4T5byvw/n8uNhvWbzOpV+lu+vHcHKgJx5v3au3r7ga5MRGqfX3QQqy1KBscIEQLMa6X8GxtQIASTzAAMg73keuo2okNFS2c2PMyHkgFwb8juhGiH1YUwN2uXzWyb806evsbufTW5mhTMh6nCl9F+fa4CsUyRDfgM1o4hvNukpxi68Cap36ccxMGaoOrixk0Bbe0IstTAugIXeRei6FteIPeWZjDaRKj+v/UW9Mk1V9HvQ5BDUP4zQk0mulxU6ExAA43NouUYExJUTK3adUTaImS6J5D9T+EW+lpvTPmc7bsTb5WxLR1jCdbOnave8ytlEnTXcJZstg0GTyHxG3lDHniIbgZowZO8w/TeD8YvUcKJH3B1K1GuUFozkN5AHOKGOszIfnydwLxLZr+PCJvO4Ctqg4pVixT3BOb1cYZSdH4xk0Eec/8xNjvcTxtLSZ5LFJgiC+zD/VxG7SOA7E0O8N7hMQ1qRvg5iie6PXUnvKDTQdD6vnVNhHwBYRPI8ckbplS5rA70gbg== X-OriginatorOrg: nxp.com X-MS-Exchange-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 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: 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); From patchwork Wed Mar 22 23:38:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13184738 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 D2C26C6FD1F for ; Wed, 22 Mar 2023 23:38:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229686AbjCVXit (ORCPT ); Wed, 22 Mar 2023 19:38:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230081AbjCVXin (ORCPT ); Wed, 22 Mar 2023 19:38:43 -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 7ADD81912B; Wed, 22 Mar 2023 16:38:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TJlBk9ICT7bSBcc4DzNi0IWE1m1Ht3I3mGbJn4ERy8IoBx1TIxVzdlFPu5IyL6R1YifolGINluE/AODYk3ciVRuwfuhyhPtHnQPeVxupw6ZO+QiCim4SRIIoEmlKxhcedZtLZWugnLeIWjuyyD39bey9gSybNvdzyUpsGjfHsCZFL7mwenLdPtfWHUURHrBLoMOqc8x/6NVkA0BIUawyyBUQd4LDXSPy5edqR46wUhuW909Kq4zCeY1qYpyZlSBgKjrKnaFQFYcHVDi8FFFTiABQUa0tqQDVGk02wpmcuLyasL+si6fFCKoBxyGHiuK/f3fDuMeiGC9tFLkOqciICw== 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=fMqwWlF76BPvn64Yt1dgtuQx/bzT8eTVldu38bx/etU=; b=ShAuz7o4jksDA4lN30vQyMBvZ6Au8urH4XYZKOxMJJtBb365M08wubsafCGopYPFvT51+tpcB/6TfhVsmhQdnOQG83F5QkwmD5sdGxZxpjzxMRlLZACYY01lY/arFGaYAmL5LcAYUgod8G+Ax7mXlsdUafIX3H2AetJQubW00W4d962o+6z/VrpaGkm3svau6ZNsLQn4URwpqA/4weYBKWWMEYguConHa7ta0Dm9M8BYNUZEVcgkW/yLe+vY1BwiDWMsOCgwWTpcKN1HCZ5uPSOaBfRuac1wtdgdszYOSWI8nKhWiS2I9APa1eu0ZSTdVHUbmitw0X9xYoUQA4nsEw== 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=fMqwWlF76BPvn64Yt1dgtuQx/bzT8eTVldu38bx/etU=; b=mFa/6Ql2WT3UX0rK36/FTSi6GTxZ0I3qvydM64m6QNtGJS0Oydvk8g1kjhgTdg5H4AQUJkiC+1DO+KEF/MZ6bgo022RBD6wKng5FNB+hDrFYDlYgs3nUS3BACPou6p3frHIt7mfTdBc6jCuHeaq1Swhvsqjq0qes5bmWf6CTMME= 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:37 +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 2/9] net: vlan: introduce skb_vlan_eth_hdr() Date: Thu, 23 Mar 2023 01:38:16 +0200 Message-Id: <20230322233823.1806736-3-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: e2676b32-c267-45b1-9b59-08db2b2e8f41 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3OselxUFFAwEHWZUe/0Wow+JfLbfJkiS3tKpXGrfp3txowUxei+U3kVGC7aB7eIWyt6How6EdmH6kZ5L+O9Qdo8xt1IwhDizUZtsd5OD2CMZlVs6iFptFk47sXk4KK+qLwGtMEdvIcQT34sORuhWZObHK7Wtd94/fkREpNvX+eJgw1pFXwn4+Ln0T/8Fbk62I0H5ADJ5boEPgBH565CrrRrUMg7rSQOGDCLQnc7OmqATuSfKWoU5BjUSZ1fyGPnFXc6AD7l4jGfub1mczsglPnASWEzkLWhkAfm7JeI574YozL5zoITT/FrQSSjZJ7WzHTPYlF9Lyqo3fg0UZtbfqGF1GhX22Hmoxv0d1iwY3Wc98WOQ1b0hY98Tt1Nvvlmn5qha0+JIIlVqiHoFTDjnMgDcPL3y8k39HyejpO65HjHxPzxhFC5XXl35dprpynG4u3NZlluaF/WSY9ix/rmGPrMIaya+0vDHMvcqfEInSIj7j6c0UzoLbL5xLXXiSW91AQwHmJp6Ti0WdKkggDl0xXHhR5J473IbG+PmVLScbWUo/da44L9mTA5gwRiRpuAsaQ55YkkwEWvmMKZGWdWtGydiNc+N9TRZhxw8l0DCWI72Ln7cFK3DHz1NJhnXbUQR91seU8pBCQp2rAy5eEQx1+ukkUe3tKeokKjG81pJFPGNgX0vEJ9Y8XvNPXmhWK7WHBehBDc6duMbU2zU0u2B+rTbwF6qUlmgOTMRAkiaZX1QN5jOp0DrRnfJW4eKY1YT 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: /3AglQ79NJbjTbSr07ajCUhtHW9F5Aoot0W4KN5BbOrZu2iJkcGqLVuDFv4IvJpPmcfJ7u3YX5pyKtmsaL2TmV9CXA+OH5/pin74ushkWoUCIseV+u8BlPPq7HrvvsNRwb2CcQUzogO+oYjolq6IA5aNoG7FtYjXDHTf6hvoMcIqa7kc86kmMFpkLJ0im9OzTOUKBWvvYEvgaA49/c2NrzOiMIWtcvpL1TcYOUxDYF6q6CbQRLCZo2jfTtFnDOIaSZumZ0ArAExK9FIUX1NrByV6gOhPBumnSsCW6qS/ZQLO5rYWx9oEFPY8pvCzoXMEMxCihUwpShlntDq2P4ggicIDOFXX4LPzmWRiOC7NdzVeI/m+a42v3n0cP3n9giAeBTKvnvW0c+3bLkmyZjs/L81qfcO0/9cw8famtctfx/Lgyj4OH5nuX2aWQHahBWSzFJhJ/ipwGEL2UVy2yvWH+NKnvpksZOEM6UDAuWp76D1hSlIyzr7JHY+QrGJ6aPonj2X38Wt2HJAN2xMWTgmcD7jbmAjAeWXkdg8jeomX3nVEQm+8jWKNWPPdIHEFy/cq62QBvM5gOnoBVdbkHAWXG9p261EgZRlTnuSRS01QO+1lC7j42yZxhrADgxatf1pF5OcZVrsusE39wR/5SigfOEKKA+snlqjQ6aCac8oJL2qLSzn5Xk6Fkc/czC1If/kzvk6Y88QZc2HUhDFGegqWyGkNNy+ITmE8oYjLlNCPRrLN3oTd1XOpJWgQ3SVMdlUILz4Iy14ESyXzoetZz3auIhXrQheGeB5UE9HNEsQxg6kibLMW1KOlj/4Xdfh9f0iS/ZF2AhZzFGfTKReHvpc97Y0MGdeYy/k2aKNSiBZTycuK2AqAmGB3LRlpHDccWZHWryid0QW9XRFR0L4eYIseTWMuVhY/vXDUhEDLPvPLz+4IVAQY//ksGtPpZhRQy00tUjhtPUoBTAYxbmb4xru6Y+DlOJwDwnbmJI7VuQpR5fkAxRrAg6w8YV312Kqg+4tKe/DgInMRD/zLqHsY8DgYCKn5mfDkZ7iqNq611O/9rKsQ+bOhAQJH2tIg4bKOHxmZE6k7mk8QwRnucO90HJOt9APLjO3+Ut2d6G4grEXSIepBqv4L6wZqrFJGIJ7uuUm1oEVAgLj4lATd/zOKZo1GA5K4PxChIGNhb6zZyauucule38KBjXz02XqXwGRIwqPttR2xpY2jnCOFv4/sieG9+RqITQ6bXWMkqrBqbICd4J4cCsnrnxKXeo4/KdCmGgcOxiOMgfAkxEFOQ9mrTRcAu2JW7T1H7ZH/NQR2Rme2sLG31hHIr3uUXJM28RIdxu5Qc3FsVDd6WIbTd3+C+ASi0QuK0Es3cN49zcCKfRZuLijg8Z+vPHQx9zKzPZHCkDNcRqpdpkOHxXblio4+MmStFeH45Q9dPzBiCzrHquKUI8/QN3u8jUfrE7cIO/QSrKKnPD6pn0FoN5KjL2mCdWXUtqzrfhx0djAXVor+udXPH+Yrn6CipKMh2uEzz+dbgrQslt/A6S5IrFETbaWl7X+5RzqdW5a9Wg/Iw0E3I08c/ol0eB15F+MwInyQoAv+LRImWEH47VRFqjr+TtYZVqxYAg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e2676b32-c267-45b1-9b59-08db2b2e8f41 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:37.6863 (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: IWl9oac/suGJq+SrxKmAmzhYlLZlf+dSAsw/0zJJNGUwSXkIoGlSD0iyrgEIOeOzlsxa0Xd50tQzCnoy3rss1g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7263 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Similar to skb_eth_hdr() introduced in commit 96cc4b69581d ("macvlan: do not assume mac_header is set in macvlan_broadcast()"), let's introduce a skb_vlan_eth_hdr() helper which can be used in TX-only code paths to get to the VLAN header based on skb->data rather than based on the skb_mac_header(skb). We also consolidate the drivers that dereference skb->data to go through this helper. Signed-off-by: Vladimir Oltean Reviewed-by: Simon Horman Reviewed-by: Florian Fainelli --- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 3 +-- drivers/net/ethernet/emulex/benet/be_main.c | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 2 +- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 2 +- drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | 2 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c | 4 ++-- drivers/net/ethernet/sfc/tx_tso.c | 2 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 ++----- drivers/staging/gdm724x/gdm_lte.c | 4 ++-- include/linux/if_vlan.h | 12 ++++++++++-- net/batman-adv/soft-interface.c | 2 +- 12 files changed, 24 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index 16c490692f42..4950fde82d17 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c @@ -1923,8 +1923,7 @@ u16 bnx2x_select_queue(struct net_device *dev, struct sk_buff *skb, /* Skip VLAN tag if present */ if (ether_type == ETH_P_8021Q) { - struct vlan_ethhdr *vhdr = - (struct vlan_ethhdr *)skb->data; + struct vlan_ethhdr *vhdr = skb_vlan_eth_hdr(skb); ether_type = ntohs(vhdr->h_vlan_encapsulated_proto); } diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index aed1b622f51f..7e408bcc88de 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -1124,7 +1124,7 @@ static struct sk_buff *be_lancer_xmit_workarounds(struct be_adapter *adapter, struct be_wrb_params *wrb_params) { - struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; + struct vlan_ethhdr *veh = skb_vlan_eth_hdr(skb); unsigned int eth_hdr_len; struct iphdr *ip; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 5caea154362f..7356ad965487 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -1532,7 +1532,7 @@ static int hns3_handle_vtags(struct hns3_enet_ring *tx_ring, if (unlikely(rc < 0)) return rc; - vhdr = (struct vlan_ethhdr *)skb->data; + vhdr = skb_vlan_eth_hdr(skb); vhdr->h_vlan_TCI |= cpu_to_be16((skb->priority << VLAN_PRIO_SHIFT) & VLAN_PRIO_MASK); diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index 32cce90abbb4..81856f444d38 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c @@ -3063,7 +3063,7 @@ static inline int i40e_tx_prepare_vlan_flags(struct sk_buff *skb, rc = skb_cow_head(skb, 0); if (rc < 0) return rc; - vhdr = (struct vlan_ethhdr *)skb->data; + vhdr = skb_vlan_eth_hdr(skb); vhdr->h_vlan_TCI = htons(tx_flags >> I40E_TX_FLAGS_VLAN_SHIFT); } else { diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 773c35fecace..eae6c89e62f4 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -8818,7 +8818,7 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb, if (skb_cow_head(skb, 0)) goto out_drop; - vhdr = (struct vlan_ethhdr *)skb->data; + vhdr = skb_vlan_eth_hdr(skb); vhdr->h_vlan_TCI = htons(tx_flags >> IXGBE_TX_FLAGS_VLAN_SHIFT); } else { diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c index 59d0dd862fd1..1d1e183d3a8b 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c @@ -1854,7 +1854,7 @@ netxen_tso_check(struct net_device *netdev, if (protocol == cpu_to_be16(ETH_P_8021Q)) { - vh = (struct vlan_ethhdr *)skb->data; + vh = skb_vlan_eth_hdr(skb); protocol = vh->h_vlan_encapsulated_proto; flags = FLAGS_VLAN_TAGGED; diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c index 92930a055cbc..41894d154013 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c @@ -318,7 +318,7 @@ static void qlcnic_send_filter(struct qlcnic_adapter *adapter, if (adapter->flags & QLCNIC_VLAN_FILTERING) { if (protocol == ETH_P_8021Q) { - vh = (struct vlan_ethhdr *)skb->data; + vh = skb_vlan_eth_hdr(skb); vlan_id = ntohs(vh->h_vlan_TCI); } else if (skb_vlan_tag_present(skb)) { vlan_id = skb_vlan_tag_get(skb); @@ -468,7 +468,7 @@ static int qlcnic_tx_pkt(struct qlcnic_adapter *adapter, u32 producer = tx_ring->producer; if (protocol == ETH_P_8021Q) { - vh = (struct vlan_ethhdr *)skb->data; + vh = skb_vlan_eth_hdr(skb); flags = QLCNIC_FLAGS_VLAN_TAGGED; vlan_tci = ntohs(vh->h_vlan_TCI); protocol = ntohs(vh->h_vlan_encapsulated_proto); diff --git a/drivers/net/ethernet/sfc/tx_tso.c b/drivers/net/ethernet/sfc/tx_tso.c index 898e5c61d908..d381d8164f07 100644 --- a/drivers/net/ethernet/sfc/tx_tso.c +++ b/drivers/net/ethernet/sfc/tx_tso.c @@ -147,7 +147,7 @@ static __be16 efx_tso_check_protocol(struct sk_buff *skb) EFX_WARN_ON_ONCE_PARANOID(((struct ethhdr *)skb->data)->h_proto != protocol); if (protocol == htons(ETH_P_8021Q)) { - struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; + struct vlan_ethhdr *veh = skb_vlan_eth_hdr(skb); protocol = veh->h_vlan_encapsulated_proto; } diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 8f543c3ab5c5..918de65fb707 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -4554,13 +4554,10 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) static void stmmac_rx_vlan(struct net_device *dev, struct sk_buff *skb) { - struct vlan_ethhdr *veth; - __be16 vlan_proto; + struct vlan_ethhdr *veth = skb_vlan_eth_hdr(skb); + __be16 vlan_proto = veth->h_vlan_proto; u16 vlanid; - veth = (struct vlan_ethhdr *)skb->data; - vlan_proto = veth->h_vlan_proto; - if ((vlan_proto == htons(ETH_P_8021Q) && dev->features & NETIF_F_HW_VLAN_CTAG_RX) || (vlan_proto == htons(ETH_P_8021AD) && diff --git a/drivers/staging/gdm724x/gdm_lte.c b/drivers/staging/gdm724x/gdm_lte.c index 671ee8843c88..5703a9ddb6d0 100644 --- a/drivers/staging/gdm724x/gdm_lte.c +++ b/drivers/staging/gdm724x/gdm_lte.c @@ -349,7 +349,7 @@ static s32 gdm_lte_tx_nic_type(struct net_device *dev, struct sk_buff *skb) /* Get ethernet protocol */ eth = (struct ethhdr *)skb->data; if (ntohs(eth->h_proto) == ETH_P_8021Q) { - vlan_eth = (struct vlan_ethhdr *)skb->data; + vlan_eth = skb_vlan_eth_hdr(skb); mac_proto = ntohs(vlan_eth->h_vlan_encapsulated_proto); network_data = skb->data + VLAN_ETH_HLEN; nic_type |= NIC_TYPE_F_VLAN; @@ -435,7 +435,7 @@ static netdev_tx_t gdm_lte_tx(struct sk_buff *skb, struct net_device *dev) * driver based on the NIC mac */ if (nic_type & NIC_TYPE_F_VLAN) { - struct vlan_ethhdr *vlan_eth = (struct vlan_ethhdr *)skb->data; + struct vlan_ethhdr *vlan_eth = skb_vlan_eth_hdr(skb); nic->vlan_id = ntohs(vlan_eth->h_vlan_TCI) & VLAN_VID_MASK; data_buf = skb->data + (VLAN_ETH_HLEN - ETH_HLEN); diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 90b76d63c11c..3698f2b391cd 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h @@ -62,6 +62,14 @@ static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb) return (struct vlan_ethhdr *)skb_mac_header(skb); } +/* Prefer this version in TX path, instead of + * skb_reset_mac_header() + vlan_eth_hdr() + */ +static inline struct vlan_ethhdr *skb_vlan_eth_hdr(const struct sk_buff *skb) +{ + return (struct vlan_ethhdr *)skb->data; +} + #define VLAN_PRIO_MASK 0xe000 /* Priority Code Point */ #define VLAN_PRIO_SHIFT 13 #define VLAN_CFI_MASK 0x1000 /* Canonical Format Indicator / Drop Eligible Indicator */ @@ -529,7 +537,7 @@ static inline void __vlan_hwaccel_put_tag(struct sk_buff *skb, */ static inline int __vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci) { - struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data; + struct vlan_ethhdr *veth = skb_vlan_eth_hdr(skb); if (!eth_type_vlan(veth->h_vlan_proto)) return -EINVAL; @@ -713,7 +721,7 @@ static inline bool skb_vlan_tagged_multi(struct sk_buff *skb) if (unlikely(!pskb_may_pull(skb, VLAN_ETH_HLEN))) return false; - veh = (struct vlan_ethhdr *)skb->data; + veh = skb_vlan_eth_hdr(skb); protocol = veh->h_vlan_encapsulated_proto; } diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index 125f4628687c..d3fdf82282af 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c @@ -439,7 +439,7 @@ void batadv_interface_rx(struct net_device *soft_iface, if (!pskb_may_pull(skb, VLAN_ETH_HLEN)) goto dropped; - vhdr = (struct vlan_ethhdr *)skb->data; + vhdr = skb_vlan_eth_hdr(skb); /* drop batman-in-batman packets to prevent loops */ if (vhdr->h_vlan_encapsulated_proto != htons(ETH_P_BATMAN)) From patchwork Wed Mar 22 23:38:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13184739 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 850ACC6FD1C for ; Wed, 22 Mar 2023 23:39:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230182AbjCVXjD (ORCPT ); Wed, 22 Mar 2023 19:39:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230119AbjCVXit (ORCPT ); Wed, 22 Mar 2023 19:38:49 -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 4F23223A41; Wed, 22 Mar 2023 16:38:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KoQBd+W2fkNBvHJWgkx7y1/LtGiTKXi79xhpdnbrlVy5082jVZhyVKu2VQLXPQS64VN8U3eY0lUiMhAppb3qa4ynTgcPbS5szP15xhGSss2cNBkuhIQbSmjvwno7qia06d0syJQeiOoD19MMEoCeemKG6C2Tk0uCAbqPZmB1FsYfH+/ad/skNkqdYj245b9UVzvjTbAjGAZryx3WT/eAPBXoZoIvk8DoFuaxmbRZJaiyWxKZ3oDc4lwjNmr9xNm9602LQxxACaNSarFmMWkhDscf4HXtMUPCGF8hFPhJdtqBXcrT2GsjTbW7JuN233lDoleJq31REIGPNuy7U7si+A== 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=sWoNA2qGlTD0NuWmXD6qB3Ml+r6i7UOgwiv8FaImTM8=; b=AVP7OChsL+YwSaeAVgtyEm1+lUZGdfEm2OR/cI2cAyKz2UbkWp+asbZLiW7gHajA1pOdGhiMNfzcLRDllaB4mcDfJEfrN4tXEvwkgiMKHSA051nRjHgbu84MRv0FZnp7RV/tOXp9CR+R6BqkyOS/NmMUvFWXBtd5awQ8HJbonQkY6E8e6UeSE2h/6kHWxzmoIcL/7BwtS0MS9okHIV5JgmOxiIPNO/BtAD/hDLgkidxhevPegjNBx9h4hyKrtSjZXOP4E5fDHj6E1CeZX2O/BJY7O+WlZ/gXV+UD0tf4roJL/sJ99yDXCTUPMMNygJfSnNSMuJDLzVt+DvOAgVFcTQ== 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=sWoNA2qGlTD0NuWmXD6qB3Ml+r6i7UOgwiv8FaImTM8=; b=U1Jgs9chbODeZsWgwdMMGaFADzDUJ5Q8+l2zBi6rjvo9o+70vdLNW6liUxClWMcgDnr03ngjmAWntdwnRAhD3YIkc2/CUkWfqa+q8WaaeeDe0J3cGefQGljUEGDMIuCkw9y9tXtUpe4h2kYgbzvJxhZHXtRBofahM4fpC5R7J0I= 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:38 +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:38 +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 3/9] net: dpaa: avoid one skb_reset_mac_header() in dpaa_enable_tx_csum() Date: Thu, 23 Mar 2023 01:38:17 +0200 Message-Id: <20230322233823.1806736-4-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: e153b579-4170-429d-6cc3-08db2b2e8fb6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 12qFDzNXxBtwnMzMx9dqUAQs3yzfb9dPTSTiPgxVM+R6d2yVnGz+Bq3aYmvrTzFZug8UKiIAbPIRYkn9vR7e9TXqvxvVK0CvGKsCGCJqY3QP10gZrp/lKWAfqisUTuwDYwvHpbeuLH2XMtHNyggT0wQLU1Qj+BdMa4JmipMNX4Y9dgoyCSepUyK9S3elHv8Ixqvs3A/kqjOxxuO+xGvn1GHkagjYQMCt1gavc0lqLgwHYZ6v7EGWVgzGXqKDO1993vbJb+getRGrS74Bwrb/M7D26aZxgxrzMpiQYicV/061KTPK0v/xjEhYTYfcilyqVVhfRqdXK0aGzprjodVbN9PXysHOC9y9D0nyI9aH3eUTwwOIA9J/eZf88vr+xEHddybm5uWxMuwPV4wt66dHjOVfA8IRwd+dnMO55fIDPf1JIUrSu8ejlm4imBGLKLDkd2on1wbzdnB1K2LsKA3342CZxOTjhizsKofIC9wAryEEVrqEtLNyDPJiyy8EphOHTkfZchwn2lljjLm/MEWvGypkHSkhgSvUPoj8buHAzTQAE7qMP6BR/UMds5GHx5+mr12BASewZuWWiM+fjEf/VC9hEid1Mg75hL+07O/LkXZEaLSeIzqxTTfTyjS5/6WBJgESzuOGreH2y9KuXW/5aHvfI92R1oEB2GDbFpGTSH8T3gfp3SV8VIb+/o7U5yJXcR1JsONGF6G+GNqAAUiqif2CYrPS86wDd5WKeo0xFArdoREzr++vx2C3caukQqMW 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)(66899018)(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: HdXlWNh62kuoPvEAEOxZc+vAqB5IVImmyiZXHWXdRjOqGVprjoOKB+hb7TjQ6B+d3gdNH/kJ1zCP4s+Qc//3V1cT2mBYnecetQD8nGGfbKPhuEg1Rhl/x5ZgUAyBqjQA+v1CLfZX9FIfuJ39iwQbtNcg1OUokWVqtNn3ZDzGHnGtg8tATEn6r8ZH7o+Oyqb3eVWCyvkuy3OEC/xyAYmdNEe95kxePJhVQjhJAViTJrLjrEOeVlmb+3mkZTtDohmOb00JhkgxldiwMqxq3io4sqNrR8crKv4a3PNYixamlg30Lk1+TPbxXpoN7pBoeNaiWnEhNT9hj9YKJjML1d0oZZ2V6gJYzmXAB8lhsKt5fTeknc2iwvirJqAPC+C8V+VSHIVrUO6HSDFf9T05KGqw1X4q3LJBFVNq3eZONw+OTFyEIcyrGhhOMytbaNDm78LUz83RbxvtE5QWhQLP8dEpvjbXNxUMVScMt7dMlNXOGsl4JopsB+gj7zvwZ0q5wORbl9/ypO2xnADfMaUBT2VbRr+J5UbsammnrL54VXeaVVtIQScKXgebdD8P2yf5zTsfeqjlFvL7XqZKojoeziw0cZyzDzjWeGnMJOLT6HSEIwB6lIYcA0JrqjsaRFSIusqUMNTOW2xA7DddPnMEqteCcJCUL8XX6PklVQdIKvmh1ui7sq73QIx4oZ5BWvIDC6y/pQ2oD7xwdwDOhWXyA0p9u1U0hYuLT2n+Z7K/7OWkEAR5Yd/hYD0lYWtlVZf9zE+gVXn5PzVva/ibr+fYeUkTF00jzT1z/2sTgG2zIF3kdR0bD4/xRnS6iRo4wHb3khwAaJxtWu3xCmIUE/IM5LnsXR7kuzU5Ub+M/0zoqiMiq/xx2IWiPQY2vHktaq8iD09U7h4NYpAouvTvZwrcQdyNys1Q8VSLt9gmoqO+P/hevOimgrX9X/9u/UF+ws78dNPVNzge9O6P7lRG3OVkUyP97CFXnK5pEbIXn4JZBc5HtcCiGJn0KUKQ2Z+1PgqjBLb5Dw71QCbm+TTYm1zUVyGuf+rUYo1WfWuaX3qnGGQ0R7v8KU5NE/IkK8jcvBYeXv6CmV3ncbffkHh1CWOMtdVd326Pqlmqqm0c9xd8OMKT+CbAXadmm4BLQkHAA8MR+ho5Kc66rj3/03X7XUodpW+Wa4aYmJjxU617GJFyPWKdbSpI1MCrH3RubJY+Cud4tASl2zKhRiHJ3Wp/urzSYB82RvJwG+3eNV1prOozIu+UDSDDdLwnGEaJ7gWBnCFhOoIssQXPdoZOzMVjBDRuxSfU4u0ceZyqopppe5TYmfrLSEOK9lNBq5QcMiIUFEnNOm5PpBo96QCmE8ErVkzg/tLVVdkdqhoF/r1mbG9NQTDtui7DCcHfxbQbvoNtTpjYFli2fRV1nWb8B/gz2Bz2PFip5i4mLAUPObvzKShf4O3kpX1nybNwJZY6u4KF/13kGHZM+o1cNT8b90wAbX3PbdhpAqwKxeM2uAYH1nd0HjdijsYcMg/TE64AQLChfw3VfMeCDHGc3wsCq/g5WJvXYM9GF01w/Aep0wxmiHdM7vRgKNsKh/rxzTUiw+zRe4H04UFupk7geMoogWmDgb92DJoQcw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e153b579-4170-429d-6cc3-08db2b2e8fb6 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:38.4050 (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: FNPfb0VGiv0Kh2RkZXC+eBSwgmb3aP6dl7z2irn7+s9JBzVMdW7mzhGUr4bv1IB5/nCRrIPiUcm4PEX97JjJjg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7263 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org It appears that dpaa_enable_tx_csum() only calls skb_reset_mac_header() to get to the VLAN header using skb_mac_header(). We can use skb_vlan_eth_hdr() to get to the VLAN header based on skb->data directly. This avoids spending a few cycles to set skb->mac_header. Signed-off-by: Vladimir Oltean Reviewed-by: Simon Horman Reviewed-by: Florian Fainelli --- drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index 9318a2554056..1fa676308c5e 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -1482,13 +1482,8 @@ static int dpaa_enable_tx_csum(struct dpaa_priv *priv, parse_result = (struct fman_prs_result *)parse_results; /* If we're dealing with VLAN, get the real Ethernet type */ - if (ethertype == ETH_P_8021Q) { - /* We can't always assume the MAC header is set correctly - * by the stack, so reset to beginning of skb->data - */ - skb_reset_mac_header(skb); - ethertype = ntohs(vlan_eth_hdr(skb)->h_vlan_encapsulated_proto); - } + if (ethertype == ETH_P_8021Q) + ethertype = ntohs(skb_vlan_eth_hdr(skb)->h_vlan_encapsulated_proto); /* Fill in the relevant L3 parse result fields * and read the L4 protocol type From patchwork Wed Mar 22 23:38:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13184741 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 97C98C74A5B for ; Wed, 22 Mar 2023 23:39:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230144AbjCVXjH (ORCPT ); Wed, 22 Mar 2023 19:39:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230081AbjCVXiw (ORCPT ); Wed, 22 Mar 2023 19:38:52 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2054.outbound.protection.outlook.com [40.107.7.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70F4828EB1; Wed, 22 Mar 2023 16:38:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NO7ST1lKfcHN7fq+fRGa3MM0UL3GkdLVVD8jfRZaPnWIdzT+0qJBxAkbLYkhKs/zU+yoAI5cSO5g2q/MMzq5RJqWiz+DHb6U93ce5J/oKmaP0rjeqDGFEDJQL6IUsFV1VqI5/Ub/HcmVfu1rXyMPHPUG1Lo0XFr+DyL/XlB+Sr2pb/y5boPXeBCwvJ9slVdVKq2uYwpwCyI4roIyI/ftJy/QfzALOrz5YRkBLLDq3zoCB3mwPrpimNlNlMq5D8SZ39+OKdMOw/wtKxPpKGSFOHI96uy8CYGd6drPi7zCefoU5qfi0ttNC8ateTRCqoGiaKxNBvwCmLvF7NTDK4ZC7g== 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=LQC9E1mKKbfbWTDhyi3o27SFOVt3LJpkRfuGkf7z2b4=; b=PscF8wONmE4VhsdWkZK5/tSDlEZZk0I7tZrgYOmIm0U3qq5Auo3hLQdRau/fpfzTPuIrYIF0RL7DpvILs1ZLW3Scvv4hiZTUH3fay8kMRo8geUF+B4ovvNVGrwmHb19DGsNOrkUwoTlJycUyDqlh6br7rQDR5fM2aKwRxswaYVdHD1I33cxAr3EKMLycKOmqpe4A+HpGjEjqWYz9cDZDj8WuLAdcl0dHcK+OzadbU3QbLsQpjgVDeHqxcanMJDNBLDetdtF1oX/1ZALe/F4s+NmmGh8XCRXW4T1HgVUhrpfzA2Ib5tDtlGzoTTaEKpFzaSwbcoLsFPiZ30w5hybn5Q== 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=LQC9E1mKKbfbWTDhyi3o27SFOVt3LJpkRfuGkf7z2b4=; b=ms14ngxnwWQctn0yNdgFI1HILUcEpxAya6OO4Mvz4Qoty9bIzQkckbCAWZp0JxG8eIAHzeR18HGo4nRmQPOks9hTJa8JAs79V6PPrkUzPKU1Ar7BIcyLNDqdzR0NCjjCZJUMsgMfrTQEKt+AnaW82CtNQTpNZLQJ1AFoB4vSW5A= 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:39 +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:39 +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 4/9] net: dsa: tag_ocelot: do not rely on skb_mac_header() for VLAN xmit Date: Thu, 23 Mar 2023 01:38:18 +0200 Message-Id: <20230322233823.1806736-5-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: e4ea8d63-45ff-4571-1735-08db2b2e9024 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2hoNJSISGJO4SDc6puM3sQezirHFF5V5D104GAe4/n61CwErYLX6LKrUHPzdzqMaynukYKU3eovtAqe6K6AUY0Qbd5ippKDj6Rfm9MoyB8pwCsnQ4iAnjiEis34jvnm3qBk5rZfcnCavttjQrBa7Jfgdj8UArK7SB4hI9A3zy/sF4qb+i5HqUBSUzNBo3f72sm/QuwYIkmHx1mV1vUkS0+Akv3QAnMeSt07UrGRAL3kdxYQ4j8U2dY/svSyBEocKhNlcU27PHIwTFIwqOhJ5UoIVXeZxFHgRx3dKzdTDNAl+5teWypmOd2RZdqFT7igtU6gNoDKHs+3P2pO/5b3CemBXEK6MVV7njZMu4UDPLaPXij+XH6/FhQKKyaldzPeMeFpBv9P1QSuqmWbyE7zry+Zt8CbR1kHPoDbHs3iTWUIe+EzjJTxJOe5CuNWAcjGBtfnAXDnu8PjT5sqkVDIxdK83CRphqzIRX6J+SA0/shrgw4VVvTqMt0uLHgbyiIppywGi8amC6TiK7zFy61gFgI/bK/5K+i2pEGWhTDA6YAf7K9j/QHFXcbNIQRwt9jte+fvEh0059ZYT02sHI8w32yp3Si1t61ZpImfdWZ9ucfQHTOzFYm57kEv9W3CHpMiql5pym+pWUFCIWdS7TCxT5kKh54tRedDghyoOTtiU9Vl8shz1ues2VuSjo8Kf7Vm0sHZp2QLe+xHdJLHz2c3H6bH4l7/Pej77+RvLOTAsbircg4/Gpg9El3UsinPZlYCP 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)(4744005)(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: ui1QyEv+Ene/tmOgOlofC2syhIIG2d3QJFLPrqYRqMbayDf7pQUcqDKXzI0GtTTqQe05q3wqrg+fH5WeLkIIlYYdmH34yiw0pFsJh6SninBS/MkFSNxetKPyHRmFwnELP3aQ8rcCPucH3U2BlXzEN4Zsu4z0xvZbJfF5r9VIKuxz1/J1ZVrpEVwK994opFrCRDKCJaeuJ4HN6kDEjxCKpHQkID2a9W+9Xs5i7T2Ph3HNuXTKKEhaLvR0dFtcC/JRvSi2vfTWaZ7qklil+NQiMnADyjQAe4dNScTjp2+YIGbxfaPD461Q5llt+H4CIyx+58NjhPUifiKemgOXMA05Ft/Xb062SeIorJKXuRUW+94yTToqOKR2HIGdltV0G1tZuQhi3+hb89AgU7Nw8AlfDNrdmVb887FFj2kgJJdP+2uoqWRJIHRSlEF4DSJgtF6CTH1BrAIBNqN8xZkclqRUb/ohdDwCFrrJqtEL1qERb/xqIJ+BVRrH0B0ssTtKBgWEX+fiGc2MmoCwy7eXERcaRcL5VviXvPcVGxtIu+lsDGNMVIAdVxXe+wahfL08ezi9QREs9GIdNzXd+Qj9IMT2mZINzBslzl73BryBIEXed0eyitJ369Sq9F3LAPsugx2jvIiIiQy6IYjPlbn+EOtEJoT4H794FaGTiROW0/7+Pw+HQpOMYcrDgv8CJTEa7JGqR7yIqkQY/ppqKn7mLHl4oDUecLH+8QtaU0dJ0AYoM54MZCe2e96YQWHou0LTBUJV3lcpNFbEZv9+SxY85woJbhJwlWhOyOYHnss98sLFEuQljICFx23+94vBo24wm1yk/6wEcxh46h/VcJIpsKsXT0NpBeese5Kh5+R2CL16Iu+k/D36cnRDiyWpF3P1MulRtNC9gIXXTY3KkOaIj6G8uI3NDCpyPCslEUEvDYIF06atQaZJ4e27nm3nzal/QIF1hN/B5oO3i4hfiCngQPlEI/TjKENA3YOycnZ7KPC+8Yy881FW8XeyL/8S0/NYB4Co1WRz0KpozAqClJ7e8+JcoStodbuBDg1oMLguNDAstqEFViz1XCEMvrkTvM5aS80JvPsxwzOS+Pf7Vqulxm/7HWsCvuT7jVd2bpXFacA7pB8pyYTWBSqIhuJRadH+/Xygis12uj8qdew3mQ7HPRNSpcGLLYGWHTfBu/XYkXRJoUFUTEUr+ihPrmmfcNdS6r/R6etNb+0elS90iZMuIziDXdErsq4SqxmG3Dts+5MsTlnHmW1g+OkVv/ii7Ziyi5cyNA6DYbK/GpMVrrkOOMToXcgOxiMAX7mC3ByZFIOTLofize4oE6EH1EH/6jTMZrw/vIR3FDwbPtafZLOVg0ANRnSZ4xtiaEwuEymGPre6vic+nWNZm1q/6Y5wtKNT/p4EYVhKO0QvCfBs4Z1Jfct+zbHWSOzxnSghl6Ft1yhxbxH34YzK0O957PFQBrkc8hj9KF35xDowkVvmlhJ5DXlxn1HpPO1rGeADmY+7G4F0nibKOcF3/AkqzlbxdzliULl3VBZfvStc5Wmc/9e/syO+KqRL3SjPRh91+wt41cPghcrnw8M3TDNIGo05wcvanJ0Y0hvkXRzQKgstrHn0jytG2A== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e4ea8d63-45ff-4571-1735-08db2b2e9024 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:39.1393 (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: niNLUr0SKpQTQe1dAQbWe/FtGaEmWuPAuzKK8km9esvbao4u0C7xB4QDZDsULbHgLHfI2+CAEGhF6/IaqguyXQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7263 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org skb_mac_header() will no longer be available in the TX path when reverting commit 6d1ccff62780 ("net: reset mac header in dev_start_xmit()"). As preparation for that, let's use skb_vlan_eth_hdr() to get to the VLAN header instead, which assumes it's located at skb->data (assumption which holds true here). Signed-off-by: Vladimir Oltean Reviewed-by: Simon Horman Reviewed-by: Florian Fainelli --- net/dsa/tag_ocelot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/dsa/tag_ocelot.c b/net/dsa/tag_ocelot.c index 28ebecafdd24..73ee09de1a3a 100644 --- a/net/dsa/tag_ocelot.c +++ b/net/dsa/tag_ocelot.c @@ -26,7 +26,7 @@ static void ocelot_xmit_get_vlan_info(struct sk_buff *skb, struct dsa_port *dp, return; } - hdr = (struct vlan_ethhdr *)skb_mac_header(skb); + hdr = skb_vlan_eth_hdr(skb); br_vlan_get_proto(br, &proto); if (ntohs(hdr->h_vlan_proto) == proto) { From patchwork Wed Mar 22 23:38:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13184740 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 18788C6FD1F for ; Wed, 22 Mar 2023 23:39:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230221AbjCVXjF (ORCPT ); Wed, 22 Mar 2023 19:39:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230146AbjCVXiw (ORCPT ); Wed, 22 Mar 2023 19:38:52 -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 901B82B9E1; Wed, 22 Mar 2023 16:38:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b8ZIpwmGpyTRR9b/4DI/oT/EU1Lt01Sde/O1h0JJ+ZWdSshJPuVEF0PCawQAQikTa/5MT3XwRkH8cpL3n/GoPgGhRW5ZeQ795CWGgA3VKu6FCtvhy3xSEQLkriJ0L6fGD8BKfVc+2k9Kv6vMJC+TjI4P7hdHWoLSHMM/vTwGYz1QprMjsKWpmPHxUCnBx5BGexzBqt6a1+MU7AajckF+RykQUwqcOlx+YcjQQNLL2LV98hJNz/cj3Jt2M+1gzOrC+liThsrsnh2EernCSPGMjVl/CDd8DMsRRDA4qnDU6igT/scFHtw2Fg2EXNvOFI/EKRMxlBC7YGtzvw0dBHI4fA== 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=hd/5oYgaxvpHfDjM/kbGG6yPnjs27J4T7oS5QnTeMXA=; b=IlY16sRmBkKY9DrZPw367QbdvQuxPzlerUk1CwJQ8tgKDdVJbdcUNNQjH553sgy+0b0tyxafJZwnipzjGFHEsfo9gwAO55XT9ZAho8B5c0u7+gpfrFKFuyPsA/rDB0jpSEZCkJUUH3U+8Qc+5lGCx9tj9WfFqSlywcnC5ZLwCB+z5X8CbWU9EwvVwF5vE/A/CerRb4WX6VFVsKUTNm2RQajY6WUdKO17Y4cKEd1sTTOecqpoZeyrBKzC0c4b9p4pZyjMxs8RsOI31UKjFmMTrFEBXbzjkXnGVRgdQSPoL02AUmzA9YaCC1ziR0o+LPbBL8f8f8EqtUZTGMdyR1jjtw== 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=hd/5oYgaxvpHfDjM/kbGG6yPnjs27J4T7oS5QnTeMXA=; b=N6uNlSoT1ztnE/6GPg13MyG1WjzTjWDmxfIxHvWK0ekJTVIhQ2a5iV0ysq9TsfQbxI/mKp0xAkoFWooZ7ZhjFvWXOD7+lmf2oTWScLQ+lqD+3X/i3wVRF5O6UxCz414wGGH7OrsiZCeicDwu6K9msF0tcLwOpjvAT3Hj0TtAxvc= 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:40 +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:40 +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 5/9] net: dsa: tag_ksz: do not rely on skb_mac_header() in TX paths Date: Thu, 23 Mar 2023 01:38:19 +0200 Message-Id: <20230322233823.1806736-6-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: 798b6d7f-d903-4ce5-0f91-08db2b2e90a0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: k21tdOphDvuzhUxRrHBsXGh/TDj/qsz0XInkHqEld271PflsLswgqT14ayPzyY9PwpGMT8W60Ksgu8euk25yaEYdtWkhRWNvr6/2sw3ubovE2+Y4MToQy/rDSuamakJU4AJ170TqlXxB3WeXGRMEsngTUtPF1cEioY9F8LLoy7lO73ZKOUvw4QMdByRTQt1zrskKfzgKpgS5U8HZvpkQg/mkm10B4Sa/o5jY2P9s9d2ls8mqn0H+6/r27ietyUF1KLD6w5VqfXfdGjcqykJ3CYDN4hNgnhxQ9ZzKcezmC1PDTIYVrzgxmYc/OTtyWzxbnm324fTMntAVqurAM6ZxLM+RxDc83567+eBty4pls2me8vAs4DE+G9tlbjhThDyDS+GFJqhSg7ywLDHq0bfbFRQastP/WCIe+vvWjn4vpQ+UU5nPPOHcunm0IiyTDJ3j7GiDLO3WReqsXhY4sm0pzMANIpgORGaKrDAgKWb4cB+Xq7G0eCfv3+i4g1AhCQYFONjXASYONKE5djwtfmA0nXrnnyrTpnM70OjTyN+0g1/b1wgqGDxNDbaXG8jRN77Uwnb5vOGNXfPq2q6ksGuaHt+aiCL8Rw8DElFGXoEIAtpKfj0ESUVvQxcC5njkiPcqBFl6jHTYbR/hroYI3Rsykbo3aJ7xCt9klxYshKnTPzqVYrUQG5Tl2hvF6xSZLCNc7NsfK82OGUftaJqCD+zGAI+tsWLCkpiq3YhMbd+r7TxKelX2kpIEL+IEE69sJc0P 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: BSQNfs9N8YCoC/EPAiNueapYRO7JCAbUo6YWnGwQNoTLWrn54Nt2yCFgtq7DlFNKCv2stwB6nX1ddm1L7sn8OS2hVAGG3D6DUBItAWrkGXnNTEIqOCiYVcRKno77ntYu6YdJ42LXD7JgHZfMk1SHf60ZQ7+sLYykXPJ9jsobuG7fHwOsfs2HCS7TR0TkhQVGOPAjjqfw7kTvAVqnfTYDWzIjlpGZttwIgRy1Dt5akW8xVTRXLiEiY25FTjRiTRqwo13q2ACbJsxIzjMAHhfHiGT9vLRTWbzJGjY4j/b9ufeZ/IwmFbaiPN9D8ZeK8+/sizJWXUD6hiWCeplVZyPdV1JVutAmzlHX0d3DLzG/26+3VWSRK8jQekwvnPBrMCpvqsWNL0z1MCwY+m3RzOKw/V5CmAhpqWnMRf2Q6NZOcWXgjayJ9i8UhC15hPth0q74vKaP2z6RZvu0vUsfJ+oFRpF4JBVTiya78Xt8d8nlR8caHIowGzo+83WyD7us5zLg8E/ec/3ap7eIeqPi8y2uESCZbQUTAtPXQPgREbcvqD3k6Nl2aRWAo9TYdxXiX9iylwh8u4pp/oYaMpo6WLJnnTQqYKRV9W/Ku9qbbaYKBOZgM4XgKbRHerRV+rCnpriUV6U7hr7z2FxBvKcF8fNVN6Kzdw7GaZfC+sv8aNPUFB2tWDtsGxGqsuHJNprT4+g6PwnPXMK23uENQJIGt+tS5oXFnnBZTpc6BtW95i6LxBOrsBulx0K1MSNai66x/d57CGyU847UVwz7a8weMg0aZb419su7U5+QjrA3MJOmRK+mOl7hCCSOaxN4EVIUs6UFzb0gwS7vHscxgVsQPHgvJO7Ev+cYErEnLxuW/mvSvM5+mOaaCgKla9TQ92pZlYTfLIbHW3DAGg0eTiRNcTUz4+WVT8bDssyYyLBULeCBkCqDB611S8Mx5EnFWC8zzjZRF/VW+8JB0oHwwC4JsrtTAAGorg59lrTK4VfNUZrKx/eJD8h3idcEIWgQBFyMO9z1Ghj79JH7Lv3+wB9jF9j57bW0LnslmtGMFFaJTaP3FSkWn9wQvYyrzzxnkJydBoqg0fUu1S7blYcmzLkhSn7gCZNqTfUy2r9zMqjP18RhHxtNjhH02G9Amg8sp4BDX8Wu0KmBeU8gsKrXsySymJwi1EISTuQhwfqfCp5xepTCz7++ouMuRYjZ/2m0UoWW+heG/0OYqQfGjznnAw2n+wd3uWi1bUVYbv/T+mJIRqPfUd6R7dO9Wh/i5EW8RNsNjFLvOQOKNhEs6jj3KBA6lJnUUFn+oqU556Zinuukt5jAZbohnMvcTaG8rVnklajh0wLT7IGQPXVZyXCL//AzHN/KViKfqnxE36iHXxWvzB9v2XK8jOTROYE9sgP6UghomqpidjCTlIqeAjY+WjfoPS0srzsWpaE2Xc7e6uHhCf5yBE++u64D62/zKs1806QbVeah8dPEwg+19P5MSL36zxgFphDcJrzjOpgqxujCOTVUaJ38FVQaIMyCnbJcb/9j2Jo5HqDjbdUWQXtU3DF2/3cjoZPwa9d6MrWPICprKWSKIqN7uuRm0n7a6rb6mFuRWZ78QkEbYfjoy4vfCldA6H0R4w== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 798b6d7f-d903-4ce5-0f91-08db2b2e90a0 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:39.9518 (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: nQx29gAAWjr7iRt5JqVzAz3r4XGqMzS74O6sFbFPafJP20ug/OpuTnQYgF691cT+IQaLMrffEPUJ5zSdYB1PNg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7263 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org skb_mac_header() will no longer be available in the TX path when reverting commit 6d1ccff62780 ("net: reset mac header in dev_start_xmit()"). As preparation for that, let's use skb_eth_hdr() to get to the Ethernet header's MAC DA instead, helper which assumes this header is located at skb->data (assumption which holds true here). Signed-off-by: Vladimir Oltean Reviewed-by: Simon Horman Reviewed-by: Florian Fainelli --- net/dsa/tag_ksz.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/net/dsa/tag_ksz.c b/net/dsa/tag_ksz.c index 0eb1c7784c3d..ea100bd25939 100644 --- a/net/dsa/tag_ksz.c +++ b/net/dsa/tag_ksz.c @@ -120,18 +120,18 @@ static struct sk_buff *ksz_common_rcv(struct sk_buff *skb, static struct sk_buff *ksz8795_xmit(struct sk_buff *skb, struct net_device *dev) { struct dsa_port *dp = dsa_slave_to_port(dev); + struct ethhdr *hdr; u8 *tag; - u8 *addr; if (skb->ip_summed == CHECKSUM_PARTIAL && skb_checksum_help(skb)) return NULL; /* Tag encoding */ tag = skb_put(skb, KSZ_INGRESS_TAG_LEN); - addr = skb_mac_header(skb); + hdr = skb_eth_hdr(skb); *tag = 1 << dp->index; - if (is_link_local_ether_addr(addr)) + if (is_link_local_ether_addr(hdr->h_dest)) *tag |= KSZ8795_TAIL_TAG_OVERRIDE; return skb; @@ -273,8 +273,8 @@ static struct sk_buff *ksz9477_xmit(struct sk_buff *skb, u16 queue_mapping = skb_get_queue_mapping(skb); u8 prio = netdev_txq_to_tc(dev, queue_mapping); struct dsa_port *dp = dsa_slave_to_port(dev); + struct ethhdr *hdr; __be16 *tag; - u8 *addr; u16 val; if (skb->ip_summed == CHECKSUM_PARTIAL && skb_checksum_help(skb)) @@ -284,13 +284,13 @@ static struct sk_buff *ksz9477_xmit(struct sk_buff *skb, ksz_xmit_timestamp(dp, skb); tag = skb_put(skb, KSZ9477_INGRESS_TAG_LEN); - addr = skb_mac_header(skb); + hdr = skb_eth_hdr(skb); val = BIT(dp->index); val |= FIELD_PREP(KSZ9477_TAIL_TAG_PRIO, prio); - if (is_link_local_ether_addr(addr)) + if (is_link_local_ether_addr(hdr->h_dest)) val |= KSZ9477_TAIL_TAG_OVERRIDE; *tag = cpu_to_be16(val); @@ -337,7 +337,7 @@ static struct sk_buff *ksz9893_xmit(struct sk_buff *skb, u16 queue_mapping = skb_get_queue_mapping(skb); u8 prio = netdev_txq_to_tc(dev, queue_mapping); struct dsa_port *dp = dsa_slave_to_port(dev); - u8 *addr; + struct ethhdr *hdr; u8 *tag; if (skb->ip_summed == CHECKSUM_PARTIAL && skb_checksum_help(skb)) @@ -347,13 +347,13 @@ static struct sk_buff *ksz9893_xmit(struct sk_buff *skb, ksz_xmit_timestamp(dp, skb); tag = skb_put(skb, KSZ_INGRESS_TAG_LEN); - addr = skb_mac_header(skb); + hdr = skb_eth_hdr(skb); *tag = BIT(dp->index); *tag |= FIELD_PREP(KSZ9893_TAIL_TAG_PRIO, prio); - if (is_link_local_ether_addr(addr)) + if (is_link_local_ether_addr(hdr->h_dest)) *tag |= KSZ9893_TAIL_TAG_OVERRIDE; return ksz_defer_xmit(dp, skb); From patchwork Wed Mar 22 23:38:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13184744 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 6C280C6FD1C for ; Wed, 22 Mar 2023 23:39:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229678AbjCVXjM (ORCPT ); Wed, 22 Mar 2023 19:39:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229496AbjCVXjC (ORCPT ); Wed, 22 Mar 2023 19:39:02 -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 2DA8123A72; Wed, 22 Mar 2023 16:38:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NnbGuASKJyrwvVK55sI5/yLJb3Gg5zcZUPu6vuAzCWvgiM0AFZpFFspnBPh1/M3a/7o5P+NA/GBGmGCyKY6BBZQOzmrhUdUtpp4f4/eDRjdNJppX/qrLHT3ZaKj/vKioEtoYrLgJyrTFk6DVzB1Pq6EHznZNsBqKcxj52eyVKYS513qM6I3uiWKDe1eVnk/70GyMiPN4WFQRQnucQ0lRMXwrxNGgfSQSNiYha9w7Wa8MAhz/DKv9+LsI+PnudmJGI46ywbEYGdu7TSzR8VzXzUVpVH7CRW+2OVjVamIcBi2bd7R0siz1k1ofbEOGvIF+uW/GoO26BTx1TXtf0Prxkw== 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=gvZWsCCyqAJ0UnMvHTS+s1oXQwgirZc0CmpsDT8QaWw=; b=l9BaHXyr3ae0Cc7s4tMmWqp0S4KsjmMGwwWCxQMvtU7V7RX0VZsRWjvPMzSjbAGkCDx9NHlYvaloZUrPMRiAQ5jjoxbnRQqgFDEtvb6Frz91JC1HZIRgrIAyPqOyymZwBE6v63SBYh9Z+9n5M7qmDcmFJ223iJjeMc+kpWGMjxy7GxWeYVqG1Jswlm3Mhu4Q25pY2ZHpPDoCByedcX2en4rSwnPutXdpU8bp0r+Pt2bK/v+grxDFMO5htdYnsfl3GM8dvb+Jm0+IczGC+3+4RpS3C2FdLm4krRJZvKN1Lu2zRaJzftJEdc2cNItFo9SooRN/AfQ5MBjcLdJmmMTupQ== 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=gvZWsCCyqAJ0UnMvHTS+s1oXQwgirZc0CmpsDT8QaWw=; b=ibahf7UA1CYvHfbk4pbN2KMUOEilBYpgCtVTArjCEB5FOqN1OCppGdiNcDDeeSyuaO118JU2EtCCmyeYme5kikg15mkZaDBxTHMsPr0DpD7O60eUogn5y024hnjvvwmX2r2gHn5/DHFAX3Dcfys8gPGCs+zB9qOfvLOKbvuiXdw= 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:40 +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:40 +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 6/9] net: dsa: tag_sja1105: don't rely on skb_mac_header() in TX paths Date: Thu, 23 Mar 2023 01:38:20 +0200 Message-Id: <20230322233823.1806736-7-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: 26f6f6d2-24cd-40fe-ba01-08db2b2e910d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aZyGIY/Mby61nmcbD8uuQRQ4+HADOft4FJ/QrDIZVk99Kv4FXrTKM9CdpKHvPX8mPGuxy5SkPiPnr3V7NCAJZozDFLI2ERIw5Nvc6eEGwu4W6lrG3pVhrybN/KVN4C28vDbTG4lCEyjQ56jT3Pa726RvQRy+6ixGLVa7CsmFPV7wTz3nJapa2wA48MoeI5lgqgUAox2QksGboUV55DhftDSoDdPvwZ9tMEAiz6yvemqtwGzxbiP/Q5y2h70d+OcP9b9TcSqI3BerPSYweoKwNp8wRnDtDzT38IMnBsquX6m6TehSa9semE6QG5V+QY20LO9D9vtUqS9kLAXSgZzDh3u9cl0hXYOcmMd2M2hnmR1sqRlCZbsWSbInnZV1gwnwWZ45M+BAU7xQFsSIYfDAFMNXoiZy7PR1T8KYHEWGTXx3PGJ36Z6b5FE8cq9Om9u+NXenvR1CFC3B3k6+TxAFLhsrAeNiX49XiOBg8Y5dcZu9zJkvjpY7XAfX/sqxczivEVHFYfzZu2wemqNwLblxbD77YJNWc4KAPUSCZjH94WaacTmNto5NaFE1Z1wGgHJ1f/Bs171pEXszX7I48VOZJEVgtYYG2WcgLIJqXA88wfU0GSdsK5q6XLS6h23/cBFX5GzlegDIR/RThet2oGzPS+xTbKkKp8IyugwBvdKbXkOA+hZuyhunADx5ZetY0z+hm3f5GT2aV529rEk9y4+/tmxlIBu4miqabKTlwiAY5FrID22kBZu+ls5H6fXrcDTp 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)(4744005)(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: MOFnQdWMeNquhs/DbxylVnS/HVsfon2Lco7boXhpWYWDIjwXIyU8feE7AIIvEH63zc9uOcF7PJvBlvzrxZrPCP68eK4F01xzXthF67XdhzdnaMN3pFtviS8eux07VaNG0RQZFB6eMfYoN9ZcxUfIgf6M1g+XbqucCPt9tqdsqLlURq/7oI9oAWT56BAj7RphuX1SwdfPw5QALiv6s6lfp2E5/caZJYgPly7WCZtWd0OW6ylESmxFkzSRwQIFJPlCwE6kmJftn6NKeOInmEqiq9WgWo1J4UjaiAr3tUGxewh2PQE/0yoDuxj6lQrUVIWNbUw0OmgpfGjZ+qjL/S7Gu6NEE7U8bacjDtEmJ6O9xnjkDV3+uj1vr2eISuusxhy6JP1eCVbxM7H9u07ipsx1vqKmJqJUemjpguR+sMY7F+2Nu006dseT2kZdxcCw+54aobvUpEvqxEbaLkDcgDFb+I3Thlnow/wdiPLPjeOl5tOi6ZqGbJ98PBWCWr8rZ7wvSnib0HKPdCrqYvqPW0d4gaW8KjCNVYyRhssMFUHtlZ6yvKOeK88wZoGMdECrrKtE9wwYAoUCW7cbrnjj1gJbz0j43UIb1KZ3k9r3p9vylbfa1JHjS1q+QIsFzcsOWb4+i3LqUn9OKYPU361v7aihqONqnojrfUmgTG3WxlpUADmzGP51+bEerVfTbYtsq/TBViAyotVe+cuvN6J0cTVZcLLUv3lcVxODyHizW8/DTNjlquiWIpEBk7DTCfk/zEV9jVTgwa8O89qudSVEh+mpxVoL21T1cDMh/whmbKkc2plr4Q/pjxGA29pIf780n7KR4xcpmxaHiOdtx+qHyGO670a/B7NpsnIc5QswIAvJL4BolIuSu8cnOqG0qj1O5UFhkMEWaKJsJhSiCR24heyJkfUiGDxLwuIePcJEdQew1TAufiACID5XJAhfMH7ZLpHYCVlpaUIk9anhRYIJyDmNvIgizRjfF1GqhIDp/ydXV5Z9Pk/diT4nouYJS00QoS/tidHw28Ntx2EcxkvoFn64Dd7RwvLUauJHPYJXphX+2XUj7EusM26cbQojEM02y3blaNA7g3nogT5l/OTsGR49O99Nf1U63b7o3HMDBa7J53AqRRuR5j8lsVeAvcM36MpizFXTYRMsvr1G4F48UsMBRZr0Oaka3maxPVfygarHT5mDC40JLlnrrjPuBZ4w/bfJ60ING90HSei/Sla+laB9qWMJGS11mvmzKfIQ4z8jIgFbzpSfGOwYU61mkdlajZB9b+PlZXfz6AFRe02s0iqvWLnb+fj9OxkbilEJ6x91DHUohEr6ngVfwPoPTK4NTHxWVV3TNWHMI9GbpYi0ITQIV+GrNE36YxKXt0Jo20HV1aTsU6fzmvgBP5syUcxIZnvD1tcZU8zWG8ad/ZLhBIbdvUZu0YTVJ9cazAMY9ANjB0KYtWDaTdbAEX6r5dqAJFXaw+Vxu3QpRYpE8sYXXnRtZ/e2F6fYCmTiNJqXupZ3HCe3SDDv6i3ewqKDVy/Iov1Im1/J66QjgUqDr5allWvxthzkKld43Acv0kOjNr3TWOY52bE463jQOjdUokmKdKQpgN3NGW2w+C1L5hq0/ONu9w== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 26f6f6d2-24cd-40fe-ba01-08db2b2e910d 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:40.6549 (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: dTpbyWDKq3sDrrTeR74HpG3/4q1fNiHOOeaNhfx9kGAOvaWiiS8eNgOPOFBlD+R0Wnft7OJkfqspFEWzntV+BA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7263 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org skb_mac_header() will no longer be available in the TX path when reverting commit 6d1ccff62780 ("net: reset mac header in dev_start_xmit()"). As preparation for that, let's use skb_vlan_eth_hdr() to get to the VLAN header instead, which assumes it's located at skb->data (assumption which holds true here). Signed-off-by: Vladimir Oltean Reviewed-by: Simon Horman Reviewed-by: Florian Fainelli --- net/dsa/tag_sja1105.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/dsa/tag_sja1105.c b/net/dsa/tag_sja1105.c index 1c2ceba4771b..a7ca97b7ac9e 100644 --- a/net/dsa/tag_sja1105.c +++ b/net/dsa/tag_sja1105.c @@ -256,7 +256,7 @@ static struct sk_buff *sja1105_pvid_tag_control_pkt(struct dsa_port *dp, return NULL; } - hdr = (struct vlan_ethhdr *)skb_mac_header(skb); + hdr = skb_vlan_eth_hdr(skb); /* If skb is already VLAN-tagged, leave that VLAN ID in place */ if (hdr->h_vlan_proto == xmit_tpid) From patchwork Wed Mar 22 23:38:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13184743 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 CEC3AC7619A for ; Wed, 22 Mar 2023 23:39:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230270AbjCVXjK (ORCPT ); Wed, 22 Mar 2023 19:39:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229992AbjCVXjC (ORCPT ); Wed, 22 Mar 2023 19:39:02 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2054.outbound.protection.outlook.com [40.107.7.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3498F30B09; Wed, 22 Mar 2023 16:38:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HPptFGKBDP5J5zHuGBTCaT876idcJIxtpd2vLwIhPQBgPLzX505VGMvpBpSz/jsBC4FQ8SIVhARiA09T/xN7XIOU45qGoyvboBujwrTfFMrboZ88uZ04vtPp8Mt5SpsVs/+taPe5KJ6wwP+MBPU0nNF7rLbW8HqYcR0tdruf2P6/oyL8iBtjtHC1A3Gm+BuFmnZcqUXT8tcD1LWa0msKyYesk6pZSfJXg5Uwgwu1pZztQEVHcatwYzKE5jJJ/tLUVQeacrUb235JaFy1TfwQClKQDbjftUItetN+9jgA5N9uLnBExJue6Q6auL+iC2UU88BtxNavyQtCmOgx+J4L5A== 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=iuG7JlOYD8k6GsNacoQTqp2qO6qIQjDuTf13A154WU4=; b=RjU7YMTyZ0Tey5a0qsI2khLqYsX87BaAbHL83sCQpbGyX7Zei1QpWma5oOVeweIGUhXMor/30TkbLJ5wP5vPMbhCDShxXn2AvCWPZCYqZVjXy5YsVMskibOT74qlbUv/TSZUOPUujNq34v27T8MP5m6yzwjmY8KqlaH+lF4qAuMhx6/Mjh1Fg+oCz7mvwXutXliLZrbbD0L8wQo67pCb3gkIcFyrKVQtQr7liXOXY8qDlcvl6gzHy6ZrTF2gOmPxa6uEq/VVgYeQIjMCLRD5EkEXQlvCT5U14okG/U3yrQPVm4PuKjsEIVP2AB72UshGX6GX8ETRE6O2gONRi/pwKA== 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=iuG7JlOYD8k6GsNacoQTqp2qO6qIQjDuTf13A154WU4=; b=FOTgz6Fik5DoJzkWwqWVgoov3hN/HL56clNFRd6cSdTCX4yCguivfWfx4+B0soCsELya4o/ZReZ+YX8M+GMHE48fa8rPtwS0sQ2ROZ43s2zeL4NXg0Ri8rBnOsn2FQQXzJBT7srFadc2GTTTPBVGty56COdkLlRZmil9Q0eVry0= 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:41 +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:41 +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 7/9] net: dsa: tag_sja1105: replace skb_mac_header() with vlan_eth_hdr() Date: Thu, 23 Mar 2023 01:38:21 +0200 Message-Id: <20230322233823.1806736-8-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: 50fc0560-2364-4c5b-647f-08db2b2e917b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: W7Fs1D/A8ljPzOIGbqok/JAP8/PTarfw95xO2kbpaVhphu7DS8O6aECsHYC5GQLoYzsudRdn6ofTitjiGAmDn/LV1kL1TqFUW/GuKqDUfI3I4QY6Ze41k0BYIV2nR/ovTK/U63AT7z/ldIUN411RU+31Oor5BdOsUKRlRawELmB8rnKgrOUbJBaILK/L23nhQhuHfFNmoODdzITg3labBqreoLVr5E1qw/j2xjuUK+J652C1U3uLI27RVZDuGf/2jkVraflvXoZ0PKG+QJ11ZxTPiTu8ew8KLj37KZyD8kgriR6DF4O/V/0SzF7IoYhf2rw8zQQwUUy+FtWPyvd+x/WKlQvYZovEI01wOJc91MP79OPJzm6MJOK2YnEPKUVjCMA7Oj7QL9yDdx3vzDTeLIKsM0AGDh937vjqIQNXVMWe8nM0Ujk9Tvwk79K+wmssUsmBsImprEZ7gkdxm3iLU4Ea04EOehYa02IL1iUzPUHuD+WfV7BFTQuPmIOGISgzHlZXr37SHBgTMeW6M4oJ4Hzk2oJWVJIfUu41UmgRy6prjncUb/qpn1sn2h5kRzU0R5rnp7AFToBz0klSK37yd0tPzHOCUWaGBr8wku1WSAzd27VtcvJkOzEk7AUjtckVw5QnzTFLbRFmKJhp30cF0nZoDWsGuyyW3vg2TYi95LgPUAqeg355wsHxVLCX0aPOVFQsvNvU/0OGzydT9och3n8X1qceiX8mtSrqGagwJ+PptlRD3f+MLiDK7r5DjbU8 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)(66899018)(8936002)(186003)(4744005)(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: M9hSRw6z7hqpmuGVB21ws40W2rBM9DHJT9Kkoxyz1aAxHqAsNninjobNYrRRPIyWTLiGx6FeW5RdLE2nzs6qAA3ZYHKuRYC6RB/he4CNZGXNi93mij8kIJy18y5Axw93V8UEdYaQhNwCwznX7/YSZvgXRREYlK4xev9Ch495XfbO0TerG/H6GNLR426WxwaOI/TBXEOweuMjmf3qbZqDbLi9FnluOcTmXaiGDB8/gJ1Qh68bwNnZeoNsTwrRn5tacorqgi4xN+mllDvejqEtLJEIq7xIqiezVQDjYKAjlzyoW7MKWrybca4dxufA1QMjsNjRSYZhQYCFHvAKukNuwfX3jkUPNWF0JCY273j9ldDWrQcoR1H/OUZGftJZLIumrxEJj7yrmqWyBkdEj/r+1ju13+iqm+TIthAp+GwjzWqUBY4HmpeyGe1Vf7ghrMTLHTChGmiHjcKYWIeWf0dtvbXPNd44ioMSAxMCSnBQXctykEhlzd1iuh30Iqy3COLn5F9lw9QTawR/FSxdQZF2SESe1ZzlVQnI4LS2iWJcdJ83Eo32Oe2JzOfYmGN/QGhazFQ2nRuwAcV4JP8JB0qVJyOxvlPSgvoXBjpkeEKTCTfTcBzzrWK2+FaLQh09S9PAekGDt6ucw8kMWs36sb7ID78beWTr0W5KvKUaM8aMO8ND0hq0uyGzihujcyvM13+PeJvZMMh8Y2h+O9+JC0XqsnwsuFHpGRsae42CPA+C1dJMrbQJ4LRjZY2UJRg1by5aT9By1FLeqdY9fknQKHJfl7z0zktYLOEoiBqrZD/zzgTPXoXLQCz7QtrbYn6XO6Ghe+uP3ZsXrV0gsoJvbFfu8lfm7BBdi3LHZonS/uHY0pbs2FAIGM9EOdJjfuZ9EJ13C/JAOHpnGo0eYV2ZxQ+2pylPNNvtG7AtlXfoERj1Hv5FXGL6NXdevLjYnuN5ujwH5hK1w72kksqmzUQPFsyHhhTWRBy5xWL9I0u780esan6Ig6P2q3B1/lDNOc/UrBj8u151iNwdriJRkyn0xhEqDMQ7T8ystGEyJ+NKgZr3sXM/TXMva/AW+TC8+wLR31U48Im8EKDFhPKRWU/mVPNGU0R3NMc9cKZo2H4ldG6Nl4OfN9JiMisi8toY63lGK8zBJ6b6jCfi//uutJPtl+VZPuwRdvhP5gZ8CwtSxxDEYyAEBoSroacOb94E4NWNTJbA6CQlq4PjPLRxFmtd1cgfbwV7+yZj3nZVDWK3MlQuQoUQBlLmuPsdrAXCYnqcNAfk0fEKPPYp2GLu+wQyz5cbOxNBr8kdnLsIEo3ojSroVpCgk8Ne7DwXZKt91QvtB8ANlMIlRxc9SnZdCnYIizEd5ItvufTgZxCue1rhIx9fLKZbM+1lJlW3K7UMK91FGcA9j0jPu9p+6Hcpi826IyAHbCGBWWwprkty7/8gdgn8yIgYd4EMeijbNbpHopeMFhJdOWY0Dlx3OW8EwmO9LLBl80LuTf/qOmy+CsJrThC0V0dDkRfg0r4AO4qUR+EHGe6lws5sAhIdZmryegn89ErcodBPvoZ/zvCllhIQmUS258FWxaJmDYFPdzABAgdwva1W1lQunTy7t4O3HyTVnpc+zg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 50fc0560-2364-4c5b-647f-08db2b2e917b 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:41.4048 (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: ACP8B4TclMQtcZpgPfz2vtkRS+hOheFa5wQBlC9yPvmFg9WYFVcyQvjH45FOcz61NapoD8ABI/lM20qusezpJQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7263 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This is a cosmetic patch which consolidates the code to use the helper function offered by if_vlan.h. Signed-off-by: Vladimir Oltean Reviewed-by: Simon Horman Reviewed-by: Florian Fainelli --- net/dsa/tag_sja1105.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/dsa/tag_sja1105.c b/net/dsa/tag_sja1105.c index a7ca97b7ac9e..a5f3b73da417 100644 --- a/net/dsa/tag_sja1105.c +++ b/net/dsa/tag_sja1105.c @@ -516,7 +516,7 @@ static bool sja1110_skb_has_inband_control_extension(const struct sk_buff *skb) static void sja1105_vlan_rcv(struct sk_buff *skb, int *source_port, int *switch_id, int *vbid, u16 *vid) { - struct vlan_ethhdr *hdr = (struct vlan_ethhdr *)skb_mac_header(skb); + struct vlan_ethhdr *hdr = vlan_eth_hdr(skb); u16 vlan_tci; if (skb_vlan_tag_present(skb)) From patchwork Wed Mar 22 23:38:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13184742 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 6C2C2C6FD1C for ; Wed, 22 Mar 2023 23:39:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230262AbjCVXjI (ORCPT ); Wed, 22 Mar 2023 19:39:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230172AbjCVXjD (ORCPT ); Wed, 22 Mar 2023 19:39:03 -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 A07FB23C62; Wed, 22 Mar 2023 16:38:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XwECd/mQ6ZxHUEfOoZoteViGMTexK55XKZ1vE7szQcw+MQ0uNUUIpM+t+Z6epmQVPXF4D9wnGUX2gPTN/iMW4X62WOAAvxfXYzQrA3k2ohRJmhJo/JdBDb6ikS0i2BI90pGX41HmVqIxJGEXWn8olcSZ6M+RfUhIQU+1LChVD0TJeOJGHMJnd/l6mTm0+5t0Ze0NMdoXLPD/xaYLveEzTQEz9KJWoXADCB1ffiyxmOy9mEBMYGbApzOPXQx4zqEcV1ssVfJPZa82vMHPqlP9/tEUhLvkDY5q2F+LajgzIEESp+7KvCex4sq16w9MdyiY3uN93UqwtkH57ULgoxCJww== 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=CQE2kybcbqrG5D6kCM7Z69pPnojlGGpYVdWU0BqhWM0=; b=Kd75PCnJS1oj7yZN7xDE/sHjUipXRgqu+m4thCQ8CSaAeyjnNKrEYuqaEvfkLywhBOUTgg04wGhGbr/g0qyw6NkUcZKD3zg0SvVQi/PXiZHfV4kfmIvLIDxLpbY4iSUtmCh0fG+iqG7M04CeYsbZV60RmiRzNZoCRG+nIexnOy+g5Tn+Sypntq2EjHgfxFxGC9ye5TIW6Rf5p2ItB5GspRx06qaNz70OnGOqgfdKYtZhGsa9zj7Uz+7BHGzxqMiD7oaN7y9PUgnz1RD1B5zcVjDFb+2IvneWRH++durTz+BnlQhB7wn2+5qCIHc3WHXFAwbIY5MsdNaCeXy6c8kmPw== 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=CQE2kybcbqrG5D6kCM7Z69pPnojlGGpYVdWU0BqhWM0=; b=BiQBbXuuS/fJ/Jgwfk92w16AXjO0Ff8lZ5oNjnBQ/BZ2zVbzrDlaJZUxGez+u1KNsu3X2x6tzWLYizYEu9TL2nMVsFuLRDSgNnfI7wPCZGQpvDkUmizxBV/0pfYJqAEvj+F8E4ybuMn7hRM+6g/Zk7M6P8G53V+m65UtbR++BN8= 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:42 +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:42 +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 8/9] net: dsa: update TX path comments to not mention skb_mac_header() Date: Thu, 23 Mar 2023 01:38:22 +0200 Message-Id: <20230322233823.1806736-9-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: ae95d9de-be40-40ac-0ef3-08db2b2e91e9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bFeyIRg59CRu5mmV3QbGXn2r1vzuW2qE7CncrIrX83zz7b7JAEzu2SiqgJDJdjWuNy17U+CoKWuxtVRQ7roi2E+Xwh3it+jLhteEsqyPJg+2/IprGaWLT+WKH6rY8f6bealBF2sI76oV1Pv8yaoKE5UPghWrIkMi6Hm1PM48sa3O/HGDkO3xtg6LyzZ0DiYXMGskRAnTMZHyvM83LR/w2682kHzokiGyzMdkJtzONVgL2ymYfzfCQoP2C3Ed8uAG+Mx7weyUnTj6X8JSrlR9D52A90LZW3hgJLtlywonltW6JucPQZMU1WT8Cga1brkMHq577fkQaMmzHPfekYFl9EsDNGCmeHdNiqG0VN6aYtkViwwuwp7IWP6+067F0m2oyj3VlaMKU0c96Nf3LGF9kH7NARxGuGU86duXXbi1E+oHB0i4kYKN4ElRpGDmEFGP6Y6lhTDNdqok04q0PJYCMYVo/2pUIMcnKbW24GYzogFbkS/fymdmk5VYq1M0cnUHlL1LfOzBkOrQMPhpSdOXEW0TMzviTnyTa9UqhOaVjpnWBYzDt6Ql8IZZF7/RWseinbe4KXoq6aTfqXWBnnuIObFjb3FI/aovrdOh9Qhb5Gs7w7dxJEFYHXQze6wSI98DeMHvLQv/dHSTZDJbKC2oCihjy6lpwH4b1ipRjkvitlXDnhHgatGfO2WtaSqfG0lZfdd1KlmdQOKsgSoJTaLKDOKh0YBeGJkquwv0/xwfIkBFNMFT8udfugNARnfjmnm/ 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: 7XIwkc63rmRZcMdIhMoDMPYmSodKViKJCVeYzIjP23kLDSt6HpUStzAkg8UqURms3E7ncHs2pTI/sxIAF2Mdt0WOEBL7mPo3ooguUpzPSuLyQ0B9yAVWiMkNhAZPh/KgasrqtZ5eusFLw3c8K4qecNCY5KT/nsdhbpsWE21vLmD4epjqH7GS+MRAphSYeomFXo5TM3X5Mudv23+sm0LgUHPvsrVjsaM27jHCNTrHOSgf/nOKn+l8ujRwa7k3PtLP5RKoOne8VFL1IA9TxoGmM/w1Q6mUM7zBSKAv7FQxN17GCxB01UceTTj8y3l4fcFOHT6j7K/thp0a+YLT9/guKVfPHABjN4rgShhrtPDgo5hO2tARffjaRDbZyJmUC7dKxr4LJo0drNSrdIz+zJmoBn1gmfQY7jWBc0xc04Hjfpq3iD9Hi7nb8ltVepuIektO72ae3LHg8asaNyPgs/vCL24/MAXaKv57Mv9b1sc3n7G3/muuhyJWIVT4YQtImCnnnyb7icwoMH2hf5vD9iJtyaFLm9cJuujK5pkc4hVLTVU1f72GQG6The5bJ7A36p4TgAR0eCein3VPcLlXiFp+dFt81UtZhsHVuDPn8tMXl6wq5LaAMkmpH5qVB//slA3VUDh2Myd0+SnjRZXB+9nLqIp7E1PNSIbrb/CmBDK6lmF8RYEWftotbQ/GB2OxhJDrJBus3BeLPrmkr7wUDo3j5hZ6/apTpOKa5fpGoYWQ1PX5RMDtggO9zWCTaMf84LK4bqOViiN69Lvkhe7W3QNDVfk0XKFkYP8GaD3UK+9X/KvK+ZrqVyew7QEhsGYuHLYkdBbCLH+bH6ZHR9a8h1wXwsAaJI0VrQ7j1h0/drLY/XtjSkeE+x0srmuCr882AGK4M4yi2NfRuJRs2TZ4hJizLsGejW0t7h4m3uzVCIPem4cvO9hg4lM+begSiX0mBZX3NsOzRcZ19uV+lCs7o3xPi0USvHTcHtl6KjmXAkDapAMNfPAeRtqLI3If64l2V7c+H3r5yCb//1Ql4qUzdUC4PpRPkgfR5AAobRvSzxQ50sMDMWTx2g39y119lJydGq4tNXikrvu24eGjPKFRV/LZkvDsvOphmRSPxapG6GUlxzuiQFGCawdcVIiCVIm0MdgRacBXvj+5XEy97gRKzDqZhi1rwgG1SH2GbVElZnwD/3dcEjUYO1ehvjxMotsRAW+u9d0p6Y1DjlZNWuDvYXcoimt2OncQUqedQG6KJeLxoUS7ZCdkOeWV5Ev2qAdyJKsfQqgxY6i9bazao83li6WQ7eugvN2filheFxy2nUhUW9oZGifWwNI0Y70L+muTJcEf55m6Rj9mhpLF4krvxijU4HPk8EP4Ex4YTAPMmI+kz14Dz7Q8KsVOPAZu5WH4LnRezfNUPi7wB2YTTt28wDXRYxn5Jt5sRVkc4M45YAlujpzNW2Ozsl6eAUWZolTn0xwKWJxaYoD6wEuPZfQnNIBylNXoQipD+8PL79s33zPj/mRRk9y3QVTtmnRG4BxQAmgeFc994RP6kkm4MHS6LotJ81QKXAjJyNI09NU+aqxiY+JuSux1GFKwL8AEwEf/g2PmoRa9ypcPWuZpEwv/hFgSvg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ae95d9de-be40-40ac-0ef3-08db2b2e91e9 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:42.1235 (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: zElhepYmEOr4e4c+QR5vxytD617AZTsMbl3QjOG+lOvXW3P08aO2kbhulB1723ygDqMEWBhjkCHZLXf2JMgEyw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7263 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Once commit 6d1ccff62780 ("net: reset mac header in dev_start_xmit()") will be reverted, it will no longer be true that skb->data points at skb_mac_header(skb) - since the skb->mac_header will not be set - so stop saying that, and just say that it points to the MAC header. I've reviewed vlan_insert_tag() and it does not *actually* depend on skb_mac_header(), so reword that to avoid the confusion. Signed-off-by: Vladimir Oltean Reviewed-by: Simon Horman Reviewed-by: Florian Fainelli --- net/dsa/tag.h | 2 +- net/dsa/tag_8021q.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/net/dsa/tag.h b/net/dsa/tag.h index 7cfbca824f1c..32d12f4a9d73 100644 --- a/net/dsa/tag.h +++ b/net/dsa/tag.h @@ -229,7 +229,7 @@ static inline void *dsa_etype_header_pos_rx(struct sk_buff *skb) return skb->data - 2; } -/* On TX, skb->data points to skb_mac_header(skb), which means that EtherType +/* On TX, skb->data points to the MAC header, which means that EtherType * header taggers start exactly where the EtherType is (the EtherType is * treated as part of the DSA header). */ diff --git a/net/dsa/tag_8021q.c b/net/dsa/tag_8021q.c index 5ee9ef00954e..cbdfc392f7e0 100644 --- a/net/dsa/tag_8021q.c +++ b/net/dsa/tag_8021q.c @@ -461,8 +461,8 @@ EXPORT_SYMBOL_GPL(dsa_tag_8021q_unregister); struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev, u16 tpid, u16 tci) { - /* skb->data points at skb_mac_header, which - * is fine for vlan_insert_tag. + /* skb->data points at the MAC header, which is fine + * for vlan_insert_tag(). */ return vlan_insert_tag(skb, htons(tpid), tci); } From patchwork Wed Mar 22 23:38:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13184745 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 3B053C6FD1C for ; Wed, 22 Mar 2023 23:39:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230337AbjCVXj3 (ORCPT ); Wed, 22 Mar 2023 19:39:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230195AbjCVXjE (ORCPT ); Wed, 22 Mar 2023 19:39:04 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2054.outbound.protection.outlook.com [40.107.7.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2629923A64; Wed, 22 Mar 2023 16:38:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kVUZ80RHNRpxhiB2aqDQG6XCZcpsBlLSzf+ShsCFC8PlT+AaVkgmINu51fWVlELUbSAV+4F2cvrm72IQXg13zstmu2XDD/zxwfGilC0NA80bA2tGJvMOWNLaf6yqLkAz3ETDnhQ+CsR6VU3TfIZqDlcLIAGKazVU3O/1d5qzrvl935qCTguxRQZvE7nUMhlkvPMiWtKECr+rFx0g3zOp4R/NvDlrA7LxRKih+5vI2jH4gf5dV3DwKHxpJzAvnajRIzgSKGZexd30LWtjAE5XLZhESGBq7zS258jk5eNHuPX0wMWNbfFwRh2x+Gg8DOkD2yq7uGNRtMDWsngbg7o9Ng== 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=HudGl9FX9tARMb9pAAmbiXqgdru7VPq6sg9TMbQYgBo=; b=gHCE8Z+OoPj5r6Ht1cmqYrfGMQ9mSshiInHA+fmmjPVHsCepkKMp9a4KpGjxO1aAT4xi1/0p3kKXmR6WAkQhBqwNOVYPaKgxh9CvA41YedHymK/Gj4gb+izzQX/Bux4H49DWr32O5zap9sMotde2NHdDxIGk40gxZC0twGq6ujLGGzgm3Dxdqp9lIKjRnCOJVEG165sXvbiJDz0GKaSfpM7tpglJiSTem2YGR8tndHZUPgwTRxwf2WKUoF2INkVF+PpP6B+NkR34iprktDVi4KjphOL0T2Q3X/1jW83J1JHUEuy7tKpDU04BMHuDwjTxEr4TkYM/hKUwRwTb+s1j5A== 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=HudGl9FX9tARMb9pAAmbiXqgdru7VPq6sg9TMbQYgBo=; b=V5IJ6vHOEb2lvK0vFbUSAHCyMK6za8fL8CZdXrz3sOSCj5OVms73Wd/ltQDy64MGwFMmnZrDriFzjho0dmrokqc9qCvtT1uWkevzBdozE/ooPvvf4hHb5jSbLTl0hkHKKkDox/rof5hdzhEuo6Oyux5QTNTV0oo+GYuEv66ngmo= 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:43 +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:42 +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 9/9] net: dsa: tag_ocelot: call only the relevant portion of __skb_vlan_pop() on TX Date: Thu, 23 Mar 2023 01:38:23 +0200 Message-Id: <20230322233823.1806736-10-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: 93359f0a-1440-4168-7e02-08db2b2e925b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: axsM63xrVpc3CtreONQTgT3IuvUJIKkZauFSsdhtF7OPYqEuYn5AP6yqZSll0NyyzRuyIiFSdQ1USaNlThVRfoZdw1rGY2lYyuzf65lzX4a8dDPyZXE2d4tf7glSxeNlDG636aJzakoW0SKj3gfJPEdkXXQAKjsn7dDbPfBjbaq3INvPvYiAS+pz5vKonegclnXgd9Nxo7AG9vZTtxPmNZ2hSGrmK845K4KwNJCbIgOA7Dpf4zkFDoIa+CY3AUoDr3XgMvRVC39iF99UC/lLCbfdPsISxCn5pwDuzT5mes49GX1QQgiamRZT5mjIXs1OKKAKwZMZ99RV25o1tF54BCXmZFsWLF7uEH51VhTQF7ynOXC25Pu4rMk5SRef7j7/oGR3OkYz7feUR6qSAaH9rtzEGMCbBc8ovA0n8AcmPTaqpAwrJ89tZQWCDHqbuZ0ccABpMLJLlsDG1wuHShAqdkWd/vg3YZ9o5gHqT0ARQhaAjEXUg2oWGVmloWNEzi8oX5UDhZ7lmCuio/SrNUHPG0c3sdgOV0CZiUaLLAYnLKcRrR7LbB0CBz+fr81ud4ZsjHonRyjk9SJuOdbCqrfxzwHkDY/7T86WuIS7Shc0rLTdCp/vyxlaYh38xcX5d/HWpXfc1hKwM/Btpr9Qb6NJCILW0tPm5eh8XxJqLZ9k/wEcrZ/0QcM2HEVwkQA+NX69tasqgMjYWBNvmZV3N0hnBInDVcj+g0R+Fvudw4ys1O3q4sw9bdeeIw1kKQ/z0dsW 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: yHjdqqvnOSJEGfYZFqjvXLhatIp3mXKZ+atuA2znVI4J7Y5Qj093LdSndx0TEOg/WMpKsmK3fPKl/D9l0C5TchT9GIVQnropZeFgzhVYjYaHx8m8224w3pgXq1GdmHoPXi9LDlsBUiM33K2DRO+xMqrQt/L1a1MhOYLd70vWza22rvSfwZrumx5t/cPJxwhzc2Nemx2QLNqVoVWC72VA3kx0jOaGZwDP0ANtpB9tEmUzHDUOqFK/CdF4PoSOMGnk7WkvMtUf3uy+ByMrE/KVfhjEqisplUrojp+FkL1YNlBcK7FZZqk066o3CcyT+cW6TvoQs5/nfd4l4GYcWMGfForGOuddiqXzFrlhAttwV9d2Z1jwpWuORsHm6vg/v7ZErBOhjo/zbS8DYdH/OQiYUY1ruS8VkH3bUx/EXXLEPXIco/ercT1LJr9PyhkRdi8/7VzVtXZu2DoCM2Prq/xjicI/hBZ6Y+kaStOrRamFhzx7hg4sNXakOicWzuxHxQFuYDkX3kr2Ww9+BilPcSVmeH2yJvIopEIn9byZOo6hTw1dq61rFnxP/rE1CnxAHzYVKNFJpoIk0NAhZflcYkqIybgS5ZrixJGbsAbFqUWb8nhUQhQ5zeFMRtsIsS/b4GTgvQcsdnfITXRDH2At+pKnKu5wSl3irHdJRH4GQ9ivS+uFiKntIt7FQq6pQYIFt+/fbK+OyXNusKxAXevtT6hQ5fcWr0NzL5lqoY3/7I4+YktadgfAGPqFU58oaK2n6YLNLd25Zfh9blYi/B85E+U6hkSkBMAQWE9rUasruGihCDEaEmXbKBoU3p9CwOI9hIMUqHFYbZv7CUzE2dNJ/lK6YLMynOWL8PFDvrGjjZDCi98hSbGfNhboUiyRNdhiZUnwzLO4p2PxuBIceHwkfK3HUzaaWYMT/X9nZBOTCRtdtJ4QTXC965pCNT1TRkakpb+CipfBYbX7wsoe+QlovElMvrmyINkfr6xv24XVAMSfaGUnIUocTqsW/oAo5sVBF6YlN0XAtm3KJgzyqL3dtor/fBueKmoyhxCPP08QC4ZkVh1+F4GUE+txkVzMEK2Cu4sEky/WjithORQREorC+tce32zxDkSHJbBWXsMky9GQfGDG/4eEFxz8g0UvVaC7C/UOCbYaNp5VowecrWwxdTHxBLwJA64R4ZYG/YeTg7JwkRTBb2XWouwxuhwYaFM0SvGtYcAfgtciGzNUQ+q8IMsDQ7k01D5aTsBqz5A4VZJ9cxvcHLpiWGwSRRmG+KJmnEryxWFBTaoH7Leuz/5JtGzQCbO60SmGPiwKAxeJ4vXrU8FyJmWIcwJpijHtgoH/PDUyqtN2pB86A36gGHw8SthLznhfXXiVaCv5yR3neV0ghwgeuVbWq2NmP6pF2pb9P6QzcXqMzbwG6rVD5x06g6FnicVpBKviAgEaCx1e/oG6Wr0ShtUuO/NPH1Mh/W/cwZH0HqY/+NaoKsAGcVgV6hRwmsAyh+94snfEqHQlbCB67cq/o4kTraROrziEUnxDmOh+Pxtn3u1mEnBXJdc2y3qAm0GVFeItoCSoEj/8nO7d9RAe9gFeD8LjdvfSInPAnpl1Rk3CnN8w82obwQxdxrtXRQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 93359f0a-1440-4168-7e02-08db2b2e925b 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:42.8422 (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: iHQIuyifdcoH37q7VAjVRXjvUvDJjlwd2s61rr0KktXgJnvNihH1SJZVCoPeEoqqbOPqoE5k9mzGVCai/LRDDA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7263 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org ocelot_xmit_get_vlan_info() calls __skb_vlan_pop() as the most appropriate helper I could find which strips away a VLAN header. That's all I need it to do, but __skb_vlan_pop() has more logic, which will become incompatible with the future revert of commit 6d1ccff62780 ("net: reset mac header in dev_start_xmit()"). Namely, it performs a sanity check on skb_mac_header(), which will stop being set after the above revert, so it will return an error instead of removing the VLAN tag. ocelot_xmit_get_vlan_info() gets called in 2 circumstances: (1) the port is under a VLAN-aware bridge and the bridge sends VLAN-tagged packets (2) the port is under a VLAN-aware bridge and somebody else (an 8021q upper) sends VLAN-tagged packets (using a VID that isn't in the bridge vlan tables) In case (1), there is actually no bug to defend against, because br_dev_xmit() calls skb_reset_mac_header() and things continue to work. However, in case (2), illustrated using the commands below, it can be seen that our intervention is needed, since __skb_vlan_pop() complains: $ ip link add br0 type bridge vlan_filtering 1 && ip link set br0 up $ ip link set $eth master br0 && ip link set $eth up $ ip link add link $eth name $eth.100 type vlan id 100 && ip link set $eth.100 up $ ip addr add 192.168.100.1/24 dev $eth.100 $ # needed to work around an apparent DSA RX filtering bug $ ip link set $eth promisc on I could fend off the checks in __skb_vlan_pop() with some skb_mac_header_was_set() calls, but seeing how few callers of __skb_vlan_pop() there are from TX paths, that seems rather unproductive. As an alternative solution, extract the bare minimum logic to strip a VLAN header, and move it to a new helper named vlan_remove_tag(), close to the definition of vlan_insert_tag(). Document it appropriately and make ocelot_xmit_get_vlan_info() call this smaller helper instead. Seeing that it doesn't appear illegal to test skb->protocol in the TX path, I guess it would be a good for vlan_remove_tag() to also absorb the vlan_set_encap_proto() function call. Signed-off-by: Vladimir Oltean Reviewed-by: Simon Horman Reviewed-by: Florian Fainelli --- include/linux/if_vlan.h | 20 ++++++++++++++++++++ net/core/skbuff.c | 8 +------- net/dsa/tag_ocelot.c | 2 +- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 3698f2b391cd..4d54814143a8 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h @@ -685,6 +685,26 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb, skb->protocol = htons(ETH_P_802_2); } +/** + * vlan_remove_tag - remove outer VLAN tag from payload + * @skb: skbuff to remove tag from + * + * Expects the skb to contain a VLAN tag in the payload, and to have skb->data + * pointing at the mac header. + * + * Returns a new pointer to skb->data, or NULL on failure to pull. + */ +static inline void *vlan_remove_tag(struct sk_buff *skb, u16 *vlan_tci) +{ + struct vlan_hdr *vhdr = (struct vlan_hdr *)(skb->data + ETH_HLEN); + + *vlan_tci = ntohs(vhdr->h_vlan_TCI); + + memmove(skb->data + VLAN_HLEN, skb->data, 2 * ETH_ALEN); + vlan_set_encap_proto(skb, vhdr); + return __skb_pull(skb, VLAN_HLEN); +} + /** * skb_vlan_tagged - check if skb is vlan tagged. * @skb: skbuff to query diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 050a875d09c5..0a7c058d4849 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -5939,7 +5939,6 @@ EXPORT_SYMBOL(skb_ensure_writable); */ int __skb_vlan_pop(struct sk_buff *skb, u16 *vlan_tci) { - struct vlan_hdr *vhdr; int offset = skb->data - skb_mac_header(skb); int err; @@ -5955,13 +5954,8 @@ int __skb_vlan_pop(struct sk_buff *skb, u16 *vlan_tci) skb_postpull_rcsum(skb, skb->data + (2 * ETH_ALEN), VLAN_HLEN); - vhdr = (struct vlan_hdr *)(skb->data + ETH_HLEN); - *vlan_tci = ntohs(vhdr->h_vlan_TCI); - - memmove(skb->data + VLAN_HLEN, skb->data, 2 * ETH_ALEN); - __skb_pull(skb, VLAN_HLEN); + vlan_remove_tag(skb, vlan_tci); - vlan_set_encap_proto(skb, vhdr); skb->mac_header += VLAN_HLEN; if (skb_network_offset(skb) < ETH_HLEN) diff --git a/net/dsa/tag_ocelot.c b/net/dsa/tag_ocelot.c index 73ee09de1a3a..20bf7074d5a6 100644 --- a/net/dsa/tag_ocelot.c +++ b/net/dsa/tag_ocelot.c @@ -30,7 +30,7 @@ static void ocelot_xmit_get_vlan_info(struct sk_buff *skb, struct dsa_port *dp, br_vlan_get_proto(br, &proto); if (ntohs(hdr->h_vlan_proto) == proto) { - __skb_vlan_pop(skb, &tci); + vlan_remove_tag(skb, &tci); *vlan_tci = tci; } else { rcu_read_lock();