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]
Date:   Thu, 30 Dec 2021 19:04:08 +0100
From:   Andrew Lunn <andrew@...n.ch>
To:     Dimitris Michailidis <d.michailidis@...gible.com>
Cc:     davem@...emloft.net, kuba@...nel.org, netdev@...r.kernel.org
Subject: Re: [PATCH net-next 4/8] net/funeth: ethtool operations

> +static void fun_get_pauseparam(struct net_device *netdev,
> +			       struct ethtool_pauseparam *pause)
> +{
> +	const struct funeth_priv *fp = netdev_priv(netdev);
> +	u8 active_pause = fp->active_fc;
> +
> +	pause->rx_pause = active_pause & FUN_PORT_CAP_RX_PAUSE;
> +	pause->tx_pause = active_pause & FUN_PORT_CAP_TX_PAUSE;
> +	pause->autoneg = !!(fp->advertising & FUN_PORT_CAP_AUTONEG);
> +}
> +
> +static int fun_set_pauseparam(struct net_device *netdev,
> +			      struct ethtool_pauseparam *pause)
> +{
> +	struct funeth_priv *fp = netdev_priv(netdev);
> +	u64 new_advert;
> +
> +	if (fp->port_caps & FUN_PORT_CAP_VPORT)
> +		return -EOPNOTSUPP;
> +	if (pause->autoneg && !(fp->advertising & FUN_PORT_CAP_AUTONEG))
> +		return -EINVAL;
> +	if (pause->tx_pause & !(fp->port_caps & FUN_PORT_CAP_TX_PAUSE))
> +		return -EINVAL;
> +	if (pause->rx_pause & !(fp->port_caps & FUN_PORT_CAP_RX_PAUSE))
> +		return -EINVAL;
> +

I _think_ this is wrong. pause->autoneg means we are autoneg'ing
pause, not that we are using auto-neg in general. The user can have
autoneg turned on, but force pause by setting pause->autoneg to False.
In that case, the pause->rx_pause and pause->tx_pause are given direct
to the MAC, not auto negotiated.

> +static void fun_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
> +{
> +	wol->supported = 0;
> +	wol->wolopts = 0;
> +}

Not required. If you don't provide the callback, the core will return
-EOPNOTSUPP.

> +static void fun_get_drvinfo(struct net_device *netdev,
> +			    struct ethtool_drvinfo *info)
> +{
> +	const struct funeth_priv *fp = netdev_priv(netdev);
> +
> +	strscpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
> +	strcpy(info->fw_version, "N/A");

Don't set it, if you have nothing useful to put in it.

      Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