0

我正在尝试使用RDMA Aware Programming User Manual附录 D 中描述的跨通道通信支持。不幸的是,我对某些函数参数的含义有些困惑。

我的问题

ibv_exp_post_send()和函数分别采用工作请求结构的ibv_exp_post_task()链表和工作请求结构的集合*。该结构中的 cq_count 和 wqe_count 是什么意思?

struct ibv_exp_send_wr {
  // ...
  union {
    // ...          
    struct {
      struct ibv_cq   *cq; /* Completion queue (CQ) that WAIT WR relates to */
      int32_t  cq_count;   /* Producer index (PI) of the CQ */
    } cqe_wait; /* Describes IBV_EXP_WR_CQE_WAIT WR */
    struct {
      struct ibv_qp   *qp; /* Queue pair (QP) that SEND_EN/RECV_EN WR relates to */
      int32_t  wqe_count; /* Producer index (PI) of the QP */
    } wqe_enable; /* Desribes IBV_EXP_WR_RECV_ENABLE and IBV_EXP_WR_SEND_ENABLE WR */
  } task;
  // ...
};

第一个工作请求/完成是否总是编号为 1,随后的工作请求/完成是线性增加的?还是有时会重置,例如在 ibv_exp_post_task() 调用之间或在处理某些请求后减少?ibv_exp_post_send 或 ibv_exp_post_task 之间的数字是否一致?

*从技术上讲,一个指向任务链表的指针,每个任务都包含一个工作请求的链表。

4

1 回答 1

2

据我所知,该cq_count字段的含义取决于可以在ibv_exp_send_wr.send_flags:中设置的标志IBV_EXP_SEND_WAIT_EN_LAST

如果该标志被清除,则cq_count确定要等待的完成的相对偏移量。偏移量相对于内部 per-CQ 字段,仅在设置标志时更新。

从 libmlx5 驱动程序中查看此代码:

case IBV_EXP_WR_CQE_WAIT:
{
        struct mlx5_cq *wait_cq = to_mcq(wr->task.cqe_wait.cq);
        uint32_t wait_index = 0;

        wait_index = wait_cq->wait_index +
                        wr->task.cqe_wait.cq_count;
        wait_cq->wait_count = max(wait_cq->wait_count,
                        wr->task.cqe_wait.cq_count);

        if (exp_send_flags & IBV_EXP_SEND_WAIT_EN_LAST) {
                wait_cq->wait_index += wait_cq->wait_count;
                wait_cq->wait_count = 0;
        }

        set_wait_en_seg(seg, wait_cq->cqn, wait_index);
        seg   += sizeof(struct mlx5_wqe_wait_en_seg);
        size += sizeof(struct mlx5_wqe_wait_en_seg) / 16;
}
break;

wqe_count行为类似,除了它也可以接受特殊值零,要求驱动程序启用所有以前发布的工作请求。

于 2016-11-14T09:20:53.563 回答