summaryrefslogtreecommitdiff
path: root/drivers/infiniband/hw/usnic
diff options
context:
space:
mode:
authorYuval Shaia <yuval.shaia@oracle.com>2017-03-14 17:01:57 +0300
committerDoug Ledford <dledford@redhat.com>2017-04-25 21:21:34 +0300
commit4d6f28591fe415fc5233e9148c66a1b81ad17425 (patch)
treecfcf61242386fa118ed79b39291d14b7eae7fbef /drivers/infiniband/hw/usnic
parenta7c81326ca3af41cdd5ab9a65d5d5880df66e84c (diff)
downloadlinux-4d6f28591fe415fc5233e9148c66a1b81ad17425.tar.xz
{net,IB}/{rxe,usnic}: Utilize generic mac to eui32 function
This logic seems to be duplicated in (at least) three separate files. Move it to one place so code can be re-use. Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Diffstat (limited to 'drivers/infiniband/hw/usnic')
-rw-r--r--drivers/infiniband/hw/usnic/usnic_common_util.h11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/infiniband/hw/usnic/usnic_common_util.h b/drivers/infiniband/hw/usnic/usnic_common_util.h
index d757b82b5008..ddd81294fa46 100644
--- a/drivers/infiniband/hw/usnic/usnic_common_util.h
+++ b/drivers/infiniband/hw/usnic/usnic_common_util.h
@@ -34,6 +34,8 @@
#ifndef USNIC_CMN_UTIL_H
#define USNIC_CMN_UTIL_H
+#include <net/addrconf.h>
+
static inline void
usnic_mac_ip_to_gid(const char *const mac, const __be32 inaddr, char *raw_gid)
{
@@ -41,14 +43,7 @@ usnic_mac_ip_to_gid(const char *const mac, const __be32 inaddr, char *raw_gid)
raw_gid[1] = 0x80;
memset(&raw_gid[2], 0, 2);
memcpy(&raw_gid[4], &inaddr, 4);
- raw_gid[8] = mac[0]^2;
- raw_gid[9] = mac[1];
- raw_gid[10] = mac[2];
- raw_gid[11] = 0xff;
- raw_gid[12] = 0xfe;
- raw_gid[13] = mac[3];
- raw_gid[14] = mac[4];
- raw_gid[15] = mac[5];
+ addrconf_addr_eui48(&raw_gid[8], mac);
}
#endif /* USNIC_COMMON_UTIL_H */