LCOV - code coverage report
Current view: top level - drivers/net/nfp/nfd3 - nfp_nfd3.h (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 5 0.0 %
Date: 2025-01-02 22:41:34 Functions: 0 0 -
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 10 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright (c) 2023 Corigine, Inc.
       3                 :            :  * All rights reserved.
       4                 :            :  */
       5                 :            : 
       6                 :            : #ifndef __NFP_NFD3_H__
       7                 :            : #define __NFP_NFD3_H__
       8                 :            : 
       9                 :            : #include "../nfp_rxtx.h"
      10                 :            : 
      11                 :            : /* TX descriptor format */
      12                 :            : #define NFD3_DESC_TX_EOP                RTE_BIT32(7)
      13                 :            : #define NFD3_DESC_TX_OFFSET_MASK        (0x7F)        /* [0,6] */
      14                 :            : 
      15                 :            : #define NFD3_TX_DESC_PER_PKT     1
      16                 :            : 
      17                 :            : struct nfp_net_nfd3_tx_desc {
      18                 :            :         union {
      19                 :            :                 struct {
      20                 :            :                         uint8_t dma_addr_hi; /**< High bits of host buf address */
      21                 :            :                         uint16_t dma_len;    /**< Length to DMA for this desc */
      22                 :            :                         /** Offset in buf where pkt starts + highest bit is eop flag */
      23                 :            :                         uint8_t offset_eop;
      24                 :            :                         uint32_t dma_addr_lo; /**< Low 32bit of host buf addr */
      25                 :            : 
      26                 :            :                         uint16_t mss;         /**< MSS to be used for LSO */
      27                 :            :                         uint8_t lso_hdrlen;   /**< LSO, where the data starts */
      28                 :            :                         uint8_t flags;        /**< TX Flags, see @NFD3_DESC_TX_* */
      29                 :            : 
      30                 :            :                         union {
      31                 :            :                                 struct {
      32                 :            :                                         uint8_t l3_offset; /**< L3 header offset */
      33                 :            :                                         uint8_t l4_offset; /**< L4 header offset */
      34                 :            :                                 };
      35                 :            :                                 uint16_t vlan; /**< VLAN tag to add if indicated */
      36                 :            :                         };
      37                 :            :                         uint16_t data_len;     /**< Length of frame + meta data */
      38                 :            :                 } __rte_packed;
      39                 :            :                 uint32_t vals[4];
      40                 :            :         };
      41                 :            : };
      42                 :            : 
      43                 :            : /* Leaving always free descriptors for avoiding wrapping confusion */
      44                 :            : static inline uint32_t
      45                 :            : nfp_net_nfd3_free_tx_desc(struct nfp_net_txq *txq)
      46                 :            : {
      47                 :            :         uint32_t free_desc;
      48                 :            : 
      49   [ #  #  #  # ]:          0 :         if (txq->wr_p >= txq->rd_p)
      50                 :          0 :                 free_desc = txq->tx_count - (txq->wr_p - txq->rd_p);
      51                 :            :         else
      52                 :          0 :                 free_desc = txq->rd_p - txq->wr_p;
      53                 :            : 
      54   [ #  #  #  # ]:          0 :         return (free_desc > 8) ? (free_desc - 8) : 0;
      55                 :            : }
      56                 :            : 
      57                 :            : /**
      58                 :            :  * Check if the TX queue free descriptors is below tx_free_threshold
      59                 :            :  * for firmware with nfd3
      60                 :            :  *
      61                 :            :  * This function uses the host copy* of read/write pointers.
      62                 :            :  *
      63                 :            :  * @param txq
      64                 :            :  *   TX queue to check
      65                 :            :  */
      66                 :            : static inline bool
      67                 :            : nfp_net_nfd3_txq_full(struct nfp_net_txq *txq)
      68                 :            : {
      69         [ #  # ]:          0 :         return (nfp_net_nfd3_free_tx_desc(txq) < txq->tx_free_thresh);
      70                 :            : }
      71                 :            : 
      72                 :            : uint32_t nfp_flower_nfd3_pkt_add_metadata(struct rte_mbuf *mbuf,
      73                 :            :                 uint32_t port_id);
      74                 :            : uint16_t nfp_net_nfd3_xmit_pkts_common(void *tx_queue,
      75                 :            :                 struct rte_mbuf **tx_pkts,
      76                 :            :                 uint16_t nb_pkts,
      77                 :            :                 bool repr_flag);
      78                 :            : uint16_t nfp_net_nfd3_xmit_pkts(void *tx_queue,
      79                 :            :                 struct rte_mbuf **tx_pkts,
      80                 :            :                 uint16_t nb_pkts);
      81                 :            : int nfp_net_nfd3_tx_queue_setup(struct rte_eth_dev *dev,
      82                 :            :                 uint16_t queue_idx,
      83                 :            :                 uint16_t nb_desc,
      84                 :            :                 unsigned int socket_id,
      85                 :            :                 const struct rte_eth_txconf *tx_conf);
      86                 :            : 
      87                 :            : #endif /* __NFP_NFD3_H__ */

Generated by: LCOV version 1.14