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

301 Commits

Author SHA1 Message Date
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
2a1c0549a3 openflow: Merge ofp_flow_stats_request and ofp_aggregate_stats_request. 2011-06-14 11:21:50 -07:00
Ben Pfaff
03cd34939e openflow: Remove 'body' member from struct ofp_stats_msg.
This member does not actually help with anything.
2011-06-14 11:21:49 -07:00
Ben Pfaff
28c8bad14f openflow: Merge ofp_stats_request and ofp_stats_reply.
These structures for OpenFlow stats requests and replies have identical
memebers, but until now they have been separate structures.  Since in some
cases we actually want to treat both of them the same way, this has led
to various kinds of awkwardness.  This commit merges them into a new
"struct ofp_stats_msg" and fixes up the users.
2011-06-14 11:21:49 -07:00
Ben Pfaff
d1e9b9bf30 nicira-ext: Renumber NXT_FLOW_MOD_TABLE_ID.
We don't know of anyone using this command in production yet, so it seems
reasonable to give it a new number instead of coping with it having a
conflicting number.
2011-06-10 09:03:22 -07:00
Justin Pettit
6c222e55fa Remove NXAST_DROP_SPOOFED_ARP action.
The NXAST_DROP_SPOOFED_ARP action has been deprecated in favor of
defining flows using the NXM_NX_ARP_SHA flow match for a while.  This
commit removes it.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-06-09 16:19:38 -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
eb6f28db08 ofp-util: Factor wildcard translation out of ofputil_cls_rule_from_match().
This seems like a small cleanup, plus the new function for translating
wildcards will be independently useful in an upcoming commit.
2011-06-01 09:05:39 -07:00
Ben Pfaff
47271d0d8d ofp-util: Simplify logic for computing vlan_tci and vlan_tci_mask.
I believe that this is completely equivalent to, but simpler than, the code
that was here before.
2011-06-01 09:05:36 -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
af6bce18ee ofp-util: Also force nw_tos to be wildcarded for ARP flows.
OVS doesn't fill nw_tos with anything meaningful for ARP flows so we should
also force nw_tos to be wildcarded for ARP.
2011-05-27 15:42:18 -07:00
Ben Pfaff
7fb563b94c ofp-util: Include cookie when encoding OFPT_FLOW_REMOVED messages.
Reported-by: kk yap <yapkke@stanford.edu>
Tested-by: kk yap <yapkke@stanford.edu>
2011-05-20 16:42:40 -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
eeba8e4fd3 Fix up usage of flow_wildcards_t.
The flow_wildcards_t type is defined as a distinct type from sparse's
perspective (with __attribute__((bitwise))) so that we don't accidentally
mix it with only-partially-compatible OFPFW_* flags.  But we were weren't
using it quite right in a few plces.  This fixes it up.
2011-05-16 13:40:48 -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
f1f41fb6b9 ofp-util: Don't warn for different forms of nw_{src,dst} wildcards.
OpenFlow 1.0 uses a 6-bit field to express the number of wildcarded bits
in the nw_src and nw_dst field.  Any value 32 or greater in these fields
(binary 1xxxxx) means that all of the bits are wildcarded.  That means
that there are 32 different ways to express a wildcarded nw_src or nw_dst.
At least two of those seem sensible (100000 and 111111) so we shouldn't
warn about one of them.

This fixes the problem by ORing with 100000 instead of 111111, so that any
already-correct wildcarded mask won't be affected.

This fix allows us to update some tests.

Reviewed-by: Simon Horman <horms@verge.net.au>
2011-05-13 14:45:52 -07:00
Ben Pfaff
e16b024e1b Fix bugs lingering from merge mistakes.
I should have caught these when I did the merge from "master" earlier
today, but I forgot to run the testsuite.
2011-05-12 17:24:34 -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
abe529af47 ofproto: Break apart into generic and hardware-specific parts.
In addition to the changes to ofproto, this commit changes all of the
instances of "struct flow" in the tree so that the "in_port" member is an
OpenFlow port number.  Previously, this member was an OpenFlow port number
in some cases and an ODP port number in other cases.
2011-05-11 12:35:09 -07:00
Ben Pfaff
d93ca2a0fd ofp-util: Fix validation of OFPAT_SET_VLAN_PCP actions.
Found by sparse.
2011-05-04 15:47:27 -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
0721c0739f ofp-util: Properly handle "tun_id"s in tun_id_from_cookie flows.
Just setting the tun_id field isn't enough--it's also necessary to set
the tun_id_mask.  Otherwise the call to cls_rule_zero_wildcarded_fields()
at the end of ofputil_cls_rule_from_match() will zero out the tun_id again.

This was broken by commit 8368c090cab "Implement arbitrary bitwise masks
for tun_id field" back in January.  (This makes me wonder whether we can
drop support for tun_id_from_cookie now.)

