From: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Don Hiatt <don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: linux-rdma <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH rdma-next v4 5/8] IB/core: Add functions to convert 32 bit lids to 16 bits
Date: Fri, 11 Aug 2017 14:03:55 +0300 [thread overview]
Message-ID: <20170811110355.GF24282@mtr-leonro.local> (raw)
In-Reply-To: <1502388268-20687-6-git-send-email-don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1462 bytes --]
On Thu, Aug 10, 2017 at 02:04:25PM -0400, Don Hiatt wrote:
> Add two helper functions (ib_lid_cpu16(), ib_lid_be16()) to
> convert 32 bit lids to 16 bits.
>
> Signed-off-by: Don Hiatt <don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Reviewed-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> ---
> include/rdma/ib_verbs.h | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
> index a7d6990..3875ea5d 100644
> --- a/include/rdma/ib_verbs.h
> +++ b/include/rdma/ib_verbs.h
> @@ -3710,4 +3710,16 @@ static inline enum rdma_ah_attr_type rdma_ah_find_type(struct ib_device *dev,
> else
> return RDMA_AH_ATTR_TYPE_IB;
> }
> +
> +/* Return lid in 16bit CPU encoding */
> +static inline u16 ib_lid_cpu16(u32 lid)
> +{
> + return (u16)lid;
> +}
> +
> +/* Return lid in 16bit BE encoding */
> +static inline u16 ib_lid_be16(u32 lid)
> +{
> + return cpu_to_be16((u16)lid);
> +}
Please add comments to these functions, with the description when and
why we are doing this conversion, and I think that it is worth to add
here WARN_ON_ONCE(lid && 0xFFFF0000) to catch possible bad flows.
> #endif /* IB_VERBS_H */
> --
> 1.8.3.1
>
> --
> 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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2017-08-11 11:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-10 18:04 [PATCH rdma-next v4 0/8] Add OPA extended LID support Don Hiatt
[not found] ` <1502388268-20687-1-git-send-email-don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-08-10 18:04 ` [PATCH rdma-next v4 1/8] IB/core: Convert ah_attr from OPA to IB when copying to user Don Hiatt
2017-08-10 18:04 ` [PATCH rdma-next v4 2/8] IB/srpt: Increase lid and sm_lid to 32 bits Don Hiatt
2017-08-10 18:04 ` [PATCH rdma-next v4 3/8] IB/IPoIB: Increase local_lid " Don Hiatt
2017-08-10 18:04 ` [PATCH rdma-next v4 4/8] IB/mad: Change slid in RMPP recv from 16 " Don Hiatt
2017-08-10 18:04 ` [PATCH rdma-next v4 5/8] IB/core: Add functions to convert 32 bit lids to 16 bits Don Hiatt
[not found] ` <1502388268-20687-6-git-send-email-don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-08-11 11:03 ` Leon Romanovsky [this message]
2017-08-10 18:04 ` [PATCH rdma-next v4 6/8] IB/core: Change port_attr.lid size from 16 to 32 bits Don Hiatt
2017-08-10 18:04 ` [PATCH rdma-next v4 7/8] IB/core: Change port_attr.sm_lid " Don Hiatt
2017-08-10 18:04 ` [PATCH rdma-next v4 8/8] IB/core: Change wc.slid " Don Hiatt
2017-08-11 15:39 ` [PATCH rdma-next v4 0/8] Add OPA extended LID support Doug Ledford
[not found] ` <1502465986.3080.40.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-08-11 15:48 ` Don Hiatt
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=20170811110355.GF24282@mtr-leonro.local \
--to=leon-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=don.hiatt-ral2JQCrhuEAvxtiuMwx3w@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 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.