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 Wed, Jun 14, 2017 at 10:14:07PM +0300, Yuval Shaia wrote:
> On Wed, Jun 14, 2017 at 03:04:43PM +0000, Christian Benvenuti (benve) wrote:
> > > -----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
> 
> I see,
> 
> So back to your proposal, the fact that dev->get_netdev is not set means
> that the IB device is not relayed on Ethernet one (RoCE folks, correct me
> if i'm wrong) so with the given input - the operation is not supported. Is
> that means that -EINVAL is better than -EOPNOTSUPP?
> 
> As far as the name suggest, EINVAL is where input values are wrong while
> EOPNOTSUPP is where input values are fine but the operation is not
> supported.

Please ignore, i looked at some other places.
Will post v4 soon.

> 
> Yuval
> 
> > 
> > /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
> --
> 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
--
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