net/sfc/base: add function to create packed stream RxQ

Encoding packed stream buffer size in RxQ type is not a future-proof
idea taking into account a new RxQ types with extra parameters.
To be consistent make packet stream buffer size a separate parameter.
In order to avoid blowing of the default RxQ create function prototype
add a dedicated function to create packed stream RxQ without not
applicable paramters.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@solarflare.com>
Reviewed-by: Mark Spender <mspender@solarflare.com>
This commit is contained in:
Andrew Rybchenko 2017-12-24 10:46:36 +00:00 committed by Ferruh Yigit
parent d882d61794
commit b749646dad
6 changed files with 103 additions and 33 deletions

View File

@ -1347,8 +1347,7 @@ ef10_ev_rxlabel_init(
{ {
efx_evq_rxq_state_t *eersp; efx_evq_rxq_state_t *eersp;
#if EFSYS_OPT_RX_PACKED_STREAM #if EFSYS_OPT_RX_PACKED_STREAM
boolean_t packed_stream = (type >= EFX_RXQ_TYPE_PACKED_STREAM_1M) && boolean_t packed_stream = (type == EFX_RXQ_TYPE_PACKED_STREAM);
(type <= EFX_RXQ_TYPE_PACKED_STREAM_64K);
#endif #endif
_NOTE(ARGUNUSED(type)) _NOTE(ARGUNUSED(type))

View File

@ -977,6 +977,7 @@ ef10_rx_qcreate(
__in unsigned int index, __in unsigned int index,
__in unsigned int label, __in unsigned int label,
__in efx_rxq_type_t type, __in efx_rxq_type_t type,
__in uint32_t type_data,
__in efsys_mem_t *esmp, __in efsys_mem_t *esmp,
__in size_t ndescs, __in size_t ndescs,
__in uint32_t id, __in uint32_t id,

View File

@ -948,6 +948,7 @@ ef10_rx_qcreate(
__in unsigned int index, __in unsigned int index,
__in unsigned int label, __in unsigned int label,
__in efx_rxq_type_t type, __in efx_rxq_type_t type,
__in uint32_t type_data,
__in efsys_mem_t *esmp, __in efsys_mem_t *esmp,
__in size_t ndescs, __in size_t ndescs,
__in uint32_t id, __in uint32_t id,
@ -984,25 +985,32 @@ ef10_rx_qcreate(
ps_buf_size = 0; ps_buf_size = 0;
break; break;
#if EFSYS_OPT_RX_PACKED_STREAM #if EFSYS_OPT_RX_PACKED_STREAM
case EFX_RXQ_TYPE_PACKED_STREAM_1M: case EFX_RXQ_TYPE_PACKED_STREAM:
ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_1M; switch (type_data) {
break; case EFX_RXQ_PACKED_STREAM_BUF_SIZE_1M:
case EFX_RXQ_TYPE_PACKED_STREAM_512K: ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_1M;
ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_512K; break;
break; case EFX_RXQ_PACKED_STREAM_BUF_SIZE_512K:
case EFX_RXQ_TYPE_PACKED_STREAM_256K: ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_512K;
ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_256K; break;
break; case EFX_RXQ_PACKED_STREAM_BUF_SIZE_256K:
case EFX_RXQ_TYPE_PACKED_STREAM_128K: ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_256K;
ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_128K; break;
break; case EFX_RXQ_PACKED_STREAM_BUF_SIZE_128K:
case EFX_RXQ_TYPE_PACKED_STREAM_64K: ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_128K;
ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_64K; break;
case EFX_RXQ_PACKED_STREAM_BUF_SIZE_64K:
ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_64K;
break;
default:
rc = ENOTSUP;
goto fail3;
}
break; break;
#endif /* EFSYS_OPT_RX_PACKED_STREAM */ #endif /* EFSYS_OPT_RX_PACKED_STREAM */
default: default:
rc = ENOTSUP; rc = ENOTSUP;
goto fail3; goto fail4;
} }
#if EFSYS_OPT_RX_PACKED_STREAM #if EFSYS_OPT_RX_PACKED_STREAM
@ -1010,13 +1018,13 @@ ef10_rx_qcreate(
/* Check if datapath firmware supports packed stream mode */ /* Check if datapath firmware supports packed stream mode */
if (encp->enc_rx_packed_stream_supported == B_FALSE) { if (encp->enc_rx_packed_stream_supported == B_FALSE) {
rc = ENOTSUP; rc = ENOTSUP;
goto fail4; goto fail5;
} }
/* Check if packed stream allows configurable buffer sizes */ /* Check if packed stream allows configurable buffer sizes */
if ((type != EFX_RXQ_TYPE_PACKED_STREAM_1M) && if ((ps_buf_size != MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_1M) &&
(encp->enc_rx_var_packed_stream_supported == B_FALSE)) { (encp->enc_rx_var_packed_stream_supported == B_FALSE)) {
rc = ENOTSUP; rc = ENOTSUP;
goto fail5; goto fail6;
} }
} }
#else /* EFSYS_OPT_RX_PACKED_STREAM */ #else /* EFSYS_OPT_RX_PACKED_STREAM */
@ -1031,7 +1039,7 @@ ef10_rx_qcreate(
if ((rc = efx_mcdi_init_rxq(enp, ndescs, eep->ee_index, label, index, if ((rc = efx_mcdi_init_rxq(enp, ndescs, eep->ee_index, label, index,
esmp, disable_scatter, ps_buf_size)) != 0) esmp, disable_scatter, ps_buf_size)) != 0)
goto fail6; goto fail7;
erp->er_eep = eep; erp->er_eep = eep;
erp->er_label = label; erp->er_label = label;
@ -1042,16 +1050,20 @@ ef10_rx_qcreate(
return (0); return (0);
fail7:
EFSYS_PROBE(fail7);
#if EFSYS_OPT_RX_PACKED_STREAM
fail6: fail6:
EFSYS_PROBE(fail6); EFSYS_PROBE(fail6);
#if EFSYS_OPT_RX_PACKED_STREAM
fail5: fail5:
EFSYS_PROBE(fail5); EFSYS_PROBE(fail5);
#endif /* EFSYS_OPT_RX_PACKED_STREAM */
fail4: fail4:
EFSYS_PROBE(fail4); EFSYS_PROBE(fail4);
#endif /* EFSYS_OPT_RX_PACKED_STREAM */ #if EFSYS_OPT_RX_PACKED_STREAM
fail3: fail3:
EFSYS_PROBE(fail3); EFSYS_PROBE(fail3);
#endif /* EFSYS_OPT_RX_PACKED_STREAM */
fail2: fail2:
EFSYS_PROBE(fail2); EFSYS_PROBE(fail2);
fail1: fail1:

View File

@ -2002,11 +2002,7 @@ efx_pseudo_hdr_pkt_length_get(
typedef enum efx_rxq_type_e { typedef enum efx_rxq_type_e {
EFX_RXQ_TYPE_DEFAULT, EFX_RXQ_TYPE_DEFAULT,
EFX_RXQ_TYPE_PACKED_STREAM_1M, EFX_RXQ_TYPE_PACKED_STREAM,
EFX_RXQ_TYPE_PACKED_STREAM_512K,
EFX_RXQ_TYPE_PACKED_STREAM_256K,
EFX_RXQ_TYPE_PACKED_STREAM_128K,
EFX_RXQ_TYPE_PACKED_STREAM_64K,
EFX_RXQ_NTYPES EFX_RXQ_NTYPES
} efx_rxq_type_t; } efx_rxq_type_t;
@ -2030,6 +2026,27 @@ efx_rx_qcreate(
__in efx_evq_t *eep, __in efx_evq_t *eep,
__deref_out efx_rxq_t **erpp); __deref_out efx_rxq_t **erpp);
#if EFSYS_OPT_RX_PACKED_STREAM
#define EFX_RXQ_PACKED_STREAM_BUF_SIZE_1M (1U * 1024 * 1024)
#define EFX_RXQ_PACKED_STREAM_BUF_SIZE_512K (512U * 1024)
#define EFX_RXQ_PACKED_STREAM_BUF_SIZE_256K (256U * 1024)
#define EFX_RXQ_PACKED_STREAM_BUF_SIZE_128K (128U * 1024)
#define EFX_RXQ_PACKED_STREAM_BUF_SIZE_64K (64U * 1024)
extern __checkReturn efx_rc_t
efx_rx_qcreate_packed_stream(
__in efx_nic_t *enp,
__in unsigned int index,
__in unsigned int label,
__in uint32_t ps_buf_size,
__in efsys_mem_t *esmp,
__in size_t ndescs,
__in efx_evq_t *eep,
__deref_out efx_rxq_t **erpp);
#endif
typedef struct efx_buffer_s { typedef struct efx_buffer_s {
efsys_dma_addr_t eb_addr; efsys_dma_addr_t eb_addr;
size_t eb_size; size_t eb_size;

View File

@ -181,7 +181,7 @@ typedef struct efx_rx_ops_s {
efx_rc_t (*erxo_qflush)(efx_rxq_t *); efx_rc_t (*erxo_qflush)(efx_rxq_t *);
void (*erxo_qenable)(efx_rxq_t *); void (*erxo_qenable)(efx_rxq_t *);
efx_rc_t (*erxo_qcreate)(efx_nic_t *enp, unsigned int, efx_rc_t (*erxo_qcreate)(efx_nic_t *enp, unsigned int,
unsigned int, efx_rxq_type_t, unsigned int, efx_rxq_type_t, uint32_t,
efsys_mem_t *, size_t, uint32_t, efsys_mem_t *, size_t, uint32_t,
unsigned int, unsigned int,
efx_evq_t *, efx_rxq_t *); efx_evq_t *, efx_rxq_t *);

View File

@ -131,6 +131,7 @@ siena_rx_qcreate(
__in unsigned int index, __in unsigned int index,
__in unsigned int label, __in unsigned int label,
__in efx_rxq_type_t type, __in efx_rxq_type_t type,
__in uint32_t type_data,
__in efsys_mem_t *esmp, __in efsys_mem_t *esmp,
__in size_t ndescs, __in size_t ndescs,
__in uint32_t id, __in uint32_t id,
@ -611,12 +612,13 @@ efx_rx_qenable(
erxop->erxo_qenable(erp); erxop->erxo_qenable(erp);
} }
__checkReturn efx_rc_t static __checkReturn efx_rc_t
efx_rx_qcreate( efx_rx_qcreate_internal(
__in efx_nic_t *enp, __in efx_nic_t *enp,
__in unsigned int index, __in unsigned int index,
__in unsigned int label, __in unsigned int label,
__in efx_rxq_type_t type, __in efx_rxq_type_t type,
__in uint32_t type_data,
__in efsys_mem_t *esmp, __in efsys_mem_t *esmp,
__in size_t ndescs, __in size_t ndescs,
__in uint32_t id, __in uint32_t id,
@ -645,8 +647,8 @@ efx_rx_qcreate(
erp->er_mask = ndescs - 1; erp->er_mask = ndescs - 1;
erp->er_esmp = esmp; erp->er_esmp = esmp;
if ((rc = erxop->erxo_qcreate(enp, index, label, type, esmp, ndescs, id, if ((rc = erxop->erxo_qcreate(enp, index, label, type, type_data, esmp,
flags, eep, erp)) != 0) ndescs, id, flags, eep, erp)) != 0)
goto fail2; goto fail2;
enp->en_rx_qcount++; enp->en_rx_qcount++;
@ -664,6 +666,43 @@ efx_rx_qcreate(
return (rc); return (rc);
} }
__checkReturn efx_rc_t
efx_rx_qcreate(
__in efx_nic_t *enp,
__in unsigned int index,
__in unsigned int label,
__in efx_rxq_type_t type,
__in efsys_mem_t *esmp,
__in size_t ndescs,
__in uint32_t id,
__in unsigned int flags,
__in efx_evq_t *eep,
__deref_out efx_rxq_t **erpp)
{
return efx_rx_qcreate_internal(enp, index, label, type, 0, esmp, ndescs,
id, flags, eep, erpp);
}
#if EFSYS_OPT_RX_PACKED_STREAM
__checkReturn efx_rc_t
efx_rx_qcreate_packed_stream(
__in efx_nic_t *enp,
__in unsigned int index,
__in unsigned int label,
__in uint32_t ps_buf_size,
__in efsys_mem_t *esmp,
__in size_t ndescs,
__in efx_evq_t *eep,
__deref_out efx_rxq_t **erpp)
{
return efx_rx_qcreate_internal(enp, index, label,
EFX_RXQ_TYPE_PACKED_STREAM, ps_buf_size, esmp, ndescs,
0 /* id unused on EF10 */, EFX_RXQ_FLAG_NONE, eep, erpp);
}
#endif
void void
efx_rx_qdestroy( efx_rx_qdestroy(
__in efx_rxq_t *erp) __in efx_rxq_t *erp)
@ -1305,6 +1344,7 @@ siena_rx_qcreate(
__in unsigned int index, __in unsigned int index,
__in unsigned int label, __in unsigned int label,
__in efx_rxq_type_t type, __in efx_rxq_type_t type,
__in uint32_t type_data,
__in efsys_mem_t *esmp, __in efsys_mem_t *esmp,
__in size_t ndescs, __in size_t ndescs,
__in uint32_t id, __in uint32_t id,
@ -1319,6 +1359,7 @@ siena_rx_qcreate(
efx_rc_t rc; efx_rc_t rc;
_NOTE(ARGUNUSED(esmp)) _NOTE(ARGUNUSED(esmp))
_NOTE(ARGUNUSED(type_data))
EFX_STATIC_ASSERT(EFX_EV_RX_NLABELS == EFX_STATIC_ASSERT(EFX_EV_RX_NLABELS ==
(1 << FRF_AZ_RX_DESCQ_LABEL_WIDTH)); (1 << FRF_AZ_RX_DESCQ_LABEL_WIDTH));