public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Yuval Shaia <yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: "Christian Benvenuti (benve)"
	<benve-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
Cc: "dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org"
	<dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	"sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org"
	<sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	"hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org"
	<hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org"
	<selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	"devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org"
	<devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	"somnath.kotur-dY08KVG/lbpWk0Htik3J/w@public.gmane.org"
	<somnath.kotur-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	"sriharsha.basavapatna-dY08KVG/lbpWk0Htik3J/w@public.gmane.org"
	<sriharsha.basavapatna-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	"Dave Goodell (dgoodell)"
	<dgoodell-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>,
	"monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org"
	<monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	"leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org"
	<leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	"ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org"
	<ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	"dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org"
	<dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	"sagi-TmH2Wj2nsNJBDLzU/O5InQ@public.gmane.org"
	<sagi-TmH2Wj2nsNJBDLzU/O5InQ@public.gmane.org>,
	"bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org"
	<bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>,
	yishaih@
Subject: Re: [PATCH v3 2/2] IB/core: Add generic function to extract IB speed from netdev
Date: Wed, 14 Jun 2017 22:14:07 +0300	[thread overview]
Message-ID: <20170614191406.GA2375@yuvallap> (raw)
In-Reply-To: <e61752e6cd164574b08161ae5f4c43f6-NcvnDpcxJI+VcpH5Q1TwH6BKnGwkPULj@public.gmane.org>

On Wed, Jun 14, 2017 at 03:04:43PM +0000, Christian Benvenuti (benve) wrote:
> > -----Original Message-----
> > From: Yuval Shaia [mailto:yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org]
> > Sent: Wednesday, June 14, 2017 6:03 AM
> > To: Christian Benvenuti (benve)
> > Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org; sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org; hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org;
> > selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org; devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org;
> > somnath.kotur-dY08KVG/lbpWk0Htik3J/w@public.gmane.org; sriharsha.basavapatna-dY08KVG/lbpWk0Htik3J/w@public.gmane.org; Dave Goodell
> > (dgoodell); monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org; leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org; ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org;
> > dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org; sagi-TmH2Wj2nsNJBDLzU/O5InQ@public.gmane.org;
> > bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org; yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org; linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> > 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.

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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> 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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2017-06-14 19:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-11  5:44 [PATCH v3] IB/{core, usnic}: Add generic function to extract IB speed from netdev Yuval Shaia
     [not found] ` <20170611054450.7221-1-yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2017-06-11  5:44   ` [PATCH v3 1/2] IB/usnic: Implement get_netdev hook Yuval Shaia
     [not found]     ` <20170611054450.7221-2-yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2017-06-13  7:25       ` Leon Romanovsky
     [not found]         ` <20170613072526.GM2576-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-06-13  7:35           ` Yuval Shaia
2017-06-13 10:37             ` Leon Romanovsky
2017-06-13  7:56       ` Christian Benvenuti (benve)
2017-06-11  5:44   ` [PATCH v3 2/2] IB/core: Add generic function to extract IB speed from netdev Yuval Shaia
     [not found]     ` <20170611054450.7221-3-yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2017-06-11  6:17       ` Moni Shoua
     [not found]         ` <CAG9sBKOTmcpy=iSZZ3=PG_k5o7HNS4vNA1qaahVZeOP2d2FLBw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-12 18:59           ` Yuval Shaia
2017-06-13  8:07       ` Christian Benvenuti (benve)
     [not found]         ` <e58c9e7782774aa1b710b779c44f918d-NcvnDpcxJI+VcpH5Q1TwH6BKnGwkPULj@public.gmane.org>
2017-06-14 13:02           ` Yuval Shaia
2017-06-14 15:04             ` Christian Benvenuti (benve)
     [not found]               ` <e61752e6cd164574b08161ae5f4c43f6-NcvnDpcxJI+VcpH5Q1TwH6BKnGwkPULj@public.gmane.org>
2017-06-14 19:14                 ` Yuval Shaia [this message]
2017-06-14 20:00                   ` Yuval Shaia
2017-06-13 10:37       ` Leon Romanovsky
2017-06-14 15:15       ` Selvin Xavier
     [not found]         ` <CA+sbYW07k=UoFvJVLvjfTcuUosoJJk34mSZJAfXRaUJuHwS3cA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-26 19:12           ` Yuval Shaia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170614191406.GA2375@yuvallap \
    --to=yuval.shaia-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
    --cc=bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org \
    --cc=benve-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org \
    --cc=dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=dgoodell-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=sagi-TmH2Wj2nsNJBDLzU/O5InQ@public.gmane.org \
    --cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=somnath.kotur-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=sriharsha.basavapatna-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox