Re: [PATCH v1] IB/core: Add generic function to extract IB speed from netdev

Yuval Shaia
2017-06-08T13:27:04Z

On Thu, Jun 08, 2017 at 08:43:41AM +0300, Moni Shoua wrote:
> >> >
> >> > +void ib_get_speed(struct net_device *netdev, u8 *speed, u8 *width)
> >> > +{
> >> > + int rc;
> >> > + u32 netdev_speed = SPEED_UNKNOWN;
> >> > +
> >
> > [1]
> >
> I think it should be clear that this function is good only for RoCE
> If you pass struct ib_device* instead of struct net_device* you can
> check link layer and return bad status of it is not Ethernet

Will do.

> The net_device will be obtained via get_netdev() hook.

So every explicit usage of ibdev->netdev can be considered as bed practice?

> Consider adding _eth_ to the name of the function (e.g. ib_get_etht_speed)

Will do.