netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 bpf-next 00/17] bpf: net: Remove duplicated code from bpf_getsockopt()
@ 2022-09-02  0:27 Martin KaFai Lau
  2022-09-02 22:16 ` sdf
  2022-09-03  3:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Martin KaFai Lau @ 2022-09-02  0:27 UTC (permalink / raw)
  To: bpf, netdev
  Cc: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann,
	David Miller, Eric Dumazet, Jakub Kicinski, kernel-team,
	Paolo Abeni

From: Martin KaFai Lau <martin.lau@kernel.org>

The earlier commits [0] removed duplicated code from bpf_setsockopt().
This series is to remove duplicated code from bpf_getsockopt().

Unlike the setsockopt() which had already changed to take
the sockptr_t argument, the same has not been done to
getsockopt().  This is the extra step being done in this
series.

[0]: https://lore.kernel.org/all/20220817061704.4174272-1-kafai@fb.com/

v2:
- The previous v2 did not reach the list. It is a resend.
- Add comments on bpf_getsockopt() should not free
  the saved_syn (Stanislav)
- Explicitly null-terminate the tcp-cc name (Stanislav)

Martin KaFai Lau (17):
  net: Change sock_getsockopt() to take the sk ptr instead of the sock
    ptr
  bpf: net: Change sk_getsockopt() to take the sockptr_t argument
  bpf: net: Avoid sk_getsockopt() taking sk lock when called from bpf
  bpf: net: Change do_tcp_getsockopt() to take the sockptr_t argument
  bpf: net: Avoid do_tcp_getsockopt() taking sk lock when called from
    bpf
  bpf: net: Change do_ip_getsockopt() to take the sockptr_t argument
  bpf: net: Avoid do_ip_getsockopt() taking sk lock when called from bpf
  net: Remove unused flags argument from do_ipv6_getsockopt
  net: Add a len argument to compat_ipv6_get_msfilter()
  bpf: net: Change do_ipv6_getsockopt() to take the sockptr_t argument
  bpf: net: Avoid do_ipv6_getsockopt() taking sk lock when called from
    bpf
  bpf: Embed kernel CONFIG check into the if statement in bpf_getsockopt
  bpf: Change bpf_getsockopt(SOL_SOCKET) to reuse sk_getsockopt()
  bpf: Change bpf_getsockopt(SOL_TCP) to reuse do_tcp_getsockopt()
  bpf: Change bpf_getsockopt(SOL_IP) to reuse do_ip_getsockopt()
  bpf: Change bpf_getsockopt(SOL_IPV6) to reuse do_ipv6_getsockopt()
  selftest/bpf: Add test for bpf_getsockopt()

 include/linux/filter.h                        |   3 +-
 include/linux/igmp.h                          |   4 +-
 include/linux/mroute.h                        |   6 +-
 include/linux/mroute6.h                       |   4 +-
 include/linux/sockptr.h                       |   5 +
 include/net/ip.h                              |   2 +
 include/net/ipv6.h                            |   4 +-
 include/net/ipv6_stubs.h                      |   2 +
 include/net/sock.h                            |   2 +
 include/net/tcp.h                             |   2 +
 net/core/filter.c                             | 220 ++++++++----------
 net/core/sock.c                               |  51 ++--
 net/ipv4/igmp.c                               |  22 +-
 net/ipv4/ip_sockglue.c                        |  98 ++++----
 net/ipv4/ipmr.c                               |   9 +-
 net/ipv4/tcp.c                                |  92 ++++----
 net/ipv6/af_inet6.c                           |   1 +
 net/ipv6/ip6mr.c                              |  10 +-
 net/ipv6/ipv6_sockglue.c                      |  95 ++++----
 net/ipv6/mcast.c                              |   8 +-
 .../selftests/bpf/progs/bpf_tracing_net.h     |   1 +
 .../selftests/bpf/progs/setget_sockopt.c      | 148 ++++--------
 22 files changed, 379 insertions(+), 410 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 bpf-next 00/17] bpf: net: Remove duplicated code from bpf_getsockopt()
  2022-09-02  0:27 [PATCH v2 bpf-next 00/17] bpf: net: Remove duplicated code from bpf_getsockopt() Martin KaFai Lau
@ 2022-09-02 22:16 ` sdf
  2022-09-03  3:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: sdf @ 2022-09-02 22:16 UTC (permalink / raw)
  To: Martin KaFai Lau
  Cc: bpf, netdev, Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann,
	David Miller, Eric Dumazet, Jakub Kicinski, kernel-team,
	Paolo Abeni

