[35/36] net/bnxt: rename fields in the device params structure
diff mbox series

Message ID 20200610065733.18698-36-somnath.kotur@broadcom.com
State Superseded, archived
Delegated to: Ajit Khaparde
Headers show
Series
  • bnxt fixes and enhancements
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Somnath Kotur June 10, 2020, 6:57 a.m. UTC
From: Kishore Padmanabha <kishore.padmanabha@broadcom.com>

The fields in the device params structure are renamed to reflect
the usage of those fields.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Michael Baucom <michael.baucom@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c             | 12 ++++++------
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c          |  4 ++--
 drivers/net/bnxt/tf_ulp/ulp_mapper.c           |  5 +++--
 drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c         |  4 ++--
 drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h |  7 +++++++
 drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c  | 19 ++++++++++---------
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h  | 12 ++++++------
 7 files changed, 36 insertions(+), 27 deletions(-)

Patch
diff mbox series

diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
index fd3f61b..0c3c638 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
@@ -146,14 +146,14 @@  bnxt_init_tbl_scope_parms(struct bnxt *bp,
 		params->rx_max_action_entry_sz_in_bits =
 			BNXT_ULP_DFLT_RX_MAX_ACTN_ENTRY;
 		params->rx_mem_size_in_mb = BNXT_ULP_DFLT_RX_MEM;
-		params->rx_num_flows_in_k = dparms->num_flows / (1024);
+		params->rx_num_flows_in_k = dparms->flow_db_num_entries / 1024;
 		params->rx_tbl_if_id = BNXT_ULP_RX_TBL_IF_ID;
 
 		params->tx_max_key_sz_in_bits = BNXT_ULP_DFLT_TX_MAX_KEY;
 		params->tx_max_action_entry_sz_in_bits =
 			BNXT_ULP_DFLT_TX_MAX_ACTN_ENTRY;
 		params->tx_mem_size_in_mb = BNXT_ULP_DFLT_TX_MEM;
-		params->tx_num_flows_in_k = dparms->num_flows / (1024);
+		params->tx_num_flows_in_k = dparms->flow_db_num_entries / 1024;
 		params->tx_tbl_if_id = BNXT_ULP_TX_TBL_IF_ID;
 	}
 }
@@ -299,11 +299,11 @@  ulp_dparms_init(struct bnxt *bp,
 	}
 
 	/* num_flows = max_num_kflows * 1024 */
-	dparms->num_flows = bp->max_num_kflows * 1024;
+	dparms->flow_db_num_entries = bp->max_num_kflows * 1024;
 	/* GFID =  2 * num_flows */
-	dparms->gfid_entries = dparms->num_flows * 2;
+	dparms->mark_db_gfid_entries = dparms->flow_db_num_entries * 2;
 	BNXT_TF_DBG(DEBUG, "Set the number of flows = %"PRIu64"\n",
-		    dparms->num_flows);
+		    dparms->flow_db_num_entries);
 
 	return 0;
 }
@@ -328,7 +328,7 @@  ulp_dparms_dev_port_intf_update(struct bnxt *bp,
 	}
 
 	/* Update the bp flag with gfid flag */
-	if (dparms->global_fid_enable)
+	if (dparms->flow_mem_type == BNXT_ULP_FLOW_MEM_TYPE_EXT)
 		bp->flags |= BNXT_FLAG_GFID_ENABLE;
 
 	return 0;
diff --git a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c
index fc4c4da..22996e5 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c
@@ -300,7 +300,7 @@  int32_t	ulp_flow_db_init(struct bnxt_ulp_context *ulp_ctxt)
 
 	/* Populate the regular flow table limits. */
 	flow_tbl = &flow_db->flow_tbl[BNXT_ULP_REGULAR_FLOW_TABLE];
-	flow_tbl->num_flows = dparms->num_flows + 1;
+	flow_tbl->num_flows = dparms->flow_db_num_entries + 1;
 	flow_tbl->num_resources = (flow_tbl->num_flows *
 				   dparms->num_resources_per_flow);
 
@@ -317,7 +317,7 @@  int32_t	ulp_flow_db_init(struct bnxt_ulp_context *ulp_ctxt)
 		goto error_free;
 
 	/* add 1 since we are not using index 0 for flow id */
-	flow_db->func_id_tbl_size = dparms->num_flows + 1;
+	flow_db->func_id_tbl_size = dparms->flow_db_num_entries + 1;
 	/* Allocate the function Id table */
 	flow_db->func_id_tbl = rte_zmalloc("bnxt_ulp_flow_db_func_id_table",
 					   flow_db->func_id_tbl_size *
diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
index f86cd76..d8e544f 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
@@ -1285,6 +1285,7 @@  ulp_mapper_em_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	struct tf_insert_em_entry_parms iparms = { 0 };
 	struct tf_delete_em_entry_parms free_parms = { 0 };
 	int32_t	trc;
+	enum bnxt_ulp_flow_mem_type mtype = parms->device_params->flow_mem_type;
 	int32_t rc = 0;
 
 	kflds = ulp_mapper_key_fields_get(tbl, &num_kflds);
@@ -1375,10 +1376,10 @@  ulp_mapper_em_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	}
 
 	/* Mark action process */
