2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-27 15:18:06 +00:00
Commit Graph

1490 Commits

Author SHA1 Message Date
Ben Pfaff
6d7568dc38 datapath: Avoid possibility of negative 'n_flows' in struct odp_flowvec.
do_flowvec_ioctl() was checking for too-big 'n_flows' but not negative
'n_flows'.  We could add that check too, but 'n_flows' should never be
negative so it's better to just use an unsigned type.
2010-05-13 15:29:46 -07:00
Andy Southgate
436f27dd88 Add ovsdbmonitor GUI tool by Andy Southgate, contributed by Citrix.
With Makefiles and Autoconfiscation by Ben Pfaff.

Signed-off-by: Thomas Lacroix <thomas.lacroix@citrix.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2010-05-13 14:53:39 -07:00
Ben Pfaff
a9633ada75 daemon: Throttle max respawning rate.
If a monitored daemon dies quickly at startup, the system can waste a lot
of CPU time continually restarting it.  This commit prevents a given
daemon from restarting more than once every 10 seconds.
2010-05-13 09:45:21 -07:00
Ben Pfaff
7c2dd4c648 daemon: Allow monitored daemon to dump core no more than once.
If the monitored daemon dumps core frequently, then this can quickly
exhaust the host's disk space.  This commit limits core dumps to at most
one per monitored session (typically, once per boot).
2010-05-13 09:45:21 -07:00
Ben Pfaff
e2bfacb6e4 ofproto: Prefer "master" and "other" connections for snooping over "slave".
This makes "ovs-ofctl snoop" and anything else that connects to the
switch's "snoop" socket typically more useful in the presence of multiple
controllers, since the "master" connection is the one with the most
interesting traffic.

Suggested-by: Justin Pettit <jpettit@nicira.com>
2010-05-13 09:43:39 -07:00
Ben Pfaff
32d9dc1181 ofproto-sflow: Maintain table of ports even when clearing configuration.
When ofproto_sflow_set_options() fails, it calls ofproto_sflow_clear() to
deconfigure the ofproto_sflow object.  But ofproto_sflow_clear() deletes
all of the object's record of datapath ports.  That means that the next
call to ofproto_sflow_set_options(), if it succeeds, will believe that the
datapath has no ports.

This commit fixes the problem by only clearing ofproto_sflow's record of
datapath ports when it is destroyed, not just when a configuration error
occurs.

Reported-by: Neil McKee <neil.mckee@inmon.com>
2010-05-12 16:43:34 -07:00
Ben Pfaff
0caf6bde24 ovs-ofctl: Add "snoop" command.
The "snoop" command does roughly the same thing as "monitor", but it is
easier to use in the common case where one just wants to look at the
OpenFlow controller connection for a bridge.  Instead of, for example,
   ovs-ofctl monitor unix:/var/run/openvswitch/br0.snoop
one merely types
   ovs-ofctl snoop br0
2010-05-11 12:44:58 -07:00
Ben Pfaff
c91248b3ab ofproto: Don't send async messages on transient connections by default.
ofproto supports listening for "transient connections" from clients such
as ovs-ofctl.  These OpenFlow connections are not supposed to receive
asynchronous messages by default, unless they ask for them by setting an
nonzero packet-in send length.  This feature got broken some time back.
This commit fixes it.
2010-05-11 12:42:07 -07:00
Ben Pfaff
89b9612d11 ofproto: Fix segfault sending packet_ins on transient connections. 2010-05-11 12:42:07 -07:00
Ben Pfaff
7f1089b503 ovs-ofctl: "monitor" command takes no more than 2 arguments
The "monitor" command would accept 3 arguments and ignore the third one.
Reject such usage instead.
2010-05-11 12:22:17 -07:00
Ben Pfaff
a6bc4a03a4 ovs-ofctl: Fix usage message for "monitor" command.
The "monitor" command takes at most two arguments, and the second one is
optional, so express that correctly.
2010-05-11 12:20:58 -07:00
Ben Pfaff
1e3c004749 Diagnose attempts to connect the wrong protocol to a network port.
Sometimes, when a user asks me to help debug a problem, it turns out that
an SSL connection was being made on a TCP port, or vice versa, or that an
OpenFlow connection was being made on a JSON-RPC port, or vice versa, and
so on.  This commit adds log messages that diagnose this kind of problem,
e.g. "tcp:127.0.0.1:6633: received JSON-RPC data on OpenFlow channel".
2010-05-11 11:50:45 -07:00
Ben Pfaff
c088c3be06 vconn-stream: Refactor vconn_stream_recv() for readability.
Backward "goto" statement are rarely a good idea, so this rewrites that
code for readability.
2010-05-11 11:50:45 -07:00
Jesse Gross
f7cf2ff0b6 vport: Record and free packets on unattached ports.
We throw away packets that are received on vports not attached to
a datapath but we are actually leaking them.  This records that an
error took place and frees the skb.
2010-05-11 11:01:34 -07:00
Jesse Gross
2455c7fac2 flow: Zero tun_id if wildcarded.
Normally match fields are zeroed if they are wildcarded in
normalize_match().  However, tun_id isn't part of struct ofp_match
so do it when we convert to a flow instead.
2010-05-10 18:23:18 -07:00
Jesse Gross
54adbf40ff gre: Include route headers in headroom calculation.
When calculating the amount of headroom required include the route,
which avoids a copy later when doing transforms like IPsec.
2010-05-10 17:57:47 -07:00
Jesse Gross
2457b24fc5 bridge: Add iface to hash table before calling iface_is_internal().
When creating an interface we need to check whether it is internal.
However, the function iface_is_internal() does a lookup on the
interface name but we haven't added it to the hash table yet.  This
adds the interface to the table early on in iface_create.

