diff mbox series

[v2] socket: Use __u8 instead of u8 in uapi socket.h

Message ID 20220530081450.16591-1-tklauser@distanz.ch (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [v2] socket: Use __u8 instead of u8 in uapi socket.h | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch, async

Commit Message

Tobias Klauser May 30, 2022, 8:14 a.m. UTC
Use the uapi variant of the u8 type.

Fixes: 26859240e4ee ("txhash: Add socket option to control TX hash rethink behavior")
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
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(-)

Comments

David Laight May 30, 2022, 8:20 a.m. UTC | #1
From: Tobias Klauser
> 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")
> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
> ---
> 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(-)
> 
> diff --git a/include/uapi/linux/socket.h b/include/uapi/linux/socket.h
> index 51d6bb2f6765..62a32040ad4f 100644
> --- a/include/uapi/linux/socket.h
> +++ b/include/uapi/linux/socket.h
> @@ -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)

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

	David

>  #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)
Paolo Abeni May 31, 2022, 9:24 a.m. UTC | #2
On Mon, 2022-05-30 at 08:20 +0000, David Laight wrote:
> From: Tobias Klauser
> > 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")
> > Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
> > ---
> > 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(-)
> > 
> > diff --git a/include/uapi/linux/socket.h b/include/uapi/linux/socket.h
> > index 51d6bb2f6765..62a32040ad4f 100644
> > --- a/include/uapi/linux/socket.h
> > +++ b/include/uapi/linux/socket.h
> > @@ -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)
> 
> 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
Tobias Klauser May 31, 2022, 9:44 a.m. UTC | #3
On 2022-05-31 at 11:24:46 +0200, Paolo Abeni <pabeni@redhat.com> wrote:
> On Mon, 2022-05-30 at 08:20 +0000, David Laight wrote:
> > From: Tobias Klauser
> > > 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")
> > > Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
> > > ---
> > > 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(-)
> > > 
> > > diff --git a/include/uapi/linux/socket.h b/include/uapi/linux/socket.h
> > > index 51d6bb2f6765..62a32040ad4f 100644
> > > --- a/include/uapi/linux/socket.h
> > > +++ b/include/uapi/linux/socket.h
> > > @@ -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)
> > 
> > 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'.
diff mbox series

Patch

diff --git a/include/uapi/linux/socket.h b/include/uapi/linux/socket.h
index 51d6bb2f6765..62a32040ad4f 100644
--- a/include/uapi/linux/socket.h
+++ b/include/uapi/linux/socket.h
@@ -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