On 09/01, Martin KaFai Lau wrote:
> From: Martin KaFai Lau <martin.lau@kernel.org>

> The earlier commits [0] removed duplicated code from bpf_setsockopt().
> This series is to remove duplicated code from bpf_getsockopt().

> Unlike the setsockopt() which had already changed to take
> the sockptr_t argument, the same has not been done to
> getsockopt().  This is the extra step being done in this
> series.

> [0]: https://lore.kernel.org/all/20220817061704.4174272-1-kafai@fb.com/

> v2:
> - The previous v2 did not reach the list. It is a resend.
> - Add comments on bpf_getsockopt() should not free
>    the saved_syn (Stanislav)
> - Explicitly null-terminate the tcp-cc name (Stanislav)

Looks great!

Reviewed-by: Stanislav Fomichev <sdf@google.com>

> Martin KaFai Lau (17):
>    net: Change sock_getsockopt() to take the sk ptr instead of the sock
>      ptr
>    bpf: net: Change sk_getsockopt() to take the sockptr_t argument
>    bpf: net: Avoid sk_getsockopt() taking sk lock when called from bpf
>    bpf: net: Change do_tcp_getsockopt() to take the sockptr_t argument
>    bpf: net: Avoid do_tcp_getsockopt() taking sk lock when called from
>      bpf
>    bpf: net: Change do_ip_getsockopt() to take the sockptr_t argument
>    bpf: net: Avoid do_ip_getsockopt() taking sk lock when called from bpf
>    net: Remove unused flags argument from do_ipv6_getsockopt
>    net: Add a len argument to compat_ipv6_get_msfilter()
>    bpf: net: Change do_ipv6_getsockopt() to take the sockptr_t argument
>    bpf: net: Avoid do_ipv6_getsockopt() taking sk lock when called from
>      bpf
>    bpf: Embed kernel CONFIG check into the if statement in bpf_getsockopt
>    bpf: Change bpf_getsockopt(SOL_SOCKET) to reuse sk_getsockopt()
>    bpf: Change bpf_getsockopt(SOL_TCP) to reuse do_tcp_getsockopt()
>    bpf: Change bpf_getsockopt(SOL_IP) to reuse do_ip_getsockopt()
>    bpf: Change bpf_getsockopt(SOL_IPV6) to reuse do_ipv6_getsockopt()
>    selftest/bpf: Add test for bpf_getsockopt()

>   include/linux/filter.h                        |   3 +-
>   include/linux/igmp.h                          |   4 +-
>   include/linux/mroute.h                        |   6 +-
>   include/linux/mroute6.h                       |   4 +-
>   include/linux/sockptr.h                       |   5 +
>   include/net/ip.h                              |   2 +
>   include/net/ipv6.h                            |   4 +-
>   include/net/ipv6_stubs.h                      |   2 +
>   include/net/sock.h                            |   2 +
>   include/net/tcp.h                             |   2 +
>   net/core/filter.c                             | 220 ++++++++----------
>   net/core/sock.c                               |  51 ++--
>   net/ipv4/igmp.c                               |  22 +-
>   net/ipv4/ip_sockglue.c                        |  98 ++++----
>   net/ipv4/ipmr.c                               |   9 +-
>   net/ipv4/tcp.c                                |  92 ++++----
>   net/ipv6/af_inet6.c                           |   1 +
>   net/ipv6/ip6mr.c                              |  10 +-
>   net/ipv6/ipv6_sockglue.c                      |  95 ++++----
>   net/ipv6/mcast.c                              |   8 +-
>   .../selftests/bpf/progs/bpf_tracing_net.h     |   1 +
>   .../selftests/bpf/progs/setget_sockopt.c      | 148 ++++--------
>   22 files changed, 379 insertions(+), 410 deletions(-)

