> -----Original Message----- > From: Yuval Shaia [mailto:yuval.shaia@xxxxxxxxxx] > Sent: Wednesday, June 14, 2017 6:03 AM > To: Christian Benvenuti (benve) > Cc: dledford@xxxxxxxxxx; sean.hefty@xxxxxxxxx; hal.rosenstock@xxxxxxxxx; > selvin.xavier@xxxxxxxxxxxx; devesh.sharma@xxxxxxxxxxxx; > somnath.kotur@xxxxxxxxxxxx; sriharsha.basavapatna@xxxxxxxxxxxx; Dave Goodell > (dgoodell); monis@xxxxxxxxxxxx; leonro@xxxxxxxxxxxx; ira.weiny@xxxxxxxxx; > dasaratharaman.chandramouli@xxxxxxxxx; sagi@xxxxxxxxxx; > bart.vanassche@xxxxxxxxxxx; yishaih@xxxxxxxxxxxx; linux-rdma@xxxxxxxxxxxxxxx > Subject: Re: [PATCH v3 2/2] IB/core: Add generic function to extract IB speed > from netdev > > 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? I am not sure about the other two: - rdma_port_get_link_layer() does not entirely depend on ib_device->get_link_layer() - ib_device->get_netdev() can fail for different reasons I guess /Chris > > > > > + 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