[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250909170053.6d0eb1b7@kernel.org>
Date: Tue, 9 Sep 2025 17:00:53 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Shenwei Wang <shenwei.wang@....com>
Cc: Wei Fang <wei.fang@....com>, Andrew Lunn <andrew+netdev@...n.ch>, "David
S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Paolo
Abeni <pabeni@...hat.com>, Alexei Starovoitov <ast@...nel.org>, Daniel
Borkmann <daniel@...earbox.net>, Jesper Dangaard Brouer <hawk@...nel.org>,
John Fastabend <john.fastabend@...il.com>, Clark Wang
<xiaoning.wang@....com>, Stanislav Fomichev <sdf@...ichev.me>,
imx@...ts.linux.dev, netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-imx@....com, Andrew Lunn <andrew@...n.ch>, Frank Li
<frank.li@....com>
Subject: Re: [PATCH v6 net-next 1/6] net: fec: use a member variable for
maximum buffer size
On Mon, 8 Sep 2025 11:17:50 -0500 Shenwei Wang wrote:
> -#define OPT_FRAME_SIZE (PKT_MAXBUF_SIZE << 16)
> -#else
> -#define OPT_FRAME_SIZE 0
> +#define OPT_ARCH_HAS_MAX_FL
> #endif
> +#ifdef OPT_ARCH_HAS_MAX_FL
> + rcntl |= fep->max_buf_size << 16;
> +#endif
We try to avoid ifdefs inside C functions, they make compilation
coverage harder. Could you define OPT_ARCH_HAS_MAX_FL to 0 or 1
depending on the platform, and then use:
if (OPT_ARCH_HAS_MAX_FL)
rcntl |= fep->max_buf_size << 16;
The compiler will eliminate the condition if it's a constant,
but its slightly easier to read and lets the compiler see the code
regardless of the arch.
Powered by blists - more mailing lists