DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev]  [PATCH 0/6] bnxt patchset
@ 2019-12-10 15:05 Kalesh A P
  2019-12-10 15:05 ` [dpdk-dev] [PATCH 1/6] net/bnxt: restore mac filters during reset recovery Kalesh A P
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Kalesh A P @ 2019-12-10 15:05 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, ajit.khaparde

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

bnxt patchset with bug fixes and enhancements.

Please apply.

Kalesh AP (6):
  net/bnxt: restore mac filters during reset recovery
  net/bnxt: restore vlan filters during reset recovery
  net/bnxt: fix request for hot reset support
  net/bnxt: remove unnecessary macro for unused variables
  net/bnxt: reset filter indices on free
  net/bnxt: add a field for fw capabilities

 drivers/net/bnxt/bnxt.h        | 23 ++++++-----
 drivers/net/bnxt/bnxt_cpr.c    |  2 +-
 drivers/net/bnxt/bnxt_ethdev.c | 88 +++++++++++++++++++++++++++++++++++-------
 drivers/net/bnxt/bnxt_filter.c |  5 +++
 drivers/net/bnxt/bnxt_flow.c   |  3 +-
 drivers/net/bnxt/bnxt_hwrm.c   | 24 ++++++------
 drivers/net/bnxt/bnxt_stats.c  |  6 +--
 7 files changed, 110 insertions(+), 41 deletions(-)

-- 
2.10.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH 1/6] net/bnxt: restore mac filters during reset recovery
  2019-12-10 15:05 [dpdk-dev] [PATCH 0/6] bnxt patchset Kalesh A P
@ 2019-12-10 15:05 ` Kalesh A P
  2019-12-10 15:05 ` [dpdk-dev] [PATCH 2/6] net/bnxt: restore vlan " Kalesh A P
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Kalesh A P @ 2019-12-10 15:05 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, ajit.khaparde

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

Older Firmware could have state information such as
MAC Filters, VLAN settings etc configured by user.
But new Firmware is unaware of this state information
and as a result driver should restore these settings
during reset recovery.

This patch restores the user configured mac addresses
prior to hot FW upgrade or FW error.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 43 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index c70b072..addc850 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3796,6 +3796,48 @@ static void bnxt_dev_cleanup(struct bnxt *bp)
 	bnxt_uninit_resources(bp, true);
 }
 
+static int bnxt_restore_mac_filters(struct bnxt *bp)
+{
+	struct rte_eth_dev *dev = bp->eth_dev;
+	struct rte_eth_dev_info dev_info;
+	struct rte_ether_addr *addr;
+	uint64_t pool_mask;
+	uint32_t pool = 0;
+	uint16_t i;
+	int rc;
+
+	if (BNXT_VF(bp) & !BNXT_VF_IS_TRUSTED(bp))
+		return 0;
+
+	rc = bnxt_dev_info_get_op(dev, &dev_info);
+	if (rc)
+		return rc;
+
+	/* replay MAC address configuration */
+	for (i = 1; i < dev_info.max_mac_addrs; i++) {
+		addr = &dev->data->mac_addrs[i];
+
+		/* skip zero address */
+		if (rte_is_zero_ether_addr(addr))
+			continue;
+
+		pool = 0;
+		pool_mask = dev->data->mac_pool_sel[i];
+
+		do {
+			if (pool_mask & 1ULL) {
+				rc = bnxt_mac_addr_add_op(dev, addr, i, pool);
+				if (rc)
+					return rc;
+			}
+			pool_mask >>= 1;
+			pool++;
+		} while (pool_mask);
+	}
+
+	return 0;
+}
+
 static int bnxt_restore_filters(struct bnxt *bp)
 {
 	struct rte_eth_dev *dev = bp->eth_dev;
@@ -3806,6 +3848,7 @@ static int bnxt_restore_filters(struct bnxt *bp)
 	if (dev->data->promiscuous)
 		ret = bnxt_promiscuous_enable_op(dev);
 
+	ret = bnxt_restore_mac_filters(bp);
 	/* TODO restore other filters as well */
 	return ret;
 }
-- 
2.10.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH 2/6] net/bnxt: restore vlan filters during reset recovery
  2019-12-10 15:05 [dpdk-dev] [PATCH 0/6] bnxt patchset Kalesh A P
  2019-12-10 15:05 ` [dpdk-dev] [PATCH 1/6] net/bnxt: restore mac filters during reset recovery Kalesh A P
