bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf v2] bpf: Update bpf_{g,s}etsockopt() documentation
@ 2022-11-18  8:18 Ji Rongfeng
  2022-11-24  0:18 ` Daniel Borkmann
  0 siblings, 1 reply; 5+ messages in thread
From: Ji Rongfeng @ 2022-11-18  8:18 UTC (permalink / raw)
  To: bpf, linux-kernel
  Cc: ast, daniel, andrii, martin.lau, song, yhs, john.fastabend,
	kpsingh, sdf, haoluo, jolsa, joannelkoong, kuifeng, lorenzo,
	maximmi, quentin, Ji Rongfeng

* append missing optnames to the end
* simplify bpf_getsockopt()'s doc

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

diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 51b9aa640ad2..14f29d95ea71 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -2576,14 +2576,19 @@ union bpf_attr {
  * 		* **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_BINDTODEVICE**, **SO_KEEPALIVE**, **SO_REUSEADDR**,
+ * 		  **SO_REUSEPORT**, **SO_BINDTOIFINDEX**, **SO_TXREHASH**.
  * 		* **IPPROTO_TCP**, which supports the following *optname*\ s:
  * 		  **TCP_CONGESTION**, **TCP_BPF_IW**,
  * 		  **TCP_BPF_SNDCWND_CLAMP**, **TCP_SAVE_SYN**,
  * 		  **TCP_KEEPIDLE**, **TCP_KEEPINTVL**, **TCP_KEEPCNT**,
- *		  **TCP_SYNCNT**, **TCP_USER_TIMEOUT**, **TCP_NOTSENT_LOWAT**.
+ * 		  **TCP_SYNCNT**, **TCP_USER_TIMEOUT**, **TCP_NOTSENT_LOWAT**,
+ * 		  **TCP_NODELAY**, **TCP_MAXSEG**, **TCP_WINDOW_CLAMP**,
+ * 		  **TCP_THIN_LINEAR_TIMEOUTS**, **TCP_BPF_DELACK_MAX**,
+ * 		  **TCP_BPF_RTO_MIN**.
  * 		* **IPPROTO_IP**, which supports *optname* **IP_TOS**.
- * 		* **IPPROTO_IPV6**, which supports *optname* **IPV6_TCLASS**.
+ * 		* **IPPROTO_IPV6**, which supports the following *optname*\ s:
+ * 		  **IPV6_TCLASS**, **IPV6_AUTOFLOWLABEL**.
  * 	Return
  * 		0 on success, or a negative error in case of failure.
  *
@@ -2800,12 +2805,11 @@ union bpf_attr {
  * 		  and **BPF_CGROUP_INET6_CONNECT**.
  *
  * 		This helper actually implements a subset of **getsockopt()**.
- * 		It supports the following *level*\ s:
+ * 		It supports the same set of *optname*\ s that supported by
+ * 		**bpf_setsockopt**\ () helper with a few exceptions:
  *
- * 		* **IPPROTO_TCP**, which supports *optname*
- * 		  **TCP_CONGESTION**.
- * 		* **IPPROTO_IP**, which supports *optname* **IP_TOS**.
- * 		* **IPPROTO_IPV6**, which supports *optname* **IPV6_TCLASS**.
+ * 		* **bpf_setsockopt**\ () helper only: **TCP_BPF_***.
+ * 		* **bpf_getsockopt**\ () helper only: **TCP_SAVED_SYNC**.
  * 	Return
  * 		0 on success, or a negative error in case of failure.
  *
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index 51b9aa640ad2..14f29d95ea71 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -2576,14 +2576,19 @@ union bpf_attr {
  * 		* **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_BINDTODEVICE**, **SO_KEEPALIVE**, **SO_REUSEADDR**,
+ * 		  **SO_REUSEPORT**, **SO_BINDTOIFINDEX**, **SO_TXREHASH**.
  * 		* **IPPROTO_TCP**, which supports the following *optname*\ s:
  * 		  **TCP_CONGESTION**, **TCP_BPF_IW**,
  * 		  **TCP_BPF_SNDCWND_CLAMP**, **TCP_SAVE_SYN**,
  * 		  **TCP_KEEPIDLE**, **TCP_KEEPINTVL**, **TCP_KEEPCNT**,
- *		  **TCP_SYNCNT**, **TCP_USER_TIMEOUT**, **TCP_NOTSENT_LOWAT**.
+ * 		  **TCP_SYNCNT**, **TCP_USER_TIMEOUT**, **TCP_NOTSENT_LOWAT**,
+ * 		  **TCP_NODELAY**, **TCP_MAXSEG**, **TCP_WINDOW_CLAMP**,
+ * 		  **TCP_THIN_LINEAR_TIMEOUTS**, **TCP_BPF_DELACK_MAX**,
+ * 		  **TCP_BPF_RTO_MIN**.
  * 		* **IPPROTO_IP**, which supports *optname* **IP_TOS**.
- * 		* **IPPROTO_IPV6**, which supports *optname* **IPV6_TCLASS**.
+ * 		* **IPPROTO_IPV6**, which supports the following *optname*\ s:
+ * 		  **IPV6_TCLASS**, **IPV6_AUTOFLOWLABEL**.
  * 	Return
  * 		0 on success, or a negative error in case of failure.
  *
@@ -2800,12 +2805,11 @@ union bpf_attr {
  * 		  and **BPF_CGROUP_INET6_CONNECT**.
  *
  * 		This helper actually implements a subset of **getsockopt()**.
- * 		It supports the following *level*\ s:
+ * 		It supports the same set of *optname*\ s that supported by
+ * 		**bpf_setsockopt**\ () helper with a few exceptions:
  *
- * 		* **IPPROTO_TCP**, which supports *optname*
- * 		  **TCP_CONGESTION**.
- * 		* **IPPROTO_IP**, which supports *optname* **IP_TOS**.
- * 		* **IPPROTO_IPV6**, which supports *optname* **IPV6_TCLASS**.
+ * 		* **bpf_setsockopt**\ () helper only: **TCP_BPF_***.
+ * 		* **bpf_getsockopt**\ () helper only: **TCP_SAVED_SYNC**.
  * 	Return
  * 		0 on success, or a negative error in case of failure.
  *
-- 
2.30.2


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

* Re: [PATCH bpf v2] bpf: Update bpf_{g,s}etsockopt() documentation
  2022-11-18  8:18 [PATCH bpf v2] bpf: Update bpf_{g,s}etsockopt() documentation Ji Rongfeng
@ 2022-11-24  0:18 ` Daniel Borkmann
  2022-11-24  0:40   ` Martin KaFai Lau
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Borkmann @ 2022-11-24  0:18 UTC (permalink / raw)
  To: Ji Rongfeng, bpf, linux-kernel
  Cc: ast, andrii, martin.lau, song, yhs, john.fastabend, kpsingh, sdf,
	haoluo, jolsa, joannelkoong, kuifeng, lorenzo, maximmi, quentin

On 11/18/22 9:18 AM, Ji Rongfeng wrote:
> * append missing optnames to the end
> * simplify bpf_getsockopt()'s doc
> 
> Signed-off-by: Ji Rongfeng <SikoJobs@outlook.com>
> ---
>   include/uapi/linux/bpf.h       | 20 ++++++++++++--------
>   tools/include/uapi/linux/bpf.h | 20 ++++++++++++--------
>   2 files changed, 24 insertions(+), 16 deletions(-)
> 
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index 51b9aa640ad2..14f29d95ea71 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -2576,14 +2576,19 @@ union bpf_attr {
>    * 		* **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_BINDTODEVICE**, **SO_KEEPALIVE**, **SO_REUSEADDR**,
> + * 		  **SO_REUSEPORT**, **SO_BINDTOIFINDEX**, **SO_TXREHASH**.
>    * 		* **IPPROTO_TCP**, which supports the following *optname*\ s:
>    * 		  **TCP_CONGESTION**, **TCP_BPF_IW**,
>    * 		  **TCP_BPF_SNDCWND_CLAMP**, **TCP_SAVE_SYN**,
>    * 		  **TCP_KEEPIDLE**, **TCP_KEEPINTVL**, **TCP_KEEPCNT**,
> - *		  **TCP_SYNCNT**, **TCP_USER_TIMEOUT**, **TCP_NOTSENT_LOWAT**.
> + * 		  **TCP_SYNCNT**, **TCP_USER_TIMEOUT**, **TCP_NOTSENT_LOWAT**,
> + * 		  **TCP_NODELAY**, **TCP_MAXSEG**, **TCP_WINDOW_CLAMP**,
> + * 		  **TCP_THIN_LINEAR_TIMEOUTS**, **TCP_BPF_DELACK_MAX**,
> + * 		  **TCP_BPF_RTO_MIN**.
>    * 		* **IPPROTO_IP**, which supports *optname* **IP_TOS**.
> - * 		* **IPPROTO_IPV6**, which supports *optname* **IPV6_TCLASS**.
> + * 		* **IPPROTO_IPV6**, which supports the following *optname*\ s:
> + * 		  **IPV6_TCLASS**, **IPV6_AUTOFLOWLABEL**.
>    * 	Return
>    * 		0 on success, or a negative error in case of failure.
>    *
> @@ -2800,12 +2805,11 @@ union bpf_attr {
>    * 		  and **BPF_CGROUP_INET6_CONNECT**.
>    *
>    * 		This helper actually implements a subset of **getsockopt()**.
> - * 		It supports the following *level*\ s:
> + * 		It supports the same set of *optname*\ s that supported by

nit: that is supported by

> + * 		**bpf_setsockopt**\ () helper with a few exceptions:
>    *
> - * 		* **IPPROTO_TCP**, which supports *optname*
> - * 		  **TCP_CONGESTION**.
> - * 		* **IPPROTO_IP**, which supports *optname* **IP_TOS**.
> - * 		* **IPPROTO_IPV6**, which supports *optname* **IPV6_TCLASS**.
> + * 		* **bpf_setsockopt**\ () helper only: **TCP_BPF_***.
> + * 		* **bpf_getsockopt**\ () helper only: **TCP_SAVED_SYNC**.

I think from a user PoV the above is a bit hard to follow, maybe take Martin's
earlier feedback into account and add a proper sentence; it will be much easier
to understand.

>    * 	Return
>    * 		0 on success, or a negative error in case of failure.
>    *
[...]

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

* Re: [PATCH bpf v2] bpf: Update bpf_{g,s}etsockopt() documentation
  2022-11-24  0:18 ` Daniel Borkmann