NIC-78
2010-05-10 13:38:21 -07:00
Ben Pfaff
d25b341aa8 bridge: Fix double-free bug in port_reconfigure().
Reported-by: Peter Balland <peter@nicira.com>
Bug #2794
2010-05-10 10:55:29 -07:00
Ben Pfaff
176aaa65aa flow: Fix misaligned access.
The testsuite for the flow extractor triggered this.

With this commit, "make check" passes on SPARC.
2010-05-07 14:36:08 -07:00
Ben Pfaff
afa3a93165 Add header for access to potentially unaligned data.
I had been under the impression that "memcpy" was a valid way to copy
unaligned data into an aligned location for access.  But testing on SPARC
has shown that GCC doesn't always honor that intention.  It seems that, if
GCC can see that there is a pointer of a type that requires alignment to
a given object, then it will access it directly regardless of whether
memcpy() is used to copy it.

This commit adds a new header with functions to access unaligned data.  I
managed to come up with two techniques, one GCC-specific, one generic, that
do avoid the misaligned access in my test case.  The GCC-specific technique
is the same one used by the Linux kernel (although no code has been
literally copied).  The other one seemed obvious but possibly slow
depending on the compiler's ability to optimize.

The following commit adds a user.
2010-05-07 14:36:07 -07:00
Ben Pfaff
a1ae5dc8da ovsdb-client: Serialize columns in predictable order on "monitor" command.
The "monitor" command goes to some trouble to write its output in a
predictable order, so that test programs can reliably compare it against
expectations.  This commit fixes up one part that was missing, which is
that the columns were not being ordered predictably (it depended on
hash order, which differs between big-endian and little-endian systems).
It also updates the test suite to expect the new order.
2010-05-07 14:36:06 -07:00
Ben Pfaff
e86dd676cd tests: Fix bug in "ovsdb-tool compact" test.
This test examines the OVSDB database log and checks that it contains what
it should for specified transactions.  However, the database log ordering
differs between big-endian and little-endian architectures because it is
written out in hash order.  We don't want to incur the expense of always
sorting the log as we write it out, so instead this commit fixes the
problem by sorting the log as it reads it, using the "test-json" program.
2010-05-07 14:36:04 -07:00
Ben Pfaff
1f4f3cd7e0 tests: Fix bug in "weak references" test.
One part of the "weak references" test inserts invalid all-zeros weak
references into two columns and expects to get an error message mentioning
one of them.  Unfortunately the one that actually gets mentioned depends
on hash ordering and thus differs between big-endian and little-endian
machines.  This commit fixes the problem by only putting an invalid
reference in a single column, instead of two of them.
2010-05-07 14:36:03 -07:00
Ben Pfaff
62c87d4aed tests: Fix bug in ovsdb-server test suite.
The formatting of OVSDB syntax errors differed between big-endian and
little-endian systems, which caused the "database multiplexing
implementation" test to fail on SPARC.  This commit fixes the problem by
always outputting JSON in syntax errors in deterministic (sorted) order.
2010-05-07 14:36:02 -07:00
Ben Pfaff
26adc8ddd7 util: Fix GCC false-positive warning for CONTAINER_OF.
On sparc, GCC would issue the following warning for every use of
CONTAINER_OF:

    warning: cast increases required alignment of target type

