netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Sitnicki <jakub@cloudflare.com>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org,
	duanxiongchun@bytedance.com, wangdongdong.6@bytedance.com,
	jiang.wang@bytedance.com, Cong Wang <cong.wang@bytedance.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Lorenz Bauer <lmb@cloudflare.com>,
	John Fastabend <john.fastabend@gmail.com>
Subject: Re: [Patch bpf-next v4 1/5] bpf: clean up sockmap related Kconfigs
Date: Fri, 19 Feb 2021 19:25:22 +0100	[thread overview]
Message-ID: <87im6n52zx.fsf@cloudflare.com> (raw)
In-Reply-To: <20210216064250.38331-2-xiyou.wangcong@gmail.com>

On Tue, Feb 16, 2021 at 07:42 AM CET, Cong Wang wrote:
> From: Cong Wang <cong.wang@bytedance.com>
>
> As suggested by John, clean up sockmap related Kconfigs:
>
> Reduce the scope of CONFIG_BPF_STREAM_PARSER down to TCP stream
> parser, to reflect its name.
>
> Make the rest sockmap code simply depend on CONFIG_BPF_SYSCALL.
> And leave CONFIG_NET_SOCK_MSG untouched, as it is used by
> non-sockmap cases.
>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: Jakub Sitnicki <jakub@cloudflare.com>
> Reviewed-by: Lorenz Bauer <lmb@cloudflare.com>
> Acked-by: John Fastabend <john.fastabend@gmail.com>
> Signed-off-by: Cong Wang <cong.wang@bytedance.com>
> ---

Sorry for the delay. There's a lot happening here. Took me a while to
dig through it.

I have a couple of nit-picks, which easily can be addressed as
follow-ups, and one comment.

sock_map_prog_update and sk_psock_done_strp are only used in
net/core/sock_map.c and can be static.

[...]

> diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c
> index bc7d2a586e18..b2c4865eb39b 100644
> --- a/net/ipv4/tcp_bpf.c
> +++ b/net/ipv4/tcp_bpf.c
> @@ -229,7 +229,6 @@ int tcp_bpf_sendmsg_redir(struct sock *sk, struct sk_msg *msg,
>  }
>  EXPORT_SYMBOL_GPL(tcp_bpf_sendmsg_redir);
>
> -#ifdef CONFIG_BPF_STREAM_PARSER
>  static bool tcp_bpf_stream_read(const struct sock *sk)
>  {
>  	struct sk_psock *psock;
> @@ -561,8 +560,10 @@ static void tcp_bpf_rebuild_protos(struct proto prot[TCP_BPF_NUM_CFGS],
>  				   struct proto *base)
>  {
>  	prot[TCP_BPF_BASE]			= *base;
> +#if defined(CONFIG_BPF_SYSCALL)
>  	prot[TCP_BPF_BASE].unhash		= sock_map_unhash;
>  	prot[TCP_BPF_BASE].close		= sock_map_close;
> +#endif
>  	prot[TCP_BPF_BASE].recvmsg		= tcp_bpf_recvmsg;
>  	prot[TCP_BPF_BASE].stream_memory_read	= tcp_bpf_stream_read;
>
> @@ -629,4 +630,3 @@ void tcp_bpf_clone(const struct sock *sk, struct sock *newsk)
>  	if (prot == &tcp_bpf_prots[family][TCP_BPF_BASE])
>  		newsk->sk_prot = sk->sk_prot_creator;
>  }
> -#endif /* CONFIG_BPF_STREAM_PARSER */

net/core/sock_map.o now is built only when CONFIG_BPF_SYSCALL is set.
While tcp_bpf_get_proto is only called from net/core/sock_map.o.

Seems there is no sense in compiling tcp_bpf_get_proto, and everything
it depends on which was enclosed by CONFIG_BPF_STREAM_PARSER check, when
CONFIG_BPF_SYSCALL is unset.

> diff --git a/net/ipv4/udp_bpf.c b/net/ipv4/udp_bpf.c
> index 7a94791efc1a..e635ccc175ca 100644
> --- a/net/ipv4/udp_bpf.c
> +++ b/net/ipv4/udp_bpf.c
> @@ -18,8 +18,10 @@ static struct proto udp_bpf_prots[UDP_BPF_NUM_PROTS];
>  static void udp_bpf_rebuild_protos(struct proto *prot, const struct proto *base)
>  {
>  	*prot        = *base;
> +#if defined(CONFIG_BPF_SYSCALL)
>  	prot->unhash = sock_map_unhash;
>  	prot->close  = sock_map_close;
> +#endif
>  }
>
>  static void udp_bpf_check_v6_needs_rebuild(struct proto *ops)

Same situation here but for udp_bpf_get_proto.

  reply	other threads:[~2021-02-19 18:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-16  6:42 [Patch bpf-next v4 0/5] sock_map: clean up and refactor code for BPF_SK_SKB_VERDICT Cong Wang
2021-02-16  6:42 ` [Patch bpf-next v4 1/5] bpf: clean up sockmap related Kconfigs Cong Wang
2021-02-19 18:25   ` Jakub Sitnicki [this message]
2021-02-19 18:46     ` Cong Wang
2021-02-19 22:00       ` Jakub Sitnicki
2021-02-16  6:42 ` [Patch bpf-next v4 2/5] skmsg: get rid of struct sk_psock_parser Cong Wang
2021-02-16  6:42 ` [Patch bpf-next v4 3/5] bpf: compute data_end dynamically with JIT code Cong Wang
2021-02-16  6:42 ` [Patch bpf-next v4 4/5] skmsg: move sk_redir from TCP_SKB_CB to skb Cong Wang
2021-02-17 18:40   ` John Fastabend
2021-02-17 18:49     ` Cong Wang
2021-02-17 20:12       ` John Fastabend
2021-02-16  6:42 ` [Patch bpf-next v4 5/5] sock_map: rename skb_parser and skb_verdict Cong Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87im6n52zx.fsf@cloudflare.com \
    --to=jakub@cloudflare.com \
    --cc=bpf@vger.kernel.org \
    --cc=cong.wang@bytedance.com \
    --cc=daniel@iogearbox.net \
    --cc=duanxiongchun@bytedance.com \
    --cc=jiang.wang@bytedance.com \
    --cc=john.fastabend@gmail.com \
    --cc=lmb@cloudflare.com \
    --cc=netdev@vger.kernel.org \
    --cc=wangdongdong.6@bytedance.com \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).