RDMA/bnxt_re: Use helper function to set GUIDs
authorKamal Heib <kamalheib1@gmail.com>
Thu, 28 Oct 2021 09:43:59 +0000 (12:43 +0300)
committerJason Gunthorpe <jgg@nvidia.com>
Fri, 29 Oct 2021 16:24:09 +0000 (13:24 -0300)
Use addrconf_addr_eui48() helper function to set the GUIDs and remove the
driver specific version.

Link: https://lore.kernel.org/r/20211028094359.160407-1-kamalheib1@gmail.com
Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/bnxt_re/ib_verbs.c
drivers/infiniband/hw/bnxt_re/main.c
drivers/infiniband/hw/bnxt_re/qplib_res.c
drivers/infiniband/hw/bnxt_re/qplib_res.h

index 67ca794f64e897af02be865ed642086a3997c707..d5f347f8d088af7b8f29a7bc58f85ab89deca0a4 100644 (file)
@@ -41,6 +41,7 @@
 #include <linux/pci.h>
 #include <linux/netdevice.h>
 #include <linux/if_ether.h>
+#include <net/addrconf.h>
 
 #include <rdma/ib_verbs.h>
 #include <rdma/ib_user_verbs.h>
@@ -130,8 +131,8 @@ int bnxt_re_query_device(struct ib_device *ibdev,
        memcpy(&ib_attr->fw_ver, dev_attr->fw_ver,
               min(sizeof(dev_attr->fw_ver),
                   sizeof(ib_attr->fw_ver)));
-       bnxt_qplib_get_guid(rdev->netdev->dev_addr,
-                           (u8 *)&ib_attr->sys_image_guid);
+       addrconf_addr_eui48((u8 *)&ib_attr->sys_image_guid,
+                           rdev->netdev->dev_addr);
        ib_attr->max_mr_size = BNXT_RE_MAX_MR_SIZE;
        ib_attr->page_size_cap = BNXT_RE_PAGE_SIZE_SUPPORTED;
 
index 4fa3b14b26138765be93b57d80567e8a2934c389..83c0748e092d7ed970540bcd591b06052dbdf995 100644 (file)
@@ -730,7 +730,7 @@ static int bnxt_re_register_ib(struct bnxt_re_dev *rdev)
                strlen(BNXT_RE_DESC) + 5);
        ibdev->phys_port_cnt = 1;
 
-       bnxt_qplib_get_guid(rdev->netdev->dev_addr, (u8 *)&ibdev->node_guid);
+       addrconf_addr_eui48((u8 *)&ibdev->node_guid, rdev->netdev->dev_addr);
 
        ibdev->num_comp_vectors = rdev->num_msix - 1;
        ibdev->dev.parent = &rdev->en_dev->pdev->dev;
index a1d8a87dc678c38fed72c0f87bdcabc7b88309f9..bc1ba4b51ba4cbf25914a6d44bfbf6388412f794 100644 (file)
@@ -572,23 +572,6 @@ fail:
        return rc;
 }
 
-/* GUID */
-void bnxt_qplib_get_guid(const u8 *dev_addr, u8 *guid)
-{
-       u8 mac[ETH_ALEN];
-
-       /* MAC-48 to EUI-64 mapping */
-       memcpy(mac, dev_addr, ETH_ALEN);
-       guid[0] = mac[0] ^ 2;
-       guid[1] = mac[1];
-       guid[2] = mac[2];
-       guid[3] = 0xff;
-       guid[4] = 0xfe;
-       guid[5] = mac[3];
-       guid[6] = mac[4];
-       guid[7] = mac[5];
-}
-
 static void bnxt_qplib_free_sgid_tbl(struct bnxt_qplib_res *res,
                                     struct bnxt_qplib_sgid_tbl *sgid_tbl)
 {
index d2951a713cc824d7417241b9d37e46f4f0cc9ee8..e1411a2352a7867d8aa0f649f1927cd15c8d849f 100644 (file)
@@ -346,7 +346,6 @@ void bnxt_qplib_free_hwq(struct bnxt_qplib_res *res,
                         struct bnxt_qplib_hwq *hwq);
 int bnxt_qplib_alloc_init_hwq(struct bnxt_qplib_hwq *hwq,
                              struct bnxt_qplib_hwq_attr *hwq_attr);
-void bnxt_qplib_get_guid(const u8 *dev_addr, u8 *guid);
 int bnxt_qplib_alloc_pd(struct bnxt_qplib_pd_tbl *pd_tbl,
                        struct bnxt_qplib_pd *pd);
 int bnxt_qplib_dealloc_pd(struct bnxt_qplib_res *res,