New upstream version 18.02
[deb_dpdk.git] / drivers / net / sfc / base / efx_ev.c
index 42ded5a..949d352 100644 (file)
@@ -1,31 +1,7 @@
-/*
- * Copyright (c) 2007-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) 2007-2018 Solarflare Communications Inc.
+ * All rights reserved.
  */
 
 #include "efx.h"
@@ -65,7 +41,7 @@ siena_ev_qcreate(
        __in            efx_nic_t *enp,
        __in            unsigned int index,
        __in            efsys_mem_t *esmp,
-       __in            size_t n,
+       __in            size_t ndescs,
        __in            uint32_t id,
        __in            uint32_t us,
        __in            uint32_t flags,
@@ -216,21 +192,21 @@ efx_ev_qcreate(
        __in            efx_nic_t *enp,
        __in            unsigned int index,
        __in            efsys_mem_t *esmp,
-       __in            size_t n,
+       __in            size_t ndescs,
        __in            uint32_t id,
        __in            uint32_t us,
        __in            uint32_t flags,
        __deref_out     efx_evq_t **eepp)
 {
        const efx_ev_ops_t *eevop = enp->en_eevop;
-       efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
        efx_evq_t *eep;
        efx_rc_t rc;
 
        EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
        EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_EV);
 
-       EFSYS_ASSERT3U(enp->en_ev_qcount + 1, <, encp->enc_evq_limit);
+       EFSYS_ASSERT3U(enp->en_ev_qcount + 1, <,
+           enp->en_nic_cfg.enc_evq_limit);
 
        switch (flags & EFX_EVQ_FLAGS_NOTIFY_MASK) {
        case EFX_EVQ_FLAGS_NOTIFY_INTERRUPT:
@@ -256,7 +232,7 @@ efx_ev_qcreate(
        eep->ee_magic = EFX_EVQ_MAGIC;
        eep->ee_enp = enp;
        eep->ee_index = index;
-       eep->ee_mask = n - 1;
+       eep->ee_mask = ndescs - 1;
        eep->ee_flags = flags;
        eep->ee_esmp = esmp;
 
@@ -271,7 +247,7 @@ efx_ev_qcreate(
        enp->en_ev_qcount++;
        *eepp = eep;
 
-       if ((rc = eevop->eevo_qcreate(enp, index, esmp, n, id, us, flags,
+       if ((rc = eevop->eevo_qcreate(enp, index, esmp, ndescs, id, us, flags,
            eep)) != 0)
                goto fail4;
 
@@ -1281,7 +1257,7 @@ siena_ev_qcreate(
        __in            efx_nic_t *enp,
        __in            unsigned int index,
        __in            efsys_mem_t *esmp,
-       __in            size_t n,
+       __in            size_t ndescs,
        __in            uint32_t id,
        __in            uint32_t us,
        __in            uint32_t flags,
@@ -1298,7 +1274,8 @@ siena_ev_qcreate(
        EFX_STATIC_ASSERT(ISP2(EFX_EVQ_MAXNEVS));
        EFX_STATIC_ASSERT(ISP2(EFX_EVQ_MINNEVS));
 
-       if (!ISP2(n) || (n < EFX_EVQ_MINNEVS) || (n > EFX_EVQ_MAXNEVS)) {
+       if (!ISP2(ndescs) ||
+           (ndescs < EFX_EVQ_MINNEVS) || (ndescs > EFX_EVQ_MAXNEVS)) {
                rc = EINVAL;
                goto fail1;
        }
@@ -1315,7 +1292,7 @@ siena_ev_qcreate(
 #endif
        for (size = 0; (1 << size) <= (EFX_EVQ_MAXNEVS / EFX_EVQ_MINNEVS);
            size++)
-               if ((1 << size) == (int)(n / EFX_EVQ_MINNEVS))
+               if ((1 << size) == (int)(ndescs / EFX_EVQ_MINNEVS))
                        break;
        if (id + (1 << size) >= encp->enc_buftbl_limit) {
                rc = EINVAL;
@@ -1416,6 +1393,8 @@ efx_ev_qstat_name(
        __in    efx_nic_t *enp,
        __in    unsigned int id)
 {
+       _NOTE(ARGUNUSED(enp))
+
        EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
        EFSYS_ASSERT3U(id, <, EV_NQSTATS);