[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200304183643.GK4264@unicorn.suse.cz>
Date: Wed, 4 Mar 2020 19:36:44 +0100
From: Michal Kubecek <mkubecek@...e.cz>
To: Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net, thomas.lendacky@....com, benve@...co.com,
_govind@....com, pkaustub@...co.com, peppe.cavallaro@...com,
alexandre.torgue@...com, joabreu@...opsys.com, snelson@...sando.io,
yisen.zhuang@...wei.com, salil.mehta@...wei.com,
jeffrey.t.kirsher@...el.com, jacob.e.keller@...el.com,
alexander.h.duyck@...ux.intel.com, michael.chan@...adcom.com,
saeedm@...lanox.com, leon@...nel.org, netdev@...r.kernel.org
Subject: Re: [PATCH net-next v2 01/12] ethtool: add infrastructure for
centralized checking of coalescing parameters
On Wed, Mar 04, 2020 at 10:00:50AM -0800, Jakub Kicinski wrote:
> On Wed, 4 Mar 2020 08:59:26 +0100 Michal Kubecek wrote:
> > Just an idea: perhaps we could use the fact that struct ethtool_coalesce
> > is de facto an array so that this block could be replaced by a loop like
> >
> > u32 supported_types = dev->ethtool_ops->coalesce_types;
> > const u32 *values = &coalesce->rx_coalesce_usecs;
> >
> > for (i = 0; i < __ETHTOOL_COALESCE_COUNT; i++)
> > if (values[i] && !(supported_types & BIT(i)))
> > return false;
> >
> > and to be sure, BUILD_BUG_ON() or static_assert() check that the offset
> > of ->rate_sample_interval matches ETHTOOL_COALESCE_RATE_SAMPLE_INTERVAL.
>
> I kind of prefer the greppability over the saved 40 lines :(
> But I'm happy to change if we get more votes for the more concise
> version. Or perhaps the Intel version with the warnings printed.
No problem, it was just an idea, I can see that each approach has its
advantages.
Michal
Powered by blists - more mailing lists