summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* meta-flow: Fix the NXM_NX_* names of xxreg2 and xxreg3.Jarno Rajahalme2016-10-101-2/+6
| | | | | | | | | | | | | xxreg2 and xxreg3 had the same NXM_NX_* names as xxreg0 and xxreg1, correspondingly. Also add placeholders for future expansion for four more xxregs. Found by inspection. CC: Justin Pettit <jpettit@ovn.org> Fixes: b23ada8eecfd ("Introduce 128-bit xxregs.") Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
* smap: New macro SMAP_CONST2 for an immutable map of 2 key-value pairs.Ben Pfaff2016-10-071-5/+5
| | | | | | | Future commits will add a user. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* json: Use reference counting in JSON objectsRodriguez Betancourt, Esteban2016-10-041-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After profiling OVSDB insert performance it was found that some significant portion of its time OVSDB is calling the function json_clone. Also, the current usages of json_clone never modify the json, just keeps it to prevent it to be freed. With that in mind the struct json, json_create, json_clone and json_destroy were modified to keep a count of how many references of the json struct are left. Only when that count reaches zero the json struct is freed. The old "json_clone" function was renamed as "json_deep_clone". Some examples of the performance difference: In these tests a test table with 4 columns (string, string, bool, integer) was used. All the tests used "commit block". *** 50 process each inserting 1000 rows *** Master OVS Test Duration 131 seconds Average Inserts Per second 746.2687 inserts/s Average Insert Duration 134.1382 ms Minimal Insert Duration 0.166202 ms Maximum Insert Duration 489.8593 ms JSON GC Patch Test Duration 86 seconds Average Inserts Per second 1176 inserts/s Average Insert Duration 82.26761 ms Minimal Insert Duration 0.165448 ms Maximum Insert Duration 751.2111 ms *** 5 process each inserting 10000 rows *** Master OVS Test Duration 8 seconds Average Inserts Per second 7142.857 inserts/s Average Insert Duration 0.656431 ms Minimal Insert Duration 0.125197 ms Maximum Insert Duration 11.93203 ms JSON GC Patch Test Duration 7 seconds Average Inserts Per second 8333.333 inserts/s Average Insert Duration 0.55688 ms Minimal Insert Duration 0.143233 ms Maximum Insert Duration 26.26319 ms Signed-off-by: Esteban Rodriguez Betancourt <estebarb@hpe.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Check and allocate free qdisc queue id for ports with qos parametersBabu Shanmugam2016-10-041-1/+16
| | | | | | | | | | | | | | | | | | | ovn-northd processes the list of Port_Bindings and hashes the list of queues per chassis. When it finds a port with qos_parameters and without a queue_id, it allocates a free queue for the chassis that this port belongs. The queue_id information is stored in the options field of Port_binding table. Adds an action set_queue to the ingress table 0 of the logical flows which will be translated to openflow set_queue by ovn-controller ovn-controller opens the netdev corresponding to the tunnel interface's status:tunnel_egress_iface value and configures a HTB qdisc on it. Then for each SB port_binding that has queue_id set, it allocates a queue with the qos_parameters of that port. It also frees up unused queues. This patch replaces the older approach of policing Signed-off-by: Babu Shanmugam <bschanmu@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofp-actions: Style fixes.Jarno Rajahalme2016-09-271-1/+1
| | | | | | | Replace a tab by a space and remove an unnecessary variable. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Joe Stringer <joe@ovn.org>
* Add OpenFlow command to flush conntrack table entries.Justin Pettit2016-09-232-0/+13
| | | | | Signed-off-by: Justin Pettit <jpettit@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* token-bucket: Add token_bucket_wait_at().Jarno Rajahalme2016-09-201-1/+4
| | | | | | | | Having the caller of token_bucket_wait() indicated in the log messages makes debugging easier. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofp-actions: Remove unused OFPACT_FOR_EACH_TYPE.Binbin Xu2016-09-201-23/+0
| | | | | 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-194-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Support packet_outs in bundles.Jarno Rajahalme2016-09-142-3/+10
| | | | | | | | | | | | | | | | | | | | | | | 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>
* ovn-controller: Fix group_id allocation.Gurucharan Shetty2016-09-091-0/+2
| | | | | | | | | | | | | | | | | | A bitmap in 'struct group_table' is used to track all the allocated group_ids. For every run of logical flows action parsing, we add 'group_info' structure to a hmap called 'desired_groups'. The group_id assigned to this group_info either comes from an already installed 'existing groups' or a new reservation done in the bitmap. In ofctrl_put(), if there is a backlog, we call ovn_group_table_clear(). This could unreserve a group_id that comes from an already existing group. This could result in re-use of group_id in the future causing errors while installing new groups. This commit fixes the above scenario. Signed-off-by: Gurucharan Shetty <guru@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ovn-controller: Datapath based conntrack zone for load-balancing.Gurucharan Shetty2016-09-091-0/+3
| | | | | | | | | | | | | | | | | Currently ct_lb() logical action is only added for a logical switch and we use the conntrack zone allocated for the logical port. A future commit will use ct_lb() for a logical router too. In that case, use the allocated DNAT zone. Rationale for not passing zone as an argument for ct_lb(): One way to look at it would be that a "zone" is an internal implementation detail and should not be seen in a action of logical flow. But we can then say that we could rename "zone" as "datapath" in the logical action. But, then we would be limiting it to 2 anyway (datapath=lswitch or datapath=lrouter) - in which case we are inferring it with the current patch. Signed-off-by: Gurucharan Shetty <guru@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* learn: Fix iteration over learning specs.Ben Pfaff2016-09-021-10/+23
| | | | | | | | | | | | | | | | struct ofpact_learn_spec is variable-length. The 'n_specs' member of struct ofpact_learn counted the number of specs, but the iteration loops over struct ofpact_learn_spec only iterated as far as the *minimum* length of 'n_specs' specs. This fixes the problem, which exhibited as consistent failures for test 431 (learning action - TCPv6 port learning), seemingly only on i386 since it shows up for my personal development machine but appears to not happen for anyone else. Fixes: dfe191d5faa6 ("ofp-actions: Waste less memory in learn actions.") Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* learn: Avoid nested zero-sized arrays to fix build with MSVC.Jarno Rajahalme2016-09-011-16/+23
| | | | | | | | | | | | Avoid using nested zero-sized arrays to allow compilation with MSVC. Also, make sure the immediate data is accessed only if it exists, and that the size is always calculated from struct learn_spec field 'n_bits'. Fixes: dfe191d5faa6 ("ofp-actions: Waste less memory in learn actions.") Reported-by: Alin Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ovn-controller: Back out incremental processingRyan Moats2016-08-311-4/+0
| | | | | | | | | | | | | | | | | | | | | | | As [1] indicates, incremental processing hasn't resulted in an improvement worth the complexity it has added. This patch backs out all of the code specific to incremental processing, along with the persisting of OF flows, logical ports, multicast groups, all_lports, local and patched datapaths. Persisted objects in the ovn/controller/physical.c module will be used by a future patch set to determine if physical changes have occurred. Future patch sets in the series will convert the ovn/controller/encaps.c module back to full processing and remove the persistance of address sets in the ovn/controller/lflow.c module. [1] http://openvswitch.org/pipermail/dev/2016-August/078272.html Signed-off-by: Ryan Moats <rmoats@us.ibm.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofp-actions: Waste less memory in set field and load actions.Jarno Rajahalme2016-08-312-14/+28
| | | | | | | | | | | | | | | 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>
* ofp-actions: Waste less memory in learn actions.Jarno Rajahalme2016-08-312-14/+42
| | | | | | | | | | | Make the immediate data member 'src_imm' of a learn spec allocated at the end of the action for just the right size. This, together with some structure packing saves on average of ~128 bytes for each learn spec in each learn action. Typical learn actions have about 4 specs each, so this amounts to saving about 0.5kb for each learn action. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* lib: Retire packet buffering feature.Jarno Rajahalme2016-08-301-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* vlog: Fix crash when --syslog-method has no argument.Binbin Xu2016-08-191-1/+1
| | | | | | | | | | | | | When we start ovs-appctl with no argument option "syslog-method", the process crashed. backtrace: 0 0x00000000004180c4 in vlog_set_syslog_method (method=0x0) at lib/vlog.c:587 1 0x0000000000408b27 in parse_command_line (argv=0x7fff097e83b8, argc=2) at utilities/ovs-appctl.c:175 2 main (argc=2, argv=0x7fff097e83b8) at utilities/ovs-appctl.c:53 Signed-off-by: Binbin Xu <xu.binbin1@zte.com.cn> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovn-trace: New utility.Ben Pfaff2016-08-152-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This new utility is intended to fulfill for OVN the purpose that "ofproto/trace" has for Open vSwitch. First, it's meant to be a useful tool for troubleshooting and diagnosis and in general for improving one's understanding of the emergent properties of a flow table. Second, it simplifies and increases the practical scope of testing, as well as making testing more reliable and repeatable and failures easier to interpret. This commit adds only a single test that uses the new utility, based on the oldest OVN end-to-end test "ovn -- 3 HVs, 1 LS, 3 lports/HV". The differences between the old and the new test illustrate properties of tracing. First, the new test does not start any ovn-controller processes or simulate any hypervisors in a nontrivial way. This is because ovn-trace does not actually forward packets or rely on the physical structure of the system. Second, whereas the old test tested not just the logical but also the physical structure of the system, it needed to have several logical ports, a total of 9 (3 on each of 3 HVs), whereas since this test only tests the logical network implementation it can use a smaller number. This property also means that the new test runs signicantly faster than the old one (less than a second on my laptop). In my opinion this approach points the way toward the future of OVN testing. Certainly, we need end-to-end tests. However, I believe that the bulk of our tests can be broken into ones that test the logical network implementation (using tracing) and ones that test physical/logical translation. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Ryan Moats <rmoats@us.ibm.com>
* expr: New function expr_parse_microflow().Ben Pfaff2016-08-151-0/+8
| | | | | | | | | | | This allows "ovstest test-ovn evaluate-expr" to work with arbitrary microflows rather than just a few restricted variables, but the main point is to enable the upcoming "ovn-trace" utility to accept arbitrary microflows in a format that seems reasonable for OVN. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Ryan Moats <rmoats@us.ibm.com> Acked-by: Justin Pettit <jpettit@ovn.org>
* expr: New function expr_evaluate().Ben Pfaff2016-08-151-0/+6
| | | | | | | | | | | An upcoming commit will need to evaluate individual expressions outside the context of a classifier. test-ovn already had a function to do this but it wasn't general-purpose, so this commit makes a general-purpose version and adopts it for use in test-ovn as well. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Ryan Moats <rmoats@us.ibm.com> Acked-by: Justin Pettit <jpettit@ovn.org>
* meta-flow: New functions mf_subfield_copy() and mf_subfield_swap().Ben Pfaff2016-08-151-0/+6
| | | | | | | | | | | | | | | | | 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>
* lex: Integrate error handling into struct lexer.Ben Pfaff2016-08-153-13/+20
| | | | | | | | | | The actions and expr modules had each developed their own error handling code that were very similar. Upcoming code needs similar error handling, so rather than duplicating it again, integrate it into the lexer itself. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Ryan Moats <rmoats@us.ibm.com> Acked-by: Justin Pettit <jpettit@ovn.org>
* ovn: Rewrite logical action parsing and encoding library.Ben Pfaff2016-08-152-37/+299
| | | | | | | | | | | | | | | | | Until now, parsing logical actions and encoding them into OpenFlow has happened in a single step. An upcoming commit will want to examine actions after parsing without encoding them into OpenFlow. This commit refactors OVN logical actions to make this possible. The new form of the OVN action handling is closely modeled on ofp-actions in the OVS core library. Notable differences are that OVN actions are always fixed-length and that individual OVN actions can have destructors (and thus can contain pointers to data that need to be freed when the actions are destroyed). Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Ryan Moats <rmoats@us.ibm.com> Acked-by: Justin Pettit <jpettit@ovn.org>
* ovn-controller: Add 'put_dhcpv6_opts' action in ovn-controllerNuman Siddique2016-08-141-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a new OVN action 'put_dhcpv6_opts' to support native DHCPv6 in OVN. ovn-controller parses this action and adds a NXT_PACKET_IN2 OF flow with 'pause' flag set and the DHCPv6 options stored in 'userdata' field. When the valid DHCPv6 packet is received by ovn-controller, it frames a new DHCPv6 reply packet with the DHCPv6 options present in the 'userdata' field and resumes the packet and stores 1 in the 1-bit subfield. If the packet is invalid, it resumes the packet without any modifying and stores 0 in the 1-bit subfield. Eg. reg0[3] = put_dhcpv6_opts(ia_addr = aef0::4, server_id = 00:00:00:00:10:02, dns_server = {ae70::1,ae70::2}....) A new 'DHCPv6_Options' table is added in SB DB which stores the supported DHCPv6 options with DHCPv6 code and type. ovn-northd is expected to popule this table. Upcoming patch will add logical flows using this action. Signed-off-by: Numan Siddique <nusiddiq@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* meta-flow: Add ovs_be128 member to union mf_subvalue.Ben Pfaff2016-08-131-0/+1
| | | | | | | | | This makes it more convenient to access a 128-bit value stored in an mf_subvalue. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Ryan Moats <rmoats@us.ibm.com> Acked-by: Justin Pettit <jpettit@ovn.org>
* ovn-controller: Persist desired conntrack groups.Ryan Moats2016-08-102-0/+6
| | | | | | | | | | | | | With incremental processing of logical flows desired conntrack groups are not being persisted. This patch adds this capability, with the side effect of adding a ds_clone method that this capability leverages. Signed-off-by: Ryan Moats <rmoats@us.ibm.com> Reported-by: Guru Shetty <guru@ovn.org> Reported-at: http://openvswitch.org/pipermail/dev/2016-July/076320.html Fixes: 70c7cfe ("ovn-controller: Add incremental processing to lflow_run and physical_run") Acked-by: Flavio Fernandes <flavio@flaviof.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovn: Use a common symbol table for ovn-controller and test-ovn.Ben Pfaff2016-08-081-0/+4
| | | | | | | | | | | Most of the differences were superficial, so it's better to reduce code duplication. This also adds a test to ensure that the OVN logical registers are built properly out of subfields. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Ryan Moats <rmoats@us.ibm.com>
* expr: Give a subfield a direct pointer to its parent in struct expr_symbol.Ben Pfaff2016-08-081-15/+19
| | | | | | | | | | | | | | | | | | Until now, symbols that represent subfields and predicates were both implemented as the same string member, named 'expansion', inside struct expr. This makes it a little inconvenient to find the parent of a subfield for two reasons. First, one must actually parse the string, e.g. to convert "vlan.tci[13..15]" into a pointer to a struct. Second, and more importantly, to parse the string it's necessary to have access to the symbol table, which isn't always convenient to pass around. This commit avoids the problem by breaking apart subfields and predicates and giving the former a direct pointer to the parent symbol. We could do the same thing for predicates by storing a pointer to a pre-built struct expr, but so far it's not necessary. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Ryan Moats <rmoats@us.ibm.com>
* expr: Track writability as part of expr_symbol.Ben Pfaff2016-08-081-0/+1
| | | | | | | | | | Until now it was only possible to find out whether an expr_symbol was read/write or read-only, for subfields, by chasing down whether the eventual parent field was read/write or read-only. This commit adds a new 'rw' member that indicates directly. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Ryan Moats <rmoats@us.ibm.com>
* ofp-actions: Factor OFPACT_PADDED_MEMBERS out into a more general form.Ben Pfaff2016-08-082-14/+22
| | | | | | | This makes it easier to reuse this idea elsewhere. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Ryan Moats <rmoats@us.ibm.com>
* ofp-actions: Correct member name for write_actions.Ben Pfaff2016-08-081-1/+1
| | | | | | | | | | | For a variable-length action like write_actions, the member name is supposed to be the name of the variable-length array at the end of the action structure. It only makes a real difference if the beginning of the array is not 64-bit aligned, so it did not matter in this case, but it's better to get it right. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Ryan Moats <rmoats@us.ibm.com>
* flow: Comment that nw_src holds ARP SPA and nw_dst holds ARP TPA.Ben Pfaff2016-08-081-2/+2
| | | | | Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Ryan Moats <rmoats@us.ibm.com>
* ovn: Add support for IPv6 dynamic bindings.Justin Pettit2016-07-291-1/+12
| | | | | | | This commit also introduces "get_nd" and "put_nd" logical actions. Signed-off-by: Justin Pettit <jpettit@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ovn: Rename "nd" action to "nd_na".Justin Pettit2016-07-291-2/+2
| | | | | | | | | | Rename "nd" to "nd_na" to be more descriptive and consistent with other ND messages and actions. This commit also fixes some minor documentation issues and limits the action to responding to Neighbor Solicitation messages. Signed-off-by: Justin Pettit <jpettit@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofp-util: remove flow mod's delete_reason.Jarno Rajahalme2016-07-291-3/+0
| | | | | | | We can use the rule's removed_reason instead. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofproto: Support group mods in bundles.Jarno Rajahalme2016-07-292-4/+22
| | | | | | | | | | | | | | | | | | | Allow adding group mods in OpenFlow bundles. Group mods are executed atomically with any flow mods in the same bundle. Mods are executed in order, so that groups appearing in flow actions need to be inserted in to the bundle before the dependent flow mods. ovs-ofctl is enhanced to allow the '--bundle' option with group mod commands. add-groups file format is enhanced to allow each line to be preceded by one of the keywords "add", "modify", "delete", "add_or_mod", "insert_bucket", or "remove_bucket". ovs-ofctl also has a new "bundle" command that reads a file in which each line contains one flow mod or group mod, and then executes them all as a single atomic bundle transaction. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* meta-flow: Compact struct field_array.Jarno Rajahalme2016-07-292-2/+7
| | | | | | | | | | | struct field_array is included in each ofgroup, but the current implementation is very sparse, using more than 20kb of data. Also loop over 1-bits instead of each and every MF type to make processing faster. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofproto-dpif-xlate: Hash only fields specified for 'hash' selection method.Jarno Rajahalme2016-07-291-2/+0
| | | | | | | | | | | | | | The mask for non-present fields in struct field_array is always zero, so hashing a prerequisite field that was not also specified for the "hash" selection method boiled down to hashing a all-zeroes value and unwildcarding the prerequisite field. Now that mf_are_prereqs_ok() already takes care of unwildcarding, we can simplify the code by hashing only the specified fields. Also change the test case to include fields that have prerequisities. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* meta-flow: Clean up masking with prerequisities checking.Jarno Rajahalme2016-07-291-6/+2
| | | | | | | | | | | | | | | Change mf_are_prereqs_ok() take a flow_wildcards pointer, so that the wildcards can be set at the same time as the prerequisiteis are checked. This makes it easier to write more obviously correct code. Remove the functions mf_mask_field_and_prereqs() and mf_mask_field_and_prereqs__(), and make the callers first check the prerequisites, while supplying 'wc' to mf_are_prereqs_ok(), and if successful, mask the bits of the field that were read or set using mf_mask_field_masked(). Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* meta-flow: Add mf_mask_field_masked().Jarno Rajahalme2016-07-292-3/+5
| | | | | | | Having a masked version allows generating better wildcarding. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* meta-flow: Add byte access to struct mf_value.Jarno Rajahalme2016-07-291-0/+1
| | | | | | | | This allows reducing pointer casting when individual bytes of mf_value are accessed. First users are in the following patches. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* vconn: Better bundle error management.Jarno Rajahalme2016-07-291-1/+14
| | | | | | | | | | | | | | | | It is possible that a bundle add message fails, but the following commit succeeds, since the message was not added to the bundle. Make ovs-ofctl fail also in these cases. Also, the commit should not be sent if any of the bundled messages failed. To make sure all the errors are received before the commit is sent, a barrier is required before sending the commit message. Finally, make vconn collect bundle errors into a list instead of calling a callback. This makes bundle error management simpler. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofproto: Use ofproto_mutex for groups and keep track of referring flows.Jarno Rajahalme2016-07-291-0/+55
| | | | | | | | | | | Adding groups support for bundles is simpler if also groups are modified under ofproto_mutex. Eliminate the search for rules when deleting a group so that we will not keep the mutex for too long. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* conntrack: New userspace connection tracker.Daniele Di Proietto2016-07-271-0/+4
| | | | | | | | | | | | | | | | | | | | | | This commit adds the conntrack module. It is a connection tracker that resides entirely in userspace. Its primary user will be the dpif-netdev datapath. The module main goal is to provide conntrack_execute(), which offers a convenient interface to implement the datapath ct() action. The conntrack module uses two submodules to deal with the l4 protocol details (conntrack-other for UDP and ICMP, conntrack-tcp for TCP). The conntrack-tcp submodule implementation is adapted from FreeBSD's pf subsystem, therefore it's BSD licensed. It has been slightly altered to match the OVS coding style and to allow the pickup of already established connections. Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Acked-by: Antonio Fischetti <antonio.fischetti@intel.com> Acked-by: Joe Stringer <joe@ovn.org>
* move ovn/lib/<lex|actions|expr>.h to include/ovnAaron Rosen2016-07-275-0/+760
| | | | | | | | | | This patch is done to enable in tree building of the ovn-utils python wrapper. This is similar to what was done in commit ee89ea7b477bb4fd05137de03b2e8443807ed9f4 (json: Move from lib to include/openvswitch.). Signed-off-by: Aaron Rosen <aaronorosen@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovn: Make it possible for CMS to detect when the OVN system is up-to-date.Ben Pfaff2016-07-261-0/+6
| | | | | | | | | | | | | | | | | Until now, there has been no reliable for the CMS (or ovn-nbctl, or anything else) to detect when changes made to the northbound configuration have been passed through to the southbound database or to the hypervisors. This commit adds this feature to the system, by adding sequence numbers to the northbound and southbound databases and adding code in ovn-nbctl, ovn-northd, and ovn-controller to keep those sequence numbers up-to-date. The biggest user-visible change from this commit is new a new option --wait to ovn-nbctl. With --wait=sb, ovn-nbctl now waits for ovn-northd to update the southbound database; with --wait=hv, it waits for the changes to make their way to Open vSwitch on every hypervisor. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Russell Bryant <russell@ovn.org>
* ovsdb: Weak references performance fixRodriguez Betancourt, Esteban2016-07-261-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prevents the cloning of rows with outgoing or incoming weak references when those rows aren't being modified. It improves the OVSDB Server performance when many rows with weak references are involved in a transaction. In the original code (dst_refs is created from scratch): old->dst_refs = all the rows that weak referenced old new->dst_refs = all the rows that weak referenced old and are still weak +referencing new + rows in the transaction that weak referenced new In the patch (dst_refs incrementally built): Old->dst_refs = all the rows that weak referenced old Ideally, but expansive to calculate: New->dst_refs = old->dst_refs - "weak references removed within this TXN" + +"weak references created within this TXN" What this patch implements: New->dst_refs = old->dst_refs - "weak references in old rows in TXN" + "weak +references in new rows in TXN" The resulting sets should be equal in both cases. We do some more optimizations: - If we know that the transactions must be successful at some point then, instead of cloning dst_refs we could just move the elements between the lists. - At that point we lost the rollback feature, but we aren't going to need it anyway (note that we didn't really touch the src_refs part). - The references in dst_refs must point to new instead than old. Previously we iterated over all the weak references in dst_refs to change that pointer, but using an UUID is easier, and prevents that iteration completely. For some more commentary, see: http://openvswitch.org/pipermail/dev/2016-July/074840.html Signed-off-by: Esteban Rodriguez Betancourt <estebarb@hpe.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* json: Move from lib to include/openvswitch.Terry Wilson2016-07-224-0/+632
| | | | | | | | | | | | | | | To easily allow both in- and out-of-tree building of the Python wrapper for the OVS JSON parser (e.g. w/ pip), move json.h to include/openvswitch. This also requires moving lib/{hmap,shash}.h. Both hmap.h and shash.h were #include-ing "util.h" even though the headers themselves did not use anything from there, but rather from include/openvswitch/util.h. Fixing that required including util.h in several C files mostly due to OVS_NOT_REACHED and things like xmalloc. Signed-off-by: Terry Wilson <twilson@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>