2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-28 12:58:00 +00:00

38 Commits

Author SHA1 Message Date
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
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
b9298d3f82 Expand tunnel IDs from 32 to 64 bits.
We have a need to identify tunnels with keys longer than 32 bits.  This
commit adds basic datapath and OpenFlow support for such keys.  It doesn't
actually add any tunnel protocols that support 64-bit keys, so this is not
very useful yet.

The 'arg' member of struct odp_msg had to be expanded to 64-bits also,
because it sometimes contains a tunnel ID.  This member also contains the
argument passed to ODPAT_CONTROLLER, so I expanded that action's argument
to 64 bits also so that it can use the full width of the expanded 'arg'.
Userspace doesn't take advantage of the new space though (it was only
using 16 bits anyhow).

This commit has been tested only to the extent that it doesn't disrupt
basic Open vSwitch operation.  I have not tested it with tunnel traffic.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Feature #3976.
2010-12-10 11:14:13 -08:00
Ben Pfaff
07b37e8f98 classifier: Implement better classifier rule formatting.
The old formatting was only good enough for debugging, but now we need to
be able to format cls_rules as part of ofp-print.c.  This new code is
modeled after ofp_match_to_string().
2010-12-07 12:45:26 -08:00
Ben Pfaff
772ec52b89 util: Introduce ASSIGN_CONTAINER to make iteration macros easier to read. 2010-12-06 09:59:30 -08:00
Ben Pfaff
87542e21fa classifier: New cls_rule functions for setting registers and tun_id. 2010-12-03 10:30:11 -08:00
Ben Pfaff
66642cb40b nx-match: Implement support for arbitrary VLAN TCI masks.
Since the Nicira Extended Match was specified nicira-ext.h has claimed that
arbitrary masks are allowed, but in fact only certain masks were actually
implemented.  This commit implements general masking for the 802.1Q VLAN
TCI field.
2010-11-23 10:06:28 -08:00
Ben Pfaff
d8ae4d6726 flow: Fully separate flow_wildcards from OpenFlow wildcard bits.
Originally, wildcards were just the OpenFlow OFPFW_* bits.  Then, when
OpenFlow added CIDR masks for IP addresses, struct flow_wildcards was born
with additional members for those masks, derived from the wildcard bits.
Then, when OVS added support for tunnels, we added another bit
NXFW_TUN_ID that coexisted with the OFPFW_*.  Later we added even more bits
that do not appear in the OpenFlow 1.0 match structure at all.  This had
become really confusing, and the difficulties were especially visible in
the long list of invariants in comments on struct flow_wildcards.

