sparse: Fix conflict between netinet/in.h and linux/in.h
linux/in.h (from linux uapi headers) carries many of the same
definitions as netinet/in.h (from glibc).
If linux/in.h is included after netinet/in.h, conflicts are avoided in
two ways:
1) linux/libc-compat.h (included by linux/in.h) detects the include
guard of netinet/in.h and defines some macros (e.g.
__UAPI_DEF_IN_IPPROTO) to 0. linux/in.h avoids exporting the same
enums if those macros are 0.
2) The two files are allowed to redefine the same macros as long as the
values are the same.
1) It uses a custom include guard
2) It uses dummy values for some macros.
This commit changes include/sparse/netinet/in.h to use the same include
guard as glibc netinet/in.h, and to use the same values for some macros.
I think this problem is present with linux headers after a263653ed798("netfilter: don't pull include/linux/netfilter.h from netns
headers") which cause our lib/netlink-conntrack.c to include linux/in.h
after netinet/in.h.
sample output from sparse:
/usr/include/linux/in.h:29:9: warning: preprocessor token IPPROTO_IP
redefined
../include/sparse/netinet/in.h:60:9: this was the original definition
/usr/include/linux/in.h:31:9: warning: preprocessor token IPPROTO_ICMP
redefined
../include/sparse/netinet/in.h:63:9: this was the original definition
[...]
/usr/include/linux/in.h:28:3: error: bad enum definition
/usr/include/linux/in.h:28:3: error: Expected } at end of specifier
/usr/include/linux/in.h:28:3: error: got 0
/usr/include/linux/in.h:84:16: error: redefinition of struct in_addr
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Tested-by: Joe Stringer <joe@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
Terry Wilson [Wed, 8 Jun 2016 13:55:14 +0000 (08:55 -0500)]
Add optional C extension wrapper for Python JSON parsing
The pure Python in-tree JSON parser is *much* slower than the
in-tree C JSON parser. A local test parsing a 100Mb JSON file
showed the Python version taking 270 seconds. With the C wrapper,
it took under 4 seconds.
The C extension will be used automatically if it can be built. If
the extension fails to build, a warning is displayed and the build
is restarted without the extension.
The Serializer class is replaced with Python's built-in
JSON library since the ability to process chunked data is not
needed in that case.
The extension should work with both Python 2.7 and Python 3.3+.
Signed-off-by: Terry Wilson <twilson@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
Terry Wilson [Wed, 8 Jun 2016 13:55:13 +0000 (08:55 -0500)]
Ensure significand remains an integer in Python3 json parser
The / operation in Python 2 is "floor division" for int/long types
while in Python 3 is "true division". This means that the
significand can become a float with the existing code in Python 3.
This, in turn, can result in a parse of something like [1.10e1]
returning 11 in Python 2 and 11.0 in Python 3. Switching to the
// operator resolves this difference.
The JSON tests do not catch this difference because the built-in
serializer prints floats with the %.15g format which will convert
floats with no fractional part to an integer representation.
Signed-off-by: Terry Wilson <twilson@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
ofproto-dpif-upcall: Prevent memory leak on log message.
When DPIF does not support UFID (like old kernels), it may print this
message quite frequently, if using an OVS version that does not include
the upstream fix af50de800ecb ("ofproto-dpif-upcall: Pass key to
dpif_flow_get().").
Fixes: 64bb477f0568 ("dpif: Minimize memory copy for revalidation.") Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com> Signed-off-by: Joe Stringer <joe@ovn.org>
Joe Stringer [Tue, 24 May 2016 01:20:31 +0000 (18:20 -0700)]
xenserver: Remove deprecated print statement.
PEP 3105 removed the print statement in favour of a print function.
Replace usage of the old statement with equivalent functionality that
works in both python2.7 and python3.
Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
Joe Stringer [Tue, 24 May 2016 01:20:29 +0000 (18:20 -0700)]
xenserver: Remove tuple unpacking in lambdas.
PEP 3113 removed the use of tuple parameter unpacking in conjunction
with lambdas, replace this code with something that works in python2.7
and python3.
Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
Joe Stringer [Tue, 24 May 2016 01:20:26 +0000 (18:20 -0700)]
xenserver: Sort vsctl port options.
In python3, dictionaries are less likely to be sorted consistently from
one run to the next, so sort port options when outputting to provide
reliable test results.
Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
This option is used to initialize the ovs_numa module with a fake
configuration and to avoid pthread_setaffinity_np() calls. It will be
useful to test dpif-netdev with pmd threads.
Since it is only used for testing it is not documented in the man pages.
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Acked-by: Ilya Maximets <i.maximets@samsung.com>
ovs-numa: Introduce function to set current thread affinity.
This commit moves the code that sets the pmd threads affinity from
netdev-dpdk to ovs-numa. There's one small part left in netdev-dpdk, to
set the lcore_id.
Now dpif-netdev will call both modules (ovs-numa and netdev-dpdk) when
starting a pmd thread.
This change will allow having a dummy implementation of the set affinity
call, for testing purposes.
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Acked-by: Ilya Maximets <i.maximets@samsung.com>
Instead of having static inline stubs for non linux platform we can use
the implementations in ovs-numa.c. With one small change to
ovs_numa_dump_cores_on_numa(), they will behave exactly like the
stubs for the non-linux case, because 'found_numa_and_core' will be
false and the socket and cpu hmaps will be empty.
There are a few places where conditional compilation is required: the
code that parses the linux specific sysfs entries and its dependencies.
It requires opendir() and readdir() and doesn't make sense outside of
linux anyway.
This change is required to have a cross-platform ovs-numa dummy
implementation for testing.
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Acked-by: Ilya Maximets <i.maximets@samsung.com>
Paul Boca [Mon, 6 Jun 2016 16:45:00 +0000 (16:45 +0000)]
datapath-windows: Improved offloading on STT tunnel
*Added OvsExtractLayers - populates only the layers field without unnecessary
memory operations for flow part
*If in STT header the flags are 0 then force packets checksums calculation
on receive.
*Ensure correct pseudo checksum is set for LSO both on send and receive.
Linux includes the segment length to TCP pseudo-checksum conforming to
RFC 793 but in case of LSO Windows expects this to be only on
Source IP Address, Destination IP Address, and Protocol.
*Fragment expiration on rx side of STT was set to 30 seconds, but the correct
timeout would be TTL of the packet
Russell Bryant [Thu, 2 Jun 2016 19:53:46 +0000 (15:53 -0400)]
INSTALL.md: Note use of "hacking" flake8 plugin.
The automatic flake8 check that runs against Python code has some
warnings enabled that come from the "hacking" flake8 plugin. If it's
not installed, the warnings just won't occur until it's run on a system
with "hacking" installed.
Signed-off-by: Russell Bryant <russell@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
Ilya Maximets [Fri, 27 May 2016 13:32:53 +0000 (16:32 +0300)]
netdev-dummy: Add multiqueue support to dummy-pmd.
All previous multi-open logic preserved for rx queues.
Also, added new optional parameter '--qid' for 'netdev-dummy/receive'
in order to allow user to choose id of rx queue to which packet will
be sent.
Benli Ye [Fri, 27 May 2016 15:32:40 +0000 (23:32 +0800)]
ipfix: Bug fix for configuring IPFIX for flows
There are two kinds of IPFIX: bridge level IPFIX and flow level
IPFIX. Now if we only configure flow level IPFIX, even if there
is no bridge IPFIX configuration, the datapath flow will contain
a sample action for bridge IPFIX. Fix it.
Steps to configure flow level IPFIX:
1) Create a new record in Flow_Sample_Collector_Set table:
'ovs-vsctl -- create Flow_Sample_Collector_Set id=1 bridge="Bridge UUID"'
2) Add IPFIX configuration which is referred by corresponding
row in Flow_Sample_Collector_Set table:
'ovs-vsctl -- set Flow_Sample_Collector_Set
"Flow_Sample_Collector_Set UUID" ipfix=@i -- --id=@i create IPFIX
targets=\"IP:4739\" obs_domain_id=123 obs_point_id=456
cache_active_timeout=60 cache_max_flows=13'
3) Add sample action to the flows:
'ovs-ofctl add-flow mybridge in_port=1,
actions=sample'('probability=65535,collector_set_id=1,
obs_domain_id=123,obs_point_id=456')',output:LOCAL'
Before this fix, if you only configure flow IPFIX, the datapath flow is:
id(0),in_port(2),eth_type(0x0806), packets:0, bytes:0, used:never,
actions:sample(sample=0.0%,actions(userspace(pid=4294960835,
ipfix(output_port=4294967295)))),sample(sample=100.0%,
actions(userspace(pid=4294960835,flow_sample(probability=65535,
collector_set_id=1,obs_domain_id=123,obs_point_id=456)))),
sample(sample=0.0%,actions(userspace(pid=4294960835,
ipfix(output_port=1)))),1
The datapath flow should only contain the sample action like below:
id(0),in_port(2),eth_type(0x0800),ipv4(frag=no), packets:9, bytes:871,
used:0.656s, actions:sample(sample=100.0%,actions(userspace(pid=4294962911,
flow_sample(probability=65535,collector_set_id=1,obs_domain_id=123,
obs_point_id=456)))),1
Signed-off-by: Benli Ye <daniely@vmware.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
Ben Pfaff [Fri, 27 May 2016 00:02:38 +0000 (17:02 -0700)]
tests: Avoid endianness sensitivity in MPLS handling test.
The test "ofproto-dpif - MPLS handling" included a test of the "multipath"
action whose results depended on the hash function in use. The OVS hash
function yields different results on little-endian and big-endian systems,
so this caused a failure.
This commit fixes the problem by changing the modulus in the multipath
action from 256 to 1; any (nonnegative) value modulo 1 is 0, so this makes
the results consistent across endianness (and across hash function
changes). I think that this is still a good enough test.
Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Aaron Conole <aconole@redhat.com> Acked-by: Gerhard Stenzel <gstenzel@linux.vnet.ibm.com>
Ben Pfaff [Thu, 26 May 2016 23:57:00 +0000 (16:57 -0700)]
tests: Fix select group test on big-endian systems.
This test ensures that, when the selection criteria for a select group are
the same from packet to packet, the same bucket is always selected.
However, it hardcoded the bucket that was selected to the one that happens
to be selected with the current OVS hash function on little-endian systems.
On big-endian systems, the current OVS hash functions turns out to select
the other bucket. That's fine (it's consistent, it just consistently makes
the other choice), so this commit fixes the problem by allowing either
bucket to be selected.
Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Aaron Conole <aconole@redhat.com> Acked-by: Gerhard Stenzel <gstenzel@linux.vnet.ibm.com>
Ben Pfaff [Thu, 26 May 2016 23:53:52 +0000 (16:53 -0700)]
netdev-native-tnl: Fix treatment of GRE key on big-endian systems.
The GRE implementation used bitwise shifts to convert an ovs_be32 to an
ovs_be64 (with zero extension), but on big-endian systems these conversions
are no-ops. This fixes the problem.
Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Aaron Conole <aconole@redhat.com> Acked-by: Gerhard Stenzel <gstenzel@linux.vnet.ibm.com>
Ben Pfaff [Fri, 3 Jun 2016 20:15:01 +0000 (13:15 -0700)]
types: Change ofp_port_t from uint16_t to uint32_t.
This fixes several tests that failed on big-endian systems because "union
flow_in_port" overlays an ofp_port_t and odp_port_t and in some cases it
is not easy to determine which one is in use.
This commit also fixes up a few places where this broke other code.
Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Aaron Conole <aconole@redhat.com> Acked-by: Gerhard Stenzel <gstenzel@linux.vnet.ibm.com>
route-table: If device is not there, route is still parseable.
Do not return failure to parse a route if device has been removed before we are
able to parse the route. That prevents "received bad netlink message" warnings
on the log.
This can be reproduced by simply removing interfaces.
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
There are four sessions established from ovn-controller to the following:
OVN Southbound — JSONRPC based
Local ovsdb — JSONRPC based
Local vswitchd — openflow based from ofctrl
Local vswitchd — openflow based from pinctrl
All of these sessions have their own probe_interval, For the last
two connections, they do not need probe_timer as they are over unix domain
socket. This patch takes care of that.
This change has been tested putting logs in several places like in
ovn-controller.c, lib/rconn.c to make sure the probe_timer is
disabled. Also, by making sure from ovn-controller's
log file that there is no more reconnect happening due to probe
under heavy load.
Signed-off-by: Nirapada Ghosh <nghosh@us.ibm.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
Nirapada Ghosh [Fri, 3 Jun 2016 18:48:49 +0000 (11:48 -0700)]
ovn-nbctl: Add lrouter and lrport related commands.
ovn-nbctl provides a shortcut to perform commands related lswitch, lport
and such but it doesn't have similar commands related to logical routers
and logical router ports. Also, 'ovn-nbctl show' is supposed to show an
overview of database contents, which means it should show the routers
as well. "ovn-nbctl show LSWITCH" shows the switch details, similarly
"ovn-nbctl show LROUTER" should show the router details too. This patch
takes care of all of these.
Modifications;
1) ovn-nbctl show -- will now show lrouters as well
2) ovn-nbctl show <lrouter> -- will show the router now
Unit test cases have been added to test all of these modifications and
additions.
Signed-off-by: Nirapada Ghosh <nghosh@us.ibm.com>
[blp@ovn.org added features to match the lswitch and lport commands] Co-authored-by: Ben Pfaff <blp@ovn.org> Signed-off-by: Ben Pfaff <blp@ovn.org>
Li Wei [Thu, 2 Jun 2016 01:09:42 +0000 (09:09 +0800)]
ovn-northd.8.xml: fix sock path of NB and SB database.
commit 60bdd01148e4 ("Separating OVN NB and SB database processes")
introduced a separating OVN NB and SB database process, the path of
sock files need to be updated.
Fixes: 60bdd01148e4 ("Separating OVN NB and SB database processes") Signed-off-by: Li Wei <lw@cn.fujitsu.com> Signed-off-by: Russell Bryant <russell@ovn.org>
ovn-controller: Refactor conntrack zone allocation.
We currently allocate conntrack zones in binding.c. It fits
in nicely there because we currently only allocate conntrack
zones to logical ports and binding.c is where we figure out
the local ones.
An upcoming commit needs conntrack zone allocation for routers
in a gateway. For that reason, this commit moves conntrack zone
allocation code to ovn-controller.c where it would be easily
accessible for router zone allocation too.
Signed-off-by: Gurucharan Shetty <guru@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
Currently OVN has distributed switches and routers. When a packet
exits a container or a VM, the entire lifecycle of the packet
through multiple switches and routers are calculated in source
chassis itself. When the destination endpoint resides on a different
chassis, the packet is sent to the other chassis and it only goes
through the egress pipeline of that chassis once and eventually to
the real destination.
When the packet returns back, the same thing happens. The return
packet leaves the VM/container on the chassis where it resides.
The packet goes through all the switches and routers in the logical
pipleline on that chassis and then sent to the eventual destination
over the tunnel.
The above makes the logical pipeline very flexible and easy. But,
creates a problem for cases where you need to add stateful services
(via conntrack) on switches and routers.
For l3 gateways, we plan to leverage DNAT and SNAT functionality
and we want to apply DNAT and SNAT rules on a router. So we ideally need
the packet to go through that router in both directions in the same
chassis. To achieve this, this commit introduces a new gateway router which is
static and can be connected to your distributed router via a switch.
To make minimal changes in OVN's logical pipeline, this commit
tries to make the switch port connected to a l3 gateway router look like
a container/VM endpoint for every other chassis except the chassis
on which the l3 gateway router resides. On the chassis where the
gateway router resides, the connection looks just like a patch port.
This is achieved by the doing the following:
Introduces a new type of port_binding record called 'gateway'.
On the chassis where the gateway router resides, this port behaves just
like the port of type 'patch'. The ovn-controller on that chassis
populates the "chassis" column for this record as an indication for
other ovn-controllers of its physical location. Other ovn-controllers
treat this port as they would treat a VM/Container port on a different
chassis.
Signed-off-by: Gurucharan Shetty <guru@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
ovn-northd: Support connecting multiple routers to a switch.
Currently we can connect routers via "peer"ing. This limits
the number of routers that can be connected with each other
directly to 2.
One of the design goals for L3 Gateway is to be able to
have multiple gateways (each with their own router)
connected to a distributed router via a switch.
With the above goal in mind, this commit gives the general
ability to connect multiple routers via a switch.
Signed-off-by: Gurucharan Shetty <guru@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
Dustin Lundquist [Fri, 20 May 2016 19:48:16 +0000 (12:48 -0700)]
ovn-northd: Restrict use of unspecified source addresses
Restrict use of the unspecified source addresses (:: and 0.0.0.0) to
traffic necessary to obtain an IP address. DHCP discovery messages for
the IPv4 case, and ICMP6 types necessary for duplicate address detection
for IPv6.
This breaks the existing ovn -- portsecurity : 3 HVs, 1 LS, 3 lports/HV
test since it tests sourcing IPv6 packets from the unspecified address
with and invalid ICMPv6 type (0). Modified this test should be extended
to verify ICMPv6 types for DAD are permitted, and other IPv6 traffic
sourced from the unspecified address are dropped.
Signed-off-by: Dustin Lundquist <dustin@null-ptr.net> Signed-off-by: Ben Pfaff <blp@ovn.org>
Zoltán Balogh [Thu, 2 Jun 2016 12:42:39 +0000 (12:42 +0000)]
netdev-dpdk: vhost-user port link state fix
OVS reports that link state of a vhost-user port (type=dpdkvhostuser) is
DOWN, even when traffic is running through the port between a Virtual
Machine and the vSwitch. Changing admin state with the
"ovs-ofctl mod-port <BR> <PORT> up/down" command over OpenFlow does
affect neither the reported link state nor the traffic.
The patch below does the flowing:
- Triggers link state change by altering netdev's change_seq member.
- Controls sending/receiving of packets through vhost-user port
according to the port's current admin state.
- Sets admin state of newly created vhost-user port to UP.
Signed-off-by: Zoltán Balogh <zoltan.balogh@ericsson.com> Co-authored-by: Jan Scheurich <jan.scheurich@ericsson.com> Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com> Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
ofproto-dpif: Cache result of time_msec() for rule_expire().
In the run() function of ofproto-dpif we call rule_expire() for every
possible flow that has a timeout and rule_expire() calls time_msec().
Calling time_msec() repeatedly can be pretty expensive, even though most
of the time it involves only a vdso call.
This commit calls time_msec only once in run(), to reduce the workload.
Keeping the flows ordered by expiration in some kind of heap or timing
wheel data structure could help make this process more efficient, if
rule_expire() turns out to be a bottleneck.
VMware-BZ: #1655122 Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Acked-by: Ben Pfaff <blp@ovn.org>
Throughout the years, changes in netdev vport have removed the need for some of
the headers, like shash, hmap, and many others. With the recent split of
push/pop code, less headers are needed in each of the two modules.
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com> Signed-off-by: Jesse Gross <jesse@kernel.org>
acinclude: fix issue when configuring with --with-dpdk
when an empty path is given to the --with-dpdk option
(--with-dpdk="" or --width-dpdk=$NON_SET_ENV_VARIABLE) the configure
script does not show any error and configures OvS without DPDK support,
this can create some confusion.
This patch modifies that behavior showing an explicity error in that case.
Signed-off-by: Mauricio Vasquez B <mauricio.vasquezbernal@studenti.polito.it> Signed-off-by: Ben Pfaff <blp@ovn.org>
Joe Stringer [Tue, 24 May 2016 01:11:03 +0000 (18:11 -0700)]
ovs-vtep: Make compatible with python2.7 and 3.
Translate commandline calls to UTF-8, appease flake8 and use six's
integer types. This allows the testsuite to pass when using python3 as
your default system python version.
Signed-off-by: Joe Stringer <joe@ovn.org> Tested-by: Darrell Ball <dlu998@gmail.com>
Simon Horman [Wed, 25 May 2016 01:34:31 +0000 (10:34 +0900)]
xlate: Skip recirculation for output and set actions
Until 8bf009bf8ab4 ("xlate: Always recirculate after an MPLS POP to a
non-MPLS ethertype.") the translation code took some care to only
recirculate as a result of a pop_mpls action if necessary. This was
implemented using per-action checks and resulted in some maintenance
burden.
Unfortunately recirculation is a relatively expensive operation and a
performance degradation of up to 35% has been observed with the above
mentioned patch applied for the arguably common case of:
pop_mpls,set(l2 field),output
This patch attempts to strike a balance between performance and
maintainability by special casing set and output actions such
that recirculation may be avoided.
This partially reverts the above mentioned commit. In particular most
of the C code outside of do_xlate_actions().
Signed-off-by: Simon Horman <simon.horman@netronome.com> Acked-by: Jarno Rajahalme <jarno@ovn.org>
Markos Chandras [Thu, 26 May 2016 15:23:02 +0000 (16:23 +0100)]
tests: bfd.at: Fix bridge name in comment
The bridge sitting between 'br-bfd0' and 'br-bfd1' is called 'br-sw'
instead of 'br2' and the patch ports are 'p0-sw' and 'p1-sw' instead
of 'p0-2' and 'p1-2' respectively so fix the comment.
Signed-off-by: Markos Chandras <mchandras@suse.de> Signed-off-by: Ben Pfaff <blp@ovn.org>
Markos Chandras [Thu, 26 May 2016 09:02:54 +0000 (10:02 +0100)]
util: Drop 'date' and 'time' arguments from ovs_set_program_name
The 'date' and 'time' arguments are normally being set by
'ovs_set_program_name' using __DATE__ and __TIME__. However, this
breaks reproducible builds since even without any changes in the
toolchain, build system etc, the end binary will still differ in
that regard. This is also visible when building with -Wdate-time:
and it's also something that triggers the following warning in the
openSUSE OBS builds:
[...]
openvswitch.x86_64: W: file-contains-date-and-time /usr/bin/ovs-ofctl
openvswitch.x86_64: W: file-contains-date-and-time /usr/bin/ovs-appctl
Your file uses __DATE and __TIME__ this causes the package to rebuild
when not needed
[...]
This patch drops these two arguments from ovs_set_program_name__ and
renames the function to ovs_set_program_name dropping the previous
preprocessor macro in the process.
This finally removes the remaining references to __DATE__ and __TIME__
from the sources which is something that has already been done in
commit 26bfaeaa9687 ("Stop using __DATE__ and __TIME__ in startup
string.") for the kernel datapath.
Cc: Jan Engelhardt <jengelh@inai.de> Signed-off-by: Markos Chandras <mchandras@suse.de> Signed-off-by: Ben Pfaff <blp@ovn.org>
Joe Stringer [Fri, 20 May 2016 18:49:59 +0000 (11:49 -0700)]
vagrant: Enable silent-rules for configure.
In the majority of cases, developers debugging their code using vagrant
will be more interested in compiler errors/warnings than the exact
invocation of the compiler. By enabling silent-rules, the verbosity of
compilation is lowered and it is easier to identify these pieces of
information.
Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org> Acked-by: Ryan Moats <rmoats@us.ibm.com>
ofproto: update mtu when port is getting removed as well
When we're adding the port into ovs bridge, its mtu is updated to the minimal
mtu of the included port. But when the port is getting removed, no such update
is performed, which leads to bug. For example, when the port with minimal mtu
is removed, bridge's mtu must adapt to new value, but it won't happen.
How to reproduce the problem:
$ ovs-vsctl add-br testing
$ ip link add name gretap11 type gretap local 10.0.0.1 remote 10.0.0.100
$ ip link add name gretap12 type gretap local 10.0.0.1 remote 10.0.0.200
$ ip link set dev gretap12 mtu 1600
$ ovs-vsctl add-port testing gretap11
$ ovs-vsctl add-port testing gretap12
$ ip a sh testing
16: testing: <BROADCAST,MULTICAST> mtu 1462 qdisc noop state DOWN
group default qlen 1
link/ether 7a:42:95:00:96:40 brd ff:ff:ff:ff:ff:ff
$ ovs-vsctl del-port gretap11
$ ip a sh testing
16: testing: <BROADCAST,MULTICAST> mtu 1462 qdisc noop state DOWN
group default qlen 1
link/ether 7a:42:95:00:96:40 brd ff:ff:ff:ff:ff:ff
$## as we can see here, 'testing' bridge mtu is stuck, while it must
adapt to new '1600' value,
$## cause there is only one port 'gretap12' left, and it's mtu is '1600':
$ ip a sh gretap12
19: gretap12@NONE: <BROADCAST,MULTICAST> mtu 1600 qdisc noop master
ovs-system state DOWN group default qlen 1000
link/ether b2:c6:1d:9f:be:0d brd ff:ff:ff:ff:ff:ff
My commit fixes this problem - mtu update is performed on port removal as well.
Signed-off-by: wisd0me <ak47izatool@gmail.com> Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Nithin Raju [Thu, 19 May 2016 22:31:49 +0000 (15:31 -0700)]
datapath-windows: o/p buffer must fit NL error message
OVS_IOCTL_WRITE and OVS_IOCTL_TRANSACT can generate a
netlink error that is represented by a OVS_MESSAGE_ERROR
struct. We want to make sure at the entry point of the
ioctl processing that the output buffer is big enough
to hold the error message. We were earlier checking
for struct OVS_MESSAGE which is smaller.
Since we are ensuring that output buffer can fit
OVS_MESSAGE_ERROR at the top of the ioctl function,
there's no need to check for that later.
Nithin Raju [Thu, 19 May 2016 22:31:48 +0000 (15:31 -0700)]
datapath-windows: don't map output buffer in OVS_IOCTL_WRITE
The contract of OVS_IOCTL_WRITE is that write operations
will not need the output buffer. Only the input buffer
will be used in the IRP. So, better to not map the output
buffer at all.
Nithin Raju [Tue, 17 May 2016 17:15:21 +0000 (10:15 -0700)]
datapath-windows: Use l2 port and tunkey during execute
While testing DFW and recirc code it was found that userspace
was calling into packet execute with the tunnel key and the
vport added as part of the execute structure. We were not passing
this along to the code that executes actions. The right thing is
to contruct the key based on all of the attributes sent down from
userspace.
Ian Stokes [Tue, 24 May 2016 16:36:50 +0000 (17:36 +0100)]
netdev-dpdk.c: Add generic policer functions.
Add generic policer functions to avoid code duplication.
Policing can be implemented on both egress and ingress paths.
Currently the QoS egress-policer implementation uses it's own specific run
and packet handle policer functions. This patch makes the policer functions
generic so that they can be used regardless of whether the policer is egress
or ingress by just requiring a pointer to the rte_meter used for policing
to be passed.
Signed-off-by: Ian Stokes <ian.stokes@intel.com> Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Jarno Rajahalme [Tue, 24 May 2016 07:25:36 +0000 (00:25 -0700)]
ofp-actions: Allow conntrack action in group buckets.
Conntrack action used in group buckets lets
us do simple load-balancing.
Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
[guru@ovn.org updated the commit message and made
a small change to the test output format] Signed-off-by: Gurucharan Shetty <guru@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
Instead of hardcoding 'kill `cat pid`' on every call to AT_CHECK is
simpler to use on_exit.
This makes sure that we kill every started daemon and fixes a travis
build timeout.
Suggested-by: Ben Pfaff <blp@ovn.org>
Tested-at: https://travis-ci.org/ddiproietto/ovs/builds/132404750 Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Acked-by: Ben Pfaff <blp@ovn.org>
Pravin B Shelar [Tue, 24 May 2016 03:27:14 +0000 (20:27 -0700)]
netdev-native-tnl: Introduce ip_build_header()
The native tunneling build tunnel header code is spread across
two different modules, it makes pretty hard to follow the code.
Following patch refactors the code to move all code to
netdev-ative-tnl module.
Signed-off-by: Pravin B Shelar <pshelar@ovn.org> Acked-by: Jesse Gross <jesse@kernel.org>
Joe Stringer [Tue, 17 May 2016 03:08:01 +0000 (20:08 -0700)]
upcall: Unregister dpif cbs in udpif_destroy().
During udpif_create(), we register callbacks for handling upcalls and
purging the datapath; however, in the corresponding udpif_destroy() we
never did this. This could potentially lead to dereference of
uninitialized memory in the userspace datapath if the main thread
destroys the udpif then executes an OpenFlow packet-out.
Fixes: e4e74c3a2b9a ("dpif-netdev: Purge all ukeys when reconfigure pmd.") Fixes: 623540e4617e ("dpif-netdev: Streamline miss handling.") Reported-by: William Tu <u9012063@gmail.com> Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
netdev-dpdk: Use ->reconfigure() call to change rx/tx queues.
This introduces in dpif-netdev and netdev-dpdk the first use for the
newly introduce reconfigure netdev call.
When a request to change the number of queues comes, netdev-dpdk will
remember this and notify the upper layer via
netdev_request_reconfigure().
The datapath, instead of periodically calling netdev_set_multiq(), can
detect this and call reconfigure().
This mechanism can also be used to:
* Automatically match the number of rxq with the one provided by qemu
via the new_device callback.
* Provide a way to change the MTU of dpdk devices at runtime.
* Move a DPDK vhost device to the proper NUMA socket.
A netdev provider, especially a PMD provider (like netdev DPDK) might
not be able to change some of its parameters (such as MTU, or number of
queues) without stopping everything and restarting.
This commit introduces a mechanism that allows a netdev provider to
request a restart (netdev_request_reconfigure()). The upper layer can
be notified via netdev_wait_reconf_required() and
netdev_is_reconf_required(). After closing all the rxqs the upper layer
can finally call netdev_reconfigure(), to make sure that the new
configuration is in place.
This will be used by next commit to reconfigure rx and tx queues in
netdev-dpdk.
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Tested-by: Ilya Maximets <i.maximets@samsung.com> Acked-by: Ilya Maximets <i.maximets@samsung.com> Acked-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
dpif-netdev: Handle errors in reconfigure_pmd_threads().
Errors returned by netdev_set_multiq() and netdev_rxq_open() weren't
handled properly in reconfigure_pmd_threads(). In case of error now we
remove the port from the datapath.
Also, part of the code is moved in a new function, port_reconfigure().
ofproto-dpif: Call dpif_poll_threads_set() before dpif_run().
An upcoming commit will make dpif_poll_threads_set() record the
requested configuration and dpif_run() apply it, so it makes sense to
change the order.
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Tested-by: Ilya Maximets <i.maximets@samsung.com> Acked-by: Ilya Maximets <i.maximets@samsung.com> Acked-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
ovs-thread: Do not quiesce in ovs_mutex_cond_wait().
ovs_mutex_cond_wait() is used in many functions in dpif-netdev to
synchronize with pmd threads, but we can't guarantee that the callers do
not hold RCU references, so it's better to avoid quiescing.
In system_stats_thread_func() the code relied on ovs_mutex_cond_wait()
to introduce a quiescent state, so explicit calls to
ovsrcu_quiesce_start() and ovsrcu_quiesce_end() are added there.
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Tested-by: Ilya Maximets <i.maximets@samsung.com> Acked-by: Ilya Maximets <i.maximets@samsung.com> Acked-by: Ben Pfaff <blp@ovn.org>
netdev objects are hard to use with RCU, because it's not possible to
split removal and reclamation. Postponing the removal means that the
port is not removed and cannot be readded immediately. Waiting for
reclamation means introducing a quiescent state, and that may introduce
subtle bugs, due to the RCU model we use in userspace.
This commit changes the port container from cmap to hmap. 'port_mutex'
must be held by readers and writers. This shouldn't have performance
impact, as readers in the fast path use a thread local cache.
dpif-netdev: Add pmd thread local port cache for transmission.
A future commit will stop using RCU for 'dp->ports' and use a mutex for
reading/writing them. To avoid taking a mutex in dp_execute_cb(), which
is called in the fast path, this commit introduces a pmd thread local
cache of ports.
The downside is that every port add/remove now needs to synchronize with
every pmd thread.
Among the advantages, keeping a per thread port mapping could allow
greater control over the txq assigment.