net/sfc/base: regenerate headers to pick up CTPIO stats
[dpdk.git] / drivers / net / sfc / base / ef10_tx.c
index 14b23d0..8ca0b55 100644 (file)
@@ -1,38 +1,14 @@
-/*
- * 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:
- *
- * 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) 2012-2018 Solarflare Communications Inc.
+ * All rights reserved.
  */
 
 #include "efx.h"
 #include "efx_impl.h"
 
 
-#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
+#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2
 
 #if EFSYS_OPT_QSTATS
 #define        EFX_TX_QSTAT_INCR(_etp, _stat)                                  \
@@ -66,10 +42,15 @@ efx_mcdi_init_txq(
        EFSYS_ASSERT(EFX_TXQ_MAX_BUFS >=
            EFX_TXQ_NBUFS(enp->en_nic_cfg.enc_txq_max_ndescs));
 
+       if ((esmp == NULL) || (EFSYS_MEM_SIZE(esmp) < EFX_TXQ_SIZE(ndescs))) {
+               rc = EINVAL;
+               goto fail1;
+       }
+
        npages = EFX_TXQ_NBUFS(ndescs);
        if (MC_CMD_INIT_TXQ_IN_LEN(npages) > sizeof (payload)) {
                rc = EINVAL;
-               goto fail1;
+               goto fail2;
        }
 
        (void) memset(payload, 0, sizeof (payload));
@@ -118,11 +99,13 @@ efx_mcdi_init_txq(
 
        if (req.emr_rc != 0) {
                rc = req.emr_rc;
-               goto fail2;
+               goto fail3;
        }
 
        return (0);
 
+fail3:
+       EFSYS_PROBE(fail3);
 fail2:
        EFSYS_PROBE(fail2);
 fail1:
@@ -200,7 +183,7 @@ ef10_tx_qcreate(
 {
        efx_nic_cfg_t *encp = &enp->en_nic_cfg;
        uint16_t inner_csum;
-       efx_qword_t desc;
+       efx_desc_t desc;
        efx_rc_t rc;
 
        _NOTE(ARGUNUSED(id))
@@ -225,19 +208,9 @@ ef10_tx_qcreate(
         * a no-op TX option descriptor. See bug29981 for details.
         */
        *addedp = 1;
-       EFX_POPULATE_QWORD_6(desc,
-           ESF_DZ_TX_DESC_IS_OPT, 1,
-           ESF_DZ_TX_OPTION_TYPE, ESE_DZ_TX_OPTION_DESC_CRC_CSUM,
-           ESF_DZ_TX_OPTION_UDP_TCP_CSUM,
-           (flags & EFX_TXQ_CKSUM_TCPUDP) ? 1 : 0,
-           ESF_DZ_TX_OPTION_IP_CSUM,
-           (flags & EFX_TXQ_CKSUM_IPV4) ? 1 : 0,
-           ESF_DZ_TX_OPTION_INNER_UDP_TCP_CSUM,
-           (flags & EFX_TXQ_CKSUM_INNER_TCPUDP) ? 1 : 0,
-           ESF_DZ_TX_OPTION_INNER_IP_CSUM,
-           (flags & EFX_TXQ_CKSUM_INNER_IPV4) ? 1 : 0);
+       ef10_tx_qdesc_checksum_create(etp, flags, &desc);
 
-       EFSYS_MEM_WRITEQ(etp->et_esmp, 0, &desc);
+       EFSYS_MEM_WRITEQ(etp->et_esmp, 0, &desc.ed_eq);
        ef10_tx_qpush(etp, *addedp, 0);
 
        return (0);
@@ -535,8 +508,8 @@ ef10_tx_qpush(
                EFX_DMA_SYNC_QUEUE_FOR_DEVICE(etp->et_esmp, etp->et_mask + 1,
                                            wptr, id);
                EFSYS_PIO_WRITE_BARRIER();
-               EFX_BAR_TBL_DOORBELL_WRITEO(enp, ER_DZ_TX_DESC_UPD_REG,
-                                           etp->et_index, &oword);
+               EFX_BAR_VI_DOORBELL_WRITEO(enp, ER_DZ_TX_DESC_UPD_REG,
+                   etp->et_index, &oword);
        } else {
                efx_dword_t dword;
 
@@ -551,8 +524,8 @@ ef10_tx_qpush(
                EFX_DMA_SYNC_QUEUE_FOR_DEVICE(etp->et_esmp, etp->et_mask + 1,
                                            wptr, id);
                EFSYS_PIO_WRITE_BARRIER();
-               EFX_BAR_TBL_WRITED2(enp, ER_DZ_TX_DESC_UPD_REG,
-                                   etp->et_index, &dword, B_FALSE);
+               EFX_BAR_VI_WRITED2(enp, ER_DZ_TX_DESC_UPD_REG,
+                   etp->et_index, &dword, B_FALSE);
        }
 }
 
@@ -606,6 +579,8 @@ ef10_tx_qdesc_dma_create(
        __in    boolean_t eop,
        __out   efx_desc_t *edp)
 {
+       _NOTE(ARGUNUSED(etp))
+
        /* No limitations on boundary crossing */
        EFSYS_ASSERT(size <= etp->et_enp->en_nic_cfg.enc_tx_dma_desc_size_max);
 
@@ -629,6 +604,8 @@ ef10_tx_qdesc_tso_create(
        __in    uint8_t  tcp_flags,
        __out   efx_desc_t *edp)
 {
+       _NOTE(ARGUNUSED(etp))
+
        EFSYS_PROBE4(tx_desc_tso_create, unsigned int, etp->et_index,
                    uint16_t, ipv4_id, uint32_t, tcp_seq,
                    uint8_t, tcp_flags);
@@ -651,6 +628,8 @@ ef10_tx_qdesc_tso2_create(
        __out_ecount(count)     efx_desc_t *edp,
        __in                    int count)
 {
+       _NOTE(ARGUNUSED(etp, count))
+
        EFSYS_PROBE4(tx_desc_tso2_create, unsigned int, etp->et_index,
                    uint16_t, ipv4_id, uint32_t, tcp_seq,
                    uint16_t, tcp_mss);
@@ -680,6 +659,8 @@ ef10_tx_qdesc_vlantci_create(
        __in    uint16_t  tci,
        __out   efx_desc_t *edp)
 {
+       _NOTE(ARGUNUSED(etp))
+
        EFSYS_PROBE2(tx_desc_vlantci_create, unsigned int, etp->et_index,
                    uint16_t, tci);
 
@@ -691,6 +672,30 @@ ef10_tx_qdesc_vlantci_create(
                            ESF_DZ_TX_VLAN_TAG1, tci);
 }
 
+       void
+ef10_tx_qdesc_checksum_create(
+       __in    efx_txq_t *etp,
+       __in    uint16_t flags,
+       __out   efx_desc_t *edp)
+{
+       _NOTE(ARGUNUSED(etp));
+
+       EFSYS_PROBE2(tx_desc_checksum_create, unsigned int, etp->et_index,
+                   uint32_t, flags);
+
+       EFX_POPULATE_QWORD_6(edp->ed_eq,
+           ESF_DZ_TX_DESC_IS_OPT, 1,
+           ESF_DZ_TX_OPTION_TYPE, ESE_DZ_TX_OPTION_DESC_CRC_CSUM,
+           ESF_DZ_TX_OPTION_UDP_TCP_CSUM,
+           (flags & EFX_TXQ_CKSUM_TCPUDP) ? 1 : 0,
+           ESF_DZ_TX_OPTION_IP_CSUM,
+           (flags & EFX_TXQ_CKSUM_IPV4) ? 1 : 0,
+           ESF_DZ_TX_OPTION_INNER_UDP_TCP_CSUM,
+           (flags & EFX_TXQ_CKSUM_INNER_TCPUDP) ? 1 : 0,
+           ESF_DZ_TX_OPTION_INNER_IP_CSUM,
+           (flags & EFX_TXQ_CKSUM_INNER_IPV4) ? 1 : 0);
+}
+
 
        __checkReturn   efx_rc_t
 ef10_tx_qpace(
@@ -768,4 +773,4 @@ ef10_tx_qstats_update(
 
 #endif /* EFSYS_OPT_QSTATS */
 
-#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
+#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */