From: Somnath Kotur <somnath.kotur@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com
Subject: [dpdk-dev] [PATCH 3/6] net/bnxt: fix flow flush to sync with flow destroy routine
Date: Tue, 17 Dec 2019 09:47:52 +0530 [thread overview]
Message-ID: <20191217041755.29232-4-somnath.kotur@broadcom.com> (raw)
In-Reply-To: <20191217041755.29232-1-somnath.kotur@broadcom.com>
Sync flow flush routine with flow destroy so that the operations
performed per flow during a flush are the same as that are done for an
individual flow destroy by having a common function to call for both.
One of the things that was missed in the flow flush routine was the
deletion of the L2 filter that would have been created as part of an
n-tuple filter.
Also, decrement the l2_ref_cnt for a filter in the case of a filter
update as it would've bumped up previously in validate_and_parse_flow()
Fixes: a0800839 ("net/bnxt: handle flow flush handling")
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
---
drivers/net/bnxt/bnxt_flow.c | 132 +++++++++++++++----------------------------
1 file changed, 46 insertions(+), 86 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c
index 4381cd7..59e55c3 100644
--- a/drivers/net/bnxt/bnxt_flow.c
+++ b/drivers/net/bnxt/bnxt_flow.c
@@ -1537,10 +1537,13 @@ struct bnxt_vnic_info *find_matching_vnic(struct bnxt *bp,
* filter which points to the new destination queue and so we clear
* the previous L2 filter. For ntuple filters, we are going to reuse
* the old L2 filter and create new NTUPLE filter with this new
- * destination queue subsequently during bnxt_flow_create.
+ * destination queue subsequently during bnxt_flow_create. So we
+ * decrement the ref cnt of the L2 filter that would've been bumped
+ * up previously in bnxt_validate_and_parse_flow as the old n-tuple
+ * filter that was referencing it will be deleted now.
*/
+ bnxt_hwrm_clear_l2_filter(bp, old_filter);
if (new_filter->filter_type == HWRM_CFA_L2_FILTER) {
- bnxt_hwrm_clear_l2_filter(bp, old_filter);
bnxt_hwrm_set_l2_filter(bp, new_filter->dst_id, new_filter);
} else {
if (new_filter->filter_type == HWRM_CFA_EM_FILTER)
@@ -1828,46 +1831,24 @@ static int bnxt_handle_tunnel_redirect_destroy(struct bnxt *bp,
}
static int
-bnxt_flow_destroy(struct rte_eth_dev *dev,
- struct rte_flow *flow,
- struct rte_flow_error *error)
+_bnxt_flow_destroy(struct bnxt *bp,
+ struct rte_flow *flow,
+ struct rte_flow_error *error)
{
- struct bnxt *bp = dev->data->dev_private;
struct bnxt_filter_info *filter;
struct bnxt_vnic_info *vnic;
int ret = 0;
- bnxt_acquire_flow_lock(bp);
- if (!flow) {
- rte_flow_error_set(error, EINVAL,
- RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
- "Invalid flow: failed to destroy flow.");
- bnxt_release_flow_lock(bp);
- return -EINVAL;
- }
-
filter = flow->filter;
vnic = flow->vnic;
- if (!filter) {
- rte_flow_error_set(error, EINVAL,
- RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
- "Invalid flow: failed to destroy flow.");
- bnxt_release_flow_lock(bp);
- return -EINVAL;
- }
-
if (filter->filter_type == HWRM_CFA_TUNNEL_REDIRECT_FILTER &&
filter->enables == filter->tunnel_type) {
- ret = bnxt_handle_tunnel_redirect_destroy(bp,
- filter,
- error);
- if (!ret) {
+ ret = bnxt_handle_tunnel_redirect_destroy(bp, filter, error);
+ if (!ret)
goto done;
- } else {
- bnxt_release_flow_lock(bp);
+ else
return ret;
- }
}
ret = bnxt_match_filter(bp, filter);
@@ -1919,7 +1900,36 @@ static int bnxt_handle_tunnel_redirect_destroy(struct bnxt *bp,
"Failed to destroy flow.");
}
+ return ret;
+}
+
+static int
+bnxt_flow_destroy(struct rte_eth_dev *dev,
+ struct rte_flow *flow,
+ struct rte_flow_error *error)
+{
+ struct bnxt *bp = dev->data->dev_private;
+ int ret = 0;
+
+ bnxt_acquire_flow_lock(bp);
+ if (!flow) {
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
+ "Invalid flow: failed to destroy flow.");
+ bnxt_release_flow_lock(bp);
+ return -EINVAL;
+ }
+
+ if (!flow->filter) {
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
+ "Invalid flow: failed to destroy flow.");
+ bnxt_release_flow_lock(bp);
+ return -EINVAL;
+ }
+ ret = _bnxt_flow_destroy(bp, flow, error);
bnxt_release_flow_lock(bp);
+
return ret;
}
@@ -1927,7 +1937,6 @@ static int bnxt_handle_tunnel_redirect_destroy(struct bnxt *bp,
bnxt_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *error)
{
struct bnxt *bp = dev->data->dev_private;
- struct bnxt_filter_info *filter = NULL;
struct bnxt_vnic_info *vnic;
struct rte_flow *flow;
unsigned int i;
@@ -1941,66 +1950,17 @@ static int bnxt_handle_tunnel_redirect_destroy(struct bnxt *bp,
while (!STAILQ_EMPTY(&vnic->flow_list)) {
flow = STAILQ_FIRST(&vnic->flow_list);
- filter = flow->filter;
-
- if (filter->filter_type ==
- HWRM_CFA_TUNNEL_REDIRECT_FILTER &&
- filter->enables == filter->tunnel_type) {
- ret =
- bnxt_handle_tunnel_redirect_destroy(bp,
- filter,
- error);
- if (!ret) {
- goto done;
- } else {
- bnxt_release_flow_lock(bp);
- return ret;
- }
- }
-
- if (filter->filter_type == HWRM_CFA_EM_FILTER)
- ret = bnxt_hwrm_clear_em_filter(bp, filter);
- if (filter->filter_type == HWRM_CFA_NTUPLE_FILTER)
- ret = bnxt_hwrm_clear_ntuple_filter(bp, filter);
- else if (i)
- ret = bnxt_hwrm_clear_l2_filter(bp, filter);
- if (ret) {
- rte_flow_error_set
- (error,
- -ret,
- RTE_FLOW_ERROR_TYPE_HANDLE,
- NULL,
- "Failed to flush flow in HW.");
- bnxt_release_flow_lock(bp);
- return -rte_errno;
- }
-done:
- STAILQ_REMOVE(&vnic->flow_list, flow,
- rte_flow, next);
-
- STAILQ_REMOVE(&vnic->filter,
- filter,
- bnxt_filter_info,
- next);
- bnxt_free_filter(bp, filter);
-
- rte_free(flow);
+ if (!flow->filter)
+ continue;
- /* If this was the last flow associated with this vnic,
- * switch the queue back to RSS pool.
- */
- if (STAILQ_EMPTY(&vnic->flow_list)) {
- rte_free(vnic->fw_grp_ids);
- if (vnic->rx_queue_cnt > 1)
- bnxt_hwrm_vnic_ctx_free(bp, vnic);
- bnxt_hwrm_vnic_free(bp, vnic);
- vnic->rx_queue_cnt = 0;
- }
+ ret = _bnxt_flow_destroy(bp, flow, error);
+ if (ret)
+ break;
}
}
-
bnxt_release_flow_lock(bp);
+
return ret;
}
--
1.8.3.1
next prev parent reply other threads:[~2019-12-17 4:18 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-17 4:17 [dpdk-dev] [PATCH 0/6] bnxt patchset Somnath Kotur
2019-12-17 4:17 ` [dpdk-dev] [PATCH 1/6] net/bnxt: fix link failure during port toggle by increasing link wait time Somnath Kotur
2019-12-17 4:17 ` [dpdk-dev] [PATCH 2/6] net/bnxt: fix to use first valid profile if lossy profile not found Somnath Kotur
2019-12-17 4:17 ` Somnath Kotur [this message]
2019-12-17 4:17 ` [dpdk-dev] [PATCH 4/6] net/bnxt: fix non matching flow hitting filter rule Somnath Kotur
2019-12-17 4:17 ` [dpdk-dev] [PATCH 5/6] net/bnxt: fix to keep the L2 filter intact so it can be reused Somnath Kotur
2019-12-17 4:17 ` [dpdk-dev] [PATCH 6/6] net/bnxt: fix to free l2 filters while clearing vnic flows/filters Somnath Kotur
2019-12-21 2:29 ` [dpdk-dev] [PATCH v2 0/5] bnxt patchset Ajit Khaparde
2019-12-21 2:50 ` Ajit Khaparde
2020-01-07 0:37 ` [dpdk-dev] [PATCH v3 0/7] " Ajit Khaparde
2020-01-07 0:37 ` [dpdk-dev] [PATCH v3 1/7] net/bnxt: fix link failure during port toggle Ajit Khaparde
2020-01-07 0:37 ` [dpdk-dev] [PATCH v3 2/7] net/bnxt: fix to use first valid profile Ajit Khaparde
2020-01-07 0:37 ` [dpdk-dev] [PATCH v3 3/7] net/bnxt: fix flow flush to sync with flow destroy Ajit Khaparde
2020-01-07 0:37 ` [dpdk-dev] [PATCH v3 4/7] net/bnxt: fix non matching flow hitting filter rule Ajit Khaparde
2020-01-07 0:37 ` [dpdk-dev] [PATCH v3 5/7] net/bnxt: fix to reuse an L2 filter Ajit Khaparde
2020-01-07 0:37 ` [dpdk-dev] [PATCH v3 6/7] net/bnxt: add support for flow mark action Ajit Khaparde
2020-01-07 0:37 ` [dpdk-dev] [PATCH v3 7/7] net/bnxt: fix to not overwrite error message Ajit Khaparde
2020-01-07 9:18 ` Ferruh Yigit
2020-01-07 21:50 ` Ajit Khaparde
2020-01-07 23:04 ` [dpdk-dev] [PATCH v3 0/7] bnxt patchset Ajit Khaparde
2019-12-21 2:29 ` [dpdk-dev] [PATCH v2 1/5] net/bnxt: fix link failure during port toggle Ajit Khaparde
2019-12-21 2:29 ` [dpdk-dev] [PATCH v2 2/5] net/bnxt: fix to use first valid profile Ajit Khaparde
2019-12-21 2:29 ` [dpdk-dev] [PATCH v2 3/5] net/bnxt: fix flow flush to sync with flow destroy Ajit Khaparde
2019-12-21 2:29 ` [dpdk-dev] [PATCH v2 4/5] net/bnxt: fix non matching flow hitting filter rule Ajit Khaparde
2019-12-21 2:29 ` [dpdk-dev] [PATCH v2 5/5] net/bnxt: fix to reuse an L2 filter Ajit Khaparde
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=20191217041755.29232-4-somnath.kotur@broadcom.com \
--to=somnath.kotur@broadcom.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
/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).