patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 06/12] net/bnxt: set MTU in dev config for jumbo packets
       [not found] <20180501010616.40472-1-ajit.khaparde@broadcom.com>
@ 2018-05-01  1:06 ` Ajit Khaparde
  2018-05-01  1:06 ` [dpdk-stable] [PATCH 07/12] net/bnxt: fix MTU calculation Ajit Khaparde
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: Ajit Khaparde @ 2018-05-01  1:06 UTC (permalink / raw)
  To: dev; +Cc: Qingmin Liu, stable, Scott Branden

From: Qingmin Liu <qingmin.liu@broadcom.com>

MTU setting does not take effect after rte_eth_dev_configure
is called with jumbo enable unless it is configured using the
set_mtu dev_op.

Fixes: daef48efe5e5 ("net/bnxt: support set MTU")
Cc: stable@dpdk.org

Signed-off-by: Qingmin Liu <qingmin.liu@broadcom.com>
Signed-off-by: Scott Branden <scott.branden@broadcom.com>
Reviewed-by: Jay Ding <jay.ding@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 58241ccac..e68608f61 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -151,6 +151,7 @@ static const struct rte_pci_id bnxt_pci_id_map[] = {
 
 static int bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask);
 static void bnxt_print_link_info(struct rte_eth_dev *eth_dev);
+static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu);
 
 /***********************/
 
@@ -548,10 +549,12 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 	bp->rx_cp_nr_rings = bp->rx_nr_rings;
 	bp->tx_cp_nr_rings = bp->tx_nr_rings;
 
-	if (rx_offloads & DEV_RX_OFFLOAD_JUMBO_FRAME)
+	if (rx_offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
 		eth_dev->data->mtu =
 				eth_dev->data->dev_conf.rxmode.max_rx_pkt_len -
 				ETHER_HDR_LEN - ETHER_CRC_LEN - VLAN_TAG_SIZE;
+		bnxt_mtu_set_op(eth_dev, eth_dev->data->mtu);
+	}
 	return 0;
 }
 
-- 
2.15.1 (Apple Git-101)

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

