From: Wei Hu <weh@microsoft.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: "dev@dpdk.org" <dev@dpdk.org>, Long Li <longli@microsoft.com>,
"stable@dpdk.org" <stable@dpdk.org>
Subject: RE: [PATCH 1/1] net/mana: enable 32 bit build for mana driver
Date: Tue, 12 Sep 2023 12:48:43 +0000 [thread overview]
Message-ID: <SI2P153MB04418DC53739DC56E72F51EABBF1A@SI2P153MB0441.APCP153.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20230909075154.038f6b35@hermes.local>
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Saturday, September 9, 2023 10:52 PM
> > diff --git a/drivers/net/mana/mana.c b/drivers/net/mana/mana.c index
> > 7630118d4f..a20ca1a988 100644
> > --- a/drivers/net/mana/mana.c
> > +++ b/drivers/net/mana/mana.c
> > @@ -1260,7 +1260,7 @@ mana_probe_port(struct ibv_device *ibdev,
> struct ibv_device_attr_ex *dev_attr,
> > /* Create a parent domain with the port number */
> > attr.pd = priv->ib_pd;
> > attr.comp_mask = IBV_PARENT_DOMAIN_INIT_ATTR_PD_CONTEXT;
> > - attr.pd_context = (void *)(uint64_t)port;
> > + attr.pd_context = (void *)(size_t)port;
>
> Since port is uint8_t, the better cast would be to uintptr_t which is always an
> unsigned value of same size as pointer.
>
> Also, not sure why using PRIxPTR is necessary; on all arch and platforms %p
> should work for printing a pointer and is more common usage.
Thanks Stephen. I will send out a v2 with port casting to uintptr_t.
Regarding the use of PRIxPTR, I have seen this in couple other drivers.
I think it is probably because the original variable is defined as uintptr_t,
which was typedef'ed to unsigned long. We probably want to differentiate
it from an actual pointer. And I was trying to stick to original code.
Wei
prev parent reply other threads:[~2023-09-12 12:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-09 12:18 Wei Hu
2023-09-09 14:51 ` Stephen Hemminger
2023-09-12 12:48 ` Wei Hu [this message]
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=SI2P153MB04418DC53739DC56E72F51EABBF1A@SI2P153MB0441.APCP153.PROD.OUTLOOK.COM \
--to=weh@microsoft.com \
--cc=dev@dpdk.org \
--cc=longli@microsoft.com \
--cc=stable@dpdk.org \
--cc=stephen@networkplumber.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;
as well as URLs for NNTP newsgroup(s).