sch_ets.sh 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #!/bin/bash
  2. # SPDX-License-Identifier: GPL-2.0
  3. # A driver for the ETS selftest that implements testing in offloaded datapath.
  4. lib_dir=$(dirname $0)/../../../net/forwarding
  5. source $lib_dir/sch_ets_core.sh
  6. source $lib_dir/devlink_lib.sh
  7. ALL_TESTS="
  8. ping_ipv4
  9. priomap_mode
  10. ets_test_strict
  11. ets_test_mixed
  12. ets_test_dwrr
  13. "
  14. PARENT="parent 3:3"
  15. switch_create()
  16. {
  17. # Create a bottleneck so that the DWRR process can kick in.
  18. tc qdisc replace dev $swp2 root handle 3: tbf rate 1gbit \
  19. burst 128K limit 1G
  20. ets_switch_create
  21. # Set the ingress quota high and use the three egress TCs to limit the
  22. # amount of traffic that is admitted to the shared buffers. This makes
  23. # sure that there is always enough traffic of all types to select from
  24. # for the DWRR process.
  25. devlink_port_pool_th_save $swp1 0
  26. devlink_port_pool_th_set $swp1 0 12
  27. devlink_tc_bind_pool_th_save $swp1 0 ingress
  28. devlink_tc_bind_pool_th_set $swp1 0 ingress 0 12
  29. devlink_port_pool_th_save $swp2 4
  30. devlink_port_pool_th_set $swp2 4 12
  31. devlink_tc_bind_pool_th_save $swp2 7 egress
  32. devlink_tc_bind_pool_th_set $swp2 7 egress 4 5
  33. devlink_tc_bind_pool_th_save $swp2 6 egress
  34. devlink_tc_bind_pool_th_set $swp2 6 egress 4 5
  35. devlink_tc_bind_pool_th_save $swp2 5 egress
  36. devlink_tc_bind_pool_th_set $swp2 5 egress 4 5
  37. # Note: sch_ets_core.sh uses VLAN ingress-qos-map to assign packet
  38. # priorities at $swp1 based on their 802.1p headers. ingress-qos-map is
  39. # not offloaded by mlxsw as of this writing, but the mapping used is
  40. # 1:1, which is the mapping currently hard-coded by the driver.
  41. }
  42. switch_destroy()
  43. {
  44. devlink_tc_bind_pool_th_restore $swp2 5 egress
  45. devlink_tc_bind_pool_th_restore $swp2 6 egress
  46. devlink_tc_bind_pool_th_restore $swp2 7 egress
  47. devlink_port_pool_th_restore $swp2 4
  48. devlink_tc_bind_pool_th_restore $swp1 0 ingress
  49. devlink_port_pool_th_restore $swp1 0
  50. ets_switch_destroy
  51. tc qdisc del dev $swp2 root handle 3:
  52. }
  53. # Callback from sch_ets_tests.sh
  54. collect_stats()
  55. {
  56. local -a streams=("$@")
  57. local stream
  58. # Wait for qdisc counter update so that we don't get it mid-way through.
  59. busywait_for_counter 1000 +1 \
  60. qdisc_parent_stats_get $swp2 10:$((${streams[0]} + 1)) .bytes \
  61. > /dev/null
  62. for stream in ${streams[@]}; do
  63. qdisc_parent_stats_get $swp2 10:$((stream + 1)) .bytes
  64. done
  65. }
  66. bail_on_lldpad "configure DCB" "configure Qdiscs"
  67. ets_run