* [dpdk-stable] [PATCH 07/12] net/bnxt: fix MTU calculation
       [not found] <20180501010616.40472-1-ajit.khaparde@broadcom.com>
  2018-05-01  1:06 ` [dpdk-stable] [PATCH 06/12] net/bnxt: set MTU in dev config for jumbo packets Ajit Khaparde
@ 2018-05-01  1:06 ` Ajit Khaparde
  2018-05-01  1:06 ` [dpdk-stable] [PATCH 08/12] net/bnxt: return error if init is not complete before accessing stats Ajit Khaparde
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: Ajit Khaparde @ 2018-05-01  1:06 UTC (permalink / raw)
  To: dev; +Cc: stable, Qingmin Liu, Scott Branden

We were not considering the case of nested VLANs while
calculating MTU. This patch takes care of the same.

Fixes: daef48efe5e5 ("net/bnxt: support set MTU")
Cc: stable@dpdk.org

Signed-off-by: Qingmin Liu <qingmin.liu@broadcom.com>
Signed-off-by: Scott Branden <scott.branden@broadcom.com>
Reviewed-by: Jay Ding <jay.ding@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        | 1 +
 drivers/net/bnxt/bnxt_ethdev.c | 3 ++-
 drivers/net/bnxt/bnxt_hwrm.c   | 9 ++++++---
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 97b0e0853..110cdb992 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -23,6 +23,7 @@
 #define BNXT_MAX_MTU		9500
 #define VLAN_TAG_SIZE		4
 #define BNXT_MAX_LED		4
+#define BNXT_NUM_VLANS		2
 
 struct bnxt_led_info {
 	uint8_t      led_id;
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index e68608f61..20ed0a31f 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -552,7 +552,8 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 	if (rx_offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
 		eth_dev->data->mtu =
 				eth_dev->data->dev_conf.rxmode.max_rx_pkt_len -
-				ETHER_HDR_LEN - ETHER_CRC_LEN - VLAN_TAG_SIZE;
+				ETHER_HDR_LEN - ETHER_CRC_LEN - VLAN_TAG_SIZE *
+				BNXT_NUM_VLANS;
 		bnxt_mtu_set_op(eth_dev, eth_dev->data->mtu);
 	}
 	return 0;
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index bc8773509..c136edc06 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -2360,7 +2360,8 @@ static int bnxt_hwrm_pf_func_cfg(struct bnxt *bp, int tx_rings)
 	req.flags = rte_cpu_to_le_32(bp->pf.func_cfg_flags);
 	req.mtu = rte_cpu_to_le_16(BNXT_MAX_MTU);
 	req.mru = rte_cpu_to_le_16(bp->eth_dev->data->mtu + ETHER_HDR_LEN +
-				   ETHER_CRC_LEN + VLAN_TAG_SIZE);
+				   ETHER_CRC_LEN + VLAN_TAG_SIZE *
+				   BNXT_NUM_VLANS);
 	req.num_rsscos_ctxs = rte_cpu_to_le_16(bp->max_rsscos_ctx);
 	req.num_stat_ctxs = rte_cpu_to_le_16(bp->max_stat_ctx);
 	req.num_cmpl_rings = rte_cpu_to_le_16(bp->max_cp_rings);
@@ -2397,9 +2398,11 @@ static void populate_vf_func_cfg_req(struct bnxt *bp,
 			HWRM_FUNC_CFG_INPUT_ENABLES_NUM_HW_RING_GRPS);
 
 	req->mtu = rte_cpu_to_le_16(bp->eth_dev->data->mtu + ETHER_HDR_LEN +
-				    ETHER_CRC_LEN + VLAN_TAG_SIZE);
+				    ETHER_CRC_LEN + VLAN_TAG_SIZE *
+				    BNXT_NUM_VLANS);
 	req->mru = rte_cpu_to_le_16(bp->eth_dev->data->mtu + ETHER_HDR_LEN +
-				    ETHER_CRC_LEN + VLAN_TAG_SIZE);
+				    ETHER_CRC_LEN + VLAN_TAG_SIZE *
+				    BNXT_NUM_VLANS);
 	req->num_rsscos_ctxs = rte_cpu_to_le_16(bp->max_rsscos_ctx /
 						(num_vfs + 1));
 	req->num_stat_ctxs = rte_cpu_to_le_16(bp->max_stat_ctx / (num_vfs + 1));
-- 
2.15.1 (Apple Git-101)

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

* [dpdk-stable] [PATCH 08/12] net/bnxt: return error if init is not complete before accessing stats
       [not found] <20180501010616.40472-1-ajit.khaparde@broadcom.com>
  2018-05-01  1:06 ` [dpdk-stable] [PATCH 06/12] net/bnxt: set MTU in dev config for jumbo packets Ajit Khaparde
  2018-05-01  1:06 ` [dpdk-stable] [PATCH 07/12] net/bnxt: fix MTU calculation Ajit Khaparde
@ 2018-05-01  1:06 ` Ajit Khaparde
  2018-05-01  1:06 ` [dpdk-stable] [PATCH 09/12] net/bnxt: fix to reset status of initialization Ajit Khaparde
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: Ajit Khaparde @ 2018-05-01  1:06 UTC (permalink / raw)
  To: dev; +Cc: Jay Ding, stable, Scott Branden

From: Jay Ding <jay.ding@broadcom.com>

return error if init is not complete before accessing stats.

Fixes: ed2ced6fe927 ("net/bnxt: check initialization before accessing stats")
Cc: stable@dpdk.org

Signed-off-by: Jay Ding <jay.ding@broadcom.com>
Signed-off-by: Scott Branden <scott.branden@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
index 1b586f333..c1a8fad09 100644
--- a/drivers/net/bnxt/bnxt_stats.c
+++ b/drivers/net/bnxt/bnxt_stats.c
@@ -210,7 +210,7 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
 	memset(bnxt_stats, 0, sizeof(*bnxt_stats));
 	if (!(bp->flags & BNXT_FLAG_INIT_DONE)) {
 		PMD_DRV_LOG(ERR, "Device Initialization not complete!\n");
-		return 0;
+		return -1;
 	}
 
 	for (i = 0; i < bp->rx_cp_nr_rings; i++) {
-- 
2.15.1 (Apple Git-101)

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

* [dpdk-stable] [PATCH 09/12] net/bnxt: fix to reset status of initialization
       [not found] <20180501010616.40472-1-ajit.khaparde@broadcom.com>
                   ` (2 preceding siblings ...)
  2018-05-01  1:06 ` [dpdk-stable] [PATCH 08/12] net/bnxt: return error if init is not complete before accessing stats Ajit Khaparde
@ 2018-05-01  1:06 ` Ajit Khaparde
  2018-05-01  1:06 ` [dpdk-stable] [PATCH 10/12] net/bnxt: fix rx mbuf and agg ring leak in dev stop Ajit Khaparde
  2018-05-01  1:06 ` [dpdk-stable] [PATCH 11/12] net/bnxt: fix usage of vnic id Ajit Khaparde
  5 siblings, 0 replies; 6+ messages in thread