This is a false positive: assuming that the data structure that it is
applied to was allocated properly, the use of CONTAINER_OF to reach it is
valid.  And if it was not allocated properly, then code that accesses it
other ways will have trouble too.
2010-05-07 14:36:01 -07:00
Jesse Gross
f4267e344a datapath: Enable offloading on internal devices.
Enables checksum offloading, scatter/gather, and TSO on internal
devices.  While these optimizations were not previously enabled on
internal ports we already could receive these types of packets from
Xen guests.  This has the obvious performance benefits when these
packets can be passed directly to hardware.

There is also a more subtle benefit for GRE on Xen.  GRE packets
pass through OVS twice - once before encapsulation and once after
encapsulation, moving through an internal device in the process.
If it is a SG packet (as is common on Xen), a copy was necessary
to linearize for the internal device.  However, Xen uses the
memory allocator to track packets so when the original packet is
freed after the copy netback notifies the guest that the packet
has been sent, despite the fact that it is actually sitting in the
transmit queue.  The guest then sends packets as fast as the CPU
can handle, overflowing the transmit queue.  By enabling SG on
the internal device, we avoid the copy and keep the accounting
correct.

In certain circumstances this patch can decrease performance for
TCP.  TCP has its own mechanism for tracking in-flight packets
and therefore does not benefit from the corrected socket accounting.
However, certain NICs do not like SG when it is not being used for
TSO (these packets can no longer be handled by TSO after GRE
encapsulation).  These NICs presumably enable SG even though they
can't handle it well because TSO requires SG.

Tested controllers (all 1G):
Marvell 88E8053 (large performance hit)
Broadcom BCM5721 (small performance hit)
Intel 82571EB (no change)
2010-05-07 11:29:11 -07:00
Ben Pfaff
ccc1d98b87 ovsdb: In documentation, add commas to make large numbers easier to read. 2010-05-07 10:03:14 -07:00
Jesse Gross
090847a35f datapath: Break out test for dev_disable_lro().
It seems that dev_disable_lro() and skb_warn_if_lro() are not always
defined at the same time, despite the fact that they are typically
used together.  This independently tests for them.
2010-05-06 15:28:46 -07:00
Justin Pettit
7dab724e7d Fix issue with "strict" deletion of flows
OpenFlow provides the ability to delete flows that match a "strict"
description.  This means that wildcards are not active, and thus will
only match a single flow that exactly matches the description.  The code
that checks for a match is pretty dumb and still compares the values of
fields that are wildcarded.  A recent change added a "tun_id" matching
field, but did not zero out the field when it was supposed to be
ignored, which broke the matching used by strict deletions.  This sets
the field regardless of whether the field is wildcarded or not.

Reported-by: Natasha Gude <natasha@nicira.com>

Bug #2775
2010-05-06 14:44:00 -07:00
Jesse Gross
32ec73557f datapath: Fix build issue with LRO.
The last commit added a configure test for skb_warn_if_lro() but
reversed an #ifdef causing a function to be compiled when it wasn't
needed.
2010-05-06 13:44:01 -07:00
Jesse Gross
14cf356bf2 datapath: Add configure test for skb_warn_if_lro().
Some distributions backport this function, so use a configure
test instead of a version check.

CC: Alexey I. Froloff <raorn@altlinux.org>
2010-05-06 13:15:21 -07:00
Ben Pfaff
30ea5d93dc ofproto: Implement ofp_action_output "max_len" feature.
The "max_len" feature of ofp_action_output is completely unimplemented
currently.  Implement it.

Reported-by: Tetsuo NAKAGAWA <nakagawa@mxc.nes.nec.co.jp>
2010-05-05 14:33:50 -07:00
Ben Pfaff
6f42c8ea9a netdev-linux: Optimize removing policing from an interface.
It is very expensive to start a subprocess and, especially, to wait for it
to complete.  This replaces the most common subprocess operation in
netdev_linux_set_policing() by a Netlink socket operation, which is much
faster.

