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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 13, 2017 at 08:07:48AM +0000, Christian Benvenuti (benve) wrote:
> > 
> > +int ib_get_eth_speed(struct ib_device *dev, u8 port_num, u8 *speed, u8
> > +*width) {
> > +	int rc;
> > +	u32 netdev_speed;
> > +	struct net_device *netdev;
> > +	struct ethtool_link_ksettings lksettings;
> > +
> > +	if (rdma_port_get_link_layer(dev, port_num) != IB_LINK_LAYER_ETHERNET)
> > +		return -EINVAL;
> > +
> > +	if (!dev->get_netdev)
> > +		return -EINVAL;
> 
> -EOPNOTSUPP ?

Looks better.
Assuming the same should be for the above one and the one below, right?

> 
> > +	netdev = dev->get_netdev(dev, port_num);
> > +	if (!netdev)
> > +		return -EINVAL;
> > +
> > +	rtnl_lock();
> > +	rc = __ethtool_get_link_ksettings(netdev, &lksettings);
> > +	rtnl_unlock();
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux