Message ID | 1445964755-13371-7-git-send-email-matanb@mellanox.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
On Tue, Oct 27, 2015 at 6:52 PM, Matan Barak <matanb@mellanox.com> wrote: > 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(-) > > diff --git a/src/cq.c b/src/cq.c > index 7f40f12..1f2d572 100644 > --- a/src/cq.c > +++ b/src/cq.c > @@ -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; > } > diff --git a/src/mlx4.h b/src/mlx4.h > index 8e1935d..46a18d6 100644 > --- a/src/mlx4.h > +++ b/src/mlx4.h > @@ -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); > diff --git a/src/verbs.c b/src/verbs.c > index 843ca1e..62908c1 100644 > --- a/src/verbs.c > +++ b/src/verbs.c > @@ -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; > -- > 2.1.0 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html This should have libmlx4 prefix. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/src/cq.c b/src/cq.c index 7f40f12..1f2d572 100644 --- a/src/cq.c +++ b/src/cq.c @@ -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; } diff --git a/src/mlx4.h b/src/mlx4.h index 8e1935d..46a18d6 100644 --- a/src/mlx4.h +++ b/src/mlx4.h @@ -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); diff --git a/src/verbs.c b/src/verbs.c index 843ca1e..62908c1 100644 --- a/src/verbs.c +++ b/src/verbs.c @@ -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(-)