From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dennis Dalessandro Subject: [PATCH for-next 04/27] IB/hfi1: Use host_link_state to read state when DC is shut down Date: Fri, 04 Aug 2017 13:52:32 -0700 Message-ID: <20170804205231.17853.80277.stgit@scvm10.sc.intel.com> References: <20170804204842.17853.14858.stgit@scvm10.sc.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20170804204842.17853.14858.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org> Sender: linux-rdma-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Bartlomiej Dudek , Jakub Byczkowski List-Id: linux-rdma@vger.kernel.org From: Bartlomiej Dudek 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 --- drivers/infiniband/hw/hfi1/hfi.h | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/drivers/infiniband/hw/hfi1/hfi.h b/drivers/infiniband/hw/hfi1/hfi.h index e66e8f9..728ed45 100644 --- a/drivers/infiniband/hw/hfi1/hfi.h +++ b/drivers/infiniband/hw/hfi1/hfi.h @@ -1298,6 +1298,13 @@ void hfi1_init_pportdata(struct pci_dev *pdev, struct hfi1_pportdata *ppd, 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 * as such. Return IB_PORTPHYSSTATE_TRAINING until the software -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html