[3/3] net/sfc: clarify Rx buffer size calculation
Checks
Commit Message
The user has the right to supply pools with excessively large
buffers, regardless of the maximum supported Rx packet length
reported by the adapter. However, in this PMD, on EF10 boards,
a Rx descriptor has only 14 bits to specify the buffer length.
To avoid potential problems, use this information accordingly.
Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
drivers/net/sfc/sfc_rx.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
@@ -1081,7 +1081,11 @@ sfc_rx_mb_pool_buf_size(struct sfc_adapter *sa, struct rte_mempool *mb_pool)
buf_size = EFX_P2ALIGN(uint32_t, buf_size, nic_align_end);
}
- return buf_size;
+ /*
+ * Buffer length field of a Rx descriptor may not be wide
+ * enough to store a 16-bit data count taken from an mbuf.
+ */
+ return MIN(buf_size, encp->enc_rx_dma_desc_size_max);
}
int