-	if (parms->device_params->global_fid_enable &&
+	if (mtype == BNXT_ULP_FLOW_MEM_TYPE_EXT &&
 	    tbl->resource_type == TF_MEM_EXTERNAL)
 		rc = ulp_mapper_mark_gfid_process(parms, tbl, iparms.flow_id);
-	else if (!parms->device_params->global_fid_enable &&
+	else if (mtype == BNXT_ULP_FLOW_MEM_TYPE_INT &&
 		 tbl->resource_type == TF_MEM_INTERNAL)
 		rc = ulp_mapper_mark_act_ptr_process(parms, tbl);
 	if (rc) {
diff --git a/drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c b/drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c
index 0c47768..89c08ab 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c
@@ -77,7 +77,7 @@  ulp_mark_db_init(struct bnxt_ulp_context *ctxt)
 		goto mem_error;
 
 	/* Need to allocate 2 * Num flows to account for hash type bit.*/
-	mark_tbl->lfid_num_entries = dparms->lfid_entries;
+	mark_tbl->lfid_num_entries = dparms->mark_db_lfid_entries;
 	mark_tbl->lfid_tbl = rte_zmalloc("ulp_rx_em_flow_mark_table",
 					 mark_tbl->lfid_num_entries *
 					 sizeof(struct bnxt_lfid_mark_info),
@@ -86,7 +86,7 @@  ulp_mark_db_init(struct bnxt_ulp_context *ctxt)
 		goto mem_error;
 
 	/* Need to allocate 2 * Num flows to account for hash type bit */
-	mark_tbl->gfid_num_entries = dparms->gfid_entries;
+	mark_tbl->gfid_num_entries = dparms->mark_db_gfid_entries;
 	mark_tbl->gfid_tbl = rte_zmalloc("ulp_rx_eem_flow_mark_table",
 					 mark_tbl->gfid_num_entries *
 					 sizeof(struct bnxt_gfid_mark_info),
diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h b/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h
index 5376245..50a28af 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h
@@ -139,6 +139,13 @@  enum bnxt_ulp_direction {
 	BNXT_ULP_DIRECTION_LAST = 2
 };
 
+enum bnxt_ulp_flow_mem_type {
+	BNXT_ULP_FLOW_MEM_TYPE_INT = 0,
+	BNXT_ULP_FLOW_MEM_TYPE_EXT = 1,
+	BNXT_ULP_FLOW_MEM_TYPE_BOTH = 2,
+	BNXT_ULP_FLOW_MEM_TYPE_LAST = 3
+};
+
 enum bnxt_ulp_glb_regfile_index {
 	BNXT_ULP_GLB_REGFILE_INDEX_GLB_PROF_FUNC_ID = 0,
 	BNXT_ULP_GLB_REGFILE_INDEX_LAST = 1
diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c b/drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c
index b49b0a1..bd36368 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c
@@ -313,15 +313,16 @@  struct bnxt_ulp_cache_tbl_params ulp_cache_tbl_params[] = {
 
 struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	[BNXT_ULP_DEVICE_ID_WH_PLUS] = {
-		.global_fid_enable       = BNXT_ULP_SYM_YES,
-		.byte_order              = BNXT_ULP_BYTE_ORDER_LE,
-		.encap_byte_swap         = 1,
-		.lfid_entries            = 16384,
-		.lfid_entry_size         = 4,
-		.gfid_entries            = 65536,
-		.gfid_entry_size         = 4,
-		.num_flows               = 32768,
-		.num_resources_per_flow  = 8
+	.description            = "Whitney_Plus",
+	.flow_mem_type          = BNXT_ULP_FLOW_MEM_TYPE_EXT,
+	.byte_order             = BNXT_ULP_BYTE_ORDER_LE,
+	.encap_byte_swap        = 1,
+	.flow_db_num_entries    = 32768,
+	.mark_db_lfid_entries   = 65536,
+	.mark_db_gfid_entries   = 65536,
+	.flow_count_db_entries  = 16384,
+	.num_resources_per_flow = 8,
+	.num_phy_ports          = 2
 	}
 };
 
diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_struct.h b/drivers/net/bnxt/tf_ulp/ulp_template_struct.h
index 5d11a7e..5c43358 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_template_struct.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_template_struct.h
@@ -137,14 +137,14 @@  extern struct bnxt_ulp_act_match_info ulp_act_match_list[];
 /* Device specific parameters */
 struct bnxt_ulp_device_params {
 	uint8_t				description[16];
-	uint32_t			global_fid_enable;
+	enum bnxt_ulp_flow_mem_type	flow_mem_type;
 	enum bnxt_ulp_byte_order	byte_order;
 	uint8_t				encap_byte_swap;
-	uint32_t			lfid_entries;
-	uint32_t			lfid_entry_size;
-	uint64_t			gfid_entries;
-	uint32_t			gfid_entry_size;
-	uint64_t			num_flows;
+	uint8_t				num_phy_ports;
+	uint32_t			mark_db_lfid_entries;
+	uint64_t			mark_db_gfid_entries;
+	uint64_t			flow_db_num_entries;
+	uint32_t			flow_count_db_entries;
 	uint32_t			num_resources_per_flow;
 };