CNDP  22.08.0
node_private.h
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 <cne_common.h>
9 #include <cne_log.h>
10 #include <pktmbuf.h>
11 
12 #define NODE_LOG(level, node_name, ...) \
13  cne_log(CNE_LOG_##level, __func__, __LINE__, \
14  CNE_FMT("NODE: %s: " CNE_FMT_HEAD(__VA_ARGS__, ) "\n", node_name, \
15  CNE_FMT_TAIL(__VA_ARGS__, )))
16 
17 #define node_err(node_name, ...) NODE_LOG(ERR, node_name, __VA_ARGS__)
18 #define node_info(node_name, ...) NODE_LOG(INFO, node_name, __VA_ARGS__)
19 #define node_dbg(node_name, ...) NODE_LOG(DEBUG, node_name, __VA_ARGS__)
20 
25  union {
26  /* IP4 rewrite */
27  struct {
28  uint16_t nh;
29  uint16_t ttl;
30  uint32_t cksum;
31  };
32 
33  uint64_t u;
34  };
35 };
36 
37 extern int node_mbuf_priv1_dynfield_offset;
38 
43  uint64_t priv_data;
45 
46 #define NODE_MBUF_PRIV2_SIZE sizeof(struct node_mbuf_priv2)
47 
48 #define OBJS_PER_CLINE (CNE_CACHE_LINE_SIZE / sizeof(void *))
49 
60 node_mbuf_priv1(pktmbuf_t *m, const int offset)
61 {
62  return (struct node_mbuf_priv1 *)((char *)m + offset);
63 }
64 
76 {
77  return (struct node_mbuf_priv2 *)((char *)pktmbuf_udata64(m) + sizeof(uint64_t));
78 }
79 
80 #endif /* __NODE_PRIVATE_H__ */
#define __cne_cache_aligned
Definition: cne_common.h:379
#define __cne_always_inline
Definition: cne_common.h:218
#define pktmbuf_udata64(m)
Definition: pktmbuf.h:362