[v4,14/15] net/bnxt: set thread safe flow ops flag

Message ID 20201026035616.19264-15-ajit.khaparde@broadcom.com (mailing list archive)
State Accepted, archived
Delegated to: Ajit Khaparde
Headers
Series bnxt fixes and enhancements |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Ajit Khaparde Oct. 26, 2020, 3:56 a.m. UTC
  PMD supports thread-safe flow operations. Set the
RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE dev_flag to indicate this info
to the application. rte_flow API functions can avoid using its
own mutex for safe multi-thread flow handling.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 doc/guides/nics/bnxt.rst               | 2 ++
 doc/guides/rel_notes/release_20_11.rst | 1 +
 drivers/net/bnxt/bnxt_ethdev.c         | 6 ++++++
 3 files changed, 9 insertions(+)
  

Patch

diff --git a/doc/guides/nics/bnxt.rst b/doc/guides/nics/bnxt.rst
index bf2ef19adb..b38fc0b330 100644
--- a/doc/guides/nics/bnxt.rst
+++ b/doc/guides/nics/bnxt.rst
@@ -721,6 +721,8 @@  Notes
   of deferring Flow2 for offloading. Flow2 that arrive after Flow1 is offloaded
   will be directly programmed and not cached.
 
+- PMD supports thread-safe rte_flow operations.
+
 Note: A VNIC represents a virtual interface in the hardware. It is a resource
 in the RX path of the chip and is used to setup various target actions such as
 RSS, MAC filtering etc. for the physical function in use.
diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index 471c670317..367ccb3248 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -149,6 +149,7 @@  New Features
   * Added TRUFLOW support for Stingray devices.
   * Added support for representors on MAIA cores of SR.
   * Added support for VXLAN decap offload using rte_flow.
+  * Added support to indicate native rte_flow API thread safety.
 
 * **Updated Cisco enic driver.**
 
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index a0e01d059d..71ad05dfe9 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3824,6 +3824,12 @@  bnxt_filter_ctrl_op(struct rte_eth_dev *dev,
 	case RTE_ETH_FILTER_GENERIC:
 		if (filter_op != RTE_ETH_FILTER_GET)
 			return -EINVAL;
+
+		/* PMD supports thread-safe flow operations.  rte_flow API
+		 * functions can avoid mutex for multi-thread safety.
+		 */
+		dev->data->dev_flags |= RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE;
+
 		if (BNXT_TRUFLOW_EN(bp))
 			*(const void **)arg = &bnxt_ulp_rte_flow_ops;
 		else