question about eth and vlan item in flow pattern
    Thomas Monjalon 
    thomas at monjalon.net
       
    Wed Apr 10 14:33:18 CEST 2024
    
    
  
Hello,
10/04/2024 13:37, Jie Hai:
> Hi, all,
> 
> I have some questions about the sub-options for ``VLAN`` and ``ETH`` item.
If it is not clear in the doxygen documentation,
please do not hesitate to submit a patch to make it more explicit.
> According to the documentation, ``has_vlan`` is sub-option of ``ETH``
> item and it means that the pattern contains at least one vlan.
Yes
> The ``VLAN`` item is used to match tagged packets and have some
> sub-options such as ``vid``, ``tci``, etc.
> 
> If we combine them, what should the effect be?
> For instance,
> 
> rule-0: flow create 0 ingress pattern  eth  has_vlan is 1 / vlan  / end 
> actions queue index 2 / end
I don't think the item "vlan" has any impact here.
I mean it is redundant with "has_vlan".
> rule-1: flow create 0 ingress pattern  eth  has_vlan is 1 / vlan vid is 
> 10 / end actions queue index 2 / end
> 
> For rule-0, should it match single-tagged packets only or multi-tagged 
> only or both?
I would say it matches 1 VLAN or more.
> That is to say, which one will take effect, `has_vlan is 1`  or `vlan` 
> or both?
I think it is redundant.
The real interesting usage of "has_vlan" would be for matching untagged packets.
> For rule-2, which packets should it match, with inner VLAN id 10, or 
You mean rule-1
> outer VLAN id 10, or both 10?
In case of QinQ, I suppose specifying only 1 VLAN allows to match either inner or outer.
> The hns3 driver supports only the exact matching of VLAN numer.
> And it is planned to adapt ``has_vlan`` and ``has_more_vlan`` to the
> meaning of one VLAN for hns3 driver. Therefore, if the preceding 
> combinations are supported, we need to confirm the exact meanings.
> 
> So, what are your views on the above question?
I'm adding Ori Kam, maintainer of rte_flow API to confirm.
    
    
More information about the dev
mailing list