net/netvsc: fix crash during Tx

Commit cc02518132 ("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: cc02518132 ("net/netvsc: split send buffers from Tx descriptors")
Cc: stable@dpdk.org

Signed-off-by: Chas Williams <3chas3@gmail.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
Chas Williams 2020-07-29 09:58:44 -04:00 committed by Ferruh Yigit
parent d74fab8e7c
commit aee76bb79b

View File

@ -1421,11 +1421,12 @@ static int hn_xmit_sg(struct hn_tx_queue *txq,
hn_rndis_dump(txd->rndis_pkt); hn_rndis_dump(txd->rndis_pkt);
/* pass IOVA of rndis header in first segment */ /* 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)) { if (unlikely(addr == RTE_BAD_IOVA)) {
PMD_DRV_LOG(ERR, "RNDIS transmit can not get iova"); PMD_DRV_LOG(ERR, "RNDIS transmit can not get iova");
return -EINVAL; return -EINVAL;
} }
addr = addr + ((char *)txd->rndis_pkt - (char *)txq->tx_rndis);
sg[0].page = addr / PAGE_SIZE; sg[0].page = addr / PAGE_SIZE;
sg[0].ofs = addr & PAGE_MASK; sg[0].ofs = addr & PAGE_MASK;