Skip to contentSkip to conversation

net/netvsc: fix seg fault during transmit

PATCH Applied Chas Williams 3 participants 3 messages Jul 29, 2020 – Jul 30, 2020 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/netvsc: fix seg fault during transmit

Commit cc0251813277 ("net/netvsc: split send buffers from Tx descriptors") changed the way that transmit descriptors are allocated. They come from a single pool instead of being individually attached to each mbuf. To find the IOVA, you need to calculate the offset from the base of the pool.

Fixes cc0251813277 ("net/netvsc: split send buffers from Tx descriptors")
---
 drivers/net/netvsc/hn_rxtx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/netvsc/hn_rxtx.c +2 -1
index 86a4c0d74..0428c586a 100644
@@ -1421,11 +1421,12 @@ static int hn_xmit_sg(struct hn_tx_queue *txq,
 	hn_rndis_dump(txd->rndis_pkt);
 
 	/* pass IOVA of rndis header in first segment */
-	addr = rte_malloc_virt2iova(txd->rndis_pkt);
+	addr = rte_malloc_virt2iova(txq->tx_rndis);
 	if (unlikely(addr == RTE_BAD_IOVA)) {
 		PMD_DRV_LOG(ERR, "RNDIS transmit can not get iova");
 		return -EINVAL;
 	}
+	addr = addr + ((char *)txd->rndis_pkt - (char *)txq->tx_rndis);
 
 	sg[0].page = addr / PAGE_SIZE;
 	sg[0].ofs = addr & PAGE_MASK;
Signature · 1 line
2.21.3
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · On Wed, 29 Jul 2020 09:58:44 -0400 Chas Williams <[email protected]> wrote:

Commit cc0251813277 ("net/netvsc: split send buffers from Tx descriptors") changed the way that transmit descriptors are allocated. They come from a single pool instead of being individually attached to each mbuf. To find the IOVA, you need to calculate the offset from the base of the pool.

Fixes cc0251813277 ("net/netvsc: split send buffers from Tx descriptors")
Applied
#2 lore raw
Quoted 9 lines · Stephen Hemminger
Quoted 6 lines · On Wed, 29 Jul 2020 09:58:44 -0400 Chas Williams <[email protected]> wrote:

Commit cc0251813277 ("net/netvsc: split send buffers from Tx descriptors") changed the way that transmit descriptors are allocated. They come from a single pool instead of being individually attached to each mbuf. To find the IOVA, you need to calculate the offset from the base of the pool.

Quoted 7 lines
Quoted 4 lines
Fixes cc0251813277 ("net/netvsc: split send buffers from Tx descriptors")

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