@ 2022-11-24  0:40   ` Martin KaFai Lau
  2022-11-27  3:27     ` Ji Rongfeng
       [not found]     ` <7ede0b02-6fe6-f51e-eb3c-bf6dab63aa21@outlook.com>
  0 siblings, 2 replies; 5+ messages in thread
From: Martin KaFai Lau @ 2022-11-24  0:40 UTC (permalink / raw)
  To: Daniel Borkmann, Ji Rongfeng
  Cc: ast, andrii, song, yhs, john.fastabend, kpsingh, sdf, haoluo,
	jolsa, joannelkoong, kuifeng, lorenzo, maximmi, quentin, bpf,
	linux-kernel

On 11/23/22 4:18 PM, Daniel Borkmann wrote:
> On 11/18/22 9:18 AM, Ji Rongfeng wrote:
>> * append missing optnames to the end
>> * simplify bpf_getsockopt()'s doc
>>
>> Signed-off-by: Ji Rongfeng <SikoJobs@outlook.com>
>> ---
>>   include/uapi/linux/bpf.h       | 20 ++++++++++++--------
>>   tools/include/uapi/linux/bpf.h | 20 ++++++++++++--------
>>   2 files changed, 24 insertions(+), 16 deletions(-)
>>
>> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
>> index 51b9aa640ad2..14f29d95ea71 100644
>> --- a/include/uapi/linux/bpf.h
>> +++ b/include/uapi/linux/bpf.h
>> @@ -2576,14 +2576,19 @@ union bpf_attr {
>>    *         * **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_BINDTODEVICE**, **SO_KEEPALIVE**, **SO_REUSEADDR**,
>> + *           **SO_REUSEPORT**, **SO_BINDTOIFINDEX**, **SO_TXREHASH**.
>>    *         * **IPPROTO_TCP**, which supports the following *optname*\ s:
>>    *           **TCP_CONGESTION**, **TCP_BPF_IW**,
>>    *           **TCP_BPF_SNDCWND_CLAMP**, **TCP_SAVE_SYN**,
>>    *           **TCP_KEEPIDLE**, **TCP_KEEPINTVL**, **TCP_KEEPCNT**,
>> - *          **TCP_SYNCNT**, **TCP_USER_TIMEOUT**, **TCP_NOTSENT_LOWAT**.
>> + *           **TCP_SYNCNT**, **TCP_USER_TIMEOUT**, **TCP_NOTSENT_LOWAT**,
>> + *           **TCP_NODELAY**, **TCP_MAXSEG**, **TCP_WINDOW_CLAMP**,
>> + *           **TCP_THIN_LINEAR_TIMEOUTS**, **TCP_BPF_DELACK_MAX**,
>> + *           **TCP_BPF_RTO_MIN**.
>>    *         * **IPPROTO_IP**, which supports *optname* **IP_TOS**.
>> - *         * **IPPROTO_IPV6**, which supports *optname* **IPV6_TCLASS**.
>> + *         * **IPPROTO_IPV6**, which supports the following *optname*\ s:
>> + *           **IPV6_TCLASS**, **IPV6_AUTOFLOWLABEL**.
>>    *     Return
>>    *         0 on success, or a negative error in case of failure.
>>    *
>> @@ -2800,12 +2805,11 @@ union bpf_attr {
>>    *           and **BPF_CGROUP_INET6_CONNECT**.
>>    *
>>    *         This helper actually implements a subset of **getsockopt()**.
>> - *         It supports the following *level*\ s:
>> + *         It supports the same set of *optname*\ s that supported by
> 
> nit: that is supported by
> 
>> + *         **bpf_setsockopt**\ () helper with a few exceptions:
>>    *
>> - *         * **IPPROTO_TCP**, which supports *optname*
>> - *           **TCP_CONGESTION**.
>> - *         * **IPPROTO_IP**, which supports *optname* **IP_TOS**.
>> - *         * **IPPROTO_IPV6**, which supports *optname* **IPV6_TCLASS**.
>> + *         * **bpf_setsockopt**\ () helper only: **TCP_BPF_***.
>> + *         * **bpf_getsockopt**\ () helper only: **TCP_SAVED_SYNC**.
> 
> I think from a user PoV the above is a bit hard to follow, maybe take Martin's
> earlier feedback into account and add a proper sentence; it will be much easier
> to understand.

+1  Made the change and also fixed TCP_SAVED_SYNC with s/SYNC/SYN/ while 
applying.  Thanks!



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

* Re: [PATCH bpf v2] bpf: Update bpf_{g,s}etsockopt() documentation
  2022-11-24  0:40   ` Martin KaFai Lau
