All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hal Rosenstock <hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
To: Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Cc: ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
	cl-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org,
	bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org,
	ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH V5 for-next 1/4] IB/core: Introduce capabilitymask2 field in ClassPortInfo mad
Date: Mon, 23 May 2016 07:33:34 -0400	[thread overview]
Message-ID: <ead67cbd-ca28-322b-0435-ab01c1f04be5@dev.mellanox.co.il> (raw)
In-Reply-To: <1463991263-13084-2-git-send-email-erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

On 5/23/2016 4:14 AM, 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 for capabilitymask2 (previously was the
> reserved field) and the resp_time field.
> 
> And it fixes up qib and srpt, use of the field repurposed to be used as
> capabilitymask2:
> 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   |  4 +--
>  drivers/infiniband/ulp/srpt/ib_srpt.c |  2 +-
>  include/rdma/ib_mad.h                 | 57 +++++++++++++++++++++++++++++++++--
>  3 files changed, 58 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/qib/qib_mad.c b/drivers/infiniband/hw/qib/qib_mad.c
> index 0bd1837..a872865 100644
> --- a/drivers/infiniband/hw/qib/qib_mad.c
> +++ b/drivers/infiniband/hw/qib/qib_mad.c
> @@ -1172,11 +1172,11 @@ 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;
> +	ib_set_cpi_capmask2(p, dd->psxmitwait_supported << 7);

Is this really equivalent to what it's replacing ?

Which CapabilityMask2 is being usurped for non standard use by qib (to
indicate proprietary/vendor CC counter support) ?

-- Hal

>  	/*
>  	 * Expected response time is 4.096 usec. * 2^18 == 1.073741824 sec.
>  	 */
> -	p->resp_time_value = 18;
> +	ib_set_cpi_resp_time(p, 18);
>  
>  	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 2843f1a..887ebad 100644
> --- a/drivers/infiniband/ulp/srpt/ib_srpt.c
> +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
> @@ -254,8 +254,8 @@ static void srpt_get_class_port_info(struct ib_dm_mad *mad)
>  	memset(cif, 0, sizeof(*cif));
>  	cif->base_version = 1;
>  	cif->class_version = 1;
> -	cif->resp_time_value = 20;
>  
> +	ib_set_cpi_resp_time(cif, 20);
>  	mad->mad_hdr.status = 0;
>  }
>  
> diff --git a/include/rdma/ib_mad.h b/include/rdma/ib_mad.h
> index 37dd534c..2c379b5 100644
> --- a/include/rdma/ib_mad.h
> +++ b/include/rdma/ib_mad.h
> @@ -239,12 +239,14 @@ struct ib_vendor_mad {
>  
>  #define IB_MGMT_CLASSPORTINFO_ATTR_ID	cpu_to_be16(0x0001)
>  
> +#define IB_CLASS_PORT_INFO_RESP_TIME_MASK 0x1F
> +
>  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;
> @@ -259,6 +261,57 @@ struct ib_class_port_info {
>  	__be32			trap_qkey;
>  };
>  
> +/**
> + * ib_get_cpi_resp_time - Returns the resp_time value from
> + * cap_mask2_resp_time in ib_class_port_info.
> + * @cpi: A struct ib_class_port_info mad.
> + */
> +static inline u8 ib_get_cpi_resp_time(struct ib_class_port_info *cpi)
> +{
> +	return (u8)(be32_to_cpu(cpi->cap_mask2_resp_time) &
> +		    IB_CLASS_PORT_INFO_RESP_TIME_MASK);
> +}
> +
> +/**
> + * ib_set_cpi_resptime - Sets the response time in an
> + * ib_class_port_info mad.
> + * @cpi: A struct ib_class_port_info.
> + * @rtime: The response time to set.
> + */
> +static inline void ib_set_cpi_resp_time(struct ib_class_port_info *cpi,
> +					u8 rtime)
> +{
> +	cpi->cap_mask2_resp_time =
> +		(cpi->cap_mask2_resp_time &
> +		 cpu_to_be32(~IB_CLASS_PORT_INFO_RESP_TIME_MASK)) |
> +		cpu_to_be32(rtime & IB_CLASS_PORT_INFO_RESP_TIME_MASK);
> +}
> +
> +/**
> + * ib_get_cpi_capmask2 - Returns the capmask2 value from
> + * cap_mask2_resp_time in ib_class_port_info.
> + * @cpi: A struct ib_class_port_info mad.
> + */
> +static inline u32 ib_get_cpi_capmask2(struct ib_class_port_info *cpi)
> +{
> +	return (be32_to_cpu(cpi->cap_mask2_resp_time) >> 5);
> +}
> +
> +/**
> + * ib_set_cpi_capmask2 - Sets the capmask2 in an
> + * ib_class_port_info mad.
> + * @cpi: A struct ib_class_port_info.
> + * @capmask2: The capmask2 to set.
> + */
> +static inline void ib_set_cpi_capmask2(struct ib_class_port_info *cpi,
> +				       u32 capmask2)
> +{
> +	cpi->cap_mask2_resp_time =
> +		(cpi->cap_mask2_resp_time &
> +		 cpu_to_be32(IB_CLASS_PORT_INFO_RESP_TIME_MASK)) |
> +		cpu_to_be32(capmask2 << 5);
> +}
> +
>  struct ib_mad_notice_attr {
>  	u8 generic_type;
>  	u8 prod_type_msb;
> 
--
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-23 11:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-23  8:14 [PATCH V5 for-next 0/4] Support SendOnlyFullMember join Erez Shitrit
     [not found] ` <1463991263-13084-1-git-send-email-erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-05-23  8:14   ` [PATCH V5 for-next 1/4] IB/core: Introduce capabilitymask2 field in ClassPortInfo mad Erez Shitrit
     [not found]     ` <1463991263-13084-2-git-send-email-erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-05-23 11:33       ` Hal Rosenstock [this message]
     [not found]         ` <ead67cbd-ca28-322b-0435-ab01c1f04be5-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2016-05-23 11:49           ` Erez Shitrit
     [not found]             ` <CAAk-MO-2JQpmb8xR4gqQQEfpEpQCgMbxgbOLXhLPW991FhvJWQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-05-23 15:26               ` Bart Van Assche
     [not found]                 ` <f576c725-b78f-6432-5991-bf82fd0d9a8c-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-05-23 16:46                   ` Hal Rosenstock
2016-05-24  7:03                   ` Erez Shitrit
     [not found]                     ` <CAAk-MO-M6heX7bXi53gbDe89AnUQQ0fA2d_uiKHPyF+S_G4qhA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-05-24 19:17                       ` Doug Ledford
2016-05-23  8:14   ` [PATCH V5 for-next 2/4] IB/SA Agent: Add support for SA agent get ClassPortInfo Erez Shitrit
2016-05-23  8:14   ` [PATCH V5 for-next 3/4] IB/core: Support new type of join-state for multicast Erez Shitrit
2016-05-23  8:14   ` [PATCH V5 for-next 4/4] IB/ipoib: Support SendOnlyFullMember MCG for SendOnly join 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=ead67cbd-ca28-322b-0435-ab01c1f04be5@dev.mellanox.co.il \
    --to=hal-ldsdmyg8hgv8yrgs2mwiifqbs+8scbdb@public.gmane.org \
    --cc=bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org \
    --cc=cl-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=ira.weiny-ral2JQCrhuEAvxtiuMwx3w@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.