2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-28 21:07:47 +00:00

142 Commits

Author SHA1 Message Date
Andy Zhou
918f2b8270 openflow-1.1+: OFPT_TABLE_MOD (part 1)
Added infrastructure to support Openflow OFPT_TABLE_MOD message. This patch
does not include the flexible table miss handling code that is necessary to
support the semantics specified in OFPT_TABLE_MOD messages.

Current flow miss behavior continues to conform to Openflow 1.0.  Future
commits to add more flexible table miss support are needed to fully support
OPFT_TABLE_MOD for Openflow-1.1+.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-09-07 11:01:33 -07:00
Neil Zhu
7395c05254 Implement OpenFlow 1.1+ "groups" protocol.
This doesn't include a dpif implementation of groups functionality.  In its
current form, it is untested.

Signed-off-by: Neil Zhu <zhuj@centecnetworks.com>
Co-authored-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Co-authored-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Simon Horman <horms@verge.net.au>
Co-authored-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
2013-09-02 09:23:49 -07:00
Jarno Rajahalme
db0b6c2913 lib: Keep track of usable protocols while parsing.
Keep track of usable protocols while parsing actions and matches,
rather than checking for them afterwards.  This fixes silently discarded
meter and goto table instructions when not explicitly specifying the
protocol to use.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-08-27 21:58:55 -07:00
Ethan Jackson
30618594b6 mac-learning: Stop using tags.
This patch transitions mac learning away from using tags as required
by future patches.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2013-08-02 14:41:23 -07:00
Ethan Jackson
509c014934 mac-learning: Make the mac-learning module thread safe.
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2013-08-01 12:26:08 -07:00
Ben Pfaff
261bd85427 ofp-msgs: Consistently include "STATS" in the names of stats messages.
This is the convention that I've meant to maintain, but missed a number of
messages.  This corrects them.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-07-18 10:59:43 -07:00
Ben Pfaff
10a89ef04d Replace all uses of strerror() by ovs_strerror(), for thread safety.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-28 16:09:38 -07:00
Ethan Jackson
5d9895170f mac-learning: Reference count 'struct mac_learning".
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2013-06-27 18:23:40 -07:00
Ethan Jackson
f9c0c3eccd flow: New function hash_ofp_port() and hash_ofp_port().
These functions are used so often, that having an easy to read
helper is worth it.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2013-06-24 14:15:50 -07:00
Alex Wang
4e022ec09e Create specific types for ofp and odp port
Until now, datapath ports and openflow ports were both represented by
unsigned integers of various sizes. With implicit conversions, etc., it is
easy to mix them up and use one where the other is expected.  This commit
creates two typedefs, ofp_port_t and odp_port_t.  Both of these two types
are marked by "__attribute__((bitwise))" so that sparse can be used to
detect any misuse.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-06-20 10:42:37 -07:00
Alex Wang
63a10d0e09 lib/mac-learning.h: Change one variable's type and name
This commit changes variable "int i" of "union port" of "struct mac_entry"
to "uint16_t ofp_port", since it is used to store the OpenFlow port number.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-16 15:24:55 -07:00
Ben Pfaff
cb22974d77 Replace most uses of assert by ovs_assert.
This is a straight search-and-replace, except that I also removed #include
<assert.h> from each file where there were no assert calls left.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
2013-01-16 16:03:37 -08:00
Jarno Rajahalme
c545d38da7 Openflow 1.1 queue set/get config placeholders.
Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-12-10 10:29:43 -08:00
Jarno Rajahalme
2e1ae2005e Initial OpenFlow 1.3 support
Initial OpenFlow 1.3 support with new include/openflow/openflow-1.3.h.
Most of the messages that differ from 1.2 are implemented. OFPT_SET_ASYNC
is implemented via NX_SET_ASYNC_CONFIG, other new message types are yet to
be implemented. Stats replies that add duration fields are implemented at
encode/decode level only. Test cases for implemented features are included.
Remaining FIXME:s should not cause runtime aborts. Make check comes out
clean.

Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-11-27 09:37:50 -08:00
Ansis Atteka
72e8bf28bb datapath: add skb mark matching and set action
This patch adds support for skb mark matching and set action.

Acked-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: Ansis Atteka <aatteka@nicira.com>
2012-11-21 16:19:30 -08:00
Ben Pfaff
e43928f286 ofp-util: Make ofputil_encode_set_protocol() able to return failure.
Soon, it's not going to be possible to switch between every possible
protocol on an established OpenFlow connection, yet
ofputil_encode_set_protocol() didn't have a documented way to report such
a problem.  This commit adds a means for reporting and makes its callers
able to handle the problem.

