OSDN Git Service

IB/hfi1: Check for QSFP presence before attempting reads
authorEaswar Hariharan <easwar.hariharan@intel.com>
Tue, 21 Mar 2017 00:25:42 +0000 (17:25 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Mar 2018 08:17:47 +0000 (09:17 +0100)
[ Upstream commit fb897ad315643e5dc1092a115b3cec914b66df9d ]

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 <dennis.dalessandro@intel.com>
Signed-off-by: Easwar Hariharan <easwar.hariharan@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/hw/hfi1/chip.c

index 4682909..3be62ef 100644 (file)
@@ -9489,8 +9489,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 */