Bug 212613

Summary: Strange vlan handling on e1000e
Product: Drivers Reporter: Armin Wolf (W_Armin)
Component: NetworkAssignee: drivers_network (drivers_network)
Status: RESOLVED ANSWERED    
Severity: normal CC: anthony.l.nguyen, jbrandeb, W_Armin
Priority: P1    
Hardware: Intel   
OS: Linux   
Kernel Version: 5.12.0-rc4 (net-next) Subsystem:
Regression: No Bisected commit-id:
Attachments: From the maschine with the intel nic
lspci output

Description Armin Wolf 2021-04-08 18:28:18 UTC
Created attachment 296297 [details]
From the maschine with the intel nic

When using a Python script to send max sized vlan packets
on a BCM4401 nic (driver: b44), the Intel I217-V nic (driver: e1000e) only receives packets with a maximum size of 1514 bytes and reports a length error for the 1518 bytes sized packet.

When sending the packet from the I217-V and receiving with the BCM4401 however, both packets are received without errors.

This still happens when both sides are directly connected thru a single ethernet cable.

Kernel version I217-V: 5.12.0-rc4 (net-next)
Kernel version BCM4401: 4.19.0-181

Python script:

from scapy.all import *

pkg1 = Ether(dst="FF:FF:FF:FF:FF:FF")/Dot1Q(vlan=100, type=0x8000)/Raw(load=b"\xFF" * 1500)
print("1st lenght: " + str(len(pkg1)) + " Byte + 4 Byte FCS")
sendp(pkg1, iface="eth0.100")

pkg2 = Ether(dst="FF:FF:FF:FF:FF:FF")/Dot1Q(vlan=100, type=0x8000)/Raw(load=b"\xFF" * 1496)
print("2nd lenght: " + str(len(pkg2)) + " Byte + 4 Byte FCS")
sendp(pkg2, iface="eth0.100")
Comment 1 Armin Wolf 2021-04-08 18:29:05 UTC
Created attachment 296299 [details]
lspci output
Comment 2 Jesse Brandeburg 2021-04-23 01:52:39 UTC
The e1000e driver was designed with single vlan in mind. The driver also doesn't check transmit length and will just send whatever it's told to, so that explains the ability to transmit.

As for your network interface, it supports jumbos up to 9022 bytes, and it appears from your test, since you're using eth0.100 (which inserts a vlan tag) and also building a frame manually that has a vlan tag, you're using double vlans (QinQ)

So, if you adjust the max size of the interface to MTU 1504, everything will start to work, but your interface may try to send packets out the base eth0 interface that will be too large, so it's only a temporary workaround.

I think it would be ok for us to allow 1522 (double vlan) as the maximum length for e1000e by default, but we'd have to make a patch to do that, or you can.
Comment 3 Jesse Brandeburg 2021-04-23 02:04:58 UTC
Also, did you understand that the 8021q driver puts a VLAN tag in every packet sent on a vlan interface? I'm wondering if that is the source of all the confusion.

If you want to test if double vlans will work, you might want to try creating another vlan on top of eth0.100 and then send a "plain/no vlan" ethernet packet using that interface in scapy.

Basically, what were you trying to test exactly? What packet did you want on the wire?

dst / src / vlan / packet
or
dst / src / vlan / vlan / packet

?
Comment 4 Armin Wolf 2021-06-26 22:21:29 UTC
I didnt know that.
I think this "bug" is resolved then.