summaryrefslogtreecommitdiff
path: root/include/openflow
Commit message (Collapse)AuthorAgeFilesLines
* openflow: Add extension to flush CT by generic match.Ales Musil2023-01-161-0/+37
| | | | | | | | | | | Add extension that allows to flush connections from CT by specifying fields that the connections should be matched against. This allows to match only some fields of the connection e.g. source address for orig direction. Reported-at: https://bugzilla.redhat.com/2120546 Signed-off-by: Ales Musil <amusil@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* ofp-monitor: Support flow monitoring for OpenFlow 1.3, 1.4+.Vasu Dasari2022-04-282-10/+172
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extended OpenFlow monitoring support * OpenFlow 1.3 with ONF extensions * OpenFlow 1.4+ as defined in OpenFlow specification 1.4+. ONF extensions are similar to Nicira extensions except for onf_flow_monitor_request{} where out_port is defined as 32-bit number OF(1.1) number, oxm match formats are used in update and request messages. Flow monitoring support in 1.4+ is slightly different from Nicira and ONF extensions. * More flow monitoring flags are defined. * Monitor add/modify/delete command is introduced in flow_monitor request message. * Addition of out_group as part of flow_monitor request message Description of changes: 1. Generate ofp-msgs.inc to be able to support 1.3, 1.4+ flow Monitoring messages. include/openvswitch/ofp-msgs.h 2. Modify openflow header files with protocol specific headers. include/openflow/openflow-1.3.h include/openflow/openflow-1.4.h 3. Modify OvS abstraction of openflow headers. ofp-monitor.h leverages enums from on nicira extensions for creating protocol abstraction headers. OF(1.4+) enums are superset of nicira extensions. include/openvswitch/ofp-monitor.h 4. Changes to these files reflect encoding and decoding of new protocol messages. lib/ofp-monitor.c 5. Changes to modules using ofp-monitor APIs. Most of the changes here are to migrate enums from nicira to OF 1.4+ versions. ofproto/connmgr.c ofproto/connmgr.h ofproto/ofproto-provider.h ofproto/ofproto.c 6. Extended protocol decoding tests to verify all protocol versions FLOW_MONITOR_CANCEL FLOW_MONITOR_PAUSED FLOW_MONITOR_RESUMED FLOW_MONITOR request FLOW_MONITOR reply tests/ofp-print.at 7. Modify flow monitoring tests to be able executed by all protocol versions. tests/ofproto.at 7. Modified documentation highlighting the change utilities/ovs-ofctl.8.in NEWS Signed-off-by: Vasu Dasari <vdasari@gmail.com> Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2021-June/383915.html Acked-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* Use primary/secondary, not master/slave, as names for OpenFlow roles.Ben Pfaff2020-10-163-18/+18
| | | | | Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>
* Require Python 3 and remove support for Python 2.Ben Pfaff2019-09-271-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Python 2 reaches end-of-life on January 1, 2020, which is only a few months away. This means that OVS needs to stop depending on in the next release that should occur roughly that same time. Therefore, this commit removes all support for Python 2. It also makes Python 3 a mandatory build dependency. Some of the interesting consequences: - HAVE_PYTHON, HAVE_PYTHON2, and HAVE_PYTHON3 conditionals have been removed, since we now know that Python3 is available. - $PYTHON and $PYTHON2 are removed, and $PYTHON3 is always available. - Many tests for Python 2 support have been removed, and the ones that depended on Python 3 now run unconditionally. This allowed several macros in the testsuite to be removed, making the code clearer. This does make some of the changes to the testsuite files large due to indentation level changes. - #! lines for Python now use /usr/bin/python3 instead of /usr/bin/python. - Packaging depends on Python 3 packages. Acked-by: Numan Siddique <nusiddiq@redhat.com> Tested-by: Numan Siddique <nusiddiq@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Remove support for OpenFlow 1.6 (draft).Ben Pfaff2019-02-057-103/+5
| | | | | | | | | ONF abandoned the OpenFlow specification, so that OpenFlow 1.6 will never be completed. It did not contain much in the way of useful features, so remove what support Open vSwitch already had. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
* ofp-table: Parse table features messages more carefully.Ben Pfaff2018-12-031-1/+23
| | | | | Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
* bundle: add symmetric_l3 hash method for multipathMartin Xu2018-10-021-1/+3
| | | | | | | | | Add a symmetric_l3 hash method that uses both network destination address and network source address. VMware-BZ: #2112940 Signed-off-by: Martin Xu <martinxu9.ovs@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Add OpenFlow extensions for group support in OpenFlow 1.0.Ben Pfaff2018-05-171-2/+1
| | | | | Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
* Add support for OpenFlow 1.5 statistics (OXS).SatyaValli2018-05-161-0/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch provides implementation Existing flow entry statistics are redefined as standard OXS(OpenFlow Extensible Statistics) fields for displaying the arbitrary flow stats. To support this implementation below messages are newly added OFPRAW_OFPT15_FLOW_REMOVED, OFPRAW_OFPST15_AGGREGATE_REQUEST, OFPRAW_OFPST15_FLOW_REPLY, OFPRAW_OFPST15_AGGREGATE_REPLY, The current commit adds support for the new feature in flow statistics multipart messages, aggregate multipart messages and OXS support for flow removal message, individual flow description messages. Signed-off-by: Satya Valli <satyavalli.rama@tcs.com> Co-authored-by: Lavanya Harivelam <harivelam.lavanya@tcs.com> Signed-off-by: Lavanya Harivelam <harivelam.lavanya@tcs.com> Co-authored-by: Surya Muttamsetty <muttamsetty.surya@tcs.com> Signed-off-by: Surya Muttamsetty <muttamsetty.surya@tcs.com> Co-authored-by: Manasa Cherukupally <manasa.cherukupally@tcs.com> Signed-off-by: Manasa Cherukupally <manasa.cherukupally@tcs.com> Co-authored-by: Pavani Panthagada <p.pavani1@tcs.com> Signed-off-by: Pavani Panthagada <p.pavani1@tcs.com> [blp@ovn.org simplified and rewrote much of the code] Co-authored-by: Ben Pfaff <blp@ovn.org> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofp-packet: Better abstract packet-in format.Ben Pfaff2018-03-141-25/+0
| | | | | | | | | | This commit relieves the caller of code that deals with the format of packet-in messages from some of the burden of understanding the packet format. It also renames the constants to appear to be at a higher level of abstraction. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
* ofp-protocol: Better abstract changing the protocol used for flow matches.Ben Pfaff2018-03-141-58/+2
| | | | | | | | | | | The previous interface here required the client to understand, to some extent, the low-level NXFF_* values and the encoding format for the NXT_SET_FLOW_FORMAT and NXT_SET_FLOW_MOD_TABLE_ID messages. This commit changes the interface so that the client only has to understand the ofputil_protocol type used elsewhere and none of the encoding otherwise. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
* netdev: Custom statistics.Michal Weglicki2018-01-101-0/+28
| | | | | | | | | | | | | | | | | | | | | - New get_custom_stats interface function is added to netdev. It allows particular netdev implementation to expose custom counters in dictionary format (counter name/counter value). - 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+. - New statistics are printed to output via ofctl only if those are present in reply message. - New statistics definition is added to include/openflow/intel-ext.h. - Custom statistics are implemented only for dpdk-physical port type. - DPDK-physical implementation uses xstats to collect statistics. Only dropped and error counters are exposed. Co-authored-by: Ben Pfaff <blp@ovn.org> Signed-off-by: Ben Pfaff <blp@ovn.org> Signed-off-by: Michal Weglicki <michalx.weglicki@intel.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofp-util: Update OpenFlow 1.6 port support to track latest proposal.Ben Pfaff2017-11-031-10/+3
| | | | | | | | | | The latest updates to the OpenFlow 1.6 proposal removes the hw_addr_type fields from ofp_port and ofp_port_mod. This commit updates the OVS prototype to match the updated proposal. ONF-JIRA: EXT-566 Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
* Fix C++ build issue when static_assert() is not availableYi-Hung Wei2017-09-131-2/+5
| | | | | | | | | | This patch prevents compile errors if the C++ compiler does not support C++11 or the support is not enabled. VMWare-BZ: #1953215 Fixes: 994bfc298502 ("Automatically verify that OVS header files work OK in C++ also.") Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* OF support and translation of generic encap and decapJan Scheurich2017-08-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds support for the OpenFlow actions generic encap and decap (as specified in ONF EXT-382) to the OVS control plane. CLI syntax for encap action with properties: encap(<header>) encap(<header>(<prop>=<value>,<tlv>(<class>,<type>,<value>),...)) For example: encap(ethernet) encap(nsh(md_type=1)) encap(nsh(md_type=2,tlv(0x1000,10,0x12345678),tlv(0x2000,20,0xfedcba9876543210))) CLI syntax for decap action: decap() decap(packet_type(ns=<pt_ns>,type=<pt_type>)) For example: decap() decap(packet_type(ns=0,type=0xfffe)) decap(packet_type(ns=1,type=0x894f)) The first header supported for encap and decap is "ethernet" to convert packets between packet_type (1,Ethertype) and (0,0). This commit also implements a skeleton for the translation of generic encap and decap actions in ofproto-dpif and adds support to encap and decap an Ethernet header. In general translation of encap commits pending actions and then rewrites struct flow in accordance with the new packet type and header. In the case of encap(ethernet) it suffices to change the packet type from (1, Ethertype) to (0,0) and set the dl_type accordingly. A new pending_encap flag in xlate ctx is set to mark that an corresponding datapath encap action must be triggered at the next commit. In the case of encap(ethernet) ofproto generetas a push_eth action. The general case for translation of decap() is to emit a datapath action to decap the current outermost header and then recirculate the packet to reparse the inner headers. In the special case of an Ethernet packet, decap() just changes the packet type from (0,0) to (1, dl_type) without a need to recirculate. The emission of the pop_eth action for the datapath is postponed to the next commit. Hence encap(ethernet) and decap() on an Ethernet packet are OF octions that only incur a cost in the dataplane when a modifed packet is actually committed, e.g. because it is sent out. They can freely be used for normalizing the packet type in the OF pipeline without degrading performance. Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com> Signed-off-by: Yi Yang <yi.y.yang@intel.com> Signed-off-by: Zoltan Balogh <zoltan.balogh@ericsson.com> Co-authored-by: Zoltan Balogh <zoltan.balogh@ericsson.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Automatically verify that OVS header files work OK in C++ also.Ben Pfaff2017-07-311-2/+1
| | | | | | | | | | This should help address a recurring problem. This change makes the OVS header files, when parsed by a C++ compiler, require C++11 or later. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Russell Bryant <russell@ovn.org>
* OpenFlow: Add support for "group delete" flow removed reason to 1.3.Justin Pettit2017-07-161-2/+4
| | | | | Signed-off-by: Justin Pettit <jpettit@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofp-util: Add OpenFlow 1.5 packet-out supportYi-Hung Wei2017-05-311-0/+13
| | | | | | | | | | | | | | | | | This patch implements the encoding and decoding of the new packet-out format defined in OpenFlow 1.5. Test cases are provided to verify the encoding and decoding. This patch is based on [1] and [2]. [1] https://github.com/jean2/openvswitch/commits/jean/ext-427 [2] https://mail.openvswitch.org/pipermail/ovs-dev/2017-April/331032.html Signed-off-by: Jean Tourrilhes <jt@labs.hpe.com> Signed-off-by: Zoltan Balogh <zoltan.balogh@ericsson.com> Co-authored-by: Jan Scheurich <jan.scheurich@ericsson.com> Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* userspace: Add packet_type in dp_packet and flowJan Scheurich2017-05-031-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds a packet_type attribute to the structs dp_packet and flow to explicitly carry the type of the packet as prepration for the introduction of the so-called packet type-aware pipeline (PTAP) in OVS. The packet_type is a big-endian 32 bit integer with the encoding as specified in OpenFlow verion 1.5. The upper 16 bits contain the packet type name space. Pre-defined values are defined in openflow-common.h: enum ofp_header_type_namespaces { OFPHTN_ONF = 0, /* ONF namespace. */ OFPHTN_ETHERTYPE = 1, /* ns_type is an Ethertype. */ OFPHTN_IP_PROTO = 2, /* ns_type is a IP protocol number. */ OFPHTN_UDP_TCP_PORT = 3, /* ns_type is a TCP or UDP port. */ OFPHTN_IPV4_OPTION = 4, /* ns_type is an IPv4 option number. */ }; The lower 16 bits specify the actual type in the context of the name space. Only name spaces 0 and 1 will be supported for now. For name space OFPHTN_ONF the relevant packet type is 0 (Ethernet). This is the default packet_type in OVS and the only one supported so far. Packets of type (OFPHTN_ONF, 0) are called Ethernet packets. In name space OFPHTN_ETHERTYPE the type is the Ethertype of the packet. A packet of type (OFPHTN_ETHERTYPE, <Ethertype>) is a standard L2 packet whith the Ethernet header (and any VLAN tags) removed to expose the L3 (or L2.5) payload of the packet. These will simply be called L3 packets. The Ethernet address fields dl_src and dl_dst in struct flow are not applicable for an L3 packet and must be zero. However, to maintain compatibility with the large code base, we have chosen to copy the Ethertype of an L3 packet into the the dl_type field of struct flow. This does not mean that it will be possible to match on dl_type for L3 packets with PTAP later on. Matching must be done on packet_type instead. New dp_packets are initialized with packet_type Ethernet. Ports that receive L3 packets will have to explicitly adjust the packet_type. Signed-off-by: Jean Tourrilhes <jt@labs.hpe.com> Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com> Co-authored-by: Zoltan Balogh <zoltan.balogh@ericsson.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* connmgr: Fix internal packet-in reason code mask.Yi-Hung Wei2017-04-241-2/+7
| | | | | | | | | | | | | | | | Starting from OpenFlow 1.4+, OFPR_ACTION is split into four more descriptive reasons, OFPR_APPLY_ACTION, OFPR_ACTION_SET, OFPR_GROUP, and OFPR_PACKET_OUT. OVS maintains the new reason code internally, and it currently supports the first three reason code. If the version of an established OpenFlow connection is less than 1.4, OVS converts the internal reason code back to OFPR_ACTION to be backward compatible. However, the internal packet-in reason code mask is not properly maintained for the older OpenFlow version that may emit the packet-in messages wth the new reason code. It is because OVS does not enable the new reason code internally in the reason code mask for older OpenFlow version. This commit tries to address the aforementioned issue. Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Add support for OpenFlow 1.6 (draft) port status and port mod messages.Ben Pfaff2017-04-077-6/+111
| | | | | | | | | OpenFlow 1.6 adds support for EUI-64 addresses for ports, and extends the maximum length of OpenFlow port names from 16 to 64 bytes. ONF-JIRA: EXT-566 Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* bundle: add nw_src/dst hash methodwenxu2017-04-061-1/+6
| | | | | | | Add only nw_src or nw_dst hash feature to bundle and multipath. Signed-off-by: wenxu <wenxu@ucloud.cn> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofproto: Return the OFPC_BUNDLES bit in switch features reply.Jarno Rajahalme2016-11-141-0/+6
| | | | | | | | | Add definitions for the OpenFlow 1.4.1/1.5 specific capabilities bits OFPC14_BUNDLES and OFPC14_FLOW_MONITORING. Return the bundles capability bit in switch features reply. Reported-by: Andrej Leitner <andrej.leitner@pantheon.tech> Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* Add OpenFlow command to flush conntrack table entries.Justin Pettit2016-09-231-0/+9
| | | | | Signed-off-by: Justin Pettit <jpettit@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofproto: Add relaxed group_mod command ADD_OR_MODJan Scheurich2016-07-022-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for a new Group Mod command OFPGC_ADD_OR_MOD to OVS for all OpenFlow versions that support groups (OF11 and higher). The new ADD_OR_MOD creates a group that does not yet exist (like ADD) and modifies an existing group (like MODIFY). Rational: In OpenFlow 1.x the Group Mod commands OFPGC_ADD and OFPGC_MODIFY have strict semantics: ADD fails if the group exists, while MODIFY fails if the group does not exist. This requires a controller to exactly know the state of the switch when programming a group in order not run the risk of getting an OFP Error message in response. This is hard to achieve and maintain at all times in view of possible switch and controller restarts or other connection losses between switch and controller. Due to the un-acknowledged nature of the Group Mod message programming groups safely and efficiently at the same time is virtually impossible as the controller has to either query the existence of the group prior to each Group Mod message or to insert a Barrier Request/Reply after every group to be sure that no Error can be received at a later stage and require a complicated roll-back of any dependent actions taken between the failed Group Mod and the Error. In the ovs-ofctl command line the ADD_OR_MOD command is made available through the new option --may-create in the mod-group command: $ ovs-ofctl -Oopenflow13 del-groups br-int group_id=100 $ ovs-ofctl -Oopenflow13 mod-group br-int group_id=100,type=indirect,bucket=actions=2 OFPT_ERROR (OF1.3) (xid=0x2): OFPGMFC_UNKNOWN_GROUP OFPT_GROUP_MOD (OF1.3) (xid=0x2): MOD group_id=100,type=indirect,bucket=actions=output:2 $ ovs-ofctl -Oopenflow13 --may-create mod-group br-int group_id=100,type=indirect,bucket=actions=2 $ ovs-ofctl -Oopenflow13 dump-groups br-int OFPST_GROUP_DESC reply (OF1.3) (xid=0x2): group_id=100,type=indirect,bucket=actions=output:2 $ ovs-ofctl -Oopenflow13 --may-create mod-group br-int group_id=100,type=indirect,bucket=actions=3 $ ovs-ofctl -Oopenflow13 dump-groups br-int OFPST_GROUP_DESC reply (OF1.3) (xid=0x2): group_id=100,type=indirect,bucket=actions=output:3 Signed-off-by: Jan Scheurich <jan.scheurich at web.de> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ipfix: Add support for exporting ipfix statistics.Benli Ye2016-06-141-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is meaningful for user to check the stats of IPFIX. Using IPFIX stats, user can know how much flows the system can support. It is also can be used for performance check of IPFIX. IPFIX stats is added for per IPFIX exporter. If bridge IPFIX is enabled on the bridge, the whole bridge will have one exporter. For flow IPFIX, the system keeps per id (column in Flow_Sample_Collector_Set) per exporter. 1) Add 'ovs-ofctl dump-ipfix-bridge SWITCH' to export IPFIX stats of the bridge which enable bridge IPFIX. The output format: NXST_IPFIX_BRIDGE reply (xid=0x2): bridge ipfix: flows=0, current flows=0, sampled pkts=0, \ ipv4 ok=0, ipv6 ok=0, tx pkts=0 pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0 2) Add 'ovs-ofctl dump-ipfix-flow SWITCH' to export IPFIX stats of the bridge which enable flow IPFIX. The output format: NXST_IPFIX_FLOW reply (xid=0x2): 2 ids id 1: flows=4, current flows=4, sampled pkts=14, ipv4 ok=13, \ ipv6 ok=0, tx pkts=0 pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0 id 2: flows=0, current flows=0, sampled pkts=0, ipv4 ok=0, \ ipv6 ok=0, tx pkts=0 pkts errs=0, ipv4 errs=0, ipv6 errs=0, tx errs=0 flows: the number of total flow records, including those exported. current flows: the number of current flow records cached. sampled pkts: Successfully sampled packet count. ipv4 ok: successfully sampled IPv4 flow packet count. ipv6 ok: Successfully sampled IPv6 flow packet count. tx pkts: the count of IPFIX exported packets sent to the collector(s). pkts errs: count of packets failed when sampling, maybe not supported or other error. ipv4 errs: Count of IPV4 flow packet in the error packets. ipv6 errs: Count of IPV6 flow packet in the error packets. tx errs: the count of IPFIX exported packets failed when sending to the collector(s). Signed-off-by: Benli Ye <daniely@vmware.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Add support for extended netdev statistics based on RFC 2819.mweglicx2016-05-063-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-2/+3
| | | | | Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Ryan Moats <rmoats@us.ibm.com>
* Implement OFPT_TABLE_STATUS Message.Saloni Jain2016-02-241-0/+8
| | | | | | | | | | | | | | 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-2/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/+1
| | | | | Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* Implement new packet-in format NXT_PACKET_IN2.Ben Pfaff2016-02-191-4/+39
| | | | | Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* ofp-msgs: Move most OpenFlow header definitions here.Ben Pfaff2016-02-193-39/+1
| | | | | | | | This code was the only user for OpenFlow header definitions other than struct ofp_header itself. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* ofp-msgs: Add support for ONF extension messages.Ben Pfaff2016-02-193-38/+0
| | | | | | | | | | | | | | | ONF introduced a number of "standard extensions" that use its own vendor (experimenter) ID. This commit adds support for such extensions to ofp-msgs. These extensions were already half-supported, so there's barely any change to build-aux/extract-ofp-msgs. This isn't fully tested, since nothing adds support for such a message yet. Requested-by: Jarno Rajahalme <jarno@ovn.org> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* openflow-common: Describe length and padding rules for OpenFlow properties.Ben Pfaff2016-02-161-0/+6
| | | | | | | I keep having to rediscover these from the code. This is easier. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Joe Stringer <joe@ovn.org>
* openflow: Better abstract handling of packet-in messages.Ben Pfaff2016-01-201-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* openflow: Get rid of struct ofp13_packet_in.Ben Pfaff2016-01-201-20/+1
| | | | | | | | | It's actually harder to parse OF1.2/OF1.3 "packet-in" messages when ofp13_packet_in is involved than when the code just realizes that ofp13_packet_in = ofp12_packet_in + cookie. 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-22/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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-1/+23
| | | | | | | 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>
* openflow: Implement OF1.4+ OFPMP_QUEUE_DESC multipart message.Ben Pfaff2016-01-201-0/+25
| | | | | | | | | | | | | | | | | | 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>
* openflow: Remove unused (and not useful) property headers.Ben Pfaff2016-01-202-127/+0
| | | | | | | | These are all just copies of the otherwise generic ofp_prop_header or ofp_prop_experimenter. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* ofp-prop: Add generic functions for working with 16- and 32-bit properties.Ben Pfaff2016-01-202-45/+0
| | | | | | | These will see increasing use in upcoming commits. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* ofp-prop: New module for working with OpenFlow 1.3+ properties.Ben Pfaff2016-01-201-0/+28
| | | | | | | | | | | | | Several OpenFlow 1.3+ messages use TLV-based properties that take a common form. Until now, ofp-util has had some static functions for dealing with properties. Because properties will start to be needed outside of ofp-util, this commit breaks them out into a new library, renaming them to begin with ofpprop_. The following commit will add a few new interfaces that add new functionality. Signed-off-by: Ben Pfaff <blp@ovn.org>
* openflow: Rename OF0.1-1.3 queue property constants.Ben Pfaff2016-01-202-24/+36
| | | | | | | | | | | | | | | At first glance, OF1.4 queue properties look a lot like those for OF1.0 to OF1.3, but in fact their different padding makes them incompatible. In addition, OF1.4 switches from using regular OpenFlow messages to request queue properties, to using multipart messages. Thus, we really need to use separate code to deal with OF1.4 queues. OF1.0, OF1.1, and OF1.2 all have slightly different queue config reply messages, but only OF1.0 and OF1.2 had tests, so this adds tests. (There is no test for OF1.3 because it's the same as OF1.2.) Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* openflow-1.2: Remove unused struct definition.Ben Pfaff2016-01-191-9/+0
| | | | | | | | Experimenter stats are handled by code in ofp-msgs, and this struct isn't good for anything. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* ofp-msgs: Fix definitions of OF1.4 OFPT_GET_ASYNC_REPLY and OFPT_SET_ASYNC.Ben Pfaff2016-01-191-11/+0
| | | | | | | | | | | | | | The structures declared in ofp-msgs.h for messages definitions should not include an OpenFlow header (its presence is implied), but the definition of these messages did. This commit fixes the definitions. The visible bug was really minor here: messages of these kinds without any TLVs would be rejected by the OpenFlow parser. But OVS never sends these messages without TLVs, so probably no one ever noticed this. (Also, the OVS support for OF1.4 is still incomplete and experimental.) Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* geneve-map-rename: rename geneve-map to tlv-map.Mengke Liu2015-12-151-37/+49
| | | | | | | | | | | | | | | | | | 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-302-1/+5
| | | | | | | | | | 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>
* openflow: Remove OFPG11_*Jarno Rajahalme2015-11-241-16/+2
| | | | | | | | | 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>
* openflow-common: Correct Netronome vendor ID.Simon Horman2015-09-301-1/+2
| | | | | | | | | Due to an error on my part the Netronome vendor Id is incorrect: the last digit should be 'd' rather than '0' as per the Netronome IEEE OUI. Signed-off-by: Simon Horman <simon.horman@netronome.com> Signed-off-by: Ben Pfaff <blp@nicira.com>