[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181006173847.GF6990@lunn.ch>
Date: Sat, 6 Oct 2018 19:38:47 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Igor Russkikh <Igor.Russkikh@...antia.com>
Cc: "David S . Miller" <davem@...emloft.net>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Dmitry Bezrukov <Dmitry.Bezrukov@...antia.com>
Subject: Re: [PATCH net-next 18/19] net: usb: aqc111: Implement
get/set_link_ksettings callbacks
> +static int aqc111_set_link_ksettings(struct net_device *net,
> + const struct ethtool_link_ksettings *elk)
> +{
> + struct usbnet *dev = netdev_priv(net);
> + enum usb_device_speed usb_speed = dev->udev->speed;
> + struct aqc111_data *aqc111_data = (struct aqc111_data *)dev->data[0];
> + u32 speed = elk->base.speed;
> + u8 autoneg = elk->base.autoneg;
> +
> + if (autoneg == AUTONEG_ENABLE) {
> + if (aqc111_data->autoneg != AUTONEG_ENABLE) {
> + aqc111_data->autoneg = AUTONEG_ENABLE;
> + aqc111_data->advertised_speed =
> + (usb_speed == USB_SPEED_SUPER) ?
> + SPEED_5000 : SPEED_1000;
> + aqc111_set_phy_speed(dev, aqc111_data->autoneg,
> + aqc111_data->advertised_speed);
> + }
> + } else {
> + if (speed != SPEED_100 &&
> + speed != SPEED_1000 &&
> + speed != SPEED_2500 &&
> + speed != SPEED_5000 &&
> + speed != SPEED_UNKNOWN)
> + return -EINVAL;
> +
> + if (usb_speed != USB_SPEED_SUPER && speed > SPEED_1000)
> + return -EINVAL;
> +
Hi Igor
Maybe you are missing a check for duplex here?
> + aqc111_data->autoneg = AUTONEG_DISABLE;
> + if (speed != SPEED_UNKNOWN)
> + aqc111_data->advertised_speed = speed;
> +
> + aqc111_set_phy_speed(dev, aqc111_data->autoneg,
> + aqc111_data->advertised_speed);
> + }
> +
> + return 0;
> +}
> +
Powered by blists - more mailing lists