Lines Matching refs:cqe
174 static inline struct mthca_cqe *cqe_sw(struct mthca_cqe *cqe)
176 return MTHCA_CQ_ENTRY_OWNER_HW & cqe->owner ? NULL : cqe;
181 return cqe_sw(get_cqe(cq, cq->cons_index & cq->ibcq.cqe));
184 static inline void set_cqe_hw(struct mthca_cqe *cqe)
186 cqe->owner = MTHCA_CQ_ENTRY_OWNER_HW;
191 __be32 *cqe = cqe_ptr;
193 (void) cqe; /* avoid warning if mthca_dbg compiled away... */
195 be32_to_cpu(cqe[0]), be32_to_cpu(cqe[1]), be32_to_cpu(cqe[2]),
196 be32_to_cpu(cqe[3]), be32_to_cpu(cqe[4]), be32_to_cpu(cqe[5]),
197 be32_to_cpu(cqe[6]), be32_to_cpu(cqe[7]));
264 static inline int is_recv_cqe(struct mthca_cqe *cqe)
266 if ((cqe->opcode & MTHCA_ERROR_CQE_OPCODE_MASK) ==
268 return !(cqe->opcode & 0x01);
270 return !(cqe->is_send & 0x80);
276 struct mthca_cqe *cqe;
290 cqe_sw(get_cqe(cq, prod_index & cq->ibcq.cqe));
292 if (prod_index == cq->cons_index + cq->ibcq.cqe)
304 cqe = get_cqe(cq, prod_index & cq->ibcq.cqe);
305 if (cqe->my_qpn == cpu_to_be32(qpn)) {
306 if (srq && is_recv_cqe(cqe))
307 mthca_free_srq_wqe(srq, be32_to_cpu(cqe->wqe));
310 memcpy(get_cqe(cq, (prod_index + nfreed) & cq->ibcq.cqe),
311 cqe, MTHCA_CQ_ENTRY_SIZE);
316 set_cqe_hw(get_cqe(cq, (cq->cons_index + i) & cq->ibcq.cqe));
336 cq->ibcq.cqe < cq->resize_buf->cqe) {
337 cq->cons_index &= cq->ibcq.cqe;
338 if (cqe_sw(get_cqe(cq, cq->ibcq.cqe)))
339 cq->cons_index -= cq->ibcq.cqe + 1;
342 for (i = cq->cons_index; cqe_sw(get_cqe(cq, i & cq->ibcq.cqe)); ++i)
344 i & cq->resize_buf->cqe),
345 get_cqe(cq, i & cq->ibcq.cqe), MTHCA_CQ_ENTRY_SIZE);
366 void mthca_free_cq_buf(struct mthca_dev *dev, struct mthca_cq_buf *buf, int cqe)
368 mthca_buf_free(dev, (cqe + 1) * MTHCA_CQ_ENTRY_SIZE, &buf->queue,
374 struct mthca_err_cqe *cqe,
380 if (cqe->syndrome == SYNDROME_LOCAL_QP_OP_ERR) {
383 be32_to_cpu(cqe->my_qpn), be32_to_cpu(cqe->wqe),
385 dump_cqe(dev, cqe);
392 switch (cqe->syndrome) {
452 entry->vendor_err = cqe->vendor_err;
468 if (!(new_wqe & cpu_to_be32(0x3f)) || (!cqe->db_cnt && dbd))
471 be16_add_cpu(&cqe->db_cnt, -dbd);
472 cqe->wqe = new_wqe;
473 cqe->syndrome = SYNDROME_WR_FLUSH_ERR;
485 struct mthca_cqe *cqe;
493 cqe = next_cqe_sw(cq);
494 if (!cqe)
505 cq->cqn, cq->cons_index, be32_to_cpu(cqe->my_qpn),
506 be32_to_cpu(cqe->wqe));
507 dump_cqe(dev, cqe);
510 is_error = (cqe->opcode & MTHCA_ERROR_CQE_OPCODE_MASK) ==
512 is_send = is_error ? cqe->opcode & 0x01 : cqe->is_send & 0x80;
514 if (!*cur_qp || be32_to_cpu(cqe->my_qpn) != (*cur_qp)->qpn) {
521 be32_to_cpu(cqe->my_qpn) &
525 be32_to_cpu(cqe->my_qpn) & 0xffffff);
535 wqe_index = ((be32_to_cpu(cqe->wqe) - (*cur_qp)->send_wqe_offset)
541 u32 wqe = be32_to_cpu(cqe->wqe);
549 wqe = be32_to_cpu(cqe->wqe);
572 (struct mthca_err_cqe *) cqe,
579 switch (cqe->opcode) {
596 entry->byte_len = be32_to_cpu(cqe->byte_cnt);
611 entry->byte_len = be32_to_cpu(cqe->byte_cnt);
612 switch (cqe->opcode & 0x1f) {
616 entry->ex.imm_data = cqe->imm_etype_pkey_eec;
622 entry->ex.imm_data = cqe->imm_etype_pkey_eec;
630 entry->slid = be16_to_cpu(cqe->rlid);
631 entry->sl = cqe->sl_ipok >> 4;
632 entry->src_qp = be32_to_cpu(cqe->rqpn) & 0xffffff;
633 entry->dlid_path_bits = cqe->g_mlpath & 0x7f;
634 entry->pkey_index = be32_to_cpu(cqe->imm_etype_pkey_eec) >> 16;
635 entry->wc_flags |= cqe->g_mlpath & 0x80 ? IB_WC_GRH : 0;
636 checksum = (be32_to_cpu(cqe->rqpn) >> 24) |
637 ((be32_to_cpu(cqe->my_ee) >> 16) & 0xff00);
638 entry->wc_flags |= (cqe->sl_ipok & 1 && checksum == 0xffff) ?
646 set_cqe_hw(cqe);
698 cq->cons_index &= cq->ibcq.cqe;
701 cq->cons_index & cq->resize_buf->cqe))) {
706 tcqe = cq->ibcq.cqe;
708 cq->ibcq.cqe = cq->resize_buf->cqe;
711 cq->resize_buf->cqe = tcqe;
776 cq->ibcq.cqe = nent - 1;
867 mthca_free_cq_buf(dev, &cq->buf, cq->ibcq.cqe);
941 mthca_free_cq_buf(dev, &cq->buf, cq->ibcq.cqe);