> -----Original Message----- > From: Singh, Aman Deep <aman.deep.si...@intel.com> > Sent: Tuesday, June 14, 2022 5:44 PM > To: Spike Du <spi...@nvidia.com>; Matan Azrad <ma...@nvidia.com>; > Slava Ovsiienko <viachesl...@nvidia.com>; Ori Kam <or...@nvidia.com>; > NBU-Contact-Thomas Monjalon (EXTERNAL) <tho...@monjalon.net>; > Wenzhuo Lu <wenzhuo...@intel.com>; Beilei Xing <beilei.x...@intel.com>; > Bernard Iremonger <bernard.iremon...@intel.com>; Shahaf Shuler > <shah...@nvidia.com> > Cc: andrew.rybche...@oktetlabs.ru; step...@networkplumber.org; > m...@smartsharesystems.com; dev@dpdk.org; Raslan Darawsheh > <rasl...@nvidia.com> > Subject: Re: [PATCH v6] app/testpmd: add Host Shaper command > > External email: Use caution opening links or attachments > > > 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>
Sorry, it is test code that I should remove. The check of mlx5 driver_name Is done in mlx5_test_avail_thresh_event_handler(), if the port is not mlx5 port, We simply return there. Will update the patch soon, thanks for the catch!