summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* New action "ct_clear".Ben Pfaff2017-01-101-1/+2
| | | | | | | | | | | | | | This is being introduced specifically to allow a user of the "clone" action to clear the connection tracking state, but it's implemented as a separate action as a matter of clean design and in case another use case arises later. Reported-by: Mickey Spiegel <mickeys.dev@gmail.com> Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2017-January/326981.html Fixes: 7ae62a676d3a ("ofp-actions: Add clone action.") Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Mickey Spiegel <mickeys.dev@gmail.com> Tested-by: Dong Jun <dongj@dtdream.com>
* nx-match: Only store significant bytes to stack.Jarno Rajahalme2017-01-061-2/+2
| | | | | | | | | | | Always storing the maximum mf_value size wastes about 120 bytes for each stack entry. This patch changes the stack from an mf_value array to a string of value-length pairs. The length is stored after the value so that the stack pop may first read the length and then the appropriate number of bytes. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* expr: Rename "macros" to "addr_sets".Justin Pettit2017-01-051-9/+9
| | | | | | | | Macro is a very generic term, but the arguments are only ever address sets, so rename for clarity. Signed-off-by: Justin Pettit <jpettit@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* util: Remove obsolete comment.Ben Pfaff2017-01-051-6/+2
| | | | | Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Simon Horman <simon.horman@netronome.com>
* ofproto: Fix crash on flow monitor request with tun_metadata.Daniele Di Proietto2017-01-041-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | nx_put_match() needs a non-NULL tunnel metadata table, otherwise it will crash if a flow matches on tunnel metadata. This wasn't handled in ofputil_append_flow_update(), causing a crash when the controller sent a flow monitor request. To fix the problem, this commit changes ofputil_append_flow_update() to behave like ofputil_append_flow_stats_reply(). Since ofputil_append_flow_update() now needs to temporarily modify the match, this commits also embeds 'struct match' into 'struct ofputil_flow_update', to be safer. This is more similar to 'struct ofputil_flow_stats'. A regression test is added and a comment is updated in ovs-ofctl.c #0 0x000055699bd82fa0 in memcpy_from_metadata (dst=0x7ffc770930d0, src=0x7ffc77093698, loc=0x18) at ../lib/tun-metadata.c:451 #1 0x000055699bd83c2e in metadata_loc_from_match_read (map=0x0, match=0x7ffc77093410, idx=0, mask=0x7ffc77093658, is_masked=0x7ffc77093287) at ../lib/tun-metadata.c:848 #2 0x000055699bd83d9b in tun_metadata_to_nx_match (b=0x55699d3f0300, oxm=0, match=0x7ffc77093410) at ../lib/tun-metadata.c:871 #3 0x000055699bce523d in nx_put_raw (b=0x55699d3f0300, oxm=0, match=0x7ffc77093410, cookie=0, cookie_mask=0) at ../lib/nx-match.c:1052 #4 0x000055699bce5580 in nx_put_match (b=0x55699d3f0300, match=0x7ffc77093410, cookie=0, cookie_mask=0) at ../lib/nx-match.c:1116 #5 0x000055699bd3926f in ofputil_append_flow_update (update=0x7ffc770940b0, replies=0x7ffc77094e00) at ../lib/ofp-util.c:6805 #6 0x000055699bc4b5a9 in ofproto_compose_flow_refresh_update (rule=0x55699d405b40, flags=(NXFMF_INITIAL | NXFMF_ACTIONS), msgs=0x7ffc77094e00) at ../ofproto/ofproto.c:5915 #7 0x000055699bc4b5f6 in ofmonitor_compose_refresh_updates (rules=0x7ffc77094e10, msgs=0x7ffc77094e00) at ../ofproto/ofproto.c:5929 #8 0x000055699bc4bafc in handle_flow_monitor_request (ofconn=0x55699d404090, oh=0x55699d404220) at ../ofproto/ofproto.c:6082 #9 0x000055699bc4f46d in handle_openflow__ (ofconn=0x55699d404090, msg=0x55699d404910) at ../ofproto/ofproto.c:7912 #10 0x000055699bc4f5df in handle_openflow (ofconn=0x55699d404090, ofp_msg=0x55699d404910) at ../ofproto/ofproto.c:8002 #11 0x000055699bc88154 in ofconn_run (ofconn=0x55699d404090, handle_openflow=0x55699bc4f5bc <handle_openflow>) at ../ofproto/connmgr.c:1427 #12 0x000055699bc85934 in connmgr_run (mgr=0x55699d3adb90, handle_openflow=0x55699bc4f5bc <handle_openflow>) at ../ofproto/connmgr.c:363 #13 0x000055699bc422c9 in ofproto_run (p=0x55699d3c85e0) at ../ofproto/ofproto.c:1798 #14 0x000055699bc31ec6 in bridge_run__ () at ../vswitchd/bridge.c:2881 #15 0x000055699bc320a6 in bridge_run () at ../vswitchd/bridge.c:2938 #16 0x000055699bc3784e in main (argc=10, argv=0x7ffc770952c8) at ../vswitchd/ovs-vswitchd.c:111 Fixes: 8d8ab6c2d574 ("tun-metadata: Manage tunnel TLV mapping table on a per-bridge basis.") Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Acked-by: Ben Pfaff <blp@ovn.org>
* ofp-parse: Allow match field names in actions and brackets in matches.Jarno Rajahalme2017-01-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Allow using match field names in addition to the canonical register names in actions (including 'load', 'move', 'push', 'pop', 'output', 'multipath', 'bundle_load', and 'learn'). Allow also leaving out the trailing '[]' to indicate full field. These changes allow simpler syntax similar to 'set_field' to be used also elsewhere. Correspondingly, allow the '[start..end]' syntax to be used in matches in addition to the more explicit 'value/mask' notation. For example, to match on the value 2 of the bits 14..15 of NXM_NX_REG0, the match could include: ... reg0[14..15]=2 ... instead of ... reg0=0x8000/0xc000 ... Note that only contiguous masks can be specified with the bracket notation. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* lib: Add support for tftp ct helper.Joe Stringer2017-01-031-0/+4
| | | | | | | | | The kernel datapath provides support for TFTP helpers, so add support for this ALG to the commandline and OpenFlow encoding/decoding. Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Daniele Di Proietto <diproiettod@vmware.com> Acked-by: Ben Pfaff <blp@ovn.org>
* ovn-trace: New --ovs option to also print OpenFlow flows.Ben Pfaff2016-12-281-4/+9
| | | | | | | | | | | Sometimes seeing the OpenFlow flows that back a given logical flow can provide additional insight. This commit adds a new --ovs option to ovn-trace that makes it connect to Open vSwitch over OpenFlow and retrieve and print the OpenFlow flows behind each logical flow encountered during a trace. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
* ofp-actions: Add clone action.William Tu2016-12-191-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds OpenFlow clone action with syntax as below: "clone([action][,action...])". The clone() action makes a copy of the current packet and executes the list of actions against the packet, without affecting the packet after the "clone(...)" action. In other word, the packet before the clone() and after the clone() is the same, no matter what actions executed inside the clone(). Use case 1: Set different fields and output to different ports without unset actions= clone(mod_dl_src:<mac1>, output:1), clone(mod_dl_dst:<mac2>, output:2), output:3 Since each clone() has independent packet, output:1 has only dl_src modified, output:2 has only dl_dst modified, output:3 has original packet. Similar to case1 actions= push_vlan(...), output:2, pop_vlan, push_vlan(...), output:3 can be changed to actions= clone(push_vlan(...), output:2),clone(push_vlan(...), output:3) without having to add pop_vlan. case 2: resubmit to another table without worrying packet being modified actions=clone(resubmit(1,2)), ... Signed-off-by: William Tu <u9012063@gmail.com> [blp@ovn.org revised this to omit the "sample" action] Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofp-actions: Move function for struct ofpact_nest near struct definition.Ben Pfaff2016-12-191-6/+6
| | | | | | This seems like a logical place for it. Signed-off-by: Ben Pfaff <blp@ovn.org>
* doc: Populate 'topics' sectionStephen Finucane2016-12-122-4/+4
| | | | | | | | | | | There are many docs that don't need to kept at the top level, along with many more hidden in random folders. Move them all. This also allows us to add the '-W' flag to Sphinx, ensuring unindexed docs result in build failures. Signed-off-by: Stephen Finucane <stephen@that.guru> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofp-actions: Add "ingress" and "egress" options to "sample" action.Ben Pfaff2016-11-301-1/+16
| | | | | | | | | | | | | | | | | | | | Before Open vSwitch 2.5.90, IPFIX reports from Open vSwitch didn't include whether the packet was ingressing or egressing the switch. Starting in OVS 2.5.90, this information was available but only accurate if the action included a port number that indicated a tunnel. Conflating these two does not always make sense (not every packet involves a tunnel!), so this patch makes it possible for the sample action to simply say whether it's for ingress or egress. This is difficult to test, since the "tests" directory of OVS does not have a proper IPFIX listener. This passes those tests, plus a couple that just verify that the actions are properly parsed and formatted. Benli did test it end-to-end in a VMware use case. Requested-by: Benli Ye <daniely@vmware.com> Tested-by: Benli Ye <daniely@vmware.com> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Simon Horman <simon.horman@netronome.com>
* ofproto: Return the OFPC_BUNDLES bit in switch features reply.Jarno Rajahalme2016-11-142-3/+14
| | | | | | | | | Add definitions for the OpenFlow 1.4.1/1.5 specific capabilities bits OFPC14_BUNDLES and OFPC14_FLOW_MONITORING. Return the bundles capability bit in switch features reply. Reported-by: Andrej Leitner <andrej.leitner@pantheon.tech> Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* doc: Convert DESIGN to rSTStephen Finucane2016-11-031-1/+1
| | | | | | | This is a top-level document, so plain old rST is preferred. Signed-off-by: Stephen Finucane <stephen@that.guru> Signed-off-by: Russell Bryant <russell@ovn.org>
* 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>