From: Michael Chan <michael.chan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, Andy Gospodarek <gospo@broadcom.com>
Subject: [PATCH net-next 09/14] bnxt_en: reduce timeout on initial HWRM calls
Date: Wed, 25 Apr 2018 20:40:52 -0400 [thread overview]
Message-ID: <1524703257-12812-10-git-send-email-michael.chan@broadcom.com> (raw)
In-Reply-To: <1524703257-12812-1-git-send-email-michael.chan@broadcom.com>
From: Andy Gospodarek <gospo@broadcom.com>
Testing with DIM enabled on older kernels indicated that firmware calls
were slower than expected. More detailed analysis indicated that the
default 25us delay was higher than necessary. Reducing the time spend in
usleep_range() for the first several calls would reduce the overall
latency of firmware calls on newer Intel processors.
Signed-off-by: Andy Gospodarek <gospo@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 26 +++++++++++++++++++++++---
drivers/net/ethernet/broadcom/bnxt/bnxt.h | 6 ++++++
2 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index a221a10..ff9a5cd 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -3495,15 +3495,29 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len,
if (!timeout)
timeout = DFLT_HWRM_CMD_TIMEOUT;
+ /* convert timeout to usec */
+ timeout *= 1000;
i = 0;
- tmo_count = timeout * 40;
+ /* Short timeout for the first few iterations:
+ * number of loops = number of loops for short timeout +
+ * number of loops for standard timeout.
+ */
+ tmo_count = HWRM_SHORT_TIMEOUT_COUNTER;
+ timeout = timeout - HWRM_SHORT_MIN_TIMEOUT * HWRM_SHORT_TIMEOUT_COUNTER;
+ tmo_count += DIV_ROUND_UP(timeout, HWRM_MIN_TIMEOUT);
resp_len = bp->hwrm_cmd_resp_addr + HWRM_RESP_LEN_OFFSET;
if (intr_process) {
/* Wait until hwrm response cmpl interrupt is processed */
while (bp->hwrm_intr_seq_id != HWRM_SEQ_ID_INVALID &&
i++ < tmo_count) {
- usleep_range(25, 40);
+ /* on first few passes, just barely sleep */
+ if (i < HWRM_SHORT_TIMEOUT_COUNTER)
+ usleep_range(HWRM_SHORT_MIN_TIMEOUT,
+ HWRM_SHORT_MAX_TIMEOUT);
+ else
+ usleep_range(HWRM_MIN_TIMEOUT,
+ HWRM_MAX_TIMEOUT);
}
if (bp->hwrm_intr_seq_id != HWRM_SEQ_ID_INVALID) {
@@ -3521,7 +3535,13 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len,
HWRM_RESP_LEN_SFT;
if (len)
break;
- usleep_range(25, 40);
+ /* on first few passes, just barely sleep */
+ if (i < DFLT_HWRM_CMD_TIMEOUT)
+ usleep_range(HWRM_SHORT_MIN_TIMEOUT,
+ HWRM_SHORT_MAX_TIMEOUT);
+ else
+ usleep_range(HWRM_MIN_TIMEOUT,
+ HWRM_MAX_TIMEOUT);
}
if (i >= tmo_count) {
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
index 057f8a2..7fa4a45 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
@@ -532,6 +532,12 @@ struct rx_tpa_end_cmp_ext {
#define BNXT_HWRM_REQ_MAX_SIZE 128
#define BNXT_HWRM_REQS_PER_PAGE (BNXT_PAGE_SIZE / \
BNXT_HWRM_REQ_MAX_SIZE)
+#define HWRM_SHORT_MIN_TIMEOUT 3
+#define HWRM_SHORT_MAX_TIMEOUT 10
+#define HWRM_SHORT_TIMEOUT_COUNTER 5
+
+#define HWRM_MIN_TIMEOUT 25
+#define HWRM_MAX_TIMEOUT 40
#define BNXT_RX_EVENT 1
#define BNXT_AGG_EVENT 2
--
1.8.3.1
next prev parent reply other threads:[~2018-04-26 0:41 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-26 0:40 [PATCH net-next 00/14] bnxt_en: Net-next updates Michael Chan
2018-04-26 0:40 ` [PATCH net-next 01/14] bnxt_en: Add TC to hardware QoS queue mapping logic Michael Chan
2018-04-26 0:40 ` [PATCH net-next 02/14] bnxt_en: Remap TC to hardware queues when configuring PFC Michael Chan
2018-04-26 0:40 ` [PATCH net-next 03/14] bnxt_en: Check the lengths of encapsulated firmware responses Michael Chan
2018-04-26 0:40 ` [PATCH net-next 04/14] bnxt_en: Do not set firmware time from VF driver on older firmware Michael Chan
2018-04-26 0:40 ` [PATCH net-next 05/14] bnxt_en: Simplify ring alloc/free error messages Michael Chan
2018-04-26 0:40 ` [PATCH net-next 06/14] bnxt_en: Display function level rx/tx_discard_pkts via ethtool Michael Chan
2018-04-26 0:40 ` [PATCH net-next 07/14] bnxt_en: Do not allow VF to read EEPEOM Michael Chan
2018-04-26 1:38 ` Andrew Lunn
2018-04-26 2:40 ` Michael Chan
2018-04-26 0:40 ` [PATCH net-next 08/14] bnxt_en: Increase RING_IDLE minimum threshold to 50 Michael Chan
2018-04-26 0:40 ` Michael Chan [this message]
2018-04-26 0:40 ` [PATCH net-next 10/14] bnxt_en: add debugfs support for DIM Michael Chan
2018-04-26 0:40 ` [PATCH net-next 11/14] bnxt_en: Reserve rings in bnxt_set_channels() if device is down Michael Chan
2018-04-26 0:40 ` [PATCH net-next 12/14] bnxt_en: Don't reserve rings on VF when min rings were not provisioned by PF Michael Chan
2018-04-26 0:40 ` [PATCH net-next 13/14] bnxt_en: Reserve RSS and L2 contexts for VF Michael Chan
2018-04-26 0:40 ` [PATCH net-next 14/14] bnxt_en: Reserve rings at driver open if none was reserved at probe time Michael Chan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1524703257-12812-10-git-send-email-michael.chan@broadcom.com \
--to=michael.chan@broadcom.com \
--cc=davem@davemloft.net \
--cc=gospo@broadcom.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).