aboutsummaryrefslogtreecommitdiff
path: root/contrib/rdmacm-mux/rdmacm-mux.h
blob: 942a802c47863d616fd9095ad857cacb873aa7ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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