Reported-by: Dan Wendlandt <dan@nicira.com>
2011-04-19 11:55:19 -07:00
Ben Pfaff
5160ab34f8 Avoid warnings about comparisons that are always true.
The range of "enum" types varies from one ABI to another.  If the enums
being tested in these functions happen to be 16 bits wide, then GCC may
issue a warning because, in such a case, the comparison is always true.

Using an int instead of a uint16_t avoids that particular problem and
should suppress the warning.

Fixes the following reported warnings:

lib/ofp-print.c:240: warning: comparison is always true due to limited
range of data type
lib/ofp-util.c:1973: warning: comparison is always false due to limited
range of data type

Reported-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
2011-04-18 10:26:17 -07:00
Ethan Jackson
3b6a2571f0 autopath: Create the autopath action.
The newly created autopath action will be the way OpenFlow
interacts with the existing bonding infrastructure.
2011-04-11 15:56:20 -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
b9d5a387b2 ofp-util: Make NXM required for 64-bit cookies in is_nxm_required().
Only NXM supports 64-bit cookies, but this code didn't properly check
for that.  This commit fixes the problem and makes the code much more
explicit about what it is checking.

This will hide bug #4566, but the following commit actually fixes it.
2011-03-01 14:20:52 -08:00
Justin Pettit
685a51a5b8 nicira-ext: Support matching IPv6 Neighbor Discovery messages.
IPv6 uses Neighbor Discovery messages in a similar manner to how IPv4
uses ARP.  This commit adds support for matching deeper into the
payloads of Neighbor Solicitation (NS) and Neighbor Advertisement (NA)
messages.  Currently, the matching fields include:

    - NS and NA Target (nd_target)
    - NS Source Link Layer Address (nd_sll)
    - NA Target Link Layer Address (nd_tll)

When defining IPv6 Neighbor Discovery rules, the Nicira Extensible Match
(NXM) extension to OVS must be used.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2011-02-02 13:22:34 -08:00
Justin Pettit
d31f1109f1 nicira-ext: Support matching IPv6 traffic.
Provides ability to match over IPv6 traffic in the same manner as IPv4.
Currently, the matching fields include:

    - IPv6 source and destination addresses (ipv6_src and ipv6_dst)
    - Traffic Class (nw_tos)
    - Next Header (nw_proto)
    - ICMPv6 Type and Code (icmp_type and icmp_code)
    - TCP and UDP Ports over IPv6 (tp_src and tp_dst)

When defining IPv6 rules, the Nicira Extensible Match (NXM) extension to
OVS must be used.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2011-02-02 12:53:26 -08:00
Justin Pettit
bad68a9965 nicira-ext: Support matching ARP source and target hardware addresses.
OpenFlow 1.0 doesn't allow matching on the ARP source and target
hardware address.  This has caused us to introduce hacks such as the
Drop Spoofed ARP action.  Now that we have extensible match, we can
match on more fields within ARP:

    - Source Hardware Address (arp_sha)
    - Target Hardware Address (arp_tha)

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2011-02-02 12:42:40 -08: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
8368c090ca Implement arbitrary bitwise masks for tun_id field.
This was documented to work, but not implemented.

Requested-by: Pankaj Thakkar <thakkar@nicira.com>
2011-01-20 15:29:00 -08:00
Ben Pfaff
dc4762edd0 Automatically extract error types and codes for formatting. 2011-01-12 13:51:43 -08:00
Ben Pfaff
abcf9134e4 ofp-util: Improve log messages for bad Nicira extension actions.
check_action_exact_len() will always report that a Nicira extension action
has type 65535 (OFPAT_VENDOR), which isn't very helpful for debugging.
This introduces a new function that reports the subtype.

Also, log the subtype of unknown Nicira vendor actions.
2010-12-27 09:45:06 -08:00
Ben Pfaff
f435052921 ofp-util: Upgrade log messages for controller bugs to warning level.
All of these messages indicate that there is a bug in the controller.  We
want to know about that, so increase the log level from debug to warning.
2010-12-27 09:45:06 -08:00
Ben Pfaff
35c4693ab8 ofp-util: Improve log message for bad OpenFlow action length.
First, this is an important message since it indicates a bug in the
controller, so log it at warning level instead of debug level--we want to
know about it.

Second, properly byteswap the action type.

Third, use the correct PRIu16 format specified for a uint16_t.
2010-12-27 09:45:06 -08:00
Ben Pfaff
53ddd40ab5 Implement a new Nicira extension action for multipath link selection. 2010-12-17 14:38:50 -08:00
Ben Pfaff
08717852cd ofp-util: Improve error log messages. 2010-12-15 09:48:18 -08:00
Ben Pfaff
5c47debbf0 ofp-util: Use proper format specifier for uint32_t in ofputil_lookup_openflow_message(). 2010-12-15 09:48:18 -08:00