2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-29 15:28:56 +00:00
Commit Graph

6270 Commits

Author SHA1 Message Date
Justin Pettit
910fb1d8b6 meta-flow: Fix comment describing mf_set_flow_value().
An obvious copy/paste error.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
2013-06-11 13:03:50 -07:00
Joe Stringer
2b06df546f odp-execute: Style fixes
Signed-off-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-11 09:43:35 -07:00
Ben Pfaff
ff412c8c09 process: Add thread safety comments.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-10 13:48:12 -07:00
Ben Pfaff
57d90319a6 process: Make signal handling thread-safe.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-10 13:48:12 -07:00
Ben Pfaff
e1208bc494 process: Remove unused features from process_start().
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
2013-06-10 13:48:11 -07:00
Ben Pfaff
21f0192507 process: Remove process_run(), process_run_capture(), and related code.
They are unused.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ansis Atteka <aatteka@nicira.com>
2013-06-10 13:48:08 -07:00
Ben Pfaff
09672174bf ofproto-dpif: Fix incorrect printf format specifiers.
cc1: warnings being treated as errors
    ../ofproto/ofproto-dpif.c: In function ‘dpif_show_backer’:
    ../ofproto/ofproto-dpif.c:8305: error: format ‘%llu’ expects type ‘long
    long unsigned int’, but argument 4 has type ‘size_t’
    ../ofproto/ofproto-dpif.c:8305: error: format ‘%llu’ expects type ‘long
    long unsigned int’, but argument 5 has type ‘size_t’

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
2013-06-10 11:26:03 -07:00
Ben Pfaff
b1612a86b5 netdev-vport: Make netdev_vport_get_dpif_port() code less confusing.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-10 11:13:54 -07:00
Ben Pfaff
5014a89d93 ofp-util: Don't return static data in ofputil_packet_in_reason_to_string().
Returning a static data buffer makes code more brittle and definitely
not thread-safe, so this commit switches to using a caller-provided
buffer instead.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-10 11:13:54 -07:00
Ben Pfaff
e6603631d3 odp-util: Avoid returning static data in ovs_key_attr_to_string().
Returning a static data buffer makes code more brittle and definitely
not thread-safe, so this commit switches to using a caller-provided
buffer instead.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ansis Atteka <aatteka@nicira.com>
2013-06-10 10:59:59 -07:00
Ben Pfaff
e956d63bd5 ofp-actions: Add comments to struct ofpact_learn_spec.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ansis Atteka <aatteka@nicira.com>
2013-06-10 10:38:39 -07:00
Ben Pfaff
292aefc477 ovsdb-idlc: Write a new-line at the end of "annotate" output.
Some tools do not like text files that lack a trailing new-line.  In
particular, Debian's dpkg-source utility complains about a missing new-line
in the file generated by ovsdb-idlc:

    dpkg-source: warning: file
    openvswitch-1.9.2+git20130605/lib/vswitch-idl.ovsidl has no final
    newline (either original or modified version)

