Merge tag 's390-5.19-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
[linux-2.6-microblaze.git] / net / mptcp / bpf.c
1 // SPDX-License-Identifier: GPL-2.0
2 /* Multipath TCP
3  *
4  * Copyright (c) 2020, Tessares SA.
5  * Copyright (c) 2022, SUSE.
6  *
7  * Author: Nicolas Rybowski <nicolas.rybowski@tessares.net>
8  */
9
10 #define pr_fmt(fmt) "MPTCP: " fmt
11
12 #include <linux/bpf.h>
13 #include "protocol.h"
14
15 struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk)
16 {
17         if (sk && sk_fullsock(sk) && sk->sk_protocol == IPPROTO_TCP && sk_is_mptcp(sk))
18                 return mptcp_sk(mptcp_subflow_ctx(sk)->conn);
19
20         return NULL;
21 }