@@ -703,6 +703,7 @@ static int ionic_flush_recv(struct ionic_qp *qp, struct ibv_wc *wc)
703703 struct ionic_rq_meta * meta ;
704704 struct ionic_v1_wqe * wqe ;
705705 struct ionic_ctx * ctx ;
706+ uint64_t wqe_idx ;
706707
707708 if (!qp -> rq .flush )
708709 return 0 ;
@@ -711,20 +712,19 @@ static int ionic_flush_recv(struct ionic_qp *qp, struct ibv_wc *wc)
711712 return 0 ;
712713
713714 wqe = ionic_queue_at_cons (& qp -> rq .queue );
715+ wqe_idx = le64toh (wqe -> base .wqe_idx );
714716 ctx = to_ionic_ctx (qp -> vqp .qp .context );
715717
716- /* wqe_id must be a valid queue index */
717- if (unlikely (wqe -> base .wqe_id >> qp -> rq .queue .depth_log2 )) {
718- verbs_err (& ctx -> vctx , "invalid id %#lx" ,
719- (unsigned long )wqe -> base .wqe_id );
718+ /* wqe_idx must be a valid queue index */
719+ if (unlikely (wqe_idx >> qp -> rq .queue .depth_log2 )) {
720+ verbs_err (& ctx -> vctx , "invalid id %#lx" , (unsigned long )wqe_idx );
720721 return - EIO ;
721722 }
722723
723- /* wqe_id must indicate a request that is outstanding */
724- meta = & qp -> rq .meta [wqe -> base . wqe_id ];
724+ /* wqe_idx must indicate a request that is outstanding */
725+ meta = & qp -> rq .meta [wqe_idx ];
725726 if (unlikely (meta -> next != IONIC_META_POSTED )) {
726- verbs_err (& ctx -> vctx , "wqe not posted %#lx" ,
727- (unsigned long )wqe -> base .wqe_id );
727+ verbs_err (& ctx -> vctx , "wqe not posted %#lx" , (unsigned long )wqe_idx );
728728 return - EIO ;
729729 }
730730
@@ -803,8 +803,8 @@ static int ionic_poll_recv(struct ionic_ctx *ctx, struct ionic_cq *cq,
803803{
804804 struct ionic_qp * qp = NULL ;
805805 struct ionic_rq_meta * meta ;
806+ uint16_t vlan_tag , wqe_idx ;
806807 uint32_t src_qpn , st_len ;
807- uint16_t vlan_tag ;
808808 uint8_t op ;
809809
810810 if (cqe_qp -> rq .flush )
@@ -814,7 +814,7 @@ static int ionic_poll_recv(struct ionic_ctx *ctx, struct ionic_cq *cq,
814814
815815 st_len = be32toh (cqe -> status_length );
816816
817- /* ignore wqe_id in case of flush error */
817+ /* ignore wqe_idx in case of flush error */
818818 if (ionic_v1_cqe_error (cqe ) && st_len == IONIC_STS_WQE_FLUSHED_ERR ) {
819819 cqe_qp -> rq .flush = true;
820820 cq -> flush = true;
@@ -831,19 +831,20 @@ static int ionic_poll_recv(struct ionic_ctx *ctx, struct ionic_cq *cq,
831831 return - EIO ;
832832 }
833833
834- /* wqe_id must be a valid queue index */
835- if (unlikely (cqe -> recv .wqe_id >> qp -> rq .queue .depth_log2 )) {
836- verbs_err (& ctx -> vctx , "invalid id %#lx" ,
837- (unsigned long )cqe -> recv .wqe_id );
834+ wqe_idx = le64toh (cqe -> recv .wqe_idx ) & IONIC_V1_CQE_WQE_IDX_MASK ;
835+
836+ /* wqe_idx must be a valid queue index */
837+ if (unlikely (wqe_idx >> qp -> rq .queue .depth_log2 )) {
838+ verbs_err (& ctx -> vctx , "invalid id %#lx" , (unsigned long )wqe_idx );
838839 return - EIO ;
839840 }
840841
841- /* wqe_id must indicate a request that is outstanding */
842- meta = & qp -> rq .meta [qp -> rq .meta_idx [cqe -> recv . wqe_id ]];
842+ /* wqe_idx must indicate a request that is outstanding */
843+ meta = & qp -> rq .meta [qp -> rq .meta_idx [wqe_idx ]];
843844 if (unlikely (meta -> next != IONIC_META_POSTED )) {
844845 verbs_err (& ctx -> vctx , "wqe is not posted for idx %lu meta_idx %u qpid %u rq.prod %u rq.cons %u cqid %u" ,
845- (unsigned long )cqe -> recv . wqe_id ,
846- qp -> rq .meta_idx [cqe -> recv . wqe_id ],
846+ (unsigned long )wqe_idx ,
847+ qp -> rq .meta_idx [wqe_idx ],
847848 qp -> qpid , qp -> rq .queue .prod ,
848849 qp -> rq .queue .cons , cq -> cqid );
849850 return - EIO ;
@@ -1086,7 +1087,7 @@ static int ionic_comp_npg(struct ionic_ctx *ctx,
10861087 struct ionic_v1_cqe * cqe )
10871088{
10881089 struct ionic_sq_meta * meta ;
1089- uint16_t cqe_idx ;
1090+ uint16_t wqe_idx ;
10901091 uint32_t st_len ;
10911092
10921093 if (qp -> sq .flush )
@@ -1107,8 +1108,8 @@ static int ionic_comp_npg(struct ionic_ctx *ctx,
11071108 return 0 ;
11081109 }
11091110
1110- cqe_idx = cqe -> send .npg_wqe_id & qp -> sq .queue .mask ;
1111- meta = & qp -> sq .meta [cqe_idx ];
1111+ wqe_idx = le64toh ( cqe -> send .npg_wqe_idx ) & qp -> sq .queue .mask ;
1112+ meta = & qp -> sq .meta [wqe_idx ];
11121113 meta -> local_comp = true;
11131114
11141115 if (ionic_v1_cqe_error (cqe )) {
@@ -2100,7 +2101,7 @@ static void ionic_v1_prep_base(struct ionic_qp *qp,
21002101 meta -> signal = false;
21012102 meta -> local_comp = false;
21022103
2103- wqe -> base .wqe_id = qp -> sq .queue .prod ;
2104+ wqe -> base .wqe_idx = htole64 ( qp -> sq .queue .prod ) ;
21042105 if (qp -> sq .color )
21052106 wqe -> base .flags |= htobe16 (IONIC_V1_FLAG_COLOR );
21062107
@@ -2708,7 +2709,7 @@ static int ionic_v1_prep_recv(struct ionic_qp *qp,
27082709
27092710 meta -> wrid = wr -> wr_id ;
27102711
2711- wqe -> base .wqe_id = qp -> rq .queue .prod ;
2712+ wqe -> base .wqe_idx = htole64 ( qp -> rq .queue .prod ) ;
27122713 wqe -> base .num_sge_key = wr -> num_sge ;
27132714
27142715 qp -> rq .meta_idx [qp -> rq .queue .prod ] = meta - qp -> rq .meta ;
0 commit comments