public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: "ira.weiny" <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Hal Rosenstock <hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
Cc: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Christoph Lameter <cl-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>,
	"linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] IB/core: sysfs.c: Fix PerfMgt ClassPortInfo handling
Date: Mon, 28 Dec 2015 19:22:39 -0500	[thread overview]
Message-ID: <20151229002239.GB19794@phlsvsds.ph.intel.com> (raw)
In-Reply-To: <5681AF4E.8060604-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>

On Mon, Dec 28, 2015 at 04:53:18PM -0500, Hal Rosenstock wrote:
> 
> Port number is not part of ClassPortInfo attribute but is
> still needed as a parameter when invoking process_mad.
> 
> To properly handle this attribute, port_num is added as a
> parameter to get_counter_table and get_perf_mad was changed
> not to store port_num in the attribute itself when it's
> querying the ClassPortInfo attribute.
> 
> This handles issue pointed out by Matan Barak <matanb-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
> 
> Signed-off-by: Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Reviewed-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

> Acked-by: Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> ---
> diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
> index 539040f..2daf832 100644
> --- a/drivers/infiniband/core/sysfs.c
> +++ b/drivers/infiniband/core/sysfs.c
> @@ -438,7 +438,8 @@ static int get_perf_mad(struct ib_device *dev, int port_num, int attr,
>  	in_mad->mad_hdr.method        = IB_MGMT_METHOD_GET;
>  	in_mad->mad_hdr.attr_id       = attr;
>  
> -	in_mad->data[41] = port_num;	/* PortSelect field */
> +	if (attr != IB_PMA_CLASS_PORT_INFO)
> +		in_mad->data[41] = port_num;	/* PortSelect field */
>  
>  	if ((dev->process_mad(dev, IB_MAD_IGNORE_MKEY,
>  		 port_num, NULL, NULL,
> @@ -714,11 +715,12 @@ err:
>   * Figure out which counter table to use depending on
>   * the device capabilities.
>   */
> -static struct attribute_group *get_counter_table(struct ib_device *dev)
> +static struct attribute_group *get_counter_table(struct ib_device *dev,
> +						 int port_num)
>  {
>  	struct ib_class_port_info cpi;
>  
> -	if (get_perf_mad(dev, 0, IB_PMA_CLASS_PORT_INFO,
> +	if (get_perf_mad(dev, port_num, IB_PMA_CLASS_PORT_INFO,
>  				&cpi, 40, sizeof(cpi)) >= 0) {
>  
>  		if (cpi.capability_mask && IB_PMA_CLASS_CAP_EXT_WIDTH)
> @@ -776,7 +778,7 @@ static int add_port(struct ib_device *device, int port_num,
>  		goto err_put;
>  	}
>  
> -	p->pma_table = get_counter_table(device);
> +	p->pma_table = get_counter_table(device, port_num);
>  	ret = sysfs_create_group(&p->kobj, p->pma_table);
>  	if (ret)
>  		goto err_put_gid_attrs;
--
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:[~2015-12-29  0:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-28 21:53 [PATCH] IB/core: sysfs.c: Fix PerfMgt ClassPortInfo handling Hal Rosenstock
     [not found] ` <5681AF4E.8060604-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-12-29  0:22   ` ira.weiny [this message]
2015-12-29  8:55   ` Matan Barak

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=20151229002239.GB19794@phlsvsds.ph.intel.com \
    --to=ira.weiny-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=cl-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@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