net/sfc/base: provide a flag for controlling CTPIO mode
[dpdk.git] / drivers / net / sfc / base / efx_lic.c
index 15405f9..49c0034 100644 (file)
@@ -1,31 +1,7 @@
-/*
- * Copyright (c) 2009-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:
- *
- * 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) 2009-2018 Solarflare Communications Inc.
+ * All rights reserved.
  */
 
 #include "efx.h"
@@ -34,6 +10,9 @@
 #if EFSYS_OPT_LICENSING
 
 #include "ef10_tlv_layout.h"
+#if EFSYS_OPT_SIENA
+#include "efx_regs_mcdi_aoe.h"
+#endif
 
 #if EFSYS_OPT_SIENA | EFSYS_OPT_HUNTINGTON
 
@@ -186,7 +165,7 @@ static const efx_lic_ops_t  __efx_lic_v2_ops = {
 
 #endif /* EFSYS_OPT_HUNTINGTON */
 
-#if EFSYS_OPT_MEDFORD
+#if EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2
 
 static __checkReturn   efx_rc_t
 efx_mcdi_licensing_v3_update_licenses(
@@ -310,7 +289,7 @@ static const efx_lic_ops_t  __efx_lic_v3_ops = {
        efx_lic_v3_finish_partition,            /* elo_finish_partition */
 };
 
-#endif /* EFSYS_OPT_MEDFORD */
+#endif /* EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */
 
 
 /* V1 Licensing - used in Siena Modena only */
@@ -843,7 +822,7 @@ fail1:
 
 /* V3 Licensing - used starting from Medford family. See SF-114884-SW */
 
-#if EFSYS_OPT_MEDFORD
+#if EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2
 
 static __checkReturn   efx_rc_t
 efx_mcdi_licensing_v3_update_licenses(
@@ -853,7 +832,8 @@ efx_mcdi_licensing_v3_update_licenses(
        uint8_t payload[MC_CMD_LICENSING_V3_IN_LEN];
        efx_rc_t rc;
 
-       EFSYS_ASSERT(enp->en_family == EFX_FAMILY_MEDFORD);
+       EFSYS_ASSERT((enp->en_family == EFX_FAMILY_MEDFORD) ||
+           (enp->en_family == EFX_FAMILY_MEDFORD2));
 
        (void) memset(payload, 0, sizeof (payload));
        req.emr_cmd = MC_CMD_LICENSING_V3;
@@ -890,7 +870,8 @@ efx_mcdi_licensing_v3_report_license(
                            MC_CMD_LICENSING_V3_OUT_LEN)];
        efx_rc_t rc;
 
-       EFSYS_ASSERT(enp->en_family == EFX_FAMILY_MEDFORD);
+       EFSYS_ASSERT((enp->en_family == EFX_FAMILY_MEDFORD) ||
+           (enp->en_family == EFX_FAMILY_MEDFORD2));
 
        (void) memset(payload, 0, sizeof (payload));
        req.emr_cmd = MC_CMD_LICENSING_V3;
@@ -954,7 +935,8 @@ efx_mcdi_licensing_v3_app_state(
        uint32_t app_state;
        efx_rc_t rc;
 
-       EFSYS_ASSERT(enp->en_family == EFX_FAMILY_MEDFORD);
+       EFSYS_ASSERT((enp->en_family == EFX_FAMILY_MEDFORD) ||
+           (enp->en_family == EFX_FAMILY_MEDFORD2));
 
        (void) memset(payload, 0, sizeof (payload));
        req.emr_cmd = MC_CMD_GET_LICENSED_V3_APP_STATE;
@@ -1286,7 +1268,7 @@ fail1:
 }
 
 
-#endif /* EFSYS_OPT_MEDFORD */
+#endif /* EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */
 
        __checkReturn           efx_rc_t
 efx_lic_init(
@@ -1320,6 +1302,12 @@ efx_lic_init(
                break;
 #endif /* EFSYS_OPT_MEDFORD */
 
+#if EFSYS_OPT_MEDFORD2
+       case EFX_FAMILY_MEDFORD2:
+               elop = &__efx_lic_v3_ops;
+               break;
+#endif /* EFSYS_OPT_MEDFORD2 */
+
        default:
                EFSYS_ASSERT(0);
                rc = ENOTSUP;