Skip to content

Commit

Permalink
net/ice: fix Rx data buffer size
Browse files Browse the repository at this point in the history
[ upstream commit 9a5c9dc475428c7d2c74383c0903541ab80144ea ]

This patch does two fixes.

1. According to hardware spec, the data buffer size should not
be greater than 16K - 128.

2. Replace RTE_ALIGN with RTE_ALIGN_FLOOR according to [1].

[1] Commit c9c45be ("net/iavf: fix Rx queue buffer size alignment")

Fixes: 5037066 ("net/ice: support device and queue ops")
Fixes: 1b00927 ("net/ice: add Rx queue init in DCF")

Signed-off-by: Wenjun Wu <wenjun1.wu@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
  • Loading branch information
Junewu7777 authored and kevintraynor committed Jul 11, 2023
1 parent d5755af commit 54b0828
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion drivers/net/ice/ice_dcf_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ ice_dcf_init_rxq(struct rte_eth_dev *dev, struct ice_rx_queue *rxq)

buf_size = rte_pktmbuf_data_room_size(rxq->mp) - RTE_PKTMBUF_HEADROOM;
rxq->rx_hdr_len = 0;
rxq->rx_buf_len = RTE_ALIGN(buf_size, (1 << ICE_RLAN_CTX_DBUF_S));
rxq->rx_buf_len = RTE_ALIGN_FLOOR(buf_size, (1 << ICE_RLAN_CTX_DBUF_S));
rxq->rx_buf_len = RTE_MIN(rxq->rx_buf_len, ICE_RX_MAX_DATA_BUF_SIZE);
max_pkt_len = RTE_MIN(ICE_SUPPORT_CHAIN_NUM * rxq->rx_buf_len,
dev->data->mtu + ICE_ETH_OVERHEAD);

Expand Down
3 changes: 2 additions & 1 deletion drivers/net/ice/ice_rxtx.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq)
buf_size = (uint16_t)(rte_pktmbuf_data_room_size(rxq->mp) -
RTE_PKTMBUF_HEADROOM);
rxq->rx_hdr_len = 0;
rxq->rx_buf_len = RTE_ALIGN(buf_size, (1 << ICE_RLAN_CTX_DBUF_S));
rxq->rx_buf_len = RTE_ALIGN_FLOOR(buf_size, (1 << ICE_RLAN_CTX_DBUF_S));
rxq->rx_buf_len = RTE_MIN(rxq->rx_buf_len, ICE_RX_MAX_DATA_BUF_SIZE);
rxq->max_pkt_len =
RTE_MIN((uint32_t)ICE_SUPPORT_CHAIN_NUM * rxq->rx_buf_len,
frame_size);
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/ice/ice_rxtx.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
extern uint64_t ice_timestamp_dynflag;
extern int ice_timestamp_dynfield_offset;

/* Max data buffer size must be 16K - 128 bytes */
#define ICE_RX_MAX_DATA_BUF_SIZE (16 * 1024 - 128)

typedef void (*ice_rx_release_mbufs_t)(struct ice_rx_queue *rxq);
typedef void (*ice_tx_release_mbufs_t)(struct ice_tx_queue *txq);
typedef void (*ice_rxd_to_pkt_fields_t)(struct ice_rx_queue *rxq,
Expand Down

0 comments on commit 54b0828

Please sign in to comment.