diff mbox

[rdma-next,V2,3/5] RDMA/ipoib: Fix verifying return codes

Message ID 20180704215251.10698-4-kamalheib1@gmail.com (mailing list archive)
State Superseded
Headers show

Commit Message

Kamal Heib July 4, 2018, 9:52 p.m. UTC
Make sure to check for "-EOPNOTSUPP" instead of "-ENOSYS" which is the
return code from ib_create_srq() and rdma_set_cq_moderation() in case
that they aren't supported.

Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
---
 drivers/infiniband/ulp/ipoib/ipoib_cm.c      | 2 +-
 drivers/infiniband/ulp/ipoib/ipoib_ethtool.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Jason Gunthorpe July 9, 2018, 6:04 p.m. UTC | #1
On Thu, Jul 05, 2018 at 12:52:49AM +0300, Kamal Heib wrote:
> Make sure to check for "-EOPNOTSUPP" instead of "-ENOSYS" which is the
> return code from ib_create_srq() and rdma_set_cq_moderation() in case
> that they aren't supported.
> 
> Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
>  drivers/infiniband/ulp/ipoib/ipoib_cm.c      | 2 +-
>  drivers/infiniband/ulp/ipoib/ipoib_ethtool.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
> index 7eb38775f948..f16ecd799ab0 100644
> +++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
> @@ -1564,7 +1564,7 @@ static void ipoib_cm_create_srq(struct net_device *dev, int max_sge)
>  
>  	priv->cm.srq = ib_create_srq(priv->pd, &srq_init_attr);
>  	if (IS_ERR(priv->cm.srq)) {
> -		if (PTR_ERR(priv->cm.srq) != -ENOSYS)
> +		if (PTR_ERR(priv->cm.srq) != -EOPNOTSUPP)
>  			pr_warn("%s: failed to allocate SRQ, error %ld\n",
>  			       priv->ca->name, PTR_ERR(priv->cm.srq));
>  		priv->cm.srq = NULL;

There are several drivers that use ENOSYS, did you audit every
ib_create_srq implementation in drivers to make sure there was no
ENOSYS returned?

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kamal Heib July 9, 2018, 6:59 p.m. UTC | #2
On Mon, Jul 09, 2018 at 12:04:42PM -0600, Jason Gunthorpe wrote:
> On Thu, Jul 05, 2018 at 12:52:49AM +0300, Kamal Heib wrote:
> > Make sure to check for "-EOPNOTSUPP" instead of "-ENOSYS" which is the
> > return code from ib_create_srq() and rdma_set_cq_moderation() in case
> > that they aren't supported.
> > 
> > Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> >  drivers/infiniband/ulp/ipoib/ipoib_cm.c      | 2 +-
> >  drivers/infiniband/ulp/ipoib/ipoib_ethtool.c | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
> > index 7eb38775f948..f16ecd799ab0 100644
> > +++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
> > @@ -1564,7 +1564,7 @@ static void ipoib_cm_create_srq(struct net_device *dev, int max_sge)
> >  
> >  	priv->cm.srq = ib_create_srq(priv->pd, &srq_init_attr);
> >  	if (IS_ERR(priv->cm.srq)) {
> > -		if (PTR_ERR(priv->cm.srq) != -ENOSYS)
> > +		if (PTR_ERR(priv->cm.srq) != -EOPNOTSUPP)
> >  			pr_warn("%s: failed to allocate SRQ, error %ld\n",
> >  			       priv->ca->name, PTR_ERR(priv->cm.srq));
> >  		priv->cm.srq = NULL;
> 
> There are several drivers that use ENOSYS, did you audit every
> ib_create_srq implementation in drivers to make sure there was no
> ENOSYS returned?
> 
> Jason

Thanks for your review, I'll double check.

Thanks,
Kamal
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index 7eb38775f948..f16ecd799ab0 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -1564,7 +1564,7 @@  static void ipoib_cm_create_srq(struct net_device *dev, int max_sge)
 
 	priv->cm.srq = ib_create_srq(priv->pd, &srq_init_attr);
 	if (IS_ERR(priv->cm.srq)) {
-		if (PTR_ERR(priv->cm.srq) != -ENOSYS)
+		if (PTR_ERR(priv->cm.srq) != -EOPNOTSUPP)
 			pr_warn("%s: failed to allocate SRQ, error %ld\n",
 			       priv->ca->name, PTR_ERR(priv->cm.srq));
 		priv->cm.srq = NULL;
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c b/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c
index 2706bf26cbac..83429925dfc6 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c
@@ -102,7 +102,7 @@  static int ipoib_set_coalesce(struct net_device *dev,
 	ret = rdma_set_cq_moderation(priv->recv_cq,
 				     coal->rx_max_coalesced_frames,
 				     coal->rx_coalesce_usecs);
-	if (ret && ret != -ENOSYS) {
+	if (ret && ret != -EOPNOTSUPP) {
 		ipoib_warn(priv, "failed modifying CQ (%d)\n", ret);
 		return ret;
 	}