Skip to content

Commit

Permalink
Merge pull request #165 from jgunthorpe/sparse4
Browse files Browse the repository at this point in the history
More sparse work for more providers
  • Loading branch information
rleon authored Jul 31, 2017
2 parents a7d1dd7 + 748b819 commit d779dd9
Show file tree
Hide file tree
Showing 25 changed files with 253 additions and 233 deletions.
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -414,15 +414,15 @@ add_subdirectory(providers/cxgb3) # NO SPARSE
add_subdirectory(providers/cxgb4) # NO SPARSE
add_subdirectory(providers/hns) # NO SPARSE
add_subdirectory(providers/i40iw) # NO SPARSE
add_subdirectory(providers/mlx4) # NO SPARSE
add_subdirectory(providers/mlx4/man) # NO SPARSE
add_subdirectory(providers/mlx5) # NO SPARSE
add_subdirectory(providers/mlx5/man) # NO SPARSE
add_subdirectory(providers/mthca) # NO SPARSE
add_subdirectory(providers/mlx4)
add_subdirectory(providers/mlx4/man)
add_subdirectory(providers/mlx5)
add_subdirectory(providers/mlx5/man)
add_subdirectory(providers/mthca)
add_subdirectory(providers/nes) # NO SPARSE
add_subdirectory(providers/ocrdma)
add_subdirectory(providers/qedr)
add_subdirectory(providers/vmw_pvrdma) # NO SPARSE
add_subdirectory(providers/vmw_pvrdma)
endif()

add_subdirectory(providers/hfi1verbs)
Expand Down
4 changes: 2 additions & 2 deletions buildlib/fixup-include/rdma-vmw_pvrdma-abi.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ struct pvrdma_sq_wqe_hdr {
__u32 opcode; /* operation type */
__u32 send_flags; /* wr flags */
union {
__u32 imm_data;
__be32 imm_data;
__u32 invalidate_rkey;
} ex;
__u32 reserved;
Expand Down Expand Up @@ -273,7 +273,7 @@ struct pvrdma_cqe {
__u32 opcode;
__u32 status;
__u32 byte_len;
__u32 imm_data;
__be32 imm_data;
__u32 src_qp;
__u32 wc_flags;
__u32 vendor_err;
Expand Down
5 changes: 4 additions & 1 deletion libibverbs/man/ibv_create_cq_ex.3
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,12 @@ Below members and functions are used in order to poll the current completion. Th
.BI "uint32_t ibv_wc_read_byte_len(struct ibv_cq_ex " "*cq"); \c
Get the vendor error from the current completion.

.BI "uint32_t ibv_wc_read_imm_data(struct ibv_cq_ex " "*cq"); \c
.BI "__be32 ibv_wc_read_imm_data(struct ibv_cq_ex " "*cq"); \c
Get the immediate data field from the current completion.

.BI "uint32_t ibv_wc_read_invalidated_rkey(struct ibv_cq_ex " "*cq"); \c
Get the rkey invalided by the SEND_INVAL from the current completion.

.BI "uint32_t ibv_wc_read_qp_num(struct ibv_cq_ex " "*cq"); \c
Get the QP number field from the current completion.

