lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2bc1c2ee-f777-1e46-5a7d-7b4b755e1d79@intel.com>
Date:   Wed, 4 Mar 2020 13:22:47 -0800
From:   Jacob Keller <jacob.e.keller@...el.com>
To:     Jakub Kicinski <kuba@...nel.org>, Michal Kubecek <mkubecek@...e.cz>
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, 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 3/4/2020 10:00 AM, 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.
> 

We could go the looped route, but I like being able to search the code
for references. Seems like the main point of the loop would be to
simplify catching new added parameters in the future.

I don't really have a strong preference.

Thanks,
Jake

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