Skip to contentSkip to conversation

RDMA/cxgb4: Use helper function to set GUIDs

PATCH Applied Kamal Heib 2 participants 2 messages Nov 18, 2021 – Nov 19, 2021

Subsystems (2)
lore
Share & tools
lore

Kamal Heib

author
#0 lore raw

PATCH 1/1 RDMA/cxgb4: Use helper function to set GUIDs

Use the addrconf_addr_eui48() helper function to set the GUIDs, Also make sure the GUIDs are valid EUI-64 identifiers.

---
 drivers/infiniband/hw/cxgb4/provider.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/infiniband/hw/cxgb4/provider.c +5 -3
index 0c8fd5a85fcb..89f36a3a9af0 100644
@@ -41,6 +41,7 @@
 #include <linux/ethtool.h>
 #include <linux/rtnetlink.h>
 #include <linux/inetdevice.h>
+#include <net/addrconf.h>
 #include <linux/io.h>
 
 #include <asm/irq.h>
@@ -264,7 +265,8 @@ static int c4iw_query_device(struct ib_device *ibdev, struct ib_device_attr *pro
 		return -EINVAL;
 
 	dev = to_c4iw_dev(ibdev);
-	memcpy(&props->sys_image_guid, dev->rdev.lldi.ports[0]->dev_addr, 6);
+	addrconf_addr_eui48((u8 *)&props->sys_image_guid,
+			    dev->rdev.lldi.ports[0]->dev_addr);
 	props->hw_ver = CHELSIO_CHIP_RELEASE(dev->rdev.lldi.adapter_type);
 	props->fw_ver = dev->rdev.lldi.fw_vers;
 	props->device_cap_flags = dev->device_cap_flags;
@@ -525,8 +527,8 @@ void c4iw_register_device(struct work_struct *work)
 	struct c4iw_dev *dev = ctx->dev;
 
 	pr_debug("c4iw_dev %p\n", dev);
-	memset(&dev->ibdev.node_guid, 0, sizeof(dev->ibdev.node_guid));
-	memcpy(&dev->ibdev.node_guid, dev->rdev.lldi.ports[0]->dev_addr, 6);
+	addrconf_addr_eui48((u8 *)&dev->ibdev.node_guid,
+			    dev->rdev.lldi.ports[0]->dev_addr);
 	dev->device_cap_flags = IB_DEVICE_LOCAL_DMA_LKEY | IB_DEVICE_MEM_WINDOW;
 	if (fastreg_support)
 		dev->device_cap_flags |= IB_DEVICE_MEM_MGT_EXTENSIONS;
Signature · 1 line
2.31.1
maintainer Applied
#1 lore raw
Quoted 7 lines · Kamal Heib

Use the addrconf_addr_eui48() helper function to set the GUIDs, Also make sure the GUIDs are valid EUI-64 identifiers.

---
 drivers/infiniband/hw/cxgb4/provider.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Applied to for-next, thanks

Jason