Rx scatter may be applicable to different Rx queue types.
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@solarflare.com>
Reviewed-by: Mark Spender <mspender@solarflare.com>
__in efsys_mem_t *esmp,
__in size_t ndescs,
__in uint32_t id,
+ __in unsigned int flags,
__in efx_evq_t *eep,
__in efx_rxq_t *erp);
__in efsys_mem_t *esmp,
__in size_t ndescs,
__in uint32_t id,
+ __in unsigned int flags,
__in efx_evq_t *eep,
__in efx_rxq_t *erp)
{
switch (type) {
case EFX_RXQ_TYPE_DEFAULT:
- case EFX_RXQ_TYPE_SCATTER:
ps_buf_size = 0;
break;
#if EFSYS_OPT_RX_PACKED_STREAM
#endif /* EFSYS_OPT_RX_PACKED_STREAM */
/* Scatter can only be disabled if the firmware supports doing so */
- if (type == EFX_RXQ_TYPE_SCATTER)
+ if (flags & EFX_RXQ_FLAG_SCATTER)
disable_scatter = B_FALSE;
else
disable_scatter = encp->enc_rx_disable_scatter_supported;
typedef enum efx_rxq_type_e {
EFX_RXQ_TYPE_DEFAULT,
- EFX_RXQ_TYPE_SCATTER,
EFX_RXQ_TYPE_PACKED_STREAM_1M,
EFX_RXQ_TYPE_PACKED_STREAM_512K,
EFX_RXQ_TYPE_PACKED_STREAM_256K,
EFX_RXQ_NTYPES
} efx_rxq_type_t;
+/*
+ * Dummy flag to be used instead of 0 to make it clear that the argument
+ * is receive queue flags.
+ */
+#define EFX_RXQ_FLAG_NONE 0x0
+#define EFX_RXQ_FLAG_SCATTER 0x1
+
extern __checkReturn efx_rc_t
efx_rx_qcreate(
__in efx_nic_t *enp,
__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);
efx_rc_t (*erxo_qcreate)(efx_nic_t *enp, unsigned int,
unsigned int, efx_rxq_type_t,
efsys_mem_t *, size_t, uint32_t,
+ unsigned int,
efx_evq_t *, efx_rxq_t *);
void (*erxo_qdestroy)(efx_rxq_t *);
} efx_rx_ops_t;
__in efsys_mem_t *esmp,
__in size_t ndescs,
__in uint32_t id,
+ __in unsigned int flags,
__in efx_evq_t *eep,
__in efx_rxq_t *erp);
__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)
{
erp->er_esmp = esmp;
if ((rc = erxop->erxo_qcreate(enp, index, label, type, esmp, ndescs, id,
- eep, erp)) != 0)
+ flags, eep, erp)) != 0)
goto fail2;
enp->en_rx_qcount++;
__in efsys_mem_t *esmp,
__in size_t ndescs,
__in uint32_t id,
+ __in unsigned int flags,
__in efx_evq_t *eep,
__in efx_rxq_t *erp)
{
efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
efx_oword_t oword;
uint32_t size;
- boolean_t jumbo;
+ boolean_t jumbo = B_FALSE;
efx_rc_t rc;
_NOTE(ARGUNUSED(esmp))
switch (type) {
case EFX_RXQ_TYPE_DEFAULT:
- jumbo = B_FALSE;
break;
-#if EFSYS_OPT_RX_SCATTER
- case EFX_RXQ_TYPE_SCATTER:
- jumbo = B_TRUE;
- break;
-#endif /* EFSYS_OPT_RX_SCATTER */
-
default:
rc = EINVAL;
goto fail4;
}
+ if (flags & EFX_RXQ_FLAG_SCATTER) {
+#if EFSYS_OPT_RX_SCATTER
+ jumbo = B_TRUE;
+#else
+ rc = EINVAL;
+ goto fail5;
+#endif /* EFSYS_OPT_RX_SCATTER */
+ }
+
/* Set up the new descriptor queue */
EFX_POPULATE_OWORD_7(oword,
FRF_AZ_RX_DESCQ_BUF_BASE_ID, id,
return (0);
+#if !EFSYS_OPT_RX_SCATTER
+fail5:
+ EFSYS_PROBE(fail5);
+#endif
fail4:
EFSYS_PROBE(fail4);
fail3:
qinfo->conf.rx_free_thresh = rxq->refill_threshold;
qinfo->conf.rx_drop_en = 1;
qinfo->conf.rx_deferred_start = rxq_info->deferred_start;
- qinfo->scattered_rx = (rxq_info->type == EFX_RXQ_TYPE_SCATTER);
+ qinfo->scattered_rx =
+ ((rxq_info->type_flags & EFX_RXQ_FLAG_SCATTER) != 0);
qinfo->nb_desc = rxq_info->entries;
sfc_adapter_unlock(sa);
rc = efx_rx_qcreate(sa->nic, rxq->hw_index, 0, rxq_info->type,
&rxq->mem, rxq_info->entries,
- 0 /* not used on EF10 */, evq->common,
- &rxq->common);
+ 0 /* not used on EF10 */, rxq_info->type_flags,
+ evq->common, &rxq->common);
if (rc != 0)
goto fail_rx_qcreate;
SFC_ASSERT(nb_rx_desc <= rxq_info->max_entries);
rxq_info->entries = nb_rx_desc;
- rxq_info->type =
+ rxq_info->type = EFX_RXQ_TYPE_DEFAULT;
+ rxq_info->type_flags =
sa->eth_dev->data->dev_conf.rxmode.enable_scatter ?
- EFX_RXQ_TYPE_SCATTER : EFX_RXQ_TYPE_DEFAULT;
+ EFX_RXQ_FLAG_SCATTER : EFX_RXQ_FLAG_NONE;
rc = sfc_ev_qinit(sa, SFC_EVQ_TYPE_RX, sw_index,
rxq_info->entries, socket_id, &evq);
unsigned int max_entries;
unsigned int entries;
efx_rxq_type_t type;
+ unsigned int type_flags;
struct sfc_rxq *rxq;
boolean_t deferred_start;
boolean_t deferred_started;