@ 2022-11-27  3:27     ` Ji Rongfeng
       [not found]     ` <7ede0b02-6fe6-f51e-eb3c-bf6dab63aa21@outlook.com>
  1 sibling, 0 replies; 5+ messages in thread
From: Ji Rongfeng @ 2022-11-27  3:27 UTC (permalink / raw)
  To: Martin KaFai Lau, Daniel Borkmann
  Cc: ast, andrii, song, yhs, john.fastabend, kpsingh, sdf, haoluo,
	jolsa, joannelkoong, kuifeng, lorenzo, maximmi, quentin, bpf,
	linux-kernel

On 2022/11/24 8:40, Martin KaFai Lau wrote:
> On 11/23/22 4:18 PM, Daniel Borkmann wrote:
>> On 11/18/22 9:18 AM, Ji Rongfeng wrote:
>>> * append missing optnames to the end
>>> * simplify bpf_getsockopt()'s doc
>>>
>>> Signed-off-by: Ji Rongfeng <SikoJobs@outlook.com>
>>> ---
>>>   include/uapi/linux/bpf.h       | 20 ++++++++++++--------
>>>   tools/include/uapi/linux/bpf.h | 20 ++++++++++++--------
>>>   2 files changed, 24 insertions(+), 16 deletions(-)
>>>
>>> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
>>> index 51b9aa640ad2..14f29d95ea71 100644
>>> --- a/include/uapi/linux/bpf.h
>>> +++ b/include/uapi/linux/bpf.h
>>> @@ -2576,14 +2576,19 @@ union bpf_attr {
>>>    *         * **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_BINDTODEVICE**, **SO_KEEPALIVE**, **SO_REUSEADDR**,
>>> + *           **SO_REUSEPORT**, **SO_BINDTOIFINDEX**, **SO_TXREHASH**.
>>>    *         * **IPPROTO_TCP**, which supports the following 
>>> *optname*\ s:
>>>    *           **TCP_CONGESTION**, **TCP_BPF_IW**,
>>>    *           **TCP_BPF_SNDCWND_CLAMP**, **TCP_SAVE_SYN**,
>>>    *           **TCP_KEEPIDLE**, **TCP_KEEPINTVL**, **TCP_KEEPCNT**,
>>> - *          **TCP_SYNCNT**, **TCP_USER_TIMEOUT**, 
>>> **TCP_NOTSENT_LOWAT**.
>>> + *           **TCP_SYNCNT**, **TCP_USER_TIMEOUT**, 
>>> **TCP_NOTSENT_LOWAT**,
>>> + *           **TCP_NODELAY**, **TCP_MAXSEG**, **TCP_WINDOW_CLAMP**,
>>> + *           **TCP_THIN_LINEAR_TIMEOUTS**, **TCP_BPF_DELACK_MAX**,
>>> + *           **TCP_BPF_RTO_MIN**.
>>>    *         * **IPPROTO_IP**, which supports *optname* **IP_TOS**.
>>> - *         * **IPPROTO_IPV6**, which supports *optname* 
>>> **IPV6_TCLASS**.
>>> + *         * **IPPROTO_IPV6**, which supports the following 
>>> *optname*\ s:
>>> + *           **IPV6_TCLASS**, **IPV6_AUTOFLOWLABEL**.
>>>    *     Return
>>>    *         0 on success, or a negative error in case of failure.
>>>    *
>>> @@ -2800,12 +2805,11 @@ union bpf_attr {
>>>    *           and **BPF_CGROUP_INET6_CONNECT**.
>>>    *
>>>    *         This helper actually implements a subset of 
>>> **getsockopt()**.
>>> - *         It supports the following *level*\ s:
>>> + *         It supports the same set of *optname*\ s that supported by
>>
>> nit: that is supported by
>>
>>> + *         **bpf_setsockopt**\ () helper with a few exceptions:
>>>    *
>>> - *         * **IPPROTO_TCP**, which supports *optname*
>>> - *           **TCP_CONGESTION**.
>>> - *         * **IPPROTO_IP**, which supports *optname* **IP_TOS**.
>>> - *         * **IPPROTO_IPV6**, which supports *optname* 
>>> **IPV6_TCLASS**.
>>> + *         * **bpf_setsockopt**\ () helper only: **TCP_BPF_***.
>>> + *         * **bpf_getsockopt**\ () helper only: **TCP_SAVED_SYNC**.
>>
>> I think from a user PoV the above is a bit hard to follow, maybe take 
>> Martin's
>> earlier feedback into account and add a proper sentence; it will be 
>> much easier
>> to understand.
>
> +1  Made the change and also fixed TCP_SAVED_SYNC with s/SYNC/SYN/ 
> while applying.  Thanks!

Thanks for the helpful reviews. I chose the form of lists was because we 
could
append more optnames easily in the future. But I believe it's not late 
to apply
that form when we really need it : )

In my opinion, this patch doesn't contain any new feature, but just a 
kind of fix
to the documentation, according to the corresponding code in the bpf tree,
which hasn't been modified yet in the bpf-next tree. So I targeted the 
former,
as this patch could be useful there. Please let me know if there's any 
customary
rules outside bpf_devel_QA. Thanks!

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

* Re: [PATCH bpf v2] bpf: Update bpf_{g,s}etsockopt() documentation
       [not found]     ` <7ede0b02-6fe6-f51e-eb3c-bf6dab63aa21@outlook.com>
@ 2022-11-29 14:14       ` Ji Rongfeng
  0 siblings, 0 replies; 5+ messages in thread
From: Ji Rongfeng @ 2022-11-29 14:14 UTC (permalink / raw)
  To: Martin KaFai Lau, Daniel Borkmann
  Cc: ast, andrii, song, yhs, john.fastabend, kpsingh, sdf, haoluo,
	jolsa, joannelkoong, kuifeng, lorenzo, maximmi, quentin, bpf,
	linux-kernel

On 2022/11/27 11:27, Ji Rongfeng wrote:
> On 2022/11/24 8:40, Martin KaFai Lau wrote:
>> On 11/23/22 4:18 PM, Daniel Borkmann wrote:
>>> On 11/18/22 9:18 AM, Ji Rongfeng wrote:
>>>> * append missing optnames to the end
>>>> * simplify bpf_getsockopt()'s doc
>>>>
>>>> Signed-off-by: Ji Rongfeng <SikoJobs@outlook.com>
>>>> ---
>>>>   include/uapi/linux/bpf.h       | 20 ++++++++++++--------
>>>>   tools/include/uapi/linux/bpf.h | 20 ++++++++++++--------
>>>>   2 files changed, 24 insertions(+), 16 deletions(-)
>>>>
>>>> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
>>>> index 51b9aa640ad2..14f29d95ea71 100644
>>>> --- a/include/uapi/linux/bpf.h
>>>> +++ b/include/uapi/linux/bpf.h
>>>> @@ -2576,14 +2576,19 @@ union bpf_attr {
>>>>    *         * **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_BINDTODEVICE**, **SO_KEEPALIVE**, **SO_REUSEADDR**,
>>>> + *           **SO_REUSEPORT**, **SO_BINDTOIFINDEX**, **SO_TXREHASH**.
>>>>    *         * **IPPROTO_TCP**, which supports the following 
>>>> *optname*\ s:
>>>>    *           **TCP_CONGESTION**, **TCP_BPF_IW**,
>>>>    *           **TCP_BPF_SNDCWND_CLAMP**, **TCP_SAVE_SYN**,
>>>>    *           **TCP_KEEPIDLE**, **TCP_KEEPINTVL**, **TCP_KEEPCNT**,
>>>> - *          **TCP_SYNCNT**, **TCP_USER_TIMEOUT**, 
>>>> **TCP_NOTSENT_LOWAT**.
>>>> + *           **TCP_SYNCNT**, **TCP_USER_TIMEOUT**, 
>>>> **TCP_NOTSENT_LOWAT**,
>>>> + *           **TCP_NODELAY**, **TCP_MAXSEG**, **TCP_WINDOW_CLAMP**,
>>>> + *           **TCP_THIN_LINEAR_TIMEOUTS**, **TCP_BPF_DELACK_MAX**,
>>>> + *           **TCP_BPF_RTO_MIN**.
>>>>    *         * **IPPROTO_IP**, which supports *optname* **IP_TOS**.
>>>> - *         * **IPPROTO_IPV6**, which supports *optname* 
>>>> **IPV6_TCLASS**.
>>>> + *         * **IPPROTO_IPV6**, which supports the following 
>>>> *optname*\ s:
>>>> + *           **IPV6_TCLASS**, **IPV6_AUTOFLOWLABEL**.
>>>>    *     Return
>>>>    *         0 on success, or a negative error in case of failure.
>>>>    *
>>>> @@ -2800,12 +2805,11 @@ union bpf_attr {
>>>>    *           and **BPF_CGROUP_INET6_CONNECT**.
>>>>    *
>>>>    *         This helper actually implements a subset of 
>>>> **getsockopt()**.
>>>> - *         It supports the following *level*\ s:
>>>> + *         It supports the same set of *optname*\ s that supported by
>>>
>>> nit: that is supported by
>>>
>>>> + *         **bpf_setsockopt**\ () helper with a few exceptions:
>>>>    *
>>>> - *         * **IPPROTO_TCP**, which supports *optname*
>>>> - *           **TCP_CONGESTION**.
>>>> - *         * **IPPROTO_IP**, which supports *optname* **IP_TOS**.
>>>> - *         * **IPPROTO_IPV6**, which supports *optname* 
>>>> **IPV6_TCLASS**.
>>>> + *         * **bpf_setsockopt**\ () helper only: **TCP_BPF_***.
>>>> + *         * **bpf_getsockopt**\ () helper only: **TCP_SAVED_SYNC**.
>>>
>>> I think from a user PoV the above is a bit hard to follow, maybe take 
>>> Martin's
>>> earlier feedback into account and add a proper sentence; it will be 
>>> much easier
>>> to understand.
>>
>> +1  Made the change and also fixed TCP_SAVED_SYNC with s/SYNC/SYN/ 
>> while applying.  Thanks!
> 
> Thanks for the helpful reviews. I chose the form of lists was because we 
> could
> append more optnames easily in the future. But I believe it's not late 
> to apply
> that form when we really need it : )
> 
> In my opinion, this patch doesn't contain any new feature, but just a 

new features

> kind of fix
> to the documentation, according to the corresponding code in the bpf tree,
> which hasn't been modified yet in the bpf-next tree. So I targeted the 
> former,
> as this patch could be useful there. Please let me know if there's any 

if there're

> customary
> rules outside bpf_devel_QA. Thanks!

I just found that SO_BINDTODEVICE is bpf_setsockopt() only. I checked 
sock_getbindtodevice() and there's nothing special comparing with 
sock_setbindtodevice(), except "down_read(&devnet_rename_sem);" and 
"up_read(&devnet_rename_sem);". Martin once wrote:

 > The only exception is SO_BINDTODEVICE because it needs to acquire a
 > blocking lock.  Thus, SO_BINDTODEVICE is not supported.

Were you referring to "down_read(&devnet_rename_sem);"? Seems it's not 
acquiring a blocking lock. Maybe "devnet_rename_sem" has been locked for 
writing somewhere in bpf before? Please let me know. Thanks!

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

end of thread, other threads:[~2022-11-29 14:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-18  8:18 [PATCH bpf v2] bpf: Update bpf_{g,s}etsockopt() documentation Ji Rongfeng
2022-11-24  0:18 ` Daniel Borkmann
2022-11-24  0:40   ` Martin KaFai Lau
2022-11-27  3:27     ` Ji Rongfeng
     [not found]     ` <7ede0b02-6fe6-f51e-eb3c-bf6dab63aa21@outlook.com>
2022-11-29 14:14       ` Ji Rongfeng

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