net/i40e: move RSS to flow API
[dpdk.git] / drivers / net / sfc / base / ef10_nic.c
index 7af8935..eb9ec2b 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"
@@ -490,59 +466,6 @@ fail1:
        return (rc);
 }
 
-static __checkReturn   efx_rc_t
-efx_mcdi_get_capabilities(
-       __in            efx_nic_t *enp,
-       __out           uint32_t *flagsp,
-       __out           uint32_t *flags2p,
-       __out           uint32_t *tso2ncp)
-{
-       efx_mcdi_req_t req;
-       uint8_t payload[MAX(MC_CMD_GET_CAPABILITIES_IN_LEN,
-                           MC_CMD_GET_CAPABILITIES_V2_OUT_LEN)];
-       efx_rc_t rc;
-
-       (void) memset(payload, 0, sizeof (payload));
-       req.emr_cmd = MC_CMD_GET_CAPABILITIES;
-       req.emr_in_buf = payload;
-       req.emr_in_length = MC_CMD_GET_CAPABILITIES_IN_LEN;
-       req.emr_out_buf = payload;
-       req.emr_out_length = MC_CMD_GET_CAPABILITIES_V2_OUT_LEN;
-
-       efx_mcdi_execute(enp, &req);
-
-       if (req.emr_rc != 0) {
-               rc = req.emr_rc;
-               goto fail1;
-       }
-
-       if (req.emr_out_length_used < MC_CMD_GET_CAPABILITIES_OUT_LEN) {
-               rc = EMSGSIZE;
-               goto fail2;
-       }
-
-       *flagsp = MCDI_OUT_DWORD(req, GET_CAPABILITIES_OUT_FLAGS1);
-
-       if (req.emr_out_length_used < MC_CMD_GET_CAPABILITIES_V2_OUT_LEN) {
-               *flags2p = 0;
-               *tso2ncp = 0;
-       } else {
-               *flags2p = MCDI_OUT_DWORD(req, GET_CAPABILITIES_V2_OUT_FLAGS2);
-               *tso2ncp = MCDI_OUT_WORD(req,
-                               GET_CAPABILITIES_V2_OUT_TX_TSO_V2_N_CONTEXTS);
-       }
-
-       return (0);
-
-fail2:
-       EFSYS_PROBE(fail2);
-fail1:
-       EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
-       return (rc);
-}
-
-
 static __checkReturn   efx_rc_t
 efx_mcdi_alloc_vis(
        __in            efx_nic_t *enp,
@@ -554,7 +477,7 @@ efx_mcdi_alloc_vis(
 {
        efx_mcdi_req_t req;
        uint8_t payload[MAX(MC_CMD_ALLOC_VIS_IN_LEN,
-                           MC_CMD_ALLOC_VIS_OUT_LEN)];
+                           MC_CMD_ALLOC_VIS_EXT_OUT_LEN)];
        efx_rc_t rc;
 
        if (vi_countp == NULL) {
@@ -567,7 +490,7 @@ efx_mcdi_alloc_vis(
        req.emr_in_buf = payload;
        req.emr_in_length = MC_CMD_ALLOC_VIS_IN_LEN;
        req.emr_out_buf = payload;
-       req.emr_out_length = MC_CMD_ALLOC_VIS_OUT_LEN;
+       req.emr_out_length = MC_CMD_ALLOC_VIS_EXT_OUT_LEN;
 
        MCDI_IN_SET_DWORD(req, ALLOC_VIS_IN_MIN_VI_COUNT, min_vi_count);
        MCDI_IN_SET_DWORD(req, ALLOC_VIS_IN_MAX_VI_COUNT, max_vi_count);
@@ -1012,8 +935,8 @@ ef10_get_datapath_caps(
        uint32_t tso2nc;
        efx_rc_t rc;
 
-       if ((rc = efx_mcdi_get_capabilities(enp, &flags, &flags2,
-                                           &tso2nc)) != 0)
+       if ((rc = efx_mcdi_get_capabilities(enp, &flags, NULL, NULL,
+                                           &flags2, &tso2nc)) != 0)
                goto fail1;
 
        if ((rc = ef10_mcdi_get_pf_count(enp, &encp->enc_hw_pf_count)) != 0)
@@ -1107,7 +1030,7 @@ ef10_get_datapath_caps(
         * and version 2 of MC_CMD_NVRAM_UPDATE_FINISH (to verify the updated
         * partition and report the result).
         */
-       encp->enc_fw_verified_nvram_update_required =
+       encp->enc_nvram_update_verify_result_supported =
            CAP_FLAG2(flags2, NVRAM_UPDATE_REPORT_VERIFY_RESULT) ?
            B_TRUE : B_FALSE;
 
@@ -1125,6 +1048,24 @@ ef10_get_datapath_caps(
        encp->enc_mac_stats_40g_tx_size_bins =
            CAP_FLAG2(flags2, MAC_STATS_40G_TX_SIZE_BINS) ? B_TRUE : B_FALSE;
 
+       /*
+        * Check if firmware supports VXLAN and NVGRE tunnels.
+        * The capability indicates Geneve protocol support as well.
+        */
+       if (CAP_FLAG(flags, VXLAN_NVGRE)) {
+               encp->enc_tunnel_encapsulations_supported =
+                   (1u << EFX_TUNNEL_PROTOCOL_VXLAN) |
+                   (1u << EFX_TUNNEL_PROTOCOL_GENEVE) |
+                   (1u << EFX_TUNNEL_PROTOCOL_NVGRE);
+
+               EFX_STATIC_ASSERT(EFX_TUNNEL_MAXNENTRIES ==
+                   MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_IN_ENTRIES_MAXNUM);
+               encp->enc_tunnel_config_udp_entries_max =
+                   EFX_TUNNEL_MAXNENTRIES;
+       } else {
+               encp->enc_tunnel_config_udp_entries_max = 0;
+       }
+
 #undef CAP_FLAG
 #undef CAP_FLAG2
 
@@ -1202,7 +1143,7 @@ fail1:
  * For the Huntington family, the current port mode cannot be discovered,
  * so the mapping used is instead the last match in the table to the full
  * set of port modes to which the NIC can be configured. Therefore the
- * ordering of entries in the the mapping table is significant.
+ * ordering of entries in the mapping table is significant.
  */
 static struct {
        efx_family_t    family;