From: Qiming Chen Date: Sat, 11 Sep 2021 02:07:56 +0000 (+0800) Subject: net/iavf: fix Rx queue buffer size alignment X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;ds=sidebyside;h=c9c45beb1b97eed3fbf05095e376823fc58c9aa7;p=dpdk.git net/iavf: fix Rx queue buffer size alignment The RTE_ALIGN macro is aligned upwards. If the buf_size variable is not aligned with 1 << I40E_RXQ_CTX_DBUFF_SHIFT, the rx_buf_len is larger than the actual mbuf memory after the operation. When receiving the packet, if the packet is larger than the configured buf_size, it will cause a memory stepping event. The patch uses the RTE_ALIGN_FLOOR down alignment macro to correct the problem. Fixes: 69dd4c3d0898 ("net/avf: enable queue and device") Cc: stable@dpdk.org Signed-off-by: Qiming Chen Acked-by: Qi Zhang --- diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index 7240e70f9e..6de8ad3fe3 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -619,7 +619,7 @@ iavf_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, rxq->crc_len = 0; len = rte_pktmbuf_data_room_size(rxq->mp) - RTE_PKTMBUF_HEADROOM; - rxq->rx_buf_len = RTE_ALIGN(len, (1 << IAVF_RXQ_CTX_DBUFF_SHIFT)); + rxq->rx_buf_len = RTE_ALIGN_FLOOR(len, (1 << IAVF_RXQ_CTX_DBUFF_SHIFT)); /* Allocate the software ring. */ len = nb_desc + IAVF_RX_MAX_BURST;