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

tc-testing: Add control-plane selftests for sch_mq

Recently we added multi-queue support to netdevsim in commit d4861fc6be58
("netdevsim: Add multi-queue support"); add a few control-plane selftests
for sch_mq using this new feature.

Use nsPlugin.py to avoid network interface name collisions.

Reviewed-by: Cong Wang <cong.wang@bytedance.com>
Signed-off-by: Peilin Ye <peilin.ye@bytedance.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Peilin Ye and committed by
David S. Miller
625af9f0 a54182b2

+138
+137
tools/testing/selftests/tc-testing/tc-tests/qdiscs/mq.json
··· 1 + [ 2 + { 3 + "id": "ce7d", 4 + "name": "Add mq Qdisc to multi-queue device (4 queues)", 5 + "category": [ 6 + "qdisc", 7 + "mq" 8 + ], 9 + "plugins": { 10 + "requires": "nsPlugin" 11 + }, 12 + "setup": [ 13 + "echo \"1 1 4\" > /sys/bus/netdevsim/new_device" 14 + ], 15 + "cmdUnderTest": "$TC qdisc add dev $ETH root handle 1: mq", 16 + "expExitCode": "0", 17 + "verifyCmd": "$TC qdisc show dev $ETH", 18 + "matchPattern": "qdisc pfifo_fast 0: parent 1:[1-4] bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1", 19 + "matchCount": "4", 20 + "teardown": [ 21 + "echo \"1\" > /sys/bus/netdevsim/del_device" 22 + ] 23 + }, 24 + { 25 + "id": "2f82", 26 + "name": "Add mq Qdisc to multi-queue device (256 queues)", 27 + "category": [ 28 + "qdisc", 29 + "mq" 30 + ], 31 + "plugins": { 32 + "requires": "nsPlugin" 33 + }, 34 + "setup": [ 35 + "echo \"1 1 256\" > /sys/bus/netdevsim/new_device" 36 + ], 37 + "cmdUnderTest": "$TC qdisc add dev $ETH root handle 1: mq", 38 + "expExitCode": "0", 39 + "verifyCmd": "$TC qdisc show dev $ETH", 40 + "matchPattern": "qdisc pfifo_fast 0: parent 1:[1-9,a-f][0-9,a-f]{0,2} bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1", 41 + "matchCount": "256", 42 + "teardown": [ 43 + "echo \"1\" > /sys/bus/netdevsim/del_device" 44 + ] 45 + }, 46 + { 47 + "id": "c525", 48 + "name": "Add duplicate mq Qdisc", 49 + "category": [ 50 + "qdisc", 51 + "mq" 52 + ], 53 + "plugins": { 54 + "requires": "nsPlugin" 55 + }, 56 + "setup": [ 57 + "echo \"1 1 4\" > /sys/bus/netdevsim/new_device", 58 + "$TC qdisc add dev $ETH root handle 1: mq" 59 + ], 60 + "cmdUnderTest": "$TC qdisc add dev $ETH root handle 1: mq", 61 + "expExitCode": "2", 62 + "verifyCmd": "$TC qdisc show dev $ETH", 63 + "matchPattern": "qdisc pfifo_fast 0: parent 1:[1-4] bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1", 64 + "matchCount": "4", 65 + "teardown": [ 66 + "echo \"1\" > /sys/bus/netdevsim/del_device" 67 + ] 68 + }, 69 + { 70 + "id": "128a", 71 + "name": "Delete nonexistent mq Qdisc", 72 + "category": [ 73 + "qdisc", 74 + "mq" 75 + ], 76 + "plugins": { 77 + "requires": "nsPlugin" 78 + }, 79 + "setup": [ 80 + "echo \"1 1 4\" > /sys/bus/netdevsim/new_device" 81 + ], 82 + "cmdUnderTest": "$TC qdisc del dev $ETH root handle 1: mq", 83 + "expExitCode": "2", 84 + "verifyCmd": "$TC qdisc show dev $ETH", 85 + "matchPattern": "qdisc pfifo_fast 0: parent 1:[1-4] bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1", 86 + "matchCount": "0", 87 + "teardown": [ 88 + "echo \"1\" > /sys/bus/netdevsim/del_device" 89 + ] 90 + }, 91 + { 92 + "id": "03a9", 93 + "name": "Delete mq Qdisc twice", 94 + "category": [ 95 + "qdisc", 96 + "mq" 97 + ], 98 + "plugins": { 99 + "requires": "nsPlugin" 100 + }, 101 + "setup": [ 102 + "echo \"1 1 4\" > /sys/bus/netdevsim/new_device", 103 + "$TC qdisc add dev $ETH root handle 1: mq", 104 + "$TC qdisc del dev $ETH root handle 1: mq" 105 + ], 106 + "cmdUnderTest": "$TC qdisc del dev $ETH root handle 1: mq", 107 + "expExitCode": "2", 108 + "verifyCmd": "$TC qdisc show dev $ETH", 109 + "matchPattern": "qdisc pfifo_fast 0: parent 1:[1-4] bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1", 110 + "matchCount": "0", 111 + "teardown": [ 112 + "echo \"1\" > /sys/bus/netdevsim/del_device" 113 + ] 114 + }, 115 + { 116 + "id": "be0f", 117 + "name": "Add mq Qdisc to single-queue device", 118 + "category": [ 119 + "qdisc", 120 + "mq" 121 + ], 122 + "plugins": { 123 + "requires": "nsPlugin" 124 + }, 125 + "setup": [ 126 + "echo \"1 1\" > /sys/bus/netdevsim/new_device" 127 + ], 128 + "cmdUnderTest": "$TC qdisc add dev $ETH root handle 1: mq", 129 + "expExitCode": "2", 130 + "verifyCmd": "$TC qdisc show dev $ETH", 131 + "matchPattern": "qdisc pfifo_fast 0: parent 1:[1-4] bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1", 132 + "matchCount": "0", 133 + "teardown": [ 134 + "echo \"1\" > /sys/bus/netdevsim/del_device" 135 + ] 136 + } 137 + ]
+1
tools/testing/selftests/tc-testing/tdc_config.py
··· 17 17 'DEV1': 'v0p1', 18 18 'DEV2': '', 19 19 'DUMMY': 'dummy1', 20 + 'ETH': 'eth0', 20 21 'BATCH_FILE': './batch.txt', 21 22 'BATCH_DIR': 'tmp', 22 23 # Length of time in seconds to wait before terminating a command