From 64a296f579303322ebec9edae09cf87240b1ad78 Mon Sep 17 00:00:00 2001 From: Bartlomiej Dudek Date: Fri, 4 Aug 2017 13:52:32 -0700 Subject: [PATCH] IB/hfi1: Use host_link_state to read state when DC is shut down When DC is shut down (by e.g. disconnecting the cable), the driver should use host_link_state to get port's current physical state. This is due to the fact that physical state is read from DC's CSRs and when DC is shut down and state is changed, its registers are not impacted. Reviewed-by: Jakub Byczkowski Signed-off-by: Bartlomiej Dudek Signed-off-by: Dennis Dalessandro Signed-off-by: Doug Ledford --- drivers/infiniband/hw/hfi1/hfi.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/infiniband/hw/hfi1/hfi.h b/drivers/infiniband/hw/hfi1/hfi.h index e66e8f96ceab..728ed457e447 100644 --- a/drivers/infiniband/hw/hfi1/hfi.h +++ b/drivers/infiniband/hw/hfi1/hfi.h @@ -1297,6 +1297,13 @@ int hfi1_reset_device(int); /* return the driver's idea of the physical OPA port state */ static inline u32 driver_pstate(struct hfi1_pportdata *ppd) { + /* + * When DC is shut down and state is changed, its CSRs are not + * impacted, therefore host_link_state should be used to get + * current physical state. + */ + if (ppd->dd->dc_shutdown) + return driver_physical_state(ppd); /* * The driver does some processing from the time the physical * link state is at LINKUP to the time the SM can be notified -- 2.39.5