Skip to content

Commit c0be792

Browse files
bvanasschegregkh
authored andcommitted
IB/srp: Report receive errors correctly
commit cd4e385 upstream. The IB spec does not guarantee that the opcode is available in error completions. Hence do not rely on it. See also commit 948d1e8 ("IB/srp: Introduce srp_handle_qp_err()"). Signed-off-by: Bart Van Assche <[email protected]> Signed-off-by: Roland Dreier <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 71d7bd9 commit c0be792

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

drivers/infiniband/ulp/srp/ib_srp.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,14 +1300,13 @@ static void srp_handle_recv(struct srp_target_port *target, struct ib_wc *wc)
13001300
PFX "Recv failed with error code %d\n", res);
13011301
}
13021302

1303-
static void srp_handle_qp_err(enum ib_wc_status wc_status,
1304-
enum ib_wc_opcode wc_opcode,
1303+
static void srp_handle_qp_err(enum ib_wc_status wc_status, bool send_err,
13051304
struct srp_target_port *target)
13061305
{
13071306
if (target->connected && !target->qp_in_error) {
13081307
shost_printk(KERN_ERR, target->scsi_host,
13091308
PFX "failed %s status %d\n",
1310-
wc_opcode & IB_WC_RECV ? "receive" : "send",
1309+
send_err ? "send" : "receive",
13111310
wc_status);
13121311
}
13131312
target->qp_in_error = true;
@@ -1323,7 +1322,7 @@ static void srp_recv_completion(struct ib_cq *cq, void *target_ptr)
13231322
if (likely(wc.status == IB_WC_SUCCESS)) {
13241323
srp_handle_recv(target, &wc);
13251324
} else {
1326-
srp_handle_qp_err(wc.status, wc.opcode, target);
1325+
srp_handle_qp_err(wc.status, false, target);
13271326
}
13281327
}
13291328
}
@@ -1339,7 +1338,7 @@ static void srp_send_completion(struct ib_cq *cq, void *target_ptr)
13391338
iu = (struct srp_iu *) (uintptr_t) wc.wr_id;
13401339
list_add(&iu->list, &target->free_tx);
13411340
} else {
1342-
srp_handle_qp_err(wc.status, wc.opcode, target);
1341+
srp_handle_qp_err(wc.status, true, target);
13431342
}
13441343
}
13451344
}

0 commit comments

Comments
 (0)