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

Generated by: LCOV version 1.14