2b05705dc8
The control over the RDMA device's GID table is done by updating the device's Ethernet function addresses. Usually the first GID entry is determined by the MAC address, the second by the first IPv6 address and the third by the IPv4 address. Other entries can be added by adding more IP addresses. The opposite is the same, i.e. whenever an address is removed, the corresponding GID entry is removed. The process is done by the network and RDMA stacks. Whenever an address is added the ib_core driver is notified and calls the device driver add_gid function which in turn update the device. To support this in pvrdma device we need to hook into the create_bind and destroy_bind HW commands triggered by pvrdma driver in guest. Whenever a change is made to the pvrdma port's GID table a special QMP message is sent to be processed by libvirt to update the address of the backend Ethernet device. 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>
77 lines
1.8 KiB
C
77 lines
1.8 KiB
C
/*
|
|
* RDMA device: Definitions of Backend Device structures
|
|
*
|
|
* Copyright (C) 2018 Oracle
|
|
* Copyright (C) 2018 Red Hat Inc
|
|
*
|
|
* Authors:
|
|
* Yuval Shaia <yuval.shaia@oracle.com>
|
|
* Marcel Apfelbaum <marcel@redhat.com>
|
|
*
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
* See the COPYING file in the top-level directory.
|
|
*
|
|
*/
|
|
|
|
#ifndef RDMA_BACKEND_DEFS_H
|
|
#define RDMA_BACKEND_DEFS_H
|
|
|
|
#include "qemu/thread.h"
|
|
#include "chardev/char-fe.h"
|
|
#include <infiniband/verbs.h>
|
|
#include "contrib/rdmacm-mux/rdmacm-mux.h"
|
|
|
|
typedef struct RdmaDeviceResources RdmaDeviceResources;
|
|
|
|
typedef struct RdmaBackendThread {
|
|
QemuThread thread;
|
|
QemuMutex mutex;
|
|
bool run; /* Set by thread manager to let thread know it should exit */
|
|
bool is_running; /* Set by the thread to report its status */
|
|
} RdmaBackendThread;
|
|
|
|
typedef struct RecvMadList {
|
|
QemuMutex lock;
|
|
QList *list;
|
|
} RecvMadList;
|
|
|
|
typedef struct RdmaCmMux {
|
|
CharBackend *chr_be;
|
|
int can_receive;
|
|
} RdmaCmMux;
|
|
|
|
typedef struct RdmaBackendDev {
|
|
struct ibv_device_attr dev_attr;
|
|
RdmaBackendThread comp_thread;
|
|
PCIDevice *dev;
|
|
RdmaDeviceResources *rdma_dev_res;
|
|
struct ibv_device *ib_dev;
|
|
struct ibv_context *context;
|
|
struct ibv_comp_channel *channel;
|
|
uint8_t port_num;
|
|
RecvMadList recv_mads_list;
|
|
RdmaCmMux rdmacm_mux;
|
|
} RdmaBackendDev;
|
|
|
|
typedef struct RdmaBackendPD {
|
|
struct ibv_pd *ibpd;
|
|
} RdmaBackendPD;
|
|
|
|
typedef struct RdmaBackendMR {
|
|
struct ibv_pd *ibpd;
|
|
struct ibv_mr *ibmr;
|
|
} RdmaBackendMR;
|
|
|
|
typedef struct RdmaBackendCQ {
|
|
RdmaBackendDev *backend_dev;
|
|
struct ibv_cq *ibcq;
|
|
} RdmaBackendCQ;
|
|
|
|
typedef struct RdmaBackendQP {
|
|
struct ibv_pd *ibpd;
|
|
struct ibv_qp *ibqp;
|
|
uint8_t sgid_idx;
|
|
} RdmaBackendQP;
|
|
|
|
#endif
|