summaryrefslogtreecommitdiff
path: root/datapath
Commit message (Collapse)AuthorAgeFilesLines
* datapath: vxlan: Only set has-GBP bit in header if any other bits would be setThomas Graf2015-02-121-0/+3
| | | | | | | | | | | | | | vxlan: Only set has-GBP bit in header if any other bits would be set This allows for a VXLAN-GBP socket to talk to a Linux VXLAN socket by not setting any of the bits. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net> Upstream: db79a621835e ("vxlan: Only set has-GBP bit in header if any other bits would be set") Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Account for "vxlan: Eliminate dependency on UDP socket in transmit ↵Thomas Graf2015-02-063-10/+14
| | | | | | | | | | | | | | | | | | | | | | | | path" Excludes VXLAN_F_REMCSUM_TX bits as OVS currently doesn't support it. Upstream commit: vxlan: Eliminate dependency on UDP socket in transmit path In the vxlan transmit path there is no need to reference the socket for a tunnel which is needed for the receive side. We do, however, need the vxlan_dev flags. This patch eliminate references to the socket in the transmit path, and changes VXLAN_F_UNSHAREABLE to be VXLAN_F_RCV_FLAGS. This mask is used to store the flags applicable to receive (GBP, CSUM6_RX, and REMCSUM_RX) in the vxlan_sock flags. Signed-off-by: Tom Herbert <therbert@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> Upstream: af33c1adae1e ("vxlan: Eliminate dependency on UDP socket in transmit path") Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Support VXLAN Group Policy extensionThomas Graf2015-02-067-19/+223
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Upstream commit: openvswitch: Support VXLAN Group Policy extension Introduces support for the group policy extension to the VXLAN virtual port. The extension is disabled by default and only enabled if the user has provided the respective configuration. ovs-vsctl add-port br0 vxlan0 -- \ set Interface vxlan0 type=vxlan options:exts=gbp The configuration interface to enable the extension is based on a new attribute OVS_VXLAN_EXT_GBP nested inside OVS_TUNNEL_ATTR_EXTENSION which can carry additional extensions as needed in the future. The group policy metadata is stored as binary blob (struct ovs_vxlan_opts) internally just like Geneve options but transported as nested Netlink attributes to user space. Renames the existing TUNNEL_OPTIONS_PRESENT to TUNNEL_GENEVE_OPT with the binary value kept intact, a new flag TUNNEL_VXLAN_OPT is introduced. The attributes OVS_TUNNEL_KEY_ATTR_VXLAN_OPTS and existing OVS_TUNNEL_KEY_ATTR_GENEVE_OPTS are implemented mutually exclusive. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net> Upstream: 1dd144 ("openvswitch: Support VXLAN Group Policy extension") Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Fix missing symbols when required to use own VXLAN stackThomas Graf2015-02-054-7/+14
| | | | | | | | | | | | | | | Fixes an insufficient ifdef in compat/vxlan.c which caused required symbols not to be included in the build. The declarations were properly enabled so the build would succeed but the module would spit missing symbols when being inserted. The fix uses a new define USE_UPSTREAM_VXLAN which is set in the compat header <net/vxlan.h> as required. This centralizes the decision when to include VXLAN compat code to a single place which eases further changes. Reported-by: Pravin Shelar <pshelar@nicira.com> Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: update exact match lookup hash value to avoid hash collisionAndy Zhou2015-02-031-1/+8
| | | | | | | | | | | Currently, the exact match cache lookup uses 'skb->hash' as an index. In most cases, this value will be the same for pre and post recirculation lookup, threshing the exact match cache. This patch avoid this hash collision by using the rehashed value, by mixing in in the 'recirc_id', as the lookup index. Signed-off-by: Andy Zhou <azhou@nicira.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Account for "netlink: make nlmsg_end() and genlmsg_end() void"Thomas Graf2015-02-031-3/+6
| | | | | | | | | genlmsg_end() no longer returns an error value. Not a problem as it never returned an error code anyway. Upstream: 053c09 ("netlink: make nlmsg_end() and genlmsg_end() void") Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Account for "genetlink: pass only network namespace to ↵Thomas Graf2015-02-032-6/+15
| | | | | | | | | | | | | | | | | | | | genl_has_listeners()" Upstream commit: genetlink: pass only network namespace to genl_has_listeners() There's no point to force the caller to know about the internal genl_sock to use inside struct net, just have them pass the network namespace. This doesn't really change code generation since it's an inline, but makes the caller less magic - there's never any reason to pass another socket. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net> Upstream: f8403a2 ("genetlink: pass only network namespace to genl_has_listeners()") Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Allow for any level of nesting in flow attributesThomas Graf2015-02-031-51/+56
| | | | | | | | | | | | | | | | Upstream commit: openvswitch: Allow for any level of nesting in flow attributes nlattr_set() is currently hardcoded to two levels of nesting. This change introduces struct ovs_len_tbl to define minimal length requirements plus next level nesting tables to traverse the key attributes to arbitrary depth. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net> Upstream: 81bfe3 ("openvswitch: Allow for any level of nesting in flow attributes") Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Rename GENEVE_TUN_OPTS() to TUN_METADATA_OPTS()Thomas Graf2015-02-033-41/+49
| | | | | | | | | | | | | | | | | | | | Backport of upstream commit: openvswitch: Rename GENEVE_TUN_OPTS() to TUN_METADATA_OPTS() Also factors out Geneve validation code into a new separate function validate_and_copy_geneve_opts(). A subsequent patch will introduce VXLAN options. Rename the existing GENEVE_TUN_OPTS() to reflect its extended purpose of carrying generic tunnel metadata options. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net> Upstream: d91641d ("openvswitch: Rename GENEVE_TUN_OPTS() to TUN_METADATA_OPTS()") Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Account for "vxlan: add x-netns support"Thomas Graf2015-02-033-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Upstream commit: vxlan: add x-netns support This patch allows to switch the netns when packet is encapsulated or decapsulated. The vxlan socket is openned into the i/o netns, ie into the netns where encapsulated packets are received. The socket lookup is done into this netns to find the corresponding vxlan tunnel. After decapsulation, the packet is injecting into the corresponding interface which may stand to another netns. When one of the two netns is removed, the tunnel is destroyed. Configuration example: ip netns add netns1 ip netns exec netns1 ip link set lo up ip link add vxlan10 type vxlan id 10 group 239.0.0.10 dev eth0 dstport 0 ip link set vxlan10 netns netns1 ip netns exec netns1 ip addr add 192.168.0.249/24 broadcast 192.168.0.255 dev vxlan10 ip netns exec netns1 ip link set vxlan10 up Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: David S. Miller <davem@davemloft.net> Upstream: f01ec1c017de ("vxlan: add x-netns support") Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Account for "vxlan: Group Policy extension"Thomas Graf2015-02-033-28/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Upstream commit: vxlan: Group Policy extension Implements supports for the Group Policy VXLAN extension [0] to provide a lightweight and simple security label mechanism across network peers based on VXLAN. The security context and associated metadata is mapped to/from skb->mark. This allows further mapping to a SELinux context using SECMARK, to implement ACLs directly with nftables, iptables, OVS, tc, etc. The group membership is defined by the lower 16 bits of skb->mark, the upper 16 bits are used for flags. SELinux allows to manage label to secure local resources. However, distributed applications require ACLs to implemented across hosts. This is typically achieved by matching on L2-L4 fields to identify the original sending host and process on the receiver. On top of that, netlabel and specifically CIPSO [1] allow to map security contexts to universal labels. However, netlabel and CIPSO are relatively complex. This patch provides a lightweight alternative for overlay network environments with a trusted underlay. No additional control protocol is required. Host 1: Host 2: Group A Group B Group B Group A +-----+ +-------------+ +-------+ +-----+ | lxc | | SELinux CTX | | httpd | | VM | +--+--+ +--+----------+ +---+---+ +--+--+ \---+---/ \----+---/ | | +---+---+ +---+---+ | vxlan | | vxlan | +---+---+ +---+---+ +------------------------------+ Backwards compatibility: A VXLAN-GBP socket can receive standard VXLAN frames and will assign the default group 0x0000 to such frames. A Linux VXLAN socket will drop VXLAN-GBP frames. The extension is therefore disabled by default and needs to be specifically enabled: ip link add [...] type vxlan [...] gbp In a mixed environment with VXLAN and VXLAN-GBP sockets, the GBP socket must run on a separate port number. Examples: iptables: host1# iptables -I OUTPUT -m owner --uid-owner 101 -j MARK --set-mark 0x200 host2# iptables -I INPUT -m mark --mark 0x200 -j DROP OVS: # ovs-ofctl add-flow br0 'in_port=1,actions=load:0x200->NXM_NX_TUN_GBP_ID[],NORMAL' # ovs-ofctl add-flow br0 'in_port=2,tun_gbp_id=0x200,actions=drop' [0] https://tools.ietf.org/html/draft-smith-vxlan-group-policy [1] http://lwn.net/Articles/204905/ Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net> Upstream: 351149 ("vxlan: Group Policy extension") Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Account for now exposed VXLAN definitionsThomas Graf2015-02-032-11/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This brings the compat version of vxlan_udp_encap_recv() and vxlan_xmit_skb() in line with upstream commit: commit 3bf3947526c1053ddf2523f261395d682718f56c Author: Tom Herbert <therbert@google.com> Date: Thu Jan 8 12:31:18 2015 -0800 vxlan: Improve support for header flags This patch cleans up the header flags of VXLAN in anticipation of defining some new ones: - Move header related definitions from vxlan.c to vxlan.h - Change VXLAN_FLAGS to be VXLAN_HF_VNI (only currently defined flag) - Move check for unknown flags to after we find vxlan_sock, this assumes that some flags may be processed based on tunnel configuration - Add a comment about why the stack treating unknown set flags as an error instead of ignoring them Signed-off-by: Tom Herbert <therbert@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> Upstream: 3bf394 ("vxlan: Improve support for header flags") Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Account for "rename vlan_tx_* helpers since "tx" is misleading there"Thomas Graf2015-02-0312-24/+29
| | | | | | | | | | | | | | Upstream commit: net: rename vlan_tx_* helpers since "tx" is misleading there The same macros are used for rx as well. So rename it. Signed-off-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net> Upstream: df8a39d ("net: rename vlan_tx_* helpers since "tx" is misleading there") Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* dpif: Use separate OVS_PACKET_ATTR_PROBE for packet messgesThomas Graf2015-01-152-1/+6
| | | | | | | | | | | | | | | | User space is currently sending a OVS_FLOW_ATTR_PROBE for both flow and packet messages. This leads to an out-of-bounds access in ovs_packet_cmd_execute() because OVS_FLOW_ATTR_PROBE > OVS_PACKET_ATTR_MAX. Introduce a new OVS_PACKET_ATTR_PROBE with the same numeric value as OVS_FLOW_ATTR_PROBE to grow the range of accepted packet attributes while maintaining binary compatibility with existing OVS binaries. Fixes: 9233ce ("datapath: Add support for OVS_FLOW_ATTR_PROBE.") Reported-by: Sander Eikelenboom <linux@eikelenboom.it> Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Jesse Gross <jesse@nicira.com>
* datapath: Bug setting vlan tci in compat functionThomas F Herbert2015-01-121-1/+1
| | | | | | | | This patch fixes a bug when pushing vlans. It causes vlans to be transmitted with the TPID instead of the tci on the inner vlan. Signed-off-by: Thomas F Herbert <thomasfherbert@entpnt.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Account for new flags args of vxlan_sock_add()Thomas Graf2015-01-073-3/+3
| | | | | | | | | | | | | The upstream commit 359a0ea ("vxlan: Add support for UDP checksums (v4 sending, v6 zero csums)") has introduced a new flags argument to vxlan_sock_add(). OVS does not pass any flags at this point, thus specyfing 0 will be compatible with both the old ipv6 bool and the new u32 flags argument. Upstream: 359a0ea ("vxlan: Add support for UDP checksums (v4 sending, v6 zero csums)") Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: replace remaining users of arch_fast_hash with jhashThomas Graf2015-01-076-214/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch effectively reverts commit 500f80872645 ("net: ovs: use CRC32 accelerated flow hash if available"), and other remaining arch_fast_hash() users such as from nfsd via commit 6282cd565553 ("NFSD: Don't hand out delegations for 30 seconds after recalling them.") where it has been used as a hash function for bloom filtering. While we think that these users are actually not much of concern, it has been requested to remove the arch_fast_hash() library bits that arose from [1] entirely as per recent discussion [2]. The main argument is that using it as a hash may introduce bias due to its linearity (see avalanche criterion) and thus makes it less clear (though we tried to document that) when this security/performance trade-off is actually acceptable for a general purpose library function. Lets therefore avoid any further confusion on this matter and remove it to prevent any future accidental misuse of it. For the time being, this is going to make hashing of flow keys a bit more expensive in the ovs case, but future work could reevaluate a different hashing discipline. [1] https://patchwork.ozlabs.org/patch/299369/ [2] https://patchwork.ozlabs.org/patch/418756/ Upstream: 8754589 ("net: replace remaining users of arch_fast_hash with jhash") Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: introduce rtnl ops stubThomas Graf2015-01-073-1/+25
| | | | | | | | | This stub now allows userspace to see IFLA_INFO_KIND for ovs master and IFLA_INFO_SLAVE_KIND for slave. Upstream: 5b9e7e16 ("openvswitch: introduce rtnl ops stub") Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: move vlan pop/push functions into common codeThomas Graf2015-01-073-73/+117
| | | | | | | | | | | | | | | So it can be used from out of openvswitch code. Did couple of cosmetic changes on the way, namely variable naming and adding support for 8021AD proto. Note on backwards compatability: Unlike the upstream version, the backport of skb_vlan_push() does not support translating a hardware accelerated 8021AD tag to software. This is not a problem though as it preserves existing behaviour. Upstream: 93515d53 ("net: move vlan pop/push functions into common code") Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: move make_writable helper into common codeThomas Graf2015-01-073-25/+32
| | | | | | | | | note that skb_make_writable already exists in net/netfilter/core.c but does something slightly different. Upstream: e219512 ("net: move make_writable helper into common code") Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Add __vlan_insert_tag() compat helper if not availableThomas Graf2015-01-071-0/+29
| | | | | | | | | | | Since older kernels do not have skb->vlan_proto, it is assumed that kernels which don't provide their own __vlan_insert_tag() will also not have skb->vlan_proto. The backwards compat function therefore only supports ETH_P_8021Q as the protocol type. Upstream: 15255a43 ("vlan: introduce __vlan_insert_tag helper which does not free skb") Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Account for rename to vlan_insert_tag_set_proto()Thomas Graf2015-01-078-22/+27
| | | | | | | | | __vlan_put_tag() was renamed to vlan_insert_tag_set_proto() with the argument list kept intact. Upstream: 62749e ("vlan: rename __vlan_put_tag to vlan_insert_tag_set_proto") Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Consistently include VLAN header in flow and port stats.Ben Pfaff2015-01-062-3/+4
| | | | | | | | | | | | | | | | | | Until now, when VLAN acceleration was in use, the bytes of the VLAN header were not included in port or flow byte counters. They were however included when VLAN acceleration was not used. This commit corrects the inconsistency, by always including the VLAN header in byte counters. Previous discussion at http://openvswitch.org/pipermail/dev/2014-December/049521.html Already committed to upstream Linux netdev tree as 24cc59d1ebaac54d933dc0b30abcd8bd86193eef. Reported-by: Motonori Shindo <mshindo@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com> Reviewed-by: Flavio Leitner <fbl@sysclose.org> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Simplify vport_send() error handling.Pravin B Shelar2014-12-236-17/+37
| | | | | | | | | | | | Today vport-send has complex error handling because it involves freeing skb and updating stats depending on return value from vport send implementation. This can be simplified by delegating responsibility of freeing skb to the vport implementation for all cases. So that vport-send needs just update stats. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* datapath: compat: introduce ovs_iptunnel_handle_offloads()Pravin B Shelar2014-12-236-75/+107
| | | | | | | | handle offload code is replicated for different tunneling protocols define compat function to simplify the code. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* datapath:compat: Fix build failure on old kernels.Pravin B Shelar2014-12-198-21/+45
| | | | | | Reported by Travis. Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Fix MPLS action validation.Pravin B Shelar2014-12-194-14/+8
| | | | | | | | | | | | | | Linux stack do not allow GSO for packet with multiple encapsulations. Therefore there was check in MPLS action validation to detect such case, But it is better to add such check at run time to detect such cases. Removing this check also fixes bug in action copy to no skip multiple set actions. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Reported-by: Srinivas Neginhal <sneginha@vmware.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com> Bug #1367702
* datapath: Account for already defined NETIF_F_GSO_ENCAP_ALLThomas Graf2014-12-091-0/+3
| | | | | | Relates-to: f6eec614 ("openvswitch: Enable tunnel GSO for OVS bridge.") Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Check if nla_is_last() is available in <net/netlink.h>Thomas Graf2014-12-091-1/+1
| | | | | | | | | nla_is_last() is not available in 3.18, it's only in net-next. Convert to grep based to check to account for distribution backports. Fixes: 684b5f ("datapath: Rename last_action() as nla_is_last() and move to netlink.h") Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Add UFID interface to openvswitch.h.Joe Stringer2014-12-022-0/+32
| | | | | | | | | | An upcoming set of patches will implement support for indexing flows by Unique Flow IDentifiers (UFID) rather than the traditional unmasked key. This patch implements the interface changes required. The implementation will follow. Signed-off-by: Joe Stringer <joestringer@nicira.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Use ccflags-y instead of deprecated EXTRA_CFLAGSThomas Graf2014-12-011-5/+5
| | | | | | | | | | | This allows users to pass in additional compiler flags through the environment variable EXTRA_CFLAGS, e.g. make EXTRA_CFLAGS=-Wno-error=foo V=1 Reported-by: Alexandru Ardelean <ardeleanalex@gmail.com> Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Don't validate IPv6 label masks.Joe Stringer2014-11-251-1/+1
| | | | | | | | | | | | | | | | When userspace doesn't provide a mask, OVS datapath generates a fully unwildcarded mask for the flow by copying the flow and setting all bits in all fields. For IPv6 label, this creates a mask that matches on the upper 12 bits, causing the following error: openvswitch: netlink: Invalid IPv6 flow label value (value=ffffffff, max=fffff) This patch ignores the label validation check for masks, avoiding this error. Signed-off-by: Joe Stringer <joestringer@nicira.com> Acked-by: Pravin B Shelar <pshelar@nicira.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* datapath: compat: Fix build on RHEL 6.6Pravin B Shelar2014-11-192-1/+7
| | | | | | | | RHEL 6.6 kernel percpu APIs are broken, so following patch is using OVS backported version. Reported-by: Wang Sheng-Hui <shhuiw@gmail.com> Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
* openvswitch: Userspace tunneling.Pravin B Shelar2014-11-121-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | Following patch adds support for userspace tunneling. Tunneling needs three more component first is routing table which is configured by caching kernel routes and second is ARP cache which build automatically by snooping arp. And third is tunnel protocol table which list all listening protocols which is populated by vswitchd as tunnel ports are added. GRE and VXLAN protocol support is added in this patch. Tunneling works as follows: On packet receive vswitchd check if this packet is targeted to tunnel port. If it is then vswitchd inserts tunnel pop action which pops header and sends packet to tunnel port. On packet xmit rather than generating Set tunnel action it generate tunnel push action which has tunnel header data. datapath can use tunnel-push action data to generate header for each packet and forward this packet to output port. Since tunnel-push action contains most of packet header vswitchd needs to lookup routing table and arp table to build this action. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Ben Pfaff <blp@nicira.com>
* datapath: fix coding style.Pravin B Shelar2014-11-099-216/+198
| | | | | | | | | Kernel datapath code has diverged from upstream code. This makes porting patches between these two code bases harder than it needs to be. Following patch fixes this by fixing coding style issues on this branch. Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Fix few mpls issues.Pravin B Shelar2014-11-0912-47/+135
| | | | | | | Found during MPLS upstreaming. Also sync-up MPLS header files with upstream code. Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Rename last_action() as nla_is_last() and move to netlink.hSimon Horman2014-11-092-8/+10
| | | | | | | | | | | | | | | | | | | | The original motivation for this change was to allow the helper to be used in files other than actions.c as part of work on an odp select group action. It was as pointed out by Thomas Graf that this helper would be best off living in netlink.h. Furthermore, I think that the generic nature of this helper means it is best off in netlink.h regardless of if it is used more than one .c file or not. Thus, I would like it considered independent of the work on an odp select group action. Cc: Thomas Graf <tgraf@suug.ch> Cc: Pravin Shelar <pshelar@nicira.com> Cc: Andy Zhou <azhou@nicira.com> Signed-off-by: Simon Horman <simon.horman@netronome.com> Acked-by: Thomas Graf <tgraf@noironetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: Convert dp rcu read operation to locked operationsPravin B Shelar2014-11-041-7/+7
| | | | | | | | | | | | dp read operations depends on ovs_dp_cmd_fill_info(). This API needs to looup vport to find dp name, but vport lookup can fail. Therefore to keep vport reference alive we need to take ovs lock. Found by code inspection. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Andy Zhou <azhou@nicira.com>
* datapath: Fix compat checks for ipv6_skip_exthdr()Pravin B Shelar2014-11-032-7/+7
| | | | Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
* doc: Convert docs to Markdown languageThomas Graf2014-10-282-26/+26
| | | | | | | | | | | Converts the majority of docs over to use the Markdown language for pretty printing on GitHub. It's a rough first convertion without exploiting the full potential of Markdown at this point. Section titles and indentation are fixed as needed. Minimal docs interlinking is added. Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath: Use upstream ipv6_find_hdr().Pravin B Shelar2014-10-233-16/+23
| | | | | | | | | | | ipv6_find_hdr() already fixed in newer upstram kernel by Ansis, we can start using this API safely. This patch also backports fix (ipv6: ipv6_find_hdr restore prev functionality) to compat ipv6_find_hdr(). CC: Ansis Atteka <aatteka@nicira.com> Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Andy Zhou <azhou@nicira.com>
* datapath: Fix comment style.Pravin B Shelar2014-10-2310-21/+41
| | | | | | | Use netdev comment style. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Andy Zhou <azhou@nicira.com>
* datapath: Replace __force type cast with rcu_dereference_raw().Pravin B Shelar2014-10-233-6/+6
| | | | | | | | rcu_dereference_raw() api is cleaner way of accessing RCU pointer when no locking is required. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Andy Zhou <azhou@nicira.com>
* datapath: net: make skb_gso_segment error handling more robustPravin B Shelar2014-10-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | skb_gso_segment has three possible return values: 1. a pointer to the first segmented skb 2. an errno value (IS_ERR()) 3. NULL. This can happen when GSO is used for header verification. However, several callers currently test IS_ERR instead of IS_ERR_OR_NULL and would oops when NULL is returned. Note that these call sites should never actually see such a NULL return value; all callers mask out the GSO bits in the feature argument. However, there have been issues with some protocol handlers erronously not respecting the specified feature mask in some cases. It is preferable to get 'have to turn off hw offloading, else slow' reports rather than 'kernel crashes'. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: David S. Miller <davem@davemloft.net> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: fix a use after freeLi RongQing2014-10-171-5/+6
| | | | | | | | | | | | | pskb_may_pull() called by arphdr_ok can change skb->data, so put the arp setting after arphdr_ok to avoid the use the freed memory Fixes: 0714812134d7d ("openvswitch: Eliminate memset() from flow_extract.") Cc: Jesse Gross <jesse@nicira.com> Cc: Eric Dumazet <edumazet@google.com> Signed-off-by: Li RongQing <roy.qing.li@gmail.com> Acked-by: Jesse Gross <jesse@nicira.com> Signed-off-by: David S. Miller <davem@davemloft.net> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: use vport instead of pFabian Frederick2014-10-171-2/+2
| | | | | | | | | | | All functions used struct vport *vport except ovs_vport_find_upcall_portid. This fixes 1 kerneldoc warning Signed-off-by: Fabian Frederick <fabf@skynet.be> Acked-by: Pravin B Shelar <pshelar@nicira.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* datapath: compat: Fix compilation 3.11Pravin B Shelar2014-10-137-9/+9
| | | | | | | | | Kernel 3.11 is only kernel where GRE APIs are available but not vxlan. Add check for vxlan xmit to detect this case. Reported-by: Dave Benson <dbenson@verdantnetworks.com> Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Andy Zhou <azhou@nicira.com>
* datapath: Add support for RHEL-7 / CentOS-7 kernel.Pravin B Shelar2014-10-0311-13/+40
| | | | | | | | | This patch mostly is related to tunnel API where RHEL 7 kernel API are not in-sync with newer linux kernel API. So extra checks are required to check for parameters of API. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jiri Benc <jbenc@redhat.com>
* datapath: Add support for OVS_FLOW_ATTR_PROBE.Jarno Rajahalme2014-10-037-127/+187
| | | | | | | | | This new flag is useful for suppressing error logging while probing for datapath features using flow commands. For backwards compatibility reasons the commands are executed normally, but error logging is suppressed. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: avoid hard coding OVS_VPORT_TYPE_GENEVEAndy Zhou2014-10-021-1/+1
| | | | | | | | | OVS_VPORT_TYPE_GENEVE is currently hard coded to 6. This is not necessary since slot 5 has not been taken yet. Drop the hard coded value to before upstreaming GENEVE support to Linux kernel. Signed-off-by: Andy Zhou <azhou@nicira.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>