net/sfc/base: add equal stride super-buffer prefix layout
[dpdk.git] / drivers / net / sfc / base / efx_rx.c
index a9995b4..4fd73ba 100644 (file)
@@ -107,7 +107,7 @@ siena_rx_qcreate(
        __in            unsigned int index,
        __in            unsigned int label,
        __in            efx_rxq_type_t type,
-       __in            uint32_t type_data,
+       __in            const efx_rxq_type_data_t *type_data,
        __in            efsys_mem_t *esmp,
        __in            size_t ndescs,
        __in            uint32_t id,
@@ -301,6 +301,9 @@ efx_rx_scale_hash_flags_get(
        __inout_ecount(EFX_RX_HASH_NFLAGS)      unsigned int *flags,
        __out                                   unsigned int *nflagsp)
 {
+       efx_nic_cfg_t *encp = &enp->en_nic_cfg;
+       boolean_t l4;
+       boolean_t additional_modes;
        unsigned int *entryp = flags;
        efx_rc_t rc;
 
@@ -309,23 +312,53 @@ efx_rx_scale_hash_flags_get(
                goto fail1;
        }
 
-#define        LIST_FLAGS(_entryp, _class, _l4_hashing)                        \
+       l4 = encp->enc_rx_scale_l4_hash_supported;
+       additional_modes = encp->enc_rx_scale_additional_modes_supported;
+
+#define        LIST_FLAGS(_entryp, _class, _l4_hashing, _additional_modes)     \
        do {                                                            \
-               if (_l4_hashing)                                        \
+               if (_l4_hashing) {                                      \
                        *(_entryp++) = EFX_RX_HASH(_class, 4TUPLE);     \
                                                                        \
+                       if (_additional_modes) {                        \
+                               *(_entryp++) =                          \
+                                   EFX_RX_HASH(_class, 2TUPLE_DST);    \
+                               *(_entryp++) =                          \
+                                   EFX_RX_HASH(_class, 2TUPLE_SRC);    \
+                       }                                               \
+               }                                                       \
+                                                                       \
                *(_entryp++) = EFX_RX_HASH(_class, 2TUPLE);             \
+                                                                       \
+               if (_additional_modes) {                                \
+                       *(_entryp++) = EFX_RX_HASH(_class, 1TUPLE_DST); \
+                       *(_entryp++) = EFX_RX_HASH(_class, 1TUPLE_SRC); \
+               }                                                       \
+                                                                       \
                *(_entryp++) = EFX_RX_HASH(_class, DISABLE);            \
                                                                        \
                _NOTE(CONSTANTCONDITION)                                \
        } while (B_FALSE)
 
        switch (hash_alg) {
+       case EFX_RX_HASHALG_PACKED_STREAM:
+               if ((encp->enc_rx_scale_hash_alg_mask & (1U << hash_alg)) == 0)
+                       break;
+               /* FALLTHRU */
        case EFX_RX_HASHALG_TOEPLITZ:
-               LIST_FLAGS(entryp, IPV4_TCP, B_TRUE);
-               LIST_FLAGS(entryp, IPV6_TCP, B_TRUE);
-               LIST_FLAGS(entryp, IPV4, B_FALSE);
-               LIST_FLAGS(entryp, IPV6, B_FALSE);
+               if ((encp->enc_rx_scale_hash_alg_mask & (1U << hash_alg)) == 0)
+                       break;
+
+               LIST_FLAGS(entryp, IPV4_TCP, l4, additional_modes);
+               LIST_FLAGS(entryp, IPV6_TCP, l4, additional_modes);
+
+               if (additional_modes) {
+                       LIST_FLAGS(entryp, IPV4_UDP, l4, additional_modes);
+                       LIST_FLAGS(entryp, IPV6_UDP, l4, additional_modes);
+               }
+
+               LIST_FLAGS(entryp, IPV4, B_FALSE, additional_modes);
+               LIST_FLAGS(entryp, IPV6, B_FALSE, additional_modes);
                break;
 
        default:
@@ -507,6 +540,7 @@ efx_rx_scale_mode_set(
        if (type & EFX_RX_HASH_IPV4) {
                type |= EFX_RX_HASH(IPV4, 2TUPLE);
                type |= EFX_RX_HASH(IPV4_TCP, 2TUPLE);
+               type |= EFX_RX_HASH(IPV4_UDP, 2TUPLE);
        }
 
        if (type & EFX_RX_HASH_TCPIPV4)
@@ -515,6 +549,7 @@ efx_rx_scale_mode_set(
        if (type & EFX_RX_HASH_IPV6) {
                type |= EFX_RX_HASH(IPV6, 2TUPLE);
                type |= EFX_RX_HASH(IPV6_TCP, 2TUPLE);
+               type |= EFX_RX_HASH(IPV6_UDP, 2TUPLE);
        }
 
        if (type & EFX_RX_HASH_TCPIPV6)
@@ -716,7 +751,7 @@ efx_rx_qcreate_internal(
        __in            unsigned int index,
        __in            unsigned int label,
        __in            efx_rxq_type_t type,
-       __in            uint32_t type_data,
+       __in            const efx_rxq_type_data_t *type_data,
        __in            efsys_mem_t *esmp,
        __in            size_t ndescs,
        __in            uint32_t id,
@@ -777,8 +812,8 @@ efx_rx_qcreate(
        __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);
+       return efx_rx_qcreate_internal(enp, index, label, type, NULL,
+           esmp, ndescs, id, flags, eep, erpp);
 }
 
 #if EFSYS_OPT_RX_PACKED_STREAM
@@ -794,13 +829,71 @@ efx_rx_qcreate_packed_stream(
        __in            efx_evq_t *eep,
        __deref_out     efx_rxq_t **erpp)
 {
+       efx_rxq_type_data_t type_data;
+
+       memset(&type_data, 0, sizeof(type_data));
+
+       type_data.ertd_packed_stream.eps_buf_size = ps_buf_size;
+
        return efx_rx_qcreate_internal(enp, index, label,
-           EFX_RXQ_TYPE_PACKED_STREAM, ps_buf_size, esmp, ndescs,
+           EFX_RXQ_TYPE_PACKED_STREAM, &type_data, esmp, ndescs,
            0 /* id unused on EF10 */, EFX_RXQ_FLAG_NONE, eep, erpp);
 }
 
 #endif
 
+#if EFSYS_OPT_RX_ES_SUPER_BUFFER
+
+       __checkReturn   efx_rc_t
+efx_rx_qcreate_es_super_buffer(
+       __in            efx_nic_t *enp,
+       __in            unsigned int index,
+       __in            unsigned int label,
+       __in            uint32_t n_bufs_per_desc,
+       __in            uint32_t max_dma_len,
+       __in            uint32_t buf_stride,
+       __in            uint32_t hol_block_timeout,
+       __in            efsys_mem_t *esmp,
+       __in            size_t ndescs,
+       __in            unsigned int flags,
+       __in            efx_evq_t *eep,
+       __deref_out     efx_rxq_t **erpp)
+{
+       efx_rc_t rc;
+       efx_rxq_type_data_t type_data;
+
+       if (hol_block_timeout > EFX_RXQ_ES_SUPER_BUFFER_HOL_BLOCK_MAX) {
+               rc = EINVAL;
+               goto fail1;
+       }
+
+       memset(&type_data, 0, sizeof(type_data));
+
+       type_data.ertd_es_super_buffer.eessb_bufs_per_desc = n_bufs_per_desc;
+       type_data.ertd_es_super_buffer.eessb_max_dma_len = max_dma_len;
+       type_data.ertd_es_super_buffer.eessb_buf_stride = buf_stride;
+       type_data.ertd_es_super_buffer.eessb_hol_block_timeout =
+           hol_block_timeout;
+
+       rc = efx_rx_qcreate_internal(enp, index, label,
+           EFX_RXQ_TYPE_ES_SUPER_BUFFER, &type_data, esmp, ndescs,
+           0 /* id unused on EF10 */, flags, eep, erpp);
+       if (rc != 0)
+               goto fail2;
+
+       return (0);
+
+fail2:
+       EFSYS_PROBE(fail2);
+fail1:
+       EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+       return (rc);
+}
+
+#endif
+
+
                        void
 efx_rx_qdestroy(
        __in            efx_rxq_t *erp)
@@ -1446,7 +1539,7 @@ siena_rx_qcreate(
        __in            unsigned int index,
        __in            unsigned int label,
        __in            efx_rxq_type_t type,
-       __in            uint32_t type_data,
+       __in            const efx_rxq_type_data_t *type_data,
        __in            efsys_mem_t *esmp,
        __in            size_t ndescs,
        __in            uint32_t id,