Orabug:
24735772
The CQ full is calculated via last posted seq number (last_seq)
minus the last completion seq number (head_seq). Both last_seq
and head_seq are defined as u16. However, in the calculation to
verify that the CQ is not full, a wrong casting is performed.
This causes a false negative of CQ full in the wrapped case.
Signed-off-by: Wei Lin Guay <wei.lin.guay@oracle.com>
Reviewed-by: Knut Omang <knut.omang@oracle.com>
};
#define GREATER_16(a, b) ((s16)((s16)(a) - (s16)(b)) > 0)
+#define GREATER_32(a, b) ((s32)((s32)(a) - (s32)(b)) > 0)
#define LESS_OR_EQUAL_16(a, b) (!(GREATER_16((a), (b))))
#define PSIF_WC_STATUS_DUPL_COMPL_ERR (PSIF_WC_STATUS_FIELD_MAX - 1)
#define PSIF_WC_STATUS_GEN_TRANSL_COMPL_ERR (PSIF_WC_STATUS_FIELD_MAX - 2)
last_seq, last_gen_seq);
for (; (LESS_OR_EQUAL_16(last_seq, last_gen_seq)); ++last_seq) {
- if (unlikely(cq->entries < ((u32) (last_seq - sq_sw->head_seq)))) {
+ if (unlikely(GREATER_32((u16)(last_seq - sq_sw->head_seq), cq->entries))) {
sif_log(sdev, SIF_INFO, "cq (%d) is full! (len = %d, used = %d)",
- cq->index, cq->entries, last_seq - sq_sw->head_seq - 1);
+ cq->index, cq->entries, (u16)(last_seq - sq_sw->head_seq));
goto err_post_wa4074;
}