diff mbox series

[for-next] RDMA/siw: Use helper function to set sys_image_guid

Message ID 20211124102336.427637-1-kamalheib1@gmail.com (mailing list archive)
State Accepted
Delegated to: Jason Gunthorpe
Headers show
Series [for-next] RDMA/siw: Use helper function to set sys_image_guid | expand

Commit Message

Kamal Heib Nov. 24, 2021, 10:23 a.m. UTC
Use the addrconf_addr_eui48() helper function to set the sys_image_guid,
Also make sure the GUID is valid EUI-64 identifier.

Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
---
 drivers/infiniband/sw/siw/siw_verbs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Bernard Metzler Nov. 24, 2021, 11:03 a.m. UTC | #1
-----"Kamal Heib" <kamalheib1@gmail.com> wrote: -----

>To: linux-rdma@vger.kernel.org
>From: "Kamal Heib" <kamalheib1@gmail.com>
>Date: 11/24/2021 11:24AM
>Cc: "Bernard Metzler" <bmt@zurich.ibm.com>, "Jason Gunthorpe"
><jgg@ziepe.ca>, "Kamal Heib" <kamalheib1@gmail.com>
>Subject: [EXTERNAL] [PATCH for-next] RDMA/siw: Use helper function to
>set sys_image_guid
>
>Use the addrconf_addr_eui48() helper function to set the
>sys_image_guid,
>Also make sure the GUID is valid EUI-64 identifier.
>
>Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
>---
> drivers/infiniband/sw/siw/siw_verbs.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/infiniband/sw/siw/siw_verbs.c
>b/drivers/infiniband/sw/siw/siw_verbs.c
>index 1b36350601fa..d15a1f9c59f0 100644
>--- a/drivers/infiniband/sw/siw/siw_verbs.c
>+++ b/drivers/infiniband/sw/siw/siw_verbs.c
>@@ -8,6 +8,7 @@
> #include <linux/uaccess.h>
> #include <linux/vmalloc.h>
> #include <linux/xarray.h>
>+#include <net/addrconf.h>
> 
> #include <rdma/iw_cm.h>
> #include <rdma/ib_verbs.h>
>@@ -155,7 +156,8 @@ int siw_query_device(struct ib_device *base_dev,
>struct ib_device_attr *attr,
> 	attr->vendor_id = SIW_VENDOR_ID;
> 	attr->vendor_part_id = sdev->vendor_part_id;
> 
>-	memcpy(&attr->sys_image_guid, sdev->netdev->dev_addr, 6);
>+	addrconf_addr_eui48((u8 *)&attr->sys_image_guid,
>+			    sdev->netdev->dev_addr);
> 
> 	return 0;
> }
>-- 
>2.31.1
>
>

Thanks, Kamal!

Acked-by: Bernard Metzler <bmt@zurich.ibm.com>
Jason Gunthorpe Nov. 25, 2021, 5:37 p.m. UTC | #2
On Wed, Nov 24, 2021 at 12:23:36PM +0200, Kamal Heib wrote:
> Use the addrconf_addr_eui48() helper function to set the sys_image_guid,
> Also make sure the GUID is valid EUI-64 identifier.
> 
> Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> Acked-by: Bernard Metzler <bmt@zurich.ibm.com>
> ---
>  drivers/infiniband/sw/siw/siw_verbs.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Applied to for-next, thanks

Jason
diff mbox series

Patch

diff --git a/drivers/infiniband/sw/siw/siw_verbs.c b/drivers/infiniband/sw/siw/siw_verbs.c
index 1b36350601fa..d15a1f9c59f0 100644
--- a/drivers/infiniband/sw/siw/siw_verbs.c
+++ b/drivers/infiniband/sw/siw/siw_verbs.c
@@ -8,6 +8,7 @@ 
 #include <linux/uaccess.h>
 #include <linux/vmalloc.h>
 #include <linux/xarray.h>
+#include <net/addrconf.h>
 
 #include <rdma/iw_cm.h>
 #include <rdma/ib_verbs.h>
@@ -155,7 +156,8 @@  int siw_query_device(struct ib_device *base_dev, struct ib_device_attr *attr,
 	attr->vendor_id = SIW_VENDOR_ID;
 	attr->vendor_part_id = sdev->vendor_part_id;
 
-	memcpy(&attr->sys_image_guid, sdev->netdev->dev_addr, 6);
+	addrconf_addr_eui48((u8 *)&attr->sys_image_guid,
+			    sdev->netdev->dev_addr);
 
 	return 0;
 }