@ 2019-12-10 15:05 ` Kalesh A P
  2019-12-10 15:05 ` [dpdk-dev] [PATCH 3/6] net/bnxt: fix request for hot reset support Kalesh A P
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Kalesh A P @ 2019-12-10 15:05 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, ajit.khaparde

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

Older Firmware could have state information such as
MAC Filters, VLAN settings etc configured by user.
But new Firmware is unaware of this state information
and as a result driver should restore these settings
during reset recovery.

This patch restores the user configured vlan settings
prior to hot FW upgrade or FW error.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index addc850..d72a756 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3796,6 +3796,29 @@ static void bnxt_dev_cleanup(struct bnxt *bp)
 	bnxt_uninit_resources(bp, true);
 }
 
+static int bnxt_restore_vlan_filters(struct bnxt *bp)
+{
+	struct rte_eth_dev *dev = bp->eth_dev;
+	struct rte_vlan_filter_conf *vfc;
+	int vidx, vbit, rc;
+	uint16_t vlan_id;
+
+	for (vlan_id = 1; vlan_id <= RTE_ETHER_MAX_VLAN_ID; vlan_id++) {
+		vfc = &dev->data->vlan_filter_conf;
+		vidx = vlan_id / 64;
+		vbit = vlan_id % 64;
+
+		/* Each bit corresponds to a VLAN id */
+		if (vfc->ids[vidx] & (UINT64_C(1) << vbit)) {
+			rc = bnxt_add_vlan_filter(bp, vlan_id);
+			if (rc)
+				return rc;
+		}
+	}
+
+	return 0;
+}
+
 static int bnxt_restore_mac_filters(struct bnxt *bp)
 {
 	struct rte_eth_dev *dev = bp->eth_dev;
@@ -3849,6 +3872,10 @@ static int bnxt_restore_filters(struct bnxt *bp)
 		ret = bnxt_promiscuous_enable_op(dev);
 
 	ret = bnxt_restore_mac_filters(bp);
+	if (ret)
+		return ret;
+
+	ret = bnxt_restore_vlan_filters(bp);
 	/* TODO restore other filters as well */
 	return ret;
 }
-- 
2.10.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH 3/6] net/bnxt: fix request for hot reset support
  2019-12-10 15:05 [dpdk-dev] [PATCH 0/6] bnxt patchset Kalesh A P
  2019-12-10 15:05 ` [dpdk-dev] [PATCH 1/6] net/bnxt: restore mac filters during reset recovery Kalesh A P
  2019-12-10 15:05 ` [dpdk-dev] [PATCH 2/6] net/bnxt: restore vlan " Kalesh A P
@ 2019-12-10 15:05 ` Kalesh A P
  2019-12-10 15:05 ` [dpdk-dev] [PATCH 4/6] net/bnxt: remove unnecessary macro for unused variables Kalesh A P
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Kalesh A P @ 2019-12-10 15:05 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, ajit.khaparde

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

During the registration process, the drivers must publish
"HOT_RESET_SUPPORTED" capability to the core firmware only
if core firmware is capable of Hot Reset.

