2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 05:47:55 +00:00

10798 Commits

Author SHA1 Message Date
Joe Stringer
78145f6edb dpif: Always generate RFC4122 UUIDs for UFID.
This patch sacrifices a few bits of hash quality from the 128-bit unique
flow identifiers to make the UFIDs RFC4122-conformant as per the version 4
(random) UUID spec. Given that the 128-bit space is already quite large,
this should not affect the spread of UFIDs in any meaningful way for
hashing.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-09 18:20:02 -07:00
Jarno Rajahalme
19ba142220 ofp-parse: Use F_OUT_PORT when parsing.
We set this field flag for the cases when an out_port should be
parsed, but failed to make use of it.

Two test cases needed to be updated due to use of out_port in flow
add, while out_port is legal for flow deletes only.

Suggested-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-09 17:08:26 -07:00
Jarno Rajahalme
3139b8e909 odp-util: Simplify parsing function for GCC.
GCC 4.7.2 -O3 flagged potential use before initialization for the 'id'
and 'id_mask' being scanned in scan_vxlan_gbp().  For the 'id' this
was a real possiblity, but for the 'id_mask' it seems to be a false
positive in gcc analysis.  Simplify scan_vxlan_gbp() to fix this.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-09 17:08:13 -07:00
Jarno Rajahalme
d426c66cad ofproto: Fix memory leak in ofproto_rule_delete().
Commit 401aa90e33be (ofproto: Fix memory leak in flow deletion.) fixed
the memory leak when a rule is deleted, but failed to do the same when
all rules in a bridge are deleted just before the bridge itself is
deleted.

This patch adds the necessary unref to ofproto_rule_delete().

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-09 15:24:33 -07:00
Ben Pfaff
4c0e587ce4 flow: Add 'const' qualifiers in flow extraction.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
2015-06-08 15:04:30 -07:00
Andy Zhou
4c2809787c ovsdb-monitor: add json cache
Although multiple jsonrpc monitors can share the same ovsdb monitor,
each change still needs to translated into json object from scratch.
This can be wasteful if multiple jsonrpc monitors are interested in the
same changes.

Json cache improves this by keeping an copy of json object generated
for transaction X to current transaction. When jsonrpc is interested
in a change, the cache is searched first, if an json object is found,
a copy of it is handed back, skipping the regeneration process.

Any commit to the monitor will empty the cache. This can be further
optimized to not throw away the cache if the updated tables and columns
are not being monitored.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-08 14:28:23 -07:00
Andy Zhou
6e5a9216f3 ovsdb-monitor: allow multiple jsonrpc monitors to share a single ovsdb
monitor

Store ovsdb monitor in a global hmap. If a newly created ovsdb monitor
object monitors the same tables and columns as an existing one, the
existing monitor will be reused.

With this patch, jsonrpc monitor and ovsdb monitor now have N:1 mapping.
The goals are to:
1) Reduce the cost of maintaining duplicated monitors.
2) Allow for create Json cache for the same updates. Json cache will be
introduced in the following patch.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-08 14:28:23 -07:00
Andy Zhou
36247a75e9 ovsdb-monitor: refactor ovsdb_monitor_create()
Add ovsdb_monitor_add_jsonrpc_monitor(). This change will allow
ovsdb_monitor to be reference counted.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-08 14:28:22 -07:00
Andy Zhou
6d9e94b522 tunneling: Fix a tunnel name display bug
Currently, 'ovs-appctl tnl/ports/show' command won't display gre port
name correctly. Since netdev_vport_get_dpif_port() will not always
set the 'namebuf' it receives. Should use the name by its return
value instead. Found by inspection.

Also extend the test case to cover this command.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-08 13:28:14 -07:00
Jesse Gross
50dcbd8ed4 ofp-util: Convert flow_metadata to match structure.
We have a special flow_metadata structure to represent the parts
of a packet that aren't carried in the payload itself. This is
used in the case where we need to send the packet as a Packet In
to an OpenFlow controller. This is a subset of the more general
struct flow.

In practice, almost all operations we do on this structure involve
converting it to or from a match or have code that is the same as
a match. Serialization to NXM and back is done as a match. There
is special flow_metadata formatting code that is almost identical
to match formatting.

The uses for struct flow_metadata aren't performance critical
when it comes to memory, so we can save quite a bit of code by
just using a match structure directly instead. In addition, as
metadata increases and becomes more complex (Geneve options require
some special handling beyond just additional fields), using the
match structure means we only have to do this work in one place.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-08 10:17:58 -07:00
Alin Gabriel Serdean
d183efc22b This commit adds the windows installer to the OVS tree.
Requirements are the following:
Visual Studio Community 2013
WiX Toolset 3.9
Microsoft_VC120_CRT_x86.msm