Also, initially make ofputil_encode_set_protocol() fail when the current
and requested protocols are for different OpenFlow versions.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Reviewed-by: Simon Horman <horms@verge.net.au>
2012-11-16 09:20:21 -08:00
Jesse Gross
296e07ace0 flow: Extend struct flow to contain tunnel outer header.
Soon the kernel will begin supplying the information about the outer
IP header for tunneled packets and userspace will need to be able to
track it as part of the flow.  For the time being this is only used
internally by OVS and not exposed outwards to OpenFlow.  As a result,
this threads the information throughout userspace but simply stores
the existing tun_id in it.

Signed-off-by: Jesse Gross <jesse@nicira.com>
2012-10-03 10:04:10 -07:00
Ben Pfaff
81a76618be classifier: Break cls_rule 'flow' and 'wc' members into new "struct match".
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-09-04 12:24:27 -07:00
Simon Horman
de0f3156a0 ofp-util: Prepare Packet Out encoder for other Open Flow versions
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-08-08 16:32:18 -07:00
Ben Pfaff
125ee67317 learning-switch: Normalize the flows that are sent to the switch.
This suppresses a long-standing warning from ovs-vswitchd about
non-normalized flows.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-08-07 12:41:59 -07:00
Ben Pfaff
3cbd99318d learning-switch: Don't use exact-match on every field by default.
OVS has all kinds of odd fields, e.g. registers, and it doesn't make sense
to try to match on all of them.  This commit changes learning-switch to
only try to match on the fields defined by OpenFlow 1.0.  That's still not
minimal, but it's more reasonable.

This commit should not have an immediately visible effect since
ovs-controller always sends OF1.0 format flows to the switch, and OF1.0
format flows don't have these extra fields.  But in the future when we
add support for new protocols and flow formats to ovs-controller, it
will make a difference.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-08-07 12:41:59 -07:00
Ben Pfaff
f702893a7c learning-switch: Delay sending handshake until version negotiation is done.
The learning-switch implementation needs to know the OpenFlow version in
use to send the initial handshake messages (e.g. the feature request), but
the version is not always available at the time that the code currently
sends the handshake.  This can cause an assertion failure later when
ofputil_encode_flow_mod() checks the protocol, which will be 0 if the
version wasn't known.

This commit fixes the problem by introducing a state machine that sends the
handshake messages only after version negotiation has finished.

Reported-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-08-07 12:41:58 -07:00
Ben Pfaff
002c3f1734 learning-switch: Make lswitch own its rconn.
Until now, ovs-controller and the learning-switch code split responsibility
for the OpenFlow connection.  This commit moves all the responsibility into
the learning-switch code.

The rationale here is twofold.  First, the split itself seems odd; I think
there must have been a reason for it at one time, but I don't remember it
and don't see one anymore.  Second, I intend to make the lswitch code more
stateful in upcoming commits, and it seems odd to have the lswitch manage
quite a bit of state but not the entity that that state applies to.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-08-07 12:41:58 -07:00
Simon Horman
ee1fb070b2 learning-switch: Send Features Request and Set Config with correct version
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-08-06 22:55:14 -07:00
Ben Pfaff
982697a4d2 ofp-msgs: New approach to encoding and decoding OpenFlow headers.
OpenFlow headers are not as uniform as they could be, with size, alignment,
and numbering changes from one version to another and across varieties
(e.g. ordinary messages vs. "stats" messages).  Until now the Open vSwitch
internal APIs haven't done a good job of abstracting those differences in
header formats.  This commit changes that; from this commit forward very
little code actually needs to understand the header format or numbering.
Instead, it can just encode or decode, or pull or put, the header using
a more abstract API using the ofpraw_, ofptype_, and other APIs in the
new ofp-msgs module.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Tested-by: Simon Horman <horms@verge.net.au>
Reviewed-by: Simon Horman <horms@verge.net.au>
2012-07-30 21:09:12 -07:00
Ben Pfaff
2b07c8b182 ofproto: New feature to notify controllers of flow table changes.
OpenFlow switching monitoring and controller coordination can be made more
efficient if the switch can notify a controller of flow table changes as
they occur, rather than periodically polling for changes.  This commit
implements such a feature.

Feature #6633.
CC: Natasha Gude <natasha@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-07-12 14:18:05 -07:00
Ben Pfaff
f25d0cf3c3 Introduce ofpacts, an abstraction of OpenFlow actions.
OpenFlow actions have always been somewhat awkward to handle.
Moreover, over time we've started creating actions that require more
complicated parsing.  When we maintain those actions internally in
their wire format, we end up parsing them multiple times, whenever
we have to look at the set of actions.

