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:   Sat, 16 May 2020 17:14:11 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     Luo bin <luobin9@...wei.com>
Cc:     davem@...emloft.net, linux-kernel@...r.kernel.org,
        netdev@...r.kernel.org, luoxianjun@...wei.com,
        yin.yinshi@...wei.com, cloud.wangxiaoyun@...wei.com
Subject: Re: [PATCH net-next] hinic: add support to set and get pause param

On Sat, May 16, 2020 at 02:00:30AM +0000, Luo bin wrote:
> +static int hinic_set_pauseparam(struct net_device *netdev,
> +				struct ethtool_pauseparam *pause)
> +{
> +	struct hinic_dev *nic_dev = netdev_priv(netdev);
> +	struct hinic_pause_config pause_info = {0};
> +	struct hinic_port_cap port_cap = {0};
> +	int err;
> +
> +	err = hinic_port_get_cap(nic_dev, &port_cap);
> +	if (err) {
> +		netif_err(nic_dev, drv, netdev,
> +			  "Failed to get port capability\n");
> +		return -EIO;
> +	}
> +
> +	if (pause->autoneg != port_cap.autoneg_state) {
> +		netif_err(nic_dev, drv, netdev,
> +			  "To change autoneg please use: ethtool -s <dev> autoneg <on|off>\n");
> +		return -EOPNOTSUPP;
> +	}

It is unclear at the moment if this is the correct thing to do. There
was a discussion this week involving Russell King and Doug Berger you
might want to read.

> +
> +	pause_info.auto_neg = pause->autoneg;
> +	pause_info.rx_pause = pause->rx_pause;
> +	pause_info.tx_pause = pause->tx_pause;
> +
> +	down(&nic_dev->hwdev->func_to_io.nic_cfg.cfg_lock);
> +	err = hinic_set_hw_pause_info(nic_dev->hwdev, &pause_info);
> +	if (err) {
> +		netif_err(nic_dev, drv, netdev, "Failed to set pauseparam\n");
> +		up(&nic_dev->hwdev->func_to_io.nic_cfg.cfg_lock);
> +		return err;
> +	}
> +	nic_dev->hwdev->func_to_io.nic_cfg.pause_set = true;
> +	nic_dev->hwdev->func_to_io.nic_cfg.auto_neg = pause->autoneg;
> +	nic_dev->hwdev->func_to_io.nic_cfg.rx_pause = pause->rx_pause;
> +	nic_dev->hwdev->func_to_io.nic_cfg.tx_pause = pause->tx_pause;
> +	up(&nic_dev->hwdev->func_to_io.nic_cfg.cfg_lock);
> +
> +	netif_info(nic_dev, drv, netdev, "Set pause options, tx: %s, rx: %s\n",
> +		   pause->tx_pause ? "on" : "off",
> +		   pause->rx_pause ? "on" : "off");

netif_dbg()

	Andrew

Powered by blists - more mailing lists