LCOV - code coverage report
Current view: top level - drivers/net/cnxk - cnxk_rep.h (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 5 0.0 %
Date: 2024-12-01 18:57:19 Functions: 0 1 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 28 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright(C) 2024 Marvell.
       3                 :            :  */
       4                 :            : 
       5                 :            : #include <regex.h>
       6                 :            : 
       7                 :            : #include <cnxk_eswitch.h>
       8                 :            : #include <cnxk_ethdev.h>
       9                 :            : 
      10                 :            : #ifndef __CNXK_REP_H__
      11                 :            : #define __CNXK_REP_H__
      12                 :            : 
      13                 :            : #define CNXK_REP_TX_OFFLOAD_CAPA                                                                   \
      14                 :            :         (RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE | RTE_ETH_TX_OFFLOAD_VLAN_INSERT |                      \
      15                 :            :          RTE_ETH_TX_OFFLOAD_MULTI_SEGS)
      16                 :            : 
      17                 :            : #define CNXK_REP_RX_OFFLOAD_CAPA                                                                   \
      18                 :            :         (RTE_ETH_RX_OFFLOAD_SCATTER | RTE_ETH_RX_OFFLOAD_RSS_HASH | RTE_ETH_RX_OFFLOAD_VLAN_STRIP)
      19                 :            : 
      20                 :            : /* Common ethdev ops */
      21                 :            : extern struct eth_dev_ops cnxk_rep_dev_ops;
      22                 :            : 
      23                 :            : /* Flow ops for representor ports */
      24                 :            : extern struct rte_flow_ops cnxk_rep_flow_ops;
      25                 :            : 
      26                 :            : struct cnxk_rep_queue_stats {
      27                 :            :         uint64_t pkts;
      28                 :            :         uint64_t bytes;
      29                 :            : };
      30                 :            : 
      31                 :            : struct cnxk_rep_rxq {
      32                 :            :         /* Parent rep device */
      33                 :            :         struct cnxk_rep_dev *rep_dev;
      34                 :            :         /* Queue ID */
      35                 :            :         uint16_t qid;
      36                 :            :         /* No of desc */
      37                 :            :         uint16_t nb_desc;
      38                 :            :         /* mempool handle */
      39                 :            :         struct rte_mempool *mpool;
      40                 :            :         /* RX config parameters */
      41                 :            :         const struct rte_eth_rxconf *rx_conf;
      42                 :            :         /* Per queue TX statistics */
      43                 :            :         struct cnxk_rep_queue_stats stats;
      44                 :            : };
      45                 :            : 
      46                 :            : struct cnxk_rep_txq {
      47                 :            :         /* Parent rep device */
      48                 :            :         struct cnxk_rep_dev *rep_dev;
      49                 :            :         /* Queue ID */
      50                 :            :         uint16_t qid;
      51                 :            :         /* No of desc */
      52                 :            :         uint16_t nb_desc;
      53                 :            :         /* TX config parameters */
      54                 :            :         const struct rte_eth_txconf *tx_conf;
      55                 :            :         /* Per queue TX statistics */
      56                 :            :         struct cnxk_rep_queue_stats stats;
      57                 :            : };
      58                 :            : 
      59                 :            : /* Representor port configurations */
      60                 :            : struct cnxk_rep_dev {
      61                 :            :         uint16_t port_id;
      62                 :            :         uint16_t rep_id;
      63                 :            :         uint16_t switch_domain_id;
      64                 :            :         struct cnxk_eswitch_dev *parent_dev;
      65                 :            :         /* Representee HW func */
      66                 :            :         uint16_t hw_func;
      67                 :            :         /* No of queues configured at representee */
      68                 :            :         uint16_t nb_rxq;
      69                 :            :         bool is_vf_active;
      70                 :            :         bool native_repte;
      71                 :            :         struct cnxk_rep_rxq *rxq;
      72                 :            :         struct cnxk_rep_txq *txq;
      73                 :            :         uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
      74                 :            :         uint16_t repte_mtu;
      75                 :            : };
      76                 :            : 
      77                 :            : /* Inline functions */
      78                 :            : static inline void
      79                 :            : cnxk_rep_lock(struct cnxk_rep_dev *rep)
      80                 :            : {
      81                 :            :         rte_spinlock_lock(&rep->parent_dev->rep_lock);
      82                 :            : }
      83                 :            : 
      84                 :            : static inline void
      85                 :            : cnxk_rep_unlock(struct cnxk_rep_dev *rep)
      86                 :            : {
      87                 :            :         rte_spinlock_unlock(&rep->parent_dev->rep_lock);
      88                 :            : }
      89                 :            : 
      90                 :            : static inline struct cnxk_rep_dev *
      91                 :            : cnxk_rep_pmd_priv(const struct rte_eth_dev *eth_dev)
      92                 :            : {
      93   [ #  #  #  #  :          0 :         return eth_dev->data->dev_private;
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
             #  #  #  # ]
      94                 :            : }
      95                 :            : 
      96                 :            : static __rte_always_inline void
      97                 :            : cnxk_rep_pool_buffer_stats(struct rte_mempool *pool)
      98                 :            : {
      99                 :            :         plt_rep_dbg("        pool %s size %d buffer count in use  %d available %d", pool->name,
     100                 :            :                     pool->size, rte_mempool_in_use_count(pool), rte_mempool_avail_count(pool));
     101                 :            : }
     102                 :            : 
     103                 :            : static inline int
     104                 :          0 : cnxk_ethdev_is_representor(const char *if_name)
     105                 :            : {
     106                 :            :         regex_t regex;
     107                 :            :         int val;
     108                 :            : 
     109                 :          0 :         val = regcomp(&regex, "net_.*_representor_.*", 0);
     110                 :          0 :         val = regexec(&regex, if_name, 0, NULL, 0);
     111                 :          0 :         return (val == 0);
     112                 :            : }
     113                 :            : 
     114                 :            : /* Prototypes */
     115                 :            : int cnxk_rep_dev_probe(struct rte_pci_device *pci_dev, struct cnxk_eswitch_dev *eswitch_dev);
     116                 :            : int cnxk_rep_dev_remove(struct cnxk_eswitch_dev *eswitch_dev);
     117                 :            : int cnxk_rep_dev_uninit(struct rte_eth_dev *ethdev);
     118                 :            : int cnxk_rep_dev_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *dev_info);
     119                 :            : int cnxk_rep_representor_info_get(struct rte_eth_dev *dev, struct rte_eth_representor_info *info);
     120                 :            : int cnxk_rep_dev_configure(struct rte_eth_dev *eth_dev);
     121                 :            : 
     122                 :            : int cnxk_rep_link_update(struct rte_eth_dev *eth_dev, int wait_to_compl);
     123                 :            : int cnxk_rep_dev_start(struct rte_eth_dev *eth_dev);
     124                 :            : int cnxk_rep_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t queue_idx, uint16_t nb_desc,
     125                 :            :                             unsigned int socket_id, const struct rte_eth_rxconf *rx_conf,
     126                 :            :                             struct rte_mempool *mp);
     127                 :            : int cnxk_rep_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t queue_idx, uint16_t nb_desc,
     128                 :            :                             unsigned int socket_id, const struct rte_eth_txconf *tx_conf);
     129                 :            : void cnxk_rep_rx_queue_release(struct rte_eth_dev *dev, uint16_t queue_idx);
     130                 :            : void cnxk_rep_tx_queue_release(struct rte_eth_dev *dev, uint16_t queue_idx);
     131                 :            : int cnxk_rep_dev_stop(struct rte_eth_dev *eth_dev);
     132                 :            : int cnxk_rep_dev_close(struct rte_eth_dev *eth_dev);
     133                 :            : int cnxk_rep_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *stats);
     134                 :            : int cnxk_rep_stats_reset(struct rte_eth_dev *eth_dev);
     135                 :            : int cnxk_rep_flow_ops_get(struct rte_eth_dev *ethdev, const struct rte_flow_ops **ops);
     136                 :            : int cnxk_rep_state_update(struct cnxk_eswitch_dev *eswitch_dev, uint32_t state, uint16_t *rep_id);
     137                 :            : int cnxk_rep_promiscuous_enable(struct rte_eth_dev *ethdev);
     138                 :            : int cnxk_rep_promiscuous_disable(struct rte_eth_dev *ethdev);
     139                 :            : int cnxk_rep_mac_addr_set(struct rte_eth_dev *eth_dev, struct rte_ether_addr *addr);
     140                 :            : uint16_t cnxk_rep_tx_burst_dummy(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts);
     141                 :            : uint16_t cnxk_rep_rx_burst_dummy(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts);
     142                 :            : void cnxk_rep_tx_queue_stop(struct rte_eth_dev *ethdev, uint16_t queue_id);
     143                 :            : void cnxk_rep_rx_queue_stop(struct rte_eth_dev *ethdev, uint16_t queue_id);
     144                 :            : int cnxk_rep_xstats_get(struct rte_eth_dev *eth_dev, struct rte_eth_xstat *stats, unsigned int n);
     145                 :            : int cnxk_rep_xstats_reset(struct rte_eth_dev *eth_dev);
     146                 :            : int cnxk_rep_xstats_get_names(struct rte_eth_dev *eth_dev, struct rte_eth_xstat_name *xstats_names,
     147                 :            :                               unsigned int n);
     148                 :            : int cnxk_rep_xstats_get_by_id(struct rte_eth_dev *eth_dev, const uint64_t *ids, uint64_t *values,
     149                 :            :                               unsigned int n);
     150                 :            : int cnxk_rep_xstats_get_names_by_id(struct rte_eth_dev *eth_dev, const uint64_t *ids,
     151                 :            :                                     struct rte_eth_xstat_name *xstats_names, unsigned int n);
     152                 :            : int cnxk_rep_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu);
     153                 :            : 
     154                 :            : #endif /* __CNXK_REP_H__ */

Generated by: LCOV version 1.14