This series implements support for layer 3 encapsulated packets. At the core of this change is removing the assumption that all packets/flows have Ethernet header. Support for layer 3 packets in GRE tunnels is also added by this patchset.
The implementation automatically adds appropriate pop_eth and push_eth actions to datapath flows. This may change in the future if OpenFlow support for these actions is added. This series is based on work by Lorand Jakab, Thomas Morin and others. Unlike Lorand's work this series does not update the kernel datapath nor the LISP vport implementation in the version of the kernel datapath in the OVS tree. Rather it focuses only on userspace including the user-space datapath, and provides layer 3 GRE support. It should, however, be in keeping with his goal of providing a clean path for porting the LISP datapath support to the mainline kernel for inclusion there. To aid review this series is available at: tree: https://github.com//horms/openvswitch branch: me/l3-vpn tag: l3-vpn-v11 I have prepared a separate series for the kernel datapath against the net-next tree. I plan to post it in conjunction with this patchset as: "[PATCH v10 net-next 0/7] openvswitch: support for layer 3 encapsulated packets" It may be found on github: tree: https://github.com//horms/linux branch: me/l3-vpn tag: l3-vpn-v10 Key Changes from v10: * Omit type field from push_eth action, it is not needed as the type of the packet is already known * Do not allow setting of OVS_KEY_ATTR_PACKET_ETHERTYPE field. This does not seem necessary and is not used at this time. * Update for new kernel implementation that uses ARPHRD_NONE devices * Correct OVS_KEY_ATTR_NEXT_BASE_LAYER handling in odp_flow_key_from_flow__() and parse_l2_5_onward() so that the encoding and decoding of the next_base_layer field of a flow key is consistent both with itself on encode and decode and with other fields of the flow key. * Guard OVS_KEY_ATTR_TUNNEL_INFO with #ifndef __KERNEL__ in openvswitch.h and note that it is only used by the user-space datapath * Append "(layer3)" to when showing layer3 tunnel ports as they may share the same ODP port as a non-layer3 tunnel port. This seems simpler than v10 which included an O(n**2) filter on showing duplicate ports. * Added Acks from Ben Pfaff Key Changes from v9: * Reworked GRE changes to make use of a mode rather than a new tunnel type for layer 3 * Ensure that packets sent to controller have an ethernet header * Avoid popping ethernet header multiple times resulting in a corrupted packet * Set packet_ethtype in set_ethertype() * Do not include zero-value OVS_KEY_ATTR_PACKET_ETHERTYPE attribute in flow key of layer 2 packets as this creates an unnecessary incompatibility with kernel datapaths that are unaware of that attribute. * Don't update tnl_port_map_lookup() to always match on next_base_layer: the implementation didn't actually do that and thus was a lot of code change for no behavioural change. Key Changes from v8: * Rebased * Addressed review of v8 (I picked most of this out of Jakubs tree on github) * Support non-IP packets * Support non-tap GRE vports Key Changes from v7: * Rebased * Addressed Jesse's comments: * Clean up ovs_packet_cmd_execute() * Use attributes instead of reaching into the IP header to determine L3 protocol Key Changes from v6: * Rebased * Patch 2: Removed MFF_ETH_SRC and MFF_ETH_DST from Ethernet prerequisites to allow setting Ethernet addresses in push_eth without knowing a priori the layer of the output port; this will be reverted when {push,pop}_eth will be explicit (see above) * Patch 3: Re-added "key->eth.tci = 0" in flow_extract(), since removal broke validation of flows * Added support for layer 3 packets in "ovs_packet" netlink messages which execute actions on a packet received in a miss upcall. Support is in two new commits, one for user space, one for the linux datapath, to make review easier. Key Changes from v5: * Addressed the new round of comments from Jesse * Renamed noeth to is_layer3 * Fixed is_layer3 wildcarding * Fixed style issues Key Changes from v4: * Addressed the new round of comments from Jesse * Rebased several times Key Changes from v3: * Addressed the new round of comments from Ben * Rebased several times Key Changes from v2: * Addressed the new round of comments from Ben * Addressed Jesse's comments * Rebased several times Key Changes from the initial version: * Addressed all comments from Ben's review * Fixed all failing unit tests Lorand Jakab (3): userspace: add support for pop_eth and push_eth actions userspace: add layer 3 flow and switching support userspace: add layer 3 support to packet metadata Simon Horman (2): userspace: extend layer 3 support to cover non-IP packets userspace: add non-tap (l3) support to GRE vports build-aux/extract-ofp-fields | 1 + datapath/flow_netlink.c | 2 +- datapath/linux/compat/include/linux/openvswitch.h | 17 ++ include/openvswitch/flow.h | 20 +- include/openvswitch/match.h | 1 + include/openvswitch/meta-flow.h | 9 +- include/openvswitch/ofp-print.h | 8 +- lib/dp-packet.h | 14 +- lib/dpif-netdev.c | 6 +- lib/dpif-netlink.c | 4 + lib/dpif.c | 9 +- lib/flow.c | 122 +++++++---- lib/flow.h | 2 + lib/match.c | 13 +- lib/meta-flow.c | 10 + lib/netdev-bsd.c | 2 + lib/netdev-dummy.c | 1 + lib/netdev-linux.c | 5 +- lib/netdev-native-tnl.c | 26 ++- lib/netdev-vport.c | 22 +- lib/netdev.h | 1 + lib/nx-match.c | 2 +- lib/odp-execute.c | 22 ++ lib/odp-util.c | 246 +++++++++++++++++----- lib/odp-util.h | 8 +- lib/ofp-print.c | 27 ++- lib/ofp-util.c | 2 +- lib/packets.c | 33 +++ lib/packets.h | 6 + lib/tnl-ports.c | 51 +++-- lib/tnl-ports.h | 3 +- ofproto/ofproto-dpif-rid.h | 2 +- ofproto/ofproto-dpif-sflow.c | 9 + ofproto/ofproto-dpif-xlate.c | 36 +++- ofproto/ofproto-dpif-xlate.h | 2 +- ofproto/ofproto-dpif.c | 4 +- ofproto/tunnel.c | 4 +- tests/ofproto-dpif.at | 6 +- tests/tunnel-push-pop-ipv6.at | 12 +- tests/tunnel-push-pop.at | 36 +++- tests/tunnel.at | 10 +- vswitchd/vswitch.xml | 13 ++ 42 files changed, 652 insertions(+), 177 deletions(-) -- 2.1.4 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev