2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-29 13:27:59 +00:00

117 Commits

Author SHA1 Message Date
Ben Pfaff
e23ae58527 ofp-util: Further abstract definitions of action properties.
This commit primarily moves the OFPAT_ACTION and NXAST_ACTION invocations
into a new file ofp-util.def.  This allows multiple places in the source to
use them.

This commit also adds a new function ofputil_action_code_from_name().
The following commit will add the first user.
2011-09-13 11:46:08 -07:00
Ben Pfaff
39dc90822e ofp-util: New functions for parsing and formatting OpenFlow port numbers.
These functions were previously used only in ofp-parse.c and ofp-print.c,
but they are more generally useful and future commits will add more users.
2011-09-13 11:46:08 -07:00
Ethan Jackson
f694937d4e nicra-ext: New action NXAST_OUTPUT_REG.
The NXAST_OUTPUT_REG action outputs to the OpenFlow port contained
in a supplied NXM field.
2011-08-12 15:06:53 -07:00
Ben Pfaff
81d1ea9414 ofp-util: Rename struct flow_stats_request with ofputil_ prefix.
Most of the structs in ofp-util.h have the ofputil_ prefix.  Rename this
one for consistency.
2011-08-09 13:53:21 -07:00
Ben Pfaff
a9a2da3894 ofp-util: Rename struct flow_mod to struct ofputil_flow_mod.
Most of the structs in ofp-util.h have the ofputil_ prefix.  Rename this
one for consistency.
2011-08-09 13:53:21 -07:00
Ben Pfaff
299016266e New action NXAST_RESUBMIT_TABLE.
This makes multiple table support in ofproto-dpif useful, by allowing
resubmits into tables other than 0.
2011-08-09 09:24:18 -07:00
Casey Barker
43d1478b16 lib: Adapt headers for use in C++.
This commit makes several library headers suitable for inclusion in C++.

It adds [extern "C"] guards and makes minor changes to fix casting and
keyword issues.
2011-08-04 16:20:04 -07:00
Ethan Jackson
a368bb53d9 bundle: New action "bundle_load".
The bundle_load action behaves the same as the bundle action,
except instead of outputting, it writes its result to a register.
2011-07-22 17:46:48 -07:00
Ethan Jackson
daff3353a0 vswitch: Implement bundle action.
This patch creates a new action called "bundle".  Bundles are a way
to implement a simple form of multipath in OpenFlow by grouping
several ports in a single output-like action.
2011-07-19 11:34:26 -07:00
Ethan Jackson
774101397b ofputil: Export ofputil_check_output_port().
Future patches will use this function outside of the ofputil
module.
2011-07-19 11:34:26 -07:00
Ben Pfaff
38f2e36072 ofp-util: Centralize decoding of OpenFlow actions.
This significantly simplifies code in ofp-print and ofproto-dpif and is
likely to simplify any new ofproto implementations whose support for
actions differs from ofproto-dpif.
2011-06-30 10:05:52 -07:00
Ben Pfaff
b4b8c7812b ofp-util: Simplify iteration through OpenFlow actions.
The existing actions_first() and actions_next() iterator functions are not
much like the other iteration constructs found throughout the Open vSwitch
tree.  Also, they only work with actions that have already been validated,
so there are cases where they cannot be used.

This commit adds new macros for iterating through OpenFlow actions, one
for actions that have been validated and one for actions that have not, and
adapts the existing users.  The following commit will further refine action
parsing and add more users.
2011-06-30 10:04:09 -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
5e9d0469fc Define UINT64_MAX as "unknown" in Open vSwitch specific interfaces.
Some hardware supports reporting packet or byte counters but not both, so
OVS has to be prepared for that.

Suggested-by: Justin Pettit <jpettit@nicira.com>
2011-06-14 11:21:52 -07:00
Ben Pfaff
18ddadc2e9 ofp-util: New functions ofputil_actions_equal(), ofputil_actions_clone().
I found that introducing these helper functions provided a very modest
increase in readability.
2011-06-14 11:21:51 -07:00
Ben Pfaff
349adfb29c ofproto: Better abstract flow stats encoding. 2011-06-14 11:21:50 -07:00
Ben Pfaff
76c93b2274 ofproto: Better abstract aggregate stats encoding and decoding. 2011-06-14 11:21:50 -07:00
Ben Pfaff
63f2140a55 openflow: Make stats replies more like other OpenFlow messages. 2011-06-14 11:21:50 -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
b459a924d0 ofp-util: Export (again) a generalized function for normalizing rules.
Feature #5029 requests that "ovs-ofctl add-flow" report an attempt to add
a flow that is not properly normalized, that is, a flow to which the switch
will add extra wildcards, ignoring some fields specified by the user.  This
requires that ofp-util make flow normalization directly available (again).

