LCOV - code coverage report
Current view: top level - lib/node - ip4_local.c (source / functions) Hit Total Coverage
Test: Code coverage Lines: 1 20 5.0 %
Date: 2025-03-01 20:23:48 Functions: 1 2 50.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 12 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright(C) 2023 Marvell International Ltd.
       3                 :            :  */
       4                 :            : 
       5                 :            : #include <arpa/inet.h>
       6                 :            : #include <sys/socket.h>
       7                 :            : 
       8                 :            : #include <rte_ethdev.h>
       9                 :            : #include <rte_ether.h>
      10                 :            : #include <rte_graph.h>
      11                 :            : #include <rte_graph_worker.h>
      12                 :            : #include <rte_ip.h>
      13                 :            : #include <rte_lpm.h>
      14                 :            : #include <rte_hash.h>
      15                 :            : #include <rte_fbk_hash.h>
      16                 :            : #include <rte_jhash.h>
      17                 :            : #include <rte_hash_crc.h>
      18                 :            : 
      19                 :            : #include "rte_node_ip4_api.h"
      20                 :            : 
      21                 :            : #include "node_private.h"
      22                 :            : 
      23                 :            : static uint16_t
      24                 :          0 : ip4_local_node_process_scalar(struct rte_graph *graph, struct rte_node *node,
      25                 :            :                               void **objs, uint16_t nb_objs)
      26                 :            : {
      27                 :            :         void **to_next, **from;
      28                 :            :         uint16_t last_spec = 0;
      29                 :            :         rte_edge_t next_index;
      30                 :            :         struct rte_mbuf *mbuf;
      31                 :            :         uint16_t held = 0;
      32                 :            :         uint32_t l4;
      33                 :            :         int i;
      34                 :            : 
      35                 :            :         /* Speculative next */
      36                 :            :         next_index = RTE_NODE_IP4_LOCAL_NEXT_UDP4_INPUT;
      37                 :            : 
      38                 :            :         from = objs;
      39                 :          0 :         to_next = rte_node_next_stream_get(graph, node, next_index, nb_objs);
      40         [ #  # ]:          0 :         for (i = 0; i < nb_objs; i++) {
      41                 :            :                 uint16_t next;
      42                 :            : 
      43                 :          0 :                 mbuf = (struct rte_mbuf *)objs[i];
      44                 :          0 :                 l4 = mbuf->packet_type & RTE_PTYPE_L4_MASK;
      45                 :            : 
      46         [ #  # ]:          0 :                 next = (l4 == RTE_PTYPE_L4_UDP)
      47                 :            :                                 ? next_index
      48                 :            :                                 : RTE_NODE_IP4_LOCAL_NEXT_PKT_DROP;
      49                 :            : 
      50         [ #  # ]:          0 :                 if (unlikely(next_index != next)) {
      51                 :            :                         /* Copy things successfully speculated till now */
      52         [ #  # ]:          0 :                         rte_memcpy(to_next, from, last_spec * sizeof(from[0]));
      53                 :          0 :                         from += last_spec;
      54                 :          0 :                         to_next += last_spec;
      55                 :          0 :                         held += last_spec;
      56                 :            :                         last_spec = 0;
      57                 :            : 
      58                 :          0 :                         rte_node_enqueue_x1(graph, node, next, from[0]);
      59                 :          0 :                         from += 1;
      60                 :            :                 } else {
      61                 :          0 :                         last_spec += 1;
      62                 :            :                 }
      63                 :            :         }
      64                 :            :         /* !!! Home run !!! */
      65         [ #  # ]:          0 :         if (likely(last_spec == nb_objs)) {
      66                 :          0 :                 rte_node_next_stream_move(graph, node, next_index);
      67                 :          0 :                 return nb_objs;
      68                 :            :         }
      69                 :          0 :         held += last_spec;
      70         [ #  # ]:          0 :         rte_memcpy(to_next, from, last_spec * sizeof(from[0]));
      71                 :            :         rte_node_next_stream_put(graph, node, next_index, held);
      72                 :            : 
      73                 :            :         return nb_objs;
      74                 :            : }
      75                 :            : 
      76                 :            : static struct rte_node_register ip4_local_node = {
      77                 :            :         .process = ip4_local_node_process_scalar,
      78                 :            :         .name = "ip4_local",
      79                 :            : 
      80                 :            :         .nb_edges = RTE_NODE_IP4_LOCAL_NEXT_PKT_DROP + 1,
      81                 :            :         .next_nodes = {
      82                 :            :                 [RTE_NODE_IP4_LOCAL_NEXT_UDP4_INPUT] = "udp4_input",
      83                 :            :                 [RTE_NODE_IP4_LOCAL_NEXT_PKT_DROP] = "pkt_drop",
      84                 :            :         },
      85                 :            : };
      86                 :            : 
      87                 :        252 : RTE_NODE_REGISTER(ip4_local_node);

Generated by: LCOV version 1.14