[dpdk-dev] [PATCH] net/ixgbe: Strip SR-IOV transparent VLANs in VF

Robert Shearman robertshearman at gmail.com
Tue Sep 4 11:57:39 CEST 2018


Hi Qi,

On 04/09/2018 03:16, Zhang, Qi Z wrote:
>> -----Original Message-----
>> From: Robert Shearman [mailto:robertshearman at gmail.com]
>> Sent: Monday, September 3, 2018 9:14 PM
>> To: Zhang, Qi Z <qi.z.zhang at intel.com>; dev at dpdk.org
>> Cc: Lu, Wenzhuo <wenzhuo.lu at intel.com>; Ananyev, Konstantin
>> <konstantin.ananyev at intel.com>; Robert Shearman
>> <robert.shearman at att.com>
>> Subject: Re: [dpdk-dev] [PATCH] net/ixgbe: Strip SR-IOV transparent VLANs in
>> VF
>>
>> Hi Qi,
>>
>> On 03/09/2018 12:45, Zhang, Qi Z wrote:
>>> Hi Robert:
>>>
>>>> -----Original Message-----
>>>> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of
>>>> robertshearman at gmail.com
>>>> Sent: Saturday, August 25, 2018 12:35 AM
>>>> To: dev at dpdk.org
>>>> Cc: Lu, Wenzhuo <wenzhuo.lu at intel.com>; Ananyev, Konstantin
>>>> <konstantin.ananyev at intel.com>; Robert Shearman
>>>> <robert.shearman at att.com>
>>>> Subject: [dpdk-dev] [PATCH] net/ixgbe: Strip SR-IOV transparent VLANs
>>>> in VF
>>>>
>>>> From: Robert Shearman <robert.shearman at att.com>
>>>>
>>>> SR-IOV VFs support "transparent" VLANs. Traffic from/to a VM
>>>> associated with a VF has a VLAN tag inserted/stripped in a manner
>>>> intended to be totally transparent to the VM.  On a Linux hypervisor
>>>> the vlan can be specified by "ip link set <device> vf <n> vlan <v>".
>>>> The VM VF driver is not configured to use any VLAN and the VM should
>>>> never see the transparent VLAN for that reason.  However, in practice
>>>> these VLAN headers are being received by the VM which discards the
>>>> packets as that VLAN is unknown to it.  The Linux kernel ixbge driver
>>>> explicitly removes the VLAN in this case (presumably due to the
>>>> hardware not being able to do this) but the DPDK driver does not.
>>>
>>> I'm not quite understand this part.
>>> What does explicitly remove the VLAN means?, DPDK also discard
>>> unmatched VLAN and strip vlan if vlan_strip is enabled what is the gap?
>>> It will be better if you can give same examples
>>
>> Sure. Typical use case for this is a hypervisor where it is necessary to provide
>> L2 access into the guests, but there are insufficient, and so the hypervisor is
>> using the PF and VFs are assigned to guests. In order to avoid having to
>> configure each guest to use the VLAN and to not send any untagged traffic it is
>> desirable to use transparent VLANs. For example:
>> Guest 1 = VLAN 10
>> Guest 2 = VLAN 20
>>
>> ip link set eth0 vf 1 vlan 10
>> ip link set eth0 vf 2 vlan 20
>>
>> Now this means that packets arriving tagged on the physical port should be
>> delivered to the guest and arrive in the guest untagged. Similarly, packets
>> transmitted untagged by the guest should gain a tag before they go out of the
>> physical port. What you get when using the Linux VF ixgbe driver inside the
>> VMs is exactly this since the driver knows that for this hardware the
>> transparent stripping isn't done in hardware and is done inside the driver.
>> What you get currently when using the DPDK VF ixgbe driver inside the VMs is
>> that packets arrive tagged (e.g. with VLAN tag 10) and these are then dropped
>> because the VM doesn't know about VLAN 10.
>>
>> Transparent VLAN insertion works currently with both Linux and DPDK VF
>> drivers.
> 
> What do you mean "stripping isn't done in hardware" and "packets arrived tagged"?
> Let me explain how PMD driver works. (or it is expected)
> if we enable vlan_strip, the VLAN header is expected to be stripped from packet data by hardware.
> And in rx descriptor, it still keep the stripped vlan information, so driver will set mbuf->ol_flags with PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED and also set stripped vlan tag to mbuf->vlan_tci
> So in my review, it is "stripping is done and packets arrived with untagged", and application also know what exactly happened and make decision based on the requirement
> 
> So do you mean ixgbevf does not support vlan_strip as a hardware offload?, and it should be done with software?
> But in your code, I didn't see the part that vlan header is stripped from the packet data. ( set mbuf->ol_flag and mbuf->vlan_tci does not mean the vlan is stripped)

I understand how the VLAN stripping hardware offload is supposed to 
work, but this use case is distinct from VLAN stripping and it was my 
mistake to use that loaded term in my explanation of the use case.

The expectation in this case is that the packet arrive completely 
untagged, i.e. whether the VLAN has been stripped and placed in metadata 
or not. The application running inside the VM expects the packet to 
arrive is if the VLAN tag was never there.

The application cannot do the removal of the VLAN tag itself because in 
this use case it is implicit that it shouldn't know about the tag and 
the presence of the tag is driver/hardware specific.

Thanks for highlighting the PKT_RX_VLAN_STRIPPED flag - I should remove 
that as well when the transparent VLAN filter triggers.

Thanks,
Rob


More information about the dev mailing list