[dpdk-dev] [PATCH] net/ena: Fix admin cq polling for 32-bit apps

Michał Krawczyk mk at semihalf.com
Fri Jun 28 17:03:26 CEST 2019


Hi,

sorry for the late reply.

śr., 29 maj 2019 o 23:01 David Harton <dharton at cisco.com> napisał(a):
>
> 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 at 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;

This part can be problematic at the very overloaded systems - in that
case the ENA_MSLEEP can take a much longer than ENA_POLL_MS and in
this situation the time spent in this function can't be determined.
That's why we were checking time spent in sleep every ENA_TIME_EXPIRE
macro.
The issue can be observed especially in the kernel drivers, and
ena_com is common file for all ENA drivers.


More information about the dev mailing list