summaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat.h
diff options
context:
space:
mode:
authorFilip Varga <fivarga@cisco.com>2020-05-07 14:28:56 +0200
committerOle Trøan <otroan@employees.org>2020-05-07 17:04:00 +0000
commit9bb09afb56b1aa787ca574cc732085272059fd5f (patch)
tree38a3051033c5ed864386969f710a07b89c224728 /src/plugins/nat/nat.h
parent5505ee8904fafc7c1f017f88853f80a616784cf2 (diff)
nat: fix per thread data vlib_main_t usage
Type: fix Change-Id: If6784c9eb278f525e05304d10fd1a00641faaaf0 Signed-off-by: Filip Varga <fivarga@cisco.com>
Diffstat (limited to 'src/plugins/nat/nat.h')
-rw-r--r--src/plugins/nat/nat.h66
1 files changed, 34 insertions, 32 deletions
diff --git a/src/plugins/nat/nat.h b/src/plugins/nat/nat.h
index 4a3ae6532aa..1245b850ed0 100644
--- a/src/plugins/nat/nat.h
+++ b/src/plugins/nat/nat.h
@@ -489,6 +489,9 @@ typedef struct
/* real thread index */
u32 thread_index;
+ // per thread data structures
+ vlib_main_t *vlib_main;
+
} snat_main_per_thread_data_t;
struct snat_main_s;
@@ -674,7 +677,6 @@ typedef struct snat_main_s
u8 log_level;
/* convenience */
- vlib_main_t *vlib_main;
vnet_main_t *vnet_main;
ip4_main_t *ip4_main;
ip_lookup_main_t *ip4_lookup_main;
@@ -850,19 +852,19 @@ typedef enum nat_log_level_t_
#undef _
} nat_log_level_t;
-#define nat_elog(_level, _str) \
-do \
- { \
- snat_main_t *sm = &snat_main; \
- if (PREDICT_FALSE (sm->log_level >= _level)) \
- { \
- ELOG_TYPE_DECLARE (e) = \
- { \
- .format = "nat-msg " _str, \
- .format_args = "", \
- }; \
- ELOG_DATA (&sm->vlib_main->elog_main, e); \
- } \
+#define nat_elog(_level, _str) \
+do \
+ { \
+ snat_main_t *sm = &snat_main; \
+ if (PREDICT_FALSE (sm->log_level >= _level)) \
+ { \
+ ELOG_TYPE_DECLARE (e) = \
+ { \
+ .format = "nat-msg " _str, \
+ .format_args = "", \
+ }; \
+ ELOG_DATA (&vlib_global_main.elog_main, e); \
+ } \
} while (0);
#define nat_elog_addr(_level, _str, _addr) \
@@ -970,24 +972,24 @@ do \
} \
} while (0);
-#define nat_elog_X1(_level, _fmt, _arg, _val1) \
-do \
- { \
- snat_main_t *sm = &snat_main; \
- if (PREDICT_FALSE (sm->log_level >= _level)) \
- { \
- ELOG_TYPE_DECLARE (e) = \
- { \
- .format = "nat-msg " _fmt, \
- .format_args = _arg, \
- }; \
- CLIB_PACKED(struct \
- { \
- typeof (_val1) val1; \
- }) *ed; \
- ed = ELOG_DATA (&sm->vlib_main->elog_main, e); \
- ed->val1 = _val1; \
- } \
+#define nat_elog_X1(_level, _fmt, _arg, _val1) \
+do \
+ { \
+ snat_main_t *sm = &snat_main; \
+ if (PREDICT_FALSE (sm->log_level >= _level)) \
+ { \
+ ELOG_TYPE_DECLARE (e) = \
+ { \
+ .format = "nat-msg " _fmt, \
+ .format_args = _arg, \
+ }; \
+ CLIB_PACKED(struct \
+ { \
+ typeof (_val1) val1; \
+ }) *ed; \
+ ed = ELOG_DATA (&vlib_global_main.elog_main, e); \
+ ed->val1 = _val1; \
+ } \
} while (0);
#define nat_elog_notice(nat_elog_str) \