Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cd4e3854 authored by Bart Van Assche's avatar Bart Van Assche Committed by Roland Dreier
Browse files

IB/srp: Report receive errors correctly



The IB spec does not guarantee that the opcode is available in error
completions.  Hence do not rely on it.  See also commit 948d1e88
("IB/srp: Introduce srp_handle_qp_err()").

Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
Cc: <stable@vger.kernel.org> # v3.8
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent 99b6697a
Loading
Loading
Loading
Loading
+4 −5
Original line number Original line Diff line number Diff line
@@ -1449,14 +1449,13 @@ static void srp_tl_err_work(struct work_struct *work)
		srp_start_tl_fail_timers(target->rport);
		srp_start_tl_fail_timers(target->rport);
}
}


static void srp_handle_qp_err(enum ib_wc_status wc_status,
static void srp_handle_qp_err(enum ib_wc_status wc_status, bool send_err,
			      enum ib_wc_opcode wc_opcode,
			      struct srp_target_port *target)
			      struct srp_target_port *target)
{
{
	if (target->connected && !target->qp_in_error) {
	if (target->connected && !target->qp_in_error) {
		shost_printk(KERN_ERR, target->scsi_host,
		shost_printk(KERN_ERR, target->scsi_host,
			     PFX "failed %s status %d\n",
			     PFX "failed %s status %d\n",
			     wc_opcode & IB_WC_RECV ? "receive" : "send",
			     send_err ? "send" : "receive",
			     wc_status);
			     wc_status);
		queue_work(system_long_wq, &target->tl_err_work);
		queue_work(system_long_wq, &target->tl_err_work);
	}
	}
@@ -1473,7 +1472,7 @@ static void srp_recv_completion(struct ib_cq *cq, void *target_ptr)
		if (likely(wc.status == IB_WC_SUCCESS)) {
		if (likely(wc.status == IB_WC_SUCCESS)) {
			srp_handle_recv(target, &wc);
			srp_handle_recv(target, &wc);
		} else {
		} else {
			srp_handle_qp_err(wc.status, wc.opcode, target);
			srp_handle_qp_err(wc.status, false, target);
		}
		}
	}
	}
}
}
@@ -1489,7 +1488,7 @@ static void srp_send_completion(struct ib_cq *cq, void *target_ptr)
			iu = (struct srp_iu *) (uintptr_t) wc.wr_id;
			iu = (struct srp_iu *) (uintptr_t) wc.wr_id;
			list_add(&iu->list, &target->free_tx);
			list_add(&iu->list, &target->free_tx);
		} else {
		} else {
			srp_handle_qp_err(wc.status, wc.opcode, target);
			srp_handle_qp_err(wc.status, true, target);
		}
		}
	}
	}
}
}