Expand Down
7 changes: 6 additions & 1 deletion libibverbs/man/ibv_post_send.3
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ struct ibv_sge *sg_list; /* Pointer to the s/g array */
int num_sge; /* Size of the s/g array */
enum ibv_wr_opcode opcode; /* Operation type */
int send_flags; /* Flags of the WR properties */
uint32_t imm_data; /* Immediate data (in network byte order) */
union {
.in +8
__be32 imm_data; /* Immediate data (in network byte order) */
uint32_t invalidate_rkey; /* Remote rkey to invalidate */
.in -8
};
union {
.in +8
struct {
Expand Down
21 changes: 18 additions & 3 deletions libibverbs/verbs.h
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,13 @@ struct ibv_send_wr {
int num_sge;
enum ibv_wr_opcode opcode;
int send_flags;
__be32 imm_data;
/* When opcode is *_WITH_IMM: Immediate data in network byte order.
* When opcode is *_INV: Stores the rkey to invalidate
*/
union {
__be32 imm_data;
uint32_t invalidate_rkey;
};
union {
struct {
uint64_t remote_addr;
Expand Down Expand Up @@ -1093,7 +1099,7 @@ struct ibv_cq_ex {
enum ibv_wc_opcode (*read_opcode)(struct ibv_cq_ex *current);
uint32_t (*read_vendor_err)(struct ibv_cq_ex *current);
uint32_t (*read_byte_len)(struct ibv_cq_ex *current);
uint32_t (*read_imm_data)(struct ibv_cq_ex *current);
__be32 (*read_imm_data)(struct ibv_cq_ex *current);
uint32_t (*read_qp_num)(struct ibv_cq_ex *current);
uint32_t (*read_src_qp)(struct ibv_cq_ex *current);
int (*read_wc_flags)(struct ibv_cq_ex *current);
Expand Down Expand Up @@ -1141,11 +1147,20 @@ static inline uint32_t ibv_wc_read_byte_len(struct ibv_cq_ex *cq)
return cq->read_byte_len(cq);
}

static inline uint32_t ibv_wc_read_imm_data(struct ibv_cq_ex *cq)
static inline __be32 ibv_wc_read_imm_data(struct ibv_cq_ex *cq)
{
return cq->read_imm_data(cq);
}

static inline uint32_t ibv_wc_read_invalidated_rkey(struct ibv_cq_ex *cq)
{
#ifdef __CHECKER__
return (__attribute__((force)) uint32_t)cq->read_imm_data(cq);
#else
return cq->read_imm_data(cq);
#endif
}

static inline uint32_t ibv_wc_read_qp_num(struct ibv_cq_ex *cq)
{
return cq->read_qp_num(cq);
Expand Down
9 changes: 6 additions & 3 deletions providers/mlx4/cq.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ static inline int mlx4_parse_cqe(struct mlx4_cq *cq,
case MLX4_RECV_OPCODE_SEND_INVAL:
wc->opcode = IBV_WC_RECV;
wc->wc_flags |= IBV_WC_WITH_INV;
wc->imm_data = be32toh(cqe->immed_rss_invalid);
wc->invalidated_rkey = be32toh(cqe->immed_rss_invalid);
break;
case MLX4_RECV_OPCODE_SEND:
wc->opcode = IBV_WC_RECV;
Expand Down Expand Up @@ -550,13 +550,16 @@ static uint32_t mlx4_cq_read_wc_vendor_err(struct ibv_cq_ex *ibcq)
return ecqe->vendor_err;
}

static uint32_t mlx4_cq_read_wc_imm_data(struct ibv_cq_ex *ibcq)
static __be32 mlx4_cq_read_wc_imm_data(struct ibv_cq_ex *ibcq)
{
struct mlx4_cq *cq = to_mcq(ibv_cq_ex_to_cq(ibcq));

switch (mlx4dv_get_cqe_opcode(cq->cqe)) {
case MLX4_RECV_OPCODE_SEND_INVAL:
return be32toh(cq->cqe->immed_rss_invalid);
/* This is returning invalidate_rkey which is in host order, see
* ibv_wc_read_invalidated_rkey
*/
return (__force __be32)be32toh(cq->cqe->immed_rss_invalid);
default:
return cq->cqe->immed_rss_invalid;
}
Expand Down
7 changes: 4 additions & 3 deletions providers/mlx4/dbrec.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ static struct mlx4_db_page *__add_page(struct mlx4_context *context,
return page;
}

uint32_t *mlx4_alloc_db(struct mlx4_context *context, enum mlx4_db_type type)
__be32 *mlx4_alloc_db(struct mlx4_context *context, enum mlx4_db_type type)
{
struct mlx4_db_page *page;
uint32_t *db = NULL;
__be32 *db = NULL;
int i, j;

pthread_mutex_lock(&context->db_list_mutex);
Expand Down Expand Up @@ -116,7 +116,8 @@ uint32_t *mlx4_alloc_db(struct mlx4_context *context, enum mlx4_db_type type)
return db;
}

void mlx4_free_db(struct mlx4_context *context, enum mlx4_db_type type, uint32_t *db)
void mlx4_free_db(struct mlx4_context *context, enum mlx4_db_type type,
__be32 *db)
{
struct mlx4_db_page *page;
uintptr_t ps = to_mdev(context->ibv_ctx.device)->page_size;
Expand Down
17 changes: 9 additions & 8 deletions providers/mlx4/mlx4.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ struct mlx4_cq {
pthread_spinlock_t lock;
uint32_t cqn;
uint32_t cons_index;
uint32_t *set_ci_db;
uint32_t *arm_db;
__be32 *set_ci_db;
__be32 *arm_db;
int arm_sn;
int cqe_size;
struct mlx4_qp *cur_qp;
Expand All @@ -179,7 +179,7 @@ struct mlx4_srq {
int wqe_shift;
int head;
int tail;
uint32_t *db;
__be32 *db;
uint16_t counter;
uint8_t ext_srq;
};
Expand All @@ -202,12 +202,12 @@ struct mlx4_qp {
int max_inline_data;
int buf_size;

uint32_t doorbell_qpn;
uint32_t sq_signal_bits;
__be32 doorbell_qpn;
__be32 sq_signal_bits;
int sq_spare_wqes;
struct mlx4_wq sq;

uint32_t *db;
__be32 *db;
struct mlx4_wq rq;

uint8_t link_layer;
Expand Down Expand Up @@ -292,8 +292,9 @@ static inline int cleanup_on_fatal(int ret)
int mlx4_alloc_buf(struct mlx4_buf *buf, size_t size, int page_size);
void mlx4_free_buf(struct mlx4_buf *buf);

uint32_t *mlx4_alloc_db(struct mlx4_context *context, enum mlx4_db_type type);
void mlx4_free_db(struct mlx4_context *context, enum mlx4_db_type type, uint32_t *db);
__be32 *mlx4_alloc_db(struct mlx4_context *context, enum mlx4_db_type type);
void mlx4_free_db(struct mlx4_context *context, enum mlx4_db_type type,
__be32 *db);

int mlx4_query_device(struct ibv_context *context,
struct ibv_device_attr *attr);
Expand Down
84 changes: 42 additions & 42 deletions providers/mlx4/mlx4dv.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,30 +125,30 @@ enum mlx4_cqe_status {
};

struct mlx4_cqe {
uint32_t vlan_my_qpn;
uint32_t immed_rss_invalid;
uint32_t g_mlpath_rqpn;
__be32 vlan_my_qpn;
__be32 immed_rss_invalid;
__be32 g_mlpath_rqpn;
union {
struct {
uint16_t sl_vid;
uint16_t rlid;
__be16 sl_vid;
__be16 rlid;
};
uint32_t ts_47_16;
__be32 ts_47_16;
};
uint32_t status;
uint32_t byte_cnt;
uint16_t wqe_index;
uint16_t checksum;
__be32 status;
__be32 byte_cnt;
__be16 wqe_index;
__be16 checksum;
uint8_t reserved3;
uint8_t ts_15_8;
uint8_t ts_7_0;
uint8_t owner_sr_opcode;
};

struct mlx4dv_qp {
uint32_t *rdb;
__be32 *rdb;
uint32_t *sdb;
uint32_t doorbell_qpn;
__be32 doorbell_qpn;
struct {
uint32_t wqe_cnt;
int wqe_shift;
Expand All @@ -173,8 +173,8 @@ struct mlx4dv_cq {
} buf;
uint32_t cqe_cnt;
uint32_t cqn;
uint32_t *set_ci_db;
uint32_t *arm_db;
__be32 *set_ci_db;
__be32 *arm_db;
int arm_sn;
int cqe_size;
uint64_t comp_mask;
Expand All @@ -187,7 +187,7 @@ struct mlx4dv_srq {
int wqe_shift;
int head;
int tail;
uint32_t *db;
__be32 *db;
uint64_t comp_mask;
};

Expand Down Expand Up @@ -284,28 +284,28 @@ enum {

struct mlx4_wqe_local_inval_seg {
uint64_t reserved1;
uint32_t mem_key;
__be32 mem_key;
uint32_t reserved2;
uint64_t reserved3[2];
};

struct mlx4_wqe_bind_seg {
uint32_t flags1;
uint32_t flags2;
uint32_t new_rkey;
uint32_t lkey;
uint64_t addr;
uint64_t length;
__be32 flags1;
__be32 flags2;
__be32 new_rkey;
__be32 lkey;
__be64 addr;
__be64 length;
};

struct mlx4_wqe_ctrl_seg {
uint32_t owner_opcode;
__be32 owner_opcode;
union {
struct {
uint8_t reserved[3];
uint8_t fence_size;
};
uint32_t bf_qpn;
__be32 bf_qpn;
};
/*
* High 24 bits are SRC remote buffer; low 8 bits are flags:
Expand All @@ -316,61 +316,61 @@ struct mlx4_wqe_ctrl_seg {
* [1] SE (solicited event)
* [0] FL (force loopback)
*/
uint32_t srcrb_flags;
__be32 srcrb_flags;
/*
* imm is immediate data for send/RDMA write w/ immediate;
* also invalidation key for send with invalidate; input
* modifier for WQEs on CCQs.
*/
uint32_t imm;
__be32 imm;
};

struct mlx4_av {
uint32_t port_pd;
__be32 port_pd;
uint8_t reserved1;
uint8_t g_slid;
uint16_t dlid;
__be16 dlid;
uint8_t reserved2;
uint8_t gid_index;
uint8_t stat_rate;
uint8_t hop_limit;
uint32_t sl_tclass_flowlabel;
__be32 sl_tclass_flowlabel;
uint8_t dgid[16];
};

struct mlx4_wqe_datagram_seg {
struct mlx4_av av;
uint32_t dqpn;
uint32_t qkey;
uint16_t vlan;
__be32 dqpn;
__be32 qkey;
__be16 vlan;
uint8_t mac[6];
};

struct mlx4_wqe_data_seg {
uint32_t byte_count;
uint32_t lkey;
uint64_t addr;
__be32 byte_count;
__be32 lkey;
__be64 addr;
};

struct mlx4_wqe_inline_seg {
uint32_t byte_count;
__be32 byte_count;
};

struct mlx4_wqe_srq_next_seg {
uint16_t reserved1;
uint16_t next_wqe_index;
__be16 next_wqe_index;
uint32_t reserved2[3];
};

struct mlx4_wqe_raddr_seg {
uint64_t raddr;
uint32_t rkey;
uint32_t reserved;
__be64 raddr;
__be32 rkey;
__be32 reserved;
};

struct mlx4_wqe_atomic_seg {
uint64_t swap_add;
uint64_t compare;
__be64 swap_add;
__be64 compare;
};

/*
Expand Down
Loading

0 comments on commit d779dd9

Please sign in to comment.