Skip to content

Commit 4a05c56

Browse files
committed
ionic: Reserve bytes in CQE format for future use
Reserve a few bytes from wqe_id in the CQE format for future use. Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com>
1 parent ed04764 commit 4a05c56

2 files changed

Lines changed: 32 additions & 26 deletions

File tree

providers/ionic/ionic_fw_types.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ union ionic_v1_pld {
7474
struct ionic_v1_cqe {
7575
union {
7676
struct {
77-
__u64 wqe_id;
77+
__le64 wqe_idx;
7878
__be32 src_qpn_op;
7979
__u8 src_mac[6];
8080
__be16 vlan_tag;
@@ -84,13 +84,18 @@ struct ionic_v1_cqe {
8484
__u8 rsvd[4];
8585
__be32 msg_msn;
8686
__u8 rsvd2[8];
87-
__u64 npg_wqe_id;
87+
__le64 npg_wqe_idx;
8888
} send;
8989
};
9090
__be32 status_length;
9191
__be32 qid_type_flags;
9292
};
9393

94+
/* bits for cqe wqe_idx */
95+
enum ionic_v1_cqe_wqe_idx_bits {
96+
IONIC_V1_CQE_WQE_IDX_MASK = 0xffff,
97+
};
98+
9499
/* bits for cqe recv */
95100
enum ionic_v1_cqe_src_qpn_bits {
96101
IONIC_V1_CQE_RECV_QPN_MASK = 0xffffff,
@@ -125,7 +130,7 @@ enum ionic_v1_cqe_qtf_bits {
125130

126131
/* v1 base wqe header */
127132
struct ionic_v1_base_hdr {
128-
__u64 wqe_id;
133+
__le64 wqe_idx;
129134
__u8 op;
130135
__u8 num_sge_key;
131136
__be16 flags;

providers/ionic/ionic_verbs.c

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)