LCOV - code coverage report
Current view: top level - drivers/net/intel/cpfl - cpfl_rxtx.h (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 2 0.0 %
Date: 2025-06-01 17:49:23 Functions: 0 0 -
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 6 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright(c) 2023 Intel Corporation
       3                 :            :  */
       4                 :            : 
       5                 :            : #ifndef _CPFL_RXTX_H_
       6                 :            : #define _CPFL_RXTX_H_
       7                 :            : 
       8                 :            : #include <idpf_common_rxtx.h>
       9                 :            : #include "cpfl_ethdev.h"
      10                 :            : #include "../common/tx.h"
      11                 :            : 
      12                 :            : /* In QLEN must be whole number of 32 descriptors. */
      13                 :            : #define CPFL_ALIGN_RING_DESC    32
      14                 :            : #define CPFL_MIN_RING_DESC      32
      15                 :            : #define CPFL_MAX_RING_DESC      4096
      16                 :            : #define CPFL_DMA_MEM_ALIGN      4096
      17                 :            : 
      18                 :            : #define CPFL_MAX_HAIRPINQ_RX_2_TX       1
      19                 :            : #define CPFL_MAX_HAIRPINQ_TX_2_RX       1
      20                 :            : #define CPFL_MAX_HAIRPINQ_NB_DESC       1024
      21                 :            : #define CPFL_MAX_P2P_NB_QUEUES  16
      22                 :            : #define CPFL_P2P_NB_RX_BUFQ     1
      23                 :            : #define CPFL_P2P_NB_TX_COMPLQ   1
      24                 :            : #define CPFL_P2P_NB_QUEUE_GRPS  1
      25                 :            : #define CPFL_P2P_QUEUE_GRP_ID   1
      26                 :            : #define CPFL_P2P_DESC_LEN       16
      27                 :            : #define CPFL_P2P_NB_MBUF        4096
      28                 :            : #define CPFL_P2P_CACHE_SIZE     250
      29                 :            : #define CPFL_P2P_MBUF_SIZE      2048
      30                 :            : #define CPFL_P2P_RING_BUF       128
      31                 :            : 
      32                 :            : /* Base address of the HW descriptor ring should be 128B aligned. */
      33                 :            : #define CPFL_RING_BASE_ALIGN    128
      34                 :            : 
      35                 :            : #define CPFL_DEFAULT_RX_FREE_THRESH     32
      36                 :            : #define CPFL_RXBUF_LOW_WATERMARK        64
      37                 :            : 
      38                 :            : #define CPFL_DEFAULT_TX_RS_THRESH       32
      39                 :            : #define CPFL_DEFAULT_TX_FREE_THRESH     32
      40                 :            : 
      41                 :            : #define CPFL_SUPPORT_CHAIN_NUM 5
      42                 :            : 
      43                 :            : #define CPFL_RX_BUF_STRIDE 64
      44                 :            : 
      45                 :            : /* The value written in the RX buffer queue tail register,
      46                 :            :  * and in WritePTR field in the TX completion queue context,
      47                 :            :  * must be a multiple of 8.
      48                 :            :  */
      49                 :            : #define CPFL_HAIRPIN_Q_TAIL_AUX_VALUE 8
      50                 :            : 
      51                 :            : struct virtchnl2_p2p_rx_buf_desc {
      52                 :            :         __le64  reserve0;
      53                 :            :         __le64  pkt_addr; /* Packet buffer address */
      54                 :            : };
      55                 :            : 
      56                 :            : struct cpfl_rxq_hairpin_info {
      57                 :            :         bool hairpin_q;         /* if rx queue is a hairpin queue */
      58                 :            :         uint16_t peer_txp;
      59                 :            :         uint16_t peer_txq_id;
      60                 :            : };
      61                 :            : 
      62                 :            : struct cpfl_rx_queue {
      63                 :            :         struct idpf_rx_queue base;
      64                 :            :         struct cpfl_rxq_hairpin_info hairpin_info;
      65                 :            : };
      66                 :            : 
      67                 :            : struct cpfl_txq_hairpin_info {
      68                 :            :         bool hairpin_q;         /* if tx queue is a hairpin queue */
      69                 :            :         uint16_t peer_rxp;
      70                 :            :         uint16_t peer_rxq_id;
      71                 :            : };
      72                 :            : 
      73                 :            : struct cpfl_tx_queue {
      74                 :            :         struct ci_tx_queue base;
      75                 :            :         struct cpfl_txq_hairpin_info hairpin_info;
      76                 :            : };
      77                 :            : 
      78                 :            : static inline uint16_t
      79                 :            : cpfl_hw_qid_get(uint16_t start_qid, uint16_t offset)
      80                 :            : {
      81   [ #  #  #  # ]:          0 :         return start_qid + offset;
      82                 :            : }
      83                 :            : 
      84                 :            : static inline uint64_t
      85                 :            : cpfl_hw_qtail_get(uint64_t tail_start, uint16_t offset, uint64_t tail_spacing)
      86                 :            : {
      87         [ #  # ]:          0 :         return tail_start + offset * tail_spacing;
      88                 :            : }
      89                 :            : 
      90                 :            : int cpfl_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
      91                 :            :                         uint16_t nb_desc, unsigned int socket_id,
      92                 :            :                         const struct rte_eth_txconf *tx_conf);
      93                 :            : int cpfl_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
      94                 :            :                         uint16_t nb_desc, unsigned int socket_id,
      95                 :            :                         const struct rte_eth_rxconf *rx_conf,
      96                 :            :                         struct rte_mempool *mp);
      97                 :            : int cpfl_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id);
      98                 :            : int cpfl_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
      99                 :            : int cpfl_tx_queue_init(struct rte_eth_dev *dev, uint16_t tx_queue_id);
     100                 :            : int cpfl_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
     101                 :            : void cpfl_stop_queues(struct rte_eth_dev *dev);
     102                 :            : int cpfl_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
     103                 :            : int cpfl_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
     104                 :            : void cpfl_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
     105                 :            : void cpfl_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
     106                 :            : void cpfl_set_rx_function(struct rte_eth_dev *dev);
     107                 :            : void cpfl_set_tx_function(struct rte_eth_dev *dev);
     108                 :            : int cpfl_rx_hairpin_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
     109                 :            :                                 uint16_t nb_desc, const struct rte_eth_hairpin_conf *conf);
     110                 :            : int cpfl_tx_hairpin_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
     111                 :            :                                 uint16_t nb_desc,
     112                 :            :                                 const struct rte_eth_hairpin_conf *conf);
     113                 :            : int cpfl_hairpin_tx_complq_config(struct cpfl_vport *cpfl_vport);
     114                 :            : int cpfl_hairpin_txq_config(struct idpf_vport *vport, struct cpfl_tx_queue *cpfl_txq);
     115                 :            : int cpfl_hairpin_rx_bufq_config(struct cpfl_vport *cpfl_vport);
     116                 :            : int cpfl_hairpin_rxq_config(struct idpf_vport *vport, struct cpfl_rx_queue *cpfl_rxq);
     117                 :            : int cpfl_switch_hairpin_complq(struct cpfl_vport *cpfl_vport, bool on);
     118                 :            : int cpfl_switch_hairpin_bufq(struct cpfl_vport *cpfl_vport, bool on);
     119                 :            : int cpfl_switch_hairpin_rxtx_queue(struct cpfl_vport *cpfl_vport, uint16_t qid,
     120                 :            :                                    bool rx, bool on);
     121                 :            : #endif /* _CPFL_RXTX_H_ */

Generated by: LCOV version 1.14