LCOV - code coverage report
Current view: top level - drivers/net/cnxk - cn20k_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) 2024 Marvell.
       3                 :            :  */
       4                 :            : 
       5                 :            : #include "cn20k_ethdev.h"
       6                 :            : #include "cn20k_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, const eth_rx_burst_t rx_burst[NIX_RX_OFFLOAD_MAX])
      11                 :            : {
      12                 :            :         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
      13                 :            : 
      14                 :            :         /* [VLAN] [TSP] [MARK] [CKSUM] [PTYPE] [RSS] */
      15                 :            :         eth_dev->rx_pkt_burst = rx_burst[dev->rx_offload_flags & (NIX_RX_OFFLOAD_MAX - 1)];
      16                 :            : 
      17                 :            :         if (eth_dev->data->dev_started)
      18                 :            :                 rte_eth_fp_ops[eth_dev->data->port_id].rx_pkt_burst = eth_dev->rx_pkt_burst;
      19                 :            : 
      20                 :            :         rte_atomic_thread_fence(rte_memory_order_release);
      21                 :            : }
      22                 :            : #endif
      23                 :            : 
      24                 :            : static uint16_t __rte_noinline __rte_hot __rte_unused
      25                 :            : cn20k_nix_flush_rx(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)
      26                 :            : {
      27                 :            :         const uint16_t flags = NIX_RX_MULTI_SEG_F | NIX_RX_REAS_F | NIX_RX_OFFLOAD_SECURITY_F;
      28                 :            :         return cn20k_nix_flush_recv_pkts(rx_queue, rx_pkts, pkts, flags);
      29                 :            : }
      30                 :            : 
      31                 :            : #if defined(RTE_ARCH_ARM64)
      32                 :            : static void
      33                 :            : cn20k_eth_set_rx_tmplt_func(struct rte_eth_dev *eth_dev)
      34                 :            : {
      35                 :            : #if !defined(CNXK_DIS_TMPLT_FUNC)
      36                 :            :         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
      37                 :            : 
      38                 :            :         const eth_rx_burst_t nix_eth_rx_burst[NIX_RX_OFFLOAD_MAX] = {
      39                 :            : #define R(name, flags) [flags] = cn20k_nix_recv_pkts_##name,
      40                 :            : 
      41                 :            :                 NIX_RX_FASTPATH_MODES
      42                 :            : #undef R
      43                 :            :         };
      44                 :            : 
      45                 :            :         const eth_rx_burst_t nix_eth_rx_burst_mseg[NIX_RX_OFFLOAD_MAX] = {
      46                 :            : #define R(name, flags) [flags] = cn20k_nix_recv_pkts_mseg_##name,
      47                 :            : 
      48                 :            :                 NIX_RX_FASTPATH_MODES
      49                 :            : #undef R
      50                 :            :         };
      51                 :            : 
      52                 :            :         const eth_rx_burst_t nix_eth_rx_burst_reas[NIX_RX_OFFLOAD_MAX] = {
      53                 :            : #define R(name, flags) [flags] = cn20k_nix_recv_pkts_reas_##name,
      54                 :            :                 NIX_RX_FASTPATH_MODES
      55                 :            : #undef R
      56                 :            :         };
      57                 :            : 
      58                 :            :         const eth_rx_burst_t nix_eth_rx_burst_mseg_reas[NIX_RX_OFFLOAD_MAX] = {
      59                 :            : #define R(name, flags) [flags] = cn20k_nix_recv_pkts_reas_mseg_##name,
      60                 :            :                 NIX_RX_FASTPATH_MODES
      61                 :            : #undef R
      62                 :            :         };
      63                 :            : 
      64                 :            :         const eth_rx_burst_t nix_eth_rx_vec_burst[NIX_RX_OFFLOAD_MAX] = {
      65                 :            : #define R(name, flags) [flags] = cn20k_nix_recv_pkts_vec_##name,
      66                 :            : 
      67                 :            :                 NIX_RX_FASTPATH_MODES
      68                 :            : #undef R
      69                 :            :         };
      70                 :            : 
      71                 :            :         const eth_rx_burst_t nix_eth_rx_vec_burst_mseg[NIX_RX_OFFLOAD_MAX] = {
      72                 :            : #define R(name, flags) [flags] = cn20k_nix_recv_pkts_vec_mseg_##name,
      73                 :            : 
      74                 :            :                 NIX_RX_FASTPATH_MODES
      75                 :            : #undef R
      76                 :            :         };
      77                 :            : 
      78                 :            :         const eth_rx_burst_t nix_eth_rx_vec_burst_reas[NIX_RX_OFFLOAD_MAX] = {
      79                 :            : #define R(name, flags) [flags] = cn20k_nix_recv_pkts_reas_vec_##name,
      80                 :            :                 NIX_RX_FASTPATH_MODES
      81                 :            : #undef R
      82                 :            :         };
      83                 :            : 
      84                 :            :         const eth_rx_burst_t nix_eth_rx_vec_burst_mseg_reas[NIX_RX_OFFLOAD_MAX] = {
      85                 :            : #define R(name, flags) [flags] = cn20k_nix_recv_pkts_reas_vec_mseg_##name,
      86                 :            :                 NIX_RX_FASTPATH_MODES
      87                 :            : #undef R
      88                 :            :         };
      89                 :            : 
      90                 :            :         /* Copy multi seg version with security for tear down sequence */
      91                 :            :         if (rte_eal_process_type() == RTE_PROC_PRIMARY)
      92                 :            :                 dev->rx_pkt_burst_no_offload = cn20k_nix_flush_rx;
      93                 :            : 
      94                 :            :         if (dev->scalar_ena) {
      95                 :            :                 if (dev->rx_offloads & RTE_ETH_RX_OFFLOAD_SCATTER) {
      96                 :            :                         if (dev->rx_offload_flags & NIX_RX_REAS_F)
      97                 :            :                                 return pick_rx_func(eth_dev, nix_eth_rx_burst_mseg_reas);
      98                 :            :                         else
      99                 :            :                                 return pick_rx_func(eth_dev, nix_eth_rx_burst_mseg);
     100                 :            :                 }
     101                 :            :                 if (dev->rx_offload_flags & NIX_RX_REAS_F)
     102                 :            :                         return pick_rx_func(eth_dev, nix_eth_rx_burst_reas);
     103                 :            :                 else
     104                 :            :                         return pick_rx_func(eth_dev, nix_eth_rx_burst);
     105                 :            :         }
     106                 :            : 
     107                 :            :         if (dev->rx_offloads & RTE_ETH_RX_OFFLOAD_SCATTER) {
     108                 :            :                 if (dev->rx_offload_flags & NIX_RX_REAS_F)
     109                 :            :                         return pick_rx_func(eth_dev, nix_eth_rx_vec_burst_mseg_reas);
     110                 :            :                 else
     111                 :            :                         return pick_rx_func(eth_dev, nix_eth_rx_vec_burst_mseg);
     112                 :            :         }
     113                 :            : 
     114                 :            :         if (dev->rx_offload_flags & NIX_RX_REAS_F)
     115                 :            :                 return pick_rx_func(eth_dev, nix_eth_rx_vec_burst_reas);
     116                 :            :         else
     117                 :            :                 return pick_rx_func(eth_dev, nix_eth_rx_vec_burst);
     118                 :            : #else
     119                 :            :         RTE_SET_USED(eth_dev);
     120                 :            : #endif
     121                 :            : }
     122                 :            : 
     123                 :            : static void
     124                 :            : cn20k_eth_set_rx_blk_func(struct rte_eth_dev *eth_dev)
     125                 :            : {
     126                 :            : #if defined(CNXK_DIS_TMPLT_FUNC)
     127                 :            :         struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
     128                 :            : 
     129                 :            :         /* Copy multi seg version with security for tear down sequence */
     130                 :            :         if (rte_eal_process_type() == RTE_PROC_PRIMARY)
     131                 :            :                 dev->rx_pkt_burst_no_offload = cn20k_nix_flush_rx;
     132                 :            : 
     133                 :            :         if (dev->scalar_ena) {
     134                 :            :                 eth_dev->rx_pkt_burst = cn20k_nix_recv_pkts_all_offload;
     135                 :            :                 if (dev->rx_offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP)
     136                 :            :                         eth_dev->rx_pkt_burst = cn20k_nix_recv_pkts_all_offload_tst;
     137                 :            :         } else {
     138                 :            :                 eth_dev->rx_pkt_burst = cn20k_nix_recv_pkts_vec_all_offload;
     139                 :            :                 if (dev->rx_offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP)
     140                 :            :                         eth_dev->rx_pkt_burst = cn20k_nix_recv_pkts_vec_all_offload_tst;
     141                 :            :         }
     142                 :            : 
     143                 :            :         if (eth_dev->data->dev_started)
     144                 :            :                 rte_eth_fp_ops[eth_dev->data->port_id].rx_pkt_burst = eth_dev->rx_pkt_burst;
     145                 :            : #else
     146                 :            :         RTE_SET_USED(eth_dev);
     147                 :            : #endif
     148                 :            : }
     149                 :            : #endif
     150                 :            : 
     151                 :            : void
     152                 :          0 : cn20k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
     153                 :            : {
     154                 :            : #if defined(RTE_ARCH_ARM64)
     155                 :            :         cn20k_eth_set_rx_blk_func(eth_dev);
     156                 :            :         cn20k_eth_set_rx_tmplt_func(eth_dev);
     157                 :            : 
     158                 :            :         rte_atomic_thread_fence(rte_memory_order_release);
     159                 :            : #else
     160                 :            :         RTE_SET_USED(eth_dev);
     161                 :            : #endif
     162                 :          0 : }

Generated by: LCOV version 1.14