From: Andrew Rybchenko Date: Sun, 24 Dec 2017 10:46:35 +0000 (+0000) Subject: net/sfc/base: control RxQ scatter using flag instead of type X-Git-Tag: spdx-start~485 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=d882d61794134e67222f16e1152ff4603976940e;p=dpdk.git net/sfc/base: control RxQ scatter using flag instead of type Rx scatter may be applicable to different Rx queue types. Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton Reviewed-by: Mark Spender --- diff --git a/drivers/net/sfc/base/ef10_impl.h b/drivers/net/sfc/base/ef10_impl.h index a9b286209a..0eeb68f6d6 100644 --- a/drivers/net/sfc/base/ef10_impl.h +++ b/drivers/net/sfc/base/ef10_impl.h @@ -980,6 +980,7 @@ ef10_rx_qcreate( __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); diff --git a/drivers/net/sfc/base/ef10_rx.c b/drivers/net/sfc/base/ef10_rx.c index 9b0e1ee578..9aa89812ff 100644 --- a/drivers/net/sfc/base/ef10_rx.c +++ b/drivers/net/sfc/base/ef10_rx.c @@ -951,6 +951,7 @@ ef10_rx_qcreate( __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) { @@ -980,7 +981,6 @@ ef10_rx_qcreate( switch (type) { case EFX_RXQ_TYPE_DEFAULT: - case EFX_RXQ_TYPE_SCATTER: ps_buf_size = 0; break; #if EFSYS_OPT_RX_PACKED_STREAM @@ -1024,7 +1024,7 @@ ef10_rx_qcreate( #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; diff --git a/drivers/net/sfc/base/efx.h b/drivers/net/sfc/base/efx.h index 93accd752b..e0dc76c085 100644 --- a/drivers/net/sfc/base/efx.h +++ b/drivers/net/sfc/base/efx.h @@ -2002,7 +2002,6 @@ efx_pseudo_hdr_pkt_length_get( 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, @@ -2011,6 +2010,13 @@ typedef enum efx_rxq_type_e { 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, @@ -2020,6 +2026,7 @@ efx_rx_qcreate( __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); diff --git a/drivers/net/sfc/base/efx_impl.h b/drivers/net/sfc/base/efx_impl.h index c29ba0e8d5..8bd667caa9 100644 --- a/drivers/net/sfc/base/efx_impl.h +++ b/drivers/net/sfc/base/efx_impl.h @@ -183,6 +183,7 @@ typedef struct efx_rx_ops_s { 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; diff --git a/drivers/net/sfc/base/efx_rx.c b/drivers/net/sfc/base/efx_rx.c index f922b5937b..870d42f8e6 100644 --- a/drivers/net/sfc/base/efx_rx.c +++ b/drivers/net/sfc/base/efx_rx.c @@ -134,6 +134,7 @@ siena_rx_qcreate( __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); @@ -619,6 +620,7 @@ efx_rx_qcreate( __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) { @@ -644,7 +646,7 @@ efx_rx_qcreate( 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++; @@ -1306,13 +1308,14 @@ siena_rx_qcreate( __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)) @@ -1345,20 +1348,22 @@ siena_rx_qcreate( 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, @@ -1374,6 +1379,10 @@ siena_rx_qcreate( return (0); +#if !EFSYS_OPT_RX_SCATTER +fail5: + EFSYS_PROBE(fail5); +#endif fail4: EFSYS_PROBE(fail4); fail3: diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index fabcc3293e..0ac9362528 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -1058,7 +1058,8 @@ sfc_rx_queue_info_get(struct rte_eth_dev *dev, uint16_t rx_queue_id, 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); diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c index 7816393b75..22bf3727c8 100644 --- a/drivers/net/sfc/sfc_rx.c +++ b/drivers/net/sfc/sfc_rx.c @@ -697,8 +697,8 @@ sfc_rx_qstart(struct sfc_adapter *sa, unsigned int sw_index) 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; @@ -942,9 +942,10 @@ sfc_rx_qinit(struct sfc_adapter *sa, unsigned int sw_index, 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); diff --git a/drivers/net/sfc/sfc_rx.h b/drivers/net/sfc/sfc_rx.h index 9e6282eadd..ff72718586 100644 --- a/drivers/net/sfc/sfc_rx.h +++ b/drivers/net/sfc/sfc_rx.h @@ -144,6 +144,7 @@ struct sfc_rxq_info { 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;