[ovs-dev] [PATCH 3/5] odp-util: Fix converting masked VLAN from flow.

Rajahalme, Jarno (NSN - FI/Espoo) jarno.rajahalme at nsn.com
Fri Jun 28 08:07:09 UTC 2013


On Jun 28, 2013, at 4:43 , ext Jesse Gross wrote:

> It's a validation limitation: if you have a vlan packet then you need
> to have an exact match on a corresponding EtherType. If you only want
> to match on the Ethernet header then it's fully maskable.
> 

On OpenFlow (& meta-flow etc.) ethertype is "unmaskable" i.e. only full mask is supported.
So even if kernel now allows bitwise masking, such masks are not generated.

 Jarno

> On Thu, Jun 27, 2013 at 6:30 PM, Ethan Jackson <ethan at nicira.com> wrote:
>> Is the lack of support for bitwise masking if the ethertype a kernel
>> limitation or a userspace one?  If it's a userspace limitation I think
>> we should handle the case where it could be bitwise.  If it's a kernel
>> limitation, I think the current patch is fine.
>> 
>> Acked-by: Ethan Jackson <ethan at nicira.com>
>> 
>> On Thu, Jun 27, 2013 at 6:16 PM, Justin Pettit <jpettit at nicira.com> wrote:
>>> When converting the VLAN from a flow to an ODP key, the processing logic
>>> would always store the VLAN ethertype.  However, when handling a mask,
>>> it should be a mask, not an ethertype.  And since we don't support
>>> bit-wise masking of the ethertype, just make it an exact-match mask.
>>> 
>>> Signed-off-by: Justin Pettit <jpettit at nicira.com>
>>> ---
>>> lib/odp-util.c |    6 +++++-
>>> 1 files changed, 5 insertions(+), 1 deletions(-)
>>> 
>>> diff --git a/lib/odp-util.c b/lib/odp-util.c
>>> index 7724be4..5be8118 100644
>>> --- a/lib/odp-util.c
>>> +++ b/lib/odp-util.c
>>> @@ -2285,7 +2285,11 @@ odp_flow_key_from_flow__(struct ofpbuf *buf, const struct flow *data,
>>>    memcpy(eth_key->eth_dst, data->dl_dst, ETH_ADDR_LEN);
>>> 
>>>    if (flow->vlan_tci != htons(0) || flow->dl_type == htons(ETH_TYPE_VLAN)) {
>>> -        nl_msg_put_be16(buf, OVS_KEY_ATTR_ETHERTYPE, htons(ETH_TYPE_VLAN));
>>> +        if (is_mask) {
>>> +            nl_msg_put_be16(buf, OVS_KEY_ATTR_ETHERTYPE, htons(UINT16_MAX));
>>> +        } else {
>>> +            nl_msg_put_be16(buf, OVS_KEY_ATTR_ETHERTYPE, htons(ETH_TYPE_VLAN));
>>> +        }
>>>        nl_msg_put_be16(buf, OVS_KEY_ATTR_VLAN, data->vlan_tci);
>>>        encap = nl_msg_start_nested(buf, OVS_KEY_ATTR_ENCAP);
>>>        if (flow->vlan_tci == htons(0)) {
>>> --
>>> 1.7.5.4
>>> 
>>> _______________________________________________
>>> dev mailing list
>>> dev at openvswitch.org
>>> http://openvswitch.org/mailman/listinfo/dev
>> X-CudaMail-Whitelist-To: dev at openvswitch.org
>> _______________________________________________
>> dev mailing list
>> dev at openvswitch.org
>> http://openvswitch.org/mailman/listinfo/dev
> X-CudaMail-Whitelist-To: dev at openvswitch.org
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev




More information about the dev mailing list