Skip to content

Commit c2e40d5

Browse files
committed
libxscale: Add support for posting verbs
This patch adds support for post_send and post_recv routines. Signed-off-by: Tian Xin <[email protected]> Signed-off-by: Wei Honggang <[email protected]> Signed-off-by: Zhao Qianwei <[email protected]> Signed-off-by: Li Qiang <[email protected]> Signed-off-by: Yan Lei <[email protected]>
1 parent 8218c4d commit c2e40d5

File tree

3 files changed

+511
-40
lines changed

3 files changed

+511
-40
lines changed

providers/xscale/cq.c

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,6 @@ static void *get_sw_cqe(struct xsc_cq *cq, int n)
112112
return NULL;
113113
}
114114

115-
void *xsc_get_send_wqe(struct xsc_qp *qp, int n)
116-
{
117-
return qp->sq_start + (n << qp->sq.wqe_shift);
118-
}
119-
120115
static void update_cons_index(struct xsc_cq *cq)
121116
{
122117
struct xsc_context *ctx =
@@ -520,38 +515,11 @@ int xsc_free_cq_buf(struct xsc_context *ctx, struct xsc_buf *buf)
520515
return xsc_free_actual_buf(ctx, buf);
521516
}
522517

523-
static int is_equal_rsn(struct xsc_cqe64 *cqe64, uint32_t rsn)
524-
{
525-
return rsn == (be32toh(cqe64->sop_drop_qpn) & 0xffffff);
526-
}
527-
528-
static inline int is_equal_uidx(struct xsc_cqe64 *cqe64, uint32_t uidx)
529-
{
530-
return uidx == (be32toh(cqe64->srqn_uidx) & 0xffffff);
531-
}
532-
533-
static inline int free_res_cqe(struct xsc_cqe64 *cqe64, uint32_t rsn,
534-
int cqe_version)
535-
{
536-
if (cqe_version) {
537-
if (is_equal_uidx(cqe64, rsn))
538-
return 1;
539-
} else {
540-
if (is_equal_rsn(cqe64, rsn))
541-
return 1;
542-
}
543-
544-
return 0;
545-
}
546-
547-
void __xsc_cq_clean(struct xsc_cq *cq, u32 rsn)
518+
void __xsc_cq_clean(struct xsc_cq *cq, u32 qpn)
548519
{
549520
u32 prod_index;
550521
int nfreed = 0;
551-
struct xsc_cqe64 *cqe64, *dest64;
552522
void *cqe, *dest;
553-
u8 owner_bit;
554-
int cqe_version;
555523

556524
if (!cq || cq->flags & XSC_CQ_FLAGS_DV_OWNED)
557525
return;
@@ -573,21 +541,20 @@ void __xsc_cq_clean(struct xsc_cq *cq, u32 rsn)
573541
* Now sweep backwards through the CQ, removing CQ entries
574542
* that match our QP by copying older entries on top of them.
575543
*/
576-
cqe_version = (to_xctx(cq->verbs_cq.cq_ex.context))->cqe_version;
577544
while ((int)(--prod_index) - (int)cq->cons_index >= 0) {
545+
u16 qp_id_combined;
546+
u32 qp_id;
547+
578548
cqe = get_cqe(cq, prod_index & (cq->verbs_cq.cq_ex.cqe - 1));
579-
cqe64 = (cq->cqe_sz == 64) ? cqe : cqe + 64;
580-
if (free_res_cqe(cqe64, rsn, cqe_version)) {
549+
qp_id_combined = __le16_to_cpu(*(u16 *)((void *)cqe + 1));
550+
qp_id = qp_id_combined & 0x7fff;
551+
if (qpn == qp_id) {
581552
++nfreed;
582553
} else if (nfreed) {
583554
dest = get_cqe(cq,
584555
(prod_index + nfreed) &
585556
(cq->verbs_cq.cq_ex.cqe - 1));
586-
dest64 = (cq->cqe_sz == 64) ? dest : dest + 64;
587-
owner_bit = dest64->op_own & XSC_CQE_OWNER_MASK;
588557
memcpy(dest, cqe, cq->cqe_sz);
589-
dest64->op_own = owner_bit |
590-
(dest64->op_own & ~XSC_CQE_OWNER_MASK);
591558
}
592559
}
593560

0 commit comments

Comments
 (0)