aboutsummaryrefslogtreecommitdiff
path: root/hw/rdma/rdma_utils.h
diff options
context:
space:
mode:
authorYuval Shaia <yuval.shaia@oracle.com>2018-12-21 16:40:28 +0200
committerMarcel Apfelbaum <marcel.apfelbaum@gmail.com>2018-12-22 11:09:56 +0200
commit028c3f93d61d33f7335ebef475aa2ab1faa8b20a (patch)
tree64b6bc99951be9b4d4cdfb580e18e8ab5690b39d /hw/rdma/rdma_utils.h
parentd961ead16edc03b850f906451bb995fe1a6513f1 (diff)
hw/rdma: Initialize node_guid from vmxnet3 mac address
node_guid should be set once device is load. Make node_guid be GID format (32 bit) of PCI function 0 vmxnet3 device's MAC. A new function was added to do the conversion. So for example the MAC 56:b6:44:e9:62:dc will be converted to GID 54b6:44ff:fee9:62dc. Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> Reviewed-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com> Signed-off-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Diffstat (limited to 'hw/rdma/rdma_utils.h')
-rw-r--r--hw/rdma/rdma_utils.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/hw/rdma/rdma_utils.h b/hw/rdma/rdma_utils.h
index 062e2cd688..4490ea0b94 100644
--- a/hw/rdma/rdma_utils.h
+++ b/hw/rdma/rdma_utils.h
@@ -63,4 +63,13 @@ extern unsigned long pr_dbg_cnt;
void *rdma_pci_dma_map(PCIDevice *dev, dma_addr_t addr, dma_addr_t plen);
void rdma_pci_dma_unmap(PCIDevice *dev, void *buffer, dma_addr_t len);
+static inline void addrconf_addr_eui48(uint8_t *eui, const char *addr)
+{
+ memcpy(eui, addr, 3);
+ eui[3] = 0xFF;
+ eui[4] = 0xFE;
+ memcpy(eui + 5, addr + 3, 3);
+ eui[0] ^= 2;
+}
+
#endif