LCOV - code coverage report
Current view: top level - drivers/net/intel/ixgbe - ixgbe_rxtx.h (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 2 0.0 %
Date: 2025-07-01 21:32:37 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) 2010-2014 Intel Corporation
       3                 :            :  */
       4                 :            : 
       5                 :            : #ifndef _IXGBE_RXTX_H_
       6                 :            : #define _IXGBE_RXTX_H_
       7                 :            : 
       8                 :            : #include "ixgbe_type.h"
       9                 :            : 
      10                 :            : /*
      11                 :            :  * For IXGBE, descriptor size is always 16 bytes, so in order to have all
      12                 :            :  * vectorized and common code building correctly and with proper offsets, force
      13                 :            :  * the common parts to consider IXGBE descriptors to be 16-bytes in size.
      14                 :            :  */
      15                 :            : #ifndef RTE_NET_INTEL_USE_16BYTE_DESC
      16                 :            : #define RTE_NET_INTEL_USE_16BYTE_DESC
      17                 :            : #endif
      18                 :            : 
      19                 :            : #include "../common/rx.h"
      20                 :            : #include "../common/tx.h"
      21                 :            : 
      22                 :            : /*
      23                 :            :  * Rings setup and release.
      24                 :            :  *
      25                 :            :  * TDBA/RDBA should be aligned on 16 byte boundary. But TDLEN/RDLEN should be
      26                 :            :  * multiple of 128 bytes. So we align TDBA/RDBA on 128 byte boundary. This will
      27                 :            :  * also optimize cache line size effect. H/W supports up to cache line size 128.
      28                 :            :  */
      29                 :            : #define IXGBE_ALIGN     128
      30                 :            : 
      31                 :            : #define IXGBE_RXD_ALIGN (IXGBE_ALIGN / sizeof(union ixgbe_adv_rx_desc))
      32                 :            : #define IXGBE_TXD_ALIGN (IXGBE_ALIGN / sizeof(union ixgbe_adv_tx_desc))
      33                 :            : 
      34                 :            : /*
      35                 :            :  * Maximum number of Ring Descriptors.
      36                 :            :  *
      37                 :            :  * Since RDLEN/TDLEN should be multiple of 128 bytes, the number of ring
      38                 :            :  * descriptors should meet the following condition:
      39                 :            :  *      (num_ring_desc * sizeof(rx/tx descriptor)) % 128 == 0
      40                 :            :  */
      41                 :            : #define IXGBE_MIN_RING_DESC     64
      42                 :            : #define IXGBE_MAX_RING_DESC     8192
      43                 :            : 
      44                 :            : #define IXGBE_TX_MAX_BURST            32
      45                 :            : #define IXGBE_RX_MAX_BURST            CI_RX_MAX_BURST
      46                 :            : #define IXGBE_TX_MAX_FREE_BUF_SZ      64
      47                 :            : 
      48                 :            : #define IXGBE_VPMD_DESCS_PER_LOOP     CI_VPMD_DESCS_PER_LOOP
      49                 :            : 
      50                 :            : #define IXGBE_VPMD_RXQ_REARM_THRESH   CI_VPMD_RX_REARM_THRESH
      51                 :            : #define IXGBE_VPMD_RX_BURST           CI_VPMD_RX_BURST
      52                 :            : 
      53                 :            : #define RX_RING_SZ ((IXGBE_MAX_RING_DESC + IXGBE_RX_MAX_BURST) * \
      54                 :            :                     sizeof(union ixgbe_adv_rx_desc))
      55                 :            : 
      56                 :            : #ifdef RTE_PMD_PACKET_PREFETCH
      57                 :            : #define rte_packet_prefetch(p)  rte_prefetch1(p)
      58                 :            : #else
      59                 :            : #define rte_packet_prefetch(p)  do {} while(0)
      60                 :            : #endif
      61                 :            : 
      62                 :            : #define IXGBE_REGISTER_POLL_WAIT_10_MS  10
      63                 :            : #define IXGBE_WAIT_100_US               100
      64                 :            : #define IXGBE_VMTXSW_REGISTER_COUNT     2
      65                 :            : 
      66                 :            : #define IXGBE_TX_MAX_SEG                    40
      67                 :            : 
      68                 :            : #define IXGBE_TX_MIN_PKT_LEN                 14
      69                 :            : 
      70                 :            : #define IXGBE_PACKET_TYPE_MASK_82599        0X7F
      71                 :            : #define IXGBE_PACKET_TYPE_MASK_X550         0X10FF
      72                 :            : #define IXGBE_PACKET_TYPE_MASK_TUNNEL       0XFF
      73                 :            : #define IXGBE_PACKET_TYPE_TUNNEL_BIT        0X1000
      74                 :            : 
      75                 :            : #define IXGBE_PACKET_TYPE_MAX               0X80
      76                 :            : #define IXGBE_PACKET_TYPE_TN_MAX            0X100
      77                 :            : #define IXGBE_PACKET_TYPE_SHIFT             0X04
      78                 :            : 
      79                 :            : /**
      80                 :            :  * IXGBE CTX Constants
      81                 :            :  */
      82                 :            : enum ixgbe_advctx_num {
      83                 :            :         IXGBE_CTX_0    = 0, /**< CTX0 */
      84                 :            :         IXGBE_CTX_1    = 1, /**< CTX1  */
      85                 :            :         IXGBE_CTX_NUM  = 2, /**< CTX NUMBER  */
      86                 :            : };
      87                 :            : 
      88                 :            : /** Offload features */
      89                 :            : union ixgbe_tx_offload {
      90                 :            :         uint64_t data[2];
      91                 :            :         struct {
      92                 :            :                 uint64_t l2_len:7; /**< L2 (MAC) Header Length. */
      93                 :            :                 uint64_t l3_len:9; /**< L3 (IP) Header Length. */
      94                 :            :                 uint64_t l4_len:8; /**< L4 (TCP/UDP) Header Length. */
      95                 :            :                 uint64_t tso_segsz:16; /**< TCP TSO segment size */
      96                 :            :                 uint64_t vlan_tci:16;
      97                 :            :                 /**< VLAN Tag Control Identifier (CPU order). */
      98                 :            : 
      99                 :            :                 /* fields for TX offloading of tunnels */
     100                 :            :                 uint64_t outer_l3_len:8; /**< Outer L3 (IP) Hdr Length. */
     101                 :            :                 uint64_t outer_l2_len:8; /**< Outer L2 (MAC) Hdr Length. */
     102                 :            : #ifdef RTE_LIB_SECURITY
     103                 :            :                 /* inline ipsec related*/
     104                 :            :                 uint64_t sa_idx:8;      /**< TX SA database entry index */
     105                 :            :                 uint64_t sec_pad_len:4; /**< padding length */
     106                 :            : #endif
     107                 :            :         };
     108                 :            : };
     109                 :            : 
     110                 :            : /*
     111                 :            :  * Compare mask for vlan_macip_len.data,
     112                 :            :  * should be in sync with ixgbe_vlan_macip.f layout.
     113                 :            :  * */
     114                 :            : #define TX_VLAN_CMP_MASK        0xFFFF0000  /**< VLAN length - 16-bits. */
     115                 :            : #define TX_MAC_LEN_CMP_MASK     0x0000FE00  /**< MAC length - 7-bits. */
     116                 :            : #define TX_IP_LEN_CMP_MASK      0x000001FF  /**< IP  length - 9-bits. */
     117                 :            : /** MAC+IP  length. */
     118                 :            : #define TX_MACIP_LEN_CMP_MASK   (TX_MAC_LEN_CMP_MASK | TX_IP_LEN_CMP_MASK)
     119                 :            : 
     120                 :            : /**
     121                 :            :  * Structure to check if new context need be built
     122                 :            :  */
     123                 :            : 
     124                 :            : struct ixgbe_advctx_info {
     125                 :            :         uint64_t flags;           /**< ol_flags for context build. */
     126                 :            :         /**< tx offload: vlan, tso, l2-l3-l4 lengths. */
     127                 :            :         union ixgbe_tx_offload tx_offload;
     128                 :            :         /** compare mask for tx offload. */
     129                 :            :         union ixgbe_tx_offload tx_offload_mask;
     130                 :            : };
     131                 :            : 
     132                 :            : struct ixgbe_txq_ops {
     133                 :            :         void (*free_swring)(struct ci_tx_queue *txq);
     134                 :            :         void (*reset)(struct ci_tx_queue *txq);
     135                 :            : };
     136                 :            : 
     137                 :            : /*
     138                 :            :  * Populate descriptors with the following info:
     139                 :            :  * 1.) buffer_addr = phys_addr + headroom
     140                 :            :  * 2.) cmd_type_len = DCMD_DTYP_FLAGS | pkt_len
     141                 :            :  * 3.) olinfo_status = pkt_len << PAYLEN_SHIFT
     142                 :            :  */
     143                 :            : 
     144                 :            : /* Defines for Tx descriptor */
     145                 :            : #define DCMD_DTYP_FLAGS (IXGBE_ADVTXD_DTYP_DATA |\
     146                 :            :                          IXGBE_ADVTXD_DCMD_IFCS |\
     147                 :            :                          IXGBE_ADVTXD_DCMD_DEXT |\
     148                 :            :                          IXGBE_ADVTXD_DCMD_EOP)
     149                 :            : 
     150                 :            : 
     151                 :            : /* Takes an ethdev and a queue and sets up the tx function to be used based on
     152                 :            :  * the queue parameters. Used in tx_queue_setup by primary process and then
     153                 :            :  * in dev_init by secondary process when attaching to an existing ethdev.
     154                 :            :  */
     155                 :            : void ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ci_tx_queue *txq);
     156                 :            : int ixgbe_tx_burst_mode_get(struct rte_eth_dev *dev,
     157                 :            :                 uint16_t queue_id, struct rte_eth_burst_mode *mode);
     158                 :            : 
     159                 :            : /**
     160                 :            :  * Sets the rx_pkt_burst callback in the ixgbe rte_eth_dev instance.
     161                 :            :  *
     162                 :            :  * Sets the callback based on the device parameters:
     163                 :            :  *  - ixgbe_hw.rx_bulk_alloc_allowed
     164                 :            :  *  - rte_eth_dev_data.scattered_rx
     165                 :            :  *  - rte_eth_dev_data.lro
     166                 :            :  *  - conditions checked in ixgbe_rx_vec_condition_check()
     167                 :            :  *
     168                 :            :  *  This means that the parameters above have to be configured prior to calling
     169                 :            :  *  to this function.
     170                 :            :  *
     171                 :            :  * @dev rte_eth_dev handle
     172                 :            :  */
     173                 :            : void ixgbe_set_rx_function(struct rte_eth_dev *dev);
     174                 :            : int ixgbe_rx_burst_mode_get(struct rte_eth_dev *dev,
     175                 :            :                 uint16_t queue_id, struct rte_eth_burst_mode *mode);
     176                 :            : 
     177                 :            : int ixgbe_check_supported_loopback_mode(struct rte_eth_dev *dev);
     178                 :            : int ixgbe_dev_tx_done_cleanup(void *tx_queue, uint32_t free_cnt);
     179                 :            : 
     180                 :            : extern const uint32_t ptype_table[IXGBE_PACKET_TYPE_MAX];
     181                 :            : extern const uint32_t ptype_table_tn[IXGBE_PACKET_TYPE_TN_MAX];
     182                 :            : 
     183                 :            : int ixgbe_write_default_ctx_desc(struct ci_tx_queue *txq, struct rte_mempool *mp, bool vec);
     184                 :            : uint16_t ixgbe_recycle_tx_mbufs_reuse_vec(void *tx_queue,
     185                 :            :                 struct rte_eth_recycle_rxq_info *recycle_rxq_info);
     186                 :            : void ixgbe_recycle_rx_descriptors_refill_vec(void *rx_queue, uint16_t nb_mbufs);
     187                 :            : 
     188                 :            : uint16_t ixgbe_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
     189                 :            :                                     uint16_t nb_pkts);
     190                 :            : int ixgbe_write_default_ctx_desc(struct ci_tx_queue *txq, struct rte_mempool *mp, bool vec);
     191                 :            : 
     192                 :            : uint64_t ixgbe_get_tx_port_offloads(struct rte_eth_dev *dev);
     193                 :            : uint64_t ixgbe_get_rx_queue_offloads(struct rte_eth_dev *dev);
     194                 :            : uint64_t ixgbe_get_rx_port_offloads(struct rte_eth_dev *dev);
     195                 :            : uint64_t ixgbe_get_tx_queue_offloads(struct rte_eth_dev *dev);
     196                 :            : int ixgbe_get_monitor_addr(void *rx_queue, struct rte_power_monitor_cond *pmc);
     197                 :            : 
     198                 :            : /**
     199                 :            :  * Check if the Tx descriptor DD bit is set.
     200                 :            :  *
     201                 :            :  * @param txq
     202                 :            :  *   Pointer to the Tx queue structure.
     203                 :            :  * @param idx
     204                 :            :  *   Index of the Tx descriptor to check.
     205                 :            :  *
     206                 :            :  * @return
     207                 :            :  *   1 if the Tx descriptor is done, 0 otherwise.
     208                 :            :  */
     209                 :            : static inline int
     210                 :            : ixgbe_tx_desc_done(struct ci_tx_queue *txq, uint16_t idx)
     211                 :            : {
     212                 :          0 :         const uint32_t status = txq->ixgbe_tx_ring[idx].wb.status;
     213                 :            : 
     214   [ #  #  #  #  :          0 :         return !!(status & rte_cpu_to_le_32(IXGBE_ADVTXD_STAT_DD));
                   #  # ]
     215                 :            : }
     216                 :            : 
     217                 :            : #endif /* _IXGBE_RXTX_H_ */

Generated by: LCOV version 1.14