Nothing outside of ofproto-dpif-xlate.c referenced this member.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
The initialization of 'base_flow' was previously split into a few pieces,
and I think it's easier to understand if it's all in one place.
This also moves and rewrites the comment describing 'base_flow'. I think
that the perspective of the new comment is a little more useful.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
This code was a twisty maze of tiny functions, but what it actually needed
to do was simple. This makes it look that simple.
Among more stylistic changes, this removes 'user_cookie_offset' from
xlate_ctx. This member was used to communicate between two sections of
code that are both in xlate_actions() and close together, so it's better to
simply use a local variable than to put it into a shared context structure.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
It seems to me that tnl_xlate_init() has two almost-separate tasks. First,
it marks most of the 'wc' bits for tunnels. Second, it checks and updates
ECN bits. This commit breaks tnl_xlate_init() into two separate functions,
one for each of those tasks.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
It's always the size of 'odp_actions' following adding the sample actions.
This is a stylistic change that should not change behavior.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
This is only used in one place and action processing can't change the
result, so only calculate it where it's needed.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
This takes advantage of common properties of the invocation of this
function in both callers (both supply the same 'flow' and 'packet',
although they write it differently) and avoids the need for a local
variable in each place.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
This variable was only used as a temporary within a small scope, so it
worked just as well to just use ctx.rule there instead.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
This moves the calculation of 'ofpacts' closer to its actual use, which
in my opinion makes the code easier to read.
This commit also expands the circumstances in which OVS omits sending
NetFlow records from those where there is exactly one OpenFlow action that
sends to controller, to those where any OpenFlow action sends to
controller. I doubt that this is a big deal.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Until now, struct xlate_out has embedded an ofpbuf for actions and a large
stub for it, which xlate_actions() filled in during the flow translation
process. This commit removes the embedded ofpbuf and stub, instead putting a
pointer to an ofpbuf into struct xlate_in, for a caller to fill in with a
pointer to its own structure if desired. (If none is supplied,
xlate_actions() uses an internal scratch buffer and destroys it before
returning.)
This commit eliminates the last large data structure from
struct xlate_out, making the initialization of an entire xlate_out at
the beginning of xlate_actions() now reasonable. More members will be
eliminated in upcoming commits, but this is no longer essential.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Until now, struct xlate_out has embedded a struct flow_wildcards, which
xlate_actions() filled in during the flow translation process (unless this
was disabled with xin->skip_wildcards, which in classifier microbenchmarks
saves significant time). This commit removes the embedded flow_wildcards
and 'skip_wildcards', instead putting a pointer to a flow_wildcards into
struct xlate_in, for a caller to fill in with a pointer to its own
structure if desired.
One reason for this change is performance. Until now, the userspace slow
path has done a full copy of a struct flow_wildcards for each upcall in
upcall_cb(). This commit eliminates that copy. I don't know whether this
has a measurable performance impact; it may, because struct flow copies
had a noticeable cost in slow-path stress tests even when struct flow was
half its current size.
This commit also eliminates a large data structure from struct xlate_out,
reducing the cost of the initialization of that structure at the beginning
of xlate_actions(). However, there is more size reduction to come in
later commits.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Until now, the ofproto/trace command has tried to accumulate wildcards
independently of flow translation. This was unnecessary, and in a few
cases where flow translation drops wildcards, it meant that ofproto/trace
printed inaccurate wildcards (because it keep the wildcards that flow
translation dropped).
This updates a test case whose output is now more accurate.
Signed-off-by: Ben Pfaff <blp@nicira.com>
As I see it, this has two benefits. First, by using an initializer
rather than a series of assignment statements, the reader can be
assured that everything in the structure is actually initialized.
Second, previously the initialization of 'ctx' was scattered in
a few places in this function, which made it a little harder to be
sure that any given member was not just initialized but actually
initialized before the statement that one was looking at.
It's also nice to get rid of the stub members in xlate_ctx, since
nothing outside of xlate_actions() itself needs direct access to
them. (This is pretty much necessary if we're going to use an
initializer for struct xlate_ctx, because otherwise the compiler
would initialize the whole stub, which is too expensive.)
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
To my mind, this is a good way to ensure that '*xout' gets initialized
properly in every execution. By using an initializer rather than a
series of assignment statements, we can be assured that every member
gets initialized.
This commit makes xlate_actions() more expensive because struct
xlate_out is large and this assignment will initialize all of it due to
C rules. Later commits will fix this up by removing all of the large
members, reducing xlate_out to only a few bytes total.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Until now, Clang 3.7+ and sufficiently new versions of GCC complained about
TYPE_MAXIMUM(int), etc., because it shifts a negative value. This commit
fixes the problem.
This commit also gives these macros sensible definitions for _Bool, and
documents all of them.
Reported-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
Replace "ntohs(proto) >= ETH_P_802_3_MIN" w/ eth_proto_is_802_3(proto).
Backport of upstream commit 6713fc9b8fa33444aa000f0f31076f6a859ccb34:
"openvswitch: Use eth_proto_is_802_3"
Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Backport of upstream commit 2c7a88c252bf3381958cf716f31b6b2e0f2f3fa7:
"etherdev: Fix sparse error, make test usable by other functions"
Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Those two packages are needed to build but they might not
be present in the system.
Signed-off-by: Flavio Leitner <fbl@redhat.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Until now, if external-ids:ovn-bridge changed, ovn-controller ignored
the change. With this commit, ovn-controller uses the new bridge.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
The generic *_init() names for these functions made it sounds like they
do something more than just register IDL columns, even though that's all
they do. Also, the controller_ctx that was passed into each of them was
only used to get the IDL handle. This commit renames them and changes
their parameter type to simplify and make all of this clearer.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
Until now, if the chassis id was missing, ovn-controller exited. This
commit makes ovn-controller wait for it to return.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
Until now, if the integration bridge was missing, ovn-controller exited.
This commit makes it wait until the integration bridge is created.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
I found it otherwise difficult to see what code depended on this. When
later commits make it possible for ovn-controller to handle changes in
chassis ID, this will become important (the code should determine the
current chassis ID before trying to use it).
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
These two pieces of code have different requirements and hardly anything in
common, and I found it easier to understand and reasonably modify the
overall structure of the program when they were separated.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
Until now, OVS has parsed all OF1.1+ group buckets that lack a weight
as having weight 1. Unfortunately, OpenFlow says that only "select"
groups may have a nonzero weight, and requires reporting an error for
other kinds of groups that have a nonzero weight. This commit fixes
the problem by parsing only select groups with a default weight of 1
and other groups with a default weight of 0. It also adds the
OpenFlow-required check for nonzero weights for other kinds of groups.
This complies with OpenFlow 1.1 and later. OF1.1 says in section 5.8:
If a specified group type is invalid (ie: includes fields such as
weight that are undefined for the specified group type) then the
switch must refuse to add the group entry and must send an
ofp_error_msg with OFPET_GROUP_MOD_FAILED type and
OFPGMFC_INVALID_GROUP code.
Found by OFTest.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
This is implied by the list of ports that are valid for output in the
various versions of the OpenFlow specification.
Found by OFTest.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
The OpenFlow specification says that only role changes to slave or master
check the generation ID, so this is a bug fix.
OpenFlow 1.2 section A.3.9 phrases the requirement this way:
Additionally, if the role value in the message is OFPCR_ROLE_MASTER
or OFPCR_ROLE_SLAVE, the switch must validate generation_id to check
for stale messages.
Found by OFTest.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Fixes the following error:
The following files are in git but not the distribution:
ovn/OVN-GW-HA.md
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
A commit to the database takes multiple trips through the main loop. In
that time, the database could change, but ovn-controller can't properly
react to the changes until the commit has succeeded or failed. Since
commit f1fd765733 (ovn-controller: Avoid blocking to commit OVSDB
transactions), Open vSwitch has failed to properly re-check the contents
of the database following a successful commit. That meant that it was
possible for ovn-controller to fail to react to a database change until
much later, if nothing else happened for some time.
Reported-by; Alex Wang <alexw@nicira.com>
Reported-at: http://openvswitch.org/pipermail/dev/2015-July/058176.html
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
High availability for gateways in network virtualization deployments
is fairly difficult to get right. There are a ton of options, most of
which are too complicated or perform badly. To help solve this
problem, this patch proposes an HA design based on some of the lessons
learned building similar systems. The hope is that it can be used as
a starting point for design discussions and an eventual
implementation.
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
It's possible to imagine that a switch might want to report additional
capabilities related to Geneve beyond just the number of options and
how much space they can consume. Some examples include additional
restrictions on parsing (if this command is used for non-OVS implementations
or OVS changes how it works) and per-packet actions that can't be done
generically (such as checksums or encryption). It's not yet clear if
these will be necessary or if OpenFlow is the right place to expose
them. However, it's easy to do now and there is very little cost so
it seems like a good idea to leave some additional reserved space.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
In table 64, when a vlan tag is set on a packet
destined to a container running inside a VM, we currently
don't revert it. This has an unintended consequence for
broadcast traffic when one endpoint of the braodcast
traffic is a plain VM (without containers running inside) where
the previously set tag would remain in the packets sent to the VM.
This commit fixes the above problem by popping the VLAN
and resetting the input port after outputting the packet
with a vlan tag to a container logical port.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
I spent some time recently looking at the results of "ovs-ofctl
dump-table-features". It was really distressing because of the volume of
information. Every table yielded well over 100 lines of output and for 253
(visible) tables that meant over 25,300 lines of output total, which is
basically unusable.
This commit cuts the volume of output greatly by eliminating most of the
duplication from one table to the next. The command now prints the full
output only for table 0, and for each subsequent table prints only the
parts that differ. That reduces the output volume for tables after the
first to only 9 lines each (one of which is blank), for a total of more
like 2,400 lines, which is still not short but reasonably manageable.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
Dpdk allows users to create a config that includes other config files and
then override values.
Eg.
defconfig_x86_64-native_vhost_cuse-linuxapp-gcc:
CONFIG_RTE_BUILD_COMBINE_LIBS=y
CONFIG_RTE_BUILD_SHARED_LIB=n
CONFIG_RTE_LIBRTE_VHOST=y
CONFIG_RTE_LIBRTE_VHOST_USER=n
This allows you to have both a vhostuser and vhostcuse config in the same
source tree without the need to replicate everything in those config files
just to change a couple of settings. The resultant .config file has all of
the settings from the included files with the updated settings at the end.
The resultant rte_config.h contains multiple undefs and defines for the
overridden settings.
Eg.
> grep RTE_LIBRTE_VHOST_USER x86_64-native_vhost_cuse-linuxapp-gcc/include/rte_config.h
#undef RTE_LIBRTE_VHOST_USER
#define RTE_LIBRTE_VHOST_USER 1
#undef RTE_LIBRTE_VHOST_USER
The current mechanism to detect the RTE_LIBRTE_VHOST_USER setting merely
greps the rte_config.h file for the string "define RTE_LIBRTE_VHOST_USER 1"
rather than the final setting of RTE_LIBRTE_VHOST_USER. The following patch
changes this test to detect the final setting of RTE_LIBRTE_VHOST_USER.
Signed-off-by: Gary Mussar <gmussar@ciena.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com
When ofctrl_add_flow() called ovn_flow_lookup(), the latter used the hash
from the flow's hmap_node, but the former hadn't initialized it at that
point. This commit fixes the problem.
Reported-by: Russell Bryant <rbryant@redhat.com>
Reported-at: http://openvswitch.org/pipermail/dev/2015-July/057851.html
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
The logic in ovn-northd's parents_equal() and tags_equal() is useful
for other columns, so convert them into more generic functions that
can be reused.
Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>