Skip to content

Commit 625af9f

Browse files
peilin-yedavem330
authored andcommitted
tc-testing: Add control-plane selftests for sch_mq
Recently we added multi-queue support to netdevsim in commit d4861fc ("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 <[email protected]> Signed-off-by: Peilin Ye <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a54182b commit 625af9f

File tree

2 files changed

+138
-0
lines changed

2 files changed

+138
-0
lines changed
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
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+
]

tools/testing/selftests/tc-testing/tdc_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
'DEV1': 'v0p1',
1818
'DEV2': '',
1919
'DUMMY': 'dummy1',
20+
'ETH': 'eth0',
2021
'BATCH_FILE': './batch.txt',
2122
'BATCH_DIR': 'tmp',
2223
# Length of time in seconds to wait before terminating a command

0 commit comments

Comments
 (0)