summaryrefslogtreecommitdiff
path: root/ofproto
Commit message (Collapse)AuthorAgeFilesLines
* treewide: Fix spelling of "prerequisites".Ben Pfaff2017-06-121-1/+1
| | | | | Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Greg Rose <gvrose8192@gmail.com>
* rstp: Add rstp port name for human reading.nickcooper-zhangtonghao2017-06-081-1/+1
| | | | | | | | | | This patch is useful to debug rstp subsystem and log the port name instead of port number. This patch will also be used to display rstp info for next patches. Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech> Acked-by: Jarno Rajahalme <jarno@ovn.org> Signed-off-by: Ben Pfaff <blp@ovn.org>
* userspace: L3 tunnel support for GRE and LISPJan Scheurich2017-06-021-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a boolean "layer3" configuration option for tunnel vports. The layer3 option defaults to false for all ports except LISP. GRE ports accept both true and false for "layer3". A tunnel vport configured with layer3=true receives L3 packets. which are then converted to Ethernet packets by pushing a dummy Ethernet heder at the ingress of the OpenFlow pipeline. The Ethernet header of a packet is stripped before sending to a layer3 tunnel vport. Presently a single GRE vport cannot carry both L2 and L3 packets. But it is possible to create two GRE vports representing the same GRE tunel, one with layer3=false, the other with layer3=true. L2 packet from the tunnel are received on the first vport, L3 packets on the second. The controller must send packets to the layer3 GRE vport to tunnel them without their Ethernet header. Units tests have been added to check the L3 tunnel handling. LISP tunnels are not yet supported by the netdev userspace datapath. Signed-off-by: Simon Horman <simon.horman@netronome.com> Signed-off-by: Jiri Benc <jbenc@redhat.com> Signed-off-by: Yi Yang <yi.y.yang@intel.com> Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com> Co-authored-by: Zoltan Balogh <zoltan.balogh@ericsson.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* userspace: Switching of L3 packets in L2 pipelineJan Scheurich2017-06-025-12/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ports have a new layer3 attribute if they send/receive L3 packets. The packet_type included in structs dp_packet and flow is considered in ofproto-dpif. The classical L2 match fields (dl_src, dl_dst, dl_type, and vlan_tci, vlan_vid, vlan_pcp) now have Ethernet as pre-requisite. A dummy ethernet header is pushed to L3 packets received from L3 ports before the the pipeline processing starts. The ethernet header is popped before sending a packet to a L3 port. For datapath ports that can receive L2 or L3 packets, the packet_type becomes part of the flow key for datapath flows and is handled appropriately in dpif-netdev. In the 'else' branch in flow_put_on_pmd() function, the additional check flow_equal(&match.flow, &netdev_flow->flow) was removed, as a) the dpcls lookup is sufficient to uniquely identify a flow and b) it caused false negatives because the flow in netdev->flow may not properly masked. In dpif_netdev_flow_put() we now use the same method for constructing the netdev_flow_key as the one used when adding the flow to the dplcs to make sure these always match. The function netdev_flow_key_from_flow() used so far was not only inefficient but sometimes caused mismatches and subsequent flow update failures. The kernel datapath does not support the packet_type match field. Instead it encodes the packet type implictly by the presence or absence of the Ethernet attribute in the flow key and mask. This patch filters the PACKET_TYPE attribute out of netlink flow key and mask to be sent to the kernel datapath. Signed-off-by: Lorand Jakab <lojakab@cisco.com> Signed-off-by: Simon Horman <simon.horman@netronome.com> Signed-off-by: Jiri Benc <jbenc@redhat.com> Signed-off-by: Yi Yang <yi.y.yang@intel.com> Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com> Co-authored-by: Zoltan Balogh <zoltan.balogh@ericsson.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofproto: Use shash_find_and_delete() in ofport_destroy__().Ben Pfaff2017-06-011-2/+1
| | | | | | | | | | | This is shorter and slightly safer than combining calls to shash_find() and shash_delete(). Found by Coverity. Reported-at: https://scan3.coverity.com/reports.htm#v16889/p10449/fileInstanceId=14762983&defectInstanceId=4305289&mergedDefectId=179850 Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
* Support accepting and displaying port names in OVS tools.Ben Pfaff2017-05-316-29/+37
| | | | | | | | | | | | | | Until now, most ovs-ofctl commands have not accepted names for ports, only numbers, and have not been able to display port names either. It's a lot easier for users if they can use and see meaningful names instead of arbitrary numbers. This commit adds that support. For backward compatibility, only interactive ovs-ofctl commands by default display port names; to display them in scripts, use the new --names option. Signed-off-by: Ben Pfaff <blp@ovn.org> Tested-by: Aaron Conole <aconole@redhat.com>
* stp: Add link-state checking support for stp ports.nickcooper-zhangtonghao2017-05-311-1/+37
| | | | | | | | | | | | | | When bridge stp enabled, we can enable the stp ports despite ports are down. When initializing, this patch checks link-state of ports and enable or disable them according to their link-state. This patch also allow user to enable and disable a port when bridge stp is running. If a stp port is in disable state, it can forward packets. If its link is down and this patch sets it to disable, there is no L2 loop. Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofp-util: Fix tun_metadata processing in packet-outYi-Hung Wei2017-05-311-2/+5
| | | | | | | | Pass tun_table to ofputil_handle_packet_out() to correctly decode tunnel metadata in packet-out messages. Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofproto: Add pipeline fields support for OF 1.5 packet-outYi-Hung Wei2017-05-311-2/+7
| | | | | | | | | | | | | | | | | | | | | | | This patch decodes pipeline fields from a packet-out message, and populates the pipeline fields into datapath. Error OFPERR_OFPBRC_PIPELINE_FIELDS_ONLY is returned if the match field of a packet-out messages contains any non pipeline fields. Currently, the supported pipeline fields are as following. * metadata fields: - in_port, in_port_oxm * tunnel fields: - tun_id, tun_src, tun_dst, tun_ipv6_src, tun_ipv6_dst - tun_gbp_id, tun_gpb_flags, tun_flags - tun_metadata0 - tun_metadata63 * register fields: - metadata - reg0 - reg-15, xreg0 - xreg7, xxreg0 - xxreg3 Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofp-util: Add flow metadata to ofputil_packet_outYi-Hung Wei2017-05-311-3/+3
| | | | | | | | | This patch adds flow metadata to ofputil_packet_out. It does not make any functional change. The flow metadata will be useful to support new packet-out message format in OpenFlow 1.5. Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* netflow: Fix memory leak in netflow_unref.Yunjian Wang2017-05-311-0/+8
| | | | | | | | The memory leak was triggered each time on calling netflow_unref() with containing netflow_flows. And flows need to be removed and destroyed. Signed-off-by: Yunjian Wang <wangyunjian@huawei.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* packets: Remove unnecessary "packed" annotations.Ben Pfaff2017-05-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I know of two reasons to mark a structure as "packed". The first is because the structure must match some defined interface and therefore compiler-inserted padding between or after members would cause its layout to diverge from that interface. This is not a problem in a structure that follows the general alignment rules that are seen in ABIs for all the architectures that OVS cares about: basically, that a struct member needs to be aligned on a boundary that is a multiple of the member's size. The second reason is because instances of the struct tend to be at misaligned addresses. struct eth_header and struct vlan_eth_header are normally aligned on 16-bit boundaries (at least), and they contain only 16-bit members, so there's no need to pack them. This commit removes the packed annotation. This commit also removes the packed annotation from struct llc_header. Since that struct only contains 8-bit members, I don't know of any benefit to packing it, period. This commit also removes a few more packed annotations that are much less important. When these packed annotations were removed, it caused a few warnings related to casts from 'uint8_t *' to more strictly aligned pointer types, related to struct ovs_action_push_tnl. That's because that struct had a trailing member used to store packet headers, that was declared as a uint8_t[]. Before, when this was cast to 'struct eth_header *', there was no change in alignment since eth_header was packed; now that eth_header is not packed, the compiler considers it suspicious. This commit avoids that problem by changing the member from uint8_t[] to uint32_t[], which assures the compiler that it is properly aligned. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Joe Stringer <joe@ovn.org>
* ofproto-dpif: Include EthType in ct_orig_tuple feature probeSairam Venugopal2017-05-261-5/+8
| | | | | | | | | | Set flow->dl_type to either ETH_TYPE_IP or ETH_TYPE_IPV6 when probing for ct_orig_tuple feature support. This can be expanded later on to check for both IPv4 and IPv6 support. Fixes: daf4d3c18da4 ("odp: Support conntrack orig tuple key.") Signed-off-by: Sairam Venugopal <vsairam@vmware.com> Signed-off-by: Joe Stringer <joe@ovn.org>
* ofproto-dpif-ipfix: add support for per-flow TCP countersPrzemyslaw Szczerbik2017-05-201-18/+126
| | | | | | | | This patch implements support for per-flow TCP IPFIX counters. It's based on RFC 5102, section 5.10. Signed-off-by: Przemyslaw Szczerbik <przemyslawx.szczerbik@intel.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofproto-dpif-xlate: refactor compose_output_action__Jan Scheurich2017-05-181-63/+85
| | | | | | | | | | | | The very long function compose_output_action__() has been re-factored to make the different cases for output to patch-port, native tunnel port, kernel tunnel port, recirculation, or termination of a native tunnel at output to LOCAL port clearer. Larger, self-contained blocks have been split out into separate functions. Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com> Co-authored-by: Zoltan Balogh <zoltan.balogh@ericsson.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofproto-dpif-xlate: Fix typos in comment.Ben Pfaff2017-05-181-1/+1
| | | | | Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Aaron Conole <aconole@redhat.com>
* Revert "tunneling: Avoid recirculation on datapath."Joe Stringer2017-05-101-146/+134
| | | | | | | | | | | | | | | | | | | This reverts commit f1dac5128ce6db2e493f0d1c7a8b53fb9f34476f. When this commit was introduced, it broke the 'make check-system-userspace' testsuite. It appears that the new translation fails to modify the flow in a way that would represent the flow as an encapsulated flow when the traffic is patched through to the second bridge. As such, rather than matching on, for example, "ip,proto=47" for gre, it would use the inner packet's flow headers. It also results in problems reporting statistics, as the tunnel's header is not reflected in subsequent statistics and truncation is not properly applied during translation. While a refreshed approach to solving the above problem is formed, revert this patch. Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2017-May/331972.html Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Greg Rose <gvrose8192@gmail.com>
* userspace: Support for push_eth and pop_eth actionsJan Scheurich2017-05-081-7/+7
| | | | | | | | | | | | | | | Add support for actions push_eth and pop_eth to the netdev datapath and the supporting libraries. This patch relies on the support for these actions in the kernel datapath to be present. Signed-off-by: Lorand Jakab <lojakab@cisco.com> Signed-off-by: Simon Horman <simon.horman@netronome.com> Signed-off-by: Jiri Benc <jbenc@redhat.com> Signed-off-by: Yi Yang <yi.y.yang@intel.com> Signed-off-by: Jean Tourrilhes <jt@labs.hpe.com> Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com> Co-authored-by: Zoltan Balogh <zoltan.balogh@ericsson.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofproto-dpif-ipfix: Add total counters.mweglicx2017-05-081-25/+85
| | | | | | | | Implementation of IPFix counters which hold total values measured since metering process startup. Signed-off-by: Michal Weglicki <michalx.weglicki@intel.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* userspace: Add packet_type in dp_packet and flowJan Scheurich2017-05-033-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds a packet_type attribute to the structs dp_packet and flow to explicitly carry the type of the packet as prepration for the introduction of the so-called packet type-aware pipeline (PTAP) in OVS. The packet_type is a big-endian 32 bit integer with the encoding as specified in OpenFlow verion 1.5. The upper 16 bits contain the packet type name space. Pre-defined values are defined in openflow-common.h: enum ofp_header_type_namespaces { OFPHTN_ONF = 0, /* ONF namespace. */ OFPHTN_ETHERTYPE = 1, /* ns_type is an Ethertype. */ OFPHTN_IP_PROTO = 2, /* ns_type is a IP protocol number. */ OFPHTN_UDP_TCP_PORT = 3, /* ns_type is a TCP or UDP port. */ OFPHTN_IPV4_OPTION = 4, /* ns_type is an IPv4 option number. */ }; The lower 16 bits specify the actual type in the context of the name space. Only name spaces 0 and 1 will be supported for now. For name space OFPHTN_ONF the relevant packet type is 0 (Ethernet). This is the default packet_type in OVS and the only one supported so far. Packets of type (OFPHTN_ONF, 0) are called Ethernet packets. In name space OFPHTN_ETHERTYPE the type is the Ethertype of the packet. A packet of type (OFPHTN_ETHERTYPE, <Ethertype>) is a standard L2 packet whith the Ethernet header (and any VLAN tags) removed to expose the L3 (or L2.5) payload of the packet. These will simply be called L3 packets. The Ethernet address fields dl_src and dl_dst in struct flow are not applicable for an L3 packet and must be zero. However, to maintain compatibility with the large code base, we have chosen to copy the Ethertype of an L3 packet into the the dl_type field of struct flow. This does not mean that it will be possible to match on dl_type for L3 packets with PTAP later on. Matching must be done on packet_type instead. New dp_packets are initialized with packet_type Ethernet. Ports that receive L3 packets will have to explicitly adjust the packet_type. Signed-off-by: Jean Tourrilhes <jt@labs.hpe.com> Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com> Co-authored-by: Zoltan Balogh <zoltan.balogh@ericsson.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* vswitchd: Add --cleanup option to the 'appctl exit' commandAndy Zhou2017-05-033-6/+9
| | | | | | | | | | | | | | | | | | 'appctl exit' stops the running vswitchd daemon, without releasing the datapath resources (such as bridges and ports) that vswitchd has created. This is expected when vswitchd is to be relaunched, to reduce the perturbation of exiting traffic and connections. However, when vswitchd is intended to be shutdown permanently, it is desirable not to leak datapath resources. In theory, this can be achieved by removing the corresponding configurations from OVSDB before shutting down vswitchd. However it is not always possible in practice. Sometimes it is convenient and robust for vswitchd to release all datapath resources that it has configured. Add 'appctl exit --cleanup' option for this use case. Signed-off-by: Andy Zhou <azhou@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* revalidator: Fix logging of xlate_key() failure.Joe Stringer2017-05-021-2/+2
| | | | | | | | | This was being logged using xlate_strerror(), but the return code is actually an errno code. Use ovs_strerror() instead. Fixes: dd0dc9eda0e0 ("revalidator: Reuse xlate_ukey from deletion.") Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* revalidator: Revalidate ukeys created from flows.Joe Stringer2017-05-021-1/+1
| | | | | | | | | | | | | | | | | | | | | If there is no active ukey for a particular datapath flow, and it is dumped from the datapath, then the revalidator threads will assemble a ukey based on the datapath flow. This will allow tracking of the stats for proper attribution, and future validation of the flow. However, until now when creating the ukey in this context, the ukey's 'reval_seq' has been set to the current udpif's reval_seq. This implies that the flow has been validated against the current flow table. However, this is not true - The flow appeared in the datapath without any prior knowledge in this OVS instance so we should set up the reval_seq of the ukey to ensure that the flow will be validated during the current dump/revalidation cycle. Refer also revalidate_ukey(). Fixes: 23597df05226 ("upcall: Create ukeys in handler threads.") Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* config: Define OVS_CT_EVENT_* mask macros.Jarno Rajahalme2017-04-281-3/+1
| | | | | | | | | | | Unconditionally define OVS_CT_EVENT_* macros for the datapath netlink interface so that we do not need to include platform dependent files. This fixes the build on non-Linux (and non-Windows) platforms. Also define a macro for the default set of events set by OVS userspace. Reported-by: Joe Stringer <joe@ovn.org> Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Joe Stringer <joe@ovn.org>
* ofproto: Meter slowpath action when action upcall meters are configuredAndy Zhou2017-04-281-3/+31
| | | | | | | | | | | | | If a slow path action is a controller action, meter it when the controller meter is configured. For other kinds of slow path actions, meter it when the slowpath meter is configured. Note, this patch only considers the meters configuration of the packet's input bridge, which may not be the same bridge that the action is generated. Signed-off-by: Andy Zhou <azhou@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* ofproto: Meter sample action when configured.Andy Zhou2017-04-281-2/+12
| | | | | | | | When slowpath meter is configured, add meter action when translate sample action. Signed-off-by: Andy Zhou <azhou@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* ofproto: Support action upcall metersAndy Zhou2017-04-282-3/+51
| | | | | | | | | | | Allow action upcall meters, i.e. slowpath and controller meters, to be added and displayed. Keep track of datapath meter ID of those action upcall meters in ofproto to aid action translation. Later patches will make use of them. Signed-off-by: Andy Zhou <azhou@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* ofproto-dpif: Add 'meter_ids' to backerAndy Zhou2017-04-282-3/+52
| | | | | | | | | | | | Add 'meter_ids', an id-pool object to manage datapath meter id, i.e. provider_meter_id. Currently, only userspace datapath supports meter, and it implements the provider_meter_id management. Moving this function to 'backer' allows other datapath implementation to share the same logic. Signed-off-by: Andy Zhou <azhou@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* ofproto: Store meters using hmapAndy Zhou2017-04-282-104/+153
| | | | | | | | | | | | | | | | | Currently, meters are stored in a fixed pointer array. It is not very efficient since the controller, at least in theory, can pick any meter id (up to the limits to uint32_t), not necessarily within the lower end of a region, or in close range to each other. In particular, OFPM_SLOWPATH and OFPM_CONTROLLER meters are specified at the high region. Switching to using hmap. Ofproto layer does not restrict the number of meters that controller can add, nor does it care about the value of meter_id. Datapth limits the number of meters ofproto layer can support at run time. Signed-off-by: Andy Zhou <azhou@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* xlate: Use OVS_CT_ATTR_EVENTMASK.Jarno Rajahalme2017-04-283-1/+73
| | | | | | | | | | | | | | | | | | | | | | | | Specify the event mask with CT commit including bits for CT features exposed at the OVS interface (mark and label changes in addition to basic creation and destruction of conntrack entries). Without this any listener of conntrack update events will typically (depending on system configuration) receive events for each L4 (e.g., TCP) state machine change, which can multiply the number of events received per connection. By including the new, related, and destroy events any listener of new conntrack events gets notified of new related and non-related connections, and any listener of destroy events will get notified of deleted (typically timed out) conntrack entries. By including the flags for mark and labels, any listener of conntrack update events gets notified whenever the connmark or conntrack labels are changed from the values reported within the new events. VMware-BZ: #1837218 Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Joe Stringer <joe@ovn.org>
* revalidator: Improve logging for transition_ukey().Joe Stringer2017-04-271-3/+22
| | | | | | | | | | There are a few cases where more introspection into ukey transitions would be relevant for logging or assertion. Track the SOURCE_LOCATOR and thread id when states are transitioned and use these for logging. Suggested-by: Jarno Rajahalme <jarno@ovn.org> Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* revalidator: Avoid assert in transition_ukey().Joe Stringer2017-04-271-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a case where a flow is dumped from the kernel after the ukey is already transitioned into an EVICTING/EVICTED/DELETED state, and the revalidator thread attempts to shift that into UKEY_OPERATIONAL because it was able to dump the flow from the datapath. This resulted in triggering the assert in transition_ukey(). Detect this condition and skip handling the flow (as it's already on its way out). Users report: > Program terminated with signal SIGABRT, Aborted. > raise () from /lib/x86_64-linux-gnu/libc.so.6 > raise () from /lib/x86_64-linux-gnu/libc.so.6 > abort () from /lib/x86_64-linux-gnu/libc.so.6 > ovs_abort_valist > vlog_abort_valist > vlog_abort > ovs_assert_failure > transition_ukey (ukey=<optimized out>, dst=<optimized out>) >     at ofproto/ofproto-dpif-upcall.c:1674 > revalidate (revalidator=0x1cb36c8) at ofproto/ofproto-dpif-upcall.c:2324 > udpif_revalidator (arg=0x1cb36c8) at ofproto/ofproto-dpif-upcall.c:901 > ovsthread_wrapper (aux_=<optimized out>) at lib/ovs-thread.c:348 > start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0 > clone () from /lib/x86_64-linux-gnu/libc.so.6 VMware-BZ: #1857694 Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofproto-dpif-xlate: Fix the memory leak in netflow.Sha Zhang2017-04-241-0/+1
| | | | | | | | The memory leak was triggered each time on creating a netflow and subsequently deleting it. Signed-off-by: Sha Zhang <zhangsha.zhang@huawei.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofproto: Add support of OFPR_PACKET_OUT as packet-in reasonYi-Hung Wei2017-04-243-1/+10
| | | | | | | | | | | This patch adds support of OFPR_PACKET_OUT as the packet-in reason. This packet-in reason is a required feature for OF1.4+, and it indicates that the associated packet-in message to the controller is triggered when the switch is processing a packet-out message. This reason code is enabled by default when OF1.4+ is used. Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* connmgr: Fix internal packet-in reason code mask.Yi-Hung Wei2017-04-241-0/+10
| | | | | | | | | | | | | | | | Starting from OpenFlow 1.4+, OFPR_ACTION is split into four more descriptive reasons, OFPR_APPLY_ACTION, OFPR_ACTION_SET, OFPR_GROUP, and OFPR_PACKET_OUT. OVS maintains the new reason code internally, and it currently supports the first three reason code. If the version of an established OpenFlow connection is less than 1.4, OVS converts the internal reason code back to OFPR_ACTION to be backward compatible. However, the internal packet-in reason code mask is not properly maintained for the older OpenFlow version that may emit the packet-in messages wth the new reason code. It is because OVS does not enable the new reason code internally in the reason code mask for older OpenFlow version. This commit tries to address the aforementioned issue. Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofproto-dpif: Fix memory leak in disable_datapath_clone()Yi-Hung Wei2017-04-241-0/+1
| | | | | | | | | | | | | | | | | In testcase "ofproto-dpif - clone action", valgrind reports a memory leak with the following call stack. xrealloc (util.c:123) ds_reserve (dynamic-string.c:63) ds_put_format_valist (dynamic-string.c:161) ds_put_format (dynamic-string.c:142) disable_datapath_clone (ofproto-dpif.c:5206) process_command (unixctl.c:313) run_connection (unixctl.c:347) unixctl_server_run (unixctl.c:400) main (ovs-vswitchd.c:112) Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofproto: Fix memory leak in handle_tlv_table_mod()Yi-Hung Wei2017-04-221-0/+2
| | | | | | | | | | | | | | | | | | | | In testcase "tunnel - Geneve metadata", valgrind reports a memory leak with the following call stack. xcalloc (util.c:95) tun_metadata_alloc (tun-metadata.c:89) tun_metadata_table_mod (tun-metadata.c:175) handle_tlv_table_mod (ofproto.c:7856) handle_openflow__ (ofproto.c:8036) handle_openflow (ofproto.c:8098) ofconn_run (connmgr.c:1427) connmgr_run (connmgr.c:363) ofproto_run (ofproto.c:1815) bridge_run__ (bridge.c:2915) bridge_run (bridge.c:2972) main (ovs-vswitchd.c:111) Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* rstp/stp: Unref the rstp/stp when bridges destroyed.nickcooper-zhangtonghao2017-04-211-0/+2
| | | | | | | | | | | | | | When bridges destroyed, which stp enabled, you can still get stp info via the command 'ovs-appctl stp/show'. And the rstp is also in the same case. We should unref them. The rstp/stp ports have been unregistered via 'ofproto_port_unregister' function when ports destroyed. We will unref rstp/stp struct in the 'destruct' of ofproto-dpif provider. Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* tunneling: Avoid recirculation on datapath.Sugesh Chandran2017-04-211-134/+146
| | | | | | | | | | | | | | | | | | | | | | | Open vSwitch datapath recirculates packets for tunneling, i.e. the incoming packets are encapsulated at first pass. Further actions are applied on encapsulated packets on the second pass after recirculating. The proposed patch compute and append the post tunnel actions at the time of translation itself instead of recirculating at datapath. These actions are solely depends on tunnel attributes so there is no need of datapath recirculation. By avoiding the recirculation at datapath, the patch offers up to 30% performance improvement for VXLAN tunneling in our testing. The action execution logic is using the new CLONE action to define the packet cloning when the actions are combined. The length in the CLONE action specifies the size of nested action set. It also fixing the testsuite failures that are introduced by nested CLONE action in tunneling. Signed-off-by: Sugesh Chandran <sugesh.chandran@intel.com> Signed-off-by: Zoltán Balogh <zoltan.balogh@ericsson.com> Co-authored-by: Zoltán Balogh <zoltan.balogh@ericsson.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofproto: Report only un-deleted groups in group stats replies.Ben Pfaff2017-04-211-1/+4
| | | | | | | | | | | | | Deleted groups hang around in the group table until the next grace period, so it's important for the group stats code to pretend that they're gone until they really get deleted. Reported-by: "Timothy M. Redaelli" <tredaelli@redhat.com> Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2017-April/331117.html Signed-off-by: Ben Pfaff <blp@ovn.org> Tested-by: Timothy Redaelli <tredaelli@redhat.com> Acked-by: Greg Rose <gvrose8192@gmail.com> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* ofproto-dpif: Propagate may_enable flag as link aliveness.László Sürü2017-04-212-4/+31
| | | | | | | | | | | | | | | | | | | | The idea is to use OFPPS_LIVE bit to propagate link aliveness state towards the controller also when sending port status. The ofport->may_enable flag could be used for this purpose, thus any change in LIVE bit is propagated towards conrtoller in OFPT_PORT_STATUS message. OFPPS_LIVE bit is set only when links is not down not administratively, neither operationally as recommended in OF papers. I added 9 new unit tests to verify link state changes when monitored with cfm, bfd or lacp for OF 1.3, OF 1.4 and OF 1.5. I updated related unit tests according to the changes of ofproto-dpif. Signed-off-by: László Sürü <laszlo.suru at ericsson.com> Co-authored-by: Zoltán Balogh <zoltan.balogh at ericsson.com> Signed-off-by: Zoltán Balogh <zoltan.balogh at ericsson.com> Co-authored-by: Jan Scheurich <jan.scheurich at ericsson.com> Signed-off-by: Jan Scheurich <jan.scheurich at ericsson.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* flow: New function flow_clear_conntrack().Ben Pfaff2017-04-211-17/+1
| | | | | | | This will have a new user in an upcoming commit. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Miguel Angel Ajo <majopela@redhat.com>
* ofproto-dpif: Check support for resubmit with conntrack action.Jarno Rajahalme2017-04-181-41/+45
| | | | | | | Use the existing probed support flag for the original direction tuple to determine if resubmit(ct) can be executed or not. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <bpl@ovn.org>
* ofproto-dpif: Check if original direction matches are supported.Jarno Rajahalme2017-04-181-1/+16
| | | | | | | Use the existing probed support flag for the original direction tuple to determine if matches on the original direction tuple can be supported. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <bpl@ovn.org>
* ofproto-dpif: Check support for CT action force commit flag.Jarno Rajahalme2017-04-181-0/+8
| | | | | | | | | | | | So far the force commit feature is implemented together with the original direction tuple feature by all datapaths, so we can use the support flag for the 'ct_orig_tuple' to indicate support for the force commit feature as well. Better fail the flow install than rely on ovs-vswitchd log being filled by error messages from the datapath. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <bpl@ovn.org>
* ofproto/bond: Make bond_may_recirc() private within bond.cAndy Zhou2017-04-173-18/+21
| | | | | | | Minor refactoring to make the bond code easier to read. Signed-off-by: Andy Zhou <azhou@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* Add support for OpenFlow 1.6 (draft) port status and port mod messages.Ben Pfaff2017-04-073-5/+9
| | | | | | | | | OpenFlow 1.6 adds support for EUI-64 addresses for ports, and extends the maximum length of OpenFlow port names from 16 to 64 bytes. ONF-JIRA: EXT-566 Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* ofproto: Use macros to define DPIF support fieldsAndy Zhou2017-04-032-40/+47
| | | | | | | | | | | | | | When adding a new field in the 'struct dpif_backer_support', the corresponding appctl show command should be updated to display the new field. Currently, there is nothing to remind the developer that to update the show command. This can lead to code maintenance issues. Switch to use macros to define those fields. This makes the show command update automatic. Signed-off-by: Andy Zhou <azhou@ovn.org> Acked-by: Joe Stringer <joe@ovn.org>
* ofproto-dpif-mirror: Fix issue of reseting snaplen in mirroringZhenyu Gao2017-04-031-1/+2
| | | | | | | | | | Currently, the mirror code doesn't check new value of snaplen when try to reconfigure snaplen. This patch fix this issue and add testings to reconfigure snaplen. Signed-off-by: Zhenyu Gao <sysugaozhenyu@gmail.com> Acked-by: William Tu <u9012063@gmail.com> Signed-off-by: Andy Zhou <azhou@ovn.org>
* ofproto-dpif-xlate: Don't save pkt_mark in compose_output_action__().Ben Pfaff2017-03-291-3/+0
| | | | | | | | | | Previously, this function could modify the pkt_mark field as part of IPsec integration. It no longer does that, so there's no longer any need for it to save and restore pkt_mark, and this commit removes that. CC: Ansis Atteka <aatteka@ovn.org> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>