aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/psp/functions.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/psp/functions.h')
-rw-r--r--include/net/psp/functions.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/net/psp/functions.h b/include/net/psp/functions.h
index 0d7141230f47..183a3c9216b7 100644
--- a/include/net/psp/functions.h
+++ b/include/net/psp/functions.h
@@ -5,6 +5,7 @@
#include <linux/skbuff.h>
#include <linux/rcupdate.h>
+#include <linux/udp.h>
#include <net/sock.h>
#include <net/tcp.h>
#include <net/psp/types.h>
@@ -143,6 +144,14 @@ static inline struct psp_assoc *psp_skb_get_assoc_rcu(struct sk_buff *skb)
return psp_sk_get_assoc_rcu(skb->sk);
}
+
+static inline unsigned int psp_sk_overhead(const struct sock *sk)
+{
+ int psp_encap = sizeof(struct udphdr) + PSP_HDR_SIZE + PSP_TRL_SIZE;
+ bool has_psp = rcu_access_pointer(sk->psp_assoc);
+
+ return has_psp ? psp_encap : 0;
+}
#else
static inline void psp_sk_assoc_free(struct sock *sk) { }
static inline void
@@ -182,6 +191,11 @@ static inline struct psp_assoc *psp_skb_get_assoc_rcu(struct sk_buff *skb)
{
return NULL;
}
+
+static inline unsigned int psp_sk_overhead(const struct sock *sk)
+{
+ return 0;
+}
#endif
static inline unsigned long