common/sfc_efx/base: report maximum Rx data count

Such information is useful to client drivers which deal with
large Rx pool buffers (16-bit wide data count) and thus need
to avoid overflow when setting EF10's 14-bit wide data count.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
This commit is contained in:
Ivan Malov 2022-08-12 15:24:53 +03:00 committed by Andrew Rybchenko
parent 79b0c19261
commit 61b3e9e79a
5 changed files with 19 additions and 0 deletions

View File

@ -2233,6 +2233,7 @@ ef10_nic_board_cfg(
/* Alignment for WPTR updates */
encp->enc_rx_push_align = EF10_RX_WPTR_ALIGN;
encp->enc_rx_dma_desc_size_max = EFX_MASK32(ESF_DZ_RX_KER_BYTE_CNT);
encp->enc_tx_dma_desc_size_max = EFX_MASK32(ESF_DZ_TX_KER_BYTE_CNT);
/* No boundary crossing limits */
encp->enc_tx_dma_desc_boundary = 0;

View File

@ -1587,6 +1587,7 @@ typedef struct efx_nic_cfg_s {
/* Number of rx descriptors the hardware requires for a push. */
uint32_t enc_rx_push_align;
/* Maximum amount of data in DMA descriptor */
uint32_t enc_rx_dma_desc_size_max;
uint32_t enc_tx_dma_desc_size_max;
/*
* Boundary which DMA descriptor data must not cross or 0 if no

View File

@ -978,7 +978,14 @@ efx_rx_qcreate(
__in efx_evq_t *eep,
__deref_out efx_rxq_t **erpp)
{
const efx_nic_cfg_t *encp = efx_nic_cfg_get(enp);
efx_rxq_type_data_t type_data;
efx_rc_t rc;
if (buf_size > encp->enc_rx_dma_desc_size_max) {
rc = EINVAL;
goto fail1;
}
memset(&type_data, 0, sizeof (type_data));
@ -986,6 +993,11 @@ efx_rx_qcreate(
return efx_rx_qcreate_internal(enp, index, label, type, &type_data,
esmp, ndescs, id, flags, eep, erpp);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
#if EFSYS_OPT_RX_PACKED_STREAM

View File

@ -40,6 +40,10 @@ rhead_board_cfg(
encp->enc_clk_mult = 1; /* not used for Riverhead */
EFX_STATIC_ASSERT(MC_CMD_INIT_RXQ_V4_IN_BUFFER_SIZE_BYTES_LEN == 4);
/* Agrees with MC_CMD_INIT_RXQ_V4_IN_BUFFER_SIZE_BYTES_LEN */
encp->enc_rx_dma_desc_size_max = UINT32_MAX;
/*
* FIXME There are TxSend and TxSeg descriptors on Riverhead.
* TxSeg is bigger than TxSend.

View File

@ -146,6 +146,7 @@ siena_board_cfg(
*/
encp->enc_evq_init_done_ev_supported = B_TRUE;
encp->enc_rx_dma_desc_size_max = EFX_MASK32(FSF_AZ_RX_KER_BYTE_COUNT);
encp->enc_tx_dma_desc_size_max = EFX_MASK32(FSF_AZ_TX_KER_BYTE_COUNT);
/* Fragments must not span 4k boundaries. */
encp->enc_tx_dma_desc_boundary = 4096;