This commit cleanly separates the OpenFlow 1.0 wildcard bits from the
bits used inside Open vSwitch, by defining a new set of bits that are
used only internally to Open vSwitch and converting to and from those
wildcard bits at the point where data comes off or goes onto the wire.
It also moves those functions into ofp-util.[ch] since they are only for
dealing with OpenFlow wire protocol now.
2010-11-22 10:11:40 -08:00
Ben Pfaff
844dff325b flow: Remove flow_to/from_match() in favor of cls_rule_to/from_match().
The flow_from_match() and flow_to_match() functions have to deal with most
of the state in a cls_rule anyhow, and this will increase in upcoming
commits, to the point that we might as well just use a cls_rule anyhow.
This commit therefore deletes flow_from_match() and flow_to_match(),
integrating their code into cls_rule_from_match() and the new function
cls_rule_to_match(), respectively.  It also changes each of the functions'
callers to use the new cls_rule_*() function.
2010-11-22 10:10:14 -08:00
Ben Pfaff
193eb87453 classifier: New function cls_rule_equal(). 2010-11-22 09:40:34 -08:00
Ben Pfaff
f6acdb447e classifier: Remove classifier_for_each(), classifier_for_each_match().
These functions no longer have any users.
2010-11-15 15:10:03 -08:00
Ben Pfaff
5ecc9d8156 classifier: Add functions and macros for iteration, and use them in ofproto.
This is much more convenient in practice than being forced to use a
callback function.
2010-11-15 15:09:00 -08:00
Ben Pfaff
cd10ed7fb4 classifier: Delete dead code specialized for the exact table.
These functions and macros are no longer used.
2010-11-12 14:50:45 -08:00
Ben Pfaff
3c4486a5f7 classifier: Drop CLS_INC_* enumerations and related 'include' parameters.
This type and these parameters were useful when ofproto had the need to
separately traverse exact-match rules looking for subrules, but it no
longer does that because subrules (now called "facets") are not kept in
the classifier any longer.  All the callers are now passing CLS_INC_ALL
anyhow, so we might as well delete this feature and simplify the code.
2010-11-12 14:50:44 -08:00
Ben Pfaff
b63f2ea794 flow: Better abstract flow_wildcards and use it more widely. 2010-11-08 10:43:32 -08:00
Ben Pfaff
81c9dad242 classifier: Add more cls_rule_set_*() functions.
These will be handy later but are not used yet.
2010-11-08 10:43:32 -08:00
Ben Pfaff
64420dfac5 classifier: Move in-band set_<field>() functions publicly available.
These will be useful elsewhere later.
2010-11-08 10:43:31 -08:00
Ben Pfaff
cf3fad8a1b ofproto: Change ofproto_add_flow(), ofproto_delete_flow() to take cls_rule.
This is a small cleanup that will make later changes to wildcards easier.
2010-11-08 10:43:31 -08:00
Ben Pfaff
52ce26ee3b Rename cls_rule_zero_wildcards() to cls_rule_zero_wildcarded_fields().
Justin said that he found the shorter name confusing.
2010-11-08 10:36:26 -08:00
Ben Pfaff
f9bfea1402 ofproto: Generalize tun_id_from_cookie into flow_format.
Upcoming commits will add more flow formats, so this needs to be
an enumerated type instead of a bool.
2010-11-05 11:10:35 -07:00
Ben Pfaff
b5d97350cd classifier: Rewrite.
The old classifier was not adaptive: it required knowing the structure of
the flows that were likely to be in use to get good performance.  It is
likely that it degenerated to linear search in any real-world case.

This new classifier is adaptive and should perform better in the real
world.
2010-11-03 11:12:54 -07:00
Ben Pfaff
faa50f408b classifier: Change classifier_rule_overlaps() to take a cls_rule *.
There's no benefit to spelling out all of the components of a cls_rule
separately.  Just use cls_rule itself.
2010-10-29 09:53:51 -07:00
Ben Pfaff
76ecc72179 classifier: Change classifier_find_rule_exactly() to take a cls_rule *.
There's no benefit to spelling out all of the components of a cls_rule
separately.  Just use cls_rule itself.
2010-10-29 09:53:51 -07:00
Ben Pfaff
48c3de13be classifier: Merge classifier_lookup_wild(), classifier_lookup_exact().
Merge these functions into classifier_lookup() and update its interface.

The new version of the classifier soon to be implemented naturally merges
these functions, so this commit updates the interface early.
2010-10-29 09:53:51 -07:00
Ben Pfaff
e65dc5c57e classifier: Remove unused functions cls_rule_moved(), cls_rule_replace().
In preparation for rewriting the classifier, remove some functions that
nothing uses and have no tests.
2010-10-29 09:53:51 -07:00
Ben Pfaff
ae412e7dd8 flow: Get rid of flow_t typedef.
When userspace and the kernel were using the same structure for flows,
flow_t was a useful way to indicate that a structure was really a userspace
flow instead of a kernel one, but now it's better to just write "struct
flow" for consistency, since OVS doesn't use typedefs for structs
elsewhere.

