From: Easwar Hariharan Date: Tue, 21 Mar 2017 00:25:42 +0000 (-0700) Subject: IB/hfi1: Check for QSFP presence before attempting reads X-Git-Tag: v4.14-rc1~960^3~176^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fb897ad315643e5dc1092a115b3cec914b66df9d;p=platform%2Fkernel%2Flinux-rpi.git IB/hfi1: Check for QSFP presence before attempting reads Attempting to read the status of a QSFP cable creates noise in the logs and misses out on setting an appropriate Offline/Disabled Reason if the cable is not plugged in. Check for this prior to attempting the read and attendant retries. Fixes: 673b975f1fba ("IB/hfi1: Add QSFP sanity pre-check") Reviewed-by: Dennis Dalessandro Signed-off-by: Easwar Hariharan Signed-off-by: Dennis Dalessandro Signed-off-by: Doug Ledford --- diff --git a/drivers/infiniband/hw/hfi1/chip.c b/drivers/infiniband/hw/hfi1/chip.c index 8b8840a..f9d0d8c 100644 --- a/drivers/infiniband/hw/hfi1/chip.c +++ b/drivers/infiniband/hw/hfi1/chip.c @@ -9533,8 +9533,11 @@ static int test_qsfp_read(struct hfi1_pportdata *ppd) int ret; u8 status; - /* report success if not a QSFP */ - if (ppd->port_type != PORT_TYPE_QSFP) + /* + * Report success if not a QSFP or, if it is a QSFP, but the cable is + * not present + */ + if (ppd->port_type != PORT_TYPE_QSFP || !qsfp_mod_present(ppd)) return 0; /* read byte 2, the status byte */