When we add support for OpenFlow 1.1 or later protocols, the situation
will get worse, because these newer protocols support many of the same
actions but with different representations.  It becomes unrealistic to
handle each protocol in its wire format.

This commit adopts a new strategy, by converting OpenFlow actions into
an internal form from the wire format when they are read, and converting
them back to the wire format when flows are dumped.  I believe that this
will be more maintainable over time.

Thanks to Simon Horman and Pravin Shelar for reviews.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-07-03 22:21:11 -07:00
Ben Pfaff
eec25dc1ae openflow-1.0: Rename ofp_match to ofp10_match, OFPFW_* to OFPFW10_*.
This better fits our general policy of adding a version number suffix
to structures and constants whose values differ from one OpenFlow
version to the next.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-06-12 21:19:09 -07:00
Ben Pfaff
44bac24ba5 simap: New data structure for string-to-integer maps.
This commit adapts a couple of existing pieces of code to use the
new data structure.  The following commit will add another user
(which is also the first use of the simap_increas() function).

Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-05-22 10:32:02 -07:00
Justin Pettit
2be393edd3 ofproto: Add support for OF1.3 port description multipart message.
OpenFlow 1.0 is limited to displaying 1364 ports in the Features Reply
message, and there is no other way to get consolidated port information.
OpenFlow 1.3 adds a new port description multipart message
(OFPMP_PORT_DESC) that is not limited by size.  This commit adds support
through the OpenFlow 1.0 stats mechanism, since they have complimentary
enum values.

Bug #11040

Signed-off-by: Justin Pettit <jpettit@nicira.com>
2012-05-08 09:51:43 -07:00
Raju Subramanian
e0edde6fee Global replace of Nicira Networks.
Replaced all instances of Nicira Networks(, Inc) to Nicira, Inc.

Feature #10593
Signed-off-by: Raju Subramanian <rsubramanian@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-05-02 17:08:02 -07:00
Ethan Jackson
acb9da4022 rconn: Simplify rconn_send() semantics.
Before this patch, rconn_send() would delete 'b' on success, and
not on error.  This is confusing and error-prone.  This patch
causes rconn_send() to always delete 'b'.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
2012-04-26 00:44:07 -07:00
Ben Pfaff
9e1fd49b0c Abstract everything that uses ofp_phy_port, add OF1.1 support.
Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-03-07 14:05:11 -08:00
Ben Pfaff
08f94c0e1a openflow: Split OFPAT_* into OFPAT10_* and OFPAT11_*.
An upcoming commit will start referring to OpenFlow 1.1 actions, which are
renumbered relative to OpenFlow 1.0 actions, so this commit prepares by
changing all the existing uses of OFPAT_* to instead use OFPAT10_*.

This commit also introduces the OFPAT11_* constants.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-03-07 14:05:10 -08:00
Ben Pfaff
27527aa09c Introduce ofputil_protocol, to abstract the protocol in use on a connection.
Open vSwitch already handles a few different protocol variations, but it
does so in a nonuniform manner:

  - OpenFlow 1.0 and NXM flow formats are distinguished using the NXFF_*
    constant values from nicira-ext.h.

  - The "flow_mod_table_id" feature setting is maintained in ofproto as
    part of an OpenFlow connection's (ofconn's) state.

There's no way to easily communicate this state among components.  It's
not much of a problem yet, but as more protocol support is added it seems
better to have an abstract, uniform way to represent protocol versions and
variants.  This commit implements that by introducing a new type
"enum ofputil_protocol".  Each ofputil_protocol value represents a variant
of a protocol version.  Each value is a separate bit, so a single enum
can also represent a set of protocols, which is often useful as well.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-03-07 13:59:02 -08:00
Ben Pfaff
a7349929fb Add ability to direct "packet-in"s to particular controllers.
Nicira's controllers are somewhat heterogeneous, so that particular
"packet-in" messages should be directed to particular controllers.  This
new Nicira extension action allows designating a controller or controllers
to receive the "packet-in" using a 16-bit integer ID.

The new NXAST_CONTROLLER action also specifies the "reason" code to include
in the "packet-in" message.  This is particularly useful for simulating a
"no-match" "packet-in" using a rule.

Feature #8946.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-02-27 13:21:44 -08:00
Ben Pfaff
80d5aefd65 ofproto: Implement OpenFlow extension to allow control over async messages.
Until now, the rules that cover the asynchronous messages that Open vSwitch
sends to a controller have been ad hoc.  The new NXT_SET_ASYNC_CONFIG
message provides systematic, precise control.