Fixes: df6cd7c1f73a ("net/bnxt: handle reset notify async event from FW")

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt.h      | 1 +
 drivers/net/bnxt/bnxt_hwrm.c | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index e259c82..f9e4d76 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -517,6 +517,7 @@ struct bnxt {
 #define BNXT_FLAG_INIT_DONE			BIT(24)
 #define BNXT_FLAG_FW_CAP_ONE_STEP_TX_TS		BIT(25)
 #define BNXT_FLAG_ADV_FLOW_MGMT			BIT(26)
+#define BNXT_FLAG_FW_CAP_HOT_RESET		BIT(27)
 #define BNXT_PF(bp)		(!((bp)->flags & BNXT_FLAG_VF))
 #define BNXT_VF(bp)		((bp)->flags & BNXT_FLAG_VF)
 #define BNXT_NPAR(bp)		((bp)->port_partition_type)
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index b1f908e..d30da9b 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -672,6 +672,11 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
 	else
 		bp->flags &= ~BNXT_FLAG_FW_CAP_ERR_RECOVER_RELOAD;
 
+	if (flags & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_HOT_RESET_CAPABLE)
+		bp->flags |= BNXT_FLAG_FW_CAP_HOT_RESET;
+	else
+		bp->flags &= ~BNXT_FLAG_FW_CAP_HOT_RESET;
+
 	HWRM_UNLOCK();
 
 	return rc;
@@ -756,7 +761,8 @@ int bnxt_hwrm_func_driver_register(struct bnxt *bp)
 	if (bp->flags & BNXT_FLAG_REGISTERED)
 		return 0;
 
-	flags = HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_HOT_RESET_SUPPORT;
+	if (bp->flags & BNXT_FLAG_FW_CAP_HOT_RESET)
+		flags = HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_HOT_RESET_SUPPORT;
 	if (bp->flags & BNXT_FLAG_FW_CAP_ERROR_RECOVERY)
 		flags |= HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_ERROR_RECOVERY_SUPPORT;
 
-- 
2.10.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH 4/6] net/bnxt: remove unnecessary macro for unused variables
  2019-12-10 15:05 [dpdk-dev] [PATCH 0/6] bnxt patchset Kalesh A P
                   ` (2 preceding siblings ...)
  2019-12-10 15:05 ` [dpdk-dev] [PATCH 3/6] net/bnxt: fix request for hot reset support Kalesh A P
@ 2019-12-10 15:05 ` Kalesh A P
  2019-12-10 15:05 ` [dpdk-dev] [PATCH 5/6] net/bnxt: reset filter indices on free Kalesh A P
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Kalesh A P @ 2019-12-10 15:05 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, ajit.khaparde

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

Remove "__rte_unused" instances that are not required.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Rahul Gupta <rahul.gupta@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 4 ++--
 drivers/net/bnxt/bnxt_flow.c   | 2 +-
 drivers/net/bnxt/bnxt_stats.c  | 6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index d72a756..2f84794 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3149,7 +3149,7 @@ bnxt_fdir_filter(struct rte_eth_dev *dev,
 }
 
 static int
