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

594 Commits

Author SHA1 Message Date
Ben Pfaff
c6430da5be ofp-print: Print NXST_FLOW replies. 2010-12-09 10:27:08 -08:00
Ben Pfaff
bbc32a883f Use ofpbuf_pull() instead of ofpbuf_try_pull() where it is valid.
In each of these cases, we know that the buffer is long enough to pull
the header because ofputil_decode_msg_type() already checked for us.
2010-12-08 17:11:19 -08:00
Ben Pfaff
2013493bd6 ofp-util: Use ofpbuf_use_const() in a few more places. 2010-12-08 17:11:19 -08:00
Justin Pettit
59edb09ce1 ofp-util: Fix starting offset of OpenFlow error messages. 2010-12-08 16:17:07 -08:00
Justin Pettit
17764fb2ac ofp-util: Fix offset when making Nicira extension error messages. 2010-12-07 21:58:30 -08:00
Ben Pfaff
f9ba8dad04 ofp-util: Fully initialize flow_wildcards in ofputil_cls_rule_from_match().
The new 'zero' member was not being properly initialized.  One approach
would be to add an assignment, but it seems more future-proof to let
flow_wildcards_init_catchall() do the right thing.

Noticed by valgrind.

Acked-by: Jesse Gross <jesse@nicira.com>
2010-12-07 13:44:06 -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
7045a624ea ofp-util: Fix interpretation of NXFW_TUN_ID bit for NXFF_OPENFLOW10.
In NXFF_OPENFLOW10, the tun_id field is always supposed to be wildcarded.
That is what OVS used to do, but commit d8ae4d67 "flow: Fully separate
flow_wildcards from OpenFlow wildcard bits" broke it.
2010-11-24 16:10:53 -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
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
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
0596e89755 flow: Move functions for dealing with wildcard bit counts to ofp-util.
These functions are really OpenFlow-specific, and they will not be used
directly by the flow code soon, so move them to ofp-util.
2010-11-22 10:09:18 -08:00
Ben Pfaff
44381c1b4e ofp-util: Consistently treat OpenFlow xids as network byte order.
The 'xid' in an ofp_header is not interpreted by the receiver but only by
the sender, so it need not be in any particular byte order.  OVS used to
try to take advantage of this to avoid host/network byte order conversions
for this field.  Older code in OVS, therefore, treats xid as being in host
byte order.  However, as time went on, I forgot that I had introduced this
trick, and so newer code treats xid as being in network byte order.

This commit fixes up the situation by consistently treating xid as being
in network byte order.  I think that this will be less surprising and
easier to remember in the future.

This doesn't fix any actual bugs except that some log messages would have
printed xids in the wrong byte order.
2010-11-17 09:21:09 -08:00
Ben Pfaff
72fae17599 ofp-util: Use a counter for transaction IDs instead of a random number.
I don't know of any reason why the transaction id should be random.  Using
consecutive ids means that there is no chance that two messages sent around
the same time will have the same transaction ID, which is probabilitically
possible with random IDs.
2010-11-17 09:21:09 -08:00
Ben Pfaff
96fc46e8fd nicira-ext: New Nicira vendor action NXAST_NOTE.
Our controller group at Nicira has requested a way to annotate flows with
extra information beyond the flow cookie.  The new NXAST_NOTE action
provides such a way.

This new action is somewhat controversial.  Some have suggested that it
should be added another way (either as part of the Nicira Extended Match
or as a new component of the flow_mod and related messages).  Others think
that it has no place in the OpenFlow protocol at all and that an equivalent
should be implemented using the already available features of OVSDB.  So
it is possible that this extension will be deleted and the feature will
be reimplemented some other way (or not at all).

