DPDK patches and discussions
 help / color / mirror / Atom feed
From: dapengx.yu@intel.com
To: Qiming Yang <qiming.yang@intel.com>, Qi Zhang <qi.z.zhang@intel.com>
Cc: dev@dpdk.org, haiyue.wang@intel.com,
	Dapeng Yu <dapengx.yu@intel.com>,
	stable@dpdk.org
Subject: [dpdk-dev] [PATCH 2/2] net/ice: fix flow redirect failure
Date: Mon,  1 Nov 2021 16:45:06 +0800	[thread overview]
Message-ID: <20211101084506.513407-2-dapengx.yu@intel.com> (raw)
In-Reply-To: <20211101084506.513407-1-dapengx.yu@intel.com>

From: Dapeng Yu <dapengx.yu@intel.com>

When the switch flow rules are redirected, if rule is removed but not
added successfully, the rule addition in the next time will not succeed
because the rule's meta cannot be found.

This patch uses the saved flow rule's meta when the flow rule is added
again to make the addition succeed.

Fixes: 397b4b3c5095 ("net/ice: enable flow redirect on switch")
Cc: stable@dpdk.org

Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
---
 drivers/net/ice/ice_switch_filter.c | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index 804cf9b812..0994ea00ae 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -1917,7 +1917,10 @@ 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_dp = NULL;
 	struct LIST_HEAD_TYPE *list_head;
@@ -1927,6 +1930,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;
 
@@ -1937,6 +1942,22 @@ ice_switch_redirect(struct ice_adapter *ad,
 	if (rd->type != ICE_FLOW_REDIRECT_VSI)
 		return -ENOTSUP;
 
+	if (!filter_conf_ptr->added) {
+		ret = ice_add_adv_rule(hw, filter_conf_ptr->lkups,
+				       filter_conf_ptr->lkups_num,
+				       &filter_conf_ptr->rule_info,
+				       &added_rdata);
+
+		if (ret) {
+			PMD_DRV_LOG(ERR, "Failed to replay the rule again");
+			return -EINVAL;
+		}
+
+		filter_conf_ptr->sw_query_data = added_rdata;
+		filter_conf_ptr->added = true;
+		return 0;
+	}
+
 	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) {
@@ -1983,10 +2004,14 @@ ice_switch_redirect(struct ice_adapter *ad,
 
 	/* Replay the rule */
 	ret = ice_add_adv_rule(hw, lkups_dp, lkups_cnt,
-			       &rinfo, rdata);
+			       &rinfo,  &added_rdata);
 	if (ret) {
 		PMD_DRV_LOG(ERR, "Failed to replay the rule");
+		filter_conf_ptr->added = false;
 		ret = -EINVAL;
+	} else {
+		filter_conf_ptr->sw_query_data = added_rdata;
+		filter_conf_ptr->added = true;
 	}
 
 out:
-- 
2.27.0


  reply	other threads:[~2021-11-01  8:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-01  8:45 [dpdk-dev] [PATCH 1/2] net/ice: save meta on switch filter creation dapengx.yu
2021-11-01  8:45 ` dapengx.yu [this message]
2021-11-02  0:06 ` Zhang, Qi Z
2021-11-02  0:08   ` Zhang, Qi Z
2021-11-02 16:11 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2021-11-03  3:25   ` Yu, DapengX
2021-11-03 10:05 ` [dpdk-dev] [PATCH v2 1/2] net/ice: save rule " dapengx.yu
2021-11-03 10:05   ` [dpdk-dev] [PATCH v2 2/2] net/ice: fix flow redirect failure dapengx.yu
2021-11-04  8:17   ` [dpdk-dev] [PATCH v3 1/2] net/ice: save rule on switch filter creation dapengx.yu
2021-11-04  8:17     ` [dpdk-dev] [PATCH v3 2/2] net/ice: fix flow redirect failure dapengx.yu
2021-11-04  8:45     ` [dpdk-dev] [PATCH v4 1/2] net/ice: save rule on switch filter creation dapengx.yu
2021-11-04  8:45       ` [dpdk-dev] [PATCH v4 2/2] net/ice: fix flow redirect failure dapengx.yu
2021-11-04 11:12         ` Zhang, Qi Z
2021-11-04 11:10       ` [dpdk-dev] [PATCH v4 1/2] net/ice: save rule on switch filter creation Zhang, Qi Z

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211101084506.513407-2-dapengx.yu@intel.com \
    --to=dapengx.yu@intel.com \
    --cc=dev@dpdk.org \
    --cc=haiyue.wang@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).