LCOV - code coverage report
Current view: top level - drivers/net/cnxk - cn10k_rx_select.c (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 2 0.0 %
Date: 2025-07-01 21:32:37 Functions: 0 1 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright(C) 2021 Marvell.
       3                 :            :  */
       4                 :            : 
       5                 :            : #include "cn10k_ethdev.h"
       6                 :            : #include "cn10k_rx.h"
       7                 :            : 
       8                 :            : #if defined(RTE_ARCH_ARM64) && !defined(CNXK_DIS_TMPLT_FUNC)
       9                 :            : static void
      10                 :            : pick_rx_func(struct rte_eth_dev *eth_dev,
      11                 :            :              const eth_rx_burst_t rx_burst[NIX_RX_OFFLOAD_MAX])
      12                 :            : {
      13                 :            :         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
      14                 :            : 
      15                 :            :         /* [VLAN] [TSP] [MARK] [CKSUM] [PTYPE] [RSS] */
      16                 :            :         eth_dev->rx_pkt_burst =
      17                 :            :                 rx_burst[dev->rx_offload_flags & (NIX_RX_OFFLOAD_MAX - 1)];
      18                 :            : 
      19                 :            :         if (eth_dev->data->dev_started)
      20                 :            :                 rte_eth_fp_ops[eth_dev->data->port_id].rx_pkt_burst =
      21                 :            :                         eth_dev->rx_pkt_burst;
      22                 :            : 
      23                 :            :         rte_atomic_thread_fence(rte_memory_order_release);
      24                 :            : }
      25                 :            : #endif
      26                 :            : 
      27                 :            : static uint16_t __rte_noinline __rte_hot __rte_unused
      28                 :            : cn10k_nix_flush_rx(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)
      29                 :            : {
      30                 :            :         const uint16_t flags = NIX_RX_MULTI_SEG_F | NIX_RX_REAS_F | NIX_RX_OFFLOAD_SECURITY_F;
      31                 :            :         return cn10k_nix_flush_recv_pkts(rx_queue, rx_pkts, pkts, flags);
      32                 :            : }
      33                 :            : 
      34                 :            : #if defined(RTE_ARCH_ARM64)
      35                 :            : static void
      36                 :            : cn10k_eth_set_rx_tmplt_func(struct rte_eth_dev *eth_dev)
      37                 :            : {
      38                 :            : #if !defined(CNXK_DIS_TMPLT_FUNC)
      39                 :            :         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
      40                 :            : 
      41                 :            :         const eth_rx_burst_t nix_eth_rx_burst[NIX_RX_OFFLOAD_MAX] = {
      42                 :            : #define R(name, flags)[flags] = cn10k_nix_recv_pkts_##name,
      43                 :            : 
      44                 :            :                 NIX_RX_FASTPATH_MODES
      45                 :            : #undef R
      46                 :            :         };
      47                 :            : 
      48                 :            :         const eth_rx_burst_t nix_eth_rx_burst_mseg[NIX_RX_OFFLOAD_MAX] = {
      49                 :            : #define R(name, flags)[flags] = cn10k_nix_recv_pkts_mseg_##name,
      50                 :            : 
      51                 :            :                 NIX_RX_FASTPATH_MODES
      52                 :            : #undef R
      53                 :            :         };
      54                 :            : 
      55                 :            :         const eth_rx_burst_t nix_eth_rx_burst_reas[NIX_RX_OFFLOAD_MAX] = {
      56                 :            : #define R(name, flags)[flags] = cn10k_nix_recv_pkts_reas_##name,
      57                 :            :                 NIX_RX_FASTPATH_MODES
      58                 :            : #undef R
      59                 :            :         };
      60                 :            : 
      61                 :            :         const eth_rx_burst_t nix_eth_rx_burst_mseg_reas[NIX_RX_OFFLOAD_MAX] = {
      62                 :            : #define R(name, flags)[flags] = cn10k_nix_recv_pkts_reas_mseg_##name,
      63                 :            :                 NIX_RX_FASTPATH_MODES
      64                 :            : #undef R
      65                 :            :         };
      66                 :            : 
      67                 :            :         const eth_rx_burst_t nix_eth_rx_vec_burst[NIX_RX_OFFLOAD_MAX] = {
      68                 :            : #define R(name, flags)[flags] = cn10k_nix_recv_pkts_vec_##name,
      69                 :            : 
      70                 :            :                 NIX_RX_FASTPATH_MODES
      71                 :            : #undef R
      72                 :            :         };
      73                 :            : 
      74                 :            :         const eth_rx_burst_t nix_eth_rx_vec_burst_mseg[NIX_RX_OFFLOAD_MAX] = {
      75                 :            : #define R(name, flags)[flags] = cn10k_nix_recv_pkts_vec_mseg_##name,
      76                 :            : 
      77                 :            :                 NIX_RX_FASTPATH_MODES
      78                 :            : #undef R
      79                 :            :         };
      80                 :            : 
      81                 :            :         const eth_rx_burst_t nix_eth_rx_vec_burst_reas[NIX_RX_OFFLOAD_MAX] = {
      82                 :            : #define R(name, flags)[flags] = cn10k_nix_recv_pkts_reas_vec_##name,
      83                 :            :                 NIX_RX_FASTPATH_MODES
      84                 :            : #undef R
      85                 :            :         };
      86                 :            : 
      87                 :            :         const eth_rx_burst_t nix_eth_rx_vec_burst_mseg_reas[NIX_RX_OFFLOAD_MAX] = {
      88                 :            : #define R(name, flags)[flags] = cn10k_nix_recv_pkts_reas_vec_mseg_##name,
      89                 :            :                 NIX_RX_FASTPATH_MODES
      90                 :            : #undef R
      91                 :            :         };
      92                 :            : 
      93                 :            :         /* Copy multi seg version with security for tear down sequence */
      94                 :            :         if (rte_eal_process_type() == RTE_PROC_PRIMARY)
      95                 :            :                 dev->rx_pkt_burst_no_offload = cn10k_nix_flush_rx;
      96                 :            : 
      97                 :            :         if (dev->scalar_ena) {
      98                 :            :                 if (dev->rx_offloads & RTE_ETH_RX_OFFLOAD_SCATTER) {
      99                 :            :                         if (dev->rx_offload_flags & NIX_RX_REAS_F)
     100                 :            :                                 return pick_rx_func(eth_dev,
     101                 :            :                                                 nix_eth_rx_burst_mseg_reas);
     102                 :            :                         else
     103                 :            :                                 return pick_rx_func(eth_dev,
     104                 :            :                                                 nix_eth_rx_burst_mseg);
     105                 :            :                 }
     106                 :            :                 if (dev->rx_offload_flags & NIX_RX_REAS_F)
     107                 :            :                         return pick_rx_func(eth_dev, nix_eth_rx_burst_reas);
     108                 :            :                 else
     109                 :            :                         return pick_rx_func(eth_dev, nix_eth_rx_burst);
     110                 :            :         }
     111                 :            : 
     112                 :            :         if (dev->rx_offloads & RTE_ETH_RX_OFFLOAD_SCATTER) {
     113                 :            :                 if (dev->rx_offload_flags & NIX_RX_REAS_F)
     114                 :            :                         return pick_rx_func(eth_dev,
     115                 :            :                                         nix_eth_rx_vec_burst_mseg_reas);
     116                 :            :                 else
     117                 :            :                         return pick_rx_func(eth_dev, nix_eth_rx_vec_burst_mseg);
     118                 :            :         }
     119                 :            : 
     120                 :            :         if (dev->rx_offload_flags & NIX_RX_REAS_F)
     121                 :            :                 return pick_rx_func(eth_dev, nix_eth_rx_vec_burst_reas);
     122                 :            :         else
     123                 :            :                 return pick_rx_func(eth_dev, nix_eth_rx_vec_burst);
     124                 :            : #else
     125                 :            :         RTE_SET_USED(eth_dev);
     126                 :            : #endif
     127                 :            : }
     128                 :            : 
     129                 :            : static void
     130                 :            : cn10k_eth_set_rx_blk_func(struct rte_eth_dev *eth_dev)
     131                 :            : {
     132                 :            : #if defined(CNXK_DIS_TMPLT_FUNC)
     133                 :            :         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
     134                 :            : 
     135                 :            :         /* Copy multi seg version with security for tear down sequence */
     136                 :            :         if (rte_eal_process_type() == RTE_PROC_PRIMARY)
     137                 :            :                 dev->rx_pkt_burst_no_offload = cn10k_nix_flush_rx;
     138                 :            : 
     139                 :            :         if (dev->scalar_ena) {
     140                 :            :                 eth_dev->rx_pkt_burst = cn10k_nix_recv_pkts_all_offload;
     141                 :            :                 if (dev->rx_offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP)
     142                 :            :                         eth_dev->rx_pkt_burst = cn10k_nix_recv_pkts_all_offload_tst;
     143                 :            :         } else {
     144                 :            :                 eth_dev->rx_pkt_burst = cn10k_nix_recv_pkts_vec_all_offload;
     145                 :            :                 if (dev->rx_offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP)
     146                 :            :                         eth_dev->rx_pkt_burst = cn10k_nix_recv_pkts_vec_all_offload_tst;
     147                 :            :         }
     148                 :            : 
     149                 :            :         if (eth_dev->data->dev_started)
     150                 :            :                 rte_eth_fp_ops[eth_dev->data->port_id].rx_pkt_burst = eth_dev->rx_pkt_burst;
     151                 :            : #else
     152                 :            :         RTE_SET_USED(eth_dev);
     153                 :            : #endif
     154                 :            : }
     155                 :            : #endif
     156                 :            : 
     157                 :            : void
     158                 :          0 : cn10k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
     159                 :            : {
     160                 :            : #if defined(RTE_ARCH_ARM64)
     161                 :            :         cn10k_eth_set_rx_blk_func(eth_dev);
     162                 :            :         cn10k_eth_set_rx_tmplt_func(eth_dev);
     163                 :            : 
     164                 :            :         rte_atomic_thread_fence(rte_memory_order_release);
     165                 :            : #else
     166                 :            :         RTE_SET_USED(eth_dev);
     167                 :            : #endif
     168                 :          0 : }

Generated by: LCOV version 1.14