This commit fixes the problem.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
2013-06-10 10:25:29 -07:00
Ethan Jackson
c985ec94a2 ofproto-dpif-governor: Dispense with governor name.
In almost all cases, ovs-vswitchd runs with a single datapath, and
therefore a single governor.  Therefore, it's usually clear from
context what governor log messages are referring to making the name
redundant.  This patch removes it.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
2013-06-07 13:52:39 -07:00
Ethan Jackson
04d08d54ce ofproto-dpif: Maintain subfacets in dpif_backer.
Conceptually, a subfacet represents a datapath flow key, and
therefore belongs more to a datapath more than it does to a bridge.
This patch moves the subfacet hmap from 'struct ofproto_dpif' to
'struct dpif_backer', simplifying the code in the process.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
2013-06-07 13:38:54 -07:00
Ethan Jackson
380f49c4a1 ofproto-dpif: Set flow-eviction-threshold globally.
With the single datapath, it no longer makes sense to have a per
ofproto flow eviction threshold.  This patch moves the flow
eviction threshold to the Open_vSwitch table making the setting
global, though still treated separately for each ofproto.  A future
patch will unify flow eviction on a per datapath basis.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
2013-06-07 13:38:45 -07:00
Ethan Jackson
dc54ef36cb ofproto: Track subfacet stats in the backer.
Subfacets being per-datapath entities, their statistics are really
only interesting at per-datapath granularity.  This patch moves
them to the dpif_backer and makes some related simplifications.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
2013-06-07 13:26:16 -07:00
Ethan Jackson
9fc0165a50 ofproto-dpif: More responsive average subfacet statistics.
Before this patch, statistics about subfacet average life span,
and count in the datapath, were calculated over the entire lifetime
of the ofproto.  Furthermore, the subfacet lifespan was only
updated when a subfacet was removed from the datapath causing long
lived subfacets to be ignored.  It's far more useful to know these
numbers averaged over all subfacets in the recent past.  This patch
changes the code to implement an exponentially weighted moving
average updated every time statistics are pulled from the datapath.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
2013-06-07 13:26:16 -07:00
Ben Pfaff
5ad72ef5b6 timeval: Remove time_disable_restart(), time_enable_restart() functions.
These functions will not have the same useful effect when Open vSwitch
becomes multithreaded, because time_disable_restart() will disable time
advancing for every thread, not just for the thread that calls it.

These functions are no longer used, so this commit removes them.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-06 16:59:51 -07:00
Ben Pfaff
3aa30359b1 netdev-vport: Don't return static data in netdev_vport_get_dpif_port().
Returning a static data buffer makes code more brittle and definitely
not thread-safe, so this commit switches to using a caller-provided
buffer instead.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-06 16:54:46 -07:00
Ben Pfaff
3efb60637b dpif-netdev: Don't run port names through netdev_vport_get_dpif_port().
The ports that exist within a dpif have already been translated through
netdev_vport_get_dpif_port(), so there is no value to translating them
again in the interfaces that query or dump ports (and possibly a drawback
if somehow the translation could change).

After this change, dpif-netdev translates port names in just one place,
the port_add path, which makes dpif-netdev act the same way as dpif-linux
in this respect.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
2013-06-06 15:27:15 -07:00
Simon Horman
c0a71f4e62 ofproto-dpif: Actually log errors in facet_check_consistency()
facet_check_consistency() goes to some effort to create informative
error messages, protected by a rate limit, but does not actually
log these messages.

