Page MenuHomeFreeBSD

D42176.diff
No OneTemporary

D42176.diff

diff --git a/contrib/ofed/libmlx5/mlx5.h b/contrib/ofed/libmlx5/mlx5.h
--- a/contrib/ofed/libmlx5/mlx5.h
+++ b/contrib/ofed/libmlx5/mlx5.h
@@ -386,6 +386,7 @@
unsigned offset;
unsigned buf_size;
unsigned uuarn;
+ off_t uar_mmap_offset;
};
struct mlx5_mr {
diff --git a/contrib/ofed/libmlx5/mlx5.c b/contrib/ofed/libmlx5/mlx5.c
--- a/contrib/ofed/libmlx5/mlx5.c
+++ b/contrib/ofed/libmlx5/mlx5.c
@@ -647,8 +647,8 @@
struct mlx5dv_qp *qp_out)
{
struct mlx5_qp *mqp = to_mqp(qp_in);
+ uint64_t mask_out = 0;
- qp_out->comp_mask = 0;
qp_out->dbrec = mqp->db;
if (mqp->sq_buf_size)
@@ -663,13 +663,20 @@
qp_out->rq.wqe_cnt = mqp->rq.wqe_cnt;
qp_out->rq.stride = 1 << mqp->rq.wqe_shift;
- qp_out->bf.reg = mqp->bf->reg;
+ qp_out->bf.reg = mqp->bf->reg;
+
+ if (qp_out->comp_mask & MLX5DV_QP_MASK_UAR_MMAP_OFFSET) {
+ qp_out->uar_mmap_offset = mqp->bf->uar_mmap_offset;
+ mask_out |= MLX5DV_QP_MASK_UAR_MMAP_OFFSET;
+ }
if (mqp->bf->uuarn > 0)
qp_out->bf.size = mqp->bf->buf_size;
else
qp_out->bf.size = 0;
+ qp_out->comp_mask = mask_out;
+
return 0;
}
@@ -739,6 +746,15 @@
return ret;
}
+static off_t get_uar_mmap_offset(int idx, int page_size)
+{
+ off_t offset = 0;
+
+ set_command(MLX5_MMAP_GET_REGULAR_PAGES_CMD, &offset);
+ set_index(idx, &offset);
+ return offset * page_size;
+}
+
static void adjust_uar_info(struct mlx5_device *mdev,
struct mlx5_context *context,
struct mlx5_alloc_ucontext_resp resp)
@@ -869,11 +885,9 @@
num_sys_page_map = context->tot_uuars / (context->num_uars_per_page * MLX5_NUM_NON_FP_BFREGS_PER_UAR);
for (i = 0; i < num_sys_page_map; ++i) {
- offset = 0;
- set_command(MLX5_MMAP_GET_REGULAR_PAGES_CMD, &offset);
- set_index(i, &offset);
+ offset = get_uar_mmap_offset(i, page_size);
context->uar[i] = mmap(NULL, page_size, PROT_WRITE, MAP_SHARED,
- cmd_fd, page_size * offset);
+ cmd_fd, offset);
if (context->uar[i] == MAP_FAILED) {
context->uar[i] = NULL;
goto err_db_list_mutex;
@@ -893,6 +907,7 @@
if (bfi)
context->bfs[bfi].buf_size = context->bf_reg_size / 2;
context->bfs[bfi].uuarn = bfi;
+ context->bfs[bfi].uar_mmap_offset = get_uar_mmap_offset(i, page_size);
}
}
}
diff --git a/contrib/ofed/libmlx5/mlx5dv.h b/contrib/ofed/libmlx5/mlx5dv.h
--- a/contrib/ofed/libmlx5/mlx5dv.h
+++ b/contrib/ofed/libmlx5/mlx5dv.h
@@ -106,6 +106,10 @@
int mlx5dv_query_device(struct ibv_context *ctx_in,
struct mlx5dv_context *attrs_out);
+enum mlx5dv_qp_comp_mask {
+ MLX5DV_QP_MASK_UAR_MMAP_OFFSET = 1 << 0,
+};
+
struct mlx5dv_qp {
uint32_t *dbrec;
struct {
@@ -123,6 +127,7 @@
uint32_t size;
} bf;
uint64_t comp_mask;
+ off_t uar_mmap_offset;
};
struct mlx5dv_cq {

File Metadata

Mime Type
text/plain
Expires
Wed, Feb 5, 6:50 AM (20 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16469241
Default Alt Text
D42176.diff (2 KB)

Event Timeline