Hi Spike,
On 6/13/2022 8:20 AM, Spike Du wrote:
Add command line options to support host shaper configure.
- Command syntax:
mlx5 set port <port_id> host_shaper avail_thresh_triggered <0|1> rate
<rate_num>
- 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 <spi...@nvidia.com>
---
app/test-pmd/testpmd.c | 11 +++
doc/guides/nics/mlx5.rst | 46 +++++++++
drivers/net/mlx5/meson.build | 4 +
drivers/net/mlx5/mlx5_testpmd.c | 206 ++++++++++++++++++++++++++++++++++++++++
drivers/net/mlx5/mlx5_testpmd.h | 26 +++++
5 files changed, 293 insertions(+)
create mode 100644 drivers/net/mlx5/mlx5_testpmd.c
create mode 100644 drivers/net/mlx5/mlx5_testpmd.h
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 33d9b85..e1ac75a 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -69,6 +69,9 @@
#ifdef RTE_NET_BOND
#include <rte_eth_bond.h>
#endif
+#ifdef RTE_NET_MLX5
+#include "mlx5_testpmd.h"
+#endif
#include "testpmd.h"
@@ -3659,6 +3662,14 @@ struct pmd_test_command {
break;
printf("Received avail_thresh event, port:%d
rxq_id:%d\n",
port_id, rxq_id);
+
+ struct rte_eth_dev_info dev_info;
+ if (rte_eth_dev_info_get(port_id, &dev_info) != 0 ||
+ (strncmp(dev_info.driver_name, "mlx5", 4) != 0))
+ printf("%s\n", dev_info.driver_name);
+#ifdef RTE_NET_MLX5
+ mlx5_test_avail_thresh_event_handler(port_id, rxq_id);
+#endif
}
Wanted to check the intend of above "if-statement". Currently i think only
print() is dependent on it.
Do we want to call mlx5 event_handler, only if driver_name is mlx5 ?
break;
default:
<snip>