From patchwork Tue Mar 15 11:02:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roi Dayan X-Patchwork-Id: 12781320 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 AEEC5C433EF for ; Tue, 15 Mar 2022 11:02:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347781AbiCOLDv (ORCPT ); Tue, 15 Mar 2022 07:03:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347784AbiCOLDs (ORCPT ); Tue, 15 Mar 2022 07:03:48 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam08on2086.outbound.protection.outlook.com [40.107.100.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B276E443D8 for ; Tue, 15 Mar 2022 04:02:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pd9PRTZjv6Qgi4Nmnc8N8McY5rMffhXcGbAXBeYc9KEIyrkUFXU2bzwBOyIs4Ce+UBL5v51GXuiROY/X4S0WdKDI1DR6fskOydp2XJeKTNWVExKrA6a3dzp3suidlZtmMzprg5JkmM8JRj/g3L6WDknR9x4HSVJcFXBr/yWp3O2rTt0HmojjkYhx3d4HPu7HUPp/F3O1wfzeDwj13PPVahFJtkhMVOD0J3hP7zOwpuasDfwE0IPpTkEsXoJHJGPSkVlGBMU1DLGLIIXJsQxQm/dUaOzPjYYxOXhglZiEhXTePE2FkHX+KkBQ8oMWpULMSOavrY95WHe5TqpDt5Zlaw== 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=Pm/TYrtiyF9jTWlhfA/0Ald4GBeSo5Hql1pGAyNeY2Q=; b=KEJ0BY9cREC9uO12X2xSHkXtkmoetDy82+oRiN0p30p4Op/5KPzOcsDl25UryTa0xDMC0nP8s3fXrbpJSKjjhYmTRQrc3QBt2uPqckzlhLcabK4cIWzXxbKDPIm/N7BF6fmQdC6qCEHWaOtpoj5ofKqSnVGHIdj8t/CyR2ZGJ20Ca9+c5n02It6oKuEZeGW/IwJ3KUkJOxKlIFwcUzxIRHO7EFbzpvj7Vrw+fq+ihrnRWBs5Glr12EqT3AZU2CmAh9N2X3zBJsrTRvxav8XCflpj4r0mhW56eRlJ6qalAjhna6YWusFvT2WCCFFfg0jOCEJ/qkc8R4fyqq7CrMCKtQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Pm/TYrtiyF9jTWlhfA/0Ald4GBeSo5Hql1pGAyNeY2Q=; b=av5QZG4/n9L5XMJM4rl64724r3VkRV3Thc/jKbfudEs+a16qf2kUdqWRoCC1jMlPINbfCSQhxpZlQjqRqW0LR6ASG08t1Zok1gsykaBdehThZEPklnzxOkmpF6vkUeI0z/znKHtGBbfjht9eyJab3ZQ8S7iBKGECoyb2zUOx8T42q9VU/a0cXUVX2UTx20i56XAimuLf35tCszhMx7eLI8XoPvBO4hnL3Ev1u7M6TqZHKUehqBnv6QdyKvWUQdmqyZI+TZcbbSYmJUwP8G/3te1zHTTsUgDy1SKbl7VVfFiFLdnYYGmdY76rWhiWsbtndW7meDVM7++VBSWSYDUiJA== Received: from MWHPR10CA0049.namprd10.prod.outlook.com (2603:10b6:300:2c::11) by BL1PR12MB5142.namprd12.prod.outlook.com (2603:10b6:208:312::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.25; Tue, 15 Mar 2022 11:02:35 +0000 Received: from CO1NAM11FT060.eop-nam11.prod.protection.outlook.com (2603:10b6:300:2c:cafe::28) by MWHPR10CA0049.outlook.office365.com (2603:10b6:300:2c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.22 via Frontend Transport; Tue, 15 Mar 2022 11:02:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.238) by CO1NAM11FT060.mail.protection.outlook.com (10.13.175.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5061.22 via Frontend Transport; Tue, 15 Mar 2022 11:02:34 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Tue, 15 Mar 2022 11:02:33 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Tue, 15 Mar 2022 04:02:32 -0700 Received: from dev-r-vrt-138.mtr.labs.mlnx (10.127.8.10) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.986.22 via Frontend Transport; Tue, 15 Mar 2022 04:02:30 -0700 From: Roi Dayan To: CC: Roi Dayan , Maor Dickman , "Jakub Kicinski" , "David S. Miller" , "Jamal Hadi Salim" , Jiri Pirko Subject: [PATCH net-next v2 1/3] net/sched: add vlan push_eth and pop_eth action to the hardware IR Date: Tue, 15 Mar 2022 13:02:09 +0200 Message-ID: <20220315110211.1581468-2-roid@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220315110211.1581468-1-roid@nvidia.com> References: <20220315110211.1581468-1-roid@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9c4e6b0b-ac41-4785-83d4-08da06734ef8 X-MS-TrafficTypeDiagnostic: BL1PR12MB5142:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0FZc383CfkkEY67V4rSpbwmoUs9ughVALjhYoNGI61aLnIWEBGqjsV0Ol/Yi6TgX59qZaNM1EBBYrFarTY22l68/0TWCpcGDjq4A2HbpAGdch4JYBq4JHFg+iORKw0DQKDFlxccZt6twJeW1t/NYRAKMmChy5UJJkEfaqsCdZgYlLYEuQBYhMmEWIP0xjaE+IRdrRUhalqGULIKg7v44DABtf1hVpGGCdal7wN9TVhWaWCZMYmLT/un6YwIf5MtUCrjrbQSOlX91jgz0LfPa2LZ7bXHfMxNCq2FmGtfQBvf+9//qv/oFPgjb1R2CBOBN5+uWv1x1UCz+Pqar8FiyW2eta6XO8JFcH+Px6TT1SjD5rKl4qmLaYfisOfoZpXMlnwGJFk2mun/VvXLe6/WXF9qfeIxCkm+R+IwJHHfF+EV+x+4twC04J8tY3Zyimf8552/UhrXnOSVAUS+TxksoOtmcyyDjoCjWOEePluJPJzkGFvDVcm+YtDm0Sr/1ZrVXJHBaujy7Es+kgkSwhLYhmsNLg0kFVoiBJyCV4NBFfPnFlsgCY/yQ50tKI5tsZ61n0JoaTmVhXmtynX/R9UDf59IZit8uauU0x2pFFb478hqm1jX7gQusDME9Qm5i+6NgbGJSMH1HI9WKNVQYA4R2fnbNq0LYKoB6pjIu0vCho3CcJj6Sd6RPfpC9Tfy+1+K8WO0PQ6ubV0jT1s4GlZ/Uzw== X-Forefront-Antispam-Report: CIP:12.22.5.238;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:mail.nvidia.com;PTR:InfoNoRecords;CAT:NONE;SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(6916009)(54906003)(316002)(36860700001)(40460700003)(6666004)(107886003)(36756003)(26005)(1076003)(186003)(2616005)(83380400001)(81166007)(5660300002)(2906002)(508600001)(356005)(8676002)(86362001)(70586007)(70206006)(82310400004)(8936002)(47076005)(336012)(426003)(4326008)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Mar 2022 11:02:34.1011 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9c4e6b0b-ac41-4785-83d4-08da06734ef8 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[12.22.5.238];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT060.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5142 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Maor Dickman Add vlan push_eth and pop_eth action to the hardware intermediate representation model which would subsequently allow it to be used by drivers for offload. Signed-off-by: Maor Dickman Reviewed-by: Roi Dayan Acked-by: Jakub Kicinski --- include/net/flow_offload.h | 6 ++++++ include/net/tc_act/tc_vlan.h | 10 ++++++++++ net/sched/act_vlan.c | 13 +++++++++++++ 3 files changed, 29 insertions(+) diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h index 92267d23083e..021778a7e1af 100644 --- a/include/net/flow_offload.h +++ b/include/net/flow_offload.h @@ -150,6 +150,8 @@ enum flow_action_id { FLOW_ACTION_PPPOE_PUSH, FLOW_ACTION_JUMP, FLOW_ACTION_PIPE, + FLOW_ACTION_VLAN_PUSH_ETH, + FLOW_ACTION_VLAN_POP_ETH, NUM_FLOW_ACTIONS, }; @@ -211,6 +213,10 @@ struct flow_action_entry { __be16 proto; u8 prio; } vlan; + struct { /* FLOW_ACTION_VLAN_PUSH_ETH */ + unsigned char dst[ETH_ALEN]; + unsigned char src[ETH_ALEN]; + } vlan_push_eth; struct { /* FLOW_ACTION_MANGLE */ /* FLOW_ACTION_ADD */ enum flow_action_mangle_base htype; diff --git a/include/net/tc_act/tc_vlan.h b/include/net/tc_act/tc_vlan.h index f94b8bc26f9e..a97600f742de 100644 --- a/include/net/tc_act/tc_vlan.h +++ b/include/net/tc_act/tc_vlan.h @@ -78,4 +78,14 @@ static inline u8 tcf_vlan_push_prio(const struct tc_action *a) return tcfv_push_prio; } + +static inline void tcf_vlan_push_eth(unsigned char *src, unsigned char *dest, + const struct tc_action *a) +{ + rcu_read_lock(); + memcpy(dest, rcu_dereference(to_vlan(a)->vlan_p)->tcfv_push_dst, ETH_ALEN); + memcpy(dest, rcu_dereference(to_vlan(a)->vlan_p)->tcfv_push_src, ETH_ALEN); + rcu_read_unlock(); +} + #endif /* __NET_TC_VLAN_H */ diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c index 756e2dcde1cd..883454c4f921 100644 --- a/net/sched/act_vlan.c +++ b/net/sched/act_vlan.c @@ -390,6 +390,13 @@ static int tcf_vlan_offload_act_setup(struct tc_action *act, void *entry_data, entry->vlan.proto = tcf_vlan_push_proto(act); entry->vlan.prio = tcf_vlan_push_prio(act); break; + case TCA_VLAN_ACT_POP_ETH: + entry->id = FLOW_ACTION_VLAN_POP_ETH; + break; + case TCA_VLAN_ACT_PUSH_ETH: + entry->id = FLOW_ACTION_VLAN_PUSH_ETH; + tcf_vlan_push_eth(entry->vlan_push_eth.src, entry->vlan_push_eth.dst, act); + break; default: return -EOPNOTSUPP; } @@ -407,6 +414,12 @@ static int tcf_vlan_offload_act_setup(struct tc_action *act, void *entry_data, case TCA_VLAN_ACT_MODIFY: fl_action->id = FLOW_ACTION_VLAN_MANGLE; break; + case TCA_VLAN_ACT_POP_ETH: + fl_action->id = FLOW_ACTION_VLAN_POP_ETH; + break; + case TCA_VLAN_ACT_PUSH_ETH: + fl_action->id = FLOW_ACTION_VLAN_PUSH_ETH; + break; default: return -EOPNOTSUPP; } From patchwork Tue Mar 15 11:02:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roi Dayan X-Patchwork-Id: 12781321 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 88E83C433F5 for ; Tue, 15 Mar 2022 11:02:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347786AbiCOLEA (ORCPT ); Tue, 15 Mar 2022 07:04:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245197AbiCOLD6 (ORCPT ); Tue, 15 Mar 2022 07:03:58 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2062.outbound.protection.outlook.com [40.107.244.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E8ADFC for ; Tue, 15 Mar 2022 04:02:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mk9BrSqfjCjsKguAUEftuNRNDQ5rClWGNg8Lae+1JGzXXc8nBcCvV8yVx30Tya15rE2BICp2kNMya9d8bl92cEgYl8xwyolxVBu0cZiUgdoC29cHMy+3rrW63vmmthYTQpeE3IaxSe0OR7/N5oLHpTpLLFJq83YjhSpUt2giqcVQnZzC93jVnf3t2hmrVj7NvtZdcelzg2salLwy5/rboGVcpsAlQVp4pgHxGJ1hkAyfTXH1ZC/ObFklsiW5yNzMsPbDXVBJQmg/8q+9vdYa96kC1Jqx2N3iAd6WGcEcULdHxDB7GLgn/pk1Kp1rIKVIcP0cyb0FmS6K4ps0sT6zWA== 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=418th3C9pw6asyMSlehVkY8Gq/gY11Y61fX5IFspTI4=; b=HRKAJ1Nghm5s9yLlGFf96stAikerBKOCd8yCMcEs976JPE67UVdNzlSHxFAv12DwTdiZloS5q5Huk3Jc8hS3FgnlKe2pUo0gxZodI6TndrFCDTU14V4txKz/rGdJIykHYA+zIMj5IPki43fh+p1rpY84Zs8aZnZAzyehpcGPNBr5/eqWuQbefTbQktAn2cYi7bCg067y15wiNMfQuKF2LvDXC4/sb9pB2Oip46Nvg9atlCZivVI2JFpXMVcAt5P+8TsEXNz0AYXtPaLQ2PERmAWP6ISI8i/mAKDb2U1K65WIXNssYg7GW5rZc2C9+ZNsr/lpntcl6PB7ESsLNKbdRQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=418th3C9pw6asyMSlehVkY8Gq/gY11Y61fX5IFspTI4=; b=skt+ap6i6EOTUGfVbUw2NLuYVcI3BBkejUOg29cQqrIgh8H8rklm82jsKt+LDdQixBIiTttX6w7ffm8O7mzlnJqy4onZ8eOvuR4+AWkJ5fPqGFkKi/8pCqKtgm5DSORJ9t8W9RbTgFSdKCqlD6jwZRjfpLtvFliTn7BuW96bSKxFvfvcN+22ZtFewTlq2Ihm44rvmGgzqgM1Iy6JgS/l3qO9v0o6a1kqMX/Pss6u6ZQwROQMY630lvzWpt6Ja69Ak2xsGw7X7JlESlj2WNX5ZRJCLoU0i4sPgctBxgMCReJ/TOnaQIL0j2eOTdJXW6HFIhI1D/AO0i1V/0rI7XNRbg== Received: from MW4P223CA0028.NAMP223.PROD.OUTLOOK.COM (2603:10b6:303:80::33) by DM6PR12MB4481.namprd12.prod.outlook.com (2603:10b6:5:2af::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.14; Tue, 15 Mar 2022 11:02:44 +0000 Received: from CO1NAM11FT013.eop-nam11.prod.protection.outlook.com (2603:10b6:303:80:cafe::d8) by MW4P223CA0028.outlook.office365.com (2603:10b6:303:80::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.20 via Frontend Transport; Tue, 15 Mar 2022 11:02:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.235) by CO1NAM11FT013.mail.protection.outlook.com (10.13.174.227) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5061.22 via Frontend Transport; Tue, 15 Mar 2022 11:02:44 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Tue, 15 Mar 2022 11:02:35 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Tue, 15 Mar 2022 04:02:34 -0700 Received: from dev-r-vrt-138.mtr.labs.mlnx (10.127.8.10) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.986.22 via Frontend Transport; Tue, 15 Mar 2022 04:02:32 -0700 From: Roi Dayan To: CC: Roi Dayan , Maor Dickman , "Jakub Kicinski" , "David S. Miller" , "Jamal Hadi Salim" , Jiri Pirko Subject: [PATCH net-next v2 2/3] net/mlx5e: MPLSoUDP decap, use vlan push_eth instead of pedit Date: Tue, 15 Mar 2022 13:02:10 +0200 Message-ID: <20220315110211.1581468-3-roid@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220315110211.1581468-1-roid@nvidia.com> References: <20220315110211.1581468-1-roid@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f3c06ac0-53b1-43d8-c152-08da067354e9 X-MS-TrafficTypeDiagnostic: DM6PR12MB4481:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0APXOreBZHeuc6wg1Uw5DbWaSmQKROuhggKvyNQy6IOR8rqkHbnhcApHi173Xe4QNeoh28OTvpU8xAYM/Cewq9Sz8ybPVekKW3t+RRKoENRi5p2NMrcSkD4WGMlQUo6e7y923gAAYw+IHzj76lwrcRn9oGYLEtJLcep7tfBZJRAtH//hEomIzkLG+LG6HXL5ULSPm5j9NIhXcRohibKpdvRhXK5Bsh3zF2Qx1QFf+fElLxOI4iHg8p1LWto+zeXc4QyH23yBL+tZQAR4xoYpfPrfxinJHNx0YYemOQfBaBCTdbvZ7p3p8NjbztyC8n5xGZ21+VbHvArOlfQ2FZPYZ//jpBAN6i0/kn/J95yteT6S3Tr5k6JUzHigMBR1Ur7s9CrPGV2X+mtTDkwLrSaKlmwquYyCzAPCX612Mo3/Odoflg17Oz5miNNGcR0NK9kjuXW0mLlejMtzBqGpGjHOs0CBME84qwP4JrFmA68rYEOzoMRxFlZVexoIW6OOyw0QpWRqEXPgZhALeZxGmSiI1gJrkGBKFOeDO4MrtUvTDGLOutO2Mc9atc1dA5i3ncqHiAUtg+d4neMg2e8bUoaAP3/th8xvbXhyFeDAJxozPlFA+vqKvdRMKs97X/VQc7WrYgr8eVcW1CqgIPsTvKf5S2Q7gabj8rHvzHWhGTGU8ICN5mDhW9uPMK1tbaT1EZZabXHO9FxL3ro2gtk4hEfg7Q== X-Forefront-Antispam-Report: CIP:12.22.5.235;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:mail.nvidia.com;PTR:InfoNoRecords;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(36860700001)(107886003)(70586007)(8676002)(186003)(4326008)(81166007)(2906002)(6666004)(70206006)(26005)(1076003)(356005)(5660300002)(82310400004)(426003)(30864003)(316002)(47076005)(36756003)(336012)(54906003)(6916009)(508600001)(86362001)(8936002)(83380400001)(2616005)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Mar 2022 11:02:44.0551 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f3c06ac0-53b1-43d8-c152-08da067354e9 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[12.22.5.235];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT013.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4481 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Maor Dickman Currently action pedit of source and destination MACs is used to fill the MACs in L2 push step in MPLSoUDP decap offload, this isn't aligned to tc SW which use vlan eth_push action to do this. To fix that, offload support for vlan veth_push action is added together with mpls pop action, and deprecate the use of pedit of MACs. Flow example: filter protocol mpls_uc pref 1 flower chain 0 filter protocol mpls_uc pref 1 flower chain 0 handle 0x1 eth_type 8847 mpls_label 555 enc_dst_port 6635 in_hw in_hw_count 1 action order 1: tunnel_key unset pipe index 2 ref 1 bind 1 used_hw_stats delayed action order 2: mpls pop protocol ip pipe index 2 ref 1 bind 1 used_hw_stats delayed action order 3: vlan push_eth dst_mac de:a2:ec:d6:69:c8 src_mac de:a2:ec:d6:69:c8 pipe index 2 ref 1 bind 1 used_hw_stats delayed action order 4: mirred (Egress Redirect to device enp8s0f0_0) stolen index 2 ref 1 bind 1 used_hw_stats delayed Signed-off-by: Maor Dickman Reviewed-by: Roi Dayan --- .../mellanox/mlx5/core/en/tc/act/act.c | 6 ++ .../mellanox/mlx5/core/en/tc/act/act.h | 1 + .../mellanox/mlx5/core/en/tc/act/mirred.c | 5 ++ .../mellanox/mlx5/core/en/tc/act/mpls.c | 7 ++- .../mellanox/mlx5/core/en/tc/act/pedit.c | 59 +++---------------- .../mellanox/mlx5/core/en/tc/act/pedit.h | 3 +- .../mellanox/mlx5/core/en/tc/act/vlan.c | 16 +++-- .../mlx5/core/en/tc/act/vlan_mangle.c | 4 +- .../ethernet/mellanox/mlx5/core/en/tc_priv.h | 1 - .../mellanox/mlx5/core/en/tc_tun_encap.c | 10 ++-- .../net/ethernet/mellanox/mlx5/core/eswitch.h | 1 + 11 files changed, 43 insertions(+), 70 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.c index cb8f7593a00c..24403593b952 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.c @@ -35,6 +35,12 @@ static struct mlx5e_tc_act *tc_acts_fdb[NUM_FLOW_ACTIONS] = { NULL, /* FLOW_ACTION_CT_METADATA, */ &mlx5e_tc_act_mpls_push, &mlx5e_tc_act_mpls_pop, + NULL, /* FLOW_ACTION_MPLS_MANGLE, */ + NULL, /* FLOW_ACTION_GATE, */ + NULL, /* FLOW_ACTION_PPPOE_PUSH, */ + NULL, /* FLOW_ACTION_JUMP, */ + NULL, /* FLOW_ACTION_PIPE, */ + &mlx5e_tc_act_vlan, }; /* Must be aligned with enum flow_action_id. */ diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.h b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.h index 94a7cf38d6b1..2616aee6ebf0 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.h @@ -22,6 +22,7 @@ struct mlx5e_tc_act_parse_state { bool encap; bool decap; bool mpls_push; + bool eth_push; bool ptype_host; const struct ip_tunnel_info *tun_info; struct mlx5e_mpls_info mpls_info; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mirred.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mirred.c index 05a42fb4ba97..14cfa39d30f7 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mirred.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mirred.c @@ -125,6 +125,11 @@ tc_act_can_offload_mirred(struct mlx5e_tc_act_parse_state *parse_state, return false; } + if (flow_flag_test(parse_state->flow, L3_TO_L2_DECAP) && !parse_state->eth_push) { + NL_SET_ERR_MSG_MOD(extack, "mpls pop is only supported with vlan eth push"); + return false; + } + if (mlx5e_is_ft_flow(flow) && out_dev == priv->netdev) { /* Ignore forward to self rules generated * by adding both mlx5 devs to the flow table diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mpls.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mpls.c index 96a80e03d129..f106190bf37c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mpls.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mpls.c @@ -57,12 +57,13 @@ tc_act_can_offload_mpls_pop(struct mlx5e_tc_act_parse_state *parse_state, filter_dev = attr->parse_attr->filter_dev; /* we only support mpls pop if it is the first action + * or it is second action after tunnel key unset * and the filter net device is bareudp. Subsequent * actions can be pedit and the last can be mirred * egress redirect. */ - if (act_index) { - NL_SET_ERR_MSG_MOD(extack, "mpls pop supported only as first action"); + if ((act_index == 1 && !parse_state->decap) || act_index > 1) { + NL_SET_ERR_MSG_MOD(extack, "mpls pop supported only as first action or with decap"); return false; } @@ -80,7 +81,7 @@ tc_act_parse_mpls_pop(struct mlx5e_tc_act_parse_state *parse_state, struct mlx5e_priv *priv, struct mlx5_flow_attr *attr) { - attr->parse_attr->eth.h_proto = act->mpls_pop.proto; + attr->esw_attr->eth.h_proto = act->mpls_pop.proto; attr->action |= MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT; flow_flag_set(parse_state->flow, L3_TO_L2_DECAP); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/pedit.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/pedit.c index 39f8f71bed9e..47597c524e59 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/pedit.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/pedit.c @@ -42,13 +42,12 @@ set_pedit_val(u8 hdr_type, u32 mask, u32 val, u32 offset, return -EOPNOTSUPP; } -static int -parse_pedit_to_modify_hdr(struct mlx5e_priv *priv, - const struct flow_action_entry *act, int namespace, - struct mlx5e_tc_flow_parse_attr *parse_attr, - struct netlink_ext_ack *extack) +int +mlx5e_tc_act_pedit_parse_action(struct mlx5e_priv *priv, + const struct flow_action_entry *act, int namespace, + struct pedit_headers_action *hdrs, + struct netlink_ext_ack *extack) { - struct pedit_headers_action *hdrs = parse_attr->hdrs; u8 cmd = (act->id == FLOW_ACTION_MANGLE) ? 0 : 1; u8 htype = act->mangle.htype; int err = -EOPNOTSUPP; @@ -79,46 +78,6 @@ parse_pedit_to_modify_hdr(struct mlx5e_priv *priv, return err; } -static int -parse_pedit_to_reformat(const struct flow_action_entry *act, - struct mlx5e_tc_flow_parse_attr *parse_attr, - struct netlink_ext_ack *extack) -{ - u32 mask, val, offset; - u32 *p; - - if (act->id != FLOW_ACTION_MANGLE) { - NL_SET_ERR_MSG_MOD(extack, "Unsupported action id"); - return -EOPNOTSUPP; - } - - if (act->mangle.htype != FLOW_ACT_MANGLE_HDR_TYPE_ETH) { - NL_SET_ERR_MSG_MOD(extack, "Only Ethernet modification is supported"); - return -EOPNOTSUPP; - } - - mask = ~act->mangle.mask; - val = act->mangle.val; - offset = act->mangle.offset; - p = (u32 *)&parse_attr->eth; - *(p + (offset >> 2)) |= (val & mask); - - return 0; -} - -int -mlx5e_tc_act_pedit_parse_action(struct mlx5e_priv *priv, - const struct flow_action_entry *act, int namespace, - struct mlx5e_tc_flow_parse_attr *parse_attr, - struct mlx5e_tc_flow *flow, - struct netlink_ext_ack *extack) -{ - if (flow && flow_flag_test(flow, L3_TO_L2_DECAP)) - return parse_pedit_to_reformat(act, parse_attr, extack); - - return parse_pedit_to_modify_hdr(priv, act, namespace, parse_attr, extack); -} - static bool tc_act_can_offload_pedit(struct mlx5e_tc_act_parse_state *parse_state, const struct flow_action_entry *act, @@ -141,20 +100,16 @@ tc_act_parse_pedit(struct mlx5e_tc_act_parse_state *parse_state, ns_type = mlx5e_get_flow_namespace(flow); - err = mlx5e_tc_act_pedit_parse_action(flow->priv, act, ns_type, attr->parse_attr, - flow, parse_state->extack); + err = mlx5e_tc_act_pedit_parse_action(flow->priv, act, ns_type, attr->parse_attr->hdrs, + parse_state->extack); if (err) return err; - if (flow_flag_test(flow, L3_TO_L2_DECAP)) - goto out; - attr->action |= MLX5_FLOW_CONTEXT_ACTION_MOD_HDR; if (ns_type == MLX5_FLOW_NAMESPACE_FDB) esw_attr->split_count = esw_attr->out_count; -out: return 0; } diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/pedit.h b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/pedit.h index 258f030a2dc6..434c8bd710a2 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/pedit.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/pedit.h @@ -24,8 +24,7 @@ struct pedit_headers_action { int mlx5e_tc_act_pedit_parse_action(struct mlx5e_priv *priv, const struct flow_action_entry *act, int namespace, - struct mlx5e_tc_flow_parse_attr *parse_attr, - struct mlx5e_tc_flow *flow, + struct pedit_headers_action *hdrs, struct netlink_ext_ack *extack); #endif /* __MLX5_EN_TC_ACT_PEDIT_H__ */ diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/vlan.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/vlan.c index 6378b7558ba2..cf1acf678270 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/vlan.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/vlan.c @@ -34,7 +34,8 @@ parse_tc_vlan_action(struct mlx5e_priv *priv, const struct flow_action_entry *act, struct mlx5_esw_flow_attr *attr, u32 *action, - struct netlink_ext_ack *extack) + struct netlink_ext_ack *extack, + struct mlx5e_tc_act_parse_state *parse_state) { u8 vlan_idx = attr->total_vlan; @@ -84,6 +85,13 @@ parse_tc_vlan_action(struct mlx5e_priv *priv, *action |= MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH; } break; + case FLOW_ACTION_VLAN_PUSH_ETH: + if (!flow_flag_test(parse_state->flow, L3_TO_L2_DECAP)) + return -EOPNOTSUPP; + parse_state->eth_push = true; + memcpy(attr->eth.h_dest, act->vlan_push_eth.dst, ETH_ALEN); + memcpy(attr->eth.h_source, act->vlan_push_eth.src, ETH_ALEN); + break; default: NL_SET_ERR_MSG_MOD(extack, "Unexpected action id for VLAN"); return -EINVAL; @@ -109,7 +117,7 @@ mlx5e_tc_act_vlan_add_push_action(struct mlx5e_priv *priv, }; int err; - err = parse_tc_vlan_action(priv, &vlan_act, attr->esw_attr, &attr->action, extack); + err = parse_tc_vlan_action(priv, &vlan_act, attr->esw_attr, &attr->action, extack, NULL); if (err) return err; @@ -139,7 +147,7 @@ mlx5e_tc_act_vlan_add_pop_action(struct mlx5e_priv *priv, priv->netdev->lower_level; while (nest_level--) { err = parse_tc_vlan_action(priv, &vlan_act, attr->esw_attr, &attr->action, - extack); + extack, NULL); if (err) return err; } @@ -174,7 +182,7 @@ tc_act_parse_vlan(struct mlx5e_tc_act_parse_state *parse_state, parse_state->extack); } else { err = parse_tc_vlan_action(priv, act, esw_attr, &attr->action, - parse_state->extack); + parse_state->extack, parse_state); } if (err) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/vlan_mangle.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/vlan_mangle.c index 28444d4ffd73..9a8a1a6bd99e 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/vlan_mangle.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/vlan_mangle.c @@ -43,8 +43,8 @@ mlx5e_tc_act_vlan_add_rewrite_action(struct mlx5e_priv *priv, int namespace, return -EOPNOTSUPP; } - err = mlx5e_tc_act_pedit_parse_action(priv, &pedit_act, namespace, parse_attr, - NULL, extack); + err = mlx5e_tc_act_pedit_parse_action(priv, &pedit_act, namespace, parse_attr->hdrs, + extack); *action |= MLX5_FLOW_CONTEXT_ACTION_MOD_HDR; return err; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_priv.h b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_priv.h index 03c953dacb09..3b74a6fd5c43 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_priv.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_priv.h @@ -41,7 +41,6 @@ struct mlx5e_tc_flow_parse_attr { struct pedit_headers_action hdrs[__PEDIT_CMD_MAX]; struct mlx5e_tc_mod_hdr_acts mod_hdr_acts; int mirred_ifindex[MLX5_MAX_FLOW_FWD_VPORTS]; - struct ethhdr eth; struct mlx5e_tc_act_parse_state parse_state; }; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c index 5105c8018d37..5aff97914367 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c @@ -906,20 +906,18 @@ int mlx5e_attach_decap(struct mlx5e_priv *priv, struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; struct mlx5_esw_flow_attr *attr = flow->attr->esw_attr; struct mlx5_pkt_reformat_params reformat_params; - struct mlx5e_tc_flow_parse_attr *parse_attr; struct mlx5e_decap_entry *d; struct mlx5e_decap_key key; uintptr_t hash_key; int err = 0; - parse_attr = flow->attr->parse_attr; - if (sizeof(parse_attr->eth) > MLX5_CAP_ESW(priv->mdev, max_encap_header_size)) { + if (sizeof(attr->eth) > MLX5_CAP_ESW(priv->mdev, max_encap_header_size)) { NL_SET_ERR_MSG_MOD(extack, "encap header larger than max supported"); return -EOPNOTSUPP; } - key.key = parse_attr->eth; + key.key = attr->eth; hash_key = hash_decap_info(&key); mutex_lock(&esw->offloads.decap_tbl_lock); d = mlx5e_decap_get(priv, &key, hash_key); @@ -949,8 +947,8 @@ int mlx5e_attach_decap(struct mlx5e_priv *priv, memset(&reformat_params, 0, sizeof(reformat_params)); reformat_params.type = MLX5_REFORMAT_TYPE_L3_TUNNEL_TO_L2; - reformat_params.size = sizeof(parse_attr->eth); - reformat_params.data = &parse_attr->eth; + reformat_params.size = sizeof(attr->eth); + reformat_params.data = &attr->eth; d->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev, &reformat_params, MLX5_FLOW_NAMESPACE_FDB); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h index 973281bdb4a2..bac5160837c5 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h @@ -474,6 +474,7 @@ struct mlx5_esw_flow_attr { int src_port_rewrite_act_id; } dests[MLX5_MAX_FLOW_FWD_VPORTS]; struct mlx5_rx_tun_attr *rx_tun_attr; + struct ethhdr eth; struct mlx5_pkt_reformat *decap_pkt_reformat; }; From patchwork Tue Mar 15 11:02:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roi Dayan X-Patchwork-Id: 12781322 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 506D7C433EF for ; Tue, 15 Mar 2022 11:02:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347784AbiCOLEB (ORCPT ); Tue, 15 Mar 2022 07:04:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347782AbiCOLD6 (ORCPT ); Tue, 15 Mar 2022 07:03:58 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2063.outbound.protection.outlook.com [40.107.243.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0EBAF6 for ; Tue, 15 Mar 2022 04:02:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jeS+XvfAZ3D+7Oeq6FMp/JJuoiqHlDHxhiJ4ZMK7qOsTxrsiFo/r6S3k+jzQrS0p790Uyyltm7w8J184eFyT/krtpf4KTLmCoX5KTRhidA16IQjp6gfLhEppVFqWwt/OLmaU2awmfcGxPX4nh9fKrlIqUoo/mEn0zE1HL9aiD1xy+7QQaPjnFawC5r2GcoRGhX5UplOnY9I4RSm+Ee4zaxi9IyNy0B8hWwZwwbO8Dj2rS9qivWWtqJHrd0KjB87y4yoE5ZY+ne0AV7xn9XGX3z5CDf2hphQJ6QVq3y9VcKGnee+e2On4dSrcHf4VuVtBepPfUrPWB1d9CDGGZZoQFA== 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=0MbbdebdXOBO0OFxvR2tVNdo5UQw7I4PHEyHD9wIat8=; b=W/80gAM+C9xkkNVewbZHzPp5Amssr9/JYMuV0SEGYjVZ/w1jEEMn4QiGZmH0xpRMJsR4DDNmjOlu8XBRv0G0e1bgKt2iZzUlxsZ6PxTwgYkyO9HFyy1dQ5ddVazGZ0i5yJZfxO9yPfaJtRrY9IHUPKzm6K8WNpJEfyLARPfFssoBJtcHd7abpftvYdhvC3HHyx6F85gB7nY61EUHTRihgjZQ9GssZ9I9agUAXgS/5+Azl/q/pnBuexISoYK4eNeqEQJVSc0zJzo6g3XIw+lQDPLc3iYlWp7xXpCAOjqh57rrDkgaJaeED6ZEqV12rYeu3zK5hKcDHSgepV+oMxhNoQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0MbbdebdXOBO0OFxvR2tVNdo5UQw7I4PHEyHD9wIat8=; b=hWnGzsww90MEAH4+H7+GkQ5H6KgEtL7Pof4Oh+7N4PNngoZ7cdtRU3svaRL07DO+TJkbiV3NhUQ5P7SZCRaBgaJf4Q+35DZZ3kBH1jfKykupvosPWY7gUNqqKmXqndLSA1D7Y8mFetPeF9nvG97K3papi6CcL407gUXRHERzUuOdsvkHRtjqh/+U1iHFjfJ5PJub9v4mipIwwAonmJCsSg4B23BKFgOrfmppSKxRJpWG/fNsxhAVAcj9gxP2N+t0iGgw+z/Ex4p5FEK3EfCI/wcQuFDwdEL8BuXGm0PvzWkm9efTHz9ltXzQqkijYRUiL65jogtorLpWgHFjE4UzPA== Received: from MWHPR14CA0031.namprd14.prod.outlook.com (2603:10b6:300:12b::17) by CH2PR12MB3878.namprd12.prod.outlook.com (2603:10b6:610:2a::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.22; Tue, 15 Mar 2022 11:02:44 +0000 Received: from CO1NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:300:12b:cafe::82) by MWHPR14CA0031.outlook.office365.com (2603:10b6:300:12b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.14 via Frontend Transport; Tue, 15 Mar 2022 11:02:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.238) by CO1NAM11FT032.mail.protection.outlook.com (10.13.174.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5061.22 via Frontend Transport; Tue, 15 Mar 2022 11:02:43 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Tue, 15 Mar 2022 11:02:38 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Tue, 15 Mar 2022 04:02:37 -0700 Received: from dev-r-vrt-138.mtr.labs.mlnx (10.127.8.10) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.986.22 via Frontend Transport; Tue, 15 Mar 2022 04:02:35 -0700 From: Roi Dayan To: CC: Roi Dayan , Maor Dickman , "Jakub Kicinski" , "David S. Miller" , "Jamal Hadi Salim" , Jiri Pirko Subject: [PATCH net-next v2 3/3] net/mlx5e: MPLSoUDP encap, support action vlan pop_eth explicitly Date: Tue, 15 Mar 2022 13:02:11 +0200 Message-ID: <20220315110211.1581468-4-roid@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220315110211.1581468-1-roid@nvidia.com> References: <20220315110211.1581468-1-roid@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 481ddb99-ef53-42c8-5d14-08da067354ba X-MS-TrafficTypeDiagnostic: CH2PR12MB3878:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TxSlESCGsXpY55QFaghmDxZII0sboXCqNRPLHEPbzEqX4R08GuFPFBhu4StPFfY6xlxVC/389QArEYPDCCnz9xN7PfvLtvAcLzqqDa2KGyv8FF4La1dgVTPFLu5RSTrki6MScZnQmp4SfELSJzeVfpu1dc5jkMjTGjvjiTuk/pW/wfbtjg3q3b6P1nntoTIt+qegFwu6uUcTEOL2JcLjMlp1lAXQO5QFIK+pjIpPBuU/k5uazJAoMbYna3xI/8yAHdIhMHhgXfXK3+OHzgWPpyDU4WWCynroItaqQXFaICCR8WU8zka7I53hajOh33p3fGOfeiz7Md8drBYLZ9s5BDGyT0TB8YV3yl7YWtFUotb05Uh8xgwty3LtFc8PbyDF66vO9ldZSg2KeP4CN7L5ptTs7tjPqGyr1FwDbSLQ+dcrb0APkIUx43bLWlD4fvCfA/YJBZyTS1l9PhJbyKxbAfNkm16mAQn43upTC725VzCCQhKGS4rO0EuccTAfYSoJ3f5c42rVOu9tZi8Dd2EgmpiRvPofMIGs/lG6zEa96mf0rzk1Gou9OSARLNWgAZ0/dS6HgcPHVg7O63ia2AGJJSJgLF/EzksPqBtUBF8WqhYvQFlT04ig3ZK5ND0lK6A87DcNTwP/fUnWLiDldq1Y93Yhp1DCvtN6WUXXEqfvFIrqRXjot79cRzVFKhWIwvqH1NMuPUKtNl0ShJye8pKGqw== X-Forefront-Antispam-Report: CIP:12.22.5.238;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:mail.nvidia.com;PTR:InfoNoRecords;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(40470700004)(46966006)(36860700001)(36756003)(70586007)(70206006)(4326008)(5660300002)(8676002)(40460700003)(6916009)(54906003)(83380400001)(316002)(8936002)(82310400004)(2616005)(426003)(336012)(86362001)(6666004)(186003)(81166007)(26005)(356005)(508600001)(47076005)(2906002)(1076003)(107886003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Mar 2022 11:02:43.7758 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 481ddb99-ef53-42c8-5d14-08da067354ba X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[12.22.5.238];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB3878 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Maor Dickman Currently the MPLSoUDP encap offload does the L2 pop implicitly while adding such action explicitly (vlan eth_push) will cause the rule to not be offloaded. Solve it by adding offload support for vlan eth_push in case of MPLSoUDP decap case. Flow example: filter root protocol ip pref 1 flower chain 0 filter root protocol ip pref 1 flower chain 0 handle 0x1 eth_type ipv4 dst_ip 2.2.2.22 src_ip 2.2.2.21 in_hw in_hw_count 1 action order 1: vlan pop_eth pipe index 1 ref 1 bind 1 used_hw_stats delayed action order 2: mpls push protocol mpls_uc label 555 tc 3 ttl 255 pipe index 1 ref 1 bind 1 used_hw_stats delayed action order 3: tunnel_key set src_ip 8.8.8.21 dst_ip 8.8.8.22 dst_port 6635 csum tos 0x4 ttl 6 pipe index 1 ref 1 bind 1 used_hw_stats delayed action order 4: mirred (Egress Redirect to device bareudp0) stolen index 1 ref 1 bind 1 used_hw_stats delayed Signed-off-by: Maor Dickman Reviewed-by: Roi Dayan --- drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.h | 1 + drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mirred.c | 5 +++++ drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/vlan.c | 3 +++ 4 files changed, 10 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.c index 24403593b952..af37a8d247a1 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.c @@ -41,6 +41,7 @@ static struct mlx5e_tc_act *tc_acts_fdb[NUM_FLOW_ACTIONS] = { NULL, /* FLOW_ACTION_JUMP, */ NULL, /* FLOW_ACTION_PIPE, */ &mlx5e_tc_act_vlan, + &mlx5e_tc_act_vlan, }; /* Must be aligned with enum flow_action_id. */ diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.h b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.h index 2616aee6ebf0..f34714c5ddd4 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.h @@ -23,6 +23,7 @@ struct mlx5e_tc_act_parse_state { bool decap; bool mpls_push; bool eth_push; + bool eth_pop; bool ptype_host; const struct ip_tunnel_info *tun_info; struct mlx5e_mpls_info mpls_info; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mirred.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mirred.c index 14cfa39d30f7..2b002c6a2e73 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mirred.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mirred.c @@ -125,6 +125,11 @@ tc_act_can_offload_mirred(struct mlx5e_tc_act_parse_state *parse_state, return false; } + if (parse_state->eth_pop && !parse_state->mpls_push) { + NL_SET_ERR_MSG_MOD(extack, "vlan pop eth is supported only with mpls push"); + return false; + } + if (flow_flag_test(parse_state->flow, L3_TO_L2_DECAP) && !parse_state->eth_push) { NL_SET_ERR_MSG_MOD(extack, "mpls pop is only supported with vlan eth push"); return false; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/vlan.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/vlan.c index cf1acf678270..b86ac604d0c2 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/vlan.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/vlan.c @@ -85,6 +85,9 @@ parse_tc_vlan_action(struct mlx5e_priv *priv, *action |= MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH; } break; + case FLOW_ACTION_VLAN_POP_ETH: + parse_state->eth_pop = true; + break; case FLOW_ACTION_VLAN_PUSH_ETH: if (!flow_flag_test(parse_state->flow, L3_TO_L2_DECAP)) return -EOPNOTSUPP;