From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C7426A034F for ; Wed, 10 Nov 2021 07:57:07 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BFB4B40142; Wed, 10 Nov 2021 07:57:07 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2055.outbound.protection.outlook.com [40.107.244.55]) by mails.dpdk.org (Postfix) with ESMTP id 9FF6040683 for ; Wed, 10 Nov 2021 07:57:05 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X2b3tEiTgCsTvmxSNTBB+NIcb4Eh09CG0/griHweq6GTU8M4G4EHoNv1Jsu9IyW7oLFQeGkCe1xWb4aK7yrCu6c8QvJTGsZibK/97MBdC0Rvmv/QFsH/qsoKESqDC+ZbxqfCfSGr9H6Dk5cGotVuBWNR4qANvg2V6xINL41CkZP/zBDCy10mVNqYXClBmje9IRZ8xg1X6LwpWg0yhEAEJpWG1QxOk+HW++c66XZZjfoL87q5ZcuZTSM3O1ekKFT1POksWXEYEXWmNJ9ebyHnO1ACxYqNTW3x00/IdynV28juv4m89C5JEmKHxmjjqqhh79kerSD8tctZWJ0nJTAImw== 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=lKIVrqEWwyue5ijGhWEIX55gCC4UH1EOjH4mZc7z9MU=; b=P4lenylGU3NRygp6owPsBOQMGNCDqJJ69tQkWNo6L/DZJXMjBg1EQzupcvnoJV//IMqg3oPJSAoxZIy3E/JPBKlXOFxkjV4FF7XOpzoxdOQV9dEA3XB/noRV1v9mRxEWOj9WimTOt1ycc3V3KwOFAu6StvulekzQ680i9H4MQnQl1ND9iFmvz0Q4e++zBt+rPqp/XQ9uIXyW/5xFY59k61bK4BxUtMQY+tY3tiLmgx3UF3G7TxMk0W3H1V7BZ5ekpPyNb4hgexHsf4WqMM+SVCBGYRbLrorwItGICH0AERXQjrIEBMoEh422vE2n5l8C/fpVo2CJbSVGaeqGZW02Ng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine 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=lKIVrqEWwyue5ijGhWEIX55gCC4UH1EOjH4mZc7z9MU=; b=KAN5UCccE4JY2zEEMDGVE3eD8Ix9BiiJtAkJwto9f2hQv9gEDnhoyoJ6q8YtWtjWmoY9fLg4AHpve9l3mYPQHPU1aKwxxSuMRABmlIE7sbtlZkZthxpYPLAmxgoRKAYL4YhB0Fdsvvm64EYgpVmXRtT4HZ+lCnUoXLVEcH2bsVGdLzaByPyLhe6D6d6FN0PcrxiRvnyKC/K9kHhgMKSy/ZgIn6iKuz/BNCXtijKFfjReC5/F3aZMZCAmyR6xjOPkKwcTO3t7s+RigOGIJytPtROChdkSQAvqy12Ltuau/suXc7Y3Ir3rZHG1IBYtFpQBIKbIkMREgjMcDrWZbsEilQ== Received: from DM6PR02CA0105.namprd02.prod.outlook.com (2603:10b6:5:1f4::46) by BY5PR12MB5541.namprd12.prod.outlook.com (2603:10b6:a03:1c6::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.16; Wed, 10 Nov 2021 06:57:03 +0000 Received: from DM6NAM11FT057.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1f4:cafe::28) by DM6PR02CA0105.outlook.office365.com (2603:10b6:5:1f4::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.16 via Frontend Transport; Wed, 10 Nov 2021 06:57:03 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT057.mail.protection.outlook.com (10.13.172.252) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4669.10 via Frontend Transport; Wed, 10 Nov 2021 06:57:02 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 10 Nov 2021 06:56:58 +0000 From: Xueming Li To: Dapeng Yu CC: Luca Boccassi , Qi Zhang , dpdk stable Date: Wed, 10 Nov 2021 14:31:46 +0800 Message-ID: <20211110063216.2744012-223-xuemingl@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211110063216.2744012-1-xuemingl@nvidia.com> References: <20211110063216.2744012-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 29958f0c-6855-4aee-fe53-08d9a4174cd8 X-MS-TrafficTypeDiagnostic: BY5PR12MB5541: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rMxa3SZkFSRqUJLTmVkjsv5cgnkk769JQ5pPgmxsIIky9DIlZeq4Vi7hpkJo0oNZ/3J47jay1Z6Z5ouU5X6aixa5eYvf0sW1iHGTaDXBmSx46NW+QQFmqjBABUYsENx3PlTcBv7QMIKGV+wpKyKvlskQUb3cx0rz/ahoC1UOEEf8A7GgDtcg2cre9CogkRdeDLk0+2E2+s6518DO/WSlQLtqavsjrOVL9/dgTufd8If76CmRAYbZhM0N5WnoGVE928tefRxirAl+yWdptCcCD+JOoZz7dsLnDY+FOczbiVmxeimY41A2qDvv+dp1QJP31ddA+HKdjpPD6rLWMts/imYXdwjdXYtTAPKiLVgZYI2k0JbA3jmVZt28bCQLbCuXja7E1jRzz8qn9EBQetpw9vTQlWdmEWG61NjH2kERcqvIOldXN6Tjaioq7k6vD2Y5GIXAlvDdF5QbjRES1cbFqahQWnWz9I2rCzO2g9SlWQL8npTTaBjqOBWT35DxfY9p55V7Rrd+otJY04pnUTnpaRQATiRANGRqZ/7rwzF51/hkHlvnXuCSgYQ3kd7GT+rXWinflFOhnYImKn+8n6fZVMRELf0XdKbCbE/85kGHazhEKMIefnBrWmgAFM6zA+r9yjzycy55KrUkfR+Ev/SsrCLCgFaxyjdFHbZmfQZ4CO/F0cua2BZXnBtl0yGvC/4H2lhLFcV3YCAYn+zdjH4obRr3M6psUT5kRuLKfCpgCD2if2/cGb8hpOMbCB4cImV4fftT08hdnSWQi0UgC1G6pihkIyhZ45crQ999SG2J2OyfUY3xnJvGOgTEeJjrfEFHrFMtCTvpSS66/P1805nREQ== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(53546011)(54906003)(8676002)(86362001)(26005)(36756003)(5660300002)(2906002)(36906005)(7636003)(70206006)(82310400003)(70586007)(55016002)(356005)(6916009)(8936002)(7696005)(4326008)(36860700001)(6666004)(336012)(6286002)(316002)(47076005)(4001150100001)(83380400001)(426003)(1076003)(186003)(2616005)(508600001)(966005)(16526019); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2021 06:57:02.7209 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 29958f0c-6855-4aee-fe53-08d9a4174cd8 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT057.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB5541 Subject: [dpdk-stable] patch 'net/ice: save rule on switch filter creation' has been queued to stable release 20.11.4 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/12/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/11c0e8ab51af1409f5d9208446a8749edd19deec Thanks. Xueming Li --- >From 11c0e8ab51af1409f5d9208446a8749edd19deec Mon Sep 17 00:00:00 2001 From: Dapeng Yu Date: Thu, 4 Nov 2021 16:45:34 +0800 Subject: [PATCH] net/ice: save rule on switch filter creation Cc: Xueming Li [ upstream commit 9fda31c3229ca6e036cae80392578ed6e5a51119 ] The VSI number, lookup elements and rule information for creating switch filter are abandoned when switch filter is created in original implementation. This patch saved the abandoned data in RTE flow, it is for future use on replay when handling exception at flow redirect. Signed-off-by: Dapeng Yu Acked-by: Qi Zhang --- drivers/net/ice/ice_switch_filter.c | 79 +++++++++++++++++++++-------- 1 file changed, 59 insertions(+), 20 deletions(-) diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c index c383cade65..1ee6e9715e 100644 --- a/drivers/net/ice/ice_switch_filter.c +++ b/drivers/net/ice/ice_switch_filter.c @@ -142,6 +142,28 @@ static struct ice_flow_parser ice_switch_dist_parser_comms; static struct ice_flow_parser ice_switch_perm_parser_os; static struct ice_flow_parser ice_switch_perm_parser_comms; +enum ice_sw_fltr_status { + ICE_SW_FLTR_ADDED, + ICE_SW_FLTR_RMV_FAILED_ON_RIDRECT, + ICE_SW_FLTR_ADD_FAILED_ON_RIDRECT, +}; + +struct ice_switch_filter_conf { + enum ice_sw_fltr_status fltr_status; + + struct ice_rule_query_data sw_query_data; + + /* + * The lookup elements and rule info are saved here when filter creation + * succeeds. + */ + uint16_t vsi_num; + uint16_t lkups_num; + struct ice_adv_lkup_elem *lkups; + struct ice_adv_rule_info rule_info; +}; + + static struct ice_pattern_match_item ice_switch_pattern_dist_os[] = { {pattern_ethertype, @@ -396,7 +418,7 @@ ice_switch_create(struct ice_adapter *ad, struct ice_pf *pf = &ad->pf; struct ice_hw *hw = ICE_PF_TO_HW(pf); struct ice_rule_query_data rule_added = {0}; - struct ice_rule_query_data *filter_ptr; + struct ice_switch_filter_conf *filter_conf_ptr; struct ice_adv_lkup_elem *list = ((struct sw_meta *)meta)->list; uint16_t lkups_cnt = @@ -418,18 +440,26 @@ ice_switch_create(struct ice_adapter *ad, } ret = ice_add_adv_rule(hw, list, lkups_cnt, rule_info, &rule_added); if (!ret) { - filter_ptr = rte_zmalloc("ice_switch_filter", - sizeof(struct ice_rule_query_data), 0); - if (!filter_ptr) { + filter_conf_ptr = rte_zmalloc("ice_switch_filter", + sizeof(struct ice_switch_filter_conf), 0); + if (!filter_conf_ptr) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, "No memory for ice_switch_filter"); goto error; } - flow->rule = filter_ptr; - rte_memcpy(filter_ptr, - &rule_added, - sizeof(struct ice_rule_query_data)); + + filter_conf_ptr->sw_query_data = rule_added; + + filter_conf_ptr->vsi_num = + ice_get_hw_vsi_num(hw, rule_info->sw_act.vsi_handle); + filter_conf_ptr->lkups = list; + filter_conf_ptr->lkups_num = lkups_cnt; + filter_conf_ptr->rule_info = *rule_info; + + filter_conf_ptr->fltr_status = ICE_SW_FLTR_ADDED; + + flow->rule = filter_conf_ptr; } else { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, @@ -437,7 +467,6 @@ ice_switch_create(struct ice_adapter *ad, goto error; } - rte_free(list); rte_free(meta); return 0; @@ -448,6 +477,18 @@ error: return -rte_errno; } +static inline void +ice_switch_filter_rule_free(struct rte_flow *flow) +{ + struct ice_switch_filter_conf *filter_conf_ptr = + (struct ice_switch_filter_conf *)flow->rule; + + if (filter_conf_ptr) + rte_free(filter_conf_ptr->lkups); + + rte_free(filter_conf_ptr); +} + static int ice_switch_destroy(struct ice_adapter *ad, struct rte_flow *flow, @@ -455,20 +496,24 @@ ice_switch_destroy(struct ice_adapter *ad, { struct ice_hw *hw = &ad->hw; int ret; - struct ice_rule_query_data *filter_ptr; + struct ice_switch_filter_conf *filter_conf_ptr; - filter_ptr = (struct ice_rule_query_data *) + filter_conf_ptr = (struct ice_switch_filter_conf *) flow->rule; - if (!filter_ptr) { + if (!filter_conf_ptr || + filter_conf_ptr->fltr_status == ICE_SW_FLTR_ADD_FAILED_ON_RIDRECT) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, "no such flow" " create by switch filter"); + + ice_switch_filter_rule_free(flow); + return -rte_errno; } - ret = ice_rem_adv_rule_by_id(hw, filter_ptr); + ret = ice_rem_adv_rule_by_id(hw, &filter_conf_ptr->sw_query_data); if (ret) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, @@ -476,16 +521,10 @@ ice_switch_destroy(struct ice_adapter *ad, return -rte_errno; } - rte_free(filter_ptr); + ice_switch_filter_rule_free(flow); return ret; } -static void -ice_switch_filter_rule_free(struct rte_flow *flow) -{ - rte_free(flow->rule); -} - static uint64_t ice_switch_inset_get(const struct rte_flow_item pattern[], struct rte_flow_error *error, -- 2.33.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-11-10 14:17:11.695480832 +0800 +++ 0222-net-ice-save-rule-on-switch-filter-creation.patch 2021-11-10 14:17:02.037411394 +0800 @@ -1 +1 @@ -From 9fda31c3229ca6e036cae80392578ed6e5a51119 Mon Sep 17 00:00:00 2001 +From 11c0e8ab51af1409f5d9208446a8749edd19deec Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 9fda31c3229ca6e036cae80392578ed6e5a51119 ] @@ -13,2 +15,0 @@ -Cc: stable@dpdk.org - @@ -18,2 +19,2 @@ - drivers/net/ice/ice_switch_filter.c | 78 +++++++++++++++++++++-------- - 1 file changed, 58 insertions(+), 20 deletions(-) + drivers/net/ice/ice_switch_filter.c | 79 +++++++++++++++++++++-------- + 1 file changed, 59 insertions(+), 20 deletions(-) @@ -22 +23 @@ -index 6b0c1bff1e..d5add64c53 100644 +index c383cade65..1ee6e9715e 100644 @@ -25,3 +26,3 @@ -@@ -180,6 +180,27 @@ struct sw_meta { - struct ice_adv_rule_info rule_info; - }; +@@ -142,6 +142,28 @@ static struct ice_flow_parser ice_switch_dist_parser_comms; + static struct ice_flow_parser ice_switch_perm_parser_os; + static struct ice_flow_parser ice_switch_perm_parser_comms; @@ -50,4 +51,5 @@ - static struct ice_flow_parser ice_switch_dist_parser; - static struct ice_flow_parser ice_switch_perm_parser; - -@@ -359,7 +380,7 @@ ice_switch_create(struct ice_adapter *ad, ++ + static struct + ice_pattern_match_item ice_switch_pattern_dist_os[] = { + {pattern_ethertype, +@@ -396,7 +418,7 @@ ice_switch_create(struct ice_adapter *ad, @@ -62 +64 @@ -@@ -381,18 +402,26 @@ ice_switch_create(struct ice_adapter *ad, +@@ -418,18 +440,26 @@ ice_switch_create(struct ice_adapter *ad, @@ -96 +98 @@ -@@ -400,7 +429,6 @@ ice_switch_create(struct ice_adapter *ad, +@@ -437,7 +467,6 @@ ice_switch_create(struct ice_adapter *ad, @@ -104 +106 @@ -@@ -411,6 +439,18 @@ error: +@@ -448,6 +477,18 @@ error: @@ -123 +125 @@ -@@ -418,20 +458,24 @@ ice_switch_destroy(struct ice_adapter *ad, +@@ -455,20 +496,24 @@ ice_switch_destroy(struct ice_adapter *ad, @@ -152 +154 @@ -@@ -439,16 +483,10 @@ ice_switch_destroy(struct ice_adapter *ad, +@@ -476,16 +521,10 @@ ice_switch_destroy(struct ice_adapter *ad, @@ -167,2 +169,2 @@ - static bool - ice_switch_parse_pattern(const struct rte_flow_item pattern[], + static uint64_t + ice_switch_inset_get(const struct rte_flow_item pattern[],