LCOV - code coverage report
Current view: top level - lib/node - node_private.h (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 1 0.0 %
Date: 2024-02-14 00:53:57 Functions: 0 0 -
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 8 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright(C) 2020 Marvell International Ltd.
       3                 :            :  */
       4                 :            : 
       5                 :            : #ifndef __NODE_PRIVATE_H__
       6                 :            : #define __NODE_PRIVATE_H__
       7                 :            : 
       8                 :            : #include <rte_common.h>
       9                 :            : #include <rte_log.h>
      10                 :            : #include <rte_mbuf.h>
      11                 :            : #include <rte_mbuf_dyn.h>
      12                 :            : 
      13                 :            : extern int rte_node_logtype;
      14                 :            : #define RTE_LOGTYPE_NODE rte_node_logtype
      15                 :            : 
      16                 :            : #define NODE_LOG(level, node_name, ...)                                        \
      17                 :            :         RTE_LOG_LINE(level, NODE,                                              \
      18                 :            :                 RTE_FMT("%s: %s():%u " RTE_FMT_HEAD(__VA_ARGS__ ,),            \
      19                 :            :                         node_name, __func__, __LINE__,                         \
      20                 :            :                         RTE_FMT_TAIL(__VA_ARGS__ ,)))
      21                 :            : 
      22                 :            : #define node_err(node_name, ...) NODE_LOG(ERR, node_name, __VA_ARGS__)
      23                 :            : #define node_info(node_name, ...) NODE_LOG(INFO, node_name, __VA_ARGS__)
      24                 :            : #define node_dbg(node_name, ...) NODE_LOG(DEBUG, node_name, __VA_ARGS__)
      25                 :            : 
      26                 :            : /**
      27                 :            :  * Node mbuf private data to store next hop, ttl and checksum.
      28                 :            :  */
      29                 :            : struct node_mbuf_priv1 {
      30                 :            :         union {
      31                 :            :                 /* IP4/IP6 rewrite */
      32                 :            :                 struct {
      33                 :            :                         uint16_t nh;
      34                 :            :                         uint16_t ttl;
      35                 :            :                         uint32_t cksum;
      36                 :            :                 };
      37                 :            : 
      38                 :            :                 uint64_t u;
      39                 :            :         };
      40                 :            : };
      41                 :            : 
      42                 :            : static const struct rte_mbuf_dynfield node_mbuf_priv1_dynfield_desc = {
      43                 :            :         .name = "rte_node_dynfield_priv1",
      44                 :            :         .size = sizeof(struct node_mbuf_priv1),
      45                 :            :         .align = __alignof__(struct node_mbuf_priv1),
      46                 :            : };
      47                 :            : extern int node_mbuf_priv1_dynfield_offset;
      48                 :            : 
      49                 :            : /**
      50                 :            :  * Node mbuf private area 2.
      51                 :            :  */
      52                 :            : struct node_mbuf_priv2 {
      53                 :            :         uint64_t priv_data;
      54                 :            : } __rte_cache_aligned;
      55                 :            : 
      56                 :            : #define NODE_MBUF_PRIV2_SIZE sizeof(struct node_mbuf_priv2)
      57                 :            : 
      58                 :            : #define OBJS_PER_CLINE (RTE_CACHE_LINE_SIZE / sizeof(void *))
      59                 :            : 
      60                 :            : /**
      61                 :            :  * Get mbuf_priv1 pointer from rte_mbuf.
      62                 :            :  *
      63                 :            :  * @param
      64                 :            :  *   Pointer to the rte_mbuf.
      65                 :            :  *
      66                 :            :  * @return
      67                 :            :  *   Pointer to the mbuf_priv1.
      68                 :            :  */
      69                 :            : static __rte_always_inline struct node_mbuf_priv1 *
      70                 :            : node_mbuf_priv1(struct rte_mbuf *m, const int offset)
      71                 :            : {
      72   [ #  #  #  #  :          0 :         return RTE_MBUF_DYNFIELD(m, offset, struct node_mbuf_priv1 *);
             #  #  #  # ]
      73                 :            : }
      74                 :            : 
      75                 :            : /**
      76                 :            :  * Get mbuf_priv2 pointer from rte_mbuf.
      77                 :            :  *
      78                 :            :  * @param
      79                 :            :  *   Pointer to the rte_mbuf.
      80                 :            :  *
      81                 :            :  * @return
      82                 :            :  *   Pointer to the mbuf_priv2.
      83                 :            :  */
      84                 :            : static __rte_always_inline struct node_mbuf_priv2 *
      85                 :            : node_mbuf_priv2(struct rte_mbuf *m)
      86                 :            : {
      87                 :            :         return (struct node_mbuf_priv2 *)rte_mbuf_to_priv(m);
      88                 :            : }
      89                 :            : 
      90                 :            : #endif /* __NODE_PRIVATE_H__ */

Generated by: LCOV version 1.14