summaryrefslogtreecommitdiff
path: root/lib/ofp-print.c
Commit message (Collapse)AuthorAgeFilesLines
...
* ofp-print: Sort queues before printing in OFPT_QUEUE_GET_CONFIG_REPLY.Ben Pfaff2016-06-031-15/+45
| | | | | | | | Otherwise the ordering tends to vary across endianness. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Aaron Conole <aconole@redhat.com> Acked-by: Gerhard Stenzel <gstenzel@linux.vnet.ibm.com>
* Add support for extended netdev statistics based on RFC 2819.mweglicx2016-05-061-0/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Implementation of new statistics extension for DPDK ports: - Add new counters definition to netdev struct and open flow, based on RFC2819. - Initialize netdev statistics as "filtered out" before passing it to particular netdev implementation (because of that change, statistics which are not collected are reported as filtered out, and some unit tests were modified in this respect). - New statistics are retrieved using experimenter code and are printed as a result to ofctl dump-ports. - New counters are available for OpenFlow 1.4+. - Add new vendor id: INTEL_VENDOR_ID. - New statistics are printed to output via ofctl only if those are present in reply message. - Add new file header: include/openflow/intel-ext.h which contains new statistics definition. - Extended statistics are implemented only for dpdk-physical and dpdk-vhost port types. - Dpdk-physical implementation uses xstats to collect statistics. - Dpdk-vhost implements only part of statistics (RX packet sized based counters). Signed-off-by: Michal Weglicki <michalx.weglicki@intel.com> [blp@ovn.org made software devices more consistent] Signed-off-by: Ben Pfaff <blp@ovn.org>
* Add skeleton for OF1.6 support.Ben Pfaff2016-04-181-0/+4
| | | | | Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Ryan Moats <rmoats@us.ibm.com>
* Move lib/ofp-print.h to include/openvswitch directoryBen Warren2016-04-141-3/+3
| | | | | Signed-off-by: Ben Warren <ben@skyportsystems.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Move lib/ofp-actions.h to include/openvswitch directoryBen Warren2016-04-141-2/+2
| | | | | Signed-off-by: Ben Warren <ben@skyportsystems.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Move lib/ofp-msgs.h to include/openvswitch directoryBen Warren2016-04-141-6/+6
| | | | | Signed-off-by: Ben Warren <ben@skyportsystems.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Move lib/ofp-util.h to include/openvswitch directoryBen Warren2016-04-141-1/+1
| | | | | | | | This commit also adds several #include directives in source files in order to make the 'ofp-util.h' move possible Signed-off-by: Ben Warren <ben@skyportsystems.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Move lib/type-props.h to include/openvswitch directoryBen Warren2016-04-141-1/+1
| | | | | Signed-off-by: Ben Warren <ben@skyportsystems.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Move lib/meta-flow.h to include/openvswitch directoryBen Warren2016-04-141-1/+1
| | | | | | | | | This commit also moves some bitmap macros into public header files and adds some #include directives in soure files in order to make the 'meta-flow.h' move possible. Signed-off-by: Ben Warren <ben@skyportsystems.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Break uuid.h into private and public partsBen Warren2016-04-141-0/+1
| | | | | | | | Public (struct definitions and some prototypes) go in include/openvswitch Signed-off-by: Ben Warren <ben@skyportsystems.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Move lib/ofpbuf.h to include/openvswitch directoryBen Warren2016-03-301-1/+1
| | | | | | Signed-off-by: Ben Warren <ben@skyportsystems.com> Acked-by: Ryan Moats <rmoats@us.ibm.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Move lib/dynamic-string.h to include/openvswitch directoryBen Warren2016-03-191-1/+1
| | | | | Signed-off-by: Ben Warren <ben@skyportsystems.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Move lib/ofp-errors.h to include/openvswitch directoryBen Warren2016-03-191-1/+1
| | | | | Signed-off-by: Ben Warren <ben@skyportsystems.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovs-ofctl: Add output colors for flow attributes.Quentin Monnet2016-03-181-11/+21
| | | | | | | | This commit adds colors to the “left part” of printed flows (to flow properties that are always present: `cookie`, `table`, timeouts, etc.). Signed-off-by: Quentin Monnet <quentin.monnet@6wind.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Implement OFPT_TABLE_STATUS Message.Saloni Jain2016-02-241-0/+26
| | | | | | | | | | | | | | On change in a table state, the controller needs to be informed with the OFPT_TABLE_STATUS message. The message is sent with reason OFPTR_VACANCY_DOWN or OFPTR_VACANCY_UP in case of change in remaining space eventually crossing any one of the threshold. Signed-off-by: Saloni Jain <saloni.jain@tcs.com> Co-authored-by: Rishi Bamba <rishi.bamba@tcs.com> Signed-off-by: Rishi Bamba <rishi.bamba@tcs.com> [blp@ovn.org added vacancy event initialization and tests and updated NEWS] Signed-off-by: Ben Pfaff <blp@ovn.org>
* Implement serializing the state of packet traversal in "continuations".Ben Pfaff2016-02-191-16/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One purpose of OpenFlow packet-in messages is to allow a controller to interpose on the path of a packet through the flow tables. If, for example, the controller needs to modify a packet in some way that the switch doesn't directly support, the controller should be able to program the switch to send it the packet, then modify the packet and send it back to the switch to continue through the flow table. That's the theory. In practice, this doesn't work with any but the simplest flow tables. Packet-in messages simply don't include enough context to allow the flow table traversal to continue. For example: * Via "resubmit" actions, an Open vSwitch packet can have an effective "call stack", but a packet-in can't describe it, and so it would be lost. * A packet-in can't preserve the stack used by NXAST_PUSH and NXAST_POP actions. * A packet-in can't preserve the OpenFlow 1.1+ action set. * A packet-in can't preserve the state of Open vSwitch mirroring or connection tracking. This commit introduces a solution called "continuations". A continuation is the state of a packet's traversal through OpenFlow flow tables. A "controller" action with the "pause" flag, which is newly implemented in this commit, generates a continuation and sends it to the OpenFlow controller in a packet-in asynchronous message (only NXT_PACKET_IN2 supports continuations, so the controller must configure them with NXT_SET_PACKET_IN_FORMAT). The controller processes the packet-in, possibly modifying some of its data, and sends it back to the switch with an NXT_RESUME request, which causes flow table traversal to continue. In principle, a single packet can be paused and resumed multiple times. Another way to look at it is: - "pause" is an extension of the existing OFPAT_CONTROLLER action. It sends the packet to the controller, with full pipeline context (some of which is switch implementation dependent, and may thus vary from switch to switch). - A continuation is an extension of OFPT_PACKET_IN, allowing for implementation dependent metadata. - NXT_RESUME is an extension of OFPT_PACKET_OUT, with the semantics that the pipeline processing is continued with the original translation context from where it was left at the time it was paused. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* Support userdata in NXT_PACKET_IN2.Ben Pfaff2016-02-191-0/+17
| | | | | Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* ofp-util: Rename struct ofputil_packet_in member 'len' to 'packet_len'.Ben Pfaff2016-02-191-5/+5
| | | | | | | | An upcoming commit will introduce another member that has a length, and it seems weird that bare 'len' would be one or the other. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* ofpbuf: New function ofpbuf_const_initializer().Ben Pfaff2016-02-191-49/+18
| | | | | | | | | | | | | | | A number of times I've looked at code and thought that it would be easier to understand if I could write an initializer instead of ofpbuf_use_const(). This commit adds a function for that purpose and adapts a lot of code to use it, in the places where I thought it made the code better. In theory this could improve code generation since the new function can be inlined whereas ofpbuf_use_const() isn't. But I guess that's probably insignificant; the intent of this change is code readability. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* ofp-util: Make decoding switch features harder to misuse (and fix leak).Ben Pfaff2016-01-201-1/+2
| | | | | | | | | | | | | | | | | | | | | Until now, ofputil_decode_switch_features() has put the ports from the switch features message into a separate ofpbuf supplied as an argument. The natural desire for a caller is to just reuse an ofpbuf that it already has, and that's what one of the callers did. This however has the nonobvious effect of leaking the memory that the ofpbuf previously owned, since it gets replaced by an OFPBUF_CONST-type ofpbuf. This commit avoids the problem by changing the interface to pull the header from an ofpbuf that the caller already has. This fixes a leak in testcase 909 "ofproto-dpif - patch ports". Found by valgrind. Reported-by: William Tu <u9012063@gmail.com> Reported-at: http://openvswitch.org/pipermail/dev/2016-January/064771.html Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* openflow: Better abstract handling of packet-in messages.Ben Pfaff2016-01-201-11/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Packet-in messages have been a bit of a mess. First, their abstraction in the form of struct ofputil_packet_in has some fields that are used in a clear way for incoming and outgoing packet-ins, and others (packet_len, total_len, buffer_id) have have confusing meanings or usage pattern depending on their direction. Second, it's very confusing how a packet-in has both a reason (OFPR_*) and a miss type (OFPROTO_PACKET_IN_*) and how those add up to the actual reason that is used "on the wire" for each OpenFlow version (and even whether the packet-in is sent at all!). Finally, there's all kind of low-level detail randomly scattered between connmgr, ofproto-dpif-xlate, and ofp-util. This commit attempts to clear up some of the confusion. It simplifies the struct ofputil_packet_in abstraction by removing the members that didn't have a clear and consistent meaning between incoming and outgoing packet-ins. It gets rid of OFPROTO_PACKET_IN_*, instead adding a couple of nonstandard OFPR_* reasons that add up to what OFPROTO_PACKET_IN_* was meant to say (in what I hope is a clearer way). And it consolidates the tricky parts into ofp-util, where I hope it will be easier to understand all in one place. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* ofp-print: Decode and print all async config messages the same way.Ben Pfaff2016-01-201-91/+26
| | | | | | | | We have a single function to decode all of these messages, so there's no reason to do it two different ways for printing. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* ofp-util: Fix OF1.4+ version of ofputil_decode_set_async_config().Ben Pfaff2016-01-201-2/+5
| | | | | | | | | | | | | | The OF1.0 through OF1.3 "set async config" set the whole configuration, OF1.4+ only update parts of it piecemeal, but the decoding function always set the whole configuration. This commit fixes the problem by changing the interface to require the caller to provide an initial state. (It would be possible to simply make it mutate existing state in-place, but that interface seems a little more error-prone.) Found by inspection. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* ofp-util: Rewrite async config encoding and decoding to be table-driven.Ben Pfaff2016-01-201-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | The encoding and decoding of the OpenFlow and Open vSwitch async config messages was, until now, a collection of disjoint code that had a lot of redundancy. This commit changes it all to be driven using a single central table. This rewrite fixes a bug in the OF1.4+ version of the code, which until now assumed that every TLV in an OF1.4+ asynchronous configuration message was exactly 8 bytes long, and reported an error if any was a different length. This invariant is true of all the standard TLVs already defined, but it won't be true of any experimenter TLVs (and won't necessarily be true of any new standard TLVs), so this commit changes it to be more tolerant. The OFPACPT_* constants are no longer useful (they are encoded directly in the table and do not need to be anywhere else), so this removes them. This commit also adds support for experimenter async config messages. We don't have any yet but an upcoming commit will add one. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* ofp-util: Define struct ofputil_async_cfg to hold async message config.Ben Pfaff2016-01-201-15/+7
| | | | | | | This seems a little better than a pair of bare arrays. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* ofp-util: New function ofputil_async_msg_type_to_string().Ben Pfaff2016-01-201-25/+2
| | | | | | | An upcoming commit will add another user. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* openflow: Implement OF1.4+ OFPMP_QUEUE_DESC multipart message.Ben Pfaff2016-01-201-13/+19
| | | | | | | | | | | | | | | | | | OpenFlow 1.0 through 1.3 have a message OFPT_QUEUE_GET_CONFIG_REQUEST and its corresponding reply, for fetching a description of the queues configured on a given port. OpenFlow 1.4 changes this message to a multipart message OFPMP_QUEUE_DESC, which Open vSwitch has not until now implemented. This commit adds an implemntation of that message. Because the message is a replacement for the former one, this commit implements it using the same ofp-util functions as the former message, so that the client code doesn't have to distinguish a difference between versions. The ovs-ofctl command queue-get-config was previously undocumented (due only to an oversight). This commit corrects that and documents the new feature available with OpenFlow 1.4. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* ofp-print: Improve formatting of queue stat requests and port_mods.Ben Pfaff2016-01-201-2/+2
| | | | | | | | | | | | | Without this, OFPST_QUEUE requests are formatted as: OFPST_QUEUE request:port=LOCAL queue=5 With this commit, OFPST_QUEUE requests are formatted as: OFPST_QUEUE request: port=LOCAL queue=5 which looks better. Similarly for OFPT_PORT_MOD. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* Better abstract OFPT_SET_CONFIG and OFPT_GET_CONFIG_REPLY, make stricter.Ben Pfaff2016-01-071-13/+30
| | | | | | | | | | | | | | | | | | | | The OFPT_SET_CONFIG and OFPT_GET_CONFIG_REPLY messages, which have the same format, have a 'flags' field in which OpenFlow defines some bits, which change somewhat from one version to another, and does not define others. Until now, Open vSwitch has not abstracted these messages at all and has ignored the bits that OpenFlow leaves undefined. This commit abstracts the messages in the same way as other OpenFlow messages and validates in OFPT_SET_CONFIG messages that the undefined bits are set to zero. OpenFlow 1.1 and 1.2, but not OpenFlow 1.0, define a flag named OFPC_INVALID_TTL_TO_CONTROLLER. Open vSwitch has until now also implemented this as an extension to OpenFlow 1.0, and this commit retains that extension. Reported-by: Manpreet Singh <er.manpreet25@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* ofp-print: Fix memory leak at ofp_print_bundle_add().William Tu2016-01-041-6/+3
| | | | | | | | | | | | | | | | | | | | Call ds_put_and_free_cstr instead of ds_put_cstr to free msg. Reported by test cases: 325, 326 ofp_print_bundle_add (ofp-print.c:3027) ofp_to_string__ (ofp-print.c:3410) ofp_to_string (ofp-print.c:3465) ofp_print (ofp-print.c:3497) ofctl_ofp_print (ovs-ofctl.c:3818) ovs_cmdl_run_command (command-line.c:121) main (ovs-ofctl.c:135) Signed-off-by: William Tu <u9012063@gmail.com> Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Co-authored-by: Daniele Di Proietto <diproiettod@vmware.com> [blp@ovn.org simplified the code slightly] Signed-off-by: Ben Pfaff <blp@ovn.org> Signed-off-by: Ben Pfaff <blp@ovn.org>
* geneve-map-rename: rename geneve-map to tlv-map.Mengke Liu2015-12-151-25/+25
| | | | | | | | | | | | | | | | | | This patch renames the command name related with geneve-map to a more generic name as following: add-geneve-map -> add-tlv-map del-geneve-map -> del-tlv-map dump-geneve-map -> dump-tlv-map It also renames the Geneve_table to tlv_table. By doing this renaming, the NSH variable context header (the same TLV format as Geneve) or other protocol can reuse the field tun_metadata<N> in the future. Signed-off-by: Mengke Liu <mengke.liu@intel.com> Signed-off-by: Ricky Li <ricky.li@intel.com> Signed-off-by: Jesse Gross <jesse@kernel.org>
* ofproto: Implement OF1.4 error code for set-async-configAmbika Arora2015-11-301-1/+21
| | | | | | | | | | This patch adds support for Openflow1.4 error codes for set-async-config. In this patch, a new error type, OFPET_ASYNC_CONFIG_FAILED is introduced that enables the switch to properly inform the controller when controller tries to set invalid mask or unsupported configuration. Signed-off-by: Ambika Arora <ambika.arora@tcs.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Implement Vacancy Events for OFPMP_TABLE_DESC.Saloni Jain2015-11-291-0/+11
| | | | | | | | | | | | | This patch adds support for vacancy events in table-desc. ovs-ofctl -O OpenFlow14 dump-tables-desc <switch> -This command is enhanced to display the Vacancy Event configuration of the tables on a <switch>, which is set using the mod-table command. Signed-off-by: Saloni Jain <saloni.jain@tcs.com> Co-authored-by: Hiteshi Kalra <hiteshi.kalra@tcs.com> Signed-off-by: Hiteshi Kalra <hiteshi.kalra@tcs.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Implement Openflow 1.4 Vacancy Events for OFPT_TABLE_MOD.Saloni Jain2015-11-291-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | OpenFlow 1.4 introduces the ability to turn on vacancy events with an OFPT_TABLE_MOD message specifying OFPTC_VACANCY_EVENTS. This commit adds support for the new feature in ovs-ofctl mod-table. As per the openflow specification-1.4, vacancy event adds a mechanism enabling the controller to get an early warning based on capacity threshold chosen by the controller. With this commit, vacancy events can be configured as: ovs-ofctl -O OpenFlow14 mod-table <bridge> <table> vacancy:<low,high> <low,high> specify vacancy threshold values in percentage for vacancy_down and vacancy_up respectively. To disable vacancy events, following command should be given: ovs-ofctl -O OpenFlow14 mod-table <bridge> <table> novacancy Signed-off-by: Saloni Jain <saloni.jain@tcs.com> Co-authored-by: Shashwat Srivastava <shashwat.srivastava@tcs.com> Signed-off-by: Shashwat Srivastava <shashwat.srivastava@tcs.com> Co-authored-by: Sandeep Kumar <sandeep.kumar16@tcs.com> Signed-off-by: Sandeep Kumar <sandeep.kumar16@tcs.com> [blp@ovn.org fixed a few typos] Signed-off-by: Ben Pfaff <blp@ovn.org>
* openflow: Remove OFPG11_*Jarno Rajahalme2015-11-241-1/+1
| | | | | | | | | Protocol-independent symbols OFPG_* were already defined in openflow-common.h, so remove the protocol version dependent symbols. Found by inspection. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofp-parse: Fix parsing, formatting of multiple fields in NTR extension.Ben Pfaff2015-11-031-12/+10
| | | | | | | | | | | | | | | | | Until now, the only way to specify multiple fields in the "fields" parameter for the Netronome groups extension, was to specify "fields" more than once, e.g. fields=eth_dst,fields=ip_dst However, this wasn't documented and the code in ofp-print didn't use it, generating output that couldn't be parsed. This commit fixes the situation by introducing a more straightforward syntax, e.g. fields(eth_dst,ip_dst), documents it, and adjusts ofp-print code to use it when there is more than one field (it retains the previous format for backward compatibility when there is exactly one field) Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Simon Horman <simon.horman@netronome.com>
* ofproto: Implement OF1.4 Group & Meter change notification messagesNiti Rohilla2015-09-091-31/+77
| | | | | | | | | | | | | This patch adds support for Openflow1.4 Group & meter change notification messages. In a multi controller environment, when a controller modifies the state of group and meter table, the request that successfully modifies this state is forwarded to other controllers. Other controllers are informed with the OFPT_REQUESTFORWARD message. Request forwarding is enabled on a per controller channel basis using the Set Asynchronous Configuration Message. Signed-off-by: Niti Rohilla <niti.rohilla@tcs.com> Co-authored-by: Ben Pfaff <blp@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* ofp-print: Fix redundant expression.Joe Stringer2015-08-241-1/+1
| | | | | | | | | | | 'features' is always a valid pointer to something on the stack, so checking (!features || ...) is the same as checking (false || ...). Simplify the expression. Found by MIT STACK undefined behaviour checker. Signed-off-by: Joe Stringer <joestringer@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* Fix treatment of OpenFlow 1.1+ bucket weights.Ben Pfaff2015-07-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Until now, OVS has parsed all OF1.1+ group buckets that lack a weight as having weight 1. Unfortunately, OpenFlow says that only "select" groups may have a nonzero weight, and requires reporting an error for other kinds of groups that have a nonzero weight. This commit fixes the problem by parsing only select groups with a default weight of 1 and other groups with a default weight of 0. It also adds the OpenFlow-required check for nonzero weights for other kinds of groups. This complies with OpenFlow 1.1 and later. OF1.1 says in section 5.8: If a specified group type is invalid (ie: includes fields such as weight that are undefined for the specified group type) then the switch must refuse to add the group entry and must send an ofp_error_msg with OFPET_GROUP_MOD_FAILED type and OFPGMFC_INVALID_GROUP code. Found by OFTest. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Flavio Leitner <fbl@sysclose.org>
* ofp-print: Abbreviate duplicated table features.Ben Pfaff2015-07-281-38/+128
| | | | | | | | | | | | | | | | | | I spent some time recently looking at the results of "ovs-ofctl dump-table-features". It was really distressing because of the volume of information. Every table yielded well over 100 lines of output and for 253 (visible) tables that meant over 25,300 lines of output total, which is basically unusable. This commit cuts the volume of output greatly by eliminating most of the duplication from one table to the next. The command now prints the full output only for table 0, and for each subsequent table prints only the parts that differ. That reduces the output volume for tables after the first to only 9 lines each (one of which is blank), for a total of more like 2,400 lines, which is still not short but reasonably manageable. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Andy Zhou <azhou@nicira.com>
* ofproto: Implement OF1.4 Set/Get asynchronous configuration messages.Niti Rohilla2015-07-271-41/+197
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for Openflow1.4 set/get asynchronous configuration messages. OpenVSwitch already supports set/get asynchronous configuration messages for Openflow1.3. In this patch OFPT_SET_ASYNC_CONFIG message allows the controllers to set the configuration for OFPT_ROLE_STATUS, OFPT_TABLE_STATUS and OFPT_REQUESTFORWARD in addition to the Openflow1.3 messages. In a OFPT_SET_ASYNC, only the properties that shall be changed need to be included, properties that are omitted from the message are unchanged. The OFPT_GET_ASYNC_CONFIG is used to query the asynchronous configuration of switch. In a OFPT_GET_ASYNC_REPLY message, all properties must be included. According to Openflow1.4 the initial configuration shall be: - In the “master” or “equal” role, enable all OFPT_PACKET_IN messages, except those with reason OFPR_INVALID_TTL, enable all OFPT_PORT_STATUS and OFPT_FLOW_REMOVED messages, and disable all OFPT_ROLE_STATUS, OFPT_TABLE_STATUS and OFPT_REQUESTFORWARD messages. - In the “slave” role, enable all OFPT_PORT_STATUS messages and disable all OFPT_PACKET_IN, OFPT_FLOW_REMOVED, OFPT_ROLE_STATUS, OFPT_TABLE_STATUS and OFPT_REQUESTFORWARD messages. Signed-off-by: Niti Rohilla <niti.rohilla@tcs.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* Implement OpenFlow 1.4+ OFPMP_TABLE_DESC message.Ben Pfaff2015-07-031-0/+39
| | | | | | | Signed-off-by: Ben Pfaff <blp@nicira.com> Co-authored-by: Saloni Jain <saloni.jain@tcs.com> Signed-off-by: Saloni Jain <saloni.jain@tcs.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
* Implement OpenFlow 1.4+ OFPTC_EVICTION.Ben Pfaff2015-07-031-20/+70
| | | | | | | | | | | | | | | | | | OpenFlow 1.4 introduces the ability to turn on flow table eviction with an OFPT_TABLE_MOD message specifying OFPTC_EVICTION. It also adds related machinery to other messages that mention OFPTC_* fields. This commit adds support for the new feature, implementing it as a second, parallel way to enable flow table eviction. It takes more work than it seems like it should because there is so much weirdness with the treatment of OFPTC_* flags over the evolution of OpenFlow; please refer to the explanation in DESIGN.md for more information. This commit also adds related support to ovs-ofctl, plus tests. Signed-off-by: Ben Pfaff <blp@nicira.com> Co-authored-by: Saloni Jain <saloni.jain@tcs.com> Signed-off-by: Saloni Jain <saloni.jain@tcs.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
* openflow: Table maintenance commands for Geneve options.Jesse Gross2015-06-251-0/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to work with Geneve options, we need to maintain a mapping table between an option (defined by <class, type, length>) and an NXM field that can be operated on for the purposes of matches, actions, etc. This mapping must be explicitly specified by the user. Conceptually, this table could be communicated using either OpenFlow or OVSDB. Using OVSDB requires less code and definition of extensions than OpenFlow but introduces the possibility that mapping table updates and flow modifications are desynchronized from each other. This is dangerous because the mapping table signifcantly impacts the way that flows using Geneve options are installed and processed by OVS. Therefore, the mapping table is maintained using OpenFlow commands instead, which opens the possibility of using synchronization between table changes and flow modifications through barriers, bundles, etc. There are two primary groups of OpenFlow messages that are introduced as Nicira extensions: modification commands (add, delete, clear mappings) and table status request/reply to dump the current table along with switch information. Note that mappings should not be changed while they are in active use by a flow. The result of doing so is undefined. This only adds the OpenFlow infrastructure but doesn't actually do anything with the information yet after the messages have been decoded. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* ofproto: Postpone sending flow removed messages.Jarno Rajahalme2015-06-121-0/+1
| | | | | | | | | The final flow stats are available only after there are no references to the rule. Postpone sending the flow removed message until the final stats are available. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* ofp-util: Convert flow_metadata to match structure.Jesse Gross2015-06-081-37/+2
| | | | | | | | | | | | | | | | | | | | | | | | We have a special flow_metadata structure to represent the parts of a packet that aren't carried in the payload itself. This is used in the case where we need to send the packet as a Packet In to an OpenFlow controller. This is a subset of the more general struct flow. In practice, almost all operations we do on this structure involve converting it to or from a match or have code that is the same as a match. Serialization to NXM and back is done as a match. There is special flow_metadata formatting code that is almost identical to match formatting. The uses for struct flow_metadata aren't performance critical when it comes to memory, so we can save quite a bit of code by just using a match structure directly instead. In addition, as metadata increases and becomes more complex (Geneve options require some special handling beyond just additional fields), using the match structure means we only have to do this work in one place. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* bundles: Validate bundled messages.Jarno Rajahalme2015-06-011-2/+2
| | | | | | | | OpenFlow bundle messages should be decoded and validated at the time they are added to the bundle. This commit does this for flow mod and port mod messages. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* Support encoding of NTR selection methodSimon Horman2015-03-241-6/+26
| | | | | | | | | Include NTR selection method experimenter group property in in group mod request and group desc reply. NTR selection method Signed-off-by: Simon Horman <simon.horman@netronome.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* ofpbuf: Simplify ofpbuf API.Pravin B Shelar2015-03-031-2/+2
| | | | | | | | | | | | ofpbuf was complicated due to its wide usage across all layers of OVS, Now we have introduced independent dp_packet which can be used for datapath packet, we can simplify ofpbuf. Following patch removes DPDK mbuf and access API of ofpbuf members. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* dp-packet: Remove ofpbuf dependency.Pravin B Shelar2015-03-031-11/+11
| | | | | | | | | | | | | Currently dp-packet make use of ofpbuf for managing packet buffers. That complicates ofpbuf, by making dp-packet independent of ofpbuf both libraries can be optimized for their own use case. This avoids mapping operation between ofpbuf and dp_packet in datapath upcalls. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>