patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH v3 02/13] net/enetc: fix SMMU unhandled context fault
       [not found] ` <20190412105105.24351-1-g.singh@nxp.com>
@ 2019-04-12 11:01   ` Gagandeep Singh
  2019-04-12 11:01   ` [dpdk-stable] [PATCH v3 03/13] net/enetc: fix big endian build and correct buffer allocation Gagandeep Singh
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Gagandeep Singh @ 2019-04-12 11:01 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: Gagandeep Singh, stable

First configure ring with BDs properly then enable
the ring.

Fixes: 469c6111a799 ("net/enetc: enable Rx and Tx")
Cc: stable@dpdk.org

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
 drivers/net/enetc/enetc_ethdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index 7a9a97d..f1807b9 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -492,15 +492,15 @@ static int enetc_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
 		       ENETC_RTBLENR_LEN(rx_ring->bd_count));
 
 	rx_ring->mb_pool = mb_pool;
-	/* enable ring */
-	enetc_rxbdr_wr(hw, idx, ENETC_RBMR, ENETC_RBMR_EN);
-	enetc_rxbdr_wr(hw, idx, ENETC_RBPIR, 0);
 	rx_ring->rcir = (void *)((size_t)hw->reg +
 			ENETC_BDR(RX, idx, ENETC_RBCIR));
 	enetc_refill_rx_ring(rx_ring, (enetc_bd_unused(rx_ring)));
 	buf_size = (uint16_t)(rte_pktmbuf_data_room_size(rx_ring->mb_pool) -
 		   RTE_PKTMBUF_HEADROOM);
 	enetc_rxbdr_wr(hw, idx, ENETC_RBBSR, buf_size);
+	/* enable ring */
+	enetc_rxbdr_wr(hw, idx, ENETC_RBMR, ENETC_RBMR_EN);
+	enetc_rxbdr_wr(hw, idx, ENETC_RBPIR, 0);
 }
 
 static int
-- 
1.9.1


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

* [dpdk-stable] [PATCH v3 03/13] net/enetc: fix big endian build and correct buffer allocation
       [not found] ` <20190412105105.24351-1-g.singh@nxp.com>
  2019-04-12 11:01   ` [dpdk-stable] [PATCH v3 02/13] net/enetc: fix SMMU unhandled context fault Gagandeep Singh
@ 2019-04-12 11:01   ` Gagandeep Singh
  2019-04-12 11:01   ` [dpdk-stable] [PATCH v3 13/13] net/enetc: fix crash at high speed traffic Gagandeep Singh
       [not found]   ` <20190412122840.1908-1-g.singh@nxp.com>
  3 siblings, 0 replies; 6+ messages in thread
From: Gagandeep Singh @ 2019-04-12 11:01 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: Gagandeep Singh, thomas, stable

There was an error at rte_constant_bswap64 while compiling
with big endian toolchain. so fixing it by adding type cast.

Also, rte_pktmbuf_alloc API should be used to allocate mbuf
instead of rte_pktmbuf_raw_alloc to avoid use of stale mbuf
information.

Fixes: 469c6111a799 ("net/enetc: enable Rx and Tx")
Cc: thomas@monjalon.net
Cc: stable@dpdk.org

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
 drivers/net/enetc/enetc_rxtx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/enetc/enetc_rxtx.c b/drivers/net/enetc/enetc_rxtx.c
