Test-Label: iol-testing Test-Status: WARNING http://dpdk.org/patch/112721 _apply patch failure_ Submitter: Spike Du Date: Tuesday, June 14 2022 12:01:34 Applied on: CommitID:f940a2e333e3c65ffb53b76bd7b3536084b1acbf Apply patch set 112721 failed: Checking patch app/test-pmd/testpmd.c... error: while searching for: break; printf("Received avail_thresh event, port:%d rxq_id:%d\n", port_id, rxq_id); } break; default: error: patch failed: app/test-pmd/testpmd.c:3659 Checking patch doc/guides/nics/mlx5.rst... error: while searching for: Meson detects ``libmtcr_ul`` existence at configure stage. If the library is detected, the application must link with ``-lmtcr_ul``, as done by the pkg-config file libdpdk.pc. error: patch failed: doc/guides/nics/mlx5.rst:1727 Checking patch drivers/net/mlx5/meson.build... Checking patch drivers/net/mlx5/mlx5_testpmd.c... .git/rebase-apply/patch:314: new blank line at EOF. + Checking patch drivers/net/mlx5/mlx5_testpmd.h... Applying patch app/test-pmd/testpmd.c with 1 reject... Hunk #1 applied cleanly. Rejected hunk #2. Applying patch doc/guides/nics/mlx5.rst with 1 reject... Rejected hunk #1. Applied patch drivers/net/mlx5/meson.build cleanly. Applied patch drivers/net/mlx5/mlx5_testpmd.c cleanly. Applied patch drivers/net/mlx5/mlx5_testpmd.h cleanly. diff a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c (rejected hunks) @@ -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 } break; default: diff a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst (rejected hunks) @@ -1727,3 +1727,49 @@ which can be installed from OFED mstflint package. Meson detects ``libmtcr_ul`` existence at configure stage. If the library is detected, the application must link with ``-lmtcr_ul``, as done by the pkg-config file libdpdk.pc. + +How to use available descriptor threshold and Host Shaper +------------------------------ + +There are sample command lines to configure available descriptor threshold in testpmd. +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 +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, +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: + +.. 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 https://lab.dpdk.org/results/dashboard/patchsets/22598/ UNH-IOL DPDK Community Lab