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 69426A0567; Tue, 9 Mar 2021 15:00:33 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D46744069D; Tue, 9 Mar 2021 15:00:32 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mails.dpdk.org (Postfix) with ESMTP id 44C2C4068A for ; Tue, 9 Mar 2021 15:00:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615298430; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rAOb+OCRZI6Y6EKRTEFV3TBnvDNuGzIRqRYQtw+qq2g=; b=R15FipLQ6e2dcfTOcrshfjXvsSFleQcg9T1MH3gvtR9qINO94pA4vGTWc3SlXJZKtOEeLg e5QDv8I5Kz+fc+VhrI3nbvHrMqfjm5YCBOunkgiY6txpQgvXi3HlgWT+jtq0L5O9blyrfI tX/YGMXX/+XD5z7DvyX7i5TCYmvXc7Y= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-466-cxMxJ2YEOimD4a2jlINXdg-1; Tue, 09 Mar 2021 09:00:28 -0500 X-MC-Unique: cxMxJ2YEOimD4a2jlINXdg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D4EE6108BD07; Tue, 9 Mar 2021 14:00:26 +0000 (UTC) Received: from dhcp-25.97.bos.redhat.com (ovpn-115-237.rdu2.redhat.com [10.10.115.237]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 51A161A86A; Tue, 9 Mar 2021 14:00:25 +0000 (UTC) From: Aaron Conole To: Ferruh Yigit Cc: oulijun , xiaoyun.li@intel.com, dev@dpdk.org, linuxarm@openeuler.org, Andrew Rybchenko , Thomas Monjalon , Honnappa Nagarahalli References: <1614929583-37727-1-git-send-email-oulijun@huawei.com> <1614938252-62955-1-git-send-email-oulijun@huawei.com> <35583d9b-0782-74a7-95df-aef1ca35f819@intel.com> Date: Tue, 09 Mar 2021 09:00:24 -0500 In-Reply-To: <35583d9b-0782-74a7-95df-aef1ca35f819@intel.com> (Ferruh Yigit's message of "Tue, 9 Mar 2021 09:53:49 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=aconole@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [PATCH V2] app/testpmd: support Tx mbuf free on demand cmd 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" Ferruh Yigit writes: > On 3/9/2021 8:49 AM, oulijun wrote: >> >> >> =E5=9C=A8 2021/3/9 1:33, Ferruh Yigit =E5=86=99=E9=81=93: >>> On 3/5/2021 9:57 AM, Lijun Ou wrote: >>>> From: Chengwen Feng >>>> >>>> This patch support tx_done_cleanup command: >>>> tx_done_cleanup port (port_id) (queue_id) (free_cnt) >>>> >>>> Users must make sure there are no concurrent access to the same Tx >>>> queue (like rte_eth_tx_burst, rte_eth_dev_tx_queue_stop and so on) >>>> this command executed. >>>> >>> >>> Hi Lijun, >>> >>> Is the intention to test the PMD implementation? >> Yes >>> As you highlighted the API is for the datapath, a command for it is >>> not easy to use, not sure how useful it will be. >>> Perhaps it can be option to use this API in a forwarding engine, >>> like 'txonly', controlled by a command, but again not sure what to >>> observe/measure etc.. >>> >> We want to do this. But it is diffcult to control the number of sent >> packets when used together with other txonly. > > Agree hard to verify that the implementation this way. > > What do you think adding an unit test for it, > 'app/test/test_ethdev_xx', that can send some packets get the free > mbufs number, call the 'rte_eth_tx_done_cleanup()' and check the free > mbuf numbers again and return a fail/success accordingly. > > And this can be a good start for our long missing ethdev unit tests, > cc'ed Aaron and Honnappa for the unit test perspective. Definitely, let's do it. There's a start to a guide detailing how to create unit tests and suites ;). I'll post the latest version this week. > And if we go with unit test, I think we need to find a way to mark the > unit tests that requires HW (this case) for the automation usecases. Does it really need HW, though? Can we use a software device for it? Maybe it's a good time to use the null dev for test purposes for these libraries. After all, we want to be testing the library. >>>> Signed-off-by: Chengwen Feng >>>> Signed-off-by: Lijun Ou >>>> --- >>>> V1->V2: >>>> - use Tx instead of TX >>>> - add note in doc >>>> --- >>>> =C2=A0 app/test-pmd/cmdline.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 | 91 +++++++++++++++++++++++++++++ >>>> =C2=A0 doc/guides/rel_notes/release_21_05.rst=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 |=C2=A0 2 + >>>> =C2=A0 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 ++++ >>>> =C2=A0 3 files changed, 104 insertions(+) >>>> >>>> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c >>>> index 14110eb..4df0c32 100644 >>>> --- a/app/test-pmd/cmdline.c >>>> +++ b/app/test-pmd/cmdline.c >>>> @@ -36,6 +36,7 @@ >>>> =C2=A0 #include >>>> =C2=A0 #include >>>> =C2=A0 #include >>>> +#include >>> >>> This header for PMDs to include, applications shouldn't include >>> this, including this means you are accessing dpdk internals which >>> you shouldn't access. >>> >> Thanks. I will fix it. >>>> =C2=A0 #include >>>> =C2=A0 #include >>>> =C2=A0 #include >>>> @@ -675,6 +676,9 @@ static void cmd_help_long_parsed(void *parsed_resu= lt, >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 "set port (port_id) ptype_mask (ptype_mask)\n" >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 "=C2=A0=C2=A0=C2=A0 set packet types classification for a specifi= c port\n\n" >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "t= x_done_cleanup (port_id) (queue_id) (free_cnt)\n" >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "= =C2=A0=C2=A0=C2=A0 Cleanup a Tx queue's mbuf on a port\n\n" >>>> + >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 "set port (port_id) queue-region region_id (value) " >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 "queue_start_index (value) queue_num (value)\n" >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 "=C2=A0=C2=A0=C2=A0 Set a queue region on a port\n\n" >>>> @@ -16910,6 +16914,92 @@ cmdline_parse_inst_t cmd_showport_macs =3D { >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }, >>>> =C2=A0 }; >>>> +/* *** tx_done_cleanup *** */ >>>> +struct cmd_tx_done_cleanup_result { >>>> +=C2=A0=C2=A0=C2=A0 cmdline_fixed_string_t clean; >>>> +=C2=A0=C2=A0=C2=A0 cmdline_fixed_string_t port; >>>> +=C2=A0=C2=A0=C2=A0 uint16_t port_id; >>>> +=C2=A0=C2=A0=C2=A0 uint16_t queue_id; >>>> +=C2=A0=C2=A0=C2=A0 uint32_t free_cnt; >>>> +}; >>>> + >>>> +static void >>>> +cmd_tx_done_cleanup_parsed(void *parsed_result, >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 __rte_unused struct cmdline *cl, >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 __rte_unused void *data) >>>> +{ >>>> +=C2=A0=C2=A0=C2=A0 struct cmd_tx_done_cleanup_result *res =3D parsed_= result; >>>> +=C2=A0=C2=A0=C2=A0 struct rte_eth_dev *dev; >>>> +=C2=A0=C2=A0=C2=A0 uint16_t port_id =3D res->port_id; >>>> +=C2=A0=C2=A0=C2=A0 uint16_t queue_id =3D res->queue_id; >>>> +=C2=A0=C2=A0=C2=A0 uint32_t free_cnt =3D res->free_cnt; >>>> +=C2=A0=C2=A0=C2=A0 int ret; >>>> + >>>> +=C2=A0=C2=A0=C2=A0 if (!rte_eth_dev_is_valid_port(port_id)) { >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 printf("Invalid port_id %u= \n", port_id); >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return; >>>> +=C2=A0=C2=A0=C2=A0 } >>>> + >>>> +=C2=A0=C2=A0=C2=A0 dev =3D &rte_eth_devices[port_id]; >>> >>> Similar to above comment 'rte_eth_devices' is the internal >>> variable, applications should not access it directly. >>> >> No API is available, and multiple references exist in the testpmd file. > > Technically 'rte_eth_devices' is still visible to the applications > because of the static inline functions, in theory it should be hidden. > > But this variable accessed by our test application multiple times may > be the sign that something more is missing. > > Thomas, Andrew, what to you think to try to clean this usage from > testpmd and add more APIs if needed for this? > >>>> +=C2=A0=C2=A0=C2=A0 if (queue_id >=3D dev->data->nb_tx_queues) { >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 printf("Invalid Tx queue_i= d %u\n", queue_id); >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return; >>>> +=C2=A0=C2=A0=C2=A0 } >>>> + >>> >>> Number of the queues can be get via 'rte_eth_dev_info_get()'. >>> >> This is also called in txonly. Do you want to replace it? > > That would be good if you can do it in a separate patch, thank you.