public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: "Margolin, Michael" <mrgolin@amazon.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: <leon@kernel.org>, <linux-rdma@vger.kernel.org>,
	<sleybo@amazon.com>, <matua@amazon.com>, <gal.pressman@linux.dev>,
	kernel test robot <lkp@intel.com>,
	Yehuda Yitschak <yehuday@amazon.com>,
	Yonatan Nachum <ynachum@amazon.com>
Subject: Re: [PATCH] RDMA/efa: Fix node guid compiler warning
Date: Thu, 26 Sep 2024 15:56:31 +0300	[thread overview]
Message-ID: <7aa4bf5b-17aa-474a-b6c5-c4b0600f30a3@amazon.com> (raw)
In-Reply-To: <20240924180030.GM9417@nvidia.com>

On 9/24/2024 9:00 PM, Jason Gunthorpe wrote:

> CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.
>
>
>
> On Tue, Sep 24, 2024 at 12:16:03PM +0000, Michael Margolin wrote:
>> The GUID is received in big-endian so align types accordingly to avoid
>> compiler warnings.
>>
>> Closes: https://lore.kernel.org/oe-kbuild-all/202409032113.bvyVfsNp-lkp@intel.com/
>>
>> Fixes: 04e36fd27a2a ("RDMA/efa: Add support for node guid")
>> Reported-by: kernel test robot <lkp@intel.com>
>> Reviewed-by: Yehuda Yitschak <yehuday@amazon.com>
>> Reviewed-by: Yonatan Nachum <ynachum@amazon.com>
>> Signed-off-by: Michael Margolin <mrgolin@amazon.com>
>> ---
>>   drivers/infiniband/hw/efa/efa_com_cmd.c | 2 +-
>>   drivers/infiniband/hw/efa/efa_com_cmd.h | 2 +-
>>   2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/infiniband/hw/efa/efa_com_cmd.c b/drivers/infiniband/hw/efa/efa_com_cmd.c
>> index 5a774925cdea..5754da4e6ff8 100644
>> --- a/drivers/infiniband/hw/efa/efa_com_cmd.c
>> +++ b/drivers/infiniband/hw/efa/efa_com_cmd.c
>> @@ -465,7 +465,7 @@ int efa_com_get_device_attr(struct efa_com_dev *edev,
>>        result->db_bar = resp.u.device_attr.db_bar;
>>        result->max_rdma_size = resp.u.device_attr.max_rdma_size;
>>        result->device_caps = resp.u.device_attr.device_caps;
>> -     result->guid = resp.u.device_attr.guid;
>> +     result->guid = (__force __be64)resp.u.device_attr.guid;
> That can't be right, use the proper conversion function, or the proper
> type..
>
> Jason
The current assumption in the driver is that data from the device 
arrives in a correct byte order for the CPU, while the guid field is in 
reversed order.

Would you suggest doing something like:

>-     result->guid = resp.u.device_attr.guid;
>+     result->guid = __cpu_to_be64(__swab64(resp.u.device_attr.guid));

Michael


  reply	other threads:[~2024-09-26 12:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-24 12:16 [PATCH] RDMA/efa: Fix node guid compiler warning Michael Margolin
2024-09-24 18:00 ` Jason Gunthorpe
2024-09-26 12:56   ` Margolin, Michael [this message]
2024-09-26 13:25     ` Margolin, Michael
2024-09-26 14:54       ` Jason Gunthorpe
2024-09-26 20:03         ` Margolin, Michael
2024-09-26 22:34           ` Jason Gunthorpe
2024-10-02 12:30             ` Margolin, Michael
2024-10-02 13:04               ` Jason Gunthorpe
2024-10-06 13:19 ` Leon Romanovsky

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=7aa4bf5b-17aa-474a-b6c5-c4b0600f30a3@amazon.com \
    --to=mrgolin@amazon.com \
    --cc=gal.pressman@linux.dev \
    --cc=jgg@nvidia.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=matua@amazon.com \
    --cc=sleybo@amazon.com \
    --cc=yehuday@amazon.com \
    --cc=ynachum@amazon.com \
    /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