From: David Harton <dharton@cisco.com>
To: dev@dpdk.org, mw@semihalf.com, mk@semihalf.com,
gtzalik@amazon.com, evgenys@amazon.com
Cc: David Harton <dharton@cisco.com>
Subject: [dpdk-dev] [PATCH] net/ena: Fix admin cq polling for 32-bit apps
Date: Wed, 29 May 2019 17:01:39 -0400 [thread overview]
Message-ID: <20190529210139.26766-1-dharton@cisco.com> (raw)
Recent modifications to admin command queue polling logic
did not support 32-bit applications. Updated the driver to
work for 32 or 64 bit applications as well as avoiding
roll-over possibility.
Fixes: 3adcba9a89 ("net/ena: update HAL to the newer version")
Signed-off-by: David Harton <dharton@cisco.com>
---
drivers/net/ena/base/ena_com.c | 10 +++++++---
drivers/net/ena/base/ena_plat_dpdk.h | 6 +-----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ena/base/ena_com.c b/drivers/net/ena/base/ena_com.c
index b688067f7..b96adde3c 100644
--- a/drivers/net/ena/base/ena_com.c
+++ b/drivers/net/ena/base/ena_com.c
@@ -547,10 +547,13 @@ static int ena_com_wait_and_process_admin_cq_polling(struct ena_comp_ctx *comp_c
struct ena_com_admin_queue *admin_queue)
{
unsigned long flags = 0;
- unsigned long timeout;
+ u32 timeout_ms;
int ret;
- timeout = ENA_GET_SYSTEM_TIMEOUT(admin_queue->completion_timeout);
+ /* Calculate ms granularity timeout from us completion_timeout
+ * making sure we retry once if we have at least 1ms
+ */
+ timeout_ms = (admin_queue->completion_timeout / 1000) + (ENA_POLL_MS - 1);
while (1) {
ENA_SPINLOCK_LOCK(admin_queue->q_lock, flags);
@@ -560,7 +563,7 @@ static int ena_com_wait_and_process_admin_cq_polling(struct ena_comp_ctx *comp_c
if (comp_ctx->status != ENA_CMD_SUBMITTED)
break;
- if (ENA_TIME_EXPIRE(timeout)) {
+ if (timeout_ms < ENA_POLL_MS) {
ena_trc_err("Wait for completion (polling) timeout\n");
/* ENA didn't have any completion */
ENA_SPINLOCK_LOCK(admin_queue->q_lock, flags);
@@ -573,6 +576,7 @@ static int ena_com_wait_and_process_admin_cq_polling(struct ena_comp_ctx *comp_c
}
ENA_MSLEEP(ENA_POLL_MS);
+ timeout_ms -= ENA_POLL_MS;
}
if (unlikely(comp_ctx->status == ENA_CMD_ABORTED)) {
diff --git a/drivers/net/ena/base/ena_plat_dpdk.h b/drivers/net/ena/base/ena_plat_dpdk.h
index 902d91efb..0cb837e4f 100644
--- a/drivers/net/ena/base/ena_plat_dpdk.h
+++ b/drivers/net/ena/base/ena_plat_dpdk.h
@@ -178,7 +178,7 @@ do { \
do { \
struct timespec wait; \
struct timeval now; \
- unsigned long timeout_us; \
+ uint64_t timeout_us; \
gettimeofday(&now, NULL); \
wait.tv_sec = now.tv_sec + timeout / 1000000UL; \
timeout_us = timeout % 1000000UL; \
@@ -196,10 +196,6 @@ do { \
#define ena_wait_event_t ena_wait_queue_t
#define ENA_MIGHT_SLEEP()
-#define ENA_TIME_EXPIRE(timeout) (timeout < rte_get_timer_cycles())
-#define ENA_GET_SYSTEM_TIMEOUT(timeout_us) \
- (timeout_us * rte_get_timer_hz() / 1000000 + rte_get_timer_cycles())
-
/*
* Each rte_memzone should have unique name.
* To satisfy it, count number of allocations and add it to name.
--
2.19.1
next reply other threads:[~2019-05-29 21:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-29 21:01 David Harton [this message]
2019-06-27 15:37 ` Ferruh Yigit
2019-06-28 15:03 ` Michał Krawczyk
2019-06-28 15:46 ` David Harton (dharton)
2019-07-01 7:24 ` Michał Krawczyk
2019-07-01 12:00 ` David Harton (dharton)
2019-07-01 12:52 ` Michał Krawczyk
2019-07-12 17:35 ` [dpdk-dev] [PATCH v2] " David Harton
2019-07-17 14:29 ` Michał Krawczyk
2019-07-17 15:15 ` Ferruh Yigit
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=20190529210139.26766-1-dharton@cisco.com \
--to=dharton@cisco.com \
--cc=dev@dpdk.org \
--cc=evgenys@amazon.com \
--cc=gtzalik@amazon.com \
--cc=mk@semihalf.com \
--cc=mw@semihalf.com \
/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).