net/sfc/base: control RxQ scatter using flag instead of type
authorAndrew Rybchenko <arybchenko@solarflare.com>
Sun, 24 Dec 2017 10:46:35 +0000 (10:46 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 16 Jan 2018 17:47:49 +0000 (18:47 +0100)
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>
drivers/net/sfc/base/ef10_impl.h
drivers/net/sfc/base/ef10_rx.c
drivers/net/sfc/base/efx.h
drivers/net/sfc/base/efx_impl.h
drivers/net/sfc/base/efx_rx.c
drivers/net/sfc/sfc_ethdev.c
drivers/net/sfc/sfc_rx.c
drivers/net/sfc/sfc_rx.h

index a9b2862..0eeb68f 100644 (file)
@@ -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);
 
index 9b0e1ee..9aa8981 100644 (file)
@@ -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;
index 93accd7..e0dc76c 100644 (file)
@@ -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);
 
index c29ba0e..8bd667c 100644 (file)
@@ -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;
index f922b59..870d42f 100644 (file)
@@ -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:
index fabcc32..0ac9362 100644 (file)
@@ -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);
index 7816393..22bf372 100644 (file)
@@ -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);
index 9e6282e..ff72718 100644 (file)
@@ -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;