Until now, flow normalization has only been applied to OpenFlow 1.0 flows,
but the concept applies equally to NXM, so this commit generalizes the
implementation to NXM also.
2011-05-27 15:42:19 -07:00
Ben Pfaff
b2fda3effc Merge 'next' into 'master'.
I know already that this breaks the statsfixes that were implemented by the
following commits:

827ab71c97f "ofproto: Datapath statistics accounted twice."
6f1435fc8f7 "ofproto: Resubmit statistics improperly account during..."

These were already broken in a previous merge.  I will work on a fix.
2011-05-18 14:01:13 -07:00
Ben Pfaff
dbba996be2 Convert remaining network-byte-order "uint<N>_t"s into "ovs_be<N>"s.
I looked at almost every uint<N>_t in the tree to determine whether it was
really in network byte order, and converted the ones that were.

The only remaining ones, modulo my mistakes, are in openflow.h.  I'm not
sure whether we should convert those, because there might be some value
in remaining close to upstream for this header.
2011-05-16 13:40:47 -07:00
Ben Pfaff
118c46769f ofproto: Maintain ofp_phy_port for each ofport in network byte order.
It's rather confusing to have an instance of a whole structure in an
unexpected byte order.  This commit gets rid of that oddity.
2011-05-16 13:40:47 -07:00
Ben Pfaff
1c0b7503af ofp-util: Revise OpenFlow 1.0 ofp_match normalization.
For a long time, Open vSwitch has "normalized" OpenFlow 1.0 flows in a
funny way: it tries to change fields that are wildcarded into fields
that are exact-match.  For example, the normalize_match() function
knows that if dl_type is wildcarded, then all of the L3 and L4 fields
will always be extracted as 0, so it sets those fields to exact-match
and their values to 0.

The reason for this was originally that exact-match flows were much
cheaper for Open vSwitch to implement, because they could be implemented
with a hash table, whereas other kinds of flows had to be implemented
with an expensive linear search.  But these days Open vSwitch has a
smarter classifier in which wildcarded flows have minimal cost.  Also,
it is no longer possible for OpenFlow 1.0 to specify truly exact-match
flows, because Open vSwitch supports fields for which OpenFlow 1.0
cannot specify values and therefore will always be wildcarded.

Now, it no longer makes sense to do this transformation, so this commit
removes it.  Presumably, this will be less surprising for users.

Reviewed-by: Simon Horman <horms@verge.net.au>
2011-05-13 14:45:52 -07:00
Ben Pfaff
34276a5790 ofp-util: Simplify OpenFlow 1.0 ofp_match normalization.
The normalize_match() function does more work than really needed.  It goes
to some trouble to zero out fields that are wildcarded.  This is not
necessary, because cls_rule_from_match() will take care of it later.

Also make normalize_match() private to ofp-util.c, since it has no other
users now and I don't expect more later.

Reviewed-by: Simon Horman <horms@verge.net.au>
2011-05-13 14:45:52 -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
Ben Pfaff
2c360fbb27 Convert remaining network-byte-order "uint<N>_t"s into "ovs_be<N>"s.
I looked at almost every uint<N>_t in the tree to determine whether it was
really in network byte order, and converted the ones that were.

The only remaining ones, modulo my mistakes, are in openflow.h.  I'm not
sure whether we should convert those, because there might be some value
in remaining close to upstream for this header.
2011-05-04 10:12:05 -07:00
Ben Pfaff
9cfcdadf93 ofproto: Maintain ofp_phy_port for each ofport in network byte order.
It's rather confusing to have an instance of a whole structure in an
unexpected byte order.  This commit gets rid of that oddity.
2011-05-04 10:12:05 -07:00
Ben Pfaff
b78f6b77bc Remove support for obsolete "tun_id_from_cookie" extension.
The "tun_id_from_cookie" OpenFlow extension predated NXM and supports only
a fraction of its features.  Nothing (at Nicira, anyway) uses it any
longer.  Support for it had been broken since January and it took until a
few days ago for anyone to complain, so it cannot be too important.  This
commit removes it.
2011-04-26 09:42:18 -07:00
Ben Pfaff
a6159a233e ofp-util: Remove flow_stats_iterator, flows_stats_first(), flow_stats_next()
Nothing uses these anymore.  ofputil_decode_flow_stats_reply() is a better
alternative.
2011-03-30 11:33:18 -07:00
Ben Pfaff
4093ec5979 ofproto: Move hton_ofp_phy_port() to ofp-util.
This removes some code from ofproto.c that doesn't really seem to
belong there to begin with.
2011-03-29 12:28:10 -07:00
Ben Pfaff
ebb57021a9 ofproto: Break packet_in encoding out of ofproto into ofp-util.
This removes some code from ofproto.c.
2011-03-29 12:28:10 -07:00
Ben Pfaff
588cd7b5d2 ofproto: Factor building of flow_removed messages out into ofp-util.
This removes some code from ofproto.c.
2011-03-29 12:28:10 -07:00
Ben Pfaff
9b45d7f5db ofproto: Get rid of archaic "switch status" OpenFlow extension.
Back in 2008 or so, I introduced this extension as a way to provide
information about switch status to the new "switch UI" program.  Since
then, the switch UI program has been removed and the important information
that was provided by the switch status extension is now available in the
database, so we might as well get rid of this extension, and that is what
this commit does.
2011-03-16 14:57:56 -07:00
Ben Pfaff
4ffd1b437c ofp-util: New function ofputil_decode_flow_stats_reply().
This function will see more use later in this series.  This commit just
starts using it to make ofp-print output entirely consistent for
OFPST_FLOW and NXST_FLOW replies.
2011-03-16 14:53:16 -07:00
Ben Pfaff
36956a7d33 datapath: Convert odp_flow_key to use Netlink attributes instead.
One of the goals for Open vSwitch is to decouple kernel and userspace
software, so that either one can be upgraded or rolled back independent of
the other.  To do this in full generality, it must be possible to change
the kernel's idea of the flow key separately from the userspace version.
In turn, that means that flow keys must become variable-length.  This
commit makes that change using Netlink attribute sequences.

