Alex Wang [Sun, 16 Aug 2015 07:06:24 +0000 (00:06 -0700)]
ovn-controller-vtep.at: Fix intermittent test failure.
When testing the recreation of 'chassis' table entry by 'ovn-controller-
vtep'. The removal of 'chassis' table entry by the 'ovn-sbctl' could
cause 'Broken pipe' warning in ovsdb-server.log. This is due to the
race between 'ovn-sbctl' exiting and 'ovn-controller-vtep' adding
the chassis back. So, if the 'ovn-sbctl' exits right when the
ovsdb-server tries to send update of readd of the deleted 'chassis',
the sending will fail with 'Broken pipe' error.
Signed-off-by: Alex Wang <alexw@nicira.com> Acked-by: Russell Bryant <rbryant@redhat.com>
Alex Wang [Sun, 16 Aug 2015 06:44:45 +0000 (23:44 -0700)]
ovn-controller-vtep.at: Fix intermittent test failure.
The test waits until grep no vlan '200' from the VTEP 'vlan_binding'
column. However, string '200' could also appear in other 'vlan_binding'
entry's uuid value. Instead, we should grep for '200='.
Signed-off-by: Alex Wang <alexw@nicira.com> Acked-by: Russell Bryant <rbryant@redhat.com>
Flavio Leitner [Thu, 13 Aug 2015 19:06:29 +0000 (16:06 -0300)]
rhel: add installed but not packaged OVN tools
This patch adds the following to OVN %files:
/usr/bin/ovn-controller-vtep
/usr/bin/ovn-sbctl
/usr/share/man/man8/ovn-controller-vtep.8.gz
/usr/share/man/man8/ovn-sbctl.8.gz
Simon Horman [Thu, 13 Aug 2015 07:55:32 +0000 (16:55 +0900)]
flow: Ignore invalid ICMPv6 fields when parsing packets
There is a miss-match between the handling of invalid ICMPv6 fields in the
implementations of parse_icmpv6() in user-space and in the kernel datapath.
This patch addresses that by modifying the user-space implementation to
match that of the kernel datapath; processing is terminated without
rather than with an error and partial information is cleared.
With these changes the user-space implementation of parse_icmpv6()
never returns an error. Accordingly the return type and caller have been
updated.
The original motivation for this is to allow matching the ICMPv6 type and
code of packets with invalid neighbour discovery options although only the
change around the '(!opt_len || opt_len > *sizep)' conditional is necessary
to achieve that goal.
Signed-off-by: Simon Horman <simon.horman@netronome.com> Signed-off-by: Jesse Gross <jesse@nicira.com>
Ethan Jackson [Tue, 4 Aug 2015 01:43:53 +0000 (18:43 -0700)]
ofproto: Allow in-place modifications of datapath flows.
There are certain use cases (such as bond rebalancing) where a
datapath flow's actions may change, while it's wildcard pattern
remains the same. Before this patch, revalidators would note the
change, delete the flow, and wait for the handlers to install an
updated version. This is inefficient, as many packets could get
punted to userspace before the new flow is finally installed.
To improve the situation, this patch implements in place modification
of datapath flows. If the revalidators detect the only change to a
given ukey is its actions, instead of deleting it, it does a put with
the MODIFY flag set.
Signed-off-by: Ethan J. Jackson <ethan@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Ethan Jackson [Wed, 12 Aug 2015 21:50:54 +0000 (14:50 -0700)]
ofproto-dpif-upcall: Make ukey actions modifiable with RCU.
Future patches will need to modify ukey actions in some instances.
This patch makes this possible by protecting them with RCU. It also
adds thread safety checks to enforce the new protection mechanism.
Signed-off-by: Ethan J. Jackson <ethan@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Alex Wang [Thu, 13 Aug 2015 04:29:06 +0000 (21:29 -0700)]
db-ctl-base: Allow print rows that weak reference to table in
'cmd_show_table'.
Sometimes, it is desirable to print the table with weak reference to
the table specified in 'struct cmd_show_table'. For example the
Port_Binding table rows in OVN_Southbound database that refer to the
same Chassis table row can be printed under the same chassis entry
in 'ovn-sbctl show' output.
To achieve it, this commit adds a new struct in 'struct cmd_show_table'
that allows users to print a table with weak reference to 'table'
specified in 'struct cmd_show_table'. The 'ovn-sbctl' which now prints
the Port_Binding entries with Chassis table, is the first user of this
new feature.
Requested-by: Justin Pettit <jpettit@nicira.com> Signed-off-by: Alex Wang <alexw@nicira.com> Acked-by: Justin Pettit <jpettit@nicira.com>
Jarno Rajahalme [Thu, 13 Aug 2015 00:03:07 +0000 (17:03 -0700)]
classifier: Do not use mf_value.
mf_value has grown bigger than needed for storing the biggest
supported prefix (IPv6 address length). Define a new type to be used
instead of mf_value.
This makes classifier lookups a bit faster.
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Joe Stringer <joestringer@nicira.com>
Russell Bryant [Wed, 12 Aug 2015 23:53:09 +0000 (16:53 -0700)]
ovn: Add lflow-list to ovn-sbctl.
I frequently view the contents of the Logical_Flow table while working
on OVN. Add a command that can output the contents of this table in a
sorted way that makes it easier to read through. It's sorted by
logical datapath, pipeline, table id, priority, and match.
Signed-off-by: Russell Bryant <rbryant@redhat.com> Acked-by: Alex Wang <alexw@nicira.com>
Joe Stringer [Fri, 7 Aug 2015 21:00:20 +0000 (14:00 -0700)]
system-kmod-macros: Fix VSWITCHD_STOP.
This was renamed. Surprisingly, the tests still pass without this,
however the extra checks that this command performs were not executed.
Fix the macro definition.
Signed-off-by: Joe Stringer <joestringer@nicira.com> Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
Alex Wang [Sun, 9 Aug 2015 07:02:47 +0000 (00:02 -0700)]
ovn-controller-vtep: Add gateway module.
This commit adds the gateway module to ovn-controller-vtep. The
module will register the physical switches to ovnsb as chassis and
constantly update the "vtep_logical_switches" column in Chassis table.
Limitation (Recorded in TODO file):
- Do not support reading multiple tunnel ips of physical switch.
Signed-off-by: Alex Wang <alexw@nicira.com> Acked-by: Russell Bryant <rbryant@redhat.com>
Alex Wang [Fri, 7 Aug 2015 22:55:32 +0000 (15:55 -0700)]
ovn-sb: Remove the "Gateway" table from the ovn-sb schema.
In a gateway like the VTEP L2 gateway, physical vlans belonging to
the same logical network form a "logical switch". Each logical switch
has a dedicated tunnel key and will keep records of all MACs learned
from the owned vlans. So user can just send packet to a "logical
switch" and the gateway will figure out the output port and vlan tag
automatically.
Therefore, it is really not necessary to keep record of the vlan map
for each gateway physical port in the OVN_Southbound database using
"gateway_ports" and to map each vlan to a unique ovn logical port.
Instead, we should simply map each logical switch to a ovn logical
port.
Thusly, this commit removes the "Gateway" table from the OVN_Southbound
database. In the "Chassis" table, the "gateway_ports" column is replaced
by "vtep_logical_switches" column which stores all vtep logical switch
names. The use of this column will be documented in later commit.
Signed-off-by: Alex Wang <alexw@nicira.com> Acked-by: Russell Bryant <rbryant@redhat.com>
will run "make check-system-userspace" in the vagrant launched VM.
It may be more convenient to run this tests inside a vm rather than in
the host, because they interact with system networking.
Suggested-by: Joe Stringer <joestringer@nicira.com> Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Acked-by: Joe Stringer <joestringer@nicira.com>
The new system-userspace-testsuite, which can be launched via
`make check-system-userspace`, reuses the kmod tests on the userspace
datapath.
The userspace datapath is already tested by the main testsuite (and
that's not going to change), but having also the
system-userspace-testsuite has the following advantages:
* More complicated tests are possible: real client and server
applications can be used.
* The same tests run on both kernel and userspace datapath: this gives
us an easy way to make sure that the behaviour is consistent (e.g.
with the upcoming connection tracker integration)
The userspace datapath is able to use system network interfaces via an
AF_PACKET socket.
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Acked-by: Joe Stringer <joestringer@nicira.com>
Joe Stringer [Wed, 29 Jul 2015 23:28:59 +0000 (16:28 -0700)]
kmod-macros: Don't unload kmod in VSWITCHD_STOP.
We already queue the removal of the kernel module in OVS_VSWITCHD_START,
via an ON_EXIT() call. That command is executed in both the success and
failure cases, so it is unnecessary to unload the kernel module in
OVS_VSWITCHD_STOP.
Signed-off-by: Joe Stringer <joestringer@nicira.com> Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
The file will be part of two different testsuites: one for the kernel
datapath and another for the userspace datapath. No functional change
in this commit.
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Acked-by: Joe Stringer <joestringer@nicira.com>
Ian Stokes [Thu, 6 Aug 2015 15:58:47 +0000 (16:58 +0100)]
INSTALL.DPDK.md: Add details of XL710 restrictions for DPDK
Currently there are restrictions regarding the use of the XL710 network
interface with OVS and DPDK. This patch details those restrictions in
INSTALL.DPDK.md.
Signed-off-by: Ian Stokes <ian.stokes@intel.com> Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
netdev-dpdk: Retry tx/rx queue setup until we don't get any failure.
It has been observed that some DPDK device (e.g intel xl710) report an
high number of queues but make some of them available only for special
functions (SRIOV). Therefore the queues will be counted in
rte_eth_dev_info_get(), but rte_eth_tx_queue_setup() will fail.
This commit works around the issue by retrying the device initialization
with a smaller number of queues, if a queue fails to setup.
Reported-by: Ian Stokes <ian.stokes@intel.com> Tested-by: Ian Stokes <ian.stokes@intel.com> Acked-by: Kevin Traynor <kevin.traynor@intel.com> Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Signed-off-by: Ethan Jackson <ethan@nicira.com>
Jesse Gross [Tue, 30 Jun 2015 01:01:59 +0000 (18:01 -0700)]
dpif-netdev: Translate Geneve options per-flow, not per-packet.
The kernel implementation of Geneve options stores the TLV option
data in the flow exactly as received, without any further parsing.
This is then translated to known options for the purposes of matching
on flow setup (which will then install a datapath flow in the form
the kernel is expecting).
The userspace implementation behaves a little bit differently - it
looks up known options as each packet is received. The reason for this
is there is a much tighter coupling between datapath and flow translation
and the representation is generally expected to be the same. This works
but it incurs work on a per-packet basis that could be done per-flow
instead.
This introduces a small translation step for Geneve packets between
datapath and flow lookup for the userspace datapath in order to
allow the same kind of processing that the kernel does. A side effect
of this is that unknown options are now shown when flows dumped via
ovs-appctl dpif/dump-flows, similar to the kernel.
There is a second benefit to this as well: for some operations it is
preferable to keep the options exactly as they were received on the wire,
which this enables. One example is that for packets that are executed from
ofproto-dpif-upcall to the datapath, this avoids the translation of
Geneve metadata. Since this conversion is potentially lossy (for unknown
options), keeping everything in the same format removes the possibility
of dropping options if the packet comes back up to userspace and the
Geneve option translation table has changed. To help with these types of
operations, most functions can understand both formats of data and seamlessly
do the right thing.
dpif-netdev: Don't use metaflow to operate on userspace datapath fields.
If ofproto-dpif installs a flow into the userspace datapath that doesn't
include a mask, we need to synthesize an exact match one. This is currently
done using the metaflow infrastructure, iterating over each field and
setting it to all ones.
There is a conceptual mismatch here because metaflow is operating on
OpenFlow fields, not datapath ones. Even though they are generally very
similar, there are subtle differences, which is why it is necessary to
fix up the input port mask.
With Geneve options, the mapping is much more complicated and so the
situation is worse. The first issue is that the metaflow to flow
mapping can change over time, so we would need to do more revalidation
to track this. In addition, an upcoming patch will completely disconnect
the option format between ofproto-dpif and dpif-netdev, so the values
written by metaflow don't make sense at all.
When megaflows are turned off, ofproto-dpif internally generates masks
using flow_wildcards_init_for_packet(). Since that's the same as what
we want to do here, we can just use that instead of metaflow.
Ilya Maximets [Tue, 4 Aug 2015 19:36:37 +0000 (12:36 -0700)]
dpif-netdev: fix race for queues between pmd threads.
Currently pmd threads select queues in pmd_load_queues() according to
get_n_pmd_threads_on_numa(). This behavior leads to race between pmds,
beacause dp_netdev_set_pmds_on_numa() starts them one by one and
current number of threads changes incrementally.
As a result we may have the following situation with 2 pmd threads:
* dp_netdev_set_pmds_on_numa()
* pmd12 thread started. Currently only 1 pmd thread exists.
dpif_netdev(pmd12)|INFO|Core 1 processing port 'port_1'
dpif_netdev(pmd12)|INFO|Core 1 processing port 'port_2'
* pmd14 thread started. 2 pmd threads exists.
dpif_netdev|INFO|Created 2 pmd threads on numa node 0
dpif_netdev(pmd14)|INFO|Core 2 processing port 'port_2'
We have:
core 1 --> port 1, port 2
core 2 --> port 2
Fix this by starting pmd threads only after all of them have
been configured.
Cc: Daniele Di Proietto <diproiettod at vmware.com> Cc: Dyasly Sergey <s.dyasly at samsung.com> Acked-by: Flavio Leitner <fbl@sysclose.org> Acked-by: Daniele Di Proietto <diproiettod@vmware.com> Signed-off-by: Ilya Maximets <i.maximets at samsung.com> Signed-off-by: Ethan Jackson <ethan@nicira.com>
Joe Stringer [Wed, 29 Jul 2015 19:56:06 +0000 (12:56 -0700)]
kmod-traffic: Expand sanity tests.
The initial sanity test only checked IPv4 without IP fragments. This patch
adds additional tests using IPv6 and VLANs with IP fragments and expands
the existing test to be more strict.
Signed-off-by: Joe Stringer <joestringer@nicira.com> Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
Ben Pfaff [Sun, 2 Aug 2015 18:51:32 +0000 (11:51 -0700)]
ofproto-dpif: Use a regular ref instead of try_ref for rule translation.
Until now, flow translation has had to use try_ref to take a reference on
a rule, because a competing thread might have released the last reference
and done an RCU-postponed deletion. Since classifier versioning was
introduced, however, the release of the last reference is itself
RCU-postponed, which means that it is always safe to take the reference
directly.
Changing try_ref to ref means that taking a reference can't fail, which
allows the caller to take a reference in cases where the need to take a
reference was previously passed along a call chain, which simplifies some
code.
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Ben Pfaff [Mon, 3 Aug 2015 23:38:12 +0000 (16:38 -0700)]
ovn: Change strategy for tunnel keys.
Until now, OVN has used "flat" tunnel keys, in which the STT tunnel key or
Geneve VNI contains a logical port number. Logical port numbers are unique
within an OVN deployment.
Flat tunnel keys have the advantage of simplicity. However, for packets
that are destined to logical ports on multiple hypervisors, they require
sending one packet per destination logical port rather than one packet per
hypervisor. They also make it hard to integrate with VXLAN-based hardware
switches, which use VNIs to designate logical networks instead of logical
ports.
This commit switches OVN to a different scheme. In this scheme, in Geneve
the VNI designates a logical network and a Geneve option specifies the
logical input and output ports, which are now scoped within the logical
network rather than globally unique. In STT, all three identifiers are
encoded in the tunnel key.
To allow for the reduced amount of traffic for packets destined to logical
ports on multiple hypervisors, this commit also introduces the concept
of a logical multicast group. The membership of these groups can be set
using a new Multicast_Group table in the southbound database (and
ovn-northd does use it starting in this commit).
With multicast groups alone, it would be difficult to implement ACLs,
because an ACL might disallow only some of the packets being sent to
a remote hypervisor. Thus, this commit also splits the OVN logical
pipeline into two pipelines: the "ingress" pipeline, which makes the
decision about the logical destination of a packet as a set of logical
ports or multicast groups, and the "egress" pipeline, which runs on the
destination hypervisor with the multicast group destination exploded into
individual ports and makes a final decision on whether to deliver the
packet. The "egress" pipeline can efficiently apply ACLs.
Until now, the OVN logical and physical pipeline implementation was not
adequately documented. This commit adds extensive documentation to
the OVN manpages to cover these issues.
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Justin Pettit <jpettit@nicira.com>
Ben Pfaff [Sun, 19 Jul 2015 01:29:18 +0000 (18:29 -0700)]
actions: Allow caller to specify output table.
When an upcoming commit divides the pipeline up into ingress and egress
pipeline, it will become necessary to resubmit to different tables from
each of those pipelines to implement output. This commit makes that
possible.
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Justin Pettit <jpettit@nicira.com>
Ben Pfaff [Mon, 3 Aug 2015 18:10:43 +0000 (11:10 -0700)]
ovn: Rename Pipeline table to Logical_Flow table.
The OVN pipeline is being split into two phases, which are most naturally
called "pipelines". I kept getting very confused trying to call them
anything else, and in the end it seems to make more sense to just rename
the Pipeline table.
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Justin Pettit <jpettit@nicira.com>
Ben Pfaff [Sun, 19 Jul 2015 17:58:29 +0000 (10:58 -0700)]
ovn-controller: Use controller_ctx just to pass around data.
Until now, controller_ctx has been a store of common state (although
the amount of data stored in it has declined to just database state).
I think it's clearer if we just use it as a way to pass data to
functions. This commit makes that change.
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Justin Pettit <jpettit@nicira.com>
bridge: Reconfigure when system interfaces change.
Whenever system interfaces are removed, added or change state, reconfigure
bridge. This allows late interfaces to be added to the datapath when they are
added to the system after ovs-vswitchd is started.
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Russell Bryant [Fri, 31 Jul 2015 17:14:43 +0000 (13:14 -0400)]
ovn: Get/set lport type and options in ovn-nbctl.
A recent patch added "type" and "options" columns to the Logical_Port
table in OVN_Northbound. This patch allows you to get and set those
columns with ovn-nbctl.
ovn-nbctl should eventually get converted to use the common db-ctl
code that was recently added. When that happens, these commands can
just be removed.
Signed-off-by: Russell Bryant <rbryant@redhat.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Russell Bryant [Fri, 31 Jul 2015 17:14:42 +0000 (13:14 -0400)]
ovn: Add type and options to logical port.
We have started discussing the use of the logical port abstraction in
OVN to represent special types of connections into an OVN logical
switch. This patch proposes some schema updates to reflect these
special types of logical ports. A logical port can have a "type" and
a set of options specific to that type.
Some examples of logical port types would be "vtep" for connectivity
to a VTEP gateway or "localnet" for a connection to a locally
accessible network via an ovs bridge. Actualy support for these (or
other) types will come in later patches.
Signed-off-by: Russell Bryant <rbryant@redhat.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Thu, 30 Jul 2015 05:13:26 +0000 (22:13 -0700)]
ofproto-dpif-xlate: Fix mirroring interaction with recirculation.
Before this commit, mirroring state was not preserved across recirculation,
which could result in a packet being mirrored to the same destination both
before and after recirculation. This commit fixes the problem and adds a
test to avoid regression.
Found by inspection.
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Ben Pfaff [Thu, 30 Jul 2015 03:32:12 +0000 (20:32 -0700)]
ofproto-dpif-rid: Factor recirculation state out as new structure.
This greatly reduces the number of arguments to many of the functions
involved in recirculation, which to my eye makes the code clearer. It
will also make it easier to add new recirculation state in an upcoming
commit.
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Ben Pfaff [Thu, 30 Jul 2015 00:00:49 +0000 (17:00 -0700)]
ofproto-dpif-xlate: Rewrite mirroring to better fit flow translation.
Until now, mirroring has been implemented by accumulating, across the whole
translation process, a set of mirrors that should receive a mirrored
packet. After translation was complete, mirroring restored the original
version of the packet and sent that version to the mirrors.
That implementation was ugly for multiple reasons. First, it means that
we have to keep a copy of the original packet (or its headers, actually),
which is expensive. Second, it doesn't really make sense to mirror a
version of a packet that is different from the one originally output.
Third, it interacted with recirculation; mirroring needed to happen only
after recirculation was complete, but this was never properly implemented,
so that (I think) mirroring never happened for packets that were
recirculated.
This commit changes how mirroring works. Now, a packet is mirrored at the
point in translation when it becomes eligible for it: for mirrors based on
ingress port, this is at ingress; for mirrors based on egress port, this
is at egress. (Duplicates are dropped.) Mirroring happens on the version
of the packet as it exists when it becomes eligible. Finally, since
mirroring happens immediately, it interacts better with recirculation
(it still isn't perfect, since duplicate mirroring will occur if a packet
is eligible for mirroring both before and after recirculation; this is
not difficult to fix and an upcoming commit later in this series will do so).
Finally, this commit removes more code from xlate_actions() than it adds,
which in my opinion makes it easier to understand.
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Ben Pfaff [Wed, 29 Jul 2015 21:21:52 +0000 (14:21 -0700)]
ofproto-dpif-xlate: Drop packets received from mirror output ports earlier.
Packets should never be received on mirror output ports. We drop them
when we do receive them. But by putting them through the processing that
we did until now, we made it possible for MAC learning, etc. to happen
based on these packets. This commit drops them earlier to prevent that.
Found by inspection.
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Ben Pfaff [Wed, 29 Jul 2015 22:24:05 +0000 (15:24 -0700)]
ofproto-dpif-xlate: Clean up sFlow and IPFIX sampling code.
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>
Ben Pfaff [Wed, 29 Jul 2015 21:12:26 +0000 (14:12 -0700)]
tunnel: Break tnl_xlate_init() into two separate functions.
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>
Ben Pfaff [Thu, 23 Jul 2015 20:39:38 +0000 (13:39 -0700)]
ofproto-dpif-xlate: Simplify invocation of process_special().
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>
Ben Pfaff [Thu, 23 Jul 2015 20:01:57 +0000 (13:01 -0700)]
ofproto-dpif-xlate: Calculate 'ofpacts' in more restricted scope.
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>
Ben Pfaff [Fri, 31 Jul 2015 20:34:16 +0000 (13:34 -0700)]
ofproto-dpif-xlate: Make xlate_actions() caller supply action buffer.
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>
Ben Pfaff [Fri, 31 Jul 2015 20:15:52 +0000 (13:15 -0700)]
ofproto-dpif-xlate: Make xlate_actions() caller supply flow_wildcards.
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>
Ben Pfaff [Fri, 31 Jul 2015 20:33:16 +0000 (13:33 -0700)]
ofproto-dpif: Fix inaccurate wildcard output in ofproto/trace.
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.
Ben Pfaff [Thu, 23 Jul 2015 23:24:29 +0000 (16:24 -0700)]
ofproto-dpif-xlate: Initialize 'ctx' all in one place.
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>
Ben Pfaff [Thu, 30 Jul 2015 05:31:07 +0000 (22:31 -0700)]
ofproto-dpif-xlate: Initialize '*xout' all together at beginning.
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>
Ben Pfaff [Fri, 31 Jul 2015 00:44:26 +0000 (17:44 -0700)]
type-props: Suppress warnings in newer Clang and GCC.
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>
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>