More detailed information on the requirements and build instructions
can be found under:
https://github.com/cloudbase/ovs-windows-installer/blob/master/README.rst

To run and make the installer issue the following:

./boot.sh
./configure CC=./build-aux/cccl LD="`which link`" \
LIBS="-lws2_32 -liphlpapi" --prefix="C:/openvswitch/usr" \
--localstatedir="C:/openvswitch/var" --sysconfdir="C:/openvswitch/etc" \
--with-pthread="C:/pthread" --with-vstudiotarget="Release"

make clean && make -j16 windows_installer

To uninstall one could use the following Powershell commandlets:
$app = Get-WmiObject -Class Win32_Product | Where-Object `
 { $_.Name -match "Open Vswitch" }

$app.Uninstall()

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Co-authored-by: Alessandro Pilotti <apilotti@cloudbasesolutions.com>
Signed-off-by: Alessandro Pilotti <apilotti@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
2015-06-07 14:40:52 -07:00
Alex Wang
d8485a90af tests: Fix unit test failure.
This commit fixes unit test failure caused by commit f171fa8 (odp-util:
Make sure vlan tci mask has exact match for VLAN_CFI.).

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-07 14:23:32 -07:00
Zang MingJie
53d9f3838f ovs-appctl-bashcomp: bash_completion shouldn't modify user environment.
Signed-off-by: Zang MingJie <zealot0630@gmail.com>
Acked-by: Alex Wang <alexw@nicira.com>
2015-06-07 13:23:39 -07:00
Alex Wang
f171fa8876 odp-util: Make sure vlan tci mask has exact match for VLAN_CFI.
OVS datapath has check which prevents the installation of flow
that matches VLAN TCI but does not have exact match for VLAN_CFI
bit.  To follow this rule, ovs userspace must make sure the
flow key for datapath flow matching VLAN TCI has exact match for
VLAN_CFI bit.

Before this commit, this is not enforced, so OpenFlow flow like
"vlan_tci=0x000a/0x0fff,action=output:local" can generate datapath
flow like "vlan(vid=10/0xfff,pcp=0/0x0,cfi=1/0)".

With the OVS datapath check, the installation of such datapath
flow will be rejected with:
"|WARN|system@ovs-system: failed to put[create][modify] (Invalid argument)"

This commit makes ovs userspace always exact match the VLAN_CFI
bit if the flow matches VLAN TCI.

Reported-by: Ronald Lee <ronaldlee@vmware.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
2015-06-07 11:43:34 -07:00
Thomas F. Herbert
d694339457 Add support functions for 8021.ad push and pop vlan.
Changes to allow the tpid to be specified and all vlan tpid checking to be
generalized.

Signed-off-by: Thomas F Herbert <thomasfherbert@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-06-07 11:35:21 -07:00
Sabyasachi Sengupta
3da29e3294 ofproto-dpif: Use xzalloc instead of xmalloc.
Use xzalloc instead of xmalloc for some key structure allocations in
ofproto-dpif (viz. ofproto_dpif, ofport_dpif and rule_dpif) so as to
prevent uninitialized values in these structures.

Signed-off-by: Sabyasachi Sengupta <sabyasachi.sengupta@alcatel-lucent.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-06-05 22:15:27 -07:00
Ben Pfaff
ea0797c929 ofproto-dpif: Avoid creating OpenFlow ports for duplicate tunnels.
Until now, when two tunnels had an identical configuration, both of them
were assigned OpenFlow ports, but only one of those OpenFlow ports was
functional.  With this commit, only one of the two (or more) identically
configured tunnels will be assigned an OpenFlow port number.

Reported-by: Keith Holleman <hollemanietf@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Co-authored-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
2015-06-05 21:18:31 -07:00
Gurucharan Shetty
332eafce79 appveyor: Add a newer ssl link.
The older version is no longer available for download.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Alin Serdean <aserdean@cloudbasesolutions.com>
2015-06-05 14:24:39 -07:00
Alin Serdean
a216c3bd7e Link library updates for appveyor
Add the library iphlpapi to the appveyor.yml build script.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
2015-06-05 13:16:19 -07:00
Mijo Safradin
6e5879655a ovs-vswitchd: Update documentation
Commit 7a6cf343a410d77e05ebd7bf5b5ade52803879ae raised the MAXFD
limit from 7500 to 65535.

Signed-off-by: Mijo Safradin <mijo@linux.vnet.ibm.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2015-06-05 10:03:36 -07:00
Daniele Di Proietto
3bcc10c070 dpif-netdev: Fix non-pmd thread queue id.
Non pmd threads have a core_id == UINT32_MAX, while queue ids used by
netdevs range from 0 to the number of CPUs.  Therefore core ids cannot
be used directly to select a queue.

This commit introduces a simple mapping to fix the problem: pmd threads
continue using queues 0 to N (where N is the number of CPUs in the
system), while non pmd threads use queue N+1.

Fixes: d5c199ea7ff7 ("netdev-dpdk: Properly support non pmd threads.")

Reported-by: 차은호 <eunho.cha@atto-research.com
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Signed-off-by: Mark D. Gray <mark.d.gray@intel.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Flavio Leitner <fbl@redhat.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
2015-06-03 15:34:58 -07:00
YAMAMOTO Takashi
7762f7c39a Update my email address
Signed-off-by: YAMAMOTO Takashi <yamamoto@midokura.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
2015-06-03 15:27:35 +09:00
Andy Zhou
a42023ee8d lib/util.c: style fixes
Covert tabs into spaces. Found by inspection.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2015-06-02 14:08:51 -07:00
Jesse Gross
1734bf29a3 metaflow: Convert hex parsing to use new utility functions.
We now have functions that can do parsing and printing of long hex
strings, so we should use them for meta flow fields to ensure
consistent behavior.

Since these functions can handle infinitely long strings, we can
also increase the maximum field size for MFS_HEXADECIMAL types to
the limit allowed by NXM/OXM. This is useful for future large fields,
such as Geneve options.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
2015-06-01 20:20:56 -07:00
Jarno Rajahalme
1f42be1c66 ofproto: Add support for reverting flow mods and bundle commit.
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-01 18:07:49 -07:00
Jarno Rajahalme
ce59413fb4 ofproto: Split delete_flow*().
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-01 18:07:39 -07:00
Jarno Rajahalme
d99f64d7e0 ofproto: Split modify_flows().
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-01 18:07:39 -07:00
Jarno Rajahalme
c84d869114 ofproto: Split add_flow().
Split add_flow() to add_flow_begin() which does all the error
checking, and add_flow_finish() which can not fail.

Since we still want to send an error response for an unknown
'buffer_id', send_buffered_packet() now send the error response
itself.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-01 18:07:39 -07:00
Jarno Rajahalme
dd27be824c ofproto: Refactor modify_flows__().
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-01 18:07:39 -07:00
Jarno Rajahalme
d51c8b711d ofproto: Use enum ofperr for 'error'.
Clean up error return types and related comments.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-01 18:07:39 -07:00
Jarno Rajahalme
d66713776f ofproto: Factor out ofproto_rule_create().
Makes add_flow() easier to read and understand.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-01 18:07:39 -07:00
Jarno Rajahalme
bc5e6a916a ofproto: Factor out ofproto_rule_insert__().
Pairs well with ofproto_rule_remove__().

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-01 18:07:39 -07:00
Jarno Rajahalme
ff09bc0814 bundles: Manage bundles in connmgr.
This will make implementing bundle commit in ofproto.c easier.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-01 18:07:39 -07:00
Jarno Rajahalme
7ac27a0444 bundles: Validate bundled messages.
OpenFlow bundle messages should be decoded and validated at the time
they are added to the bundle.  This commit does this for flow mod and
port mod messages.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-01 18:07:39 -07:00
Jarno Rajahalme
186120da7f classifier: Support duplicate rules.
OpenFlow 1.4 bundles are easier to implement when it is possible to
mark a rule as 'to_be_removed' and then insert a new, identical rule
with the same priority.

All but one out of the identical rules must be marked as
'to_be_removed', and the one rule that is not 'to_be_removed' must
have been inserted last.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-01 13:25:11 -07:00
Jarno Rajahalme
fc02ecc717 classifier: Add support for invisible flows.
This makes it possible to tentatively add flows to the classifier
without the datapath seeing them.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-01 13:24:09 -07:00
Jarno Rajahalme
7b3dca8906 ofp-util: Fix xid in ofputil_encode_bundle_add().
Bundle add must use the same xid as the embedded message.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-01 13:24:09 -07:00
Jarno Rajahalme
8f12b27a59 ofproto: Eliminate use of unset error code.
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-01 11:27:26 -07:00
Andy Zhou
7e911055e6 ovsdb-monitor: allow multiple of 'ovsdb_monitor_changes' in each ovsdb monitor table
Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-05-29 17:45:15 -07:00
Andy Zhou
1158f32062 ovsdb-monitor: add ovsdb_monitor_changes
Currently, each monitor table contains a single hmap 'changes' to
track updates. This patch introduces a new data structure
'ovsdb_monitor_changes' that stores the updates 'rows' tagged by
its first commit transaction id. Each 'ovsdb_monitor_changes' is
refenece counted allowing multiple jsonrpc_monitors to share them.

The next patch will allow each ovsdb monitor table to store a list
of 'ovsdb_monitor_changes'. This patch stores only one, same as
before.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-05-29 17:45:15 -07:00
Andy Zhou
f1de87bb2f ovsdb-monitor: rename jsonrpc_monitor_compose_table_update()
jsonrpc_monitor_compose_update() seems to fit better than
jsonrpc_monitor_compose_table_update(), since it composes changes
from all tables.  Albeit the original one is named after the
<table-updates> object described in RFC 7047.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-05-29 17:39:50 -07:00
Andy Zhou
59c35e1198 ovsdb-monitor: add transaction ids
With N:1 mappings, multiple jsonrpc server may be servicing the rpc
connection at a different pace. ovsdb-monitor thus needs to maintain
different change sets, depends on connection speed of each rpc
connections. Connections servicing at the same speed can share the
same change set.

Transaction ID is an concept added to describe the change set. One
possible view of the database state is a sequence of changes, more
precisely, commits be applied to it in order, starting from an
initial state, with commit 0. The logic can also be applied to the
jsonrpc monitor; each change it pushes corresponds to commits between
two transaction IDs.

This patch introduces transaction IDs. For ovsdb-monitor, it maintains
n_transactions, starting from 0. Each commit add 1 to the number.
Jsonrpc maintains and 'unflushed' transaction number, corresponding to
the next commit the remote has not seen. jsonrpc's job is simply to
notice there are changes in the ovsdb-monitor that it is interested in,
i.e.  'n_transactions' >= 'unflushed', get the changes in json format,
and push them to the remote site.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-05-29 17:39:50 -07:00
Andy Zhou
d941283758 ovsdb-monitor: stores jsonrpc-monitor in a linked-list
Currently, each ovsdb-monitor points to a single jsonrpc_monitor object.
This means there is 1:1 relationship between them.

In case multiple jsonrpc-monitors need to monitor the same tables and
the columns within them, then can share a single ovsdb-monitor, so the
updates only needs to be maintained once.

This patch, with a few following patches,  will allow for N:1 mapping
between jsonrpc-monitor and ovsdb-monitor.

Maintaining jsonrpc-monitor pointers in a linked-list is essential
in allowing N:1 mapping. The ovsdb-monitor life cycle
is now reference counted. An empty list means zero references.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-05-29 17:39:50 -07:00
Andy Zhou
61b63013e6 ovsdb-monitor: refactoring ovsdb_monitor_get_initial
Refactoring ovsdb_monitor_get_initial() to not generate JSON object.
It only collect changes within the ovsdb_monitor().
ovsdb_jsonrpc_monitor_compose_table_update() is then used to generate
JSON object.

This change will also make future patch easier.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-05-29 17:39:50 -07:00
Andy Zhou
2fa1df7b88 jsonrpc-server: Split out monitor backend functions to monitor.c/h
Added new files monitor.[ch] for monitor backend functions.
There is no functional changes.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-05-29 17:39:50 -07:00
Andy Zhou
88b633082c jsonrpc-server: refactoring ovsdb_monitor_destroy()
Add ovsdb_monitor_destroy() function to properly cleanup ovsdb_monitor.
It is also responsible for unhook from the replica chain.

The replica destroy callback is now called
ovsdb_monitor_destroy_callback()

Minor variable renaming in ovsdb_monitor_create() to make it
more consistent.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-05-29 17:39:50 -07:00
Andy Zhou
51df26a68e jsonrpc-server: rename ovsdb_jsonrpc_monitor_get_initial()
rename ovsdb_jsonrpc_monitor_get_initial() to
ovsdb_monitor_get_initial()

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-05-29 17:39:50 -07:00
Andy Zhou
dbc1cfbb28 jsonrpc-server: refactoring ovsdb_jsonrpc_monitor_needs_flush
split out per monitoring needs_flush() into
ovsdb_monitor_needs_flush().

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-05-29 17:39:50 -07:00
Andy Zhou
92d5d64389 jsonrpc-server: refactoring ovsdb_jsonrpc_monitor_compose_table_update()
Now it simply calls ovsdb_monitor_compose_table_update(), which
actually creates the json object.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-05-29 17:39:50 -07:00
Andy Zhou
ea585a0e24 jsonrpc-server: refactor ovsdb_monitor_add_column()
To hide ovsdb_monitor_table object from ovsdb_jsonrpc serve.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-05-29 17:39:50 -07:00