Skip to contentSkip to conversation

bug fixes for bnxt PMD

PATCH In review Ajit Khaparde 1 participant 11 messages May 15, 2020 – May 16, 2020 Network drivers

lore
Share & tools
lore
#0 lore raw

cover bug fixes for bnxt PMD

Patchset with fixes.
The patch [1/9] enhances the log message in case of a FW command timeout. The rest of the patches address a perf regression. Recent commits caused a regression in performance because bnxt structure became too big and noticed in rc2.
Most of the patches reduce the memory footprint of the struct bnxt. With these changes the performance is back to normal.

Ajit Khaparde (7):
net/bnxt: fix error log for command timeout net/bnxt: fix to alloc LED config info net/bnxt: fix to alloc COS queue info dynamically net/bnxt: fix to allocate flow stat related structs net/bnxt: fix to alloc link info struct net/bnxt: fix to alloc PF info structure net/bnxt: fix to use RSS config from eth dev struct

Kalesh AP (1):
net/bnxt: fix to remove unneeded structure variable

Mike Baucom (1):
net/bnxt: fix to allocate bnxt ulp context

 drivers/net/bnxt/bnxt.h            |  47 ++--
 drivers/net/bnxt/bnxt_cpr.c        |  20 +-
 drivers/net/bnxt/bnxt_ethdev.c     | 331 ++++++++++++++++++++---------
 drivers/net/bnxt/bnxt_filter.c     |  12 +-
 drivers/net/bnxt/bnxt_flow.c       |  14 +-
 drivers/net/bnxt/bnxt_hwrm.c       | 205 +++++++++---------
 drivers/net/bnxt/bnxt_rxq.c        |   4 +-
 drivers/net/bnxt/bnxt_rxr.c        |   4 +-
 drivers/net/bnxt/bnxt_stats.c      |  14 +-
 drivers/net/bnxt/rte_pmd_bnxt.c    |  98 ++++-----
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c |  64 ++++--
 11 files changed, 492 insertions(+), 321 deletions(-)
Signature · 1 line
2.21.1 (Apple Git-122.3)
#1 lore raw

PATCH 1/9 net/bnxt: fix error log for command timeout

Log the command sequence number to aid debug in case of a FW command timeout.

Fixes 804e746c7b73 ("net/bnxt: add hardware resource manager init code")
---
 drivers/net/bnxt/bnxt_hwrm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt_hwrm.c +3 -2
index 77a911067..d80d67a2d 100644
@@ -164,8 +164,9 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
 		    rte_cpu_to_le_16(req->req_type) == HWRM_VER_GET)
 			return -ETIMEDOUT;
 
-		PMD_DRV_LOG(ERR, "Error(timeout) sending msg 0x%04x\n",
-			    req->req_type);
+		PMD_DRV_LOG(ERR,
+			    "Error(timeout) sending msg 0x%04x, seq_id %d\n",
+			    req->req_type, req->seq_id);
 		return -ETIMEDOUT;
 	}
 	return 0;
Signature · 1 line
2.21.1 (Apple Git-122.3)
#2 lore raw

PATCH 2/9 net/bnxt: fix to alloc LED config info

In reply to Ajit Khaparde

Dynamically allocate bnxt_led_cfg.
This helps reduces memory footprint of struct bnxt.

Fixes bb81e07323b ("net/bnxt: support LED on/off")
---
 drivers/net/bnxt/bnxt.h        |  4 ++--
 drivers/net/bnxt/bnxt_ethdev.c | 23 +++++++++++++++++++++++
 drivers/net/bnxt/bnxt_hwrm.c   | 14 +++++++-------
 3 files changed, 32 insertions(+), 9 deletions(-)
drivers/net/bnxt/bnxt.h +2 -2
index bf5b39cd3..f4b39b345 100644
@@ -147,6 +147,7 @@
 #define BNXT_NUM_CMPL_DMA_AGGR_DURING_INT	12
 
 struct bnxt_led_info {
+	uint8_t	     num_leds;
 	uint8_t      led_id;
 	uint8_t      led_type;
 	uint8_t      led_group_id;
@@ -686,8 +687,7 @@ struct bnxt {
 	uint32_t		fw_ver;
 	uint32_t		hwrm_spec_code;
 
-	struct bnxt_led_info	leds[BNXT_MAX_LED];
-	uint8_t			num_leds;
+	struct bnxt_led_info	*leds;
 	struct bnxt_ptp_cfg     *ptp_cfg;
 	uint16_t		vf_resv_strategy;
 	struct bnxt_ctx_mem_info        *ctx;
drivers/net/bnxt/bnxt_ethdev.c +23 -0
index 2ba9d6bad..3bd30dfa1 100644
@@ -191,6 +191,12 @@ static uint16_t  bnxt_rss_hash_tbl_size(const struct bnxt *bp)
 	return bnxt_rss_ctxts(bp) * BNXT_RSS_ENTRIES_PER_CTX_THOR;
 }
 
+static void bnxt_free_leds_info(struct bnxt *bp)
+{
+	rte_free(bp->leds);
+	bp->leds = NULL;
+}
+
 static void bnxt_free_mem(struct bnxt *bp, bool reconfig)
 {
 	bnxt_free_filter_mem(bp);
@@ -213,6 +219,17 @@ static void bnxt_free_mem(struct bnxt *bp, bool reconfig)
 	bp->grp_info = NULL;
 }
 
+static int bnxt_alloc_leds_info(struct bnxt *bp)
+{
+	bp->leds = rte_zmalloc("bnxt_leds",
+			       BNXT_MAX_LED * sizeof(struct bnxt_led_info),
+			       0);
+	if (bp->leds == NULL)
+		return -ENOMEM;
+
+	return 0;
+}
+
 static int bnxt_alloc_mem(struct bnxt *bp, bool reconfig)
 {
 	int rc;
@@ -1216,6 +1233,8 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev)
 
 	bnxt_uninit_resources(bp, false);
 
+	bnxt_free_leds_info(bp);
+
 	eth_dev->dev_ops = NULL;
 	eth_dev->rx_pkt_burst = NULL;
 	eth_dev->tx_pkt_burst = NULL;
@@ -5359,6 +5378,10 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 			    "Failed to allocate hwrm resource rc: %x\n", rc);
 		goto error_free;
 	}
+	rc = bnxt_alloc_leds_info(bp);
+	if (rc)
+		goto error_free;
+
 	rc = bnxt_init_resources(bp, false);
 	if (rc)
 		goto error_free;
