[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6a2ef1b2-b4d4-41c5-9a70-42f9b0e4e29a@lunn.ch>
Date: Tue, 29 Oct 2024 22:59:40 +0100
From: Andrew Lunn <andrew@...n.ch>
To: John Ousterhout <ouster@...stanford.edu>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH net-next 01/12] net: homa: define user-visible API for
Homa
> +/**
> + * struct homa_recvmsg_args - Provides information needed by Homa's
> + * recvmsg; passed to recvmsg using the msg_control field.
> + */
> +struct homa_recvmsg_args {
> + /**
> + * @id: (in/out) Initially specifies the id of the desired RPC, or 0
> + * if any RPC is OK; returns the actual id received.
> + */
> + uint64_t id;
> +
> + /**
> + * @completion_cookie: (out) If the incoming message is a response,
> + * this will return the completion cookie specified when the
> + * request was sent. For requests this will always be zero.
> + */
> + uint64_t completion_cookie;
> +
> + /**
> + * @flags: (in) OR-ed combination of bits that control the operation.
> + * See below for values.
> + */
> + int flags;
Maybe give this a fixed size, otherwise it gets interesting when you
have a 32 bit userspace running on top of a 64 bit kernel.
> +
> + /**
> + * @error_addr: the address of the peer is stored here when available.
> + * This field is different from the msg_name field in struct msghdr
> + * in that the msg_name field isn't set after errors. This field will
> + * always be set when peer information is available, which includes
> + * some error cases.
> + */
> + union sockaddr_in_union peer_addr;
> +
> + /**
> + * @num_bpages: (in/out) Number of valid entries in @bpage_offsets.
> + * Passes in bpages from previous messages that can now be
> + * recycled; returns bpages from the new message.
> + */
> + uint32_t num_bpages;
> +
> + uint32_t _pad[1];
If you ever want to be able to use this sometime in the future, it
would be good to document that it should be filled with zero, and test
is it zero. And if the kernel ever passes this structure back to
userspace it should also fill it with zero.
> +#if !defined(__cplusplus)
> +_Static_assert(sizeof(struct homa_recvmsg_args) >= 120,
> + "homa_recvmsg_args shrunk");
> +_Static_assert(sizeof(struct homa_recvmsg_args) <= 120,
> + "homa_recvmsg_args grew");
Did you build for 32 bit systems?
Andrew
Powered by blists - more mailing lists