1 /* 2 * Copyright (c) 2018-2019 Intel Corporation 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef TP_PRIV_H 8 #define TP_PRIV_H 9 10 #ifdef __cplusplus 11 extern "C" { 12 #endif 13 14 #include <sys/types.h> 15 #include <string.h> 16 #include <zephyr/kernel.h> 17 #include <zephyr/net/net_pkt.h> 18 19 #define tp_dbg(fmt, args...) printk("%s: " fmt "\n", __func__, ## args) 20 #define tp_err(fmt, args...) do { \ 21 printk("%s: Error: " fmt "\n", __func__, ## args); \ 22 k_oops(); \ 23 } while (0) 24 25 #define tp_assert(cond, fmt, args...) do { \ 26 if ((cond) == false) { \ 27 printk("%s: Assertion failed: %s, " fmt "\n", \ 28 __func__, #cond, ## args); \ 29 k_oops(); \ 30 } \ 31 } while (0) 32 33 #define is(_a, _b) (strcmp((_a), (_b)) == 0) 34 #define ip_get(_x) ((struct net_ipv4_hdr *) net_pkt_ip_data((_x))) 35 36 #define TP_MEM_HEADER_COOKIE 0xAAAAAAAA 37 #define TP_MEM_FOOTER_COOKIE 0xBBBBBBBB 38 39 struct tp_mem { 40 sys_snode_t next; 41 const char *file; 42 int line; 43 const char *func; 44 size_t size; 45 uint32_t *footer; 46 uint32_t header; 47 uint8_t mem[]; 48 }; 49 50 struct tp_nbuf { 51 sys_snode_t next; 52 struct net_buf *nbuf; 53 const char *file; 54 int line; 55 }; 56 57 struct tp_pkt { 58 sys_snode_t next; 59 struct net_pkt *pkt; 60 const char *file; 61 int line; 62 }; 63 64 struct tp_seq { 65 sys_snode_t next; 66 const char *file; 67 int line; 68 const char *func; 69 int kind; 70 int req; 71 uint32_t value; 72 uint32_t old_value; 73 int of; 74 }; 75 76 #ifdef __cplusplus 77 } 78 #endif 79 80 #endif /* TP_PRIV_H */ 81