All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hal Rosenstock <hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
To: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Cc: roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 1/2] IB/mlx4: fix the case of invalid speed value returned when the port is down
Date: Mon, 02 Apr 2012 12:35:36 -0400	[thread overview]
Message-ID: <4F79D558.1000908@dev.mellanox.co.il> (raw)
In-Reply-To: <1333377921-8349-2-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

On 4/2/2012 10:45 AM, Or Gerlitz wrote:
> When the IB port is down, the active_speed value returned by the MAD_IFC
> command equals seven (7) which isn't among the IB speeds defined by the
> ib_port_speed enum. This results in invalid speed value seen by higher
> layers or applications who do port query. Fix that by setting the speed
> to be SDR - the lowest possible when the port is down.
> ---
>  drivers/infiniband/hw/mlx4/main.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
> index 75d3056..b727094 100644
> --- a/drivers/infiniband/hw/mlx4/main.c
> +++ b/drivers/infiniband/hw/mlx4/main.c
> @@ -253,6 +253,10 @@ static int ib_link_query_port(struct ib_device *ibdev, u8 port,
>  		if (out_mad->data[15] & 0x1)
>  			props->active_speed = IB_SPEED_FDR10;
>  	}
> +
> +	/* avoid wrong speed value returned by FW if the IB link is down */
> +	if (props->state == IB_PORT_DOWN)
> +		 props->active_speed = IB_SPEED_SDR;

Rather than always overwriting active_speed in this case, wouldn't it be
better to only do that for invalid values ?

-- Hal

>  out:
>  	kfree(in_mad);
>  	kfree(out_mad);

--
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:[~2012-04-02 16:35 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
     [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

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=4F79D558.1000908@dev.mellanox.co.il \
    --to=hal-ldsdmyg8hgv8yrgs2mwiifqbs+8scbdb@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=roland-DgEjT+Ai2ygdnm+yROfE0A@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.