net/sfc: fix assert in set multicast address list
[dpdk.git] / drivers / net / sfc / base / efx_lic.c
index de25c5c..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.
- *
- * 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.
+/* SPDX-License-Identifier: BSD-3-Clause
  *
- * 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 */
@@ -498,7 +477,7 @@ efx_lic_v1v2_find_key(
        return (found);
 
 fail1:
-       EFSYS_PROBE(fail1);
+       EFSYS_PROBE1(fail1, boolean_t, B_FALSE);
 
        return (B_FALSE);
 }
@@ -540,7 +519,7 @@ fail3:
 fail2:
        EFSYS_PROBE(fail2);
 fail1:
-       EFSYS_PROBE(fail1);
+       EFSYS_PROBE1(fail1, boolean_t, B_FALSE);
 
        return (B_FALSE);
 }
@@ -561,7 +540,7 @@ efx_lic_v1v2_read_key(
 {
        efx_rc_t rc;
 
-       _NOTE(ARGUNUSED(enp))
+       _NOTE(ARGUNUSED(enp, buffer_size))
        EFSYS_ASSERT(length <= (EFX_LICENSE_V1V2_PAYLOAD_LENGTH_MAX +
            EFX_LICENSE_V1V2_HEADER_LENGTH));
 
@@ -631,7 +610,7 @@ efx_lic_v1v2_delete_key(
        uint32_t move_start = offset + length;
        uint32_t move_length = end - move_start;
 
-       _NOTE(ARGUNUSED(enp))
+       _NOTE(ARGUNUSED(enp, buffer_size))
        EFSYS_ASSERT(end <= buffer_size);
 
        /* Shift everything after the key down */
@@ -649,7 +628,7 @@ efx_lic_v1v2_create_partition(
                                caddr_t bufferp,
        __in                    size_t buffer_size)
 {
-       _NOTE(ARGUNUSED(enp))
+       _NOTE(ARGUNUSED(enp, buffer_size))
        EFSYS_ASSERT(EFX_LICENSE_V1V2_HEADER_LENGTH <= buffer_size);
 
        /* Write terminator */
@@ -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;
@@ -1158,7 +1140,7 @@ fail3:
 fail2:
        EFSYS_PROBE(fail2);
 fail1:
-       EFSYS_PROBE(fail1);
+       EFSYS_PROBE1(fail1, boolean_t, B_FALSE);
 
        return (B_FALSE);
 }
@@ -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;