public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2]: fixes to port query and sysfs in 3.4-rc1
@ 2012-04-02 14:45 Or Gerlitz
       [not found] ` <1333377921-8349-1-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 23+ messages in thread
From: Or Gerlitz @ 2012-04-02 14:45 UTC (permalink / raw)
  To: roland-DgEjT+Ai2ygdnm+yROfE0A
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Or Gerlitz

Or Gerlitz (2):
  IB/mlx4: fix the case of invalid speed value returned when the port is down
  IB/core: add missing string for the display of SDR rates in sysfs

 drivers/infiniband/core/sysfs.c   |    1 +
 drivers/infiniband/hw/mlx4/main.c |    4 ++++
 2 files changed, 5 insertions(+), 0 deletions(-)

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

^ permalink raw reply	[flat|nested] 23+ messages in thread
* Re: [PATCH] IB/core: Don't return EINVAL from sysfs rate attribute for invalid speeds
@ 2012-04-04 19:23 Bart Van Assche
  0 siblings, 0 replies; 23+ messages in thread
From: Bart Van Assche @ 2012-04-04 19:23 UTC (permalink / raw)
  To: Roland Dreier, linux-rdma-u79uwXL29TY76Z2rM5mHXA

> From: Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>
> 
> Commit e9319b0cb00d ("IB/core: Fix SDR rates in sysfs") changed our
> sysfs rate attribute to return EINVAL to userspace if the underlying
> device driver returns an invalid rate.  Apparently some drivers do this
> when the link is down and some userspace pukes if it gets an error when
> reading this attribute, so avoid a regression by not return an error to
> match the old code.
> 
> Signed-off-by: Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>
> ---
> I think I'd rather just add this, to get back closer to the original
> behavior even for non-fixed drivers (but I'll still merge the mlx4
> patch, since that makes sense too).
> 
>  drivers/infiniband/core/sysfs.c |    9 +++++----
>  1 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
> index 83b720e..246fdc1 100644
> --- a/drivers/infiniband/core/sysfs.c
> +++ b/drivers/infiniband/core/sysfs.c
> @@ -179,7 +179,7 @@ static ssize_t rate_show(struct ib_port *p, struct port_attribute *unused,
>  {
>  	struct ib_port_attr attr;
>  	char *speed = "";
> -	int rate = -1;		/* in deci-Gb/sec */
> +	int rate;		/* in deci-Gb/sec */
>  	ssize_t ret;
>  
>  	ret = ib_query_port(p->ibdev, p->port_num, &attr);
> @@ -187,9 +187,6 @@ static ssize_t rate_show(struct ib_port *p, struct port_attribute *unused,
>  		return ret;
>  
>  	switch (attr.active_speed) {
> -	case IB_SPEED_SDR:
> -		rate = 25;
> -		break;
>  	case IB_SPEED_DDR:
>  		speed = " DDR";
>  		rate = 50;
> @@ -210,6 +207,10 @@ static ssize_t rate_show(struct ib_port *p, struct port_attribute *unused,
>  		speed = " EDR";
>  		rate = 250;
>  		break;
> +	case IB_SPEED_SDR:
> +	default:		/* default to SDR for invalid rates */
> +		rate = 25;
> +		break;
>  	}
>  
>  	rate *= ib_width_enum_to_int(attr.active_width);
> -- 
> 1.7.9.1

Tested-by: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
--
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

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2012-04-04 19:23 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-02 14:45 [PATCH 0/2]: fixes to port query and sysfs in 3.4-rc1 Or Gerlitz
     [not found] ` <1333377921-8349-1-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2012-04-02 14:45   ` [PATCH 1/2] IB/mlx4: fix the case of invalid speed value returned when the port is down Or Gerlitz
     [not found]     ` <1333377921-8349-2-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2012-04-02 16:35       ` Hal Rosenstock
     [not found]         ` <4F79D558.1000908-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2012-04-02 16:47           ` Or Gerlitz
     [not found]             ` <4F79D826.9070605-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2012-04-02 18:02               ` Hal Rosenstock
2012-04-02 18:39               ` Hefty, Sean
     [not found]                 ` <1828884A29C6694DAF28B7E6B8A823734519A40B-P5GAC/sN6hmkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2012-04-02 18:45                   ` Hal Rosenstock
2012-04-02 18:47                   ` Jason Gunthorpe
2012-04-02 19:27       ` Roland Dreier
     [not found]         ` <CAL1RGDXvR-kk7TE3O33PrifuYoKkgdgAJ9aY5JkduywEf56w+Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-04-02 19:39           ` Hal Rosenstock
     [not found]             ` <4F7A0063.4000408-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2012-04-02 19:41               ` Roland Dreier
     [not found]                 ` <CAG4TOxM=bPqLySAAJzMtXkG9-SOLCT7ET=KNDK6=_x2mADtKJw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-04-02 19:52                   ` Hal Rosenstock
2012-04-04  6:38           ` Or Gerlitz
     [not found]             ` <4F7BEC4B.2030503-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2012-04-04  7:36               ` Roland Dreier
2012-04-02 14:45   ` [PATCH 2/2] IB/core: add missing string for the display of SDR rates in sysfs Or Gerlitz
     [not found]     ` <1333377921-8349-3-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2012-04-02 17:42       ` Roland Dreier
     [not found]         ` <CAL1RGDUCO+ijdYyaPsx7X9eYssj-qDEqeYm-gSAY30NwYo1Qpg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-04-02 18:20           ` Or Gerlitz
2012-04-02 18:50           ` Or Gerlitz
     [not found]             ` <CAJZOPZLWmBDBc7HpzWYa9etiiq4ZKeqP6XTYOat6mino8en3aA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-04-02 19:29               ` Roland Dreier
     [not found]                 ` <CAL1RGDVH28u1tY3K8Mw29wfzXVeYR-mNDDvfpABsoSTmZA56Ww-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-04-02 19:35                   ` [PATCH] IB/core: Don't return EINVAL from sysfs rate attribute for invalid speeds Roland Dreier
     [not found]                     ` <1333395332-17982-1-git-send-email-roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2012-04-02 19:48                       ` Or Gerlitz
2012-04-02 20:28                       ` Hal Rosenstock
  -- strict thread matches above, loose matches on Subject: below --
2012-04-04 19:23 Bart Van Assche

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox