LCOV - code coverage report
Current view: top level - drivers/net/cnxk - cn9k_ethdev.c (source / functions) Hit Total Coverage
Test: Code coverage Lines: 1 322 0.3 %
Date: 2024-01-22 16:26:08 Functions: 1 22 4.5 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 186 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright(C) 2021 Marvell.
       3                 :            :  */
       4                 :            : #include "cn9k_ethdev.h"
       5                 :            : #include "cn9k_flow.h"
       6                 :            : #include "cn9k_rx.h"
       7                 :            : #include "cn9k_tx.h"
       8                 :            : 
       9                 :            : static uint16_t
      10         [ #  # ]:          0 : nix_rx_offload_flags(struct rte_eth_dev *eth_dev)
      11                 :            : {
      12                 :            :         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
      13                 :            :         struct rte_eth_dev_data *data = eth_dev->data;
      14                 :            :         struct rte_eth_conf *conf = &data->dev_conf;
      15                 :            :         struct rte_eth_rxmode *rxmode = &conf->rxmode;
      16                 :            :         uint16_t flags = 0;
      17                 :            : 
      18         [ #  # ]:          0 :         if (rxmode->mq_mode == RTE_ETH_MQ_RX_RSS &&
      19         [ #  # ]:          0 :             (dev->rx_offloads & RTE_ETH_RX_OFFLOAD_RSS_HASH))
      20                 :            :                 flags |= NIX_RX_OFFLOAD_RSS_F;
      21                 :            : 
      22         [ #  # ]:          0 :         if (dev->rx_offloads &
      23                 :            :             (RTE_ETH_RX_OFFLOAD_TCP_CKSUM | RTE_ETH_RX_OFFLOAD_UDP_CKSUM))
      24                 :          0 :                 flags |= NIX_RX_OFFLOAD_CHECKSUM_F;
      25                 :            : 
      26         [ #  # ]:          0 :         if (dev->rx_offloads &
      27                 :            :             (RTE_ETH_RX_OFFLOAD_IPV4_CKSUM | RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM))
      28                 :          0 :                 flags |= NIX_RX_OFFLOAD_CHECKSUM_F;
      29                 :            : 
      30         [ #  # ]:          0 :         if (dev->rx_offloads & RTE_ETH_RX_OFFLOAD_SCATTER)
      31                 :          0 :                 flags |= NIX_RX_MULTI_SEG_F;
      32                 :            : 
      33         [ #  # ]:          0 :         if ((dev->rx_offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP))
      34                 :          0 :                 flags |= NIX_RX_OFFLOAD_TSTAMP_F;
      35                 :            : 
      36         [ #  # ]:          0 :         if (!dev->ptype_disable)
      37                 :          0 :                 flags |= NIX_RX_OFFLOAD_PTYPE_F;
      38                 :            : 
      39         [ #  # ]:          0 :         if (dev->rx_offloads & RTE_ETH_RX_OFFLOAD_SECURITY)
      40                 :          0 :                 flags |= NIX_RX_OFFLOAD_SECURITY_F;
      41                 :            : 
      42                 :          0 :         return flags;
      43                 :            : }
      44                 :            : 
      45                 :            : static uint16_t
      46         [ #  # ]:          0 : nix_tx_offload_flags(struct rte_eth_dev *eth_dev)
      47                 :            : {
      48                 :            :         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
      49                 :          0 :         uint64_t conf = dev->tx_offloads;
      50                 :            :         struct roc_nix *nix = &dev->nix;
      51                 :            :         uint16_t flags = 0;
      52                 :            : 
      53                 :            :         /* Fastpath is dependent on these enums */
      54                 :            :         RTE_BUILD_BUG_ON(RTE_MBUF_F_TX_TCP_CKSUM != (1ULL << 52));
      55                 :            :         RTE_BUILD_BUG_ON(RTE_MBUF_F_TX_SCTP_CKSUM != (2ULL << 52));
      56                 :            :         RTE_BUILD_BUG_ON(RTE_MBUF_F_TX_UDP_CKSUM != (3ULL << 52));
      57                 :            :         RTE_BUILD_BUG_ON(RTE_MBUF_F_TX_IP_CKSUM != (1ULL << 54));
      58                 :            :         RTE_BUILD_BUG_ON(RTE_MBUF_F_TX_IPV4 != (1ULL << 55));
      59                 :            :         RTE_BUILD_BUG_ON(RTE_MBUF_F_TX_OUTER_IP_CKSUM != (1ULL << 58));
      60                 :            :         RTE_BUILD_BUG_ON(RTE_MBUF_F_TX_OUTER_IPV4 != (1ULL << 59));
      61                 :            :         RTE_BUILD_BUG_ON(RTE_MBUF_F_TX_OUTER_IPV6 != (1ULL << 60));
      62                 :            :         RTE_BUILD_BUG_ON(RTE_MBUF_F_TX_OUTER_UDP_CKSUM != (1ULL << 41));
      63                 :            :         RTE_BUILD_BUG_ON(RTE_MBUF_L2_LEN_BITS != 7);
      64                 :            :         RTE_BUILD_BUG_ON(RTE_MBUF_L3_LEN_BITS != 9);
      65                 :            :         RTE_BUILD_BUG_ON(RTE_MBUF_OUTL2_LEN_BITS != 7);
      66                 :            :         RTE_BUILD_BUG_ON(RTE_MBUF_OUTL3_LEN_BITS != 9);
      67                 :            :         RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_off) !=
      68                 :            :                          offsetof(struct rte_mbuf, buf_addr) + 16);
      69                 :            :         RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
      70                 :            :                          offsetof(struct rte_mbuf, buf_addr) + 24);
      71                 :            :         RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
      72                 :            :                          offsetof(struct rte_mbuf, ol_flags) + 12);
      73                 :            :         RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, tx_offload) !=
      74                 :            :                          offsetof(struct rte_mbuf, pool) + 2 * sizeof(void *));
      75                 :            : 
      76         [ #  # ]:          0 :         if (conf & RTE_ETH_TX_OFFLOAD_VLAN_INSERT ||
      77                 :            :             conf & RTE_ETH_TX_OFFLOAD_QINQ_INSERT)
      78                 :            :                 flags |= NIX_TX_OFFLOAD_VLAN_QINQ_F;
      79                 :            : 
      80         [ #  # ]:          0 :         if (conf & RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM ||
      81                 :            :             conf & RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM)
      82                 :          0 :                 flags |= NIX_TX_OFFLOAD_OL3_OL4_CSUM_F;
      83                 :            : 
      84                 :          0 :         if (conf & RTE_ETH_TX_OFFLOAD_IPV4_CKSUM ||
      85                 :            :             conf & RTE_ETH_TX_OFFLOAD_TCP_CKSUM ||
      86         [ #  # ]:          0 :             conf & RTE_ETH_TX_OFFLOAD_UDP_CKSUM || conf & RTE_ETH_TX_OFFLOAD_SCTP_CKSUM)
      87                 :          0 :                 flags |= NIX_TX_OFFLOAD_L3_L4_CSUM_F;
      88                 :            : 
      89         [ #  # ]:          0 :         if (!(conf & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE))
      90                 :          0 :                 flags |= NIX_TX_OFFLOAD_MBUF_NOFF_F;
      91                 :            : 
      92         [ #  # ]:          0 :         if (conf & RTE_ETH_TX_OFFLOAD_MULTI_SEGS)
      93                 :          0 :                 flags |= NIX_TX_MULTI_SEG_F;
      94                 :            : 
      95                 :            :         /* Enable Inner checksum for TSO */
      96         [ #  # ]:          0 :         if (conf & RTE_ETH_TX_OFFLOAD_TCP_TSO)
      97                 :          0 :                 flags |= (NIX_TX_OFFLOAD_TSO_F | NIX_TX_OFFLOAD_L3_L4_CSUM_F);
      98                 :            : 
      99                 :            :         /* Enable Inner and Outer checksum for Tunnel TSO */
     100         [ #  # ]:          0 :         if (conf & (RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO |
     101                 :            :                     RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO | RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO))
     102                 :          0 :                 flags |= (NIX_TX_OFFLOAD_TSO_F | NIX_TX_OFFLOAD_OL3_OL4_CSUM_F |
     103                 :            :                           NIX_TX_OFFLOAD_L3_L4_CSUM_F);
     104                 :            : 
     105         [ #  # ]:          0 :         if ((dev->rx_offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP))
     106                 :          0 :                 flags |= NIX_TX_OFFLOAD_TSTAMP_F;
     107                 :            : 
     108         [ #  # ]:          0 :         if (dev->tx_offloads & RTE_ETH_TX_OFFLOAD_SECURITY)
     109                 :          0 :                 flags |= NIX_TX_OFFLOAD_SECURITY_F;
     110                 :            : 
     111         [ #  # ]:          0 :         if (dev->tx_mark)
     112                 :          0 :                 flags |= NIX_TX_OFFLOAD_VLAN_QINQ_F;
     113                 :            : 
     114         [ #  # ]:          0 :         if (nix->tx_compl_ena)
     115                 :          0 :                 flags |= NIX_TX_OFFLOAD_MBUF_NOFF_F;
     116                 :            : 
     117                 :          0 :         return flags;
     118                 :            : }
     119                 :            : 
     120                 :            : static int
     121         [ #  # ]:          0 : cn9k_nix_ptypes_set(struct rte_eth_dev *eth_dev, uint32_t ptype_mask)
     122                 :            : {
     123                 :            :         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
     124                 :            : 
     125         [ #  # ]:          0 :         if (ptype_mask) {
     126                 :          0 :                 dev->rx_offload_flags |= NIX_RX_OFFLOAD_PTYPE_F;
     127                 :          0 :                 dev->ptype_disable = 0;
     128                 :            :         } else {
     129                 :          0 :                 dev->rx_offload_flags &= ~NIX_RX_OFFLOAD_PTYPE_F;
     130                 :          0 :                 dev->ptype_disable = 1;
     131                 :            :         }
     132                 :            : 
     133                 :          0 :         cn9k_eth_set_rx_function(eth_dev);
     134                 :          0 :         return 0;
     135                 :            : }
     136                 :            : 
     137                 :            : static void
     138                 :            : nix_form_default_desc(struct cnxk_eth_dev *dev, struct cn9k_eth_txq *txq,
     139                 :            :                       uint16_t qid)
     140                 :            : {
     141                 :            :         union nix_send_hdr_w0_u send_hdr_w0;
     142                 :            : 
     143                 :            :         /* Initialize the fields based on basic single segment packet */
     144                 :          0 :         send_hdr_w0.u = 0;
     145                 :          0 :         if (dev->tx_offload_flags & NIX_TX_NEED_EXT_HDR) {
     146                 :            :                 /* 2(HDR) + 2(EXT_HDR) + 1(SG) + 1(IOVA) = 6/2 - 1 = 2 */
     147                 :          0 :                 send_hdr_w0.sizem1 = 2;
     148   [ #  #  #  #  :          0 :                 if (dev->tx_offload_flags & NIX_TX_OFFLOAD_TSTAMP_F) {
                   #  # ]
     149                 :            :                         /* Default: one seg packet would have:
     150                 :            :                          * 2(HDR) + 2(EXT) + 1(SG) + 1(IOVA) + 2(MEM)
     151                 :            :                          * => 8/2 - 1 = 3
     152                 :            :                          */
     153                 :          0 :                         send_hdr_w0.sizem1 = 3;
     154                 :            : 
     155                 :            :                         /* To calculate the offset for send_mem,
     156                 :            :                          * send_hdr->w0.sizem1 * 2
     157                 :            :                          */
     158                 :          0 :                         txq->ts_mem = dev->tstamp.tx_tstamp_iova;
     159                 :            :                 }
     160                 :            :         } else {
     161                 :            :                 /* 2(HDR) + 1(SG) + 1(IOVA) = 4/2 - 1 = 1 */
     162                 :          0 :                 send_hdr_w0.sizem1 = 1;
     163                 :            :         }
     164                 :          0 :         send_hdr_w0.sq = qid;
     165                 :          0 :         txq->send_hdr_w0 = send_hdr_w0.u;
     166                 :            :         rte_wmb();
     167                 :            : }
     168                 :            : 
     169                 :            : static int
     170                 :          0 : cn9k_nix_tx_compl_setup(struct cnxk_eth_dev *dev,
     171                 :            :                 struct cn9k_eth_txq *txq,
     172                 :            :                 struct roc_nix_sq *sq, uint16_t nb_desc)
     173                 :            : {
     174                 :            :         struct roc_nix_cq *cq;
     175                 :            : 
     176                 :          0 :         cq = &dev->cqs[sq->cqid];
     177                 :          0 :         txq->tx_compl.desc_base = (uintptr_t)cq->desc_base;
     178                 :          0 :         txq->tx_compl.cq_door = cq->door;
     179                 :          0 :         txq->tx_compl.cq_status = cq->status;
     180                 :          0 :         txq->tx_compl.wdata = cq->wdata;
     181                 :          0 :         txq->tx_compl.head = cq->head;
     182                 :          0 :         txq->tx_compl.qmask = cq->qmask;
     183                 :            :         /* Total array size holding buffers is equal to
     184                 :            :          * number of entries in cq and sq
     185                 :            :          * max buffer in array = desc in cq + desc in sq
     186                 :            :          */
     187                 :          0 :         txq->tx_compl.nb_desc_mask = (2 * rte_align32pow2(nb_desc)) - 1;
     188                 :          0 :         txq->tx_compl.ena = true;
     189                 :            : 
     190                 :          0 :         txq->tx_compl.ptr = (struct rte_mbuf **)plt_zmalloc(txq->tx_compl.nb_desc_mask *
     191                 :            :                         sizeof(struct rte_mbuf *), 0);
     192         [ #  # ]:          0 :         if (!txq->tx_compl.ptr)
     193                 :          0 :                 return -1;
     194                 :            : 
     195                 :            :         return 0;
     196                 :            : }
     197                 :            : 
     198                 :            : static void
     199                 :          0 : cn9k_nix_tx_queue_release(struct rte_eth_dev *eth_dev, uint16_t qid)
     200                 :            : {
     201                 :            :         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
     202                 :            :         struct roc_nix *nix = &dev->nix;
     203                 :            :         struct cn9k_eth_txq *txq;
     204                 :            : 
     205                 :          0 :         cnxk_nix_tx_queue_release(eth_dev, qid);
     206                 :          0 :         txq = eth_dev->data->tx_queues[qid];
     207                 :            : 
     208         [ #  # ]:          0 :         if (nix->tx_compl_ena)
     209                 :          0 :                 plt_free(txq->tx_compl.ptr);
     210                 :          0 : }
     211                 :            : 
     212                 :            : static int
     213                 :          0 : cn9k_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
     214                 :            :                         uint16_t nb_desc, unsigned int socket,
     215                 :            :                         const struct rte_eth_txconf *tx_conf)
     216                 :            : {
     217                 :            :         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
     218                 :            :         struct roc_nix *nix = &dev->nix;
     219                 :            :         uint64_t mark_fmt, mark_flag;
     220                 :            :         struct roc_cpt_lf *inl_lf;
     221                 :            :         struct cn9k_eth_txq *txq;
     222                 :            :         struct roc_nix_sq *sq;
     223                 :            :         uint16_t crypto_qid;
     224                 :            :         int rc;
     225                 :            : 
     226                 :            :         RTE_SET_USED(socket);
     227                 :            : 
     228                 :            :         /* Common Tx queue setup */
     229                 :          0 :         rc = cnxk_nix_tx_queue_setup(eth_dev, qid, nb_desc,
     230                 :            :                                      sizeof(struct cn9k_eth_txq), tx_conf);
     231         [ #  # ]:          0 :         if (rc)
     232                 :            :                 return rc;
     233                 :            : 
     234                 :          0 :         sq = &dev->sqs[qid];
     235                 :            :         /* Update fast path queue */
     236                 :          0 :         txq = eth_dev->data->tx_queues[qid];
     237                 :          0 :         txq->fc_mem = sq->fc;
     238         [ #  # ]:          0 :         if (nix->tx_compl_ena) {
     239                 :          0 :                 rc = cn9k_nix_tx_compl_setup(dev, txq, sq, nb_desc);
     240         [ #  # ]:          0 :                 if (rc)
     241                 :            :                         return rc;
     242                 :            :         }
     243                 :          0 :         txq->lmt_addr = sq->lmt_addr;
     244                 :          0 :         txq->io_addr = sq->io_addr;
     245                 :          0 :         txq->nb_sqb_bufs_adj = sq->nb_sqb_bufs_adj;
     246                 :          0 :         txq->sqes_per_sqb_log2 = sq->sqes_per_sqb_log2;
     247                 :            : 
     248                 :            :         /* Fetch CPT LF info for outbound if present */
     249         [ #  # ]:          0 :         if (dev->outb.lf_base) {
     250                 :          0 :                 crypto_qid = qid % dev->outb.nb_crypto_qs;
     251                 :          0 :                 inl_lf = dev->outb.lf_base + crypto_qid;
     252                 :            : 
     253                 :          0 :                 txq->cpt_io_addr = inl_lf->io_addr;
     254                 :          0 :                 txq->cpt_fc = inl_lf->fc_addr;
     255                 :          0 :                 txq->cpt_desc = inl_lf->nb_desc * 0.7;
     256                 :          0 :                 txq->sa_base = (uint64_t)dev->outb.sa_base;
     257                 :          0 :                 txq->sa_base |= eth_dev->data->port_id;
     258                 :            :                 PLT_STATIC_ASSERT(BIT_ULL(16) == ROC_NIX_INL_SA_BASE_ALIGN);
     259                 :            :         }
     260                 :            : 
     261                 :          0 :         mark_fmt = roc_nix_tm_mark_format_get(&dev->nix, &mark_flag);
     262                 :          0 :         txq->mark_flag = mark_flag & CNXK_TM_MARK_MASK;
     263         [ #  # ]:          0 :         txq->mark_fmt = mark_fmt & CNXK_TX_MARK_FMT_MASK;
     264                 :            : 
     265                 :            :         nix_form_default_desc(dev, txq, qid);
     266                 :          0 :         txq->lso_tun_fmt = dev->lso_tun_fmt;
     267                 :          0 :         return 0;
     268                 :            : }
     269                 :            : 
     270                 :            : static int
     271         [ #  # ]:          0 : cn9k_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
     272                 :            :                         uint16_t nb_desc, unsigned int socket,
     273                 :            :                         const struct rte_eth_rxconf *rx_conf,
     274                 :            :                         struct rte_mempool *mp)
     275                 :            : {
     276                 :            :         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
     277                 :            :         struct cn9k_eth_rxq *rxq;
     278                 :            :         struct roc_nix_rq *rq;
     279                 :            :         struct roc_nix_cq *cq;
     280                 :            :         int rc;
     281                 :            : 
     282                 :            :         RTE_SET_USED(socket);
     283                 :            : 
     284                 :            :         /* CQ Errata needs min 4K ring */
     285         [ #  # ]:          0 :         if (dev->cq_min_4k && nb_desc < 4096)
     286                 :            :                 nb_desc = 4096;
     287                 :            : 
     288                 :            :         /* Common Rx queue setup */
     289                 :          0 :         rc = cnxk_nix_rx_queue_setup(eth_dev, qid, nb_desc,
     290                 :            :                                      sizeof(struct cn9k_eth_rxq), rx_conf, mp);
     291         [ #  # ]:          0 :         if (rc)
     292                 :            :                 return rc;
     293                 :            : 
     294                 :            :         /* Do initial mtu setup for RQ0 before device start */
     295         [ #  # ]:          0 :         if (!qid) {
     296                 :          0 :                 rc = nix_recalc_mtu(eth_dev);
     297         [ #  # ]:          0 :                 if (rc)
     298                 :            :                         return rc;
     299                 :            : 
     300                 :            :                 /* Update offload flags */
     301                 :          0 :                 dev->rx_offload_flags = nix_rx_offload_flags(eth_dev);
     302                 :          0 :                 dev->tx_offload_flags = nix_tx_offload_flags(eth_dev);
     303                 :            :         }
     304                 :            : 
     305                 :          0 :         rq = &dev->rqs[qid];
     306                 :          0 :         cq = &dev->cqs[qid];
     307                 :            : 
     308                 :            :         /* Update fast path queue */
     309                 :          0 :         rxq = eth_dev->data->rx_queues[qid];
     310                 :          0 :         rxq->rq = qid;
     311                 :          0 :         rxq->desc = (uintptr_t)cq->desc_base;
     312                 :          0 :         rxq->cq_door = cq->door;
     313                 :          0 :         rxq->cq_status = cq->status;
     314                 :          0 :         rxq->wdata = cq->wdata;
     315                 :          0 :         rxq->head = cq->head;
     316                 :          0 :         rxq->qmask = cq->qmask;
     317                 :          0 :         rxq->tstamp = &dev->tstamp;
     318                 :            : 
     319                 :            :         /* Data offset from data to start of mbuf is first_skip */
     320                 :          0 :         rxq->data_off = rq->first_skip;
     321                 :          0 :         rxq->mbuf_initializer = cnxk_nix_rxq_mbuf_setup(dev);
     322                 :            : 
     323                 :            :         /* Lookup mem */
     324                 :          0 :         rxq->lookup_mem = cnxk_nix_fastpath_lookup_mem_get();
     325                 :          0 :         return 0;
     326                 :            : }
     327                 :            : 
     328                 :            : static int
     329                 :          0 : cn9k_nix_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qidx)
     330                 :            : {
     331                 :          0 :         struct cn9k_eth_txq *txq = eth_dev->data->tx_queues[qidx];
     332                 :            :         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
     333                 :          0 :         uint16_t flags = dev->tx_offload_flags;
     334                 :          0 :         struct roc_nix *nix = &dev->nix;
     335                 :          0 :         uint32_t head = 0, tail = 0;
     336                 :            :         int rc;
     337                 :            : 
     338                 :            : 
     339                 :          0 :         rc = cnxk_nix_tx_queue_stop(eth_dev, qidx);
     340         [ #  # ]:          0 :         if (rc)
     341                 :            :                 return rc;
     342                 :            : 
     343                 :            :         /* Clear fc cache pkts to trigger worker stop */
     344                 :          0 :         txq->fc_cache_pkts = 0;
     345                 :            : 
     346   [ #  #  #  # ]:          0 :         if ((flags & NIX_TX_OFFLOAD_MBUF_NOFF_F) && txq->tx_compl.ena) {
     347                 :          0 :                 struct roc_nix_sq *sq = &dev->sqs[qidx];
     348                 :            :                 do {
     349                 :          0 :                         handle_tx_completion_pkts(txq, 0);
     350                 :          0 :                         roc_nix_sq_head_tail_get(nix, sq->qid, &head, &tail);
     351         [ #  # ]:          0 :                 } while (head != tail);
     352                 :            :         }
     353                 :            : 
     354                 :            :         return 0;
     355                 :            : }
     356                 :            : 
     357                 :            : static int
     358         [ #  # ]:          0 : cn9k_nix_configure(struct rte_eth_dev *eth_dev)
     359                 :            : {
     360                 :            :         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
     361                 :            :         struct rte_eth_conf *conf = &eth_dev->data->dev_conf;
     362                 :            :         struct rte_eth_txmode *txmode = &conf->txmode;
     363                 :            :         int rc;
     364                 :            : 
     365                 :            :         /* Platform specific checks */
     366   [ #  #  #  # ]:          0 :         if ((roc_model_is_cn96_a0() || roc_model_is_cn95_a0()) &&
     367         [ #  # ]:          0 :             (txmode->offloads & RTE_ETH_TX_OFFLOAD_SCTP_CKSUM) &&
     368         [ #  # ]:          0 :             ((txmode->offloads & RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM) ||
     369                 :            :              (txmode->offloads & RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM))) {
     370                 :          0 :                 plt_err("Outer IP and SCTP checksum unsupported");
     371                 :          0 :                 return -EINVAL;
     372                 :            :         }
     373                 :            : 
     374                 :            :         /* Common nix configure */
     375                 :          0 :         rc = cnxk_nix_configure(eth_dev);
     376         [ #  # ]:          0 :         if (rc)
     377                 :            :                 return rc;
     378                 :            : 
     379                 :            :         /* Update offload flags */
     380                 :          0 :         dev->rx_offload_flags = nix_rx_offload_flags(eth_dev);
     381                 :          0 :         dev->tx_offload_flags = nix_tx_offload_flags(eth_dev);
     382                 :            : 
     383                 :          0 :         plt_nix_dbg("Configured port%d platform specific rx_offload_flags=%x"
     384                 :            :                     " tx_offload_flags=0x%x",
     385                 :            :                     eth_dev->data->port_id, dev->rx_offload_flags,
     386                 :            :                     dev->tx_offload_flags);
     387                 :          0 :         return 0;
     388                 :            : }
     389                 :            : 
     390                 :            : /* Function to enable ptp config for VFs */
     391                 :            : static void
     392                 :          0 : nix_ptp_enable_vf(struct rte_eth_dev *eth_dev)
     393                 :            : {
     394                 :            :         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
     395                 :            : 
     396         [ #  # ]:          0 :         if (nix_recalc_mtu(eth_dev))
     397                 :          0 :                 plt_err("Failed to set MTU size for ptp");
     398                 :            : 
     399                 :          0 :         dev->rx_offload_flags |= NIX_RX_OFFLOAD_TSTAMP_F;
     400                 :            : 
     401                 :            :         /* Setting up the function pointers as per new offload flags */
     402                 :          0 :         cn9k_eth_set_rx_function(eth_dev);
     403                 :          0 :         cn9k_eth_set_tx_function(eth_dev);
     404                 :          0 : }
     405                 :            : 
     406                 :            : static uint16_t
     407                 :          0 : nix_ptp_vf_burst(void *queue, struct rte_mbuf **mbufs, uint16_t pkts)
     408                 :            : {
     409                 :            :         struct cn9k_eth_rxq *rxq = queue;
     410                 :            :         struct cnxk_eth_rxq_sp *rxq_sp;
     411                 :            :         struct rte_eth_dev *eth_dev;
     412                 :            : 
     413                 :            :         RTE_SET_USED(mbufs);
     414                 :            :         RTE_SET_USED(pkts);
     415                 :            : 
     416                 :            :         rxq_sp = cnxk_eth_rxq_to_sp(rxq);
     417                 :          0 :         eth_dev = rxq_sp->dev->eth_dev;
     418                 :          0 :         nix_ptp_enable_vf(eth_dev);
     419                 :            : 
     420                 :          0 :         return 0;
     421                 :            : }
     422                 :            : 
     423                 :            : static int
     424                 :          0 : cn9k_nix_ptp_info_update_cb(struct roc_nix *nix, bool ptp_en)
     425                 :            : {
     426                 :            :         struct cnxk_eth_dev *dev = (struct cnxk_eth_dev *)nix;
     427                 :            :         struct rte_eth_dev *eth_dev;
     428                 :            :         struct cn9k_eth_rxq *rxq;
     429                 :            :         int i;
     430                 :            : 
     431         [ #  # ]:          0 :         if (!dev)
     432                 :            :                 return -EINVAL;
     433                 :            : 
     434                 :          0 :         eth_dev = dev->eth_dev;
     435         [ #  # ]:          0 :         if (!eth_dev)
     436                 :            :                 return -EINVAL;
     437                 :            : 
     438                 :          0 :         dev->ptp_en = ptp_en;
     439                 :            : 
     440         [ #  # ]:          0 :         for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
     441                 :          0 :                 rxq = eth_dev->data->rx_queues[i];
     442                 :          0 :                 rxq->mbuf_initializer = cnxk_nix_rxq_mbuf_setup(dev);
     443                 :            :         }
     444                 :            : 
     445   [ #  #  #  #  :          0 :         if (roc_nix_is_vf_or_sdp(nix) && !(roc_nix_is_sdp(nix)) &&
                   #  # ]
     446                 :          0 :             !(roc_nix_is_lbk(nix))) {
     447                 :            :                 /* In case of VF, setting of MTU cannot be done directly in this
     448                 :            :                  * function as this is running as part of MBOX request(PF->VF)
     449                 :            :                  * and MTU setting also requires MBOX message to be
     450                 :            :                  * sent(VF->PF)
     451                 :            :                  */
     452                 :          0 :                 eth_dev->rx_pkt_burst = nix_ptp_vf_burst;
     453                 :            :                 rte_mb();
     454                 :            :         }
     455                 :            : 
     456                 :            :         return 0;
     457                 :            : }
     458                 :            : 
     459                 :            : static int
     460                 :          0 : cn9k_nix_timesync_enable(struct rte_eth_dev *eth_dev)
     461                 :            : {
     462                 :            :         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
     463                 :            :         int i, rc;
     464                 :            : 
     465                 :          0 :         rc = cnxk_nix_timesync_enable(eth_dev);
     466         [ #  # ]:          0 :         if (rc)
     467                 :            :                 return rc;
     468                 :            : 
     469                 :          0 :         dev->rx_offload_flags |= NIX_RX_OFFLOAD_TSTAMP_F;
     470                 :          0 :         dev->tx_offload_flags |= NIX_TX_OFFLOAD_TSTAMP_F;
     471                 :            : 
     472         [ #  # ]:          0 :         for (i = 0; i < eth_dev->data->nb_tx_queues; i++)
     473         [ #  # ]:          0 :                 nix_form_default_desc(dev, eth_dev->data->tx_queues[i], i);
     474                 :            : 
     475                 :            :         /* Setting up the rx[tx]_offload_flags due to change
     476                 :            :          * in rx[tx]_offloads.
     477                 :            :          */
     478                 :          0 :         cn9k_eth_set_rx_function(eth_dev);
     479                 :          0 :         cn9k_eth_set_tx_function(eth_dev);
     480                 :          0 :         return 0;
     481                 :            : }
     482                 :            : 
     483                 :            : static int
     484                 :          0 : cn9k_nix_timesync_disable(struct rte_eth_dev *eth_dev)
     485                 :            : {
     486                 :            :         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
     487                 :            :         int i, rc;
     488                 :            : 
     489                 :          0 :         rc = cnxk_nix_timesync_disable(eth_dev);
     490         [ #  # ]:          0 :         if (rc)
     491                 :            :                 return rc;
     492                 :            : 
     493                 :          0 :         dev->rx_offload_flags &= ~NIX_RX_OFFLOAD_TSTAMP_F;
     494                 :          0 :         dev->tx_offload_flags &= ~NIX_TX_OFFLOAD_TSTAMP_F;
     495                 :            : 
     496         [ #  # ]:          0 :         for (i = 0; i < eth_dev->data->nb_tx_queues; i++)
     497         [ #  # ]:          0 :                 nix_form_default_desc(dev, eth_dev->data->tx_queues[i], i);
     498                 :            : 
     499                 :            :         /* Setting up the rx[tx]_offload_flags due to change
     500                 :            :          * in rx[tx]_offloads.
     501                 :            :          */
     502                 :          0 :         cn9k_eth_set_rx_function(eth_dev);
     503                 :          0 :         cn9k_eth_set_tx_function(eth_dev);
     504                 :          0 :         return 0;
     505                 :            : }
     506                 :            : 
     507                 :            : static int
     508                 :          0 : cn9k_nix_dev_start(struct rte_eth_dev *eth_dev)
     509                 :            : {
     510                 :            :         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
     511                 :          0 :         struct roc_nix *nix = &dev->nix;
     512                 :            :         int rc;
     513                 :            : 
     514                 :            :         /* Common eth dev start */
     515                 :          0 :         rc = cnxk_nix_dev_start(eth_dev);
     516         [ #  # ]:          0 :         if (rc)
     517                 :            :                 return rc;
     518                 :            : 
     519                 :            :         /* Update VF about data off shifted by 8 bytes if PTP already
     520                 :            :          * enabled in PF owning this VF
     521                 :            :          */
     522   [ #  #  #  #  :          0 :         if (dev->ptp_en && (!roc_nix_is_pf(nix) && (!roc_nix_is_sdp(nix))))
                   #  # ]
     523                 :          0 :                 nix_ptp_enable_vf(eth_dev);
     524                 :            : 
     525                 :            :         /* Setting up the rx[tx]_offload_flags due to change
     526                 :            :          * in rx[tx]_offloads.
     527                 :            :          */
     528                 :          0 :         dev->rx_offload_flags |= nix_rx_offload_flags(eth_dev);
     529                 :          0 :         dev->tx_offload_flags |= nix_tx_offload_flags(eth_dev);
     530                 :            : 
     531                 :          0 :         cn9k_eth_set_tx_function(eth_dev);
     532                 :          0 :         cn9k_eth_set_rx_function(eth_dev);
     533                 :          0 :         return 0;
     534                 :            : }
     535                 :            : 
     536                 :            : static int
     537         [ #  # ]:          0 : cn9k_nix_timesync_read_tx_timestamp(struct rte_eth_dev *eth_dev,
     538                 :            :                                     struct timespec *timestamp)
     539                 :            : {
     540                 :            :         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
     541                 :            :         struct cnxk_timesync_info *tstamp = &dev->tstamp;
     542                 :            :         uint64_t ns;
     543                 :            : 
     544         [ #  # ]:          0 :         if (*tstamp->tx_tstamp == 0)
     545                 :            :                 return -EINVAL;
     546                 :            : 
     547                 :            :         ns = rte_timecounter_update(&dev->tx_tstamp_tc, *tstamp->tx_tstamp);
     548                 :          0 :         *timestamp = rte_ns_to_timespec(ns);
     549                 :          0 :         *tstamp->tx_tstamp = 0;
     550                 :            :         rte_wmb();
     551                 :            : 
     552                 :          0 :         return 0;
     553                 :            : }
     554                 :            : 
     555                 :            : static int
     556                 :          0 : cn9k_nix_tm_mark_vlan_dei(struct rte_eth_dev *eth_dev, int mark_green,
     557                 :            :                           int mark_yellow, int mark_red,
     558                 :            :                           struct rte_tm_error *error)
     559                 :            : {
     560                 :            :         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
     561                 :          0 :         struct roc_nix *roc_nix = &dev->nix;
     562                 :            :         uint64_t mark_fmt, mark_flag;
     563                 :            :         int rc, i;
     564                 :            : 
     565                 :          0 :         rc = cnxk_nix_tm_mark_vlan_dei(eth_dev, mark_green, mark_yellow,
     566                 :            :                                        mark_red, error);
     567                 :            : 
     568         [ #  # ]:          0 :         if (rc)
     569                 :          0 :                 goto exit;
     570                 :            : 
     571                 :          0 :         mark_fmt = roc_nix_tm_mark_format_get(roc_nix, &mark_flag);
     572         [ #  # ]:          0 :         if (mark_flag) {
     573                 :          0 :                 dev->tx_offload_flags |= NIX_TX_OFFLOAD_VLAN_QINQ_F;
     574                 :          0 :                 dev->tx_mark = true;
     575                 :            :         } else {
     576                 :          0 :                 dev->tx_mark = false;
     577         [ #  # ]:          0 :                 if (!(dev->tx_offloads & RTE_ETH_TX_OFFLOAD_VLAN_INSERT ||
     578                 :            :                       dev->tx_offloads & RTE_ETH_TX_OFFLOAD_QINQ_INSERT))
     579                 :          0 :                         dev->tx_offload_flags &= ~NIX_TX_OFFLOAD_VLAN_QINQ_F;
     580                 :            :         }
     581                 :            : 
     582         [ #  # ]:          0 :         for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
     583                 :          0 :                 struct cn9k_eth_txq *txq = eth_dev->data->tx_queues[i];
     584                 :            : 
     585                 :          0 :                 txq->mark_flag = mark_flag & CNXK_TM_MARK_MASK;
     586                 :          0 :                 txq->mark_fmt = mark_fmt & CNXK_TX_MARK_FMT_MASK;
     587                 :            :         }
     588                 :          0 :         cn9k_eth_set_tx_function(eth_dev);
     589                 :          0 : exit:
     590                 :          0 :         return rc;
     591                 :            : }
     592                 :            : 
     593                 :            : static int
     594                 :          0 : cn9k_nix_tm_mark_ip_ecn(struct rte_eth_dev *eth_dev, int mark_green,
     595                 :            :                         int mark_yellow, int mark_red,
     596                 :            :                         struct rte_tm_error *error)
     597                 :            : {
     598                 :            :         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
     599                 :          0 :         struct roc_nix *roc_nix = &dev->nix;
     600                 :            :         uint64_t mark_fmt, mark_flag;
     601                 :            :         int rc, i;
     602                 :            : 
     603                 :          0 :         rc = cnxk_nix_tm_mark_ip_ecn(eth_dev, mark_green, mark_yellow, mark_red,
     604                 :            :                                      error);
     605         [ #  # ]:          0 :         if (rc)
     606                 :          0 :                 goto exit;
     607                 :            : 
     608                 :          0 :         mark_fmt = roc_nix_tm_mark_format_get(roc_nix, &mark_flag);
     609         [ #  # ]:          0 :         if (mark_flag) {
     610                 :          0 :                 dev->tx_offload_flags |= NIX_TX_OFFLOAD_VLAN_QINQ_F;
     611                 :          0 :                 dev->tx_mark = true;
     612                 :            :         } else {
     613                 :          0 :                 dev->tx_mark = false;
     614         [ #  # ]:          0 :                 if (!(dev->tx_offloads & RTE_ETH_TX_OFFLOAD_VLAN_INSERT ||
     615                 :            :                       dev->tx_offloads & RTE_ETH_TX_OFFLOAD_QINQ_INSERT))
     616                 :          0 :                         dev->tx_offload_flags &= ~NIX_TX_OFFLOAD_VLAN_QINQ_F;
     617                 :            :         }
     618                 :            : 
     619         [ #  # ]:          0 :         for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
     620                 :          0 :                 struct cn9k_eth_txq *txq = eth_dev->data->tx_queues[i];
     621                 :            : 
     622                 :          0 :                 txq->mark_flag = mark_flag & CNXK_TM_MARK_MASK;
     623                 :          0 :                 txq->mark_fmt = mark_fmt & CNXK_TX_MARK_FMT_MASK;
     624                 :            :         }
     625                 :          0 :         cn9k_eth_set_tx_function(eth_dev);
     626                 :          0 : exit:
     627                 :          0 :         return rc;
     628                 :            : }
     629                 :            : 
     630                 :            : static int
     631                 :          0 : cn9k_nix_tm_mark_ip_dscp(struct rte_eth_dev *eth_dev, int mark_green,
     632                 :            :                          int mark_yellow, int mark_red,
     633                 :            :                          struct rte_tm_error *error)
     634                 :            : {
     635                 :            :         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
     636                 :          0 :         struct roc_nix *roc_nix = &dev->nix;
     637                 :            :         uint64_t mark_fmt, mark_flag;
     638                 :            :         int rc, i;
     639                 :            : 
     640                 :          0 :         rc = cnxk_nix_tm_mark_ip_dscp(eth_dev, mark_green, mark_yellow,
     641                 :            :                                       mark_red, error);
     642         [ #  # ]:          0 :         if (rc)
     643                 :          0 :                 goto exit;
     644                 :            : 
     645                 :          0 :         mark_fmt = roc_nix_tm_mark_format_get(roc_nix, &mark_flag);
     646         [ #  # ]:          0 :         if (mark_flag) {
     647                 :          0 :                 dev->tx_offload_flags |= NIX_TX_OFFLOAD_VLAN_QINQ_F;
     648                 :          0 :                 dev->tx_mark = true;
     649                 :            :         } else {
     650                 :          0 :                 dev->tx_mark = false;
     651         [ #  # ]:          0 :                 if (!(dev->tx_offloads & RTE_ETH_TX_OFFLOAD_VLAN_INSERT ||
     652                 :            :                       dev->tx_offloads & RTE_ETH_TX_OFFLOAD_QINQ_INSERT))
     653                 :          0 :                         dev->tx_offload_flags &= ~NIX_TX_OFFLOAD_VLAN_QINQ_F;
     654                 :            :         }
     655                 :            : 
     656         [ #  # ]:          0 :         for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
     657                 :          0 :                 struct cn9k_eth_txq *txq = eth_dev->data->tx_queues[i];
     658                 :            : 
     659                 :          0 :                 txq->mark_flag = mark_flag & CNXK_TM_MARK_MASK;
     660                 :          0 :                 txq->mark_fmt = mark_fmt & CNXK_TX_MARK_FMT_MASK;
     661                 :            :         }
     662                 :          0 :         cn9k_eth_set_tx_function(eth_dev);
     663                 :          0 : exit:
     664                 :          0 :         return rc;
     665                 :            : }
     666                 :            : 
     667                 :            : /* Update platform specific eth dev ops */
     668                 :            : static void
     669                 :            : nix_eth_dev_ops_override(void)
     670                 :            : {
     671                 :            :         static int init_once;
     672                 :            : 
     673         [ #  # ]:          0 :         if (init_once)
     674                 :            :                 return;
     675                 :          0 :         init_once = 1;
     676                 :            : 
     677                 :            :         /* Update platform specific ops */
     678                 :          0 :         cnxk_eth_dev_ops.dev_configure = cn9k_nix_configure;
     679                 :          0 :         cnxk_eth_dev_ops.tx_queue_setup = cn9k_nix_tx_queue_setup;
     680                 :          0 :         cnxk_eth_dev_ops.tx_queue_release = cn9k_nix_tx_queue_release;
     681                 :          0 :         cnxk_eth_dev_ops.rx_queue_setup = cn9k_nix_rx_queue_setup;
     682                 :          0 :         cnxk_eth_dev_ops.tx_queue_stop = cn9k_nix_tx_queue_stop;
     683                 :          0 :         cnxk_eth_dev_ops.dev_start = cn9k_nix_dev_start;
     684                 :          0 :         cnxk_eth_dev_ops.dev_ptypes_set = cn9k_nix_ptypes_set;
     685                 :          0 :         cnxk_eth_dev_ops.timesync_enable = cn9k_nix_timesync_enable;
     686                 :          0 :         cnxk_eth_dev_ops.timesync_disable = cn9k_nix_timesync_disable;
     687                 :          0 :         cnxk_eth_dev_ops.mtr_ops_get = NULL;
     688                 :          0 :         cnxk_eth_dev_ops.timesync_read_tx_timestamp =
     689                 :            :                 cn9k_nix_timesync_read_tx_timestamp;
     690                 :            : }
     691                 :            : 
     692                 :            : /* Update platform specific eth dev ops */
     693                 :            : static void
     694                 :            : nix_tm_ops_override(void)
     695                 :            : {
     696                 :            :         static int init_once;
     697                 :            : 
     698         [ #  # ]:          0 :         if (init_once)
     699                 :            :                 return;
     700                 :          0 :         init_once = 1;
     701                 :            : 
     702                 :            :         /* Update platform specific ops */
     703                 :          0 :         cnxk_tm_ops.mark_vlan_dei = cn9k_nix_tm_mark_vlan_dei;
     704                 :          0 :         cnxk_tm_ops.mark_ip_ecn = cn9k_nix_tm_mark_ip_ecn;
     705                 :          0 :         cnxk_tm_ops.mark_ip_dscp = cn9k_nix_tm_mark_ip_dscp;
     706                 :            : }
     707                 :            : 
     708                 :            : static void
     709                 :            : npc_flow_ops_override(void)
     710                 :            : {
     711                 :            :         static int init_once;
     712                 :            : 
     713         [ #  # ]:          0 :         if (init_once)
     714                 :            :                 return;
     715                 :          0 :         init_once = 1;
     716                 :            : 
     717                 :            :         /* Update platform specific ops */
     718                 :          0 :         cnxk_flow_ops.create = cn9k_flow_create;
     719                 :          0 :         cnxk_flow_ops.destroy = cn9k_flow_destroy;
     720                 :          0 :         cnxk_flow_ops.info_get = cn9k_flow_info_get;
     721                 :            : }
     722                 :            : 
     723                 :            : static int
     724                 :          0 : cn9k_nix_remove(struct rte_pci_device *pci_dev)
     725                 :            : {
     726                 :          0 :         return cnxk_nix_remove(pci_dev);
     727                 :            : }
     728                 :            : 
     729                 :            : static int
     730                 :          0 : cn9k_nix_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
     731                 :            : {
     732                 :            :         struct rte_eth_dev *eth_dev;
     733                 :            :         struct cnxk_eth_dev *dev;
     734                 :            :         int rc;
     735                 :            : 
     736                 :          0 :         rc = roc_plt_init();
     737         [ #  # ]:          0 :         if (rc) {
     738                 :          0 :                 plt_err("Failed to initialize platform model, rc=%d", rc);
     739                 :          0 :                 return rc;
     740                 :            :         }
     741                 :            : 
     742                 :            :         nix_eth_dev_ops_override();
     743                 :            :         nix_tm_ops_override();
     744                 :            :         npc_flow_ops_override();
     745                 :            : 
     746                 :          0 :         cn9k_eth_sec_ops_override();
     747                 :            : 
     748                 :            :         /* Common probe */
     749                 :          0 :         rc = cnxk_nix_probe(pci_drv, pci_dev);
     750         [ #  # ]:          0 :         if (rc)
     751                 :            :                 return rc;
     752                 :            : 
     753                 :            :         /* Find eth dev allocated */
     754                 :          0 :         eth_dev = rte_eth_dev_allocated(pci_dev->device.name);
     755         [ #  # ]:          0 :         if (!eth_dev) {
     756                 :            :                 /* Ignore if ethdev is in mid of detach state in secondary */
     757         [ #  # ]:          0 :                 if (rte_eal_process_type() != RTE_PROC_PRIMARY)
     758                 :            :                         return 0;
     759                 :          0 :                 return -ENOENT;
     760                 :            :         }
     761                 :            : 
     762         [ #  # ]:          0 :         if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
     763                 :            :                 /* Setup callbacks for secondary process */
     764                 :          0 :                 cn9k_eth_set_tx_function(eth_dev);
     765                 :          0 :                 cn9k_eth_set_rx_function(eth_dev);
     766                 :          0 :                 return 0;
     767                 :            :         }
     768                 :            : 
     769                 :            :         dev = cnxk_eth_pmd_priv(eth_dev);
     770                 :            :         /* Update capabilities already set for TSO.
     771                 :            :          * TSO not supported for earlier chip revisions
     772                 :            :          */
     773   [ #  #  #  # ]:          0 :         if (roc_model_is_cn96_a0() || roc_model_is_cn95_a0())
     774                 :          0 :                 dev->tx_offload_capa &= ~(RTE_ETH_TX_OFFLOAD_TCP_TSO |
     775                 :            :                                           RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO |
     776                 :            :                                           RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO |
     777                 :            :                                           RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO);
     778                 :            : 
     779                 :            :         /* 50G and 100G to be supported for board version C0
     780                 :            :          * and above of CN9K.
     781                 :            :          */
     782   [ #  #  #  # ]:          0 :         if (roc_model_is_cn96_a0() || roc_model_is_cn95_a0()) {
     783                 :          0 :                 dev->speed_capa &= ~(uint64_t)RTE_ETH_LINK_SPEED_50G;
     784                 :          0 :                 dev->speed_capa &= ~(uint64_t)RTE_ETH_LINK_SPEED_100G;
     785                 :            :         }
     786                 :            : 
     787                 :          0 :         dev->hwcap = 0;
     788                 :          0 :         dev->inb.no_inl_dev = 1;
     789                 :            : 
     790                 :            :         /* Register up msg callbacks for PTP information */
     791                 :          0 :         roc_nix_ptp_info_cb_register(&dev->nix, cn9k_nix_ptp_info_update_cb);
     792                 :            : 
     793                 :            :         /* Update HW erratas */
     794         [ #  # ]:          0 :         if (roc_errata_nix_has_cq_min_size_4k())
     795                 :          0 :                 dev->cq_min_4k = 1;
     796                 :            : 
     797         [ #  # ]:          0 :         if (dev->nix.custom_sa_action) {
     798                 :          0 :                 dev->nix.custom_sa_action = 0;
     799                 :          0 :                 plt_info("WARNING: Custom SA action is enabled. It's not supported"
     800                 :            :                          " on cn9k device. Disabling it");
     801                 :            :         }
     802                 :            :         return 0;
     803                 :            : }
     804                 :            : 
     805                 :            : static const struct rte_pci_id cn9k_pci_nix_map[] = {
     806                 :            :         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KA, PCI_DEVID_CNXK_RVU_PF),
     807                 :            :         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KB, PCI_DEVID_CNXK_RVU_PF),
     808                 :            :         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KC, PCI_DEVID_CNXK_RVU_PF),
     809                 :            :         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KD, PCI_DEVID_CNXK_RVU_PF),
     810                 :            :         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KE, PCI_DEVID_CNXK_RVU_PF),
     811                 :            :         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CNF9KA, PCI_DEVID_CNXK_RVU_PF),
     812                 :            :         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KA, PCI_DEVID_CNXK_RVU_VF),
     813                 :            :         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KB, PCI_DEVID_CNXK_RVU_VF),
     814                 :            :         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KC, PCI_DEVID_CNXK_RVU_VF),
     815                 :            :         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KD, PCI_DEVID_CNXK_RVU_VF),
     816                 :            :         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KE, PCI_DEVID_CNXK_RVU_VF),
     817                 :            :         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CNF9KA, PCI_DEVID_CNXK_RVU_VF),
     818                 :            :         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KA, PCI_DEVID_CNXK_RVU_AF_VF),
     819                 :            :         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KB, PCI_DEVID_CNXK_RVU_AF_VF),
     820                 :            :         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KC, PCI_DEVID_CNXK_RVU_AF_VF),
     821                 :            :         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KD, PCI_DEVID_CNXK_RVU_AF_VF),
     822                 :            :         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KE, PCI_DEVID_CNXK_RVU_AF_VF),
     823                 :            :         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CNF9KA, PCI_DEVID_CNXK_RVU_AF_VF),
     824                 :            :         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KA, PCI_DEVID_CNXK_RVU_SDP_VF),
     825                 :            :         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KB, PCI_DEVID_CNXK_RVU_SDP_VF),
     826                 :            :         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KC, PCI_DEVID_CNXK_RVU_SDP_VF),
     827                 :            :         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KD, PCI_DEVID_CNXK_RVU_SDP_VF),
     828                 :            :         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN9KE, PCI_DEVID_CNXK_RVU_SDP_VF),
     829                 :            :         CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CNF9KA, PCI_DEVID_CNXK_RVU_SDP_VF),
     830                 :            :         {
     831                 :            :                 .vendor_id = 0,
     832                 :            :         },
     833                 :            : };
     834                 :            : 
     835                 :            : static struct rte_pci_driver cn9k_pci_nix = {
     836                 :            :         .id_table = cn9k_pci_nix_map,
     837                 :            :         .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_NEED_IOVA_AS_VA |
     838                 :            :                      RTE_PCI_DRV_INTR_LSC,
     839                 :            :         .probe = cn9k_nix_probe,
     840                 :            :         .remove = cn9k_nix_remove,
     841                 :            : };
     842                 :            : 
     843                 :        235 : RTE_PMD_REGISTER_PCI(net_cn9k, cn9k_pci_nix);
     844                 :            : RTE_PMD_REGISTER_PCI_TABLE(net_cn9k, cn9k_pci_nix_map);
     845                 :            : RTE_PMD_REGISTER_KMOD_DEP(net_cn9k, "vfio-pci");

Generated by: LCOV version 1.14