From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: Kishore Padmanabha <kishore.padmanabha@broadcom.com>,
Shahaji Bhosle <sbhosle@broadcom.com>
Subject: [dpdk-dev] [PATCH v2 09/25] net/bnxt: fix the function id used in flow flush
Date: Tue, 15 Sep 2020 21:28:35 -0700 [thread overview]
Message-ID: <20200916042851.32914-10-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20200916042851.32914-1-ajit.khaparde@broadcom.com>
From: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
The function id being used in the flush is incorrect, fixed the
flush of the flows.
Fixes: 74bcfc062489 ("net/bnxt: add session and function flow flush")
Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Shahaji Bhosle <sbhosle@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 1 +
drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 19 +++++++-----
drivers/net/bnxt/tf_ulp/bnxt_ulp.h | 5 +--
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c | 39 ++++++++++++++++-------
drivers/net/bnxt/tf_ulp/ulp_port_db.c | 41 +++++++++++++++++++++++++
drivers/net/bnxt/tf_ulp/ulp_port_db.h | 13 ++++++++
6 files changed, 95 insertions(+), 23 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 073412de2..445c40820 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3723,6 +3723,7 @@ bnxt_filter_ctrl_op(struct rte_eth_dev *dev,
if (BNXT_ETH_DEV_IS_REPRESENTOR(dev)) {
struct bnxt_vf_representor *vfr = dev->data->dev_private;
bp = vfr->parent_dev->data->dev_private;
+ /* parent is deleted while children are still valid */
if (!bp)
return -EIO;
}
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
index bd6039d2a..63d453ffb 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
@@ -35,14 +35,12 @@ static pthread_mutex_t bnxt_ulp_global_mutex = PTHREAD_MUTEX_INITIALIZER;
* created the session.
*/
bool
-ulp_ctx_deinit_allowed(void *ptr)
+ulp_ctx_deinit_allowed(struct bnxt_ulp_context *ulp_ctx)
{
- struct bnxt *bp = (struct bnxt *)ptr;
-
- if (!bp || !bp->ulp_ctx || !bp->ulp_ctx->cfg_data)
+ if (!ulp_ctx || !ulp_ctx->cfg_data)
return false;
- if (!bp->ulp_ctx->cfg_data->ref_cnt) {
+ if (!ulp_ctx->cfg_data->ref_cnt) {
BNXT_TF_DBG(DEBUG, "ulp ctx shall initiate deinit\n");
return true;
}
@@ -629,9 +627,14 @@ bnxt_ulp_flush_port_flows(struct bnxt *bp)
{
uint16_t func_id;
- func_id = bnxt_get_fw_func_id(bp->eth_dev->data->port_id,
- BNXT_ULP_INTF_TYPE_INVALID);
- ulp_flow_db_function_flow_flush(bp->ulp_ctx, func_id);
+ /* it is assumed that port is either TVF or PF */
+ if (ulp_port_db_port_func_id_get(bp->ulp_ctx,
+ bp->eth_dev->data->port_id,
+ &func_id)) {
+ BNXT_TF_DBG(ERR, "Invalid argument\n");
+ return;
+ }
+ (void)ulp_flow_db_function_flow_flush(bp->ulp_ctx, func_id);
}
/* Internal function to delete the VFR default flows */
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h
index 8a2825ae5..5882c545c 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h
@@ -83,12 +83,9 @@ struct ulp_tlv_param {
/*
* Allow the deletion of context only for the bnxt device that
* created the session
- * TBD - The implementation of the function should change to
- * using the reference count once tf_session_attach functionality
- * is fixed.
*/
bool
-ulp_ctx_deinit_allowed(void *bp);
+ulp_ctx_deinit_allowed(struct bnxt_ulp_context *ulp_ctx);
/* Function to set the device id of the hardware. */
int32_t
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c
index 2ab00453a..566e1254a 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c
@@ -10,6 +10,7 @@
#include "ulp_flow_db.h"
#include "ulp_mapper.h"
#include "ulp_fc_mgr.h"
+#include "ulp_port_db.h"
#include <rte_malloc.h>
static int32_t
@@ -146,8 +147,14 @@ bnxt_ulp_flow_create(struct rte_eth_dev *dev,
mapper_cparms.act_prop = ¶ms.act_prop;
mapper_cparms.class_tid = class_id;
mapper_cparms.act_tid = act_tmpl;
- mapper_cparms.func_id = bnxt_get_fw_func_id(dev->data->port_id,
- BNXT_ULP_INTF_TYPE_INVALID);
+
+ /* Get the function id */
+ if (ulp_port_db_port_func_id_get(ulp_ctx,
+ dev->data->port_id,
+ &mapper_cparms.func_id)) {
+ BNXT_TF_DBG(ERR, "conversion of port to func id failed\n");
+ goto parse_error;
+ }
mapper_cparms.dir_attr = params.dir_attr;
/* Call the ulp mapper to create the flow in the hardware. */
@@ -251,8 +258,17 @@ bnxt_ulp_flow_destroy(struct rte_eth_dev *dev,
}
flow_id = (uint32_t)(uintptr_t)flow;
- func_id = bnxt_get_fw_func_id(dev->data->port_id,
- BNXT_ULP_INTF_TYPE_INVALID);
+
+ if (ulp_port_db_port_func_id_get(ulp_ctx,
+ dev->data->port_id,
+ &func_id)) {
+ BNXT_TF_DBG(ERR, "conversion of port to func id failed\n");
+ if (error)
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
+ "Failed to destroy flow.");
+ return -EINVAL;
+ }
if (ulp_flow_db_validate_flow_func(ulp_ctx, flow_id, func_id) ==
false) {
@@ -284,23 +300,24 @@ bnxt_ulp_flow_flush(struct rte_eth_dev *eth_dev,
{
struct bnxt_ulp_context *ulp_ctx;
int32_t ret = 0;
- struct bnxt *bp;
uint16_t func_id;
ulp_ctx = bnxt_ulp_eth_dev_ptr2_cntxt_get(eth_dev);
if (!ulp_ctx) {
- BNXT_TF_DBG(DEBUG, "ULP context is not initialized\n");
return ret;
}
- bp = eth_dev->data->dev_private;
/* Free the resources for the last device */
- if (ulp_ctx_deinit_allowed(bp)) {
+ if (ulp_ctx_deinit_allowed(ulp_ctx)) {
ret = ulp_flow_db_session_flow_flush(ulp_ctx);
} else if (bnxt_ulp_cntxt_ptr2_flow_db_get(ulp_ctx)) {
- func_id = bnxt_get_fw_func_id(eth_dev->data->port_id,
- BNXT_ULP_INTF_TYPE_INVALID);
- ret = ulp_flow_db_function_flow_flush(ulp_ctx, func_id);
+ ret = ulp_port_db_port_func_id_get(ulp_ctx,
+ eth_dev->data->port_id,
+ &func_id);
+ if (!ret)
+ ret = ulp_flow_db_function_flow_flush(ulp_ctx, func_id);
+ else
+ BNXT_TF_DBG(ERR, "convert port to func id failed\n");
}
if (ret)
rte_flow_error_set(error, ret,
diff --git a/drivers/net/bnxt/tf_ulp/ulp_port_db.c b/drivers/net/bnxt/tf_ulp/ulp_port_db.c
index 30876478d..4b4eaeb12 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_port_db.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_port_db.c
@@ -540,3 +540,44 @@ ulp_port_db_dev_func_id_to_ulp_index(struct bnxt_ulp_context *ulp_ctxt,
*ifindex = port_db->ulp_func_id_tbl[func_id].ifindex;
return 0;
}
+
+/*
+ * Api to get the function id for a given port id.
+ *
+ * ulp_ctxt [in] Ptr to ulp context
+ * port_id [in] dpdk port id
+ * func_id [out] the function id of the given ifindex.
+ *
+ * Returns 0 on success or negative number on failure.
+ */
+int32_t
+ulp_port_db_port_func_id_get(struct bnxt_ulp_context *ulp_ctxt,
+ uint16_t port_id, uint16_t *func_id)
+{
+ struct bnxt_ulp_port_db *port_db;
+ uint32_t ifindex;
+
+ port_db = bnxt_ulp_cntxt_ptr2_port_db_get(ulp_ctxt);
+ if (!port_db || port_id >= RTE_MAX_ETHPORTS) {
+ BNXT_TF_DBG(ERR, "Invalid Arguments\n");
+ return -EINVAL;
+ }
+ ifindex = port_db->dev_port_list[port_id];
+ if (!ifindex)
+ return -ENOENT;
+
+ switch (port_db->ulp_intf_list[ifindex].type) {
+ case BNXT_ULP_INTF_TYPE_TRUSTED_VF:
+ case BNXT_ULP_INTF_TYPE_PF:
+ *func_id = port_db->ulp_intf_list[ifindex].drv_func_id;
+ break;
+ case BNXT_ULP_INTF_TYPE_VF:
+ case BNXT_ULP_INTF_TYPE_VF_REP:
+ *func_id = port_db->ulp_intf_list[ifindex].vf_func_id;
+ break;
+ default:
+ *func_id = 0;
+ break;
+ }
+ return 0;
+}
diff --git a/drivers/net/bnxt/tf_ulp/ulp_port_db.h b/drivers/net/bnxt/tf_ulp/ulp_port_db.h
index 2b323d168..7b85987a0 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_port_db.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_port_db.h
@@ -259,4 +259,17 @@ int32_t
ulp_port_db_dev_func_id_to_ulp_index(struct bnxt_ulp_context *ulp_ctxt,
uint32_t func_id, uint32_t *ifindex);
+/*
+ * Api to get the function id for a given port id.
+ *
+ * ulp_ctxt [in] Ptr to ulp context
+ * port_id [in] dpdk port id
+ * func_id [out] the function id of the given ifindex.
+ *
+ * Returns 0 on success or negative number on failure.
+ */
+int32_t
+ulp_port_db_port_func_id_get(struct bnxt_ulp_context *ulp_ctxt,
+ uint16_t port_id, uint16_t *func_id);
+
#endif /* _ULP_PORT_DB_H_ */
--
2.21.1 (Apple Git-122.3)
next prev parent reply other threads:[~2020-09-16 4:30 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-11 1:55 [dpdk-dev] [PATCH 00/25] patchset for bnxt Ajit Khaparde
2020-09-11 1:55 ` [dpdk-dev] [PATCH 01/25] net/bnxt: fix port stop process and cleanup resources Ajit Khaparde
2020-09-11 1:55 ` [dpdk-dev] [PATCH 02/25] net/bnxt: fix the drop action flow to support count action Ajit Khaparde
2020-09-11 1:55 ` [dpdk-dev] [PATCH 03/25] net/bnxt: reject offload flows with invalid MAC address Ajit Khaparde
2020-09-11 1:55 ` [dpdk-dev] [PATCH 04/25] net/bnxt: reduce debug log messages Ajit Khaparde
2020-09-11 1:55 ` [dpdk-dev] [PATCH 05/25] net/bnxt: fix to break the ipv4 and ipv6 ingress rule Ajit Khaparde
2020-09-11 1:55 ` [dpdk-dev] [PATCH 06/25] net/bnxt: free the em index on failure Ajit Khaparde
2020-09-11 1:55 ` [dpdk-dev] [PATCH 07/25] net/bnxt: add a null ptr check for the resource manager Ajit Khaparde
2020-09-11 1:55 ` [dpdk-dev] [PATCH 08/25] net/bnxt: change default flow rule to use 8B encap Ajit Khaparde
2020-09-11 1:55 ` [dpdk-dev] [PATCH 09/25] net/bnxt: fix the function id used in the flow flush Ajit Khaparde
2020-09-11 1:55 ` [dpdk-dev] [PATCH 10/25] net/bnxt: vfr port clean up during port stop Ajit Khaparde
2020-09-11 1:55 ` [dpdk-dev] [PATCH 11/25] net/bnxt: fix crash in VF rep queue selection Ajit Khaparde
2020-09-11 1:55 ` [dpdk-dev] [PATCH 12/25] net/bnxt: fix to conditionally rollback added VF-rep ports Ajit Khaparde
2020-09-11 1:55 ` [dpdk-dev] [PATCH 13/25] net/bnxt: update resource allocation settings Ajit Khaparde
2020-09-11 1:55 ` [dpdk-dev] [PATCH 14/25] net/bnxt: move IF tbl from tunneled to direct HWRM msg Ajit Khaparde
2020-09-11 1:55 ` [dpdk-dev] [PATCH 15/25] net/bnxt: remove VLAN pop action for egress flows Ajit Khaparde
2020-09-11 1:55 ` [dpdk-dev] [PATCH 16/25] net/bnxt: increase counter support from 8K to 16K Ajit Khaparde
2020-09-11 1:55 ` [dpdk-dev] [PATCH 17/25] net/bnxt: fix to explicitly check and set for start cntr ID Ajit Khaparde
2020-09-11 1:55 ` [dpdk-dev] [PATCH 18/25] net/bnxt: enable support for VXLAN ipv6 encapsulation Ajit Khaparde
2020-09-11 1:55 ` [dpdk-dev] [PATCH 19/25] net/bnxt: enable support for nat action with tagged traffic Ajit Khaparde
2020-09-11 1:55 ` [dpdk-dev] [PATCH 20/25] net/bnxt: fix out of bound access in action bit handling Ajit Khaparde
2020-09-11 1:55 ` [dpdk-dev] [PATCH 21/25] net/bnxt: provide switch info while VF-Reps are configured Ajit Khaparde
2020-09-11 1:56 ` [dpdk-dev] [PATCH 22/25] net/bnxt: fix bugs in representor data path Ajit Khaparde
2020-09-11 1:56 ` [dpdk-dev] [PATCH 23/25] net/bnxt: add support for locks in flow database Ajit Khaparde
2020-09-11 1:56 ` [dpdk-dev] [PATCH 24/25] net/bnxt: fix to check for vnic ptr in bnxt shutdown path Ajit Khaparde
2020-09-11 1:56 ` [dpdk-dev] [PATCH 25/25] net/bnxt: fix to have a separate mutex for FW health check Ajit Khaparde
2020-09-16 4:28 ` [dpdk-dev] [PATCH v2 00/25] patchset for bnxt Ajit Khaparde
2020-09-16 4:28 ` [dpdk-dev] [PATCH v2 01/25] net/bnxt: fix resource cleanup in port stop Ajit Khaparde
2020-09-16 4:28 ` [dpdk-dev] [PATCH v2 02/25] net/bnxt: fix the drop action flow to support count Ajit Khaparde
2020-09-16 4:28 ` [dpdk-dev] [PATCH v2 03/25] net/bnxt: reject flow offload with invalid MAC Ajit Khaparde
2020-09-16 4:28 ` [dpdk-dev] [PATCH v2 04/25] net/bnxt: reduce debug log messages Ajit Khaparde
2020-09-16 4:28 ` [dpdk-dev] [PATCH v2 05/25] net/bnxt: fix coexistence of ipv4 and ipv6 ingress rules Ajit Khaparde
2020-09-16 4:28 ` [dpdk-dev] [PATCH v2 06/25] net/bnxt: free the EM index on failure Ajit Khaparde
2020-09-16 4:28 ` [dpdk-dev] [PATCH v2 07/25] net/bnxt: add null pointer check for resource manager Ajit Khaparde
2020-09-16 4:28 ` [dpdk-dev] [PATCH v2 08/25] net/bnxt: modify default flow rule creation Ajit Khaparde
2020-09-16 4:28 ` Ajit Khaparde [this message]
2020-09-16 4:28 ` [dpdk-dev] [PATCH v2 10/25] net/bnxt: refactor VFR port clean up Ajit Khaparde
2020-09-16 4:28 ` [dpdk-dev] [PATCH v2 11/25] net/bnxt: fix crash in VFR queue select Ajit Khaparde
2020-09-16 4:28 ` [dpdk-dev] [PATCH v2 12/25] net/bnxt: fix VFR cleanup during init failure Ajit Khaparde
2020-09-16 4:28 ` [dpdk-dev] [PATCH v2 13/25] net/bnxt: update resource settings Ajit Khaparde
2020-09-16 4:28 ` [dpdk-dev] [PATCH v2 14/25] net/bnxt: use direct HWRM message for interface table Ajit Khaparde
2020-09-16 4:28 ` [dpdk-dev] [PATCH v2 15/25] net/bnxt: remove VLAN pop action for egress flows Ajit Khaparde
2020-09-16 4:28 ` [dpdk-dev] [PATCH v2 16/25] net/bnxt: increase counter support from 8K to 16K Ajit Khaparde
2020-09-16 4:28 ` [dpdk-dev] [PATCH v2 17/25] net/bnxt: check and set initial counter ID Ajit Khaparde
2020-09-16 4:28 ` [dpdk-dev] [PATCH v2 18/25] net/bnxt: enable VXLAN ipv6 encapsulation Ajit Khaparde
2020-09-16 4:28 ` [dpdk-dev] [PATCH v2 19/25] net/bnxt: enable NAT action with tagged traffic Ajit Khaparde
2020-09-16 4:28 ` [dpdk-dev] [PATCH v2 20/25] net/bnxt: fix out of bound access in bit handling Ajit Khaparde
2020-09-16 4:28 ` [dpdk-dev] [PATCH v2 21/25] net/bnxt: provide switch info if VFR are configured Ajit Khaparde
2020-09-16 4:28 ` [dpdk-dev] [PATCH v2 22/25] net/bnxt: fix bugs in representor data path Ajit Khaparde
2020-09-16 4:28 ` [dpdk-dev] [PATCH v2 23/25] net/bnxt: add locks in flow database Ajit Khaparde
2020-09-16 4:28 ` [dpdk-dev] [PATCH v2 24/25] net/bnxt: fix to check VNIC in shutdown path Ajit Khaparde
2020-09-16 4:28 ` [dpdk-dev] [PATCH v2 25/25] net/bnxt: add separate mutex for FW health check Ajit Khaparde
2020-09-16 16:21 ` [dpdk-dev] [PATCH v2 00/25] patchset for bnxt Ajit Khaparde
2020-09-16 23:57 ` Ferruh Yigit
2020-09-17 0:13 ` Ajit Khaparde
2020-09-17 7:39 ` Ferruh Yigit
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=20200916042851.32914-10-ajit.khaparde@broadcom.com \
--to=ajit.khaparde@broadcom.com \
--cc=dev@dpdk.org \
--cc=kishore.padmanabha@broadcom.com \
--cc=sbhosle@broadcom.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).