doc: update octeontx2 supported SoCs
[dpdk.git] / drivers / net / sfc / base / efx_tunnel.c
index 8a8ac32..edb6be0 100644 (file)
@@ -1,31 +1,7 @@
-/*
- * Copyright (c) 2017 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:
- *
- * 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.
+/* SPDX-License-Identifier: BSD-3-Clause
  *
- * 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) 2007-2018 Solarflare Communications Inc.
+ * All rights reserved.
  */
 
 #include "efx.h"
@@ -41,20 +17,20 @@ static const efx_tunnel_ops_t       __efx_tunnel_dummy_ops = {
 };
 #endif /* EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON */
 
-#if EFSYS_OPT_MEDFORD
+#if EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2
 static __checkReturn   boolean_t
-medford_udp_encap_supported(
+ef10_udp_encap_supported(
        __in            efx_nic_t *enp);
 
 static __checkReturn   efx_rc_t
-medford_tunnel_reconfigure(
+ef10_tunnel_reconfigure(
        __in            efx_nic_t *enp);
 
-static const efx_tunnel_ops_t  __efx_tunnel_medford_ops = {
-       medford_udp_encap_supported,    /* eto_udp_encap_supported */
-       medford_tunnel_reconfigure,     /* eto_reconfigure */
+static const efx_tunnel_ops_t  __efx_tunnel_ef10_ops = {
+       ef10_udp_encap_supported,       /* eto_udp_encap_supported */
+       ef10_tunnel_reconfigure,        /* eto_reconfigure */
 };
-#endif /* EFSYS_OPT_MEDFORD */
+#endif /* EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */
 
 static __checkReturn           efx_rc_t
 efx_mcdi_set_tunnel_encap_udp_ports(
@@ -64,8 +40,9 @@ efx_mcdi_set_tunnel_encap_udp_ports(
        __out                   boolean_t *resetting)
 {
        efx_mcdi_req_t req;
-       uint8_t payload[MAX(MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_IN_LENMAX,
-                           MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_OUT_LEN)];
+       EFX_MCDI_DECLARE_BUF(payload,
+               MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_IN_LENMAX,
+               MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_OUT_LEN);
        efx_word_t flags;
        efx_rc_t rc;
        unsigned int i;
@@ -76,7 +53,6 @@ efx_mcdi_set_tunnel_encap_udp_ports(
        else
                entries_num = etcp->etc_udp_entries_num;
 
-       (void) memset(payload, 0, sizeof (payload));
        req.emr_cmd = MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS;
        req.emr_in_buf = payload;
        req.emr_in_length =
@@ -185,10 +161,16 @@ efx_tunnel_init(
 
 #if EFSYS_OPT_MEDFORD
        case EFX_FAMILY_MEDFORD:
-               etop = &__efx_tunnel_medford_ops;
+               etop = &__efx_tunnel_ef10_ops;
                break;
 #endif /* EFSYS_OPT_MEDFORD */
 
+#if EFSYS_OPT_MEDFORD2
+       case EFX_FAMILY_MEDFORD2:
+               etop = &__efx_tunnel_ef10_ops;
+               break;
+#endif /* EFSYS_OPT_MEDFORD2 */
+
        default:
                EFSYS_ASSERT(0);
                rc = ENOTSUP;
@@ -418,9 +400,9 @@ fail1:
        return (rc);
 }
 
-#if EFSYS_OPT_MEDFORD
+#if EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2
 static __checkReturn           boolean_t
-medford_udp_encap_supported(
+ef10_udp_encap_supported(
        __in            efx_nic_t *enp)
 {
        const efx_nic_cfg_t *encp = &enp->en_nic_cfg;
@@ -434,7 +416,7 @@ medford_udp_encap_supported(
 }
 
 static __checkReturn   efx_rc_t
-medford_tunnel_reconfigure(
+ef10_tunnel_reconfigure(
        __in            efx_nic_t *enp)
 {
        efx_tunnel_cfg_t *etcp = &enp->en_tunnel_cfg;
@@ -447,7 +429,7 @@ medford_tunnel_reconfigure(
        memcpy(&etc, etcp, sizeof (etc));
        EFSYS_UNLOCK(enp->en_eslp, state);
 
-       if (medford_udp_encap_supported(enp) == B_FALSE) {
+       if (ef10_udp_encap_supported(enp) == B_FALSE) {
                /*
                 * It is OK to apply empty UDP tunnel ports when UDP
                 * tunnel encapsulations are not supported - just nothing
@@ -482,6 +464,6 @@ fail1:
 
        return (rc);
 }
-#endif /* EFSYS_OPT_MEDFORD */
+#endif /* EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */
 
 #endif /* EFSYS_OPT_TUNNEL */