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

1910 Commits

Author SHA1 Message Date
Justin Pettit
5db39d100c classifier: Add missing argument in CLASSIFIER_FOR_EACH_EXACT_RULE_SAFE
The CLASSIFIER_FOR_EACH_EXACT_RULE_SAFE macro was missing its "MEMBER"
argument.  It doesn't currently cause any problems because no one uses
the macro.
2010-10-08 11:19:02 -07:00
Justin Pettit
c5cd8b2ef1 ovs-openflowd: Don't segfault when no controllers specified
If no controllers are specified on the command-line, ovs-openflowd adds
a couple of its own.  The code that accounts for the controllers
correctly allocated space for them, but used the command-line count to
determine how many to set.  This led to a segfault when later code tried
to dereference them.

Reported-by: Derek Cormier <derek.cormier@lab.ntt.co.jp>
2010-10-07 23:51:02 -07:00
Ben Pfaff
0de7a4b484 ofproto: Drop flows from datapath more quickly under heavy load.
In normal operation it makes sense to keep track of all of the flows that
have been seen recently and to cache all of them in the kernel.  Under
unusual conditions, such as those caused by network scanning tools or by an
actual targeted DoS attack against the vswitch, the number of flows can
explode to extremely high numbers (hundreds of thousands or more).  In such
a situation the vswitch needs to guard against memory exhaustion by
expiring flows more quickly and more often.  This commit implements an
inexpensive technique for determining which flows should be dropped in such
a situation.
2010-10-07 16:44:32 -07:00
Ben Pfaff
35950f0cfa classifier: Introduce macros for iterating exact-match flows.
This special case of iterating through flows is easier and presumably
faster to implement using a macro.
2010-10-07 10:36:02 -07:00
Ben Pfaff
da89bf9eb7 ofproto: Iterate through exact-match rules first during expiration.
A wildcarded flow is idle only if all of its subrules have expired because
they were idle, so unless we expire exact-match rules first it is possible
that a wildcarded flow fails to expire as soon as it should.

(The current implementation of classifier_for_each() iterates through
exact-match rules before wildcarded rules, but nothing in the interface
guarantees that.)
2010-10-07 10:30:54 -07:00
Ben Pfaff
8497dd4121 ofproto: Drop unneeded poll_immediate_wake().
This poll_immediate_wake() is unnecessary because netflow_run() is always
called afterward within the same poll loop.  It's better to delete it, to
avoid wasting CPU.
2010-10-07 10:30:54 -07:00
Ben Pfaff
431d470740 ofproto: Fix effective memory leak for uninstallable flows.
In one or two corner cases, flows cannot be installed because every packet
in the flow must be processed by userspace.  The code to expire rules was
ignoring these uninstallable rules, and thus they would never get freed,
even after they became idle.  This commit fixes the problem.
2010-10-07 10:30:54 -07:00
Ben Pfaff
3b58761604 ofproto: Factor conditional out of loop in send_flow_removed(). 2010-10-07 10:30:54 -07:00
Ben Pfaff
4a4cdb3b24 ofproto: Group functions related to flow expiration together.
This should be a purely stylistic change, with no effect on behavior.

This commit changes the callback pointer passed to the
classifier_for_each() from a pointer to an ofproto to a pointer to a
structure that includes an ofproto.  Future commits planned will add
more members to this new structure.
2010-10-06 14:39:56 -07:00
Ben Pfaff
3dffcf0701 ofproto: Avoid wasting memory malloc()'ing empty action sets for subrules.
GNU libc treats malloc(0) as malloc(1).  Subrules always have an n_actions
of 0, so this code was wasting time and memory for subrules.  This commit
stops doing that.