> --
> 2.30.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 bpf-next 00/17] bpf: net: Remove duplicated code from bpf_getsockopt()
  2022-09-02  0:27 [PATCH v2 bpf-next 00/17] bpf: net: Remove duplicated code from bpf_getsockopt() Martin KaFai Lau
  2022-09-02 22:16 ` sdf
@ 2022-09-03  3:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-09-03  3:50 UTC (permalink / raw)
  To: Martin KaFai Lau
  Cc: bpf, netdev, ast, andrii, daniel, davem, edumazet, kuba,
	kernel-team, pabeni

Hello:

This series was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Thu, 1 Sep 2022 17:27:50 -0700 you wrote:
> From: Martin KaFai Lau <martin.lau@kernel.org>
> 
> The earlier commits [0] removed duplicated code from bpf_setsockopt().
> This series is to remove duplicated code from bpf_getsockopt().
> 
> Unlike the setsockopt() which had already changed to take
> the sockptr_t argument, the same has not been done to
> getsockopt().  This is the extra step being done in this
> series.
> 
> [...]

Here is the summary with links:
  - [v2,bpf-next,01/17] net: Change sock_getsockopt() to take the sk ptr instead of the sock ptr
    https://git.kernel.org/bpf/bpf-next/c/ba74a7608dc1
  - [v2,bpf-next,02/17] bpf: net: Change sk_getsockopt() to take the sockptr_t argument
    https://git.kernel.org/bpf/bpf-next/c/4ff09db1b79b
  - [v2,bpf-next,03/17] bpf: net: Avoid sk_getsockopt() taking sk lock when called from bpf
    https://git.kernel.org/bpf/bpf-next/c/2c5b6bf5cda0
  - [v2,bpf-next,04/17] bpf: net: Change do_tcp_getsockopt() to take the sockptr_t argument
    https://git.kernel.org/bpf/bpf-next/c/34704ef024ae
  - [v2,bpf-next,05/17] bpf: net: Avoid do_tcp_getsockopt() taking sk lock when called from bpf
    https://git.kernel.org/bpf/bpf-next/c/d51bbff2aba7
  - [v2,bpf-next,06/17] bpf: net: Change do_ip_getsockopt() to take the sockptr_t argument
    https://git.kernel.org/bpf/bpf-next/c/728f064cd7eb
  - [v2,bpf-next,07/17] bpf: net: Avoid do_ip_getsockopt() taking sk lock when called from bpf
    https://git.kernel.org/bpf/bpf-next/c/1985320c54dd
  - [v2,bpf-next,08/17] net: Remove unused flags argument from do_ipv6_getsockopt
    https://git.kernel.org/bpf/bpf-next/c/75f23979888a
  - [v2,bpf-next,09/17] net: Add a len argument to compat_ipv6_get_msfilter()
    https://git.kernel.org/bpf/bpf-next/c/9c3f9707decd
  - [v2,bpf-next,10/17] bpf: net: Change do_ipv6_getsockopt() to take the sockptr_t argument
    https://git.kernel.org/bpf/bpf-next/c/6dadbe4bac68
  - [v2,bpf-next,11/17] bpf: net: Avoid do_ipv6_getsockopt() taking sk lock when called from bpf
    https://git.kernel.org/bpf/bpf-next/c/0f95f7d42611
  - [v2,bpf-next,12/17] bpf: Embed kernel CONFIG check into the if statement in bpf_getsockopt
    https://git.kernel.org/bpf/bpf-next/c/c2b063ca3458
  - [v2,bpf-next,13/17] bpf: Change bpf_getsockopt(SOL_SOCKET) to reuse sk_getsockopt()
    https://git.kernel.org/bpf/bpf-next/c/65ddc82d3b96
  - [v2,bpf-next,14/17] bpf: Change bpf_getsockopt(SOL_TCP) to reuse do_tcp_getsockopt()
    https://git.kernel.org/bpf/bpf-next/c/273b7f0fb448
  - [v2,bpf-next,15/17] bpf: Change bpf_getsockopt(SOL_IP) to reuse do_ip_getsockopt()
    https://git.kernel.org/bpf/bpf-next/c/fd969f25fe24
  - [v2,bpf-next,16/17] bpf: Change bpf_getsockopt(SOL_IPV6) to reuse do_ipv6_getsockopt()
    https://git.kernel.org/bpf/bpf-next/c/38566ec06f52
  - [v2,bpf-next,17/17] selftest/bpf: Add test for bpf_getsockopt()
    https://git.kernel.org/bpf/bpf-next/c/f649f992deee

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-03  3:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-02  0:27 [PATCH v2 bpf-next 00/17] bpf: net: Remove duplicated code from bpf_getsockopt() Martin KaFai Lau
2022-09-02 22:16 ` sdf
2022-09-03  3:50 ` patchwork-bot+netdevbpf

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).