summaryrefslogtreecommitdiff
path: root/drivers/net/bnx2x
diff options
context:
space:
mode:
authorYangchao Zhou <zhouyates@gmail.com>2018-02-06 19:20:33 +0800
committerFerruh Yigit <ferruh.yigit@intel.com>2018-04-27 17:34:41 +0100
commit58c18bc11443043d33dda361fe1e718b15d504c1 (patch)
tree077802979b881d5ba94042fd511b8c7de1220951 /drivers/net/bnx2x
parent4c53d4eaf11551c69201b192a7da153d1d88a9a5 (diff)
downloaddpdk-next-eventdev-58c18bc11443043d33dda361fe1e718b15d504c1.zip
dpdk-next-eventdev-58c18bc11443043d33dda361fe1e718b15d504c1.tar.gz
dpdk-next-eventdev-58c18bc11443043d33dda361fe1e718b15d504c1.tar.xz
net/bnx2x: reserve enough headroom for mbuf prepend
When allocating a new mbuf for Rx, the value of m->data_off should be reset to its default value (RTE_PKTMBUF_HEADROOM), instead of reusing the previous undefined value, which could cause the packet to have a too small or too high headroom. Signed-off-by: Yangchao Zhou <zhouyates@gmail.com> Acked-by: Harish Patil <harish.patil@cavium.com>
Diffstat (limited to 'drivers/net/bnx2x')
-rw-r--r--drivers/net/bnx2x/bnx2x_rxtx.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/bnx2x/bnx2x_rxtx.c b/drivers/net/bnx2x/bnx2x_rxtx.c
index 6be7277..1ab1abe 100644
--- a/drivers/net/bnx2x/bnx2x_rxtx.c
+++ b/drivers/net/bnx2x/bnx2x_rxtx.c
@@ -141,7 +141,8 @@ bnx2x_dev_rx_queue_setup(struct rte_eth_dev *dev,
return -ENOMEM;
}
rxq->sw_ring[idx] = mbuf;
- rxq->rx_ring[idx] = mbuf->buf_iova;
+ rxq->rx_ring[idx] =
+ rte_cpu_to_le_64(rte_mbuf_data_iova_default(mbuf));
}
rxq->pkt_first_seg = NULL;
rxq->pkt_last_seg = NULL;
@@ -401,7 +402,8 @@ bnx2x_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
rx_mb = rxq->sw_ring[bd_cons];
rxq->sw_ring[bd_cons] = new_mb;
- rxq->rx_ring[bd_prod] = new_mb->buf_iova;
+ rxq->rx_ring[bd_prod] =
+ rte_cpu_to_le_64(rte_mbuf_data_iova_default(new_mb));
rx_pref = NEXT_RX_BD(bd_cons) & MAX_RX_BD(rxq);
rte_prefetch0(rxq->sw_ring[rx_pref]);
@@ -410,7 +412,7 @@ bnx2x_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
rte_prefetch0(&rxq->sw_ring[rx_pref]);
}
- rx_mb->data_off = pad;
+ rx_mb->data_off = pad + RTE_PKTMBUF_HEADROOM;
rx_mb->nb_segs = 1;
rx_mb->next = NULL;
rx_mb->pkt_len = rx_mb->data_len = len;