index a31a387..42f16ca 100644
--- a/drivers/net/enetc/enetc_rxtx.c
+++ b/drivers/net/enetc/enetc_rxtx.c
@@ -88,8 +88,9 @@
 	rx_swbd = &rx_ring->q_swbd[i];
 	rxbd = ENETC_RXBD(*rx_ring, i);
 	for (j = 0; j < buff_cnt; j++) {
-		rx_swbd->buffer_addr =
-			rte_cpu_to_le_64(rte_mbuf_raw_alloc(rx_ring->mb_pool));
+		rx_swbd->buffer_addr = (void *)(uintptr_t)
+			rte_cpu_to_le_64((uint64_t)(uintptr_t)
+					rte_pktmbuf_alloc(rx_ring->mb_pool));
 		rxbd->w.addr = (uint64_t)(uintptr_t)
 			       rx_swbd->buffer_addr->buf_iova +
 			       rx_swbd->buffer_addr->data_off;
-- 
1.9.1


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

* [dpdk-stable] [PATCH v3 13/13] net/enetc: fix crash at high speed traffic
       [not found] ` <20190412105105.24351-1-g.singh@nxp.com>
  2019-04-12 11:01   ` [dpdk-stable] [PATCH v3 02/13] net/enetc: fix SMMU unhandled context fault Gagandeep Singh
  2019-04-12 11:01   ` [dpdk-stable] [PATCH v3 03/13] net/enetc: fix big endian build and correct buffer allocation Gagandeep Singh
@ 2019-04-12 11:01   ` Gagandeep Singh
       [not found]   ` <20190412122840.1908-1-g.singh@nxp.com>
  3 siblings, 0 replies; 6+ messages in thread
From: Gagandeep Singh @ 2019-04-12 11:01 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: Gagandeep Singh, stable

On xmit side, there should be a check whether BD ring
has free BDs available before transmit a packet to avoid
data corruption and buffer leak issue.

Fixes: 469c6111a799 ("net/enetc: enable Rx and Tx")
Cc: stable@dpdk.org

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
 drivers/net/enetc/enetc_rxtx.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/enetc/enetc_rxtx.c b/drivers/net/enetc/enetc_rxtx.c
index 0ce7dbe..81b0ef3 100644
--- a/drivers/net/enetc/enetc_rxtx.c
+++ b/drivers/net/enetc/enetc_rxtx.c
@@ -49,11 +49,16 @@
 		uint16_t nb_pkts)
 {
 	struct enetc_swbd *tx_swbd;
-	int i, start;
+	int i, start, bds_to_use;
 	struct enetc_tx_bd *txbd;
 	struct enetc_bdr *tx_ring = (struct enetc_bdr *)tx_queue;
 
 	i = tx_ring->next_to_use;
+
+	bds_to_use = enetc_bd_unused(tx_ring);
+	if (bds_to_use < nb_pkts)
+		nb_pkts = bds_to_use;
+
 	start = 0;
 	while (nb_pkts--) {
 		enetc_clean_tx_ring(tx_ring);
-- 
1.9.1


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

* [dpdk-stable] [PATCH v4 02/13] net/enetc: fix SMMU unhandled context fault
       [not found]   ` <20190412122840.1908-1-g.singh@nxp.com>
@ 2019-04-12 12:28     ` Gagandeep Singh
  2019-04-12 12:28     ` [dpdk-stable] [PATCH v4 03/13] net/enetc: fix big endian build and correct buffer allocation Gagandeep Singh
  2019-04-12 12:29     ` [dpdk-stable] [PATCH v4 13/13] net/enetc: fix crash at high speed traffic Gagandeep Singh
  2 siblings, 0 replies; 6+ messages in thread
From: Gagandeep Singh @ 2019-04-12 12:28 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: Gagandeep Singh, stable

First configure ring with BDs properly then enable
the ring.

Fixes: 469c6111a799 ("net/enetc: enable Rx and Tx")
Cc: stable@dpdk.org

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
 drivers/net/enetc/enetc_ethdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index 7a9a97deb..f1807b901 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -492,15 +492,15 @@ enetc_setup_rxbdr(struct enetc_hw *hw, struct enetc_bdr *rx_ring,
 		       ENETC_RTBLENR_LEN(rx_ring->bd_count));
 
 	rx_ring->mb_pool = mb_pool;
-	/* enable ring */
-	enetc_rxbdr_wr(hw, idx, ENETC_RBMR, ENETC_RBMR_EN);
-	enetc_rxbdr_wr(hw, idx, ENETC_RBPIR, 0);
 	rx_ring->rcir = (void *)((size_t)hw->reg +
 			ENETC_BDR(RX, idx, ENETC_RBCIR));
 	enetc_refill_rx_ring(rx_ring, (enetc_bd_unused(rx_ring)));
 	buf_size = (uint16_t)(rte_pktmbuf_data_room_size(rx_ring->mb_pool) -
 		   RTE_PKTMBUF_HEADROOM);
 	enetc_rxbdr_wr(hw, idx, ENETC_RBBSR, buf_size);
+	/* enable ring */
+	enetc_rxbdr_wr(hw, idx, ENETC_RBMR, ENETC_RBMR_EN);
+	enetc_rxbdr_wr(hw, idx, ENETC_RBPIR, 0);
 }
 
 static int
-- 
2.19.1


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

* [dpdk-stable] [PATCH v4 03/13] net/enetc: fix big endian build and correct buffer allocation
       [not found]   ` <20190412122840.1908-1-g.singh@nxp.com>
  2019-04-12 12:28     ` [dpdk-stable] [PATCH v4 02/13] net/enetc: fix SMMU unhandled context fault Gagandeep Singh
@ 2019-04-12 12:28     ` Gagandeep Singh
  2019-04-12 12:29     ` [dpdk-stable] [PATCH v4 13/13] net/enetc: fix crash at high speed traffic Gagandeep Singh
  2 siblings, 0 replies; 6+ messages in thread
From: Gagandeep Singh @ 2019-04-12 12:28 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: Gagandeep Singh, stable

There was an error at rte_constant_bswap64 while compiling
with big endian toolchain. so fixing it by adding type cast.

Also, rte_pktmbuf_alloc API should be used to allocate mbuf
instead of rte_pktmbuf_raw_alloc to avoid use of stale mbuf
information.

Fixes: 469c6111a799 ("net/enetc: enable Rx and Tx")
Cc: stable@dpdk.org

Suggested-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
 drivers/net/enetc/enetc_rxtx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/enetc/enetc_rxtx.c b/drivers/net/enetc/enetc_rxtx.c
index a31a38725..42f16cab1 100644
--- a/drivers/net/enetc/enetc_rxtx.c
+++ b/drivers/net/enetc/enetc_rxtx.c
@@ -88,8 +88,9 @@ enetc_refill_rx_ring(struct enetc_bdr *rx_ring, const int buff_cnt)
 	rx_swbd = &rx_ring->q_swbd[i];
 	rxbd = ENETC_RXBD(*rx_ring, i);
 	for (j = 0; j < buff_cnt; j++) {
-		rx_swbd->buffer_addr =
-			rte_cpu_to_le_64(rte_mbuf_raw_alloc(rx_ring->mb_pool));
+		rx_swbd->buffer_addr = (void *)(uintptr_t)
+			rte_cpu_to_le_64((uint64_t)(uintptr_t)
+					rte_pktmbuf_alloc(rx_ring->mb_pool));
 		rxbd->w.addr = (uint64_t)(uintptr_t)
 			       rx_swbd->buffer_addr->buf_iova +
 			       rx_swbd->buffer_addr->data_off;
-- 
2.19.1


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

* [dpdk-stable] [PATCH v4 13/13] net/enetc: fix crash at high speed traffic
       [not found]   ` <20190412122840.1908-1-g.singh@nxp.com>
  2019-04-12 12:28     ` [dpdk-stable] [PATCH v4 02/13] net/enetc: fix SMMU unhandled context fault Gagandeep Singh
  2019-04-12 12:28     ` [dpdk-stable] [PATCH v4 03/13] net/enetc: fix big endian build and correct buffer allocation Gagandeep Singh
@ 2019-04-12 12:29     ` Gagandeep Singh
  2 siblings, 0 replies; 6+ messages in thread
From: Gagandeep Singh @ 2019-04-12 12:29 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: Gagandeep Singh, stable

On xmit side, there should be a check whether BD ring
has free BDs available before transmit a packet to avoid
data corruption and buffer leak issue.

Fixes: 469c6111a799 ("net/enetc: enable Rx and Tx")
Cc: stable@dpdk.org

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
 drivers/net/enetc/enetc_rxtx.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/enetc/enetc_rxtx.c b/drivers/net/enetc/enetc_rxtx.c
index 0ce7dbee7..81b0ef3b1 100644
--- a/drivers/net/enetc/enetc_rxtx.c
+++ b/drivers/net/enetc/enetc_rxtx.c
@@ -49,11 +49,16 @@ enetc_xmit_pkts(void *tx_queue,
 		uint16_t nb_pkts)
 {
 	struct enetc_swbd *tx_swbd;
-	int i, start;
+	int i, start, bds_to_use;
 	struct enetc_tx_bd *txbd;
 	struct enetc_bdr *tx_ring = (struct enetc_bdr *)tx_queue;
 
 	i = tx_ring->next_to_use;
+
+	bds_to_use = enetc_bd_unused(tx_ring);
+	if (bds_to_use < nb_pkts)
+		nb_pkts = bds_to_use;
+
 	start = 0;
 	while (nb_pkts--) {
 		enetc_clean_tx_ring(tx_ring);
-- 
2.19.1


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

end of thread, other threads:[~2019-04-12 12:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1555075598-4988-1-git-send-email-g.singh@nxp.com>
     [not found] ` <20190412105105.24351-1-g.singh@nxp.com>
2019-04-12 11:01   ` [dpdk-stable] [PATCH v3 02/13] net/enetc: fix SMMU unhandled context fault Gagandeep Singh
2019-04-12 11:01   ` [dpdk-stable] [PATCH v3 03/13] net/enetc: fix big endian build and correct buffer allocation Gagandeep Singh
2019-04-12 11:01   ` [dpdk-stable] [PATCH v3 13/13] net/enetc: fix crash at high speed traffic Gagandeep Singh
     [not found]   ` <20190412122840.1908-1-g.singh@nxp.com>
2019-04-12 12:28     ` [dpdk-stable] [PATCH v4 02/13] net/enetc: fix SMMU unhandled context fault Gagandeep Singh
2019-04-12 12:28     ` [dpdk-stable] [PATCH v4 03/13] net/enetc: fix big endian build and correct buffer allocation Gagandeep Singh
2019-04-12 12:29     ` [dpdk-stable] [PATCH v4 13/13] net/enetc: fix crash at high speed traffic Gagandeep Singh

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