Skip to content

Commit 312896f

Browse files
Geliang Tangintel-lab-lkp
authored andcommitted
Revert "bpf: Extend bpf_skc_to_mptcp_sock to MPTCP sock"
bpf_core_cast() can be used in mptcp_subflow bpf_iter selftests to get the msk, instead of using bpf_skc_to_mptcp_sock(). No need to add this patch anymore, revert it. Signed-off-by: Geliang Tang <[email protected]>
1 parent e62e41e commit 312896f

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

include/net/mptcp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,9 @@ static inline void mptcpv6_handle_mapped(struct sock *sk, bool mapped) { }
323323
#endif
324324

325325
#if defined(CONFIG_MPTCP) && defined(CONFIG_BPF_SYSCALL)
326-
struct mptcp_sock *bpf_mptcp_sock_from_sock(struct sock *sk);
326+
struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk);
327327
#else
328-
static inline struct mptcp_sock *bpf_mptcp_sock_from_sock(struct sock *sk) { return NULL; }
328+
static inline struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk) { return NULL; }
329329
#endif
330330

331331
#if !IS_ENABLED(CONFIG_MPTCP)

net/core/filter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11843,7 +11843,7 @@ const struct bpf_func_proto bpf_skc_to_unix_sock_proto = {
1184311843
BPF_CALL_1(bpf_skc_to_mptcp_sock, struct sock *, sk)
1184411844
{
1184511845
BTF_TYPE_EMIT(struct mptcp_sock);
11846-
return (unsigned long)bpf_mptcp_sock_from_sock(sk);
11846+
return (unsigned long)bpf_mptcp_sock_from_subflow(sk);
1184711847
}
1184811848

1184911849
const struct bpf_func_proto bpf_skc_to_mptcp_sock_proto = {

net/mptcp/bpf.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -195,15 +195,9 @@ static struct bpf_struct_ops bpf_mptcp_sched_ops = {
195195
};
196196
#endif /* CONFIG_BPF_JIT */
197197

198-
struct mptcp_sock *bpf_mptcp_sock_from_sock(struct sock *sk)
198+
struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk)
199199
{
200-
if (unlikely(!sk || !sk_fullsock(sk)))
201-
return NULL;
202-
203-
if (sk->sk_protocol == IPPROTO_MPTCP)
204-
return mptcp_sk(sk);
205-
206-
if (sk->sk_protocol == IPPROTO_TCP && sk_is_mptcp(sk))
200+
if (sk && sk_fullsock(sk) && sk->sk_protocol == IPPROTO_TCP && sk_is_mptcp(sk))
207201
return mptcp_sk(mptcp_subflow_ctx(sk)->conn);
208202

209203
return NULL;

0 commit comments

Comments
 (0)