net/sfc/base: add equal stride super-buffer prefix layout
[dpdk.git] / drivers / net / sfc / base / efx_tx.c
index 0cdf7e1..da37580 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.
+/* 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"
@@ -141,6 +117,7 @@ static const efx_tx_ops_t   __efx_tx_siena_ops = {
        NULL,                                   /* etxo_qdesc_tso_create */
        NULL,                                   /* etxo_qdesc_tso2_create */
        NULL,                                   /* etxo_qdesc_vlantci_create */
+       NULL,                                   /* etxo_qdesc_checksum_create */
 #if EFSYS_OPT_QSTATS
        siena_tx_qstats_update,                 /* etxo_qstats_update */
 #endif
@@ -167,6 +144,7 @@ static const efx_tx_ops_t   __efx_tx_hunt_ops = {
        ef10_tx_qdesc_tso_create,               /* etxo_qdesc_tso_create */
        ef10_tx_qdesc_tso2_create,              /* etxo_qdesc_tso2_create */
        ef10_tx_qdesc_vlantci_create,           /* etxo_qdesc_vlantci_create */
+       ef10_tx_qdesc_checksum_create,          /* etxo_qdesc_checksum_create */
 #if EFSYS_OPT_QSTATS
        ef10_tx_qstats_update,                  /* etxo_qstats_update */
 #endif
@@ -193,12 +171,41 @@ static const efx_tx_ops_t __efx_tx_medford_ops = {
        NULL,                                   /* etxo_qdesc_tso_create */
        ef10_tx_qdesc_tso2_create,              /* etxo_qdesc_tso2_create */
        ef10_tx_qdesc_vlantci_create,           /* etxo_qdesc_vlantci_create */
+       ef10_tx_qdesc_checksum_create,          /* etxo_qdesc_checksum_create */
 #if EFSYS_OPT_QSTATS
        ef10_tx_qstats_update,                  /* etxo_qstats_update */
 #endif
 };
 #endif /* EFSYS_OPT_MEDFORD */
 
+#if EFSYS_OPT_MEDFORD2
+static const efx_tx_ops_t      __efx_tx_medford2_ops = {
+       ef10_tx_init,                           /* etxo_init */
+       ef10_tx_fini,                           /* etxo_fini */
+       ef10_tx_qcreate,                        /* etxo_qcreate */
+       ef10_tx_qdestroy,                       /* etxo_qdestroy */
+       ef10_tx_qpost,                          /* etxo_qpost */
+       ef10_tx_qpush,                          /* etxo_qpush */
+       ef10_tx_qpace,                          /* etxo_qpace */
+       ef10_tx_qflush,                         /* etxo_qflush */
+       ef10_tx_qenable,                        /* etxo_qenable */
+       ef10_tx_qpio_enable,                    /* etxo_qpio_enable */
+       ef10_tx_qpio_disable,                   /* etxo_qpio_disable */
+       ef10_tx_qpio_write,                     /* etxo_qpio_write */
+       ef10_tx_qpio_post,                      /* etxo_qpio_post */
+       ef10_tx_qdesc_post,                     /* etxo_qdesc_post */
+       ef10_tx_qdesc_dma_create,               /* etxo_qdesc_dma_create */
+       NULL,                                   /* etxo_qdesc_tso_create */
+       ef10_tx_qdesc_tso2_create,              /* etxo_qdesc_tso2_create */
+       ef10_tx_qdesc_vlantci_create,           /* etxo_qdesc_vlantci_create */
+       ef10_tx_qdesc_checksum_create,          /* etxo_qdesc_checksum_create */
+#if EFSYS_OPT_QSTATS
+       ef10_tx_qstats_update,                  /* etxo_qstats_update */
+#endif
+};
+#endif /* EFSYS_OPT_MEDFORD2 */
+
+
        __checkReturn   efx_rc_t
 efx_tx_init(
        __in            efx_nic_t *enp)
@@ -238,6 +245,12 @@ efx_tx_init(
                break;
 #endif /* EFSYS_OPT_MEDFORD */
 
+#if EFSYS_OPT_MEDFORD2
+       case EFX_FAMILY_MEDFORD2:
+               etxop = &__efx_tx_medford2_ops;
+               break;
+#endif /* EFSYS_OPT_MEDFORD2 */
+
        default:
                EFSYS_ASSERT(0);
                rc = ENOTSUP;
@@ -612,6 +625,7 @@ efx_tx_qdesc_tso_create(
 efx_tx_qdesc_tso2_create(
        __in                    efx_txq_t *etp,
        __in                    uint16_t ipv4_id,
+       __in                    uint16_t outer_ipv4_id,
        __in                    uint32_t tcp_seq,
        __in                    uint16_t mss,
        __out_ecount(count)     efx_desc_t *edp,
@@ -623,7 +637,8 @@ efx_tx_qdesc_tso2_create(
        EFSYS_ASSERT3U(etp->et_magic, ==, EFX_TXQ_MAGIC);
        EFSYS_ASSERT(etxop->etxo_qdesc_tso2_create != NULL);
 
-       etxop->etxo_qdesc_tso2_create(etp, ipv4_id, tcp_seq, mss, edp, count);
+       etxop->etxo_qdesc_tso2_create(etp, ipv4_id, outer_ipv4_id,
+           tcp_seq, mss, edp, count);
 }
 
        void
@@ -641,6 +656,21 @@ efx_tx_qdesc_vlantci_create(
        etxop->etxo_qdesc_vlantci_create(etp, tci, edp);
 }
 
+       void
+efx_tx_qdesc_checksum_create(
+       __in    efx_txq_t *etp,
+       __in    uint16_t flags,
+       __out   efx_desc_t *edp)
+{
+       efx_nic_t *enp = etp->et_enp;
+       const efx_tx_ops_t *etxop = enp->en_etxop;
+
+       EFSYS_ASSERT3U(etp->et_magic, ==, EFX_TXQ_MAGIC);
+       EFSYS_ASSERT(etxop->etxo_qdesc_checksum_create != NULL);
+
+       etxop->etxo_qdesc_checksum_create(etp, flags, edp);
+}
+
 
 #if EFSYS_OPT_QSTATS
                        void