From: Mohammad Shuab Siddique <[email protected]>
For extmem, the mbuf head node may be allocated from a pool
different from the data buffer pool. In that case the IOVA
address check using rte_mempool_virt2iova() will fail. To fix
this, skip the IOVA range check for external mbufs.
Also add unlikely() in checking invalid mbuf size.
Fixes: d01de33f98e2 ("net/bnxt: skip IOVA range check for external mbuf")
Cc: [email protected]
Signed-off-by: Damodharam Ammepalli <[email protected]>
Signed-off-by: Mohammad Shuab Siddique <[email protected]>
---
drivers/net/bnxt/bnxt_txr.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c
index 51b886c1a6..83d18e220b 100644
--- a/drivers/net/bnxt/bnxt_txr.c
+++ b/drivers/net/bnxt/bnxt_txr.c
@@ -220,8 +220,10 @@ static int bnxt_invalid_mbuf(struct rte_mbuf *mbuf)
if (unlikely(rte_mbuf_check(mbuf, 1, &reason)))
return -EINVAL;
- if (unlikely(!(mbuf->ol_flags & RTE_MBUF_F_EXTERNAL) &&
- (mbuf->buf_iova < mbuf_size ||
+ if (unlikely(mbuf->ol_flags & RTE_MBUF_F_EXTERNAL))
+ return 0;
+
+ if (unlikely((mbuf->buf_iova < mbuf_size ||
(mbuf->buf_iova != rte_mempool_virt2iova(mbuf) +
mbuf_size))))
return -EINVAL;
--
2.47.3