drivers/net/bnxt/bnxt_hwrm.c +7 -7
index d80d67a2d..148000934 100644
@@ -3900,17 +3900,17 @@ int bnxt_hwrm_port_led_qcaps(struct bnxt *bp)
 	if (resp->num_leds > 0 && resp->num_leds < BNXT_MAX_LED) {
 		unsigned int i;
 
-		bp->num_leds = resp->num_leds;
+		bp->leds->num_leds = resp->num_leds;
 		memcpy(bp->leds, &resp->led0_id,
-			sizeof(bp->leds[0]) * bp->num_leds);
-		for (i = 0; i < bp->num_leds; i++) {
+			sizeof(bp->leds[0]) * bp->leds->num_leds);
+		for (i = 0; i < bp->leds->num_leds; i++) {
 			struct bnxt_led_info *led = &bp->leds[i];
 
 			uint16_t caps = led->led_state_caps;
 
 			if (!led->led_group_id ||
 				!BNXT_LED_ALT_BLINK_CAP(caps)) {
-				bp->num_leds = 0;
+				bp->leds->num_leds = 0;
 				break;
 			}
 		}
@@ -3930,7 +3930,7 @@ int bnxt_hwrm_port_led_cfg(struct bnxt *bp, bool led_on)
 	uint16_t duration = 0;
 	int rc, i;
 
-	if (!bp->num_leds || BNXT_VF(bp))
+	if (!bp->leds->num_leds || BNXT_VF(bp))
 		return -EOPNOTSUPP;
 
 	HWRM_PREP(&req, HWRM_PORT_LED_CFG, BNXT_USE_CHIMP_MB);
@@ -3940,9 +3940,9 @@ int bnxt_hwrm_port_led_cfg(struct bnxt *bp, bool led_on)
 		duration = rte_cpu_to_le_16(500);
 	}
 	req.port_id = bp->pf.port_id;
-	req.num_leds = bp->num_leds;
+	req.num_leds = bp->leds->num_leds;
 	led_cfg = (struct bnxt_led_cfg *)&req.led0_id;
