bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bpf: Add SO_REUSEPORT to bpf_{g,s}etsockopt documentation
@ 2022-10-07 17:55 Rongfeng Ji
  2022-10-11  0:18 ` Martin KaFai Lau
  0 siblings, 1 reply; 2+ messages in thread
From: Rongfeng Ji @ 2022-10-07 17:55 UTC (permalink / raw)
  To: ast, daniel, andrii, martin.lau, song, yhs, john.fastabend,
	kpsingh, sdf, haoluo, jolsa, joannelkoong, kuifeng, maximmi,
	quentin
  Cc: bpf, linux-kernel, Rongfeng Ji

SO_REUSEPORT has been supported by bpf_{g,s}etsockopt for a long time.
It is added at the beginning of the optname list under level
SOL_SOCKET because it is supported by both helper functions.

Signed-off-by: Rongfeng Ji <SikoJobs@outlook.com>
---
 include/uapi/linux/bpf.h       | 7 ++++---
 tools/include/uapi/linux/bpf.h | 7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 51b9aa640ad2..ccae9cb833b8 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -2574,9 +2574,9 @@ union bpf_attr {
  * 		It supports the following *level*\ s:
  *
  * 		* **SOL_SOCKET**, which supports the following *optname*\ s:
- * 		  **SO_RCVBUF**, **SO_SNDBUF**, **SO_MAX_PACING_RATE**,
- * 		  **SO_PRIORITY**, **SO_RCVLOWAT**, **SO_MARK**,
- * 		  **SO_BINDTODEVICE**, **SO_KEEPALIVE**.
+ * 		  **SO_REUSEPORT**, **SO_RCVBUF**, **SO_SNDBUF**,
+ * 		  **SO_MAX_PACING_RATE**, **SO_PRIORITY**, **SO_RCVLOWAT**,
+ * 		  **SO_MARK**, **SO_BINDTODEVICE**, **SO_KEEPALIVE**.
  * 		* **IPPROTO_TCP**, which supports the following *optname*\ s:
  * 		  **TCP_CONGESTION**, **TCP_BPF_IW**,
  * 		  **TCP_BPF_SNDCWND_CLAMP**, **TCP_SAVE_SYN**,
@@ -2802,6 +2802,7 @@ union bpf_attr {
  * 		This helper actually implements a subset of **getsockopt()**.
  * 		It supports the following *level*\ s:
  *
+ * 		* **SOL_SOCKET**, which supports *optname* **SO_REUSEPORT**.
  * 		* **IPPROTO_TCP**, which supports *optname*
  * 		  **TCP_CONGESTION**.
  * 		* **IPPROTO_IP**, which supports *optname* **IP_TOS**.
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index 51b9aa640ad2..ccae9cb833b8 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -2574,9 +2574,9 @@ union bpf_attr {
  * 		It supports the following *level*\ s:
  *
  * 		* **SOL_SOCKET**, which supports the following *optname*\ s:
- * 		  **SO_RCVBUF**, **SO_SNDBUF**, **SO_MAX_PACING_RATE**,
- * 		  **SO_PRIORITY**, **SO_RCVLOWAT**, **SO_MARK**,
- * 		  **SO_BINDTODEVICE**, **SO_KEEPALIVE**.
+ * 		  **SO_REUSEPORT**, **SO_RCVBUF**, **SO_SNDBUF**,
+ * 		  **SO_MAX_PACING_RATE**, **SO_PRIORITY**, **SO_RCVLOWAT**,
+ * 		  **SO_MARK**, **SO_BINDTODEVICE**, **SO_KEEPALIVE**.
  * 		* **IPPROTO_TCP**, which supports the following *optname*\ s:
  * 		  **TCP_CONGESTION**, **TCP_BPF_IW**,
  * 		  **TCP_BPF_SNDCWND_CLAMP**, **TCP_SAVE_SYN**,
@@ -2802,6 +2802,7 @@ union bpf_attr {
  * 		This helper actually implements a subset of **getsockopt()**.
  * 		It supports the following *level*\ s:
  *
+ * 		* **SOL_SOCKET**, which supports *optname* **SO_REUSEPORT**.
  * 		* **IPPROTO_TCP**, which supports *optname*
  * 		  **TCP_CONGESTION**.
  * 		* **IPPROTO_IP**, which supports *optname* **IP_TOS**.
-- 
2.30.2


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

* Re: [PATCH] bpf: Add SO_REUSEPORT to bpf_{g,s}etsockopt documentation
  2022-10-07 17:55 [PATCH] bpf: Add SO_REUSEPORT to bpf_{g,s}etsockopt documentation Rongfeng Ji
@ 2022-10-11  0:18 ` Martin KaFai Lau
  0 siblings, 0 replies; 2+ messages in thread
