@@ -110,6 +110,23 @@ def qstat_by_ifindex(cfg) -> None:
110
110
ksft_ge (triple [1 ][key ], triple [0 ][key ], comment = "bad key: " + key )
111
111
ksft_ge (triple [2 ][key ], triple [1 ][key ], comment = "bad key: " + key )
112
112
113
+ # Sanity check the dumps
114
+ queues = NetdevFamily (recv_size = 4096 ).qstats_get ({"scope" : "queue" }, dump = True )
115
+ # Reformat the output into {ifindex: {rx: [id, id, ...], tx: [id, id, ...]}}
116
+ parsed = {}
117
+ for entry in queues :
118
+ ifindex = entry ["ifindex" ]
119
+ if ifindex not in parsed :
120
+ parsed [ifindex ] = {"rx" :[], "tx" : []}
121
+ parsed [ifindex ][entry ["queue-type" ]].append (entry ['queue-id' ])
122
+ # Now, validate
123
+ for ifindex , queues in parsed .items ():
124
+ for qtype in ['rx' , 'tx' ]:
125
+ ksft_eq (len (queues [qtype ]), len (set (queues [qtype ])),
126
+ comment = "repeated queue keys" )
127
+ ksft_eq (len (queues [qtype ]), max (queues [qtype ]) + 1 ,
128
+ comment = "missing queue keys" )
129
+
113
130
# Test invalid dumps
114
131
# 0 is invalid
115
132
with ksft_raises (NlError ) as cm :
@@ -158,7 +175,7 @@ def check_down(cfg) -> None:
158
175
159
176
160
177
def main () -> None :
161
- with NetDrvEnv (__file__ ) as cfg :
178
+ with NetDrvEnv (__file__ , queue_count = 100 ) as cfg :
162
179
ksft_run ([check_pause , check_fec , pkt_byte_sum , qstat_by_ifindex ,
163
180
check_down ],
164
181
args = (cfg , ))
0 commit comments