summaryrefslogtreecommitdiff
path: root/lib/ofp-util.h
Commit message (Collapse)AuthorAgeFilesLines
* ofp-util: Fix typo in comment.Ben Pfaff2012-03-151-1/+1
| | | | | | The ofp_packet_in reasons are OFPR_*, not OFPRR_*. (Duh.) Signed-off-by: Ben Pfaff <blp@nicira.com>
* Abstract everything that uses ofp_phy_port, add OF1.1 support.Ben Pfaff2012-03-071-3/+140
| | | | | Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
* openflow: Split OFPAT_* into OFPAT10_* and OFPAT11_*.Ben Pfaff2012-03-071-16/+16
| | | | | | | | | | | 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>
* netdev: Abstract "features" interface away from OpenFlow 1.0.Ben Pfaff2012-03-071-0/+5
| | | | | | | | | | | netdev_get_features() and other functions have always used OpenFlow 1.0 "enum ofp_port_features" bits as part of their interface. This commit switches over to using an internally defined interface that is not tied directly to any OpenFlow version, making evolution of each side of the interface easier in the future. Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
* ofp-util: Add functions for working with OpenFlow 1.1 port numbers.Ben Pfaff2012-03-071-0/+3
| | | | | | | | | | | | | OpenFlow 1.1 extends port numbers to 32 bits. Initially we plan to support only port numbers in the 16-bit range in Open vSwitch. However the OF1.1 reserved ports have high-valued fixed numbers that require translation to high fixed values in the 16-bit range for OF1.0. These new functions provide this translation. Nothing uses these functions yet. Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
* Introduce ofputil_protocol, to abstract the protocol in use on a connection.Ben Pfaff2012-03-071-19/+73
| | | | | | | | | | | | | | | | | | | | | | 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>
* Add ability to direct "packet-in"s to particular controllers.Ben Pfaff2012-02-271-0/+2
| | | | | | | | | | | | | | 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>
* ofp-util: New functions for string versions of ofp_packet_in_reason.Ben Pfaff2012-02-271-0/+4
| | | | | | | Upcoming commits add a user for ofputil_packet_in_reason_from_string() and more users for ofputil_packet_in_reason_to_string(). Signed-off-by: Ben Pfaff <blp@nicira.com>
* ofp-util: Remove duplicate declaration of ofputil_decode_packet_in()Simon Horman2012-02-271-2/+0
| | | | | Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
* Implement new "fin_timeout" action and "learn" feature.Ben Pfaff2012-02-151-0/+3
| | | | | | | | | | The "learn" action can create matching return flows. If those have a long timeout then it's a good idea to have a way to notice when in fact the flows have terminated. This new action and matching "learn" feature provides that way. Feature #8603. Signed-off-by: Ben Pfaff <blp@nicira.com>
* ofproto: Implement OpenFlow extension to allow control over async messages.Ben Pfaff2012-02-091-0/+1
| | | | | | | | | 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>
* ofp-util: New function ofputil_encode_barrier_request().Ben Pfaff2012-02-091-0/+2
| | | | | | This new function will acquire a new user in an upcoming commit. Signed-off-by: Ben Pfaff <blp@nicira.com>
* ofp-util: Add struct ofputil_packet_out, helper functions, and use it all.Ben Pfaff2012-02-091-8/+14
| | | | | | | | | 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>
* Add information about time left before timeouts to flow dumps.Ben Pfaff2012-02-071-2/+6
| | | | | | | | | 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>
* ofproto: New action TTL decrement.Pravin B Shelar2012-01-131-1/+1
| | | | | | | | | | | Following patch implements dec_ttl as vendor action with similar semantics as OpenFlow 1.2. If TTL reaches zero while procession actions in current table, the remaining actions in previous tables are processed. A configuration parameter is added to make TTL decrement to zero generate packet in. Feature #8758 Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
* Better abstract OpenFlow error codes.Ben Pfaff2012-01-121-158/+16
| | | | | | | | | | | | 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>
* openflow: New Nicira Extended PACKET_IN format.Ethan Jackson2012-01-101-1/+14
| | | | | | | 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>
* flow: Create new flow_metadata structure for packet_in messages.Ethan Jackson2012-01-101-1/+2
| | | | | | This will ease the implementation of future patches. Signed-off-by: Ethan Jackson <ethan@nicira.com>
* ofputil: New function ofputil_decode_packet_in().Ethan Jackson2012-01-101-0/+3
| | | | Signed-off-by: Ethan Jackson <ethan@nicira.com>
* ofp-util: Don't use ofpbuf in ofputil_packet_in struct.Ethan Jackson2012-01-101-1/+3
| | | | | | | This will make the memory ownership clearer in future patches which make more extensive use of ofputil_packet_in. Signed-off-by: Ethan Jackson <ethan@nicira.com>
* ofproto: Always clone packets in PACKET_IN message.Ethan Jackson2012-01-101-2/+1
| | | | | | | | | | This patch removes an optimization which significantly complicates the code in ways which would get worse in future patches if not removed. Furthermore, future patches will have fewer cases which can take advantage of the optimization further mitigating its justification. Signed-off-by: Ethan Jackson <ethan@nicira.com>
* Add ability to restrict flow mods and flow stats requests to cookies.Justin Pettit2011-12-271-0/+3
| | | | | | | | With this commit, it is possible to limit flow deletions and modifications to specific cookies. It also provides the ability to dump flows based on their cookies. Signed-off-by: Justin Pettit <jpettit@nicira.com>
* ofp-util: New function ofputil_decode_msg_type_partial().Ben Pfaff2011-11-021-0/+2
|
* Implement new fragment handling policy.Ben Pfaff2011-10-211-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now, OVS has handled IP fragments more awkwardly than necessary. It has not been possible to match on L4 headers, even in fragments with offset 0 where they are actually present. This means that there was no way to implement ACLs that treat, say, different TCP ports differently, on fragmented traffic; instead, all decisions for fragment forwarding had to be made on the basis of L2 and L3 headers alone. This commit improves the situation significantly. It is still not possible to match on L4 headers in fragments with nonzero offset, because that information is simply not present in such fragments, but this commit adds the ability to match on L4 headers for fragments with zero offset. This means that it becomes possible to implement ACLs that drop such "first fragments" on the basis of L4 headers. In practice, that effectively blocks even fragmented traffic on an L4 basis, because the receiving IP stack cannot reassemble a full packet when the first fragment is missing. This commit works by adding a new "fragment type" to the kernel flow match and making it available through OpenFlow as a new NXM field named NXM_NX_IP_FRAG. Because OpenFlow 1.0 explicitly says that the L4 fields are always 0 for IP fragments, it adds a new OpenFlow fragment handling mode that fills in the L4 fields for "first fragments". It also enhances ovs-ofctl to allow users to configure this new fragment handling mode and to parse the new field. Signed-off-by: Ben Pfaff <blp@nicira.com> Bug #7557.
* ofp-util: New function for parsing key-value pairs.Ben Pfaff2011-09-131-0/+3
| | | | This will soon have a new user, but it's a worthwhile cleanup on its own.
* ofp-util: Add type-safe functions for serializing actions.Ben Pfaff2011-09-131-0/+24
|
* ofp-util: Further abstract definitions of action properties.Ben Pfaff2011-09-131-29/+47
| | | | | | | | | 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.
* ofp-util: New functions for parsing and formatting OpenFlow port numbers.Ben Pfaff2011-09-131-0/+4
| | | | | 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.
* nicra-ext: New action NXAST_OUTPUT_REG.Ethan Jackson2011-08-121-1/+2
| | | | | The NXAST_OUTPUT_REG action outputs to the OpenFlow port contained in a supplied NXM field.
* ofp-util: Rename struct flow_stats_request with ofputil_ prefix.Ben Pfaff2011-08-091-3/+3
| | | | | Most of the structs in ofp-util.h have the ofputil_ prefix. Rename this one for consistency.
* ofp-util: Rename struct flow_mod to struct ofputil_flow_mod.Ben Pfaff2011-08-091-4/+4
| | | | | Most of the structs in ofp-util.h have the ofputil_ prefix. Rename this one for consistency.
* New action NXAST_RESUBMIT_TABLE.Ben Pfaff2011-08-091-0/+1
| | | | | This makes multiple table support in ofproto-dpif useful, by allowing resubmits into tables other than 0.
* lib: Adapt headers for use in C++.Casey Barker2011-08-041-1/+2
| | | | | | | 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.
* bundle: New action "bundle_load".Ethan Jackson2011-07-221-1/+2
| | | | | The bundle_load action behaves the same as the bundle action, except instead of outputting, it writes its result to a register.
* vswitch: Implement bundle action.Ethan Jackson2011-07-191-1/+2
| | | | | | 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.
* ofputil: Export ofputil_check_output_port().Ethan Jackson2011-07-191-0/+1
| | | | | Future patches will use this function outside of the ofputil module.
* ofp-util: Centralize decoding of OpenFlow actions.Ben Pfaff2011-06-301-0/+32
| | | | | | 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.
* ofp-util: Simplify iteration through OpenFlow actions.Ben Pfaff2011-06-301-7/+30
| | | | | | | | | | | | 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.
* ofp-util: Rename OFPUTIL_INVALID to OFPUTIL_MSG_INVALID.Ben Pfaff2011-06-301-1/+1
| | | | | | | 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.
* Define UINT64_MAX as "unknown" in Open vSwitch specific interfaces.Ben Pfaff2011-06-141-6/+6
| | | | | | | 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>
* ofp-util: New functions ofputil_actions_equal(), ofputil_actions_clone().Ben Pfaff2011-06-141-0/+4
| | | | | I found that introducing these helper functions provided a very modest increase in readability.
* ofproto: Better abstract flow stats encoding.Ben Pfaff2011-06-141-0/+2
|
* ofproto: Better abstract aggregate stats encoding and decoding.Ben Pfaff2011-06-141-0/+11
|
* openflow: Make stats replies more like other OpenFlow messages.Ben Pfaff2011-06-141-4/+10
|
* ovs-controller: Allow --wildcards to specify a wildcard set.Ben Pfaff2011-06-011-0/+1
| | | | | | | 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>
* ofp-util: Export (again) a generalized function for normalizing rules.Ben Pfaff2011-05-271-0/+1
| | | | | | | | | | | 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.
* Merge 'next' into 'master'.Ben Pfaff2011-05-181-2/+9
|\ | | | | | | | | | | | | | | | | | | 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.
| * Merge 'master' into 'next'.Ben Pfaff2011-05-121-16/+7
| |\
| * | Implement basic multiple table support.Ben Pfaff2011-05-121-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | Convert remaining network-byte-order "uint<N>_t"s into "ovs_be<N>"s.Ben Pfaff2011-05-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.