This commit does not actually make userspace flexible enough to handle
changes in the kernel flow key structure, because userspace doesn't yet
have enough information to do that intelligently.  Upcoming commits will
fix that.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-01-27 21:08:35 -08:00
Ben Pfaff
dc4762edd0 Automatically extract error types and codes for formatting. 2011-01-12 13:51:43 -08:00
Ben Pfaff
ff9d38264c ofp-util: Make ofputil_cls_rule_to_match() help with flow cookies too.
This fixes OpenFlow 1.0 flow stats reporting of flows added via NXM.

I noticed this problem while implementing 64-bit tunnel IDs, hence the
positioning.  The following commit adds a test.

Acked-by: Jesse Gross <jesse@nicira.com>
2010-12-10 11:14:13 -08:00
Ben Pfaff
9aee07644c ofp-util: Group everything related to actions together in header file.
Cleanup.
2010-12-09 10:41:33 -08:00
Ben Pfaff
9b045a0c66 ofp-print: Print OFPUTIL_NXT_FLOW_REMOVED. 2010-12-09 10:31:49 -08:00
Ben Pfaff
8d7fb7eef5 ofp-util: Fix byte order of ofputil_cls_rule_from_match() parameter.
This doesn't change any generated code so it is not a bug fix, but it
makes the byte order of the 'cookie' argument clear.
2010-12-09 10:27:08 -08:00
Ben Pfaff
c6430da5be ofp-print: Print NXST_FLOW replies. 2010-12-09 10:27:08 -08:00
Ben Pfaff
88ca35eed0 ovs-ofctl: Add NXM support. 2010-12-07 13:32:01 -08:00
Ben Pfaff
7fa9111326 ofp-print: Implement printing for OFPUTIL_NXT_FLOW_MOD. 2010-12-07 13:22:46 -08:00
Ben Pfaff
2e4f5fcf3f ofp-util: New abstractions for flow_mod, flow_stats_request.
These will be useful for adding Nicira Extended Match support to ovs-ofctl.

This commit makes ofproto use the new flow_mod abstraction, but not the
new flow and aggregate stats abstraction.  The latter takes a bit more
infrastructure that I haven't finished yet.
2010-12-07 12:45:24 -08:00
Ben Pfaff
dfdfc8d43d ofp-util: New functions for creating Nicira extension messages. 2010-12-06 10:24:56 -08:00
Ben Pfaff
d1e2cf2119 Refactor and centralize basic OpenFlow message decoding and validation.
Open vSwitch contains a few different chunks of code that need to decode
an OpenFlow message to determine its type and then validate that it is
long enough.  Until now, the code for doing this has been more or less
scattered across the tree.  Whenever a new piece of code needed to do this,
it generally needed to reimplement at least part of it.

This commit centralizes all of that work into a single function,
ofputil_decode_msg_type(), and helper functions, and converts all of the
code that was decoding messages by hand to use the new function.
2010-12-06 10:20:20 -08:00
Ben Pfaff
492f75720e nicira-ext: Name the enum used for flow formats, to clarify code. 2010-12-03 10:30:11 -08:00
Ben Pfaff
daa68e9f29 ofp-util: Make make_flow_mod() take cls_rule instead of struct flow.
This reduces code duplication, by eliminating a function that translates
from "struct flow" to "struct ofp_match" in favor of the existing function
ofputil_cls_rule_to_match().  It also allows the caller to specify the
desired priority (as part of the cls_rule).
2010-11-22 10:11:41 -08:00