From patchwork Sun Feb 20 09:05:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 12752635 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 972D5C433EF for ; Sun, 20 Feb 2022 09:06:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243479AbiBTJGu (ORCPT ); Sun, 20 Feb 2022 04:06:50 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243482AbiBTJGo (ORCPT ); Sun, 20 Feb 2022 04:06:44 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2865631935 for ; Sun, 20 Feb 2022 01:06:24 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id a11-20020a17090a740b00b001b8b506c42fso16237075pjg.0 for ; Sun, 20 Feb 2022 01:06:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VIhQRHjajsSQXDo77s/MyTmBOFb2ebVTKmCwDrvspBo=; b=TxA/86dcRNbSsCLwJXdjaXT0ecWMybylwDFhq/dOFAA2eQbB+S0/uaQkkOHQzibztv s7rJbJZWwaSKkBCt2gimNXgejAP1xNH2mKsJxQMkI6ZUTeRuIoXdxYLB5Y/zTGrJq4ar lS8BKYnPhkGWOvQlDQEZfGV2ZmHJoXzc4zhxo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VIhQRHjajsSQXDo77s/MyTmBOFb2ebVTKmCwDrvspBo=; b=RLwS22v1eoVSf7BxIdH1vczvlTp4xjcvDUCOQEuDYi5WDS3qN9flFRhL8eMuL19sHg s7nZbS1HP5gODvIU3Fe66ihTh4fG+oFEFnkFf19htjn8cJDI+5cIDlmetgoKk1TZY1OM qpnfbLdslzQBye97dfj7LhMj3zwflQcFcWjg3w3W9ChiBWIpcULZw7VM5Qz4hEVaLDls /wGKqp43wAtoS2bSHFCGp0HZmPlU/kpnj6nDewNANFvMqYVEwYnJqMDZ5+Ucf5l5yEAo eQLv1nWLX536BzF/ejIUKBIK1dICifgEo/4vgOaZYtWFHtnZ1hjpot6qE94bw2QLpSVS ji9Q== X-Gm-Message-State: AOAM532S4BkhFvWfEK0EnheySpy3AF66q4qX8kSdwXzVH2lrv6uS5d4p RXIkk0uOqwPJD6ZF9PoFNBAMVA== X-Google-Smtp-Source: ABdhPJyX+fj8E8W9q+DbWyqRQsEvV+3UGPMNPls1G8X3YS5unPaivjMAnEOjHbA0jEx/J8xnmf3cZg== X-Received: by 2002:a17:902:7296:b0:14b:4bc6:e81 with SMTP id d22-20020a170902729600b0014b4bc60e81mr14494957pll.132.1645347983377; Sun, 20 Feb 2022 01:06:23 -0800 (PST) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id m5-20020a17090b068500b001b9bef22bf5sm4061865pjz.5.2022.02.20.01.06.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Feb 2022 01:06:23 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com Subject: [PATCH net 6/7] bnxt_en: Increase firmware message response DMA wait time Date: Sun, 20 Feb 2022 04:05:52 -0500 Message-Id: <1645347953-27003-7-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1645347953-27003-1-git-send-email-michael.chan@broadcom.com> References: <1645347953-27003-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org When polling for the firmware message response, we first poll for the response message header. Once the valid length is detected in the header, we poll for the valid bit at the end of the message which signals DMA completion. Normally, this poll time for DMA completion is extremely short (0 to a few usec). But on some devices under some rare conditions, it can be up to about 20 msec. Increase this delay to 50 msec and use udelay() for the first 10 usec for the common case, and usleep_range() beyond that. Also, change the error message to include the above delay time when printing the timeout value. Fixes: 3c8c20db769c ("bnxt_en: move HWRM API implementation into separate file") Reviewed-by: Vladimir Olovyannikov Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c | 12 +++++++++--- drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.h | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c index 566c9487ef55..b01d42928a53 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c @@ -644,17 +644,23 @@ static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx) /* Last byte of resp contains valid bit */ valid = ((u8 *)ctx->resp) + len - 1; - for (j = 0; j < HWRM_VALID_BIT_DELAY_USEC; j++) { + for (j = 0; j < HWRM_VALID_BIT_DELAY_USEC; ) { /* make sure we read from updated DMA memory */ dma_rmb(); if (*valid) break; - usleep_range(1, 5); + if (j < 10) { + udelay(1); + j++; + } else { + usleep_range(20, 30); + j += 20; + } } if (j >= HWRM_VALID_BIT_DELAY_USEC) { hwrm_err(bp, ctx, "Error (timeout: %u) msg {0x%x 0x%x} len:%d v:%d\n", - hwrm_total_timeout(i), req_type, + hwrm_total_timeout(i) + j, req_type, le16_to_cpu(ctx->req->seq_id), len, *valid); goto exit; } diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.h index d52bd2d63aec..c98032e38188 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.h @@ -90,7 +90,7 @@ static inline unsigned int hwrm_total_timeout(unsigned int n) } -#define HWRM_VALID_BIT_DELAY_USEC 150 +#define HWRM_VALID_BIT_DELAY_USEC 50000 static inline bool bnxt_cfa_hwrm_message(u16 req_type) {