net/i40e: move RSS to flow API
[dpdk.git] / drivers / net / sfc / base / ef10_rx.c
index 9b0e1ee..85110ef 100644 (file)
@@ -1,31 +1,7 @@
-/*
- * Copyright (c) 2012-2016 Solarflare Communications Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
+/* SPDX-License-Identifier: BSD-3-Clause
  *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are
- * those of the authors and should not be interpreted as representing official
- * policies, either expressed or implied, of the FreeBSD Project.
+ * Copyright (c) 2012-2018 Solarflare Communications Inc.
+ * All rights reserved.
  */
 
 #include "efx.h"
@@ -44,6 +20,7 @@ efx_mcdi_init_rxq(
        __in            uint32_t instance,
        __in            efsys_mem_t *esmp,
        __in            boolean_t disable_scatter,
+       __in            boolean_t want_inner_classes,
        __in            uint32_t ps_bufsize)
 {
        efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
@@ -65,7 +42,8 @@ efx_mcdi_init_rxq(
        else
                dma_mode = MC_CMD_INIT_RXQ_EXT_IN_SINGLE_PACKET;
 
-       if (encp->enc_tunnel_encapsulations_supported != 0) {
+       if (encp->enc_tunnel_encapsulations_supported != 0 &&
+           !want_inner_classes) {
                /*
                 * WANT_OUTER_CLASSES can only be specified on hardware which
                 * supports tunnel encapsulation offloads, even though it is
@@ -948,15 +926,18 @@ ef10_rx_qcreate(
        __in            unsigned int index,
        __in            unsigned int label,
        __in            efx_rxq_type_t type,
+       __in            uint32_t type_data,
        __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_rc_t rc;
        boolean_t disable_scatter;
+       boolean_t want_inner_classes;
        unsigned int ps_buf_size;
 
        _NOTE(ARGUNUSED(id, erp))
@@ -980,29 +961,35 @@ 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
-       case EFX_RXQ_TYPE_PACKED_STREAM_1M:
-               ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_1M;
-               break;
-       case EFX_RXQ_TYPE_PACKED_STREAM_512K:
-               ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_512K;
-               break;
-       case EFX_RXQ_TYPE_PACKED_STREAM_256K:
-               ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_256K;
-               break;
-       case EFX_RXQ_TYPE_PACKED_STREAM_128K:
-               ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_128K;
-               break;
-       case EFX_RXQ_TYPE_PACKED_STREAM_64K:
-               ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_64K;
+       case EFX_RXQ_TYPE_PACKED_STREAM:
+               switch (type_data) {
+               case EFX_RXQ_PACKED_STREAM_BUF_SIZE_1M:
+                       ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_1M;
+                       break;
+               case EFX_RXQ_PACKED_STREAM_BUF_SIZE_512K:
+                       ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_512K;
+                       break;
+               case EFX_RXQ_PACKED_STREAM_BUF_SIZE_256K:
+                       ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_256K;
+                       break;
+               case EFX_RXQ_PACKED_STREAM_BUF_SIZE_128K:
+                       ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_128K;
+                       break;
+               case EFX_RXQ_PACKED_STREAM_BUF_SIZE_64K:
+                       ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_64K;
+                       break;
+               default:
+                       rc = ENOTSUP;
+                       goto fail3;
+               }
                break;
 #endif /* EFSYS_OPT_RX_PACKED_STREAM */
        default:
                rc = ENOTSUP;
-               goto fail3;
+               goto fail4;
        }
 
 #if EFSYS_OPT_RX_PACKED_STREAM
@@ -1010,13 +997,13 @@ ef10_rx_qcreate(
                /* Check if datapath firmware supports packed stream mode */
                if (encp->enc_rx_packed_stream_supported == B_FALSE) {
                        rc = ENOTSUP;
-                       goto fail4;
+                       goto fail5;
                }
                /* Check if packed stream allows configurable buffer sizes */
-               if ((type != EFX_RXQ_TYPE_PACKED_STREAM_1M) &&
+               if ((ps_buf_size != MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_1M) &&
                    (encp->enc_rx_var_packed_stream_supported == B_FALSE)) {
                        rc = ENOTSUP;
-                       goto fail5;
+                       goto fail6;
                }
        }
 #else /* EFSYS_OPT_RX_PACKED_STREAM */
@@ -1024,14 +1011,20 @@ 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;
 
+       if (flags & EFX_RXQ_FLAG_INNER_CLASSES)
+               want_inner_classes = B_TRUE;
+       else
+               want_inner_classes = B_FALSE;
+
        if ((rc = efx_mcdi_init_rxq(enp, ndescs, eep->ee_index, label, index,
-                   esmp, disable_scatter, ps_buf_size)) != 0)
-               goto fail6;
+                   esmp, disable_scatter, want_inner_classes,
+                   ps_buf_size)) != 0)
+               goto fail7;
 
        erp->er_eep = eep;
        erp->er_label = label;
@@ -1042,16 +1035,20 @@ ef10_rx_qcreate(
 
        return (0);
 
+fail7:
+       EFSYS_PROBE(fail7);
+#if EFSYS_OPT_RX_PACKED_STREAM
 fail6:
        EFSYS_PROBE(fail6);
-#if EFSYS_OPT_RX_PACKED_STREAM
 fail5:
        EFSYS_PROBE(fail5);
+#endif /* EFSYS_OPT_RX_PACKED_STREAM */
 fail4:
        EFSYS_PROBE(fail4);
-#endif /* EFSYS_OPT_RX_PACKED_STREAM */
+#if EFSYS_OPT_RX_PACKED_STREAM
 fail3:
        EFSYS_PROBE(fail3);
+#endif /* EFSYS_OPT_RX_PACKED_STREAM */
 fail2:
        EFSYS_PROBE(fail2);
 fail1: