net/sfc/base: make RxQ type data an union
authorAndrew Rybchenko <arybchenko@solarflare.com>
Thu, 19 Apr 2018 11:36:45 +0000 (12:36 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 27 Apr 2018 17:00:58 +0000 (18:00 +0100)
The type is an internal interface. Single integer is insufficient
to carry RxQ type-specific information in the case of equal stride
super-buffer Rx mode (packet buffers per bucket, maximum DMA length,
packet stride, head of line block timeout).

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
drivers/net/sfc/base/ef10_impl.h
drivers/net/sfc/base/ef10_rx.c
drivers/net/sfc/base/efx_impl.h
drivers/net/sfc/base/efx_rx.c

index b4ad595..36229a7 100644 (file)
@@ -967,13 +967,15 @@ extern            void
 ef10_rx_qenable(
        __in            efx_rxq_t *erp);
 
+union efx_rxq_type_data_u;
+
 extern __checkReturn   efx_rc_t
 ef10_rx_qcreate(
        __in            efx_nic_t *enp,
        __in            unsigned int index,
        __in            unsigned int label,
        __in            efx_rxq_type_t type,
-       __in            uint32_t type_data,
+       __in            const union efx_rxq_type_data_u *type_data,
        __in            efsys_mem_t *esmp,
        __in            size_t ndescs,
        __in            uint32_t id,
index cd35c2a..0ed5ffd 100644 (file)
@@ -1000,7 +1000,7 @@ ef10_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,
@@ -1039,7 +1039,7 @@ ef10_rx_qcreate(
                break;
 #if EFSYS_OPT_RX_PACKED_STREAM
        case EFX_RXQ_TYPE_PACKED_STREAM:
-               switch (type_data) {
+               switch (type_data->ertd_packed_stream.eps_buf_size) {
                case EFX_RXQ_PACKED_STREAM_BUF_SIZE_1M:
                        ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_1M;
                        break;
index b1d4f57..f130713 100644 (file)
@@ -129,6 +129,16 @@ typedef struct efx_tx_ops_s {
 #endif
 } efx_tx_ops_t;
 
+typedef union efx_rxq_type_data_u {
+       /* Dummy member to have non-empty union if no options are enabled */
+       uint32_t        ertd_dummy;
+#if EFSYS_OPT_RX_PACKED_STREAM
+       struct {
+               uint32_t        eps_buf_size;
+       } ertd_packed_stream;
+#endif
+} efx_rxq_type_data_t;
+
 typedef struct efx_rx_ops_s {
        efx_rc_t        (*erxo_init)(efx_nic_t *);
        void            (*erxo_fini)(efx_nic_t *);
@@ -165,7 +175,8 @@ typedef struct efx_rx_ops_s {
        efx_rc_t        (*erxo_qflush)(efx_rxq_t *);
        void            (*erxo_qenable)(efx_rxq_t *);
        efx_rc_t        (*erxo_qcreate)(efx_nic_t *enp, unsigned int,
-                                       unsigned int, efx_rxq_type_t, uint32_t,
+                                       unsigned int, efx_rxq_type_t,
+                                       const efx_rxq_type_data_t *,
                                        efsys_mem_t *, size_t, uint32_t,
                                        unsigned int,
                                        efx_evq_t *, efx_rxq_t *);
index dd09946..aab5795 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,
@@ -751,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,
@@ -812,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
@@ -829,8 +829,14 @@ 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);
 }
 
@@ -1481,7 +1487,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,