Also audits and fixes some very pedantic potential problems with null
pointers; e.g. the C standard says that NULL may not be compared with the
< operator, even if both arguments are null, and it also says that a null
pointer may not be passed to memcpy() or memcmp(), even if the length is
zero.
2010-10-06 14:21:47 -07:00
Ben Pfaff
b8dcf5e9c5 netdev: Pass class structure, instead of type, to "create" function.
This opens up the possibility of storing private data at a relative offset
to the class structure, instead of having to keep a separate table.
2010-10-06 13:49:07 -07:00
Ben Pfaff
6fcfff1b11 netdev-vport: Fix typo in comment.
Must have been a stray s/gre/patch/ in this file's history.
2010-10-06 13:45:55 -07:00
Jesse Gross
668aedc070 datapath: Force our include directory to be first.
XenServer puts our header files in the standard system search path
by default.  This is normally OK, except when we introduce new things
which aren't in those headers.  Since the system picks up the older files
first this leads to undefined sysmbols.

Signed-off-by: Jesse Gross <jesse@nicira.com>
2010-10-05 18:12:05 -07:00
Ethan Jackson
7ed7b619e3 xenserver: ovs-external-ids log to file instead of syslog
ovs-external-ids was crashing on startup because it was brought up
before /dev/log exists.  The simplest solution to this problem is
to have it log to /var/log/openvswitch/ovs-external-ids.log .  This
is consistent with vswitchd and ovsdb-server.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
2010-10-05 01:12:56 +00:00
Jesse Gross
4bee421f3a tunnel: Correctly check for internal device.
With header caching we check to see if the next device in the stack
is an OVS device and, if so, cache that flow as well.  However, the
test for this called internal_dev_get_vport() assuming that it would
return NULL if the device is not an internal device.  It doesn't,
however, it just returns the offset from the device where the vport
data structure would be if it were an internal device.  This changes
it to explicitly check for an internal device first to avoid a panic.

Bug #3470

Reported-by: Ram Jothikumar <rjothikumar@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Reviewed-by: Justin Pettit <jpettit@nicira.com>
2010-10-04 16:31:31 -07:00
Justin Pettit
eedc0097f4 Add Nicira extension for modifying queue without transmitting
The OpenFlow OFPAT_ENQUEUE action sets a queue id and outputs the packet
in one shot.  There are times in which the queue should be set, but the
output port is not yet known.  This commit adds the NXAST_SET_QUEUE and
NXAST_POP_QUEUE Nicira extension actions to modify the queue
configuration without requiring a port argument.

CC: Jeremy Stribling <strib@nicira.com>
CC: Keith Amidon <keith@nicira.com>
2010-10-02 18:36:10 -07:00
Ben Pfaff
9ebc44ae8c netflow: Avoid (theoretically) looping 2**32 times.
If the netflow byte counter is UINT64_MAX, or at any rate much larger than
UINT32_MAX, netflow_expire() could loop for a very long time.  This commit
avoids that case.

This is only a theoretical bug fix.  I don't know of any actual bug that
would cause a counter to be that high.
2010-10-01 14:31:48 -07:00
Ben Pfaff
48f846e66e netflow: Do 64-bit division less often.
64-bit division is expensive.  Usually we can avoid it entirely, as done by
this patch.
2010-10-01 14:31:48 -07:00
Ben Pfaff
8b055d9253 INSTALL.Linux: Describe how to upgrade the Open vSwitch database.
Suggested-by: Parham Kiani <pkiani@essex.ac.uk>
2010-10-01 13:51:54 -07:00
Ben Pfaff
d4cdc6b4c4 ovs-controller: Improve QoS abilities.
This makes it a little easier to test Open vSwitch QoS features using
ovs-controller, by making it possible to assign queues on the basis of
input port, instead of just allowing a single queue for a whole switch.

CC: Michael Mao <mmao@nicira.com>
2010-10-01 13:41:40 -07:00
Ben Pfaff
ad67e56888 learning-switch: Introduce struct for configuration.
This should make extensions easier.
2010-10-01 13:09:05 -07:00
Ben Pfaff
09913dfd25 ovs-controller: Make --with-flows read the file only once, at startup.
A couple of people have reported that ovs-controller --with-flows is
confusing.  This seems to be because it doesn't read the file with the
flows until the first connection from a switch.  Then, if the file has a
syntax error, it exits.

