[ovs-dev] [PATCH v4 2/3] userspace: add layer 3 flow and switching support

Lori Jakab lojakab at cisco.com
Mon Jul 7 17:58:00 UTC 2014


On 7/7/14, 7:23 PM, Ben Pfaff wrote:
> On Fri, Jun 27, 2014 at 04:21:54PM +0300, Lorand Jakab wrote:
>> This commit relaxes the assumption that all packets have an Ethernet
>> header, and adds support for layer 3 flows.  For each packet received on
>> the Linux kernel datapath the l2 and l3 members of struct ofpbuf are
>> intialized appropriately, and some functions now expect this (notably
>> flow_extract()), in order to differentiate between layer 2 and layer 3
>> packets.  struct flow has now a new 'base_layer' member, because we
>> cannot assume that a flow has no Ethernet header when eth_src and
>> eth_dst are 0.  For layer 3 packets, the protocol type is still stored
>> in the eth_type member.
>>
>> Switching L2->L3 and L3->L2 are both implemented by adding the pop_eth
>> and push_eth actions respectively when a transition is detected.  The
>> push_eth action puts 0s on both source and destination MACs.  These
>> addresses can be modified with mod_dl_dst and mod_dl_src actions.
>>
>> Added new prerequisite MFP_ETHERNET for fields MFF_ETH_SRC, MFF_ETH_DST,
>> MFF_VLAN_TCI, MFF_DL_VLAN, MFF_VLAN_VID and MFF_DL_VLAN_PCP.
>>
>> Signed-off-by: Lorand Jakab <lojakab at cisco.com>
> "sparse" warnings:
>
> ../lib/meta-flow.c:1148:26: warning: incorrect type in assignment (different base types)
> ../lib/meta-flow.c:1148:26:    expected unsigned int [unsigned] [usertype] base_layer
> ../lib/meta-flow.c:1148:26:    got restricted __be32 [usertype] <noident>
> ../lib/odp-util.c:3484:26: warning: incorrect type in assignment (different base types)
>    CC     lib/ofp-util.lo
> ../lib/odp-util.c:3484:26:    expected unsigned int [unsigned] [usertype] base_layer
> ../lib/odp-util.c:3484:26:    got restricted __be32

Fixed in my personal repo, fixes will be in v5.

>
> Otherwise this looks good to me.

Thanks for reviewing.




More information about the dev mailing list