public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: "Chandramouli,
	Dasaratharaman"
	<dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Don Hiatt <don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	linux-rdma <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH v2 02/11] IB/core: Change port_attr.sm_lid from 16 to 32 bits
Date: Tue, 22 Nov 2016 14:24:11 -0700	[thread overview]
Message-ID: <20161122212411.GC6484@obsidianresearch.com> (raw)
In-Reply-To: <cb14f866-0e19-1631-745d-5c9d67aabfe8-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

On Tue, Nov 22, 2016 at 01:13:26PM -0800, Chandramouli, Dasaratharaman wrote:
> 
> 
> On 11/22/2016 12:57 PM, Jason Gunthorpe wrote:
> >On Tue, Nov 22, 2016 at 02:38:43PM -0500, Dasaratharaman Chandramouli wrote:
> >>+++ b/drivers/infiniband/core/sa_query.c
> >>@@ -958,7 +958,7 @@ static void update_sm_ah(struct work_struct *work)
> >> 		pr_err("Couldn't find index for default PKey\n");
> >>
> >> 	memset(&ah_attr, 0, sizeof ah_attr);
> >>-	ah_attr.dlid     = port_attr.sm_lid;
> >>+	ah_attr.dlid     = (u16)port_attr.sm_lid;
> >
> >Why are we dropping bits here?
> 
> Patch 3 increases ah_attr.dlid to 32 bits and the typecast is dropped.
> We added it in this patch just to avoid compiler warnings, if any.

It would be alot better to fix this series so adding typecasts and
then dropping them didn't happen so extensively. Just reodering some
patched would do the trick. That would make it alot less churny and
easy to read..

> >>-	sport->sm_lid = port_attr.sm_lid;
> >>+	sport->sm_lid = (u16)port_attr.sm_lid;
> >> 	sport->lid = port_attr.lid;
> >
> >And here..

> Patch 11 increases lid and sm_lid fields in struct srpt_port and the
> typecast is dropped.  We added it in this patch just to avoid
> compiler warnings, if any.

Eg if you do patch 11 first this hunk goes away.

I also don't really care for all the added u16 casts, the compiler
doesn't warn on implicit demotion without a higher warning level...

> >
> >>+#define OPA_TO_IB_UCAST_LID(x)	(((x) >= be16_to_cpu(IB_MULTICAST_LID_BASE)) \
> >>+				 ? 0 : x)
> >
> >static inline function please.
> Will change. Thanks.

All of them please.

And I think you should re-think how this is being used, the pattern
around OPA_TO_IB_UCAST_LID is copied too many times for my liking, and
isn't this UAPI compatability only?

Jason
--
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-11-22 21:24 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-22 19:38 [PATCH v2 00/11] IB/core: Add 32 bit LID support Dasaratharaman Chandramouli
     [not found] ` <1479843532-47496-1-git-send-email-dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-11-22 19:38   ` [PATCH v2 01/11] IB/core: Add rdma_cap_opa_ah to expose opa address handles Dasaratharaman Chandramouli
2016-11-22 19:38   ` [PATCH v2 02/11] IB/core: Change port_attr.sm_lid from 16 to 32 bits Dasaratharaman Chandramouli
     [not found]     ` <1479843532-47496-3-git-send-email-dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-11-22 20:57       ` Jason Gunthorpe
     [not found]         ` <20161122205717.GA6484-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-11-22 21:13           ` Chandramouli, Dasaratharaman
     [not found]             ` <cb14f866-0e19-1631-745d-5c9d67aabfe8-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-11-22 21:24               ` Jason Gunthorpe [this message]
     [not found]                 ` <20161122212411.GC6484-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-11-23  5:43                   ` Chandramouli, Dasaratharaman
2016-11-22 19:38   ` [PATCH v2 03/11] IB/core: Change ah_attr.dlid " Dasaratharaman Chandramouli
     [not found]     ` <1479843532-47496-4-git-send-email-dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-12-08 15:13       ` Leon Romanovsky
     [not found]         ` <20161208151356.GE9722-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2016-12-08 22:02           ` Chandramouli, Dasaratharaman
2016-12-08 21:12       ` Hefty, Sean
     [not found]         ` <1828884A29C6694DAF28B7E6B8A82373AB0BCAD7-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2016-12-08 22:01           ` Chandramouli, Dasaratharaman
     [not found]             ` <9400a611-e37a-3e1f-2233-5650b4856831-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-12-08 23:19               ` Hefty, Sean
2016-12-08 23:17           ` Jason Gunthorpe
     [not found]             ` <20161208231736.GA18314-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-12-08 23:21               ` Hefty, Sean
2016-11-22 19:38   ` [PATCH v2 04/11] IB/core: Change port_attr.lid size " Dasaratharaman Chandramouli
2016-11-22 19:38   ` [PATCH v2 05/11] IB/core: Change wc.slid " Dasaratharaman Chandramouli
2016-11-22 19:38   ` [PATCH v2 06/11] IB/mad: Ensure DR MADs are correctly specified when using OPA devices Dasaratharaman Chandramouli
     [not found]     ` <1479843532-47496-7-git-send-email-dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-11-23 14:21       ` Hal Rosenstock
     [not found]         ` <4a729fdc-9386-c0b0-a29e-11cbddf66058-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2016-11-23 18:29           ` Chandramouli, Dasaratharaman
2016-11-22 19:38   ` [PATCH v2 07/11] IB/mad: Change slid in RMPP recv from 16 to 32 bits Dasaratharaman Chandramouli
2016-11-22 19:38   ` [PATCH v2 08/11] IB/SA: Program extended LID in SM Address handle Dasaratharaman Chandramouli
2016-11-22 19:38   ` [PATCH v2 09/11] IB/IPoIB: Retrieve 32 bit LIDs from path records when running on OPA devices Dasaratharaman Chandramouli
2016-11-22 19:38   ` [PATCH v2 10/11] IB/IPoIB: Modify ipoib_get_net_dev_by_params to lookup gid table Dasaratharaman Chandramouli
     [not found]     ` <1479843532-47496-11-git-send-email-dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-11-22 21:20       ` Jason Gunthorpe
     [not found]         ` <20161122212057.GB6484-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-12-08 23:11           ` Chandramouli, Dasaratharaman
2016-11-22 19:38   ` [PATCH v2 11/11] IB/srpt: Increase lid and sm_lid to 32 bits Dasaratharaman Chandramouli

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=20161122212411.GC6484@obsidianresearch.com \
    --to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
    --cc=dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=ira.weiny-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox