* [PATCH] RDMA/efa: Fix node guid compiler warning
@ 2024-09-24 12:16 Michael Margolin
2024-09-24 18:00 ` Jason Gunthorpe
2024-10-06 13:19 ` Leon Romanovsky
0 siblings, 2 replies; 10+ messages in thread
From: Michael Margolin @ 2024-09-24 12:16 UTC (permalink / raw)
To: jgg, leon, linux-rdma
Cc: sleybo, matua, gal.pressman, kernel test robot, Yehuda Yitschak,
Yonatan Nachum
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;
if (result->admin_api_version < 1) {
ibdev_err_ratelimited(
diff --git a/drivers/infiniband/hw/efa/efa_com_cmd.h b/drivers/infiniband/hw/efa/efa_com_cmd.h
index 668d033f7477..56382cd1b7c4 100644
--- a/drivers/infiniband/hw/efa/efa_com_cmd.h
+++ b/drivers/infiniband/hw/efa/efa_com_cmd.h
@@ -112,7 +112,7 @@ struct efa_com_get_device_attr_result {
u8 addr[EFA_GID_SIZE];
u64 page_size_cap;
u64 max_mr_pages;
- u64 guid;
+ __be64 guid;
u32 mtu;
u32 fw_version;
u32 admin_api_version;
--
2.40.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH] RDMA/efa: Fix node guid compiler warning
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
2024-10-06 13:19 ` Leon Romanovsky
1 sibling, 1 reply; 10+ messages in thread
From: Jason Gunthorpe @ 2024-09-24 18:00 UTC (permalink / raw)
To: Michael Margolin
Cc: leon, linux-rdma, sleybo, matua, gal.pressman, kernel test robot,
Yehuda Yitschak, Yonatan Nachum
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
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] RDMA/efa: Fix node guid compiler warning
2024-09-24 18:00 ` Jason Gunthorpe
@ 2024-09-26 12:56 ` Margolin, Michael
2024-09-26 13:25 ` Margolin, Michael
0 siblings, 1 reply; 10+ messages in thread
From: Margolin, Michael @ 2024-09-26 12:56 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: leon, linux-rdma, sleybo, matua, gal.pressman, kernel test robot,
Yehuda Yitschak, Yonatan Nachum
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
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] RDMA/efa: Fix node guid compiler warning
2024-09-26 12:56 ` Margolin, Michael
@ 2024-09-26 13:25 ` Margolin, Michael
2024-09-26 14:54 ` Jason Gunthorpe
0 siblings, 1 reply; 10+ messages in thread
From: Margolin, Michael @ 2024-09-26 13:25 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: leon, linux-rdma, sleybo, matua, gal.pressman, kernel test robot,
Yehuda Yitschak, Yonatan Nachum
On 9/26/2024 3:56 PM, Margolin, Michael wrote:
> 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
>
Actually that's wrong, the device always sets guid in BE order so no
swap is needed in the driver in any case.
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] RDMA/efa: Fix node guid compiler warning
2024-09-26 13:25 ` Margolin, Michael
@ 2024-09-26 14:54 ` Jason Gunthorpe
2024-09-26 20:03 ` Margolin, Michael
0 siblings, 1 reply; 10+ messages in thread
From: Jason Gunthorpe @ 2024-09-26 14:54 UTC (permalink / raw)
To: Margolin, Michael
Cc: leon, linux-rdma, sleybo, matua, gal.pressman, kernel test robot,
Yehuda Yitschak, Yonatan Nachum
On Thu, Sep 26, 2024 at 04:25:19PM +0300, Margolin, Michael wrote:
> Actually that's wrong, the device always sets guid in BE order so no
> swap is needed in the driver in any case.
They you just mark it as _be64 in the struct and there is no reason
for the __force ?
Jason
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] RDMA/efa: Fix node guid compiler warning
2024-09-26 14:54 ` Jason Gunthorpe
@ 2024-09-26 20:03 ` Margolin, Michael
2024-09-26 22:34 ` Jason Gunthorpe
0 siblings, 1 reply; 10+ messages in thread
From: Margolin, Michael @ 2024-09-26 20:03 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: leon, linux-rdma, sleybo, matua, gal.pressman, kernel test robot,
Yehuda Yitschak, Yonatan Nachum
On 9/26/2024 5:54 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 Thu, Sep 26, 2024 at 04:25:19PM +0300, Margolin, Michael wrote:
>
>> Actually that's wrong, the device always sets guid in BE order so no
>> swap is needed in the driver in any case.
> They you just mark it as _be64 in the struct and there is no reason
> for the __force ?
>
> Jason
That's probably the most correct way but I prefer to avoid introducing
kernel specific types in a shared interface file.
Michael
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] RDMA/efa: Fix node guid compiler warning
2024-09-26 20:03 ` Margolin, Michael
@ 2024-09-26 22:34 ` Jason Gunthorpe
2024-10-02 12:30 ` Margolin, Michael
0 siblings, 1 reply; 10+ messages in thread
From: Jason Gunthorpe @ 2024-09-26 22:34 UTC (permalink / raw)
To: Margolin, Michael
Cc: leon, linux-rdma, sleybo, matua, gal.pressman, kernel test robot,
Yehuda Yitschak, Yonatan Nachum
On Thu, Sep 26, 2024 at 11:03:57PM +0300, Margolin, Michael wrote:
>
> On 9/26/2024 5:54 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 Thu, Sep 26, 2024 at 04:25:19PM +0300, Margolin, Michael wrote:
> >
> > > Actually that's wrong, the device always sets guid in BE order so no
> > > swap is needed in the driver in any case.
> > They you just mark it as _be64 in the struct and there is no reason
> > for the __force ?
> >
> > Jason
>
> That's probably the most correct way but I prefer to avoid introducing
> kernel specific types in a shared interface file.
?
what is a "shared interface file" ?
That doesn't sound like a linux thing
Jason
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] RDMA/efa: Fix node guid compiler warning
2024-09-26 22:34 ` Jason Gunthorpe
@ 2024-10-02 12:30 ` Margolin, Michael
2024-10-02 13:04 ` Jason Gunthorpe
0 siblings, 1 reply; 10+ messages in thread
From: Margolin, Michael @ 2024-10-02 12:30 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: leon, linux-rdma, sleybo, matua, gal.pressman, kernel test robot,
Yehuda Yitschak, Yonatan Nachum
On 9/27/2024 1:34 AM, 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 Thu, Sep 26, 2024 at 11:03:57PM +0300, Margolin, Michael wrote:
>> On 9/26/2024 5:54 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 Thu, Sep 26, 2024 at 04:25:19PM +0300, Margolin, Michael wrote:
>>>
>>>> Actually that's wrong, the device always sets guid in BE order so no
>>>> swap is needed in the driver in any case.
>>> They you just mark it as _be64 in the struct and there is no reason
>>> for the __force ?
>>>
>>> Jason
>> That's probably the most correct way but I prefer to avoid introducing
>> kernel specific types in a shared interface file.
> ?
>
> what is a "shared interface file" ?
>
> That doesn't sound like a linux thing
>
> Jason
Nothing particularly related to linux, just a common practice of having
the same interface on both sides (driver and device in this case).
Michael
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] RDMA/efa: Fix node guid compiler warning
2024-10-02 12:30 ` Margolin, Michael
@ 2024-10-02 13:04 ` Jason Gunthorpe
0 siblings, 0 replies; 10+ messages in thread
From: Jason Gunthorpe @ 2024-10-02 13:04 UTC (permalink / raw)
To: Margolin, Michael
Cc: leon, linux-rdma, sleybo, matua, gal.pressman, kernel test robot,
Yehuda Yitschak, Yonatan Nachum
On Wed, Oct 02, 2024 at 03:30:30PM +0300, Margolin, Michael wrote:
> > > > > Actually that's wrong, the device always sets guid in BE order so no
> > > > > swap is needed in the driver in any case.
> > > > They you just mark it as _be64 in the struct and there is no reason
> > > > for the __force ?
> > > >
> > > That's probably the most correct way but I prefer to avoid introducing
> > > kernel specific types in a shared interface file.
> > ?
> >
> > what is a "shared interface file" ?
> >
> > That doesn't sound like a linux thing
>
> Nothing particularly related to linux, just a common practice of having the
> same interface on both sides (driver and device in this case).
Well, you still have to use correct types in the linux headers and
work that out somehow
Jason
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] RDMA/efa: Fix node guid compiler warning
2024-09-24 12:16 [PATCH] RDMA/efa: Fix node guid compiler warning Michael Margolin
2024-09-24 18:00 ` Jason Gunthorpe
@ 2024-10-06 13:19 ` Leon Romanovsky
1 sibling, 0 replies; 10+ messages in thread
From: Leon Romanovsky @ 2024-10-06 13:19 UTC (permalink / raw)
To: Michael Margolin
Cc: jgg, linux-rdma, sleybo, matua, gal.pressman, kernel test robot,
Yehuda Yitschak, Yonatan Nachum
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;
Based on the discussion, I'm dropping this patch.
Thanks
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-10-06 13:19 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox