[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220517010730.mmv6u2h25xyz4uwl@kafai-mbp.dhcp.thefacebook.com>
Date: Mon, 16 May 2022 18:07:30 -0700
From: Martin KaFai Lau <kafai@...com>
To: Geliang Tang <geliang.tang@...e.com>,
Mat Martineau <mathew.j.martineau@...ux.intel.com>
Cc: netdev@...r.kernel.org, bpf@...r.kernel.org, ast@...nel.org,
daniel@...earbox.net, andrii@...nel.org, mptcp@...ts.linux.dev,
Nicolas Rybowski <nicolas.rybowski@...sares.net>,
Matthieu Baerts <matthieu.baerts@...sares.net>
Subject: Re: [PATCH bpf-next v4 1/7] bpf: add bpf_skc_to_mptcp_sock_proto
On Fri, May 13, 2022 at 03:48:21PM -0700, Mat Martineau wrote:
[ ... ]
> diff --git a/include/net/mptcp.h b/include/net/mptcp.h
> index 8b1afd6f5cc4..2ba09de955c7 100644
> --- a/include/net/mptcp.h
> +++ b/include/net/mptcp.h
> @@ -284,4 +284,10 @@ static inline int mptcpv6_init(void) { return 0; }
> static inline void mptcpv6_handle_mapped(struct sock *sk, bool mapped) { }
> #endif
>
> +#if defined(CONFIG_MPTCP) && defined(CONFIG_BPF_SYSCALL)
> +struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk);
Can this be inline ?
> +#else
> +static inline struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk) { return NULL; }
> +#endif
> +
> #endif /* __NET_MPTCP_H */
[ ... ]
> diff --git a/net/mptcp/bpf.c b/net/mptcp/bpf.c
> new file mode 100644
> index 000000000000..535602ba2582
> --- /dev/null
> +++ b/net/mptcp/bpf.c
> @@ -0,0 +1,22 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Multipath TCP
> + *
> + * Copyright (c) 2020, Tessares SA.
> + * Copyright (c) 2022, SUSE.
> + *
> + * Author: Nicolas Rybowski <nicolas.rybowski@...sares.net>
> + */
> +
> +#define pr_fmt(fmt) "MPTCP: " fmt
> +
> +#include <linux/bpf.h>
> +#include "protocol.h"
> +
> +struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk)
> +{
> + if (sk && sk_fullsock(sk) && sk->sk_protocol == IPPROTO_TCP && sk_is_mptcp(sk))
> + return mptcp_sk(mptcp_subflow_ctx(sk)->conn);
> +
> + return NULL;
> +}
> +EXPORT_SYMBOL(bpf_mptcp_sock_from_subflow);
Is EXPORT_SYMBOL needed ?
Powered by blists - more mailing lists