Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
cnat: fixes & prepare maglev
[vpp.git]
/
src
/
plugins
/
cnat
/
cnat_session.h
diff --git
a/src/plugins/cnat/cnat_session.h
b/src/plugins/cnat/cnat_session.h
index
4699dcc
..
540a2f2
100644
(file)
--- a/
src/plugins/cnat/cnat_session.h
+++ b/
src/plugins/cnat/cnat_session.h
@@
-16,12
+16,11
@@
#ifndef __CNAT_SESSION_H__
#define __CNAT_SESSION_H__
#ifndef __CNAT_SESSION_H__
#define __CNAT_SESSION_H__
-#include <vnet/udp/udp.h>
+#include <vnet/udp/udp
_packet
.h>
#include <cnat/cnat_types.h>
#include <cnat/cnat_client.h>
#include <cnat/cnat_types.h>
#include <cnat/cnat_client.h>
-#include <cnat/bihash_40_48.h>
-
+#include <cnat/cnat_bihash.h>
/**
* A session represents the memory of a translation.
/**
* A session represents the memory of a translation.
@@
-63,9
+62,11
@@
typedef struct cnat_session_t_
u8 cs_af;
/**
u8 cs_af;
/**
- *
spare space
+ *
input / output / fib session
*/
*/
- u8 __cs_pad[2];
+ u8 cs_loc;
+
+ u8 __cs_pad;
} key;
/**
* this value sits in the same memory location a 'value' in the bihash kvp
} key;
/**
* this value sits in the same memory location a 'value' in the bihash kvp
@@
-87,43
+88,67
@@
typedef struct cnat_session_t_
*/
index_t cs_lbi;
*/
index_t cs_lbi;
+ /**
+ * Persist translation->ct_lb.dpoi_next_node
+ */
+ u32 dpoi_next_node;
+
/**
* Timestamp index this session was last used
*/
u32 cs_ts_index;
/**
* Timestamp index this session was last used
*/
u32 cs_ts_index;
+
/**
/**
- * Indicates a return path session that was source NATed
- * on the way in.
+ * session flags
*/
u32 flags;
*/
u32 flags;
+
+ u32 __pad;
} value;
} cnat_session_t;
typedef enum cnat_session_flag_t_
{
} value;
} cnat_session_t;
typedef enum cnat_session_flag_t_
{
+ /**
+ * Indicates a return path session that was source NATed
+ * on the way in.
+ */
CNAT_SESSION_FLAG_HAS_SNAT = (1 << 0),
CNAT_SESSION_FLAG_HAS_SNAT = (1 << 0),
+ /**
+ * This session source port was allocated, free it on cleanup
+ */
CNAT_SESSION_FLAG_ALLOC_PORT = (1 << 1),
CNAT_SESSION_FLAG_ALLOC_PORT = (1 << 1),
+ /**
+ * This session doesn't have a client, do not attempt to free it
+ */
CNAT_SESSION_FLAG_NO_CLIENT = (1 << 2),
} cnat_session_flag_t;
CNAT_SESSION_FLAG_NO_CLIENT = (1 << 2),
} cnat_session_flag_t;
+typedef enum cnat_session_location_t_
+{
+ CNAT_LOCATION_INPUT = 0,
+ CNAT_LOCATION_OUTPUT = 1,
+ CNAT_LOCATION_FIB = 0xff,
+} cnat_session_location_t;
+
extern u8 *format_cnat_session (u8 * s, va_list * args);
/**
* Ensure the session object correctly overlays the bihash key/value pair
*/
STATIC_ASSERT (STRUCT_OFFSET_OF (cnat_session_t, key) ==
extern u8 *format_cnat_session (u8 * s, va_list * args);
/**
* Ensure the session object correctly overlays the bihash key/value pair
*/
STATIC_ASSERT (STRUCT_OFFSET_OF (cnat_session_t, key) ==
-
STRUCT_OFFSET_OF (clib_bihash_kv_40_48
_t, key),
+
STRUCT_OFFSET_OF (cnat_bihash_kv
_t, key),
"key overlaps");
STATIC_ASSERT (STRUCT_OFFSET_OF (cnat_session_t, value) ==
"key overlaps");
STATIC_ASSERT (STRUCT_OFFSET_OF (cnat_session_t, value) ==
-
STRUCT_OFFSET_OF (clib_bihash_kv_40_48
_t, value),
+
STRUCT_OFFSET_OF (cnat_bihash_kv
_t, value),
"value overlaps");
"value overlaps");
-STATIC_ASSERT (sizeof (cnat_session_t) == sizeof (c
lib_bihash_kv_40_48
_t),
+STATIC_ASSERT (sizeof (cnat_session_t) == sizeof (c
nat_bihash_kv
_t),
"session kvp");
/**
* The DB of sessions
*/
"session kvp");
/**
* The DB of sessions
*/
-extern c
lib_bihash_40_48
_t cnat_session_db;
+extern c
nat_bihash
_t cnat_session_db;
/**
* Callback function invoked during a walk of all translations
/**
* Callback function invoked during a walk of all translations
@@
-151,6
+176,11
@@
extern int cnat_session_purge (void);
*/
extern void cnat_session_free (cnat_session_t * session);
*/
extern void cnat_session_free (cnat_session_t * session);
+/**
+ * Port cleanup callback
+ */
+extern void (*cnat_free_port_cb) (u16 port, ip_protocol_t iproto);
+
/*
* fd.io coding-style-patch-verification: ON
*
/*
* fd.io coding-style-patch-verification: ON
*