forked from dgubanovv/qa-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
drv_offloads.py
1774 lines (1512 loc) · 85.6 KB
/
drv_offloads.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
import os
import re
import shutil
import sys
import time
import pytest
from scapy.utils import wrpcap
from infra.test_base import TestBase, idparametrize
from tools.aqpkt import Aqsendp, scapy_pkt_to_aqsendp_str
from tools.atltool_fiji import AtlToolFiji
from tools.atltoolper import AtlTool
from tools.command import Command
from tools.constants import CARD_FIJI, LINK_STATE_DOWN, LINK_STATE_UP, DIRECTION_RX, DIRECTION_TX, SPEED_TO_MBITS, \
OFFLOADS_STATE_ON, OFFLOADS_STATE_OFF, OFFLOADS_STATE_DSBL, OFFLOADS_STATE_ENBL, OFFLOADS_STATE_TX, \
OFFLOADS_STATE_RX, OFFLOADS_STATE_TX_RX, NFS_SERVER, MTU_1500, MTU_2000, MTU_4000, MTU_9000, MTU_16000, \
LINK_SPEED_10G, LINK_SPEED_5G, LINK_SPEED_2_5G, LINK_SPEED_1G, LINK_SPEED_100M
from tools.driver import Driver, DRV_TYPE_KO
from tools.iptables import IPTables
from tools.ops import OpSystem
from tools.scapy_tools import ScapyTools, Ether, Dot1Q, IP, IPv6, TCP, UDP, ICMP, Raw, RandString
from tools.tcpdump import Tcpdump
from tools.tracepoint import Tracepoint
from tools.utils import get_atf_logger, upload_file, get_bus_dev_func
log = get_atf_logger()
def setup_module(module):
# import tools._test_setup # uncomment for manual test setup
os.environ["TEST"] = "drv_settings"
# ========= Offloads ========= #
L4_IP4_CHECKSUM = "l4_ip4_cheksum"
L4_IP6_CHECKSUM = "l4_ip6_cheksum"
TCP_IP4_CHECKSUM = "tcp_ip4_cheksum"
UDP_IP4_CHECKSUM = "udp_ip4_cheksum"
TCP_IP6_CHECKSUM = "tcp_ip6_cheksum"
UDP_IP6_CHECKSUM = "udp_ip6_cheksum"
IP4_CHECKSUM = "ip4_checksum"
LSO_V1_IP4 = "lso_v1_ip4"
LSO_V2_IP4 = "lso_v2_ip4"
LSO_V2_IP6 = "lso_v2_ip6"
RECEIVE_SIDE_SCALING = "receive_side_scaling"
RECV_SEGMENT_COALESCING_IP4 = "recv_segment_coalescing_IPv4"
RECV_SEGMENT_COALESCING_IP6 = "recv_segment_coalescing_IPv6"
TX_CHECKSUM = "tx_checksum"
RX_CHECKSUM = "rx_checksum"
LSO = "lso"
LRO = "lro" # GRO is same as LRO
GSO = "gso"
RX_VLAN = "rxvlan"
TX_VLAN = "txvlan"
RX_VLAN_FILTER = 'rx-vlan-filter'
OFFLOADS = [L4_IP4_CHECKSUM, L4_IP6_CHECKSUM, IP4_CHECKSUM,
LSO_V1_IP4, LSO_V2_IP4, LSO_V2_IP6, TX_CHECKSUM,
RX_CHECKSUM, LSO, LRO, GSO, RECEIVE_SIDE_SCALING,
RECV_SEGMENT_COALESCING_IP4, RECV_SEGMENT_COALESCING_IP6,
TCP_IP4_CHECKSUM, UDP_IP4_CHECKSUM, TCP_IP6_CHECKSUM, UDP_IP6_CHECKSUM]
WIN_OFL = "win_ofl"
LINUX_OFL = "linux_ofl"
MAC_OFL = "mac_ofl"
FREEBSD_OFL = "freebsd_ofl"
# ========= Registers ========= #
CHK_SUM_RX_REG = 0x5580
CHK_SUM_TX_REG = 0x7800
LSO_REG = 0x7810
LRO_REG = 0x5590
RSS_REG = 0x54C0
class DrvOffloadsBase(TestBase):
"""
@description: The DrvOffloadsBase test is dedicated to verify Driver offloads.
@setup: Two Aquantia devices connected back to back.
"""
IPV4_GATEWAY = "192.168.0.1"
TO_RENAME_IFACE = """
ACTION==\"add\", SUBSYSTEM==\"net\", DRIVERS==\"?*\", ATTR{{address}}==\"{}\", NAME=\"{}\"
"""
@classmethod
def setup_class(cls):
super(DrvOffloadsBase, cls).setup_class()
try:
cls.log_server_dir = cls.create_logs_dir_on_log_server()
if cls.dut_fw_card == CARD_FIJI and OpSystem().is_linux():
cls.dut_mac = cls.dut_ifconfig.get_mac_address()
log.info("Rename Fiji adapter interface name")
bus, dev, func = get_bus_dev_func(cls.dut_port)
if OpSystem().is_ubuntu():
name = "enx{}s{}".format(bus, dev)
else:
name = "enp{}s{}".format(bus, dev)
with open('/tmp/70-persistent-ipoib.rules', 'a') as f:
f.write(cls.TO_RENAME_IFACE.format(cls.dut_mac, name))
command_dut_cp_to_home = Command(
cmd='sudo cp /tmp/70-persistent-ipoib.rules /etc/udev/rules.d/70-persistent-ipoib.rules')
res = command_dut_cp_to_home.run_join(5)
assert res["returncode"] == 0, 'Failed to make cp command'
cls.install_firmwares()
if cls.dut_fw_card not in CARD_FIJI:
cls.dut_atltool_wrapper = AtlTool(port=cls.dut_port)
if cls.dut_fw_card not in CARD_FIJI and cls.dut_atltool_wrapper.is_secure_chips() and cls.dut_ops.is_linux():
cls.dut_driver = Driver(port=cls.dut_port, version=cls.dut_drv_version, flashless_fw=cls.dut_fw_version)
else:
cls.dut_driver = Driver(port=cls.dut_port, version=cls.dut_drv_version)
if '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()
# 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)
cls.dut_ifconfig.wait_link_up()
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()
# For UDP GSO
cls.udpgso_bench_downloaded = False
if cls.dut_fw_card in CARD_FIJI:
if OpSystem().is_windows():
cls.dut_atltool_wrapper_fiji = AtlToolFiji()
iptables = IPTables(dut_hostname=cls.dut_hostname, lkp_hostname=cls.lkp_hostname)
iptables.clean()
except Exception as e:
log.exception("Failed while setting up class")
raise e
def run_offload(self, offload, state):
self.dut_ifconfig.manage_offloads(offload, state)
self.dut_ifconfig.set_link_state(LINK_STATE_DOWN)
self.dut_ifconfig.set_link_state(LINK_STATE_UP)
self.dut_ifconfig.wait_link_up()
curr_speed = self.dut_ifconfig.get_link_speed()
args = {
'num_threads': 4,
'num_process': 1,
'time': 15,
'ipv': 4,
'buffer_len': 65507,
'window': "1k",
'lkp': self.lkp_hostname,
'lkp4': self.LKP_IPV4_ADDR,
'dut4': self.DUT_IPV4_ADDR,
'speed': curr_speed
}
if self.dut_fw_card in CARD_FIJI:
from tools.usb_control import USBPowerMeterControl
usb_power_meter_control = USBPowerMeterControl()
usb_power_meter_control.run_async(self.dut_usb_connect, False, self.dut_port)
self.run_iperf(**args)
if self.dut_fw_card in CARD_FIJI:
time.sleep(15)
plot = usb_power_meter_control.join(self.dut_usb_connect, self.dut_port)
if plot is not None:
shutil.move(plot, self.test_log_dir)
def get_offload_for_os(self, offload_name):
assert offload_name in OFFLOADS
map_ofl = {WIN_OFL: {L4_IP4_CHECKSUM: "*TCPUDPChecksumOffloadIPv4",
L4_IP6_CHECKSUM: "*TCPUDPChecksumOffloadIPv6",
IP4_CHECKSUM: "*IPChecksumOffloadIPv4",
TCP_IP4_CHECKSUM: "*TCPChecksumOffloadIPv4",
UDP_IP4_CHECKSUM: "*UDPChecksumOffloadIPv4",
TCP_IP6_CHECKSUM: "*TCPChecksumOffloadIPv6",
UDP_IP6_CHECKSUM: "*UDPChecksumOffloadIPv6",
LSO_V1_IP4: "*LsoV1IPv4",
LSO_V2_IP4: "*LsoV2IPv4",
LSO_V2_IP6: "*LsoV2IPv6",
RECEIVE_SIDE_SCALING: "*RSS",
RECV_SEGMENT_COALESCING_IP4: "*RscIPv4",
RECV_SEGMENT_COALESCING_IP6: "*RscIPv6"},
LINUX_OFL: {TX_CHECKSUM: "tx",
RX_CHECKSUM: "rx",
LSO: "tso",
LRO: "lro",
GSO: "gso"},
# MAC_OFL: {L4_IP4_CHECKSUM: None,
# L4_IP6_CHECKSUM: None,
# IP4_CHECKSUM: None,
# LSO_V1_IP4: None,
# LSO_V2_IP4: None,
# LSO_V2_IP6: None}
MAC_OFL: {TX_CHECKSUM: "tx",
RX_CHECKSUM: "rx",
LSO: "tso"},
FREEBSD_OFL: {TX_CHECKSUM: "txcsum",
RX_CHECKSUM: "rxcsum",
}
}
return (map_ofl[WIN_OFL][offload_name] if self.dut_ops.is_windows() else \
map_ofl[LINUX_OFL][offload_name] if self.dut_ops.is_linux() else \
map_ofl[FREEBSD_OFL][offload_name] if self.dut_ops.is_freebsd() else \
map_ofl[MAC_OFL][offload_name])
class TestWinOffloads(DrvOffloadsBase):
# -------------------- Win offloads --------------------
def setup_method(self, method):
super(TestWinOffloads, self).setup_method(method)
if sys.platform != "win32":
pytest.skip("Windows only test")
def teardown_method(self, method):
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(TCP_IP4_CHECKSUM), OFFLOADS_STATE_TX_RX)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(UDP_IP4_CHECKSUM), OFFLOADS_STATE_TX_RX)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(TCP_IP6_CHECKSUM), OFFLOADS_STATE_TX_RX)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(UDP_IP6_CHECKSUM), OFFLOADS_STATE_TX_RX)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(L4_IP4_CHECKSUM), OFFLOADS_STATE_TX_RX)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(L4_IP6_CHECKSUM), OFFLOADS_STATE_TX_RX)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(IP4_CHECKSUM), OFFLOADS_STATE_TX_RX)
if self.dut_fw_card != CARD_FIJI:
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(RECEIVE_SIDE_SCALING), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(RECV_SEGMENT_COALESCING_IP6), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(RECV_SEGMENT_COALESCING_IP4), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V1_IP4), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP4), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP6), OFFLOADS_STATE_ENBL)
def test_receive_side_scaling_disable(self):
"""
@description: Check disabled Driver receive side scaling.
@steps:
1. Disable receive side scaling via driver settings.
2. Check that value of rss_rxq_en bit in RX Filter RSS Control Register (0x54C0) is equal to 0x0.
3. Run TCP traffic.
@result: MAC RSS Control Register has correct value.
@duration: 1 minutes.
"""
if self.dut_fw_card in CARD_FIJI:
pytest.skip()
self.run_offload(self.get_offload_for_os(RECEIVE_SIDE_SCALING), OFFLOADS_STATE_DSBL)
rss_reg = (self.dut_atltool_wrapper.readreg(RSS_REG) & 0x80000000)
assert rss_reg == 0
def test_receive_side_scaling_enable(self):
"""
@description: Check enabled Driver receive side scaling.
@steps:
1. Enable receive side scaling via driver settings.
2. Check that value of rss_rxq_en bit in RX Filter RSS Control Register (0x54C0) is equal to 0x1.
3. Run TCP traffic.
@result: MAC RSS Control Register has correct value.
@duration: 1 minutes.
"""
if self.dut_fw_card in CARD_FIJI:
pytest.skip()
self.run_offload(self.get_offload_for_os(RECEIVE_SIDE_SCALING), OFFLOADS_STATE_ENBL)
rss_reg = (self.dut_atltool_wrapper.readreg(RSS_REG) & 0x80000000)
assert rss_reg == 0x80000000
def test_recv_segment_coalescing_ip4_disable(self):
"""
@description: Check disabled RX ipv4 segment coalescing.
@steps:
1. Disable RX ipv6 segment coalescing via driver settings.
2. Disable RX ipv4 segment coalescing via driver settings.
3. Check that RX Large Receive Offload Control Register (0x5590) is equal to 0x0.
4. Run TCP traffic.
@result: RX Large Receive Offload Control Register has correct value.
@requirements: DRV_OFFLOAD_RSC_2, DRV_OFFLOAD_RSC_4
@duration: 1 minutes.
"""
if self.dut_fw_card in CARD_FIJI:
pytest.skip()
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(RECV_SEGMENT_COALESCING_IP6), OFFLOADS_STATE_ENBL)
self.run_offload(self.get_offload_for_os(RECV_SEGMENT_COALESCING_IP4), OFFLOADS_STATE_DSBL)
assert self.dut_atltool_wrapper.readreg(LRO_REG) == 0
def test_recv_segment_coalescing_ip6_disable(self):
"""
@description: Check disabled RX ipv6 segment coalescing.
@steps:
1. Disable RX ipv6 segment coalescing via driver settings.
2. Disable RX ipv4 segment coalescing via driver settings.
3. Check that RX Large Receive Offload Control Register (0x5590) is equal to 0x0.
4. Run TCP traffic.
@result: RX Large Receive Offload Control Register has correct value.
@requirements: DRV_OFFLOAD_RSC_2, DRV_OFFLOAD_RSC_4
@duration: 1 minutes.
"""
if self.dut_fw_card in CARD_FIJI:
pytest.skip()
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(RECV_SEGMENT_COALESCING_IP4), OFFLOADS_STATE_ENBL)
self.run_offload(self.get_offload_for_os(RECV_SEGMENT_COALESCING_IP6), OFFLOADS_STATE_DSBL)
assert self.dut_atltool_wrapper.readreg(LRO_REG) == 0
def test_recv_segment_coalescing_ip4_ipv6_enable(self):
"""
@description: Check enabled RX ipv4/ipv6 segment coalescing.
@steps:
1. Enable RX ipv6 segment coalescing via driver settings.
2. Enable RX ipv4 segment coalescing via driver settings.
3. Check that RX Large Receive Offload Control Register (0x5590) is equal to 0xffffffff.
4. Run TCP traffic.
@result: RX Large Receive Offload Control Register has correct value.
@requirements: DRV_OFFLOAD_RSC_1, DRV_OFFLOAD_RSC_3
@duration: 1 minutes.
"""
if self.dut_fw_card in CARD_FIJI:
pytest.skip()
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(RECV_SEGMENT_COALESCING_IP6), OFFLOADS_STATE_ENBL)
self.run_offload(self.get_offload_for_os(RECV_SEGMENT_COALESCING_IP4), OFFLOADS_STATE_ENBL)
assert self.dut_atltool_wrapper.readreg(LRO_REG) == 0xffffffff
def test_tcpudp_ip4_tx(self):
"""
@description: Check enabled TX TCP/UDP Checksum Offload (IPv4).
@steps:
1. Enable Large Send Offload V2 (IPV4) via driver settings.
2. Enable Large Send Offload V2 (IPV6) via driver settings.
3. Enable Large Send Offload V1 (IPV4) via driver settings.
4. Disable TCP/UDP Checksum Offload (IPv6) via driver settings.
5. Enable TX of TCP/UDP Checksum Offload (IPv4) via driver settings.
6. Check that value of l4_chk_en bit in RX Protocol Offload Control Register (0x5580) is equal to 0x0.
7. Check that value of l4_chk_en bit in TX Protocol Offload Control Register (0x7800) is equal to 0x1.
8. Run TCP traffic.
@result: RX and TX Protocol Offload Control Registers have correct value.
@duration: 1 minutes.
"""
if self.dut_fw_card in CARD_FIJI:
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP4), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP6), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(TCP_IP6_CHECKSUM), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(UDP_IP6_CHECKSUM), OFFLOADS_STATE_DSBL)
self.run_offload(self.get_offload_for_os(TCP_IP4_CHECKSUM), OFFLOADS_STATE_TX)
self.run_offload(self.get_offload_for_os(UDP_IP4_CHECKSUM), OFFLOADS_STATE_TX)
reg = self.dut_atltool_wrapper_fiji.readreg(0x34) & 0x6
assert reg == 0
reg = self.dut_atltool_wrapper_fiji.readreg(0x35) & 0x6
assert reg == 0x6
else:
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP4), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP6), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V1_IP4), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(L4_IP6_CHECKSUM), OFFLOADS_STATE_DSBL)
self.run_offload(self.get_offload_for_os(L4_IP4_CHECKSUM), OFFLOADS_STATE_TX)
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_RX_REG) & 0x1) == 0
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_TX_REG) & 0x1) == 0x1
def test_tcpudp_ip4_rx(self):
"""
@description: Check enabled RX TCP/UDP Checksum Offload (IPv4).
@steps:
1. Disable Large Send Offload V2 (IPV4) via driver settings.
2. Disable Large Send Offload V2 (IPV6) via driver settings.
3. Disable Large Send Offload V1 (IPV4) via driver settings.
4. Disable TCP/UDP Checksum Offload (IPv6) via driver settings.
5. Enable RX of TCP/UDP Checksum Offload (IPv4) via driver settings.
6. Check that value of l4_chk_en bit in RX Protocol Offload Control Register (0x5580) is equal to 0x1.
7. Check that value of l4_chk_en bit in TX Protocol Offload Control Register (0x7800) is equal to 0x0.
8. Run TCP traffic.
@result: RX and TX Protocol Offload Control Registers have correct value.
@duration: 1 minutes.
"""
if self.dut_fw_card in CARD_FIJI:
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP4), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP6), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(TCP_IP6_CHECKSUM), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(UDP_IP6_CHECKSUM), OFFLOADS_STATE_DSBL)
self.run_offload(self.get_offload_for_os(TCP_IP4_CHECKSUM), OFFLOADS_STATE_RX)
self.run_offload(self.get_offload_for_os(UDP_IP4_CHECKSUM), OFFLOADS_STATE_RX)
reg = self.dut_atltool_wrapper_fiji.readreg(0x34) & 0x6
assert reg == 0x6
reg = self.dut_atltool_wrapper_fiji.readreg(0x35) & 0x6
assert reg == 0
else:
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP4), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP6), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V1_IP4), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(L4_IP6_CHECKSUM), OFFLOADS_STATE_DSBL)
self.run_offload(self.get_offload_for_os(L4_IP4_CHECKSUM), OFFLOADS_STATE_RX)
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_RX_REG) & 0x1) == 0x1
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_TX_REG) & 0x1) == 0
def test_tcpudp_ip4_rx_tx(self):
"""
@description: Check enabled RX/TX TCP/UDP Checksum Offload (IPv4).
@steps:
1. Enable Large Send Offload V2 (IPV4) via driver settings.
2. Enable Large Send Offload V2 (IPV6) via driver settings.
3. Enable Large Send Offload V1 (IPV4) via driver settings.
4. Disable TCP/UDP Checksum Offload (IPv6) via driver settings.
5. Enable RX and TX of TCP/UDP Checksum Offload (IPv4) via driver settings.
6. Check that value of l4_chk_en bit in RX Protocol Offload Control Register (0x5580) is equal to 0x1.
7. Check that value of l4_chk_en bit in TX Protocol Offload Control Register (0x7800) is equal to 0x1.
8. Run TCP traffic.
@result: RX and TX Protocol Offload Control Registers have correct value.
@duration: 1 minutes.
"""
if self.dut_fw_card in CARD_FIJI:
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP4), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP6), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(TCP_IP6_CHECKSUM), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(UDP_IP6_CHECKSUM), OFFLOADS_STATE_DSBL)
self.run_offload(self.get_offload_for_os(TCP_IP4_CHECKSUM), OFFLOADS_STATE_TX_RX)
self.run_offload(self.get_offload_for_os(UDP_IP4_CHECKSUM), OFFLOADS_STATE_TX_RX)
reg = self.dut_atltool_wrapper_fiji.readreg(0x34) & 0x6
assert reg == 0x6
reg = self.dut_atltool_wrapper_fiji.readreg(0x35) & 0x6
assert reg == 0x6
else:
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP4), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP6), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V1_IP4), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(L4_IP6_CHECKSUM), OFFLOADS_STATE_DSBL)
self.run_offload(self.get_offload_for_os(L4_IP4_CHECKSUM), OFFLOADS_STATE_TX_RX)
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_RX_REG) & 0x1) == 0x1
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_TX_REG) & 0x1) == 0x1
def test_tcpudp_ip4_ip6_disable(self):
"""
@description: Check disabled TCP/UDP Checksum Offload (IPv4 and IPv6).
@steps:
1. Disable Large Send Offload V2 (IPV4) via driver settings.
2. Disable Large Send Offload V2 (IPV6) via driver settings.
3. Disable Large Send Offload V1 (IPV4) via driver settings.
4. Disable TCP/UDP Checksum Offload (IPv6) via driver settings.
5. Disable TCP/UDP Checksum Offload (IPv4) via driver settings.
6. Check that value of l4_chk_en bit in RX Protocol Offload Control Register (0x5580) is equal to 0x0.
7. Check that value of l4_chk_en bit in TX Protocol Offload Control Register (0x7800) is equal to 0x0.
8. Run TCP traffic.
@result: RX and TX Protocol Offload Control Registers have correct value.
@duration: 1 minutes.
"""
if self.dut_fw_card in CARD_FIJI:
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP4), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP6), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(TCP_IP6_CHECKSUM), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(UDP_IP6_CHECKSUM), OFFLOADS_STATE_DSBL)
self.run_offload(self.get_offload_for_os(TCP_IP4_CHECKSUM), OFFLOADS_STATE_DSBL)
self.run_offload(self.get_offload_for_os(UDP_IP4_CHECKSUM), OFFLOADS_STATE_DSBL)
reg = self.dut_atltool_wrapper_fiji.readreg(0x34) & 0x66
assert reg == 0
reg = self.dut_atltool_wrapper_fiji.readreg(0x35) & 0x66
assert reg == 0
else:
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP4), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP6), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V1_IP4), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(L4_IP6_CHECKSUM), OFFLOADS_STATE_DSBL)
self.run_offload(self.get_offload_for_os(L4_IP4_CHECKSUM), OFFLOADS_STATE_DSBL)
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_TX_REG) & 0x1) == 0
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_RX_REG) & 0x1) == 0
def test_tcpudp_ip6_tx(self):
"""
@description: Check enabled TX TCP/UDP Checksum Offload (IPv6).
@steps:
1. Enable Large Send Offload V2 (IPV4) via driver settings.
2. Enable Large Send Offload V2 (IPV6) via driver settings.
3. Enable Large Send Offload V1 (IPV4) via driver settings.
4. Disable TCP/UDP Checksum Offload (IPv4) via driver settings.
5. Enable TX TCP/UDP Checksum Offload (IPv6) via driver settings.
6. Check that value of l4_chk_en bit in RX Protocol Offload Control Register (0x5580) is equal to 0x0.
7. Check that value of l4_chk_en bit in TX Protocol Offload Control Register (0x7800) is equal to 0x1.
8. Run TCP traffic.
@result: RX and TX Protocol Offload Control Registers have correct value.
@duration: 1 minutes.
"""
if self.dut_fw_card in CARD_FIJI:
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP4), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP6), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(TCP_IP4_CHECKSUM), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(UDP_IP4_CHECKSUM), OFFLOADS_STATE_DSBL)
self.run_offload(self.get_offload_for_os(TCP_IP6_CHECKSUM), OFFLOADS_STATE_TX)
self.run_offload(self.get_offload_for_os(UDP_IP6_CHECKSUM), OFFLOADS_STATE_TX)
reg = self.dut_atltool_wrapper_fiji.readreg(0x34) & 0x60
assert reg == 0
reg = self.dut_atltool_wrapper_fiji.readreg(0x35) & 0x60
assert reg == 0x60
else:
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP4), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP6), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V1_IP4), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(L4_IP4_CHECKSUM), OFFLOADS_STATE_DSBL)
self.run_offload(self.get_offload_for_os(L4_IP6_CHECKSUM), OFFLOADS_STATE_TX)
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_TX_REG) & 0x1) == 0x1
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_RX_REG) & 0x1) == 0
def test_tcpudp_ip6_rx(self):
"""
@description: Check enabled RX TCP/UDP Checksum Offload (IPv6).
@steps:
1. Disable Large Send Offload V2 (IPV4) via driver settings.
2. Disable Large Send Offload V2 (IPV6) via driver settings.
3. Disable Large Send Offload V1 (IPV4) via driver settings.
4. Disable TCP/UDP Checksum Offload (IPv4) via driver settings.
5. Enable RX TCP/UDP Checksum Offload (IPv6) via driver settings.
6. Check that value of l4_chk_en bit in RX Protocol Offload Control Register (0x5580) is equal to 0x1.
7. Check that value of l4_chk_en bit in TX Protocol Offload Control Register (0x7800) is equal to 0x0.
8. Run TCP traffic.
@result: RX and TX Protocol Offload Control Registers have correct value.
@duration: 1 minutes.
"""
if self.dut_fw_card in CARD_FIJI:
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP4), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP6), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(TCP_IP4_CHECKSUM), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(UDP_IP4_CHECKSUM), OFFLOADS_STATE_DSBL)
self.run_offload(self.get_offload_for_os(TCP_IP6_CHECKSUM), OFFLOADS_STATE_RX)
self.run_offload(self.get_offload_for_os(UDP_IP6_CHECKSUM), OFFLOADS_STATE_RX)
reg = self.dut_atltool_wrapper_fiji.readreg(0x34) & 0x60
assert reg == 0x60
reg = self.dut_atltool_wrapper_fiji.readreg(0x35) & 0x60
assert reg == 0
else:
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP4), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP6), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V1_IP4), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(L4_IP4_CHECKSUM), OFFLOADS_STATE_DSBL)
self.run_offload(self.get_offload_for_os(L4_IP6_CHECKSUM), OFFLOADS_STATE_RX)
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_RX_REG) & 0x1) == 0x1
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_TX_REG) & 0x1) == 0x0
def test_tcpudp_ip6_rx_tx(self):
"""
@description: Check enabled RX/TX TCP/UDP Checksum Offload (IPv6).
@steps:
1. Enable Large Send Offload V2 (IPV4) via driver settings.
2. Enable Large Send Offload V2 (IPV6) via driver settings.
3. Enable Large Send Offload V1 (IPV4) via driver settings.
4. Disable TCP/UDP Checksum Offload (IPv4) via driver settings.
5. Enable RX and TX TCP/UDP Checksum Offload (IPv6) via driver settings.
6. Check that value of l4_chk_en bit in RX Protocol Offload Control Register (0x5580) is equal to 0x1.
7. Check that value of l4_chk_en bit in TX Protocol Offload Control Register (0x7800) is equal to 0x1.
8. Run TCP traffic.
@result: RX and TX Protocol Offload Control Registers have correct value.
@duration: 1 minutes.
"""
if self.dut_fw_card in CARD_FIJI:
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP4), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP6), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(TCP_IP4_CHECKSUM), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(UDP_IP4_CHECKSUM), OFFLOADS_STATE_DSBL)
self.run_offload(self.get_offload_for_os(TCP_IP6_CHECKSUM), OFFLOADS_STATE_TX_RX)
self.run_offload(self.get_offload_for_os(UDP_IP6_CHECKSUM), OFFLOADS_STATE_TX_RX)
reg = self.dut_atltool_wrapper_fiji.readreg(0x34) & 0x60
assert reg == 0x60
reg = self.dut_atltool_wrapper_fiji.readreg(0x35) & 0x60
assert reg == 0x60
else:
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP4), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP6), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V1_IP4), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(L4_IP4_CHECKSUM), OFFLOADS_STATE_DSBL)
self.run_offload(self.get_offload_for_os(L4_IP6_CHECKSUM), OFFLOADS_STATE_TX_RX)
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_RX_REG) & 0x1) == 0x1
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_TX_REG) & 0x1) == 0x1
def test_ip4_checksum_rx(self):
"""
@description: Check enabled RX IPv4 Checksum Offload.
@steps:
1. Disable Large Send Offload V2 (IPV4) via driver settings.
2. Disable Large Send Offload V2 (IPV6) via driver settings.
3. Disable Large Send Offload V1 (IPV4) via driver settings.
4. Enable RX/TX TCP/UDP Checksum Offload (IPv4) via driver settings.
5. Enable RX IPv4 Checksum Offload via driver settings.
6. Check that value of ipv4_chk_en bit in RX Protocol Offload Control Register (0x5580) is equal to 0x1.
7. Check that value of ipv4_chk_en bit in TX Protocol Offload Control Register (0x7800) is equal to 0x0.
8. Run TCP traffic.
@result: RX and TX Protocol Offload Control Registers have correct value.
@duration: 1 minutes.
"""
if self.dut_fw_card in CARD_FIJI:
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP4), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP6), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V1_IP4), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(TCP_IP4_CHECKSUM), OFFLOADS_STATE_TX_RX)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(UDP_IP4_CHECKSUM), OFFLOADS_STATE_TX_RX)
self.run_offload(self.get_offload_for_os(IP4_CHECKSUM), OFFLOADS_STATE_RX)
reg = self.dut_atltool_wrapper_fiji.readreg(0x34) & 0x1
assert reg == 0x1
reg = self.dut_atltool_wrapper_fiji.readreg(0x35) & 0x1
assert reg == 0
else:
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP4), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP6), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V1_IP4), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(L4_IP4_CHECKSUM), OFFLOADS_STATE_TX_RX)
self.run_offload(self.get_offload_for_os(IP4_CHECKSUM), OFFLOADS_STATE_RX)
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_RX_REG) & 0x2) == 0x2
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_TX_REG) & 0x2) == 0x0
def test_ip4_checksum_tx(self):
"""
@description: Check enabled TX IPv4 Checksum Offload.
@steps:
1. Disable Large Send Offload V2 (IPV4) via driver settings.
2. Disable Large Send Offload V2 (IPV6) via driver settings.
3. Disable Large Send Offload V1 (IPV4) via driver settings.
4. Enable RX/TX TCP/UDP Checksum Offload (IPv4) via driver settings.
5. Enable TX IPv4 Checksum Offload via driver settings.
6. Check that value of ipv4_chk_en bit in RX Protocol Offload Control Register (0x5580) is equal to 0x0.
7. Check that value of ipv4_chk_en bit in TX Protocol Offload Control Register (0x7800) is equal to 0x1.
8. Run TCP traffic.
@result: RX and TX Protocol Offload Control Registers have correct value.
@duration: 1 minutes.
"""
if self.dut_fw_card in CARD_FIJI:
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP4), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP6), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V1_IP4), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(TCP_IP4_CHECKSUM), OFFLOADS_STATE_TX_RX)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(UDP_IP4_CHECKSUM), OFFLOADS_STATE_TX_RX)
self.run_offload(self.get_offload_for_os(IP4_CHECKSUM), OFFLOADS_STATE_TX)
reg = self.dut_atltool_wrapper_fiji.readreg(0x34) & 0x1
assert reg == 0
reg = self.dut_atltool_wrapper_fiji.readreg(0x35) & 0x1
assert reg == 0x1
else:
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP4), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP6), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V1_IP4), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(L4_IP4_CHECKSUM), OFFLOADS_STATE_TX_RX)
self.run_offload(self.get_offload_for_os(IP4_CHECKSUM), OFFLOADS_STATE_TX)
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_RX_REG) & 0x2) == 0x0
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_TX_REG) & 0x2) == 0x2
def test_ip4_checksum_rx_tx(self):
"""
@description: Check enabled TX/RX IPv4 Checksum Offload.
@steps:
1. Disable Large Send Offload V2 (IPV4) via driver settings.
2. Disable Large Send Offload V2 (IPV6) via driver settings.
3. Disable Large Send Offload V1 (IPV4) via driver settings.
4. Enable RX/TX TCP/UDP Checksum Offload (IPv4) via driver settings.
5. Enable TX and RX IPv4 Checksum Offload via driver settings.
6. Check that value of ipv4_chk_en bit in RX Protocol Offload Control Register (0x5580) is equal to 0x1.
7. Check that value of ipv4_chk_en bit in TX Protocol Offload Control Register (0x7800) is equal to 0x1.
8. Run TCP traffic.
@result: RX and TX Protocol Offload Control Registers have correct value.
@duration: 1 minutes.
"""
if self.dut_fw_card in CARD_FIJI:
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP4), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP6), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V1_IP4), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(TCP_IP4_CHECKSUM), OFFLOADS_STATE_TX_RX)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(UDP_IP4_CHECKSUM), OFFLOADS_STATE_TX_RX)
self.run_offload(self.get_offload_for_os(IP4_CHECKSUM), OFFLOADS_STATE_TX_RX)
reg = self.dut_atltool_wrapper_fiji.readreg(0x34) & 0x1
assert reg == 0x1
reg = self.dut_atltool_wrapper_fiji.readreg(0x35) & 0x1
assert reg == 0x1
else:
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP4), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP6), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V1_IP4), OFFLOADS_STATE_ENBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(L4_IP4_CHECKSUM), OFFLOADS_STATE_TX_RX)
self.run_offload(self.get_offload_for_os(IP4_CHECKSUM), OFFLOADS_STATE_TX_RX)
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_RX_REG) & 0x2) == 0x2
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_TX_REG) & 0x2) == 0x2
def test_ip4_checksum_disable(self):
"""
@description: Check disabled TX/RX IPv4 Checksum Offload.
@steps:
1. Disable Large Send Offload V2 (IPV4) via driver settings.
2. Disable Large Send Offload V2 (IPV6) via driver settings.
3. Disable Large Send Offload V1 (IPV4) via driver settings.
4. Enable RX/TX TCP/UDP Checksum Offload (IPv4) via driver settings.
5. Disable IPv4 Checksum Offload via driver settings.
6. Check that value of ipv4_chk_en bit in RX Protocol Offload Control Register (0x5580) is equal to 0x0.
7. Check that value of ipv4_chk_en bit in TX Protocol Offload Control Register (0x7800) is equal to 0x0.
8. Run TCP traffic.
@result: RX and TX Protocol Offload Control Registers have correct value.
@duration: 1 minutes.
"""
if self.dut_fw_card in CARD_FIJI:
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP4), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP6), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V1_IP4), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(TCP_IP4_CHECKSUM), OFFLOADS_STATE_TX_RX)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(UDP_IP4_CHECKSUM), OFFLOADS_STATE_TX_RX)
self.run_offload(self.get_offload_for_os(IP4_CHECKSUM), OFFLOADS_STATE_DSBL)
reg = self.dut_atltool_wrapper_fiji.readreg(0x34) & 0x1
assert reg == 0x0
reg = self.dut_atltool_wrapper_fiji.readreg(0x35) & 0x1
assert reg == 0x0
else:
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP4), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP6), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V1_IP4), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(L4_IP4_CHECKSUM), OFFLOADS_STATE_TX_RX)
self.run_offload(self.get_offload_for_os(IP4_CHECKSUM), OFFLOADS_STATE_DSBL)
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_RX_REG) & 0x2) == 0
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_TX_REG) & 0x2) == 0
def test_lso_v1_v2_ip4_ip6_disable(self):
"""
@description: Check disabled Large Send Offload V1 and V2 (IPV4 and IPv6).
@steps:
1. Disable Large Send Offload V2 (IPV4) via driver settings.
2. Disable Large Send Offload V2 (IPV6) via driver settings.
3. Disable Large Send Offload V1 (IPV4) via driver settings.
4. Check that value TX Large Send Offload Control Register (0x7810) is equal to 0x0.
5. Run TCP traffic.
@result: TX Large Send Offload Control Register has correct value.
@duration: 1 minutes.
"""
if self.dut_fw_card in CARD_FIJI:
pytest.skip()
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP4), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP6), OFFLOADS_STATE_DSBL)
self.run_offload(self.get_offload_for_os(LSO_V1_IP4), OFFLOADS_STATE_DSBL)
assert self.dut_atltool_wrapper.readreg(LSO_REG) == 0x0
def test_lso_v1_ip4_enable(self):
"""
@description: Check enabled Large Send Offload V1 (IPV4).
@steps:
1. Disable Large Send Offload V2 (IPV4) via driver settings.
2. Disable Large Send Offload V2 (IPV6) via driver settings.
3. Enable Large Send Offload V1 (IPV4) via driver settings.
4. Check that value TX Large Send Offload Control Register (0x7810) is equal to 0xffffffff.
5. Run TCP traffic.
@result: TX Large Send Offload Control Register has correct value.
@duration: 1 minutes.
"""
# Issue ATLDRV-733. LSO state in the driver is controlled by the OS network stack.
# Sometimes it fails when OS did not enables it despite the fact that it enabled it via the
# driver advanced settings.
pytest.xfail()
if self.dut_fw_card in CARD_FIJI:
pytest.skip()
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP4), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP6), OFFLOADS_STATE_DSBL)
self.run_offload(self.get_offload_for_os(LSO_V1_IP4), OFFLOADS_STATE_ENBL)
assert self.dut_atltool_wrapper.readreg(LSO_REG) == 0xffffffff
def test_lso_v2_ip4_enable(self):
"""
@description: Check enabled Large Send Offload V2 (IPV4).
@steps:
1. Enable Large Send Offload V2 (IPV4) via driver settings.
2. Disable Large Send Offload V2 (IPV6) via driver settings.
3. Disable Large Send Offload V1 (IPV4) via driver settings.
4. Check that value TX Large Send Offload Control Register (0x7810) is equal to 0xffffffff.
5. Run TCP traffic.
@result: TX Large Send Offload Control Register has correct value.
@duration: 1 minutes.
"""
# Issue ATLDRV-733. LSO state in the driver is controlled by the OS network stack.
# Sometimes it fails when OS did not enables it despite the fact that it enabled it via the
# driver advanced settings.
pytest.xfail()
if self.dut_fw_card in CARD_FIJI:
pytest.skip()
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V1_IP4), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP6), OFFLOADS_STATE_DSBL)
self.run_offload(self.get_offload_for_os(LSO_V2_IP4), OFFLOADS_STATE_ENBL)
assert self.dut_atltool_wrapper.readreg(LSO_REG) == 0xffffffff
def test_lso_v2_ip6_enable(self):
"""
@description: Check enabled Large Send Offload V2 (IPV6).
@steps:
1. Disable Large Send Offload V2 (IPV4) via driver settings.
2. Enable Large Send Offload V2 (IPV6) via driver settings.
3. Disable Large Send Offload V1 (IPV4) via driver settings.
4. Check that value TX Large Send Offload Control Register (0x7810) is equal to 0xffffffff.
5. Run TCP traffic.
@result: TX Large Send Offload Control Register has correct value.
@duration: 1 minutes.
"""
if self.dut_fw_card in CARD_FIJI:
pytest.skip()
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V1_IP4), OFFLOADS_STATE_DSBL)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO_V2_IP4), OFFLOADS_STATE_DSBL)
self.run_offload(self.get_offload_for_os(LSO_V2_IP6), OFFLOADS_STATE_ENBL)
assert self.dut_atltool_wrapper.readreg(LSO_REG) == 0xffffffff
class TestLinuxOffloads(DrvOffloadsBase):
# -------------------- Linux offloads --------------------
def setup_method(self, method):
super(TestLinuxOffloads, self).setup_method(method)
if sys.platform == "win32":
pytest.skip("Does not run on windows")
def teardown_method(self, method):
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(RX_CHECKSUM), OFFLOADS_STATE_OFF)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(TX_CHECKSUM), OFFLOADS_STATE_OFF)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LSO), OFFLOADS_STATE_OFF)
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(GSO), OFFLOADS_STATE_OFF)
self.dut_ifconfig.manage_offloads(RX_VLAN, OFFLOADS_STATE_ON)
self.dut_ifconfig.manage_offloads(TX_VLAN, OFFLOADS_STATE_ON)
if self.dut_fw_card != CARD_FIJI:
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(LRO), OFFLOADS_STATE_ON)
def test_tx_checksumming_on(self):
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(RX_CHECKSUM), OFFLOADS_STATE_OFF)
self.run_offload(self.get_offload_for_os(TX_CHECKSUM), OFFLOADS_STATE_ON)
if self.dut_fw_card not in CARD_FIJI:
if "forwarding" not in self.dut_drv_version:
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_RX_REG) & 0x3) == 0x0
else:
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_RX_REG) & 0x3) == 0x3
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_TX_REG) & 0x3) == 0x3
def test_tx_checksumming_off(self):
if self.dut_ops.is_mac():
pytest.skip("Skip test for MAC because offloads are always on")
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(RX_CHECKSUM), OFFLOADS_STATE_OFF)
self.run_offload(self.get_offload_for_os(TX_CHECKSUM), OFFLOADS_STATE_OFF)
if self.dut_fw_card not in CARD_FIJI:
if "forwarding" not in self.dut_drv_version:
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_RX_REG) & 0x3) == 0x0
else:
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_RX_REG) & 0x3) == 0x3
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_TX_REG) & 0x3) == 0x3
def test_rx_checksumming_on(self):
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(TX_CHECKSUM), OFFLOADS_STATE_OFF)
self.run_offload(self.get_offload_for_os(RX_CHECKSUM), OFFLOADS_STATE_ON)
if self.dut_fw_card not in CARD_FIJI:
if "forwarding" not in self.dut_drv_version:
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_RX_REG) & 0x3) == 0x3
else:
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_RX_REG) & 0x3) == 0x3
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_TX_REG) & 0x3) == 0x3
def test_rx_checksumming_off(self):
if self.dut_ops.is_mac():
pytest.skip("Skip test for MAC because offloads are always on")
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(TX_CHECKSUM), OFFLOADS_STATE_OFF)
self.run_offload(self.get_offload_for_os(RX_CHECKSUM), OFFLOADS_STATE_OFF)
if self.dut_fw_card not in CARD_FIJI:
if "forwarding" not in self.dut_drv_version:
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_RX_REG) & 0x3) == 0x0
else:
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_RX_REG) & 0x3) == 0x3
assert (self.dut_atltool_wrapper.readreg(CHK_SUM_TX_REG) & 0x3) == 0x3
def test_lso_on(self):
if "freebsd" in sys.platform:
pytest.skip("Does not run on freebsd")
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(TX_CHECKSUM), OFFLOADS_STATE_ON)
self.run_offload(self.get_offload_for_os(LSO), OFFLOADS_STATE_ON)
if self.dut_fw_card not in CARD_FIJI and "forwarding" not in self.dut_drv_version:
lso_reg = self.dut_atltool_wrapper.readreg(LSO_REG)
assert lso_reg == 0xffffffff
elif "forwarding" in self.dut_drv_version:
lso_reg = self.dut_atltool_wrapper.readreg(LSO_REG)
combined = []
re_cnt = re.compile("Combined:\\t*([0-9]+)")
cmd = Command(cmd='sudo ethtool -l {}'.format(self.dut_iface)).run()
if cmd["returncode"] != 0:
raise Exception("Failed to show channels")
for line in cmd["output"]:
m = re_cnt.match(line)
if m is not None:
combined.append(int(m.group(1)))
if combined == []:
raise Exception("Failed to show channels")
else:
for i in range(min(combined)): assert(lso_reg & (1 << i) != 0)
def test_lso_off(self):
if "freebsd" in sys.platform:
pytest.skip("Does not run on freebsd")
if self.dut_ops.is_mac():
pytest.skip("Skip test for MAC because offloads are always on")
self.dut_ifconfig.manage_offloads(self.get_offload_for_os(TX_CHECKSUM), OFFLOADS_STATE_OFF)
self.run_offload(self.get_offload_for_os(LSO), OFFLOADS_STATE_OFF)
if self.dut_fw_card not in CARD_FIJI and "forwarding" not in self.dut_drv_version:
lso_reg = self.dut_atltool_wrapper.readreg(LSO_REG)
assert lso_reg == 0xffffffff
elif "forwarding" in self.dut_drv_version:
lso_reg = self.dut_atltool_wrapper.readreg(LSO_REG)
combined = []
re_cnt = re.compile("Combined:\\t*([0-9]+)")
cmd = Command(cmd='sudo ethtool -l {}'.format(self.dut_iface)).run()
if cmd["returncode"] != 0:
raise Exception("Failed to show channels")
for line in cmd["output"]:
m = re_cnt.match(line)
if m is not None:
combined.append(int(m.group(1)))
if combined == []:
raise Exception("Failed to show channels")
else:
for i in range(min(combined)): assert (lso_reg & (1 << i) != 0)
def test_lro_on(self):
"""
@description: Check lro offload.
@steps:
1. Enable LRO offload.
2. Check that LRO offload is enabled(in 0x5590 register the value is 0xffffffff).
3. Send three packages.
4. Dump the traffic and check that the packages are coalesced.
@result: LRO offload is enabled and packages are coalesced.
@duration: 60 seconds.
@requirements: DRV_OFFLOAD_LRO_1, DRV_OFFLOAD_LRO_3
"""
if "freebsd" in sys.platform:
pytest.skip("Does not run on freebsd")
if self.dut_fw_card == CARD_FIJI:
pytest.skip("Not implemented for Fiji")
self.run_offload(self.get_offload_for_os(LRO), OFFLOADS_STATE_ON)
lro_reg = self.dut_atltool_wrapper.readreg(LRO_REG)
pac = 2000 * "f"