[dpdk-stable] patch 'net/ice: fix flow redirect' has been queued to stable release 20.11.4
Xueming Li
xuemingl at nvidia.com
Wed Nov 10 07:31:47 CET 2021
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 <xuemingl at nvidia.com>
---
>From 8b84cd582d1fa026e0ade33e62b4b0e40467c14f Mon Sep 17 00:00:00 2001
From: Dapeng Yu <dapengx.yu at intel.com>
Date: Thu, 4 Nov 2021 16:45:35 +0800
Subject: [PATCH] net/ice: fix flow redirect
Cc: Xueming Li <xuemingl at nvidia.com>
[ 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 <dapengx.yu at intel.com>
Acked-by: Qi Zhang <qi.z.zhang at intel.com>
---
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 <xuemingl at nvidia.com>
+
+[ upstream commit 3378e71244b2b2a1a14f94ece735352b5c34dd99 ]
@@ -15 +17,0 @@
-Cc: stable at 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,
More information about the stable
mailing list