Without this and the other netdev-linux commits, my 1000-interface test
case runs in 1 min 48 s.  With them, it runs in 25 seconds.
2010-05-05 14:00:50 -07:00
Ben Pfaff
80a86fbed4 netdev-linux: Cache policing values.
Without this and the following netdev-linux commits, my 1000-interface test
case runs in 1 min 48 s.  With them, it runs in 25 seconds.
2010-05-05 14:00:50 -07:00
Ben Pfaff
8e46022197 netdev-linux: Factor out removing policing.
This is duplicated code that the following commit will rewrite.
2010-05-05 14:00:50 -07:00
Ben Pfaff
a5af30fbaa netdev-linux: Factor out obtaining an RTNL socket.
Another function needs this same functionality in an upcoming commit, so
factor this into a new function get_rtnl_sock().
2010-05-05 14:00:50 -07:00
Ben Pfaff
54825e09b3 dpif-linux: Use hash instead of sorted array.
With 1000 network devices being added or removed, sorting the array was a
profiling hot spot.  Using a hash makes it drop off the profile.
2010-05-05 14:00:50 -07:00
Ben Pfaff
3e9c481c70 bridge: Optimize trunk port common case.
Profiling with qprof showed that bitmap_set_multiple() and bitmap_equal()
were eating up quite a bit of CPU time during bridge reconfiguration (up
to about 10% of total runtime).  This is completely avoidable in the common
case where a port trunks all VLANs, where we don't really need a bitmap at
all.  This commit implements that optimization.
2010-05-05 14:00:50 -07:00
Ben Pfaff
36c501fe78 dynamic-string: Optimize ds_put_char().
A qprof profile showed ds_put_char() and ds_put_uninit() as 4% of total
runtime.  This commit inlines the common case, which reduces them to 1%
total.
2010-05-05 14:00:50 -07:00
Ben Pfaff
836fad5e1a bridge: Optimize port_lookup() using a hash.
Before this commit and the preceding one, with 1000 interfaces strcmp()
took 36% and port_lookup() took 8% of total runtime when reconfiguring
bridges.  With these two commits the percentage is reduced to 3% and 0%,
respectively.
2010-05-05 14:00:49 -07:00
Ben Pfaff
4a1ee6ae82 bridge: Optimize iface_lookup() and port_lookup_iface() with a hash.
Before this commit and the following one, with 1000 interfaces strcmp()
took 36% and port_lookup() took 8% of total runtime when reconfiguring
bridges.  With these two commits the percentage is reduced to 3% and 0%,
respectively.
2010-05-05 14:00:47 -07:00
Ben Pfaff
9e15c889f7 ovs-vswitchd: Implement "exit" unixctl command.
This is useful for profiling, since common profilers do not print anything
until the process terminates, and only if the process terminates in the
ordinary way by calling exit().
2010-05-05 14:00:13 -07:00
Neil McKee
5586445e99 sflow: Always add poller and sampler together.
he ofproto_sflow_add_poller() and ofproto_sflow_add_sampler() calls
should always be made together, either when a port is added
dynamically with ofproto_sflow_add_port() or when the sflow_agent is
first created in ofproto_sflow_set_options().  I was seeing odd
behavior where either the pollers or the samplers would never be
instantiated depending on the order that things happened.  (It's OK to
add the same sampler or poller again, because the library routines
sfl_agent_addPoller() and sfl_agent_addSampler() will just return the
existing one if it is there.  Perhaps we should add a comment to make
that clear?).

I changed the parameters to ofproto_sflow_add_sampler to make it work
the same way as ofproto_sflow_add_poller, where the options are
extracted from os->options within the function itself.
2010-05-05 13:27:11 -07:00
Neil McKee
f9727d7405 sflow: Properly fill in initial destination VLAN in sFlow output. 2010-05-05 13:27:08 -07:00
Neil McKee
c62caaa3f4 sflow: Include Ethernet FCS in frame_length to comply with sFlow spec. 2010-05-05 13:27:01 -07:00
Ben Pfaff
e723ff43aa vswitchd: Fix documentation of "agent" column in "sFlow" table.
The documentation now accurately reflects the implementation.  The
implementation, however, leaves a great deal to be desired.
2010-05-05 10:52:46 -07:00
Ben Pfaff
7b99db051b bridge: Fix double-free in sFlow configuration. 2010-05-05 10:50:38 -07:00
Ben Pfaff
d01600a208 ovs-vsctl: Add sFlow to supported set of tables.
Somehow this one got left out accidentally.

Reported-by: Neil McKee <neil.mckee@inmon.com>
2010-05-05 10:38:24 -07:00
Ben Pfaff
0313fb2e2f xenserver: Make Open vSwitch disable itself in "bridge" mode.
When /etc/xensource/network.conf contains the word "bridge", the system
is supposed to use the Linux bridge, not Open vSwitch.  This commit makes
OVS honor this setting, which until now it has mainly ignored.

Reported-by: Reid Price <reid@nicira.com>
2010-05-04 10:20:58 -07:00
Ben Pfaff
3bcf3e33e9 xenserverd: Give XAPI a grace period before refreshing network UUIDs.
XAPI updates the pool.conf file before it actually refreshes its database
from the new pool, so we need to wait for that to happen.  Hard-coded
delays aren't a good idea, but in the long term XAPI will probably be
adding a hook script for us to use, so this may be an OK stopgap measure.

Bug #2756.
2010-05-01 14:27:53 -07:00