[PATCH] IB/mthca: Simplify handling of completions with error

Mem-free HCAs never generate error CQEs that complete multiple WQEs,
so just skip the call to mthca_free_err_wqe() for them rather than
having logic to handle the mem-free case in mthca_free_err_wqe().

Signed-off-by: Roland Dreier <rolandd@cisco.com>

authored by

Roland Dreier and committed by
Roland Dreier
288bdeb4 87b81670

+9 -9
+8 -5
drivers/infiniband/hw/mthca/mthca_cq.c
··· 367 367 break; 368 368 } 369 369 370 + /* 371 + * Mem-free HCAs always generate one CQE per WQE, even in the 372 + * error case, so we don't have to check the doorbell count, etc. 373 + */ 374 + if (mthca_is_memfree(dev)) 375 + return 0; 376 + 370 377 err = mthca_free_err_wqe(dev, qp, is_send, wqe_index, &dbd, &new_wqe); 371 378 if (err) 372 379 return err; ··· 382 375 * If we're at the end of the WQE chain, or we've used up our 383 376 * doorbell count, free the CQE. Otherwise just update it for 384 377 * the next poll operation. 385 - * 386 - * This does not apply to mem-free HCAs: they don't use the 387 - * doorbell count field, and so we should always free the CQE. 388 378 */ 389 - if (mthca_is_memfree(dev) || 390 - !(new_wqe & cpu_to_be32(0x3f)) || (!cqe->db_cnt && dbd)) 379 + if (!(new_wqe & cpu_to_be32(0x3f)) || (!cqe->db_cnt && dbd)) 391 380 return 0; 392 381 393 382 cqe->db_cnt = cpu_to_be16(be16_to_cpu(cqe->db_cnt) - dbd);
+1 -4
drivers/infiniband/hw/mthca/mthca_qp.c
··· 2086 2086 else 2087 2087 next = get_recv_wqe(qp, index); 2088 2088 2089 - if (mthca_is_memfree(dev)) 2090 - *dbd = 1; 2091 - else 2092 - *dbd = !!(next->ee_nds & cpu_to_be32(MTHCA_NEXT_DBD)); 2089 + *dbd = !!(next->ee_nds & cpu_to_be32(MTHCA_NEXT_DBD)); 2093 2090 if (next->ee_nds & cpu_to_be32(0x3f)) 2094 2091 *new_wqe = (next->nda_op & cpu_to_be32(~0x3f)) | 2095 2092 (next->ee_nds & cpu_to_be32(0x3f));