From: Martin KaFai Lau @ 2022-10-11  0:18 UTC (permalink / raw)
  To: Rongfeng Ji
  Cc: bpf, linux-kernel, ast, daniel, andrii, song, yhs,
	john.fastabend, kpsingh, sdf, haoluo, jolsa, joannelkoong,
	kuifeng, maximmi, quentin

On 10/7/22 10:55 AM, Rongfeng Ji wrote:
> SO_REUSEPORT has been supported by bpf_{g,s}etsockopt for a long time.
> It is added at the beginning of the optname list under level
> SOL_SOCKET because it is supported by both helper functions.
> 
> Signed-off-by: Rongfeng Ji <SikoJobs@outlook.com>
> ---
>   include/uapi/linux/bpf.h       | 7 ++++---
>   tools/include/uapi/linux/bpf.h | 7 ++++---
>   2 files changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index 51b9aa640ad2..ccae9cb833b8 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -2574,9 +2574,9 @@ union bpf_attr {
>    * 		It supports the following *level*\ s:
>    *
>    * 		* **SOL_SOCKET**, which supports the following *optname*\ s:
> - * 		  **SO_RCVBUF**, **SO_SNDBUF**, **SO_MAX_PACING_RATE**,
> - * 		  **SO_PRIORITY**, **SO_RCVLOWAT**, **SO_MARK**,
> - * 		  **SO_BINDTODEVICE**, **SO_KEEPALIVE**.
> + * 		  **SO_REUSEPORT**, **SO_RCVBUF**, **SO_SNDBUF**,
> + * 		  **SO_MAX_PACING_RATE**, **SO_PRIORITY**, **SO_RCVLOWAT**,
> + * 		  **SO_MARK**, **SO_BINDTODEVICE**, **SO_KEEPALIVE**.

More options has recently been added to SOL_SOCKET, IPPROTO_TCP, and 
IPPROTO_IPV6.  Could you take this chance to also add them together?

Also, it seems the optnames here is not in any particular order.  Please append 
the new ones to the end to avoid shifting code churn like the above.

>    * 		* **IPPROTO_TCP**, which supports the following *optname*\ s:
>    * 		  **TCP_CONGESTION**, **TCP_BPF_IW**,
>    * 		  **TCP_BPF_SNDCWND_CLAMP**, **TCP_SAVE_SYN**,
> @@ -2802,6 +2802,7 @@ union bpf_attr {
>    * 		This helper actually implements a subset of **getsockopt()**.
>    * 		It supports the following *level*\ s:
>    *
> + * 		* **SOL_SOCKET**, which supports *optname* **SO_REUSEPORT**.

For bpf_getsockopt(), it supports all optnames in bpf_setsockopt() with a few 
exceptions.  The exceptions should be the TCP_BPF_* which is Set only.  The 
TCP_SAVED_SYNC is Get only.  Please check.

The doc for bpf_getsockopt() could be simplified to "... the same set of 
bpf_setsockopt's optnames is supported.  The exceptions are... TCP_BPF_* which 
is bpf_setsockopt() only.... TCP_SAVED_SYNC is bpf_getsockopt() only..."

Please tag it as bpf-next and also v2 in the next revision:
Documentation/bpf/bpf_devel_QA.rst  (Q: How do I indicate which tree....)



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

end of thread, other threads:[~2022-10-11  0:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-07 17:55 [PATCH] bpf: Add SO_REUSEPORT to bpf_{g,s}etsockopt documentation Rongfeng Ji
2022-10-11  0:18 ` Martin KaFai Lau

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