CC: Teemu Koponen <koponen@nicira.com>
CC: Jeremy Stribling <strib@nicira.com>
2010-11-15 09:41:41 -08:00
Ben Pfaff
69b6be193f ofp-util: Add OFP_ACTION_ALIGN macro to header.
It seems that this should really be in openflow.h but so far it isn't.
2010-11-15 09:41:41 -08:00
Ben Pfaff
b6c9e612fa ofproto: Implement support for registers in extended flow match. 2010-11-11 10:41:33 -08:00
Ben Pfaff
f1defbf96d ofp-util: Make validate_actions() take a struct flow *.
The upcoming support for actions on registers will require the flow to
validate actions, so this commit adds the parameter in advance.  It is
not yet used.
2010-11-09 17:08:09 -08:00
Ben Pfaff
ac51afaf4c ofproto: Refactor handle_packet_out().
An upcoming commit will require the flow to be passed in as part of
OpenFlow action validation, but handle_packet_out() has until now been
structured to make this difficult.  This commit refactors it to better
suit this purpose.
2010-11-09 17:08:09 -08:00
Ben Pfaff
3052b0c5e5 ofproto: Refactor handle_flow_mod().
This breaks this OpenFlow handler into two parts, one responsible
for parsing and constructing OpenFlow messages and one that works
with the flow table.  The latter will be reused in a later commit
that implements the Nicira Extended Match flexible flow match
extension.
2010-11-08 10:43:19 -08:00
Ben Pfaff
0bd0c6606a ofp-util: New functions make_nxmsg(), make_nxmsg_xid().
These functions slightly simplify constructing Nicira vendor extension
messages.
2010-11-05 09:25:38 -07:00
Ben Pfaff
217f48c61b ofp-util: Use our usual variable naming convention in make_ofp_error_msg(). 2010-11-05 09:25:37 -07:00
Ben Pfaff
3a75cda939 ofp-util: Actually map vendor codes to IDs correctly.
Reported-by: Justin Pettit <jpettit@nicira.com>
2010-11-05 09:25:37 -07:00
Ben Pfaff
26c112c241 ofp-util: Add infrastructure for vendor extensions to OpenFlow error codes.
Cross-ported from "wdp" branch.
2010-11-05 09:25:37 -07:00
Ben Pfaff
d98e600755 vlog: Make client supply semicolon for VLOG_DEFINE_THIS_MODULE.
It's kind of odd for VLOG_DEFINE_THIS_MODULE to supply its own semicolon,
so this commit switches to the more common form.
2010-10-29 09:48:47 -07:00
Ben Pfaff
10a24935c9 xtoxll: Rename "byte-order" since it now include more than xtoxll.
Suggested-by: Justin Pettit <jpettit@nicira.com>
2010-10-29 09:48:47 -07:00
Jean Tourrilhes
371e4acc87 ofp-util: Fix normalization of IP TOS bits.
If the packet is not IP, you probably want to also wildcard the ToS.
2010-10-28 09:56:52 -07:00
Ben Pfaff
27bcf966b4 datapath: Simplify ODPAT_SET_DL_TCI action.
There's no need to have a mask in this action, because both parts of the
TCI are part of the flow structure.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2010-10-18 11:18:23 -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
Ben Pfaff
3dffcf0701 ofproto: Avoid wasting memory malloc()'ing empty action sets for subrules.
GNU libc treats malloc(0) as malloc(1).  Subrules always have an n_actions
of 0, so this code was wasting time and memory for subrules.  This commit
stops doing that.

Also audits and fixes some very pedantic potential problems with null
pointers; e.g. the C standard says that NULL may not be compared with the
< operator, even if both arguments are null, and it also says that a null
pointer may not be passed to memcpy() or memcmp(), even if the length is
zero.
2010-10-06 14:21:47 -07:00
Justin Pettit
eedc0097f4 Add Nicira extension for modifying queue without transmitting
The OpenFlow OFPAT_ENQUEUE action sets a queue id and outputs the packet
in one shot.  There are times in which the queue should be set, but the
output port is not yet known.  This commit adds the NXAST_SET_QUEUE and
NXAST_POP_QUEUE Nicira extension actions to modify the queue
configuration without requiring a port argument.

CC: Jeremy Stribling <strib@nicira.com>
CC: Keith Amidon <keith@nicira.com>
2010-10-02 18:36:10 -07:00
Ben Pfaff
92467099ee ofp-util: Also accept NXAST_DROP_SPOOFED_ARP.
Reported-by: Bryan Fulton <bryan@nicira.com>
Reported-by: Michael Mao <mmao@nicira.com>
Bug #3655.
2010-09-15 13:26:15 -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
Ben Pfaff
5136ce492c vlog: Introduce VLOG_DEFINE_THIS_MODULE for declaring vlog module in use.
Adding a macro to define the vlog module in use adds a level of
indirection, which makes it easier to change how the vlog module must be
defined.  A followup commit needs to do that, so getting these widespread
changes out of the way first should make that commit easier to review.
2010-07-21 15:47:09 -07:00
Ben Pfaff
81f3cad4d3 learning-switch: Break packet-in processing into two steps. 2010-07-20 11:10:45 -07:00
Ben Pfaff
3f09c339f7 ofproto: Log changes made by flow normalization.
Open vSwitch has always "normalized" flows, that is, zeroed out fields that
are wildcarded or that otherwise cannot affect whether a packet actually
matches the flow.  But until now it has done so silently, which prevents
the authors of controllers from learning what is happening and makes it
less likely that they will update code on their end.  This commit makes
OVS log when normalization changes a flow.

Suggested by partner.
2010-06-28 11:27:02 -07:00
Ben Pfaff
4d326addd3 ofp-util: Also normalize nw_tos in normalize_match().
The OpenFlow reference implementation was sensibly normalizing these
fields but OVS did not.  This change should make OVS resemble the OpenFlow
reference implementation at least in this respect.

For more information:
https://mailman.stanford.edu/pipermail/openflow-spec/2010-June/001040.html

Reported-by: Takayuki HAMA <t-hama@cb.jp.nec.com>
2010-06-22 12:47:03 -07:00
Ben Pfaff
c1c9c9c4b6 Implement QoS framework.
ovs-vswitchd doesn't declare its QoS capabilities in the database yet,
so the controller has to know what they are.  We can add that later.

The linux-htb QoS class has been tested to the extent that I can see that
it sets up the queues I expect when I run "tc qdisc show" and "tc class
show".  I haven't tested that the effects on flows are what we expect them
to be.  I am sure that there will be problems in that area that we will
have to fix.
2010-06-17 15:04:12 -07:00
Ben Pfaff
fa37b408ea vconn: Move OpenFlow utility functions into new file ofp-util.c.
The main purpose of the vconn code is to ship OpenFlow messages across
network connections.  Over time a large number of utility functions related
to OpenFlow messages have also crept into vconn.c, but that's really
logically separate.  This commit breaks those functions out into a new
file.
2010-06-17 10:30:18 -07:00