summaryrefslogtreecommitdiff
path: root/lib/dpif-netlink.c
Commit message (Collapse)AuthorAgeFilesLines
* dpif-netdev: Purge all ukeys when reconfigure pmd.Alex Wang2015-09-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | When dpdk configuration changes, all pmd threads are recreated and rx queues of each port are reloaded. After this process, rx queue could be mapped to a different pmd thread other than the one before reconfiguration. However, this is totally transparent to ofproto layer modules. So, if the ofproto-dpif-upcall module still holds ukeys generated before pmd thread recreation, this old ukey will collide with the ukey for the new upcalls from same traffic flow, causing flow installation failure. To fix the bug, this commit adds a new call-back function in dpif layer for notifying upper layer the purging of datapath (e.g. pmd thread deletion in dpif-netdev). So, the ofproto-dpif-upcall module can react properly with deleting the ukeys and with collecting flows' last stats. Reported-by: Ilya Maximets <i.maximets@samsung.com> Signed-off-by: Alex Wang <ee07b291@gmail.com> Acked-by: Daniele Di Proietto <diproiettod@vmware.com> Tested-by: Daniele Di Proietto <diproiettod@vmware.com> Acked-by: Joe Stringer <joestringer@nicira.com>
* tunneling: Remove gre64 tunnel support.Pravin B Shelar2015-08-201-5/+0
| | | | | | | | | | GRE64 was introduced to extend gre key from 32-bit to 64-bit using gre-key and sequence number field. But GRE64 is not standard protocol. There are not many users of this protocol. Therefore we have decided to remove it. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* Extend sFlow agent to report tunnel and MPLS structuresNeil McKee2015-07-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Packets are still sampled at ingress only, so the egress tunnel and/or MPLS structures are only included when there is just 1 output port. The actions are either provided by the datapath in the sample upcall or looked up in the userspace cache. The former is preferred because it is more reliable and does not present any new demands or constraints on the userspace cache, however the code falls back on the userspace lookup so that this solution can work with existing kernel datapath modules. If the lookup fails it is not critical: the compiled user-action-cookie is still available and provides the essential output port and output VLAN forwarding information just as before. The openvswitch actions can express almost any tunneling/mangling so the only totally faithful representation would be to somehow encode the whole list of flow actions in the sFlow output. However the standard sFlow tunnel structures can express most common real-world scenarios, so in parsing the actions we look for those and skip the encoding if we see anything unusual. For example, a single set(tunnel()) or tnl_push() is interpreted, but if a second such action is encountered then the egress tunnel reporting is suppressed. The sFlow standard allows "best effort" encoding so that if a field is not knowable or too onerous to look up then it can be left out. This is often the case for the layer-4 source port or even the src ip address of a tunnel. The assumption is that monitoring is enabled everywhere so a missing field can typically be seen at ingress to the next switch in the path. This patch also adds unit tests to check the sFlow encoding of set(tunnel()), tnl_push() and push_mpls() actions. The netlink attribute to request that actions be included in the upcall from the datapath is inserted for sFlow sampling only. To make that option be explicit would require further changes to the printing and parsing of actions in lib/odp-util.c, and to scripts in the test suite. Further enhancements to report on 802.1AD QinQ, 64-bit tunnel IDs, and NAT transformations can follow in future patches that make only incremental changes. Signed-off-by: Neil McKee <neil.mckee@inmon.com> [blp@nicira.com made stylistic and semantic changes] Signed-off-by: Ben Pfaff <blp@nicira.com>
* dpif-netlink: Fix compiler warning.Alin Serdean2015-07-131-2/+2
| | | | | | | warning C4098: 'dpif_netlink_init_flow_del' : 'void' function returning a value Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath: Add Stateless TCP Tunneling protocol.Pravin B Shelar2015-04-291-0/+5
| | | | | | | | | | | | | | | | | The Stateless TCP Tunnel (STT) protocol encapsulates traffic in IPv4/TCP packets. STT uses TCP segmentation offload available in most of NIC. On packet xmit STT driver appends STT header along with TCP header to the packet. For GSO packet GSO parameters are set according to tunnel configuration and packet is handed over to networking stack. This allows use of segmentation offload available in NICs The protocol is documented at http://www.ietf.org/archive/id/draft-davie-stt-06.txt Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* dpif-provider: Add class init function.Daniele Di Proietto2015-04-141-0/+1
| | | | | | | | This init function is called when the dpif class is registered. It will be used by following commits Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* ofpbuf: Simplify ofpbuf API.Pravin B Shelar2015-03-031-7/+7
| | | | | | | | | | | | ofpbuf was complicated due to its wide usage across all layers of OVS, Now we have introduced independent dp_packet which can be used for datapath packet, we can simplify ofpbuf. Following patch removes DPDK mbuf and access API of ofpbuf members. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* dp-packet: Remove ofpbuf dependency.Pravin B Shelar2015-03-031-10/+10
| | | | | | | | | | | | | Currently dp-packet make use of ofpbuf for managing packet buffers. That complicates ofpbuf, by making dp-packet independent of ofpbuf both libraries can be optimized for their own use case. This avoids mapping operation between ofpbuf and dp_packet in datapath upcalls. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* tunnel: Provide framework for tunnel extensions for VXLAN-GBP and othersThomas Graf2015-02-061-3/+17
| | | | | | | | | | | | Supports a new "exts" field in the tunnel configuration which takes a comma separated list of enabled extensions. The only extension supported so far is GBP but this can be used to enable RCO and possibly others as soon as the OVS datapath supports them. Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Ben Pfaff <blp@nicira.com>
* ovs-dpctl: Do not report pmd info for 'dpif-netlink' datapath.Alex Wang2015-02-031-1/+1
| | | | | | | | | | | | In 'ovs-dpctl dump-flows' output, we should only report the pmd related info for 'dpif-netdev' datapath. However, current implementation also reports uninitialized pmd info for 'dpif-netlink' datapath, which is very confusing to users. This commit fixes it. Signed-off-by: Alex Wang <alexw@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* setup n_upcall_pids for vport_request when destroy all channelsGao feng2015-01-221-0/+1
| | | | | | | | Setup the n_upcall_pids to 1, otherwise the OVS_VPORT_ATTR_UPCALL_PID nlattr will be incorrect. Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com> Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
* dpif: Use separate OVS_PACKET_ATTR_PROBE for packet messgesThomas Graf2015-01-151-1/+1
| | | | | | | | | | | | | | | | 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>
* dpif-netlink: Drop oversized packets instead of assert-failing.Ben Pfaff2015-01-111-11/+29
| | | | | | | | | | | | | A packet sent to a Netlink datapath has to fit within a Netlink attribute. Until now, this was only checked in an assertion inside the Netlink code, which meant that trying to send a too-large packet (approximate 64 kB or larger) would assert-fail. It's better to just drop those packets, which this commit does. Reported-by: Shuping Cui <scui@redhat.com> Reported-by: Jiri Benc <jbenc@redhat.com> Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* dpif-netdev: Add per-pmd flow-table/classifier.Alex Wang2014-12-301-0/+1
| | | | | | | | | | | | | | | | | | | | | This commit changes the per dpif-netdev datapath flow-table/ classifier to per pmd-thread. As direct benefit, datapath and flow statistics no longer need to be protected by mutex or be declared as per-thread variable, since they are only written by the owning pmd thread. As side effects, the flow-dump output of userspace datapath can contain overlapping flows. To reduce confusion, the dump from different pmd thread will be separated by a title line. In addition, the flow operations via 'ovs-appctl dpctl/*' are modified so that if the given flow in_port corresponds to a dpdk interface, the operation will be conducted to all pmd threads recv from that interface (expect for flow-get which will always be applied to non-pmd threads). Signed-off-by: Alex Wang <alexw@nicira.com> Tested-by: Mark D. Gray <mark.d.gray@intel.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* dpif: Shift ufid support checking up to dpif_backer.Joe Stringer2014-12-191-45/+1
| | | | | | | | | | | | | | | | | Previously, the dpif layer was responsible for determining datapath support for UFIDs, which resulted in all ovs-dpctl utilities inserting/deleting flows from the datapath each time they are run. Shift this responsibility up to the dpif_backer. There are two users of this functionality: Revalidators check for UFID support to request a terser dump using UFIDs, and dpif-netlink uses this to request flow_del operations to only return the UFID/stats. The latter case was previously hidden from revalidators, but this change makes them aware of it, and reuses the same "udpif->enable_ufid" flag for reducing overhead of both flow dump and flow delete. Signed-off-by: Joe Stringer <joestringer@nicira.com> Acked-by: Andy Zhou <azhou@nicira.com>
* lib: Move vlog.h to <openvswitch/vlog.h>Thomas Graf2014-12-151-1/+1
| | | | | | | | A new function vlog_insert_module() is introduced to avoid using list_insert() from the vlog.h header. Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Ben Pfaff <blp@nicira.com>
* dpif: Refactor datapath feature detection.Joe Stringer2014-12-121-42/+2
| | | | | | | | | Various functions in ofproto-dpif and dpif-netlink detect support for features in very similar ways. Refactor their common code to a single function. Signed-off-by: Joe Stringer <joestringer@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* dpif: Minimize memory copy for revalidation.Joe Stringer2014-12-021-20/+35
| | | | | | | | | | | | | | | | | | One of the limiting factors on the number of flows that can be supported in the datapath is the overhead of assembling flow dump messages in the datapath. This patch modifies the dpif to allow revalidators to skip dumping the key, mask and actions from the datapath, by making use of the unique flow identifiers introduced in earlier patches. For each flow dump, the dpif user specifies whether to skip these attributes, allowing the common case to only dump a pair of 128-bit ID and flow stats. With datapath support, this increases the number of flows that a revalidator can handle per second by 50% or more. Support in dpif-netdev and dpif-netlink is added in this patch; kernel support is left for future patches. Signed-off-by: Joe Stringer <joestringer@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* dpif: Index flows using unique identifiers.Joe Stringer2014-12-021-21/+178
| | | | | | | | | | | | | | | | | | | | | | | This patch modifies the dpif interface to allow flows to be manipulated using a 128-bit identifier. This allows revalidator threads to perform datapath operations faster, as they do not need to serialise the entire flow key for operations like flow_get and flow_delete. In conjunction with a future patch to simplify the dump interface, this provides a significant performance benefit for revalidation. When handlers assemble flow_put operations, they specify a unique identifier (UFID) for each flow as it is passed down to the datapath to be stored with the flow. The UFID is currently provided to handlers by the dpif during upcall processing. When revalidators assemble flow_get or flow_del operations, they may specify the UFID for the flow along with the key. The dpif will decide whether to send only the UFID to the datapath, or both the UFID and flow key. The former is preferred for newer datapaths that support UFID, while the latter is used for backwards compatibility. Signed-off-by: Joe Stringer <joestringer@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* dpif-netlink: Fix windows build.Joe Stringer2014-11-251-1/+1
| | | | | | | | Commit 7af12bd "dpif: Generate flow_hash for revalidators in dpif." broke compilation on windows. Fix it. Signed-off-by: Joe Stringer <joestringer@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* dpif: Generate flow_hash for revalidators in dpif.Joe Stringer2014-11-251-8/+14
| | | | | | | | | | | | | | | | | | | | | | | This patch shifts the responsibility for determining the hash for a flow from the revalidation logic down to the dpif layer. This assists in handling backward-compatibility for revalidation with the upcoming unique flow identifier "UFID" patches. A 128-bit UFID was selected to minimize the likelihood of hash conflicts. Handler threads will not install a flow that has an identical UFID as another flow, to prevent misattribution of stats and to ensure that the correct flow key cache is used for revalidation. For datapaths that do not support UFID, which is currently all datapaths, the dpif will generate the UFID and pass it up during upcall and flow_dump. This is generated based on the datapath flow key. Later patches will add support for datapaths to store and interpret this UFID, in which case the dpif has a responsibility to pass it through transparently. Signed-off-by: Joe Stringer <joestringer@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* openvswitch: Userspace tunneling.Pravin B Shelar2014-11-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* bridge: Store datapath version into ovsdbAndy Zhou2014-11-051-0/+31
| | | | | | | | | | | OVS userspace are backward compatible with older Linux kernel modules. However, not having the most up-to-date datapath kernel modules can some times lead to user confusion. Storing the datapath version in OVSDB allows management software to check and optionally provide notifications to users. Signed-off-by: Andy Zhou <azhou@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* dpif-netlink: Add support for packet receive on Windows.Nithin Raju2014-10-231-55/+293
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In this patch, we add support in dpif-netlink.c to receive packets on Windows. Windows does not natively support epoll(). Even though there are mechanisms/interfaces that provide functionality similar to epoll(), we take a simple approach of using a pool of sockets. Here are some details of the implementaion to aid review: 1. There's pool of sockets per upcall handler. 2. The pool of sockets is initialized while setting up the handler in dpif_netlink_refresh_channels() primarily. 3. When sockets are to be allocated for a vport, we walk through the pool of sockets for all handlers and pick one of the sockets in each of the pool. Within a handler's pool, sockets are picked in a round-robin fashion. 4. We currently support only 1 handler, since there are some kernel changes needed for support more than 1 handler per vport. 5. The pool size is also set to 1 currently. The restructions imposed by #4 and #5 can be removed in the future without much code churn. Validation: 1. With a hacked up kernel which figures out the netlink socket that is designated to receive packets, we are cable to perform pings between 2 VMs on the same Hyper-V host. 2. Compiled the code in Linux as well. 3. Tested with pool size == 2 as well, though in this patch we set the pool size = 1. Signed-off-by: Nithin Raju <nithin@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* dpif: Use OVS_FLOW_ATTR_PROBE.Jarno Rajahalme2014-10-031-0/+11
| | | | | | | | Use the new OVS_FLOW_ATTR_PROBE flag when probing for datapath feature support. Suppress also dpif error logging when requested, as probe failures are already logged at ofproto-dpif. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* dpif-netdev: Allow multi-rx-queue, multi-pmd-thread configuration.Alex Wang2014-09-191-0/+1
| | | | | | | | | | | | | | This commits adds the multithreading functionality to OVS dpdk module. Users are able to create multiple pmd threads and set their cpu affinity via specifying the cpu mask string similar to the EAL '-c COREMASK' option. Also, the number of rx queues for each dpdk interface is made configurable to help distribution of rx packets among multiple pmd threads. Signed-off-by: Alex Wang <alexw@nicira.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
* dpif-netlink: rename linux_flow variable to datapath_flowNithin Raju2014-09-191-16/+16
| | | | | | | | | In the flow related functions, there's a stack variable called 'linux_flow'. Since this code is not specific to Linux anymore, in this patch, we rename the variable to 'datpath_flow'. Signed-off-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* dpif-linux: Rename dpif-netlink; change to compile with MSVC.Alin Gabriel Serdean2014-09-181-0/+2496
The patch contains the necessary modifications to compile and also to run under MSVC. Added the files to the build system and also changed dpif_linux to be under a more generic name dpif_windows. Added a TODO under the windows part in case we want to implement another counterpart for epoll functions. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@nicira.com>