mirror of
https://github.com/corundum/corundum.git
synced 2025-01-30 08:32:52 +08:00
fpga/common/tb: Check feature bits in core testbenches
Signed-off-by: Alex Forencich <alex@alexforencich.com>
This commit is contained in:
parent
1c242f7d92
commit
b7dad0e946
@ -490,6 +490,7 @@ async def run_test_nic(dut):
|
||||
pkt = await interface.recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if interface.if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.log.info("RX and TX checksum tests")
|
||||
@ -500,10 +501,13 @@ async def run_test_nic(dut):
|
||||
udp = UDP(sport=1, dport=2)
|
||||
test_pkt = eth / ip / udp / payload
|
||||
|
||||
if tb.driver.interfaces[0].if_feature_tx_csum:
|
||||
test_pkt2 = test_pkt.copy()
|
||||
test_pkt2[UDP].chksum = scapy.utils.checksum(bytes(test_pkt2[UDP]))
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
else:
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt.build(), 0)
|
||||
|
||||
pkt = await tb.port_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
@ -513,6 +517,7 @@ async def run_test_nic(dut):
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
assert Ether(pkt.data).build() == test_pkt.build()
|
||||
|
||||
@ -530,6 +535,7 @@ async def run_test_nic(dut):
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
assert pkt.queue == k
|
||||
|
||||
@ -537,6 +543,7 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].set_rx_queue_map_indir_table(0, 0, 0)
|
||||
|
||||
if tb.driver.interfaces[0].if_feature_rss:
|
||||
tb.log.info("Queue mapping RSS mask test")
|
||||
|
||||
await tb.driver.interfaces[0].set_rx_queue_map_rss_mask(0, 0x00000003)
|
||||
@ -555,15 +562,19 @@ async def run_test_nic(dut):
|
||||
udp = UDP(sport=1, dport=k+0)
|
||||
test_pkt = eth / ip / udp / payload
|
||||
|
||||
if tb.driver.interfaces[0].if_feature_tx_csum:
|
||||
test_pkt2 = test_pkt.copy()
|
||||
test_pkt2[UDP].chksum = scapy.utils.checksum(bytes(test_pkt2[UDP]))
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
else:
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt.build(), 0)
|
||||
|
||||
for k in range(64):
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
queues.add(pkt.queue)
|
||||
@ -590,6 +601,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -610,6 +622,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -630,6 +643,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -651,6 +665,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -683,6 +698,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
# assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
queues.add(pkt.queue)
|
||||
|
@ -490,6 +490,7 @@ async def run_test_nic(dut):
|
||||
pkt = await interface.recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if interface.if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.log.info("RX and TX checksum tests")
|
||||
@ -500,10 +501,13 @@ async def run_test_nic(dut):
|
||||
udp = UDP(sport=1, dport=2)
|
||||
test_pkt = eth / ip / udp / payload
|
||||
|
||||
if tb.driver.interfaces[0].if_feature_tx_csum:
|
||||
test_pkt2 = test_pkt.copy()
|
||||
test_pkt2[UDP].chksum = scapy.utils.checksum(bytes(test_pkt2[UDP]))
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
else:
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt.build(), 0)
|
||||
|
||||
pkt = await tb.port_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
@ -513,6 +517,7 @@ async def run_test_nic(dut):
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
assert Ether(pkt.data).build() == test_pkt.build()
|
||||
|
||||
@ -530,6 +535,7 @@ async def run_test_nic(dut):
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
assert pkt.queue == k
|
||||
|
||||
@ -537,6 +543,7 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].set_rx_queue_map_indir_table(0, 0, 0)
|
||||
|
||||
if tb.driver.interfaces[0].if_feature_rss:
|
||||
tb.log.info("Queue mapping RSS mask test")
|
||||
|
||||
await tb.driver.interfaces[0].set_rx_queue_map_rss_mask(0, 0x00000003)
|
||||
@ -555,15 +562,19 @@ async def run_test_nic(dut):
|
||||
udp = UDP(sport=1, dport=k+0)
|
||||
test_pkt = eth / ip / udp / payload
|
||||
|
||||
if tb.driver.interfaces[0].if_feature_tx_csum:
|
||||
test_pkt2 = test_pkt.copy()
|
||||
test_pkt2[UDP].chksum = scapy.utils.checksum(bytes(test_pkt2[UDP]))
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
else:
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt.build(), 0)
|
||||
|
||||
for k in range(64):
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
queues.add(pkt.queue)
|
||||
@ -590,6 +601,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -610,6 +622,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -630,6 +643,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -651,6 +665,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -683,6 +698,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
# assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
queues.add(pkt.queue)
|
||||
|
@ -270,6 +270,7 @@ async def run_test_nic(dut):
|
||||
pkt = await interface.recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if interface.if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.log.info("RX and TX checksum tests")
|
||||
@ -280,10 +281,13 @@ async def run_test_nic(dut):
|
||||
udp = UDP(sport=1, dport=2)
|
||||
test_pkt = eth / ip / udp / payload
|
||||
|
||||
if tb.driver.interfaces[0].if_feature_tx_csum:
|
||||
test_pkt2 = test_pkt.copy()
|
||||
test_pkt2[UDP].chksum = scapy.utils.checksum(bytes(test_pkt2[UDP]))
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
else:
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt.build(), 0)
|
||||
|
||||
pkt = await tb.port_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
@ -293,6 +297,7 @@ async def run_test_nic(dut):
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
assert Ether(pkt.data).build() == test_pkt.build()
|
||||
|
||||
@ -310,6 +315,7 @@ async def run_test_nic(dut):
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
assert pkt.queue == k
|
||||
|
||||
@ -317,6 +323,7 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].set_rx_queue_map_indir_table(0, 0, 0)
|
||||
|
||||
if tb.driver.interfaces[0].if_feature_rss:
|
||||
tb.log.info("Queue mapping RSS mask test")
|
||||
|
||||
await tb.driver.interfaces[0].set_rx_queue_map_rss_mask(0, 0x00000003)
|
||||
@ -335,15 +342,19 @@ async def run_test_nic(dut):
|
||||
udp = UDP(sport=1, dport=k+0)
|
||||
test_pkt = eth / ip / udp / payload
|
||||
|
||||
if tb.driver.interfaces[0].if_feature_tx_csum:
|
||||
test_pkt2 = test_pkt.copy()
|
||||
test_pkt2[UDP].chksum = scapy.utils.checksum(bytes(test_pkt2[UDP]))
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
else:
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt.build(), 0)
|
||||
|
||||
for k in range(64):
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
queues.add(pkt.queue)
|
||||
@ -370,6 +381,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -389,6 +401,7 @@ async def run_test_nic(dut):
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -409,6 +422,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -429,6 +443,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -450,6 +465,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -482,6 +498,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
# assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
queues.add(pkt.queue)
|
||||
|
@ -468,6 +468,7 @@ async def run_test_nic(dut):
|
||||
pkt = await interface.recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if interface.if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.log.info("RX and TX checksum tests")
|
||||
@ -478,10 +479,13 @@ async def run_test_nic(dut):
|
||||
udp = UDP(sport=1, dport=2)
|
||||
test_pkt = eth / ip / udp / payload
|
||||
|
||||
if tb.driver.interfaces[0].if_feature_tx_csum:
|
||||
test_pkt2 = test_pkt.copy()
|
||||
test_pkt2[UDP].chksum = scapy.utils.checksum(bytes(test_pkt2[UDP]))
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
else:
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt.build(), 0)
|
||||
|
||||
pkt = await tb.port_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
@ -491,6 +495,7 @@ async def run_test_nic(dut):
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
assert Ether(pkt.data).build() == test_pkt.build()
|
||||
|
||||
@ -508,6 +513,7 @@ async def run_test_nic(dut):
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
assert pkt.queue == k
|
||||
|
||||
@ -515,6 +521,7 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].set_rx_queue_map_indir_table(0, 0, 0)
|
||||
|
||||
if tb.driver.interfaces[0].if_feature_rss:
|
||||
tb.log.info("Queue mapping RSS mask test")
|
||||
|
||||
await tb.driver.interfaces[0].set_rx_queue_map_rss_mask(0, 0x00000003)
|
||||
@ -533,15 +540,19 @@ async def run_test_nic(dut):
|
||||
udp = UDP(sport=1, dport=k+0)
|
||||
test_pkt = eth / ip / udp / payload
|
||||
|
||||
if tb.driver.interfaces[0].if_feature_tx_csum:
|
||||
test_pkt2 = test_pkt.copy()
|
||||
test_pkt2[UDP].chksum = scapy.utils.checksum(bytes(test_pkt2[UDP]))
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
else:
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt.build(), 0)
|
||||
|
||||
for k in range(64):
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
queues.add(pkt.queue)
|
||||
@ -568,6 +579,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -587,6 +599,7 @@ async def run_test_nic(dut):
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -607,6 +620,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -627,6 +641,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -648,6 +663,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -680,6 +696,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
# assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
queues.add(pkt.queue)
|
||||
|
@ -416,6 +416,7 @@ async def run_test_nic(dut):
|
||||
pkt = await interface.recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if interface.if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.log.info("RX and TX checksum tests")
|
||||
@ -426,10 +427,13 @@ async def run_test_nic(dut):
|
||||
udp = UDP(sport=1, dport=2)
|
||||
test_pkt = eth / ip / udp / payload
|
||||
|
||||
if tb.driver.interfaces[0].if_feature_tx_csum:
|
||||
test_pkt2 = test_pkt.copy()
|
||||
test_pkt2[UDP].chksum = scapy.utils.checksum(bytes(test_pkt2[UDP]))
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
else:
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt.build(), 0)
|
||||
|
||||
pkt = await tb.port_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
@ -439,6 +443,7 @@ async def run_test_nic(dut):
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
assert Ether(pkt.data).build() == test_pkt.build()
|
||||
|
||||
@ -456,6 +461,7 @@ async def run_test_nic(dut):
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
assert pkt.queue == k
|
||||
|
||||
@ -463,6 +469,7 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].set_rx_queue_map_indir_table(0, 0, 0)
|
||||
|
||||
if tb.driver.interfaces[0].if_feature_rss:
|
||||
tb.log.info("Queue mapping RSS mask test")
|
||||
|
||||
await tb.driver.interfaces[0].set_rx_queue_map_rss_mask(0, 0x00000003)
|
||||
@ -481,15 +488,19 @@ async def run_test_nic(dut):
|
||||
udp = UDP(sport=1, dport=k+0)
|
||||
test_pkt = eth / ip / udp / payload
|
||||
|
||||
if tb.driver.interfaces[0].if_feature_tx_csum:
|
||||
test_pkt2 = test_pkt.copy()
|
||||
test_pkt2[UDP].chksum = scapy.utils.checksum(bytes(test_pkt2[UDP]))
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
else:
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt.build(), 0)
|
||||
|
||||
for k in range(64):
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
queues.add(pkt.queue)
|
||||
@ -516,6 +527,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -535,6 +547,7 @@ async def run_test_nic(dut):
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -555,6 +568,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -575,6 +589,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -596,6 +611,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -628,6 +644,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
# assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
queues.add(pkt.queue)
|
||||
|
@ -490,6 +490,7 @@ async def run_test_nic(dut):
|
||||
pkt = await interface.recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if interface.if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.log.info("RX and TX checksum tests")
|
||||
@ -500,10 +501,13 @@ async def run_test_nic(dut):
|
||||
udp = UDP(sport=1, dport=2)
|
||||
test_pkt = eth / ip / udp / payload
|
||||
|
||||
if tb.driver.interfaces[0].if_feature_tx_csum:
|
||||
test_pkt2 = test_pkt.copy()
|
||||
test_pkt2[UDP].chksum = scapy.utils.checksum(bytes(test_pkt2[UDP]))
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
else:
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt.build(), 0)
|
||||
|
||||
pkt = await tb.port_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
@ -513,6 +517,7 @@ async def run_test_nic(dut):
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
assert Ether(pkt.data).build() == test_pkt.build()
|
||||
|
||||
@ -530,6 +535,7 @@ async def run_test_nic(dut):
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
assert pkt.queue == k
|
||||
|
||||
@ -537,6 +543,7 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].set_rx_queue_map_indir_table(0, 0, 0)
|
||||
|
||||
if tb.driver.interfaces[0].if_feature_rss:
|
||||
tb.log.info("Queue mapping RSS mask test")
|
||||
|
||||
await tb.driver.interfaces[0].set_rx_queue_map_rss_mask(0, 0x00000003)
|
||||
@ -555,15 +562,19 @@ async def run_test_nic(dut):
|
||||
udp = UDP(sport=1, dport=k+0)
|
||||
test_pkt = eth / ip / udp / payload
|
||||
|
||||
if tb.driver.interfaces[0].if_feature_tx_csum:
|
||||
test_pkt2 = test_pkt.copy()
|
||||
test_pkt2[UDP].chksum = scapy.utils.checksum(bytes(test_pkt2[UDP]))
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
else:
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt.build(), 0)
|
||||
|
||||
for k in range(64):
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
queues.add(pkt.queue)
|
||||
@ -590,6 +601,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -609,6 +621,7 @@ async def run_test_nic(dut):
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -629,6 +642,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -649,6 +663,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -670,6 +685,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -702,6 +718,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
# assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
queues.add(pkt.queue)
|
||||
|
@ -490,6 +490,7 @@ async def run_test_nic(dut):
|
||||
pkt = await interface.recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if interface.if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.log.info("RX and TX checksum tests")
|
||||
@ -500,10 +501,13 @@ async def run_test_nic(dut):
|
||||
udp = UDP(sport=1, dport=2)
|
||||
test_pkt = eth / ip / udp / payload
|
||||
|
||||
if tb.driver.interfaces[0].if_feature_tx_csum:
|
||||
test_pkt2 = test_pkt.copy()
|
||||
test_pkt2[UDP].chksum = scapy.utils.checksum(bytes(test_pkt2[UDP]))
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
else:
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt.build(), 0)
|
||||
|
||||
pkt = await tb.port_mac[0].tx.recv()
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
@ -513,6 +517,7 @@ async def run_test_nic(dut):
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
assert Ether(pkt.data).build() == test_pkt.build()
|
||||
|
||||
@ -530,6 +535,7 @@ async def run_test_nic(dut):
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
assert pkt.queue == k
|
||||
|
||||
@ -537,6 +543,7 @@ async def run_test_nic(dut):
|
||||
|
||||
await tb.driver.interfaces[0].set_rx_queue_map_indir_table(0, 0, 0)
|
||||
|
||||
if tb.driver.interfaces[0].if_feature_rss:
|
||||
tb.log.info("Queue mapping RSS mask test")
|
||||
|
||||
await tb.driver.interfaces[0].set_rx_queue_map_rss_mask(0, 0x00000003)
|
||||
@ -555,15 +562,19 @@ async def run_test_nic(dut):
|
||||
udp = UDP(sport=1, dport=k+0)
|
||||
test_pkt = eth / ip / udp / payload
|
||||
|
||||
if tb.driver.interfaces[0].if_feature_tx_csum:
|
||||
test_pkt2 = test_pkt.copy()
|
||||
test_pkt2[UDP].chksum = scapy.utils.checksum(bytes(test_pkt2[UDP]))
|
||||
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt2.build(), 0, 34, 6)
|
||||
else:
|
||||
await tb.driver.interfaces[0].start_xmit(test_pkt.build(), 0)
|
||||
|
||||
for k in range(64):
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
queues.add(pkt.queue)
|
||||
@ -590,6 +601,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -609,6 +621,7 @@ async def run_test_nic(dut):
|
||||
pkt = await tb.driver.interfaces[0].recv()
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -629,6 +642,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -649,6 +663,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -670,6 +685,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
tb.loopback_enable = False
|
||||
@ -702,6 +718,7 @@ async def run_test_nic(dut):
|
||||
|
||||
tb.log.info("Packet: %s", pkt)
|
||||
# assert pkt.data == pkts[k]
|
||||
if tb.driver.interfaces[0].if_feature_rx_csum:
|
||||
assert pkt.rx_checksum == ~scapy.utils.checksum(bytes(pkt.data[14:])) & 0xffff
|
||||
|
||||
queues.add(pkt.queue)
|
||||
|
Loading…
x
Reference in New Issue
Block a user