From: Ajit Khaparde @ 2018-05-01  1:06 UTC (permalink / raw)
  To: dev; +Cc: stable

clear flag on stop at proper location to avoid race conditions.

Fixes: ed2ced6fe927 ("net/bnxt: check initialization before accessing stats")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 20ed0a31f..352fc30b4 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -648,13 +648,13 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
 {
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
 
+	bp->flags &= ~BNXT_FLAG_INIT_DONE;
 	if (bp->eth_dev->data->dev_started) {
 		/* TBD: STOP HW queues DMA */
 		eth_dev->data->dev_link.link_status = 0;
 	}
 	bnxt_set_hwrm_link_config(bp, false);
 	bnxt_hwrm_port_clr_stats(bp);
-	bp->flags &= ~BNXT_FLAG_INIT_DONE;
 	bnxt_shutdown_nic(bp);
 	bp->dev_stopped = 1;
 }
-- 
2.15.1 (Apple Git-101)

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

* [dpdk-stable] [PATCH 10/12] net/bnxt: fix rx mbuf and agg ring leak in dev stop
       [not found] <20180501010616.40472-1-ajit.khaparde@broadcom.com>
                   ` (3 preceding siblings ...)
  2018-05-01  1:06 ` [dpdk-stable] [PATCH 09/12] net/bnxt: fix to reset status of initialization Ajit Khaparde
@ 2018-05-01  1:06 ` Ajit Khaparde
  2018-05-01  1:06 ` [dpdk-stable] [PATCH 11/12] net/bnxt: fix usage of vnic id Ajit Khaparde
  5 siblings, 0 replies; 6+ messages in thread
From: Ajit Khaparde @ 2018-05-01  1:06 UTC (permalink / raw)
  To: dev; +Cc: Xiaoxin Peng, stable, Jay Ding, Scott Branden

From: Xiaoxin Peng <xiaoxin.peng@broadcom.com>

In the start/stop_op operation, mbufs allocated for rings were not freed

1) add bnxt_free_tx_mbuf/bnxt_free_rx_mbuf in bnxt_dev_stop_op to free MBUF
   before freeing the rings.
2) MBUF allocation and free routines were not in sync. Allocation uses the
   ring->ring_size including any rounded up and multiple factors while the
   free routine uses the requested queue size.

Fixes: c09f57b49c13 ("net/bnxt: add start/stop/link update operations")
Cc: stable@dpdk.org

Signed-off-by: Jay Ding <jay.ding@broadcom.com>
Signed-off-by: Scott Branden <scott.branden@broadcom.com>
Reviewed-by: Ray Jui <ray.jui@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Signed-off-by: Xiaoxin Peng <xiaoxin.peng@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 4 ++--
 drivers/net/bnxt/bnxt_rxq.c    | 6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 352fc30b4..dc445f9a5 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -655,6 +655,8 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
 	}
 	bnxt_set_hwrm_link_config(bp, false);
 	bnxt_hwrm_port_clr_stats(bp);
+	bnxt_free_tx_mbufs(bp);
+	bnxt_free_rx_mbufs(bp);
 	bnxt_shutdown_nic(bp);
 	bp->dev_stopped = 1;
 }
@@ -666,8 +668,6 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev)
 	if (bp->dev_stopped == 0)
 		bnxt_dev_stop_op(eth_dev);
 
