From patchwork Thu Apr 20 22:55:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13219264 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD8CEC77B7E for ; Thu, 20 Apr 2023 22:56:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233109AbjDTW4T (ORCPT ); Thu, 20 Apr 2023 18:56:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231562AbjDTW4S (ORCPT ); Thu, 20 Apr 2023 18:56:18 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2063.outbound.protection.outlook.com [40.107.21.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36E7F3C06; Thu, 20 Apr 2023 15:56:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZmUgpYLuQaBnoYtTAdiRGaCI/sqBojfhuk6At3vfWTHLjAQnqu7bnVpUKtoY/27fYg/EkMbJRATlHzV9pzABRYGM1RVAVRrCRvRfsb5EvA42xHjVvXQF+souaT6wezjKpfk6/lkJsPJDEihZwjBOMwRYQaC4ihC3mLMzkT6N4yYy1IOzu+DqcaaIB5GRp3PbGcu6gCYZ8tVTtxgf2/Rhp6o3PVLrGBhJvjyzBpFdghvofeoiJsn/R5l5U3QnQBf6XEd06+an6lPeW8noIRuX4Jlk+6okuSemENaid4z0Kn6wawFMsb4PCIA5xneGSfBQw0tTx2Y03+dPLqEOYBtotg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BbCd/MGRniqdetASdFqizhW2CBDY8IEYUP3mWHYLPXU=; b=hxbJTyXT39TrWSTyltH7YYTabRDJGvbbz5nW5jRgQIxTXbaPEGtAxxM3yRcwtW8Ziva40bgyM5nGSFH6kN2bB+83w5xkb9ksgh3a5z3fdjRmPw/2kgCLL6rogouDf5Sykc3crsVlUCIZAwaPT+djHoDGQfhNUL1hl9ZR6dprK3nf2AZNGBOHHZKBmRTEKFx+acVEYR1TYGvx4SYULnW1dmKQPMun02JcQ9v4u+IZOV4Y6KeSPhtPkevqtVM3KrkQgy+FbbQrotM40d4V+fMffpZ49KSZ81gWJHsnsje/LdethqxrJ1umg+lW9qUqDCWhAtQvwqE0vs9YXi0MuVWUdA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BbCd/MGRniqdetASdFqizhW2CBDY8IEYUP3mWHYLPXU=; b=B2wkNpSY2GvtHM5mAfB33IaHOVh55S9eOMALLWY9UmBD+aH+Tj4A+htJj6vcDR8YDyNHSkB2Jdj8aeM+1YoZUSLIPmpVpfIK6FS/OLrxxvmen/CKzT6jz1J+VThaCLhwmgTvC18ZjN7WTZRPZnKOZJ4Lispm3BtYDMDH+4GPKng= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by GV1PR04MB9213.eurprd04.prod.outlook.com (2603:10a6:150:28::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Thu, 20 Apr 2023 22:56:13 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::245a:9272:b30a:a21c]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::245a:9272:b30a:a21c%3]) with mapi id 15.20.6319.022; Thu, 20 Apr 2023 22:56:13 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , linux-kernel@vger.kernel.org, Simon Horman Subject: [PATCH v2 net-next 1/9] net: vlan: don't adjust MAC header in __vlan_insert_inner_tag() unless set Date: Fri, 21 Apr 2023 01:55:53 +0300 Message-Id: <20230420225601.2358327-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230420225601.2358327-1-vladimir.oltean@nxp.com> References: <20230420225601.2358327-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR03CA0088.eurprd03.prod.outlook.com (2603:10a6:208:69::29) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|GV1PR04MB9213:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b0d48ca-7637-4674-a67d-08db41f27081 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bculxy5lMfUnY0R7xr/cV4xx3aNh/jgTwasYVsdKgdpkQuvqlZx1GlaqdSpLVLYOSnq4jUoh8yICi3PtUn6n+/8W2TbgtWuBBVKfMJp4TB9OVLFMnF/tLHkhn3f7S2LOk3QNMqS0xRB8uz8en8yyEOPcou5E9bXQMWTrIQRoym+NHaed/IhsD7tHapl+5ZEkpL1qt2SHRkJNk72z5G3aAm+c94qzKN/srocVikz2tLSGZmUqopuELfsscw+kHyu0HffAGR1gZXCx76mAEflzeTRNuiyTo1Iy2fQB8uMEzOHlSWcE9nlLWvAC7BVSClQGkFwM4rPRX+nzITv9Wgo6aWv9teJH0aqeBDIeR0uLPoP1d8U0+l9E9AW1sYto5MiH7Q+2nMN/tnkwkbbes/7WSzBKdeImH4eABVIBF3vIeSNm+x5DAUR7vwUnjzD9Uiu1yLg5URFvjzOv27bNMet5opDM12sAPRKr53uggoYOmwyl0FiFaZXCb9KJSrKiT6yx+7UGUjjDMmRe0GB9VPtq//HmTk+rrmPmN1ugGUn3eeJfsILI0s/5dHxm3YRgFjQJHmgi3qB12LXmez+gjpwiGbIULqbgH/TP71wXBwLJcxzDOjMWVQFrI+/10HQUhKdv X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(376002)(346002)(396003)(366004)(136003)(39860400002)(451199021)(2906002)(38350700002)(38100700002)(86362001)(478600001)(54906003)(316002)(41300700001)(66476007)(66946007)(66556008)(6916009)(4326008)(26005)(1076003)(6506007)(6512007)(6666004)(6486002)(52116002)(186003)(36756003)(8936002)(8676002)(83380400001)(5660300002)(2616005)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: T46/nrInAgsV9YpHhwlNybpGThHwEPTOVWgGkIBwK6b9mEiQpbNHEgiqiYxpbSlJuPor7qqwLE0YU2diZM9LDsamfDqn+Sl9rE50LZLbuhVPDs1r7XVM1r4GJXGIYyh2wrtuFm2sbJxG2f7B7iSxfFPjeuHVOZt0bKOnbwrlxPvhEbr1pmS31t30JdgQv9CzYZZAspT7FaGj/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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This is a preparatory change for the deletion of skb_reset_mac_header(skb) from __dev_queue_xmit(). After that deletion, skb_mac_header(skb) will no longer be set in TX paths, from which __vlan_insert_inner_tag() can still be called (perhaps indirectly). If we don't make this change, then an unset MAC header (equal to ~0U) will become set after the adjustment with VLAN_HLEN. Signed-off-by: Vladimir Oltean Reviewed-by: Eric Dumazet Reviewed-by: Simon Horman Reviewed-by: Florian Fainelli --- include/linux/if_vlan.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 6864b89ef868..90b76d63c11c 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h @@ -351,7 +351,8 @@ static inline int __vlan_insert_inner_tag(struct sk_buff *skb, /* Move the mac header sans proto to the beginning of the new header. */ if (likely(mac_len > ETH_TLEN)) memmove(skb->data, skb->data + VLAN_HLEN, mac_len - ETH_TLEN); - skb->mac_header -= VLAN_HLEN; + if (skb_mac_header_was_set(skb)) + skb->mac_header -= VLAN_HLEN; veth = (struct vlan_ethhdr *)(skb->data + mac_len - ETH_HLEN); 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: 13219265 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF77EC7618E for ; Thu, 20 Apr 2023 22:56:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233148AbjDTW41 (ORCPT ); Thu, 20 Apr 2023 18:56:27 -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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Similar to skb_eth_hdr() introduced in commit 96cc4b69581d ("macvlan: do not assume mac_header is set in macvlan_broadcast()"), let's introduce a skb_vlan_eth_hdr() helper which can be used in TX-only code paths to get to the VLAN header based on skb->data rather than based on the skb_mac_header(skb). We also consolidate the drivers that dereference skb->data to go through this helper. Signed-off-by: Vladimir Oltean Reviewed-by: 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: 13219268 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 044F6C77B7E for ; Thu, 20 Apr 2023 22:56:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233266AbjDTW4e (ORCPT ); Thu, 20 Apr 2023 18:56:34 -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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org It appears that dpaa_enable_tx_csum() only calls skb_reset_mac_header() to get to the VLAN header using skb_mac_header(). We can use skb_vlan_eth_hdr() to get to the VLAN header based on skb->data directly. This avoids spending a few cycles to set skb->mac_header. Signed-off-by: Vladimir Oltean Reviewed-by: 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: 13219266 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE247C77B7C for ; Thu, 20 Apr 2023 22:56:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233200AbjDTW43 (ORCPT ); Thu, 20 Apr 2023 18:56:29 -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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org skb_mac_header() will no longer be available in the TX path when reverting commit 6d1ccff62780 ("net: reset mac header in dev_start_xmit()"). As preparation for that, let's use skb_vlan_eth_hdr() to get to the VLAN header instead, which assumes it's located at skb->data (assumption which holds true here). Signed-off-by: Vladimir Oltean Reviewed-by: 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: 13219267 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E17DDC77B7C for ; Thu, 20 Apr 2023 22:56:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233215AbjDTW4b (ORCPT ); Thu, 20 Apr 2023 18:56:31 -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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org skb_mac_header() will no longer be available in the TX path when reverting commit 6d1ccff62780 ("net: reset mac header in dev_start_xmit()"). As preparation for that, let's use skb_eth_hdr() to get to the Ethernet header's MAC DA instead, helper which assumes this header is located at skb->data (assumption which holds true here). Signed-off-by: Vladimir Oltean Reviewed-by: 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: 13219269 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0EA3AC77B73 for ; Thu, 20 Apr 2023 22:56:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231636AbjDTW4g (ORCPT ); Thu, 20 Apr 2023 18:56:36 -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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org skb_mac_header() will no longer be available in the TX path when reverting commit 6d1ccff62780 ("net: reset mac header in dev_start_xmit()"). As preparation for that, let's use skb_vlan_eth_hdr() to get to the VLAN header instead, which assumes it's located at skb->data (assumption which holds true here). Signed-off-by: Vladimir Oltean Reviewed-by: 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: 13219270 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91935C77B73 for ; Thu, 20 Apr 2023 22:56:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233288AbjDTW4h (ORCPT ); Thu, 20 Apr 2023 18:56:37 -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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This is a cosmetic patch which consolidates the code to use the helper function offered by if_vlan.h. Signed-off-by: Vladimir Oltean Reviewed-by: 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: 13219271 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF760C7618E for ; Thu, 20 Apr 2023 22:56:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233304AbjDTW4j (ORCPT ); Thu, 20 Apr 2023 18:56:39 -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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Once commit 6d1ccff62780 ("net: reset mac header in dev_start_xmit()") will be reverted, it will no longer be true that skb->data points at skb_mac_header(skb) - since the skb->mac_header will not be set - so stop saying that, and just say that it points to the MAC header. I've reviewed vlan_insert_tag() and it does not *actually* depend on skb_mac_header(), so reword that to avoid the confusion. Signed-off-by: Vladimir Oltean Reviewed-by: 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: 13219272 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C81EFC7618E for ; Thu, 20 Apr 2023 22:57:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233393AbjDTW5C (ORCPT ); Thu, 20 Apr 2023 18:57:02 -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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org ocelot_xmit_get_vlan_info() calls __skb_vlan_pop() as the most appropriate helper I could find which strips away a VLAN header. That's all I need it to do, but __skb_vlan_pop() has more logic, which will become incompatible with the future revert of commit 6d1ccff62780 ("net: reset mac header in dev_start_xmit()"). Namely, it performs a sanity check on skb_mac_header(), which will stop being set after the above revert, so it will return an error instead of removing the VLAN tag. ocelot_xmit_get_vlan_info() gets called in 2 circumstances: (1) the port is under a VLAN-aware bridge and the bridge sends VLAN-tagged packets (2) the port is under a VLAN-aware bridge and somebody else (an 8021q upper) sends VLAN-tagged packets (using a VID that isn't in the bridge vlan tables) In case (1), there is actually no bug to defend against, because br_dev_xmit() calls skb_reset_mac_header() and things continue to work. However, in case (2), illustrated using the commands below, it can be seen that our intervention is needed, since __skb_vlan_pop() complains: $ ip link add br0 type bridge vlan_filtering 1 && ip link set br0 up $ ip link set $eth master br0 && ip link set $eth up $ ip link add link $eth name $eth.100 type vlan id 100 && ip link set $eth.100 up $ ip addr add 192.168.100.1/24 dev $eth.100 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();