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 763E7A0548; Wed, 15 Jun 2022 13:08:27 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 19F4F40220; Wed, 15 Jun 2022 13:08:27 +0200 (CEST) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by mails.dpdk.org (Postfix) with ESMTP id DDFA540040 for ; Wed, 15 Jun 2022 13:08:24 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 6F5523200934; Wed, 15 Jun 2022 07:08:22 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 15 Jun 2022 07:08:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1655291301; x= 1655377701; bh=IkKoJJl51fQ2M6dSfqa8X7UImF8BedwWYFQ/Jhwa6SE=; b=k 7ROMNK0LTDc4JUuEveTl74ininu3xAjKEP4B95/My/5OSDwar7/UP3R81/NcNORQ 8bAmvCY46m0/IRseYGs8L8oQAqZLf0axqyIRqOfXoe/wJnLo4mjmmCi2i7wBYzFv OoanRP+wuHmJfkcrtQe+hKvn2taV/Wis4Q3AAPzO6ekfVTYTQ4/2I0UObeGUERb3 0dZIrLs8lwsP6QJiFic0zs+LOgQukQcEk7SOKwP5usy/6LN+QeuZuka6hfeDmaWD hGzuuFwtcxKifFtUWXdtGwbuvx0ZGgeT8qjlUV10B22kXOgT2a1QtA11Nk35QraT wfDJsT5T+1zWGJmYuBT0A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1655291301; x= 1655377701; bh=IkKoJJl51fQ2M6dSfqa8X7UImF8BedwWYFQ/Jhwa6SE=; b=n jEtNrtUBDI8vca1gAlCqhm/AGDeZ6Di9AFM8jvdie/ULAIIb2WTO3W2GWO9Q0NUF 28cejYehtx758xpjZLOQQOK92vkMNw9S3/JgC8UxkAah8TtqeE9HEK05Gxlqu+3Z XUBo4AKXnAhhmQdvWBLl1pG8pB0Pu+LO6VqtbCi9xA33RAdpv3h5PUcFzZk+WEVT UbBNjQjT+ssNOpz4E7PW2aKizw+Rh9nk6kB718GVvebIJuci2o+ugNI1JCEaIDyu +OfJvzXe7lRfqwg9014yqgBwTZcPja6oGtpGxD3ELTomVrUVbCUbp0CCMbqPHcte AwPO5ZpQb3bCu/3bwvzWg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedruddvuddgfeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpedtjeeiieefhedtfffgvdelteeufeefheeujefgueetfedttdei kefgkeduhedtgfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 15 Jun 2022 07:08:19 -0400 (EDT) From: Thomas Monjalon To: matan@nvidia.com, viacheslavo@nvidia.com, orika@nvidia.com, Spike Du Cc: Wenzhuo Lu , Beilei Xing , Bernard Iremonger , Shahaf Shuler , dev@dpdk.org, andrew.rybchenko@oktetlabs.ru, stephen@networkplumber.org, mb@smartsharesystems.com, dev@dpdk.org, rasland@nvidia.com Subject: Re: [PATCH v7] app/testpmd: add Host Shaper command Date: Wed, 15 Jun 2022 13:08:16 +0200 Message-ID: <8390242.T7Z3S40VBb@thomas> In-Reply-To: <20220614120134.1828188-2-spiked@nvidia.com> References: <20220613025006.1596552-2-spiked@nvidia.com> <20220614120134.1828188-1-spiked@nvidia.com> <20220614120134.1828188-2-spiked@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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 Few comments below, 14/06/2022 14:01, Spike Du: > Add command line options to support host shaper configure. > - Command syntax: > mlx5 set port host_shaper avail_thresh_triggered <0|1> rate > > > - Example commands: > To enable avail_thresh_triggered on port 1 and disable current host > shaper: > testpmd> mlx5 set port 1 host_shaper avail_thresh_triggered 1 rate 0 > > To disable avail_thresh_triggered and current host shaper on port 1: > testpmd> mlx5 set port 1 host_shaper avail_thresh_triggered 0 rate 0 > > The rate unit is 100Mbps. > To disable avail_thresh_triggered and configure a shaper of 5Gbps on > port 1: > testpmd> mlx5 set port 1 host_shaper avail_thresh_triggered 0 rate 50 > > Add sample code to handle rxq available descriptor threshold event, it > delays a while so that rxq empties, then disables host shaper and > rearms available descriptor threshold event. > > Signed-off-by: Spike Du [...] > @@ -3659,6 +3662,10 @@ struct pmd_test_command { > break; > printf("Received avail_thresh event, port:%d rxq_id:%d\n", > port_id, rxq_id); > + > +#ifdef RTE_NET_MLX5 > + mlx5_test_avail_thresh_event_handler(port_id, rxq_id); > +#endif This function includes a check of the driver in use for the port, so I assume it is OK to call it unconditionally here. [...] > +How to use available descriptor threshold and Host Shaper > +------------------------------ Underlining should be of same size as the title. > + > +There are sample command lines to configure available descriptor threshold in testpmd. Simpler: There is a command to configure available descriptor threshold in testpmd. You could add a link here to the doc of the command. > +Testpmd also contains sample logic to handle available descriptor threshold event. > +The typical workflow is: testpmd configure available descriptor threshold for Rx queues, enable > +avail_thresh_triggered in host shaper and register a callback, when traffic from host is > +too high and Rx queue emptiness is below available descriptor threshold, PMD receives an event and > +firmware configures a 100Mbps shaper on host port automatically, then PMD call > +the callback registered previously, which will delay a while to let Rx queue > +empty, then disable host shaper. > + > +Let's assume we have a simple Blue Field 2 setup: port 0 is uplink, port 1 There's no space in BlueField. > +is VF representor. Each port has 2 Rx queues. > +In order to control traffic from host to ARM, we can enable available descriptor threshold in testpmd by: > + > +.. code-block:: console > + > + testpmd> mlx5 set port 1 host_shaper avail_thresh_triggered 1 rate 0 > + testpmd> set port 1 rxq 0 avail_thresh 70 > + testpmd> set port 1 rxq 1 avail_thresh 70 > + > +The first command disables current host shaper, and enables available descriptor threshold triggered mode. > +The left commands configure available descriptor threshold to 70% of Rx queue size for both Rx queues, left -> other > +When traffic from host is too high, you can see testpmd console prints log > +about available descriptor threshold event receiving, then host shaper is disabled. > +The traffic rate from host is controlled and less drop happens in Rx queues. > + > +When disable available descriptor threshold and avail_thresh_triggered, we can invoke below commands in testpmd: Reword: The threshold event and shaper can be disabled like this: > + > +.. code-block:: console > + > + testpmd> mlx5 set port 1 host_shaper avail_thresh_triggered 0 rate 0 > + testpmd> set port 1 rxq 0 avail_thresh 0 > + testpmd> set port 1 rxq 1 avail_thresh 0 > + > +It's recommended an application disables available descriptor threshold and avail_thresh_triggered before exit, > +if it enables them before. > + > +We can also configure the shaper with a value, the rate unit is 100Mbps, below > +command sets current shaper to 5Gbps and disables avail_thresh_triggered. > + > +.. code-block:: console > + > + testpmd> mlx5 set port 1 host_shaper avail_thresh_triggered 0 rate 50