summaryrefslogtreecommitdiff
path: root/ofproto
Commit message (Collapse)AuthorAgeFilesLines
* ofproto-dpif: Log warning when ct action or its variants are not supported.Ben Pfaff2016-11-011-0/+14
| | | | | | | | | | | Some datapaths do not support the ct action, and others support only a subset of its features. Until now, it has been difficult to tell why a particular action is being rejected. This commit should make it clearer. Reported-by: Kevin Lin <kevinlin@berkeley.edu> Reported-at: http://openvswitch.org/pipermail/discuss/2016-October/023060.html Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Joe Stringer <joe@ovn.org>
* doc: Convert README-native-tunneling to rSTStephen Finucane2016-10-281-1/+1
| | | | | Signed-off-by: Stephen Finucane <stephen@that.guru> Signed-off-by: Russell Bryant <russell@ovn.org>
* ofproto: Always delete rules before deleting a meter.Jarno Rajahalme2016-10-041-20/+15
| | | | | | | | | When deleting a bridge it is currently possible to delete a mater without deleting the rules using the meter first. Fix this by moving the meter's rule deletion to meter_delete(). Reported-by: Petr Machata <pertm@mellanox.com> Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* revalidator: Simplify full-revalidation code.Joe Stringer2016-09-281-31/+18
| | | | | | | | | | Simplify the remaining bits of the original revalidation codepath to only handle the "full-revalidation" case. Make the 'ukey' parameter purely const by pushing the only piece that gets changed into a separate argument. Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
* revalidator: Defer stats push to end of validation.Joe Stringer2016-09-281-20/+42
| | | | | | | | | | | | | | To make more of the core revalidate() functions do just one thing and not modify state on the way, refactor them to prepare the xcache then defer the ukey modification and stats/side effects execution to the end of successful revalidation. If revalidation causes deletion, then the xcache will be prepared and attached to the ukey, but the actual execution will be skipped since it will be executed on flow_delete very soon anyway with final stats. Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
* revalidator: Reuse xlate_ukey from deletion.Joe Stringer2016-09-283-45/+22
| | | | | | | | | | This code was already very similar to the actual revalidation code, but previously it wasn't structured quite closely enough to share it. Do so. xlate_actions_for_side_effects() is now unused, so remove it. Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
* revalidator: Refactor revalidation early exit.Joe Stringer2016-09-281-58/+78
| | | | | | | | Shift the early-exit conditions for revalidation into a separate function. Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
* revalidator: Refactor ukey->xout translation.Joe Stringer2016-09-281-33/+67
| | | | | | | | This patch shifts the code that directly calls xlate into a separate function, xlate_ukey(). Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
* revalidator: Prepare xcache before xlate_lookup.Joe Stringer2016-09-281-7/+7
| | | | | | | | | | | | | | | | Functionally this has little change, but it allows the following patch to refactor the translation code with less changes. Strictly speaking the odp_flow_key_to_flow() and xlate_lookup() error cases should free the ukey->xcache, since it's empty and was never initialised via the later call to xlate_actions(). However, if one of these error conditions is hit during a flow dump, then there's no way that it will ever succeed on a subsequent revalidate/delete. Rather, the later revalidate/delete would do no stats translation - the same result as keeping the empty xcache here. Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
* upcall: Don't start new revalidation round too soon after the last one.Jarno Rajahalme2016-09-271-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The execution time of 'ovs-ofctl add-flows' with a large number of flows can be more than halved if revalidators are not running after each flow mod separately. This was first suspected when it was found that 'ovs-ofctl --bundle add-flows' is about 10 times faster than the same command without the '--bundle' option in a scenario where there is a large set of flows being added and no datapath flows at all. One of the differences caused by the '--bundle' option is that the revalidators are woken up only once, at the end of the whole set of flow table changes, rather than after each flow table change individually. This patch limits the revalidation to run at most 200 times a second by enforcing a minimum of 5ms time gap between the start times of revalidation rounds. If nothing happens in, say 6 milliseconds, and then a new flow table change is signaled, the revalidator threads wake up immediately without any further delay. Values smaller than 5 were found to increase the 'ovs-ofctl add-flows' execution time noticeably. Since the revalidators are not running after each flow mod, the overall OVS CPU utilization during the 'ovs-ofctl add-flows' run time is reduced roughly by one core on a four core machine. In testing the 'ovs-ofctl add-flows' execution time is not significantly improved from this even if the revalidators are not notified about the flow table changes at all. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* openvswitch: Allow external IPsec tunnel management.Pravin B Shelar2016-09-273-35/+0
| | | | | | | | | | | | | | | | | | OVS GRE IPsec tunnel support has multiple issues, Therefore it was deprecated in OVS 2.6. Following patch removes support for GRE IPsec and allows external IPsec tunnel management for any type of tunnel not just GRE. e.g. user can encrypt Geneve or VxLan traffic. It can be done by using openflow pipeline to set skb-mark and using IPsec keying daemons to implement IPsec tunnels. This packet can be matched for the skb-mark to encrypt selective tunnel traffic. VMware-BZ: 1710701 Signed-off-by: Pravin B Shelar <pshelar@ovn.org> Acked-by: Ansis Atteka <aatteka@ovn.org>
* Add OpenFlow command to flush conntrack table entries.Justin Pettit2016-09-233-0/+40
| | | | | Signed-off-by: Justin Pettit <jpettit@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofproto-dpif-xlate: Adjust generated mask for fragments.Daniele Di Proietto2016-09-211-0/+11
| | | | | | | | | | | | | | | | | | | | | | | It's possible to install an OpenFlow flow that matches on udp source and destination ports without matching on fragments. If the subtable where such flow stays is visited during translation of a later fragment, the generated mask will have incorrect prerequisited for the datapath and it would be revalidated away at the first chance. This commit fixes it by adjusting the mask for later fragments after translation. Other prerequisites of the mask are also prerequisites in OpenFlow, but not the ip fragment bit, that's why we need a special case here. For completeness, this commits also fixes a related problem in bfd, where we check the udp destination port without checking if the frame is an ip fragment. It's not really necessary to address this separately, given the adjustment that we perform. VMware-BZ: #1651589 Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* Remove execute permisson on source filesHuanle Han2016-09-211-0/+0
| | | | | Signed-off-by: Huanle Han <hanxueluo@gmail.com> Signed-off-by: Russell Bryant <russell@ovn.org>
* ofproto: Do not signal revalidation for group mods twice.Jarno Rajahalme2016-09-202-10/+3
| | | | | | | | | | | The new group mod implementation signals revalidation through '->set_tables_version()', so the separate '->group_modify()' is no longer needed. The ofproto-provider API is changed to allow 'group_modify' to be NULL. Fixes: 5d08a275cd ("ofproto: Make groups versioned.") Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofproto-dpif-xlate: Fix memory leak in execute_controller_action.Ryan Moats2016-09-201-0/+2
| | | | | | | | | | | | commit df70a7731 ("ofproto-dpif-xlate: Allow translating without side-effects.") created a memory leak by removing the dp_packet_delete statement in execute_controller_action that freed the earlier cloned packet. This commit restores this statement to the end of the method. Fixes: df70a7731 ("ofproto-dpif-xlate: Allow translating without side-effects.") Signed-off-by: Ryan Moats <rmoats@us.ibm.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofproto: Remove groups that nested actions reference when removing rule.Binbin Xu2016-09-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | topology: +----------------+ +-------->| SDN Controller |<--------------+ | +----------------+ | | | +-----------|-----+ +-----------|-----+ | +-----+ | | | +-----+ | | | | VM1 | | | | | VM2 | | | | +-----+ | | | +-----+ | | | ^ V | | ^ V | | | +-----+ | | | +-----+ | | +-> | OVS | | | +-> | OVS | | | +-----+ | | +-----+ | | ^ | | ^ | +-----------|-----+ +-----------|-----+ | Nic Nic| +------------------------------------------+ We start the communication between VM1 and VM2, for example, ICMP. At the meantime, disconnect OVS and SDN controller, and reconnect them again, the process ovs-vswitchd crashes. backtrace: 0 0x00007f658082ffe4 in cls_rule_make_invisible_in_version () 1 0x00007f65807f6bb3 in delete_flows_start__ () 2 0x00007f65807f7ee9 in ofproto_group_mod_start () 3 0x00007f65807fa07b in handle_openflow () 4 0x00007f658082119b in connmgr_run () 5 0x00007f65807f3ba6 in ofproto_run () 6 0x00007f65807e101c in bridge_run__ () 7 0x00007f65807e715d in bridge_run () 8 0x00007f658065784d in main () Signed-off-by: Binbin Xu <xu.binbin1@zte.com.cn> Signed-off-by: Ben Pfaff <blp@ovn.org>
* tun-metadata: Manage tunnel TLV mapping table on a per-bridge basis.Jesse Gross2016-09-198-33/+168
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using tunnel TLVs (at the moment, this means Geneve options), a controller must first map the class and type onto an appropriate OXM field so that it can be used in OVS flow operations. This table is managed using OpenFlow extensions. The original code that added support for TLVs made the mapping table global as a simplification. However, this is not really logically correct as the OpenFlow management commands are operating on a per-bridge basis. This removes the original limitation to make the table per-bridge. One nice result of this change is that it is generally clearer whether the tunnel metadata is in datapath or OpenFlow format. Rather than allowing ad-hoc format changes and trying to handle both formats in the tunnel metadata functions, the format is more clearly separated by function. Datapaths (both kernel and userspace) use datapath format and it is not changed during the upcall process. At the beginning of action translation, tunnel metadata is converted to OpenFlow format and flows and wildcards are translated back at the end of the process. As an additional benefit, this change improves performance in some flow setup situations by keeping the tunnel metadata in the original packet format in more cases. This helps when copies need to be made as the amount of data touched is only what is present in the packet rather than the maximum amount of metadata supported. Co-authored-by: Madhu Challa <challa@noironetworks.com> Signed-off-by: Madhu Challa <challa@noironetworks.com> Signed-off-by: Jesse Gross <jesse@kernel.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofproto-dpif-xlate: Fix treatment of mirrors across patch port.Ben Pfaff2016-09-161-3/+25
| | | | | | | | | | | | | When the bridges on both sides of a patch port included mirrors, the translation code incorrectly conflated them instead of treating them as independent. Reported-by: Zoltán Balogh <zoltan.balogh@ericsson.com> Reported-by: Sugesh Chandran <sugesh.chandran@intel.com> Reported-at: http://openvswitch.org/pipermail/discuss/2016-September/022689.html Signed-off-by: Ben Pfaff <blp@ovn.org> Tested-by: Zoltán Balogh <zoltan.balogh@ericsson.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* xlate: Use dp_hash for select groups.Jarno Rajahalme2016-09-163-9/+76
| | | | | | | | | | | Add a new select group selection method "dp_hash", which uses minimal number of bits from the datapath calculated packet hash to inform the select group bucket selection. This makes the datapath flows more generic resulting in less upcalls to userspace, but adds recirculation prior to group selection. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofproto: Remove double reporting from bundles.Jarno Rajahalme2016-09-154-17/+11
| | | | | | | | | | | | | Patch b0d38b2f17 unified flow mod reporting in ofproto for both stand-alone flow mods and bundle flow mods, but left bundle-specific reporting to the bundle removal code. This patch fixes this by removing the bundle-specific reporting of flow mods. Found by inspection. Fixes: b0d38b2f17 ("ofproto: Report flow mods also from bundles.") Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofproto: Support packet_outs in bundles.Jarno Rajahalme2016-09-144-25/+94
| | | | | | | | | | | | | | | | | | | | | | | Add support for OFPT_PACKET_OUT messages in bundles. While ovs-ofctl already has a packet-out command, we did not have a string parser for it, as the parsing was done directly from command line arguments. This patch adds the string parser for packet-out messages, adds support for it into the 'ovs-ofctl packet-out' command, and adds a new ofctl/packet-out ovs-appctl command that can be used when ovs-ofctl is used as a flow monitor. The old 'ovs-ofctl packet-out syntax is deprecated' and will be removed in a later OVS release. The new packet-out parser is further supported with the ovs-ofctl bundle command, which allows bundles to mix flow mods, group mods and packet-out messages. Also the packet-outs in bundles are only executed if the whole bundle is successful. A failing packet-out translation may also make the whole bundle to fail. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofproto: Refactor packet_out handling.Jarno Rajahalme2016-09-149-182/+490
| | | | | | | | | | | | | | | | | | Refactor handle_packet_out() to prepare for bundle support for packet outs in a later patch. Two new callbacks are introduced in ofproto-provider class: ->packet_xlate() and ->packet_execute(). ->packet_xlate() translates the packet using the flow and actions provided by the caller, but defers all OpenFlow-visible side-effects (stats, learn actions, actual packet output, etc.) to be explicitly executed with the ->packet_execute() call. Adds a new ofproto_rule_reduce_timeouts__() that must be called with 'ofproto_mutex' held. This is used in the next patch. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofproto-dpif-xlate: Allow translating without side-effects.Jarno Rajahalme2016-09-145-18/+69
| | | | | | | | | | | | | | | Extend 'may_learn' attribute to also control the treatment of FIN_TIMEOUT action and asynchronous messages (packet ins, continuations), so that when 'may_learn' is 'false' and 'resubmit_stats' is 'NULL', no OpenFlow-visible side effects are generated by the translation. Correspondingly, add support for one-time asynchronous messages to xlate cache, so that all side-effects of the translation may be executed at a later stage. This will be useful for bundle commits. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofproto: Use ofproto_flow_mod for learn execution from xlate cache.Jarno Rajahalme2016-09-147-104/+242
| | | | | | | | | | | | | | | | | | | | | | | | | Use ofproto_flow_mod with a reference to an existing or new rule instead of ofputil_flow_mod for learn action execution from xlate cache Typically we would find that when a learn xlate cache entry is created, a preceding upcall has already created the learned flow. In this case the xlate cache entry takes a reference to that flow and keeps refreshing it without needing to perform any flow table lookups. Otherwise the creation of the xlate cache entry creates the new rule, which is then subsequently added to the classifier. In both cases this is both faster and shrinks the memory cost of each learn cache entry from ~3.5kb to about 0.3kb. If the learned rule does not yet exist, it is created and attached to the ofproto_flow_mod, from which it is then added. If the referred rule happens to expire, or is modified in any way and is thus removed from the classifier tables, we create a new rule using the old rule as a template, so that we can avoid storing the ofputil_flow_mod in all cases. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofproto-dpif-xlate: Add xlate cache type XC_TABLE.Jarno Rajahalme2016-09-145-5/+60
| | | | | | | | | | | | | Xlate cache entry type XC_TABLE is required for the table stats (number of misses and matches) to be correctly attributed. It appears that table stats have been off ever since xlate cache was introduced. This was now revealed by a PACKET_OUT unit test case in a later patch that checks for table stats explicitly. Fixes: b256dc52 ("ofproto-dpif-xlate: Cache xlate_actions() effects.") Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofproto-dpif-xlate: Expose xlate cache.Jarno Rajahalme2016-09-146-298/+413
| | | | | | | | | | | | | | Later patches will need to create xlate cache entries from different modules. This patch refactors the xlate cache code in preparation without any functional changes, so that the changes are clearly visible in the following patches. The definition of XC_ENTRY_FOR_EACH() iterator macro is changed so that it now does not take the xlate cache pointer to unify the usage accross all call sites. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* lib: Refactor mac-learning updates.Jarno Rajahalme2016-09-141-118/+29
| | | | | | | | | | | | Make mac table update functions part of the mac-learning module, which also helps in figuring what is the minimal set of struct flow fields needed for the update. Use this to change the xlate cache entry for XC_NORMAL to not take a copy of the struct flow, but only save the in_port, dl_src, and some auxiliary fields. This reduces the memory burden of XC_NORMAL by roughly 0.5kb. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* connmgr: Make connmgr_wants_packet_in_on_miss() lock-free.Jarno Rajahalme2016-09-133-39/+47
| | | | | | | | | | | Make connmgr_wants_packet_in_on_miss() use an atomic int instead of a list traversal taking the 'ofproto_mutex'. This allows connmgr_wants_packet_in_on_miss() to be called also when 'ofproto_mutex' is already held, and makes it faster, too. Remove unused ofproto_dpif_wants_packet_in_on_miss(). Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofproto: Change rule's 'removed' member to a tri-state 'state'.Jarno Rajahalme2016-09-132-8/+22
| | | | | | | | As a rule may not be re-inserted to ofproto data structures, it is cleaner to have three states for the rule, rather than just two. This will be useful for managing learned flows in later patches. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofproto: Add a fixed bundle idle timeout of 10 seconds.Jarno Rajahalme2016-09-134-19/+69
| | | | | | | | | | | | | | | | Timing out idle bundles frees memory that would effectively be leaked if a long standing OpenFlow connection would fail to commit or discard a bundle. OpenFlow specification mandates the timeout to be at least one second, if the switch implements such a timeout. This patch makes the bundle idle timeout to be 10 seconds. We do not limit the number of messages in a bundle, so it does not make sense to limit the number of bundles either, especially now that idle bundles are timed out. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofproto: Don't use connmgr after destruction.Jarno Rajahalme2016-09-138-20/+55
| | | | | | | | | | | | | | Set ofproto's connmgr pointer to NULL after the connmgr has been destructed, and check for NULL when sending a flow removed notification. Verified by sending the flow removed message unconditionally and observing numerous core dumps in the test suite. Found by inspection. Fixes: f695ebfae5 ("ofproto: Postpone sending flow removed messages.") Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* xlate: Clarify comment about mac learning table entry locking.Jarno Rajahalme2016-09-061-2/+7
| | | | | | | | | | The rationale for locking mac learning table entires wrt. gratuitous ARP packets and bond interfaces was too cryptic for me to understand. After reading vswitchd/INTERNALS the issue is understandable, but we can still improve the comment to prevent such confusion in future. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofproto: Honor mtu_request even for internal ports.Daniele Di Proietto2016-09-021-18/+26
| | | | | | | | | | | | | | | | | | | | | | | | By default Open vSwitch tries to configure internal interfaces MTU to match the bridge minimum, overriding any attempt by the user to configure it through standard system tools, or the database. While this works in many simple cases (there are probably many users that rely on this) it may create problems for more advanced use cases (like any overlay networks). This commit allows the user to override the default behavior by providing an explict MTU in the mtu_request column in the Interface table. This means that Open vSwitch will now treat differently database MTU requests from standard system tools MTU requests (coming from `ip link` or `ifconfig`), but this seems the best way to remain compatible with old users while providing a more powerful interface. Suggested-by: Darrell Ball <dlu998@gmail.com> Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Acked-by: Ben Pfaff <blp@ovn.org> Tested-by: Joe Stringer <joe@ovn.org>
* Revert "ofproto: Always set MTU for new internal ports."Daniele Di Proietto2016-09-021-5/+5
| | | | | | | | | | This reverts commit 47bf118665a3d0f3c153d1fe80e9af02ac9a4e9c. While the commit tries to make it more consistent, it breaks some system tests. The assumptions made on the tests are probably made by many users, so it's better to revert it. Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Acked-by: Ben Pfaff <blp@ovn.org>
* ofproto-dpif-sflow: Tolerate unknown datapath input port for tunnel.Neil McKee2016-09-021-1/+1
| | | | | | | | | | | This patch avoids a segfault. Submitted-at: https://github.com/openvswitch/ovs/pull/152 Reported-at: http://openvswitch.org/pipermail/discuss/2016-August/022513.html Reported-by: 张东亚 <fortitude.zhang@gmail.com> Fixes: 7321bda384c3 ("Extend sFlow agent to report tunnel and MPLS structures") Signed-off-by: Neil McKee <neil.mckee@inmon.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* upcall: Replace ukeys for deleted flows.Joe Stringer2016-09-011-1/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | If a revalidator dumps/revalidates a flow during the 'dump' phase, resulting in the deletion of the flow, then the ukey state moves into UKEY_EVICTED, and the ukey is kept around until the 'sweep' phase. The ukey is kept around to ensure that cases like duplicated dumps from the datapaths do not result in multiple attribution of the same stats. However, if an upcall for this flow comes for a handler between the revalidator 'dump' and 'sweep' phases, the handler will lookup the ukey and find that the ukey exists, then skip installing a new flow entirely. As a result, for this period all traffic for the flow is slowpathed. If there is a lot of traffic hitting this flow, then it will all be handled in userspace until the 'sweep' phase. Eventually the revalidators will reach the sweep phase and delete the ukey, and subsequently the handlers should install a new flow. To reduce the slowpathing of this traffic during flow table transitions, allow the handler to identify this case during miss upcall handling and replace the existing ukey with a new ukey. The handler will then be able to install a flow for this traffic, allowing the traffic flow to return to the fastpath. Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* upcall: Track ukey states.Joe Stringer2016-09-011-46/+96
| | | | | | | | | | | | | | | | | | | Ukeys have a defined lifetime that starts from being created, inserted into the umaps, having the corresponding flow installed, then the flow deleted, the ukey removed from the umap, rcu-deferral of its deletion, and finally freedom. However, until now it's all been represented behind a simple boolean "flow_exists" with a bunch of implicit logic sprinkled around the accessors. This patch attempts to make the ukey lifetime a bit clearer by outlining the correct transitions and asserting that their lifetime proceeds as expected. This should improve the readability of the current code, and also make the following patch easier to reason about. Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* upcall: Only init flow_put if ukey is installed.Joe Stringer2016-09-011-12/+4
| | | | | | | | | | | | | | | | Currently when processing a batch of upcalls, all datapath operations are first initialized, then later the corresponding ukeys are installed. If the ukey_install fails at this later point, then the code needs to backtrack a bit to delete the ukey and skip using the initialized datapath op. It's a little simpler to only initialize the datapath operation if the ukey could actually be installed. The locks are held longer, but these locks aren't heavily contended and the extended holding of the lock will be removed in a subsequent patch anyway. Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* upcall: Reuse flow_put initializer.Joe Stringer2016-09-011-16/+8
| | | | | Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* ofp-actions: Waste less memory in set field and load actions.Jarno Rajahalme2016-08-311-8/+6
| | | | | | | | | | | | | | | Change the value and mask to be added to the end of the set field action without any extra bytes, exept for the usual ofp-actions padding to 8 bytes. Together with some structure member packing this saves on average about to 256 bytes for each set field and load action (as set field internal representation is also used for load actions). On a specific production data set each flow entry uses on average about 4.2 load or set field actions. This means that with this patch an average of more than 1kb can be saved for each flow with such a flow table. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofproto: Always set MTU for new internal ports.Daniele Di Proietto2016-08-301-5/+5
| | | | | | | | | | | | | | | | | | | We only change the MTU of new internal ports if it is bigger than the bridge minimum. But when the minimum MTU of the bridge is updated we change the MTU of all internal ports no matter what. The behavior is inconsistent, because now the internal ports MTU depends on the order in which the ports were added. This commit fixes the problem by _always_ setting the MTU of new internal ports to the bridge minimum. I'm not sure what was the logic behind only adjusting the mtu if it was too big. A testcase is improved to detect the problem. VMware-BZ: #1718776 Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Acked-by: Ben Pfaff <blp@ovn.org>
* object-collection: Remove access to stub.Jarno Rajahalme2016-08-301-5/+5
| | | | | | | Better not use access to the *_collection_stub(), as it is an internal implementation detail. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofproto: Remove stale comment.Jarno Rajahalme2016-08-301-2/+0
| | | | | | The previous line tells that this comment is now stale. Remove it. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofproto-dpif: Remove prototype for an undefined function.Jarno Rajahalme2016-08-301-1/+0
| | | | | | We do not have a 'ofproto_dpif_refresh_rule()' function. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* upcall: reduce log level for "no reference to recirc flow" messageLance Richardson2016-08-301-1/+1
| | | | | | | | Reduce log level from "warn" to "debug" for "upcall: no reference to recirc flow" log message. Suggested-by: Jarno Rajahalme <jarno@ovn.org> Signed-off-by: Lance Richardson <lrichard@redhat.com> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* lib: Retire packet buffering feature.Jarno Rajahalme2016-08-307-199/+18
| | | | | | | | | | | | | | | | | | | | | | | | | OVS implementation of buffering packets that are sent to the controller is not compliant with the OpenFlow specifications after OpenFlow 1.0, which is possibly true since OpenFlow 1.0 is not really specifying the packet buffering behavior. OVS implementation executes the buffered packet against the actions of the modified or added rule, whereas OpenFlow (since 1.1) specifies that the packet should be matched against the flow table 0 and processed accordingly. Rather than fix this behavior, and potentially break OVS users, the packet buffering feature is removed altogether. After all, such packet buffering is an optional OpenFlow feature, and as such any possible users should continue to work without this feature. This patch also makes OVS check the received 'buffer_id' values more rigorously, and fixes some internal users accordingly. Found by inspection. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* upcall: Log failure to flow_put for dpif-netlink.Joe Stringer2016-08-191-29/+29
| | | | | | | | Previously these errors were only logged for dpif-netdev. Make it consistent by merging the code for both datapaths. Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* meta-flow: New functions mf_subfield_copy() and mf_subfield_swap().Ben Pfaff2016-08-151-1/+2
| | | | | | | | | | | | | | | | | The function nxm_execute_reg_move() was almost a general-purpose function for manipulating subfields, except for its awkward interface that took a struct ofpact_reg_move instead of a plain source and destination. This commit introduces a general-purpose function in meta-flow that corrects this flaw, and updates the callers. An upcoming commit will introduce a new user of the function. This commit also introduces a related function mf_subfield_swap() to swap the contents of subfields. An upcoming commit will introduce the first user. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Ryan Moats <rmoats@us.ibm.com> Acked-by: Justin Pettit <jpettit@ovn.org>
* ofproto: Reduce bundle memory use.Jarno Rajahalme2016-08-154-233/+401
| | | | | | | | | | | | | | | Instead of storing the (big) struct ofputil_flow_mod, create the new rule and/or create the rule criteria for matching at bundle message insert time. This change reduces the size of a bundle flow mod from 3.5kb to 272 bytes, not counting the created rule, which was anyway created during bundle commit. In successful bundles this shifts work out of the ofproto_mutex critical section and should thus reduce the time the mutex is held during bundle commit. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>