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: <20240815184635.4c074130@kernel.org>
Date: Thu, 15 Aug 2024 18:46:35 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Justin Lai <justinlai0215@...ltek.com>
Cc: <davem@...emloft.net>, <edumazet@...gle.com>, <pabeni@...hat.com>,
 <linux-kernel@...r.kernel.org>, <netdev@...r.kernel.org>, <andrew@...n.ch>,
 <jiri@...nulli.us>, <horms@...nel.org>, <rkannoth@...vell.com>,
 <jdamato@...tly.com>, <pkshih@...ltek.com>, <larry.chiu@...ltek.com>
Subject: Re: [PATCH net-next v27 10/13] rtase: Implement ethtool function

On Mon, 12 Aug 2024 14:35:36 +0800 Justin Lai wrote:
> +static void rtase_get_drvinfo(struct net_device *dev,
> +			      struct ethtool_drvinfo *info)
> +{
> +	const struct rtase_private *tp = netdev_priv(dev);
> +
> +	strscpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
> +	strscpy(info->bus_info, pci_name(tp->pdev), sizeof(info->bus_info));
> +}

This shouldn't be necessary, can you delete this function from the
driver and check if the output of ethtool -i changes?
ethtool_get_drvinfo() should fill this in for you.

> +static void rtase_get_pauseparam(struct net_device *dev,
> +				 struct ethtool_pauseparam *pause)
> +{
> +	const struct rtase_private *tp = netdev_priv(dev);
> +	u16 value = rtase_r16(tp, RTASE_CPLUS_CMD);
> +
> +	pause->autoneg = AUTONEG_DISABLE;
> +
> +	if ((value & (RTASE_FORCE_TXFLOW_EN | RTASE_FORCE_RXFLOW_EN)) ==
> +	    (RTASE_FORCE_TXFLOW_EN | RTASE_FORCE_RXFLOW_EN)) {
> +		pause->rx_pause = 1;
> +		pause->tx_pause = 1;
> +	} else if (value & RTASE_FORCE_TXFLOW_EN) {
> +		pause->tx_pause = 1;
> +	} else if (value & RTASE_FORCE_RXFLOW_EN) {
> +		pause->rx_pause = 1;
> +	}

This 3 if statements can be replaced with just two lines:

	pause->rx_pause = !!(value & RTASE_FORCE_RXFLOW_EN);
	pause->tx_pause = !!(value & RTASE_FORCE_TXFLOW_EN);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