@@ -577,21 +577,14 @@ int ibv_cmd_create_srq_ex(struct ibv_context *context,
* If it is than all the others exist as well
*/
if (vext_field_avail(struct verbs_srq, srq_num, vsrq_sz)) {
- srq->comp_mask = IBV_SRQ_INIT_ATTR_TYPE;
srq->srq_type = (attr_ex->comp_mask & IBV_SRQ_INIT_ATTR_TYPE) ?
attr_ex->srq_type : IBV_SRQT_BASIC;
- if (srq->srq_type == IBV_SRQT_XRC) {
- srq->comp_mask |= VERBS_SRQ_NUM;
+ if (srq->srq_type == IBV_SRQT_XRC)
srq->srq_num = resp->srqn;
- }
- if (attr_ex->comp_mask & IBV_SRQ_INIT_ATTR_XRCD) {
- srq->comp_mask |= VERBS_SRQ_XRCD;
+ if (attr_ex->comp_mask & IBV_SRQ_INIT_ATTR_XRCD)
srq->xrcd = vxrcd;
- }
- if (attr_ex->comp_mask & IBV_SRQ_INIT_ATTR_CQ) {
- srq->comp_mask |= VERBS_SRQ_CQ;
+ if (attr_ex->comp_mask & IBV_SRQ_INIT_ATTR_CQ)
srq->cq = attr_ex->cq;
- }
}
attr_ex->attr.max_wr = resp->max_wr;
@@ -59,17 +59,8 @@ struct verbs_xrcd {
uint32_t handle;
};
-enum verbs_srq_mask {
- VERBS_SRQ_TYPE = 1 << 0,
- VERBS_SRQ_XRCD = 1 << 1,
- VERBS_SRQ_CQ = 1 << 2,
- VERBS_SRQ_NUM = 1 << 3,
- VERBS_SRQ_RESERVED = 1 << 4
-};
-
struct verbs_srq {
struct ibv_srq srq;
- uint32_t comp_mask;
enum ibv_srq_type srq_type;
struct verbs_xrcd *xrcd;
struct ibv_cq *cq;
@@ -633,16 +624,6 @@ int ibv_read_ibdev_sysfs_file(char *buf, size_t size,
__attribute__((format(printf, 4, 5)));
int ibv_get_fw_ver(char *value, size_t len, struct verbs_sysfs_dev *sysfs_dev);
-static inline int verbs_get_srq_num(struct ibv_srq *srq, uint32_t *srq_num)
-{
- struct verbs_srq *vsrq = container_of(srq, struct verbs_srq, srq);
- if (vsrq->comp_mask & VERBS_SRQ_NUM) {
- *srq_num = vsrq->srq_num;
- return 0;
- }
- return EOPNOTSUPP;
-}
-
static inline bool check_comp_mask(uint64_t input, uint64_t supported)
{
return (input & ~supported) == 0;
@@ -126,7 +126,7 @@ static const struct verbs_context_ops mlx4_ctx_ops = {
.destroy_flow = mlx4_destroy_flow,
.destroy_rwq_ind_table = mlx4_destroy_rwq_ind_table,
.destroy_wq = mlx4_destroy_wq,
- .get_srq_num = verbs_get_srq_num,
+ .get_srq_num = mlx4_get_srq_num,
.modify_cq = mlx4_modify_cq,
.modify_wq = mlx4_modify_wq,
.open_qp = mlx4_open_qp,
@@ -319,6 +319,7 @@ int mlx4_free_pd(struct ibv_pd *pd);
struct ibv_xrcd *mlx4_open_xrcd(struct ibv_context *context,
struct ibv_xrcd_init_attr *attr);
int mlx4_close_xrcd(struct ibv_xrcd *xrcd);
+int mlx4_get_srq_num(struct ibv_srq *srq, uint32_t *srq_num);
struct ibv_mr *mlx4_reg_mr(struct ibv_pd *pd, void *addr, size_t length,
uint64_t hca_va, int access);
@@ -274,6 +274,17 @@ int mlx4_close_xrcd(struct ibv_xrcd *ib_xrcd)
return 0;
}
+int mlx4_get_srq_num(struct ibv_srq *srq, uint32_t *srq_num)
+{
+ struct mlx4_srq *msrq =
+ container_of(srq, struct mlx4_srq, verbs_srq.srq);
+
+ if (!msrq->verbs_srq.xrcd)
+ return EOPNOTSUPP;
+ *srq_num = msrq->verbs_srq.srq_num;
+ return 0;
+}
+
struct ibv_mr *mlx4_reg_mr(struct ibv_pd *pd, void *addr, size_t length,
uint64_t hca_va, int access)
{