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 E5305A034F 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 DD94C410F2; Wed, 10 Nov 2021 07:57:07 +0100 (CET) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2084.outbound.protection.outlook.com [40.107.96.84]) by mails.dpdk.org (Postfix) with ESMTP id 68B4940683 for ; Wed, 10 Nov 2021 07:57:06 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hnDeIO+Yhlt6i0ggFPttKtN8N//lpduu83lsoZyYHlRIZLZEmyi7xiGF9Y195cIM/OPkJSZhDnQXCu+YB137EbdAZWAyJcbQh7swNA60igYndIMOAY0KoiB6LTe9YDS3NUu10+2b1USq1yRJKrgASCuoyUeJolFMHUOyVrM3T6090se8nOz7IMebVCS89Pe3svMZcQE6TwHKgppq4VpDElNCWYorklhnWtOi6yB35v4MikUg4v7uUV0mzCRCsgyYKyP8vAXy2J9Bjk9oQi6QuZ/Umzve1F4eyQIWFv34PwulMFzD21SJ5WsqeOTUkueUMis5ovrgypqeVh21bwOdjg== 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=88deNEcltOA7x1P2uX0VSyCfguoKhaHgZvQRgIF5HFo=; b=Exwoa1LzS3eD+XpE53WV8iOLVJTly+D4M6VLogyFZCTtMR/eAXnNS2ugyBycK67++V2xcd+G1T2fCfn/kxadSGL46YioKTZRHhBinsSQdJL+yXqCu0TuWRR+YUI3P5j2aqujm58UYCfPDQQy8PHfONytP4bl65A/0YYxUMDH5ailIT5dYDx4qg4Zw+nQrngKoBHr1k3ToneN1HU7qsqiiK2pWZzv++xWU83DYBO19tiXxoRZWbYGylwIWXb0aCPWsMZKNl4Gc58hBygwJ7ldyQqInZmMJYvTyMuWo0WTslOXmGzz9s6d8DbVJGLQU2et8YBlHAUiQdLKBhdvwGWqUQ== 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=88deNEcltOA7x1P2uX0VSyCfguoKhaHgZvQRgIF5HFo=; b=U3OiWW3BCPR7wVPbWjeU0TGtegfVnWPSP6KH2k9Nob6wNAIZJD4u1dOqXhF25oD29NRiXlQkIO6spJ32BvmwN2Dz92/SMVRfIbMkwnzTCy+eiE1yoHAck33853wby/lTIg9eRJzjdzPV7AnfHD0DQ0/Dk6EitaPqOtaFDyR06XnOCDLu3YokCUDqFRcBW+kX0TJe4g+sJFueW7U7wQF2XX/RzlB+8sCSVd8H96xTAgbifrHemOrhMORokHSshFvQ2Em+4yW3/SkisjMn6gsG53QePu6PP7y74gl0FBEzU0dDLpL1YN6u1NAm2s7gc6iHjw5Mq24ObucfipObs47esg== Received: from DM6PR02CA0085.namprd02.prod.outlook.com (2603:10b6:5:1f4::26) by DM6PR12MB5533.namprd12.prod.outlook.com (2603:10b6:5:1bc::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.13; Wed, 10 Nov 2021 06:57:04 +0000 Received: from DM6NAM11FT057.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1f4:cafe::dd) by DM6PR02CA0085.outlook.office365.com (2603:10b6:5:1f4::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.15 via Frontend Transport; Wed, 10 Nov 2021 06:57:04 +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:04 +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:59 +0000 From: Xueming Li To: Dapeng Yu CC: Luca Boccassi , Qi Zhang , dpdk stable Date: Wed, 10 Nov 2021 14:31:47 +0800 Message-ID: <20211110063216.2744012-224-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: 3841ea24-8629-4710-3ab6-08d9a4174da1 X-MS-TrafficTypeDiagnostic: DM6PR12MB5533: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6hhAO74b8LQoEbrGj6Z4eEVmbPn48QOL+uBZ8CdRN8D/rV+FXZjdfT+vTlWRzLO52EqGpPgdewzlPMDGsn1t2PeQkgSf93/BFpwuumJ5o5c4scZhLSeynEt5MUcs+EjlNolsbZ2jwEW3EjQ+L1wmFVihXV3SkATQEAFmQD2qXgaMWaiGbZFtenLRICgSq4crObw+SmTSz0wFGg7vcFZgtt8AilRpTIc7D6ciOPVMxXgFOLnpOVIhxHpT6b1zYhLiw9AYIUwQg3lvoB+PvMR1yh0fVQWuK3x1lDdOcqynmi11o4Qgr3CUJHojReSf7xSRoxXDDUJDGffylea7ts2Ml0wkqtmorVlL4yUMd66rFCiZgO2ouCr0NWyRvMkjdw9mvQdw250cY3ZfFZH1B6R8m2dqyoouOUInHMhNz3emCfEVnqkRdDoXCbNVLDR/MHSz0Ue8hOomooj4dXzRZ5xH75QHZOzrW3KrWt0ZFko/J/WP/+5nYdYJALkNSXhG5UYnGaJ2h46tMWVuWKaO2QycAOZ9bUB3xe6b5eMuDDj65ppdtHb9EtEgv2QzcBy1f5wcK7Or/qNxn0f3aE/lDlF5mGKPawsw9yKjEV9MuFbweuA8ujQJ6l1HHjudAZ+oNOQNcnaOsLNeoTUaSESyp0WOHt53UW/xFSXWQVOxNdYqXGdC6+iFaA9v/TS7xiGuA8qNTB8uGm0QKIER5FUwXw/xQ2mCVJotnfR/11iXIDwiZENfp+dlGR37A8m0FFTWT1wXQWH7bt5Gn9kZ30VhaxU6VLgGBUM7Dxh3pvSyawLHitwwKKQudltBO4UZ6kTWK1dgFfKDVgq11s3bnxN4st0IOg== 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)(46966006)(36840700001)(70206006)(26005)(8676002)(86362001)(83380400001)(36756003)(6286002)(55016002)(36906005)(5660300002)(7636003)(82310400003)(186003)(54906003)(4326008)(70586007)(336012)(36860700001)(53546011)(1076003)(356005)(966005)(4001150100001)(508600001)(2906002)(426003)(6916009)(7696005)(6666004)(16526019)(47076005)(8936002)(2616005)(316002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2021 06:57:04.2051 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3841ea24-8629-4710-3ab6-08d9a4174da1 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: DM6PR12MB5533 Subject: [dpdk-stable] patch 'net/ice: fix flow redirect' 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/8b84cd582d1fa026e0ade33e62b4b0e40467c14f Thanks. Xueming Li --- >From 8b84cd582d1fa026e0ade33e62b4b0e40467c14f Mon Sep 17 00:00:00 2001 From: Dapeng Yu Date: Thu, 4 Nov 2021 16:45:35 +0800 Subject: [PATCH] net/ice: fix flow redirect Cc: Xueming Li [ upstream commit 3378e71244b2b2a1a14f94ece735352b5c34dd99 ] It's possible that a switch rule can't be redirect successfully due to kernel driver is busy to handle an ongoing VF reset, so the redirect action need to be deferred into next redirect request which is promised by kernel driver after VF reset done. This patch uses the saved flow rule's data to replay switch rule remove/add during next flow redirect. Fixes: 397b4b3c5095 ("net/ice: enable flow redirect on switch") Signed-off-by: Dapeng Yu Acked-by: Qi Zhang --- drivers/net/ice/ice_switch_filter.c | 108 ++++++++++++++++++++-------- 1 file changed, 78 insertions(+), 30 deletions(-) diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c index 1ee6e9715e..f41a57acf4 100644 --- a/drivers/net/ice/ice_switch_filter.c +++ b/drivers/net/ice/ice_switch_filter.c @@ -1814,8 +1814,12 @@ ice_switch_redirect(struct ice_adapter *ad, struct rte_flow *flow, struct ice_flow_redirect *rd) { - struct ice_rule_query_data *rdata = flow->rule; + struct ice_rule_query_data *rdata; + struct ice_switch_filter_conf *filter_conf_ptr = + (struct ice_switch_filter_conf *)flow->rule; + struct ice_rule_query_data added_rdata = { 0 }; struct ice_adv_fltr_mgmt_list_entry *list_itr; + struct ice_adv_lkup_elem *lkups_ref = NULL; struct ice_adv_lkup_elem *lkups_dp = NULL; struct LIST_HEAD_TYPE *list_head; struct ice_adv_rule_info rinfo; @@ -1824,6 +1828,8 @@ ice_switch_redirect(struct ice_adapter *ad, uint16_t lkups_cnt; int ret; + rdata = &filter_conf_ptr->sw_query_data; + if (rdata->vsi_handle != rd->vsi_handle) return 0; @@ -1834,56 +1840,98 @@ ice_switch_redirect(struct ice_adapter *ad, if (rd->type != ICE_FLOW_REDIRECT_VSI) return -ENOTSUP; - list_head = &sw->recp_list[rdata->rid].filt_rules; - LIST_FOR_EACH_ENTRY(list_itr, list_head, ice_adv_fltr_mgmt_list_entry, - list_entry) { - rinfo = list_itr->rule_info; - if ((rinfo.fltr_rule_id == rdata->rule_id && - rinfo.sw_act.fltr_act == ICE_FWD_TO_VSI && - rinfo.sw_act.vsi_handle == rd->vsi_handle) || - (rinfo.fltr_rule_id == rdata->rule_id && - rinfo.sw_act.fltr_act == ICE_FWD_TO_VSI_LIST)){ - lkups_cnt = list_itr->lkups_cnt; - lkups_dp = (struct ice_adv_lkup_elem *) - ice_memdup(hw, list_itr->lkups, - sizeof(*list_itr->lkups) * - lkups_cnt, ICE_NONDMA_TO_NONDMA); - - if (!lkups_dp) { - PMD_DRV_LOG(ERR, "Failed to allocate memory."); - return -EINVAL; - } + switch (filter_conf_ptr->fltr_status) { + case ICE_SW_FLTR_ADDED: + list_head = &sw->recp_list[rdata->rid].filt_rules; + LIST_FOR_EACH_ENTRY(list_itr, list_head, + ice_adv_fltr_mgmt_list_entry, + list_entry) { + rinfo = list_itr->rule_info; + if ((rinfo.fltr_rule_id == rdata->rule_id && + rinfo.sw_act.fltr_act == ICE_FWD_TO_VSI && + rinfo.sw_act.vsi_handle == rd->vsi_handle) || + (rinfo.fltr_rule_id == rdata->rule_id && + rinfo.sw_act.fltr_act == ICE_FWD_TO_VSI_LIST)){ + lkups_cnt = list_itr->lkups_cnt; + + lkups_dp = (struct ice_adv_lkup_elem *) + ice_memdup(hw, list_itr->lkups, + sizeof(*list_itr->lkups) * + lkups_cnt, + ICE_NONDMA_TO_NONDMA); + if (!lkups_dp) { + PMD_DRV_LOG(ERR, + "Failed to allocate memory."); + return -EINVAL; + } + lkups_ref = lkups_dp; - if (rinfo.sw_act.fltr_act == ICE_FWD_TO_VSI_LIST) { - rinfo.sw_act.vsi_handle = rd->vsi_handle; - rinfo.sw_act.fltr_act = ICE_FWD_TO_VSI; + if (rinfo.sw_act.fltr_act == + ICE_FWD_TO_VSI_LIST) { + rinfo.sw_act.vsi_handle = + rd->vsi_handle; + rinfo.sw_act.fltr_act = ICE_FWD_TO_VSI; + } + break; } - break; } - } - if (!lkups_dp) + if (!lkups_ref) + return -EINVAL; + + goto rmv_rule; + case ICE_SW_FLTR_RMV_FAILED_ON_RIDRECT: + /* Recover VSI context */ + hw->vsi_ctx[rd->vsi_handle]->vsi_num = filter_conf_ptr->vsi_num; + rinfo = filter_conf_ptr->rule_info; + lkups_cnt = filter_conf_ptr->lkups_num; + lkups_ref = filter_conf_ptr->lkups; + + if (rinfo.sw_act.fltr_act == ICE_FWD_TO_VSI_LIST) { + rinfo.sw_act.vsi_handle = rd->vsi_handle; + rinfo.sw_act.fltr_act = ICE_FWD_TO_VSI; + } + + goto rmv_rule; + case ICE_SW_FLTR_ADD_FAILED_ON_RIDRECT: + rinfo = filter_conf_ptr->rule_info; + lkups_cnt = filter_conf_ptr->lkups_num; + lkups_ref = filter_conf_ptr->lkups; + + goto add_rule; + default: return -EINVAL; + } +rmv_rule: /* Remove the old rule */ - ret = ice_rem_adv_rule(hw, list_itr->lkups, - lkups_cnt, &rinfo); + ret = ice_rem_adv_rule(hw, lkups_ref, lkups_cnt, &rinfo); if (ret) { PMD_DRV_LOG(ERR, "Failed to delete the old rule %d", rdata->rule_id); + filter_conf_ptr->fltr_status = + ICE_SW_FLTR_RMV_FAILED_ON_RIDRECT; ret = -EINVAL; goto out; } +add_rule: /* Update VSI context */ hw->vsi_ctx[rd->vsi_handle]->vsi_num = rd->new_vsi_num; /* Replay the rule */ - ret = ice_add_adv_rule(hw, lkups_dp, lkups_cnt, - &rinfo, rdata); + ret = ice_add_adv_rule(hw, lkups_ref, lkups_cnt, + &rinfo, &added_rdata); if (ret) { PMD_DRV_LOG(ERR, "Failed to replay the rule"); + filter_conf_ptr->fltr_status = + ICE_SW_FLTR_ADD_FAILED_ON_RIDRECT; ret = -EINVAL; + } else { + filter_conf_ptr->sw_query_data = added_rdata; + /* Save VSI number for failure recover */ + filter_conf_ptr->vsi_num = rd->new_vsi_num; + filter_conf_ptr->fltr_status = ICE_SW_FLTR_ADDED; } out: -- 2.33.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-11-10 14:17:11.739156171 +0800 +++ 0223-net-ice-fix-flow-redirect.patch 2021-11-10 14:17:02.040744700 +0800 @@ -1 +1 @@ -From 3378e71244b2b2a1a14f94ece735352b5c34dd99 Mon Sep 17 00:00:00 2001 +From 8b84cd582d1fa026e0ade33e62b4b0e40467c14f Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 3378e71244b2b2a1a14f94ece735352b5c34dd99 ] @@ -15 +17,0 @@ -Cc: stable@dpdk.org @@ -24 +26 @@ -index d5add64c53..ed29c00d77 100644 +index 1ee6e9715e..f41a57acf4 100644 @@ -27 +29 @@ -@@ -1926,8 +1926,12 @@ ice_switch_redirect(struct ice_adapter *ad, +@@ -1814,8 +1814,12 @@ ice_switch_redirect(struct ice_adapter *ad, @@ -41 +43 @@ -@@ -1936,6 +1940,8 @@ ice_switch_redirect(struct ice_adapter *ad, +@@ -1824,6 +1828,8 @@ ice_switch_redirect(struct ice_adapter *ad, @@ -50 +52 @@ -@@ -1946,56 +1952,98 @@ ice_switch_redirect(struct ice_adapter *ad, +@@ -1834,56 +1840,98 @@ ice_switch_redirect(struct ice_adapter *ad,