-	bnxt_free_tx_mbufs(bp);
-	bnxt_free_rx_mbufs(bp);
 	bnxt_free_mem(bp);
 	if (eth_dev->data->mac_addrs != NULL) {
 		rte_free(eth_dev->data->mac_addrs);
diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index 4b380d4f0..866fb56b1 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -207,7 +207,8 @@ static void bnxt_rx_queue_release_mbufs(struct bnxt_rx_queue *rxq)
 	if (rxq) {
 		sw_ring = rxq->rx_ring->rx_buf_ring;
 		if (sw_ring) {
-			for (i = 0; i < rxq->nb_rx_desc; i++) {
+			for (i = 0;
+			     i < rxq->rx_ring->rx_ring_struct->ring_size; i++) {
 				if (sw_ring[i].mbuf) {
 					rte_pktmbuf_free_seg(sw_ring[i].mbuf);
 					sw_ring[i].mbuf = NULL;
@@ -217,7 +218,8 @@ static void bnxt_rx_queue_release_mbufs(struct bnxt_rx_queue *rxq)
 		/* Free up mbufs in Agg ring */
 		sw_ring = rxq->rx_ring->ag_buf_ring;
 		if (sw_ring) {
-			for (i = 0; i < rxq->nb_rx_desc; i++) {
+			for (i = 0;
+			     i < rxq->rx_ring->ag_ring_struct->ring_size; i++) {
 				if (sw_ring[i].mbuf) {
 					rte_pktmbuf_free_seg(sw_ring[i].mbuf);
 					sw_ring[i].mbuf = NULL;
-- 
2.15.1 (Apple Git-101)

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

* [dpdk-stable] [PATCH 11/12] net/bnxt: fix usage of vnic id
       [not found] <20180501010616.40472-1-ajit.khaparde@broadcom.com>
                   ` (4 preceding siblings ...)
  2018-05-01  1:06 ` [dpdk-stable] [PATCH 10/12] net/bnxt: fix rx mbuf and agg ring leak in dev stop Ajit Khaparde
@ 2018-05-01  1:06 ` Ajit Khaparde
  5 siblings, 0 replies; 6+ messages in thread
From: Ajit Khaparde @ 2018-05-01  1:06 UTC (permalink / raw)
  To: dev; +Cc: stable, Scott Branden

VNIC ID returned by the FW is a 16-bit field.
We are incorrectly using it as a 32-bit value in few places.
This patch corrects that.

Fixes: daef48efe5e5 ("net/bnxt: support set MTU")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Scott Branden <scott.branden@broadcom.com>
Reviewed-by: Michael Wildt <michael.wildt@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Reviewed-by: Ray Jui <ray.jui@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index c136edc06..d3c50e490 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -1212,7 +1212,7 @@ static int bnxt_hwrm_vnic_plcmodes_qcfg(struct bnxt *bp,
 
 	HWRM_PREP(req, VNIC_PLCMODES_QCFG);
 
-	req.vnic_id = rte_cpu_to_le_32(vnic->fw_vnic_id);
+	req.vnic_id = rte_cpu_to_le_16(vnic->fw_vnic_id);
 
 	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
 
@@ -1240,7 +1240,7 @@ static int bnxt_hwrm_vnic_plcmodes_cfg(struct bnxt *bp,
 
 	HWRM_PREP(req, VNIC_PLCMODES_CFG);
 
-	req.vnic_id = rte_cpu_to_le_32(vnic->fw_vnic_id);
+	req.vnic_id = rte_cpu_to_le_16(vnic->fw_vnic_id);
 	req.flags = rte_cpu_to_le_32(pmode->flags);
 	req.jumbo_thresh = rte_cpu_to_le_16(pmode->jumbo_thresh);
 	req.hds_offset = rte_cpu_to_le_16(pmode->hds_offset);
@@ -1484,7 +1484,7 @@ int bnxt_hwrm_vnic_plcmode_cfg(struct bnxt *bp,
 	size -= RTE_PKTMBUF_HEADROOM;
 
 	req.jumbo_thresh = rte_cpu_to_le_16(size);
-	req.vnic_id = rte_cpu_to_le_32(vnic->fw_vnic_id);
+	req.vnic_id = rte_cpu_to_le_16(vnic->fw_vnic_id);
 
 	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
 
@@ -1520,7 +1520,7 @@ int bnxt_hwrm_vnic_tpa_cfg(struct bnxt *bp,
 			rte_cpu_to_le_16(HWRM_VNIC_TPA_CFG_INPUT_MAX_AGGS_MAX);
 		req.min_agg_len = rte_cpu_to_le_32(512);
 	}
-	req.vnic_id = rte_cpu_to_le_32(vnic->fw_vnic_id);
+	req.vnic_id = rte_cpu_to_le_16(vnic->fw_vnic_id);
 
 	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
 
-- 
2.15.1 (Apple Git-101)

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

end of thread, other threads:[~2018-05-01  1:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20180501010616.40472-1-ajit.khaparde@broadcom.com>
2018-05-01  1:06 ` [dpdk-stable] [PATCH 06/12] net/bnxt: set MTU in dev config for jumbo packets Ajit Khaparde
2018-05-01  1:06 ` [dpdk-stable] [PATCH 07/12] net/bnxt: fix MTU calculation Ajit Khaparde
2018-05-01  1:06 ` [dpdk-stable] [PATCH 08/12] net/bnxt: return error if init is not complete before accessing stats Ajit Khaparde
2018-05-01  1:06 ` [dpdk-stable] [PATCH 09/12] net/bnxt: fix to reset status of initialization Ajit Khaparde
2018-05-01  1:06 ` [dpdk-stable] [PATCH 10/12] net/bnxt: fix rx mbuf and agg ring leak in dev stop Ajit Khaparde
2018-05-01  1:06 ` [dpdk-stable] [PATCH 11/12] net/bnxt: fix usage of vnic id 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).