net/mlx5: move Linux-specific functions
[dpdk.git] / drivers / net / sfc / base / efx_tx.c
index b777a85..38c64e0 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
- * Copyright (c) 2007-2018 Solarflare Communications Inc.
- * All rights reserved.
+ * Copyright(c) 2019-2020 Xilinx, Inc.
+ * Copyright(c) 2007-2019 Solarflare Communications Inc.
  */
 
 #include "efx.h"
@@ -297,6 +297,24 @@ efx_tx_fini(
        enp->en_mod_flags &= ~EFX_MOD_TX;
 }
 
+       __checkReturn   size_t
+efx_txq_size(
+       __in    const efx_nic_t *enp,
+       __in    unsigned int ndescs)
+{
+       const efx_nic_cfg_t *encp = efx_nic_cfg_get(enp);
+
+       return (ndescs * encp->enc_tx_desc_size);
+}
+
+       __checkReturn   unsigned int
+efx_txq_nbufs(
+       __in    const efx_nic_t *enp,
+       __in    unsigned int ndescs)
+{
+       return (EFX_DIV_ROUND_UP(efx_txq_size(enp, ndescs), EFX_BUF_SIZE));
+}
+
        __checkReturn   efx_rc_t
 efx_tx_qcreate(
        __in            efx_nic_t *enp,
@@ -781,7 +799,7 @@ siena_tx_qpost(
                 * Fragments must not span 4k boundaries.
                 * Here it is a stricter requirement than the maximum length.
                 */
-               EFSYS_ASSERT(P2ROUNDUP(start + 1,
+               EFSYS_ASSERT(EFX_P2ROUNDUP(efsys_dma_addr_t, start + 1,
                    etp->et_enp->en_nic_cfg.enc_tx_dma_desc_boundary) >= end);
 
                EFX_TX_DESC(etp, start, size, ebp->eb_eop, added);
@@ -1040,7 +1058,7 @@ siena_tx_qdesc_dma_create(
         * Fragments must not span 4k boundaries.
         * Here it is a stricter requirement than the maximum length.
         */
-       EFSYS_ASSERT(P2ROUNDUP(addr + 1,
+       EFSYS_ASSERT(EFX_P2ROUNDUP(efsys_dma_addr_t, addr + 1,
            etp->et_enp->en_nic_cfg.enc_tx_dma_desc_boundary) >= addr + size);
 
        EFSYS_PROBE4(tx_desc_dma_create, unsigned int, etp->et_index,