77 lines
2.0 KiB
Diff
77 lines
2.0 KiB
Diff
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
|
|
index 0a14daa..ff8a1ad 100644
|
|
--- a/include/net/xfrm.h
|
|
+++ b/include/net/xfrm.h
|
|
@@ -196,6 +196,12 @@ struct xfrm_state {
|
|
struct hlist_node bysrc;
|
|
};
|
|
struct hlist_node byspi;
|
|
+#if defined(CONFIG_INET_IPSEC_OFFLOAD) || defined(CONFIG_INET6_IPSEC_OFFLOAD)
|
|
+ struct hlist_node byh;
|
|
+ u16 handle;
|
|
+ u16 in_byh_hash;
|
|
+ u16 parent_sa_handle; /* handle of the old SA from which this SA is created using rekey */
|
|
+#endif
|
|
struct hlist_node byseq;
|
|
struct hlist_node state_cache;
|
|
struct hlist_node state_cache_input;
|
|
@@ -314,6 +320,11 @@ struct xfrm_state {
|
|
/* Private data of this transformer, format is opaque,
|
|
* interpreted by xfrm_type methods. */
|
|
void *data;
|
|
+#if defined(CONFIG_INET_IPSEC_OFFLOAD) || defined(CONFIG_INET6_IPSEC_OFFLOAD)
|
|
+ /* Intended direction of this state, used for offloading */
|
|
+ int offloaded;
|
|
+ u64 curr_time;
|
|
+#endif
|
|
u8 dir;
|
|
|
|
const struct xfrm_mode_cbs *mode_cbs;
|
|
@@ -337,6 +348,13 @@ enum {
|
|
XFRM_STATE_EXPIRED,
|
|
XFRM_STATE_DEAD
|
|
};
|
|
+#if defined(CONFIG_INET_IPSEC_OFFLOAD) || defined(CONFIG_INET6_IPSEC_OFFLOAD)
|
|
+enum {
|
|
+ XFRM_STATE_DIR_UNKNOWN,
|
|
+ XFRM_STATE_DIR_IN,
|
|
+ XFRM_STATE_DIR_OUT,
|
|
+};
|
|
+#endif
|
|
|
|
/* callback structure passed from either netlink or pfkey */
|
|
struct km_event {
|
|
@@ -1173,6 +1191,32 @@ struct sec_path {
|
|
|
|
struct sec_path *secpath_set(struct sk_buff *skb);
|
|
|
|
+#if defined(CONFIG_INET_IPSEC_OFFLOAD) || defined(CONFIG_INET6_IPSEC_OFFLOAD)
|
|
+struct xfrm_input_shared {
|
|
+ struct sk_buff *skb;
|
|
+ int xfrm_nr, first, xfrm_encap;
|
|
+ struct xfrm_state *xfrm_vec[XFRM_MAX_DEPTH];
|
|
+ __u16 encap_type;
|
|
+ int decaps;
|
|
+ u32 seq, spi;
|
|
+ unsigned int nhoff;
|
|
+ int nexthdr;
|
|
+ int (*callback)(struct xfrm_input_shared *sh);
|
|
+ atomic_t refcnt;
|
|
+};
|
|
+
|
|
+static inline void xfrm_shared_get(struct xfrm_input_shared *sh)
|
|
+{
|
|
+ atomic_inc(&sh->refcnt);
|
|
+}
|
|
+
|
|
+static inline void xfrm_shared_put(struct xfrm_input_shared *sh)
|
|
+{
|
|
+ if (atomic_dec_and_test(&sh->refcnt))
|
|
+ kfree(sh);
|
|
+}
|
|
+#endif
|
|
+
|
|
static inline void
|
|
secpath_reset(struct sk_buff *skb)
|
|
{
|