-	for (i = 0; i < bp->num_leds; i++, led_cfg++) {
+	for (i = 0; i < bp->leds->num_leds; i++, led_cfg++) {
 		req.enables |= BNXT_LED_DFLT_ENABLES(i);
 		led_cfg->led_id = bp->leds[i].led_id;
 		led_cfg->led_state = led_state;
Signature · 1 line
2.21.1 (Apple Git-122.3)
#3 lore raw

PATCH 3/9 net/bnxt: fix to alloc COS queue info dynamically

In reply to Ajit Khaparde
Fixes 698aa7e95325 ("net/bnxt: add code to determine the Tx COS queue")
---
 drivers/net/bnxt/bnxt.h        |  4 ++--
 drivers/net/bnxt/bnxt_ethdev.c | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt.h +2 -2
index f4b39b345..570767253 100644
@@ -637,8 +637,8 @@ struct bnxt {
 	uint32_t			hwrm_cmd_timeout;
 
 	struct bnxt_link_info	link_info;
-	struct bnxt_cos_queue_info	rx_cos_queue[BNXT_COS_QUEUE_COUNT];
-	struct bnxt_cos_queue_info	tx_cos_queue[BNXT_COS_QUEUE_COUNT];
+	struct bnxt_cos_queue_info	*rx_cos_queue;
+	struct bnxt_cos_queue_info	*tx_cos_queue;
 	uint8_t			tx_cosq_id[BNXT_COS_QUEUE_COUNT];
 	uint8_t			rx_cosq_cnt;
 	uint8_t                 max_tc;
drivers/net/bnxt/bnxt_ethdev.c +32 -0
index 3bd30dfa1..fa1f84d44 100644
@@ -197,6 +197,12 @@ static void bnxt_free_leds_info(struct bnxt *bp)
 	bp->leds = NULL;
 }
 
+static void bnxt_free_cos_queues(struct bnxt *bp)
+{
+	rte_free(bp->rx_cos_queue);
+	rte_free(bp->tx_cos_queue);
+}
+
 static void bnxt_free_mem(struct bnxt *bp, bool reconfig)
 {
 	bnxt_free_filter_mem(bp);
@@ -230,6 +236,27 @@ static int bnxt_alloc_leds_info(struct bnxt *bp)
 	return 0;
 }
 
+static int bnxt_alloc_cos_queues(struct bnxt *bp)
+{
+	bp->rx_cos_queue =
+		rte_zmalloc("bnxt_rx_cosq",
+			    BNXT_COS_QUEUE_COUNT *
+			    sizeof(struct bnxt_cos_queue_info),
+			    0);
+	if (bp->rx_cos_queue == NULL)
+		return -ENOMEM;
+
+	bp->tx_cos_queue =
+		rte_zmalloc("bnxt_tx_cosq",
+			    BNXT_COS_QUEUE_COUNT *
+			    sizeof(struct bnxt_cos_queue_info),
+			    0);
+	if (bp->tx_cos_queue == NULL)
+		return -ENOMEM;
+
+	return 0;
+}
+
 static int bnxt_alloc_mem(struct bnxt *bp, bool reconfig)
 {
 	int rc;
@@ -1234,6 +1261,7 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev)
 	bnxt_uninit_resources(bp, false);
 
 	bnxt_free_leds_info(bp);
+	bnxt_free_cos_queues(bp);
 
 	eth_dev->dev_ops = NULL;
 	eth_dev->rx_pkt_burst = NULL;
@@ -5382,6 +5410,10 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 	if (rc)
 		goto error_free;
 
+	rc = bnxt_alloc_cos_queues(bp);
+	if (rc)
+		goto error_free;
+
 	rc = bnxt_init_resources(bp, false);
 	if (rc)
 		goto error_free;
Signature · 1 line
2.21.1 (Apple Git-122.3)
#4 lore raw

PATCH 4/9 net/bnxt: fix to allocate flow stat related structs

In reply to Ajit Khaparde

Consolidate flow stat related structs for performance improvement. The intention of this patch is to reduce the size struct bnxt which had grown because of recent changes and was impacting performance.

Fixes 02a95625fe9c ("net/bnxt: add flow stats in extended stats")
---
 drivers/net/bnxt/bnxt.h        |  19 ++--
 drivers/net/bnxt/bnxt_ethdev.c | 153 +++++++++++++++++++++------------
 drivers/net/bnxt/bnxt_flow.c   |  14 +--
 drivers/net/bnxt/bnxt_hwrm.c   |   5 +-
 drivers/net/bnxt/bnxt_stats.c  |  14 +--
 5 files changed, 127 insertions(+), 78 deletions(-)
drivers/net/bnxt/bnxt.h +13 -6
index 570767253..b71435495 100644
@@ -515,6 +515,16 @@ struct bnxt_mark_info {
 #define BNXT_FW_STATUS_SHUTDOWN		0x100000
 
 #define BNXT_HWRM_SHORT_REQ_LEN		sizeof(struct hwrm_short_input)
+
+struct bnxt_flow_stat_info {
+	uint16_t                max_fc;
+	uint16_t		flow_count;
+	struct bnxt_ctx_mem_buf_info rx_fc_in_tbl;
+	struct bnxt_ctx_mem_buf_info rx_fc_out_tbl;
+	struct bnxt_ctx_mem_buf_info tx_fc_in_tbl;
+	struct bnxt_ctx_mem_buf_info tx_fc_out_tbl;
+};
+
 struct bnxt {
 	void				*bar0;
 
@@ -549,6 +559,7 @@ struct bnxt {
 #define BNXT_FLAG_FW_CAP_ONE_STEP_TX_TS		BIT(22)
 #define BNXT_FLAG_FC_THREAD			BIT(23)
 #define BNXT_FLAG_RX_VECTOR_PKT_MODE		BIT(24)
+#define BNXT_FLAG_FLOW_XSTATS_EN		BIT(25)
 #define BNXT_PF(bp)		(!((bp)->flags & BNXT_FLAG_VF))
 #define BNXT_VF(bp)		((bp)->flags & BNXT_FLAG_VF)
 #define BNXT_NPAR(bp)		((bp)->flags & BNXT_FLAG_NPAR_PF)
@@ -561,6 +572,7 @@ struct bnxt {
 #define BNXT_STINGRAY(bp)	((bp)->flags & BNXT_FLAG_STINGRAY)
 #define BNXT_HAS_NQ(bp)		BNXT_CHIP_THOR(bp)
 #define BNXT_HAS_RING_GRPS(bp)	(!BNXT_CHIP_THOR(bp))
+#define BNXT_FLOW_XSTATS_EN(bp)	((bp)->flags & BNXT_FLAG_FLOW_XSTATS_EN)
 
 	uint32_t		fw_cap;
 #define BNXT_FW_CAP_HOT_RESET		BIT(0)
@@ -709,12 +721,7 @@ struct bnxt {
 	struct tf		tfp;
 	struct bnxt_ulp_context	ulp_ctx;
 	uint8_t			truflow;
-	uint16_t                max_fc;
-	struct bnxt_ctx_mem_buf_info rx_fc_in_tbl;
-	struct bnxt_ctx_mem_buf_info rx_fc_out_tbl;
-	struct bnxt_ctx_mem_buf_info tx_fc_in_tbl;
-	struct bnxt_ctx_mem_buf_info tx_fc_out_tbl;
-	uint16_t		flow_count;
+	struct bnxt_flow_stat_info *flow_stat;
 	uint8_t			flow_xstat;
 };
 
drivers/net/bnxt/bnxt_ethdev.c +97 -56

292 lines not on this page · raw message

drivers/net/bnxt/bnxt_flow.c +8 -6
index 44734272f..84a21dba9 100644
@@ -1633,7 +1633,7 @@ static void
 bnxt_setup_flow_counter(struct bnxt *bp)
 {
 	if (bp->fw_cap & BNXT_FW_CAP_ADV_FLOW_COUNTERS &&
-	    !(bp->flags & BNXT_FLAG_FC_THREAD)) {
+	    !(bp->flags & BNXT_FLAG_FC_THREAD) && BNXT_FLOW_XSTATS_EN(bp)) {
 		rte_eal_alarm_set(US_PER_S * BNXT_FC_TIMER,
 				  bnxt_flow_cnt_alarm_cb,
 				  (void *)bp);
@@ -1646,13 +1646,13 @@ void bnxt_flow_cnt_alarm_cb(void *arg)
 	int rc = 0;
 	struct bnxt *bp = arg;
 
-	if (!bp->rx_fc_out_tbl.va) {
-		PMD_DRV_LOG(ERR, "bp->rx_fc_out_tbl.va is NULL?\n");
+	if (!bp->flow_stat->rx_fc_out_tbl.va) {
+		PMD_DRV_LOG(ERR, "bp->flow_stat->rx_fc_out_tbl.va is NULL?\n");
 		bnxt_cancel_fc_thread(bp);
 		return;
 	}
 
-	if (!bp->flow_count) {
+	if (!bp->flow_stat->flow_count) {
 		bnxt_cancel_fc_thread(bp);
 		return;
 	}
@@ -1830,7 +1830,8 @@ bnxt_flow_create(struct rte_eth_dev *dev,
 			bp->mark_table[flow_id].valid = true;
 			bp->mark_table[flow_id].mark_id = filter->mark;
 		}
-		bp->flow_count++;
+		if (BNXT_FLOW_XSTATS_EN(bp))
+			bp->flow_stat->flow_count++;
 		bnxt_release_flow_lock(bp);
 		bnxt_setup_flow_counter(bp);
 		return flow;
@@ -1952,7 +1953,8 @@ _bnxt_flow_destroy(struct bnxt *bp,
 		bnxt_free_filter(bp, filter);
 		STAILQ_REMOVE(&vnic->flow_list, flow, rte_flow, next);
 		rte_free(flow);
-		bp->flow_count--;
+		if (BNXT_FLOW_XSTATS_EN(bp))
+			bp->flow_stat->flow_count--;
 
 		/* If this was the last flow associated with this vnic,
 		 * switch the queue back to RSS pool.
drivers/net/bnxt/bnxt_hwrm.c +2 -3
index 148000934..4022fafd1 100644
@@ -5274,7 +5274,6 @@ int bnxt_hwrm_cfa_counter_qcaps(struct bnxt *bp, uint16_t *max_fc)
 		*max_fc = rte_le_to_cpu_16(resp->max_rx_fc);
 	HWRM_UNLOCK();
 
-	PMD_DRV_LOG(DEBUG, "max_fc = %d\n", *max_fc);
 	return 0;
 }
 
@@ -5387,10 +5386,10 @@ int bnxt_hwrm_cfa_counter_qstats(struct bnxt *bp,
 	}
 
 	if (dir == BNXT_DIR_RX) {
-		flow_ctx_id = bp->rx_fc_in_tbl.ctx_id;
+		flow_ctx_id = bp->flow_stat->rx_fc_in_tbl.ctx_id;
 		flags = HWRM_CFA_COUNTER_QSTATS_INPUT_FLAGS_PATH_RX;
 	} else if (dir == BNXT_DIR_TX) {
-		flow_ctx_id = bp->tx_fc_in_tbl.ctx_id;
+		flow_ctx_id = bp->flow_stat->tx_fc_in_tbl.ctx_id;
 		flags = HWRM_CFA_COUNTER_QSTATS_INPUT_FLAGS_PATH_TX;
 	}
 
drivers/net/bnxt/bnxt_stats.c +7 -7
index 1d3be16f8..cfe193284 100644
@@ -669,7 +669,7 @@ int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
 
 	if (bp->fw_cap & BNXT_FW_CAP_ADV_FLOW_COUNTERS &&
 	    bp->fw_cap & BNXT_FW_CAP_ADV_FLOW_MGMT &&
-	    bp->flow_xstat) {
+	    BNXT_FLOW_XSTATS_EN(bp)) {
 		int j;
 
 		i = 0;
@@ -713,7 +713,7 @@ int bnxt_flow_stats_cnt(struct bnxt *bp)
 {
 	if (bp->fw_cap & BNXT_FW_CAP_ADV_FLOW_COUNTERS &&
 	    bp->fw_cap & BNXT_FW_CAP_ADV_FLOW_MGMT &&
-	    bp->flow_xstat) {
+	    BNXT_FLOW_XSTATS_EN(bp)) {
 		struct bnxt_xstats_name_off flow_bytes[bp->max_l2_ctx];
 		struct bnxt_xstats_name_off flow_pkts[bp->max_l2_ctx];
 
@@ -783,7 +783,7 @@ int bnxt_dev_xstats_get_names_op(struct rte_eth_dev *eth_dev,
 
 		if (bp->fw_cap & BNXT_FW_CAP_ADV_FLOW_COUNTERS &&
 		    bp->fw_cap & BNXT_FW_CAP_ADV_FLOW_MGMT &&
-		    bp->flow_xstat) {
+		    BNXT_FLOW_XSTATS_EN(bp)) {
 			for (i = 0; i < bp->max_l2_ctx; i++) {
 				char buf[RTE_ETH_XSTATS_NAME_SIZE];
 
@@ -936,8 +936,8 @@ static int bnxt_update_fc_tbl(struct bnxt *bp, uint16_t ctr,
 	uint32_t out_rx_tbl_cnt = 0;
 	int i, rc = 0;
 
-	in_rx_tbl = (uint32_t *)bp->rx_fc_in_tbl.va;
-	out_rx_tbl = (uint64_t *)bp->rx_fc_out_tbl.va;
+	in_rx_tbl = (uint32_t *)bp->flow_stat->rx_fc_in_tbl.va;
+	out_rx_tbl = (uint64_t *)bp->flow_stat->rx_fc_out_tbl.va;
 
 	for (i = 0; i < in_flow_cnt; i++) {
 		if (!en_tbl[i])
@@ -979,7 +979,7 @@ int bnxt_flow_stats_req(struct bnxt *bp)
 	struct rte_flow *flow;
 	uint16_t in_flow_tbl_cnt = 0;
 	struct bnxt_vnic_info *vnic = NULL;
-	struct bnxt_filter_info *valid_en_tbl[bp->max_fc];
+	struct bnxt_filter_info *valid_en_tbl[bp->flow_stat->max_fc];
 	uint16_t counter_type = CFA_COUNTER_CFG_IN_COUNTER_TYPE_FC;
 
 	bnxt_acquire_flow_lock(bp);
@@ -996,7 +996,7 @@ int bnxt_flow_stats_req(struct bnxt *bp)
 				continue;
 
 			valid_en_tbl[in_flow_tbl_cnt++] = flow->filter;
-			if (in_flow_tbl_cnt >= bp->max_fc) {
+			if (in_flow_tbl_cnt >= bp->flow_stat->max_fc) {
 				rc = bnxt_update_fc_tbl(bp, counter_type,
 							valid_en_tbl,
 							in_flow_tbl_cnt);
Signature · 1 line
2.21.1 (Apple Git-122.3)
#5 lore raw

PATCH 5/9 net/bnxt: fix to alloc link info struct

In reply to Ajit Khaparde

Dynamically alloc link info structure.

Fixes 1d0704f4d793 ("net/bnxt: add device configure operation")
---
 drivers/net/bnxt/bnxt.h        |  2 +-
 drivers/net/bnxt/bnxt_ethdev.c | 65 ++++++++++++++++++++++------------
 drivers/net/bnxt/bnxt_hwrm.c   | 28 +++++++--------
 3 files changed, 58 insertions(+), 37 deletions(-)
drivers/net/bnxt/bnxt.h +1 -1
index b71435495..b66f6ba25 100644
@@ -648,7 +648,7 @@ struct bnxt {
 	/* default HWRM request timeout value */
 	uint32_t			hwrm_cmd_timeout;
 
-	struct bnxt_link_info	link_info;
+	struct bnxt_link_info		*link_info;
 	struct bnxt_cos_queue_info	*rx_cos_queue;
 	struct bnxt_cos_queue_info	*tx_cos_queue;
 	uint8_t			tx_cosq_id[BNXT_COS_QUEUE_COUNT];
drivers/net/bnxt/bnxt_ethdev.c +43 -22

158 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.c +14 -14
index 4022fafd1..2e93a847f 100644
@@ -1223,7 +1223,7 @@ static int bnxt_hwrm_port_phy_cfg(struct bnxt *bp, struct bnxt_link_info *conf)
 
 	if (conf->link_up) {
 		/* Setting Fixed Speed. But AutoNeg is ON, So disable it */
-		if (bp->link_info.auto_mode && conf->link_speed) {
+		if (bp->link_info->auto_mode && conf->link_speed) {
 			req.auto_mode = HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_NONE;
 			PMD_DRV_LOG(DEBUG, "Disabling AutoNeg\n");
 		}
@@ -2821,8 +2821,8 @@ bnxt_parse_eth_link_speed_mask(struct bnxt *bp, uint32_t link_speed)
 	uint16_t ret = 0;
 
 	if (link_speed == ETH_LINK_SPEED_AUTONEG) {
-		if (bp->link_info.support_speeds)
-			return bp->link_info.support_speeds;
+		if (bp->link_info->support_speeds)
+			return bp->link_info->support_speeds;
 		link_speed = BNXT_SUPPORTED_SPEEDS;
 	}
 
@@ -2919,7 +2919,7 @@ static uint16_t bnxt_parse_hw_link_duplex(uint16_t hw_link_duplex)
 int bnxt_get_hwrm_link_config(struct bnxt *bp, struct rte_eth_link *link)
 {
 	int rc = 0;
-	struct bnxt_link_info *link_info = &bp->link_info;
+	struct bnxt_link_info *link_info = bp->link_info;
 
 	rc = bnxt_hwrm_port_phy_qcfg(bp, link_info);
 	if (rc) {
@@ -2981,19 +2981,19 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up)
 	 */
 	if (autoneg == 1 &&
 	    !(!BNXT_CHIP_THOR(bp) &&
-	      (bp->link_info.auto_link_speed ||
-	       bp->link_info.force_link_speed))) {
+	      (bp->link_info->auto_link_speed ||
+	       bp->link_info->force_link_speed))) {
 		link_req.phy_flags |=
 				HWRM_PORT_PHY_CFG_INPUT_FLAGS_RESTART_AUTONEG;
 		link_req.auto_link_speed_mask =
 			bnxt_parse_eth_link_speed_mask(bp,
 						       dev_conf->link_speeds);
 	} else {
-		if (bp->link_info.phy_type ==
+		if (bp->link_info->phy_type ==
 		    HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASET ||
-		    bp->link_info.phy_type ==
+		    bp->link_info->phy_type ==
 		    HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASETE ||
-		    bp->link_info.media_type ==
+		    bp->link_info->media_type ==
 		    HWRM_PORT_PHY_QCFG_OUTPUT_MEDIA_TYPE_TP) {
 			PMD_DRV_LOG(ERR, "10GBase-T devices must autoneg\n");
 			return -EINVAL;
@@ -3003,14 +3003,14 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up)
 		/* If user wants a particular speed try that first. */
 		if (speed)
 			link_req.link_speed = speed;
-		else if (bp->link_info.force_link_speed)
-			link_req.link_speed = bp->link_info.force_link_speed;
+		else if (bp->link_info->force_link_speed)
+			link_req.link_speed = bp->link_info->force_link_speed;
 		else
-			link_req.link_speed = bp->link_info.auto_link_speed;
+			link_req.link_speed = bp->link_info->auto_link_speed;
 	}
 	link_req.duplex = bnxt_parse_eth_link_duplex(dev_conf->link_speeds);
-	link_req.auto_pause = bp->link_info.auto_pause;
-	link_req.force_pause = bp->link_info.force_pause;
+	link_req.auto_pause = bp->link_info->auto_pause;
+	link_req.force_pause = bp->link_info->force_pause;
 
 port_phy_cfg:
 	rc = bnxt_hwrm_port_phy_cfg(bp, &link_req);
Signature · 1 line
2.21.1 (Apple Git-122.3)
#6 lore raw

PATCH 6/9 net/bnxt: fix to alloc PF info structure

In reply to Ajit Khaparde
Fixes 804e746c7b73 ("net/bnxt: add hardware resource manager init code")
---
 drivers/net/bnxt/bnxt.h         |   9 +-
 drivers/net/bnxt/bnxt_cpr.c     |  20 ++---
 drivers/net/bnxt/bnxt_ethdev.c  |  31 +++++--
 drivers/net/bnxt/bnxt_filter.c  |  12 +--
 drivers/net/bnxt/bnxt_hwrm.c    | 145 ++++++++++++++++----------------
 drivers/net/bnxt/rte_pmd_bnxt.c |  98 ++++++++++-----------
 6 files changed, 169 insertions(+), 146 deletions(-)
drivers/net/bnxt/bnxt.h +5 -4
index b66f6ba25..7410db5e4 100644
@@ -219,11 +219,12 @@ struct bnxt_child_vf_info {
 
 struct bnxt_pf_info {
 #define BNXT_FIRST_PF_FID	1
-#define BNXT_MAX_VFS(bp)	(bp->pf.max_vfs)
-#define BNXT_TOTAL_VFS(bp)	((bp)->pf.total_vfs)
+#define BNXT_MAX_VFS(bp)	((bp)->pf->max_vfs)
+#define BNXT_TOTAL_VFS(bp)	((bp)->pf->total_vfs)
 #define BNXT_FIRST_VF_FID	128
 #define BNXT_PF_RINGS_USED(bp)	bnxt_get_num_queues(bp)
-#define BNXT_PF_RINGS_AVAIL(bp)	(bp->pf.max_cp_rings - BNXT_PF_RINGS_USED(bp))
+#define BNXT_PF_RINGS_AVAIL(bp)	((bp)->pf->max_cp_rings - \
+				 BNXT_PF_RINGS_USED(bp))
 	uint16_t		port_id;
 	uint16_t		first_vf_id;
 	uint16_t		active_vfs;
@@ -689,7 +690,7 @@ struct bnxt {
 #define BNXT_OUTER_TPID_BD_MASK	0xffff0000
 #define BNXT_OUTER_TPID_BD_SHFT	16
 	uint32_t		outer_tpid_bd;
-	struct bnxt_pf_info	pf;
+	struct bnxt_pf_info	*pf;
 	uint8_t			vxlan_port_cnt;
 	uint8_t			geneve_port_cnt;
 	uint16_t		vxlan_port;
drivers/net/bnxt/bnxt_cpr.c +10 -10
index 21565b1e2..40e5350f6 100644
@@ -160,14 +160,14 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 	uint16_t req_len;
 	int rc;
 
-	if (bp->pf.active_vfs <= 0) {
+	if (bp->pf->active_vfs <= 0) {
 		PMD_DRV_LOG(ERR, "Forwarded VF with no active VFs\n");
 		return;
 	}
 
 	/* Qualify the fwd request */
 	fw_vf_id = rte_le_to_cpu_16(fwd_cmpl->source_id);
-	vf_id = fw_vf_id - bp->pf.first_vf_id;
+	vf_id = fw_vf_id - bp->pf->first_vf_id;
 
 	req_len = (rte_le_to_cpu_16(fwd_cmpl->req_len_type) &
 		   HWRM_FWD_REQ_CMPL_REQ_LEN_MASK) >>
@@ -176,15 +176,15 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 		req_len = sizeof(fwreq->encap_request);
 
 	/* Locate VF's forwarded command */
-	fwd_cmd = (struct input *)bp->pf.vf_info[vf_id].req_buf;
+	fwd_cmd = (struct input *)bp->pf->vf_info[vf_id].req_buf;
 
-	if (fw_vf_id < bp->pf.first_vf_id ||
-	    fw_vf_id >= (bp->pf.first_vf_id) + bp->pf.active_vfs) {
+	if (fw_vf_id < bp->pf->first_vf_id ||
+	    fw_vf_id >= bp->pf->first_vf_id + bp->pf->active_vfs) {
 		PMD_DRV_LOG(ERR,
 		"FWD req's source_id 0x%x out of range 0x%x - 0x%x (%d %d)\n",
-			fw_vf_id, bp->pf.first_vf_id,
-			(bp->pf.first_vf_id) + bp->pf.active_vfs - 1,
-			bp->pf.first_vf_id, bp->pf.active_vfs);
+			fw_vf_id, bp->pf->first_vf_id,
+			(bp->pf->first_vf_id) + bp->pf->active_vfs - 1,
+			bp->pf->first_vf_id, bp->pf->active_vfs);
 		goto reject;
 	}
 
@@ -219,7 +219,7 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 		if (rc) {
 			PMD_DRV_LOG(ERR,
 				"Failed to send FWD req VF 0x%x, type 0x%x.\n",
-				fw_vf_id - bp->pf.first_vf_id,
+				fw_vf_id - bp->pf->first_vf_id,
 				rte_le_to_cpu_16(fwd_cmd->req_type));
 		}
 		return;
@@ -230,7 +230,7 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
 	if (rc) {
 		PMD_DRV_LOG(ERR,
 			"Failed to send REJECT req VF 0x%x, type 0x%x.\n",
-			fw_vf_id - bp->pf.first_vf_id,
+			fw_vf_id - bp->pf->first_vf_id,
 			rte_le_to_cpu_16(fwd_cmd->req_type));
 	}
 
drivers/net/bnxt/bnxt_ethdev.c +25 -6
index 7367c14d4..b64745003 100644
@@ -191,6 +191,11 @@ static uint16_t  bnxt_rss_hash_tbl_size(const struct bnxt *bp)
 	return bnxt_rss_ctxts(bp) * BNXT_RSS_ENTRIES_PER_CTX_THOR;
 }
 
+static void bnxt_free_pf_info(struct bnxt *bp)
+{
+	rte_free(bp->pf);
+}
+
 static void bnxt_free_link_info(struct bnxt *bp)
 {
 	rte_free(bp->link_info);
@@ -238,6 +243,15 @@ static void bnxt_free_mem(struct bnxt *bp, bool reconfig)
 	bp->grp_info = NULL;
 }
 
+static int bnxt_alloc_pf_info(struct bnxt *bp)
+{
+	bp->pf = rte_zmalloc("bnxt_pf_info", sizeof(struct bnxt_pf_info), 0);
+	if (bp->pf == NULL)
+		return -ENOMEM;
+
+	return 0;
+}
+
 static int bnxt_alloc_link_info(struct bnxt *bp)
 {
 	bp->link_info =
@@ -1319,6 +1333,7 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev)
 	bnxt_free_leds_info(bp);
 	bnxt_free_cos_queues(bp);
 	bnxt_free_link_info(bp);
+	bnxt_free_pf_info(bp);
 
 	eth_dev->dev_ops = NULL;
 	eth_dev->rx_pkt_burst = NULL;
@@ -1329,8 +1344,8 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev)
 	rte_memzone_free((const struct rte_memzone *)bp->rx_mem_zone);
 	bp->rx_mem_zone = NULL;
 
-	rte_free(bp->pf.vf_info);
-	bp->pf.vf_info = NULL;
+	rte_free(bp->pf->vf_info);
+	bp->pf->vf_info = NULL;
 
 	rte_free(bp->grp_info);
 	bp->grp_info = NULL;
@@ -3751,7 +3766,7 @@ static int bnxt_get_tx_ts(struct bnxt *bp, uint64_t *ts)
 static int bnxt_get_rx_ts(struct bnxt *bp, uint64_t *ts)
 {
 	struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
-	struct bnxt_pf_info *pf = &bp->pf;
+	struct bnxt_pf_info *pf = bp->pf;
 	uint16_t port_id;
 	uint32_t fifo;
 
@@ -5013,7 +5028,7 @@ static void bnxt_config_vf_req_fwd(struct bnxt *bp)
 #define ALLOW_FUNC(x)	\
 	{ \
 		uint32_t arg = (x); \
-		bp->pf.vf_req_fwd[((arg) >> 5)] &= \
+		bp->pf->vf_req_fwd[((arg) >> 5)] &= \
 		~rte_cpu_to_le_32(1 << ((arg) & 0x1f)); \
 	}
 
@@ -5021,11 +5036,11 @@ static void bnxt_config_vf_req_fwd(struct bnxt *bp)
 	if (((bp->fw_ver >= ((20 << 24) | (6 << 16) | (100 << 8))) &&
 	     (bp->fw_ver < ((20 << 24) | (7 << 16)))) ||
 	    ((bp->fw_ver >= ((20 << 24) | (8 << 16))))) {
-		memset(bp->pf.vf_req_fwd, 0xff, sizeof(bp->pf.vf_req_fwd));
+		memset(bp->pf->vf_req_fwd, 0xff, sizeof(bp->pf->vf_req_fwd));
 	} else {
 		PMD_DRV_LOG(WARNING,
 			    "Firmware too old for VF mailbox functionality\n");
-		memset(bp->pf.vf_req_fwd, 0, sizeof(bp->pf.vf_req_fwd));
+		memset(bp->pf->vf_req_fwd, 0, sizeof(bp->pf->vf_req_fwd));
 	}
 
 	/*
@@ -5457,6 +5472,10 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
 		return rc;
 	}
 
+	rc = bnxt_alloc_pf_info(bp);
+	if (rc)
+		goto error_free;
+
 	rc = bnxt_alloc_link_info(bp);
 	if (rc)
 		goto error_free;
drivers/net/bnxt/bnxt_filter.c +6 -6
index a1463a0e2..d822ff607 100644
@@ -55,7 +55,7 @@ struct bnxt_filter_info *bnxt_alloc_vf_filter(struct bnxt *bp, uint16_t vf)
 	}
 
 	filter->fw_l2_filter_id = UINT64_MAX;
-	STAILQ_INSERT_TAIL(&bp->pf.vf_info[vf].filter, filter, next);
+	STAILQ_INSERT_TAIL(&bp->pf->vf_info[vf].filter, filter, next);
 	return filter;
 }
 
@@ -95,8 +95,8 @@ void bnxt_free_all_filters(struct bnxt *bp)
 		STAILQ_INIT(&vnic->filter);
 	}
 
-	for (i = 0; i < bp->pf.max_vfs; i++) {
-		STAILQ_FOREACH(filter, &bp->pf.vf_info[i].filter, next) {
+	for (i = 0; i < bp->pf->max_vfs; i++) {
+		STAILQ_FOREACH(filter, &bp->pf->vf_info[i].filter, next) {
 			bnxt_hwrm_clear_l2_filter(bp, filter);
 		}
 	}
@@ -144,10 +144,10 @@ void bnxt_free_filter_mem(struct bnxt *bp)
 	rte_free(bp->filter_info);
 	bp->filter_info = NULL;
 
-	for (i = 0; i < bp->pf.max_vfs; i++) {
-		STAILQ_FOREACH(filter, &bp->pf.vf_info[i].filter, next) {
+	for (i = 0; i < bp->pf->max_vfs; i++) {
+		STAILQ_FOREACH(filter, &bp->pf->vf_info[i].filter, next) {
 			rte_free(filter);
-			STAILQ_REMOVE(&bp->pf.vf_info[i].filter, filter,
+			STAILQ_REMOVE(&bp->pf->vf_info[i].filter, filter,
 				      bnxt_filter_info, next);
 		}
 	}
drivers/net/bnxt/bnxt_hwrm.c +73 -72

415 lines not on this page · raw message

drivers/net/bnxt/rte_pmd_bnxt.c +50 -48

277 lines not on this page · raw message

Signature · 1 line
2.21.1 (Apple Git-122.3)
#7 lore raw

PATCH 7/9 net/bnxt: fix to use RSS config from eth dev struct

In reply to Ajit Khaparde

There is no need to maintain local copy.
This helps reduce the size of the bnxt structure.

Fixes fcc0aa1edc10 ("net/bnxt: add RSS hash configuration")
---
 drivers/net/bnxt/bnxt.h        | 1 -
 drivers/net/bnxt/bnxt_ethdev.c | 4 +++-
 drivers/net/bnxt/bnxt_rxq.c    | 4 +---
 3 files changed, 4 insertions(+), 5 deletions(-)
drivers/net/bnxt/bnxt.h +0 -1
index 7410db5e4..4093a2f01 100644
@@ -530,7 +530,6 @@ struct bnxt {
 	void				*bar0;
 
 	struct rte_eth_dev		*eth_dev;
-	struct rte_eth_rss_conf		rss_conf;
 	struct rte_pci_device		*pdev;
 	void				*doorbell_base;
 
drivers/net/bnxt/bnxt_ethdev.c +3 -1
index b64745003..4d64a9835 100644
@@ -1796,7 +1796,9 @@ static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev,
 	}
 
 	bp->flags |= BNXT_FLAG_UPDATE_HASH;
-	memcpy(&bp->rss_conf, rss_conf, sizeof(*rss_conf));
+	memcpy(&eth_dev->data->dev_conf.rx_adv_conf.rss_conf,
+	       rss_conf,
+	       sizeof(*rss_conf));
 
 	/* Update the default RSS VNIC(s) */
 	vnic = BNXT_GET_DEFAULT_VNIC(bp);
drivers/net/bnxt/bnxt_rxq.c +1 -3
index 457ebede0..e42308a97 100644
@@ -168,10 +168,8 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 	if (dev_conf->rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG) {
 		struct rte_eth_rss_conf *rss = &dev_conf->rx_adv_conf.rss_conf;
 
-		if (bp->flags & BNXT_FLAG_UPDATE_HASH) {
-			rss = &bp->rss_conf;
+		if (bp->flags & BNXT_FLAG_UPDATE_HASH)
 			bp->flags &= ~BNXT_FLAG_UPDATE_HASH;
-		}
 
 		for (i = 0; i < bp->nr_vnics; i++) {
 			vnic = &bp->vnic_info[i];
Signature · 1 line
2.21.1 (Apple Git-122.3)
#8 lore raw

PATCH 8/9 net/bnxt: fix to remove unneeded structure variable

In reply to Ajit Khaparde

From: Kalesh AP <[email protected]>

We are maintaining MAC address twice which is unnecessary. This patch removes the copy which helps reduce size of bnxt structure.

Fixes b7778e8a1c00 ("net/bnxt: refactor to properly allocate resources for PF/VF")
---
 drivers/net/bnxt/bnxt.h        |  3 ++-
 drivers/net/bnxt/bnxt_ethdev.c | 11 ++++-------
 drivers/net/bnxt/bnxt_hwrm.c   |  8 ++++++--
 3 files changed, 12 insertions(+), 10 deletions(-)
drivers/net/bnxt/bnxt.h +2 -1
index 4093a2f01..403b23f35 100644
@@ -560,6 +560,7 @@ struct bnxt {
 #define BNXT_FLAG_FC_THREAD			BIT(23)
 #define BNXT_FLAG_RX_VECTOR_PKT_MODE		BIT(24)
 #define BNXT_FLAG_FLOW_XSTATS_EN		BIT(25)
+#define BNXT_FLAG_DFLT_MAC_SET			BIT(26)
 #define BNXT_PF(bp)		(!((bp)->flags & BNXT_FLAG_VF))
 #define BNXT_VF(bp)		((bp)->flags & BNXT_FLAG_VF)
 #define BNXT_NPAR(bp)		((bp)->flags & BNXT_FLAG_NPAR_PF)
@@ -573,6 +574,7 @@ struct bnxt {
 #define BNXT_HAS_NQ(bp)		BNXT_CHIP_THOR(bp)
 #define BNXT_HAS_RING_GRPS(bp)	(!BNXT_CHIP_THOR(bp))
 #define BNXT_FLOW_XSTATS_EN(bp)	((bp)->flags & BNXT_FLAG_FLOW_XSTATS_EN)
+#define BNXT_HAS_DFLT_MAC_SET(bp)      ((bp)->flags & BNXT_FLAG_DFLT_MAC_SET)
 
 	uint32_t		fw_cap;
 #define BNXT_FW_CAP_HOT_RESET		BIT(0)
@@ -658,7 +660,6 @@ struct bnxt {
 	uint8_t                 max_q;
 
 	uint16_t		fw_fid;
-	uint8_t			dflt_mac_addr[RTE_ETHER_ADDR_LEN];
 	uint16_t		max_rsscos_ctx;
 	uint16_t		max_cp_rings;
 	uint16_t		max_tx_rings;
drivers/net/bnxt/bnxt_ethdev.c +4 -7
index 4d64a9835..77492f89c 100644
@@ -4980,7 +4980,7 @@ static int bnxt_setup_mac_addr(struct rte_eth_dev *eth_dev)
 		return -ENOMEM;
 	}
 
-	if (bnxt_check_zero_bytes(bp->dflt_mac_addr, RTE_ETHER_ADDR_LEN)) {
+	if (!BNXT_HAS_DFLT_MAC_SET(bp)) {
 		if (BNXT_PF(bp))
 			return -EINVAL;
 
@@ -4993,14 +4993,11 @@ static int bnxt_setup_mac_addr(struct rte_eth_dev *eth_dev)
 			    bp->mac_addr[3], bp->mac_addr[4], bp->mac_addr[5]);
 
 		rc = bnxt_hwrm_set_mac(bp);
-		if (!rc)
-			memcpy(&bp->eth_dev->data->mac_addrs[0], bp->mac_addr,
-			       RTE_ETHER_ADDR_LEN);
-		return rc;
+		if (rc)
+			return rc;
 	}
 
 	/* Copy the permanent MAC from the FUNC_QCAPS response */
-	memcpy(bp->mac_addr, bp->dflt_mac_addr, RTE_ETHER_ADDR_LEN);
 	memcpy(&eth_dev->data->mac_addrs[0], bp->mac_addr, RTE_ETHER_ADDR_LEN);
 
 	return rc;
@@ -5011,7 +5008,7 @@ static int bnxt_restore_dflt_mac(struct bnxt *bp)
 	int rc = 0;
 
 	/* MAC is already configured in FW */
-	if (!bnxt_check_zero_bytes(bp->dflt_mac_addr, RTE_ETHER_ADDR_LEN))
+	if (BNXT_HAS_DFLT_MAC_SET(bp))
 		return 0;
 
 	/* Restore the old MAC configured */
drivers/net/bnxt/bnxt_hwrm.c +6 -2
index a41d77669..c1798b59d 100644
@@ -731,7 +731,12 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
 	}
 
 	bp->fw_fid = rte_le_to_cpu_32(resp->fid);
-	memcpy(bp->dflt_mac_addr, &resp->mac_address, RTE_ETHER_ADDR_LEN);
+	if (!bnxt_check_zero_bytes(resp->mac_address, RTE_ETHER_ADDR_LEN)) {
+		bp->flags |= BNXT_FLAG_DFLT_MAC_SET;
+		memcpy(bp->mac_addr, &resp->mac_address, RTE_ETHER_ADDR_LEN);
+	} else {
+		bp->flags &= ~BNXT_FLAG_DFLT_MAC_SET;
+	}
 	bp->max_rsscos_ctx = rte_le_to_cpu_16(resp->max_rsscos_ctx);
 	bp->max_cp_rings = rte_le_to_cpu_16(resp->max_cmpl_rings);
 	bp->max_tx_rings = rte_le_to_cpu_16(resp->max_tx_rings);
@@ -5027,7 +5032,6 @@ int bnxt_hwrm_set_mac(struct bnxt *bp)
 
 	HWRM_CHECK_RESULT();
 
-	memcpy(bp->dflt_mac_addr, bp->mac_addr, RTE_ETHER_ADDR_LEN);
 	HWRM_UNLOCK();
 
 	return rc;
Signature · 1 line
2.21.1 (Apple Git-122.3)
#9 lore raw

PATCH 9/9 net/bnxt: fix to allocate bnxt ulp context

In reply to Ajit Khaparde

From: Mike Baucom <[email protected]>

Fix to allocate bnxt ulp context when TRUFLOW is enabled. This patch reduces the size of struct bnxt.

Fixes 313ac35ac701 ("net/bnxt: support ULP session manager init")
---
 drivers/net/bnxt/bnxt.h            |  5 ++-
 drivers/net/bnxt/bnxt_ethdev.c     | 12 +++---
 drivers/net/bnxt/bnxt_rxr.c        |  4 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 64 ++++++++++++++++++++----------
 4 files changed, 53 insertions(+), 32 deletions(-)
drivers/net/bnxt/bnxt.h +3 -2
index 403b23f35..446764c57 100644
@@ -561,6 +561,7 @@ struct bnxt {
 #define BNXT_FLAG_RX_VECTOR_PKT_MODE		BIT(24)
 #define BNXT_FLAG_FLOW_XSTATS_EN		BIT(25)
 #define BNXT_FLAG_DFLT_MAC_SET			BIT(26)
+#define BNXT_FLAG_TRUFLOW_EN			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)->flags & BNXT_FLAG_NPAR_PF)
@@ -575,6 +576,7 @@ struct bnxt {
 #define BNXT_HAS_RING_GRPS(bp)	(!BNXT_CHIP_THOR(bp))
 #define BNXT_FLOW_XSTATS_EN(bp)	((bp)->flags & BNXT_FLAG_FLOW_XSTATS_EN)
 #define BNXT_HAS_DFLT_MAC_SET(bp)      ((bp)->flags & BNXT_FLAG_DFLT_MAC_SET)
+#define BNXT_TRUFLOW_EN(bp)	((bp)->flags & BNXT_FLAG_TRUFLOW_EN)
 
 	uint32_t		fw_cap;
 #define BNXT_FW_CAP_HOT_RESET		BIT(0)
@@ -720,8 +722,7 @@ struct bnxt {
 	uint16_t		port_svif;
 
 	struct tf		tfp;
-	struct bnxt_ulp_context	ulp_ctx;
-	uint8_t			truflow;
+	struct bnxt_ulp_context	*ulp_ctx;
 	struct bnxt_flow_stat_info *flow_stat;
 	uint8_t			flow_xstat;
 };
drivers/net/bnxt/bnxt_ethdev.c +6 -6
index 77492f89c..ae495da34 100644
@@ -1095,7 +1095,7 @@ bnxt_receive_function(struct rte_eth_dev *eth_dev)
 		DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM |
 		DEV_RX_OFFLOAD_RSS_HASH |
 		DEV_RX_OFFLOAD_VLAN_FILTER)) &&
-	    !bp->truflow) {
+	    !BNXT_TRUFLOW_EN(bp)) {
 		PMD_DRV_LOG(INFO, "Using vector mode receive for port %d\n",
 			    eth_dev->data->port_id);
 		bp->flags |= BNXT_FLAG_RX_VECTOR_PKT_MODE;
@@ -1221,7 +1221,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 	bnxt_schedule_fw_health_check(bp);
 	pthread_mutex_unlock(&bp->def_cp_lock);
 
-	if (bp->truflow)
+	if (BNXT_TRUFLOW_EN(bp))
 		bnxt_ulp_init(bp);
 
 	return 0;
@@ -1267,7 +1267,7 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
 
-	if (bp->truflow)
+	if (BNXT_TRUFLOW_EN(bp))
 		bnxt_ulp_deinit(bp);
 
 	eth_dev->data->dev_started = 0;
@@ -3647,7 +3647,7 @@ bnxt_filter_ctrl_op(struct rte_eth_dev *dev,
 	case RTE_ETH_FILTER_GENERIC:
 		if (filter_op != RTE_ETH_FILTER_GET)
 			return -EINVAL;
-		if (bp->truflow)
+		if (BNXT_TRUFLOW_EN(bp))
 			*(const void **)arg = &bnxt_ulp_rte_flow_ops;
 		else
 			*(const void **)arg = &bnxt_flow_ops;
@@ -5350,8 +5350,8 @@ bnxt_parse_devarg_truflow(__rte_unused const char *key,
 		return -EINVAL;
 	}
 
-	bp->truflow = truflow;
-	if (bp->truflow)
+	bp->flags |= BNXT_FLAG_TRUFLOW_EN;
+	if (BNXT_TRUFLOW_EN(bp))
 		PMD_DRV_LOG(INFO, "Host-based truflow feature enabled.\n");
 
 	return 0;
drivers/net/bnxt/bnxt_rxr.c +2 -2
index 9ecdf5e65..d2955bae3 100644
@@ -466,7 +466,7 @@ bnxt_ulp_set_mark_in_mbuf(struct bnxt *bp, struct rx_pkt_cmpl_hi *rxcmp1,
 	}
 
 	if (cfa_code) {
-		rc = ulp_mark_db_mark_get(&bp->ulp_ctx, gfid,
+		rc = ulp_mark_db_mark_get(bp->ulp_ctx, gfid,
 					  cfa_code, &mark_id);
 		if (!rc) {
 			/* Got the mark, write it to the mbuf and return */
@@ -614,7 +614,7 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
 		mbuf->ol_flags |= PKT_RX_RSS_HASH;
 	}
 
-	if (bp->truflow)
+	if (BNXT_TRUFLOW_EN(bp))
 		bnxt_ulp_set_mark_in_mbuf(rxq->bp, rxcmp1, mbuf);
 	else
 		bnxt_set_mark_in_mbuf(rxq->bp, rxcmp1, mbuf);
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +42 -22

196 lines not on this page · raw message

Signature · 1 line
2.21.1 (Apple Git-122.3)
#10 lore raw
In reply to Ajit Khaparde
Quoted 23 lines · Ajit Khaparde

Patchset with fixes.
The patch [1/9] enhances the log message in case of a FW command timeout. The rest of the patches address a perf regression. Recent commits caused a regression in performance because bnxt structure became too big and noticed in rc2.
Most of the patches reduce the memory footprint of the struct bnxt. With these changes the performance is back to normal.

Ajit Khaparde (7):
net/bnxt: fix error log for command timeout net/bnxt: fix to alloc LED config info net/bnxt: fix to alloc COS queue info dynamically net/bnxt: fix to allocate flow stat related structs net/bnxt: fix to alloc link info struct net/bnxt: fix to alloc PF info structure net/bnxt: fix to use RSS config from eth dev struct

Kalesh AP (1):
net/bnxt: fix to remove unneeded structure variable

Mike Baucom (1):
net/bnxt: fix to allocate bnxt ulp context

Quoted 13 lines
 drivers/net/bnxt/bnxt.h            |  47 ++--
 drivers/net/bnxt/bnxt_cpr.c        |  20 +-
 drivers/net/bnxt/bnxt_ethdev.c     | 331 ++++++++++++++++++++---------
 drivers/net/bnxt/bnxt_filter.c     |  12 +-
 drivers/net/bnxt/bnxt_flow.c       |  14 +-
 drivers/net/bnxt/bnxt_hwrm.c       | 205 +++++++++---------
 drivers/net/bnxt/bnxt_rxq.c        |   4 +-
 drivers/net/bnxt/bnxt_rxr.c        |   4 +-
 drivers/net/bnxt/bnxt_stats.c      |  14 +-
 drivers/net/bnxt/rte_pmd_bnxt.c    |  98 ++++-----
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c |  64 ++++--
 11 files changed, 492 insertions(+), 321 deletions(-)

Patchset applied to dpdk-next-net-brcm. Thanks