From: Andrew Lunn <andrew@lunn.ch>
To: Igor Russkikh <Igor.Russkikh@aquantia.com>
Cc: "David S . Miller" <davem@davemloft.net>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
Dmitry Bezrukov <Dmitry.Bezrukov@aquantia.com>
Subject: [net-next,18/19] net: usb: aqc111: Implement get/set_link_ksettings callbacks
Date: Sat, 6 Oct 2018 19:38:47 +0200 [thread overview]
Message-ID: <20181006173847.GF6990@lunn.ch> (raw)
> +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;
> +}
> +
next reply other threads:[~2018-10-06 17:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-06 17:38 Andrew Lunn [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-10-08 14:18 [net-next,18/19] net: usb: aqc111: Implement get/set_link_ksettings callbacks Oliver Neukum
2018-10-05 10:25 Igor Russkikh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181006173847.GF6990@lunn.ch \
--to=andrew@lunn.ch \
--cc=Dmitry.Bezrukov@aquantia.com \
--cc=Igor.Russkikh@aquantia.com \
--cc=davem@davemloft.net \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).