From patchwork Tue May 24 19:50:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dennis Dalessandro X-Patchwork-Id: 9134201 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ACD3460221 for ; Tue, 24 May 2016 19:50:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A24EA281E2 for ; Tue, 24 May 2016 19:50:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9727C2829D; Tue, 24 May 2016 19:50:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46789281E2 for ; Tue, 24 May 2016 19:50:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932379AbcEXTuz (ORCPT ); Tue, 24 May 2016 15:50:55 -0400 Received: from mga11.intel.com ([192.55.52.93]:15645 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932250AbcEXTuz (ORCPT ); Tue, 24 May 2016 15:50:55 -0400 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP; 24 May 2016 12:50:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,360,1459839600"; d="scan'208";a="109773249" Received: from scymds02.sc.intel.com ([10.82.195.37]) by fmsmga004.fm.intel.com with ESMTP; 24 May 2016 12:50:55 -0700 Received: from scvm10.sc.intel.com (scvm10.sc.intel.com [10.82.195.27]) by scymds02.sc.intel.com with ESMTP id u4OJornB017293; Tue, 24 May 2016 12:50:53 -0700 Received: from scvm10.sc.intel.com (localhost [127.0.0.1]) by scvm10.sc.intel.com with ESMTP id u4OJor8E021079; Tue, 24 May 2016 12:50:53 -0700 Subject: [PATCH 07/10] IB/hfi1: Add a retry for the first-time QSFP access To: dledford@redhat.com From: Dennis Dalessandro Cc: linux-rdma@vger.kernel.org, Dean Luick Date: Tue, 24 May 2016 12:50:53 -0700 Message-ID: <20160524195052.19706.43009.stgit@scvm10.sc.intel.com> In-Reply-To: <20160524194746.19706.42976.stgit@scvm10.sc.intel.com> References: <20160524194746.19706.42976.stgit@scvm10.sc.intel.com> User-Agent: StGit/0.16 MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dean Luick Some QSFPs do not respond within the expected time, but later appear fine. Add a limited retry on the first access. Reviewed-by: Dennis Dalessandro Signed-off-by: Dean Luick --- drivers/infiniband/hw/hfi1/qsfp.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/infiniband/hw/hfi1/qsfp.c b/drivers/infiniband/hw/hfi1/qsfp.c index 2441669..aa7ed23 100644 --- a/drivers/infiniband/hw/hfi1/qsfp.c +++ b/drivers/infiniband/hw/hfi1/qsfp.c @@ -362,6 +362,7 @@ int refresh_qsfp_cache(struct hfi1_pportdata *ppd, struct qsfp_data *cp) { u32 target = ppd->dd->hfi1_id; int ret; + int retry_count; unsigned long flags; u8 *cache = &cp->cache[0]; @@ -376,8 +377,23 @@ int refresh_qsfp_cache(struct hfi1_pportdata *ppd, struct qsfp_data *cp) goto bail; } + retry_count = 0; +retry: ret = qsfp_read(ppd, target, 0, cache, QSFP_PAGESIZE); if (ret != QSFP_PAGESIZE) { + /* + * This is the first QSFP access the driver makes. + * Some QSFPs don't respond within the expected time, + * but later appear fine. Retry at 2s intervals for up + * to 10s. + */ + if (ret < 0 && retry_count < 5) { + retry_count++; + dd_dev_info(ppd->dd, "%s: QSFP not responding, waiting and retrying %d\n", + __func__, retry_count); + msleep(2000); + goto retry; + } dd_dev_info(ppd->dd, "%s: Page 0 read failed, expected %d, got %d\n", __func__, QSFP_PAGESIZE, ret);