-bnxt_filter_ctrl_op(struct rte_eth_dev *dev __rte_unused,
+bnxt_filter_ctrl_op(struct rte_eth_dev *dev,
 		    enum rte_filter_type filter_type,
 		    enum rte_filter_op filter_op, void *arg)
 {
@@ -4173,7 +4173,7 @@ static int bnxt_init_board(struct rte_eth_dev *eth_dev)
 	return 0;
 }
 
-static int bnxt_alloc_ctx_mem_blk(__rte_unused struct bnxt *bp,
+static int bnxt_alloc_ctx_mem_blk(struct bnxt *bp,
 				  struct bnxt_ctx_pg_info *ctx_pg,
 				  uint32_t mem_size,
 				  const char *suffix,
diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c
index 76e9584..447a51b 100644
--- a/drivers/net/bnxt/bnxt_flow.c
+++ b/drivers/net/bnxt/bnxt_flow.c
@@ -77,7 +77,7 @@ bnxt_flow_non_void_action(const struct rte_flow_action *cur)
 
 static int
 bnxt_filter_type_check(const struct rte_flow_item pattern[],
-		       struct rte_flow_error *error __rte_unused)
+		       struct rte_flow_error *error)
 {
 	const struct rte_flow_item *item =
 		bnxt_flow_non_void_item(pattern);
diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
index 14d355f..20a16a6 100644
--- a/drivers/net/bnxt/bnxt_stats.c
+++ b/drivers/net/bnxt/bnxt_stats.c
@@ -539,9 +539,9 @@ int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
 	return stat_count;
 }
 
-int bnxt_dev_xstats_get_names_op(__rte_unused struct rte_eth_dev *eth_dev,
-	struct rte_eth_xstat_name *xstats_names,
-	__rte_unused unsigned int limit)
+int bnxt_dev_xstats_get_names_op(struct rte_eth_dev *eth_dev,
+				 struct rte_eth_xstat_name *xstats_names,
+				 __rte_unused unsigned int limit)
 {
 	/* Account for the Tx drop pkts aka the Anti spoof counter */
 	const unsigned int stat_cnt = RTE_DIM(bnxt_rx_stats_strings) +
-- 
2.10.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev]  [PATCH 5/6] net/bnxt: reset filter indices on free
  2019-12-10 15:05 [dpdk-dev] [PATCH 0/6] bnxt patchset Kalesh A P
                   ` (3 preceding siblings ...)
  2019-12-10 15:05 ` [dpdk-dev] [PATCH 4/6] net/bnxt: remove unnecessary macro for unused variables Kalesh A P
@ 2019-12-10 15:05 ` Kalesh A P
  2019-12-10 15:05 ` [dpdk-dev] [PATCH 6/6] net/bnxt: add a field for fw capabilities Kalesh A P
  2019-12-13 22:41 ` [dpdk-dev] [PATCH 0/6] bnxt patchset Ajit Khaparde
  6 siblings, 0 replies; 8+ messages in thread
From: Kalesh A P @ 2019-12-10 15:05 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, ajit.khaparde

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

Fix bnxt_free_filter() to ensure that the filter indices
are reset correctly when a filter is freed.

This change helps in avoiding few duplicate code as well.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 10 ----------
 drivers/net/bnxt/bnxt_filter.c |  5 +++++
 drivers/net/bnxt/bnxt_flow.c   |  1 -
 3 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 2f84794..146f04b 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1007,8 +1007,6 @@ static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev,
 				STAILQ_REMOVE(&vnic->filter, filter,
 						bnxt_filter_info, next);
 				bnxt_hwrm_clear_l2_filter(bp, filter);
-				filter->mac_index = INVALID_MAC_INDEX;
-				memset(&filter->l2_addr, 0, RTE_ETHER_ADDR_LEN);
 				bnxt_free_filter(bp, filter);
 			}
 			filter = temp_filter;
@@ -1055,7 +1053,6 @@ static int bnxt_add_mac_filter(struct bnxt *bp, struct bnxt_vnic_info *vnic,
 		else
 			STAILQ_INSERT_TAIL(&vnic->filter, filter, next);
 	} else {
-		memset(&filter->l2_addr, 0, RTE_ETHER_ADDR_LEN);
 		bnxt_free_filter(bp, filter);
 	}
 
@@ -1781,7 +1778,6 @@ static int bnxt_add_vlan_filter(struct bnxt *bp, uint16_t vlan_id)
 		/* Free the newly allocated filter as we were
 		 * not able to create the filter in hardware.
 		 */
-		filter->fw_l2_filter_id = UINT64_MAX;
 		bnxt_free_filter(bp, filter);
 		return rc;
 	}
@@ -1831,7 +1827,6 @@ static int bnxt_del_dflt_mac_filter(struct bnxt *bp,
 				STAILQ_REMOVE(&vnic->filter, filter,
 					      bnxt_filter_info, next);
 				bnxt_free_filter(bp, filter);
-				filter->fw_l2_filter_id = UINT64_MAX;
 			}
 			return rc;
 		}
@@ -2705,14 +2700,11 @@ bnxt_cfg_ntuple_filter(struct bnxt *bp,
 
 		STAILQ_REMOVE(&vnic->filter, mfilter, bnxt_filter_info, next);
 		bnxt_free_filter(bp, mfilter);
-		mfilter->fw_l2_filter_id = -1;
 		bnxt_free_filter(bp, bfilter);
-		bfilter->fw_l2_filter_id = -1;
 	}
 
 	return 0;
 free_filter:
-	bfilter->fw_l2_filter_id = -1;
 	bnxt_free_filter(bp, bfilter);
 	return ret;
 }
@@ -3110,7 +3102,6 @@ bnxt_fdir_filter(struct rte_eth_dev *dev,
 			STAILQ_REMOVE(&vnic->filter, match,
 				      bnxt_filter_info, next);
 			bnxt_free_filter(bp, match);
-			filter->fw_l2_filter_id = -1;
 			bnxt_free_filter(bp, filter);
 		}
 		break;
@@ -3143,7 +3134,6 @@ bnxt_fdir_filter(struct rte_eth_dev *dev,
 	return ret;
 
 free_filter:
-	filter->fw_l2_filter_id = -1;
 	bnxt_free_filter(bp, filter);
 	return ret;
 }
diff --git a/drivers/net/bnxt/bnxt_filter.c b/drivers/net/bnxt/bnxt_filter.c
index da1a6c2..0c410f8 100644
--- a/drivers/net/bnxt/bnxt_filter.c
+++ b/drivers/net/bnxt/bnxt_filter.c
@@ -192,5 +192,10 @@ struct bnxt_filter_info *bnxt_get_unused_filter(struct bnxt *bp)
 
 void bnxt_free_filter(struct bnxt *bp, struct bnxt_filter_info *filter)
 {
+	memset(filter, 0, sizeof(*filter));
+	filter->mac_index = INVALID_MAC_INDEX;
+	filter->fw_l2_filter_id = UINT64_MAX;
+	filter->fw_ntuple_filter_id = UINT64_MAX;
+	filter->fw_em_filter_id = UINT64_MAX;
 	STAILQ_INSERT_TAIL(&bp->free_filter_list, filter, next);
 }
diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c
index 447a51b..7bd6811 100644
--- a/drivers/net/bnxt/bnxt_flow.c
+++ b/drivers/net/bnxt/bnxt_flow.c
@@ -1521,7 +1521,6 @@ bnxt_flow_validate(struct rte_eth_dev *dev,
 
 exit:
 	/* No need to hold on to this filter if we are just validating flow */
-	filter->fw_l2_filter_id = UINT64_MAX;
 	bnxt_free_filter(bp, filter);
 	bnxt_release_flow_lock(bp);
 
-- 
2.10.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev]  [PATCH 6/6] net/bnxt: add a field for fw capabilities
  2019-12-10 15:05 [dpdk-dev] [PATCH 0/6] bnxt patchset Kalesh A P
                   ` (4 preceding siblings ...)
  2019-12-10 15:05 ` [dpdk-dev] [PATCH 5/6] net/bnxt: reset filter indices on free Kalesh A P
@ 2019-12-10 15:05 ` Kalesh A P
  2019-12-13 22:41 ` [dpdk-dev] [PATCH 0/6] bnxt patchset Ajit Khaparde
  6 siblings, 0 replies; 8+ messages in thread
From: Kalesh A P @ 2019-12-10 15:05 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, ajit.khaparde

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

The purpose of this patch is used to add a new field "fw_cap"
in bnxt structure. The new "fw_cap" field store all the capabilities
reported by the FW. This information will help us to determine
the device capablities when registering feature support with FW.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        | 24 +++++++++++++-----------
 drivers/net/bnxt/bnxt_cpr.c    |  2 +-
 drivers/net/bnxt/bnxt_ethdev.c |  4 +++-
 drivers/net/bnxt/bnxt_hwrm.c   | 24 +++++++++---------------
 4 files changed, 26 insertions(+), 28 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index f9e4d76..ab18e8a 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -507,17 +507,13 @@ struct bnxt {
 #define BNXT_FLAG_STINGRAY		BIT(14)
 #define BNXT_FLAG_FW_RESET		BIT(15)
 #define BNXT_FLAG_FATAL_ERROR		BIT(16)
-#define BNXT_FLAG_FW_CAP_IF_CHANGE		BIT(17)
-#define BNXT_FLAG_IF_CHANGE_HOT_FW_RESET_DONE	BIT(18)
-#define BNXT_FLAG_FW_CAP_ERROR_RECOVERY		BIT(19)
-#define BNXT_FLAG_FW_HEALTH_CHECK_SCHEDULED	BIT(20)
-#define BNXT_FLAG_FW_CAP_ERR_RECOVER_RELOAD	BIT(21)
-#define BNXT_FLAG_EXT_STATS_SUPPORTED		BIT(22)
-#define BNXT_FLAG_NEW_RM			BIT(23)
-#define BNXT_FLAG_INIT_DONE			BIT(24)
-#define BNXT_FLAG_FW_CAP_ONE_STEP_TX_TS		BIT(25)
-#define BNXT_FLAG_ADV_FLOW_MGMT			BIT(26)
-#define BNXT_FLAG_FW_CAP_HOT_RESET		BIT(27)
+#define BNXT_FLAG_IF_CHANGE_HOT_FW_RESET_DONE	BIT(17)
+#define BNXT_FLAG_FW_HEALTH_CHECK_SCHEDULED	BIT(18)
+#define BNXT_FLAG_EXT_STATS_SUPPORTED		BIT(19)
+#define BNXT_FLAG_NEW_RM			BIT(20)
+#define BNXT_FLAG_INIT_DONE			BIT(21)
+#define BNXT_FLAG_FW_CAP_ONE_STEP_TX_TS		BIT(22)
+#define BNXT_FLAG_ADV_FLOW_MGMT			BIT(23)
 #define BNXT_PF(bp)		(!((bp)->flags & BNXT_FLAG_VF))
 #define BNXT_VF(bp)		((bp)->flags & BNXT_FLAG_VF)
 #define BNXT_NPAR(bp)		((bp)->port_partition_type)
@@ -531,6 +527,12 @@ struct bnxt {
 #define BNXT_HAS_NQ(bp)		BNXT_CHIP_THOR(bp)
 #define BNXT_HAS_RING_GRPS(bp)	(!BNXT_CHIP_THOR(bp))
 
+	uint32_t		fw_cap;
+#define BNXT_FW_CAP_HOT_RESET		BIT(0)
+#define BNXT_FW_CAP_IF_CHANGE		BIT(1)
+#define BNXT_FW_CAP_ERROR_RECOVERY	BIT(2)
+#define BNXT_FW_CAP_ERR_RECOVER_RELOAD	BIT(3)
+
 	uint32_t		flow_flags;
 #define BNXT_FLOW_FLAG_L2_HDR_SRC_FILTER_EN	BIT(0)
 	pthread_mutex_t         flow_lock;
diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c
index e6f30fe..2c3129f 100644
--- a/drivers/net/bnxt/bnxt_cpr.c
+++ b/drivers/net/bnxt/bnxt_cpr.c
@@ -21,7 +21,7 @@ void bnxt_wait_for_device_shutdown(struct bnxt *bp)
 	 * the SHUTDOWN bit in health register
 	 */
 	if (!(bp->recovery_info &&
-	      (bp->flags & BNXT_FLAG_FW_CAP_ERR_RECOVER_RELOAD)))
+	      (bp->fw_cap & BNXT_FW_CAP_ERR_RECOVER_RELOAD)))
 		return;
 
 	/* Driver has to wait for fw_reset_max_msecs or shutdown bit which comes
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 146f04b..1b4ed29 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -4617,6 +4617,8 @@ static int bnxt_init_fw(struct bnxt *bp)
 	uint16_t mtu;
 	int rc = 0;
 
+	bp->fw_cap = 0;
+
 	rc = bnxt_hwrm_ver_get(bp);
 	if (rc)
 		return rc;
@@ -4652,7 +4654,7 @@ static int bnxt_init_fw(struct bnxt *bp)
 	/* Get the adapter error recovery support info */
 	rc = bnxt_hwrm_error_recovery_qcfg(bp);
 	if (rc)
-		bp->flags &= ~BNXT_FLAG_FW_CAP_ERROR_RECOVERY;
+		bp->fw_cap &= ~BNXT_FW_CAP_ERROR_RECOVERY;
 
 	bnxt_hwrm_port_led_qcaps(bp);
 
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index d30da9b..d0dcd56 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -661,21 +661,15 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
 		bp->flags |= BNXT_FLAG_EXT_STATS_SUPPORTED;
 
 	if (flags & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_ERROR_RECOVERY_CAPABLE) {
-		bp->flags |= BNXT_FLAG_FW_CAP_ERROR_RECOVERY;
+		bp->fw_cap |= BNXT_FW_CAP_ERROR_RECOVERY;
 		PMD_DRV_LOG(DEBUG, "Adapter Error recovery SUPPORTED\n");
-	} else {
-		bp->flags &= ~BNXT_FLAG_FW_CAP_ERROR_RECOVERY;
 	}
 
 	if (flags & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_ERR_RECOVER_RELOAD)
-		bp->flags |= BNXT_FLAG_FW_CAP_ERR_RECOVER_RELOAD;
-	else
-		bp->flags &= ~BNXT_FLAG_FW_CAP_ERR_RECOVER_RELOAD;
+		bp->fw_cap |= BNXT_FW_CAP_ERR_RECOVER_RELOAD;
 
 	if (flags & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_HOT_RESET_CAPABLE)
-		bp->flags |= BNXT_FLAG_FW_CAP_HOT_RESET;
-	else
-		bp->flags &= ~BNXT_FLAG_FW_CAP_HOT_RESET;
+		bp->fw_cap |= BNXT_FW_CAP_HOT_RESET;
 
 	HWRM_UNLOCK();
 
@@ -761,9 +755,9 @@ int bnxt_hwrm_func_driver_register(struct bnxt *bp)
 	if (bp->flags & BNXT_FLAG_REGISTERED)
 		return 0;
 
-	if (bp->flags & BNXT_FLAG_FW_CAP_HOT_RESET)
+	if (bp->fw_cap & BNXT_FW_CAP_HOT_RESET)
 		flags = HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_HOT_RESET_SUPPORT;
-	if (bp->flags & BNXT_FLAG_FW_CAP_ERROR_RECOVERY)
+	if (bp->fw_cap & BNXT_FW_CAP_ERROR_RECOVERY)
 		flags |= HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_ERROR_RECOVERY_SUPPORT;
 
 	/* PFs and trusted VFs should indicate the support of the
@@ -803,7 +797,7 @@ int bnxt_hwrm_func_driver_register(struct bnxt *bp)
 				 ASYNC_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE |
 				 ASYNC_CMPL_EVENT_ID_LINK_SPEED_CHANGE |
 				 ASYNC_CMPL_EVENT_ID_RESET_NOTIFY);
-	if (bp->flags & BNXT_FLAG_FW_CAP_ERROR_RECOVERY)
+	if (bp->fw_cap & BNXT_FW_CAP_ERROR_RECOVERY)
 		req.async_event_fwd[0] |=
 			rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_ERROR_RECOVERY);
 	req.async_event_fwd[1] |=
@@ -816,7 +810,7 @@ int bnxt_hwrm_func_driver_register(struct bnxt *bp)
 
 	flags = rte_le_to_cpu_32(resp->flags);
 	if (flags & HWRM_FUNC_DRV_RGTR_OUTPUT_FLAGS_IF_CHANGE_SUPPORTED)
-		bp->flags |= BNXT_FLAG_FW_CAP_IF_CHANGE;
+		bp->fw_cap |= BNXT_FW_CAP_IF_CHANGE;
 
 	HWRM_UNLOCK();
 
@@ -4849,7 +4843,7 @@ int bnxt_hwrm_if_change(struct bnxt *bp, bool up)
 	uint32_t flags;
 	int rc;
 
-	if (!(bp->flags & BNXT_FLAG_FW_CAP_IF_CHANGE))
+	if (!(bp->fw_cap & BNXT_FW_CAP_IF_CHANGE))
 		return 0;
 
 	/* Do not issue FUNC_DRV_IF_CHANGE during reset recovery.
@@ -4892,7 +4886,7 @@ int bnxt_hwrm_error_recovery_qcfg(struct bnxt *bp)
 	int rc;
 
 	/* Older FW does not have error recovery support */
-	if (!(bp->flags & BNXT_FLAG_FW_CAP_ERROR_RECOVERY))
+	if (!(bp->fw_cap & BNXT_FW_CAP_ERROR_RECOVERY))
 		return 0;
 
 	if (!info) {
-- 
2.10.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH 0/6] bnxt patchset
  2019-12-10 15:05 [dpdk-dev] [PATCH 0/6] bnxt patchset Kalesh A P
                   ` (5 preceding siblings ...)
  2019-12-10 15:05 ` [dpdk-dev] [PATCH 6/6] net/bnxt: add a field for fw capabilities Kalesh A P
@ 2019-12-13 22:41 ` Ajit Khaparde
  6 siblings, 0 replies; 8+ messages in thread
From: Ajit Khaparde @ 2019-12-13 22:41 UTC (permalink / raw)
  To: Kalesh A P; +Cc: dpdk-dev, Ferruh Yigit

On Tue, Dec 10, 2019 at 6:48 AM Kalesh A P <
kalesh-anakkur.purayil@broadcom.com> wrote:

> From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
>
> bnxt patchset with bug fixes and enhancements.
>
> Please apply.
>
Patchset applied to dpdk-next-net-brcm. Thanks


>
> Kalesh AP (6):
>   net/bnxt: restore mac filters during reset recovery
>   net/bnxt: restore vlan filters during reset recovery
>   net/bnxt: fix request for hot reset support
>   net/bnxt: remove unnecessary macro for unused variables
>   net/bnxt: reset filter indices on free
>   net/bnxt: add a field for fw capabilities
>
>  drivers/net/bnxt/bnxt.h        | 23 ++++++-----
>  drivers/net/bnxt/bnxt_cpr.c    |  2 +-
>  drivers/net/bnxt/bnxt_ethdev.c | 88
> +++++++++++++++++++++++++++++++++++-------
>  drivers/net/bnxt/bnxt_filter.c |  5 +++
>  drivers/net/bnxt/bnxt_flow.c   |  3 +-
>  drivers/net/bnxt/bnxt_hwrm.c   | 24 ++++++------
>  drivers/net/bnxt/bnxt_stats.c  |  6 +--
>  7 files changed, 110 insertions(+), 41 deletions(-)
>
> --
> 2.10.1
>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-12-13 22:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-10 15:05 [dpdk-dev] [PATCH 0/6] bnxt patchset Kalesh A P
2019-12-10 15:05 ` [dpdk-dev] [PATCH 1/6] net/bnxt: restore mac filters during reset recovery Kalesh A P
2019-12-10 15:05 ` [dpdk-dev] [PATCH 2/6] net/bnxt: restore vlan " Kalesh A P
2019-12-10 15:05 ` [dpdk-dev] [PATCH 3/6] net/bnxt: fix request for hot reset support Kalesh A P
2019-12-10 15:05 ` [dpdk-dev] [PATCH 4/6] net/bnxt: remove unnecessary macro for unused variables Kalesh A P
2019-12-10 15:05 ` [dpdk-dev] [PATCH 5/6] net/bnxt: reset filter indices on free Kalesh A P
2019-12-10 15:05 ` [dpdk-dev] [PATCH 6/6] net/bnxt: add a field for fw capabilities Kalesh A P
2019-12-13 22:41 ` [dpdk-dev] [PATCH 0/6] bnxt patchset Ajit Khaparde

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).