From patchwork Thu Apr 20 22:55:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 86074 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp669388vqo; Thu, 20 Apr 2023 15:57:44 -0700 (PDT) X-Google-Smtp-Source: AKy350YAT8nHTBI605mUAzL2Q73lcReNIpIhqKJV3I7XZg2ipdNeL+OJSQAaRKu6CMxZUHHDPAmd X-Received: by 2002:a17:903:1c7:b0:19e:baa6:5860 with SMTP id e7-20020a17090301c700b0019ebaa65860mr3594972plh.2.1682031463980; Thu, 20 Apr 2023 15:57:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1682031463; cv=pass; d=google.com; s=arc-20160816; b=qE/NlWjjvDBY0hn0WQSE0N1+De09h98H5RbyTokm30StsmQ5YlhIRuoeatkb5Mk2cx inUy2MBmbkQvovXRfKYHvP41k87wwYbyXmFoW0sTpMsWb/VabMqzZxErFXmIZPnRDiI+ R2VxoY4WIOPBJgWeRfJsr0fccV/KCmo1CqOs5Toz8eluMZSWJCLFHqhWsyMQvpqtpROE QrNPVFsqnEHvCE5zQxZZXVSU+UlLwyv7/ofaaXK/z/mB6Z2CG1aMcUkL70Bth/q0fT3A /fF7I0wOa3AiqoBF/DnrQ+Onmy2hTG3pManH033RtrXya3dpCb/7RMD0Fe7xyp5AfHBl r3wA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BbCd/MGRniqdetASdFqizhW2CBDY8IEYUP3mWHYLPXU=; b=Lkj9y2DKA3TEoqtmXuquQIOIthRVthj23ktuTwcapi/YfFsaol8aUi8rwsTqXvHJQW gJ+J1bTrLgHNaX067tI8Ru3dNshJzy7YhGdGc+PmrjLfubogmSbog5SqcrOmyiFX2/GB 9QTu/m9rsvhWEwNoC2mWrAotVbfuBHjbVlBMhy7iAIU7hs9LkPTE6iBdqgsvFHroMQ1w YhnClC3A57T+ZtTRcmVSO6rP/R/03EGtMdI8rxgXOIVcC5w3Y9gYbtXta9af6Q3ReP8R s4qxys+SleWBnjvhMXguN3/i+jHUTr83c1Jqt4Ul4xHySczB6wJAoEy7jvzvFZVEOGr0 Aq2A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=B2wkNpSY; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jj11-20020a170903048b00b001a198584921si2688459plb.482.2023.04.20.15.57.31; Thu, 20 Apr 2023 15:57:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=B2wkNpSY; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233153AbjDTW4X (ORCPT + 99 others); Thu, 20 Apr 2023 18:56:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231562AbjDTW4S (ORCPT ); Thu, 20 Apr 2023 18:56:18 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2063.outbound.protection.outlook.com [40.107.21.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36E7F3C06; Thu, 20 Apr 2023 15:56:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZmUgpYLuQaBnoYtTAdiRGaCI/sqBojfhuk6At3vfWTHLjAQnqu7bnVpUKtoY/27fYg/EkMbJRATlHzV9pzABRYGM1RVAVRrCRvRfsb5EvA42xHjVvXQF+souaT6wezjKpfk6/lkJsPJDEihZwjBOMwRYQaC4ihC3mLMzkT6N4yYy1IOzu+DqcaaIB5GRp3PbGcu6gCYZ8tVTtxgf2/Rhp6o3PVLrGBhJvjyzBpFdghvofeoiJsn/R5l5U3QnQBf6XEd06+an6lPeW8noIRuX4Jlk+6okuSemENaid4z0Kn6wawFMsb4PCIA5xneGSfBQw0tTx2Y03+dPLqEOYBtotg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BbCd/MGRniqdetASdFqizhW2CBDY8IEYUP3mWHYLPXU=; b=hxbJTyXT39TrWSTyltH7YYTabRDJGvbbz5nW5jRgQIxTXbaPEGtAxxM3yRcwtW8Ziva40bgyM5nGSFH6kN2bB+83w5xkb9ksgh3a5z3fdjRmPw/2kgCLL6rogouDf5Sykc3crsVlUCIZAwaPT+djHoDGQfhNUL1hl9ZR6dprK3nf2AZNGBOHHZKBmRTEKFx+acVEYR1TYGvx4SYULnW1dmKQPMun02JcQ9v4u+IZOV4Y6KeSPhtPkevqtVM3KrkQgy+FbbQrotM40d4V+fMffpZ49KSZ81gWJHsnsje/LdethqxrJ1umg+lW9qUqDCWhAtQvwqE0vs9YXi0MuVWUdA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BbCd/MGRniqdetASdFqizhW2CBDY8IEYUP3mWHYLPXU=; b=B2wkNpSY2GvtHM5mAfB33IaHOVh55S9eOMALLWY9UmBD+aH+Tj4A+htJj6vcDR8YDyNHSkB2Jdj8aeM+1YoZUSLIPmpVpfIK6FS/OLrxxvmen/CKzT6jz1J+VThaCLhwmgTvC18ZjN7WTZRPZnKOZJ4Lispm3BtYDMDH+4GPKng= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by GV1PR04MB9213.eurprd04.prod.outlook.com (2603:10a6:150:28::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Thu, 20 Apr 2023 22:56:13 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::245a:9272:b30a:a21c]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::245a:9272:b30a:a21c%3]) with mapi id 15.20.6319.022; Thu, 20 Apr 2023 22:56:13 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , linux-kernel@vger.kernel.org, Simon Horman Subject: [PATCH v2 net-next 1/9] net: vlan: don't adjust MAC header in __vlan_insert_inner_tag() unless set Date: Fri, 21 Apr 2023 01:55:53 +0300 Message-Id: <20230420225601.2358327-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230420225601.2358327-1-vladimir.oltean@nxp.com> References: <20230420225601.2358327-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR03CA0088.eurprd03.prod.outlook.com (2603:10a6:208:69::29) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|GV1PR04MB9213:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b0d48ca-7637-4674-a67d-08db41f27081 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bculxy5lMfUnY0R7xr/cV4xx3aNh/jgTwasYVsdKgdpkQuvqlZx1GlaqdSpLVLYOSnq4jUoh8yICi3PtUn6n+/8W2TbgtWuBBVKfMJp4TB9OVLFMnF/tLHkhn3f7S2LOk3QNMqS0xRB8uz8en8yyEOPcou5E9bXQMWTrIQRoym+NHaed/IhsD7tHapl+5ZEkpL1qt2SHRkJNk72z5G3aAm+c94qzKN/srocVikz2tLSGZmUqopuELfsscw+kHyu0HffAGR1gZXCx76mAEflzeTRNuiyTo1Iy2fQB8uMEzOHlSWcE9nlLWvAC7BVSClQGkFwM4rPRX+nzITv9Wgo6aWv9teJH0aqeBDIeR0uLPoP1d8U0+l9E9AW1sYto5MiH7Q+2nMN/tnkwkbbes/7WSzBKdeImH4eABVIBF3vIeSNm+x5DAUR7vwUnjzD9Uiu1yLg5URFvjzOv27bNMet5opDM12sAPRKr53uggoYOmwyl0FiFaZXCb9KJSrKiT6yx+7UGUjjDMmRe0GB9VPtq//HmTk+rrmPmN1ugGUn3eeJfsILI0s/5dHxm3YRgFjQJHmgi3qB12LXmez+gjpwiGbIULqbgH/TP71wXBwLJcxzDOjMWVQFrI+/10HQUhKdv X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(376002)(346002)(396003)(366004)(136003)(39860400002)(451199021)(2906002)(38350700002)(38100700002)(86362001)(478600001)(54906003)(316002)(41300700001)(66476007)(66946007)(66556008)(6916009)(4326008)(26005)(1076003)(6506007)(6512007)(6666004)(6486002)(52116002)(186003)(36756003)(8936002)(8676002)(83380400001)(5660300002)(2616005)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: T46/nrInAgsV9YpHhwlNybpGThHwEPTOVWgGkIBwK6b9mEiQpbNHEgiqiYxpbSlJuPor7qqwLE0YU2diZM9LDsamfDqn+Sl9rE50LZLbuhVPDs1r7XVM1r4GJXGIYyh2wrtuFm2sbJxG2f7B7iSxfFPjeuHVOZt0bKOnbwrlxPvhEbr1pmS31t30JdgQv9CzYZZAspT7FaGj/MTQOrKBPEDyK6Ydc4cvQgOhjGZDom9H2C0nGRH0Mkc3nEQFPHeOxEzQI+aZ51myG92QaeS3FUOub2ZTA918MeyJETmOTZfnpStcNZ1QDofEEUrfad8BrdvU21RavTBoHR7Oru/b66DvTJ1YFuW1nfwmwmW+eR8u8xF3t53Jr8hOGLAkuUMnNHnvbdQxujD98PwLmvP2JpZLQ6kKWLRGYWOIXLjiXy2BQf5n/ulj8q11poF0WjaobrjywodDTtNJGSfCX1RZ2bsgVXuWHGuSU6MZG32UFCmjR0ph7/ESjQAodKfIbBa4ib9Y6aZeQ00NU6Q1XQHJHnXvZdVwFLjNkVpV6b47htJlkkhe1hv3eN7c8M7mwSnp5c7pX53excnafKZv5ofhR1AdUDE/lK+B/N15b2Jlf4BRdi6D8K129l20cGa01v4O00vODFR1anWyQkPCwYkzsnn23KxdEDpR9AKSzA3I/ypzCwIxnpgbBZ0gCRVfpvQ7BSe4Hb+BOqNHXZD4m+6pECLeCxUJbSb77OfKfFoka1W9GQGEF2VuOagsAMpRBbRU91VelReH923xii8nOuKvkkWA2XDByk8V/SlvrvGYNvbkOwk21XXrr3wQJxa0OBFkN97vsDuKSr6hrHvTjAIOhO+s23BjCHmEkygZ6w4QV16HNGBTQKK4ail7pfzGNzrlGDi+gkpUhIo+qdNV/y6AZp6AdPf0bsLZhVHPOu/5aTZe3rNZ/5bX3YJWUJBO7sKf0gvMnh2D4rknXNkNwf9eHooyFDXkokH4z8Ym7tsCYADTt1+LHxGTilSY1Zr+7BjmvLWCzLw5OlffBDOJh526wiLHjvXoNgbckpl+Hm3LFbfH9SEh2WxnG90hTSZjm8zP0lqRUhtJu7VFISCYyh037bfGv3k/nb8U5pbLKA3PrD62p869qhWDBi+Tl1AXPHP1wwgnLWwMo0LYNbxjHMyqR0LN1sYUZJA0XEAdHKd9x72aQ6wX4/L7SzzZdrgn0aTvgGP9VtFVhxS60fDY58jMmYYZPmw6Cf+BzeamdAk+vekmXy5XxO1kPeQ3bO2MOVQ3Fm00lk7kIh2NkWoL+pDoYLiDyYPITwrp788sUBaMs65lFu9BvreNulxiHYFa5PtqFUmOLYV4td4h8cmnr05JpdNzh5ER/eYkqJfrO59LIHMhU6w3tgu0jpzve1J/XLH8Q08plpnBkzxtpj9h3y4regCTw0dolQoXQXFdCzREngxTXhFJHkWvaGEAy5JR4rfSoapGG8XL/oYi4tVvme6PaIlokZmrlIjenTk6LGIN3mYGcqvlMJkEYI9GqJq84nLiqThYztZSOYHHvYB8rGPxt1vJ2i3XiKDXEMnuWJNSWBihQSnWARBiq48FyvC/Aq+SqLISL4mUQ9tKicj9FS+yig== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9b0d48ca-7637-4674-a67d-08db41f27081 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2023 22:56:13.0029 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9fZiXbFr3hdJJ4wveZgW25U0pL4/ZSffIaxi4GPHC92FyW9dJEHebr2eBG4YPZgG0tl08lWh6dHLmk1lhvCwww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB9213 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763737824803448800?= X-GMAIL-MSGID: =?utf-8?q?1763737824803448800?= This is a preparatory change for the deletion of skb_reset_mac_header(skb) from __dev_queue_xmit(). After that deletion, skb_mac_header(skb) will no longer be set in TX paths, from which __vlan_insert_inner_tag() can still be called (perhaps indirectly). If we don't make this change, then an unset MAC header (equal to ~0U) will become set after the adjustment with VLAN_HLEN. Signed-off-by: Vladimir Oltean Reviewed-by: Eric Dumazet Reviewed-by: Simon Horman Reviewed-by: Florian Fainelli --- include/linux/if_vlan.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 6864b89ef868..90b76d63c11c 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h @@ -351,7 +351,8 @@ static inline int __vlan_insert_inner_tag(struct sk_buff *skb, /* Move the mac header sans proto to the beginning of the new header. */ if (likely(mac_len > ETH_TLEN)) memmove(skb->data, skb->data + VLAN_HLEN, mac_len - ETH_TLEN); - skb->mac_header -= VLAN_HLEN; + if (skb_mac_header_was_set(skb)) + skb->mac_header -= VLAN_HLEN; veth = (struct vlan_ethhdr *)(skb->data + mac_len - ETH_HLEN); From patchwork Thu Apr 20 22:55:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 86075 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp669412vqo; Thu, 20 Apr 2023 15:57:48 -0700 (PDT) X-Google-Smtp-Source: AKy350a7V9kU+UbGtKRph+zI2zZcyV3bHt08iP/eiukw/g6Z+BEQSyEtWtW0I632kgYMw3Qrr9Am X-Received: by 2002:a05:6a20:7fa3:b0:f0:a8e7:e4c0 with SMTP id d35-20020a056a207fa300b000f0a8e7e4c0mr5070115pzj.55.1682031467979; Thu, 20 Apr 2023 15:57:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1682031467; cv=pass; d=google.com; s=arc-20160816; b=mPejX6UWLaaAF2UzOY5aN1xHxJGWgz9Ll7rdspGJ2wRzeiqWefF3ntNiP/iYRO03f1 ADrm2vz9z0BZWC3bgX+5Xy7EwDm9hEK4RijGU22nIifYn9nWiycOEonUwXS2NZ6Gi0Gl 6TI43VZjzJhlmSBpbvGkn7er4/eZqrUigzUqKBs8TP0UFjuPTaESGfuarjHg7zz/BPIz 1kdr/LnvMImUnmmcZscJQK2Tb8PORqk+V0wyynWJuMihM9n9ubHlzF4PlwbEJR5seZHi I3W4RJqp/08om/zFPSlhGpocf0JRvOgF+KGjkRnXpDFXfJPHw4MXCzNCGhjv1iTQhDP9 wHOA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/0TNAANsp/qqmh1WtfphXOh9vFnOldTmvS9awJSo3js=; b=pi+1xVzM5cvpXJDELSF550sWy20Ndew4ZR6ywjK1zheCv9zr1JN9sLuBkq7K+CMZm4 OvjhlQ2RRMRqicdJHIBTPFvha7t2S6GiRgjga7OLlhtY2wTaCNqaq5bsxPIw40N/Qqkw i1ZiEAJBEzXPu6euxf2qIq2OHbVvudotria5PPKOmqqtrAjmsp6Sn6PnRicylkGE3q8N u+Ynhm1h9aWdfXp6vD2y0G6vQ/nuOcRGuqA2nhgBqdWXC/1pL7hyCMhu7eZ23/JRTBWU WH7NDVCQKWsJVDXOrO3P4gS2/mQkxn9Afq8zGyU7yLXZhKU4yPqaYlIa0VTei4gQOi81 d+gw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=notalCUK; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v68-20020a626147000000b00639e52424a6si2605370pfb.146.2023.04.20.15.57.36; Thu, 20 Apr 2023 15:57:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=notalCUK; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233212AbjDTW4a (ORCPT + 99 others); Thu, 20 Apr 2023 18:56:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233115AbjDTW4U (ORCPT ); Thu, 20 Apr 2023 18:56:20 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2063.outbound.protection.outlook.com [40.107.21.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 618703C0D; Thu, 20 Apr 2023 15:56:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lznu0NnVt6fGL3dRrIM9/Ddqwory3d3eQ+W+XvLlZ2EzqG60y7Ls8w/7n1dBLneVDM3QDF0w0FzmOI3hXQUG9jy2p1BCpcMINtVxUwmp7zehY+ZL0tHAA9YKaBoKNpBZikGCmeWIobwHjjlAtQ4BsyzrSF9Wi6iKQATXO45bwEFAfkYd6tQpxQB9bRi79cQ5/cTi3s5cKqRBy7zQeLHVQcbccs/JaRiH88Gy3oEDeCK2V7wUulUFrxnBRHBmSaoTKzrEZKJ/+0XCplYrb+ilaVDVl+nDBi8fZQX/IO/ipiZ6kLxinGmd+pFHY5lPmpTN+GbL1Z65mqh9yHmVeua1KQ== 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=/0TNAANsp/qqmh1WtfphXOh9vFnOldTmvS9awJSo3js=; b=YKkyChVbbxDaPZgNUCvLxMy7CNP7RtPmnHNeGH3fdlSnU/YDj1VseaI4YrYUKMrxoYY23RuuYnW3apKsX3Ucwp9jfL8y9q/mlnWJCHvxEC36rwrG6o+oqzbFmNbt3wIqp6EMvVhfWxNYysqvz0QsqtQ7T+hPEX/PAj9ybMLpasG4SnzuFWM03KdodfNs3Cvaxnpqf4cP7sEZg9VtNnhYmaSIiWOXXAouRJ0+cYl6ob+s1Ij1FRPcLYehvVpQDRfye0JmI/0uZeAnIECG+Nm/42hnuhm47ZeSMUOKhWXAhK7Bnbkmr1G/iKXYEnyn0pz3ktfieRDI8442FeOzowQyJg== 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=/0TNAANsp/qqmh1WtfphXOh9vFnOldTmvS9awJSo3js=; b=notalCUK9YFcG5Sgo0DLu8WrmQ4sQUpveiHe5FE01dJ5mD9AMX8Zu6fwL8JqERmqhEHGpuEC/zSf7WCxeANGmoPrS3SuajOkRqJAtARm5TcWXADiHN3Rc6xo88VwQRnu3ENzRJen4hntql3tQd2hxHMu2Yj+JorwSOZe9ItWHjk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by GV1PR04MB9213.eurprd04.prod.outlook.com (2603:10a6:150:28::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Thu, 20 Apr 2023 22:56:13 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::245a:9272:b30a:a21c]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::245a:9272:b30a:a21c%3]) with mapi id 15.20.6319.022; Thu, 20 Apr 2023 22:56:13 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , linux-kernel@vger.kernel.org, Simon Horman Subject: [PATCH v2 net-next 2/9] net: vlan: introduce skb_vlan_eth_hdr() Date: Fri, 21 Apr 2023 01:55:54 +0300 Message-Id: <20230420225601.2358327-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230420225601.2358327-1-vladimir.oltean@nxp.com> References: <20230420225601.2358327-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR03CA0088.eurprd03.prod.outlook.com (2603:10a6:208:69::29) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|GV1PR04MB9213:EE_ X-MS-Office365-Filtering-Correlation-Id: c44b64d4-4f40-4139-b3a5-08db41f270f1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 18pUYwP3RxwYDu+S7QCSbmYdik6X/a9ArwSwVYs8XW7W9sZCKl0YRZTNwbGflmgvCLyF8MXtMS5hkyEnhkJoMbZarFFytDfB28aM3n/KCy5DHN+JkaYhzMi/XfbtJ872vc+IbyH/Lm9AdOC+b7ClrXGNJHZ9sHMNB8fM/oSjVyNdlvmCKuU6EIgP7Z8FRJysP75IJgb4V0QUVmu9rMpCE378lq1xQehnnGTGzvWYJnyTheU/ReLEvfTRfOstx0JM+ALEscoNSTkX0PMdFGJzNwyVSOpJEjgFQ0MrQ9+QpvKeSrc/LHWWnq/jxJNyTZSiZbn2nZBEISmIFiQ2DKZvh3m2af9/sub91mr3VFCg56E2EqK/9nQqU8gX87TrmEg6puejovjER7Bdgg5QSOUrJkWPJrYvr7hFeUkk/zKupRV0DlFoE7G8uK9mIxdvRFBgfZPj0Xxk4MSV3y4iuNBOLv0bJRKdk41XPwzLXbu9D51Ae4ZoHVjCwMEpxYQNwYMYPRByKlj8plHcblOLLK5q7kiVGIsqNdblR4P/lmIPms1beKxwGQ0ctc/ItbeOhLeKK6qefRRJHBWFwLWJ0O8ZEtrcFeJPwJTx70KJBcNjFrqIReB3DdnfYUtpT+d+W2CJ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(376002)(346002)(396003)(366004)(136003)(39860400002)(451199021)(2906002)(38350700002)(38100700002)(86362001)(478600001)(54906003)(316002)(41300700001)(66476007)(66946007)(66556008)(6916009)(4326008)(26005)(1076003)(6506007)(6512007)(6666004)(6486002)(52116002)(186003)(36756003)(8936002)(8676002)(83380400001)(5660300002)(2616005)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zuA19TtWuXTpaDCpgyl8tPASqBy/vvX3QIGGgzM3Jjh0K8Rwf0Zc24hz4GnQeIm3GEpsmaf3VIBVamP7kJ/16e/NA+A800QWntDdWnWGcPpUx82dUUxIANJSVs2V1ubN4z3zybeUL9eic2+/0AePREsyauR3c1no5zt9tX190FuRIcYG2m2UQDXc3lOnMsCxoc+AdP2DIRwM9XZWKsi7x/rRhTdFtRpjd/8XczHTZvG1EKJvTAQuFaruz7URd0icPQV/vg6SF0F+tBo/XchJ430gGHhixV/YsfZpD70LixSdP6NBXV7YqJYaXfkUvPmC7pRH0XSz5t5KYXKaIliUI+Mt9IJp+pQXrk2h8znjGbPZcLclIgHYrgbUwbAz+4FYWXAFuzVQHOExlxlVjAQ3UVNzBmj8xkeJMovW8T8dy/CsxZzElMxvUQ5AF7+SFzIlloo+sxmaSjaYgclfUsvzOPG34z24VqZrRfVkaXupM/W2aEG90v+bDwMfRfwwWpTVuGCIBzD1RDAzgydqVKmJixsyjZ7wYTtJBw5ZVZWnQyodp7lK0thTrNfvj4GAYhPaawechl+KxRd7vr3HbkLePxTpDtiPmtULLfEoYTeb3iRlMrIznNYIGjPIptvi92UPnlKBXQtd5c8diR0jmXwbtNXwFB+wjMBL56bkGBLGgjJUsZojvcizqabq7AHLRacvgIwK3Qb8XfRlZXqIE3hqyFlcp6oV+eZCDfZwBG3PW3E5VGs30POfdrPhJOW2GtmHX/8+K2AH2c7+Cum7/vq34QxFuaRPs23nTyuucAA1ZyT/S9copeRCqF9lztqFTIUbAsCWtGBjvLQ89+qAju15dSVVuhH2Z36Z/w5BAmEPTGQ0uhnOvHzXfUsYUcJRaz95Nh/edBU06BE6QqyCMQpeRfnWSo1GtOF2DhleCtYJKHo3nWNI3FW36kMW1TmEamWvHvDE4x0iFHr5BJXGNXpB0moOKK/nnEorycTuUASrLCsq4LYkyjDxAXU0zMyD+i1sobpF09ynzHswIeRAOmyy2muxG3DhzUg44++cgOY5G2WbSuZVs5MiqgA66MH4oxylV+GYbj7sdS7mOPJ0yk6I2yJIb8OcJEHOhBrZkA3+B/hVcHGwFVoexNlKl5+02Nw+7n+3cCb98KA2oovWC/Qwmlrv9OoRpsz7FOAHQSF5Kh8heJlJKIQZta3hHafzvqMRjWFuFL5Ro++ZCdj9PMtWSFE5IMKTS3embpaDE6GJCRhM1bL5/IV6g7CKlzvdm11yVaAQ94ZRxUYRVeR0MgBN+yqLYH6NqALmqZpw7wZILTEQDNJHTFDREQnmJVzl3wxasa7HLqZNy8se23o8EZFr+OJThKaXmM3nmbb/rYo7VvTPVUEYEwdTjZ9wWktAuWNEuNmBBh48LZshLELnS6Wniq5ZQIcYNxWWBHyeN8zMjwiJCGnsbQV4SXjJSk24OB9ZgaD+RizX7uCGn+yuah4SKGar4iGcIt6NSyFTLMJH7nU6zaHllS6jXGsk3WxIKf1L9Fftf5XE0O3HBgXxVyzxlVhJBToiK1h25UueLqbzMRjqR9qDToqX+mFvFQkbnjKaaamhIbU7fMIXR1jleZLP5w== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c44b64d4-4f40-4139-b3a5-08db41f270f1 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2023 22:56:13.7397 (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: 27SXkNzm5YWrSO7KsXAdHf4uKWpFwl0GMub0EHHJhjmqY34YV5NNvmLOHLOlrpbzIUWmxXOyesI7FcNW1Lsnlg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB9213 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763737828120170545?= X-GMAIL-MSGID: =?utf-8?q?1763737828120170545?= 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: Eric Dumazet 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 12083b9679b5..6ea5521074d3 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c @@ -1935,8 +1935,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 c8c2cbaa0ede..8b8bf4880faa 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 f2604fc05991..e961ef4bbf4d 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -8798,7 +8798,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 47534310365a..b8e2bd752f89 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -4569,13 +4569,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 Thu Apr 20 22:55:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 86081 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp675122vqo; Thu, 20 Apr 2023 16:06:59 -0700 (PDT) X-Google-Smtp-Source: AKy350bk6bq6eHe2PjtreI5RO6SLvlPPbYtB/GBcJFKJmz+nMuOdU0bcpj80AnVpO6p86I1EACEU X-Received: by 2002:a17:90b:1494:b0:23c:fa83:2a7d with SMTP id js20-20020a17090b149400b0023cfa832a7dmr3475652pjb.12.1682032019516; Thu, 20 Apr 2023 16:06:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1682032019; cv=pass; d=google.com; s=arc-20160816; b=s/MDQMe2NB8kbIn0WvzFAmxUHAULmaOO9SJ/zmvD+W85agiY6AEsY8WzrrACToGQrV 3Bjn5BZYJ6l6eO4uJeA+U1W3oZCZiXTDbJFSh8zd6kwPcbb6wp37MXb5ZDd2zYvZe8BQ 89dKPyjj+sdU+whw7OSI0HfyerGKWv/NfeAtXGc4SjjiivNXPex3TDj/+Ni04lu24xlW ApQgOmV/iJsCNLd//TB1Wve1WzpAmp0SNUtSy+Ug11lIpnegtPE38rF+cToPUn3GjbZC 0Xd/Bfbr4o0yAdC/RqZLnJa5a/N8iYJRVg41Hx/3etWuE5UkTYgwbGINP2GWn+WMGw5J mawQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BNBllRY2kMskBkefqHjux2zmaTfona/fmbPs+u0Rwss=; b=oSsAwvmUb2T8t5qHf3mXt99lPsfXC2SdW/VuJlYuLuEbDi5tvrMx61CzLsBvlky/Hu HdTRboUu2e8QrOq3arHRLWrBgEBV7k0cnyxYhuUZ5bdriWIvrexAPEswAW+ztQpF9tjW TH0RVUEdxthTvH6JrJmetpFqFdZvp0gFoJohKhbthEvnhD8wQOMqxFqDjI/lyeJZhD6G uHyil0fGf+Y6gTC6uTz3DJwmcY8teRZfxMCHbnkefBmgaKcJsi/J5W7DgdzUkfOhboSW D+Siyvb4SqfT9Zo7NGTxQp2EYQbIdLEuAn/kAArZEPwKvLmXGfe1TB1Lu10gX5IkFNVU hP3w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=DDjjMJ9y; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j19-20020a634a53000000b00503a2ab160esi2837684pgl.553.2023.04.20.16.06.47; Thu, 20 Apr 2023 16:06:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=DDjjMJ9y; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233317AbjDTW4l (ORCPT + 99 others); Thu, 20 Apr 2023 18:56:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233145AbjDTW4W (ORCPT ); Thu, 20 Apr 2023 18:56:22 -0400 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2070.outbound.protection.outlook.com [40.107.14.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA0A755AA; Thu, 20 Apr 2023 15:56:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U/L4bMmhIxqcCps26KJ2qsIeXdBZz0tvkVTTfnoOvW2sjSMJnjf5RZuRW+PGHRQ3jWgK7yxhm7yub/zA51sfdcmqZImmDHRd3xW7k/8/v1xV2jexpvYWU8OPdc2f8a3oXxqbHO7anv6F6qZ8q4SJhjf+HWygLTKf9uGmuLIs4h2mH5/AZZDaxNok2Y2sPTeIata/3x5G9IvaDev/r5ISQsqHxA68v0M+AScsFoJAiB4Os9zgRxgtb7SXZ4GnGrOag81N3cif8wxyPn8YD5iREC5WLBFSN3i0fbCd98EFsVV6/mY4BpmBbyb/+0MDT7tyV6nK9MlVPJR6eyPkMjWdQQ== 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=BNBllRY2kMskBkefqHjux2zmaTfona/fmbPs+u0Rwss=; b=gJoi3xET4UN+LwJin58naW9hdlvjky0lPvtbUtPNPW7V4e0kWIQfBCBNraLU+cwPcmxnAtMXlWMM24aCYanIke+959LLrM/158V66mxMOOjuCfig+P8UmqsU26DHb0y6z55WnTgUeOrJPHSQdmRmJNTXHjJ+Zt83D+ZA0+2qPb4HsUTq2tW6JuD38/ugkVG90BOhoPcR+b7rMaLXRaDzfkpKbrYWUOO8iqQ9RvG0639k+iC4vV0PoeqZDX+bIVymep+jPyzj8HbskeadDP7ER8jqcJVH8UZw3Z8jb4kjRt0RpfqBkCXhifS412c7lfyWBheb+mkAZswpuBwtse+toA== 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=BNBllRY2kMskBkefqHjux2zmaTfona/fmbPs+u0Rwss=; b=DDjjMJ9y/LrAhXaZG/guDhjeeBUxhAFjTrYxXXxmPakoe6AjuDouAZqYX8eRPPcflbUt5VO05Tgr+bse0K2mqkVvpzrMfMJ5uk0hY3ad+riEbflS9eUA1UVBDgcc8FK9GVfjlrl5X79/uQeELfG96nRxa6DoEg5ENxzuTdKDYKg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by GV1PR04MB9213.eurprd04.prod.outlook.com (2603:10a6:150:28::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Thu, 20 Apr 2023 22:56:14 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::245a:9272:b30a:a21c]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::245a:9272:b30a:a21c%3]) with mapi id 15.20.6319.022; Thu, 20 Apr 2023 22:56:14 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , linux-kernel@vger.kernel.org, Simon Horman , Madalin Bucur Subject: [PATCH v2 net-next 3/9] net: dpaa: avoid one skb_reset_mac_header() in dpaa_enable_tx_csum() Date: Fri, 21 Apr 2023 01:55:55 +0300 Message-Id: <20230420225601.2358327-4-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230420225601.2358327-1-vladimir.oltean@nxp.com> References: <20230420225601.2358327-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR03CA0088.eurprd03.prod.outlook.com (2603:10a6:208:69::29) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|GV1PR04MB9213:EE_ X-MS-Office365-Filtering-Correlation-Id: 740889cd-4b4c-452b-e7c8-08db41f27168 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zopiOZN95nyFLCtHFwczPWGx7TA7CbxOHhKxAWSLwRjhAl2q6nV7VDoP32EMj2sQYle9m/SJF7LiBcOQovZHB8Wml06JL1BwwfAwdhc6pjRRBBmo4KjOqeiozWHK79izFm8e3+ZbyVIvt/x7Z0tiuohIooTJD3JiJ/DQ4VXCTJHX2mEHZ8GIJjXiL7mpyoKatNfgpn2ZOJBz2eFFXBot8/Uxn3lsndcpaJuKwBEhjshSrxhk0ZzW+n3bKfi+mXnx5paSIBAiNe5vuDKAD3WM1l8CrIY7Hd+r5V2LW/K9kKIE9AFvW692uHznbDmrMYj0+IQaijghkXglUqvqFoNbnIU826v2dWjYt43H/bYpgd4O9lpKDh5wooZSV3oCf05+1CpAfW+XfnAJckq0QZnLVq8Vl5n600SY0OVYccd3aiL2sxjN7OLw1ZUzw1o3wSEg2FUKWik0PXBqDjFLwHSZ/mKmFYeO1GPbnAttyXoV5kpX3554lU0pbmrRRkxLnwYDWN4k6A69qjWFq2/7H6mdcccoRuyj8U1SdHyhl0hpAcEpvwkZzyAd5wdk/5MCBJhRr1CxRMtHZ7rCqVSKgm15wpURwGremURrdg1TLN6O0K8iqw3ivD27Yp5CyX/wNMbr X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(376002)(346002)(396003)(366004)(136003)(39860400002)(451199021)(2906002)(38350700002)(38100700002)(86362001)(66899021)(478600001)(54906003)(316002)(41300700001)(66476007)(66946007)(66556008)(6916009)(4326008)(26005)(1076003)(6506007)(6512007)(6666004)(6486002)(52116002)(186003)(36756003)(8936002)(8676002)(83380400001)(5660300002)(2616005)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ae8Y7RebDJgBCgaYfNynzCIjx+DQODXw1jbJ0Bfnar0bb5Cj+ROCvwRCFOwdGDKam3Go+tnZV3Gcs4oNxF7PqE1QwoFut8b8/zk5MsQTkvx+zd+7AwHiQ+KA5nGXKIGQZn7k0ntMO6QRrGfy+5SjHmc7hBYwXDSARj76MGbJuhyv5o63PK9a5PIOVp3PDTOf0SfeN/dPIkLF8jxsxgCq38zx5NSvVUFh4WPoauLqhFpvZmPibvyNqRSjg+FxZaC0A0XtdbHWhsfRN3MQEROcBfbrModaJzr5vXSLgMAIRHQr8WzBrTo7h6n3xDgcBBswZ4aCSjEWEDanWCBcNuoSVYlgEY/nXoMTXpw/iujadyE8BB9mUs/kjTtNpZ8vFzDs6ogLIuIAoGnJ4+4jYgDUfPFg5lqvfSbVRZXxS4+DVZl6F9j1TUr9LNPhCvbphbU8YN6oIXij7P+gv1/fXz/Y8s6xUuL7YfVL01h49GKW08EdYEJkrOhc3RO3cxMYTLlGw3Z6hktW62kDwpB3rQsVpgOn/n43tf/tv96OU6sViEQl2A+bh3c0IC9NRQLAxPN4o7kopVIBoY1WNQ0xpT+Yk8mdBhjof8ZsJ4+Dvtpn0vI2zFPdfGM2oDza3bHzEQrTQfueQ4S92lKCpWsr+D1kvXN/nou3KFIa4wDNczajuJIqCEaL072/kZdPYMLfnowb5Eq4F04w/h9+EixXWafo26F4oVadj5KhdC+gMHTz+UaN0moLEDIAtZV6JQKpXRMahXGL5GIfoISylCTbax1090htrxtaj2VAbmdtpFKmWHMU38hJVm1wAq7gVz+/W6wetdkxT0VuDkqZvd2d1dMHuL0ZRgCtNPqRnlWBPfGTVby9BvRS8rSaw6OoNv6xiT3VjIduLlhH9Ags+wbumNn5qijWOGjQ0uFcaA2rE2JdyXgi6gvoBRB3y19nySl+jBB5yxBhAvtjT9wBVv0h2ihB73uvHx36sl+HD5IUj3YATPdv1NGxKFrz6KntEFjyQVXzp1iBZmNuZKbMQCdfjEnyf+t85cM9TnuTgge9l0sKX063otdum7kmLDbn2H6zPFx46XkShTw2vaFkZWnQ843VPtEt65qMZrbQpgrH1T2Zc7+LxTO+pvvCfRkfWOD3zA7EXH6HeHzN0er7OmkA2U/5ENY/odwObTxfYWyv0+Ii+MhrGZJp0+xR5TJgviLwQwbAe9oHVYexOLKcKbSjZbTyHcptgpQvZ5JN3oyOybLq+mGr08IRdJbIXejjQetD4VaJpf97/0wooxdgH5OZZcA+6TfqCJ2wiCD+AyGvIEVTmedAh6AxPH00m3M7scqlqjjE9uzYS8azlprifTupo25ml2nNsFuUjhLAuC0/2Gd9V7yxCodDZgflxjLdSBjXCc2/dS6ESSffywK1TC6coQhXpHuKN2XfWvCNrzmpAuhzxO8iWz6nhgCjoQ+Ynqxf23g3UY/lRedBRo2i80ZVdwAbQReIs0O3CzWFEAlsKFiH4tp60aUZbetr14/0gtMPFLkIfBX2MShZT9g6YldNM/q0y6LhzkvdJVni94KE5+tJBri+Nv99oBRleanfa/MiXt60mPhA1rghmsJhcVDGkd6PNA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 740889cd-4b4c-452b-e7c8-08db41f27168 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2023 22:56:14.5078 (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: fEhX7h+3Rybu3H4Yzy5bRC6SFLUxCzfPRBnuGz8RuVfC7gw8T0glfSR7II7TkrjpVQFiO/F5bmU59Kz/mlOaEg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB9213 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763738406872516945?= X-GMAIL-MSGID: =?utf-8?q?1763738406872516945?= 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: Eric Dumazet Reviewed-by: Simon Horman Reviewed-by: Florian Fainelli Acked-by: Madalin Bucur --- Cc: Madalin Bucur 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 Thu Apr 20 22:55:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 86076 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp669444vqo; Thu, 20 Apr 2023 15:57:52 -0700 (PDT) X-Google-Smtp-Source: AKy350bV5mxIP6TSVsluawdqF/g4r/h0eHbWRX1FBuPeqChPPzhYF9KayC26rYk3sis8K5Aat+eT X-Received: by 2002:a05:6a00:1749:b0:63b:64f7:45a0 with SMTP id j9-20020a056a00174900b0063b64f745a0mr3658363pfc.12.1682031471774; Thu, 20 Apr 2023 15:57:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1682031471; cv=pass; d=google.com; s=arc-20160816; b=OtZWn/a4fv7KJEWal8wrH0+gQ7hEa+4GZsdnOdl3DnFVgWaipqljulKUUoZgJJSoog TqGF+DljGUoYbymG0WbcnEG3AV9D5if/mf+gaoJYeZ3M7Lq4svnCZH0ZV9dpFOT5/0VU GMTQg08YLFhC64khdNaFmNSr6rtTcmELjfr7HXnCrOB8A3unRi7mohccTGjkUC8EuuBG zLBJj26/JWrU7vfPT6XMfBTkYz34/ZojwK8MlRtDvUJoWW2AwwtMMrq5ywZVF8R/FILb MqEVj0I62H6HEkzaDJnqhy9teEbqi/pn3fG+fOgCXqfl3gHlaaiVOTyyCSRFiJHE26aA 2xVw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mTQeTJCWZwm7sfAUThcnyzZsB0nTfOHGcdL/9FT2qZA=; b=qgSz01TEIm8waNhR+kvtzr3xGW5dyhQOAT3nro9wluQFJSGyYPb1CBslmORK7+yXqB eOi6QBiYYdda0aKAhs82ApyFb7v5QfyW2n7w6XcqtZpEXjQAkjeYAYO9rAVm9UYwN6EL KHHnH0xBbO/CO33PjvyODmtoZqt5tWS/WdoMYy9EXqdJUnhBs2ES7TeBqFyhMwmaQgAi j9rs7SuM+SWuviOGVPQLdH+ilPLz8SOEa+Fi1oCBvFfFABZ3oLB0R/fFuBYo786Vo+xW sPyuPAwxiJHmkouNpGDu4ZIm4qk1dNYrc0hyZiCnNo7p1sqBJXYVTfnsDP9MMW66k2wm xv8g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=DG3idIab; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l73-20020a63914c000000b0050bfa82c23bsi2682259pge.230.2023.04.20.15.57.39; Thu, 20 Apr 2023 15:57:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=DG3idIab; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233172AbjDTW4f (ORCPT + 99 others); Thu, 20 Apr 2023 18:56:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232762AbjDTW4V (ORCPT ); Thu, 20 Apr 2023 18:56:21 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2063.outbound.protection.outlook.com [40.107.21.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4446440F0; Thu, 20 Apr 2023 15:56:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V7ySHTpz8gE3s7DkcG+zNlx+6KlXEkXhX3IQZ+Vz1ncciKB7R/A5p7aM6Zj3ZQmepMnQgVKq8G53fTlABCBXasAcQ59lHBHOwMOyzInrmPp/Xx4bnPMf1Hu+y1oI+Fa2lNkmD78/kcxi/MpqTCqQqYDEtqRSPmss8M/kO8wSaEp0IQ1dSssuL2YdUHgZ4QjAybMPl/ApCQyf6qfS8qIocLvotQ0DkrNJUTaZPRzHLA9IgXTmu1rkaL8gR8IpqgwSMvGJK10vIs1WDXCwTyUrKqNotW82L7rHo3pELrwjp80nxQ94QREwWsYwyOlw8vWLGzJ7biA17QUDBp5y1JXl7Q== 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=mTQeTJCWZwm7sfAUThcnyzZsB0nTfOHGcdL/9FT2qZA=; b=Nk+Fq+4e9MdOjIzHMlw2DekGy8SDnOecv0XN+PY7P52+Ku0wmMxx1iAy3YgR/ZpjthKlKZwI1I0KSir16mll54csUX9+BPl5ZeCL1OI8eg1/ILYmvq7YCD9gd6rs0LUv1w4PH0t+1aBf2n07V2Pj/ZVpJYDmvhKOVPWm4UdS+boW/5xzQou5jxknowg4WXRxS0FbKJZ3d7hgPYG1LkwlVJl2aGdxAkJwAG8JGH3+qM+n0aoqgnqeMUnsjpdwbkbmg4DrIVmr4C/uaZFFZltfoFbXzxQ28fIFMY9wnkCFVkG4LwxDN2EjyLo32lbtw+e9iiPyTgrn6tUEhdmOEwL21g== 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=mTQeTJCWZwm7sfAUThcnyzZsB0nTfOHGcdL/9FT2qZA=; b=DG3idIabPdNXlRJ7hCl0c02LXbnodlY4xJLSMC2XT5fxqu2JWFsX4PPXqA7Z/BwJeAjsHp9Q7FdqTqlseeSv3ID+HsYI3okQXlJkcjyRLxS62s60aWLV/4N6q6+vI3TuZXaCprqXAkkFjhqU/uxJbe4wqOCxlgY3oPZVTtXPHAA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by GV1PR04MB9213.eurprd04.prod.outlook.com (2603:10a6:150:28::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Thu, 20 Apr 2023 22:56:15 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::245a:9272:b30a:a21c]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::245a:9272:b30a:a21c%3]) with mapi id 15.20.6319.022; Thu, 20 Apr 2023 22:56:15 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , linux-kernel@vger.kernel.org, Simon Horman Subject: [PATCH v2 net-next 4/9] net: dsa: tag_ocelot: do not rely on skb_mac_header() for VLAN xmit Date: Fri, 21 Apr 2023 01:55:56 +0300 Message-Id: <20230420225601.2358327-5-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230420225601.2358327-1-vladimir.oltean@nxp.com> References: <20230420225601.2358327-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR03CA0088.eurprd03.prod.outlook.com (2603:10a6:208:69::29) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|GV1PR04MB9213:EE_ X-MS-Office365-Filtering-Correlation-Id: 3c4d2a47-582d-42f7-92af-08db41f271d6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8C0tjBIXb8Mq4C6GFFV336dpjQhj+2WXd1LHZ5HSou27TUrpt7/jvXLrjUj6nzJHNTEhblU3MI4xKH3B/f76PEPu+Rad8X9H6gdNsZ7+QWfCmeDxV/z4DD6e+8RcwnslrXoeFZMLVzvmN6rJFzn1wnUvDWMkDKL+aIapoyRD+s3yY97YAj0hGms/+s/XfOteNaRAnNpjyq7RdObZy1SLgr35CdD+WEWUEwM+vwgApjnWKqCsCtJFCPM9Fi4w0BtpPkn1inRMNOzaJY23ICum1et9D5bROBa05F5ZVR8HVYSZBi0eomGbhjcFzdBG263NZ/UcJNC8I//pvrmjKf4YYlvjTbefUXuQtBrBvsu6NNLd5xiSTLgndLwnX/umYrTfvA0BRDJUOsrtFTZk/80c6Zl0jDJExYfgmq2bWAcPrNqGwu0vN2tKsvg9I2vAQxcX6q/j9cabl7gl+urrokK5VEYzeYxfnkdeZGaJdL6bOF6TIsuOMGgHJ4kHl7FLhQzU2i0bj4A+w0MNKLb1ieMqhvk/lgm+kKTLtRuIDIurhbki9YQ3fsEIyrmqd6rH+v+vTDnBEeu2cfMKzBJ8Sj6xoqwMTyP33jSH7yy7ia/2z/8ZHuR5/HNm/AFJvQ6JVmjN X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(376002)(346002)(396003)(366004)(136003)(39860400002)(451199021)(2906002)(38350700002)(38100700002)(86362001)(478600001)(54906003)(316002)(41300700001)(66476007)(66946007)(66556008)(6916009)(4326008)(26005)(1076003)(6506007)(6512007)(6666004)(6486002)(52116002)(186003)(36756003)(8936002)(8676002)(83380400001)(5660300002)(2616005)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MCOgUaLr8EGGY6dxmZhdq8WN7O8t3n9ZWafJm0iqgISDiODWfZRlb+2pRCajDk3dYJFDJhTSf11gXr7d+PmLI180LRCOrRatzyoHs3lGJwITLdWOHbpkkN7B6uJN6J80SgZZ05saB/kn/uNkzsj16P3trb6duJhXetlerj4fjBXVtiQ7QWuYaI4pti9YnU1gSYv5I2pa7KMS/6t4ikmngit//S2iCPnUtvzDXqdVZkfPIMXRKp68Ml1oqjX0sLoYOqVwX0TsSTEvnMtvNDnzWnPu+RopwOb3yV1RzjTToghrDnLsV9JVDsfgFtj2C2bIjN9k3Q+y9c1tG2W44XmNZ1Yk3HJ/Ik2ns5T34XKOV9R46Y6fXSUsNqPX58Z/TmYTy6VLHwIPWEeY6xCaCqttXd/ZeCqArBBoUWfsWQc8wIY70gT1pdzFkOWA7Bm9yV62DgetcRs/MzaaFnUt4nOiT5k8HAohbkVmHpP4l4i6S6thrCsQlhNpEjAOGRghxGK3FPZn2NTaxSrY4yXB9YdSOFYJ37Nn64q7iu76OthkMyMfBqmFgFormgx/QIlMJc8upvzuKUUmVZKCrUTOX9ZJJuxgjxVSSodG/OKcwaKIjz+zKfA3C2n4TWtwLYR7vAdr9ZXG4zn9JUb+EYMtQ2VfwoklbR54EOIwkd/3paZjVsJ6qt16vSHlN10j3Zqqx3GZl+A26NulvYm3Mm28pRp8byix+Jc0v7tBz0w9+WTH58W6cil+kl8YrGogcevGe++Ib1Kj4wOXwDtEq0jSP51P7HC4wh8qwcveRJ0W9+UkzZQvESjdehToHF0LFXPpxwnceRe0uQ92Bico9S+VwjgiAbfjCQrBVAYtmaHDASkOd+c3eLgafcrK/qFbEMASQnTJXTuji41tOluclzFpipyhS5m3DDhwhrZdph4CcTgf2aHolZf0guAt7iG133odehskEMrz/F14RjTl64hkE5Oy8LLi0HEPOuBGJobgqUyCw8Oo6LivvUsaHw5K6DfHsRlo+6FiY5enBRlVqJitmg4oFiQEyzU9xFaohZWncxmrQKaWlJen05Kl8RNwgYVQHJDVnAqtUlfrsdj/B8xAq9QFfEiggUA6UIyPc/bfr/aey/PP8wu8tmzXtndYcqZdi3lfiXB3GChAHFzLil+VB6ocZ4h3DUAs7Um6iemXBfCNLSyhShGGtSxf8e5CjMBG2ZCThE3ryy2Xg2VxgsIgXWj3oHU9+O/AAY4ipu+yg1ne7hz9KwNEEoVdsllZc1iErcpwQHSL1tEVFh4R4OGfkotGIDT6ToOsIJy7JrxxYwTbis1EJhMprCCA5tRihSb0swpccLi0hk/aBDtBHj4KggYWMrHmAdNZmkZamdgdOqd+alH1+jxacjk1EVhUCxzz9blitappwDatyebP8z/O8mTh629DVKikFw8G8UXe2/k0Q2tDa0d7h37gScWt++l9Bx/x6FdYo6ArC+hZ2cMdIf6o5UQmIjedxBSlqw11u5EWqA807poVupbobHeZSjz6SGeTiBngkdhc1rj32wi/Qja5H9z2I9HhnJqw7g3vFCA8Z5t0IUriOWt0yqgVXCSH2s2SRhKHm20x0o+dtH+Ldplplw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3c4d2a47-582d-42f7-92af-08db41f271d6 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2023 22:56:15.2209 (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: ubkHe86JsH+M8q4cJm2uNutpi5O1zbaSDRpLLrZZz9he2JZOWaa0UyvkNoNIsV38IeMN7LaVETGPBaIyoZiCPA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB9213 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763737832834067294?= X-GMAIL-MSGID: =?utf-8?q?1763737832834067294?= 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: Eric Dumazet 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 Thu Apr 20 22:55:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 86077 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp669667vqo; Thu, 20 Apr 2023 15:58:30 -0700 (PDT) X-Google-Smtp-Source: AKy350by+TUwFuen9kO9agzWZoM/1q4wjf1RT7gMULK/ArBbkuFJiZKZabpIeTQ/lUMVR/INa9mL X-Received: by 2002:a05:6a00:c88:b0:638:7e00:3737 with SMTP id a8-20020a056a000c8800b006387e003737mr4027752pfv.23.1682031510331; Thu, 20 Apr 2023 15:58:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1682031510; cv=pass; d=google.com; s=arc-20160816; b=Rpq0J6zHNZqMfsUWcmhSS9lPoyFtRBfSRwblGIquwDAu+YGXUW5E2empMrxjIqsMrQ pRBnrJkMnTfoNsEO98Dj7s/gi81WAyOXuTTjytM41mjmsSnvsqkN//K4YPjkHVSz7SQp OeceIQ4k3Kqzm4QHWxaL1BCA6SCLAq/dDh7zQ+oI3Pq/ISmESiCFKK++I6JajzxEiheL 24g8ubQfKPN1D5iJcahmz9LYCklneU8Gb1kS16G4qLppp+U+aruSkHs6VbmNQ2wmpGX/ iNoqBkJbIgLBsLa5w3LOkmFlrm/DVrmiPuMuxRiPTLr/VB+FLxv+MdMCrkSyhivgV3y5 EsFg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4VRDp1sATinR1AEbcXAXCgTevcVxBGIbhFvYTt7Teq4=; b=OFmGDNej48bbiGRB2muYCVo/+4VBETPwVqm8lKkNg3UUSbf8iqMrB2eWC720I8/xrw yHOD4jYKY9Tr0037Jn4IdvyE8Jd95Y+oc1LM7owuRnkcQT+gB9FtIHxkTTEUdXq3TwM6 2Y9A/c0iW1mo/QIC04X3zWQi2ahvbP/2RmQIt/Avw3zqflnH5Y3CHAfmU5C1yukgStGP os5Qka0+c60ZDF78EvEPpYu9eDhqxyC3uCcrXs72yYzgyOg7VvJWbWYz73ksWtkOksHU weSjDgakBtRWe48NWUXXBbUhas0pSumjHBzBOW5dKOXgbSGBtex2la1ow+1plQop0PGE bgWQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=JaQJ0hia; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d9-20020a631d09000000b0051b7d4ff03csi2862864pgd.874.2023.04.20.15.58.18; Thu, 20 Apr 2023 15:58:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=JaQJ0hia; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233299AbjDTW4i (ORCPT + 99 others); Thu, 20 Apr 2023 18:56:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233149AbjDTW4W (ORCPT ); Thu, 20 Apr 2023 18:56:22 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2063.outbound.protection.outlook.com [40.107.21.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84C365B9E; Thu, 20 Apr 2023 15:56:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LOukXD9Rq4D0smXqitOpZ3WIOLEbT3imCAR2EPC9/f+qK1SbliICWOcVe7d3YuPtp4AzRMSzEsHhiQdIZgXNhXyNM9HKevvTpvQCVNeCVw/SWnoO/gHtiqHWg2NyZBsztLncLjGTtCegHoPvZcAE3ScEjlCxoDFu7q0Yf5nd6/p0qa9eJHr6S5c/m2JY7ovngquRcq3DViZucAS+ee3M2vF3CUaPaqWqn1H7Hj8iz/kZWVWw0LM++HXBdUTQ7zZJ5a265sxfu/lYCmlbxgWK8KZTEfK5R6Slll5P1GwPXl3hfWE5ywe1BWMUfMJtT0sKylrOJzSzaQuhkl2wnlSkFw== 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=4VRDp1sATinR1AEbcXAXCgTevcVxBGIbhFvYTt7Teq4=; b=VgGMFN1YDV7YbwrQylZ8p/bfsjpaxvuBwOzU9meJ8edr4anDGLduQr0dh7lnB6qKmuBYfSqsbPlV4Absd7rGJeRX0TyLFr5c6634D0EBIsU+/7SZXKuoqBwqxuZrKqS3+WAv5Hdgu5BYcqKQwaAeroBS98/IPuW3pANmIvvYbvQj+Ig0UaowSbXL+xwPBFu7JnyELKscnAUfT7fxOZWlM+lmo0Lh9HtkljbqVQuvcyimBmpRpnqYit4akCMiS+8V9H9CxtpXqEB38HWeupiPH5+vS+0AtBxM66n1NFn594k3pm8F3WNbMsxy0jQvMmiLh0jUwCzWMCP6oU4sX3hCUg== 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=4VRDp1sATinR1AEbcXAXCgTevcVxBGIbhFvYTt7Teq4=; b=JaQJ0hiaZQG4xz8ZAc9vOBOMKiPgwZfnGbiOhUhAJD7yVir4w+o4+/fHUuwL6ISfUYZDuropqeKuGHx7L/njlWx2Idb+QJcj2H/4lxGriianjAaYW8CxDu2Q1HP6b/cZ/dN0mtoq/w1dNCgN5UEkg3gxn7zXLdTJFAswJnWGIVw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by GV1PR04MB9213.eurprd04.prod.outlook.com (2603:10a6:150:28::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Thu, 20 Apr 2023 22:56:16 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::245a:9272:b30a:a21c]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::245a:9272:b30a:a21c%3]) with mapi id 15.20.6319.022; Thu, 20 Apr 2023 22:56:16 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , linux-kernel@vger.kernel.org, Simon Horman Subject: [PATCH v2 net-next 5/9] net: dsa: tag_ksz: do not rely on skb_mac_header() in TX paths Date: Fri, 21 Apr 2023 01:55:57 +0300 Message-Id: <20230420225601.2358327-6-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230420225601.2358327-1-vladimir.oltean@nxp.com> References: <20230420225601.2358327-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR03CA0088.eurprd03.prod.outlook.com (2603:10a6:208:69::29) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|GV1PR04MB9213:EE_ X-MS-Office365-Filtering-Correlation-Id: 96dde338-b4f8-4fd5-3d78-08db41f27244 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nZTOdUCalSqlbB4iWQBxKDdywmjFWiq92RscyvyWoV9zh4oRS8323x+EvYRSWxTpKIiuTdiAl5RpnCMR6/1IOwY+Fa+ClNvivjovd/F/DvszmdSKGPOCwwgshFqQtFCYYt2N93VwQQY+3QRlhjyBk+qTwVVZnt2ieE3W19ACZz86XPZxiBJ4bL76ScmwUjs0vTcDnAwMT1EgjeYxAvu5V3FbLD3FOiXS/1bReRgmFZEDlDFvD3lerWX2zUHkXBd8ZhJIcK9MJr9k7z4gl6gQC+qMiFvebfq9R7QJCsl9YFz5MtxeSSAcNjKIYZO7Y+yWd0+kzdujXkElhoWayBF+X2G05HJVMhREM6HVEhy61iPvStP2M99nwKhpfDnbnP6cp0e91tmS0IL9gD43HwuYzW5vunErfAWeO6cz5S6SJaaVVdl7V0Ussge/kyXjaXnpMcOa4vOYD9TYioVpgM/9scM/NOxMYHaJ7NnXYz2ILvOfC8zQ+n/h4KjJg6TWZGi2kJkNcJKg2sVfgpfjGBEiam3IuBPAhDqBcIkbhwMWlajdAD0x3jLD5hKu+u2K2i6JktmQ+MjiVOaRFRTcenU8Ik+dRGt8iVuQSVwlMwXsM7AduX7ODjfJGen3WR6w4Q3F X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(376002)(346002)(396003)(366004)(136003)(39860400002)(451199021)(2906002)(38350700002)(38100700002)(86362001)(478600001)(54906003)(316002)(41300700001)(66476007)(66946007)(66556008)(6916009)(4326008)(26005)(1076003)(6506007)(6512007)(6666004)(6486002)(52116002)(186003)(36756003)(8936002)(8676002)(83380400001)(5660300002)(2616005)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: H1rJMhvxAZm9EEfs0UPy2PhbsHzT0iAr3+lwWO2F109m3mnvP+fi4hTzATwUdaa6eZmTGgFZhJsZF2dHJTMah2mWDUeOKm+HxIhL91hvfYd7LpiG0ruXkjgP0SdY0SlGfJ0j2DpRmtDeoHU6DPrk8iet6j2zlFhqij4UMKl4VMf+hbZHtgq3eSwEUTuI3uTv2dt2cV3qth9I6Lsv9g7s8P4aDqgys561rChJQEMEBXL0ydhJjiAWWhC69GE/JMkAllN0OSa+mymwMLCxA4PU4xIsiYcFjWwPwaFO4qcACPOHRfBmuYIfYKNuvm1zqlYoo4NRl3181WKHTX3gmxW0gMRQpy4EMK6NWYg8xSWXDSxvOG9Qn6nhWvF/pmYugKpdXR+UKxmcrsO7WHteyEXbeuwDDwF2EUIB9dy+m/7VfbY5c6YWNbgAhR5kAeV/of8YwIktxbIMfKvJawRfVQjmxHLgDXD64E0fZar3BCwo2a/D9xqSZcuGtLrOld2IPit/6sIMFu1r7y3zWb3HqWqHMrwj4ZF0gfOW57GU/NadYhG0Th95tUFeCx0YHh90E4I5ARLFVAdM7xGDvc9NqwKUDTrJmT7N/lZJwKk9iVoj6s4BJ/Jl1mMPwlgorgH+3gJOnl9WGPI2TDSWdfG97Y84xp96ZbolvS1aXEYJlyy/ETKPexFdGPYU+jD6esG4vuSe8XIq2I7lHormNq3z+yYxYkw/2rRV1IfriHfcNUhh6xT0sqY2hAv9V3ZqIUrEK6rWkLhFh1n2SmGLkxskXMziItOhSHvmNZzrx8qqcfBi5LTwM/1Ud0Pkz9QXubB/d5iYGZbqkBIDs88yr7YwpB6oCgjhf5i0O2zlkZ967ipRLF6QhzU8NSyWLGdQCeZHMFpGJTIWLsAIXFh4G5Fh5zlDKwix754yICd/f6uxUBZ76IIT4IwK2OtLtGnlCfSl/kmpdM2g5zbdp+qTP8ZJ67Lezzhu/RnTtMUPunmalc/5oxwcq/2zyoFMd7feaNOdSuwJh/nkF5b48w2S25pedUoJyGLwjn8sGNeXKnRn1+Qzij3xleWL3NgxBqv4rgfFAwDFF9y05OEqZrflncfG/7/V8n5RLkn/gNXWyXCuP2knhmVhms7k8n4Za5qagc70N9FPvaJwxLo7m3BqpJL9ibvlAtrFZ4gPy7L+OpZxK2M6W1Ya0cTL/q1NuDGDcQrLNZ2FLFzob74H1WWmNg2BRRhNkIROB87QNr9siBFFdsPn6cQIVAHeEkmvqCIrnll2z/aAQGlKmvWZHM1q2ZhPg6YsBvqIximeWaLAbeXrCbrX15uNbutxeqfG1N/D4TGVGgA7Z6KVfs9ub/onezIa7hldlhZ4HQBBkr394b/03FZE+l/kvnJTtBACUOEyVLqATA7IV1xEYkPkEQ95a7vBJuZek8nRPxpEn+PvGo4Z9fC5ftD/xzjROqvUlNniUtc8F46/38gkNzmJIg3jByRjJSqRT/PopH5HtqiiPDCp2bR5585IWHc2hrztiEhGTVtAvn73auoIGK2GejEXPTkIyhFGoq5osBlypSCDUGKC9+1PYwVmwirFYT4/rCXzRXi18t7lLh8XTwPdpdLmNP6vlpczUw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 96dde338-b4f8-4fd5-3d78-08db41f27244 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2023 22:56:15.9452 (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: MlHW8kGpgNiU7dVGE7xP7hZeRM3Ae32xHOqXvljW/+MTrOwVyrSJx/teHxJxPJtUz/XpUlbaKfsXRU7LqnzBMg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB9213 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763737872968910694?= X-GMAIL-MSGID: =?utf-8?q?1763737872968910694?= 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: Eric Dumazet 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 Thu Apr 20 22:55:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 86078 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp674058vqo; Thu, 20 Apr 2023 16:05:21 -0700 (PDT) X-Google-Smtp-Source: AKy350bWNdEpV3HKKkewmBsAwwLTPgP+84P7KBq0/SMkgYJPYYWv9430+t6CXaHgAO6Me38pyxGj X-Received: by 2002:a05:6a20:3942:b0:e3:763e:555 with SMTP id r2-20020a056a20394200b000e3763e0555mr4316363pzg.57.1682031921002; Thu, 20 Apr 2023 16:05:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1682031920; cv=pass; d=google.com; s=arc-20160816; b=GFeI0fTS3BmJdS69mRnAjYc+9VZNZ3UrFCygs6TfwWLsOCnKiBRIVngzwHSUpm+8gc 3jLq17cPpnsMWV4vaALST1bxWhK+JnpKuyHuNdmyKQk8HulmMpoAYfyTUDMO5yUmP/LX 0qJgHOuhIOxgbCkqVBXabkEo2qZg6XTtlYSMZpQ7FZtWKlTa9U5J47cByXpJZXGjOg+A F3yh0liV3m31Ls//S0YMOh98O2/XmOj4Att6xqZrt2PldOxOeEBWbYUHdD1IjBAxZ1H+ sIHbdEFRaKRnPUsU3mVwTCMAMYte1hsmvbcQDeeaO70ZpZ+b/smG9Tzm1zksYUUj0e6p EFTw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=c0t9cQiyv9+2haPB/Rp5vs/Y5Bt5Q7jRQTlXdtGEWms=; b=pK410YIoW/b/avTuZ3BliFqsr7YHHc+HJy+gIlChExP3VcGBK+3FfXbSd9F4UGsTAA TbwBetB7tN6GJNbvB5WE0P9OKOirMaKQDJ+IxnIL6D+jdDkUD76ycUS8UFFhbtlHkAvd jkqH4sO3L56cy21jm5Pfp+jaKVf87YxMhpdr7KJ+iME39BIHwbMSFC46c/hqMoFwR9Rc VRch+B0TqaIFofNrvqFpqC5UluhjVNrT5x+/qJ4wBidYSOsEtFmX57ivGH1+5thxA5Gz 9AIRSnU0X8HNE+wRrPzn03t6WbhshN3vAsyEWEAm3n0+C+KNyLIaoS2JLHWndKSXn0Hn e/Ug== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=U4orHWsD; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q5-20020a632a05000000b0050af2178284si2979068pgq.819.2023.04.20.16.05.06; Thu, 20 Apr 2023 16:05:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=U4orHWsD; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233227AbjDTW4p (ORCPT + 99 others); Thu, 20 Apr 2023 18:56:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233163AbjDTW4X (ORCPT ); Thu, 20 Apr 2023 18:56:23 -0400 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2070.outbound.protection.outlook.com [40.107.14.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45A046196; Thu, 20 Apr 2023 15:56:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A45W4X6H05vlFst4oWKrYZUTguwqd/Wq62k4R9+Y1ZLFprTD+7+jpvM+a2xpGjzJHO6pudDigFdfKS0urhkV+2nZQ6WJdasifF94d4ulFhJX8xDTQAJLe9LmwlMwNh195dKG7Pd/SyPfuCzsPDrSL4Tz7iv9dpjxUszx3NaFDYMEe4PjNO1CidzkaepRkgXUBxwYbHNmVQWh8zw6Vk/k91OWqyC1uP9HCfGHqW/uJkUYllsjVm5e+E0NKAUR7EYq9l3kX2Tw58Ww1NRm+SMv0OToa5YCVsZO7I3STxCFBGiP/V7T9CaG7TwUICjereaS5thfL8pTyHjs6cd8tZ0tLQ== 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=c0t9cQiyv9+2haPB/Rp5vs/Y5Bt5Q7jRQTlXdtGEWms=; b=h8Urt9erexpEyeFXRLfbI2dFGDAXa0KxsLW/dLLYFz26wRrwAsRV97IdieGLJCLbAVYF4bxn/9x88QgedZLXLgtX9JzeCTrKYbPoWQS0/QJi9/elw8qnT4XkJ6nf2CHsKpr5M9cnJvqbD/+TNo++Ae0PNo7ZOLyg3fSRgqM0eZqXgph0saxurt93+TuJMSwlA0xvOvkVb0NwJJmZlFfMIPnG3MaocZNbLkFR3qT0XkIuyt62gXXzedAXC8wW8Meg6bDpJja6M8mD6MvhgCc2whGBZ/N9tLjVMrcj9U3sJQCv2OrEv0Rhba+WSICDvpeWcJyqzxFMwSvDOv8rQpgfxg== 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=c0t9cQiyv9+2haPB/Rp5vs/Y5Bt5Q7jRQTlXdtGEWms=; b=U4orHWsDJHen7pcmx+A+SGKCW0gnJ1E959Sh/H05nMa4efxejpn9ms7pYVU7H2lQNY3vTtW2v0H3045VnJHkDxq5Eub5OYtqF+lL+SbWLtKuvwKblbFksOQUMXY14CvG/AC2y3pym9NqRAI+hOgoNTeGpu7dJZqhqZ/bkpi6uE4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by GV1PR04MB9213.eurprd04.prod.outlook.com (2603:10a6:150:28::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Thu, 20 Apr 2023 22:56:16 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::245a:9272:b30a:a21c]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::245a:9272:b30a:a21c%3]) with mapi id 15.20.6319.022; Thu, 20 Apr 2023 22:56:16 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , linux-kernel@vger.kernel.org, Simon Horman Subject: [PATCH v2 net-next 6/9] net: dsa: tag_sja1105: don't rely on skb_mac_header() in TX paths Date: Fri, 21 Apr 2023 01:55:58 +0300 Message-Id: <20230420225601.2358327-7-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230420225601.2358327-1-vladimir.oltean@nxp.com> References: <20230420225601.2358327-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR03CA0088.eurprd03.prod.outlook.com (2603:10a6:208:69::29) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|GV1PR04MB9213:EE_ X-MS-Office365-Filtering-Correlation-Id: ef59bcb2-7054-40f1-4a96-08db41f272b4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BtYZigeyuZHT5KDr5PRB7gCl7+e/iLpovsaGl3LeMzVcVrxwmEco0yBd2HhVPP+QW4oe+99fLuSE592Sju/Fq1lEJ/P+D9iwR4AcfXIHLlAMXTlVzQaaRxk+7l+hcgk/ZMolUr7ED1b5xH+QAfXP1UOZbLB2jAB73VInktiR9D0vjwNdhqdIYS3bfAgI7ycu6UP9M2e/z9/1NeZ360XftPXBSOTx0WEt1CRD1QFJfj2lmvEGX+rcjYnmwLTtfRCPqN3f9Lk1Y9i1N2koSrvLv735eu0sTmiep3dxtdRG3PNbF6YyrVmV3sjor3j+97BdVwIaswgxnbuZK+Vv6prEABUmpJxAPmPrVb5/MBwM1nrhrMyXrgvtHIstnnEE8zFl6QlliuT2ytdzo6m9UVasiSqsNriOJez75XcIY6oftxP8+3CFNZCrADTdh9zCEl027QPCWCBXzRWyqg2XMKM3P2l4Lgf1quT/h6KvQYp3ddCtOrrNk9f1dLTBsc9tL8dAhgxUDQUWYe2ehwR231aeoawoMNqmS0QdCXrRehzy3rkEMIRESYYLj25gk85PbSxSfgpI7v0f8Zu9w5x5IaBFgMJtQZoGqKQSMf9Q3yyNDUxMeENkvngfyujzqopAkMvr X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(376002)(346002)(396003)(366004)(136003)(39860400002)(451199021)(2906002)(38350700002)(38100700002)(86362001)(478600001)(54906003)(316002)(41300700001)(66476007)(66946007)(66556008)(6916009)(4326008)(26005)(1076003)(6506007)(6512007)(6666004)(6486002)(52116002)(186003)(36756003)(8936002)(8676002)(83380400001)(5660300002)(2616005)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZTEYxNjFY12egojz2UCm9Jx/r02oa4gy812gN4PHwqkvVsu4I4WQcuU4kY0IIpJgCazThml2bYgqHBwL+7zX1zvu6zHa2I3f3EFDMC6XdeMryaXSh1FRJQi2H2lQLMAdgAv6SviIapkNGzbs4FjqcJ3LiHcuS6C+iskCedWiaX0Q1X/3irxqBRUN9OKKqugdvKFA6x6OcEaFoZ7WjZuBudKm9eNqURGeiFu6EhenyG7NJMqp5C+p7ymw70TuSljGkis172zBJbiR0cpg6ARkCwBm4XGefw8BZ/gtBpRchCuGV9W/2dkYDlJiX3OL/n/+MjkT1qtvCabhV5euuDqdM5WFPVkkUqgnX4hp9+qV+nm2y3e9+CilLVHiKfz/ulvDxqnVnysQvsB82P+aff7ygSKyiDrzkh9C6SXnOIe/JHIniQpZNlgoxlhDphZ80RqCXKuc7XneuTnJWL2CKVQ+TlVIUHtdcHqi3rvzDV0TiTYwAqJ/zUVzKQbCx9l4zWoQMMCTn9DWYgwsz/5N5OtWJ3t88Thyxkjl/L/xSIoA2PQgjcVuaTaqEYz3v59AHhHDxPA4+Eo2TK772WaJHyFgqnREXofWDJkeUNPIQNpewYHKlugTjniwQZMGi3zgU4He1qIPMCXGHeJvK3FyONMTJgtaFnqOCZlFJGbHsyS58FS4XtVuILjpPR7mt1PS/zUXJVzideeW9zD1rBcfIZuImqx7kBVzsr9Z0JXVIcrcNd3NOC533gGrJdDuG1jkGZAUoQt7YLe2ErL5KWfkLi00kmBqm/hDUsKDnEINBUfJst8wjtb2YhZnEmWvRTK0iQgerobg+RrAP1brcorvPpuW8h2e1oxRKEu2bXJS82NCg7ESFIbeNW0gtYwLPioximmkTgo0+VTm7bOjNEjsbHX81yuczPoEI/u8zt5oEO6d61/XBEzwD0DgEQITZBFcxchQSpZ1nJsPJx+jA4UZ8QtIO7zgHoG+cPFpn8judCQVdOSRhb9SXd4fULD/tK7shw6ac2x/FR+LPOHHAXsh45dqPmFj9uTA9qmjBsZ6AKJlGErDr7KqdxkptXIy0QKnpda9mdJEAbG8zCuCpLisTMgtME3L4TGvsH5eHhH+tsRW2J1mT++f52FUhViEH7m7HfexdI/1ozNQAArOPxAqqJ1HtdY4GWSSi1Dxi0i/Cur2AfnP6JDVWJovv+2xr0hlbMlDK2wVXp4yfozVYPMlSwdvdoDJ0NFfaCLmYY20inQHPuPAOX5d1doC/2X51oYCk7b0jIx76Y/Ku+7N1ICdDJYe8Umk3owOAKrQ+ftDXlBqLaXlW4PkrrrC6NDMV8RgY6LnmSzTuCpwliqGR3JYVwkpqvjgz4FfZvA+PjzT0h0CBQY9B/9hq4aV5EIpPdtKgWb1P+YZIG+vdPKRcu6bWifqhCGOsiRbe+Z/WGux7LaYC3A0X+vW2xbAeuIsq9LUdjSKSWd8baPZqzHBCMOM3cklk3rPugs5blCSPlLghopAbra9oxjai2zHkah1sTdGy136g4URYZDdViY5B2c08o0Kyk1O/rvaZE+NabDEW+5cbThbW6srSHjp+XJDbPWaYz2iRqZ6jojS8UjqXsIsTbYVtg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ef59bcb2-7054-40f1-4a96-08db41f272b4 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2023 22:56:16.6735 (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: R36w6X+fGlhtpxxktOB3Ap+z0p2ZBRVhRnRjC4kJqQIzOFrGUafgLq0pWMRvR1uq29d3cp2pJElwY7EAUvI7fg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB9213 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763738303471828253?= X-GMAIL-MSGID: =?utf-8?q?1763738303471828253?= 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: Eric Dumazet 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 Thu Apr 20 22:55:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 86079 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp674451vqo; Thu, 20 Apr 2023 16:06:00 -0700 (PDT) X-Google-Smtp-Source: AKy350aqwsm242A74qHJ3055oLOJkdqCcs8SRbByySBljaIhvVBULpGPy5HWZYey33z9oaJg6EfU X-Received: by 2002:a17:90b:1bc1:b0:247:14ac:4d3a with SMTP id oa1-20020a17090b1bc100b0024714ac4d3amr3355570pjb.20.1682031960023; Thu, 20 Apr 2023 16:06:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1682031960; cv=pass; d=google.com; s=arc-20160816; b=Z/3yk8zvDX3uRXPetWdmRXehSCbjAlq1ZYxiUQjKy1++XCaQelDORyTJHdnD8KjiA+ dYDV49ZlnBTD6wiefzHw7kt3CoIJi7qorePar4BrhBD2KnoJAnPYAVd3xD/j5scQC5nC NHgrbcUFAbtqRoGAKFFSw41VOBOrEUisRWVGjPHHUJBKHDA7aSNYCqqvTveZ2kk/lSsF JuS8b0P2HweHztHO4y6/qT7MzNpz49iOt0cT1go4eKu82Z4Y/+JLo9hq1qgkwwNMHR1T 5WTRH/8LJh2sAOki28eRTdRT7GPD+PCiEZ1Ed+GgDzvNfpnX15JeYSB7R+GMe8JyKMi5 3gZA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Ht3ZUyEsnFLqae0qeYKxYb5wG/dLKpYEg1K7SawcTQM=; b=VpupIJ7qcounfjBArkDAcu3nJGenm/PbxtvJlnSULdgrPH5B/eKQ5ez1G/+UiiiJn7 nfDTgi0VNv16K0qw9OXE0ZWgRfK8x9JiUwLbg72lIAjBC6HkcS0syIrjqvcTgaFjMYsB p6o+TxfIh73nkrg/cEpJF+5jJiyKyznPEvV9V6NN1qgkotkwvgsAIsTnjjSzozn/entR cepq/v04WN9zkai0Zo4oK/BiVHJaFXwQmtTGYOTxPXOo+A6Rxl0miLInfTxQknpSGkz3 ft3oyDRIxlarjqoqcW6I44hAO07Rdp1+kp8ykUn7Yj9R4+DxFKDXkBd2Wa6ZnrUJvPT0 dqeg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=TyWdVBmT; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x14-20020a17090abc8e00b002474101aa7esi3015153pjr.163.2023.04.20.16.05.47; Thu, 20 Apr 2023 16:05:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=TyWdVBmT; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233344AbjDTW4u (ORCPT + 99 others); Thu, 20 Apr 2023 18:56:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233181AbjDTW4Y (ORCPT ); Thu, 20 Apr 2023 18:56:24 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2063.outbound.protection.outlook.com [40.107.21.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CFB24210; Thu, 20 Apr 2023 15:56:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ACsisWJCnoDHxh5/JjCSc1sZt9BowMUY2rnX+j2PeNLM3AqK/oZDC9mE7/+daJzdKsN1d0EHI2R+DXFrGKnvi8npX2KkQklnX+UcvyukRT4DCJsyY0C7Tqt/CxXhFDo9BP+KKR+XxhGdSpPSp26Ir5N+nd1CVmBNFv6pIs+JNuWXObjRBJ/Fs3f0wIGXupbC+S21oyYyF7JO+hVdJPJTeV56VwsBVdrsPnct0vxeZ2459ztkVgXQfyYPvpRxCyqOdxUFPPUcL8U0owJqUrw6OA1AbXI27O12oOlt0Xt4Tsw+i0Mkf4nUGsSTw0yfT0TonfWvhEQzCOCFsQ4whUBKMg== 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=Ht3ZUyEsnFLqae0qeYKxYb5wG/dLKpYEg1K7SawcTQM=; b=Z+gA+hvjGASJiT6OHMJevrUqtLYAVYCGHFJCPKHQgAX6c/w+oN+9Z2mmpjqKFAHV08uvnIdc1+6GLBzClDgedUCyz5naUntLH80u7CHrUlKce0lUZp7DWpurQ1SXbuDzbOxsd4L1oJ97E9Qs09+bzjsjjYCHI1etGWe7Zia5UInpP70clEKN3KlwVcSLkk3LJ6WgivU3zeyuxwKbRV5F7AZ/N+2tnneHrjLzqPcLAp7OtJI2ahDWzov3jAX4iGy0iJW9dlKb3bQWA2wRzOgWe4CPXX9AvvqAO1QOp1O09G964TNwakdgflE25TYVWFDelik5Pr+oUbqd3QNE/8FX1Q== 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=Ht3ZUyEsnFLqae0qeYKxYb5wG/dLKpYEg1K7SawcTQM=; b=TyWdVBmT0w1jMtSm4Z0x1JgwKgZOgU+xDfRTHPS75ckkktSqeXlrxDWDeYjC9e8VJhkyr8zDSiqFlsa5Fqx5pcMnT1C1LmGNYfzMKz4Kp7uuwI6TiwGwrmowG6u+vrc0KHCwHkYPqUWtTJrEOL1cSCg2tQ6sa0cuXWIhzTmhwbM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by GV1PR04MB9213.eurprd04.prod.outlook.com (2603:10a6:150:28::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Thu, 20 Apr 2023 22:56:17 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::245a:9272:b30a:a21c]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::245a:9272:b30a:a21c%3]) with mapi id 15.20.6319.022; Thu, 20 Apr 2023 22:56:17 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , linux-kernel@vger.kernel.org, Simon Horman Subject: [PATCH v2 net-next 7/9] net: dsa: tag_sja1105: replace skb_mac_header() with vlan_eth_hdr() Date: Fri, 21 Apr 2023 01:55:59 +0300 Message-Id: <20230420225601.2358327-8-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230420225601.2358327-1-vladimir.oltean@nxp.com> References: <20230420225601.2358327-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR03CA0088.eurprd03.prod.outlook.com (2603:10a6:208:69::29) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|GV1PR04MB9213:EE_ X-MS-Office365-Filtering-Correlation-Id: 123f41be-90d4-4d09-57c0-08db41f27324 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qVafDPoKD5si6kd1o7lqlo0UhJwGhjwVW7bF44XBX6JDR117UE2uhpUEAe0Qq+RqcwirkoUrx9+zeiGnE9FAbIDuXd98ineJLALL/xVScFv/tNIpM14xLmcyH2rt40/0vmwSvhCH5smY2VAPDyX0uX9fq/Al6a6p/r4RH4Tl+oY6ECJakRqGZGcNBSWmb3aymLf4k0YJsRc9j/MUk/GXKpQ3h13Lhv9JRWuwFttifbt+Uret7IEVYo5Cnt35oePyebCbowgCKSJ5HbFT+teS2P/NEg/DBeFlNnBCVmKlu4520WGlsEOmiAPLCy0cjbFUMMcLHGLoGCXjsfiwSoTrWeGi8+XAGkwUVxesQdhn0bxu4z3GQF98SB1xKCqsSPuBLyEgWzhTQUx75jbPQVcs/8zJ+aJv2Of/VqqsatP9fIkb7+n69+pasp763cinAkb2su+o71JIvcbgweuOyWqPOc+YN1yTcL/Kj/uz09h9vuMHTqhY57QUOMAOCg7N0LigO4dzgPxaDVA5nNsna5sLC5pz7x8rFmIzd8mUKCcPmdcl9wo3BueWs4HFa+qy999KLWPTKdLw8GSNXBZ2leS+310EOIAf2B96rUBR6nEVmSZlRw7M9HUdDbi3COQBlZb8 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(376002)(346002)(396003)(366004)(136003)(39860400002)(451199021)(2906002)(4744005)(38350700002)(38100700002)(86362001)(66899021)(478600001)(54906003)(316002)(41300700001)(66476007)(66946007)(66556008)(6916009)(4326008)(26005)(1076003)(6506007)(6512007)(6666004)(6486002)(52116002)(186003)(36756003)(8936002)(8676002)(83380400001)(5660300002)(2616005)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kFTG3VWyKjJ/OEwdx58yfskuzYk4slUOhKwvj4LCgz4pHSgFCUKEt7EY5j9X3IZbHDIMJ+ty/hPNRZdG2ih9OdrsIblL9K/LkFdCJ55RWmIzvSZu0sNbzRMTy/bCT+Pnl2TbuQl00olS4LICmvGtW4FeKk4vowodG88QV3Xye5pjceYtdJZoNPJxUgeoEWn0e4y0gyKDkFbET6sMCT7Fjotp261pJS00eqxQFtW56S7HMY9qT8Fm5cd9cFiHfqWXOdVR3QdBdyUTV8P0c07xJ3Bgm6ySL6tv1uB7v87R4GQKiKNz+7gxAjAWbNyfwlug545tIo5XC8FSylKdp/YjE0ru6n84pNII+eyTIn0RaFMSmEDNihYHyjW0TN7FwjlU2NVXNU2QFB0ju1RjLV6ZDZRQWgFOkZ9MpjGv3o/aPGExbjXQaCVuHFaFCKvoN+TPj/NL+kFFRIOgVcgmRFZdYQv7ttvsMLCEGY/YkZ+HgMPi+TFFOdzYRqDAqrjlE09yGZPn4/tn5AVPIs8aaI0vxiry+GJ6RaZoLofgIk8xjosTVxkgvPOms+NhU9jOc467JBFRkMiXZsyNRgc6cEjBoGRKOWvlej+ofuVcwiKyFj0+QcZL9qw1MSmCoQ364hRh98pgrPCfNRrtdPOWFsrMSZZX4sfFnT3SUQTDppzIuIT0c1GzsAVvVKDO6EMEIjfiC8v8Qa7IPg3qFuuCPYI9enkoQ2XvDHxxqE5vGyBtY1hs5UzV6ugcZY227S0xTvklNekSwbvVh07f945XNRcg4Nd+amHFV0+5joCfwQLnLHf9oX45VxhhbR1SfECbaEQpQ9D7PJD51rLePVPznM4lL7X7WEG9mj98iIbhvUE7haTkUa4kHNyoZuNae/0KFdGQ3VX9pXxIewxTRNx9GLR4jseuBWW4r6rw86LF3BBfoUX+eKW4hPIMNZ2/MvmBRXBCxQJ8xf+7Ppi0WIo4WNwIZ8+9W33W3isypZrwgbQQO7NBeBPu1xoUGbuIgBzBLffs+S0UhG7v37mHhUguJ4mBrO53GGI6nkZGfCsgCCH3aR3whPYc8xLwpJ5xNOtq+8tLlOVr1ypFQHzlbapMAP0TNFmUKn/legloSzrv/9FLJUSlpj3gYTFHBBc6HZakv9v2Y9BaN7jFom+SD2qXrANeKBUpxfP6ToXvdKT7OaQ6QHnMwHESs7M313pBIalusHKgjCdvHIDBZnoJgQ4weLaO6oLslIesJBpdK12ZqBxj2KLM0mVR1ElqrYFkH2fCu51eI+fC7kvPUSNFv/X7SWTuzSnWZu3Uclbo8hWZnL13RpqwDGajzTXyNwUKyHKbVLDHOwk6X9/WGbzTnUjDomAMZ1+TMQISzyqUM9OTTGowJyhU1+PdJ4GNRsZ3xACcwe4ojqR4B6xF9MIQ46aszMeVOqm3xEAzihWQaiWoWvtRi6cHgvDxfPMfs4q7CtrLtVflvWcy2L1KyhTbwgAliXnZyJ+AoJN5G/+z7WUdpQfWJfEPk4fWK3IgKjTHMerqqH7ZxCEe8e2Ovie9EaUVvUodefhvJ3K/R/N/H2a3id07BVjuKJfILd6xM0rd7uP6SkuDTCPnk10LH4zVsRduKG+D9A== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 123f41be-90d4-4d09-57c0-08db41f27324 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2023 22:56:17.4071 (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: gy8e903hwW4gZYRRxkF+G7Ym2CEXgx9a4tINcMIxXxplUi+EJnlDLh7QR0zVICRLFn4IMRqjp3TuUNn+oZEsXQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB9213 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763738344157764839?= X-GMAIL-MSGID: =?utf-8?q?1763738344157764839?= 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: Eric Dumazet 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 Thu Apr 20 22:56:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 86080 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp675062vqo; Thu, 20 Apr 2023 16:06:54 -0700 (PDT) X-Google-Smtp-Source: AKy350bnISvnOUTFaxFElVF9+HKCc5cRNEK7L2m655eL52HTN3tjRATWLEudlBLA9RWH0kwWldYI X-Received: by 2002:a05:6a00:cc3:b0:627:ea7a:ff46 with SMTP id b3-20020a056a000cc300b00627ea7aff46mr3807265pfv.16.1682032014036; Thu, 20 Apr 2023 16:06:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1682032014; cv=pass; d=google.com; s=arc-20160816; b=N/bs4oL3qxO1qTmgboWpHv3hQsnYNzeU9wBNNTH1BCLZEqxLfXh9hxN8MIUWmY0XYo nAPaUjae7ubxeBpzyHDo+VwtyLBEeCW6lrH60iGULk3t4bSgQ3AwvXAY0RjcpNKH8x9n RVYI5S8Ox+m1C8q5v6ZjOupEMx6tqflvXZLVnpS7tIN62g/JCNp5jnmxWL6XpoD0lRyi JhqBgRWAQRpkSF7/LsbbnM8TEyo8D+QWEvUFrrAslUOrtTV47qB26PNR2HtCACEyKZK9 2lMyX6MR+eiEPn1PV5r79HNrii02KPRqCsY53720/57175xGSCPu3vRCVuvTiA4gaZwI JGIw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XTdiTvuz0snlaQP1usAosQoB9AJsPhW1MxetII5AmaE=; b=BEVlciMtDBWuW1FaKaeWvSeEqOKH/tGk1os1EJHCnORC5h6js2YIWZJEuvbXeoJSl3 uD31tsLMB5Fr9PHYMMfJ6cENEuam/Y+uQbVlm+ITZ7WFUtGs8lgkXnuKcYsA/jUfsRF4 V2In18pJNyN1zeC60HKAkJjHuyKeG9DqGHs5QOoYV1pCLHM9qu6FP+KxFYFjlBxsUnxj eDJGaM5alSRbzT4KQepDihZ+z4PTEWclCXVin3Okrt2OqH4Zb0wPJuEhr4QQz7zPPskF YyUVHfo64LVUsBOalw89SfqbZTvimLRz6jgrZ5zGp26h36uazX2qUko6h70n8EF4is4W hstQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=cfZPoWOK; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x29-20020aa78f1d000000b0063b8f3a4d42si2780156pfr.163.2023.04.20.16.06.41; Thu, 20 Apr 2023 16:06:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=cfZPoWOK; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233236AbjDTW4w (ORCPT + 99 others); Thu, 20 Apr 2023 18:56:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232351AbjDTW4Y (ORCPT ); Thu, 20 Apr 2023 18:56:24 -0400 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2070.outbound.protection.outlook.com [40.107.14.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AA0565B4; Thu, 20 Apr 2023 15:56:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CFffYDlBdZ3W6Mqig6FnVv+xkQq6erOa8YioNZ0ZQRbD/aOxmSAWHUQWqkobow15gOynQFjYf3lsJGsOmPlbnGxesqvT/SfW+gfG5NPiM1f/V/Qu4R3P0ZRki0mJvzUbhuqTw5pzIeRb/5ig++ej9H+S+nmv+vobxmmzOAcU+/vj8uylCfBJmYyFXbl65SL/yFuUc5y1TAM2jrjDytShI0ShofpKwtfICgPs6gqTbjE5a/t2HxtzABtqTKC14F1bqYEkdwtpwRWK87oLl7Ct4lG6OwpdjWN/kcai3SuTX5elZQomLE27PI9x4i4pKp24FnGkcT9sZuvRqXIkQQaYIA== 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=XTdiTvuz0snlaQP1usAosQoB9AJsPhW1MxetII5AmaE=; b=Q6aBkjAjYav3uDS9cxRGtZI0iNpZTo5L1BZdQK4/c0dNjKl9hzvvdVOHt5HGzCnU/iE98t/mpV1H6US7DCZEujjqQHrt96Tf784OU/ByuoexDmnYZavNOb20Y+/TXpuoEjh1zxfY0lLccMzwBs7mtUNL3nIJQrzkfLF2YXPCW+KePafdfNeKOsV6raLPsqUn06JZj1Ek7GXhMxFGHH3MO5QR4RqkpZ8tGeMvanLiCcbiyJrpXVIv4tcPizi9OhlDP0wRkP/2rCysvBfRwJkaUgsYggjnKuNMUF6QGav0qi5hYDpSclCPJhDI4xUhz6+mttC+MBTWattfCQaxvQz7lQ== 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=XTdiTvuz0snlaQP1usAosQoB9AJsPhW1MxetII5AmaE=; b=cfZPoWOKIJQ+Ze3zS0to24N5q3bhXIUILyQveFwyF/kUiruFd2F8YgLdhdnxVqnyF6Fu+7gr74JVUVqJBXRxDjsMoRxvMBrHSRnK8Vb+XODZ7YN8qMAirQIpBOdcZOS1NKnmldKX3ltoktX2BEfVTMiT4LBsHjajgYjWJoj7NhI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by GV1PR04MB9213.eurprd04.prod.outlook.com (2603:10a6:150:28::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Thu, 20 Apr 2023 22:56:18 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::245a:9272:b30a:a21c]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::245a:9272:b30a:a21c%3]) with mapi id 15.20.6319.022; Thu, 20 Apr 2023 22:56:18 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , linux-kernel@vger.kernel.org, Simon Horman Subject: [PATCH v2 net-next 8/9] net: dsa: update TX path comments to not mention skb_mac_header() Date: Fri, 21 Apr 2023 01:56:00 +0300 Message-Id: <20230420225601.2358327-9-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230420225601.2358327-1-vladimir.oltean@nxp.com> References: <20230420225601.2358327-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR03CA0088.eurprd03.prod.outlook.com (2603:10a6:208:69::29) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|GV1PR04MB9213:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d84bc5a-434e-40ec-64ef-08db41f27394 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FpvKihcL2MamMB15mQxJIOMt45rv4rpliKQgoSChuDA+YXvsBitL9azt3hboQbTAOeyuyRv4z2gcqspNKseTw39VIIN4W0451kNdNiLvtoZ0nPgSPkQ3FqbJQt45MihDL6cSiiahej6Egk01biqvl5l69ZsjVU/cPsyiPw9szXyYNNkQx04tgncxHsD7eIkhNCHISYKwRWSvRbgYJA9tSnyGOI/ZNCuj/8XWxy2eSCBzdWDq2XDmyEV0t0jAwXXLvCRU+d8XrMQQWO9IZXKob3wZzna4Z/ZeDZiQ/avaKDnft08xS+2PK1CfBMAhIIPavtx2NtwBlXEinsXxsbuDdLt9P5hAQtz8oeETag7QilliMGF1iit9LtSgmOJUBn44Ywnb8VWxImrF/1pBEw4ZMT6+zmqljgPsszReo4FcyDYPskAYHyaKrwGSH6EVY11GGcIlmQQIM9WtC1k3kzAkE4L4u2g3GJPS2IJ5vk1hfb3Dz4KApix7hEBtGKqNlSN0IaqztktaF88W6exx3DyXuyULALsypV3VV59D6EHXfvAfAUV0eJyF1MCUVig+2Dz0PMnKcxViO7rYqOW/z1K1fSxt59C3BWjIqLgmlMX1xiJQHqfpTX6tV5Fjm0sPW9/I X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(376002)(346002)(396003)(366004)(136003)(39860400002)(451199021)(2906002)(38350700002)(38100700002)(86362001)(478600001)(54906003)(316002)(41300700001)(66476007)(66946007)(66556008)(6916009)(4326008)(26005)(1076003)(6506007)(6512007)(6666004)(6486002)(52116002)(186003)(36756003)(8936002)(8676002)(83380400001)(5660300002)(2616005)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SZTZSWwyDdAkjVCi9/xU31IjVLRLChxWyzehlkAu+GKBlIL/7FnVhNxlnsjcIRCKi13naCbvyeLpv5YLCn7LVnwfRuK4YtdYXTBMyw+sY+xuOzXuAeqS//rJOVyILsyGjCcmftLuFZH94Q8qWqIQ9xwH2ceXWoQ6RZ8d0UIumw/sxtVmD48MdVpX1xU4kPpex5uPGz1sTvNrDZDDKESJQb/daN2+FG2TaNM3kjBehBkdPur5MojuvY8U4Dvagx1mhJIxSKpAh2dOHOAVxqqLObltuqOPHQ4hDVL6fgvMgP47hYpHSAJgbldRPBKdY65yE8RF4EOu2YALBHYfZtKOk+1OkTgdCTJ3WaLhNzG2ZViyxbZ9bvNNvC0x40XU3isjyhduFQR6SyCD07yJJ5BuleIqtTepLIp3wGW1sCynww4JbfUDerAocvwvGVtnIha84zpGTTXB3FzGuZCqM7yQ5oOT5LCxsH5aLx205kOBh8Zc+BHotJJ9L9EEuCYayJCKMpXdsiayS+GF/Q2+ZOF0S/6CqagwbdlE1luJ3F6ZNS4OpryzR3PTjQ0gnSsa2SVVVkHK2ZGgeOsd59bMRIxA2thyq5xDDGowF+zh6TKBB5v5MFzGum4VW3h3XKblebb1GXfVtpSV7tmO+BsomC/tvEr97nmi7ApKla0OXLqhRl0kiOkOkQGCPP61vFQAPzIAVS+IQeBoExyYwIt4nxJhkRTGEbKOjDiD5KR2otHCQAtaLZlMN/2fKctAPnvIheLu4qNStRwFO1QVw2jp8eIKi9oXKBOKlzRVB8kXgn8VeRV5KIR4pRKSdca6DE3UxnhiXgkR9XisP4NNHfBe1aEt0TSBVIeKgMHWn9BO3CqW5g9tnOks9+aMzvD6o7So9ge8tBI14x6oPUvOxVayo47r3m5Dwc7voRi026bCHwNfSI5ENUJmvsu+iutMa26doDjWLjT57ExA+gyilKL+YbG0ETapf30iXyduLZqz6hiXfkzWPGGjDsjvbVanRH15vENbLSRmdlLJJfEsHxzlcNA8Q7DLdBMej0A7U/bPx+p4rfDLmJIe7ceLsGZVh6/UgoEY72Rk/VIcNJWKn0nbFf2i09dpSDybzUOnqrFWEJyF16FOrvnlenPckgm8LlRyNUZpd4SH76dLu6XqxDXnFJRDlB6ZeJp6EosLby1St2LX7LjXA1VxTySsmrXVGuWe77nRwpB2y1SzrVm1UpcbD6z/uhS6M7YgRskboguLkGbsZSH9+gjGdmdbot4NVCeWRhsecSeTtreYDlZAVjV3rYjA/K/g8+KiBKWu8V5hm31JoQyS+uOvXFRNiiZl1V0p9GtqL6ZOTjvYPWugaGT/8MfNS4/G+y/wgSpQfw505fOTYV9nM8/fGUjPsWzEKDfOuG7o2/1f+GEQlFBgfDtmisWrwdE+q75C3fJ+Pp6n4PTkkGbwhRllw+sF8R9RDM1FQHqMQ+T4pRkZazw2j8ORc1v1Y9rrW3C5DQpjzgio8Cm8aksb8IuDXM2+KF6mXG/KByrFcbJmgsoWijty/bOuNZr9BB7tr6KBeDvcsIs/CE0kx96rpLB7haciyK74TDtH64fMhNlPrR8k0UxzOAD6VMMgHQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d84bc5a-434e-40ec-64ef-08db41f27394 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2023 22:56:18.1496 (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: nDD3ILeRjeJydKjQLfnLTTyf2yKXlYzIo4L+pCDjzRbvPD08JM7WEm3GQYAZ3zbuTW0oC1gmwgCHM+o08Bcrmg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB9213 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763738401093491360?= X-GMAIL-MSGID: =?utf-8?q?1763738401093491360?= 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: Eric Dumazet 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 Thu Apr 20 22:56:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 86082 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp675504vqo; Thu, 20 Apr 2023 16:07:36 -0700 (PDT) X-Google-Smtp-Source: AKy350YwQkZHYodXDm0TlmA8RyxKusJpHB67AAwFOcwTIMWuZfMXn8kRoC7mrOF0ygY4al1ABKm7 X-Received: by 2002:a17:90a:cf8f:b0:23d:e0e8:f453 with SMTP id i15-20020a17090acf8f00b0023de0e8f453mr2975061pju.38.1682032056369; Thu, 20 Apr 2023 16:07:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1682032056; cv=pass; d=google.com; s=arc-20160816; b=HKCQ7AruGApBc35BHmio2eEIZqcPfDp5/LRZR/cR3hPC+Zyh9GfENgREH2H2YPLBAz pj/hVUOMUleAOiyOWLLdrtKiGdkkpf234p/UGlSDSJagbBVu5wJOwFMU1uW0O3aE7gNf Sq3fXTuwJiGLpkETm5cW4LAj7ZkYLEpZ3R/bkgA16I77ZfALB3CtbGAfwr36abyAfm90 S9S8QWBHcbn6x/PwZxe8aBq1L82/saXcmXK+UT8IJweOaBKICx7cFhT4B1CpmmVDOwFq /8BEcHu3SnuRUPN9NPSAC4uYczehvWj2DlOKbqfM0WxUgefLveM1/B7qcOTFQDW3cE9y tJEw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=T/hd14NTERXsZeFZUPsIg4Ww7+KoT2dotGnFbCxnoxU=; b=xXcIX5y0pfZMyYtoLGm+MTUJybyE1FC7sUu7g77tJBGwxTrnjeT+TKY86LMcRsSqCq ZCEphlNKISv5Eg819pRpVApigrDUHMLa0w0p+w9nzjcQ2dLZzP3oBGrxOiSHRYZCFg5z wIyg76Nxs8CFUTH+na9rMLEg9TZ1QcTgqBxNCkCSUiExMT04FHEU4sgydln+06a3BuQg yplDDtiDktZ9+IZRNJuD1zRMc2RFOuy67Tf6CTckElgH5QI0xCIvpWbPfZxdfprlipf8 gsuIRL011hP9d4yWQV0GoGl4vpRFLVW5XIejIYJ0FejE9gWIV0rp8/pxH6IJw0+u7vVm gJ8w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Z9WIsiwm; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n9-20020a17090a9f0900b0023d22d0f0fdsi5469567pjp.19.2023.04.20.16.07.22; Thu, 20 Apr 2023 16:07:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Z9WIsiwm; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233175AbjDTW5D (ORCPT + 99 others); Thu, 20 Apr 2023 18:57:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233255AbjDTW4d (ORCPT ); Thu, 20 Apr 2023 18:56:33 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on060f.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0e::60f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D02966A5A; Thu, 20 Apr 2023 15:56:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iMNZ1gHo6LeDZhpNB4WdqqUzuD8VWWARBJTCZUXKDBom2HxpaRHYae1+QU1hEl6IeCqY67loHHfTLxlpA9lAfmvtxQ5ZkRXJ4Dvq7InU+IxDfO9/TB403KLwIfzf4eyPhXJ9y/g8Y9uw6ZmBKqXJ7oDDNbOOBJItJYKVYIXevpIrievRHipQAFuETDKKv6AZrxNynAqVMc/oOke7GiHwsnGyi6w+axhVSvoAibZ5efdmD1k+UbV/2dqkF8Ry2AFSZid9o5u+CDRPbpUNCdPtGeJKC5SnBvdHRv/B0W32XlhlSjHulKTfosaqZiO0fsKQHE9HwdBdTV/WxBdRbIMB+Q== 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=T/hd14NTERXsZeFZUPsIg4Ww7+KoT2dotGnFbCxnoxU=; b=dMH+GgAV3hXL7C/iLnj58r30I2SgiQTxb6jsYlbcWMzybInT81qHrnMR+SiZM4vKZMJPIbFwxuPDkl4MO6ywnWIOD3Q+H+bqXYgAhWZnxjnXYaiTQnI5edJ5CAr0Ru5Smjtt6CrKTfb7bt1C9CW1cXvVNhdK3SxdrzeuUUI7b3OwMOSaFKd6ofupMbhcFqTwNA1rRAuiZjcp9zq6DOHhzNL5ZTTQe5psdZ1TNfC2fmXBrrtqu9POipnmmbBsp8AWimRMxq/nMN7Ihp6JlLxgBwfcx3i/0BMwLqTycSbYf3DOqWz8vensPbXruhP+qLeDtCK6LgjZsHf64k3jT5ltOQ== 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=T/hd14NTERXsZeFZUPsIg4Ww7+KoT2dotGnFbCxnoxU=; b=Z9WIsiwmtPltj7/B7TpuUqEnTlGA0lhQcAmenhXLQ08tTHxex4zFaUVSXmxHK4SvkCbmmEAwgTQCuoEb3vx4bA2ltwI+1X4LO/M3Q/J8+zS2LP0n697GE/t2AyidQ4L/4BsZU7r39FsHiAeMHsnqlLoSmbDEpE0oALcH7/mnPXU= 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 DB9PR04MB9497.eurprd04.prod.outlook.com (2603:10a6:10:361::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Thu, 20 Apr 2023 22:56:19 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::245a:9272:b30a:a21c]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::245a:9272:b30a:a21c%3]) with mapi id 15.20.6319.022; Thu, 20 Apr 2023 22:56:18 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , linux-kernel@vger.kernel.org, Simon Horman Subject: [PATCH v2 net-next 9/9] net: dsa: tag_ocelot: call only the relevant portion of __skb_vlan_pop() on TX Date: Fri, 21 Apr 2023 01:56:01 +0300 Message-Id: <20230420225601.2358327-10-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230420225601.2358327-1-vladimir.oltean@nxp.com> References: <20230420225601.2358327-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR03CA0088.eurprd03.prod.outlook.com (2603:10a6:208:69::29) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|DB9PR04MB9497:EE_ X-MS-Office365-Filtering-Correlation-Id: f34c1c0f-2259-4237-7218-08db41f27404 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: i84X2GnrtaOzIzSyMCm9ITpGRTa0pn2wYZTuUIOtd5IXP4Tm7zacvydznkKE/SYiZWWsiVeLbyor8mqMWctgPzH5VdYy+TZ9lrEMS7yr9buYUWITJishiuC7nKSOJvosi4eeROg1vmhSfU0zOBSJCb9Wn+SQYDJoRxwEB+9MhAze0Lmm2KogtbeavZEs1AMZ2d5dhHiFEztAKga/m11AxwEfqQk17IMaMI++jdHQ78/Szmrup3XJyg26VqSX6A3jBr04zjRWvHcfYubSuxdZK4XX4s1sUAjAnhrpZnJksP48nhY4rK/5sQeU2ECKfh6XH0+4LYCyh6M9EWYnngchKvUrLSbfUL3p9Zf9uyC1qJesjHoe+IE53VtAEPpToHZubiUdUNLtpw3mRFsVFrB7q0spIvIlF/zIwtp0az5v9aSaaRIYtXT5SByRu7D43pdhLVPYrj0bwCQUKDRvj21derb15Sv/PkRLtp/h/ByqavGITVy3lcW5c3liwEf2tNzSMZUF2Hklym0a9W26AFbY11bd6NuaRw1nX/yVnroybhpKiT883DSPlihBPFKaYD14bHHVfZNNrVSzmN/eA5z8TDPdU/SKpe6axbYMwYi2rIQZI6WM2BVQr4g+Tmant8mo X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(39860400002)(376002)(366004)(396003)(136003)(451199021)(83380400001)(86362001)(2616005)(6506007)(1076003)(26005)(6512007)(36756003)(52116002)(478600001)(6486002)(54906003)(6666004)(4326008)(66476007)(66946007)(66556008)(41300700001)(316002)(8936002)(8676002)(38100700002)(6916009)(186003)(44832011)(2906002)(5660300002)(38350700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0s4dBz43+w+hVcPizI+mtqftpe3fvThvs8Y8zUwKN+a1hm7qbsK6OOliQi4Fjhm3JQNPt9n8z7Zc2G7dzuHaf5lW2IizWHhzNxBVeS6Z40vGjArNkAg2+XiPuPKAejK22fg+a1hmZSHMJQOoeR0Gr9MPGB00tl/kBcBVehcynVyG+0ByzXAL+LuYmdkqB8i295dBRVauJYn9DqKj0mxzs8t+2LW8S0YrNHsZw3HRfAl441iqbD9KgXlCFT283+5vJIEDY/90bJbWWIAjMI8ooeRAnAyWN4WXITMtUU5iBjfDgf58SoYDZJp1qSQS3TTwbw0I9qbEZ/wLrBNnPDVouCybmBgHEtKxLrtjrXd69Z63QH/D/9tESn5/eeEmNH0U8B6l0nLQUrAPBkvQiLRlxpydsXXUYWcFVXZ/j4L+579ngBukbZ1Fp/njWs/qS8VuqRW5A4gx5+LYCLi6PbFCStlx/UvY3oB8tCz7bJD18SH2zhf1QxG4RGzvgslOGBQaBQAAtLBn0tcWIeYHUi+zq0MVTgK9efn6pSXVH8s0DYCTVP/cnQdRzkPit97vp2HW7jZ0+PTxq0nAcUf/mNDVgDFyhxLw9023oveuF1qIb8RmOIA42q+HsGwLnK1FfP0AUU3B6mDn9/Jhp7RtAvtgwFiE5Ucq9Lxg0gpXW1B9R4CsB08fNQYxXWxYk0KTT3ePCBjF2x1wdKxjue0myWsU/nxW92ds0y13uL6Nt+LIAXZBC1dlgQxXMnC6D0RuEMV+4MUfXKGcMO9eIzOMtvgOmrxmdbqfNXQGrWXLLrkrR8sD0FN2WYBccFgTUIFQX9RCjM3qkXF3lKsCtpGlEpgvwcG2FzDidIicKw/RNPHmXU9AWzRZ+rJKAczHCXrWKWrOgW/MJgCxRmSf6C5UFoCQebl8vS1LHqKW0e8QJzz1fucIQPrqlDRJjyR+hrMxLHKqhX9n7YLnaXLSguh5Jgv+f3zJillsCufZReu3i/l0va04CP4194ZQKS2qcziRGA0qMSyW46QJzRVpsfPGFmtyM0k1ioYULhlbdR4++FNlB9LIfCTGrhsU7fajIls/IsGHIdesMeB0h30BeWZNH2hVi0RSGb5zp5EHHpCHx/PXTLDLlkFZ1BcPhh1G7981uHjt9aSaAotT/MztpVFP2aBafGcIL14xB+wv0ZqqxJoexxs/2bPJslNUQCanGzJyECeel34szeq1mfX1TSTLYqxMBZ4kRd3Oj9vlVg0fZyjdg6iVNsJpLnkpQt+yr6zUsDrxcOU4p5oJs0sFmj4gHpGuKyEIGayJM+6Io65Xt+d5gugUjuBGpqkrgCAjmB5DLqgl6mLm6XmIAlxxG42qDNoiVpSw+NiEBKzCcwB91SvuuZmg/4Ak7e7jtIeTboNtFnJ/35TiNnK8UJguyHHZEXXsUIGDvV8wXbqzG953fGiWoi0hLDCV2vUCSu2sjkBfLUKgb6SQlE8Cc7Oa3Zw1xN2wtO70Dj8yQtzzxrgHO3M/aVEukWBxVbtcCzTw98Y9OlwICKLa2CKyDHaUMGmR6pKqARBeHrL8TZV2tBjS9KRyLTxLweDpcBJ4zTSEbxdWPkUP2BVAVhkaEt/OstwQS1V+EQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f34c1c0f-2259-4237-7218-08db41f27404 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2023 22:56:18.9062 (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: 0LaxCqmuqKDqeL4beTUtoKQ9xqCu9DcDNigRvbjBXkZXi+Vi+q+XgC9lZy+w/LKrj3RXsUxmyGwaR/SDu4yezg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9497 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,SPF_HELO_PASS, T_SCC_BODY_TEXT_LINE,T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763738445959630006?= X-GMAIL-MSGID: =?utf-8?q?1763738445959630006?= 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 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 Reviewed-by: Eric Dumazet --- include/linux/if_vlan.h | 21 +++++++++++++++++++++ net/core/skbuff.c | 8 +------- net/dsa/tag_ocelot.c | 2 +- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 3698f2b391cd..0f40f379d75c 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h @@ -685,6 +685,27 @@ 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 + * @vlan_tci: buffer to store value + * + * 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 768f9d04911f..3fbf32897b8d 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -5943,7 +5943,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; @@ -5959,13 +5958,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();