This commit changes the behavior so that it reads the file immediately at
startup instead.
2010-10-01 13:09:05 -07:00
Ben Pfaff
0e581146fe ofp-parse: Add test. 2010-10-01 13:09:05 -07:00
Ben Pfaff
3ff4f87161 ofp-print: Make output easier to read. 2010-10-01 13:09:05 -07:00
Ben Pfaff
15f1f1b63a ofp-parse: Factor out duplicated code into new functions. 2010-10-01 13:08:33 -07:00
Ben Pfaff
bb98f9b951 ofp-parse: Properly byteswap in_port. 2010-10-01 13:08:33 -07:00
Ben Pfaff
1ac788f67f ofproto: Only dump queue statistics if the queue really exists.
Without this commit, "ovs-ofctl queue-stats br0 ALL 1" will print something
like the following if port 3 has queue 1 but none of the other ports do:

    stats_reply (xid=0x7b378): flags=none type=5(queue)
     4 queues
      port 0 queue 1: bytes=?, pkts=?, errors=?
      port 1 queue 1: bytes=?, pkts=?, errors=?
      port 2 queue 1: bytes=?, pkts=?, errors=?
      port 3 queue 1: bytes=0, pkts=0, errors=0

With this commit, it will print the following instead, which seems more
useful:

   stats_reply (xid=0x3ada1): flags=none type=5(queue)
    1 queues
     port 3 queue 1: bytes=0, pkts=0, errors=0
2010-10-01 10:40:01 -07:00
Ben Pfaff
d5590e7e41 netdev-linux: Fix off-by-one error dumping queue stats.
Linux kernel queue numbers are one greater than OpenFlow queue numbers, for
HTB anyhow.  The code to dump queues wasn't compensating for this, so this
commit fixes it up.
2010-10-01 10:40:00 -07:00
Ben Pfaff
d2805da2cb ovs-ofctl: Add "queue-stats" command to print queue stats. 2010-10-01 10:40:00 -07:00
Ben Pfaff
4e8e4213a8 Switch many macros from using CONTAINER_OF to using OBJECT_CONTAINING.
These macros require one fewer argument by switching, which makes code
that uses them shorter and more readable.
2010-10-01 10:25:29 -07:00
Ben Pfaff
adf7cfd851 util: New macro OBJECT_CONTAINING.
This macro is a variant on CONTAINER_OF that takes an object pointer
instead of a type name as its second argument.  In the following commit
this will simplify many users of CONTAINER_OF.
2010-10-01 10:25:10 -07:00
Ben Pfaff
ca0f572cfe ofproto: Use hash table instead of sparse array for ofports.
The main advantage of a sparse array over a hash table is that it can be
iterated in numerical order.  But the OVS implementation of sparse arrays
is quite expensive in terms of memory: on a 32-bit system, a sparse array
with exactly 1 nonnull element has 512 bytes of overhead.  In this case,
the sparse array's property of iteration in numerical order is not
important, so this commit converts it to a hash table to save memory.
2010-10-01 10:25:10 -07:00
Ben Pfaff
0cc96e48ab sflow: Use hash table instead of sparse array for sflow ports.
The main advantage of a sparse array over a hash table is that it can be
iterated in numerical order.  But the OVS implementation of sparse arrays
is quite expensive in terms of memory: on a 32-bit system, a sparse array
with exactly 1 nonnull element has 512 bytes of overhead.  In this case,
the sparse array's property of iteration in numerical order is not
important, so this commit converts it to a hash table to save memory.
2010-10-01 10:25:10 -07:00
Ben Pfaff
d9a8717a00 bridge: Use hash table instead of sparse array for bridge ports.
The main advantage of a sparse array over a hash table is that it can be
iterated in numerical order.  But the OVS implementation of sparse arrays
is quite expensive in terms of memory: on a 32-bit system, a sparse array
with exactly 1 nonnull element has 512 bytes of overhead.  In this case,
the sparse array's property of iteration in numerical order is not
important, so this commit converts it to a hash table to save memory.
2010-10-01 10:25:10 -07:00
Ben Pfaff
f309964762 hmap: New function hmap_clear(). 2010-10-01 10:25:10 -07:00
Ben Pfaff
93b13be8e6 netdev-linux: Use hash table instead of sparse array for QoS classes.
The main advantage of a sparse array over a hash table is that it can be
iterated in numerical order.  But the OVS implementation of sparse arrays
is quite expensive in terms of memory: on a 32-bit system, a sparse array
with exactly 1 nonnull element has 512 bytes of overhead.  In this case,
the sparse array's property of iteration in numerical order is not
important, so this commit converts it to a hash table to save memory.
2010-10-01 10:25:10 -07:00
Ben Pfaff
0c18b5a065 ovs-vsctl: Reduce log level for "Called as..." for read-only invocations.
When ovs-vsctl is not actually going to modify the database, it is less
interesting in the log, so we might as well only log it at "debug" level.

