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 E14D1A0561; Fri, 5 Mar 2021 08:46:56 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ABA544069B; Fri, 5 Mar 2021 08:46:56 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 6C46B40147 for ; Fri, 5 Mar 2021 08:46:55 +0100 (CET) IronPort-SDR: 3wd6H5mNtRwImbJvt5TVaArzfGfzrwIGgxT8AKw0tTPvMqLA1HQODU2GtwPTsrbHprWIGq3cLo Sm4yOHrySt+A== X-IronPort-AV: E=McAfee;i="6000,8403,9913"; a="166858660" X-IronPort-AV: E=Sophos;i="5.81,224,1610438400"; d="scan'208";a="166858660" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2021 23:46:53 -0800 IronPort-SDR: YJPpMvCWpiYs2OO4Q4hE1gk+qHCcsdXk5/oIiQjl/2wY4EM2bLLt8G+EuOkJpqQTZkEwTva9qB PeUf/Q7ETiSw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,224,1610438400"; d="scan'208";a="374849941" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by fmsmga007.fm.intel.com with ESMTP; 04 Mar 2021 23:46:52 -0800 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Thu, 4 Mar 2021 23:46:52 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Thu, 4 Mar 2021 23:46:52 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Thu, 4 Mar 2021 23:46:52 -0800 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.169) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2106.2; Thu, 4 Mar 2021 23:46:52 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e2a/BiVshhgFiRbCX5nVu8oQRlyCSwvEz9lH0vj8lAPYhc0Hjz/u5w1FDjnDBKJMilBB7REsgx6cb7nehz+fSKG5e7jm23qO0nclaTEMXweSMY9U5I+GGI6OavrA/puhPMf5z/pVZz+JJwSB1YAlojrmHj/n7ywnTD0qnn5po16QtKxfS3x3FEYQitRvK0DfY4868AaEomv5THpivhIx6bvlM0MPiARvlUJxx1eYj6ni+JKLkC6k4K/sct3sH+7PKHrxkJLFI7bdNlC79k8u3/MPs2GZ4wjA7E0hrHh3Q0Ztu4m3MKTE+9quB0nvgmftB7N7E8tF//YRSYLM0iV7bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1hXTe2Hjosg62YX38p1gkBMtda5HF+BEo5SbQeaYsTk=; b=iogRRBR3CBaRSJIccDLJuif9IQW2rFGgPHZLdVxPl5TN0OlanIgn+aXC8aosstddDSqGz/3Gd9YaV4potas0GfTMQk3vFsqfKxHDeNxfFIFyobmWXYXK+j8jPuYnqA2FecIHuBHCyhoVDhQR64MsLPO03K6IlFyaIFTl4j2N2s61k6OQJ4/Lolupt2KC3Dzc+al6nqW7h1szUBxSSoA4Y64nmdmg9mGsb0FtgsOqa8fGhDDjHKtl9nW1ULI73hMTw6zb4071eFgh2welplmQek0K387jW3+Vm4jbn9O9BrK8PRXCpX1+ToMYe4RpJ0C+GAxsgMPKnwOKPzjhRQ8HOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1hXTe2Hjosg62YX38p1gkBMtda5HF+BEo5SbQeaYsTk=; b=SEBitZmtGXkK9t+6j0nNvakdj7PLhJVF/CHfhXz3EV0na+5teGE+eq28gZ8VUxhCvKVK5fRhQrAsDFbCv57atNZNVDlzN+ORn1ClGNMsuEBmUYNaFGcu6sr29I8ySUBGAaEB7RtI6FCTdWpkp1p2BUl+oEhSFoqd3WnWlCDvhuc= Received: from CY4PR11MB1750.namprd11.prod.outlook.com (2603:10b6:903:126::8) by CY4PR1101MB2215.namprd11.prod.outlook.com (2603:10b6:910:21::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.18; Fri, 5 Mar 2021 07:46:47 +0000 Received: from CY4PR11MB1750.namprd11.prod.outlook.com ([fe80::8fd:c082:f2bc:f6ae]) by CY4PR11MB1750.namprd11.prod.outlook.com ([fe80::8fd:c082:f2bc:f6ae%12]) with mapi id 15.20.3912.022; Fri, 5 Mar 2021 07:46:47 +0000 From: "Li, Xiaoyun" To: Lijun Ou , "Yigit, Ferruh" CC: "dev@dpdk.org" , "linuxarm@openeuler.org" Thread-Topic: [PATCH] app/testpmd: support Tx mbuf free on demand cmd Thread-Index: AQHXEZG1xwmFxaDCdUmltYroAhQKkKp1AS/Q Date: Fri, 5 Mar 2021 07:46:47 +0000 Message-ID: References: <1614929583-37727-1-git-send-email-oulijun@huawei.com> In-Reply-To: <1614929583-37727-1-git-send-email-oulijun@huawei.com> Accept-Language: en-US Content-Language: en-US X-Mentions: ferruh.yigit@intel.com X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.37] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ce7fdfa9-048e-4a1a-24cd-08d8dfaad471 x-ms-traffictypediagnostic: CY4PR1101MB2215: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4303; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: xEHlD9NirgyLWrodvh/dtlZMgPLPYqxVcBNYmsFulXfQcxw9EDEjX8iVR39g8d5l2czmoFyWUIwdkzi4JxJg/6wMiZ8KVtj3Dq5dgCgdRWW7n+EaYq7bV2Bsw1pePPTp7Z56Wisf1YPh0irHgfG8QJ1fbsrA96un5SGFUB/4K/vJeGD0xo34sQ7s47XaHxzK4gYkxXTHaIPkY2MhzEGQAt7R/hRpF18M3GhlDDAwWOYKrp58oL4CmRITq4+eUut7MtImJVkO/xfwgUwjVnAz4ECtVjKiQONJQCPqYLfYhLhBDh8tCM+rckgN6JavJ6ihxQxiGHWpsmHD5zUFfkV6MHceg/WAuJ+M4N0WEJewwCoZN/t9XpqFqGJ3SaLeoCabkwvlb07nfPrbGTW1o37hfSVySHmXZiN3XscucA3nNqGFZWXMovtpBorUUvmVRg2sqiy2CTOSb4njzraVKK8KiMpYluq3kJByQeyEDI76LJ2q6WEmT1NxNh3mhcNt3nQnXNiy9FoNRNZvU0S3Pe6NMw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR11MB1750.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(376002)(39860400002)(366004)(346002)(396003)(186003)(54906003)(33656002)(110136005)(316002)(71200400001)(8676002)(478600001)(53546011)(52536014)(66476007)(4326008)(86362001)(5660300002)(26005)(7696005)(83380400001)(6506007)(2906002)(9686003)(64756008)(6636002)(55016002)(66946007)(76116006)(8936002)(66446008)(66556008); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?Oz2r/5l1s2vEX7t7+6HhANTC8VEaofyImF3uyBtD+PSGtBThCqsypbHeA9xC?= =?us-ascii?Q?FlIYYYBDo9/HgFJidu8CYBOVbUJetwHvpPnSx06DKmOWMMe9ZZeBmvQ6ySoR?= =?us-ascii?Q?w/sTQkVxYSJ6dxusdoa5+GLRVhosxveLS2icdt0wQhp/BZryfv0XKTfFMHyt?= =?us-ascii?Q?/oPogaCQEdRCGBt/c09y6KeJI9p3YPL9WDAYmWwtoLPaGek2/yL310eWihUt?= =?us-ascii?Q?/i7whMvZ93f9jjf/0vHklIxsAofw8TVEe+DI4vc+26oLOQvbU7x/bnIoAsKy?= =?us-ascii?Q?w+ONHgYWDaHeyK3wQU+uSw1935Vj/6flkyFOCRnZvXB17wSMltoLo8HvEJna?= =?us-ascii?Q?sYn2cZmLXPUuEMcByUu+uBwp1XTF43RgJuItkwcSe0usj9caT6bw4mrJMTxr?= =?us-ascii?Q?+FwwyIpwbporaHO9BlB3FQtafWpWj2mB0NXacLITUfkXg2HPMBs+bTDayUqn?= =?us-ascii?Q?4Gqk/czGqbkv2iCH9xfL9j+oT8gciT0D3EEk0s5YNMV9Mx65xFbOxqlHvUt7?= =?us-ascii?Q?3y9YDr+lAxjaDRIWijA53KTd198ZUXVVaxDyxIAdyTR9urIcPyxSoafZPkc3?= =?us-ascii?Q?nB8aTNCgL5IekB4qE71DCekWeam3GZHt3g2vka4vJNk37xT0Xm4F1W67YjzR?= =?us-ascii?Q?Wn5p5hROOcB/k3Bsc9TZSecwWH5SyMnLG6E7BJPJ/sb751oM6Sv1SuNPa5qn?= =?us-ascii?Q?Cw/y0f/yBCM8de7XPVMVXwERo6RXPIioIB5fcusorM97q5xDvtWYYZhQMd8l?= =?us-ascii?Q?6kofguF7DJrDWQyvHl8rbyY5EPR+z6soPEoAhB4twsBpwdiW1Zt0dvK5QrXr?= =?us-ascii?Q?Ao6Q4hJ0AdAXaMZkvl0rzpOqXhqzHhrh83VBZkl6nXPFOjDdsbvIHF6H+COL?= =?us-ascii?Q?Bu+XpWNdJhQQiPqycdlcgm1ZAbDfFHdzOhiP6ssgVMv5YPFO/1sHRbFLGjG/?= =?us-ascii?Q?evGEPEDZCXuR6J4ZVfiWq0YNyI7p+/U77x8a5HWD02Psw6NoISoOMRxaM2qQ?= =?us-ascii?Q?xL8s+xpfp7v6ZnDd7+TNJlXgHQtFH+XZ2w1xclk8skByFVJ1LjP5OhU8c2mm?= =?us-ascii?Q?0kPYXTEqgdNYR3nBiw8nsVXx3oj8B1gI5Qv8LKnuVYueTQPABGudKjNGrR7L?= =?us-ascii?Q?b0Gt6J4LInMp9AiRSc6D2uU07W256Sgub8gOf1ET4jifI7aEwXITkGIVEsaJ?= =?us-ascii?Q?m3RDJArV6KwCbXeL3SPWIKZyYz9UNpjCrEPMVNRr7Plz5zCewrwXdTsg/NEg?= =?us-ascii?Q?aLKVdwUyGIVkxSgwhEpw9rVUsToSbMTeG9S5fikE17NfEO3oOFOfMpAX4F+C?= =?us-ascii?Q?Nyjp0pdwUUexBl09nzoVwohp?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CY4PR11MB1750.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce7fdfa9-048e-4a1a-24cd-08d8dfaad471 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Mar 2021 07:46:47.3674 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: GCUUXdIy95aDo5ZkJfyJhavX+pJublNXYNgbuarpdF0KGTAP6s7JMyDx5byBEgUNOQHDUC7v9tpoCdpR2CZTPA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1101MB2215 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH] 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" Hi Sorry, forgot to send this in last patchset. > -----Original Message----- > From: Lijun Ou > Sent: Friday, March 5, 2021 15:33 > To: Yigit, Ferruh > Cc: Li, Xiaoyun ; dev@dpdk.org; > linuxarm@openeuler.org > Subject: [PATCH] app/testpmd: support Tx mbuf free on demand cmd >=20 > From: Chengwen Feng >=20 > This patch support tx_done_cleanup command: > tx_done_cleanup port (port_id) (queue_id) (free_cnt) >=20 > User 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) when this command Users ...... this command is executed. > executed. >=20 > Signed-off-by: Chengwen Feng > Signed-off-by: Lijun Ou > --- > app/test-pmd/cmdline.c | 91 +++++++++++++++++++++++= ++++++ > doc/guides/rel_notes/release_21_05.rst | 2 + > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ > 3 files changed, 100 insertions(+) >=20 > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index > 14110eb..832ae70 100644 > --- a/app/test-pmd/cmdline.c > +++ b/app/test-pmd/cmdline.c > @@ -36,6 +36,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -675,6 +676,9 @@ static void cmd_help_long_parsed(void *parsed_result, > "set port (port_id) ptype_mask (ptype_mask)\n" > " set packet types classification for a specific > port\n\n" >=20 > + "tx_done_cleanup (port_id) (queue_id) (free_cnt)\n" > + " Cleanup a tx queue's mbuf on a port\n\n" > + > "set port (port_id) queue-region region_id (value) " > "queue_start_index (value) queue_num (value)\n" > " Set a queue region on a port\n\n" > @@ -16910,6 +16914,92 @@ cmdline_parse_inst_t cmd_showport_macs =3D { > }, > }; >=20 > +/* *** tx_done_cleanup *** */ > +struct cmd_tx_done_cleanup_result { > + cmdline_fixed_string_t clean; > + cmdline_fixed_string_t port; > + uint16_t port_id; > + uint16_t queue_id; > + uint32_t free_cnt; > +}; > + > +static void > +cmd_tx_done_cleanup_parsed(void *parsed_result, > + __rte_unused struct cmdline *cl, > + __rte_unused void *data) > +{ > + struct cmd_tx_done_cleanup_result *res =3D parsed_result; > + struct rte_eth_dev *dev; > + uint16_t port_id =3D res->port_id; > + uint16_t queue_id =3D res->queue_id; > + uint32_t free_cnt =3D res->free_cnt; > + int ret; > + > + if (!rte_eth_dev_is_valid_port(port_id)) { > + printf("Invalid port_id %u\n", port_id); > + return; > + } > + > + dev =3D &rte_eth_devices[port_id]; > + if (queue_id >=3D dev->data->nb_tx_queues) { > + printf("Invalid TX queue_id %u\n", queue_id); Tx? You just want to send a patch to use Rx/Tx. You should keep concurrency= . > + return; > + } > + > + if (dev->data->tx_queue_state[queue_id] !=3D > + RTE_ETH_QUEUE_STATE_STARTED) { > + printf("TX queue_id %u not started!\n", queue_id); Tx? > + return; > + } > + > + /* > + * rte_eth_tx_done_cleanup is a dataplane API, user 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) when this > API > + * called. > + */ And I have some concerns on this. Users cannot know about this unless they = read your code. I don't think this will likely happen. So you should document this in testpmd doc when you introduced this command= . Or maybe you can have a way to stop that to happen. Maybe checking "test_do= ne && engine !=3D rxonly" before this? In your comment, the tx forwarding shouldn't happen, right? Every fwd engin= e except rxonly will contain tx. Well, it's still a rough way because tx may not happen even if it's io fwd. Maybe other people have better ideas. Otherwise, you should at least docume= nt it. @Yigit, Ferruh What do you think? Is there a better way? > + ret =3D rte_eth_tx_done_cleanup(port_id, queue_id, free_cnt); > + if (ret < 0) { > + printf("Failed to cleanup mbuf for port %u TX queue %u " Tx? > + "error desc: %s(%d)\n", > + port_id, queue_id, strerror(-ret), ret); > + return; > + } > + > + printf("Cleanup port %u TX queue %u mbuf nums: %u\n", Tx? > + port_id, queue_id, ret); > +} > + > +cmdline_parse_token_string_t cmd_tx_done_cleanup_clean =3D > + TOKEN_STRING_INITIALIZER(struct cmd_tx_done_cleanup_result, clean, > + "tx_done_cleanup"); > +cmdline_parse_token_string_t cmd_tx_done_cleanup_port =3D > + TOKEN_STRING_INITIALIZER(struct cmd_tx_done_cleanup_result, port, > + "port"); > +cmdline_parse_token_num_t cmd_tx_done_cleanup_port_id =3D > + TOKEN_NUM_INITIALIZER(struct cmd_tx_done_cleanup_result, port_id, > + UINT16); > +cmdline_parse_token_num_t cmd_tx_done_cleanup_queue_id =3D > + TOKEN_NUM_INITIALIZER(struct cmd_tx_done_cleanup_result, > queue_id, > + UINT16); > +cmdline_parse_token_num_t cmd_tx_done_cleanup_free_cnt =3D > + TOKEN_NUM_INITIALIZER(struct cmd_tx_done_cleanup_result, > free_cnt, > + UINT32); > + > +cmdline_parse_inst_t cmd_tx_done_cleanup =3D { > + .f =3D cmd_tx_done_cleanup_parsed, > + .data =3D NULL, > + .help_str =3D "tx_done_cleanup port ", > + .tokens =3D { > + (void *)&cmd_tx_done_cleanup_clean, > + (void *)&cmd_tx_done_cleanup_port, > + (void *)&cmd_tx_done_cleanup_port_id, > + (void *)&cmd_tx_done_cleanup_queue_id, > + (void *)&cmd_tx_done_cleanup_free_cnt, > + NULL, > + }, > +}; > + > /* > ***************************************************************** > *************** */ >=20 > /* list of instructions */ > @@ -17035,6 +17125,7 @@ cmdline_parse_ctx_t main_ctx[] =3D { > (cmdline_parse_inst_t *)&cmd_config_rss_reta, > (cmdline_parse_inst_t *)&cmd_showport_reta, > (cmdline_parse_inst_t *)&cmd_showport_macs, > + (cmdline_parse_inst_t *)&cmd_tx_done_cleanup, > (cmdline_parse_inst_t *)&cmd_config_burst, > (cmdline_parse_inst_t *)&cmd_config_thresh, > (cmdline_parse_inst_t *)&cmd_config_threshold, diff --git > a/doc/guides/rel_notes/release_21_05.rst > b/doc/guides/rel_notes/release_21_05.rst > index 23f7f0b..8077573 100644 > --- a/doc/guides/rel_notes/release_21_05.rst > +++ b/doc/guides/rel_notes/release_21_05.rst > @@ -69,6 +69,8 @@ New Features >=20 > * Added command to display Rx queue used descriptor count. > ``show port (port_id) rxq (queue_id) desc used count`` > + * Added command to cleanup a Tx queue's mbuf on a port. > + ``tx_done_cleanup port `` >=20 >=20 > Removed Items > diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > index f59eb8a..39281f5 100644 > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > @@ -272,6 +272,13 @@ and ready to be processed by the driver on a given R= X > queue:: >=20 > testpmd> show port (port_id) rxq (queue_id) desc used count >=20 > +cleanup txq mbufs > +~~~~~~~~~~~~~~~~~~~~~~~~ > + > +Request the driver to free mbufs currently cached by the driver for a > +given port's Tx queue:: > + testpmd> tx_done_cleanup port (port_id) (queue_id) (free_cnt) > + > show config > ~~~~~~~~~~~ >=20 > -- > 2.7.4