[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200706113208.672ce199@hermes.lan>
Date: Mon, 6 Jul 2020 11:32:08 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: "YU, Xiangning" <xiangning.yu@...baba-inc.com>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH net-next 2/2] net: sched: Lockless Token Bucket (LTB)
Qdisc
On Tue, 07 Jul 2020 02:08:13 +0800
"YU, Xiangning" <xiangning.yu@...baba-inc.com> wrote:
> +static inline s64 get_linkspeed(struct net_device *dev)
This is not performance sensitive and should not be marked inline.
> +{
> + struct ethtool_link_ksettings ecmd;
> +
> + ASSERT_RTNL();
> + if (netif_running(dev) && !__ethtool_get_link_ksettings(dev, &ecmd))
> + /* Convert to bytes per second */
> + return ecmd.base.speed * 1000 * 1000L / 8;
You need to be more careful in handling of devices that return unknown for speed.
> + return 0;
> +}
> +
Powered by blists - more mailing lists