]>
git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blob - include/net/mptcp.h
1 /* SPDX-License-Identifier: GPL-2.0 */
5 * Copyright (c) 2017 - 2019, Intel Corporation.
11 #include <linux/skbuff.h>
12 #include <linux/types.h>
14 /* MPTCP sk_buff extension data */
31 void mptcp_init(void);
33 /* move the skb extension owership, with the assumption that 'to' is
36 static inline void mptcp_skb_ext_move(struct sk_buff
*to
,
39 if (!skb_ext_exist(from
, SKB_EXT_MPTCP
))
42 if (WARN_ON_ONCE(to
->active_extensions
))
45 to
->active_extensions
= from
->active_extensions
;
46 to
->extensions
= from
->extensions
;
47 from
->active_extensions
= 0;
50 static inline bool mptcp_ext_matches(const struct mptcp_ext
*to_ext
,
51 const struct mptcp_ext
*from_ext
)
53 /* MPTCP always clears the ext when adding it to the skb, so
54 * holes do not bother us here
57 (to_ext
&& from_ext
&&
58 !memcmp(from_ext
, to_ext
, sizeof(struct mptcp_ext
)));
61 /* check if skbs can be collapsed.
62 * MPTCP collapse is allowed if neither @to or @from carry an mptcp data
63 * mapping, or if the extension of @to is the same as @from.
64 * Collapsing is not possible if @to lacks an extension, but @from carries one.
66 static inline bool mptcp_skb_can_collapse(const struct sk_buff
*to
,
67 const struct sk_buff
*from
)
69 return mptcp_ext_matches(skb_ext_find(to
, SKB_EXT_MPTCP
),
70 skb_ext_find(from
, SKB_EXT_MPTCP
));
75 static inline void mptcp_init(void)
79 static inline void mptcp_skb_ext_move(struct sk_buff
*to
,
80 const struct sk_buff
*from
)
84 static inline bool mptcp_skb_can_collapse(const struct sk_buff
*to
,
85 const struct sk_buff
*from
)
90 #endif /* CONFIG_MPTCP */
92 #if IS_ENABLED(CONFIG_MPTCP_IPV6)
93 int mptcpv6_init(void);
94 #elif IS_ENABLED(CONFIG_IPV6)
95 static inline int mptcpv6_init(void)
101 #endif /* __NET_MPTCP_H */