summaryrefslogtreecommitdiff
path: root/tests/test-bundle.c
Commit message (Collapse)AuthorAgeFilesLines
* Eliminate most shadowing for local variable names.Ben Pfaff2017-08-021-1/+1
| | | | | | | | | | | | | | Shadowing is when a variable with a given name in an inner scope hides a different variable with the same name in a surrounding scope. This is generally undesirable because it can confuse programmers. This commit eliminates most of it. Found with -Wshadow=local in GCC 7. The repo is not really ready to enable this option by default because of a few cases that are harder to fix, and harmless, such as nested use of CMAP_FOR_EACH. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* Support accepting and displaying port names in OVS tools.Ben Pfaff2017-05-311-2/+2
| | | | | | | | | | | | | | Until now, most ovs-ofctl commands have not accepted names for ports, only numbers, and have not been able to display port names either. It's a lot easier for users if they can use and see meaningful names instead of arbitrary numbers. This commit adds that support. For backward compatibility, only interactive ovs-ofctl commands by default display port names; to display them in scripts, use the new --names option. Signed-off-by: Ben Pfaff <blp@ovn.org> Tested-by: Aaron Conole <aconole@redhat.com>
* Move lib/ofp-actions.h to include/openvswitch directoryBen Warren2016-04-141-2/+2
| | | | | Signed-off-by: Ben Warren <ben@skyportsystems.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Move lib/ofpbuf.h to include/openvswitch directoryBen Warren2016-03-301-1/+1
| | | | | | Signed-off-by: Ben Warren <ben@skyportsystems.com> Acked-by: Ryan Moats <rmoats@us.ibm.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofpbuf: Simplify ofpbuf API.Pravin B Shelar2015-03-031-1/+1
| | | | | | | | | | | | ofpbuf was complicated due to its wide usage across all layers of OVS, Now we have introduced independent dp_packet which can be used for datapath packet, we can simplify ofpbuf. Following patch removes DPDK mbuf and access API of ofpbuf members. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* ovs_assert, tests: Support NDEBUG.Jarno Rajahalme2014-10-301-5/+2
| | | | | | | | | | | | | | | | | ./configure accepts --enable-ndebug option. Make ovs_assert() honor it, and make sure all test programs disable it. The order of include files in test programs is also made uniform: 1. #include <config.h> 2. #undef NDEBUG 3. Include file of the test subject (to make sure it itself has sufficient include directives). 4. System includes in alphapetical order. 5. OVS includes in aplhapetical order. Suggested-by: Ben Pfaff <blp@nicira.com> Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* unit-test: Link 29 test programs into ovstestAndy Zhou2014-04-031-4/+7
| | | | | | | | | | | | | | Improve link speed by linking 29 test programs into ovstest. On my machine, running the following command against a fully built tree: $ touch lib/random.c; time make Improve the overall build time from 7 seconds to 3.5 seconds. Signed-off-by: Andy Zhou <azhou@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* ofpbuf: Introduce access api for base, data and size.Pravin Shelar2014-03-301-1/+1
| | | | | | | These functions will be used by later patches. Following patch does not change functionality. Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
* More accurate wildcarding and fragment handling.Jarno Rajahalme2013-10-171-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch gets rid of the need for having explicit padding in struct flow as new fields are being added. flow_wildcards_init_exact(), which used to set bits in both compiler generated and explicit padding, is removed. match_wc_init() is now used instead, which generates the mask based on a given flow, setting bits only in fields which make sense. Places where random bits were placed in struct flow have been changed to only set random bits on fields that are significant in the given context. This avoids setting padding bits. - lib/flow: - Properly initialize struct flow also in places we used to zero out padding before. - Add flow_random_hash_fields() used for testing. - Remove flow_wildcards_init_exact() to avoid initializing masks where compiler generated padding has bits set. - lib/match.c match_wc_init(): Wildcard transport layer fields for later fragments, remove match_init_exact(), which used flow_wildcards_init_exact(). - tests/test-flows.c: use match_wc_init() instead of match_init_exact() - tests/flowgen.pl: generate more accurate packets and flows when fragmenting, mark unavailable fields as wildcarded. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* Remove mpls_depth field from flowSimon Horman2013-09-271-2/+0
| | | | | | | | | | | | | | | | | | | | | Rather than tracking the MPLS depth as a field in the flow, which is an entirely poor place for it, just track the delta to the MPLS depth during translation. This logic was developed while implementing recirculation and intended to be used to detect when recirculation should occur. This variant of the patch uses the logic to determine if processing of actions should stop due to an MPLS action which cannot be translated (without recirculation). A side-effect of this patch is that it resolves a bug whereby ovs-vswitchd will abort due to to an assertion on eth_type_mpls(ctx->xin->flow.dl_type) in compose_mpls_pop_action(() if the actions of a flow include pop_mpls twice without a push_mpls in between. Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
* ofp-parse: Do not exit() upon a parse error.Ben Pfaff2013-07-081-2/+7
| | | | | | | | | Until now, failure to parse a flow in the ofp-parse module has caused the program to abort immediately with a fatal error. This makes it hard to use these functions from any long-lived program. This commit fixes the problem. Signed-off-by: Ben Pfaff <blp@nicira.com>
* Create specific types for ofp and odp portAlex Wang2013-06-201-8/+8
| | | | | | | | | | | | Until now, datapath ports and openflow ports were both represented by unsigned integers of various sizes. With implicit conversions, etc., it is easy to mix them up and use one where the other is expected. This commit creates two typedefs, ofp_port_t and odp_port_t. Both of these two types are marked by "__attribute__((bitwise))" so that sparse can be used to detect any misuse. Signed-off-by: Alex Wang <alexw@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* ofproto-dpif: Store relevant fields for wildcarding in facet.Justin Pettit2013-06-111-1/+3
| | | | | | | | | | | | | | | | | | | | | Dynamically determines the flow fields that were relevant in processing flows based on the OpenFlow flow table and switch configuration. The immediate use for this functionality is to cache action translations for similar flows in facets. This yields a roughly 80% improvement in flow set up rates for a complicated flow table. More importantly, these wildcards will be used to determine what to wildcard for the forthcoming kernel wildcard (megaflow) patches that will allow wildcarding in the kernel, which will provide significant flow set up improvements. The approach to tracking fields and caching action translations in facets was based on an impressive prototype by Ethan Jackson. Co-authored-by: Ethan Jackson <ethan@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com> Signed-off-by: Justin Pettit <jpettit@nicira.com>
* User-Space MPLS actions and matchesSimon Horman2013-02-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements use-space datapath and non-datapath code to match and use the datapath API set out in Leo Alterman's patch "user-space datapath: Add basic MPLS support to kernel". The resulting MPLS implementation supports: * Pushing a single MPLS label * Poping a single MPLS label * Modifying an MPLS lable using set-field or load actions that act on the label value, tc and bos bit. * There is no support for manipulating the TTL this is considered future work. The single-level push pop limitation is implemented by processing push, pop and set-field/load actions in order and discarding information that would require multiple levels of push/pop to be supported. e.g. push,push -> the first push is discarded pop,pop -> the first pop is discarded This patch is based heavily on work by Ravi K. Cc: Ravi K <rkerur@gmail.com> Reviewed-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
* vswitchd: fix 32-bit buildsAnsis Atteka2012-11-231-0/+1
| | | | | | | | | | | My previous 72e8bf28bb38e8816435c64859fb350215b6a9e6 (datapath: add skb mark matching and set action) commit broke 32-bit builds. This patch assures that size of struct flow is equal on both 32-bit and 64-bit architectures so that build asserts would not fire anymore. Acked-by: Ben Pfaff <blp@nicira.com> Signed-off-by: Ansis Atteka <aatteka@nicira.com>
* Use ODP ports in dpif layer and below.Justin Pettit2012-11-011-1/+0
| | | | | | | | | | | | | | | | The current code has a simple mapping between datapath and OpenFlow port numbers (the port numbers were the same other than OFPP_LOCAL which maps to datapath port 0). Since the translation was know at compile time, this allowed different layers to easily translate between the two, so the translation often occurred late. A future commit will break this simple mapping, so this commit draws a line between where datapath and OpenFlow port numbers are used. The ofproto-dpif layer will be responsible for the translations. Callers above will use OpenFlow port numbers. Providers below will use datapath port numbers. Signed-off-by: Justin Pettit <jpettit@nicira.com>
* flow: Ensure that padding is always zeroed.Ben Pfaff2012-09-041-0/+1
| | | | Signed-off-by: Ben Pfaff <blp@nicira.com>
* Introduce ofpacts, an abstraction of OpenFlow actions.Ben Pfaff2012-07-031-30/+25
| | | | | | | | | | | | | | | | | | | | | | OpenFlow actions have always been somewhat awkward to handle. Moreover, over time we've started creating actions that require more complicated parsing. When we maintain those actions internally in their wire format, we end up parsing them multiple times, whenever we have to look at the set of actions. When we add support for OpenFlow 1.1 or later protocols, the situation will get worse, because these newer protocols support many of the same actions but with different representations. It becomes unrealistic to handle each protocol in its wire format. This commit adopts a new strategy, by converting OpenFlow actions into an internal form from the wire format when they are read, and converting them back to the wire format when flows are dumped. I believe that this will be more maintainable over time. Thanks to Simon Horman and Pravin Shelar for reviews. Signed-off-by: Ben Pfaff <blp@nicira.com>
* Global replace of Nicira Networks.Raju Subramanian2012-05-021-1/+1
| | | | | | | | Replaced all instances of Nicira Networks(, Inc) to Nicira, Inc. Feature #10593 Signed-off-by: Raju Subramanian <rsubramanian@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* bundle: New action "bundle_load".Ethan Jackson2011-07-221-4/+9
| | | | | The bundle_load action behaves the same as the bundle action, except instead of outputting, it writes its result to a register.
* bundle: Implement NX_BD_ALG_ACTIVE_BACKUP.Ethan Jackson2011-07-221-7/+29
| | | | | | | I don't expect this bundling algorithm to be particularly useful in software switches. However, hardware switches will probably only support this bundling algorithm, so it's implemented here as an example and a reference.
* bundle: Run bundle_check() in unit tests.Ethan Jackson2011-07-221-0/+4
| | | | | This has been helpful finding bugs in my development environment. It's good to exercise this code.
* vswitch: Implement bundle action.Ethan Jackson2011-07-191-0/+237
This patch creates a new action called "bundle". Bundles are a way to implement a simple form of multipath in OpenFlow by grouping several ports in a single output-like action.