Merge tag 'perf-tools-fixes-for-v6.4-1-2023-05-20' of git://git.kernel.org/pub/scm...
[linux-block.git] / net / mptcp / bpf.c
CommitLineData
3bc253c2
GT
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
15struct 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}