mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
contrib/rdmacm-mux: Add implementation of RDMA User MAD multiplexer
RDMA MAD kernel module (ibcm) disallow more than one MAD-agent for a given MAD class. This does not go hand-by-hand with qemu pvrdma device's requirements where each VM is MAD agent. Fix it by adding implementation of RDMA MAD multiplexer service which on one hand register as a sole MAD agent with the kernel module and on the other hand gives service to more than one VM. Design Overview: Reviewed-by: Shamir Rabinovitch <shamir.rabinovitch@oracle.com> ---------------- A server process is registered to UMAD framework (for this to work the rdma_cm kernel module needs to be unloaded) and creates a unix socket to listen to incoming request from clients. A client process (such as QEMU) connects to this unix socket and registers with its own GID. TX: ---- When client needs to send rdma_cm MAD message it construct it the same way as without this multiplexer, i.e. creates a umad packet but this time it writes its content to the socket instead of calling umad_send(). The server, upon receiving such a message fetch local_comm_id from it so a context for this session can be maintain and relay the message to UMAD layer by calling umad_send(). RX: ---- The server creates a worker thread to process incoming rdma_cm MAD messages. When an incoming message arrived (umad_recv()) the server, depending on the message type (attr_id) looks for target client by either searching in gid->fd table or in local_comm_id->fd table. With the extracted fd the server relays to incoming message to the client. Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> Reviewed-by: Shamir Rabinovitch <shamir.rabinovitch@oracle.com> Signed-off-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
This commit is contained in:
committed by
Marcel Apfelbaum
parent
dee2e53c86
commit
a5d2f6f877
@@ -2412,6 +2412,7 @@ S: Maintained
|
|||||||
F: hw/rdma/*
|
F: hw/rdma/*
|
||||||
F: hw/rdma/vmw/*
|
F: hw/rdma/vmw/*
|
||||||
F: docs/pvrdma.txt
|
F: docs/pvrdma.txt
|
||||||
|
F: contrib/rdmacm-mux/*
|
||||||
|
|
||||||
Build and test automation
|
Build and test automation
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|||||||
@@ -362,6 +362,7 @@ dummy := $(call unnest-vars,, \
|
|||||||
elf2dmp-obj-y \
|
elf2dmp-obj-y \
|
||||||
ivshmem-client-obj-y \
|
ivshmem-client-obj-y \
|
||||||
ivshmem-server-obj-y \
|
ivshmem-server-obj-y \
|
||||||
|
rdmacm-mux-obj-y \
|
||||||
libvhost-user-obj-y \
|
libvhost-user-obj-y \
|
||||||
vhost-user-scsi-obj-y \
|
vhost-user-scsi-obj-y \
|
||||||
vhost-user-blk-obj-y \
|
vhost-user-blk-obj-y \
|
||||||
@@ -579,6 +580,8 @@ vhost-user-scsi$(EXESUF): $(vhost-user-scsi-obj-y) libvhost-user.a
|
|||||||
$(call LINK, $^)
|
$(call LINK, $^)
|
||||||
vhost-user-blk$(EXESUF): $(vhost-user-blk-obj-y) libvhost-user.a
|
vhost-user-blk$(EXESUF): $(vhost-user-blk-obj-y) libvhost-user.a
|
||||||
$(call LINK, $^)
|
$(call LINK, $^)
|
||||||
|
rdmacm-mux$(EXESUF): $(rdmacm-mux-obj-y) $(COMMON_LDADDS)
|
||||||
|
$(call LINK, $^)
|
||||||
|
|
||||||
module_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak
|
module_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak
|
||||||
$(call quiet-command,$(PYTHON) $< $@ \
|
$(call quiet-command,$(PYTHON) $< $@ \
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ vhost-user-scsi.o-cflags := $(LIBISCSI_CFLAGS)
|
|||||||
vhost-user-scsi.o-libs := $(LIBISCSI_LIBS)
|
vhost-user-scsi.o-libs := $(LIBISCSI_LIBS)
|
||||||
vhost-user-scsi-obj-y = contrib/vhost-user-scsi/
|
vhost-user-scsi-obj-y = contrib/vhost-user-scsi/
|
||||||
vhost-user-blk-obj-y = contrib/vhost-user-blk/
|
vhost-user-blk-obj-y = contrib/vhost-user-blk/
|
||||||
|
rdmacm-mux-obj-y = contrib/rdmacm-mux/
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
trace-events-subdirs =
|
trace-events-subdirs =
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
ifdef CONFIG_PVRDMA
|
||||||
|
CFLAGS += -libumad -Wno-format-truncation
|
||||||
|
rdmacm-mux-obj-y = main.o
|
||||||
|
endif
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* QEMU paravirtual RDMA - rdmacm-mux declarations
|
||||||
|
*
|
||||||
|
* 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 RDMACM_MUX_H
|
||||||
|
#define RDMACM_MUX_H
|
||||||
|
|
||||||
|
#include "linux/if.h"
|
||||||
|
#include "infiniband/verbs.h"
|
||||||
|
#include "infiniband/umad.h"
|
||||||
|
#include "rdma/rdma_user_cm.h"
|
||||||
|
|
||||||
|
typedef enum RdmaCmMuxMsgType {
|
||||||
|
RDMACM_MUX_MSG_TYPE_REQ = 0,
|
||||||
|
RDMACM_MUX_MSG_TYPE_RESP = 1,
|
||||||
|
} RdmaCmMuxMsgType;
|
||||||
|
|
||||||
|
typedef enum RdmaCmMuxOpCode {
|
||||||
|
RDMACM_MUX_OP_CODE_REG = 0,
|
||||||
|
RDMACM_MUX_OP_CODE_UNREG = 1,
|
||||||
|
RDMACM_MUX_OP_CODE_MAD = 2,
|
||||||
|
} RdmaCmMuxOpCode;
|
||||||
|
|
||||||
|
typedef enum RdmaCmMuxErrCode {
|
||||||
|
RDMACM_MUX_ERR_CODE_OK = 0,
|
||||||
|
RDMACM_MUX_ERR_CODE_EINVAL = 1,
|
||||||
|
RDMACM_MUX_ERR_CODE_EEXIST = 2,
|
||||||
|
RDMACM_MUX_ERR_CODE_EACCES = 3,
|
||||||
|
RDMACM_MUX_ERR_CODE_ENOTFOUND = 4,
|
||||||
|
} RdmaCmMuxErrCode;
|
||||||
|
|
||||||
|
typedef struct RdmaCmMuxHdr {
|
||||||
|
RdmaCmMuxMsgType msg_type;
|
||||||
|
RdmaCmMuxOpCode op_code;
|
||||||
|
union ibv_gid sgid;
|
||||||
|
RdmaCmMuxErrCode err_code;
|
||||||
|
} RdmaCmUHdr;
|
||||||
|
|
||||||
|
typedef struct RdmaCmUMad {
|
||||||
|
struct ib_user_mad hdr;
|
||||||
|
char mad[RDMA_MAX_PRIVATE_DATA];
|
||||||
|
} RdmaCmUMad;
|
||||||
|
|
||||||
|
typedef struct RdmaCmMuxMsg {
|
||||||
|
RdmaCmUHdr hdr;
|
||||||
|
int umad_len;
|
||||||
|
RdmaCmUMad umad;
|
||||||
|
} RdmaCmMuxMsg;
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user