tc_sample.sh 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. #!/bin/bash
  2. # SPDX-License-Identifier: GPL-2.0
  3. #
  4. # Test that packets are sampled when tc-sample is used and that reported
  5. # metadata is correct. Two sets of hosts (with and without LAG) are used, since
  6. # metadata extraction in mlxsw is a bit different when LAG is involved.
  7. #
  8. # +---------------------------------+ +---------------------------------+
  9. # | H1 (vrf) | | H3 (vrf) |
  10. # | + $h1 | | + $h3_lag |
  11. # | | 192.0.2.1/28 | | | 192.0.2.17/28 |
  12. # | | | | | |
  13. # | | default via 192.0.2.2 | | | default via 192.0.2.18 |
  14. # +----|----------------------------+ +----|----------------------------+
  15. # | |
  16. # +----|-----------------------------------------|----------------------------+
  17. # | | 192.0.2.2/28 | 192.0.2.18/28 |
  18. # | + $rp1 + $rp3_lag |
  19. # | |
  20. # | + $rp2 + $rp4_lag |
  21. # | | 198.51.100.2/28 | 198.51.100.18/28 |
  22. # +----|-----------------------------------------|----------------------------+
  23. # | |
  24. # +----|----------------------------+ +----|----------------------------+
  25. # | | default via 198.51.100.2 | | | default via 198.51.100.18 |
  26. # | | | | | |
  27. # | | 198.51.100.1/28 | | | 198.51.100.17/28 |
  28. # | + $h2 | | + $h4_lag |
  29. # | H2 (vrf) | | H4 (vrf) |
  30. # +---------------------------------+ +---------------------------------+
  31. lib_dir=$(dirname $0)/../../../net/forwarding
  32. ALL_TESTS="
  33. tc_sample_rate_test
  34. tc_sample_max_rate_test
  35. tc_sample_conflict_test
  36. tc_sample_group_conflict_test
  37. tc_sample_md_iif_test
  38. tc_sample_md_lag_iif_test
  39. tc_sample_md_oif_test
  40. tc_sample_md_lag_oif_test
  41. tc_sample_md_out_tc_test
  42. tc_sample_md_out_tc_occ_test
  43. tc_sample_md_latency_test
  44. tc_sample_acl_group_conflict_test
  45. tc_sample_acl_rate_test
  46. tc_sample_acl_max_rate_test
  47. "
  48. NUM_NETIFS=8
  49. CAPTURE_FILE=$(mktemp)
  50. source $lib_dir/lib.sh
  51. source $lib_dir/devlink_lib.sh
  52. source mlxsw_lib.sh
  53. # Available at https://github.com/Mellanox/libpsample
  54. require_command psample
  55. h1_create()
  56. {
  57. simple_if_init $h1 192.0.2.1/28
  58. ip -4 route add default vrf v$h1 nexthop via 192.0.2.2
  59. }
  60. h1_destroy()
  61. {
  62. ip -4 route del default vrf v$h1 nexthop via 192.0.2.2
  63. simple_if_fini $h1 192.0.2.1/28
  64. }
  65. h2_create()
  66. {
  67. simple_if_init $h2 198.51.100.1/28
  68. ip -4 route add default vrf v$h2 nexthop via 198.51.100.2
  69. }
  70. h2_destroy()
  71. {
  72. ip -4 route del default vrf v$h2 nexthop via 198.51.100.2
  73. simple_if_fini $h2 198.51.100.1/28
  74. }
  75. h3_create()
  76. {
  77. ip link set dev $h3 down
  78. ip link add name ${h3}_bond type bond mode 802.3ad
  79. ip link set dev $h3 master ${h3}_bond
  80. simple_if_init ${h3}_bond 192.0.2.17/28
  81. ip -4 route add default vrf v${h3}_bond nexthop via 192.0.2.18
  82. }
  83. h3_destroy()
  84. {
  85. ip -4 route del default vrf v${h3}_bond nexthop via 192.0.2.18
  86. simple_if_fini ${h3}_bond 192.0.2.17/28
  87. ip link set dev $h3 nomaster
  88. ip link del dev ${h3}_bond
  89. }
  90. h4_create()
  91. {
  92. ip link set dev $h4 down
  93. ip link add name ${h4}_bond type bond mode 802.3ad
  94. ip link set dev $h4 master ${h4}_bond
  95. simple_if_init ${h4}_bond 198.51.100.17/28
  96. ip -4 route add default vrf v${h4}_bond nexthop via 198.51.100.18
  97. }
  98. h4_destroy()
  99. {
  100. ip -4 route del default vrf v${h4}_bond nexthop via 198.51.100.18
  101. simple_if_fini ${h4}_bond 198.51.100.17/28
  102. ip link set dev $h4 nomaster
  103. ip link del dev ${h4}_bond
  104. }
  105. router_create()
  106. {
  107. ip link set dev $rp1 up
  108. __addr_add_del $rp1 add 192.0.2.2/28
  109. tc qdisc add dev $rp1 clsact
  110. ip link set dev $rp2 up
  111. __addr_add_del $rp2 add 198.51.100.2/28
  112. tc qdisc add dev $rp2 clsact
  113. ip link add name ${rp3}_bond type bond mode 802.3ad
  114. ip link set dev $rp3 master ${rp3}_bond
  115. __addr_add_del ${rp3}_bond add 192.0.2.18/28
  116. tc qdisc add dev $rp3 clsact
  117. ip link set dev ${rp3}_bond up
  118. ip link add name ${rp4}_bond type bond mode 802.3ad
  119. ip link set dev $rp4 master ${rp4}_bond
  120. __addr_add_del ${rp4}_bond add 198.51.100.18/28
  121. tc qdisc add dev $rp4 clsact
  122. ip link set dev ${rp4}_bond up
  123. }
  124. router_destroy()
  125. {
  126. ip link set dev ${rp4}_bond down
  127. tc qdisc del dev $rp4 clsact
  128. __addr_add_del ${rp4}_bond del 198.51.100.18/28
  129. ip link set dev $rp4 nomaster
  130. ip link del dev ${rp4}_bond
  131. ip link set dev ${rp3}_bond down
  132. tc qdisc del dev $rp3 clsact
  133. __addr_add_del ${rp3}_bond del 192.0.2.18/28
  134. ip link set dev $rp3 nomaster
  135. ip link del dev ${rp3}_bond
  136. tc qdisc del dev $rp2 clsact
  137. __addr_add_del $rp2 del 198.51.100.2/28
  138. ip link set dev $rp2 down
  139. tc qdisc del dev $rp1 clsact
  140. __addr_add_del $rp1 del 192.0.2.2/28
  141. ip link set dev $rp1 down
  142. }
  143. setup_prepare()
  144. {
  145. h1=${NETIFS[p1]}
  146. rp1=${NETIFS[p2]}
  147. rp2=${NETIFS[p3]}
  148. h2=${NETIFS[p4]}
  149. h3=${NETIFS[p5]}
  150. rp3=${NETIFS[p6]}
  151. h4=${NETIFS[p7]}
  152. rp4=${NETIFS[p8]}
  153. vrf_prepare
  154. h1_create
  155. h2_create
  156. h3_create
  157. h4_create
  158. router_create
  159. }
  160. cleanup()
  161. {
  162. pre_cleanup
  163. rm -f $CAPTURE_FILE
  164. router_destroy
  165. h4_destroy
  166. h3_destroy
  167. h2_destroy
  168. h1_destroy
  169. vrf_cleanup
  170. }
  171. psample_capture_start()
  172. {
  173. rm -f $CAPTURE_FILE
  174. psample &> $CAPTURE_FILE &
  175. sleep 1
  176. }
  177. psample_capture_stop()
  178. {
  179. { kill %% && wait %%; } 2>/dev/null
  180. }
  181. __tc_sample_rate_test()
  182. {
  183. local desc=$1; shift
  184. local dip=$1; shift
  185. local pkts pct
  186. RET=0
  187. tc filter add dev $rp1 ingress protocol all pref 1 handle 101 matchall \
  188. skip_sw action sample rate 32 group 1
  189. check_err $? "Failed to configure sampling rule"
  190. psample_capture_start
  191. ip vrf exec v$h1 $MZ $h1 -c 320000 -d 100usec -p 64 -A 192.0.2.1 \
  192. -B $dip -t udp dp=52768,sp=42768 -q
  193. psample_capture_stop
  194. pkts=$(grep -e "group 1 " $CAPTURE_FILE | wc -l)
  195. pct=$((100 * (pkts - 10000) / 10000))
  196. (( -25 <= pct && pct <= 25))
  197. check_err $? "Expected 10000 packets, got $pkts packets, which is $pct% off. Required accuracy is +-25%"
  198. log_test "tc sample rate ($desc)"
  199. tc filter del dev $rp1 ingress protocol all pref 1 handle 101 matchall
  200. }
  201. tc_sample_rate_test()
  202. {
  203. __tc_sample_rate_test "forward" 198.51.100.1
  204. __tc_sample_rate_test "local receive" 192.0.2.2
  205. }
  206. tc_sample_max_rate_test()
  207. {
  208. RET=0
  209. tc filter add dev $rp1 ingress protocol all pref 1 handle 101 matchall \
  210. skip_sw action sample rate $((35 * 10 ** 8)) group 1
  211. check_err $? "Failed to configure sampling rule with max rate"
  212. tc filter del dev $rp1 ingress protocol all pref 1 handle 101 matchall
  213. tc filter add dev $rp1 ingress protocol all pref 1 handle 101 matchall \
  214. skip_sw action sample rate $((35 * 10 ** 8 + 1)) \
  215. group 1 &> /dev/null
  216. check_fail $? "Managed to configure sampling rate above maximum"
  217. log_test "tc sample maximum rate"
  218. }
  219. tc_sample_conflict_test()
  220. {
  221. RET=0
  222. # Test that two sampling rules cannot be configured on the same port,
  223. # even when they share the same parameters.
  224. tc filter add dev $rp1 ingress protocol all pref 1 handle 101 matchall \
  225. skip_sw action sample rate 1024 group 1
  226. check_err $? "Failed to configure sampling rule"
  227. tc filter add dev $rp1 ingress protocol all pref 2 handle 102 matchall \
  228. skip_sw action sample rate 1024 group 1 &> /dev/null
  229. check_fail $? "Managed to configure second sampling rule"
  230. # Delete the first rule and make sure the second rule can now be
  231. # configured.
  232. tc filter del dev $rp1 ingress protocol all pref 1 handle 101 matchall
  233. tc filter add dev $rp1 ingress protocol all pref 2 handle 102 matchall \
  234. skip_sw action sample rate 1024 group 1
  235. check_err $? "Failed to configure sampling rule after deletion"
  236. log_test "tc sample conflict test"
  237. tc filter del dev $rp1 ingress protocol all pref 2 handle 102 matchall
  238. }
  239. tc_sample_group_conflict_test()
  240. {
  241. RET=0
  242. # Test that two sampling rules cannot be configured on the same port
  243. # with different groups.
  244. tc filter add dev $rp1 ingress protocol all pref 1 handle 101 matchall \
  245. skip_sw action sample rate 1024 group 1
  246. check_err $? "Failed to configure sampling rule"
  247. tc filter add dev $rp1 ingress protocol all pref 2 handle 102 matchall \
  248. skip_sw action sample rate 1024 group 2 &> /dev/null
  249. check_fail $? "Managed to configure sampling rule with conflicting group"
  250. log_test "tc sample group conflict test"
  251. tc filter del dev $rp1 ingress protocol all pref 1 handle 101 matchall
  252. }
  253. tc_sample_md_iif_test()
  254. {
  255. local rp1_ifindex
  256. RET=0
  257. tc filter add dev $rp1 ingress protocol all pref 1 handle 101 matchall \
  258. skip_sw action sample rate 5 group 1
  259. check_err $? "Failed to configure sampling rule"
  260. psample_capture_start
  261. ip vrf exec v$h1 $MZ $h1 -c 3200 -d 1msec -p 64 -A 192.0.2.1 \
  262. -B 198.51.100.1 -t udp dp=52768,sp=42768 -q
  263. psample_capture_stop
  264. rp1_ifindex=$(ip -j -p link show dev $rp1 | jq '.[]["ifindex"]')
  265. grep -q -e "in-ifindex $rp1_ifindex " $CAPTURE_FILE
  266. check_err $? "Sampled packets do not have expected in-ifindex"
  267. log_test "tc sample iif"
  268. tc filter del dev $rp1 ingress protocol all pref 1 handle 101 matchall
  269. }
  270. tc_sample_md_lag_iif_test()
  271. {
  272. local rp3_ifindex
  273. RET=0
  274. tc filter add dev $rp3 ingress protocol all pref 1 handle 101 matchall \
  275. skip_sw action sample rate 5 group 1
  276. check_err $? "Failed to configure sampling rule"
  277. psample_capture_start
  278. ip vrf exec v${h3}_bond $MZ ${h3}_bond -c 3200 -d 1msec -p 64 \
  279. -A 192.0.2.17 -B 198.51.100.17 -t udp dp=52768,sp=42768 -q
  280. psample_capture_stop
  281. rp3_ifindex=$(ip -j -p link show dev $rp3 | jq '.[]["ifindex"]')
  282. grep -q -e "in-ifindex $rp3_ifindex " $CAPTURE_FILE
  283. check_err $? "Sampled packets do not have expected in-ifindex"
  284. log_test "tc sample lag iif"
  285. tc filter del dev $rp3 ingress protocol all pref 1 handle 101 matchall
  286. }
  287. tc_sample_md_oif_test()
  288. {
  289. local rp2_ifindex
  290. RET=0
  291. tc filter add dev $rp1 ingress protocol all pref 1 handle 101 matchall \
  292. skip_sw action sample rate 5 group 1
  293. check_err $? "Failed to configure sampling rule"
  294. psample_capture_start
  295. ip vrf exec v$h1 $MZ $h1 -c 3200 -d 1msec -p 64 -A 192.0.2.1 \
  296. -B 198.51.100.1 -t udp dp=52768,sp=42768 -q
  297. psample_capture_stop
  298. rp2_ifindex=$(ip -j -p link show dev $rp2 | jq '.[]["ifindex"]')
  299. grep -q -e "out-ifindex $rp2_ifindex " $CAPTURE_FILE
  300. check_err $? "Sampled packets do not have expected out-ifindex"
  301. log_test "tc sample oif"
  302. tc filter del dev $rp1 ingress protocol all pref 1 handle 101 matchall
  303. }
  304. tc_sample_md_lag_oif_test()
  305. {
  306. local rp4_ifindex
  307. RET=0
  308. tc filter add dev $rp3 ingress protocol all pref 1 handle 101 matchall \
  309. skip_sw action sample rate 5 group 1
  310. check_err $? "Failed to configure sampling rule"
  311. psample_capture_start
  312. ip vrf exec v${h3}_bond $MZ ${h3}_bond -c 3200 -d 1msec -p 64 \
  313. -A 192.0.2.17 -B 198.51.100.17 -t udp dp=52768,sp=42768 -q
  314. psample_capture_stop
  315. rp4_ifindex=$(ip -j -p link show dev $rp4 | jq '.[]["ifindex"]')
  316. grep -q -e "out-ifindex $rp4_ifindex " $CAPTURE_FILE
  317. check_err $? "Sampled packets do not have expected out-ifindex"
  318. log_test "tc sample lag oif"
  319. tc filter del dev $rp3 ingress protocol all pref 1 handle 101 matchall
  320. }
  321. tc_sample_md_out_tc_test()
  322. {
  323. RET=0
  324. # Output traffic class is not supported on Spectrum-1.
  325. mlxsw_only_on_spectrum 2+ || return
  326. tc filter add dev $rp1 ingress protocol all pref 1 handle 101 matchall \
  327. skip_sw action sample rate 5 group 1
  328. check_err $? "Failed to configure sampling rule"
  329. # By default, all the packets should go to the same traffic class (0).
  330. psample_capture_start
  331. ip vrf exec v$h1 $MZ $h1 -c 3200 -d 1msec -p 64 -A 192.0.2.1 \
  332. -B 198.51.100.1 -t udp dp=52768,sp=42768 -q
  333. psample_capture_stop
  334. grep -q -e "out-tc 0 " $CAPTURE_FILE
  335. check_err $? "Sampled packets do not have expected out-tc (0)"
  336. # Map all priorities to highest traffic class (7) and check reported
  337. # out-tc.
  338. tc qdisc replace dev $rp2 root handle 1: \
  339. prio bands 3 priomap 0 0 0 0 0 0 0 0
  340. psample_capture_start
  341. ip vrf exec v$h1 $MZ $h1 -c 3200 -d 1msec -p 64 -A 192.0.2.1 \
  342. -B 198.51.100.1 -t udp dp=52768,sp=42768 -q
  343. psample_capture_stop
  344. grep -q -e "out-tc 7 " $CAPTURE_FILE
  345. check_err $? "Sampled packets do not have expected out-tc (7)"
  346. log_test "tc sample out-tc"
  347. tc qdisc del dev $rp2 root handle 1:
  348. tc filter del dev $rp1 ingress protocol all pref 1 handle 101 matchall
  349. }
  350. tc_sample_md_out_tc_occ_test()
  351. {
  352. local backlog pct occ
  353. RET=0
  354. # Output traffic class occupancy is not supported on Spectrum-1.
  355. mlxsw_only_on_spectrum 2+ || return
  356. tc filter add dev $rp1 ingress protocol all pref 1 handle 101 matchall \
  357. skip_sw action sample rate 1024 group 1
  358. check_err $? "Failed to configure sampling rule"
  359. # Configure a shaper on egress to create congestion.
  360. tc qdisc replace dev $rp2 root handle 1: \
  361. tbf rate 1Mbit burst 256k limit 1M
  362. psample_capture_start
  363. ip vrf exec v$h1 $MZ $h1 -c 0 -d 1usec -p 1400 -A 192.0.2.1 \
  364. -B 198.51.100.1 -t udp dp=52768,sp=42768 -q &
  365. # Allow congestion to reach steady state.
  366. sleep 10
  367. backlog=$(tc -j -p -s qdisc show dev $rp2 | jq '.[0]["backlog"]')
  368. # Kill mausezahn.
  369. { kill %% && wait %%; } 2>/dev/null
  370. psample_capture_stop
  371. # Record last congestion sample.
  372. occ=$(grep -e "out-tc-occ " $CAPTURE_FILE | tail -n 1 | \
  373. cut -d ' ' -f 16)
  374. pct=$((100 * (occ - backlog) / backlog))
  375. (( -1 <= pct && pct <= 1))
  376. check_err $? "Recorded a congestion of $backlog bytes, but sampled congestion is $occ bytes, which is $pct% off. Required accuracy is +-5%"
  377. log_test "tc sample out-tc-occ"
  378. tc qdisc del dev $rp2 root handle 1:
  379. tc filter del dev $rp1 ingress protocol all pref 1 handle 101 matchall
  380. }
  381. tc_sample_md_latency_test()
  382. {
  383. RET=0
  384. # Egress sampling not supported on Spectrum-1.
  385. mlxsw_only_on_spectrum 2+ || return
  386. tc filter add dev $rp2 egress protocol all pref 1 handle 101 matchall \
  387. skip_sw action sample rate 5 group 1
  388. check_err $? "Failed to configure sampling rule"
  389. psample_capture_start
  390. ip vrf exec v$h1 $MZ $h1 -c 3200 -d 1msec -p 64 -A 192.0.2.1 \
  391. -B 198.51.100.1 -t udp dp=52768,sp=42768 -q
  392. psample_capture_stop
  393. grep -q -e "latency " $CAPTURE_FILE
  394. check_err $? "Sampled packets do not have latency attribute"
  395. log_test "tc sample latency"
  396. tc filter del dev $rp2 egress protocol all pref 1 handle 101 matchall
  397. }
  398. tc_sample_acl_group_conflict_test()
  399. {
  400. RET=0
  401. # Test that two flower sampling rules cannot be configured on the same
  402. # port with different groups.
  403. # Policy-based sampling is not supported on Spectrum-1.
  404. mlxsw_only_on_spectrum 2+ || return
  405. tc filter add dev $rp1 ingress protocol ip pref 1 handle 101 flower \
  406. skip_sw action sample rate 1024 group 1
  407. check_err $? "Failed to configure sampling rule"
  408. tc filter add dev $rp1 ingress protocol ip pref 2 handle 102 flower \
  409. skip_sw action sample rate 1024 group 1
  410. check_err $? "Failed to configure sampling rule with same group"
  411. tc filter add dev $rp1 ingress protocol ip pref 3 handle 103 flower \
  412. skip_sw action sample rate 1024 group 2 &> /dev/null
  413. check_fail $? "Managed to configure sampling rule with conflicting group"
  414. log_test "tc sample (w/ flower) group conflict test"
  415. tc filter del dev $rp1 ingress protocol ip pref 2 handle 102 flower
  416. tc filter del dev $rp1 ingress protocol ip pref 1 handle 101 flower
  417. }
  418. __tc_sample_acl_rate_test()
  419. {
  420. local bind=$1; shift
  421. local port=$1; shift
  422. local pkts pct
  423. RET=0
  424. # Policy-based sampling is not supported on Spectrum-1.
  425. mlxsw_only_on_spectrum 2+ || return
  426. tc filter add dev $port $bind protocol ip pref 1 handle 101 flower \
  427. skip_sw dst_ip 198.51.100.1 action sample rate 32 group 1
  428. check_err $? "Failed to configure sampling rule"
  429. psample_capture_start
  430. ip vrf exec v$h1 $MZ $h1 -c 320000 -d 100usec -p 64 -A 192.0.2.1 \
  431. -B 198.51.100.1 -t udp dp=52768,sp=42768 -q
  432. psample_capture_stop
  433. pkts=$(grep -e "group 1 " $CAPTURE_FILE | wc -l)
  434. pct=$((100 * (pkts - 10000) / 10000))
  435. (( -25 <= pct && pct <= 25))
  436. check_err $? "Expected 10000 packets, got $pkts packets, which is $pct% off. Required accuracy is +-25%"
  437. # Setup a filter that should not match any packet and make sure packets
  438. # are not sampled.
  439. tc filter del dev $port $bind protocol ip pref 1 handle 101 flower
  440. tc filter add dev $port $bind protocol ip pref 1 handle 101 flower \
  441. skip_sw dst_ip 198.51.100.10 action sample rate 32 group 1
  442. check_err $? "Failed to configure sampling rule"
  443. psample_capture_start
  444. ip vrf exec v$h1 $MZ $h1 -c 3200 -d 1msec -p 64 -A 192.0.2.1 \
  445. -B 198.51.100.1 -t udp dp=52768,sp=42768 -q
  446. psample_capture_stop
  447. grep -q -e "group 1 " $CAPTURE_FILE
  448. check_fail $? "Sampled packets when should not"
  449. log_test "tc sample (w/ flower) rate ($bind)"
  450. tc filter del dev $port $bind protocol ip pref 1 handle 101 flower
  451. }
  452. tc_sample_acl_rate_test()
  453. {
  454. __tc_sample_acl_rate_test ingress $rp1
  455. __tc_sample_acl_rate_test egress $rp2
  456. }
  457. tc_sample_acl_max_rate_test()
  458. {
  459. RET=0
  460. # Policy-based sampling is not supported on Spectrum-1.
  461. mlxsw_only_on_spectrum 2+ || return
  462. tc filter add dev $rp1 ingress protocol ip pref 1 handle 101 flower \
  463. skip_sw action sample rate $((2 ** 24 - 1)) group 1
  464. check_err $? "Failed to configure sampling rule with max rate"
  465. tc filter del dev $rp1 ingress protocol ip pref 1 handle 101 flower
  466. tc filter add dev $rp1 ingress protocol ip pref 1 handle 101 flower \
  467. skip_sw action sample rate $((2 ** 24)) \
  468. group 1 &> /dev/null
  469. check_fail $? "Managed to configure sampling rate above maximum"
  470. log_test "tc sample (w/ flower) maximum rate"
  471. }
  472. trap cleanup EXIT
  473. setup_prepare
  474. setup_wait
  475. tests_run
  476. exit $EXIT_STATUS