public inbox for linux-m68k@lists.linux-m68k.org
 help / color / mirror / Atom feed
* Re: [PATCH net-next v4 04/15] mctp: Add sockaddr_mctp to uapi
       [not found] ` <20210729022053.134453-5-jk@codeconstruct.com.au>
@ 2021-10-14 18:34   ` Eugene Syromiatnikov
  2021-10-15  1:18     ` Jeremy Kerr
  2021-10-15  6:27     ` Geert Uytterhoeven
  0 siblings, 2 replies; 3+ messages in thread
From: Eugene Syromiatnikov @ 2021-10-14 18:34 UTC (permalink / raw)
  To: Jeremy Kerr
  Cc: netdev, Matt Johnston, Andrew Jeffery, Jakub Kicinski,
	David S. Miller, linux-m68k

On Thu, Jul 29, 2021 at 10:20:42AM +0800, Jeremy Kerr wrote:
> This change introduces the user-visible MCTP header, containing the
> protocol-specific addressing definitions.

[...]

> --- a/include/uapi/linux/mctp.h
> +++ b/include/uapi/linux/mctp.h
> @@ -9,7 +9,28 @@
>  #ifndef __UAPI_MCTP_H
>  #define __UAPI_MCTP_H
>  
> +#include <linux/types.h>
> +
> +typedef __u8			mctp_eid_t;
> +
> +struct mctp_addr {
> +	mctp_eid_t		s_addr;
> +};
> +
>  struct sockaddr_mctp {
> +	unsigned short int	smctp_family;

This gap makes the size of struct sockaddr_mctp 2 bytes less at least
on m68k, are you fine with that?

> +	int			smctp_network;
> +	struct mctp_addr	smctp_addr;
> +	__u8			smctp_type;
> +	__u8			smctp_tag;
>  };


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

* Re: [PATCH net-next v4 04/15] mctp: Add sockaddr_mctp to uapi
  2021-10-14 18:34   ` [PATCH net-next v4 04/15] mctp: Add sockaddr_mctp to uapi Eugene Syromiatnikov
@ 2021-10-15  1:18     ` Jeremy Kerr
  2021-10-15  6:27     ` Geert Uytterhoeven
  1 sibling, 0 replies; 3+ messages in thread
From: Jeremy Kerr @ 2021-10-15  1:18 UTC (permalink / raw)
  To: Eugene Syromiatnikov
  Cc: netdev, Matt Johnston, Andrew Jeffery, Jakub Kicinski,
	David S. Miller, linux-m68k

Hi Eugene,

Thanks for taking a look at these!

> > +typedef __u8                   mctp_eid_t;
> > +
> > +struct mctp_addr {
> > +       mctp_eid_t              s_addr;
> > +};
> > +
> >  struct sockaddr_mctp {
> > +       unsigned short int      smctp_family;
> 
> This gap makes the size of struct sockaddr_mctp 2 bytes less at least
> on m68k, are you fine with that?

Yep, that's OK from the protocol implementation side; this layout better
matches the "hierarchy" of the MCTP addressing. If we go for optimal
packing, the order of the members makes somewhat less sense. We could
add padding members, but I'm not sure that's worth it...

I noticed a few other protocol implementations doing similar things, so
assume it isn't an issue - it's all arch-specific ABI anyway, right?

> > +       int                     smctp_network;
> > +       struct mctp_addr        smctp_addr;
> > +       __u8                    smctp_type;
> > +       __u8                    smctp_tag;
> >  };

Cheers,


Jeremy



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

* Re: [PATCH net-next v4 04/15] mctp: Add sockaddr_mctp to uapi
  2021-10-14 18:34   ` [PATCH net-next v4 04/15] mctp: Add sockaddr_mctp to uapi Eugene Syromiatnikov
  2021-10-15  1:18     ` Jeremy Kerr
@ 2021-10-15  6:27     ` Geert Uytterhoeven
  1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2021-10-15  6:27 UTC (permalink / raw)
  To: Eugene Syromiatnikov
  Cc: Jeremy Kerr, netdev, Matt Johnston, Andrew Jeffery,
	Jakub Kicinski, David S. Miller, linux-m68k

On Fri, Oct 15, 2021 at 12:32 AM Eugene Syromiatnikov <esyr@redhat.com> wrote:
> On Thu, Jul 29, 2021 at 10:20:42AM +0800, Jeremy Kerr wrote:
> > This change introduces the user-visible MCTP header, containing the
> > protocol-specific addressing definitions.
>
> [...]
>
> > --- a/include/uapi/linux/mctp.h
> > +++ b/include/uapi/linux/mctp.h
> > @@ -9,7 +9,28 @@
> >  #ifndef __UAPI_MCTP_H
> >  #define __UAPI_MCTP_H
> >
> > +#include <linux/types.h>
> > +
> > +typedef __u8                 mctp_eid_t;
> > +
> > +struct mctp_addr {
> > +     mctp_eid_t              s_addr;
> > +};
> > +
> >  struct sockaddr_mctp {
> > +     unsigned short int      smctp_family;
>
> This gap makes the size of struct sockaddr_mctp 2 bytes less at least
> on m68k, are you fine with that?
>
> > +     int                     smctp_network;
> > +     struct mctp_addr        smctp_addr;
> > +     __u8                    smctp_type;
> > +     __u8                    smctp_tag;

And it may be wise to add 1 byte of explicit padding here?
Or is there a good reason not to do so?

> >  };

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

end of thread, other threads:[~2021-10-15  6:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20210729022053.134453-1-jk@codeconstruct.com.au>
     [not found] ` <20210729022053.134453-5-jk@codeconstruct.com.au>
2021-10-14 18:34   ` [PATCH net-next v4 04/15] mctp: Add sockaddr_mctp to uapi Eugene Syromiatnikov
2021-10-15  1:18     ` Jeremy Kerr
2021-10-15  6:27     ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox