Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: concurrency: add test to verify concurrent replace

Implement test that verifies concurrent replacement of rules by executing
10 tc instances that replace flower filters in same handle range.

Extend tdc_multibatch.py script with new optional CLI argument that is used
to generate all batch files with same filter handle range.

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Vlad Buslov and committed by
David S. Miller
424c5bd4 4ba21de2

+33 -1
+25
tools/testing/selftests/tc-testing/tc-tests/filters/concurrency.json
··· 71 71 "$TC qdisc del dev $DEV2 ingress", 72 72 "/bin/rm -rf $BATCH_DIR" 73 73 ] 74 + }, 75 + { 76 + "id": "14be", 77 + "name": "Concurrently replace same range of 100k flower filters from 10 tc instances", 78 + "category": [ 79 + "filter", 80 + "flower", 81 + "concurrency" 82 + ], 83 + "setup": [ 84 + "/bin/mkdir $BATCH_DIR", 85 + "$TC qdisc add dev $DEV2 ingress", 86 + "./tdc_multibatch.py $DEV2 $BATCH_DIR 100000 1 add", 87 + "$TC -b $BATCH_DIR/add_0", 88 + "./tdc_multibatch.py -d $DEV2 $BATCH_DIR 100000 10 replace" 89 + ], 90 + "cmdUnderTest": "find $BATCH_DIR/replace* -print | xargs -n 1 -P 10 $TC -b", 91 + "expExitCode": "0", 92 + "verifyCmd": "$TC -s filter show dev $DEV2 ingress", 93 + "matchPattern": "filter protocol ip pref 1 flower chain 0 handle", 94 + "matchCount": "100000", 95 + "teardown": [ 96 + "$TC qdisc del dev $DEV2 ingress", 97 + "/bin/rm -rf $BATCH_DIR" 98 + ] 74 99 } 75 100 ]
+8 -1
tools/testing/selftests/tc-testing/tdc_multibatch.py
··· 21 21 "operation", 22 22 choices=['add', 'del', 'replace'], 23 23 help="operation to perform on filters") 24 + parser.add_argument( 25 + "-d", 26 + "--duplicate_handles", 27 + action="store_true", 28 + help="duplicate filter handle range in all files") 24 29 args = parser.parse_args() 25 30 26 31 device = args.device ··· 34 29 num_filters = args.num_filters 35 30 num_files = args.num_files 36 31 operation = args.operation 32 + duplicate_handles = args.duplicate_handles 37 33 handle = 1 38 34 39 35 for i in range(num_files): 40 36 file = dir + '/' + file_prefix + str(i) 41 37 os.system("./tdc_batch.py -n {} -a {} -e {} -m {} {} {}".format( 42 38 num_filters, handle, operation, i, device, file)) 43 - handle += num_filters 39 + if not duplicate_handles: 40 + handle += num_filters