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  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]
Date:   Mon, 3 Aug 2020 15:18:18 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     <sameehj@...zon.com>
Cc:     <davem@...emloft.net>, <netdev@...r.kernel.org>, <dwmw@...zon.com>,
        <zorik@...zon.com>, <matua@...zon.com>, <saeedb@...zon.com>,
        <msw@...zon.com>, <aliguori@...zon.com>, <nafea@...zon.com>,
        <gtzalik@...zon.com>, <netanel@...zon.com>, <alisaidi@...zon.com>,
        <benh@...zon.com>, <akiyano@...zon.com>, <ndagan@...zon.com>
Subject: Re: [PATCH V1 net-next 1/3] net: ena: ethtool: Add new device
 statistics

On Sat, 1 Aug 2020 14:21:28 +0000 sameehj@...zon.com wrote:
> +	if (eni_stats_needed) {
> +		ena_update_hw_stats(adapter);
> +		for (i = 0; i < ENA_STATS_ARRAY_ENI(adapter); i++) {
> +			ena_stats = &ena_stats_eni_strings[i];
> +
> +			ptr = (u64 *)((uintptr_t)&adapter->eni_stats +
> +				(uintptr_t)ena_stats->stat_offset);

In the kernel unsigned long is the type for doing maths on pointers.

> +			ena_safe_update_stat(ptr, data++, &adapter->syncp);
> +		}
> +	}
> +
>  	ena_queue_stats(adapter, &data);
>  	ena_dev_admin_queue_stats(adapter, &data);
>  }
>  
> +static void ena_get_ethtool_stats(struct net_device *netdev,
> +				  struct ethtool_stats *stats,
> +				  u64 *data)
> +{
> +	struct ena_adapter *adapter = netdev_priv(netdev);
> +
> +	ena_get_stats(adapter, data, adapter->eni_stats_supported);
> +}

Why the indirections? You always pass adapter->eni_stats_supported as a
parameter, why not just use it directly?

Other than the two nits, the set LGTM.

Powered by blists - more mailing lists