@@ -601,7 +601,8 @@ int mlx4_poll_cq_ex(struct ibv_cq *ibcq,
int npolled;
int err = CQ_OK;
unsigned int ne = attr->max_entries;
- uint64_t wc_flags = cq->wc_flags;
+ int (*poll_fn)(struct mlx4_cq *cq, struct mlx4_qp **cur_qp,
+ struct ibv_wc_ex **wc_ex) = cq->mlx4_poll_one;
if (attr->comp_mask)
return -EINVAL;
@@ -609,7 +610,7 @@ int mlx4_poll_cq_ex(struct ibv_cq *ibcq,
pthread_spin_lock(&cq->lock);
for (npolled = 0; npolled < ne; ++npolled) {
- err = _mlx4_poll_one_ex(cq, &qp, &wc, wc_flags);
+ err = poll_fn(cq, &qp, &wc);
if (err != CQ_OK)
break;
}
@@ -215,6 +215,8 @@ struct mlx4_pd {
struct mlx4_cq {
struct ibv_cq ibv_cq;
uint64_t wc_flags;
+ int (*mlx4_poll_one)(struct mlx4_cq *cq, struct mlx4_qp **cur_qp,
+ struct ibv_wc_ex **wc_ex);
struct mlx4_buf buf;
struct mlx4_buf resize_buf;
pthread_spinlock_t lock;
@@ -432,6 +434,9 @@ int mlx4_poll_cq(struct ibv_cq *cq, int ne, struct ibv_wc *wc);
int mlx4_poll_cq_ex(struct ibv_cq *ibcq,
struct ibv_wc_ex *wc,
struct ibv_poll_cq_ex_attr *attr);
+int mlx4_poll_one_ex(struct mlx4_cq *cq,
+ struct mlx4_qp **cur_qp,
+ struct ibv_wc_ex **pwc_ex);
int mlx4_arm_cq(struct ibv_cq *cq, int solicited);
void mlx4_cq_event(struct ibv_cq *cq);
void __mlx4_cq_clean(struct mlx4_cq *cq, uint32_t qpn, struct mlx4_srq *srq);
@@ -432,6 +432,7 @@ static struct ibv_cq *create_cq(struct ibv_context *context,
if (ret)
goto err_db;
+ cq->mlx4_poll_one = mlx4_poll_one_ex;
cq->creation_flags = cmd_e.ibv_cmd.flags;
cq->wc_flags = cq_attr->wc_flags;
cq->cqn = resp.cqn;
In order to opitimize the poll_one extended verb for different wc_flags, add support for poll_one_ex callback function. Signed-off-by: Matan Barak <matanb@mellanox.com> --- src/cq.c | 5 +++-- src/mlx4.h | 5 +++++ src/verbs.c | 1 + 3 files changed, 9 insertions(+), 2 deletions(-)