Skip to contentSkip to conversation

socket: Use __u8 instead of u8 in uapi socket.h

PATCH Superseded Tobias Klauser 5 participants 8 messages May 25, 2022 – Jun 2, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 socket: Use __u8 instead of u8 in uapi socket.h

Use the uapi variant of the u8 type.

Fixes 26859240e4ee ("txhash: Add socket option to control TX hash rethink behavior")
---
 include/uapi/linux/socket.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/socket.h +1 -1
index 51d6bb2f6765..c272bfcfc479 100644
@@ -31,7 +31,7 @@ struct __kernel_sockaddr_storage {
 
 #define SOCK_BUF_LOCK_MASK (SOCK_SNDBUF_LOCK | SOCK_RCVBUF_LOCK)
 
-#define SOCK_TXREHASH_DEFAULT	((u8)-1)
+#define SOCK_TXREHASH_DEFAULT	((__u8)-1)
 #define SOCK_TXREHASH_DISABLED	0
 #define SOCK_TXREHASH_ENABLED	1
 
Signature · 1 line
2.36.1
#1 lore raw
I love your patch! Perhaps something to improve:

Hi Tobias,

I love your patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]
[also build test WARNING on net/master horms-ipvs/master linus/master v5.18 next-20220525] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/intel-lab-lkp/linux/commits/Tobias-Klauser/socket-Use-__u8-instead-of-u8-in-uapi-socket-h/20220525-170053
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 57d7becda9c9e612e6b00676f2eecfac3e719e88
config: x86_64-randconfig-a015 (https://download.01.org/0day-ci/archive/20220525/[email protected]/config)
compiler: gcc-11 (Debian 11.3.0-1) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/283fe3009b96069f17a813f86db8b48d12b5014e
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Tobias-Klauser/socket-Use-__u8-instead-of-u8-in-uapi-socket-h/20220525-170053
        git checkout 283fe3009b96069f17a813f86db8b48d12b5014e
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable

All warnings (new ones prefixed by >>):

>> usr/include/linux/socket.h:34: found __[us]{8,16,32,64} type without #include <linux/types.h>
Signature · 2 lines
0-DAY CI Kernel Test Service
https://01.org/lkp
#2 lore raw

PATCH v2 1/1 socket: Use __u8 instead of u8 in uapi socket.h

In reply to Tobias Klauser

Use the uapi variant of the u8 type.

Fixes 26859240e4ee ("txhash: Add socket option to control TX hash rethink behavior")

---
v2: add missing <linux/types.h> include as reported by kernel test robot

 include/uapi/linux/socket.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
include/uapi/linux/socket.h +3 -1
index 51d6bb2f6765..62a32040ad4f 100644
@@ -2,6 +2,8 @@
 #ifndef _UAPI_LINUX_SOCKET_H
 #define _UAPI_LINUX_SOCKET_H
 
+#include <linux/types.h>
+
 /*
  * Desired design of maximum size and alignment (see RFC2553)
  */
@@ -31,7 +33,7 @@ struct __kernel_sockaddr_storage {
 
 #define SOCK_BUF_LOCK_MASK (SOCK_SNDBUF_LOCK | SOCK_RCVBUF_LOCK)
 
-#define SOCK_TXREHASH_DEFAULT	((u8)-1)
+#define SOCK_TXREHASH_DEFAULT	((__u8)-1)
 #define SOCK_TXREHASH_DISABLED	0
 #define SOCK_TXREHASH_ENABLED	1
 
Signature · 1 line
2.36.1
#3 lore raw

From: Tobias Klauser

Quoted 26 lines

Sent: 30 May 2022 09:15

Use the uapi variant of the u8 type.

Fixes 26859240e4ee ("txhash: Add socket option to control TX hash rethink behavior")

---
v2: add missing <linux/types.h> include as reported by kernel test robot

 include/uapi/linux/socket.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
include/uapi/linux/socket.h +2 -0
index 51d6bb2f6765..62a32040ad4f 100644
@@ -2,6 +2,8 @@
 #ifndef _UAPI_LINUX_SOCKET_H
 #define _UAPI_LINUX_SOCKET_H
 
+#include <linux/types.h>
+
 /*
  * Desired design of maximum size and alignment (see RFC2553)
  */

include/uapi/linux/socket.h struct __kernel_sockaddr_storage { · line 36

Quoted 5 lines
include/uapi/linux/socket.h +1 -1
@@ -31,7 +33,7 @@ struct __kernel_sockaddr_storage {
 
 #define SOCK_BUF_LOCK_MASK (SOCK_SNDBUF_LOCK | SOCK_RCVBUF_LOCK)
 
-#define SOCK_TXREHASH_DEFAULT	((u8)-1)
+#define SOCK_TXREHASH_DEFAULT	((__u8)-1)

I can't help feeling that 255u (or 0xffu) would be a better way to describe that value.

David

Quoted 5 lines
include/uapi/linux/socket.h +0 -1
 #define SOCK_TXREHASH_DISABLED	0
 #define SOCK_TXREHASH_ENABLED	1
 
--

2.36.1

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)

maintainer
#4 lore raw
Quoted 28 lines · David Laight

From: Tobias Klauser

Quoted 27 lines

Sent: 30 May 2022 09:15

Use the uapi variant of the u8 type.

Fixes 26859240e4ee ("txhash: Add socket option to control TX hash rethink behavior")

---
v2: add missing <linux/types.h> include as reported by kernel test robot

 include/uapi/linux/socket.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
include/uapi/linux/socket.h +2 -0
index 51d6bb2f6765..62a32040ad4f 100644
@@ -2,6 +2,8 @@
 #ifndef _UAPI_LINUX_SOCKET_H
 #define _UAPI_LINUX_SOCKET_H
 
+#include <linux/types.h>
+
 /*
  * Desired design of maximum size and alignment (see RFC2553)
  */
@@ -31,7 +33,7 @@ struct __kernel_sockaddr_storage {
 
Quoted 7 lines

include/uapi/linux/socket.h struct __kernel_sockaddr_storage { · line 36

Quoted 4 lines
include/uapi/linux/socket.h +1 -1
 #define SOCK_BUF_LOCK_MASK (SOCK_SNDBUF_LOCK | SOCK_RCVBUF_LOCK)
 
-#define SOCK_TXREHASH_DEFAULT	((u8)-1)
+#define SOCK_TXREHASH_DEFAULT	((__u8)-1)

I can't help feeling that 255u (or 0xffu) would be a better way to describe that value.

Even plain '255' would do. Additionally, any of the above will avoid the additional header dependency.

Thanks,

Paolo

#5 lore raw
Quoted 31 lines · Paolo Abeni
Quoted 30 lines · David Laight

From: Tobias Klauser

Quoted 29 lines

Sent: 30 May 2022 09:15

Use the uapi variant of the u8 type.

Fixes 26859240e4ee ("txhash: Add socket option to control TX hash rethink behavior")

---
v2: add missing <linux/types.h> include as reported by kernel test robot

 include/uapi/linux/socket.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
include/uapi/linux/socket.h +2 -0
index 51d6bb2f6765..62a32040ad4f 100644
@@ -2,6 +2,8 @@
 #ifndef _UAPI_LINUX_SOCKET_H
 #define _UAPI_LINUX_SOCKET_H
 
+#include <linux/types.h>
+
 /*
  * Desired design of maximum size and alignment (see RFC2553)
  */
@@ -31,7 +33,7 @@ struct __kernel_sockaddr_storage {
 
 #define SOCK_BUF_LOCK_MASK (SOCK_SNDBUF_LOCK | SOCK_RCVBUF_LOCK)
 
Quoted 8 lines
Quoted 5 lines

include/uapi/linux/socket.h struct __kernel_sockaddr_storage { · line 36

Quoted 2 lines
include/uapi/linux/socket.h +1 -1
-#define SOCK_TXREHASH_DEFAULT	((u8)-1)
+#define SOCK_TXREHASH_DEFAULT	((__u8)-1)

I can't help feeling that 255u (or 0xffu) would be a better way to describe that value.

Even plain '255' would do. Additionally, any of the above will avoid the additional header dependency.

Thanks, I've sent v3 changing it to plain '255'.

#6 lore raw

PATCH v3 1/1 socket: Don't use u8 type in uapi socket.h

In reply to Tobias Klauser

Use plain 255 instead, which also avoid introducing an additional header dependency on <linux/types.h>

Fixes 26859240e4ee ("txhash: Add socket option to control TX hash rethink behavior")

---
v3: changed to plain 255 as suggested by David Laight and Paolo Abeni

 include/uapi/linux/socket.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/socket.h +1 -1
index 51d6bb2f6765..d3fcd3b5ec53 100644
@@ -31,7 +31,7 @@ struct __kernel_sockaddr_storage {
 
 #define SOCK_BUF_LOCK_MASK (SOCK_SNDBUF_LOCK | SOCK_RCVBUF_LOCK)
 
-#define SOCK_TXREHASH_DEFAULT	((u8)-1)
+#define SOCK_TXREHASH_DEFAULT	255
 #define SOCK_TXREHASH_DISABLED	0
 #define SOCK_TXREHASH_ENABLED	1
 
Signature · 1 line
2.36.1
#7 lore raw

Re: [PATCH v3] socket: Don't use u8 type in uapi socket.h

This patch was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Tue, 31 May 2022 11:43:45 +0200 you wrote:

Use plain 255 instead, which also avoid introducing an additional header dependency on <linux/types.h>

Fixes 26859240e4ee ("txhash: Add socket option to control TX hash rethink behavior")

---
v3: changed to plain 255 as suggested by David Laight and Paolo Abeni

[...]

Here is the summary with links:
- [v3] socket: Don't use u8 type in uapi socket.h

    https://git.kernel.org/netdev/net/c/8d3398ba2a0d

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html