forked from dgubanovv/qa-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
drv_settings.py
1947 lines (1655 loc) · 83.9 KB
/
drv_settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"""
THIS SCRIPT MUST BE EXECUTED ON LKP.
"""
import csv
import ipaddress
import json
import numpy
import os
import time
import timeit
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))))
import pytest
from scapy.all import Ether, Dot1Q, IP, UDP, TCP
from collections import OrderedDict
from hlh.register import Register
from tools.atltoolper import AtlTool
from tools.aqpkt import Aqsendp, scapy_pkt_to_aqsendp_str
from tools.command import Command
from tools.constants import LINK_SPEED_NO_LINK, LINK_STATE_UP, LINK_STATE_DOWN, FELICITY_CARDS, \
DIRECTION_TX, DIRECTION_RX, DIRECTION_RXTX, SPEED_TO_MBITS, CARD_FIJI, CARD_ANTIGUA, CARD_NIKKI, \
LINK_SPEED_AUTO, INTERRUPT_TYPE_LEGACY, INTERRUPT_TYPE_MSI, OFFLOADS_STATE_DSBL, OFFLOADS_STATE_TX, \
OFFLOADS_STATE_RX, OFFLOADS_STATE_TX_RX, MTU_16000, MTU_DISABLED, LIN_PAUSE_SYMMETRIC, LIN_PAUSE_SYMMETRIC_RECEIVE, \
LIN_PAUSE_NO, LIN_PAUSE_TRANSMIT
from tools.driver import Driver, DRV_TYPE_KO
from tools.fw_a2_drv_iface_cfg import FirmwareA2Config
from tools.killer import Killer
from tools.ops import OpSystem
from tools.ping import ping
from tools.power import Power
from tools import pcontrol
from tools.scapy_tools import arping, ScapyTools
from tools.tcpdump import Tcpdump
from tools.utils import get_atf_logger
from perf.nuttcp import Nuttcp
from infra.test_base import TestBase, idparametrize
log = get_atf_logger()
def setup_module(module):
# import tools._test_setup # uncomment for manual test setup
os.environ["TEST"] = "drv_settings"
class TestDrvSettings(TestBase):
"""
@description: The TestDrvSettings test is dedicated to verify Driver settings.
@setup: Two Aquantia devices connected back to back.
"""
PRVT_NW_DELAY = 20
IPV4_GATEWAY = "192.168.0.1"
NETMASK_IPV4 = "255.255.255.0"
PREFIX_IPV6 = "64"
PRVT_NW_CMD = "powershell -command \"& {&'Set-NetConnectionProfile' -NetworkCategory Private}\""
IPERF_EXEC_TIME = 7
STATE_DSBL = "Disable"
STATE_ENBL = "Enable"
STATE_ADAPTIVE = "adaptive"
STATE_EXTREME = "extreme"
STATE_HIGH = "high"
STATE_LOW = "low"
STATE_MEDIUM = "medium"
STATE_OFF = "off"
@classmethod
def setup_class(cls):
super(TestDrvSettings, cls).setup_class()
try:
cls.log_server_dir = cls.create_logs_dir_on_log_server()
cls.install_firmwares()
if cls.dut_fw_card not in CARD_FIJI:
cls.dut_atltool_wrapper = AtlTool(port=cls.dut_port, host=cls.dut_hostname)
if cls.lkp_fw_card not in CARD_FIJI:
cls.lkp_atltool_wrapper = AtlTool(port=cls.lkp_port, host=cls.lkp_hostname)
insmod_args = None
flashless_fw = None
if "forwarding" in cls.dut_drv_version:
insmod_args = "rx_linear=1"
if cls.dut_fw_card not in CARD_FIJI and cls.dut_atltool_wrapper.is_secure_chips():
flashless_fw = cls.dut_fw_version
cls.dut_driver = Driver(port=cls.dut_port, version=cls.dut_drv_version, host=cls.dut_hostname,
insmod_args=insmod_args, flashless_fw=flashless_fw)
if cls.platform is not None and 'Tehuti' in cls.platform:
cls.lkp_driver = Driver(port=cls.lkp_port, version="latest", host=cls.lkp_hostname,
drv_type=DRV_TYPE_KO)
else:
cls.lkp_driver = Driver(port=cls.lkp_port, version=cls.lkp_drv_version, host=cls.lkp_hostname)
cls.dut_driver.install()
cls.lkp_driver.install()
cls.DUT_IPV6_ADDR = cls.suggest_test_ip_address(cls.dut_port, cls.dut_hostname, ipv6=True)
cls.LKP_IPV6_ADDR = cls.suggest_test_ip_address(cls.lkp_port, ipv6=True)
cls.DUT_IPV4_ADDR = cls.suggest_test_ip_address(cls.dut_port, cls.dut_hostname)
cls.LKP_IPV4_ADDR = cls.suggest_test_ip_address(cls.lkp_port)
# IPV4_GATEWAY setting on DUT is the workaround
# For some reason Windows do not propagate ARP/NS affloads to the driver if gateway is not set
cls.dut_ifconfig.set_ip_address(cls.DUT_IPV4_ADDR, cls.DEFAULT_NETMASK_IPV4, cls.LKP_IPV4_ADDR)
cls.lkp_ifconfig.set_ip_address(cls.LKP_IPV4_ADDR, cls.DEFAULT_NETMASK_IPV4, None)
cls.dut_ifconfig.set_ipv6_address(cls.DUT_IPV6_ADDR, cls.PREFIX_IPV6, None)
cls.lkp_ifconfig.set_ipv6_address(cls.LKP_IPV6_ADDR, cls.PREFIX_IPV6, None)
time.sleep(cls.LINK_CONFIG_DELAY)
# Remove link local IPs
ipv4 = cls.dut_ifconfig.get_ip_address()
ipv6 = cls.dut_ifconfig.get_ip_address(ipv=6)
for ip in ipv4:
if ip != cls.DUT_IPV4_ADDR:
cls.dut_ifconfig.del_ip_address(ip)
for ip in ipv6:
if ip != str(ipaddress.ip_address(unicode(cls.DUT_IPV6_ADDR))):
cls.dut_ifconfig.del_ip_address(ip)
cls.dut_ifconfig.set_link_state(LINK_STATE_DOWN)
cls.dut_ifconfig.set_link_state(LINK_STATE_UP)
cls.dut_ifconfig.wait_link_up()
cls.dut_power = Power(host=cls.dut_hostname)
cls.dut_ops = OpSystem(host=cls.dut_hostname)
cls.lkp_ops = OpSystem()
cls.dut_mac = cls.dut_ifconfig.get_mac_address()
cls.lkp_mac = cls.lkp_ifconfig.get_mac_address()
cls.dut_iface = cls.dut_ifconfig.get_conn_name()
cls.lkp_iface = cls.lkp_ifconfig.get_conn_name()
cls.dut_nof_pci_lines = cls.dut_ifconfig.get_nof_pci_lines()
cls.lkp_nof_pci_lines = cls.lkp_ifconfig.get_nof_pci_lines()
cls.iperf_config = {
'num_threads': 1,
'num_process': 4,
'ipv': 4,
'buffer_len': 0,
'is_udp': False,
'is_eee': False,
"time": 30,
"speed": cls.supported_speeds[-1],
'lkp': cls.dut_hostname,
'lkp4': cls.DUT_IPV4_ADDR,
'lkp6': cls.DUT_IPV6_ADDR,
'dut4': cls.LKP_IPV4_ADDR,
'dut6': cls.LKP_IPV6_ADDR
}
TestDrvSettings.result = None
if cls.dut_fw_card == CARD_ANTIGUA:
cls.fw_config = FirmwareA2Config(cls.dut_atltool_wrapper)
except Exception as e:
log.exception("Failed while setting up class")
raise e
def setup_method(self, method):
super(TestDrvSettings, self).setup_method(method)
if not self.is_host_alive_and_ready(self.dut_hostname):
raise Exception("DUT is not online, can't perform test")
def teardown_method(self, method):
super(TestDrvSettings, self).teardown_method(method)
self.bring_host_online(self.dut_hostname)
# Hibernate off is not available for Linux
if self.dut_ops.is_windows():
self.dut_power.hibernate_off()
# if self.dut_ops.is_windows():
# # Enable IPv6 binding back because ARP offload tests may disable it
# self.dut_ifconfig.bind_ipv6()
if self.dut_ops.is_windows():
self.dut_ifconfig.set_advanced_property("*PMARPOffload", "Enable")
self.dut_ifconfig.set_advanced_property("*PMNSOffload", "Enable")
self.dut_ifconfig.set_buffer_size(rx_size=512, tx_size=2048)
self.dut_ifconfig.set_mtu(MTU_DISABLED)
if self.dut_fw_card != CARD_FIJI:
self.dut_ifconfig.set_interrupt_type(INTERRUPT_TYPE_LEGACY)
self.dut_ifconfig.set_advanced_property("*InterruptModeration", self.STATE_ENBL)
self.dut_ifconfig.set_advanced_property("ITR", self.STATE_ADAPTIVE)
self.dut_ifconfig.set_advanced_property("VlanID", 0)
self.dut_ifconfig.set_advanced_property("MonitorModeEnabled", "Disable")
self.dut_ifconfig.set_flow_control(OFFLOADS_STATE_TX_RX)
if self.dut_ops.is_linux():
if "forwarding" in self.dut_drv_version:
res = Command(cmd="sudo ethtool --set-priv-flags {} StripEtherPadding off".format(self.dut_iface),
host=self.dut_hostname).wait()
if res["returncode"] != 0:
raise Exception("Ethtool failed")
res = Command(cmd="sudo ethtool --set-priv-flags {} MediaDetect off".format(self.dut_iface),
host=self.dut_hostname).wait()
if res["returncode"] != 0:
raise Exception("Ethtool failed")
self.dut_ifconfig.delete_macvlan_ifaces()
self.dut_ifconfig.set_buffer_size(rx_size=2048, tx_size=4096)
self.dut_ifconfig.set_flow_control(OFFLOADS_STATE_TX_RX)
self.dut_ifconfig.delete_vlan_ifaces()
def randomize_ipv6(self, init_adress):
last_byte = init_adress.split(":")[7]
last_byte = int(last_byte, 16) + 1
last_byte_str = "0{:02x}".format(last_byte)
return "{}:{}".format(init_adress[:-5], last_byte_str if len(last_byte_str) == 4 else last_byte_str[1:])
def hibernate_dut(self, retry_interval=15):
log.info("Hibernating DUT")
self.dut_power.hibernate()
if not self.poll_host_powered_off(self.dut_hostname, retry_interval=retry_interval):
raise Exception("Couldn't hibernate DUT")
log.info("DUT is hibernated")
def set_offload_settings(self, arp_offload, ns_offload):
self.dut_ifconfig.set_power_mgmt_settings(False, True, True)
# Set wol settings to make sure FW keeps link up after hibernate
self.dut_ifconfig.set_advanced_property("WakeOnPing", "Enable")
self.dut_ifconfig.set_advanced_property("*WakeOnMagicPacket", "Enable")
self.dut_ifconfig.set_advanced_property("*PMARPOffload", arp_offload)
self.dut_ifconfig.set_advanced_property("*PMNSOffload", ns_offload)
if self.lkp_fw_card in FELICITY_CARDS or self.dut_fw_card in FELICITY_CARDS:
speed = self.supported_speeds[-1]
self.dut_ifconfig.set_link_speed(speed)
self.lkp_ifconfig.set_link_speed(speed)
self.dut_ifconfig.set_link_state(LINK_STATE_DOWN)
self.dut_ifconfig.set_link_state(LINK_STATE_UP)
time.sleep(self.LINK_CONFIG_DELAY)
if "win7" not in self.dut_ops.get_name().lower():
res = Command(cmd=self.PRVT_NW_CMD, host=self.dut_hostname).run()
assert res["returncode"] == 0, "Couldn't set network to private on DUT"
def all_loopback_off(self):
res = Command(cmd="sudo ethtool --set-priv-flags {} PKTSystemLoopback off".format(self.dut_iface),
host=self.dut_hostname).wait()
if res["returncode"] != 0:
raise Exception("Ethtool failed")
res = Command(cmd="sudo ethtool --set-priv-flags {} DMASystemLoopback off".format(self.dut_iface),
host=self.dut_hostname).wait()
if res["returncode"] != 0:
raise Exception("Ethtool failed")
res = Command(cmd="sudo ethtool --set-priv-flags {} DMANetworkLoopback off".format(self.dut_iface),
host=self.dut_hostname).wait()
if res["returncode"] != 0:
raise Exception("Ethtool failed")
res = Command(cmd="sudo ethtool --set-priv-flags {} PHYInternalLoopback off".format(self.dut_iface),
host=self.dut_hostname).wait()
if res["returncode"] != 0:
raise Exception("Ethtool failed")
res = Command(cmd="sudo ethtool --set-priv-flags {} PHYExternalLoopback off".format(self.dut_iface),
host=self.dut_hostname).wait()
if res["returncode"] != 0:
raise Exception("Ethtool failed")
res = Command(cmd="sudo ethtool --set-priv-flags {} MediaDetect off".format(self.dut_iface),
host=self.dut_hostname).wait()
if res["returncode"] != 0:
raise Exception("Ethtool failed")
def send_pkt_loopback_system(self):
dut_scapy_tool = ScapyTools(port=self.dut_port, host=self.dut_hostname)
dut_scapy_iface = dut_scapy_tool.get_scapy_iface()
pkt = Ether(dst="ff:ff:ff:ff:ff:ff", src="ff:ff:ff:ff:ff:ff") / IP(dst=self.DUT_IPV4_ADDR) / TCP(
dport=1111) / ("1234567890" * 5)
sniffer = Tcpdump(port=self.dut_port, timeout=5, host=self.dut_hostname)
sniffer.run_async()
dut_scapy_tool.send_packet(pkt=pkt, iface=dut_scapy_iface)
sniffed = sniffer.join(10)
pkts = []
for pkt in sniffed:
if TCP in pkt and pkt[TCP].dport == 1111:
pkts.append(pkt)
assert len(pkts) == 2, "Loopback is not work"
assert pkts[0] == pkts[1], "Loopback is not work"
def send_pkt_loopback_network(self):
lkp_scapy_tool = ScapyTools(port=self.lkp_port, host=self.lkp_hostname)
lkp_scapy_iface = lkp_scapy_tool.get_scapy_iface()
pkt = Ether(dst="ff:ff:ff:ff:ff:ff", src="ff:ff:ff:ff:ff:ff") / IP(dst=self.DUT_IPV4_ADDR) / TCP(
dport=1111) / ("1234567890" * 5)
sniffer = Tcpdump(port=self.lkp_port, timeout=5, host=self.lkp_hostname)
sniffer.run_async()
time.sleep(2)
lkp_scapy_tool.send_packet(pkt=pkt, iface=lkp_scapy_iface)
time.sleep(2)
sniffed = sniffer.join(10)
pkts = []
for pkt in sniffed:
if TCP in pkt and pkt[TCP].dport == 1111:
pkts.append(pkt)
assert len(pkts) == 2, "Loopback is not work"
assert pkts[0] == pkts[1], "Loopback is not work"
def get_advertised_flow_control_linux(self):
cmd = "sudo ethtool {} | grep 'Advertised pause frame use:'".format(self.lkp_iface)
res = Command(cmd=cmd, host=self.lkp_hostname).run_join(5)
assert res["returncode"] == 0
cur_pause = res["output"][0].split(':')[1].strip()
return (LIN_PAUSE_NO if cur_pause == "No" else \
LIN_PAUSE_SYMMETRIC if cur_pause == "Symmetric" else \
LIN_PAUSE_SYMMETRIC_RECEIVE if cur_pause == "Symmetric Receive-only" else \
LIN_PAUSE_TRANSMIT if cur_pause == "Transmit-only" else None)
def test_pkt_system_loopback(self):
"""
@description: Check packet loopback system.
@steps:
1. Check that in registers loopback is off.
2. Turn on loopback.
3. Check that in registers loopback is on.
4. Send packets from DUT
5. Check that package send and receive on DUT
@result: Package send and receive on DUT.
@duration: 30 seconds.
@requirements: DRV_LOOPBACK_1
"""
if not self.dut_ops.is_linux():
pytest.skip()
self.dut_ifconfig.wait_link_up()
self.all_loopback_off()
reg_5000 = Register(self.dut_atltool_wrapper.readreg(0x5000))
reg_7000 = Register(self.dut_atltool_wrapper.readreg(0x7000))
assert reg_5000[8] == 0 and reg_5000[7] == 0, "Rx PKTSystemLoopback is on"
assert reg_7000[8] == 0 and reg_7000[7] == 0, "Tx PKTSystemLoopback is on"
try:
res = Command(cmd="sudo ethtool --set-priv-flags {} PKTSystemLoopback on".format(self.dut_iface),
host=self.dut_hostname).wait()
if res["returncode"] != 0:
raise Exception("Ethtool failed")
reg_5000 = Register(self.dut_atltool_wrapper.readreg(0x5000))
reg_7000 = Register(self.dut_atltool_wrapper.readreg(0x7000))
assert reg_5000[8] == 1 or reg_5000[7] == 1, "Tx PKTSystemLoopback is off"
assert reg_7000[8] == 1 or reg_7000[7] == 1, "Rx PKTSystemLoopback is off"
self.send_pkt_loopback_system()
finally:
self.all_loopback_off()
def test_dma_system_loopback(self):
"""
@description: Check dma loopback system.
@steps:
1. Check that in registers loopback is off.
2. Turn on loopback.
3. Check that in registers loopback is on.
4. Send packets from DUT
5. Check that package send and receive on DUT
@result: Package send and receive on DUT.
@duration: 30 seconds.
@requirements: DRV_LOOPBACK_2
"""
if not self.dut_ops.is_linux():
pytest.skip()
self.dut_ifconfig.wait_link_up()
self.all_loopback_off()
assert self.dut_atltool_wrapper.readreg(0x5000) & 0x40 == 0, "Rx DMASystemLoopback is on"
assert self.dut_atltool_wrapper.readreg(0x7000) & 0x40 == 0, "Tx DMASystemLoopback is on"
try:
res = Command(cmd="sudo ethtool --set-priv-flags {} DMASystemLoopback on".format(self.dut_iface),
host=self.dut_hostname).wait()
if res["returncode"] != 0:
raise Exception("Ethtool failed")
assert self.dut_atltool_wrapper.readreg(0x7000) & 0x40 == 0x40, "Tx DMASystemLoopback is off"
assert self.dut_atltool_wrapper.readreg(0x5000) & 0x40 == 0x40, "Rx DMASystemLoopback is off"
self.send_pkt_loopback_system()
finally:
self.all_loopback_off()
def test_dma_network_loopback(self):
"""
@description: Check dma loopback network.
@steps:
1. Check that in registers loopback is off.
2. Turn on loopback.
3. Check that in registers loopback is on.
4. Send packets from LKP to DUT
5. Check that package send and receive on LKP
@result: Package send and receive on LKP.
@duration: 30 seconds.
@requirements: DRV_LOOPBACK_3
"""
if not self.dut_ops.is_linux():
pytest.skip()
self.dut_ifconfig.wait_link_up()
self.all_loopback_off()
assert self.dut_atltool_wrapper.readreg(0x5000) & 0x10 == 0, "Rx DMANetworkLoopback is on"
assert self.dut_atltool_wrapper.readreg(0x7000) & 0x10 == 0, "Tx DMANetworkLoopback is on"
try:
res = Command(cmd="sudo ethtool --set-priv-flags {} DMANetworkLoopback on".format(self.dut_iface),
host=self.dut_hostname).wait()
if res["returncode"] != 0:
raise Exception("Ethtool failed")
assert self.dut_atltool_wrapper.readreg(0x7000) & 0x10 == 0x10, "Tx DMANetworkLoopback is off"
assert self.dut_atltool_wrapper.readreg(0x5000) & 0x10 == 0x10, "Rx DMANetworkLoopback is off"
assert self.dut_atltool_wrapper.readreg(0x5100) & 0x8 == 0x8, "Rx DMANetworkLoopback is off"
assert self.dut_atltool_wrapper.readreg(0x5280) & 0x4 == 0x4, "Rx DMANetworkLoopback is off"
assert self.dut_atltool_wrapper.readreg(0x7900) & 0x10 == 0, "Rx DMANetworkLoopback is off"
self.send_pkt_loopback_network()
finally:
self.all_loopback_off()
def test_phy_internal_loopback(self):
"""
@description: Check phy internal loopback.
@steps:
1. Check that in registers loopback is off.
2. Turn on loopback.
3. Check that in registers loopback is on.
@result: Register show correct information.
@duration: 15 seconds.
"""
if not self.dut_ops.is_linux() or self.dut_fw_card in FELICITY_CARDS or self.dut_fw_card == CARD_ANTIGUA:
pytest.skip()
self.dut_ifconfig.wait_link_up()
self.all_loopback_off()
assert self.dut_atltool_wrapper.readreg(0x36c) & 0x8000000 == 0, "PHYInternalLoopback is on"
try:
res = Command(cmd="sudo ethtool --set-priv-flags {} PHYInternalLoopback on".format(self.dut_iface),
host=self.dut_hostname).wait()
if res["returncode"] != 0:
raise Exception("Ethtool failed")
time.sleep(3)
assert self.dut_atltool_wrapper.readreg(0x36c) & 0x8000000 == 0x8000000, "PHYInternalLoopback is off"
self.send_pkt_loopback_system()
finally:
self.all_loopback_off()
def test_phy_external_loopback(self):
"""
@description: Check phy external loopback.
@steps:
1. Check that in registers loopback is off.
2. Turn on loopback.
3. Check that in registers loopback is on.
@result: Register show correct information.
@duration: 15 seconds.
"""
if not self.dut_ops.is_linux() or self.dut_fw_card in FELICITY_CARDS or self.dut_fw_card == CARD_ANTIGUA:
pytest.skip()
self.dut_ifconfig.wait_link_up()
self.all_loopback_off()
assert self.dut_atltool_wrapper.readreg(0x36c) & 0x4000000 == 0, "PHYExternalLoopback is on"
try:
res = Command(cmd="sudo ethtool --set-priv-flags {} PHYExternalLoopback on".format(self.dut_iface),
host=self.dut_hostname).wait()
if res["returncode"] != 0:
raise Exception("Ethtool failed")
time.sleep(3)
assert self.dut_atltool_wrapper.readreg(0x36c) & 0x4000000 == 0x4000000, "PHYExternalLoopback is off"
finally:
self.all_loopback_off()
def test_media_detect(self):
"""
@description: Check media detect.
@steps:
1. Check that in registers media detect is off.
2. Turn on media detect.
3. Check that in registers media detect is on.
4. Suspending DUT
5. Turn on DUT
6. Check that in registers media detect is on.
@result: Register show correct information.
@duration: 15 seconds.
"""
if not self.dut_ops.is_linux() or self.dut_fw_card in FELICITY_CARDS or self.dut_fw_card == CARD_ANTIGUA:
pytest.skip()
self.dut_ifconfig.wait_link_up()
try:
res = Command(cmd="sudo ethtool --set-priv-flags {} MediaDetect off".format(self.dut_iface),
host=self.dut_hostname).wait()
if res["returncode"] != 0:
raise Exception("Ethtool failed")
assert self.dut_atltool_wrapper.readphyreg(0x1E, 0xC478) & 0x180 == 0, "Media detect enabled"
res = Command(cmd="sudo ethtool --set-priv-flags {} MediaDetect on".format(self.dut_iface),
host=self.dut_hostname).wait()
if res["returncode"] != 0:
raise Exception("Ethtool failed")
assert self.dut_atltool_wrapper.readphyreg(0x1E, 0xC478) & 0x180 == 0x180, "Media detect disabled"
self.dut_power.suspend()
time.sleep(3)
pcontrol.PControl().power(self.dut_hostname, 500, 0)
if not self.poll_host_alive_and_ready(self.dut_hostname, self.POWER_UP_TIMEOUT):
raise Exception("Couldn't wake DUT up using power control")
assert self.dut_atltool_wrapper.readphyreg(0x1E, 0xC478) & 0x180 == 0x180, "Media detect disabled \
after sleep"
finally:
self.all_loopback_off()
def test_phy_switched_to_low_power(self):
"""
@description: Check phy switched to low power.
@steps:
1. Link down.
2. Wait link down.
3. Check SIF status in PHY.
@result: System Iface should be low power.
@duration: 30 seconds.
@requirements: DRV_LINK_1
"""
if not self.dut_ops.is_linux() or self.dut_fw_card in FELICITY_CARDS or self.dut_fw_card == CARD_ANTIGUA:
pytest.skip()
self.dut_ifconfig.set_link_state(LINK_STATE_DOWN)
self.dut_ifconfig.wait_link_down()
sif_status = self.dut_atltool_wrapper.readphyreg(0x4, 0xE812)
systemIface = (sif_status >> 3) & 0x1F
assert systemIface == 9
def test_multicast_adresses(self):
"""
@description: Check multicast adresses and macvlan.
@steps:
1. Link up.
2. Add MACVLAN device
3. Check that Unicast filters registers have valid values for macvlan and enabled multicast addresses.
4. Remove MULTICAST flag.
5. Check that Unicast filters registers have valid values for macvlan and disabled multicast filters.
6. Set ALLMULTI flag.
7. Check that Unicast filters registers have valid values for macvlan and disabled multicast filters and l2
mc_accept_all is 0.
8. Set MULTICAST flag
9. Check that Unicast filters registers have valid values for macvlan and 0x5270.E (l2_mc_accept_all) is 1 and
0x5250.10 (l2_mc_act0) is 1 and 0x5250.1F(l2_mc_en0) is 1.
10. Clear MULTICAST flag
11. Check that Unicast filters registers have valid values for macvlan and disabled multicast filters and
0x5270.E (l2_mc_accept_all) is 0.
@result: MULTICAST and MACVLAN works correctly.
@duration: 1 minutes.
@requirements: DRV_MULTICAST_1, DRV_MULTICAST_2
"""
if not self.dut_ops.is_linux():
pytest.skip()
self.dut_ifconfig.set_link_state(LINK_STATE_DOWN)
self.dut_ifconfig.set_link_state(LINK_STATE_UP)
self.dut_ifconfig.wait_link_up()
multicast_address = '01:00:5e:00:00:01'
def convert_reg_in_mac(reg):
mac_str = str(reg)
if mac_str[-1] == "L":
return "{}:{}:{}:{}:{}:{}".format(
mac_str[-13:-11], mac_str[-11:-9], mac_str[-9:-7], mac_str[-7:-5], mac_str[-5:-3], mac_str[-3:-1])
else:
return "{}:{}:{}:{}:{}:{}".format(
mac_str[-12:-10], mac_str[-10:-8], mac_str[-8:-6], mac_str[-6:-4], mac_str[-4:-2], mac_str[-2:])
def check_macvlan_multicast(mac_address):
end = self.dut_atltool_wrapper.readreg(0x00005110)
first = self.dut_atltool_wrapper.readreg(0x00005114)
mac = hex((first << 32) | end)
if convert_reg_in_mac(mac) == mac_address:
return True
end = self.dut_atltool_wrapper.readreg(0x00005118)
first = self.dut_atltool_wrapper.readreg(0x0000511c)
mac = hex((first << 32) | end)
if convert_reg_in_mac(mac) == mac_address:
return True
end = self.dut_atltool_wrapper.readreg(0x00005120)
first = self.dut_atltool_wrapper.readreg(0x00005124)
mac = hex((first << 32) | end)
if convert_reg_in_mac(mac) == mac_address:
return True
return False
c = Command(cmd="sudo ip link add mymacvlan1 link {} type macvlan mode bridge".format(self.dut_iface),
host=self.dut_hostname)
c.run()
assert c.join()["returncode"] == 0
c = Command(cmd="sudo ifconfig mymacvlan1 up", host=self.dut_hostname)
c.run()
assert c.join()["returncode"] == 0
time.sleep(15)
macvl = self.dut_ifconfig.get_mac_address(macvlan="mymacvlan1@{}".format(self.dut_iface))
assert check_macvlan_multicast(macvl), "Unicast filters registers not have valid values for macvlan"
assert check_macvlan_multicast(multicast_address), \
"Unicast filters registers not have valid values for multicast addresses"
c = Command(cmd="sudo ifconfig {} -multicast".format(self.dut_iface), host=self.dut_hostname)
c.run()
assert c.join()["returncode"] == 0
self.dut_ifconfig.set_link_state(LINK_STATE_DOWN)
self.dut_ifconfig.set_link_state(LINK_STATE_UP)
assert check_macvlan_multicast(macvl), "Unicast filters registers not have valid values for macvlan"
assert check_macvlan_multicast(
multicast_address) is False, "Unicast filters registers have valid values for multicast addresses"
c = Command(cmd="sudo ifconfig {} allmulti".format(self.dut_iface), host=self.dut_hostname)
c.run()
assert c.join()["returncode"] == 0
self.dut_ifconfig.set_link_state(LINK_STATE_DOWN)
self.dut_ifconfig.set_link_state(LINK_STATE_UP)
assert check_macvlan_multicast(macvl), "Unicast filters registers not have valid values for macvlan"
assert check_macvlan_multicast(
multicast_address) is False, "Unicast filters registers have valid values for multicast addresses"
assert self.dut_atltool_wrapper.readreg(0x00005270) & 0x4000 == 0
c = Command(cmd="sudo ifconfig {} multicast".format(self.dut_iface), host=self.dut_hostname)
c.run()
assert c.join()["returncode"] == 0
self.dut_ifconfig.set_link_state(LINK_STATE_DOWN)
self.dut_ifconfig.set_link_state(LINK_STATE_UP)
assert check_macvlan_multicast(macvl), "Unicast filters registers not have valid values for macvlan"
assert self.dut_atltool_wrapper.readreg(0x00005250) & 0x80010000 == 0x80010000
assert self.dut_atltool_wrapper.readreg(0x00005270) & 0x4000 == 0x4000
c = Command(cmd="sudo ifconfig {} -multicast".format(self.dut_iface), host=self.dut_hostname)
c.run()
assert c.join()["returncode"] == 0
self.dut_ifconfig.set_link_state(LINK_STATE_DOWN)
self.dut_ifconfig.set_link_state(LINK_STATE_UP)
assert check_macvlan_multicast(macvl), "Unicast filters registers not have valid values for macvlan"
assert check_macvlan_multicast(
multicast_address) is False, "Unicast filters registers not have valid values for multicast addresses"
assert self.dut_atltool_wrapper.readreg(0x00005270) & 0x4000 == 0
def test_cooperation_of_promisc_flag_and_vlan_functionality(self):
"""
@description: Check a cooperation of PROMISC flag and VLAN functionality
@steps:
1. Configure 15 vlan on the interface.
2. Check that VLAN-PROMISC is not set (0x5280.1 = 0)
3. Set PROMISC flag.
4. Check that VLAN-PROMISC is set (0x5280.1 = 1)
5. Check that L2-PROMISC is set (0x5100.3 = 1)
6. Remove PROMISC flag.
7. Check VLAN-PROMISC and L2-PROMISC is not set (0x5280.1 = 0, 0x5100.3 = 0)
8. Configure 16 vlans on the interface.
9. Check that VLAN-PROMISC is set (0x5280.1 = 1)
10.Set PROMISC flag.
11.Check that VLAN-PROMISC is set (0x5280.1 = 1)
12.Remove PROMISC flag
13.Check that VLAN-PROMISC is set (0x5280.1 = 1)
14.Set PROMISC flag.
15.Check that VLAN-PROMISC is set (0x5280.1 = 1)
16.Configure 1 vlan on the interface.
17.Check that VLAN-PROMISC is set (0x5280.1 = 1)
18.Delete 1 vlan on the interface
19.Check that VLAN-PROMISC is set (0x5280.1 = 1)
20.Set PROMISC flag.
21.Check that VLAN-PROMISC is set (0x5280.1 = 1)
22.Configure 16 vlans on the interface.
23.Check that VLAN-PROMISC is set (0x5280.1 = 1)
24.Delete 1 vlan on the interface.
25.Check that VLAN-PROMISC is set (0x5280.1 = 1)
@result: Correct a cooperation of PROMISC flag and VLAN functionality.
@duration: 2 minutes.
@requirements: DRV_VLAN_2, DRV_VLAN_3, DRV_VLAN_6
"""
if not self.dut_ops.is_linux() or self.dut_fw_card == CARD_FIJI:
pytest.skip("Not implemented")
for number in range(1, 16):
self.dut_ifconfig.create_vlan_iface(number)
assert self.dut_atltool_wrapper.readreg(0x5280) & 0x2 == 0
res = Command(cmd="sudo ifconfig {} promisc".format(self.dut_iface), host=self.dut_hostname).run()
if res["returncode"] != 0:
raise Exception("Failed enable promisc")
assert self.dut_atltool_wrapper.readreg(0x5280) & 0x2 == 2
assert self.dut_atltool_wrapper.readreg(0x5100) & 0x8 == 8
res = Command(cmd="sudo ifconfig {} -promisc".format(self.dut_iface), host=self.dut_hostname).run()
if res["returncode"] != 0:
raise Exception("Failed disable promisc")
assert self.dut_atltool_wrapper.readreg(0x5280) & 0x2 == 0
assert self.dut_atltool_wrapper.readreg(0x5100) & 0x8 == 0
self.dut_ifconfig.create_vlan_iface(16)
assert self.dut_atltool_wrapper.readreg(0x5280) & 0x2 == 2
res = Command(cmd="sudo ifconfig {} promisc".format(self.dut_iface), host=self.dut_hostname).run()
if res["returncode"] != 0:
raise Exception("Failed enable promisc")
assert self.dut_atltool_wrapper.readreg(0x5280) & 0x2 == 2
res = Command(cmd="sudo ifconfig {} -promisc".format(self.dut_iface), host=self.dut_hostname).run()
if res["returncode"] != 0:
raise Exception("Failed disable promisc")
assert self.dut_atltool_wrapper.readreg(0x5280) & 0x2 == 2
self.dut_ifconfig.delete_vlan_ifaces()
res = Command(cmd="sudo ifconfig {} promisc".format(self.dut_iface), host=self.dut_hostname).run()
if res["returncode"] != 0:
raise Exception("Failed enable promisc")
assert self.dut_atltool_wrapper.readreg(0x5280) & 0x2 == 2
self.dut_ifconfig.create_vlan_iface(1)
assert self.dut_atltool_wrapper.readreg(0x5280) & 0x2 == 2
self.dut_ifconfig.delete_vlan_ifaces()
assert self.dut_atltool_wrapper.readreg(0x5280) & 0x2 == 2
res = Command(cmd="sudo ifconfig {} promisc".format(self.dut_iface), host=self.dut_hostname).run()
if res["returncode"] != 0:
raise Exception("Failed enable promisc")
assert self.dut_atltool_wrapper.readreg(0x5280) & 0x2 == 2
for number in range(1, 17):
self.dut_ifconfig.create_vlan_iface(number)
assert self.dut_atltool_wrapper.readreg(0x5280) & 0x2 == 2
self.dut_ifconfig.delete_vlan_iface(1)
assert self.dut_atltool_wrapper.readreg(0x5280) & 0x2 == 2
def test_stripping_of_padding(self):
"""
@description: Verify StripEtherPadding ethtool option.
@steps:
1. Enable stripping of padding using ethtool.
2. Verify that 0x8 MSM register has correct value.
@result: MSM is configured correctly.
@duration: 10 seconds.
"""
if "forwarding" not in self.dut_drv_version:
pytest.skip()
assert self.dut_atltool_wrapper.readmsmreg(0x00000008) & 0x20 == 0
res = Command(cmd="sudo ethtool --set-priv-flags {} StripEtherPadding on".format(self.dut_iface),
host=self.dut_hostname).wait()
if res["returncode"] != 0:
raise Exception("Ethtool failed")
self.dut_ifconfig.wait_link_up()
assert self.dut_atltool_wrapper.readmsmreg(0x00000008) & 0x20 == 0x20
@idparametrize("direction", [OFFLOADS_STATE_TX, OFFLOADS_STATE_RX, OFFLOADS_STATE_TX_RX, OFFLOADS_STATE_DSBL])
def test_flow_control_reg(self, direction):
"""
@description: Check driver flow control.
@steps:
1. In loop for TX, RX, TX/RX or disable value of flow control:
a. Configure flow control
b. Renegotiate link speed
c. Check that register 0x36c/0x13014 has the correct value of flow control bit.
@result: Register 0x36c/0x13014 has the correct value.
@duration: 30 seconds.
@requirements: DRV_FLOW_CONTROL_3, DRV_FLOW_CONTROL_4, DRV_FLOW_CONTROL_5, DRV_FLOW_CONTROL_6,
DRV_FLOW_CONTROL_7
"""
if self.dut_fw_card in CARD_FIJI or self.lkp_fw_card in CARD_FIJI:
pytest.skip("Not implemented")
self.dut_ifconfig.set_link_speed(self.supported_speeds[-1])
self.dut_ifconfig.set_link_state(LINK_STATE_DOWN)
self.dut_ifconfig.set_link_state(LINK_STATE_UP)
self.dut_ifconfig.wait_link_up()
self.dut_ifconfig.set_flow_control(direction)
time.sleep(3)
self.dut_ifconfig.set_link_speed(self.supported_speeds[-1])
self.dut_ifconfig.set_link_state(LINK_STATE_UP)
self.dut_ifconfig.wait_link_up()
val_1 = self.dut_ifconfig.get_flow_control()
assert val_1 == direction
if self.dut_fw_card in CARD_ANTIGUA:
val = self.dut_atltool_wrapper.readreg(0x13014)
val = (val >> 8) & 0x3
if direction == OFFLOADS_STATE_TX_RX:
assert val == 3
elif direction == OFFLOADS_STATE_DSBL:
assert val == 0
elif direction == OFFLOADS_STATE_RX:
assert val == 3
elif direction == OFFLOADS_STATE_TX:
assert val == 1
else:
val = self.dut_atltool_wrapper.readreg(0x36c)
val = (val >> 3) & 0x3
if direction == OFFLOADS_STATE_TX_RX:
assert val == 1 or val == 3
elif direction == OFFLOADS_STATE_DSBL:
assert val == 0
elif direction == OFFLOADS_STATE_RX:
assert val == 3
elif direction == OFFLOADS_STATE_TX:
assert val == 2
def run_flow_control_lkp(self, direction_dut, direction_lkp):
self.dut_ifconfig.set_link_speed(self.supported_speeds[-1])
self.dut_ifconfig.set_flow_control(direction_dut)
self.lkp_ifconfig.set_flow_control(direction_lkp)
self.dut_ifconfig.set_link_state(LINK_STATE_DOWN)
self.dut_ifconfig.set_link_state(LINK_STATE_UP)
speed = self.dut_ifconfig.wait_link_up()
lkp_pause = self.get_advertised_flow_control_linux()
if all(pause in [OFFLOADS_STATE_TX_RX, OFFLOADS_STATE_RX] for pause in [direction_dut, direction_lkp]):
assert lkp_pause == LIN_PAUSE_SYMMETRIC
elif all(pause in [OFFLOADS_STATE_TX, OFFLOADS_STATE_DSBL] for pause in [direction_dut, direction_lkp]):
assert lkp_pause == LIN_PAUSE_NO
elif direction_dut == OFFLOADS_STATE_TX_RX and direction_lkp == OFFLOADS_STATE_TX:
assert lkp_pause == LIN_PAUSE_TRANSMIT
elif direction_dut == OFFLOADS_STATE_TX_RX and direction_lkp == OFFLOADS_STATE_RX:
assert lkp_pause == LIN_PAUSE_SYMMETRIC
elif direction_dut == OFFLOADS_STATE_TX and direction_lkp == OFFLOADS_STATE_RX:
assert lkp_pause == LIN_PAUSE_SYMMETRIC_RECEIVE
def test_flow_control_lkp_tx(self):
"""
@description: Check FC settings for TX/TX
@steps:
1. Setup FC setting of TX/TX for both DUT/LKP
2. Check advertised FC status
@result: Advertised FC is disabled
@duration: 30 seconds
@requirements: DRV_ADV_FLOW_CONTROL_1
"""
self.run_flow_control_lkp(OFFLOADS_STATE_TX, OFFLOADS_STATE_TX)
def test_flow_control_lkp_rx(self):
"""
@description: Check FC settings for dut RX/RX
@steps:
1. Setup FC setting of RX for DUT and RX for LKP
2. Check advertised FC status
@result: Advertised FC is symmetric
@duration: 30 seconds
@requirements: DRV_ADV_FLOW_CONTROL_2
"""
self.run_flow_control_lkp(OFFLOADS_STATE_RX, OFFLOADS_STATE_RX)
def test_flow_control_lkp_rx_tx(self):
"""
@description: Check FC settings for RX/TX
@steps:
1. Setup FC setting of RX/TX for both DUT/LKP
2. Check advertised FC status
@result: Advertised FC is symmetric
@duration: 30 seconds
@requirements: DRV_ADV_FLOW_CONTROL_3
"""
self.run_flow_control_lkp(OFFLOADS_STATE_TX_RX, OFFLOADS_STATE_TX_RX)
def test_flow_control_lkp_dsbl(self):
"""
@description: Check FC settings for disabled
@steps:
1. Setup FC setting of disabled for both DUT/LKP
2. Check advertised FC status
@result: Advertised FC is disabled
@duration: 30 seconds
@requirements: DRV_ADV_FLOW_CONTROL_4
"""
self.run_flow_control_lkp(OFFLOADS_STATE_DSBL, OFFLOADS_STATE_DSBL)
def test_flow_control_lkp_rx_tx_tx(self):
"""
@description: Check FC settings for dut RX/TX and lkp TX
@steps:
1. Setup FC setting of RX/TX for DUT and TX for LKP
2. Check advertised FC status
@result: Advertised FC is Transmit-only
@duration: 30 seconds
@requirements: DRV_ADV_FLOW_CONTROL_5
"""
self.run_flow_control_lkp(OFFLOADS_STATE_TX_RX, OFFLOADS_STATE_TX)
def test_flow_control_lkp_rx_tx_rx(self):
"""
@description: Check FC settings for dut RX/TX and lkp RX
@steps:
1. Setup FC setting of RX/TX for DUT and RX for LKP
2. Check advertised FC status
@result: Advertised FC is symmetric
@duration: 30 seconds
@requirements: DRV_ADV_FLOW_CONTROL_6
"""
self.run_flow_control_lkp(OFFLOADS_STATE_TX_RX, OFFLOADS_STATE_RX)
def test_flow_control_lkp_tx_rx(self):
"""
@description: Check FC settings for dut TX and lkp RX
@steps:
1. Setup FC setting of TX for DUT and RX for LKP
2. Check advertised FC status
@result: Advertised FC is Symmetric Receive-only
@duration: 30 seconds
@requirements: DRV_ADV_FLOW_CONTROL_7
"""
self.run_flow_control_lkp(OFFLOADS_STATE_TX, OFFLOADS_STATE_RX)
def test_interrupt(self):
"""
@description: Check Legacy and MSI Interupt types.
@steps:
1. In loop for 0x1 and 0xa Interrupt MSI type:
a. Run iperf traffic with payload length 1600 bytes.
b. Check MSI-X Enable status.
2. Set Interupt type Legacy.
3. Run iperf traffic with payload length 1600 bytes.
4. Check MSI-X Enable status.
@result: All checks are passed.
@duration: 3 minutes.
"""
if not self.dut_ops.is_windows() or self.dut_fw_card == CARD_FIJI:
pytest.skip("Not implemented")
def check_msi():
res = Command(cmd="lspci -d 1d6a: -vvv", host=self.dut_hostname).run()
for str in res["output"]:
if "MSI-X: Enable+" in str:
return True
elif "MSI-X: Enable-" in str:
return False
return None
speed = self.dut_ifconfig.wait_link_up()
time.sleep(5)
args = {'time': 5,
'directon': DIRECTION_RXTX,
'speed': speed,
"bandwidth": SPEED_TO_MBITS[speed],
'buffer_len': 1600,
'lkp': self.dut_hostname,
'dut': self.lkp_hostname,
'lkp4': self.DUT_IPV4_ADDR,
'lkp6': self.DUT_IPV6_ADDR,
'dut4': self.LKP_IPV4_ADDR,
'dut6': self.LKP_IPV6_ADDR}
driver_version = self.dut_driver.release_version
ver_major, ver_minor, ver_release, ver_build = [
int(item) for item in driver_version.split('/')[-1].split('.')]
if (ver_major >= 3) or (ver_major == 2 and ver_minor >= 1 and ver_release >= 18 and ver_build >= 0):
message_number_limit = 0x12
else:
message_number_limit = 0xa
for i in [0x1, message_number_limit]:
self.dut_ifconfig.set_interrupt_type(INTERRUPT_TYPE_MSI, i)
self.dut_ifconfig.set_link_state(LINK_STATE_DOWN)
self.dut_ifconfig.set_link_state(LINK_STATE_UP)
self.dut_ifconfig.wait_link_up()
self.run_iperf(**args)
assert check_msi()
self.dut_ifconfig.set_interrupt_type(INTERRUPT_TYPE_LEGACY)
self.dut_ifconfig.set_link_state(LINK_STATE_DOWN)
self.dut_ifconfig.set_link_state(LINK_STATE_UP)
self.dut_ifconfig.wait_link_up()
self.run_iperf(**args)
assert not check_msi()
def run_nuttcp_interrupt(self, udp, buffer_len):
def kill_nuttcp():
Killer().kill("nuttcp")
Killer(host=self.dut_hostname).kill("nuttcp")
speed = self.supported_speeds[-1]
self.dut_ifconfig.set_mtu(MTU_16000)
self.lkp_ifconfig.set_mtu(MTU_16000)
self.dut_ifconfig.set_link_speed(speed)
self.lkp_ifconfig.set_link_speed(speed)
self.dut_ifconfig.wait_link_up()