All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH for-next 1/4] IB/core: Add support for get ClassPortInfo from the SA
Date: Thu, 12 May 2016 19:17:37 -0400	[thread overview]
Message-ID: <20160512231737.GA16168@rhel.sc.intel.com> (raw)
In-Reply-To: <1461070287-13469-2-git-send-email-erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

On Tue, Apr 19, 2016 at 03:51:24PM +0300, Erez Shitrit wrote:
> 
> Change struct ib_class_port_info to conform to IB Spec 1.3
> That in order to get specific capability mask from ClassPortInfo mad.
> 
> From the IB Spec, ClassPortInfo section:
> 	"CapabilityMask2 Bits 0-26: Additional class-specific capabilities...
> 	 RespTimeValue the rest 5 bits"
> 
> The new struct now has one field that contains both of cap_mask2 (which was
> reserved and resp_time which now is 27 bits for cap_mask2 and 5 bits for
> resp_time in the new field)
> 
> More changes to adjust the new structure:
> IB/qib: Change pma_get_classportinfo
> IB/srpt: Adjust the use of ib_class_port_info
> 
> Signed-off-by: Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Reviewed-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> ---
>  drivers/infiniband/hw/qib/qib_mad.c   | 6 ++++--
>  drivers/infiniband/ulp/srpt/ib_srpt.c | 5 ++++-
>  include/rdma/ib_mad.h                 | 4 ++--
>  3 files changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/qib/qib_mad.c b/drivers/infiniband/hw/qib/qib_mad.c
> index 0bd1837..c5d029d 100644
> --- a/drivers/infiniband/hw/qib/qib_mad.c
> +++ b/drivers/infiniband/hw/qib/qib_mad.c
> @@ -1158,6 +1158,7 @@ static int pma_get_classportinfo(struct ib_pma_mad *pmp,
>  	struct ib_class_port_info *p =
>  		(struct ib_class_port_info *)pmp->data;
>  	struct qib_devdata *dd = dd_from_ibdev(ibdev);
> +	char *p_cap_mask2;
>  
>  	memset(pmp->data, 0, sizeof(pmp->data));
>  
> @@ -1172,11 +1173,12 @@ static int pma_get_classportinfo(struct ib_pma_mad *pmp,
>  	 * Set the most significant bit of CM2 to indicate support for
>  	 * congestion statistics
>  	 */
> -	p->reserved[0] = dd->psxmitwait_supported << 7;
> +	p_cap_mask2 = (char *)&p->cap_mask2_resp_time;
> +	p_cap_mask2[0] = dd->psxmitwait_supported << 7;
>  	/*
>  	 * Expected response time is 4.096 usec. * 2^18 == 1.073741824 sec.
>  	 */
> -	p->resp_time_value = 18;
> +	p_cap_mask2[3] = 18;

Does this get the endianess right?

To me it would be cleaner to use a temp u32 set the values and then byteswap
into the MAD.

Ira

>  
>  	return reply((struct ib_smp *) pmp);
>  }
> diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
> index 0bd3cb2..d12b602 100644
> --- a/drivers/infiniband/ulp/srpt/ib_srpt.c
> +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
> @@ -249,12 +249,15 @@ static void srpt_set_ioc(u8 *c_list, u32 slot, u8 value)
>  static void srpt_get_class_port_info(struct ib_dm_mad *mad)
>  {
>  	struct ib_class_port_info *cif;
> +	char *p_cap_mask2;
>  
>  	cif = (struct ib_class_port_info *)mad->data;
>  	memset(cif, 0, sizeof(*cif));
>  	cif->base_version = 1;
>  	cif->class_version = 1;
> -	cif->resp_time_value = 20;
> +
> +	p_cap_mask2 = (char *)&cif->cap_mask2_resp_time;
> +	p_cap_mask2[3] = 20;
>  
>  	mad->mad_hdr.status = 0;
>  }
> diff --git a/include/rdma/ib_mad.h b/include/rdma/ib_mad.h
> index 37dd534c..2aaf1cb 100644
> --- a/include/rdma/ib_mad.h
> +++ b/include/rdma/ib_mad.h
> @@ -243,8 +243,8 @@ struct ib_class_port_info {
>  	u8			base_version;
>  	u8			class_version;
>  	__be16			capability_mask;
> -	u8			reserved[3];
> -	u8			resp_time_value;
> +	  /* 27 bits for cap_mask2, 5 bits for resp_time */
> +	__be32			cap_mask2_resp_time;
>  	u8			redirect_gid[16];
>  	__be32			redirect_tcslfl;
>  	__be16			redirect_lid;
> -- 
> 1.7.11.3
> 
> --
> 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:[~2016-05-12 23:17 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-19 12:51 [PATCH for-next 0/4] Support SendOnlyFullMember join Erez Shitrit
     [not found] ` <1461070287-13469-1-git-send-email-erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-04-19 12:51   ` [PATCH for-next 1/4] IB/core: Add support for get ClassPortInfo from the SA Erez Shitrit
     [not found]     ` <1461070287-13469-2-git-send-email-erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-05-12 23:17       ` Ira Weiny [this message]
2016-04-19 12:51   ` [PATCH for-next 2/4] IB/sa: Add support for sa get ClassPortInfo Erez Shitrit
     [not found]     ` <1461070287-13469-3-git-send-email-erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-04-20 12:09       ` Hal Rosenstock
     [not found]         ` <57177181.7090408-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2016-04-20 14:24           ` Erez Shitrit
2016-04-21 12:12           ` Erez Shitrit
2016-04-20 13:12       ` Or Gerlitz
     [not found]         ` <CAJ3xEMihe-54UExbp3ptqH5yqg7dc6a6tKcJw0gNytTECce5TQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-20 13:19           ` Erez Shitrit
2016-04-19 12:51   ` [PATCH for-next 3/4] IB/core: Support new type of join-state for multicast Erez Shitrit
     [not found]     ` <1461070287-13469-4-git-send-email-erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-04-26 20:16       ` Christoph Lameter
     [not found]         ` <alpine.DEB.2.20.1604261514590.2663-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-04-26 20:57           ` Hefty, Sean
     [not found]             ` <1828884A29C6694DAF28B7E6B8A82373AB045BD0-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2016-04-27  6:42               ` Leon Romanovsky
     [not found]                 ` <20160427064239.GO7974-2ukJVAZIZ/Y@public.gmane.org>
2016-04-29  2:34                   ` Doug Ledford
     [not found]                     ` <5722C839.2070704-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-04-29 15:50                       ` Hefty, Sean
     [not found]                         ` <1828884A29C6694DAF28B7E6B8A82373AB0475AC-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2016-04-29 16:10                           ` Doug Ledford
2016-04-29 16:27                       ` Hal Rosenstock
     [not found]                         ` <c99ef08a-77d8-1524-042a-0f269a52028d-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2016-04-29 17:12                           ` Jason Gunthorpe
     [not found]                             ` <20160429171246.GA4893-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-04-29 17:58                               ` Hal Rosenstock
     [not found]                                 ` <c1bc7c93-53c9-8b71-16eb-2bb92df93b76-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2016-04-30  1:37                                   ` Christoph Lameter
2016-05-02  7:26               ` Erez Shitrit
     [not found]                 ` <CAAk-MO8Zo2cHo8hiyYdbiSoRG2tgdxcSZPhCDWRUm6KrHCE8EQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-05-02 17:02                   ` Hefty, Sean
2016-04-19 12:51   ` [PATCH for-next 4/4] IB/ipoib: Support SendOnlyFullMember MCG for SendOnly join Erez Shitrit
     [not found]     ` <1461070287-13469-5-git-send-email-erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-04-20 12:11       ` Hal Rosenstock
     [not found]         ` <571771FB.90908-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2016-04-20 13:12           ` Erez Shitrit
     [not found]             ` <CAAk-MO_24actZ4FJqOjk0ztR=Z6toSfB-xuyFKeUvtZ8h0Xv3A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-20 13:29               ` Hal Rosenstock
     [not found]                 ` <5717843B.7020501-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2016-04-21 12:52                   ` Erez Shitrit
     [not found]                     ` <CAAk-MO9sie_pFH7wSDhhuEd2uApnz5dMF6E9u6Vgkyimc+1xWA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-21 13:24                       ` Hal Rosenstock
     [not found]                         ` <5718D497.70306-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2016-04-21 14:11                           ` Erez Shitrit
     [not found]                             ` <CAAk-MO9W-sdi4D+xT6C_TB7uWNMPV8++RRtyoLmJ23HFq11+iw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-21 17:32                               ` Jason Gunthorpe
     [not found]                                 ` <20160421173219.GA5814-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-05-02  8:00                                   ` Erez Shitrit

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=20160512231737.GA16168@rhel.sc.intel.com \
    --to=ira.weiny-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=ogerlitz-VPRAkNaXOzVWk0Htik3J/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 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.