Suggested-by: Neil McKee <neil.mckee@inmon.com>
2010-10-01 10:22:03 -07:00
Ben Pfaff
1998cd4d3e ovs-vsctl: Factor out and optimize searching for a command by name.
The following commit will introduce a new function that wants to do this
a lot, so we might as well do it efficiently.
2010-10-01 10:18:51 -07:00
Ethan Jackson
c84d769c14 debian: openvswitch-common ethtool should not be required
The ethtool package is only used to help ovs-bugtool create bug
reports and does not prevent the script from running if it's
missing. Making it a requirement for installation is a bit
draconian.
2010-09-28 13:56:00 -07:00
Justin Pettit
55f8a832c1 debian: Restart ovs-monitor-ipsec when --monitor specified
The OVS Python daemon library will restart a process when started with
"--monitor" that exits with RESTART_EXIT_CODE.  Have ovs-monitor-ipsec
exit with this code when an uncaught exception occurs.
2010-09-27 18:48:25 -07:00
Justin Pettit
b0e62f3dac debian: Create ovs-monitor-ipsec rundir if it doesn't exist
Reported-by: Sajjad Lateef <slateef@nicira.com>
2010-09-27 18:33:56 -07:00
Ethan Jackson
85d32f1fee debian: Added a manpage for ovs-bugtool
Added a manpage for the ovs-bugtool script.
2010-09-23 04:58:39 -07:00
Ethan Jackson
6793129d36 tests: Test that children restart with special exit code
Added a test which checks that the python daemon code properly
restarts child processes which exit with RESTART_EXIT_CODE.
2010-09-23 02:00:03 -07:00
Ethan Jackson
9c64f2384d tests: Remove trailing whitespace from python daemon tests
Removes the trailing whitespace from the testing code related to
daemonizing in Python.
2010-09-22 23:09:41 -07:00
Ethan Jackson
998bb652ec xenserver: monitor-external-ids should run with --monitor
The init script starts monitor-external-ids with --monitor when
configured to do so.  Also made changes to guarantee that --monitor
actually restarts ovs-external-ids.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
2010-09-22 20:06:40 -07:00
Ethan Jackson
0d8568c13e xenserver: Added additional logging to ovs-external-ids
Added additional logging for debug-ability and migrated to python
logging module.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
2010-09-22 19:56:02 -07:00
Justin Pettit
9a3f4a496f vswitch: Consistently use spaces instead of tabs in vswitch.xml 2010-09-23 18:21:31 -07:00
Justin Pettit
c1fdab0106 netdev: Cleanup minor comment formatting issues. 2010-09-23 18:21:31 -07:00
Justin Pettit
d198402844 vswitch: Disable header-caching when IPsec is enabled
Header caching speeds up sending tunneled traffic by bypassing the Linux
IP stack.  This also causes it to bypass IPsec processing, which will
break connectivity.  This commit disables header caching when IPsec is
enabled.
2010-09-23 18:21:31 -07:00
Justin Pettit
9704460403 debian: Use DODTIME instead of DIETIME in init scripts
Brad pointed out that openvswitch-ipsec init script defined the variable
DIETIME but attempted to use it as DODTIME.  This commit uses DODTIME,
since it's the name used by the openvswitch-switch init script.  The
openvswitch-controller init script had the same issue.

As suggested by Ben, the "s" suffixes are removed from sleep commands,
since they are a GNU extension.

Reported-by: Brad Hall <brad@nicira.com>
2010-09-23 18:21:31 -07:00