DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mrvl: fix mbuf to bpool lookup
@ 2018-01-26  7:55 Tomasz Duszynski
  2018-01-26 18:09 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
  0 siblings, 1 reply; 2+ messages in thread
From: Tomasz Duszynski @ 2018-01-26  7:55 UTC (permalink / raw)
  To: dev; +Cc: mw, dima, nsamsono, Jianbo.liu, stable

From: Natalie Samsonov <nsamsono@marvell.com>

Since in DPDK 17.11 port type was changed from uint8_t to uint16_t
the MBUF_INVALID_PORT value became 0xffff but in mrvl_tx_pkt_burst()
when trying to lookup bpool using mbuf port, we check if the port
is invalid according to value 0xff. This causes segmentation fault.

Solution: since the valid port value cannot exceed RTE_MAX_ETHPORTS
(size of bpool lookup table) any other values consider as invalid so
the packet should be returned to DPDK pool.

Fixes: afb4d0d0bf91 ("net/mrvl: add Rx/Tx support")
Cc: stable@dpdk.org

Signed-off-by: Natalie Samsonov <nsamsono@marvell.com>
---
 drivers/net/mrvl/mrvl_ethdev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mrvl/mrvl_ethdev.c b/drivers/net/mrvl/mrvl_ethdev.c
index 3b60f91..705c4bd 100644
--- a/drivers/net/mrvl/mrvl_ethdev.c
+++ b/drivers/net/mrvl/mrvl_ethdev.c
@@ -2096,8 +2096,9 @@ mrvl_tx_pkt_burst(void *txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		sq->ent[sq->head].buff.addr =
 			rte_mbuf_data_iova_default(mbuf);
 		sq->ent[sq->head].bpool =
-			(unlikely(mbuf->port == 0xff || mbuf->refcnt > 1)) ?
-			 NULL : mrvl_port_to_bpool_lookup[mbuf->port];
+			(unlikely(mbuf->port >= RTE_MAX_ETHPORTS ||
+			 mbuf->refcnt > 1)) ? NULL :
+			 mrvl_port_to_bpool_lookup[mbuf->port];
 		sq->head = (sq->head + 1) & MRVL_PP2_TX_SHADOWQ_MASK;
 		sq->size++;
 
@@ -2430,6 +2431,7 @@ rte_pmd_mrvl_probe(struct rte_vdev_device *vdev)
 	}
 
 	memset(mrvl_port_bpool_size, 0, sizeof(mrvl_port_bpool_size));
+	memset(mrvl_port_to_bpool_lookup, 0, sizeof(mrvl_port_to_bpool_lookup));
 
 	mrvl_lcore_first = RTE_MAX_LCORE;
 	mrvl_lcore_last = 0;
-- 
2.7.4

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

* Re: [dpdk-dev] [dpdk-stable] [PATCH] net/mrvl: fix mbuf to bpool lookup
  2018-01-26  7:55 [dpdk-dev] [PATCH] net/mrvl: fix mbuf to bpool lookup Tomasz Duszynski
@ 2018-01-26 18:09 ` Ferruh Yigit
  0 siblings, 0 replies; 2+ messages in thread
From: Ferruh Yigit @ 2018-01-26 18:09 UTC (permalink / raw)
  To: Tomasz Duszynski, dev; +Cc: mw, dima, nsamsono, Jianbo.liu, stable

On 1/26/2018 7:55 AM, Tomasz Duszynski wrote:
> From: Natalie Samsonov <nsamsono@marvell.com>
> 
> Since in DPDK 17.11 port type was changed from uint8_t to uint16_t
> the MBUF_INVALID_PORT value became 0xffff but in mrvl_tx_pkt_burst()
> when trying to lookup bpool using mbuf port, we check if the port
> is invalid according to value 0xff. This causes segmentation fault.
> 
> Solution: since the valid port value cannot exceed RTE_MAX_ETHPORTS
> (size of bpool lookup table) any other values consider as invalid so
> the packet should be returned to DPDK pool.
> 
> Fixes: afb4d0d0bf91 ("net/mrvl: add Rx/Tx support")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Natalie Samsonov <nsamsono@marvell.com>

Applied to dpdk-next-net/master, thanks.

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

end of thread, other threads:[~2018-01-26 18:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-26  7:55 [dpdk-dev] [PATCH] net/mrvl: fix mbuf to bpool lookup Tomasz Duszynski
2018-01-26 18:09 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit

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