This appears to be an unintended side effect of
4dff909776 ("ofproto-dpif: Move
odp_actions from subfacet to facet.").  This patch restores the
logging behaviour present prior to the above commit.

This patch also reverses a changes made by the same commit to use
ds_put_cstr() instead of ds_put_char() in facet_check_consistency().

Cc: Justin Pettit <jpettit@nicira.com>
Cc: Ethan Jackson <ethan@nicira.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
2013-06-06 11:11:57 -07:00
Ben Pfaff
37cd552e93 route-table: Make 'rtnl_sock' and 'attrs' local variables non-static.
I don't see any reason for these to be static.

CC: Ethan Jackson <ethan@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
2013-06-05 14:58:09 -07:00
Ben Pfaff
3dea0874f7 netdev-vport: Make 'iface' non-static in tunnel_get_status().
I don't see any reason for this to be static.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
2013-06-05 14:58:05 -07:00
Ben Pfaff
a19b84f4a6 timeval: Do not block SIGALRM around setting 'deadline' in time_alarm().
There is no need to do so because the signal handler does not read or
write 'deadline'.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
2013-06-05 14:58:01 -07:00
Ben Pfaff
0c53ae66a3 lockfile: Remove calls to time_disable_restart()/time_enable_restart().
These calls are not necessary because F_SETLK does not block.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
2013-06-05 14:57:58 -07:00
Ben Pfaff
b173e167a4 signals: Make thread-safe.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
2013-06-05 14:57:54 -07:00
Simon Horman
799a91bb80 Always update ethertype on mpls_pop
The ethertype should always be updated on mpls_pop
as there may be a transition between MPLS unicast (0x8847) and
MPLS multicast (0x8848).

Ben Pfaff tells me that this is consistent with the
behaviour described in EXT-194 of the JIRA bug tracker.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-05 14:46:42 -07:00
Simon Horman
1ac7c9bdb2 ofproto-dpif: Use execute_actions to execute controller actions
Now that execute_actions() is available it can be used as a generic
replacement for special-case action execution in
execute_controller_action().

As suggested by Jesse Gross.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-05 14:31:49 -07:00
Simon Horman
6c13071b37 odp-execute: Add set skb_mark, set_priority, tunnel support.
The motivation for this is to allow such actions to be honoured
if they are encountered; by the user-space datapath before recirculation;
or by internal processing of actions by ovs-vswitchd before recirculation.
Recirculation will be added by a subsequent patch.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-05 14:28:57 -07:00
Simon Horman
617e10e71c odp-util: Export odp_tun_key_from_attr()
Rename tun_key_from_attr() as odp_tun_key_from_attr() and export it.
This is in preparation for calling this function outside of odp-util.c.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-05 13:51:04 -07:00
Jing Ai
bff7eeb648 ofp-actions: enforce valid range for table_id in goto_table instruction
Found a bug that OVS allows goto_table_id to be smaller than (or equal to)
the current table id where the flow resides. It potentially creates an
infinite loop when composing actions for a packet. To fix it, we just let
OVS returns an error message to prevent such flow to be programmed.

Signed-off-by: Jing Ai <jinga@google.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-05 13:34:25 -07:00
Ed Maste
084c3bb434 lib: Restore build on FreeBSD
It appears that the size_t definition was supplied through header leakage
on other platforms after commit eee8089cbe
(signals: Make signal_name() thread-safe.).

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-05 13:24:35 -07:00
Ben Pfaff
eee8089cbe signals: Make signal_name() thread-safe.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-05 12:46:59 -07:00
Ben Pfaff
22c4e104f6 signals: Use sys_siglist[] instead of strsignal() for thread-safety.
strsignal() isn't thread-safe but sys_siglist[] is.  Also, according to
the glibc manual, BSD has sys_siglist[] but not strsignal().

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-05 12:46:58 -07:00
Ben Pfaff
7fd51d3995 ofproto-dpif: Do not give stats to rules bypassed by "drop" frag policy.
When the OFPC_FRAG_DROP policy is in effect, IP fragments are supposed to
be dropped before they reach the flow table.  Open vSwitch properly dropped
IP fragments in this case, but still accounted them to the packet and byte
counters for the flow that they would have hit if the OFPC_FRAG_NX_MATCh
policy had been in effect.

Reported-by: love you <thunder.love07@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
2013-06-05 10:11:55 -07:00
Ben Pfaff
f0ac9da996 packets: Fix typo in reserved multicast Ethernet addresses.
The reserved multicast Ethernet addresses begin with 01:80:c2, not
01:08:c2.

Reported-by: Padmanabhan Krishnan <kprad1@yahoo.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
2013-06-05 09:44:32 -07:00
Andy Hill
ec9f40dce1 Fix misspellings in comments and docs.
Flagged with: https://github.com/lyda/misspell-check
Run with: git ls-files | misspellings -f -

Signed-off-by: Andy Hill <hillad@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-04 21:53:33 -07:00
Alex Wang
4be5ac89be ofproto/pktbuf.c: Fix a typo in the comment
This patch fixes a typo in the comment of the pktbuf_retrieve() function.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-04 14:33:26 -07:00
YAMAMOTO Takashi
9f9b6465b4 testsuite: make a sed command more portable
avoid using some GNU sed extensions, which are not available
eg. on NetBSD's /usr/bin/sed.

while there are other places these extenstions are used in the testsuite,
this instance is new and seems the only one currently being executed
for NetBSD.

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-04 12:39:23 -07:00
Alex Wang
c60c33fb5d bridge.c: Change variable "ofport" type in "struct if_cfg" and "struct iface"
This patch changes the variable type of "ofport" in "struct if_cfg" and
"struct iface" from int64_t to uint16_t. This is more consistent with
the OpenFlow-1.0 port definition.

Also, before this patch, -1 is used to indicate an unknown port. This
patch uses OFPP_NONE, since "ofport" becomes uint16_t.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-04 12:32:44 -07:00
Simon Horman
e655542cf3 Always use valid ids pointer in dec_ttl_cnt_ids_from_openflow()
Always update the ids pointer after calling ofpbuf_put()
to ensure that it is valid when accessed.

During testing a case came up where the call to ofpbuf_put() in the
for (i = 0; i < ids->n_controllers; i++) loop would cause the underlying
buffer to be reallocated. This resulted in ids->n_controllers being an
incorrect value, the loop continuing on longer than desired and finally a
segmentation fault.

Reported-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-04 10:23:06 -07:00
Ethan Jackson
9d46b444e3 cfm: Update netdev when changed.
If ofproto decided to change the netdev of a particular ofport,
cfm_demand mode would improperly continue using the old netdev to
collect stats.

Bug #17583.
Signed-off-by: Ethan Jackson <ethan@nicira.com>
2013-06-03 14:35:18 -07:00
Lorand Jakab
ae9020cf61 datapath: fix variable names in comment
Signed-off-by: Lorand Jakab <lojakab@cisco.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
2013-06-03 09:45:15 -07:00
Alex Wang
deea120099 ofproto-dpif.c: Modify vsp_realdev_to_vlandev() function
Commit 52a90c29 (Implement new "VLAN splinters" feature) passed in OpenFlow
port number to vsp_realdev_to_vlandev() function which asks for datapath port
number.

This patch fixes this bug by making the vsp_realdev_to_vlandev() function
take in and return OpenFlow port number.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-30 21:23:49 -07:00
Gurucharan Shetty
4e375050c6 INSTALL: Add documentaion for hot upgrades.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
2013-05-30 17:25:24 -07:00
Gurucharan Shetty
407b147399 ovs-ctl.in: Restore flows with vswitchd packet processing disabled.
It has been observed that when we upgrade openvswitch with
thousands of openflow flows already established and there is heavy
traffic going through the switch, restoring flows can take a very
long time (8 minutes in one use case) with CPU running at 100%.
This can make the upgrade very expensive.

This commit starts vswitchd by asking it to wait till flow restore is
finished. Once the flows are restored, it resumes normal operations.

Bug #16086.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
2013-05-30 17:25:24 -07:00
Gurucharan Shetty
1259a0c421 ovs-ctl.in: Add manager after restoring flows.
Currently we are adding the manager after starting ovs-vswitchd.
Instead, add the manager after flow restore is completed.

Bug #16086.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
2013-05-30 17:25:24 -07:00
Gurucharan Shetty
40358701d5 ovs-vswitchd: An option to wait for userspace flow restore to complete.
While upgrading openvswitch, it helps to restore openflow flows before
starting packet processing.  Typically we want to restart openvswitch,
add the openflow flows and then start packet processing.

To do this, we look for the other_config:flow-restore-wait column
in the Open_vSwitch table during startup. If set as true, we disable
receiving packets from the datapath, expiring or flushing flows and
running any periodic ofproto activities. This option does not prevent
the addition and deletion of ports. Once this option is set to false,
we return to normal processing.

An upcoming commit will use this feature in Open vSwitch startup scripts.

Bug #16086.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
2013-05-30 17:25:17 -07:00
Ethan Jackson
787f3d590b ofproto-dpif: Simplify ofproto hit count tracking.
Signed-off-by: Ethan Jackson <ethan@nicira.com>
2013-05-30 14:43:03 -07:00
Alex Wang
c33855167b ofproto-dpif: Fix a typo
This patch fixes a typo in handle_miss_upcalls() function.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-30 14:27:54 -07:00