LCOV - code coverage report
Current view: top level - drivers/bus/fslmc/portal - dpaa2_hw_pvt.h (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 18 0.0 %
Date: 2024-01-22 15:35:40 Functions: 0 2 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 20 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  *
       3                 :            :  *   Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved.
       4                 :            :  *   Copyright 2016-2021 NXP
       5                 :            :  *
       6                 :            :  */
       7                 :            : 
       8                 :            : #ifndef _DPAA2_HW_PVT_H_
       9                 :            : #define _DPAA2_HW_PVT_H_
      10                 :            : 
      11                 :            : #include <rte_compat.h>
      12                 :            : #include <rte_eventdev.h>
      13                 :            : #include <dpaax_iova_table.h>
      14                 :            : 
      15                 :            : #include <mc/fsl_mc_sys.h>
      16                 :            : #include <fsl_qbman_portal.h>
      17                 :            : 
      18                 :            : #ifndef false
      19                 :            : #define false      0
      20                 :            : #endif
      21                 :            : #ifndef true
      22                 :            : #define true       1
      23                 :            : #endif
      24                 :            : #define lower_32_bits(x) ((uint32_t)(x))
      25                 :            : #define upper_32_bits(x) ((uint32_t)(((x) >> 16) >> 16))
      26                 :            : 
      27                 :            : #ifndef VLAN_TAG_SIZE
      28                 :            : #define VLAN_TAG_SIZE   4 /** < Vlan Header Length */
      29                 :            : #endif
      30                 :            : 
      31                 :            : /* Maximum number of slots available in TX ring */
      32                 :            : #define MAX_TX_RING_SLOTS                       32
      33                 :            : #define MAX_EQ_RESP_ENTRIES                     (MAX_TX_RING_SLOTS + 1)
      34                 :            : 
      35                 :            : /* Maximum number of slots available in RX ring */
      36                 :            : #define DPAA2_EQCR_RING_SIZE            8
      37                 :            : /* Maximum number of slots available in RX ring on LX2 */
      38                 :            : #define DPAA2_LX2_EQCR_RING_SIZE        32
      39                 :            : 
      40                 :            : /* Maximum number of slots available in RX ring */
      41                 :            : #define DPAA2_DQRR_RING_SIZE            16
      42                 :            : /* Maximum number of slots available in RX ring on LX2 */
      43                 :            : #define DPAA2_LX2_DQRR_RING_SIZE        32
      44                 :            : 
      45                 :            : /* EQCR shift to get EQCR size (2 >> 3) = 8 for LS2/LS2 */
      46                 :            : #define DPAA2_EQCR_SHIFT                3
      47                 :            : /* EQCR shift to get EQCR size for LX2 (2 >> 5) = 32 for LX2 */
      48                 :            : #define DPAA2_LX2_EQCR_SHIFT            5
      49                 :            : 
      50                 :            : /* Flag to determine an ordered queue mbuf */
      51                 :            : #define DPAA2_ENQUEUE_FLAG_ORP          (1ULL << 30)
      52                 :            : /* ORP ID shift and mask */
      53                 :            : #define DPAA2_EQCR_OPRID_SHIFT          16
      54                 :            : #define DPAA2_EQCR_OPRID_MASK           0x3FFF0000
      55                 :            : /* Sequence number shift and mask */
      56                 :            : #define DPAA2_EQCR_SEQNUM_SHIFT         0
      57                 :            : #define DPAA2_EQCR_SEQNUM_MASK          0x0000FFFF
      58                 :            : 
      59                 :            : #define DPAA2_SWP_CENA_REGION           0
      60                 :            : #define DPAA2_SWP_CINH_REGION           1
      61                 :            : #define DPAA2_SWP_CENA_MEM_REGION       2
      62                 :            : 
      63                 :            : #define DPAA2_MAX_TX_RETRY_COUNT        10000
      64                 :            : 
      65                 :            : #define MC_PORTAL_INDEX         0
      66                 :            : #define NUM_DPIO_REGIONS        2
      67                 :            : #define NUM_DQS_PER_QUEUE       2
      68                 :            : 
      69                 :            : /* Maximum release/acquire from QBMAN */
      70                 :            : #define DPAA2_MBUF_MAX_ACQ_REL  7
      71                 :            : 
      72                 :            : #define DPAA2_MEMPOOL_OPS_NAME          "dpaa2"
      73                 :            : 
      74                 :            : #define MAX_BPID 256
      75                 :            : #define DPAA2_MBUF_HW_ANNOTATION        64
      76                 :            : #define DPAA2_FD_PTA_SIZE               0
      77                 :            : 
      78                 :            : /* we will re-use the HEADROOM for annotation in RX */
      79                 :            : #define DPAA2_HW_BUF_RESERVE    0
      80                 :            : #define DPAA2_PACKET_LAYOUT_ALIGN       64 /*changing from 256 */
      81                 :            : 
      82                 :            : #define DPAA2_DPCI_MAX_QUEUES 2
      83                 :            : 
      84                 :            : struct dpaa2_queue;
      85                 :            : 
      86                 :            : struct eqresp_metadata {
      87                 :            :         struct dpaa2_queue *dpaa2_q;
      88                 :            :         struct rte_mempool *mp;
      89                 :            : };
      90                 :            : 
      91                 :            : #define DPAA2_PORTAL_DEQUEUE_DEPTH      32
      92                 :            : struct dpaa2_portal_dqrr {
      93                 :            :         struct rte_mbuf *mbuf[DPAA2_PORTAL_DEQUEUE_DEPTH];
      94                 :            :         uint64_t dqrr_held;
      95                 :            :         uint8_t dqrr_size;
      96                 :            : };
      97                 :            : 
      98                 :            : struct dpaa2_dpio_dev {
      99                 :            :         TAILQ_ENTRY(dpaa2_dpio_dev) next;
     100                 :            :                 /**< Pointer to Next device instance */
     101                 :            :         uint16_t index; /**< Index of a instance in the list */
     102                 :            :         rte_atomic16_t ref_count;
     103                 :            :                 /**< How many thread contexts are sharing this.*/
     104                 :            :         uint16_t eqresp_ci;
     105                 :            :         uint16_t eqresp_pi;
     106                 :            :         struct qbman_result *eqresp;
     107                 :            :         struct eqresp_metadata *eqresp_meta;
     108                 :            :         struct fsl_mc_io *dpio; /** handle to DPIO portal object */
     109                 :            :         uint16_t token;
     110                 :            :         struct qbman_swp *sw_portal; /** SW portal object */
     111                 :            :         const struct qbman_result *dqrr[4];
     112                 :            :                 /**< DQRR Entry for this SW portal */
     113                 :            :         void *mc_portal; /**< MC Portal for configuring this device */
     114                 :            :         uintptr_t qbman_portal_ce_paddr;
     115                 :            :                 /**< Physical address of Cache Enabled Area */
     116                 :            :         uintptr_t ce_size; /**< Size of the CE region */
     117                 :            :         uintptr_t qbman_portal_ci_paddr;
     118                 :            :                 /**< Physical address of Cache Inhibit Area */
     119                 :            :         uintptr_t ci_size; /**< Size of the CI region */
     120                 :            :         struct rte_intr_handle *intr_handle; /* Interrupt related info */
     121                 :            :         int32_t epoll_fd; /**< File descriptor created for interrupt polling */
     122                 :            :         int32_t hw_id; /**< An unique ID of this DPIO device instance */
     123                 :            :         struct dpaa2_portal_dqrr dpaa2_held_bufs;
     124                 :            : };
     125                 :            : 
     126                 :            : struct dpaa2_dpbp_dev {
     127                 :            :         TAILQ_ENTRY(dpaa2_dpbp_dev) next;
     128                 :            :                 /**< Pointer to Next device instance */
     129                 :            :         struct fsl_mc_io dpbp;  /** handle to DPBP portal object */
     130                 :            :         uint16_t token;
     131                 :            :         rte_atomic16_t in_use;
     132                 :            :         uint32_t dpbp_id; /*HW ID for DPBP object */
     133                 :            : };
     134                 :            : 
     135                 :            : struct queue_storage_info_t {
     136                 :            :         struct qbman_result *dq_storage[NUM_DQS_PER_QUEUE];
     137                 :            :         struct qbman_result *active_dqs;
     138                 :            :         uint8_t active_dpio_id;
     139                 :            :         uint8_t toggle;
     140                 :            :         uint8_t last_num_pkts;
     141                 :            : };
     142                 :            : 
     143                 :            : struct dpaa2_queue;
     144                 :            : 
     145                 :            : typedef void (dpaa2_queue_cb_dqrr_t)(struct qbman_swp *swp,
     146                 :            :                 const struct qbman_fd *fd,
     147                 :            :                 const struct qbman_result *dq,
     148                 :            :                 struct dpaa2_queue *rxq,
     149                 :            :                 struct rte_event *ev);
     150                 :            : 
     151                 :            : typedef void (dpaa2_queue_cb_eqresp_free_t)(uint16_t eqresp_ci,
     152                 :            :                                         struct dpaa2_queue *dpaa2_q);
     153                 :            : 
     154                 :            : struct dpaa2_queue {
     155                 :            :         struct rte_mempool *mb_pool; /**< mbuf pool to populate RX ring. */
     156                 :            :         union {
     157                 :            :                 struct rte_eth_dev_data *eth_data;
     158                 :            :                 struct rte_cryptodev_data *crypto_data;
     159                 :            :         };
     160                 :            :         uint32_t fqid;          /*!< Unique ID of this queue */
     161                 :            :         uint16_t flow_id;       /*!< To be used by DPAA2 framework */
     162                 :            :         uint8_t tc_index;       /*!< traffic class identifier */
     163                 :            :         uint8_t cgid;           /*! < Congestion Group id for this queue */
     164                 :            :         uint64_t rx_pkts;
     165                 :            :         uint64_t tx_pkts;
     166                 :            :         uint64_t err_pkts;
     167                 :            :         union {
     168                 :            :                 struct queue_storage_info_t *q_storage;
     169                 :            :                 struct qbman_result *cscn;
     170                 :            :         };
     171                 :            :         struct rte_event ev;
     172                 :            :         dpaa2_queue_cb_dqrr_t *cb;
     173                 :            :         dpaa2_queue_cb_eqresp_free_t *cb_eqresp_free;
     174                 :            :         struct dpaa2_bp_info *bp_array;
     175                 :            :         /*to store tx_conf_queue corresponding to tx_queue*/
     176                 :            :         struct dpaa2_queue *tx_conf_queue;
     177                 :            :         int32_t eventfd;        /*!< Event Fd of this queue */
     178                 :            :         uint16_t nb_desc;
     179                 :            :         uint16_t resv;
     180                 :            :         uint64_t offloads;
     181                 :            :         uint64_t lpbk_cntx;
     182                 :            : } __rte_cache_aligned;
     183                 :            : 
     184                 :            : struct swp_active_dqs {
     185                 :            :         struct qbman_result *global_active_dqs;
     186                 :            :         uint64_t reserved[7];
     187                 :            : };
     188                 :            : 
     189                 :            : #define NUM_MAX_SWP 64
     190                 :            : 
     191                 :            : extern struct swp_active_dqs rte_global_active_dqs_list[NUM_MAX_SWP];
     192                 :            : 
     193                 :            : /**
     194                 :            :  * A structure describing a DPAA2 container.
     195                 :            :  */
     196                 :            : struct dpaa2_dprc_dev {
     197                 :            :         TAILQ_ENTRY(dpaa2_dprc_dev) next;
     198                 :            :                 /**< Pointer to Next device instance */
     199                 :            :         const char *name;
     200                 :            :         struct fsl_mc_io dprc;  /** handle to DPRC portal object */
     201                 :            :         uint16_t token;
     202                 :            :         uint32_t dprc_id; /*HW ID for DPRC object */
     203                 :            : };
     204                 :            : 
     205                 :            : struct dpaa2_dpci_dev {
     206                 :            :         TAILQ_ENTRY(dpaa2_dpci_dev) next;
     207                 :            :                 /**< Pointer to Next device instance */
     208                 :            :         struct fsl_mc_io dpci;  /** handle to DPCI portal object */
     209                 :            :         uint16_t token;
     210                 :            :         rte_atomic16_t in_use;
     211                 :            :         uint32_t dpci_id; /*HW ID for DPCI object */
     212                 :            :         struct dpaa2_queue rx_queue[DPAA2_DPCI_MAX_QUEUES];
     213                 :            :         struct dpaa2_queue tx_queue[DPAA2_DPCI_MAX_QUEUES];
     214                 :            : };
     215                 :            : 
     216                 :            : struct dpaa2_dpcon_dev {
     217                 :            :         TAILQ_ENTRY(dpaa2_dpcon_dev) next;
     218                 :            :         struct fsl_mc_io dpcon;
     219                 :            :         uint16_t token;
     220                 :            :         rte_atomic16_t in_use;
     221                 :            :         uint32_t dpcon_id;
     222                 :            :         uint16_t qbman_ch_id;
     223                 :            :         uint8_t num_priorities;
     224                 :            :         uint8_t channel_index;
     225                 :            : };
     226                 :            : 
     227                 :            : /* Refer to Table 7-3 in SEC BG */
     228                 :            : #define QBMAN_FLE_WORD4_FMT_SBF 0x0    /* Single buffer frame */
     229                 :            : #define QBMAN_FLE_WORD4_FMT_SGE 0x2 /* Scatter gather frame */
     230                 :            : 
     231                 :            : struct qbman_fle_word4 {
     232                 :            :         uint32_t bpid:14; /* Frame buffer pool ID */
     233                 :            :         uint32_t ivp:1; /* Invalid Pool ID. */
     234                 :            :         uint32_t bmt:1; /* Bypass Memory Translation */
     235                 :            :         uint32_t offset:12; /* Frame offset */
     236                 :            :         uint32_t fmt:2; /* Frame Format */
     237                 :            :         uint32_t sl:1; /* Short Length */
     238                 :            :         uint32_t f:1; /* Final bit */
     239                 :            : };
     240                 :            : 
     241                 :            : struct qbman_fle {
     242                 :            :         uint32_t addr_lo;
     243                 :            :         uint32_t addr_hi;
     244                 :            :         uint32_t length;
     245                 :            :         /* FMT must be 00, MSB is final bit  */
     246                 :            :         union {
     247                 :            :                 uint32_t fin_bpid_offset;
     248                 :            :                 struct qbman_fle_word4 word4;
     249                 :            :         };
     250                 :            :         uint32_t frc;
     251                 :            :         uint32_t reserved[3]; /* Not used currently */
     252                 :            : };
     253                 :            : 
     254                 :            : struct qbman_sge {
     255                 :            :         uint32_t addr_lo;
     256                 :            :         uint32_t addr_hi;
     257                 :            :         uint32_t length;
     258                 :            :         uint32_t fin_bpid_offset;
     259                 :            : };
     260                 :            : 
     261                 :            : /* There are three types of frames: Single, Scatter Gather and Frame Lists */
     262                 :            : enum qbman_fd_format {
     263                 :            :         qbman_fd_single = 0,
     264                 :            :         qbman_fd_list,
     265                 :            :         qbman_fd_sg
     266                 :            : };
     267                 :            : /*Macros to define operations on FD*/
     268                 :            : #define DPAA2_SET_FD_ADDR(fd, addr) do {                        \
     269                 :            :         (fd)->simple.addr_lo = lower_32_bits((size_t)(addr));        \
     270                 :            :         (fd)->simple.addr_hi = upper_32_bits((uint64_t)(addr));      \
     271                 :            : } while (0)
     272                 :            : #define DPAA2_SET_FD_LEN(fd, length)    ((fd)->simple.len = length)
     273                 :            : #define DPAA2_SET_FD_BPID(fd, bpid)     ((fd)->simple.bpid_offset |= bpid)
     274                 :            : #define DPAA2_SET_ONLY_FD_BPID(fd, bpid) \
     275                 :            :         ((fd)->simple.bpid_offset = bpid)
     276                 :            : #define DPAA2_SET_FD_IVP(fd)   (((fd)->simple.bpid_offset |= 0x00004000))
     277                 :            : #define DPAA2_SET_FD_OFFSET(fd, offset) \
     278                 :            :         (((fd)->simple.bpid_offset |= (uint32_t)(offset) << 16))
     279                 :            : #define DPAA2_SET_FD_INTERNAL_JD(fd, len) \
     280                 :            :         ((fd)->simple.frc = (0x80000000 | (len)))
     281                 :            : #define DPAA2_GET_FD_FRC_PARSE_SUM(fd)  \
     282                 :            :                         ((uint16_t)(((fd)->simple.frc & 0xffff0000) >> 16))
     283                 :            : #define DPAA2_RESET_FD_FRC(fd)          ((fd)->simple.frc = 0)
     284                 :            : #define DPAA2_SET_FD_FRC(fd, _frc)      ((fd)->simple.frc = _frc)
     285                 :            : #define DPAA2_RESET_FD_CTRL(fd)  ((fd)->simple.ctrl = 0)
     286                 :            : 
     287                 :            : #define DPAA2_SET_FD_ASAL(fd, asal)     ((fd)->simple.ctrl |= (asal << 16))
     288                 :            : 
     289                 :            : #define DPAA2_RESET_FD_FLC(fd)  do {    \
     290                 :            :         (fd)->simple.flc_lo = 0;     \
     291                 :            :         (fd)->simple.flc_hi = 0;     \
     292                 :            : } while (0)
     293                 :            : 
     294                 :            : #define DPAA2_SET_FD_FLC(fd, addr)      do { \
     295                 :            :         (fd)->simple.flc_lo = lower_32_bits((size_t)(addr)); \
     296                 :            :         (fd)->simple.flc_hi = upper_32_bits((uint64_t)(addr));       \
     297                 :            : } while (0)
     298                 :            : #define DPAA2_SET_FLE_INTERNAL_JD(fle, len) ((fle)->frc = (0x80000000 | (len)))
     299                 :            : #define DPAA2_GET_FLE_ADDR(fle)                                 \
     300                 :            :         (size_t)((((uint64_t)((fle)->addr_hi)) << 32) + (fle)->addr_lo)
     301                 :            : #define DPAA2_SET_FLE_ADDR(fle, addr) do { \
     302                 :            :         (fle)->addr_lo = lower_32_bits((size_t)addr);                \
     303                 :            :         (fle)->addr_hi = upper_32_bits((uint64_t)addr);              \
     304                 :            : } while (0)
     305                 :            : #define DPAA2_GET_FLE_CTXT(fle)                                 \
     306                 :            :         ((((uint64_t)((fle)->reserved[1])) << 32) + (fle)->reserved[0])
     307                 :            : #define DPAA2_FLE_SAVE_CTXT(fle, addr) do { \
     308                 :            :         (fle)->reserved[0] = lower_32_bits((size_t)addr);    \
     309                 :            :         (fle)->reserved[1] = upper_32_bits((uint64_t)addr);  \
     310                 :            : } while (0)
     311                 :            : #define DPAA2_SET_FLE_OFFSET(fle, offset) \
     312                 :            :         ((fle)->fin_bpid_offset |= (uint32_t)(offset) << 16)
     313                 :            : #define DPAA2_SET_FLE_LEN(fle, len)    ((fle)->length = len)
     314                 :            : #define DPAA2_SET_FLE_BPID(fle, bpid) ((fle)->fin_bpid_offset |= (size_t)bpid)
     315                 :            : #define DPAA2_GET_FLE_BPID(fle) ((fle)->fin_bpid_offset & 0x000000ff)
     316                 :            : #define DPAA2_SET_FLE_FIN(fle)  ((fle)->fin_bpid_offset |= 1 << 31)
     317                 :            : #define DPAA2_SET_FLE_IVP(fle)   (((fle)->fin_bpid_offset |= 0x00004000))
     318                 :            : #define DPAA2_SET_FLE_BMT(fle)   (((fle)->fin_bpid_offset |= 0x00008000))
     319                 :            : #define DPAA2_SET_FD_COMPOUND_FMT(fd)   \
     320                 :            :         ((fd)->simple.bpid_offset |= (uint32_t)1 << 28)
     321                 :            : #define DPAA2_GET_FD_ADDR(fd)   \
     322                 :            : (((((uint64_t)((fd)->simple.addr_hi)) << 32) + (fd)->simple.addr_lo))
     323                 :            : 
     324                 :            : #define DPAA2_GET_FD_LEN(fd)    ((fd)->simple.len)
     325                 :            : #define DPAA2_GET_FD_BPID(fd)   (((fd)->simple.bpid_offset & 0x00003FFF))
     326                 :            : #define DPAA2_GET_FD_IVP(fd)   (((fd)->simple.bpid_offset & 0x00004000) >> 14)
     327                 :            : #define DPAA2_GET_FD_OFFSET(fd) (((fd)->simple.bpid_offset & 0x0FFF0000) >> 16)
     328                 :            : #define DPAA2_GET_FD_FRC(fd)   ((fd)->simple.frc)
     329                 :            : #define DPAA2_GET_FD_FLC(fd) \
     330                 :            :         (((uint64_t)((fd)->simple.flc_hi) << 32) + (fd)->simple.flc_lo)
     331                 :            : #define DPAA2_GET_FD_ERR(fd)   ((fd)->simple.ctrl & 0x000000FF)
     332                 :            : #define DPAA2_GET_FD_FA_ERR(fd)   ((fd)->simple.ctrl & 0x00000040)
     333                 :            : #define DPAA2_GET_FLE_OFFSET(fle) (((fle)->fin_bpid_offset & 0x0FFF0000) >> 16)
     334                 :            : #define DPAA2_SET_FLE_SG_EXT(fle) ((fle)->fin_bpid_offset |= (uint64_t)1 << 29)
     335                 :            : #define DPAA2_IS_SET_FLE_SG_EXT(fle)    \
     336                 :            :         (((fle)->fin_bpid_offset & ((uint64_t)1 << 29)) ? 1 : 0)
     337                 :            : 
     338                 :            : #define DPAA2_INLINE_MBUF_FROM_BUF(buf, meta_data_size) \
     339                 :            :         ((struct rte_mbuf *)((size_t)(buf) - (meta_data_size)))
     340                 :            : 
     341                 :            : #define DPAA2_ASAL_VAL (DPAA2_MBUF_HW_ANNOTATION / 64)
     342                 :            : 
     343                 :            : #define DPAA2_FD_SET_FORMAT(fd, format) do {                            \
     344                 :            :                 (fd)->simple.bpid_offset &= 0xCFFFFFFF;                  \
     345                 :            :                 (fd)->simple.bpid_offset |= (uint32_t)format << 28;    \
     346                 :            : } while (0)
     347                 :            : #define DPAA2_FD_GET_FORMAT(fd) (((fd)->simple.bpid_offset >> 28) & 0x3)
     348                 :            : 
     349                 :            : #define DPAA2_SG_SET_FORMAT(sg, format) do {                            \
     350                 :            :                 (sg)->fin_bpid_offset &= 0xCFFFFFFF;                     \
     351                 :            :                 (sg)->fin_bpid_offset |= (uint32_t)format << 28;       \
     352                 :            : } while (0)
     353                 :            : 
     354                 :            : #define DPAA2_SG_SET_FINAL(sg, fin)     do {                            \
     355                 :            :                 (sg)->fin_bpid_offset &= 0x7FFFFFFF;                     \
     356                 :            :                 (sg)->fin_bpid_offset |= (uint32_t)fin << 31;          \
     357                 :            : } while (0)
     358                 :            : #define DPAA2_SG_IS_FINAL(sg) (!!((sg)->fin_bpid_offset >> 31))
     359                 :            : /* Only Enqueue Error responses will be
     360                 :            :  * pushed on FQID_ERR of Enqueue FQ
     361                 :            :  */
     362                 :            : #define DPAA2_EQ_RESP_ERR_FQ            0
     363                 :            : /* All Enqueue responses will be pushed on address
     364                 :            :  * set with qbman_eq_desc_set_response
     365                 :            :  */
     366                 :            : #define DPAA2_EQ_RESP_ALWAYS            1
     367                 :            : 
     368                 :            : /* Various structures representing contiguous memory maps */
     369                 :            : struct dpaa2_memseg {
     370                 :            :         TAILQ_ENTRY(dpaa2_memseg) next;
     371                 :            :         char *vaddr;
     372                 :            :         rte_iova_t iova;
     373                 :            :         size_t len;
     374                 :            : };
     375                 :            : 
     376                 :            : #ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA
     377                 :            : extern uint8_t dpaa2_virt_mode;
     378                 :            : static void *dpaa2_mem_ptov(phys_addr_t paddr) __rte_unused;
     379                 :            : 
     380                 :          0 : static void *dpaa2_mem_ptov(phys_addr_t paddr)
     381                 :            : {
     382                 :            :         void *va;
     383                 :            : 
     384         [ #  # ]:          0 :         if (dpaa2_virt_mode)
     385                 :          0 :                 return (void *)(size_t)paddr;
     386                 :            : 
     387                 :          0 :         va = (void *)dpaax_iova_table_get_va(paddr);
     388         [ #  # ]:          0 :         if (likely(va != NULL))
     389                 :            :                 return va;
     390                 :            : 
     391                 :            :         /* If not, Fallback to full memseg list searching */
     392                 :          0 :         va = rte_mem_iova2virt(paddr);
     393                 :            : 
     394                 :          0 :         return va;
     395                 :            : }
     396                 :            : 
     397                 :            : static phys_addr_t dpaa2_mem_vtop(uint64_t vaddr) __rte_unused;
     398                 :            : 
     399                 :          0 : static phys_addr_t dpaa2_mem_vtop(uint64_t vaddr)
     400                 :            : {
     401                 :            :         const struct rte_memseg *memseg;
     402                 :            : 
     403         [ #  # ]:          0 :         if (dpaa2_virt_mode)
     404                 :            :                 return vaddr;
     405                 :            : 
     406                 :          0 :         memseg = rte_mem_virt2memseg((void *)(uintptr_t)vaddr, NULL);
     407         [ #  # ]:          0 :         if (memseg)
     408                 :          0 :                 return memseg->iova + RTE_PTR_DIFF(vaddr, memseg->addr);
     409                 :            :         return (size_t)NULL;
     410                 :            : }
     411                 :            : 
     412                 :            : /**
     413                 :            :  * When we are using Physical addresses as IO Virtual Addresses,
     414                 :            :  * Need to call conversion routines dpaa2_mem_vtop & dpaa2_mem_ptov
     415                 :            :  * wherever required.
     416                 :            :  * These routines are called with help of below MACRO's
     417                 :            :  */
     418                 :            : 
     419                 :            : #define DPAA2_MBUF_VADDR_TO_IOVA(mbuf) ((mbuf)->buf_iova)
     420                 :            : 
     421                 :            : /**
     422                 :            :  * macro to convert Virtual address to IOVA
     423                 :            :  */
     424                 :            : #define DPAA2_VADDR_TO_IOVA(_vaddr) dpaa2_mem_vtop((size_t)(_vaddr))
     425                 :            : 
     426                 :            : /**
     427                 :            :  * macro to convert IOVA to Virtual address
     428                 :            :  */
     429                 :            : #define DPAA2_IOVA_TO_VADDR(_iova) dpaa2_mem_ptov((size_t)(_iova))
     430                 :            : 
     431                 :            : /**
     432                 :            :  * macro to convert modify the memory containing IOVA to Virtual address
     433                 :            :  */
     434                 :            : #define DPAA2_MODIFY_IOVA_TO_VADDR(_mem, _type) \
     435                 :            :         {_mem = (_type)(dpaa2_mem_ptov((size_t)(_mem))); }
     436                 :            : 
     437                 :            : #else   /* RTE_LIBRTE_DPAA2_USE_PHYS_IOVA */
     438                 :            : 
     439                 :            : #define DPAA2_MBUF_VADDR_TO_IOVA(mbuf) ((mbuf)->buf_addr)
     440                 :            : #define DPAA2_VADDR_TO_IOVA(_vaddr) (phys_addr_t)(_vaddr)
     441                 :            : #define DPAA2_IOVA_TO_VADDR(_iova) (void *)(_iova)
     442                 :            : #define DPAA2_MODIFY_IOVA_TO_VADDR(_mem, _type)
     443                 :            : 
     444                 :            : #endif /* RTE_LIBRTE_DPAA2_USE_PHYS_IOVA */
     445                 :            : 
     446                 :            : static inline
     447                 :            : int check_swp_active_dqs(uint16_t dpio_index)
     448                 :            : {
     449   [ #  #  #  #  :          0 :         if (rte_global_active_dqs_list[dpio_index].global_active_dqs != NULL)
             #  #  #  # ]
     450                 :            :                 return 1;
     451                 :            :         return 0;
     452                 :            : }
     453                 :            : 
     454                 :            : static inline
     455                 :            : void clear_swp_active_dqs(uint16_t dpio_index)
     456                 :            : {
     457                 :          0 :         rte_global_active_dqs_list[dpio_index].global_active_dqs = NULL;
     458                 :          0 : }
     459                 :            : 
     460                 :            : static inline
     461                 :            : struct qbman_result *get_swp_active_dqs(uint16_t dpio_index)
     462                 :            : {
     463   [ #  #  #  # ]:          0 :         return rte_global_active_dqs_list[dpio_index].global_active_dqs;
     464                 :            : }
     465                 :            : 
     466                 :            : static inline
     467                 :            : void set_swp_active_dqs(uint16_t dpio_index, struct qbman_result *dqs)
     468                 :            : {
     469                 :          0 :         rte_global_active_dqs_list[dpio_index].global_active_dqs = dqs;
     470                 :          0 : }
     471                 :            : 
     472                 :            : __rte_internal
     473                 :            : struct dpaa2_dpbp_dev *dpaa2_alloc_dpbp_dev(void);
     474                 :            : 
     475                 :            : __rte_internal
     476                 :            : void dpaa2_free_dpbp_dev(struct dpaa2_dpbp_dev *dpbp);
     477                 :            : 
     478                 :            : __rte_internal
     479                 :            : int dpaa2_dpbp_supported(void);
     480                 :            : 
     481                 :            : __rte_internal
     482                 :            : struct dpaa2_dpci_dev *rte_dpaa2_alloc_dpci_dev(void);
     483                 :            : 
     484                 :            : __rte_internal
     485                 :            : void rte_dpaa2_free_dpci_dev(struct dpaa2_dpci_dev *dpci);
     486                 :            : 
     487                 :            : /* Global MCP pointer */
     488                 :            : __rte_internal
     489                 :            : void *dpaa2_get_mcp_ptr(int portal_idx);
     490                 :            : 
     491                 :            : #endif

Generated by: LCOV version 1.14