Feature #7086.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-02-09 14:06:35 -08:00
Ben Pfaff
c6a93eb711 ofp-util: Add struct ofputil_packet_out, helper functions, and use it all.
This makes the ofp-util support for packet_out better match the support
that ofp-util has for other OpenFlow messages.  It also prepares for an
upcoming patch that adds a new piece of code that generates packet_out
messages.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-02-09 13:23:36 -08:00
Ben Pfaff
f27f21341a Add information about time left before timeouts to flow dumps.
The "learn" action is useful for MAC learning, but until now there has been
no way to find out through OpenFlow how much time remains before a MAC
learning entry (a learned flow) expires.  This commit adds that ability.

Feature #7193.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-02-07 15:48:53 -08:00
Ben Pfaff
e764773ccb vswitchd: Make the MAC entry aging time configurable.
NICS-11.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-02-01 15:04:51 -08:00
Ben Pfaff
90bf1e0732 Better abstract OpenFlow error codes.
This commit switches from using the actual protocol values of error codes
internally in Open vSwitch, to using abstract values that are translated to
and from protocol values at message parsing and serialization time.  I
believe that this makes the code easier to read and to write.

This is also one step along the way toward OpenFlow 1.1 support because
OpenFlow 1.1 renumbered a bunch of error codes.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-01-12 15:54:25 -08:00
Ethan Jackson
5483496034 openflow: New Nicira Extended PACKET_IN format.
The new PACKET_IN format implemented in this patch includes flow
metadata such as the cookie, table_id, and registers.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
2012-01-10 14:30:15 -08:00
Pravin B Shelar
abff858b5a datapath: Convert kernel priority actions into match/set.
Following patch adds skb-priority to flow key. So userspace will know
what was priority when packet arrived and we can remove the pop/reset
priority action. It's no longer necessary to have a special action for
pop that is based on the kernel remembering original skb->priority.
Userspace can just emit a set priority action with the original value.

Since the priority field is a match field with just a normal set action,
we can convert it into the new model for actions that are based on
matches.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>

Bug #7715
2011-11-01 10:13:16 -07:00
Ethan Jackson
b53055f4da lib: Whitespace cleanup. 2011-08-12 15:05:41 -07:00
Ben Pfaff
8f93e93c80 ofp-util: Rename OFPUTIL_INVALID to OFPUTIL_MSG_INVALID.
An upcoming commit will introduce new OPFUTIL_* constants for actions.  It
seems best to be able to visually distinguish the contants.  Most of the
existing constants start with a good prefix, but OFPUTIL_INVALID does not,
so rename it.
2011-06-30 10:02:55 -07:00
Ben Pfaff
b05072ee5e learning-switch: Also wildcard VLAN priority bits.
There's no need to learn based on the priority bits so we might as well
wildcard them too.

Reported-by: Justin Pettit <jpettit@nicira.com>
2011-06-06 22:07:37 -07:00
Ben Pfaff
b85145b59f learning-switch: Don't limit message queued by --with-flows.
queue_tx() intentionally limits the number of outstanding OpenFlow messages
queued to the switch.  This was unintentionally being applied to the
messages queued to the switch at startup by ovs-ofctl's --with-flows
command.  This patch should fix the problem, by calling rconn_send()
directly instead of through queue_tx().

Ahmed reported that with this patch there was still a problem when 30,000
flows were specified in the file.

Reported-by: Ahmed Bilal <numan252@gmail.com>
2011-06-01 10:53:53 -07:00
Ben Pfaff
7286b1e13d ovs-controller: Allow --wildcards to specify a wildcard set.
Based on a patch by Jean Tourrilhes <jt@hpl.hp.com>.  According to Jean,
besides increasing flexibility, this reduces  normalization warnings.

Tested-by: Jean Tourrilhes <jt@hpl.hp.com>
2011-06-01 09:09:20 -07:00
Ben Pfaff
0079481775 Merge 'master' into 'next'. 2011-05-12 12:05:42 -07:00
Ben Pfaff
6c1491fbd7 Implement basic multiple table support.
This implements basic multiple table support in ofproto and supporting
libraries and utilities. The design is the same as the one that has been
on the Open vSwitch "wdp" branch for a long time.  There is no support for
multiple tables in the software switch implementation (ofproto-dpif), only
a set of hooks for other switch implementations to use.

To allow controllers to add flows in a particular table, Open vSwitch adds
an OpenFlow 1.0 extension called NXT_FLOW_MOD_TABLE_ID.
2011-05-12 09:58:01 -07:00