From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3D427A0C47; Thu, 2 Sep 2021 09:45:06 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BD30840041; Thu, 2 Sep 2021 09:45:05 +0200 (CEST) Received: from mail-il1-f181.google.com (mail-il1-f181.google.com [209.85.166.181]) by mails.dpdk.org (Postfix) with ESMTP id 6B4AC4003C for ; Thu, 2 Sep 2021 09:45:05 +0200 (CEST) Received: by mail-il1-f181.google.com with SMTP id j15so870222ila.1 for ; Thu, 02 Sep 2021 00:45:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1Mi7Rg7RIGbQOaRg0YLb9dY3xcF7fmuMwnAclGDr210=; b=cXLOL46Ka23Fqzl/egtQIWdgYy82cb8JjPM8v6jXPZM3U6PYeYnFsBQ/BcFjfdmRaH xxVK72aaz41EpwcYTnCTSKhv+rvsPczGgoEoelOE/bwQbECHSLFIvLGJ4mDQc6Abd3XA jlbNNm6OLr9p9FClIuPSUwj7ApTTdghUKPbuY5a4hSNR4IsxNbDDx4pEiocn91WxgyOu dgodmZ4yGaY61fVI0nBEPf5JAOhrFrjbNWUw7aSYi/EJ7UfGZpb5RqNVRRN3MYzurhwR KgTtTGWZFDkfmC9y4TN/shDQJC3cRv7bjfnVrV2iAsjgCYa2FzJoPqK0ophZ6ga9a9WC vtVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1Mi7Rg7RIGbQOaRg0YLb9dY3xcF7fmuMwnAclGDr210=; b=skJOnMviLnt7HI4Df9AJxecVwr0q6dwLWA1UQW8ZAj+IUOSa/rizLoK/0OcEn5QEZh bqiBe0eZW13q/mCYUWQsWbqw75tsLXUbbb96iI0MhcjBUtFBFuaJBcaMdLSTbP5KIc7g UHjPzjjLFj/Md2I1a2OMkc+7aD3Y7gS2m24EtYHykKMcIx2u2aczCm+P/UmyALfIFQds ir9291t1ARwv0mAbOXmeyWuDc64G8atxJ2Ewzy1n6xoI4t6H2Rb1sfBFgBQVjDTdk966 2mTbxdOpjr3UswNRx8h3UtqUjySsdSHGlrxsSHjMNaRVas9S7ze1uAD1YWz0YSlLAWdR UtbA== X-Gm-Message-State: AOAM530XgY+KQbbYveH9fAyRLJSDB5b0Uo+ZOaMQQXqnLCxzn+2eRkHJ VBLsbuWqNq8QEpHT9keAHFfExKPyQPwzOZuDCbE= X-Google-Smtp-Source: ABdhPJz1RRz16s43au3Eygjr42WqaA5+AihbA7Me2Q9Wb+Y95jMuLJBEAW9ConW8xTg6tKAqm85OmSnO2tIVbUCwhMI= X-Received: by 2002:a92:cf50:: with SMTP id c16mr1349715ilr.162.1630568704648; Thu, 02 Sep 2021 00:45:04 -0700 (PDT) MIME-Version: 1.0 References: <20210826183301.333442-1-bruce.richardson@intel.com> <20210901163216.120087-1-bruce.richardson@intel.com> <20210901163216.120087-4-bruce.richardson@intel.com> In-Reply-To: <20210901163216.120087-4-bruce.richardson@intel.com> From: Jerin Jacob Date: Thu, 2 Sep 2021 13:14:38 +0530 Message-ID: To: Bruce Richardson Cc: dpdk-dev , "Walsh, Conor" , "Laatz, Kevin" , fengchengwen , Jerin Jacob , Satananda Burla Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v2 3/6] app/test: add basic dmadev copy tests X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Wed, Sep 1, 2021 at 10:02 PM Bruce Richardson wrote: > > For each dmadev instance, perform some basic copy tests to validate that > functionality. > > Signed-off-by: Bruce Richardson > --- > app/test/test_dmadev.c | 174 +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 174 insertions(+) > > diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c > index 12f7c69629..261f45db71 100644 > --- a/app/test/test_dmadev.c > +++ b/app/test/test_dmadev.c > @@ -2,12 +2,15 @@ > * Copyright(c) 2021 HiSilicon Limited. > * Copyright(c) 2021 Intel Corporation. > */ > +#include > #include > > #include > #include > #include > #include > +#include > +#include > > #include "test.h" > > @@ -16,6 +19,11 @@ extern int test_dmadev_api(uint16_t dev_id); > > #define PRINT_ERR(...) print_err(__func__, __LINE__, __VA_ARGS__) > > +#define COPY_LEN 1024 > + > +static struct rte_mempool *pool; > +static uint16_t id_count; > + > static inline int > __rte_format_printf(3, 4) > print_err(const char *func, int lineno, const char *format, ...) > @@ -31,6 +39,134 @@ print_err(const char *func, int lineno, const char *format, ...) > return ret; > } > > +static inline void > +await_hw(int dev_id, uint16_t vchan) > +{ > + int idle = rte_dmadev_vchan_idle(dev_id, vchan); > + if (idle < 0) { > + /* for drivers that don't support this op, just sleep for 25 microseconds */ > + usleep(25); > + return; > + } Can following model eliminate the need for rte_dmadev_vchan_idle() API. Right? static inline bool await_hw(int dev_id, uint16_t vchan, uint16_t nb_req, uint16_t *last_idx) { const uint64_t tmo = rte_get_timer_hz(); bool has_error = false; const uint64_t end_cycles = rte_get_timer_cycles() + tmo; while (rte_get_timer_cycles() < end_cycles && nb_req > 0 && has_error == false) { rte_pause(); nb_req -= rte_dmadev_completed(dev_id, nb_req, last_idx, &has_error); } return has_error ; } > + > + /* for those that do, *max* end time is one second from now, but all should be faster */ > + const uint64_t end_cycles = rte_get_timer_cycles() + rte_get_timer_hz(); > + while (!idle && rte_get_timer_cycles() < end_cycles) { > + rte_pause(); > + idle = rte_dmadev_vchan_idle(dev_id, vchan); > + } > +}