[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <97283e6f-6018-4252-b3f0-e620f989c065@redhat.com>
Date: Thu, 22 May 2025 09:36:58 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: John Ousterhout <ouster@...stanford.edu>
Cc: netdev@...r.kernel.org, edumazet@...gle.com, horms@...nel.org,
kuba@...nel.org
Subject: Re: [PATCH net-next v8 02/15] net: homa: create homa_wire.h
On 5/22/25 7:31 AM, John Ousterhout wrote:
> One small follow-up:
>
> On Mon, May 5, 2025 at 1:28 AM Paolo Abeni <pabeni@...hat.com> wrote:
>> [...]
>>> +_Static_assert(sizeof(struct homa_data_hdr) <= HOMA_MAX_HEADER,
>>> + "homa_data_hdr too large for HOMA_MAX_HEADER; must adjust HOMA_MAX_HEADER");
>>> +_Static_assert(sizeof(struct homa_data_hdr) >= HOMA_MIN_PKT_LENGTH,
>>> + "homa_data_hdr too small: Homa doesn't currently have code to pad data packets");
>>> +_Static_assert(((sizeof(struct homa_data_hdr) - sizeof(struct homa_seg_hdr)) &
>>> + 0x3) == 0,
>>> + " homa_data_hdr length not a multiple of 4 bytes (required for TCP/TSO compatibility");
>>
>> Please use BUILD_BUG_ON() in a .c file instead. Many other cases below.
>
> BUILD_BUG_ON expands to code, so it only works in contexts where there
> can be code. I see that you said to put this in a .c file, but these
> assertions are closely related to the structure declaration, so they
> really belong right next to the structure (there's no natural place to
> put them in a .c file).
The customary practice is to add this kind of check in the relevant
_init function, see as a random example:
https://elixir.bootlin.com/linux/v6.14.7/source/net/ipv4/tcp_bbr.c#L1178
Possibly a good location could be the homa per netns init.
/P
Powered by blists - more mailing lists