Acked-by: Jesse Gross <jesse@nicira.com>
2010-10-11 13:31:43 -07:00
Justin Pettit
5db39d100c classifier: Add missing argument in CLASSIFIER_FOR_EACH_EXACT_RULE_SAFE
The CLASSIFIER_FOR_EACH_EXACT_RULE_SAFE macro was missing its "MEMBER"
argument.  It doesn't currently cause any problems because no one uses
the macro.
2010-10-08 11:19:02 -07:00
Ben Pfaff
35950f0cfa classifier: Introduce macros for iterating exact-match flows.
This special case of iterating through flows is easier and presumably
faster to implement using a macro.
2010-10-07 10:36:02 -07:00
Joe Perches
d295e8e97a treewide: Remove trailing whitespace
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Jesse Gross <jesse@nicira.com>
2010-08-30 13:23:08 -07:00
Jesse Gross
659586efcf tunneling: Add support for tunnel ID.
Add a tun_id field which contains the ID of the encapsulating tunnel
on which a packet was received (0 if not received on a tunnel).  Also
add an action which allows the tunnel ID to be set for outgoing
packets.  At this point there aren't any tunnel implementations so
these fields don't have any effect.

The matching is exposed to OpenFlow by overloading the high 32 bits
of the cookie as the tunnel ID.  ovs-ofctl is capable of turning
on this special behavior using a new "tun-cookie" command but this
command is intentially undocumented to avoid it being used without
a full understanding of the consequences.
2010-04-19 09:11:51 -04:00
Ben Pfaff
02dd3123a0 Merge "master" into "next". 2010-02-24 13:47:09 -08:00
Justin Pettit
834377ea55 ofproto: Match on IP ToS/DSCP bits (OpenFlow 1.0)
OpenFlow 1.0 adds support for matching on IP ToS/DSCP bits.

NOTE: OVS at this point is not wire-compatible with OpenFlow 1.0 until
the final commit in this OpenFlow 1.0 set.
2010-02-20 02:22:28 -08:00
Justin Pettit
49bdc010df ofproto: Check overlap, emerg flow cache, and error code sync (OpenFlow 0.9)
This commit adds (some) support for a couple new OpenFlow 0.9 features:

    - The OFPFF_CHECK_OVERLAP flag in Flow Mod messages allows the
      controller to prevent flows that would conflict at the same
      priority.

    - An emergency flow cache that contains a small flow table that is
      used if the switch loses connectivity with the controller.  I
      believe the design has fundamental flaws and looks likely to be
      retired.  If a controller attempts to add a flow to the emergency
      flow cache, OVS always responds that the tables are full.

The OpenFlow 0.9 error codes are also sync'd in the commit.

NOTE: OVS at this point is not wire-compatible with OpenFlow 0.9 until the
final commit in this OpenFlow 0.9 set.
2010-02-20 02:22:27 -08:00
Justin Pettit
959a2ecdc8 ofproto: Match VLAN PCP and rewrite ToS bits (OpenFlow 0.9)
Starting in OpenFlow 0.9, it is possible to match on the VLAN PCP
(priority) field and rewrite the IP ToS/DSCP bits.  This check-in
provides that support and bumps the wire protocol number to 0x98.

NOTE: The wire changes come together over the set of OpenFlow 0.9 commits,
so OVS will not be OpenFlow-compatible with any official release between
this commit and the one that completes the set.
2010-02-20 02:22:26 -08:00
Ben Pfaff
68d1c8c3c3 classifier: New function cls_rule_to_string().
This may be useful for debugging.

From Jean Tourrilhes <jt@hpl.hp.com>.
2010-02-12 13:55:47 -08:00
Ben Pfaff
318e2e6d60 classifier: Improve comments. 2009-11-24 09:59:54 -08:00
Ben Pfaff
a14bc59fb8 Update primary code license to Apache 2.0. 2009-06-15 15:11:30 -07:00
Ben Pfaff
064af42167 Import from old repository commit 61ef2b42a9c4ba8e1600f15bb0236765edc2ad45. 2009-07-08 13:19:16 -07:00