linux-user: rename gettid() to sys_gettid() to avoid clash with glibc
[qemu/ar7.git] / hw / rdma / rdma_utils.h
blob2d4224969158906594b8e8b1da465e811529ab13
1 /*
2 * RDMA device: Debug utilities
4 * Copyright (C) 2018 Oracle
5 * Copyright (C) 2018 Red Hat Inc
8 * Authors:
9 * Yuval Shaia <yuval.shaia@oracle.com>
10 * Marcel Apfelbaum <marcel@redhat.com>
12 * This work is licensed under the terms of the GNU GPL, version 2 or later.
13 * See the COPYING file in the top-level directory.
17 #ifndef RDMA_UTILS_H
18 #define RDMA_UTILS_H
20 #include "qemu/error-report.h"
21 #include "hw/pci/pci.h"
22 #include "sysemu/dma.h"
23 #include "stdio.h"
25 #define rdma_error_report(fmt, ...) \
26 error_report("%s: " fmt, "rdma", ## __VA_ARGS__)
27 #define rdma_warn_report(fmt, ...) \
28 warn_report("%s: " fmt, "rdma", ## __VA_ARGS__)
29 #define rdma_info_report(fmt, ...) \
30 info_report("%s: " fmt, "rdma", ## __VA_ARGS__)
32 typedef struct RdmaProtectedQList {
33 QemuMutex lock;
34 QList *list;
35 } RdmaProtectedQList;
37 typedef struct RdmaProtectedGSList {
38 QemuMutex lock;
39 GSList *list;
40 } RdmaProtectedGSList;
42 void *rdma_pci_dma_map(PCIDevice *dev, dma_addr_t addr, dma_addr_t plen);
43 void rdma_pci_dma_unmap(PCIDevice *dev, void *buffer, dma_addr_t len);
44 void rdma_protected_qlist_init(RdmaProtectedQList *list);
45 void rdma_protected_qlist_destroy(RdmaProtectedQList *list);
46 void rdma_protected_qlist_append_int64(RdmaProtectedQList *list, int64_t value);
47 int64_t rdma_protected_qlist_pop_int64(RdmaProtectedQList *list);
48 void rdma_protected_gslist_init(RdmaProtectedGSList *list);
49 void rdma_protected_gslist_destroy(RdmaProtectedGSList *list);
50 void rdma_protected_gslist_append_int32(RdmaProtectedGSList *list,
51 int32_t value);
52 void rdma_protected_gslist_remove_int32(RdmaProtectedGSList *list,
53 int32_t value);
55 static inline void addrconf_addr_eui48(uint8_t *eui, const char *addr)
57 memcpy(eui, addr, 3);
58 eui[3] = 0xFF;
59 eui[4] = 0xFE;
60 memcpy(eui + 5, addr + 3, 3);
61 eui[0] ^= 2;
64 #endif