From patchwork Mon Jul 6 20:35:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1323940 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4B0y9g57CSz9sRK for ; Tue, 7 Jul 2020 06:39:51 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id D64BB88B66; Mon, 6 Jul 2020 20:39:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TRhI6QwrbEQE; Mon, 6 Jul 2020 20:38:14 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 9FB6D88BB9; Mon, 6 Jul 2020 20:38:14 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4EC66C08A0; Mon, 6 Jul 2020 20:38:14 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 523C6C18DA for ; Mon, 6 Jul 2020 20:38:11 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 35DED2594B for ; Mon, 6 Jul 2020 20:37:28 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yHqCN45qF3cc for ; Mon, 6 Jul 2020 20:35:31 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by silver.osuosl.org (Postfix) with ESMTPS id 437AB20360 for ; Mon, 6 Jul 2020 20:35:30 +0000 (UTC) Received: from sigfpe.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay11.mail.gandi.net (Postfix) with ESMTPSA id D0232100002; Mon, 6 Jul 2020 20:35:26 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Mon, 6 Jul 2020 13:35:17 -0700 Message-Id: <20200706203521.719453-2-blp@ovn.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200706203521.719453-1-blp@ovn.org> References: <20200706203521.719453-1-blp@ovn.org> MIME-Version: 1.0 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH v2 1/5] Eliminate use of term "slave" in bond, LACP, and bundle contexts. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Most of these changes should not change user-visible behavior. One place where they do is in "ovs-ofctl dump-flows", which will now output "subs:..." inside "bundle" actions instead of "slaves:...". I don't expect this to cause real problems in most systems. The old syntax is still supported on input for backward compatibility. Signed-off-by: Ben Pfaff --- Documentation/topics/bonding.rst | 177 +++---- Documentation/topics/porting.rst | 4 +- NEWS | 5 +- debian/changelog | 2 +- debian/ifupdown.sh | 4 +- include/openvswitch/ofp-actions.h | 28 +- lib/bundle.c | 100 ++-- lib/bundle.h | 4 +- lib/cfm.c | 2 +- lib/lacp.c | 542 ++++++++++---------- lib/lacp.h | 23 +- lib/lldp/lldp-const.h | 16 +- lib/lldp/lldpd-structs.h | 10 +- lib/mac-learning.c | 17 +- lib/mac-learning.h | 2 +- lib/netdev-linux.c | 22 +- lib/ofp-actions.c | 84 ++-- lib/ovs-actions.xml | 35 +- lib/rtnetlink.c | 16 +- lib/rtnetlink.h | 6 +- lib/unixctl.c | 6 +- ofproto/bond.c | 786 +++++++++++++++--------------- ofproto/bond.h | 28 +- ofproto/ofproto-dpif-rid.h | 4 +- ofproto/ofproto-dpif-sflow.c | 2 +- ofproto/ofproto-dpif-xlate.c | 21 +- ofproto/ofproto-dpif.c | 45 +- ofproto/ofproto-provider.h | 12 +- ofproto/ofproto.c | 6 +- ofproto/ofproto.h | 10 +- tests/bundle.at | 48 +- tests/lacp.at | 130 ++--- tests/ofp-actions.at | 28 +- tests/ofproto-dpif.at | 6 +- tests/ofproto.at | 4 +- tests/ovs-ofctl.at | 56 +-- tests/test-bundle.c | 112 ++--- vswitchd/bridge.c | 34 +- vswitchd/ovs-vswitchd.8.in | 42 +- vswitchd/vswitch.xml | 31 +- 40 files changed, 1271 insertions(+), 1239 deletions(-) diff --git a/Documentation/topics/bonding.rst b/Documentation/topics/bonding.rst index ac39fd18bfac..68746456185c 100644 --- a/Documentation/topics/bonding.rst +++ b/Documentation/topics/bonding.rst @@ -25,22 +25,24 @@ Bonding ======= -Bonding allows two or more interfaces (the "slaves") to share network traffic. -From a high-level point of view, bonded interfaces act like a single port, but -they have the bandwidth of multiple network devices, e.g. two 1 GB physical +Bonding allows two or more interfaces, its "sub-interfaces" ("subs" for short +or, in context, just "interfaces"), to share network traffic. From a +high-level point of view, bonded interfaces act like a single port, but they +have the bandwidth of multiple network devices, e.g. two 1 GB physical interfaces act like a single 2 GB interface. Bonds also increase robustness: -the bonded port does not go down as long as at least one of its slaves is up. +the bonded port does not go down as long as at least one of its sub-interfaces +is up. -In vswitchd, a bond always has at least two slaves (and may have more). If a -configuration error, etc. would cause a bond to have only one slave, the port -becomes an ordinary port, not a bonded port, and none of the special features -of bonded ports described in this section apply. +In vswitchd, a bond always has at least two sub-interfaces (and may have more). +If a configuration error, etc. would cause a bond to have only one +sub-interface, the port becomes an ordinary port, not a bonded port, and none +of the special features of bonded ports described in this section apply. There are many forms of bonding of which ovs-vswitchd implements only a few. The most complex bond ovs-vswitchd implements is called "source load balancing" -or SLB bonding. SLB bonding divides traffic among the slaves based on the -Ethernet source address. This is useful only if the traffic over the bond has -multiple Ethernet source addresses, for example if network traffic from +or SLB bonding. SLB bonding divides traffic among the sub-interfaces based on +the Ethernet source address. This is useful only if the traffic over the bond +has multiple Ethernet source addresses, for example if network traffic from multiple VMs are multiplexed over the bond. .. note:: @@ -50,89 +52,90 @@ multiple VMs are multiplexed over the bond. specified. -Enabling and Disabling Slaves ------------------------------ +Enabling and Disabling Sub-Interfaces +------------------------------------- -When a bond is created, a slave is initially enabled or disabled based on -whether carrier is detected on the NIC (see ``iface_create()``). After that, a -slave is disabled if its carrier goes down for a period of time longer than the -downdelay, and it is enabled if carrier comes up for longer than the updelay -(see ``bond_link_status_update()``). There is one exception where the updelay -is skipped: if no slaves at all are currently enabled, then the first slave on -which carrier comes up is enabled immediately. +When a bond is created, a sub-interface is initially enabled or disabled based +on whether carrier is detected on the NIC (see ``iface_create()``). After +that, a sub-interface is disabled if its carrier goes down for a period of time +longer than the downdelay, and it is enabled if carrier comes up for longer +than the updelay (see ``bond_link_status_update()``). There is one exception +where the updelay is skipped: if no sub-interfaces at all are currently +enabled, then the first sub-interface on which carrier comes up is enabled +immediately. The updelay should be set to a time longer than the STP forwarding delay of the physical switch to which the bond port is connected (if STP is enabled on that -switch). Otherwise, the slave will be enabled, and load may be shifted to it, -before the physical switch starts forwarding packets on that port, which can -cause some data to be "blackholed" for a time. The exception for a single -enabled slave does not cause any problem in this regard because when no slaves -are enabled all output packets are blackholed anyway. - -When a slave becomes disabled, the vswitch immediately chooses a new output -port for traffic that was destined for that slave (see -``bond_enable_slave()``). It also sends a "gratuitous learning packet", -specifically a RARP, on the bond port (on the newly chosen slave) for each MAC -address that the vswitch has learned on a port other than the bond (see -``bundle_send_learning_packets()``), to teach the physical switch that the new -slave should be used in place of the one that is now disabled. (This behavior -probably makes sense only for a vswitch that has only one port (the bond) -connected to a physical switch; vswitchd should probably provide a way to -disable or configure it in other scenarios.) +switch). Otherwise, the sub-interface will be enabled, and load may be shifted +to it, before the physical switch starts forwarding packets on that port, which +can cause some data to be dropped for a time. The exception for a single +enabled sub-interface does not cause any problem in this regard because when no +sub-interfaces are enabled all output packets are dropped anyway. + +When a sub-interface becomes disabled, the vswitch immediately chooses a new +output port for traffic that was destined for that sub-interface (see +``bond_enable_sub()``). It also sends a "gratuitous learning packet", +specifically a RARP, on the bond port (on the newly chosen sub-interface) for +each MAC address that the vswitch has learned on a port other than the bond +(see ``bundle_send_learning_packets()``), to teach the physical switch that the +new sub-interface should be used in place of the one that is now disabled. +(This behavior probably makes sense only for a vswitch that has only one port +(the bond) connected to a physical switch; vswitchd should probably provide a +way to disable or configure it in other scenarios.) Bond Packet Input ----------------- -Bonding accepts unicast packets on any bond slave. This can occasionally cause -packet duplication for the first few packets sent to a given MAC, if the +Bonding accepts unicast packets on any sub-interface. This can occasionally +cause packet duplication for the first few packets sent to a given MAC, if the physical switch attached to the bond is flooding packets to that MAC because it -has not yet learned the correct slave for that MAC. +has not yet learned the correct sub-interface for that MAC. -Bonding only accepts multicast (and broadcast) packets on a single bond slave -(the "active slave") at any given time. Multicast packets received on other -slaves are dropped. Otherwise, every multicast packet would be duplicated, -once for every bond slave, because the physical switch attached to the bond -will flood those packets. +Bonding only accepts multicast (and broadcast) packets on a single bond +sub-interface (the "active sub-interface") at any given time. Multicast +packets received on other sub-interfaces are dropped. Otherwise, every +multicast packet would be duplicated, once for every bond sub-interface, +because the physical switch attached to the bond will flood those packets. Bonding also drops received packets when the vswitch has learned that the packet's MAC is on a port other than the bond port itself. This is because it is likely that the vswitch itself sent the packet out the bond port on a -different slave and is now receiving the packet back. This occurs when the -packet is multicast or the physical switch has not yet learned the MAC and is -flooding it. However, the vswitch makes an exception to this rule for +different sub-interface and is now receiving the packet back. This occurs when +the packet is multicast or the physical switch has not yet learned the MAC and +is flooding it. However, the vswitch makes an exception to this rule for broadcast ARP replies, which indicate that the MAC has moved to another switch, probably due to VM migration. (ARP replies are normally unicast, so this exception does not match normal ARP replies. It will match the learning packets sent on bond fail-over.) -The active slave is simply the first slave to be enabled after the bond is -created (see ``bond_choose_active_slave()``). If the active slave is disabled, -then a new active slave is chosen among the slaves that remain active. -Currently due to the way that configuration works, this tends to be the -remaining slave whose interface name is first alphabetically, but this is by no -means guaranteed. +The active sub-interface is simply the first sub-interface to be enabled after +the bond is created (see ``bond_choose_active_sub()``). If the active +sub-interface is disabled, then a new active sub-interface is chosen among the +sub-interfaces that remain active. Currently due to the way that configuration +works, this tends to be the remaining sub-interface whose interface name is +first alphabetically, but this is by no means guaranteed. Bond Packet Output ------------------ -When a packet is sent out a bond port, the bond slave actually used is selected -based on the packet's source MAC and VLAN tag (see ``bond_choose_output_slave()``). -In particular, the source MAC and VLAN tag are hashed into one of 256 values, -and that value is looked up in a hash table (the "bond hash") kept in the -``bond_hash`` member of struct port. The hash table entry identifies a bond -slave. If no bond slave has yet been chosen for that hash table entry, -vswitchd chooses one arbitrarily. - -Every 10 seconds, vswitchd rebalances the bond slaves (see -``bond_rebalance()``). To rebalance, vswitchd examines the statistics for -the number of bytes transmitted by each slave over approximately the past +When a packet is sent out a bond port, the bond sub-interface actually used is +selected based on the packet's source MAC and VLAN tag (see +``bond_choose_output_sub()``). In particular, the source MAC and VLAN tag are +hashed into one of 256 values, and that value is looked up in a hash table (the +"bond hash") kept in the ``bond_hash`` member of struct port. The hash table +entry identifies a bond sub-interface. If no bond sub-interface has yet been +chosen for that hash table entry, vswitchd chooses one arbitrarily. + +Every 10 seconds, vswitchd rebalances the bond sub-interfaces (see +``bond_rebalance()``). To rebalance, vswitchd examines the statistics for the +number of bytes transmitted by each sub-interface over approximately the past minute, with data sent more recently weighted more heavily than data sent less -recently. It considers each of the slaves in order from most-loaded to -least-loaded. If highly loaded slave H is significantly more heavily loaded -than the least-loaded slave L, and slave H carries at least two hashes, then -vswitchd shifts one of H's hashes to L. However, vswitchd will only shift a -hash from H to L if it will decrease the ratio of the load between H and L by -at least 0.1. +recently. It considers each of the sub-interfaces in order from most-loaded to +least-loaded. If highly loaded sub-interface H is significantly more heavily +loaded than the least-loaded sub-interface L, and sub-interface H carries at +least two hashes, then vswitchd shifts one of H's hashes to L. However, +vswitchd will only shift a hash from H to L if it will decrease the ratio of +the load between H and L by at least 0.1. Currently, "significantly more loaded" means that H must carry at least 1 Mbps more traffic, and that traffic must be at least 3% greater than L's. @@ -166,11 +169,11 @@ behavior on Open vSwitch. Active Backup Bonding ~~~~~~~~~~~~~~~~~~~~~ -Active Backup bonds send all traffic out one "active" slave until that slave -becomes unavailable. Since they are significantly less complicated than SLB -bonds, they are preferred when LACP is not an option. Additionally, they are -the only bond mode which supports attaching each slave to a different upstream -switch. +Active Backup bonds send all traffic out one "active" sub-interface until that +sub-interface becomes unavailable. Since they are significantly less +complicated than SLB bonds, they are preferred when LACP is not an option. +Additionally, they are the only bond mode which supports attaching each +sub-interface to a different upstream switch. SLB Bonding ~~~~~~~~~~~ @@ -195,15 +198,15 @@ SLB bonding has the following complications: This would cause packet duplication if not handled specially. Open vSwitch avoids packet duplication by accepting multicast and broadcast - packets on only the active slave, and dropping multicast and broadcast - packets on all other slaves. + packets on only the active sub-interface, and dropping multicast and + broadcast packets on all other sub-interfaces. 2. When Open vSwitch forwards a multicast or broadcast packet to a link in the - SLB bond other than the active slave, the remote switch will forward it to - all of the other links in the SLB bond, including the active slave. Without - special handling, this would mean that Open vSwitch would forward a second - copy of the packet to each switch port (other than the bond), including the - port that originated the packet. + SLB bond other than the active sub-interface, the remote switch will forward + it to all of the other links in the SLB bond, including the active + sub-interface. Without special handling, this would mean that Open vSwitch + would forward a second copy of the packet to each switch port (other than + the bond), including the port that originated the packet. Open vSwitch deals with this case by dropping packets received on any SLB bonded link that have a source MAC+VLAN that has been learned on any other @@ -226,11 +229,11 @@ SLB bonding has the following complications: 4. Suppose that a MAC+VLAN moves from an SLB bond to another port (e.g. when a VM is migrated from a different hypervisor to this one), that the MAC+VLAN emits a gratuitous ARP, and that Open vSwitch forwards that gratuitous ARP - to a link in the SLB bond other than the active slave. The remote switch - will forward the gratuitous ARP to all of the other links in the SLB bond, - including the active slave. Without additional special handling, this would - mean that Open vSwitch would learn that the MAC+VLAN was located on the SLB - bond, as a consequence of rule #3. + to a link in the SLB bond other than the active sub-interface. The remote + switch will forward the gratuitous ARP to all of the other links in the SLB + bond, including the active sub-interface. Without additional special + handling, this would mean that Open vSwitch would learn that the MAC+VLAN + was located on the SLB bond, as a consequence of rule #3. Open vSwitch avoids this problem by "locking" the MAC learning table entry for a MAC+VLAN from which a gratuitous ARP was received from a non-SLB bond diff --git a/Documentation/topics/porting.rst b/Documentation/topics/porting.rst index b327b2b0d2ee..8c6d1c8e1fb3 100644 --- a/Documentation/topics/porting.rst +++ b/Documentation/topics/porting.rst @@ -42,8 +42,8 @@ concordance, indexed by the area of the source tree: datapath/ vport --- vswitchd/ iface port ofproto/ port bundle - ofproto/bond.c slave bond - lib/lacp.c slave lacp + ofproto/bond.c sub-interface bond + lib/lacp.c sub-interface lacp lib/netdev.c netdev --- database Interface Port diff --git a/NEWS b/NEWS index 0116b3ea087f..1157a1d19170 100644 --- a/NEWS +++ b/NEWS @@ -23,6 +23,9 @@ Post-v2.13.0 - Tunnels: TC Flower offload * Tunnel Local endpoint address masked match are supported. * Tunnel Romte endpoint address masked match are supported. + - Terminology: + * The term "slave" has been replaced by "sub-interface", "sub" for short, + in the contexts of bonds, LACP, and OpenFlow bundle actions. v2.13.0 - 14 Feb 2020 @@ -799,7 +802,7 @@ v2.4.0 - 20 Aug 2015 The implementation has been tested successfully against the Ixia Automated Network Validation Library (ANVL). - Stats are no longer updated on fake bond interface. - - Keep active bond slave selection across OVS restart. + - Keep active bond interface selection across OVS restart. - A simple wrapper script, 'ovs-docker', to integrate OVS with Docker containers. If and when there is a native integration of Open vSwitch with Docker, the wrapper script will be retired. diff --git a/debian/changelog b/debian/changelog index d5c1db839734..39424a7bc46d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -382,7 +382,7 @@ openvswitch (2.4.0-1) unstable; urgency=low The implementation has been tested successfully against the Ixia Automated Network Validation Library (ANVL). - Stats are no longer updated on fake bond interface. - - Keep active bond slave selection across OVS restart. + - Keep active bond interface selection across OVS restart. - A simple wrapper script, 'ovs-docker', to integrate OVS with Docker containers. If and when there is a native integration of Open vSwitch with Docker, the wrapper script will be retired. diff --git a/debian/ifupdown.sh b/debian/ifupdown.sh index 9a7772d032ba..e5a61375c49c 100755 --- a/debian/ifupdown.sh +++ b/debian/ifupdown.sh @@ -65,9 +65,9 @@ if [ "${MODE}" = "start" ]; then ${OVS_EXTRA+-- $OVS_EXTRA} ip link set "${IFACE}" up - for slave in ${IF_OVS_BONDS} + for sub in ${IF_OVS_BONDS} do - ip link set "${slave}" up + ip link set "${sub}" up done ;; OVSPatchPort) diff --git a/include/openvswitch/ofp-actions.h b/include/openvswitch/ofp-actions.h index 226e86d0b0a5..e4a3f7c4f6f1 100644 --- a/include/openvswitch/ofp-actions.h +++ b/include/openvswitch/ofp-actions.h @@ -66,7 +66,7 @@ struct vl_mff_map; OFPACT(CONTROLLER, ofpact_controller, userdata, "controller") \ OFPACT(ENQUEUE, ofpact_enqueue, ofpact, "enqueue") \ OFPACT(OUTPUT_REG, ofpact_output_reg, ofpact, "output_reg") \ - OFPACT(BUNDLE, ofpact_bundle, slaves, "bundle") \ + OFPACT(BUNDLE, ofpact_bundle, subs, "bundle") \ \ /* Header changes. */ \ OFPACT(SET_FIELD, ofpact_set_field, ofpact, "set_field") \ @@ -364,24 +364,24 @@ struct ofpact_output_trunc { ); }; -/* Bundle slave choice algorithm to apply. +/* Bundle sub choice algorithm to apply. * - * In the descriptions below, 'slaves' is the list of possible slaves in the + * In the descriptions below, 'subs' is the list of possible subs in the * order they appear in the OpenFlow action. */ enum nx_bd_algorithm { - /* Chooses the first live slave listed in the bundle. + /* Chooses the first live sub listed in the bundle. * - * O(n_slaves) performance. */ + * O(n_subs) performance. */ NX_BD_ALG_ACTIVE_BACKUP = 0, /* Highest Random Weight. * - * for i in [0,n_slaves): + * for i in [0,n_subs): * weights[i] = hash(flow, i) - * slave = { slaves[i] such that weights[i] >= weights[j] for all j != i } + * sub = { subs[i] such that weights[i] >= weights[j] for all j != i } * - * Redistributes 1/n_slaves of traffic when a slave's liveness changes. - * O(n_slaves) performance. + * Redistributes 1/n_subs of traffic when a sub's liveness changes. + * O(n_subs) performance. * * Uses the 'fields' and 'basis' parameters. */ NX_BD_ALG_HRW = 1 @@ -394,7 +394,7 @@ struct ofpact_bundle { OFPACT_PADDED_MEMBERS( struct ofpact ofpact; - /* Slave choice algorithm to apply to hash value. */ + /* Sub choice algorithm to apply to hash value. */ enum nx_bd_algorithm algorithm; /* What fields to hash and how. */ @@ -403,10 +403,12 @@ struct ofpact_bundle { struct mf_subfield dst; - /* Slaves for output. */ - unsigned int n_slaves; + bool compat_syntax; + + /* Subs for output. */ + unsigned int n_subs; ); - ofp_port_t slaves[]; + ofp_port_t subs[]; }; /* OFPACT_SET_VLAN_VID. diff --git a/lib/bundle.c b/lib/bundle.c index edb11f6bebfa..53cb0c766115 100644 --- a/lib/bundle.c +++ b/lib/bundle.c @@ -39,14 +39,14 @@ VLOG_DEFINE_THIS_MODULE(bundle); static ofp_port_t execute_ab(const struct ofpact_bundle *bundle, - bool (*slave_enabled)(ofp_port_t ofp_port, void *aux), void *aux) + bool (*sub_enabled)(ofp_port_t ofp_port, void *aux), void *aux) { size_t i; - for (i = 0; i < bundle->n_slaves; i++) { - ofp_port_t slave = bundle->slaves[i]; - if (slave_enabled(slave, aux)) { - return slave; + for (i = 0; i < bundle->n_subs; i++) { + ofp_port_t sub = bundle->subs[i]; + if (sub_enabled(sub, aux)) { + return sub; } } @@ -56,12 +56,12 @@ execute_ab(const struct ofpact_bundle *bundle, static ofp_port_t execute_hrw(const struct ofpact_bundle *bundle, const struct flow *flow, struct flow_wildcards *wc, - bool (*slave_enabled)(ofp_port_t ofp_port, void *aux), void *aux) + bool (*sub_enabled)(ofp_port_t ofp_port, void *aux), void *aux) { uint32_t flow_hash, best_hash; int best, i; - if (bundle->n_slaves > 1) { + if (bundle->n_subs > 1) { flow_mask_hash_fields(flow, wc, bundle->fields); } @@ -69,8 +69,8 @@ execute_hrw(const struct ofpact_bundle *bundle, best = -1; best_hash = 0; - for (i = 0; i < bundle->n_slaves; i++) { - if (slave_enabled(bundle->slaves[i], aux)) { + for (i = 0; i < bundle->n_subs; i++) { + if (sub_enabled(bundle->subs[i], aux)) { uint32_t hash = hash_2words(i, flow_hash); if (best < 0 || hash > best_hash) { @@ -80,25 +80,25 @@ execute_hrw(const struct ofpact_bundle *bundle, } } - return best >= 0 ? bundle->slaves[best] : OFPP_NONE; + return best >= 0 ? bundle->subs[best] : OFPP_NONE; } /* Executes 'bundle' on 'flow'. Sets fields in 'wc' that were used to - * calculate the result. Uses 'slave_enabled' to determine if the slave - * designated by 'ofp_port' is up. Returns the chosen slave, or - * OFPP_NONE if none of the slaves are acceptable. */ + * calculate the result. Uses 'sub_enabled' to determine if the sub + * designated by 'ofp_port' is up. Returns the chosen sub, or + * OFPP_NONE if none of the subs are acceptable. */ ofp_port_t bundle_execute(const struct ofpact_bundle *bundle, const struct flow *flow, struct flow_wildcards *wc, - bool (*slave_enabled)(ofp_port_t ofp_port, void *aux), + bool (*sub_enabled)(ofp_port_t ofp_port, void *aux), void *aux) { switch (bundle->algorithm) { case NX_BD_ALG_HRW: - return execute_hrw(bundle, flow, wc, slave_enabled, aux); + return execute_hrw(bundle, flow, wc, sub_enabled, aux); case NX_BD_ALG_ACTIVE_BACKUP: - return execute_ab(bundle, slave_enabled, aux); + return execute_ab(bundle, sub_enabled, aux); default: OVS_NOT_REACHED(); @@ -119,21 +119,21 @@ bundle_check(const struct ofpact_bundle *bundle, ofp_port_t max_ports, } } - for (i = 0; i < bundle->n_slaves; i++) { - ofp_port_t ofp_port = bundle->slaves[i]; + for (i = 0; i < bundle->n_subs; i++) { + ofp_port_t ofp_port = bundle->subs[i]; if (ofp_port != OFPP_NONE) { enum ofperr error = ofpact_check_output_port(ofp_port, max_ports); if (error) { - VLOG_WARN_RL(&rl, "invalid slave %"PRIu32, ofp_port); + VLOG_WARN_RL(&rl, "invalid sub %"PRIu32, ofp_port); return error; } } - /* Controller slaves are unsupported due to the lack of a max_len + /* Controller subs are unsupported due to the lack of a max_len * argument. This may or may not change in the future. There doesn't * seem to be a real-world use-case for supporting it. */ if (ofp_port == OFPP_CONTROLLER) { - VLOG_WARN_RL(&rl, "unsupported controller slave"); + VLOG_WARN_RL(&rl, "unsupported controller sub"); return OFPERR_OFPBAC_BAD_OUT_PORT; } } @@ -150,38 +150,38 @@ static char * OVS_WARN_UNUSED_RESULT bundle_parse__(const char *s, const struct ofputil_port_map *port_map, char **save_ptr, const char *fields, const char *basis, const char *algorithm, - const char *slave_type, const char *dst, - const char *slave_delim, struct ofpbuf *ofpacts) + const char *sub_type, const char *dst, + const char *sub_delim, struct ofpbuf *ofpacts) { struct ofpact_bundle *bundle; - if (!slave_delim) { + if (!sub_delim) { return xasprintf("%s: not enough arguments to bundle action", s); } - if (strcasecmp(slave_delim, "slaves")) { - return xasprintf("%s: missing slave delimiter, expected `slaves' " - "got `%s'", s, slave_delim); + if (strcasecmp(sub_delim, "subs") && strcasecmp(sub_delim, "slaves")) { + return xasprintf("%s: missing sub delimiter, expected `subs', " + "got `%s'", s, sub_delim); } bundle = ofpact_put_BUNDLE(ofpacts); for (;;) { - ofp_port_t slave_port; - char *slave; + ofp_port_t sub_port; + char *sub; - slave = strtok_r(NULL, ", []", save_ptr); - if (!slave || bundle->n_slaves >= BUNDLE_MAX_SLAVES) { + sub = strtok_r(NULL, ", []", save_ptr); + if (!sub || bundle->n_subs >= BUNDLE_MAX_SUBS) { break; } - if (!ofputil_port_from_string(slave, port_map, &slave_port)) { - return xasprintf("%s: bad port number", slave); + if (!ofputil_port_from_string(sub, port_map, &sub_port)) { + return xasprintf("%s: bad port number", sub); } - ofpbuf_put(ofpacts, &slave_port, sizeof slave_port); + ofpbuf_put(ofpacts, &sub_port, sizeof sub_port); bundle = ofpacts->header; - bundle->n_slaves++; + bundle->n_subs++; } if (ofpbuf_oversized(ofpacts)) { @@ -217,8 +217,8 @@ bundle_parse__(const char *s, const struct ofputil_port_map *port_map, return xasprintf("%s: unknown algorithm `%s'", s, algorithm); } - if (strcasecmp(slave_type, "ofport")) { - return xasprintf("%s: unknown slave_type `%s'", s, slave_type); + if (strcasecmp(sub_type, "ofport")) { + return xasprintf("%s: unknown sub_type `%s'", s, sub_type); } if (dst) { @@ -245,7 +245,7 @@ char * OVS_WARN_UNUSED_RESULT bundle_parse(const char *s, const struct ofputil_port_map *port_map, struct ofpbuf *ofpacts) { - char *fields, *basis, *algorithm, *slave_type, *slave_delim; + char *fields, *basis, *algorithm, *sub_type, *sub_delim; char *tokstr, *save_ptr; char *error; @@ -254,12 +254,12 @@ bundle_parse(const char *s, const struct ofputil_port_map *port_map, fields = strtok_r(tokstr, ", ", &save_ptr); basis = strtok_r(NULL, ", ", &save_ptr); algorithm = strtok_r(NULL, ", ", &save_ptr); - slave_type = strtok_r(NULL, ", ", &save_ptr); - slave_delim = strtok_r(NULL, ": ", &save_ptr); + sub_type = strtok_r(NULL, ", ", &save_ptr); + sub_delim = strtok_r(NULL, ": ", &save_ptr); error = bundle_parse__(s, port_map, - &save_ptr, fields, basis, algorithm, slave_type, - NULL, slave_delim, ofpacts); + &save_ptr, fields, basis, algorithm, sub_type, + NULL, sub_delim, ofpacts); free(tokstr); return error; @@ -274,7 +274,7 @@ char * OVS_WARN_UNUSED_RESULT bundle_parse_load(const char *s, const struct ofputil_port_map *port_map, struct ofpbuf *ofpacts) { - char *fields, *basis, *algorithm, *slave_type, *dst, *slave_delim; + char *fields, *basis, *algorithm, *sub_type, *dst, *sub_delim; char *tokstr, *save_ptr; char *error; @@ -283,13 +283,13 @@ bundle_parse_load(const char *s, const struct ofputil_port_map *port_map, fields = strtok_r(tokstr, ", ", &save_ptr); basis = strtok_r(NULL, ", ", &save_ptr); algorithm = strtok_r(NULL, ", ", &save_ptr); - slave_type = strtok_r(NULL, ", ", &save_ptr); + sub_type = strtok_r(NULL, ", ", &save_ptr); dst = strtok_r(NULL, ", ", &save_ptr); - slave_delim = strtok_r(NULL, ": ", &save_ptr); + sub_delim = strtok_r(NULL, ": ", &save_ptr); error = bundle_parse__(s, port_map, - &save_ptr, fields, basis, algorithm, slave_type, - dst, slave_delim, ofpacts); + &save_ptr, fields, basis, algorithm, sub_type, + dst, sub_delim, ofpacts); free(tokstr); @@ -328,13 +328,13 @@ bundle_format(const struct ofpact_bundle *bundle, ds_put_char(s, ','); } - ds_put_format(s, "%sslaves:%s", colors.param, colors.end); - for (i = 0; i < bundle->n_slaves; i++) { + ds_put_format(s, "%ssubs:%s", colors.param, colors.end); + for (i = 0; i < bundle->n_subs; i++) { if (i) { ds_put_char(s, ','); } - ofputil_format_port(bundle->slaves[i], port_map, s); + ofputil_format_port(bundle->subs[i], port_map, s); } ds_put_format(s, "%s)%s", colors.paren, colors.end); diff --git a/lib/bundle.h b/lib/bundle.h index 85a2e861d367..496eda3a5821 100644 --- a/lib/bundle.h +++ b/lib/bundle.h @@ -40,11 +40,11 @@ struct ofputil_port_map; * * See lib/ofp-actions.c for NXAST_BUNDLE specification. */ -#define BUNDLE_MAX_SLAVES 2048 +#define BUNDLE_MAX_SUBS 2048 ofp_port_t bundle_execute(const struct ofpact_bundle *, const struct flow *, struct flow_wildcards *wc, - bool (*slave_enabled)(ofp_port_t ofp_port, void *aux), + bool (*sub_enabled)(ofp_port_t ofp_port, void *aux), void *aux); enum ofperr bundle_check(const struct ofpact_bundle *, ofp_port_t max_ports, const struct match *); diff --git a/lib/cfm.c b/lib/cfm.c index 71d2c02067e0..1a9f52b45b16 100644 --- a/lib/cfm.c +++ b/lib/cfm.c @@ -780,7 +780,7 @@ cfm_process_heartbeat(struct cfm *cfm, const struct dp_packet *p) * * Faults can cause a controller or Open vSwitch to make potentially * expensive changes to the network topology. It seems prudent to trigger - * them judiciously, especially when CFM is used to check slave status of + * them judiciously, especially when CFM is used to check sub status of * bonds. Furthermore, faults can be maliciously triggered by crafting * unexpected CCMs. */ if (memcmp(ccm->maid, cfm->maid, sizeof ccm->maid)) { diff --git a/lib/lacp.c b/lib/lacp.c index 705d88f5047a..4c95afb18e6d 100644 --- a/lib/lacp.c +++ b/lib/lacp.c @@ -92,12 +92,13 @@ enum pdu_subtype { SUBTYPE_MARKER, /* Link Aggregation Marker Protocol. */ }; -enum slave_status { +enum sub_status { LACP_CURRENT, /* Current State. Partner up to date. */ LACP_EXPIRED, /* Expired State. Partner out of date. */ LACP_DEFAULTED, /* Defaulted State. No partner. */ }; +/* A LACP primary interface. */ struct lacp { struct ovs_list node; /* Node in all_lacps list. */ char *name; /* Name of this lacp object. */ @@ -105,8 +106,8 @@ struct lacp { uint16_t sys_priority; /* System Priority. */ bool active; /* Active or Passive. */ - struct hmap slaves; /* Slaves this LACP object controls. */ - struct slave *key_slave; /* Slave whose ID will be the aggregation key. */ + struct hmap subs; /* Subs this LACP object controls. */ + struct sub *key_sub; /* Sub whose ID will be the aggregation key. */ bool fast; /* True if using fast probe interval. */ bool negotiated; /* True if LACP negotiations were successful. */ @@ -116,17 +117,18 @@ struct lacp { struct ovs_refcount ref_cnt; }; -struct slave { - void *aux; /* Handle used to identify this slave. */ - struct hmap_node node; /* Node in master's slaves map. */ +/* A LACP sub-interface. */ +struct sub { + void *aux; /* Handle used to identify this sub. */ + struct hmap_node node; /* Node in primary's subs map. */ - struct lacp *lacp; /* LACP object containing this slave. */ + struct lacp *lacp; /* LACP object containing this sub. */ uint16_t port_id; /* Port ID. */ uint16_t port_priority; /* Port Priority. */ uint16_t key; /* Aggregation Key. 0 if default. */ - char *name; /* Name of this slave. */ + char *name; /* Name of this sub. */ - enum slave_status status; /* Slave status. */ + enum sub_status status; /* Sub status. */ bool attached; /* Attached. Traffic may flow. */ bool carrier_up; /* Carrier state of link. */ struct lacp_info partner; /* Partner information. */ @@ -149,20 +151,20 @@ static struct ovs_list *const all_lacps OVS_GUARDED_BY(mutex) = &all_lacps__; static void lacp_update_attached(struct lacp *) OVS_REQUIRES(mutex); -static void slave_destroy(struct slave *) OVS_REQUIRES(mutex); -static void slave_set_defaulted(struct slave *) OVS_REQUIRES(mutex); -static void slave_set_expired(struct slave *) OVS_REQUIRES(mutex); -static void slave_get_actor(struct slave *, struct lacp_info *actor) +static void sub_destroy(struct sub *) OVS_REQUIRES(mutex); +static void sub_set_defaulted(struct sub *) OVS_REQUIRES(mutex); +static void sub_set_expired(struct sub *) OVS_REQUIRES(mutex); +static void sub_get_actor(struct sub *, struct lacp_info *actor) OVS_REQUIRES(mutex); -static void slave_get_priority(struct slave *, struct lacp_info *priority) +static void sub_get_priority(struct sub *, struct lacp_info *priority) OVS_REQUIRES(mutex); -static bool slave_may_tx(const struct slave *) +static bool sub_may_tx(const struct sub *) OVS_REQUIRES(mutex); -static struct slave *slave_lookup(const struct lacp *, const void *slave) +static struct sub *sub_lookup(const struct lacp *, const void *sub) OVS_REQUIRES(mutex); static bool info_tx_equal(struct lacp_info *, struct lacp_info *) OVS_REQUIRES(mutex); -static bool slave_may_enable__(struct slave *slave) OVS_REQUIRES(mutex); +static bool sub_may_enable__(struct sub *sub) OVS_REQUIRES(mutex); static unixctl_cb_func lacp_unixctl_show; static unixctl_cb_func lacp_unixctl_show_stats; @@ -254,7 +256,7 @@ lacp_create(void) OVS_EXCLUDED(mutex) struct lacp *lacp; lacp = xzalloc(sizeof *lacp); - hmap_init(&lacp->slaves); + hmap_init(&lacp->subs); ovs_refcount_init(&lacp->ref_cnt); lacp_lock(); @@ -273,19 +275,19 @@ lacp_ref(const struct lacp *lacp_) return lacp; } -/* Destroys 'lacp' and its slaves. Does nothing if 'lacp' is NULL. */ +/* Destroys 'lacp' and its subs. Does nothing if 'lacp' is NULL. */ void lacp_unref(struct lacp *lacp) OVS_EXCLUDED(mutex) { if (lacp && ovs_refcount_unref_relaxed(&lacp->ref_cnt) == 1) { - struct slave *slave, *next; + struct sub *sub, *next; lacp_lock(); - HMAP_FOR_EACH_SAFE (slave, next, node, &lacp->slaves) { - slave_destroy(slave); + HMAP_FOR_EACH_SAFE (sub, next, node, &lacp->subs) { + sub_destroy(sub); } - hmap_destroy(&lacp->slaves); + hmap_destroy(&lacp->subs); ovs_list_remove(&lacp->node); free(lacp->name); free(lacp); @@ -336,39 +338,39 @@ lacp_is_active(const struct lacp *lacp) OVS_EXCLUDED(mutex) return ret; } -/* Processes 'packet' which was received on 'slave_'. This function should be - * called on all packets received on 'slave_' with Ethernet Type ETH_TYPE_LACP. +/* Processes 'packet' which was received on 'sub_'. This function should be + * called on all packets received on 'sub_' with Ethernet Type ETH_TYPE_LACP. */ bool -lacp_process_packet(struct lacp *lacp, const void *slave_, +lacp_process_packet(struct lacp *lacp, const void *sub_, const struct dp_packet *packet) OVS_EXCLUDED(mutex) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); const struct lacp_pdu *pdu; long long int tx_rate; - struct slave *slave; + struct sub *sub; bool lacp_may_enable = false; enum pdu_subtype subtype; lacp_lock(); - slave = slave_lookup(lacp, slave_); - if (!slave) { + sub = sub_lookup(lacp, sub_); + if (!sub) { goto out; } - slave->count_rx_pdus++; + sub->count_rx_pdus++; pdu = parse_lacp_packet(packet, &subtype); switch (subtype) { case SUBTYPE_LACP: break; case SUBTYPE_MARKER: - slave->count_rx_pdus_marker++; + sub->count_rx_pdus_marker++; VLOG_DBG("%s: received a LACP marker PDU.", lacp->name); goto out; case SUBTYPE_UNUSED: default: - slave->count_rx_pdus_bad++; + sub->count_rx_pdus_bad++; VLOG_WARN_RL(&rl, "%s: received an unparsable LACP PDU.", lacp->name); goto out; @@ -377,30 +379,30 @@ lacp_process_packet(struct lacp *lacp, const void *slave_, /* On some NICs L1 state reporting is slow. In case LACP packets are * received while carrier (L1) state is still down, drop the LACP PDU and * trigger re-checking of L1 state. */ - if (!slave->carrier_up) { + if (!sub->carrier_up) { VLOG_INFO_RL(&rl, "%s: carrier state is DOWN," - " dropping received LACP PDU.", slave->name); + " dropping received LACP PDU.", sub->name); seq_change(connectivity_seq_get()); goto out; } - slave->status = LACP_CURRENT; + sub->status = LACP_CURRENT; tx_rate = lacp->fast ? LACP_FAST_TIME_TX : LACP_SLOW_TIME_TX; - timer_set_duration(&slave->rx, LACP_RX_MULTIPLIER * tx_rate); + timer_set_duration(&sub->rx, LACP_RX_MULTIPLIER * tx_rate); - slave->ntt_actor = pdu->partner; + sub->ntt_actor = pdu->partner; /* Update our information about our partner if it's out of date. This may * cause priorities to change so re-calculate attached status of all - * slaves. */ - if (memcmp(&slave->partner, &pdu->actor, sizeof pdu->actor)) { + * subs. */ + if (memcmp(&sub->partner, &pdu->actor, sizeof pdu->actor)) { lacp->update = true; - slave->partner = pdu->actor; + sub->partner = pdu->actor; } /* Evaluate may_enable here to avoid dropping of packets till main thread * sets may_enable to true. */ - lacp_may_enable = slave_may_enable__(slave); + lacp_may_enable = sub_may_enable__(sub); out: lacp_unlock(); @@ -426,92 +428,92 @@ lacp_status(const struct lacp *lacp) OVS_EXCLUDED(mutex) } } -/* Registers 'slave_' as subordinate to 'lacp'. This should be called at least - * once per slave in a LACP managed bond. Should also be called whenever a - * slave's settings change. */ +/* Registers 'sub_' as subordinate to 'lacp'. This should be called at least + * once per sub in a LACP managed bond. Should also be called whenever a + * sub's settings change. */ void -lacp_slave_register(struct lacp *lacp, void *slave_, - const struct lacp_slave_settings *s) +lacp_sub_register(struct lacp *lacp, void *sub_, + const struct lacp_sub_settings *s) OVS_EXCLUDED(mutex) { - struct slave *slave; + struct sub *sub; lacp_lock(); - slave = slave_lookup(lacp, slave_); - if (!slave) { - slave = xzalloc(sizeof *slave); - slave->lacp = lacp; - slave->aux = slave_; - hmap_insert(&lacp->slaves, &slave->node, hash_pointer(slave_, 0)); - slave_set_defaulted(slave); - - if (!lacp->key_slave) { - lacp->key_slave = slave; + sub = sub_lookup(lacp, sub_); + if (!sub) { + sub = xzalloc(sizeof *sub); + sub->lacp = lacp; + sub->aux = sub_; + hmap_insert(&lacp->subs, &sub->node, hash_pointer(sub_, 0)); + sub_set_defaulted(sub); + + if (!lacp->key_sub) { + lacp->key_sub = sub; } } - if (!slave->name || strcmp(s->name, slave->name)) { - free(slave->name); - slave->name = xstrdup(s->name); + if (!sub->name || strcmp(s->name, sub->name)) { + free(sub->name); + sub->name = xstrdup(s->name); } - if (slave->port_id != s->id - || slave->port_priority != s->priority - || slave->key != s->key) { - slave->port_id = s->id; - slave->port_priority = s->priority; - slave->key = s->key; + if (sub->port_id != s->id + || sub->port_priority != s->priority + || sub->key != s->key) { + sub->port_id = s->id; + sub->port_priority = s->priority; + sub->key = s->key; lacp->update = true; if (lacp->active || lacp->negotiated) { - slave_set_expired(slave); + sub_set_expired(sub); } } lacp_unlock(); } -/* Unregisters 'slave_' with 'lacp'. */ +/* Unregisters 'sub_' with 'lacp'. */ void -lacp_slave_unregister(struct lacp *lacp, const void *slave_) +lacp_sub_unregister(struct lacp *lacp, const void *sub_) OVS_EXCLUDED(mutex) { - struct slave *slave; + struct sub *sub; lacp_lock(); - slave = slave_lookup(lacp, slave_); - if (slave) { - slave_destroy(slave); + sub = sub_lookup(lacp, sub_); + if (sub) { + sub_destroy(sub); lacp->update = true; } lacp_unlock(); } -/* This function should be called whenever the carrier status of 'slave_' has +/* This function should be called whenever the carrier status of 'sub_' has * changed. If 'lacp' is null, this function has no effect.*/ void -lacp_slave_carrier_changed(const struct lacp *lacp, const void *slave_, +lacp_sub_carrier_changed(const struct lacp *lacp, const void *sub_, bool carrier_up) OVS_EXCLUDED(mutex) { - struct slave *slave; + struct sub *sub; if (!lacp) { return; } lacp_lock(); - slave = slave_lookup(lacp, slave_); - if (!slave) { + sub = sub_lookup(lacp, sub_); + if (!sub) { goto out; } - if (slave->status == LACP_CURRENT || slave->lacp->active) { - slave_set_expired(slave); + if (sub->status == LACP_CURRENT || sub->lacp->active) { + sub_set_expired(sub); } - if (slave->carrier_up != carrier_up) { - slave->carrier_up = carrier_up; - slave->count_carrier_changed++; + if (sub->carrier_up != carrier_up) { + sub->carrier_up = carrier_up; + sub->count_carrier_changed++; } out: @@ -519,35 +521,35 @@ out: } static bool -slave_may_enable__(struct slave *slave) OVS_REQUIRES(mutex) +sub_may_enable__(struct sub *sub) OVS_REQUIRES(mutex) { - /* The slave may be enabled if it's attached to an aggregator and its + /* The sub may be enabled if it's attached to an aggregator and its * partner is synchronized.*/ - return slave->attached && (slave->partner.state & LACP_STATE_SYNC - || (slave->lacp && slave->lacp->fallback_ab - && slave->status == LACP_DEFAULTED)); + return sub->attached && (sub->partner.state & LACP_STATE_SYNC + || (sub->lacp && sub->lacp->fallback_ab + && sub->status == LACP_DEFAULTED)); } -/* This function should be called before enabling 'slave_' to send or receive - * traffic. If it returns false, 'slave_' should not enabled. As a +/* This function should be called before enabling 'sub_' to send or receive + * traffic. If it returns false, 'sub_' should not enabled. As a * convenience, returns true if 'lacp' is NULL. */ bool -lacp_slave_may_enable(const struct lacp *lacp, const void *slave_) +lacp_sub_may_enable(const struct lacp *lacp, const void *sub_) OVS_EXCLUDED(mutex) { if (lacp) { - struct slave *slave; + struct sub *sub; bool ret = false; lacp_lock(); - slave = slave_lookup(lacp, slave_); - if (slave) { - /* It is only called when carrier is up. So, enable slave's + sub = sub_lookup(lacp, sub_); + if (sub) { + /* It is only called when carrier is up. So, enable sub's * carrier state if it is currently down. */ - if (!slave->carrier_up) { - slave->carrier_up = true; + if (!sub->carrier_up) { + sub->carrier_up = true; } - ret = slave_may_enable__(slave); + ret = sub_may_enable__(sub); } lacp_unlock(); return ret; @@ -556,19 +558,19 @@ lacp_slave_may_enable(const struct lacp *lacp, const void *slave_) } } -/* Returns true if partner information on 'slave_' is up to date. 'slave_' +/* Returns true if partner information on 'sub_' is up to date. 'sub_' * not being current, generally indicates a connectivity problem, or a * misconfigured (or broken) partner. */ bool -lacp_slave_is_current(const struct lacp *lacp, const void *slave_) +lacp_sub_is_current(const struct lacp *lacp, const void *sub_) OVS_EXCLUDED(mutex) { - struct slave *slave; + struct sub *sub; bool ret; lacp_lock(); - slave = slave_lookup(lacp, slave_); - ret = slave ? slave->status != LACP_DEFAULTED : false; + sub = sub_lookup(lacp, sub_); + ret = sub ? sub->status != LACP_DEFAULTED : false; lacp_unlock(); return ret; } @@ -577,21 +579,21 @@ lacp_slave_is_current(const struct lacp *lacp, const void *slave_) void lacp_run(struct lacp *lacp, lacp_send_pdu *send_pdu) OVS_EXCLUDED(mutex) { - struct slave *slave; + struct sub *sub; lacp_lock(); - HMAP_FOR_EACH (slave, node, &lacp->slaves) { - if (timer_expired(&slave->rx)) { - enum slave_status old_status = slave->status; - - if (slave->status == LACP_CURRENT) { - slave_set_expired(slave); - slave->count_link_expired++; - } else if (slave->status == LACP_EXPIRED) { - slave_set_defaulted(slave); - slave->count_link_defaulted++; + HMAP_FOR_EACH (sub, node, &lacp->subs) { + if (timer_expired(&sub->rx)) { + enum sub_status old_status = sub->status; + + if (sub->status == LACP_CURRENT) { + sub_set_expired(sub); + sub->count_link_expired++; + } else if (sub->status == LACP_EXPIRED) { + sub_set_defaulted(sub); + sub->count_link_defaulted++; } - if (slave->status != old_status) { + if (sub->status != old_status) { seq_change(connectivity_seq_get()); } } @@ -602,30 +604,30 @@ lacp_run(struct lacp *lacp, lacp_send_pdu *send_pdu) OVS_EXCLUDED(mutex) seq_change(connectivity_seq_get()); } - HMAP_FOR_EACH (slave, node, &lacp->slaves) { + HMAP_FOR_EACH (sub, node, &lacp->subs) { struct lacp_info actor; - if (!slave_may_tx(slave)) { + if (!sub_may_tx(sub)) { continue; } - slave_get_actor(slave, &actor); + sub_get_actor(sub, &actor); - if (timer_expired(&slave->tx) - || !info_tx_equal(&actor, &slave->ntt_actor)) { + if (timer_expired(&sub->tx) + || !info_tx_equal(&actor, &sub->ntt_actor)) { long long int duration; struct lacp_pdu pdu; - slave->ntt_actor = actor; - compose_lacp_pdu(&actor, &slave->partner, &pdu); - send_pdu(slave->aux, &pdu, sizeof pdu); - slave->count_tx_pdus++; + sub->ntt_actor = actor; + compose_lacp_pdu(&actor, &sub->partner, &pdu); + send_pdu(sub->aux, &pdu, sizeof pdu); + sub->count_tx_pdus++; - duration = (slave->partner.state & LACP_STATE_TIME + duration = (sub->partner.state & LACP_STATE_TIME ? LACP_FAST_TIME_TX : LACP_SLOW_TIME_TX); - timer_set_duration(&slave->tx, duration); + timer_set_duration(&sub->tx, duration); seq_change(connectivity_seq_get()); } } @@ -636,16 +638,16 @@ lacp_run(struct lacp *lacp, lacp_send_pdu *send_pdu) OVS_EXCLUDED(mutex) void lacp_wait(struct lacp *lacp) OVS_EXCLUDED(mutex) { - struct slave *slave; + struct sub *sub; lacp_lock(); - HMAP_FOR_EACH (slave, node, &lacp->slaves) { - if (slave_may_tx(slave)) { - timer_wait(&slave->tx); + HMAP_FOR_EACH (sub, node, &lacp->subs) { + if (sub_may_tx(sub)) { + timer_wait(&sub->tx); } - if (slave->status != LACP_DEFAULTED) { - timer_wait(&slave->rx); + if (sub->status != LACP_DEFAULTED) { + timer_wait(&sub->rx); } } lacp_unlock(); @@ -653,12 +655,12 @@ lacp_wait(struct lacp *lacp) OVS_EXCLUDED(mutex) /* Static Helpers. */ -/* Updates the attached status of all slaves controlled by 'lacp' and sets its - * negotiated parameter to true if any slaves are attachable. */ +/* Updates the attached status of all subs controlled by 'lacp' and sets its + * negotiated parameter to true if any subs are attachable. */ static void lacp_update_attached(struct lacp *lacp) OVS_REQUIRES(mutex) { - struct slave *lead, *lead_current, *slave; + struct sub *lead, *lead_current, *sub; struct lacp_info lead_pri; bool lead_enable; static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 10); @@ -671,12 +673,12 @@ lacp_update_attached(struct lacp *lacp) OVS_REQUIRES(mutex) /* Check if there is a working interface. * Store as lead_current, if there is one. */ - HMAP_FOR_EACH (slave, node, &lacp->slaves) { - if (slave->status == LACP_CURRENT && slave->attached) { + HMAP_FOR_EACH (sub, node, &lacp->subs) { + if (sub->status == LACP_CURRENT && sub->attached) { struct lacp_info pri; - slave_get_priority(slave, &pri); + sub_get_priority(sub, &pri); if (!lead_current || memcmp(&pri, &lead_pri, sizeof pri) < 0) { - lead_current = slave; + lead_current = sub; lead = lead_current; lead_pri = pri; lead_enable = true; @@ -685,43 +687,43 @@ lacp_update_attached(struct lacp *lacp) OVS_REQUIRES(mutex) } /* Find interface with highest priority. */ - HMAP_FOR_EACH (slave, node, &lacp->slaves) { + HMAP_FOR_EACH (sub, node, &lacp->subs) { struct lacp_info pri; - slave->attached = false; + sub->attached = false; /* XXX: In the future allow users to configure the expected system ID. * For now just special case loopback. */ - if (eth_addr_equals(slave->partner.sys_id, slave->lacp->sys_id)) { - VLOG_WARN_RL(&rl, "slave %s: Loopback detected. Slave is " - "connected to its own bond", slave->name); + if (eth_addr_equals(sub->partner.sys_id, sub->lacp->sys_id)) { + VLOG_WARN_RL(&rl, "interface %s: Loopback detected. Interface is " + "connected to its own bond", sub->name); continue; } - if (slave->status == LACP_DEFAULTED) { + if (sub->status == LACP_DEFAULTED) { if (lacp->fallback_ab) { - slave->attached = true; + sub->attached = true; } continue; } - slave_get_priority(slave, &pri); - bool enable = slave_may_enable__(slave); + sub_get_priority(sub, &pri); + bool enable = sub_may_enable__(sub); /* Check if partner MAC address is the same as on the working - * interface. Activate slave only if the MAC is the same, or + * interface. Activate sub only if the MAC is the same, or * there is no working interface. */ if (!lead_current || (lead_current - && eth_addr_equals(slave->partner.sys_id, + && eth_addr_equals(sub->partner.sys_id, lead_current->partner.sys_id))) { - slave->attached = true; + sub->attached = true; } - if (slave->attached && + if (sub->attached && (!lead || enable > lead_enable || (enable == lead_enable && memcmp(&pri, &lead_pri, sizeof pri) < 0))) { - lead = slave; + lead = sub; lead_enable = enable; lead_pri = pri; } @@ -730,65 +732,65 @@ lacp_update_attached(struct lacp *lacp) OVS_REQUIRES(mutex) lacp->negotiated = lead != NULL; if (lead) { - HMAP_FOR_EACH (slave, node, &lacp->slaves) { - if ((lacp->fallback_ab && slave->status == LACP_DEFAULTED) - || lead->partner.key != slave->partner.key + HMAP_FOR_EACH (sub, node, &lacp->subs) { + if ((lacp->fallback_ab && sub->status == LACP_DEFAULTED) + || lead->partner.key != sub->partner.key || !eth_addr_equals(lead->partner.sys_id, - slave->partner.sys_id)) { - slave->attached = false; + sub->partner.sys_id)) { + sub->attached = false; } } } } static void -slave_destroy(struct slave *slave) OVS_REQUIRES(mutex) +sub_destroy(struct sub *sub) OVS_REQUIRES(mutex) { - if (slave) { - struct lacp *lacp = slave->lacp; + if (sub) { + struct lacp *lacp = sub->lacp; lacp->update = true; - hmap_remove(&lacp->slaves, &slave->node); + hmap_remove(&lacp->subs, &sub->node); - if (lacp->key_slave == slave) { - struct hmap_node *slave_node = hmap_first(&lacp->slaves); + if (lacp->key_sub == sub) { + struct hmap_node *sub_node = hmap_first(&lacp->subs); - if (slave_node) { - lacp->key_slave = CONTAINER_OF(slave_node, struct slave, node); + if (sub_node) { + lacp->key_sub = CONTAINER_OF(sub_node, struct sub, node); } else { - lacp->key_slave = NULL; + lacp->key_sub = NULL; } } - free(slave->name); - free(slave); + free(sub->name); + free(sub); } } static void -slave_set_defaulted(struct slave *slave) OVS_REQUIRES(mutex) +sub_set_defaulted(struct sub *sub) OVS_REQUIRES(mutex) { - memset(&slave->partner, 0, sizeof slave->partner); + memset(&sub->partner, 0, sizeof sub->partner); - slave->lacp->update = true; - slave->status = LACP_DEFAULTED; + sub->lacp->update = true; + sub->status = LACP_DEFAULTED; } static void -slave_set_expired(struct slave *slave) OVS_REQUIRES(mutex) +sub_set_expired(struct sub *sub) OVS_REQUIRES(mutex) { - slave->status = LACP_EXPIRED; - slave->partner.state |= LACP_STATE_TIME; - slave->partner.state &= ~LACP_STATE_SYNC; + sub->status = LACP_EXPIRED; + sub->partner.state |= LACP_STATE_TIME; + sub->partner.state &= ~LACP_STATE_SYNC; - timer_set_duration(&slave->rx, LACP_RX_MULTIPLIER * LACP_FAST_TIME_TX); + timer_set_duration(&sub->rx, LACP_RX_MULTIPLIER * LACP_FAST_TIME_TX); } static void -slave_get_actor(struct slave *slave, struct lacp_info *actor) +sub_get_actor(struct sub *sub, struct lacp_info *actor) OVS_REQUIRES(mutex) { - struct lacp *lacp = slave->lacp; + struct lacp *lacp = sub->lacp; uint16_t key; uint8_t state = 0; @@ -800,62 +802,62 @@ slave_get_actor(struct slave *slave, struct lacp_info *actor) state |= LACP_STATE_TIME; } - if (slave->attached) { + if (sub->attached) { state |= LACP_STATE_SYNC; } - if (slave->status == LACP_DEFAULTED) { + if (sub->status == LACP_DEFAULTED) { state |= LACP_STATE_DEF; } - if (slave->status == LACP_EXPIRED) { + if (sub->status == LACP_EXPIRED) { state |= LACP_STATE_EXP; } - if (hmap_count(&lacp->slaves) > 1) { + if (hmap_count(&lacp->subs) > 1) { state |= LACP_STATE_AGG; } - if (slave->attached || !lacp->negotiated) { + if (sub->attached || !lacp->negotiated) { state |= LACP_STATE_COL | LACP_STATE_DIST; } - key = lacp->key_slave->key; + key = lacp->key_sub->key; if (!key) { - key = lacp->key_slave->port_id; + key = lacp->key_sub->port_id; } actor->state = state; actor->key = htons(key); - actor->port_priority = htons(slave->port_priority); - actor->port_id = htons(slave->port_id); + actor->port_priority = htons(sub->port_priority); + actor->port_id = htons(sub->port_id); actor->sys_priority = htons(lacp->sys_priority); actor->sys_id = lacp->sys_id; } -/* Given 'slave', populates 'priority' with data representing its LACP link +/* Given 'sub', populates 'priority' with data representing its LACP link * priority. If two priority objects populated by this function are compared * using memcmp, the higher priority link will be less than the lower priority * link. */ static void -slave_get_priority(struct slave *slave, struct lacp_info *priority) +sub_get_priority(struct sub *sub, struct lacp_info *priority) OVS_REQUIRES(mutex) { uint16_t partner_priority, actor_priority; /* Choose the lacp_info of the higher priority system by comparing their * system priorities and mac addresses. */ - actor_priority = slave->lacp->sys_priority; - partner_priority = ntohs(slave->partner.sys_priority); + actor_priority = sub->lacp->sys_priority; + partner_priority = ntohs(sub->partner.sys_priority); if (actor_priority < partner_priority) { - slave_get_actor(slave, priority); + sub_get_actor(sub, priority); } else if (partner_priority < actor_priority) { - *priority = slave->partner; - } else if (eth_addr_compare_3way(slave->lacp->sys_id, - slave->partner.sys_id) < 0) { - slave_get_actor(slave, priority); + *priority = sub->partner; + } else if (eth_addr_compare_3way(sub->lacp->sys_id, + sub->partner.sys_id) < 0) { + sub_get_actor(sub, priority); } else { - *priority = slave->partner; + *priority = sub->partner; } /* Key and state are not used in priority comparisons. */ @@ -864,22 +866,22 @@ slave_get_priority(struct slave *slave, struct lacp_info *priority) } static bool -slave_may_tx(const struct slave *slave) OVS_REQUIRES(mutex) +sub_may_tx(const struct sub *sub) OVS_REQUIRES(mutex) { /* Check for L1 state as well as LACP state. */ - return (slave->carrier_up) && ((slave->lacp->active) || - (slave->status != LACP_DEFAULTED)); + return (sub->carrier_up) && ((sub->lacp->active) || + (sub->status != LACP_DEFAULTED)); } -static struct slave * -slave_lookup(const struct lacp *lacp, const void *slave_) OVS_REQUIRES(mutex) +static struct sub * +sub_lookup(const struct lacp *lacp, const void *sub_) OVS_REQUIRES(mutex) { - struct slave *slave; + struct sub *sub; - HMAP_FOR_EACH_IN_BUCKET (slave, node, hash_pointer(slave_, 0), - &lacp->slaves) { - if (slave->aux == slave_) { - return slave; + HMAP_FOR_EACH_IN_BUCKET (sub, node, hash_pointer(sub_, 0), + &lacp->subs) { + if (sub->aux == sub_) { + return sub; } } @@ -961,10 +963,10 @@ ds_put_lacp_state(struct ds *ds, uint8_t state) static void lacp_print_details(struct ds *ds, struct lacp *lacp) OVS_REQUIRES(mutex) { - struct shash slave_shash = SHASH_INITIALIZER(&slave_shash); - const struct shash_node **sorted_slaves = NULL; + struct shash sub_shash = SHASH_INITIALIZER(&sub_shash); + const struct shash_node **sorted_subs = NULL; - struct slave *slave; + struct sub *sub; int i; ds_put_format(ds, "---- %s ----\n", lacp->name); @@ -977,10 +979,10 @@ lacp_print_details(struct ds *ds, struct lacp *lacp) OVS_REQUIRES(mutex) ds_put_format(ds, " sys_id: " ETH_ADDR_FMT "\n", ETH_ADDR_ARGS(lacp->sys_id)); ds_put_format(ds, " sys_priority: %u\n", lacp->sys_priority); ds_put_cstr(ds, " aggregation key: "); - if (lacp->key_slave) { - ds_put_format(ds, "%u", lacp->key_slave->key - ? lacp->key_slave->key - : lacp->key_slave->port_id); + if (lacp->key_sub) { + ds_put_format(ds, "%u", lacp->key_sub->key + ? lacp->key_sub->key + : lacp->key_sub->port_id); } else { ds_put_cstr(ds, "none"); } @@ -993,18 +995,18 @@ lacp_print_details(struct ds *ds, struct lacp *lacp) OVS_REQUIRES(mutex) ds_put_cstr(ds, "slow\n"); } - HMAP_FOR_EACH (slave, node, &lacp->slaves) { - shash_add(&slave_shash, slave->name, slave); + HMAP_FOR_EACH (sub, node, &lacp->subs) { + shash_add(&sub_shash, sub->name, sub); } - sorted_slaves = shash_sort(&slave_shash); + sorted_subs = shash_sort(&sub_shash); - for (i = 0; i < shash_count(&slave_shash); i++) { + for (i = 0; i < shash_count(&sub_shash); i++) { char *status; struct lacp_info actor; - slave = sorted_slaves[i]->data; - slave_get_actor(slave, &actor); - switch (slave->status) { + sub = sorted_subs[i]->data; + sub_get_actor(sub, &actor); + switch (sub->status) { case LACP_CURRENT: status = "current"; break; @@ -1018,11 +1020,11 @@ lacp_print_details(struct ds *ds, struct lacp *lacp) OVS_REQUIRES(mutex) OVS_NOT_REACHED(); } - ds_put_format(ds, "\nslave: %s: %s %s\n", slave->name, status, - slave->attached ? "attached" : "detached"); - ds_put_format(ds, " port_id: %u\n", slave->port_id); - ds_put_format(ds, " port_priority: %u\n", slave->port_priority); - ds_put_format(ds, " may_enable: %s\n", (slave_may_enable__(slave) + ds_put_format(ds, "\ninterface: %s: %s %s\n", sub->name, status, + sub->attached ? "attached" : "detached"); + ds_put_format(ds, " port_id: %u\n", sub->port_id); + ds_put_format(ds, " port_priority: %u\n", sub->port_priority); + ds_put_format(ds, " may_enable: %s\n", (sub_may_enable__(sub) ? "true" : "false")); ds_put_format(ds, "\n actor sys_id: " ETH_ADDR_FMT "\n", @@ -1040,58 +1042,58 @@ lacp_print_details(struct ds *ds, struct lacp *lacp) OVS_REQUIRES(mutex) ds_put_cstr(ds, "\n\n"); ds_put_format(ds, " partner sys_id: " ETH_ADDR_FMT "\n", - ETH_ADDR_ARGS(slave->partner.sys_id)); + ETH_ADDR_ARGS(sub->partner.sys_id)); ds_put_format(ds, " partner sys_priority: %u\n", - ntohs(slave->partner.sys_priority)); + ntohs(sub->partner.sys_priority)); ds_put_format(ds, " partner port_id: %u\n", - ntohs(slave->partner.port_id)); + ntohs(sub->partner.port_id)); ds_put_format(ds, " partner port_priority: %u\n", - ntohs(slave->partner.port_priority)); + ntohs(sub->partner.port_priority)); ds_put_format(ds, " partner key: %u\n", - ntohs(slave->partner.key)); + ntohs(sub->partner.key)); ds_put_cstr(ds, " partner state:"); - ds_put_lacp_state(ds, slave->partner.state); + ds_put_lacp_state(ds, sub->partner.state); ds_put_cstr(ds, "\n"); } - shash_destroy(&slave_shash); - free(sorted_slaves); + shash_destroy(&sub_shash); + free(sorted_subs); } static void lacp_print_stats(struct ds *ds, struct lacp *lacp) OVS_REQUIRES(mutex) { - struct shash slave_shash = SHASH_INITIALIZER(&slave_shash); - const struct shash_node **sorted_slaves = NULL; + struct shash sub_shash = SHASH_INITIALIZER(&sub_shash); + const struct shash_node **sorted_subs = NULL; - struct slave *slave; + struct sub *sub; int i; ds_put_format(ds, "---- %s statistics ----\n", lacp->name); - HMAP_FOR_EACH (slave, node, &lacp->slaves) { - shash_add(&slave_shash, slave->name, slave); + HMAP_FOR_EACH (sub, node, &lacp->subs) { + shash_add(&sub_shash, sub->name, sub); } - sorted_slaves = shash_sort(&slave_shash); - - for (i = 0; i < shash_count(&slave_shash); i++) { - slave = sorted_slaves[i]->data; - ds_put_format(ds, "\nslave: %s:\n", slave->name); - ds_put_format(ds, " TX PDUs: %u\n", slave->count_tx_pdus); - ds_put_format(ds, " RX PDUs: %u\n", slave->count_rx_pdus); - ds_put_format(ds, " RX Bad PDUs: %u\n", slave->count_rx_pdus_bad); + sorted_subs = shash_sort(&sub_shash); + + for (i = 0; i < shash_count(&sub_shash); i++) { + sub = sorted_subs[i]->data; + ds_put_format(ds, "\ninterface: %s:\n", sub->name); + ds_put_format(ds, " TX PDUs: %u\n", sub->count_tx_pdus); + ds_put_format(ds, " RX PDUs: %u\n", sub->count_rx_pdus); + ds_put_format(ds, " RX Bad PDUs: %u\n", sub->count_rx_pdus_bad); ds_put_format(ds, " RX Marker Request PDUs: %u\n", - slave->count_rx_pdus_marker); + sub->count_rx_pdus_marker); ds_put_format(ds, " Link Expired: %u\n", - slave->count_link_expired); + sub->count_link_expired); ds_put_format(ds, " Link Defaulted: %u\n", - slave->count_link_defaulted); + sub->count_link_defaulted); ds_put_format(ds, " Carrier Status Changed: %u\n", - slave->count_carrier_changed); + sub->count_carrier_changed); } - shash_destroy(&slave_shash); - free(sorted_slaves); + shash_destroy(&sub_shash); + free(sorted_subs); } static void @@ -1152,27 +1154,27 @@ out: lacp_unlock(); } -/* Extract a snapshot of the current state and counters for a slave port. - Return false if the slave is not active. */ +/* Extract a snapshot of the current state and counters for a sub port. + Return false if the sub is not active. */ bool -lacp_get_slave_stats(const struct lacp *lacp, const void *slave_, struct lacp_slave_stats *stats) +lacp_get_sub_stats(const struct lacp *lacp, const void *sub_, struct lacp_sub_stats *stats) OVS_EXCLUDED(mutex) { - struct slave *slave; + struct sub *sub; struct lacp_info actor; bool ret; ovs_mutex_lock(&mutex); - slave = slave_lookup(lacp, slave_); - if (slave) { + sub = sub_lookup(lacp, sub_); + if (sub) { ret = true; - slave_get_actor(slave, &actor); + sub_get_actor(sub, &actor); stats->dot3adAggPortActorSystemID = actor.sys_id; - stats->dot3adAggPortPartnerOperSystemID = slave->partner.sys_id; - stats->dot3adAggPortAttachedAggID = (lacp->key_slave->key ? - lacp->key_slave->key : - lacp->key_slave->port_id); + stats->dot3adAggPortPartnerOperSystemID = sub->partner.sys_id; + stats->dot3adAggPortAttachedAggID = (lacp->key_sub->key ? + lacp->key_sub->key : + lacp->key_sub->port_id); /* Construct my admin-state. Assume aggregation is configured on. */ stats->dot3adAggPortActorAdminState = LACP_STATE_AGG; @@ -1189,12 +1191,12 @@ lacp_get_slave_stats(const struct lacp *lacp, const void *slave_, struct lacp_sl stats->dot3adAggPortPartnerAdminState = 0; stats->dot3adAggPortActorOperState = actor.state; - stats->dot3adAggPortPartnerOperState = slave->partner.state; + stats->dot3adAggPortPartnerOperState = sub->partner.state; /* Read out the latest counters */ - stats->dot3adAggPortStatsLACPDUsRx = slave->count_rx_pdus; - stats->dot3adAggPortStatsIllegalRx = slave->count_rx_pdus_bad; - stats->dot3adAggPortStatsLACPDUsTx = slave->count_tx_pdus; + stats->dot3adAggPortStatsLACPDUsRx = sub->count_rx_pdus; + stats->dot3adAggPortStatsIllegalRx = sub->count_rx_pdus_bad; + stats->dot3adAggPortStatsLACPDUsTx = sub->count_tx_pdus; } else { ret = false; } diff --git a/lib/lacp.h b/lib/lacp.h index d731ae9a6be8..6e2eaa037614 100644 --- a/lib/lacp.h +++ b/lib/lacp.h @@ -46,32 +46,32 @@ struct lacp *lacp_ref(const struct lacp *); void lacp_configure(struct lacp *, const struct lacp_settings *); bool lacp_is_active(const struct lacp *); -bool lacp_process_packet(struct lacp *, const void *slave, +bool lacp_process_packet(struct lacp *, const void *sub, const struct dp_packet *packet); enum lacp_status lacp_status(const struct lacp *); -struct lacp_slave_settings { +struct lacp_sub_settings { char *name; /* Name (for debugging). */ uint16_t id; /* Port ID. */ uint16_t priority; /* Port priority. */ uint16_t key; /* Aggregation key. */ }; -void lacp_slave_register(struct lacp *, void *slave_, - const struct lacp_slave_settings *); -void lacp_slave_unregister(struct lacp *, const void *slave); -void lacp_slave_carrier_changed(const struct lacp *, const void *slave, +void lacp_sub_register(struct lacp *, void *sub_, + const struct lacp_sub_settings *); +void lacp_sub_unregister(struct lacp *, const void *sub); +void lacp_sub_carrier_changed(const struct lacp *, const void *sub, bool carrier_up); -bool lacp_slave_may_enable(const struct lacp *, const void *slave); -bool lacp_slave_is_current(const struct lacp *, const void *slave_); +bool lacp_sub_may_enable(const struct lacp *, const void *sub); +bool lacp_sub_is_current(const struct lacp *, const void *sub_); /* Callback function for lacp_run() for sending a LACP PDU. */ -typedef void lacp_send_pdu(void *slave, const void *pdu, size_t pdu_size); +typedef void lacp_send_pdu(void *sub, const void *pdu, size_t pdu_size); void lacp_run(struct lacp *, lacp_send_pdu *); void lacp_wait(struct lacp *); -struct lacp_slave_stats { +struct lacp_sub_stats { /* id */ struct eth_addr dot3adAggPortActorSystemID; struct eth_addr dot3adAggPortPartnerOperSystemID; @@ -92,6 +92,7 @@ struct lacp_slave_stats { /* uint32_t dot3adAggPortStatsMarkerResponsePDUsTx; */ }; -bool lacp_get_slave_stats(const struct lacp *, const void *slave_, struct lacp_slave_stats *); +bool lacp_get_sub_stats(const struct lacp *, const void *sub_, + struct lacp_sub_stats *); #endif /* lacp.h */ diff --git a/lib/lldp/lldp-const.h b/lib/lldp/lldp-const.h index eceb612d18cd..e346059a4259 100644 --- a/lib/lldp/lldp-const.h +++ b/lib/lldp/lldp-const.h @@ -218,13 +218,13 @@ #define LLDPD_MODE_MAX LLDPD_MODE_FDP -/* Bond slave src mac type constants */ -#define LLDP_BOND_SLAVE_SRC_MAC_TYPE_UNKNOWN 0 -#define LLDP_BOND_SLAVE_SRC_MAC_TYPE_REAL 1 -#define LLDP_BOND_SLAVE_SRC_MAC_TYPE_ZERO 2 -#define LLDP_BOND_SLAVE_SRC_MAC_TYPE_FIXED 3 -#define LLDP_BOND_SLAVE_SRC_MAC_TYPE_LOCALLY_ADMINISTERED 4 -#define LLDP_BOND_SLAVE_SRC_MAC_TYPE_MAX \ - LLDP_BOND_SLAVE_SRC_MAC_TYPE_LOCALLY_ADMINISTERED +/* Bond sub-interface src mac type constants */ +#define LLDP_BOND_SUB_SRC_MAC_TYPE_UNKNOWN 0 +#define LLDP_BOND_SUB_SRC_MAC_TYPE_REAL 1 +#define LLDP_BOND_SUB_SRC_MAC_TYPE_ZERO 2 +#define LLDP_BOND_SUB_SRC_MAC_TYPE_FIXED 3 +#define LLDP_BOND_SUB_SRC_MAC_TYPE_LOCALLY_ADMINISTERED 4 +#define LLDP_BOND_SUB_SRC_MAC_TYPE_MAX \ + LLDP_BOND_SUB_SRC_MAC_TYPE_LOCALLY_ADMINISTERED #endif /* _LLDP_H */ diff --git a/lib/lldp/lldpd-structs.h b/lib/lldp/lldpd-structs.h index 6a3ffb8d33f0..7dfdf3a8b637 100644 --- a/lib/lldp/lldpd-structs.h +++ b/lib/lldp/lldpd-structs.h @@ -135,8 +135,8 @@ struct lldpd_config { int c_set_ifdescr; /* Set interface description */ int c_promisc; /* Interfaces should be in promiscuous mode */ int c_tx_hold; /* Transmit hold */ - int c_bond_slave_src_mac_type; /* Src mac type in lldp frames over bond - * slaves */ + int c_bond_sub_src_mac_type; /* Src mac type in lldp frames over bond + * sub-interfaces */ int c_lldp_portid_type; /* The PortID type */ }; @@ -158,9 +158,9 @@ struct lldpd_ops { }; /* An interface is uniquely identified by h_ifindex, h_ifname and h_ops. This - * means if an interface becomes enslaved, it will be considered as a new - * interface. The same applies for renaming and we include the index in case of - * renaming to an existing interface. + * means if an interface becomes a sub-interface, it will be considered as a + * new interface. The same applies for renaming and we include the index in + * case of renaming to an existing interface. */ struct lldpd_hardware { struct ovs_list h_entries; diff --git a/lib/mac-learning.c b/lib/mac-learning.c index f6183480d9f2..e7907be371b3 100644 --- a/lib/mac-learning.c +++ b/lib/mac-learning.c @@ -384,8 +384,9 @@ is_mac_learning_update_needed(const struct mac_learning *ml, if (is_gratuitous_arp) { /* We don't want to learn from gratuitous ARP packets that are - * reflected back over bond slaves so we lock the learning table. For - * more detail, see the bigger comment in update_learning_table__(). */ + * reflected back over bond sub-interfaces so we lock the learning + * table. For more detail, see the bigger comment in + * update_learning_table__(). */ if (!is_bond) { return true; /* Need to set the gratuitous ARP lock. */ } else if (mac_entry_is_grat_arp_locked(mac)) { @@ -424,12 +425,12 @@ update_learning_table__(struct mac_learning *ml, struct eth_addr src, mac = mac_learning_insert(ml, src, vlan); if (is_gratuitous_arp) { /* Gratuitous ARP packets received over non-bond interfaces could be - * reflected back over bond slaves. We don't want to learn from these - * reflected packets, so we lock each entry for which a gratuitous ARP - * packet was received over a non-bond interface and refrain from - * learning from gratuitous ARP packets that arrive over bond - * interfaces for this entry while the lock is in effect. Refer to the - * 'ovs-vswitch Internals' document for more in-depth discussion on + * reflected back over bond sub-interfaces. We don't want to learn + * from these reflected packets, so we lock each entry for which a + * gratuitous ARP packet was received over a non-bond interface and + * refrain from learning from gratuitous ARP packets that arrive over + * bond interfaces for this entry while the lock is in effect. Refer to + * the 'ovs-vswitch Internals' document for more in-depth discussion on * this topic. */ if (!is_bond) { mac_entry_set_grat_arp_lock(mac); diff --git a/lib/mac-learning.h b/lib/mac-learning.h index ad2f1fe4ebef..5b29407993a9 100644 --- a/lib/mac-learning.h +++ b/lib/mac-learning.h @@ -95,7 +95,7 @@ struct mac_learning; #define MAC_ENTRY_DEFAULT_IDLE_TIME 300 /* Time, in seconds, to lock an entry updated by a gratuitous ARP to avoid - * relearning based on a reflection from a bond slave. */ + * relearning based on a reflection from a bond sub-interface. */ #define MAC_GRAT_ARP_LOCK_TIME 5 /* A MAC learning table entry. diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index 6269c24acf75..1d482dff47f9 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -249,15 +249,15 @@ enum { IOV_AUXBUF = 1, }; -struct linux_lag_slave { +struct linux_lag_sub { uint32_t block_id; struct shash_node *node; }; -/* Protects 'lag_shash' and the mutable members of struct linux_lag_slave. */ +/* Protects 'lag_shash' and the mutable members of struct linux_lag_sub. */ static struct ovs_mutex lag_mutex = OVS_MUTEX_INITIALIZER; -/* All slaves whose LAG masters are network devices in OvS. */ +/* All sub-interfaces whose LAG primary interfaces are OVS network devices. */ static struct shash lag_shash OVS_GUARDED_BY(lag_mutex) = SHASH_INITIALIZER(&lag_shash); @@ -653,9 +653,9 @@ static void netdev_linux_update_lag(struct rtnetlink_change *change) OVS_REQUIRES(lag_mutex) { - struct linux_lag_slave *lag; + struct linux_lag_sub *lag; - if (change->slave && netdev_linux_kind_is_lag(change->slave)) { + if (change->sub && netdev_linux_kind_is_lag(change->sub)) { lag = shash_find_data(&lag_shash, change->ifname); if (!lag) { @@ -683,12 +683,12 @@ netdev_linux_update_lag(struct rtnetlink_change *change) /* delete ingress block in case it exists */ tc_add_del_qdisc(change->if_index, false, 0, TC_INGRESS); - /* LAG master is linux netdev so add slave to same block. */ + /* LAG master is linux netdev so add sub to same block. */ error = tc_add_del_qdisc(change->if_index, true, block_id, TC_INGRESS); if (error) { - VLOG_WARN("failed to bind LAG slave %s to master's block", - change->ifname); + VLOG_WARN("failed to bind LAG sub-interface %s to " + "primary's block", change->ifname); shash_delete(&lag_shash, lag->node); free(lag); } @@ -697,7 +697,7 @@ netdev_linux_update_lag(struct rtnetlink_change *change) netdev_close(master_netdev); } } else if (change->master_ifindex == 0) { - /* Check if this was a lag slave that has been freed. */ + /* Check if this was a lag sub that has been removed. */ lag = shash_find_data(&lag_shash, change->ifname); if (lag) { @@ -852,7 +852,7 @@ netdev_linux_update__(struct netdev_linux *dev, rtnetlink_report_link(); } - if (change->master && netdev_linux_kind_is_lag(change->master)) { + if (change->primary && netdev_linux_kind_is_lag(change->primary)) { dev->is_lag_master = true; } @@ -6368,7 +6368,7 @@ netdev_linux_update_via_netlink(struct netdev_linux *netdev) netdev->get_ifindex_error = 0; changed = true; } - if (change->master && netdev_linux_kind_is_lag(change->master)) { + if (change->primary && netdev_linux_kind_is_lag(change->primary)) { netdev->is_lag_master = true; } if (changed) { diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index be08a53fd589..265416be9f7b 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -1334,34 +1334,34 @@ check_OUTPUT_REG(const struct ofpact_output_reg *a, /* Action structure for NXAST_BUNDLE and NXAST_BUNDLE_LOAD. * - * The bundle actions choose a slave from a supplied list of options. + * The bundle actions choose a sub-interface from a supplied list of options. * NXAST_BUNDLE outputs to its selection. NXAST_BUNDLE_LOAD writes its * selection to a register. * - * The list of possible slaves follows the nx_action_bundle structure. The size - * of each slave is governed by its type as indicated by the 'slave_type' - * parameter. The list of slaves should be padded at its end with zeros to make + * The list of possible subs follows the nx_action_bundle structure. The size + * of each sub is governed by its type as indicated by the 'sub_type' + * parameter. The list of subs should be padded at its end with zeros to make * the total length of the action a multiple of 8. * - * Switches infer from the 'slave_type' parameter the size of each slave. All - * implementations must support the NXM_OF_IN_PORT 'slave_type' which indicates - * that the slaves are OpenFlow port numbers with NXM_LENGTH(NXM_OF_IN_PORT) == + * Switches infer from the 'sub_type' parameter the size of each sub. All + * implementations must support the NXM_OF_IN_PORT 'sub_type' which indicates + * that the subs are OpenFlow port numbers with NXM_LENGTH(NXM_OF_IN_PORT) == * 2 byte width. Switches should reject actions which indicate unknown or - * unsupported slave types. + * unsupported sub types. * * Switches use a strategy dictated by the 'algorithm' parameter to choose a - * slave. If the switch does not support the specified 'algorithm' parameter, + * sub. If the switch does not support the specified 'algorithm' parameter, * it should reject the action. * - * Several algorithms take into account liveness when selecting slaves. The - * liveness of a slave is implementation defined (with one exception), but will + * Several algorithms take into account liveness when selecting subs. The + * liveness of a sub is implementation defined (with one exception), but will * generally take into account things like its carrier status and the results * of any link monitoring protocols which happen to be running on it. In order * to give controllers a place-holder value, the OFPP_NONE port is always * considered live, that is, NXAST_BUNDLE_LOAD stores OFPP_NONE in the output - * register if no slave is live. + * register if no sub is live. * - * Some slave selection strategies require the use of a hash function, in which + * Some sub selection strategies require the use of a hash function, in which * case the 'fields' and 'basis' parameters should be populated. The 'fields' * parameter (one of NX_HASH_FIELDS_*) designates which parts of the flow to * hash. Refer to the definition of "enum nx_hash_fields" for details. The @@ -1375,24 +1375,24 @@ check_OUTPUT_REG(const struct ofpact_output_reg *a, * NXAST_BUNDLE actions should have 'ofs_nbits' and 'dst' zeroed. Switches * should reject actions which have nonzero bytes in either of these fields. * - * NXAST_BUNDLE_LOAD stores the OpenFlow port number of the selected slave in + * NXAST_BUNDLE_LOAD stores the OpenFlow port number of the selected sub in * dst[ofs:ofs+n_bits]. The format and semantics of 'dst' and 'ofs_nbits' are * similar to those for the NXAST_REG_LOAD action. */ struct nx_action_bundle { ovs_be16 type; /* OFPAT_VENDOR. */ - ovs_be16 len; /* Length including slaves. */ + ovs_be16 len; /* Length including subs. */ ovs_be32 vendor; /* NX_VENDOR_ID. */ ovs_be16 subtype; /* NXAST_BUNDLE or NXAST_BUNDLE_LOAD. */ - /* Slave choice algorithm to apply to hash value. */ + /* Sub choice algorithm to apply to hash value. */ ovs_be16 algorithm; /* One of NX_BD_ALG_*. */ /* What fields to hash and how. */ ovs_be16 fields; /* One of NX_HASH_FIELDS_*. */ ovs_be16 basis; /* Universal hash parameter. */ - ovs_be32 slave_type; /* NXM_OF_IN_PORT. */ - ovs_be16 n_slaves; /* Number of slaves. */ + ovs_be32 sub_type; /* NXM_OF_IN_PORT. */ + ovs_be16 n_subs; /* Number of subs. */ ovs_be16 ofs_nbits; /* (ofs << 6) | (n_bits - 1). */ ovs_be32 dst; /* Destination. */ @@ -1408,29 +1408,29 @@ decode_bundle(bool load, const struct nx_action_bundle *nab, { static struct vlog_rate_limit rll = VLOG_RATE_LIMIT_INIT(1, 5); struct ofpact_bundle *bundle; - uint32_t slave_type; - size_t slaves_size, i; + uint32_t sub_type; + size_t subs_size, i; enum ofperr error; bundle = ofpact_put_BUNDLE(ofpacts); - bundle->n_slaves = ntohs(nab->n_slaves); + bundle->n_subs = ntohs(nab->n_subs); bundle->basis = ntohs(nab->basis); bundle->fields = ntohs(nab->fields); bundle->algorithm = ntohs(nab->algorithm); - slave_type = ntohl(nab->slave_type); - slaves_size = ntohs(nab->len) - sizeof *nab; + sub_type = ntohl(nab->sub_type); + subs_size = ntohs(nab->len) - sizeof *nab; error = OFPERR_OFPBAC_BAD_ARGUMENT; if (!flow_hash_fields_valid(bundle->fields)) { VLOG_WARN_RL(&rll, "unsupported fields %d", (int) bundle->fields); - } else if (bundle->n_slaves > BUNDLE_MAX_SLAVES) { - VLOG_WARN_RL(&rll, "too many slaves"); + } else if (bundle->n_subs > BUNDLE_MAX_SUBS) { + VLOG_WARN_RL(&rll, "too many subs"); } else if (bundle->algorithm != NX_BD_ALG_HRW && bundle->algorithm != NX_BD_ALG_ACTIVE_BACKUP) { VLOG_WARN_RL(&rll, "unsupported algorithm %d", (int) bundle->algorithm); - } else if (slave_type != mf_nxm_header(MFF_IN_PORT)) { - VLOG_WARN_RL(&rll, "unsupported slave type %"PRIu32, slave_type); + } else if (sub_type != mf_nxm_header(MFF_IN_PORT)) { + VLOG_WARN_RL(&rll, "unsupported sub-interface type %"PRIu32, sub_type); } else { error = 0; } @@ -1461,15 +1461,15 @@ decode_bundle(bool load, const struct nx_action_bundle *nab, } } - if (slaves_size < bundle->n_slaves * sizeof(ovs_be16)) { + if (subs_size < bundle->n_subs * sizeof(ovs_be16)) { VLOG_WARN_RL(&rll, "Nicira action %s only has %"PRIuSIZE" bytes " - "allocated for slaves. %"PRIuSIZE" bytes are required " - "for %u slaves.", - load ? "bundle_load" : "bundle", slaves_size, - bundle->n_slaves * sizeof(ovs_be16), bundle->n_slaves); + "allocated for sub-interfaces. %"PRIuSIZE" bytes are " + "required for %u sub-interfaces.", + load ? "bundle_load" : "bundle", subs_size, + bundle->n_subs * sizeof(ovs_be16), bundle->n_subs); error = OFPERR_OFPBAC_BAD_LEN; } else { - for (i = 0; i < bundle->n_slaves; i++) { + for (i = 0; i < bundle->n_subs; i++) { ofp_port_t ofp_port = u16_to_ofp(ntohs(((ovs_be16 *)(nab + 1))[i])); ofpbuf_put(ofpacts, &ofp_port, sizeof ofp_port); @@ -1506,29 +1506,29 @@ encode_BUNDLE(const struct ofpact_bundle *bundle, enum ofp_version ofp_version OVS_UNUSED, struct ofpbuf *out) { - int slaves_len = ROUND_UP(2 * bundle->n_slaves, OFP_ACTION_ALIGN); + int subs_len = ROUND_UP(2 * bundle->n_subs, OFP_ACTION_ALIGN); struct nx_action_bundle *nab; - ovs_be16 *slaves; + ovs_be16 *subs; size_t i; nab = (bundle->dst.field ? put_NXAST_BUNDLE_LOAD(out) : put_NXAST_BUNDLE(out)); - nab->len = htons(ntohs(nab->len) + slaves_len); + nab->len = htons(ntohs(nab->len) + subs_len); nab->algorithm = htons(bundle->algorithm); nab->fields = htons(bundle->fields); nab->basis = htons(bundle->basis); - nab->slave_type = htonl(mf_nxm_header(MFF_IN_PORT)); - nab->n_slaves = htons(bundle->n_slaves); + nab->sub_type = htonl(mf_nxm_header(MFF_IN_PORT)); + nab->n_subs = htons(bundle->n_subs); if (bundle->dst.field) { nab->ofs_nbits = nxm_encode_ofs_nbits(bundle->dst.ofs, bundle->dst.n_bits); nab->dst = htonl(nxm_header_from_mff(bundle->dst.field)); } - slaves = ofpbuf_put_zeros(out, slaves_len); - for (i = 0; i < bundle->n_slaves; i++) { - slaves[i] = htons(ofp_to_u16(bundle->slaves[i])); + subs = ofpbuf_put_zeros(out, subs_len); + for (i = 0; i < bundle->n_subs; i++) { + subs[i] = htons(ofp_to_u16(bundle->subs[i])); } } @@ -3585,7 +3585,7 @@ check_STACK_POP(const struct ofpact_stack *a, */ struct nx_action_cnt_ids { ovs_be16 type; /* OFPAT_VENDOR. */ - ovs_be16 len; /* Length including slaves. */ + ovs_be16 len; /* Length including cnt_ids. */ ovs_be32 vendor; /* NX_VENDOR_ID. */ ovs_be16 subtype; /* NXAST_DEC_TTL_CNT_IDS. */ diff --git a/lib/ovs-actions.xml b/lib/ovs-actions.xml index 7169b15c02fa..0304d60f4f38 100644 --- a/lib/ovs-actions.xml +++ b/lib/ovs-actions.xml @@ -789,15 +789,16 @@ $ ovs-ofctl -O OpenFlow10 add-flow br0 actions=mod_nw_src:1.2.3.4

The bundle and bundle_load actions

- bundle(fields, basis, algorithm, ofport, slaves:port...) - bundle_load(fields, basis, algorithm, ofport, dst, slaves:port...) + bundle(fields, basis, algorithm, ofport, subs:port...) + bundle_load(fields, basis, algorithm, ofport, dst, subs:port...)

- These actions choose a port (``slave'') from a comma-separated OpenFlow - port list. After selecting the port, bundle - outputs to it, whereas bundle_load writes its port number - to dst, which must be a 16-bit or wider field or subfield in - the syntax described under ``Field Specifications'' above. + These actions choose a port (``sub-interface'' or ``sub'') from a + comma-separated OpenFlow port list. After selecting the + port, bundle outputs to it, whereas + bundle_load writes its port number to dst, + which must be a 16-bit or wider field or subfield in the syntax + described under ``Field Specifications'' above.

@@ -854,20 +855,20 @@ $ ovs-ofctl -O OpenFlow10 add-flow br0 actions=mod_nw_src:1.2.3.4

active_backup
- Chooses the first live port listed in slaves. + Chooses the first live port listed in subs.
hrw (Highest Random Weight)

Computes the following, considering only the live ports in - slaves: + subs:

-for i in [1,n_slaves]:
+for i in [1,n_subs]:
     weights[i] = hash(flow, i)
-slave = { i such that weights[i] >= weights[j] for all j != i }
+sub = { i such that weights[i] >= weights[j] for all j != i }
           

@@ -877,17 +878,17 @@ for i in [1,n_slaves]:

- The algorithms take port liveness into account when selecting slaves. - The definition of whether a port is live is subject to change. It - currently takes into account carrier status and link monitoring - protocols such as BFD and CFM. If none of the slaves is live, - bundle does not output the packet and + The algorithms take port liveness into account when selecting + sub-interfaces. The definition of whether a port is live is subject to + change. It currently takes into account carrier status and link + monitoring protocols such as BFD and CFM. If none of the subs is + live, bundle does not output the packet and bundle_load stores OFPP_NONE (65535) in the output field.

- Example: bundle(eth_src,0,hrw,ofport,slaves:4,8) uses an + Example: bundle(eth_src,0,hrw,ofport,subs:4,8) uses an Ethernet source hash with basis 0, to select between OpenFlow ports 4 and 8 using the Highest Random Weight algorithm.

diff --git a/lib/rtnetlink.c b/lib/rtnetlink.c index f822dffc7bfd..125802925751 100644 --- a/lib/rtnetlink.c +++ b/lib/rtnetlink.c @@ -68,12 +68,12 @@ rtnetlink_parse_link_info(const struct nlattr *nla, ARRAY_SIZE(linkinfo_policy)); if (parsed) { - change->master = (linkinfo[IFLA_INFO_KIND] - ? nl_attr_get_string(linkinfo[IFLA_INFO_KIND]) - : NULL); - change->slave = (linkinfo[IFLA_INFO_SLAVE_KIND] - ? nl_attr_get_string(linkinfo[IFLA_INFO_SLAVE_KIND]) - : NULL); + change->primary = (linkinfo[IFLA_INFO_KIND] + ? nl_attr_get_string(linkinfo[IFLA_INFO_KIND]) + : NULL); + change->sub = (linkinfo[IFLA_INFO_SLAVE_KIND] + ? nl_attr_get_string(linkinfo[IFLA_INFO_SLAVE_KIND]) + : NULL); } return parsed; @@ -134,8 +134,8 @@ rtnetlink_parse(struct ofpbuf *buf, struct rtnetlink_change *change) parsed = rtnetlink_parse_link_info(attrs[IFLA_LINKINFO], change); } else { - change->master = NULL; - change->slave = NULL; + change->primary = NULL; + change->sub = NULL; } } } else if (rtnetlink_type_is_rtnlgrp_addr(nlmsg->nlmsg_type)) { diff --git a/lib/rtnetlink.h b/lib/rtnetlink.h index 422d1db11a09..b6ddb4bd1cbf 100644 --- a/lib/rtnetlink.h +++ b/lib/rtnetlink.h @@ -49,9 +49,9 @@ struct rtnetlink_change { /* Network device address status. */ /* xxx To be added when needed. */ - /* Link info. */ - const char *master; /* Kind of master (NULL if not master). */ - const char *slave; /* Kind of slave (NULL if not slave). */ + /* Link bonding info. */ + const char *primary; /* Kind of primary (NULL if not primary). */ + const char *sub; /* Kind of subordinate (NULL if not sub). */ }; /* Function called to report that a netdev has changed. 'change' describes the diff --git a/lib/unixctl.c b/lib/unixctl.c index c216de3d05a7..69aed6722c10 100644 --- a/lib/unixctl.c +++ b/lib/unixctl.c @@ -77,7 +77,9 @@ unixctl_list_commands(struct unixctl_conn *conn, int argc OVS_UNUSED, const struct shash_node *node = nodes[i]; const struct unixctl_command *command = node->data; - ds_put_format(&ds, " %-23s %s\n", node->name, command->usage); + if (command->usage) { + ds_put_format(&ds, " %-23s %s\n", node->name, command->usage); + } } free(nodes); @@ -94,7 +96,7 @@ unixctl_version(struct unixctl_conn *conn, int argc OVS_UNUSED, /* Registers a unixctl command with the given 'name'. 'usage' describes the * arguments to the command; it is used only for presentation to the user in - * "list-commands" output. + * "list-commands" output. (If 'usage' is NULL, then the command is hidden.) * * 'cb' is called when the command is received. It is passed an array * containing the command name and arguments, plus a copy of 'aux'. Normally diff --git a/ofproto/bond.c b/ofproto/bond.c index 9947e7531409..8399868ae233 100644 --- a/ofproto/bond.c +++ b/ofproto/bond.c @@ -57,13 +57,13 @@ static struct hmap *const all_bonds OVS_GUARDED_BY(rwlock) = &all_bonds__; /* Priority for internal rules created to handle recirculation */ #define RECIRC_RULE_PRIORITY 20 -/* A hash bucket for mapping a flow to a slave. +/* A hash bucket for mapping a flow to a sub-interface. * "struct bond" has an array of BOND_BUCKETS of these. */ struct bond_entry { - struct bond_slave *slave; /* Assigned slave, NULL if unassigned. */ + struct bond_sub *sub; /* Assigned sub, NULL if unassigned. */ uint64_t tx_bytes /* Count of bytes recently transmitted. */ OVS_GUARDED_BY(rwlock); - struct ovs_list list_node; /* In bond_slave's 'entries' list. */ + struct ovs_list list_node; /* In bond_sub's 'entries' list. */ /* Recirculation. * @@ -74,12 +74,12 @@ struct bond_entry { uint64_t pr_tx_bytes OVS_GUARDED_BY(rwlock); }; -/* A bond slave, that is, one of the links comprising a bond. */ -struct bond_slave { - struct hmap_node hmap_node; /* In struct bond's slaves hmap. */ - struct ovs_list list_node; /* In struct bond's enabled_slaves list. */ - struct bond *bond; /* The bond that contains this slave. */ - void *aux; /* Client-provided handle for this slave. */ +/* A bond sub-interface, that is, one of the links comprising a bond. */ +struct bond_sub { + struct hmap_node hmap_node; /* In struct bond's subs hmap. */ + struct ovs_list list_node; /* In struct bond's enabled_subs list. */ + struct bond *bond; /* The bond that contains this sub. */ + void *aux; /* Client-provided handle for this sub. */ struct netdev *netdev; /* Network device, owned by the client. */ uint64_t change_seq; /* Tracks changes in 'netdev'. */ @@ -88,7 +88,7 @@ struct bond_slave { /* Link status. */ bool enabled; /* May be chosen for flows? */ - bool may_enable; /* Client considers this slave bondable. */ + bool may_enable; /* Client considers this sub bondable. */ long long delay_expires; /* Time after which 'enabled' may change. */ /* Rebalancing info. Used only by bond_rebalance(). */ @@ -104,21 +104,21 @@ struct bond { char *name; /* Name provided by client. */ struct ofproto_dpif *ofproto; /* The bridge this bond belongs to. */ - /* Slaves. */ - struct hmap slaves; + /* Subs. */ + struct hmap subs; - /* Enabled slaves. + /* Enabled subs. * - * Any reader or writer of 'enabled_slaves' must hold 'mutex'. - * (To prevent the bond_slave from disappearing they must also hold + * Any reader or writer of 'enabled_subs' must hold 'mutex'. + * (To prevent the bond_sub from disappearing they must also hold * 'rwlock'.) */ struct ovs_mutex mutex OVS_ACQ_AFTER(rwlock); - struct ovs_list enabled_slaves OVS_GUARDED; /* Contains struct bond_slaves. */ + struct ovs_list enabled_subs OVS_GUARDED; /* Contains struct bond_subs. */ /* Bonding info. */ enum bond_mode balance; /* Balancing mode, one of BM_*. */ - struct bond_slave *active_slave; - int updelay, downdelay; /* Delay before slave goes up/down, in ms. */ + struct bond_sub *active_sub; + int updelay, downdelay; /* Delay before sub goes up/down, in ms. */ enum lacp_status lacp_status; /* Status of LACP negotiations. */ bool bond_revalidate; /* True if flows need revalidation. */ uint32_t basis; /* Basis for flow hash function. */ @@ -133,15 +133,14 @@ struct bond { uint32_t recirc_id; /* Non zero if recirculation can be used.*/ struct hmap pr_rule_ops; /* Helps to maintain post recirculation rules.*/ - /* Store active slave to OVSDB. */ - bool active_slave_changed; /* Set to true whenever the bond changes - active slave. It will be reset to false - after it is stored into OVSDB */ + /* Store active sub to OVSDB. */ + bool active_sub_changed; /* Set to true whenever the bond changes active + sub-interface. It will be reset to false after + it is stored into OVSDB */ /* Interface name may not be persistent across an OS reboot, use - * MAC address for identifing the active slave */ - struct eth_addr active_slave_mac; - /* The MAC address of the active interface. */ + * MAC address for identifing the active sub. */ + struct eth_addr active_sub_mac; /* MAC address of the active interface. */ /* Legacy compatibility. */ bool lacp_fallback_ab; /* Fallback to active-backup on LACP failure. */ @@ -164,24 +163,24 @@ struct bond_pr_rule_op { }; static void bond_entry_reset(struct bond *) OVS_REQ_WRLOCK(rwlock); -static struct bond_slave *bond_slave_lookup(struct bond *, const void *slave_) +static struct bond_sub *bond_sub_lookup(struct bond *, const void *sub_) OVS_REQ_RDLOCK(rwlock); -static void bond_enable_slave(struct bond_slave *, bool enable) +static void bond_enable_sub(struct bond_sub *, bool enable) OVS_REQ_WRLOCK(rwlock); -static void bond_link_status_update(struct bond_slave *) +static void bond_link_status_update(struct bond_sub *) OVS_REQ_WRLOCK(rwlock); -static void bond_choose_active_slave(struct bond *) +static void bond_choose_active_sub(struct bond *) OVS_REQ_WRLOCK(rwlock); static struct bond_entry *lookup_bond_entry(const struct bond *, const struct flow *, uint16_t vlan) OVS_REQ_RDLOCK(rwlock); -static struct bond_slave *get_enabled_slave(struct bond *) +static struct bond_sub *get_enabled_sub(struct bond *) OVS_REQ_RDLOCK(rwlock); -static struct bond_slave *choose_output_slave(const struct bond *, - const struct flow *, - struct flow_wildcards *, - uint16_t vlan) +static struct bond_sub *choose_output_sub(const struct bond *, + const struct flow *, + struct flow_wildcards *, + uint16_t vlan) OVS_REQ_RDLOCK(rwlock); static void update_recirc_rules__(struct bond *); static bool bond_is_falling_back_to_ab(const struct bond *); @@ -224,8 +223,8 @@ bond_mode_to_string(enum bond_mode balance) { /* Creates and returns a new bond whose configuration is initially taken from * 's'. * - * The caller should register each slave on the new bond by calling - * bond_slave_register(). */ + * The caller should register each sub-interface on the new bond by calling + * bond_sub_register(). */ struct bond * bond_create(const struct bond_settings *s, struct ofproto_dpif *ofproto) { @@ -233,14 +232,14 @@ bond_create(const struct bond_settings *s, struct ofproto_dpif *ofproto) bond = xzalloc(sizeof *bond); bond->ofproto = ofproto; - hmap_init(&bond->slaves); - ovs_list_init(&bond->enabled_slaves); + hmap_init(&bond->subs); + ovs_list_init(&bond->enabled_subs); ovs_mutex_init(&bond->mutex); ovs_refcount_init(&bond->ref_cnt); hmap_init(&bond->pr_rule_ops); - bond->active_slave_mac = eth_addr_zero; - bond->active_slave_changed = false; + bond->active_sub_mac = eth_addr_zero; + bond->active_sub_changed = false; bond_reconfigure(bond, s); return bond; @@ -261,7 +260,7 @@ bond_ref(const struct bond *bond_) void bond_unref(struct bond *bond) { - struct bond_slave *slave; + struct bond_sub *sub; if (!bond || ovs_refcount_unref_relaxed(&bond->ref_cnt) != 1) { return; @@ -271,12 +270,12 @@ bond_unref(struct bond *bond) hmap_remove(all_bonds, &bond->hmap_node); ovs_rwlock_unlock(&rwlock); - HMAP_FOR_EACH_POP (slave, hmap_node, &bond->slaves) { - /* Client owns 'slave->netdev'. */ - free(slave->name); - free(slave); + HMAP_FOR_EACH_POP (sub, hmap_node, &bond->subs) { + /* Client owns 'sub->netdev'. */ + free(sub->name); + free(sub); } - hmap_destroy(&bond->slaves); + hmap_destroy(&bond->subs); ovs_mutex_destroy(&bond->mutex); @@ -353,14 +352,14 @@ update_recirc_rules__(struct bond *bond) return; } else { for (i = 0; i < BOND_BUCKETS; i++) { - struct bond_slave *slave = bond->hash[i].slave; + struct bond_sub *sub = bond->hash[i].sub; - if (slave) { + if (sub) { match_init_catchall(&match); match_set_recirc_id(&match, bond->recirc_id); match_set_dp_hash_masked(&match, i, BOND_MASK); - add_pr_rule(bond, &match, slave->ofp_port, + add_pr_rule(bond, &match, sub->ofp_port, &bond->hash[i].pr_rule); } } @@ -421,9 +420,9 @@ update_recirc_rules(struct bond *bond) /* Updates 'bond''s overall configuration to 's'. * - * The caller should register each slave on 'bond' by calling - * bond_slave_register(). This is optional if none of the slaves' - * configuration has changed. In any case it can't hurt. + * The caller should register each sub-interface on 'bond' by calling + * bond_sub_register(). This is optional if none of the subs' configuration + * has changed. In any case it can't hurt. * * Returns true if the configuration has changed in such a way that requires * flow revalidation. @@ -502,21 +501,21 @@ bond_reconfigure(struct bond *bond, const struct bond_settings *s) return revalidate; } -static struct bond_slave * -bond_find_slave_by_mac(const struct bond *bond, const struct eth_addr mac) +static struct bond_sub * +bond_find_sub_by_mac(const struct bond *bond, const struct eth_addr mac) { - struct bond_slave *slave; + struct bond_sub *sub; - /* Find the last active slave */ - HMAP_FOR_EACH(slave, hmap_node, &bond->slaves) { - struct eth_addr slave_mac; + /* Find the last active sub */ + HMAP_FOR_EACH(sub, hmap_node, &bond->subs) { + struct eth_addr sub_mac; - if (netdev_get_etheraddr(slave->netdev, &slave_mac)) { + if (netdev_get_etheraddr(sub->netdev, &sub_mac)) { continue; } - if (eth_addr_equals(slave_mac, mac)) { - return slave; + if (eth_addr_equals(sub_mac, mac)) { + return sub; } } @@ -524,139 +523,139 @@ bond_find_slave_by_mac(const struct bond *bond, const struct eth_addr mac) } static void -bond_active_slave_changed(struct bond *bond) +bond_active_sub_changed(struct bond *bond) { - if (bond->active_slave) { + if (bond->active_sub) { struct eth_addr mac; - netdev_get_etheraddr(bond->active_slave->netdev, &mac); - bond->active_slave_mac = mac; + netdev_get_etheraddr(bond->active_sub->netdev, &mac); + bond->active_sub_mac = mac; } else { - bond->active_slave_mac = eth_addr_zero; + bond->active_sub_mac = eth_addr_zero; } - bond->active_slave_changed = true; + bond->active_sub_changed = true; seq_change(connectivity_seq_get()); } static void -bond_slave_set_netdev__(struct bond_slave *slave, struct netdev *netdev) +bond_sub_set_netdev__(struct bond_sub *sub, struct netdev *netdev) OVS_REQ_WRLOCK(rwlock) { - if (slave->netdev != netdev) { - slave->netdev = netdev; - slave->change_seq = 0; + if (sub->netdev != netdev) { + sub->netdev = netdev; + sub->change_seq = 0; } } -/* Registers 'slave_' as a slave of 'bond'. The 'slave_' pointer is an - * arbitrary client-provided pointer that uniquely identifies a slave within a - * bond. If 'slave_' already exists within 'bond' then this function - * reconfigures the existing slave. +/* Registers 'sub_' as a sub-interface of 'bond'. The 'sub_' pointer is an + * arbitrary client-provided pointer that uniquely identifies a sub within a + * bond. If 'sub_' already exists within 'bond' then this function + * reconfigures the existing sub. * - * 'netdev' must be the network device that 'slave_' represents. It is owned + * 'netdev' must be the network device that 'sub_' represents. It is owned * by the client, so the client must not close it before either unregistering - * 'slave_' or destroying 'bond'. + * 'sub_' or destroying 'bond'. */ void -bond_slave_register(struct bond *bond, void *slave_, - ofp_port_t ofport, struct netdev *netdev) +bond_sub_register(struct bond *bond, void *sub_, + ofp_port_t ofport, struct netdev *netdev) { - struct bond_slave *slave; + struct bond_sub *sub; ovs_rwlock_wrlock(&rwlock); - slave = bond_slave_lookup(bond, slave_); - if (!slave) { - slave = xzalloc(sizeof *slave); - - hmap_insert(&bond->slaves, &slave->hmap_node, hash_pointer(slave_, 0)); - slave->bond = bond; - slave->aux = slave_; - slave->ofp_port = ofport; - slave->delay_expires = LLONG_MAX; - slave->name = xstrdup(netdev_get_name(netdev)); + sub = bond_sub_lookup(bond, sub_); + if (!sub) { + sub = xzalloc(sizeof *sub); + + hmap_insert(&bond->subs, &sub->hmap_node, hash_pointer(sub_, 0)); + sub->bond = bond; + sub->aux = sub_; + sub->ofp_port = ofport; + sub->delay_expires = LLONG_MAX; + sub->name = xstrdup(netdev_get_name(netdev)); bond->bond_revalidate = true; - slave->enabled = false; - bond_enable_slave(slave, netdev_get_carrier(netdev)); + sub->enabled = false; + bond_enable_sub(sub, netdev_get_carrier(netdev)); } - bond_slave_set_netdev__(slave, netdev); + bond_sub_set_netdev__(sub, netdev); - free(slave->name); - slave->name = xstrdup(netdev_get_name(netdev)); + free(sub->name); + sub->name = xstrdup(netdev_get_name(netdev)); ovs_rwlock_unlock(&rwlock); } -/* Updates the network device to be used with 'slave_' to 'netdev'. +/* Updates the network device to be used with 'sub_' to 'netdev'. * * This is useful if the caller closes and re-opens the network device - * registered with bond_slave_register() but doesn't need to change anything + * registered with bond_sub_register() but doesn't need to change anything * else. */ void -bond_slave_set_netdev(struct bond *bond, void *slave_, struct netdev *netdev) +bond_sub_set_netdev(struct bond *bond, void *sub_, struct netdev *netdev) { - struct bond_slave *slave; + struct bond_sub *sub; ovs_rwlock_wrlock(&rwlock); - slave = bond_slave_lookup(bond, slave_); - if (slave) { - bond_slave_set_netdev__(slave, netdev); + sub = bond_sub_lookup(bond, sub_); + if (sub) { + bond_sub_set_netdev__(sub, netdev); } ovs_rwlock_unlock(&rwlock); } -/* Unregisters 'slave_' from 'bond'. If 'bond' does not contain such a slave - * then this function has no effect. +/* Unregisters 'sub_' from 'bond'. If 'bond' does not contain such a + * sub-interface then this function has no effect. * - * Unregistering a slave invalidates all flows. */ + * Unregistering a sub invalidates all flows. */ void -bond_slave_unregister(struct bond *bond, const void *slave_) +bond_sub_unregister(struct bond *bond, const void *sub_) { - struct bond_slave *slave; + struct bond_sub *sub; bool del_active; ovs_rwlock_wrlock(&rwlock); - slave = bond_slave_lookup(bond, slave_); - if (!slave) { + sub = bond_sub_lookup(bond, sub_); + if (!sub) { goto out; } bond->bond_revalidate = true; - bond_enable_slave(slave, false); + bond_enable_sub(sub, false); - del_active = bond->active_slave == slave; + del_active = bond->active_sub == sub; if (bond->hash) { struct bond_entry *e; for (e = bond->hash; e <= &bond->hash[BOND_MASK]; e++) { - if (e->slave == slave) { - e->slave = NULL; + if (e->sub == sub) { + e->sub = NULL; } } } - free(slave->name); + free(sub->name); - hmap_remove(&bond->slaves, &slave->hmap_node); - /* Client owns 'slave->netdev'. */ - free(slave); + hmap_remove(&bond->subs, &sub->hmap_node); + /* Client owns 'sub->netdev'. */ + free(sub); if (del_active) { - bond_choose_active_slave(bond); + bond_choose_active_sub(bond); bond->send_learning_packets = true; } out: ovs_rwlock_unlock(&rwlock); } -/* Should be called on each slave in 'bond' before bond_run() to indicate - * whether or not 'slave_' may be enabled. This function is intended to allow +/* Should be called on each sub in 'bond' before bond_run() to indicate + * whether or not 'sub_' may be enabled. This function is intended to allow * other protocols to have some impact on bonding decisions. For example LACP - * or high level link monitoring protocols may decide that a given slave should + * or high level link monitoring protocols may decide that a given sub should * not be able to send traffic. */ void -bond_slave_set_may_enable(struct bond *bond, void *slave_, bool may_enable) +bond_sub_set_may_enable(struct bond *bond, void *sub_, bool may_enable) { ovs_rwlock_wrlock(&rwlock); - bond_slave_lookup(bond, slave_)->may_enable = may_enable; + bond_sub_lookup(bond, sub_)->may_enable = may_enable; ovs_rwlock_unlock(&rwlock); } @@ -668,7 +667,7 @@ bond_slave_set_may_enable(struct bond *bond, void *slave_, bool may_enable) bool bond_run(struct bond *bond, enum lacp_status lacp_status) { - struct bond_slave *slave; + struct bond_sub *sub; bool revalidate; ovs_rwlock_wrlock(&rwlock); @@ -684,13 +683,13 @@ bond_run(struct bond *bond, enum lacp_status lacp_status) } } - /* Enable slaves based on link status and LACP feedback. */ - HMAP_FOR_EACH (slave, hmap_node, &bond->slaves) { - bond_link_status_update(slave); - slave->change_seq = seq_read(connectivity_seq_get()); + /* Enable subs based on link status and LACP feedback. */ + HMAP_FOR_EACH (sub, hmap_node, &bond->subs) { + bond_link_status_update(sub); + sub->change_seq = seq_read(connectivity_seq_get()); } - if (!bond->active_slave || !bond->active_slave->enabled) { - bond_choose_active_slave(bond); + if (!bond->active_sub || !bond->active_sub->enabled) { + bond_choose_active_sub(bond); } revalidate = bond->bond_revalidate; @@ -704,15 +703,15 @@ bond_run(struct bond *bond, enum lacp_status lacp_status) void bond_wait(struct bond *bond) { - struct bond_slave *slave; + struct bond_sub *sub; ovs_rwlock_rdlock(&rwlock); - HMAP_FOR_EACH (slave, hmap_node, &bond->slaves) { - if (slave->delay_expires != LLONG_MAX) { - poll_timer_wait_until(slave->delay_expires); + HMAP_FOR_EACH (sub, hmap_node, &bond->subs) { + if (sub->delay_expires != LLONG_MAX) { + poll_timer_wait_until(sub->delay_expires); } - seq_wait(connectivity_seq_get(), slave->change_seq); + seq_wait(connectivity_seq_get(), sub->change_seq); } if (bond->bond_revalidate) { @@ -734,7 +733,7 @@ may_send_learning_packets(const struct bond *bond) return ((bond->lacp_status == LACP_DISABLED && (bond->balance == BM_SLB || bond->balance == BM_AB)) || (bond->lacp_fallback_ab && bond->lacp_status == LACP_CONFIGURED)) - && bond->active_slave; + && bond->active_sub; } /* Returns true if 'bond' needs the client to send out packets to assist with @@ -769,7 +768,7 @@ struct dp_packet * bond_compose_learning_packet(struct bond *bond, const struct eth_addr eth_src, uint16_t vlan, void **port_aux) { - struct bond_slave *slave; + struct bond_sub *sub; struct dp_packet *packet; struct flow flow; @@ -777,7 +776,7 @@ bond_compose_learning_packet(struct bond *bond, const struct eth_addr eth_src, ovs_assert(may_send_learning_packets(bond)); memset(&flow, 0, sizeof flow); flow.dl_src = eth_src; - slave = choose_output_slave(bond, &flow, NULL, vlan); + sub = choose_output_sub(bond, &flow, NULL, vlan); packet = dp_packet_new(0); compose_rarp(packet, eth_src); @@ -785,7 +784,7 @@ bond_compose_learning_packet(struct bond *bond, const struct eth_addr eth_src, eth_push_vlan(packet, htons(ETH_TYPE_VLAN), htons(vlan)); } - *port_aux = slave->aux; + *port_aux = sub->aux; ovs_rwlock_unlock(&rwlock); return packet; } @@ -799,7 +798,7 @@ bond_is_falling_back_to_ab(const struct bond *bond) && bond->lacp_status == LACP_CONFIGURED); } -/* Checks whether a packet that arrived on 'slave_' within 'bond', with an +/* Checks whether a packet that arrived on 'sub_' within 'bond', with an * Ethernet destination address of 'eth_dst', should be admitted. * * The return value is one of the following: @@ -815,22 +814,22 @@ bond_is_falling_back_to_ab(const struct bond *bond) * learning). */ enum bond_verdict -bond_check_admissibility(struct bond *bond, const void *slave_, +bond_check_admissibility(struct bond *bond, const void *sub_, const struct eth_addr eth_dst) { enum bond_verdict verdict = BV_DROP; - struct bond_slave *slave; + struct bond_sub *sub; static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); ovs_rwlock_rdlock(&rwlock); - slave = bond_slave_lookup(bond, slave_); - if (!slave) { + sub = bond_sub_lookup(bond, sub_); + if (!sub) { goto out; } /* LACP bonds have very loose admissibility restrictions because we can * assume the remote switch is aware of the bond and will "do the right - * thing". However, as a precaution we drop packets on disabled slaves + * thing". However, as a precaution we drop packets on disabled subs * because no correctly implemented partner switch should be sending * packets to them. * @@ -838,14 +837,15 @@ bond_check_admissibility(struct bond *bond, const void *slave_, * drop all incoming traffic except if lacp_fallback_ab is enabled. */ switch (bond->lacp_status) { case LACP_NEGOTIATED: - /* To reduce packet-drops due to delay in enabling of slave (post + /* To reduce packet-drops due to delay in enabling of sub (post * LACP-SYNC), from main thread, check for may_enable as well. * When may_enable is TRUE, it means LACP is UP and waiting for the - * main thread to run LACP state machine and enable the slave. */ - verdict = (slave->enabled || slave->may_enable) ? BV_ACCEPT : BV_DROP; - if (!slave->enabled && slave->may_enable) { - VLOG_DBG_RL(&rl, "bond %s: slave %s: main thread not yet enabled slave", - bond->name, bond->active_slave->name); + * main thread to run LACP state machine and enable the sub. */ + verdict = (sub->enabled || sub->may_enable) ? BV_ACCEPT : BV_DROP; + if (!sub->enabled && sub->may_enable) { + VLOG_DBG_RL(&rl, "bond %s: interface %s: " + "main thread has not yet enabled interface", + bond->name, bond->active_sub->name); } goto out; case LACP_CONFIGURED: @@ -860,9 +860,9 @@ bond_check_admissibility(struct bond *bond, const void *slave_, break; } - /* Drop all multicast packets on inactive slaves. */ + /* Drop all multicast packets on inactive subs. */ if (eth_addr_is_multicast(eth_dst)) { - if (bond->active_slave != slave) { + if (bond->active_sub != sub) { goto out; } } @@ -879,12 +879,12 @@ bond_check_admissibility(struct bond *bond, const void *slave_, /* fall through */ case BM_AB: - /* Drop all packets which arrive on backup slaves. This is similar to + /* Drop all packets which arrive on backup subs. This is similar to * how Linux bonding handles active-backup bonds. */ - if (bond->active_slave != slave) { + if (bond->active_sub != sub) { VLOG_DBG_RL(&rl, "active-backup bond received packet on backup" - " slave (%s) destined for " ETH_ADDR_FMT, - slave->name, ETH_ADDR_ARGS(eth_dst)); + " interface (%s) destined for " ETH_ADDR_FMT, + sub->name, ETH_ADDR_ARGS(eth_dst)); goto out; } verdict = BV_ACCEPT; @@ -892,27 +892,28 @@ bond_check_admissibility(struct bond *bond, const void *slave_, case BM_SLB: /* Drop all packets for which we have learned a different input port, - * because we probably sent the packet on one slave and got it back on + * because we probably sent the packet on one sub and got it back on * the other. Gratuitous ARP packets are an exception to this rule: * the host has moved to another switch. The exception to the * exception is if we locked the learning table to avoid reflections on - * bond slaves. */ + * bond subs. */ verdict = BV_DROP_IF_MOVED; goto out; } OVS_NOT_REACHED(); out: - if (slave && (verdict != BV_ACCEPT)) { - VLOG_DBG_RL(&rl, "slave (%s): Admissibility verdict is to drop pkt %s." - "active slave: %s, may_enable: %s enable: %s " + if (sub && (verdict != BV_ACCEPT)) { + VLOG_DBG_RL(&rl, "interface (%s): " + "Admissibility verdict is to drop pkt %s." + "active interface: %s, may_enable: %s enable: %s " "LACP status:%d", - slave->name, + sub->name, (verdict == BV_DROP_IF_MOVED) ? "as different port is learned" : "", - (bond->active_slave == slave) ? "true" : "false", - slave->may_enable ? "true" : "false", - slave->enabled ? "true" : "false", + (bond->active_sub == sub) ? "true" : "false", + sub->may_enable ? "true" : "false", + sub->enabled ? "true" : "false", bond->lacp_status); } @@ -921,9 +922,9 @@ out: } -/* Returns the slave (registered on 'bond' by bond_slave_register()) to which - * a packet with the given 'flow' and 'vlan' should be forwarded. Returns - * NULL if the packet should be dropped because no slaves are enabled. +/* Returns the sub-interface (registered on 'bond' by bond_sub_register()) to + * which a packet with the given 'flow' and 'vlan' should be forwarded. + * Returns NULL if the packet should be dropped because no subs are enabled. * * 'vlan' is not necessarily the same as 'flow->vlan_tci'. First, 'vlan' * should be a VID only (i.e. excluding the PCP bits). Second, @@ -936,15 +937,15 @@ out: * have been initialized (e.g., by flow_wildcards_init_catchall()). */ void * -bond_choose_output_slave(struct bond *bond, const struct flow *flow, +bond_choose_output_sub(struct bond *bond, const struct flow *flow, struct flow_wildcards *wc, uint16_t vlan) { - struct bond_slave *slave; + struct bond_sub *sub; void *aux; ovs_rwlock_rdlock(&rwlock); - slave = choose_output_slave(bond, flow, wc, vlan); - aux = slave ? slave->aux : NULL; + sub = choose_output_sub(bond, flow, wc, vlan); + aux = sub ? sub->aux : NULL; ovs_rwlock_unlock(&rwlock); return aux; @@ -955,7 +956,7 @@ static void bond_entry_account(struct bond_entry *entry, uint64_t rule_tx_bytes) OVS_REQ_WRLOCK(rwlock) { - if (entry->slave) { + if (entry->sub) { uint64_t delta; delta = rule_tx_bytes - entry->pr_tx_bytes; @@ -1014,12 +1015,12 @@ bond_update_post_recirc_rules__(struct bond* bond, const bool force) /* Make sure all bond entries are populated */ for (e = bond->hash; e <= &bond->hash[BOND_MASK]; e++) { - if (!e->slave || !e->slave->enabled) { + if (!e->sub || !e->sub->enabled) { update_rules = true; - e->slave = CONTAINER_OF(hmap_random_node(&bond->slaves), - struct bond_slave, hmap_node); - if (!e->slave->enabled) { - e->slave = bond->active_slave; + e->sub = CONTAINER_OF(hmap_random_node(&bond->subs), + struct bond_sub, hmap_node); + if (!e->sub->enabled) { + e->sub = bond->active_sub; } } } @@ -1077,10 +1078,10 @@ bond_account(struct bond *bond, const struct flow *flow, uint16_t vlan, ovs_rwlock_unlock(&rwlock); } -static struct bond_slave * -bond_slave_from_bal_node(struct ovs_list *bal) OVS_REQ_RDLOCK(rwlock) +static struct bond_sub * +bond_sub_from_bal_node(struct ovs_list *bal) OVS_REQ_RDLOCK(rwlock) { - return CONTAINER_OF(bal, struct bond_slave, bal_node); + return CONTAINER_OF(bal, struct bond_sub, bal_node); } static void @@ -1089,24 +1090,24 @@ log_bals(struct bond *bond, const struct ovs_list *bals) { if (VLOG_IS_DBG_ENABLED()) { struct ds ds = DS_EMPTY_INITIALIZER; - const struct bond_slave *slave; + const struct bond_sub *sub; - LIST_FOR_EACH (slave, bal_node, bals) { + LIST_FOR_EACH (sub, bal_node, bals) { if (ds.length) { ds_put_char(&ds, ','); } ds_put_format(&ds, " %s %"PRIu64"kB", - slave->name, slave->tx_bytes / 1024); + sub->name, sub->tx_bytes / 1024); - if (!slave->enabled) { + if (!sub->enabled) { ds_put_cstr(&ds, " (disabled)"); } - if (!ovs_list_is_empty(&slave->entries)) { + if (!ovs_list_is_empty(&sub->entries)) { struct bond_entry *e; ds_put_cstr(&ds, " ("); - LIST_FOR_EACH (e, list_node, &slave->entries) { - if (&e->list_node != ovs_list_front(&slave->entries)) { + LIST_FOR_EACH (e, list_node, &sub->entries) { + if (&e->list_node != ovs_list_front(&sub->entries)) { ds_put_cstr(&ds, " + "); } ds_put_format(&ds, "h%"PRIdPTR": %"PRIu64"kB", @@ -1120,12 +1121,12 @@ log_bals(struct bond *bond, const struct ovs_list *bals) } } -/* Shifts 'hash' from its current slave to 'to'. */ +/* Shifts 'hash' from its current sub to 'to'. */ static void -bond_shift_load(struct bond_entry *hash, struct bond_slave *to) +bond_shift_load(struct bond_entry *hash, struct bond_sub *to) OVS_REQ_WRLOCK(rwlock) { - struct bond_slave *from = hash->slave; + struct bond_sub *from = hash->sub; struct bond *bond = from->bond; uint64_t delta = hash->tx_bytes; @@ -1142,19 +1143,20 @@ bond_shift_load(struct bond_entry *hash, struct bond_slave *to) to->tx_bytes += delta; /* Arrange for flows to be revalidated. */ - hash->slave = to; + hash->sub = to; bond->bond_revalidate = true; } /* Picks and returns a bond_entry to migrate from 'from' (the most heavily - * loaded bond slave) to a bond slave that has 'to_tx_bytes' bytes of load, - * given that doing so must decrease the ratio of the load on the two slaves by - * at least 0.1. Returns NULL if there is no appropriate entry. + * loaded bond sub-interface) to a bond sub-interface that has 'to_tx_bytes' + * bytes of load, given that doing so must decrease the ratio of the load on + * the two subs by at least 0.1. Returns NULL if there is no appropriate + * entry. * * The list of entries isn't sorted. I don't know of a reason to prefer to * shift away small hashes or large hashes. */ static struct bond_entry * -choose_entry_to_migrate(const struct bond_slave *from, uint64_t to_tx_bytes) +choose_entry_to_migrate(const struct bond_sub *from, uint64_t to_tx_bytes) OVS_REQ_WRLOCK(rwlock) { struct bond_entry *e; @@ -1191,28 +1193,28 @@ choose_entry_to_migrate(const struct bond_slave *from, uint64_t to_tx_bytes) return NULL; } -/* Inserts 'slave' into 'bals' so that descending order of 'tx_bytes' is +/* Inserts 'sub' into 'bals' so that descending order of 'tx_bytes' is * maintained. */ static void -insert_bal(struct ovs_list *bals, struct bond_slave *slave) +insert_bal(struct ovs_list *bals, struct bond_sub *sub) { - struct bond_slave *pos; + struct bond_sub *pos; LIST_FOR_EACH (pos, bal_node, bals) { - if (slave->tx_bytes > pos->tx_bytes) { + if (sub->tx_bytes > pos->tx_bytes) { break; } } - ovs_list_insert(&pos->bal_node, &slave->bal_node); + ovs_list_insert(&pos->bal_node, &sub->bal_node); } -/* Removes 'slave' from its current list and then inserts it into 'bals' so +/* Removes 'sub' from its current list and then inserts it into 'bals' so * that descending order of 'tx_bytes' is maintained. */ static void -reinsert_bal(struct ovs_list *bals, struct bond_slave *slave) +reinsert_bal(struct ovs_list *bals, struct bond_sub *sub) { - ovs_list_remove(&slave->bal_node); - insert_bal(bals, slave); + ovs_list_remove(&sub->bal_node); + insert_bal(bals, sub); } /* If 'bond' needs rebalancing, does so. @@ -1224,7 +1226,7 @@ reinsert_bal(struct ovs_list *bals, struct bond_slave *slave) void bond_rebalance(struct bond *bond) { - struct bond_slave *slave; + struct bond_sub *sub; struct bond_entry *e; struct ovs_list bals; bool rebalanced = false; @@ -1243,41 +1245,41 @@ bond_rebalance(struct bond *bond) bond_recirculation_account(bond); } - /* Add each bond_entry to its slave's 'entries' list. - * Compute each slave's tx_bytes as the sum of its entries' tx_bytes. */ - HMAP_FOR_EACH (slave, hmap_node, &bond->slaves) { - slave->tx_bytes = 0; - ovs_list_init(&slave->entries); + /* Add each bond_entry to its sub's 'entries' list. + * Compute each sub's tx_bytes as the sum of its entries' tx_bytes. */ + HMAP_FOR_EACH (sub, hmap_node, &bond->subs) { + sub->tx_bytes = 0; + ovs_list_init(&sub->entries); } for (e = &bond->hash[0]; e <= &bond->hash[BOND_MASK]; e++) { - if (e->slave && e->tx_bytes) { - e->slave->tx_bytes += e->tx_bytes; - ovs_list_push_back(&e->slave->entries, &e->list_node); + if (e->sub && e->tx_bytes) { + e->sub->tx_bytes += e->tx_bytes; + ovs_list_push_back(&e->sub->entries, &e->list_node); } } - /* Add enabled slaves to 'bals' in descending order of tx_bytes. + /* Add enabled subs to 'bals' in descending order of tx_bytes. * - * XXX This is O(n**2) in the number of slaves but it could be O(n lg n) + * XXX This is O(n**2) in the number of subs but it could be O(n lg n) * with a proper list sort algorithm. */ ovs_list_init(&bals); - HMAP_FOR_EACH (slave, hmap_node, &bond->slaves) { - if (slave->enabled) { - insert_bal(&bals, slave); + HMAP_FOR_EACH (sub, hmap_node, &bond->subs) { + if (sub->enabled) { + insert_bal(&bals, sub); } } log_bals(bond, &bals); - /* Shift load from the most-loaded slaves to the least-loaded slaves. */ + /* Shift load from the most-loaded subs to the least-loaded subs. */ while (!ovs_list_is_short(&bals)) { - struct bond_slave *from = bond_slave_from_bal_node(ovs_list_front(&bals)); - struct bond_slave *to = bond_slave_from_bal_node(ovs_list_back(&bals)); + struct bond_sub *from = bond_sub_from_bal_node(ovs_list_front(&bals)); + struct bond_sub *to = bond_sub_from_bal_node(ovs_list_back(&bals)); uint64_t overload; overload = from->tx_bytes - to->tx_bytes; if (overload < to->tx_bytes >> 5 || overload < 100000) { - /* The extra load on 'from' (and all less-loaded slaves), compared - * to that of 'to' (the least-loaded slave), is less than ~3%, or + /* The extra load on 'from' (and all less-loaded subs), compared + * to that of 'to' (the least-loaded sub), is less than ~3%, or * it is less than ~1Mbps. No point in rebalancing. */ break; } @@ -1291,7 +1293,7 @@ bond_rebalance(struct bond *bond) /* Delete element from from->entries. * * We don't add the element to to->hashes. That would only allow - * 'e' to be migrated to another slave in this rebalancing run, and + * 'e' to be migrated to another sub in this rebalancing run, and * there is no point in doing that. */ ovs_list_remove(&e->list_node); @@ -1337,14 +1339,14 @@ bond_find(const char *name) OVS_REQ_RDLOCK(rwlock) return NULL; } -static struct bond_slave * -bond_lookup_slave(struct bond *bond, const char *slave_name) +static struct bond_sub * +bond_lookup_sub(struct bond *bond, const char *sub_name) { - struct bond_slave *slave; + struct bond_sub *sub; - HMAP_FOR_EACH (slave, hmap_node, &bond->slaves) { - if (!strcmp(slave->name, slave_name)) { - return slave; + HMAP_FOR_EACH (sub, hmap_node, &bond->subs) { + if (!strcmp(sub->name, sub_name)) { + return sub; } } return NULL; @@ -1358,22 +1360,22 @@ bond_unixctl_list(struct unixctl_conn *conn, struct ds ds = DS_EMPTY_INITIALIZER; const struct bond *bond; - ds_put_cstr(&ds, "bond\ttype\trecircID\tslaves\n"); + ds_put_cstr(&ds, "bond\ttype\trecircID\tinterfaces\n"); ovs_rwlock_rdlock(&rwlock); HMAP_FOR_EACH (bond, hmap_node, all_bonds) { - const struct bond_slave *slave; + const struct bond_sub *sub; size_t i; ds_put_format(&ds, "%s\t%s\t%d\t", bond->name, bond_mode_to_string(bond->balance), bond->recirc_id); i = 0; - HMAP_FOR_EACH (slave, hmap_node, &bond->slaves) { + HMAP_FOR_EACH (sub, hmap_node, &bond->subs) { if (i++ > 0) { ds_put_cstr(&ds, ", "); } - ds_put_cstr(&ds, slave->name); + ds_put_cstr(&ds, sub->name); } ds_put_char(&ds, '\n'); } @@ -1386,9 +1388,9 @@ static void bond_print_details(struct ds *ds, const struct bond *bond) OVS_REQ_RDLOCK(rwlock) { - struct shash slave_shash = SHASH_INITIALIZER(&slave_shash); - const struct shash_node **sorted_slaves = NULL; - const struct bond_slave *slave; + struct shash sub_shash = SHASH_INITIALIZER(&sub_shash); + const struct shash_node **sorted_subs = NULL; + const struct bond_sub *sub; bool use_lb_output_action; bool may_recirc; uint32_t recirc_id; @@ -1437,35 +1439,35 @@ bond_print_details(struct ds *ds, const struct bond *bond) ds_put_format(ds, "lacp_fallback_ab: %s\n", bond->lacp_fallback_ab ? "true" : "false"); - ds_put_cstr(ds, "active slave mac: "); - ds_put_format(ds, ETH_ADDR_FMT, ETH_ADDR_ARGS(bond->active_slave_mac)); - slave = bond_find_slave_by_mac(bond, bond->active_slave_mac); - ds_put_format(ds,"(%s)\n", slave ? slave->name : "none"); + ds_put_cstr(ds, "active interface mac: "); + ds_put_format(ds, ETH_ADDR_FMT, ETH_ADDR_ARGS(bond->active_sub_mac)); + sub = bond_find_sub_by_mac(bond, bond->active_sub_mac); + ds_put_format(ds,"(%s)\n", sub ? sub->name : "none"); - HMAP_FOR_EACH (slave, hmap_node, &bond->slaves) { - shash_add(&slave_shash, slave->name, slave); + HMAP_FOR_EACH (sub, hmap_node, &bond->subs) { + shash_add(&sub_shash, sub->name, sub); } - sorted_slaves = shash_sort(&slave_shash); + sorted_subs = shash_sort(&sub_shash); - for (i = 0; i < shash_count(&slave_shash); i++) { + for (i = 0; i < shash_count(&sub_shash); i++) { struct bond_entry *be; - slave = sorted_slaves[i]->data; + sub = sorted_subs[i]->data; /* Basic info. */ - ds_put_format(ds, "\nslave %s: %s\n", - slave->name, slave->enabled ? "enabled" : "disabled"); - if (slave == bond->active_slave) { - ds_put_cstr(ds, " active slave\n"); + ds_put_format(ds, "\ninterface %s: %s\n", + sub->name, sub->enabled ? "enabled" : "disabled"); + if (sub == bond->active_sub) { + ds_put_cstr(ds, " active interface\n"); } - if (slave->delay_expires != LLONG_MAX) { + if (sub->delay_expires != LLONG_MAX) { ds_put_format(ds, " %s expires in %lld ms\n", - slave->enabled ? "downdelay" : "updelay", - slave->delay_expires - time_msec()); + sub->enabled ? "downdelay" : "updelay", + sub->delay_expires - time_msec()); } ds_put_format(ds, " may_enable: %s\n", - slave->may_enable ? "true" : "false"); + sub->may_enable ? "true" : "false"); if (!bond_is_balanced(bond)) { continue; @@ -1476,7 +1478,7 @@ bond_print_details(struct ds *ds, const struct bond *bond) int hash = be - bond->hash; uint64_t be_tx_k; - if (be->slave != slave) { + if (be->sub != sub) { continue; } @@ -1489,8 +1491,8 @@ bond_print_details(struct ds *ds, const struct bond *bond) /* XXX How can we list the MACs assigned to hashes of SLB bonds? */ } } - shash_destroy(&slave_shash); - free(sorted_slaves); + shash_destroy(&sub_shash); + free(sorted_subs); ds_put_cstr(ds, "\n"); } @@ -1532,9 +1534,9 @@ bond_unixctl_migrate(struct unixctl_conn *conn, { const char *bond_s = argv[1]; const char *hash_s = argv[2]; - const char *slave_s = argv[3]; + const char *sub_s = argv[3]; struct bond *bond; - struct bond_slave *slave; + struct bond_sub *sub; struct bond_entry *entry; int hash; @@ -1557,20 +1559,21 @@ bond_unixctl_migrate(struct unixctl_conn *conn, goto out; } - slave = bond_lookup_slave(bond, slave_s); - if (!slave) { - unixctl_command_reply_error(conn, "no such slave"); + sub = bond_lookup_sub(bond, sub_s); + if (!sub) { + unixctl_command_reply_error(conn, "no such interface"); goto out; } - if (!slave->enabled) { - unixctl_command_reply_error(conn, "cannot migrate to disabled slave"); + if (!sub->enabled) { + unixctl_command_reply_error(conn, + "cannot migrate to disabled interface"); goto out; } entry = &bond->hash[hash]; bond->bond_revalidate = true; - entry->slave = slave; + entry->sub = sub; unixctl_command_reply(conn, "migrated"); out: @@ -1578,14 +1581,14 @@ out: } static void -bond_unixctl_set_active_slave(struct unixctl_conn *conn, - int argc OVS_UNUSED, const char *argv[], - void *aux OVS_UNUSED) +bond_unixctl_set_active_sub(struct unixctl_conn *conn, + int argc OVS_UNUSED, const char *argv[], + void *aux OVS_UNUSED) { const char *bond_s = argv[1]; - const char *slave_s = argv[2]; + const char *sub_s = argv[2]; struct bond *bond; - struct bond_slave *slave; + struct bond_sub *sub; ovs_rwlock_wrlock(&rwlock); bond = bond_find(bond_s); @@ -1594,25 +1597,26 @@ bond_unixctl_set_active_slave(struct unixctl_conn *conn, goto out; } - slave = bond_lookup_slave(bond, slave_s); - if (!slave) { - unixctl_command_reply_error(conn, "no such slave"); + sub = bond_lookup_sub(bond, sub_s); + if (!sub) { + unixctl_command_reply_error(conn, "no such interface"); goto out; } - if (!slave->enabled) { - unixctl_command_reply_error(conn, "cannot make disabled slave active"); + if (!sub->enabled) { + unixctl_command_reply_error(conn, + "cannot make disabled interface active"); goto out; } - if (bond->active_slave != slave) { + if (bond->active_sub != sub) { bond->bond_revalidate = true; - bond->active_slave = slave; + bond->active_sub = sub; VLOG_INFO("bond %s: active interface is now %s", - bond->name, slave->name); + bond->name, sub->name); bond->send_learning_packets = true; unixctl_command_reply(conn, "done"); - bond_active_slave_changed(bond); + bond_active_sub_changed(bond); } else { unixctl_command_reply(conn, "no change"); } @@ -1621,12 +1625,12 @@ out: } static void -enable_slave(struct unixctl_conn *conn, const char *argv[], bool enable) +enable_sub(struct unixctl_conn *conn, const char *argv[], bool enable) { const char *bond_s = argv[1]; - const char *slave_s = argv[2]; + const char *sub_s = argv[2]; struct bond *bond; - struct bond_slave *slave; + struct bond_sub *sub; ovs_rwlock_wrlock(&rwlock); bond = bond_find(bond_s); @@ -1635,13 +1639,13 @@ enable_slave(struct unixctl_conn *conn, const char *argv[], bool enable) goto out; } - slave = bond_lookup_slave(bond, slave_s); - if (!slave) { - unixctl_command_reply_error(conn, "no such slave"); + sub = bond_lookup_sub(bond, sub_s); + if (!sub) { + unixctl_command_reply_error(conn, "no such interface"); goto out; } - bond_enable_slave(slave, enable); + bond_enable_sub(sub, enable); unixctl_command_reply(conn, enable ? "enabled" : "disabled"); out: @@ -1649,19 +1653,19 @@ out: } static void -bond_unixctl_enable_slave(struct unixctl_conn *conn, - int argc OVS_UNUSED, const char *argv[], - void *aux OVS_UNUSED) +bond_unixctl_enable_sub(struct unixctl_conn *conn, + int argc OVS_UNUSED, const char *argv[], + void *aux OVS_UNUSED) { - enable_slave(conn, argv, true); + enable_sub(conn, argv, true); } static void -bond_unixctl_disable_slave(struct unixctl_conn *conn, +bond_unixctl_disable_sub(struct unixctl_conn *conn, int argc OVS_UNUSED, const char *argv[], void *aux OVS_UNUSED) { - enable_slave(conn, argv, false); + enable_sub(conn, argv, false); } static void @@ -1712,16 +1716,24 @@ bond_init(void) unixctl_command_register("bond/list", "", 0, 0, bond_unixctl_list, NULL); unixctl_command_register("bond/show", "[port]", 0, 1, bond_unixctl_show, NULL); - unixctl_command_register("bond/migrate", "port hash slave", 3, 3, + unixctl_command_register("bond/migrate", "port hash sub", 3, 3, bond_unixctl_migrate, NULL); - unixctl_command_register("bond/set-active-slave", "port slave", 2, 2, - bond_unixctl_set_active_slave, NULL); - unixctl_command_register("bond/enable-slave", "port slave", 2, 2, - bond_unixctl_enable_slave, NULL); - unixctl_command_register("bond/disable-slave", "port slave", 2, 2, - bond_unixctl_disable_slave, NULL); + unixctl_command_register("bond/set-active-sub", "port sub", 2, 2, + bond_unixctl_set_active_sub, NULL); + unixctl_command_register("bond/enable-sub", "port sub", 2, 2, + bond_unixctl_enable_sub, NULL); + unixctl_command_register("bond/disable-sub", "port sub", 2, 2, + bond_unixctl_disable_sub, NULL); unixctl_command_register("bond/hash", "mac [vlan] [basis]", 1, 3, bond_unixctl_hash, NULL); + + /* Backward-compatibility command names. */ + unixctl_command_register("bond/set-active-slave", NULL, 2, 2, + bond_unixctl_set_active_sub, NULL); + unixctl_command_register("bond/enable-slave", NULL, 2, 2, + bond_unixctl_enable_sub, NULL); + unixctl_command_register("bond/disable-slave", NULL, 2, 2, + bond_unixctl_disable_sub, NULL); } static void @@ -1744,15 +1756,15 @@ bond_entry_reset(struct bond *bond) } } -static struct bond_slave * -bond_slave_lookup(struct bond *bond, const void *slave_) +static struct bond_sub * +bond_sub_lookup(struct bond *bond, const void *sub_) { - struct bond_slave *slave; + struct bond_sub *sub; - HMAP_FOR_EACH_IN_BUCKET (slave, hmap_node, hash_pointer(slave_, 0), - &bond->slaves) { - if (slave->aux == slave_) { - return slave; + HMAP_FOR_EACH_IN_BUCKET (sub, hmap_node, hash_pointer(sub_, 0), + &bond->subs) { + if (sub->aux == sub_) { + return sub; } } @@ -1760,51 +1772,51 @@ bond_slave_lookup(struct bond *bond, const void *slave_) } static void -bond_enable_slave(struct bond_slave *slave, bool enable) +bond_enable_sub(struct bond_sub *sub, bool enable) { - struct bond *bond = slave->bond; + struct bond *bond = sub->bond; - slave->delay_expires = LLONG_MAX; - if (enable != slave->enabled) { - slave->bond->bond_revalidate = true; - slave->enabled = enable; + sub->delay_expires = LLONG_MAX; + if (enable != sub->enabled) { + sub->bond->bond_revalidate = true; + sub->enabled = enable; - ovs_mutex_lock(&slave->bond->mutex); + ovs_mutex_lock(&sub->bond->mutex); if (enable) { - ovs_list_insert(&slave->bond->enabled_slaves, &slave->list_node); + ovs_list_insert(&sub->bond->enabled_subs, &sub->list_node); } else { bond->send_learning_packets = true; - ovs_list_remove(&slave->list_node); + ovs_list_remove(&sub->list_node); } - ovs_mutex_unlock(&slave->bond->mutex); + ovs_mutex_unlock(&sub->bond->mutex); - VLOG_INFO("interface %s: %s", slave->name, - slave->enabled ? "enabled" : "disabled"); + VLOG_INFO("interface %s: %s", sub->name, + sub->enabled ? "enabled" : "disabled"); } } static void -bond_link_status_update(struct bond_slave *slave) +bond_link_status_update(struct bond_sub *sub) { - struct bond *bond = slave->bond; + struct bond *bond = sub->bond; bool up; - up = netdev_get_carrier(slave->netdev) && slave->may_enable; - if ((up == slave->enabled) != (slave->delay_expires == LLONG_MAX)) { + up = netdev_get_carrier(sub->netdev) && sub->may_enable; + if ((up == sub->enabled) != (sub->delay_expires == LLONG_MAX)) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 20); VLOG_INFO_RL(&rl, "interface %s: link state %s", - slave->name, up ? "up" : "down"); - if (up == slave->enabled) { - slave->delay_expires = LLONG_MAX; + sub->name, up ? "up" : "down"); + if (up == sub->enabled) { + sub->delay_expires = LLONG_MAX; VLOG_INFO_RL(&rl, "interface %s: will not be %s", - slave->name, up ? "disabled" : "enabled"); + sub->name, up ? "disabled" : "enabled"); } else { int delay = up ? bond->updelay : bond->downdelay; - slave->delay_expires = time_msec() + delay; + sub->delay_expires = time_msec() + delay; if (delay) { VLOG_INFO_RL(&rl, "interface %s: will be %s if it stays %s " "for %d ms", - slave->name, + sub->name, up ? "enabled" : "disabled", up ? "up" : "down", delay); @@ -1812,8 +1824,8 @@ bond_link_status_update(struct bond_slave *slave) } } - if (time_msec() >= slave->delay_expires) { - bond_enable_slave(slave, up); + if (time_msec() >= sub->delay_expires) { + bond_enable_sub(sub, up); } } @@ -1834,29 +1846,29 @@ lookup_bond_entry(const struct bond *bond, const struct flow *flow, return &bond->hash[bond_hash(bond, flow, vlan) & BOND_MASK]; } -/* Selects and returns an enabled slave from the 'enabled_slaves' list - * in a round-robin fashion. If the 'enabled_slaves' list is empty, +/* Selects and returns an enabled sub from the 'enabled_subs' list + * in a round-robin fashion. If the 'enabled_subs' list is empty, * returns NULL. */ -static struct bond_slave * -get_enabled_slave(struct bond *bond) +static struct bond_sub * +get_enabled_sub(struct bond *bond) { struct ovs_list *node; ovs_mutex_lock(&bond->mutex); - if (ovs_list_is_empty(&bond->enabled_slaves)) { + if (ovs_list_is_empty(&bond->enabled_subs)) { ovs_mutex_unlock(&bond->mutex); return NULL; } - node = ovs_list_pop_front(&bond->enabled_slaves); - ovs_list_push_back(&bond->enabled_slaves, node); + node = ovs_list_pop_front(&bond->enabled_subs); + ovs_list_push_back(&bond->enabled_subs, node); ovs_mutex_unlock(&bond->mutex); - return CONTAINER_OF(node, struct bond_slave, list_node); + return CONTAINER_OF(node, struct bond_sub, list_node); } -static struct bond_slave * -choose_output_slave(const struct bond *bond, const struct flow *flow, +static struct bond_sub * +choose_output_sub(const struct bond *bond, const struct flow *flow, struct flow_wildcards *wc, uint16_t vlan) { struct bond_entry *e; @@ -1875,7 +1887,7 @@ choose_output_slave(const struct bond *bond, const struct flow *flow, switch (balance) { case BM_AB: - return bond->active_slave; + return bond->active_sub; case BM_TCP: if (bond->lacp_status != LACP_NEGOTIATED) { @@ -1891,83 +1903,83 @@ choose_output_slave(const struct bond *bond, const struct flow *flow, flow_mask_hash_fields(flow, wc, NX_HASH_FIELDS_ETH_SRC); } e = lookup_bond_entry(bond, flow, vlan); - if (!e->slave || !e->slave->enabled) { - e->slave = get_enabled_slave(CONST_CAST(struct bond*, bond)); + if (!e->sub || !e->sub->enabled) { + e->sub = get_enabled_sub(CONST_CAST(struct bond*, bond)); } - return e->slave; + return e->sub; default: OVS_NOT_REACHED(); } } -static struct bond_slave * -bond_choose_slave(const struct bond *bond) +static struct bond_sub * +bond_choose_sub(const struct bond *bond) { - struct bond_slave *slave, *best; + struct bond_sub *sub, *best; - /* Find the last active slave. */ - slave = bond_find_slave_by_mac(bond, bond->active_slave_mac); - if (slave && slave->enabled) { - return slave; + /* Find the last active sub. */ + sub = bond_find_sub_by_mac(bond, bond->active_sub_mac); + if (sub && sub->enabled) { + return sub; } - /* Find an enabled slave. */ - HMAP_FOR_EACH (slave, hmap_node, &bond->slaves) { - if (slave->enabled) { - return slave; + /* Find an enabled sub. */ + HMAP_FOR_EACH (sub, hmap_node, &bond->subs) { + if (sub->enabled) { + return sub; } } /* All interfaces are disabled. Find an interface that will be enabled * after its updelay expires. */ best = NULL; - HMAP_FOR_EACH (slave, hmap_node, &bond->slaves) { - if (slave->delay_expires != LLONG_MAX - && slave->may_enable - && (!best || slave->delay_expires < best->delay_expires)) { - best = slave; + HMAP_FOR_EACH (sub, hmap_node, &bond->subs) { + if (sub->delay_expires != LLONG_MAX + && sub->may_enable + && (!best || sub->delay_expires < best->delay_expires)) { + best = sub; } } return best; } static void -bond_choose_active_slave(struct bond *bond) +bond_choose_active_sub(struct bond *bond) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 20); - struct bond_slave *old_active_slave = bond->active_slave; + struct bond_sub *old_active_sub = bond->active_sub; - bond->active_slave = bond_choose_slave(bond); - if (bond->active_slave) { - if (bond->active_slave->enabled) { + bond->active_sub = bond_choose_sub(bond); + if (bond->active_sub) { + if (bond->active_sub->enabled) { VLOG_INFO_RL(&rl, "bond %s: active interface is now %s", - bond->name, bond->active_slave->name); + bond->name, bond->active_sub->name); } else { VLOG_INFO_RL(&rl, "bond %s: active interface is now %s, skipping " "remaining %lld ms updelay (since no interface was " - "enabled)", bond->name, bond->active_slave->name, - bond->active_slave->delay_expires - time_msec()); - bond_enable_slave(bond->active_slave, true); + "enabled)", bond->name, bond->active_sub->name, + bond->active_sub->delay_expires - time_msec()); + bond_enable_sub(bond->active_sub, true); } bond->send_learning_packets = true; - if (bond->active_slave != old_active_slave) { - bond_active_slave_changed(bond); + if (bond->active_sub != old_active_sub) { + bond_active_sub_changed(bond); } - } else if (old_active_slave) { - bond_active_slave_changed(bond); + } else if (old_active_sub) { + bond_active_sub_changed(bond); VLOG_INFO_RL(&rl, "bond %s: all interfaces disabled", bond->name); } } /* - * Return true if bond has unstored active slave change. - * If return true, 'mac' will store the bond's current active slave's + * Return true if bond has unstored active sub change. + * If return true, 'mac' will store the bond's current active sub's * MAC address. */ bool -bond_get_changed_active_slave(const char *name, struct eth_addr *mac, +bond_get_changed_active_sub(const char *name, struct eth_addr *mac, bool force) { struct bond *bond; @@ -1975,9 +1987,9 @@ bond_get_changed_active_slave(const char *name, struct eth_addr *mac, ovs_rwlock_wrlock(&rwlock); bond = bond_find(name); if (bond) { - if (bond->active_slave_changed || force) { - *mac = bond->active_slave_mac; - bond->active_slave_changed = false; + if (bond->active_sub_changed || force) { + *mac = bond->active_sub_mac; + bond->active_sub_changed = false; ovs_rwlock_unlock(&rwlock); return true; } @@ -1996,19 +2008,19 @@ bond_use_lb_output_action(const struct bond *bond) static void bond_add_lb_output_buckets(const struct bond *bond) { - ofp_port_t slave_map[BOND_BUCKETS]; + ofp_port_t sub_map[BOND_BUCKETS]; for (int i = 0; i < BOND_BUCKETS; i++) { - struct bond_slave *slave = bond->hash[i].slave; + struct bond_sub *sub = bond->hash[i].sub; - if (slave) { - slave_map[i] = slave->ofp_port; + if (sub) { + sub_map[i] = sub->ofp_port; } else { - slave_map[i] = OFPP_NONE; + sub_map[i] = OFPP_NONE; } } ofproto_dpif_add_lb_output_buckets(bond->ofproto, bond->recirc_id, - slave_map); + sub_map); } static void diff --git a/ofproto/bond.h b/ofproto/bond.h index 40c3258dc946..37f9940dc936 100644 --- a/ofproto/bond.h +++ b/ofproto/bond.h @@ -28,7 +28,7 @@ struct ofpbuf; struct ofproto_dpif; enum lacp_status; -/* How flows are balanced among bond slaves. */ +/* How flows are balanced among bond sub-interfaces. */ enum bond_mode { BM_TCP, /* Transport Layer Load Balance. */ BM_SLB, /* Source Load Balance. */ @@ -49,12 +49,12 @@ struct bond_settings { Zero to disable rebalancing. */ /* Link status detection. */ - int up_delay; /* ms before enabling an up slave. */ - int down_delay; /* ms before disabling a down slave. */ + int up_delay; /* ms before enabling an up sub-interface. */ + int down_delay; /* ms before disabling a down sub-interface. */ bool lacp_fallback_ab_cfg; /* Fallback to active-backup on LACP failure. */ - struct eth_addr active_slave_mac; + struct eth_addr active_sub_mac; /* The MAC address of the interface that was active during the last ovs run. */ @@ -72,22 +72,22 @@ void bond_unref(struct bond *); struct bond *bond_ref(const struct bond *); bool bond_reconfigure(struct bond *, const struct bond_settings *); -void bond_slave_register(struct bond *, void *slave_, ofp_port_t ofport, struct netdev *); -void bond_slave_set_netdev(struct bond *, void *slave_, struct netdev *); -void bond_slave_unregister(struct bond *, const void *slave); +void bond_sub_register(struct bond *, void *sub_, ofp_port_t ofport, struct netdev *); +void bond_sub_set_netdev(struct bond *, void *sub_, struct netdev *); +void bond_sub_unregister(struct bond *, const void *sub); bool bond_run(struct bond *, enum lacp_status); void bond_wait(struct bond *); -void bond_slave_set_may_enable(struct bond *, void *slave_, bool may_enable); +void bond_sub_set_may_enable(struct bond *, void *sub_, bool may_enable); /* Special MAC learning support for SLB bonding. */ bool bond_should_send_learning_packets(struct bond *); struct dp_packet *bond_compose_learning_packet(struct bond *, const struct eth_addr eth_src, uint16_t vlan, void **port_aux); -bool bond_get_changed_active_slave(const char *name, struct eth_addr *mac, - bool force); +bool bond_get_changed_active_sub(const char *name, struct eth_addr *mac, + bool force); /* Packet processing. */ enum bond_verdict { @@ -95,10 +95,10 @@ enum bond_verdict { BV_DROP, /* Drop this packet. */ BV_DROP_IF_MOVED /* Drop if we've learned a different port. */ }; -enum bond_verdict bond_check_admissibility(struct bond *, const void *slave_, +enum bond_verdict bond_check_admissibility(struct bond *, const void *sub_, const struct eth_addr dst); -void *bond_choose_output_slave(struct bond *, const struct flow *, - struct flow_wildcards *, uint16_t vlan); +void *bond_choose_output_sub(struct bond *, const struct flow *, + struct flow_wildcards *, uint16_t vlan); /* Rebalancing. */ void bond_account(struct bond *, const struct flow *, uint16_t vlan, @@ -117,7 +117,7 @@ void bond_rebalance(struct bond *); * * On handling first output packet, 256 post recirculation flows are installed: * - * recirc_id=, dp_hash=<[0..255]>/0xff, actions: output + * recirc_id=, dp_hash=<[0..255]>/0xff, actions: output * * Bond module pulls stats from those post recirculation rules. If rebalancing * is needed, those rules are updated with new output actions. diff --git a/ofproto/ofproto-dpif-rid.h b/ofproto/ofproto-dpif-rid.h index 30cd5275f24c..a6b606f7f688 100644 --- a/ofproto/ofproto-dpif-rid.h +++ b/ofproto/ofproto-dpif-rid.h @@ -41,8 +41,8 @@ struct rule; * * Recirculation is the use of freezing to allow a frame to re-enter the * datapath packet processing path to achieve more flexible packet processing, - * such as modifying header fields after MPLS POP action and selecting a slave - * port for bond ports. + * such as modifying header fields after MPLS POP action and selecting a + * sub-interface for bond ports. * * * Data path and user space interface diff --git a/ofproto/ofproto-dpif-sflow.c b/ofproto/ofproto-dpif-sflow.c index f616fb2bbb84..97116c6fd8cc 100644 --- a/ofproto/ofproto-dpif-sflow.c +++ b/ofproto/ofproto-dpif-sflow.c @@ -305,7 +305,7 @@ sflow_agent_get_counters(void *ds_, SFLPoller *poller, SFLEthernet_counters* eth_counters; struct netdev_stats stats; enum netdev_flags flags; - struct lacp_slave_stats lacp_stats; + struct lacp_sub_stats lacp_stats; const char *ifName; dsp = dpif_sflow_find_port(ds, u32_to_odp(poller->bridgePort)); diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index e0ede2cab3ad..7c7dc64837d0 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -2431,7 +2431,8 @@ output_normal(struct xlate_ctx *ctx, const struct xbundle *out_xbundle, } vid = out_xvlan.v[0].vid; if (ovs_list_is_empty(&out_xbundle->xports)) { - /* Partially configured bundle with no slaves. Drop the packet. */ + /* Partially configured bundle with no sub-interfaces. Drop the + * packet. */ return; } else if (!out_xbundle->bond) { xport = CONTAINER_OF(ovs_list_front(&out_xbundle->xports), struct xport, @@ -2456,12 +2457,12 @@ output_normal(struct xlate_ctx *ctx, const struct xbundle *out_xbundle, } } - ofport = bond_choose_output_slave(out_xbundle->bond, - &ctx->xin->flow, wc, vid); + ofport = bond_choose_output_sub(out_xbundle->bond, + &ctx->xin->flow, wc, vid); xport = xport_lookup(ctx->xcfg, ofport); if (!xport) { - /* No slaves enabled, so drop packet. */ + /* No sub-interfaces enabled, so drop packet. */ return; } @@ -3379,11 +3380,11 @@ process_special(struct xlate_ctx *ctx, const struct xport *xport) if (packet) { lacp_may_enable = lacp_process_packet(xport->xbundle->lacp, xport->ofport, packet); - /* Update LACP status in bond-slave to avoid packet-drops until - * LACP state machine is run by the main thread. */ + /* Update LACP status in bond-sub-interface to avoid packet-drops + * until LACP state machine is run by the main thread. */ if (xport->xbundle->bond && lacp_may_enable) { - bond_slave_set_may_enable(xport->xbundle->bond, xport->ofport, - lacp_may_enable); + bond_sub_set_may_enable(xport->xbundle->bond, xport->ofport, + lacp_may_enable); } } slow = SLOW_LACP; @@ -5391,7 +5392,7 @@ xlate_set_queue_action(struct xlate_ctx *ctx, uint32_t queue_id) } static bool -slave_enabled_cb(ofp_port_t ofp_port, void *xbridge_) +sub_enabled_cb(ofp_port_t ofp_port, void *xbridge_) { const struct xbridge *xbridge = xbridge_; struct xport *port; @@ -5420,7 +5421,7 @@ xlate_bundle_action(struct xlate_ctx *ctx, { ofp_port_t port; - port = bundle_execute(bundle, &ctx->xin->flow, ctx->wc, slave_enabled_cb, + port = bundle_execute(bundle, &ctx->xin->flow, ctx->wc, sub_enabled_cb, CONST_CAST(struct xbridge *, ctx->xbridge)); if (bundle->dst.field) { nxm_reg_load(&bundle->dst, ofp_to_u16(port), &ctx->xin->flow, ctx->wc); diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 4f0638f237c4..c1bf80a050d7 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -2199,7 +2199,7 @@ port_modified(struct ofport *port_) struct netdev *netdev = port->up.netdev; if (port->bundle && port->bundle->bond) { - bond_slave_set_netdev(port->bundle->bond, port, netdev); + bond_sub_set_netdev(port->bundle->bond, port, netdev); } if (port->cfm) { @@ -3140,10 +3140,10 @@ bundle_del_port(struct ofport_dpif *port) port->bundle = NULL; if (bundle->lacp) { - lacp_slave_unregister(bundle->lacp, port); + lacp_sub_unregister(bundle->lacp, port); } if (bundle->bond) { - bond_slave_unregister(bundle->bond, port); + bond_sub_unregister(bundle->bond, port); } bundle_update(bundle); @@ -3151,7 +3151,7 @@ bundle_del_port(struct ofport_dpif *port) static bool bundle_add_port(struct ofbundle *bundle, ofp_port_t ofp_port, - struct lacp_slave_settings *lacp) + struct lacp_sub_settings *lacp) { struct ofport_dpif *port; @@ -3177,7 +3177,7 @@ bundle_add_port(struct ofbundle *bundle, ofp_port_t ofp_port, } if (lacp) { bundle->ofproto->backer->need_revalidate = REV_RECONFIGURE; - lacp_slave_register(bundle->lacp, port, lacp); + lacp_sub_register(bundle->lacp, port, lacp); } return true; @@ -3236,8 +3236,8 @@ bundle_set(struct ofproto *ofproto_, void *aux, return 0; } - ovs_assert(s->n_slaves == 1 || s->bond != NULL); - ovs_assert((s->lacp != NULL) == (s->lacp_slaves != NULL)); + ovs_assert(s->n_subs == 1 || s->bond != NULL); + ovs_assert((s->lacp != NULL) == (s->lacp_subs != NULL)); if (!bundle) { bundle = xmalloc(sizeof *bundle); @@ -3283,18 +3283,18 @@ bundle_set(struct ofproto *ofproto_, void *aux, /* Update set of ports. */ ok = true; - for (i = 0; i < s->n_slaves; i++) { - if (!bundle_add_port(bundle, s->slaves[i], - s->lacp ? &s->lacp_slaves[i] : NULL)) { + for (i = 0; i < s->n_subs; i++) { + if (!bundle_add_port(bundle, s->subs[i], + s->lacp ? &s->lacp_subs[i] : NULL)) { ok = false; } } - if (!ok || ovs_list_size(&bundle->ports) != s->n_slaves) { + if (!ok || ovs_list_size(&bundle->ports) != s->n_subs) { struct ofport_dpif *next_port; LIST_FOR_EACH_SAFE (port, next_port, bundle_node, &bundle->ports) { - for (i = 0; i < s->n_slaves; i++) { - if (s->slaves[i] == port->up.ofp_port) { + for (i = 0; i < s->n_subs; i++) { + if (s->subs[i] == port->up.ofp_port) { goto found; } } @@ -3303,7 +3303,7 @@ bundle_set(struct ofproto *ofproto_, void *aux, found: ; } } - ovs_assert(ovs_list_size(&bundle->ports) <= s->n_slaves); + ovs_assert(ovs_list_size(&bundle->ports) <= s->n_subs); if (ovs_list_is_empty(&bundle->ports)) { bundle_destroy(bundle); @@ -3408,7 +3408,7 @@ bundle_set(struct ofproto *ofproto_, void *aux, } LIST_FOR_EACH (port, bundle_node, &bundle->ports) { - bond_slave_register(bundle->bond, port, + bond_sub_register(bundle->bond, port, port->up.ofp_port, port->up.netdev); } } else { @@ -3562,7 +3562,7 @@ bundle_run(struct ofbundle *bundle) struct ofport_dpif *port; LIST_FOR_EACH (port, bundle_node, &bundle->ports) { - bond_slave_set_may_enable(bundle->bond, port, port->up.may_enable); + bond_sub_set_may_enable(bundle->bond, port, port->up.may_enable); } if (bond_run(bundle->bond, lacp_status(bundle->lacp))) { @@ -3808,7 +3808,7 @@ may_enable_port(struct ofport_dpif *ofport) /* If LACP is enabled, it must report that the link is enabled. */ if (ofport->bundle - && !lacp_slave_may_enable(ofport->bundle->lacp, ofport)) { + && !lacp_sub_may_enable(ofport->bundle->lacp, ofport)) { return false; } @@ -3824,7 +3824,7 @@ port_run(struct ofport_dpif *ofport) ofport->carrier_seq = carrier_seq; if (carrier_changed && ofport->bundle) { - lacp_slave_carrier_changed(ofport->bundle->lacp, ofport, enable); + lacp_sub_carrier_changed(ofport->bundle->lacp, ofport, enable); } if (enable) { @@ -3936,7 +3936,8 @@ port_del(struct ofproto *ofproto_, ofp_port_t ofp_port) /* The caller is going to close ofport->up.netdev. If this is a * bonded port, then the bond is using that netdev, so remove it * from the bond. The client will need to reconfigure everything - * after deleting ports, so then the slave will get re-added. */ + * after deleting ports, so then the sub-interface will get + * re-added. */ bundle_remove(&ofport->up); } } @@ -4020,11 +4021,11 @@ vport_get_status(const struct ofport *ofport_, char **errp) } static int -port_get_lacp_stats(const struct ofport *ofport_, struct lacp_slave_stats *stats) +port_get_lacp_stats(const struct ofport *ofport_, struct lacp_sub_stats *stats) { struct ofport_dpif *ofport = ofport_dpif_cast(ofport_); if (ofport->bundle && ofport->bundle->lacp) { - if (lacp_get_slave_stats(ofport->bundle->lacp, ofport, stats)) { + if (lacp_get_sub_stats(ofport->bundle->lacp, ofport, stats)) { return 0; } } @@ -4125,7 +4126,7 @@ port_is_lacp_current(const struct ofport *ofport_) { const struct ofport_dpif *ofport = ofport_dpif_cast(ofport_); return (ofport->bundle && ofport->bundle->lacp - ? lacp_slave_is_current(ofport->bundle->lacp, ofport) + ? lacp_sub_is_current(ofport->bundle->lacp, ofport) : -1); } diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h index afecb24cba09..b6eba9135d64 100644 --- a/ofproto/ofproto-provider.h +++ b/ofproto/ofproto-provider.h @@ -1225,7 +1225,7 @@ struct ofproto_class { * not support LACP. */ int (*port_get_lacp_stats)(const struct ofport *port, - struct lacp_slave_stats *stats); + struct lacp_sub_stats *stats); /* ## ----------------------- ## */ /* ## OpenFlow Rule Functions ## */ @@ -1707,11 +1707,11 @@ struct ofproto_class { /* If 's' is nonnull, this function registers a "bundle" associated with * client data pointer 'aux' in 'ofproto'. A bundle is the same concept as - * a Port in OVSDB, that is, it consists of one or more "slave" devices - * (Interfaces, in OVSDB) along with VLAN and LACP configuration and, if - * there is more than one slave, a bonding configuration. If 'aux' is - * already registered then this function updates its configuration to 's'. - * Otherwise, this function registers a new bundle. + * a Port in OVSDB, that is, it consists of one or more "sub-interface" + * devices (Interfaces, in OVSDB) along with VLAN and LACP configuration + * and, if there is more than one sub, a bonding configuration. If 'aux' + * is already registered then this function updates its configuration to + * 's'. Otherwise, this function registers a new bundle. * * If 's' is NULL, this function unregisters the bundle registered on * 'ofproto' associated with client data pointer 'aux'. If no such bundle diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 59f06aa948e7..c1ddce80e7c0 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -1391,7 +1391,7 @@ ofproto_port_is_lacp_current(struct ofproto *ofproto, ofp_port_t ofp_port) } int -ofproto_port_get_lacp_stats(const struct ofport *port, struct lacp_slave_stats *stats) +ofproto_port_get_lacp_stats(const struct ofport *port, struct lacp_sub_stats *stats) { struct ofproto *ofproto = port->ofproto; int error; @@ -1409,8 +1409,8 @@ ofproto_port_get_lacp_stats(const struct ofport *port, struct lacp_slave_stats * /* Registers a "bundle" associated with client data pointer 'aux' in 'ofproto'. * A bundle is the same concept as a Port in OVSDB, that is, it consists of one - * or more "slave" devices (Interfaces, in OVSDB) along with a VLAN - * configuration plus, if there is more than one slave, a bonding + * or more "sub-interface" devices (Interfaces, in OVSDB) along with a VLAN + * configuration plus, if there is more than one sub, a bonding * configuration. * * If 'aux' is already registered then this function updates its configuration diff --git a/ofproto/ofproto.h b/ofproto/ofproto.h index 2dd253167601..3373b124f565 100644 --- a/ofproto/ofproto.h +++ b/ofproto/ofproto.h @@ -388,7 +388,7 @@ bool ofproto_port_bfd_status_changed(struct ofproto *, ofp_port_t ofp_port); int ofproto_port_get_bfd_status(struct ofproto *, ofp_port_t ofp_port, struct smap *); int ofproto_port_is_lacp_current(struct ofproto *, ofp_port_t ofp_port); -int ofproto_port_get_lacp_stats(const struct ofport *, struct lacp_slave_stats *); +int ofproto_port_get_lacp_stats(const struct ofport *, struct lacp_sub_stats *); int ofproto_port_set_stp(struct ofproto *, ofp_port_t ofp_port, const struct ofproto_port_stp_settings *); int ofproto_port_get_stp_status(struct ofproto *, ofp_port_t ofp_port, @@ -441,8 +441,8 @@ enum port_priority_tags_mode { struct ofproto_bundle_settings { char *name; /* For use in log messages. */ - ofp_port_t *slaves; /* OpenFlow port numbers for slaves. */ - size_t n_slaves; + ofp_port_t *subs; /* OpenFlow port numbers for sub-interfaces. */ + size_t n_subs; enum port_vlan_mode vlan_mode; /* Selects mode for vlan and trunks */ uint16_t qinq_ethtype; @@ -452,10 +452,10 @@ struct ofproto_bundle_settings { enum port_priority_tags_mode use_priority_tags; /* Use 802.1p tag for frames in VLAN 0? */ - struct bond_settings *bond; /* Must be nonnull iff if n_slaves > 1. */ + struct bond_settings *bond; /* Must be nonnull iff if n_subs > 1. */ struct lacp_settings *lacp; /* Nonnull to enable LACP. */ - struct lacp_slave_settings *lacp_slaves; /* Array of n_slaves elements. */ + struct lacp_sub_settings *lacp_subs; /* Array of n_subs elements. */ bool protected; /* Protected port mode */ }; diff --git a/tests/bundle.at b/tests/bundle.at index 0a4eadc1e0f3..8c4be13424f9 100644 --- a/tests/bundle.at +++ b/tests/bundle.at @@ -9,7 +9,7 @@ AT_BANNER([bundle link selection]) AT_SETUP([hrw bundle link selection]) AT_KEYWORDS([bundle_action]) -AT_CHECK([[ovstest test-bundle 'symmetric_l4,60,hrw,ofport,NXM_NX_REG0[],slaves:1,2,3,4,5']], +AT_CHECK([[ovstest test-bundle 'symmetric_l4,60,hrw,ofport,NXM_NX_REG0[],subs:1,2,3,4,5']], [0], [ignore]) # 100000: disruption=1.00 (perfect=1.00) 1.00 0.00 0.00 0.00 0.00 0.00 # 110000: disruption=0.50 (perfect=0.50) 0.50 0.50 0.00 0.00 0.00 0.00 @@ -80,7 +80,7 @@ AT_CLEANUP AT_SETUP([active_backup bundle link selection]) AT_KEYWORDS([bundle_action]) -AT_CHECK([[ovstest test-bundle 'symmetric_l4,60,active_backup,ofport,NXM_NX_REG0[],slaves:1,2,3,4,5,6']], +AT_CHECK([[ovstest test-bundle 'symmetric_l4,60,active_backup,ofport,NXM_NX_REG0[],subs:1,2,3,4,5,6']], [0], [100000: disruption=1.00 (perfect=1.00) 1.00 0.00 0.00 0.00 0.00 0.00 110000: disruption=0.00 (perfect=0.00) 1.00 0.00 0.00 0.00 0.00 0.00 @@ -152,7 +152,7 @@ AT_CLEANUP AT_SETUP([hrw bundle single link selection]) AT_KEYWORDS([bundle_action]) -AT_CHECK([[ovstest test-bundle 'symmetric_l4,60,hrw,ofport,NXM_NX_REG0[],slaves:1']], +AT_CHECK([[ovstest test-bundle 'symmetric_l4,60,hrw,ofport,NXM_NX_REG0[],subs:1']], [0], [ignore]) # 1: disruption=1.00 (perfect=1.00) 1.00 # 0: disruption=1.00 (perfect=1.00) 0.00 @@ -161,7 +161,7 @@ AT_CLEANUP AT_SETUP([hrw bundle no link selection]) AT_KEYWORDS([bundle_action]) -AT_CHECK([[ovstest test-bundle 'symmetric_l4,60,hrw,ofport,NXM_NX_REG0[],slaves:']], +AT_CHECK([[ovstest test-bundle 'symmetric_l4,60,hrw,ofport,NXM_NX_REG0[],subs:']], [0], [ignore]) AT_CLEANUP #: disruption=0.00 (perfect=0.00) @@ -176,29 +176,29 @@ AT_CLEANUP AT_SETUP([bundle action bad fields]) AT_KEYWORDS([bundle_action]) -AT_CHECK([ovs-ofctl parse-flow 'actions=bundle(xyzzy,60,hrw,ofport,slaves:1,2))'], [1], [], - [ovs-ofctl: xyzzy,60,hrw,ofport,slaves:1,2: unknown fields `xyzzy' +AT_CHECK([ovs-ofctl parse-flow 'actions=bundle(xyzzy,60,hrw,ofport,subs:1,2))'], [1], [], + [ovs-ofctl: xyzzy,60,hrw,ofport,subs:1,2: unknown fields `xyzzy' ]) AT_CLEANUP AT_SETUP([bundle action bad algorithm]) AT_KEYWORDS([bundle_action]) -AT_CHECK([ovs-ofctl parse-flow 'actions=bundle(symmetric_l4,60,fubar,ofport,slaves:1,2))'], [1], [], - [ovs-ofctl: symmetric_l4,60,fubar,ofport,slaves:1,2: unknown algorithm `fubar' +AT_CHECK([ovs-ofctl parse-flow 'actions=bundle(symmetric_l4,60,fubar,ofport,subs:1,2))'], [1], [], + [ovs-ofctl: symmetric_l4,60,fubar,ofport,subs:1,2: unknown algorithm `fubar' ]) AT_CLEANUP -AT_SETUP([bundle action bad slave type]) +AT_SETUP([bundle action bad sub type]) AT_KEYWORDS([bundle_action]) -AT_CHECK([ovs-ofctl parse-flow 'actions=bundle(symmetric_l4,60,hrw,robot,slaves:1,2))'], [1], [], - [ovs-ofctl: symmetric_l4,60,hrw,robot,slaves:1,2: unknown slave_type `robot' +AT_CHECK([ovs-ofctl parse-flow 'actions=bundle(symmetric_l4,60,hrw,robot,subs:1,2))'], [1], [], + [ovs-ofctl: symmetric_l4,60,hrw,robot,subs:1,2: unknown sub_type `robot' ]) AT_CLEANUP -AT_SETUP([bundle action bad slave delimiter]) +AT_SETUP([bundle action bad sub delimiter]) AT_KEYWORDS([bundle_action]) AT_CHECK([ovs-ofctl parse-flow 'actions=bundle(symmetric_l4,60,hrw,ofport,robot:1,2))'], [1], [], - [ovs-ofctl: symmetric_l4,60,hrw,ofport,robot:1,2: missing slave delimiter, expected `slaves' got `robot' + [ovs-ofctl: symmetric_l4,60,hrw,ofport,robot:1,2: missing sub delimiter, expected `subs', got `robot' ]) AT_CLEANUP @@ -211,9 +211,9 @@ dnl Valgrind warnings for use-after-free bugs. AT_SETUP([bundle action with many ports]) AT_KEYWORDS([bundle_action]) OVS_VSWITCHD_START -AT_CHECK([ovs-ofctl add-flow br0 'actions=set_field:0x1->metadata,set_field:0x2->metadata,set_field:0x3->metadata,set_field:0x4->metadata,bundle(symmetric_l4,0,hrw,ofport,slaves:[[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40]])']) +AT_CHECK([ovs-ofctl add-flow br0 'actions=set_field:0x1->metadata,set_field:0x2->metadata,set_field:0x3->metadata,set_field:0x4->metadata,bundle(symmetric_l4,0,hrw,ofport,subs:[[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40]])']) AT_CHECK([ovs-ofctl dump-flows br0 --no-stats], [0], [dnl - actions=load:0x1->OXM_OF_METADATA[[]],load:0x2->OXM_OF_METADATA[[]],load:0x3->OXM_OF_METADATA[[]],load:0x4->OXM_OF_METADATA[[]],bundle(symmetric_l4,0,hrw,ofport,slaves:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40) + actions=load:0x1->OXM_OF_METADATA[[]],load:0x2->OXM_OF_METADATA[[]],load:0x3->OXM_OF_METADATA[[]],load:0x4->OXM_OF_METADATA[[]],bundle(symmetric_l4,0,hrw,ofport,subs:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40) ]) OVS_VSWITCHD_STOP AT_CLEANUP @@ -226,7 +226,7 @@ OVS_VSWITCHD_START([dnl add-port br0 p2 -- set Interface p2 type=dummy -- \ set Interface p2 ofport_request=2 ]) -AT_CHECK([ovs-ofctl add-flow br0 'actions=bundle(eth_src,50,active_backup,ofport,slaves:1,2)']) +AT_CHECK([ovs-ofctl add-flow br0 'actions=bundle(eth_src,50,active_backup,ofport,subs:1,2)']) AT_CHECK([ovs-ofctl mod-port br0 p1 up]) AT_CHECK([ovs-ofctl mod-port br0 p2 up]) AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=LOCAL,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:06'], [0], [stdout]) @@ -264,7 +264,7 @@ OVS_VSWITCHD_START([dnl add-port br0 p2 -- set Interface p2 type=dummy -- \ set Interface p2 ofport_request=2 ]) -AT_CHECK([ovs-ofctl add-flow br0 'actions=bundle_load(eth_src,50,hrw,ofport,OXM_OF_ETH_SRC[[0..15]],slaves:1,2)']) +AT_CHECK([ovs-ofctl add-flow br0 'actions=bundle_load(eth_src,50,hrw,ofport,OXM_OF_ETH_SRC[[0..15]],subs:1,2)']) AT_CHECK([ovs-ofctl mod-port br0 p1 down]) AT_CHECK([ovs-ofctl mod-port br0 p2 down]) AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=LOCAL,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:06'], [0], [stdout]) @@ -276,7 +276,7 @@ AT_CLEANUP AT_SETUP([hrw bundle symmetric_l3 link selection]) AT_KEYWORDS([bundle_action]) -AT_CHECK([[ovstest test-bundle 'symmetric_l3,60,hrw,ofport,NXM_NX_REG0[],slaves:1,2,3,4,5']], +AT_CHECK([[ovstest test-bundle 'symmetric_l3,60,hrw,ofport,NXM_NX_REG0[],subs:1,2,3,4,5']], [0], [ignore]) # 100000: disruption=1.00 (perfect=1.00) 1.00 0.00 0.00 0.00 0.00 0.00 # 110000: disruption=0.50 (perfect=0.50) 0.50 0.50 0.00 0.00 0.00 0.00 @@ -347,7 +347,7 @@ AT_CLEANUP AT_SETUP([active_backup bundle symmetric_l3 link selection]) AT_KEYWORDS([bundle_action]) -AT_CHECK([[ovstest test-bundle 'symmetric_l3,60,active_backup,ofport,NXM_NX_REG0[],slaves:1,2,3,4,5,6']], +AT_CHECK([[ovstest test-bundle 'symmetric_l3,60,active_backup,ofport,NXM_NX_REG0[],subs:1,2,3,4,5,6']], [0], [100000: disruption=1.00 (perfect=1.00) 1.00 0.00 0.00 0.00 0.00 0.00 110000: disruption=0.00 (perfect=0.00) 1.00 0.00 0.00 0.00 0.00 0.00 @@ -419,7 +419,7 @@ AT_CLEANUP AT_SETUP([hrw bundle symmetric_l3 single link selection]) AT_KEYWORDS([bundle_action]) -AT_CHECK([[ovstest test-bundle 'symmetric_l3,60,hrw,ofport,NXM_NX_REG0[],slaves:1']], +AT_CHECK([[ovstest test-bundle 'symmetric_l3,60,hrw,ofport,NXM_NX_REG0[],subs:1']], [0], [ignore]) # 1: disruption=1.00 (perfect=1.00) 1.00 # 0: disruption=1.00 (perfect=1.00) 0.00 @@ -428,7 +428,7 @@ AT_CLEANUP AT_SETUP([hrw bundle symmetric_l3 single link selection]) AT_KEYWORDS([bundle_action]) -AT_CHECK([[ovstest test-bundle 'symmetric_l3,60,hrw,ofport,NXM_NX_REG0[],slaves:1']], +AT_CHECK([[ovstest test-bundle 'symmetric_l3,60,hrw,ofport,NXM_NX_REG0[],subs:1']], [0], [ignore]) # 1: disruption=1.00 (perfect=1.00) 1.00 # 0: disruption=1.00 (perfect=1.00) 0.00 @@ -437,7 +437,7 @@ AT_CLEANUP AT_SETUP([hrw bundle symmetric_l3 no link selection]) AT_KEYWORDS([bundle_action]) -AT_CHECK([[ovstest test-bundle 'symmetric_l3,60,hrw,ofport,NXM_NX_REG0[],slaves:']], +AT_CHECK([[ovstest test-bundle 'symmetric_l3,60,hrw,ofport,NXM_NX_REG0[],subs:']], [0], [ignore]) AT_CLEANUP #: disruption=0.00 (perfect=0.00) @@ -446,9 +446,9 @@ AT_CLEANUP AT_SETUP([bundle symmetric_l3 action with many ports]) AT_KEYWORDS([bundle_action]) OVS_VSWITCHD_START -AT_CHECK([ovs-ofctl add-flow br0 'actions=set_field:0x1->metadata,set_field:0x2->metadata,set_field:0x3->metadata,set_field:0x4->metadata,bundle(symmetric_l3,0,hrw,ofport,slaves:[[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40]])']) +AT_CHECK([ovs-ofctl add-flow br0 'actions=set_field:0x1->metadata,set_field:0x2->metadata,set_field:0x3->metadata,set_field:0x4->metadata,bundle(symmetric_l3,0,hrw,ofport,subs:[[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40]])']) AT_CHECK([ovs-ofctl dump-flows br0 --no-stats], [0], [dnl - actions=load:0x1->OXM_OF_METADATA[[]],load:0x2->OXM_OF_METADATA[[]],load:0x3->OXM_OF_METADATA[[]],load:0x4->OXM_OF_METADATA[[]],bundle(symmetric_l3,0,hrw,ofport,slaves:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40) + actions=load:0x1->OXM_OF_METADATA[[]],load:0x2->OXM_OF_METADATA[[]],load:0x3->OXM_OF_METADATA[[]],load:0x4->OXM_OF_METADATA[[]],bundle(symmetric_l3,0,hrw,ofport,subs:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40) ]) OVS_VSWITCHD_STOP AT_CLEANUP diff --git a/tests/lacp.at b/tests/lacp.at index df169173176a..1018a83e377f 100644 --- a/tests/lacp.at +++ b/tests/lacp.at @@ -5,9 +5,9 @@ m4_define([STRIP_RECIRC_ID], [[sed ' s/Recirc-ID.*$// ' ]]) -# Strips out active slave mac address since it may change over time. -m4_define([STRIP_ACTIVE_SLAVE_MAC], [[sed ' - s/active slave mac.*$// +# Strips out active interface mac address since it may change over time. +m4_define([STRIP_ACTIVE_INTERFACE_MAC], [[sed ' + s/active interface mac.*$// ' ]]) AT_SETUP([lacp - config]) @@ -27,7 +27,7 @@ AT_CHECK([ovs-appctl lacp/show], [0], [dnl aggregation key: 1 lacp_time: slow -slave: p1: expired attached +interface: p1: expired attached port_id: 1 port_priority: 65535 may_enable: false @@ -78,7 +78,7 @@ AT_CHECK([sed -e 's/aggregation key:.*/aggregation key: /' < stdout], [ aggregation key: lacp_time: fast -slave: p1: expired attached +interface: p1: expired attached port_id: 11 port_priority: 111 may_enable: false @@ -97,7 +97,7 @@ slave: p1: expired attached partner key: 0 partner state: timeout -slave: p2: expired attached +interface: p2: expired attached port_id: 22 port_priority: 222 may_enable: false @@ -126,12 +126,12 @@ updelay: 0 ms downdelay: 0 ms lacp_status: negotiated lacp_fallback_ab: false -active slave mac: 00:00:00:00:00:00(none) +active interface mac: 00:00:00:00:00:00(none) -slave p1: disabled +interface p1: disabled may_enable: false -slave p2: disabled +interface p2: disabled may_enable: false ]) @@ -192,9 +192,9 @@ done AT_CHECK( [ovs-appctl lacp/show bond0 ovs-appctl lacp/show bond1 -ovs-appctl bond/show bond0 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC -ovs-appctl bond/show bond1 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC ], [0], [stdout]) -AT_CHECK([sed '/active slave/d' stdout], [0], [dnl +ovs-appctl bond/show bond0 | STRIP_RECIRC_ID | STRIP_ACTIVE_INTERFACE_MAC +ovs-appctl bond/show bond1 | STRIP_RECIRC_ID | STRIP_ACTIVE_INTERFACE_MAC ], [0], [stdout]) +AT_CHECK([sed '/active interface/d' stdout], [0], [dnl ---- bond0 ---- status: active negotiated sys_id: aa:55:aa:55:00:00 @@ -202,7 +202,7 @@ AT_CHECK([sed '/active slave/d' stdout], [0], [dnl aggregation key: 2 lacp_time: fast -slave: p0: current attached +interface: p0: current attached port_id: 1 port_priority: 65535 may_enable: true @@ -221,7 +221,7 @@ slave: p0: current attached partner key: 4 partner state: activity timeout aggregation synchronized collecting distributing -slave: p1: current attached +interface: p1: current attached port_id: 2 port_priority: 65535 may_enable: true @@ -246,7 +246,7 @@ slave: p1: current attached aggregation key: 4 lacp_time: fast -slave: p2: current attached +interface: p2: current attached port_id: 3 port_priority: 65535 may_enable: true @@ -265,7 +265,7 @@ slave: p2: current attached partner key: 2 partner state: activity timeout aggregation synchronized collecting distributing -slave: p3: current attached +interface: p3: current attached port_id: 4 port_priority: 65535 may_enable: true @@ -293,10 +293,10 @@ downdelay: 0 ms lacp_status: negotiated lacp_fallback_ab: false -slave p0: enabled +interface p0: enabled may_enable: true -slave p1: enabled +interface p1: enabled may_enable: true ---- bond1 ---- @@ -309,16 +309,16 @@ downdelay: 0 ms lacp_status: negotiated lacp_fallback_ab: false -slave p2: enabled +interface p2: enabled may_enable: true -slave p3: enabled +interface p3: enabled may_enable: true ]) -AT_CHECK([grep 'active slave$' stdout], [0], [dnl - active slave - active slave +AT_CHECK([grep 'active interface$' stdout], [0], [dnl + active interface + active interface ]) # Redirect the patch link between p0 and p2 so that no packets get @@ -332,8 +332,8 @@ ovs-appctl time/warp 4100 100 AT_CHECK( [ovs-appctl lacp/show bond0 ovs-appctl lacp/show bond1 -ovs-appctl bond/show bond0 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC -ovs-appctl bond/show bond1 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC ], [0], [dnl +ovs-appctl bond/show bond0 | STRIP_RECIRC_ID | STRIP_ACTIVE_INTERFACE_MAC +ovs-appctl bond/show bond1 | STRIP_RECIRC_ID | STRIP_ACTIVE_INTERFACE_MAC ], [0], [dnl ---- bond0 ---- status: active negotiated sys_id: aa:55:aa:55:00:00 @@ -341,7 +341,7 @@ ovs-appctl bond/show bond1 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC ], [0], [d aggregation key: 2 lacp_time: fast -slave: p0: expired attached +interface: p0: expired attached port_id: 1 port_priority: 65535 may_enable: false @@ -360,7 +360,7 @@ slave: p0: expired attached partner key: 4 partner state: activity timeout aggregation collecting distributing -slave: p1: current attached +interface: p1: current attached port_id: 2 port_priority: 65535 may_enable: true @@ -385,7 +385,7 @@ slave: p1: current attached aggregation key: 4 lacp_time: fast -slave: p2: expired attached +interface: p2: expired attached port_id: 3 port_priority: 65535 may_enable: false @@ -404,7 +404,7 @@ slave: p2: expired attached partner key: 2 partner state: activity timeout aggregation collecting distributing -slave: p3: current attached +interface: p3: current attached port_id: 4 port_priority: 65535 may_enable: true @@ -431,13 +431,13 @@ updelay: 0 ms downdelay: 0 ms lacp_status: negotiated lacp_fallback_ab: false - + -slave p0: disabled +interface p0: disabled may_enable: false -slave p1: enabled - active slave +interface p1: enabled + active interface may_enable: true ---- bond1 ---- @@ -449,13 +449,13 @@ updelay: 0 ms downdelay: 0 ms lacp_status: negotiated lacp_fallback_ab: false - + -slave p2: disabled +interface p2: disabled may_enable: false -slave p3: enabled - active slave +interface p3: enabled + active interface may_enable: true ]) @@ -466,8 +466,8 @@ ovs-appctl time/warp 4100 100 AT_CHECK( [ovs-appctl lacp/show bond0 ovs-appctl lacp/show bond1 -ovs-appctl bond/show bond0 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC -ovs-appctl bond/show bond1 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC ], [0], [dnl +ovs-appctl bond/show bond0 | STRIP_RECIRC_ID | STRIP_ACTIVE_INTERFACE_MAC +ovs-appctl bond/show bond1 | STRIP_RECIRC_ID | STRIP_ACTIVE_INTERFACE_MAC ], [0], [dnl ---- bond0 ---- status: active negotiated sys_id: aa:55:aa:55:00:00 @@ -475,7 +475,7 @@ ovs-appctl bond/show bond1 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC ], [0], [d aggregation key: 2 lacp_time: fast -slave: p0: defaulted detached +interface: p0: defaulted detached port_id: 1 port_priority: 65535 may_enable: false @@ -494,7 +494,7 @@ slave: p0: defaulted detached partner key: 0 partner state: -slave: p1: current attached +interface: p1: current attached port_id: 2 port_priority: 65535 may_enable: true @@ -519,7 +519,7 @@ slave: p1: current attached aggregation key: 4 lacp_time: fast -slave: p2: defaulted detached +interface: p2: defaulted detached port_id: 3 port_priority: 65535 may_enable: false @@ -538,7 +538,7 @@ slave: p2: defaulted detached partner key: 0 partner state: -slave: p3: current attached +interface: p3: current attached port_id: 4 port_priority: 65535 may_enable: true @@ -565,13 +565,13 @@ updelay: 0 ms downdelay: 0 ms lacp_status: negotiated lacp_fallback_ab: false - + -slave p0: disabled +interface p0: disabled may_enable: false -slave p1: enabled - active slave +interface p1: enabled + active interface may_enable: true ---- bond1 ---- @@ -583,13 +583,13 @@ updelay: 0 ms downdelay: 0 ms lacp_status: negotiated lacp_fallback_ab: false - + -slave p2: disabled +interface p2: disabled may_enable: false -slave p3: enabled - active slave +interface p3: enabled + active interface may_enable: true ]) @@ -605,8 +605,8 @@ ovs-appctl time/warp 30100 100 AT_CHECK( [ovs-appctl lacp/show bond0 ovs-appctl lacp/show bond1 -ovs-appctl bond/show bond0 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC -ovs-appctl bond/show bond1 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC ], [0], [dnl +ovs-appctl bond/show bond0 | STRIP_RECIRC_ID | STRIP_ACTIVE_INTERFACE_MAC +ovs-appctl bond/show bond1 | STRIP_RECIRC_ID | STRIP_ACTIVE_INTERFACE_MAC ], [0], [dnl ---- bond0 ---- status: active negotiated sys_id: aa:55:aa:55:00:00 @@ -614,7 +614,7 @@ ovs-appctl bond/show bond1 | STRIP_RECIRC_ID | STRIP_ACTIVE_SLAVE_MAC ], [0], [d aggregation key: 2 lacp_time: fast -slave: p0: current attached +interface: p0: current attached port_id: 1 port_priority: 65535 may_enable: true @@ -633,7 +633,7 @@ slave: p0: current attached partner key: 4 partner state: activity timeout aggregation synchronized collecting distributing -slave: p1: current attached +interface: p1: current attached port_id: 2 port_priority: 65535 may_enable: true @@ -658,7 +658,7 @@ slave: p1: current attached aggregation key: 4 lacp_time: fast -slave: p2: current attached +interface: p2: current attached port_id: 3 port_priority: 65535 may_enable: true @@ -677,7 +677,7 @@ slave: p2: current attached partner key: 2 partner state: activity timeout aggregation synchronized collecting distributing -slave: p3: current attached +interface: p3: current attached port_id: 4 port_priority: 65535 may_enable: true @@ -704,13 +704,13 @@ updelay: 0 ms downdelay: 0 ms lacp_status: negotiated lacp_fallback_ab: false - + -slave p0: enabled +interface p0: enabled may_enable: true -slave p1: enabled - active slave +interface p1: enabled + active interface may_enable: true ---- bond1 ---- @@ -722,13 +722,13 @@ updelay: 0 ms downdelay: 0 ms lacp_status: negotiated lacp_fallback_ab: false - + -slave p2: enabled +interface p2: enabled may_enable: true -slave p3: enabled - active slave +interface p3: enabled + active interface may_enable: true ]) diff --git a/tests/ofp-actions.at b/tests/ofp-actions.at index 28b2099a0c71..36c129df69d4 100644 --- a/tests/ofp-actions.at +++ b/tests/ofp-actions.at @@ -80,11 +80,11 @@ ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffff0000ffff0000 # actions=multipath(eth_src,50,modulo_n,1,0,NXM_NX_REG0[]) ffff 0020 00002320 000a 0000 0032 0000 0000 0000 0000 0000 0000 001f 00010004 -# actions=bundle(eth_src,0,hrw,ofport,slaves:4,8) +# actions=bundle(eth_src,0,hrw,ofport,subs:4,8) ffff 0028 00002320 000c 0001 0000 0000 00000002 0002 0000 00000000 00000000 dnl 0004 0008 00000000 -# actions=bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[],slaves:4,8) +# actions=bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[],subs:4,8) ffff 0028 00002320 000d 0001 0000 0000 00000002 0002 001f 00010004 00000000 dnl 0004 0008 00000000 @@ -444,11 +444,11 @@ ffff 0020 00002320 0016 000000000000 fedcba9876543210 ffffffffffffffff # actions=multipath(eth_src,50,modulo_n,1,0,NXM_NX_REG0[]) ffff 0020 00002320 000a 0000 0032 0000 0000 0000 0000 0000 0000 001f 00010004 -# actions=bundle(eth_src,0,hrw,ofport,slaves:4,8) +# actions=bundle(eth_src,0,hrw,ofport,subs:4,8) ffff 0028 00002320 000c 0001 0000 0000 00000002 0002 0000 00000000 00000000 dnl 0004 0008 00000000 -# actions=bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[],slaves:4,8) +# actions=bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[],subs:4,8) ffff 0028 00002320 000d 0001 0000 0000 00000002 0002 001f 00010004 00000000 dnl 0004 0008 00000000 @@ -947,17 +947,17 @@ bad_action 'enqueue:asdf:123' 'asdf: enqueue to unknown port' # bundle bad_action 'bundle:123' '123: not enough arguments to bundle action' bad_action 'bundle(symmetric_l4,60,hrw,ofport,ports:1,2,3,4,5)' \ - "symmetric_l4,60,hrw,ofport,ports:1,2,3,4,5: missing slave delimiter, expected \`slaves' got \`ports'" -bad_action 'bundle(symmetric_l4,60,hrw,ofport,slaves:xyzzy,2,3,4,5)' \ + "symmetric_l4,60,hrw,ofport,ports:1,2,3,4,5: missing sub delimiter, expected \`subs', got \`ports'" +bad_action 'bundle(symmetric_l4,60,hrw,ofport,subs:xyzzy,2,3,4,5)' \ 'xyzzy: bad port number' -bad_action 'bundle(asymmetric_l4,60,hrw,ofport,slaves:1,2,3,4,5)' \ - "asymmetric_l4,60,hrw,ofport,slaves:1,2,3,4,5: unknown fields \`asymmetric_l4'" -bad_action 'bundle(symmetric_l4,60,hrt,ofport,slaves:1,2,3,4,5)' \ - "symmetric_l4,60,hrt,ofport,slaves:1,2,3,4,5: unknown algorithm \`hrt'" -bad_action 'bundle(symmetric_l4,60,hrw,odpport,slaves:1,2,3,4,5)' \ - "symmetric_l4,60,hrw,odpport,slaves:1,2,3,4,5: unknown slave_type \`odpport'" -bad_action 'bundle_load(symmetric_l4,60,hrw,ofport,actset_output,slaves:1,2,3,4,5)' \ - "symmetric_l4,60,hrw,ofport,actset_output,slaves:1,2,3,4,5: experimenter OXM field 'actset_output' not supported" +bad_action 'bundle(asymmetric_l4,60,hrw,ofport,subs:1,2,3,4,5)' \ + "asymmetric_l4,60,hrw,ofport,subs:1,2,3,4,5: unknown fields \`asymmetric_l4'" +bad_action 'bundle(symmetric_l4,60,hrt,ofport,subs:1,2,3,4,5)' \ + "symmetric_l4,60,hrt,ofport,subs:1,2,3,4,5: unknown algorithm \`hrt'" +bad_action 'bundle(symmetric_l4,60,hrw,odpport,subs:1,2,3,4,5)' \ + "symmetric_l4,60,hrw,odpport,subs:1,2,3,4,5: unknown sub_type \`odpport'" +bad_action 'bundle_load(symmetric_l4,60,hrw,ofport,actset_output,subs:1,2,3,4,5)' \ + "symmetric_l4,60,hrw,ofport,actset_output,subs:1,2,3,4,5: experimenter OXM field 'actset_output' not supported" # mod_vlan_vid bad_action 'mod_vlan_vid:6000' '6000: not a valid VLAN VID' diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at index e3402e7b871f..8ffd4f583830 100644 --- a/tests/ofproto-dpif.at +++ b/tests/ofproto-dpif.at @@ -1958,7 +1958,7 @@ cookie=0xd dl_src=60:66:66:66:00:02 actions=pop_mpls:0x0800,load:0xa000001->OXM_ cookie=0xd dl_src=60:66:66:66:00:03 actions=pop_mpls:0x0800,move:OXM_OF_IPV4_DST[[]]->OXM_OF_IPV4_SRC[[]],controller cookie=0xd dl_src=60:66:66:66:00:04 actions=pop_mpls:0x0800,push:OXM_OF_IPV4_DST[[]],pop:OXM_OF_IPV4_SRC[[]],controller cookie=0xd dl_src=60:66:66:66:00:05 actions=pop_mpls:0x0800,multipath(eth_src,50,modulo_n,1,0,OXM_OF_IPV4_SRC[[0..7]]),controller -cookie=0xd dl_src=60:66:66:66:00:06 actions=pop_mpls:0x0800,bundle_load(eth_src,50,hrw,ofport,OXM_OF_IPV4_SRC[[0..15]],slaves:1,2),controller +cookie=0xd dl_src=60:66:66:66:00:06 actions=pop_mpls:0x0800,bundle_load(eth_src,50,hrw,ofport,OXM_OF_IPV4_SRC[[0..15]],subs:1,2),controller cookie=0xd dl_src=60:66:66:66:00:07 actions=pop_mpls:0x0800,learn(table=1,hard_timeout=60,eth_type=0x800,nw_proto=6,OXM_OF_IPV4_SRC[[]]=OXM_OF_IPV4_DST[[]]),controller cookie=0xd dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1) @@ -2956,7 +2956,7 @@ AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:03 actions=pop_mpls:0x0800,move:NXM_OF_IP_DST[[]]->NXM_OF_IP_SRC[[]],CONTROLLER:65535 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:04 actions=pop_mpls:0x0800,push:NXM_OF_IP_DST[[]],pop:NXM_OF_IP_SRC[[]],CONTROLLER:65535 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:05 actions=pop_mpls:0x0800,multipath(eth_src,50,modulo_n,1,0,NXM_OF_IP_SRC[[0..7]]),CONTROLLER:65535 - cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:06 actions=pop_mpls:0x0800,bundle_load(eth_src,50,hrw,ofport,NXM_OF_IP_SRC[[0..15]],slaves:1,2),CONTROLLER:65535 + cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:06 actions=pop_mpls:0x0800,bundle_load(eth_src,50,hrw,ofport,NXM_OF_IP_SRC[[0..15]],subs:1,2),CONTROLLER:65535 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:07 actions=pop_mpls:0x0800,learn(table=1,hard_timeout=60,eth_type=0x800,nw_proto=6,NXM_OF_IP_SRC[[]]=NXM_OF_IP_DST[[]]),CONTROLLER:65535 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:09 actions=resubmit(,2),CONTROLLER:65535 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:0a actions=pop_mpls:0x0800,mod_nw_dst:10.0.0.1,CONTROLLER:65535 @@ -8773,7 +8773,7 @@ AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl Local Session State: up Remote Session State: up ]) -# bond/show should show 'may-enable: true' for all slaves. +# bond/show should show 'may-enable: true' for all interfaces. AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl may_enable: true may_enable: true diff --git a/tests/ofproto.at b/tests/ofproto.at index 76a3be44dd66..4aba60ae1ff4 100644 --- a/tests/ofproto.at +++ b/tests/ofproto.at @@ -6322,12 +6322,12 @@ AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl OFPT_ERROR: OFPBAC_BAD_SET_LEN ]) -AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=bundle_load(eth_src,50,hrw,ofport,tun_metadata1[[0..31]], slaves:4,8)"], [1], [], [stderr]) +AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=bundle_load(eth_src,50,hrw,ofport,tun_metadata1[[0..31]], subs:4,8)"], [1], [], [stderr]) AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl OFPT_ERROR: NXFMFC_INVALID_TLV_FIELD ]) -AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=bundle_load(eth_src,50,hrw,ofport,tun_metadata0[[32..63]], slaves:4,8)"], [1], [], [stderr]) +AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=bundle_load(eth_src,50,hrw,ofport,tun_metadata0[[32..63]], subs:4,8)"], [1], [], [stderr]) AT_CHECK([strip_xids < stderr | sed '/FLOW_MOD/,$d'], [0], [dnl OFPT_ERROR: OFPBAC_BAD_SET_LEN ]) diff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at index c8062c8acc34..5aaf9147b6ca 100644 --- a/tests/ovs-ofctl.at +++ b/tests/ovs-ofctl.at @@ -413,20 +413,20 @@ actions=multipath(eth_src, 50, hrw, 12, 0, NXM_NX_REG0[0..3]),multipath(symmetri table=1,actions=drop tun_id=0x1234000056780000/0xffff0000ffff0000,actions=drop metadata=0x1234ffff5678ffff/0xffff0000ffff0000,actions=drop -actions=bundle(eth_src,50,active_backup,ofport,slaves:1) -actions=bundle(symmetric_l4,60,hrw,ofport,slaves:2,3) -actions=bundle(symmetric_l4,60,hrw,ofport,slaves:) -actions=bundle(symmetric_l3,60,hrw,ofport,slaves:2,3) -actions=bundle(symmetric_l3,60,hrw,ofport,slaves:) -actions=output:1,bundle(eth_src,0,hrw,ofport,slaves:1),output:2 -actions=bundle_load(eth_src,50,active_backup,ofport,reg0,slaves:1) -actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:2,3) -actions=bundle_load(symmetric_l4,60,hrw,ofport,reg0[0..15],slaves:[2,3]) -actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..30],slaves:) -actions=bundle_load(symmetric_l3,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:2,3) -actions=bundle_load(symmetric_l3,60,hrw,ofport,reg0[0..15],slaves:[2,3]) -actions=bundle_load(symmetric_l3,60,hrw,ofport,NXM_NX_REG0[0..30],slaves:) -actions=output:1,bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[16..31],slaves:1),output:2 +actions=bundle(eth_src,50,active_backup,ofport,subs:1) +actions=bundle(symmetric_l4,60,hrw,ofport,subs:2,3) +actions=bundle(symmetric_l4,60,hrw,ofport,subs:) +actions=bundle(symmetric_l3,60,hrw,ofport,subs:2,3) +actions=bundle(symmetric_l3,60,hrw,ofport,subs:) +actions=output:1,bundle(eth_src,0,hrw,ofport,subs:1),output:2 +actions=bundle_load(eth_src,50,active_backup,ofport,reg0,subs:1) +actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..15],subs:2,3) +actions=bundle_load(symmetric_l4,60,hrw,ofport,reg0[0..15],subs:[2,3]) +actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..30],subs:) +actions=bundle_load(symmetric_l3,60,hrw,ofport,NXM_NX_REG0[0..15],subs:2,3) +actions=bundle_load(symmetric_l3,60,hrw,ofport,reg0[0..15],subs:[2,3]) +actions=bundle_load(symmetric_l3,60,hrw,ofport,NXM_NX_REG0[0..30],subs:) +actions=output:1,bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[16..31],subs:1),output:2 actions=resubmit:1,resubmit(2),resubmit(,3),resubmit(2,3) send_flow_rem,actions=output:1,output:NXM_NX_REG0,output:2,output:reg1[16..31],output:3 check_overlap,actions=output:1,exit,output:2 @@ -469,20 +469,20 @@ NXT_FLOW_MOD: ADD table:255 actions=multipath(eth_src,50,hrw,12,0,NXM_NX_REG0[0. NXT_FLOW_MOD: ADD table:1 actions=drop NXT_FLOW_MOD: ADD table:255 tun_id=0x1234000056780000/0xffff0000ffff0000 actions=drop NXT_FLOW_MOD: ADD table:255 metadata=0x1234000056780000/0xffff0000ffff0000 actions=drop -NXT_FLOW_MOD: ADD table:255 actions=bundle(eth_src,50,active_backup,ofport,slaves:1) -NXT_FLOW_MOD: ADD table:255 actions=bundle(symmetric_l4,60,hrw,ofport,slaves:2,3) -NXT_FLOW_MOD: ADD table:255 actions=bundle(symmetric_l4,60,hrw,ofport,slaves:) -NXT_FLOW_MOD: ADD table:255 actions=bundle(symmetric_l3,60,hrw,ofport,slaves:2,3) -NXT_FLOW_MOD: ADD table:255 actions=bundle(symmetric_l3,60,hrw,ofport,slaves:) -NXT_FLOW_MOD: ADD table:255 actions=output:1,bundle(eth_src,0,hrw,ofport,slaves:1),output:2 -NXT_FLOW_MOD: ADD table:255 actions=bundle_load(eth_src,50,active_backup,ofport,NXM_NX_REG0[],slaves:1) -NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:2,3) -NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:2,3) -NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..30],slaves:) -NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l3,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:2,3) -NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l3,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:2,3) -NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l3,60,hrw,ofport,NXM_NX_REG0[0..30],slaves:) -NXT_FLOW_MOD: ADD table:255 actions=output:1,bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[16..31],slaves:1),output:2 +NXT_FLOW_MOD: ADD table:255 actions=bundle(eth_src,50,active_backup,ofport,subs:1) +NXT_FLOW_MOD: ADD table:255 actions=bundle(symmetric_l4,60,hrw,ofport,subs:2,3) +NXT_FLOW_MOD: ADD table:255 actions=bundle(symmetric_l4,60,hrw,ofport,subs:) +NXT_FLOW_MOD: ADD table:255 actions=bundle(symmetric_l3,60,hrw,ofport,subs:2,3) +NXT_FLOW_MOD: ADD table:255 actions=bundle(symmetric_l3,60,hrw,ofport,subs:) +NXT_FLOW_MOD: ADD table:255 actions=output:1,bundle(eth_src,0,hrw,ofport,subs:1),output:2 +NXT_FLOW_MOD: ADD table:255 actions=bundle_load(eth_src,50,active_backup,ofport,NXM_NX_REG0[],subs:1) +NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..15],subs:2,3) +NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..15],subs:2,3) +NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..30],subs:) +NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l3,60,hrw,ofport,NXM_NX_REG0[0..15],subs:2,3) +NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l3,60,hrw,ofport,NXM_NX_REG0[0..15],subs:2,3) +NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l3,60,hrw,ofport,NXM_NX_REG0[0..30],subs:) +NXT_FLOW_MOD: ADD table:255 actions=output:1,bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[16..31],subs:1),output:2 NXT_FLOW_MOD: ADD table:255 actions=resubmit:1,resubmit:2,resubmit(,3),resubmit(2,3) NXT_FLOW_MOD: ADD table:255 send_flow_rem actions=output:1,output:NXM_NX_REG0[],output:2,output:NXM_NX_REG1[16..31],output:3 NXT_FLOW_MOD: ADD table:255 check_overlap actions=output:1,exit,output:2 diff --git a/tests/test-bundle.c b/tests/test-bundle.c index 124ad5b434d1..6bb3486b95a6 100644 --- a/tests/test-bundle.c +++ b/tests/test-bundle.c @@ -25,28 +25,28 @@ #include "util.h" #define N_FLOWS 50000 -#define MAX_SLAVES 8 /* Maximum supported by this test framework. */ +#define MAX_SUBS 8 /* Maximum supported by this test framework. */ -struct slave { - ofp_port_t slave_id; +struct sub { + ofp_port_t sub_id; bool enabled; size_t flow_count; }; -struct slave_group { - size_t n_slaves; - struct slave slaves[MAX_SLAVES]; +struct sub_group { + size_t n_subs; + struct sub subs[MAX_SUBS]; }; -static struct slave * -slave_lookup(struct slave_group *sg, ofp_port_t slave_id) +static struct sub * +sub_lookup(struct sub_group *sg, ofp_port_t sub_id) { size_t i; - for (i = 0; i < sg->n_slaves; i++) { - if (sg->slaves[i].slave_id == slave_id) { - return &sg->slaves[i]; + for (i = 0; i < sg->n_subs; i++) { + if (sg->subs[i].sub_id == sub_id) { + return &sg->subs[i]; } } @@ -54,12 +54,12 @@ slave_lookup(struct slave_group *sg, ofp_port_t slave_id) } static bool -slave_enabled_cb(ofp_port_t slave_id, void *aux) +sub_enabled_cb(ofp_port_t sub_id, void *aux) { - struct slave *slave; + struct sub *sub; - slave = slave_lookup(aux, slave_id); - return slave ? slave->enabled : false; + sub = sub_lookup(aux, sub_id); + return sub ? sub->enabled : false; } static struct ofpact_bundle * @@ -80,8 +80,8 @@ parse_bundle_actions(char *actions) bundle = ofpact_get_BUNDLE(xmemdup(action, action->len)); ofpbuf_uninit(&ofpacts); - if (bundle->n_slaves > MAX_SLAVES) { - ovs_fatal(0, "At most %u slaves are supported", MAX_SLAVES); + if (bundle->n_subs > MAX_SUBS) { + ovs_fatal(0, "At most %u subs are supported", MAX_SUBS); } return bundle; @@ -109,7 +109,7 @@ test_bundle_main(int argc, char *argv[]) struct ofpact_bundle *bundle; struct flow *flows; size_t i, n_permute, old_n_enabled; - struct slave_group sg; + struct sub_group sg; int old_active; set_program_name(argv[0]); @@ -120,17 +120,17 @@ test_bundle_main(int argc, char *argv[]) bundle = parse_bundle_actions(argv[1]); - /* Generate 'slaves' array. */ - sg.n_slaves = 0; - for (i = 0; i < bundle->n_slaves; i++) { - ofp_port_t slave_id = bundle->slaves[i]; + /* Generate 'subs' array. */ + sg.n_subs = 0; + for (i = 0; i < bundle->n_subs; i++) { + ofp_port_t sub_id = bundle->subs[i]; - if (slave_lookup(&sg, slave_id)) { - ovs_fatal(0, "Redundant slaves are not supported. "); + if (sub_lookup(&sg, sub_id)) { + ovs_fatal(0, "Redundant subs are not supported. "); } - sg.slaves[sg.n_slaves].slave_id = slave_id; - sg.n_slaves++; + sg.subs[sg.n_subs].sub_id = sub_id; + sg.n_subs++; } /* Generate flows. */ @@ -141,14 +141,14 @@ test_bundle_main(int argc, char *argv[]) } /* Cycles through each possible liveness permutation for the given - * n_slaves. The initial state is equivalent to all slaves down, so we + * n_subs. The initial state is equivalent to all subs down, so we * skip it by starting at i = 1. We do one extra iteration to cover * transitioning from the final state back to the initial state. */ old_n_enabled = 0; old_active = -1; - n_permute = 1 << sg.n_slaves; + n_permute = 1 << sg.n_subs; for (i = 1; i <= n_permute + 1; i++) { - struct slave *slave; + struct sub *sub; size_t j, n_enabled, changed; double disruption, perfect; uint8_t mask; @@ -156,27 +156,27 @@ test_bundle_main(int argc, char *argv[]) mask = i % n_permute; - /* Gray coding ensures that in each iteration exactly one slave + /* Gray coding ensures that in each iteration exactly one sub * changes its liveness. This makes the expected disruption a bit * easier to calculate, and is likely similar to how failures will be * experienced in the wild. */ mask = mask ^ (mask >> 1); - /* Initialize slaves. */ + /* Initialize subs. */ n_enabled = 0; - for (j = 0; j < sg.n_slaves; j++) { - slave = &sg.slaves[j]; - slave->flow_count = 0; - slave->enabled = ((1 << j) & mask) != 0; + for (j = 0; j < sg.n_subs; j++) { + sub = &sg.subs[j]; + sub->flow_count = 0; + sub->enabled = ((1 << j) & mask) != 0; - if (slave->enabled) { + if (sub->enabled) { n_enabled++; } } active = -1; - for (j = 0; j < sg.n_slaves; j++) { - if (sg.slaves[j].enabled) { + for (j = 0; j < sg.n_subs; j++) { + if (sg.subs[j].enabled) { active = j; break; } @@ -185,19 +185,19 @@ test_bundle_main(int argc, char *argv[]) changed = 0; for (j = 0; j < N_FLOWS; j++) { struct flow *flow = &flows[j]; - ofp_port_t old_slave_id, ofp_port; + ofp_port_t old_sub_id, ofp_port; struct flow_wildcards wc; - old_slave_id = u16_to_ofp(flow->regs[0]); - ofp_port = bundle_execute(bundle, flow, &wc, slave_enabled_cb, + old_sub_id = u16_to_ofp(flow->regs[0]); + ofp_port = bundle_execute(bundle, flow, &wc, sub_enabled_cb, &sg); flow->regs[0] = ofp_to_u16(ofp_port); if (ofp_port != OFPP_NONE) { - slave_lookup(&sg, ofp_port)->flow_count++; + sub_lookup(&sg, ofp_port)->flow_count++; } - if (old_slave_id != ofp_port) { + if (old_sub_id != ofp_port) { changed++; } } @@ -208,23 +208,23 @@ test_bundle_main(int argc, char *argv[]) if (old_n_enabled || n_enabled) { perfect = 1.0 / MAX(old_n_enabled, n_enabled); } else { - /* This will happen when 'sg.n_slaves' is 0. */ + /* This will happen when 'sg.n_subs' is 0. */ perfect = 0; } } disruption = changed / (double)N_FLOWS; printf("%s: disruption=%.2f (perfect=%.2f)", - mask_str(mask, sg.n_slaves), disruption, perfect); + mask_str(mask, sg.n_subs), disruption, perfect); - for (j = 0 ; j < sg.n_slaves; j++) { - slave = &sg.slaves[j]; + for (j = 0 ; j < sg.n_subs; j++) { + sub = &sg.subs[j]; double flow_percent; - flow_percent = slave->flow_count / (double)N_FLOWS; + flow_percent = sub->flow_count / (double)N_FLOWS; printf( " %.2f", flow_percent); - if (slave->enabled) { + if (sub->enabled) { double perfect_fp; if (bundle->algorithm == NX_BD_ALG_ACTIVE_BACKUP) { @@ -234,16 +234,16 @@ test_bundle_main(int argc, char *argv[]) } if (fabs(flow_percent - perfect_fp) >= .01) { - fprintf(stderr, "%s: slave %d: flow_percentage=%.5f for" + fprintf(stderr, "%s: sub %d: flow_percentage=%.5f for" " differs from perfect=%.5f by more than .01\n", - mask_str(mask, sg.n_slaves), slave->slave_id, + mask_str(mask, sg.n_subs), sub->sub_id, flow_percent, perfect_fp); ok = false; } - } else if (slave->flow_count) { - fprintf(stderr, "%s: slave %d: disabled slave received" - " flows.\n", mask_str(mask, sg.n_slaves), - slave->slave_id); + } else if (sub->flow_count) { + fprintf(stderr, "%s: sub %d: disabled sub received" + " flows.\n", mask_str(mask, sg.n_subs), + sub->sub_id); ok = false; } } @@ -251,7 +251,7 @@ test_bundle_main(int argc, char *argv[]) if (fabs(disruption - perfect) >= .01) { fprintf(stderr, "%s: disruption=%.5f differs from perfect=%.5f by" - " more than .01\n", mask_str(mask, sg.n_slaves), + " more than .01\n", mask_str(mask, sg.n_subs), disruption, perfect); ok = false; } diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 0bb4fa6524e9..ba4ac00f7dec 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -330,7 +330,7 @@ static void mirror_destroy(struct mirror *); static bool mirror_configure(struct mirror *); static void mirror_refresh_stats(struct mirror *); -static void iface_configure_lacp(struct iface *, struct lacp_slave_settings *); +static void iface_configure_lacp(struct iface *, struct lacp_sub_settings *); static bool iface_create(struct bridge *, const struct ovsrec_interface *, const struct ovsrec_port *); static bool iface_is_internal(const struct ovsrec_interface *iface, @@ -1197,11 +1197,11 @@ port_configure(struct port *port) /* Get name. */ s.name = port->name; - /* Get slaves. */ - s.n_slaves = 0; - s.slaves = xmalloc(ovs_list_size(&port->ifaces) * sizeof *s.slaves); + /* Get subs. */ + s.n_subs = 0; + s.subs = xmalloc(ovs_list_size(&port->ifaces) * sizeof *s.subs); LIST_FOR_EACH (iface, port_elem, &port->ifaces) { - s.slaves[s.n_slaves++] = iface->ofp_port; + s.subs[s.n_subs++] = iface->ofp_port; } /* Get VLAN tag. */ @@ -1270,16 +1270,16 @@ port_configure(struct port *port) if (s.lacp) { size_t i = 0; - s.lacp_slaves = xmalloc(s.n_slaves * sizeof *s.lacp_slaves); + s.lacp_subs = xmalloc(s.n_subs * sizeof *s.lacp_subs); LIST_FOR_EACH (iface, port_elem, &port->ifaces) { - iface_configure_lacp(iface, &s.lacp_slaves[i++]); + iface_configure_lacp(iface, &s.lacp_subs[i++]); } } else { - s.lacp_slaves = NULL; + s.lacp_subs = NULL; } /* Get bond settings. */ - if (s.n_slaves > 1) { + if (s.n_subs > 1) { s.bond = &bond_settings; port_configure_bond(port, &bond_settings); } else { @@ -1297,9 +1297,9 @@ port_configure(struct port *port) /* Clean up. */ free(s.cvlans); - free(s.slaves); + free(s.subs); free(s.trunks); - free(s.lacp_slaves); + free(s.lacp_subs); } /* Pick local port hardware address and datapath ID for 'br'. */ @@ -2277,8 +2277,8 @@ find_local_hw_addr(const struct bridge *br, struct eth_addr *ea, } else { /* Choose the interface whose MAC address will represent the port. * The Linux kernel bonding code always chooses the MAC address of - * the first slave added to a bond, and the Fedora networking - * scripts always add slaves to a bond in alphabetical order, so + * the first sub added to a bond, and the Fedora networking + * scripts always add subs to a bond in alphabetical order, so * for compatibility we choose the interface with the name that is * first in alphabetical order. */ LIST_FOR_EACH (candidate, port_elem, &port->ifaces) { @@ -2961,7 +2961,7 @@ port_refresh_bond_status(struct port *port, bool force_update) return; } - if (bond_get_changed_active_slave(port->name, &mac, force_update)) { + if (bond_get_changed_active_sub(port->name, &mac, force_update)) { struct ds mac_s; ds_init(&mac_s); @@ -4506,7 +4506,7 @@ port_configure_lacp(struct port *port, struct lacp_settings *s) } static void -iface_configure_lacp(struct iface *iface, struct lacp_slave_settings *s) +iface_configure_lacp(struct iface *iface, struct lacp_sub_settings *s) { int priority, portid, key; @@ -4598,9 +4598,9 @@ port_configure_bond(struct port *port, struct bond_settings *s) mac_s = port->cfg->bond_active_slave; if (!mac_s || !ovs_scan(mac_s, ETH_ADDR_SCAN_FMT, - ETH_ADDR_SCAN_ARGS(s->active_slave_mac))) { + ETH_ADDR_SCAN_ARGS(s->active_sub_mac))) { /* OVSDB did not store the last active interface */ - s->active_slave_mac = eth_addr_zero; + s->active_sub_mac = eth_addr_zero; } /* lb_output action is disabled by default. */ diff --git a/vswitchd/ovs-vswitchd.8.in b/vswitchd/ovs-vswitchd.8.in index 0ad8bd2bc4ff..5756b157b212 100644 --- a/vswitchd/ovs-vswitchd.8.in +++ b/vswitchd/ovs-vswitchd.8.in @@ -198,46 +198,46 @@ These commands manage bonded ports on an Open vSwitch's bridges. To understand some of these commands, it is important to understand a detail of the bonding implementation called ``source load balancing'' (SLB). Instead of directly assigning Ethernet source addresses to -slaves, the bonding implementation computes a function that maps an +sub-interfaces, the bonding implementation computes a function that maps an 48-bit Ethernet source addresses into an 8-bit value (a ``MAC hash'' value). All of the Ethernet addresses that map to a single 8-bit -value are then assigned to a single slave. +value are then assigned to a single sub-interface. .IP "\fBbond/list\fR" -Lists all of the bonds, and their slaves, on each bridge. +Lists all of the bonds, and their sub-interfaces, on each bridge. . .IP "\fBbond/show\fR [\fIport\fR]" Lists all of the bond-specific information (updelay, downdelay, time until the next rebalance) about the given bonded \fIport\fR, or all bonded ports if no \fIport\fR is given. Also lists information about -each slave: whether it is enabled or disabled, the time to completion +each sub-interface: whether it is enabled or disabled, the time to completion of an updelay or downdelay if one is in progress, whether it is the -active slave, the hashes assigned to the slave. Any LACP information +active sub-interface, the hashes assigned to the sub-interface. Any LACP information related to this bond may be found using the \fBlacp/show\fR command. . -.IP "\fBbond/migrate\fR \fIport\fR \fIhash\fR \fIslave\fR" -Only valid for SLB bonds. Assigns a given MAC hash to a new slave. +.IP "\fBbond/migrate\fR \fIport\fR \fIhash\fR \fIsub\fR" +Only valid for SLB bonds. Assigns a given MAC hash to a new sub-interface. \fIport\fR specifies the bond port, \fIhash\fR the MAC hash to be -migrated (as a decimal number between 0 and 255), and \fIslave\fR the -new slave to be assigned. +migrated (as a decimal number between 0 and 255), and \fIsub\fR the +new sub-interface to be assigned. .IP The reassignment is not permanent: rebalancing or fail-over will -cause the MAC hash to be shifted to a new slave in the usual +cause the MAC hash to be shifted to a new sub-interface in the usual manner. .IP -A MAC hash cannot be migrated to a disabled slave. -.IP "\fBbond/set\-active\-slave\fR \fIport\fR \fIslave\fR" -Sets \fIslave\fR as the active slave on \fIport\fR. \fIslave\fR must +A MAC hash cannot be migrated to a disabled sub-interface. +.IP "\fBbond/set\-active\-sub\fR \fIport\fR \fIsub\fR" +Sets \fIsub\fR as the active sub-interface on \fIport\fR. \fIsub\fR must currently be enabled. .IP -The setting is not permanent: a new active slave will be selected -if \fIslave\fR becomes disabled. -.IP "\fBbond/enable\-slave\fR \fIport\fR \fIslave\fR" -.IQ "\fBbond/disable\-slave\fR \fIport\fR \fIslave\fR" -Enables (or disables) \fIslave\fR on the given bond \fIport\fR, skipping any +The setting is not permanent: a new active sub-interface will be selected +if \fIsub\fR becomes disabled. +.IP "\fBbond/enable\-sub\fR \fIport\fR \fIsub\fR" +.IQ "\fBbond/disable\-sub\fR \fIport\fR \fIsub\fR" +Enables (or disables) \fIsub\fR on the given bond \fIport\fR, skipping any updelay (or downdelay). .IP This setting is not permanent: it persists only until the carrier -status of \fIslave\fR changes. +status of \fIsub\fR changes. .IP "\fBbond/hash\fR \fImac\fR [\fIvlan\fR] [\fIbasis\fR]" Returns the hash value which would be used for \fImac\fR with \fIvlan\fR and \fIbasis\fR if specified. @@ -245,7 +245,7 @@ and \fIbasis\fR if specified. .IP "\fBlacp/show\fR [\fIport\fR]" Lists all of the LACP related information about the given \fIport\fR: active or passive, aggregation key, system id, and system priority. Also -lists information about each slave: whether it is enabled or disabled, +lists information about each sub-interface: whether it is enabled or disabled, whether it is attached or detached, port id and priority, actor information, and partner information. If \fIport\fR is not specified, then displays detailed information about all interfaces with CFM @@ -253,7 +253,7 @@ enabled. . .IP "\fBlacp/stats-show\fR [\fIport\fR]" Lists various stats about LACP PDUs (number of RX/TX PDUs, bad PDUs received) -and slave state (number of time slave's state expired/defaulted and carrier +and sub-interface state (number of times its state expired/defaulted and carrier status changed) for the given \fIport\fR. If \fIport\fR is not specified, then displays stats of all interfaces with LACP enabled. .SS "DPCTL DATAPATH DEBUGGING COMMANDS" diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index b6acb34ca1b8..f84dc8fb8c18 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -1949,15 +1949,16 @@
balance-slb
- Balances flows among slaves based on source MAC address and output - VLAN, with periodic rebalancing as traffic patterns change. + Balances flows among sub-interfaces based on source MAC address and + output VLAN, with periodic rebalancing as traffic patterns change.
active-backup
- Assigns all flows to one slave, failing over to a backup slave when - the active slave is disabled. This is the only bonding mode in which - interfaces may be plugged into different upstream switches. + Assigns all flows to one sub-interface, failing over to a backup + sub-interface when the active sub-interface is disabled. This is the + only bonding mode in which interfaces may be plugged into different + upstream switches.
@@ -1971,8 +1972,8 @@
balance-tcp
- Balances flows among slaves based on L3 and L4 protocol information - such as IP addresses and TCP/UDP ports. + Balances flows among sub-interfaces based on L3 and L4 protocol + information such as IP addresses and TCP/UDP ports.
@@ -1987,11 +1988,11 @@ - An integer hashed along with flows when choosing output slaves in load - balanced bonds. When changed, all flows will be assigned different - hash values possibly causing slave selection decisions to change. Does - not affect bonding modes which do not employ load balancing such as - active-backup. + An integer hashed along with flows when choosing output sub-interfaces + in load balanced bonds. When changed, all flows will be assigned + different hash values possibly causing sub-interface selection + decisions to change. Does not affect bonding modes which do not employ + load balancing such as active-backup. - For a bonded port, record the mac address of the current active slave. + For a bonded port, record the MAC address of the current active + sub-interface. @@ -2469,7 +2471,8 @@
  • For the local interface, the default is the lowest-numbered MAC address among the other bridge ports, either the value of the in its record, - if set, or its actual MAC (for bonded ports, the MAC of its slave + if set, or its actual MAC (for bonded ports, the MAC of its + sub-interface whose name is first in alphabetical order). Internal ports and bridge ports that are used as port mirroring destinations (see the table) are ignored.
  • From patchwork Mon Jul 6 20:35:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1323939 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4B0y632RxYz9sRK for ; Tue, 7 Jul 2020 06:36:43 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id C259C88B61; Mon, 6 Jul 2020 20:36:41 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zRb5g9jECXRB; Mon, 6 Jul 2020 20:36:13 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id CDE4888B8E; Mon, 6 Jul 2020 20:36:08 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B57D6C0891; Mon, 6 Jul 2020 20:36:08 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4AF6BC0891 for ; Mon, 6 Jul 2020 20:36:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 2C15127AF2 for ; Mon, 6 Jul 2020 20:36:07 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Zs9ZcFyzmrSI for ; Mon, 6 Jul 2020 20:35:32 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by silver.osuosl.org (Postfix) with ESMTPS id 4F012226A9 for ; Mon, 6 Jul 2020 20:35:31 +0000 (UTC) Received: from sigfpe.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay11.mail.gandi.net (Postfix) with ESMTPSA id 0C8EA100007; Mon, 6 Jul 2020 20:35:28 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Mon, 6 Jul 2020 13:35:18 -0700 Message-Id: <20200706203521.719453-3-blp@ovn.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200706203521.719453-1-blp@ovn.org> References: <20200706203521.719453-1-blp@ovn.org> MIME-Version: 1.0 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH v2 2/5] Use primary/secondary, not master/slave, as names for OpenFlow roles. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Signed-off-by: Ben Pfaff --- Documentation/topics/design.rst | 110 +++++++++++----------- NEWS | 2 + include/openflow/nicira-ext.h | 22 ++--- include/openflow/openflow-1.2.h | 6 +- include/openflow/openflow-1.4.h | 8 +- include/openvswitch/ofp-connection.h | 6 +- include/openvswitch/ofp-errors.h | 9 +- lib/ofp-connection.c | 94 ++++++++++--------- manpages.mk | 3 - ofproto/connmgr.c | 72 +++++++------- ofproto/connmgr.h | 4 +- ofproto/ofproto.c | 36 +++---- tests/ofp-print.at | 49 +++++----- tests/ofproto-dpif.at | 12 +-- tests/ofproto.at | 134 +++++++++++++-------------- utilities/ovs-ofctl.8.in | 8 +- vswitchd/bridge.c | 8 +- vswitchd/vswitch.xml | 23 +++-- 18 files changed, 307 insertions(+), 299 deletions(-) diff --git a/Documentation/topics/design.rst b/Documentation/topics/design.rst index 22e966687bd9..656d60673e98 100644 --- a/Documentation/topics/design.rst +++ b/Documentation/topics/design.rst @@ -70,79 +70,79 @@ that the message is suppressed. .. table:: ``OFPT_PACKET_IN`` / ``NXT_PACKET_IN`` - =========================================== ======= ===== - master/ - message and reason code other slave - =========================================== ======= ===== - ``OFPR_NO_MATCH`` yes --- - ``OFPR_ACTION`` yes --- - ``OFPR_INVALID_TTL`` --- --- - ``OFPR_ACTION_SET`` (OF1.4+) yes --- - ``OFPR_GROUP`` (OF1.4+) yes --- - ``OFPR_PACKET_OUT`` (OF1.4+) yes --- - =========================================== ======= ===== + =========================================== ======== ========= + primary/ + message and reason code other secondary + =========================================== ======== ========= + ``OFPR_NO_MATCH`` yes --- + ``OFPR_ACTION`` yes --- + ``OFPR_INVALID_TTL`` --- --- + ``OFPR_ACTION_SET`` (OF1.4+) yes --- + ``OFPR_GROUP`` (OF1.4+) yes --- + ``OFPR_PACKET_OUT`` (OF1.4+) yes --- + =========================================== ======== ========= .. table:: ``OFPT_FLOW_REMOVED`` / ``NXT_FLOW_REMOVED`` - =========================================== ======= ===== - master/ - message and reason code other slave - =========================================== ======= ===== - ``OFPRR_IDLE_TIMEOUT`` yes --- - ``OFPRR_HARD_TIMEOUT`` yes --- - ``OFPRR_DELETE`` yes --- - ``OFPRR_GROUP_DELETE`` (OF1.3+) yes --- - ``OFPRR_METER_DELETE`` (OF1.4+) yes --- - ``OFPRR_EVICTION`` (OF1.4+) yes --- - =========================================== ======= ===== + =========================================== ======== ========= + primary/ + message and reason code other secondary + =========================================== ======== ========= + ``OFPRR_IDLE_TIMEOUT`` yes --- + ``OFPRR_HARD_TIMEOUT`` yes --- + ``OFPRR_DELETE`` yes --- + ``OFPRR_GROUP_DELETE`` (OF1.3+) yes --- + ``OFPRR_METER_DELETE`` (OF1.4+) yes --- + ``OFPRR_EVICTION`` (OF1.4+) yes --- + =========================================== ======== ========= .. table:: ``OFPT_PORT_STATUS`` - =========================================== ======= ===== - master/ - message and reason code other slave - =========================================== ======= ===== - ``OFPPR_ADD`` yes yes - ``OFPPR_DELETE`` yes yes - ``OFPPR_MODIFY`` yes yes - =========================================== ======= ===== - + =========================================== ======== ========= + primary/ + message and reason code other secondary + =========================================== ======== ========= + ``OFPPR_ADD`` yes --- + ``OFPPR_DELETE`` yes --- + ``OFPPR_MODIFY`` yes --- + =========================================== ======== ========= + .. table:: ``OFPT_ROLE_REQUEST`` / ``OFPT_ROLE_REPLY`` (OF1.4+) - - =========================================== ======= ===== - master/ - message and reason code other slave - =========================================== ======= ===== - ``OFPCRR_MASTER_REQUEST`` --- --- - ``OFPCRR_CONFIG`` --- --- - ``OFPCRR_EXPERIMENTER`` --- --- - =========================================== ======= ===== + + =========================================== ======== ========= + primary/ + message and reason code other secondary + =========================================== ======== ========= + ``OFPCRR_PROMOTE_REQUEST`` --- --- + ``OFPCRR_CONFIG`` --- --- + ``OFPCRR_EXPERIMENTER`` --- --- + =========================================== ======== ========= .. table:: ``OFPT_TABLE_STATUS`` (OF1.4+) - =========================================== ======= ===== - master/ - message and reason code other slave - =========================================== ======= ===== - ``OFPTR_VACANCY_DOWN`` --- --- - ``OFPTR_VACANCY_UP`` --- --- - =========================================== ======= ===== + =========================================== ======== ========= + primary/ + message and reason code other secondary + =========================================== ======== ========= + ``OFPTR_VACANCY_DOWN`` --- --- + ``OFPTR_VACANCY_UP`` --- --- + =========================================== ======== ========= .. table:: ``OFPT_REQUESTFORWARD`` (OF1.4+) - =========================================== ======= ===== - master/ - message and reason code other slave - =========================================== ======= ===== - ``OFPRFR_GROUP_MOD`` --- --- - ``OFPRFR_METER_MOD`` --- --- - =========================================== ======= ===== + =========================================== ======== ========= + primary/ + message and reason code other secondary + =========================================== ======== ========= + ``OFPRFR_GROUP_MOD`` --- --- + ``OFPRFR_METER_MOD`` --- --- + =========================================== ======== ========= The ``NXT_SET_ASYNC_CONFIG`` message directly sets all of the values in this table for the current connection. The ``OFPC_INVALID_TTL_TO_CONTROLLER`` bit in the ``OFPT_SET_CONFIG`` message controls the setting for -``OFPR_INVALID_TTL`` for the "master" role. +``OFPR_INVALID_TTL`` for the "primary" role. ``OFPAT_ENQUEUE`` ----------------- diff --git a/NEWS b/NEWS index 1157a1d19170..ce340be83d2b 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,8 @@ Post-v2.13.0 - Terminology: * The term "slave" has been replaced by "sub-interface", "sub" for short, in the contexts of bonds, LACP, and OpenFlow bundle actions. + * The terms "master" and "slave" have been replaced by "primary" and + "secondary", respectively, for OpenFlow connection roles. v2.13.0 - 14 Feb 2020 diff --git a/include/openflow/nicira-ext.h b/include/openflow/nicira-ext.h index dc12101f2080..b68804991aa7 100644 --- a/include/openflow/nicira-ext.h +++ b/include/openflow/nicira-ext.h @@ -296,16 +296,16 @@ enum nx_packet_in2_prop_type { * * The other possible roles are a related pair: * - * - Master (NX_ROLE_MASTER) is equivalent to Other, except that there may - * be at most one Master controller at a time: when a controller - * configures itself as Master, any existing Master is demoted to the - * Slave role. + * - Primary (NX_ROLE_PRIMARY) is equivalent to Other, except that there may + * be at most one Primary controller at a time: when a controller + * configures itself as Primary, any existing Primary is demoted to the + * Secondary role. * - * - Slave (NX_ROLE_SLAVE) allows the controller read-only access to + * - Secondary (NX_ROLE_SECONDARY) allows the controller read-only access to * OpenFlow features. In particular attempts to modify the flow table * will be rejected with an OFPBRC_EPERM error. * - * Slave controllers do not receive OFPT_PACKET_IN or OFPT_FLOW_REMOVED + * Secondary controllers do not receive OFPT_PACKET_IN or OFPT_FLOW_REMOVED * messages, but they do receive OFPT_PORT_STATUS messages. */ struct nx_role_request { @@ -315,23 +315,23 @@ OFP_ASSERT(sizeof(struct nx_role_request) == 4); enum nx_role { NX_ROLE_OTHER, /* Default role, full access. */ - NX_ROLE_MASTER, /* Full access, at most one. */ - NX_ROLE_SLAVE /* Read-only access. */ + NX_ROLE_PRIMARY, /* Full access, at most one. */ + NX_ROLE_SECONDARY /* Read-only access. */ }; /* NXT_SET_ASYNC_CONFIG. * * Sent by a controller, this message configures the asynchronous messages that * the controller wants to receive. Element 0 in each array specifies messages - * of interest when the controller has an "other" or "master" role; element 1, - * when the controller has a "slave" role. + * of interest when the controller has an "other" or "primary" role; element 1, + * when the controller has a "secondary" role. * * Each array element is a bitmask in which a 0-bit disables receiving a * particular message and a 1-bit enables receiving it. Each bit controls the * message whose 'reason' corresponds to the bit index. For example, the bit * with value 1<<2 == 4 in port_status_mask[1] determines whether the * controller will receive OFPT_PORT_STATUS messages with reason OFPPR_MODIFY - * (value 2) when the controller has a "slave" role. + * (value 2) when the controller has a "secondary" role. * * As a side effect, for service controllers, this message changes the * miss_send_len from default of zero to OFP_DEFAULT_MISS_SEND_LEN (128). diff --git a/include/openflow/openflow-1.2.h b/include/openflow/openflow-1.2.h index 30e220cfba5f..2952aec14ebe 100644 --- a/include/openflow/openflow-1.2.h +++ b/include/openflow/openflow-1.2.h @@ -176,7 +176,7 @@ enum ofp12_group_capabilities { struct ofp12_role_request { ovs_be32 role; /* One of OFPCR12_ROLE_*. */ uint8_t pad[4]; /* Align to 64 bits. */ - ovs_be64 generation_id; /* Master Election Generation Id */ + ovs_be64 generation_id; /* Primary Election Generation Id */ }; OFP_ASSERT(sizeof(struct ofp12_role_request) == 16); @@ -184,8 +184,8 @@ OFP_ASSERT(sizeof(struct ofp12_role_request) == 16); enum ofp12_controller_role { OFPCR12_ROLE_NOCHANGE, /* Don't change current role. */ OFPCR12_ROLE_EQUAL, /* Default role, full access. */ - OFPCR12_ROLE_MASTER, /* Full access, at most one master. */ - OFPCR12_ROLE_SLAVE, /* Read-only access. */ + OFPCR12_ROLE_PRIMARY, /* Full access, at most one primary. */ + OFPCR12_ROLE_SECONDARY, /* Read-only access. */ }; /* Packet received on port (datapath -> controller). */ diff --git a/include/openflow/openflow-1.4.h b/include/openflow/openflow-1.4.h index 2bfa16b632d9..be191180b63f 100644 --- a/include/openflow/openflow-1.4.h +++ b/include/openflow/openflow-1.4.h @@ -274,7 +274,7 @@ struct ofp14_role_status { ovs_be32 role; /* One of OFPCR_ROLE_*. */ uint8_t reason; /* One of OFPCRR_*. */ uint8_t pad[3]; /* Align to 64 bits. */ - ovs_be64 generation_id; /* Master Election Generation Id */ + ovs_be64 generation_id; /* Primary Election Generation Id */ /* Followed by a list of struct ofp14_role_prop_header */ }; @@ -282,9 +282,9 @@ OFP_ASSERT(sizeof(struct ofp14_role_status) == 16); /* What changed about the controller role */ enum ofp14_controller_role_reason { - OFPCRR_MASTER_REQUEST = 0, /* Another controller asked to be master. */ - OFPCRR_CONFIG = 1, /* Configuration changed on the switch. */ - OFPCRR_EXPERIMENTER = 2, /* Experimenter data changed. */ + OFPCRR_PRIMARY_REQUEST = 0, /* Another controller asked to be primary. */ + OFPCRR_CONFIG = 1, /* Configuration changed on the switch. */ + OFPCRR_EXPERIMENTER = 2, /* Experimenter data changed. */ OFPCRR_N_REASONS /* Denotes number of reasons. */ }; diff --git a/include/openvswitch/ofp-connection.h b/include/openvswitch/ofp-connection.h index 5fb143157d23..1e844e07f39d 100644 --- a/include/openvswitch/ofp-connection.h +++ b/include/openvswitch/ofp-connection.h @@ -69,10 +69,10 @@ enum ofputil_async_msg_type { const char *ofputil_async_msg_type_to_string(enum ofputil_async_msg_type); struct ofputil_async_cfg { - uint32_t master[OAM_N_TYPES]; - uint32_t slave[OAM_N_TYPES]; + uint32_t primary[OAM_N_TYPES]; + uint32_t secondary[OAM_N_TYPES]; }; -#define OFPUTIL_ASYNC_CFG_INIT (struct ofputil_async_cfg) { .master[0] = 0 } +#define OFPUTIL_ASYNC_CFG_INIT (struct ofputil_async_cfg) { .primary[0] = 0 } enum ofperr ofputil_decode_set_async_config(const struct ofp_header *, bool loose, diff --git a/include/openvswitch/ofp-errors.h b/include/openvswitch/ofp-errors.h index a3f8142dfb1a..8c8511d65e4a 100644 --- a/include/openvswitch/ofp-errors.h +++ b/include/openvswitch/ofp-errors.h @@ -115,10 +115,10 @@ enum ofperr { * OFPBIC_BAD_EXP_TYPE. */ /* Expected: 0x0,1,5 in OF1.0 means both OFPBRC_EPERM and - * OFPBRC_IS_SLAVE. */ + * OFPBRC_IS_SECONDARY. */ /* Expected: 0x0,1,5 in OF1.1 means both OFPBRC_EPERM and - * OFPBRC_IS_SLAVE. */ + * OFPBRC_IS_SECONDARY. */ /* ## ------------------ ## */ /* ## OFPET_HELLO_FAILED ## */ @@ -168,8 +168,9 @@ enum ofperr { * code defined the specification. ] */ OFPERR_OFPBRC_BAD_TABLE_ID, - /* OF1.0-1.1(1,5), OF1.2+(1,10). Denied because controller is slave. */ - OFPERR_OFPBRC_IS_SLAVE, + /* OF1.0-1.1(1,5), OF1.2+(1,10). Denied because controller has secondary + * role. (Secondary controllers have only read-only access.) */ + OFPERR_OFPBRC_IS_SECONDARY, /* NX1.0-1.1(1,514), OF1.2+(1,11). Invalid or missing port. [ A * non-standard error (1,514), formerly OFPERR_NXBRC_BAD_IN_PORT is used diff --git a/lib/ofp-connection.c b/lib/ofp-connection.c index 23b80ff39dc4..3a7611b00cc9 100644 --- a/lib/ofp-connection.c +++ b/lib/ofp-connection.c @@ -48,8 +48,8 @@ ofputil_decode_role_message(const struct ofp_header *oh, if (orr->role != htonl(OFPCR12_ROLE_NOCHANGE) && orr->role != htonl(OFPCR12_ROLE_EQUAL) && - orr->role != htonl(OFPCR12_ROLE_MASTER) && - orr->role != htonl(OFPCR12_ROLE_SLAVE)) { + orr->role != htonl(OFPCR12_ROLE_PRIMARY) && + orr->role != htonl(OFPCR12_ROLE_SECONDARY)) { return OFPERR_OFPRRFC_BAD_ROLE; } @@ -68,12 +68,12 @@ ofputil_decode_role_message(const struct ofp_header *oh, const struct nx_role_request *nrr = b.msg; BUILD_ASSERT(NX_ROLE_OTHER + 1 == OFPCR12_ROLE_EQUAL); - BUILD_ASSERT(NX_ROLE_MASTER + 1 == OFPCR12_ROLE_MASTER); - BUILD_ASSERT(NX_ROLE_SLAVE + 1 == OFPCR12_ROLE_SLAVE); + BUILD_ASSERT(NX_ROLE_PRIMARY + 1 == OFPCR12_ROLE_PRIMARY); + BUILD_ASSERT(NX_ROLE_SECONDARY + 1 == OFPCR12_ROLE_SECONDARY); if (nrr->role != htonl(NX_ROLE_OTHER) && - nrr->role != htonl(NX_ROLE_MASTER) && - nrr->role != htonl(NX_ROLE_SLAVE)) { + nrr->role != htonl(NX_ROLE_PRIMARY) && + nrr->role != htonl(NX_ROLE_SECONDARY)) { return OFPERR_OFPRRFC_BAD_ROLE; } @@ -100,11 +100,11 @@ format_role_generic(struct ds *string, enum ofp12_controller_role role, case OFPCR12_ROLE_EQUAL: ds_put_cstr(string, "equal"); /* OF 1.2 wording */ break; - case OFPCR12_ROLE_MASTER: - ds_put_cstr(string, "master"); + case OFPCR12_ROLE_PRIMARY: + ds_put_cstr(string, "primary"); break; - case OFPCR12_ROLE_SLAVE: - ds_put_cstr(string, "slave"); + case OFPCR12_ROLE_SECONDARY: + ds_put_cstr(string, "secondary"); break; default: OVS_NOT_REACHED(); @@ -148,8 +148,8 @@ ofputil_encode_role_reply(const struct ofp_header *request, struct nx_role_request *nrr; BUILD_ASSERT(NX_ROLE_OTHER == OFPCR12_ROLE_EQUAL - 1); - BUILD_ASSERT(NX_ROLE_MASTER == OFPCR12_ROLE_MASTER - 1); - BUILD_ASSERT(NX_ROLE_SLAVE == OFPCR12_ROLE_SLAVE - 1); + BUILD_ASSERT(NX_ROLE_PRIMARY == OFPCR12_ROLE_PRIMARY - 1); + BUILD_ASSERT(NX_ROLE_SECONDARY == OFPCR12_ROLE_SECONDARY - 1); buf = ofpraw_alloc_reply(OFPRAW_NXT_ROLE_REPLY, request, 0); nrr = ofpbuf_put_zeros(buf, sizeof *nrr); @@ -197,8 +197,8 @@ ofputil_decode_role_status(const struct ofp_header *oh, const struct ofp14_role_status *r = b.msg; if (r->role != htonl(OFPCR12_ROLE_NOCHANGE) && r->role != htonl(OFPCR12_ROLE_EQUAL) && - r->role != htonl(OFPCR12_ROLE_MASTER) && - r->role != htonl(OFPCR12_ROLE_SLAVE)) { + r->role != htonl(OFPCR12_ROLE_PRIMARY) && + r->role != htonl(OFPCR12_ROLE_SECONDARY)) { return OFPERR_OFPRRFC_BAD_ROLE; } @@ -218,8 +218,8 @@ ofputil_format_role_status(struct ds *string, ds_put_cstr(string, " reason="); switch (rs->reason) { - case OFPCRR_MASTER_REQUEST: - ds_put_cstr(string, "master_request"); + case OFPCRR_PRIMARY_REQUEST: + ds_put_cstr(string, "primary_request"); break; case OFPCRR_CONFIG: ds_put_cstr(string, "configuration_changed"); @@ -254,13 +254,13 @@ ofputil_async_msg_type_to_string(enum ofputil_async_msg_type type) struct ofp14_async_prop { uint64_t prop_type; enum ofputil_async_msg_type oam; - bool master; + bool primary; uint32_t allowed10, allowed14; }; -#define AP_PAIR(SLAVE_PROP_TYPE, OAM, A10, A14) \ - { SLAVE_PROP_TYPE, OAM, false, A10, (A14) ? (A14) : (A10) }, \ - { (SLAVE_PROP_TYPE + 1), OAM, true, A10, (A14) ? (A14) : (A10) } +#define AP_PAIR(SECONDARY_PROP_TYPE, OAM, A10, A14) \ + { SECONDARY_PROP_TYPE, OAM, false, A10, (A14) ? (A14) : (A10) }, \ + { (SECONDARY_PROP_TYPE + 1), OAM, true, A10, (A14) ? (A14) : (A10) } static const struct ofp14_async_prop async_props[] = { AP_PAIR( 0, OAM_PACKET_IN, OFPR10_BITS, OFPR14_BITS), @@ -288,10 +288,10 @@ get_ofp14_async_config_prop_by_prop_type(uint64_t prop_type) static const struct ofp14_async_prop * get_ofp14_async_config_prop_by_oam(enum ofputil_async_msg_type oam, - bool master) + bool primary) { FOR_EACH_ASYNC_PROP (ap) { - if (ap->oam == oam && ap->master == master) { + if (ap->oam == oam && ap->primary == primary) { return ap; } } @@ -310,7 +310,9 @@ encode_async_mask(const struct ofputil_async_cfg *src, const struct ofp14_async_prop *ap, enum ofp_version version) { - uint32_t mask = ap->master ? src->master[ap->oam] : src->slave[ap->oam]; + uint32_t mask = (ap->primary + ? src->primary[ap->oam] + : src->secondary[ap->oam]); return htonl(mask & ofp14_async_prop_allowed(ap, version)); } @@ -342,7 +344,7 @@ decode_async_mask(ovs_be32 src, } } - uint32_t *array = ap->master ? dst->master : dst->slave; + uint32_t *array = ap->primary ? dst->primary : dst->secondary; array[ap->oam] = mask; return 0; } @@ -362,20 +364,20 @@ parse_async_tlv(const struct ofpbuf *property, } if (ofpprop_is_experimenter(ap->prop_type)) { - /* For experimenter properties, whether a property is for the master or - * slave role is indicated by both 'type' and 'exp_type' in struct + /* For experimenter properties, whether a property is for the primary or + * secondary role is indicated by both 'type' and 'exp_type' in struct * ofp_prop_experimenter. Check that these are consistent. */ const struct ofp_prop_experimenter *ope = property->data; - bool should_be_master = ope->type == htons(0xffff); - if (should_be_master != ap->master) { + bool should_be_primary = ope->type == htons(0xffff); + if (should_be_primary != ap->primary) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); VLOG_WARN_RL(&rl, "async property type %#"PRIx16" " "indicates %s role but exp_type %"PRIu32" indicates " "%s role", ntohs(ope->type), - should_be_master ? "master" : "slave", + should_be_primary ? "primary" : "secondary", ntohl(ope->exp_type), - ap->master ? "master" : "slave"); + ap->primary ? "primary" : "secondary"); return OFPERR_OFPBPC_BAD_EXP_TYPE; } } @@ -390,9 +392,9 @@ decode_legacy_async_masks(const ovs_be32 masks[2], struct ofputil_async_cfg *dst) { for (int i = 0; i < 2; i++) { - bool master = i == 0; + bool primary = i == 0; const struct ofp14_async_prop *ap - = get_ofp14_async_config_prop_by_oam(oam, master); + = get_ofp14_async_config_prop_by_oam(oam, primary); decode_async_mask(masks[i], ap, version, true, dst); } } @@ -479,9 +481,9 @@ encode_legacy_async_masks(const struct ofputil_async_cfg *ac, ovs_be32 masks[2]) { for (int i = 0; i < 2; i++) { - bool master = i == 0; + bool primary = i == 0; const struct ofp14_async_prop *ap - = get_ofp14_async_config_prop_by_oam(oam, master); + = get_ofp14_async_config_prop_by_oam(oam, primary); masks[i] = encode_async_mask(ac, ap, version); } } @@ -507,11 +509,11 @@ ofputil_put_async_config__(const struct ofputil_async_cfg *ac, encode_async_mask(ac, ap, version)); /* For experimenter properties, we need to use type 0xfffe for - * master and 0xffff for slaves. */ + * primary and 0xffff for secondaries. */ if (ofpprop_is_experimenter(ap->prop_type)) { struct ofp_prop_experimenter *ope = ofpbuf_at_assert(buf, ofs, sizeof *ope); - ope->type = ap->master ? htons(0xffff) : htons(0xfffe); + ope->type = ap->primary ? htons(0xffff) : htons(0xfffe); } } } @@ -592,8 +594,8 @@ ofp_role_reason_to_string(enum ofp14_controller_role_reason reason, char *reasonbuf, size_t bufsize) { switch (reason) { - case OFPCRR_MASTER_REQUEST: - return "master_request"; + case OFPCRR_PRIMARY_REQUEST: + return "primary_request"; case OFPCRR_CONFIG: return "configuration_changed"; @@ -664,12 +666,12 @@ ofputil_format_set_async_config(struct ds *string, const struct ofputil_async_cfg *ac) { for (int i = 0; i < 2; i++) { - ds_put_format(string, "\n %s:\n", i == 0 ? "master" : "slave"); + ds_put_format(string, "\n %s:\n", i == 0 ? "primary" : "secondary"); for (uint32_t type = 0; type < OAM_N_TYPES; type++) { ds_put_format(string, "%16s:", ofputil_async_msg_type_to_string(type)); - uint32_t role = i == 0 ? ac->master[type] : ac->slave[type]; + uint32_t role = i == 0 ? ac->primary[type] : ac->secondary[type]; for (int j = 0; j < 32; j++) { if (role & (1u << j)) { char reasonbuf[INT_STRLEN(int) + 1]; @@ -705,17 +707,17 @@ ofputil_async_cfg_default(enum ofp_version version) } struct ofputil_async_cfg oac = { - .master[OAM_PACKET_IN] = pin, - .master[OAM_PORT_STATUS] = OFPPR_BITS, - .slave[OAM_PORT_STATUS] = OFPPR_BITS + .primary[OAM_PACKET_IN] = pin, + .primary[OAM_PORT_STATUS] = OFPPR_BITS, + .secondary[OAM_PORT_STATUS] = OFPPR_BITS }; if (version >= OFP14_VERSION) { - oac.master[OAM_FLOW_REMOVED] = OFPRR14_BITS; + oac.primary[OAM_FLOW_REMOVED] = OFPRR14_BITS; } else if (version == OFP13_VERSION) { - oac.master[OAM_FLOW_REMOVED] = OFPRR13_BITS; + oac.primary[OAM_FLOW_REMOVED] = OFPRR13_BITS; } else { - oac.master[OAM_FLOW_REMOVED] = OFPRR10_BITS; + oac.primary[OAM_FLOW_REMOVED] = OFPRR10_BITS; } return oac; diff --git a/manpages.mk b/manpages.mk index dc201484c637..54a3a82ad963 100644 --- a/manpages.mk +++ b/manpages.mk @@ -104,7 +104,6 @@ utilities/bugtool/ovs-bugtool.8: \ utilities/bugtool/ovs-bugtool.8.in: lib/ovs.tmac: - utilities/ovs-dpctl-top.8: \ utilities/ovs-dpctl-top.8.in \ lib/ovs.tmac @@ -155,8 +154,6 @@ lib/common-syn.man: lib/common.man: lib/ovs.tmac: -lib/ovs.tmac: - utilities/ovs-testcontroller.8: \ utilities/ovs-testcontroller.8.in \ lib/common.man \ diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c index 51d656cba960..f3cf01fa5ef3 100644 --- a/ofproto/connmgr.c +++ b/ofproto/connmgr.c @@ -212,9 +212,9 @@ struct connmgr { * traversals from other threads can be made safe by holding the * ofproto_mutex.*/ struct ovs_list conns; /* All ofconns. */ - uint64_t master_election_id; /* monotonically increasing sequence number - * for master election */ - bool master_election_id_defined; + uint64_t primary_election_id; /* monotonically increasing sequence number + * for primary election */ + bool primary_election_id_defined; /* OpenFlow connection establishment. */ struct hmap services; /* Contains "struct ofservice"s. */ @@ -253,8 +253,8 @@ connmgr_create(struct ofproto *ofproto, mgr->local_port_name = xstrdup(local_port_name); ovs_list_init(&mgr->conns); - mgr->master_election_id = 0; - mgr->master_election_id_defined = false; + mgr->primary_election_id = 0; + mgr->primary_election_id_defined = false; hmap_init(&mgr->services); mgr->snoops = NULL; @@ -765,11 +765,11 @@ snoop_preference(const struct ofservice *ofservice) } switch (ofconn->role) { - case OFPCR12_ROLE_MASTER: + case OFPCR12_ROLE_PRIMARY: return 3; case OFPCR12_ROLE_EQUAL: return 2; - case OFPCR12_ROLE_SLAVE: + case OFPCR12_ROLE_SECONDARY: return 1; case OFPCR12_ROLE_NOCHANGE: default: @@ -810,33 +810,33 @@ ofconn_get_type(const struct ofconn *ofconn) return ofconn->type; } -/* If a master election id is defined, stores it into '*idp' and returns +/* If a primary election id is defined, stores it into '*idp' and returns * true. Otherwise, stores UINT64_MAX into '*idp' and returns false. */ bool -ofconn_get_master_election_id(const struct ofconn *ofconn, uint64_t *idp) +ofconn_get_primary_election_id(const struct ofconn *ofconn, uint64_t *idp) { - *idp = (ofconn->connmgr->master_election_id_defined - ? ofconn->connmgr->master_election_id + *idp = (ofconn->connmgr->primary_election_id_defined + ? ofconn->connmgr->primary_election_id : UINT64_MAX); - return ofconn->connmgr->master_election_id_defined; + return ofconn->connmgr->primary_election_id_defined; } -/* Sets the master election id. +/* Sets the primary election id. * * Returns true if successful, false if the id is stale */ bool -ofconn_set_master_election_id(struct ofconn *ofconn, uint64_t id) +ofconn_set_primary_election_id(struct ofconn *ofconn, uint64_t id) { - if (ofconn->connmgr->master_election_id_defined + if (ofconn->connmgr->primary_election_id_defined && /* Unsigned difference interpreted as a two's complement signed * value */ - (int64_t)(id - ofconn->connmgr->master_election_id) < 0) { + (int64_t)(id - ofconn->connmgr->primary_election_id) < 0) { return false; } - ofconn->connmgr->master_election_id = id; - ofconn->connmgr->master_election_id_defined = true; + ofconn->connmgr->primary_election_id = id; + ofconn->connmgr->primary_election_id_defined = true; return true; } @@ -856,7 +856,7 @@ ofconn_send_role_status(struct ofconn *ofconn, uint32_t role, uint8_t reason) struct ofputil_role_status status; status.reason = reason; status.role = role; - ofconn_get_master_election_id(ofconn, &status.generation_id); + ofconn_get_primary_election_id(ofconn, &status.generation_id); struct ofpbuf *buf = ofputil_encode_role_status(&status, ofconn_get_protocol(ofconn)); @@ -865,19 +865,19 @@ ofconn_send_role_status(struct ofconn *ofconn, uint32_t role, uint8_t reason) } } -/* Changes 'ofconn''s role to 'role'. If 'role' is OFPCR12_ROLE_MASTER then - * any existing master is demoted to a slave. */ +/* Changes 'ofconn''s role to 'role'. If 'role' is OFPCR12_ROLE_PRIMARY then + * any existing primary is demoted to a secondary. */ void ofconn_set_role(struct ofconn *ofconn, enum ofp12_controller_role role) { - if (role != ofconn->role && role == OFPCR12_ROLE_MASTER) { + if (role != ofconn->role && role == OFPCR12_ROLE_PRIMARY) { struct ofconn *other; LIST_FOR_EACH (other, connmgr_node, &ofconn->connmgr->conns) { - if (other->role == OFPCR12_ROLE_MASTER) { - other->role = OFPCR12_ROLE_SLAVE; - ofconn_send_role_status(other, OFPCR12_ROLE_SLAVE, - OFPCRR_MASTER_REQUEST); + if (other->role == OFPCR12_ROLE_PRIMARY) { + other->role = OFPCR12_ROLE_SECONDARY; + ofconn_send_role_status(other, OFPCR12_ROLE_SECONDARY, + OFPCRR_PRIMARY_REQUEST); } } } @@ -890,9 +890,9 @@ ofconn_set_invalid_ttl_to_controller(struct ofconn *ofconn, bool enable) struct ofputil_async_cfg ac = ofconn_get_async_config(ofconn); uint32_t bit = 1u << OFPR_INVALID_TTL; if (enable) { - ac.master[OAM_PACKET_IN] |= bit; + ac.primary[OAM_PACKET_IN] |= bit; } else { - ac.master[OAM_PACKET_IN] &= ~bit; + ac.primary[OAM_PACKET_IN] &= ~bit; } ofconn_set_async_config(ofconn, &ac); } @@ -902,7 +902,7 @@ ofconn_get_invalid_ttl_to_controller(struct ofconn *ofconn) { struct ofputil_async_cfg ac = ofconn_get_async_config(ofconn); uint32_t bit = 1u << OFPR_INVALID_TTL; - return (ac.master[OAM_PACKET_IN] & bit) != 0; + return (ac.primary[OAM_PACKET_IN] & bit) != 0; } /* Returns the currently configured protocol for 'ofconn', one of OFPUTIL_P_*. @@ -994,11 +994,11 @@ ofconn_set_async_config(struct ofconn *ofconn, if (ofputil_protocol_to_ofp_version(ofconn_get_protocol(ofconn)) < OFP14_VERSION) { - if (ofconn->async_cfg->master[OAM_PACKET_IN] & (1u << OFPR_ACTION)) { - ofconn->async_cfg->master[OAM_PACKET_IN] |= OFPR14_ACTION_BITS; + if (ofconn->async_cfg->primary[OAM_PACKET_IN] & (1u << OFPR_ACTION)) { + ofconn->async_cfg->primary[OAM_PACKET_IN] |= OFPR14_ACTION_BITS; } - if (ofconn->async_cfg->slave[OAM_PACKET_IN] & (1u << OFPR_ACTION)) { - ofconn->async_cfg->slave[OAM_PACKET_IN] |= OFPR14_ACTION_BITS; + if (ofconn->async_cfg->secondary[OAM_PACKET_IN] & (1u << OFPR_ACTION)) { + ofconn->async_cfg->secondary[OAM_PACKET_IN] |= OFPR14_ACTION_BITS; } } } @@ -1433,9 +1433,9 @@ ofconn_receives_async_msg(const struct ofconn *ofconn, } struct ofputil_async_cfg ac = ofconn_get_async_config(ofconn); - uint32_t *masks = (ofconn->role == OFPCR12_ROLE_SLAVE - ? ac.slave - : ac.master); + uint32_t *masks = (ofconn->role == OFPCR12_ROLE_SECONDARY + ? ac.secondary + : ac.primary); return (masks[type] & (1u << reason)) != 0; } diff --git a/ofproto/connmgr.h b/ofproto/connmgr.h index 079c8437c3ef..e299386c7a2e 100644 --- a/ofproto/connmgr.h +++ b/ofproto/connmgr.h @@ -84,8 +84,8 @@ void connmgr_get_snoops(const struct connmgr *, struct sset *snoops); /* Individual connections to OpenFlow controllers. */ enum ofconn_type ofconn_get_type(const struct ofconn *); -bool ofconn_get_master_election_id(const struct ofconn *, uint64_t *idp); -bool ofconn_set_master_election_id(struct ofconn *, uint64_t); +bool ofconn_get_primary_election_id(const struct ofconn *, uint64_t *idp); +bool ofconn_set_primary_election_id(struct ofconn *, uint64_t); enum ofp12_controller_role ofconn_get_role(const struct ofconn *); void ofconn_set_role(struct ofconn *, enum ofp12_controller_role); diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index c1ddce80e7c0..9b124d6bb8c8 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -3471,7 +3471,7 @@ handle_set_config(struct ofconn *ofconn, const struct ofp_header *oh) } if (ofconn_get_type(ofconn) != OFCONN_PRIMARY - || ofconn_get_role(ofconn) != OFPCR12_ROLE_SLAVE) { + || ofconn_get_role(ofconn) != OFPCR12_ROLE_SECONDARY) { enum ofputil_frag_handling cur = ofproto->frag_handling; enum ofputil_frag_handling next = config.frag; @@ -3496,16 +3496,16 @@ handle_set_config(struct ofconn *ofconn, const struct ofp_header *oh) return 0; } -/* Checks whether 'ofconn' is a slave controller. If so, returns an OpenFlow - * error message code for the caller to propagate upward. Otherwise, returns - * 0. +/* Checks whether 'ofconn' is a secondary controller. If so, returns an + * OpenFlow error message code for the caller to propagate upward. Otherwise, + * returns 0. * * The log message mentions 'msg_type'. */ static enum ofperr -reject_slave_controller(struct ofconn *ofconn) +reject_secondary_controller(struct ofconn *ofconn) { - if (ofconn_get_role(ofconn) == OFPCR12_ROLE_SLAVE) { - return OFPERR_OFPBRC_IS_SLAVE; + if (ofconn_get_role(ofconn) == OFPCR12_ROLE_SECONDARY) { + return OFPERR_OFPBRC_IS_SECONDARY; } else { return 0; } @@ -3686,7 +3686,7 @@ handle_packet_out(struct ofconn *ofconn, const struct ofp_header *oh) COVERAGE_INC(ofproto_packet_out); - error = reject_slave_controller(ofconn); + error = reject_secondary_controller(ofconn); if (error) { return error; } @@ -3808,7 +3808,7 @@ handle_port_mod(struct ofconn *ofconn, const struct ofp_header *oh) struct ofport *port; enum ofperr error; - error = reject_slave_controller(ofconn); + error = reject_secondary_controller(ofconn); if (error) { return error; } @@ -6174,7 +6174,7 @@ handle_flow_mod(struct ofconn *ofconn, const struct ofp_header *oh) struct ofpbuf ofpacts; enum ofperr error; - error = reject_slave_controller(ofconn); + error = reject_secondary_controller(ofconn); if (error) { return error; } @@ -6237,7 +6237,7 @@ handle_role_request(struct ofconn *ofconn, const struct ofp_header *oh) if (request.role != OFPCR12_ROLE_NOCHANGE) { if (request.role != OFPCR12_ROLE_EQUAL && request.have_generation_id - && !ofconn_set_master_election_id(ofconn, request.generation_id)) { + && !ofconn_set_primary_election_id(ofconn, request.generation_id)) { return OFPERR_OFPRRFC_STALE; } @@ -6245,7 +6245,7 @@ handle_role_request(struct ofconn *ofconn, const struct ofp_header *oh) } reply.role = ofconn_get_role(ofconn); - reply.have_generation_id = ofconn_get_master_election_id( + reply.have_generation_id = ofconn_get_primary_election_id( ofconn, &reply.generation_id); buf = ofputil_encode_role_reply(oh, &reply); ofconn_send_reply(ofconn, buf); @@ -6865,7 +6865,7 @@ handle_meter_mod(struct ofconn *ofconn, const struct ofp_header *oh) uint32_t meter_id; enum ofperr error; - error = reject_slave_controller(ofconn); + error = reject_secondary_controller(ofconn); if (error) { return error; } @@ -7801,7 +7801,7 @@ handle_group_mod(struct ofconn *ofconn, const struct ofp_header *oh) struct ofproto_group_mod ogm; enum ofperr error; - error = reject_slave_controller(ofconn); + error = reject_secondary_controller(ofconn); if (error) { return error; } @@ -7922,7 +7922,7 @@ handle_table_mod(struct ofconn *ofconn, const struct ofp_header *oh) struct ofputil_table_mod tm; enum ofperr error; - error = reject_slave_controller(ofconn); + error = reject_secondary_controller(ofconn); if (error) { return error; } @@ -8295,7 +8295,7 @@ handle_bundle_control(struct ofconn *ofconn, const struct ofp_header *oh) struct ofpbuf *buf; enum ofperr error; - error = reject_slave_controller(ofconn); + error = reject_secondary_controller(ofconn); if (error) { return error; } @@ -8349,7 +8349,7 @@ handle_bundle_add(struct ofconn *ofconn, const struct ofp_header *oh) struct ofputil_bundle_add_msg badd; enum ofptype type; - error = reject_slave_controller(ofconn); + error = reject_secondary_controller(ofconn); if (error) { return error; } @@ -8427,7 +8427,7 @@ handle_tlv_table_mod(struct ofconn *ofconn, const struct ofp_header *oh) struct ofputil_tlv_table_mod ttm; enum ofperr error; - error = reject_slave_controller(ofconn); + error = reject_secondary_controller(ofconn); if (error) { return error; } diff --git a/tests/ofp-print.at b/tests/ofp-print.at index dd6410b11902..2c7e163bd602 100644 --- a/tests/ofp-print.at +++ b/tests/ofp-print.at @@ -2816,7 +2816,8 @@ AT_CLEANUP AT_SETUP([OFPT_SET_ASYNC - OF1.3]) AT_KEYWORDS([ofp-print]) -dnl This message has bit 12 set for the PACKET_IN messages (master and slave). +dnl This message has bit 12 set for the PACKET_IN messages (primary and +dnl secondary). dnl Those aren't supported bits so they get silently ignored on decoding. dnl That seems reasonable because OF1.3 doesn't define any error codes for dnl OFPT_SET_ASYNC. @@ -2825,7 +2826,7 @@ AT_CHECK([ovs-ofctl ofp-print "\ 00 00 00 03 00 00 00 07 00 00 00 00 00 00 00 03 \ "], [0], [dnl OFPT_SET_ASYNC (OF1.3) (xid=0x0): - master: + primary: PACKET_IN: no_match invalid_ttl PORT_STATUS: add delete FLOW_REMOVED: (off) @@ -2833,7 +2834,7 @@ OFPT_SET_ASYNC (OF1.3) (xid=0x0): TABLE_STATUS: (off) REQUESTFORWARD: (off) - slave: + secondary: PACKET_IN: no_match action invalid_ttl PORT_STATUS: add delete modify FLOW_REMOVED: idle hard @@ -2849,7 +2850,7 @@ AT_CHECK([ovs-ofctl ofp-print "\ 03 18 00 18 00 00 00 02 00 00 00 02 00 00 00 00 \ 00 00 00 00 00 00 00 03 \ "], [0], [dnl -OFPT_ROLE_REQUEST (OF1.2) (xid=0x2): role=master generation_id=3 +OFPT_ROLE_REQUEST (OF1.2) (xid=0x2): role=primary generation_id=3 ]) AT_CLEANUP @@ -2869,7 +2870,7 @@ AT_CHECK([ovs-ofctl ofp-print "\ 01 04 00 14 00 00 00 02 00 00 23 20 00 00 00 0a \ 00 00 00 01 \ "], [0], [dnl -NXT_ROLE_REQUEST (xid=0x2): role=master +NXT_ROLE_REQUEST (xid=0x2): role=primary ]) AT_CLEANUP @@ -2879,7 +2880,7 @@ AT_CHECK([ovs-ofctl ofp-print "\ 03 19 00 18 00 00 00 02 00 00 00 03 00 00 00 00 \ 12 34 56 78 ab cd ef 90 \ "], [0], [dnl -OFPT_ROLE_REPLY (OF1.2) (xid=0x2): role=slave generation_id=1311768467750121360 +OFPT_ROLE_REPLY (OF1.2) (xid=0x2): role=secondary generation_id=1311768467750121360 ]) AT_CLEANUP @@ -2889,67 +2890,67 @@ AT_CHECK([ovs-ofctl ofp-print "\ 01 04 00 14 00 00 00 02 00 00 23 20 00 00 00 0b \ 00 00 00 02 \ "], [0], [dnl -NXT_ROLE_REPLY (xid=0x2): role=slave +NXT_ROLE_REPLY (xid=0x2): role=secondary ]) AT_CLEANUP -AT_SETUP([OFP_ROLE_STATUS - master, experimenter - OF1.3]) +AT_SETUP([OFP_ROLE_STATUS - primary, experimenter - OF1.3]) AT_KEYWORDS([ofp-print]) AT_CHECK([ovs-ofctl ofp-print "\ 04 04 00 20 00 00 00 0a 4f 4e 46 00 00 00 07 77 \ 00 00 00 02 02 00 00 00 ff ff ff ff ff ff ff ff \ "], [0], [dnl -ONFT_ROLE_STATUS (OF1.3) (xid=0xa): role=master reason=experimenter_data_changed +ONFT_ROLE_STATUS (OF1.3) (xid=0xa): role=primary reason=experimenter_data_changed ]) AT_CLEANUP -AT_SETUP([OFP_ROLE_STATUS - master, config - OF1.3]) +AT_SETUP([OFP_ROLE_STATUS - primary, config - OF1.3]) AT_KEYWORDS([ofp-print]) AT_CHECK([ovs-ofctl ofp-print "\ 04 04 00 20 00 00 00 0a 4f 4e 46 00 00 00 07 77 \ 00 00 00 02 01 00 00 00 ff ff ff ff ff ff ff ff \ "], [0], [dnl -ONFT_ROLE_STATUS (OF1.3) (xid=0xa): role=master reason=configuration_changed +ONFT_ROLE_STATUS (OF1.3) (xid=0xa): role=primary reason=configuration_changed ]) AT_CLEANUP -AT_SETUP([OFP_ROLE_STATUS - master, config,generation - OF1.3]) +AT_SETUP([OFP_ROLE_STATUS - primary, config,generation - OF1.3]) AT_KEYWORDS([ofp-print]) AT_CHECK([ovs-ofctl ofp-print "\ 04 04 00 20 00 00 00 0a 4f 4e 46 00 00 00 07 77 \ 00 00 00 02 01 00 00 00 00 00 00 00 00 00 00 10 \ "], [0], [dnl -ONFT_ROLE_STATUS (OF1.3) (xid=0xa): role=master generation_id=16 reason=configuration_changed +ONFT_ROLE_STATUS (OF1.3) (xid=0xa): role=primary generation_id=16 reason=configuration_changed ]) AT_CLEANUP -AT_SETUP([OFP_ROLE_STATUS - master, experimenter - OF1.4]) +AT_SETUP([OFP_ROLE_STATUS - primary, experimenter - OF1.4]) AT_KEYWORDS([ofp-print]) AT_CHECK([ovs-ofctl ofp-print "\ 05 1e 00 18 00 00 00 0a \ 00 00 00 02 02 00 00 00 ff ff ff ff ff ff ff ff \ "], [0], [dnl -OFPT_ROLE_STATUS (OF1.4) (xid=0xa): role=master reason=experimenter_data_changed +OFPT_ROLE_STATUS (OF1.4) (xid=0xa): role=primary reason=experimenter_data_changed ]) AT_CLEANUP -AT_SETUP([OFP_ROLE_STATUS - master, config - OF1.4]) +AT_SETUP([OFP_ROLE_STATUS - primary, config - OF1.4]) AT_KEYWORDS([ofp-print]) AT_CHECK([ovs-ofctl ofp-print "\ 05 1e 00 18 00 00 00 0a \ 00 00 00 02 01 00 00 00 ff ff ff ff ff ff ff ff \ "], [0], [dnl -OFPT_ROLE_STATUS (OF1.4) (xid=0xa): role=master reason=configuration_changed +OFPT_ROLE_STATUS (OF1.4) (xid=0xa): role=primary reason=configuration_changed ]) AT_CLEANUP -AT_SETUP([OFP_ROLE_STATUS - master, config,generation - OF1.4]) +AT_SETUP([OFP_ROLE_STATUS - primary, config,generation - OF1.4]) AT_KEYWORDS([ofp-print]) AT_CHECK([ovs-ofctl ofp-print "\ 05 1e 00 18 00 00 00 0a \ 00 00 00 02 01 00 00 00 00 00 00 00 00 00 00 10 \ "], [0], [dnl -OFPT_ROLE_STATUS (OF1.4) (xid=0xa): role=master generation_id=16 reason=configuration_changed +OFPT_ROLE_STATUS (OF1.4) (xid=0xa): role=primary generation_id=16 reason=configuration_changed ]) AT_CLEANUP @@ -3156,7 +3157,7 @@ AT_CLEANUP AT_SETUP([NXT_SET_ASYNC_CONFIG]) AT_KEYWORDS([ofp-print]) -dnl This message has bit 12 set for the PACKET_IN messages (master and slave). +dnl This message has bit 12 set for the PACKET_IN messages (primary and secondary). dnl Those aren't supported bits so they get silently ignored on decoding. AT_CHECK([ovs-ofctl ofp-print "\ 01 04 00 28 00 00 00 00 00 00 23 20 00 00 00 13 \ @@ -3164,7 +3165,7 @@ AT_CHECK([ovs-ofctl ofp-print "\ 00 00 00 00 00 00 00 03 \ "], [0], [dnl NXT_SET_ASYNC_CONFIG (xid=0x0): - master: + primary: PACKET_IN: no_match invalid_ttl PORT_STATUS: add delete FLOW_REMOVED: (off) @@ -3172,7 +3173,7 @@ NXT_SET_ASYNC_CONFIG (xid=0x0): TABLE_STATUS: (off) REQUESTFORWARD: (off) - slave: + secondary: PACKET_IN: no_match action invalid_ttl PORT_STATUS: add delete modify FLOW_REMOVED: idle hard @@ -3191,7 +3192,7 @@ AT_CHECK([ovs-ofctl ofp-print "\ 00 05 00 08 00 00 00 05 \ "], [0], [dnl OFPT_SET_ASYNC (OF1.4) (xid=0x2): - master: + primary: PACKET_IN: action PORT_STATUS: add modify FLOW_REMOVED: idle delete @@ -3199,7 +3200,7 @@ OFPT_SET_ASYNC (OF1.4) (xid=0x2): TABLE_STATUS: (off) REQUESTFORWARD: (off) - slave: + secondary: PACKET_IN: no_match invalid_ttl PORT_STATUS: delete FLOW_REMOVED: delete group_delete meter_delete diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at index 8ffd4f583830..17d2422224ea 100644 --- a/tests/ofproto-dpif.at +++ b/tests/ofproto-dpif.at @@ -3174,13 +3174,13 @@ AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=outp dnl Singleton controller action. AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log]) -# Become slave (OF 1.3), which should disable everything except port status. +# Become secondary (OF 1.3), which should disable everything except port status. ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001 # Ensure that ovs-vswitchd gets a chance to reply before sending another command. ovs-appctl time/warp 500 100 -# Use OF 1.3 OFPT_SET_ASYNC to enable OFPR_NO_MATCH for slave only. +# Use OF 1.3 OFPT_SET_ASYNC to enable OFPR_NO_MATCH for secondary only. ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000000000000100000000000000000000000000000000 ovs-appctl time/warp 500 100 @@ -3192,11 +3192,11 @@ OVS_APP_EXIT_AND_WAIT([ovs-ofctl]) AT_CHECK([ovs-appctl revalidator/purge], [0]) AT_CHECK([cat ofctl_monitor.log], [0], [dnl -send: OFPT_ROLE_REQUEST (OF1.3) (xid=0x2): role=slave generation_id=1 -OFPT_ROLE_REPLY (OF1.3) (xid=0x2): role=slave generation_id=1 +send: OFPT_ROLE_REQUEST (OF1.3) (xid=0x2): role=secondary generation_id=1 +OFPT_ROLE_REPLY (OF1.3) (xid=0x2): role=secondary generation_id=1 dnl send: OFPT_SET_ASYNC (OF1.3) (xid=0x2): - master: + primary: PACKET_IN: (off) PORT_STATUS: (off) FLOW_REMOVED: (off) @@ -3204,7 +3204,7 @@ send: OFPT_SET_ASYNC (OF1.3) (xid=0x2): TABLE_STATUS: (off) REQUESTFORWARD: (off) - slave: + secondary: PACKET_IN: no_match PORT_STATUS: (off) FLOW_REMOVED: (off) diff --git a/tests/ofproto.at b/tests/ofproto.at index 4aba60ae1ff4..a04a415b00f7 100644 --- a/tests/ofproto.at +++ b/tests/ofproto.at @@ -3157,7 +3157,7 @@ check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE -# Become slave, which should disable everything except port status. +# Become secondary, which should disable everything except port status. ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002 check_async 4 OFPPR_ADD OFPPR_DELETE @@ -3172,7 +3172,7 @@ check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE # Restore controller ID 0. ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000 -# Become master. +# Become primary. ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001 check_async 7 OFPR_ACTION OFPPR_ADD @@ -3264,7 +3264,7 @@ check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080 check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE -# Become slave (OF 1.2), which should disable everything except port status. +# Become secondary (OF 1.2), which should disable everything except port status. ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001 check_async 4 OFPPR_ADD OFPPR_DELETE @@ -3279,7 +3279,7 @@ check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE # Restore controller ID 0. ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000 -# Become master (OF 1.2). +# Become primary (OF 1.2). ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002 check_async 7 OFPR_ACTION OFPPR_ADD @@ -3383,7 +3383,7 @@ check_async 1 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080 check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE -# Become slave (OF 1.3), which should disable everything except port status. +# Become secondary (OF 1.3), which should disable everything except port status. ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001 check_async 3 OFPPR_ADD OFPPR_DELETE @@ -3398,7 +3398,7 @@ check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE # Restore controller ID 0. ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000 -# Become master (OF 1.3). +# Become primary (OF 1.3). ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002 check_async 6 OFPR_ACTION OFPPR_ADD @@ -3615,7 +3615,7 @@ check_async 1 ovs_appctl -t ovs-ofctl ofctl/send 0509000c0123456700000080 check_async 2 OFPR_PACKET_OUT OFPR_ACTION_SET OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE -# Become slave (OF 1.4), which should disable everything except port status. +# Become secondary (OF 1.4), which should disable everything except port status. ovs_appctl -t ovs-ofctl ofctl/send 051800180000000200000003000000000000000000000001 check_async 3 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE @@ -3630,7 +3630,7 @@ check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE # Restore controller ID 0. ovs_appctl -t ovs-ofctl ofctl/send 050400180000000300002320000000140000000000000000 -# Become master (OF 1.4). +# Become primary (OF 1.4). ovs_appctl -t ovs-ofctl ofctl/send 051800180000000400000002000000000000000000000002 check_async 6 OFPR_PACKET_OUT OFPPR_ADD OFPPR_MODIFY OFPRR_DELETE @@ -3740,27 +3740,27 @@ for i in 1 2; do echo >>expout$i "OFPT_ROLE_REPLY (OF1.2): role=equal" done -# controller 1: Become slave (generation_id is initially undefined, so +# controller 1: Become secondary (generation_id is initially undefined, so # 2^63+2 should not be stale) ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000300000003000000008000000000000002 -echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=slave generation_id=9223372036854775810" -echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=slave generation_id=9223372036854775810" +echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=secondary generation_id=9223372036854775810" +echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=secondary generation_id=9223372036854775810" -# controller 2: Become master. +# controller 2: Become primary. ovs-appctl -t `pwd`/c2 ofctl/send 031800180000000300000002000000008000000000000003 -echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=9223372036854775811" -echo >>expout2 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=9223372036854775811" +echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.2): role=primary generation_id=9223372036854775811" +echo >>expout2 "OFPT_ROLE_REPLY (OF1.2): role=primary generation_id=9223372036854775811" -# controller 1: Try to become the master using a stale generation ID +# controller 1: Try to become the primary using a stale generation ID ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000400000002000000000000000000000003 -echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3" +echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=primary generation_id=3" echo >>expout1 "OFPT_ERROR (OF1.2): OFPRRFC_STALE" -echo >>expout1 "OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3" +echo >>expout1 "OFPT_ROLE_REQUEST (OF1.2): role=primary generation_id=3" -# controller 1: Become master using a valid generation ID +# controller 1: Become primary using a valid generation ID ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000500000002000000000000000000000001 -echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=1" -echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=1" +echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=primary generation_id=1" +echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=primary generation_id=1" for i in 1 2; do ovs-appctl -t `pwd`/c$i ofctl/barrier @@ -3779,8 +3779,8 @@ AT_CLEANUP dnl This test checks that the role request/response messaging works, dnl that generation_id is handled properly, and that role status update -dnl messages are sent when a controller's role gets changed from master -dnl to slave. +dnl messages are sent when a controller's role gets changed from primary +dnl to secondary. AT_SETUP([ofproto - controller role (OpenFlow 1.4)]) OVS_VSWITCHD_START on_exit 'kill `cat c1.pid c2.pid`' @@ -3805,28 +3805,28 @@ for i in 1 2; do echo >>expout$i "OFPT_ROLE_REPLY (OF1.4): role=equal" done -# controller 1: Become slave (generation_id is initially undefined, so +# controller 1: Become secondary (generation_id is initially undefined, so # 2^63+2 should not be stale) ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000300000003000000008000000000000002 -echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=slave generation_id=9223372036854775810" -echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=slave generation_id=9223372036854775810" +echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=secondary generation_id=9223372036854775810" +echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=secondary generation_id=9223372036854775810" -# controller 2: Become master. +# controller 2: Become primary. ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003 -echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=9223372036854775811" -echo >>expout2 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=9223372036854775811" +echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.4): role=primary generation_id=9223372036854775811" +echo >>expout2 "OFPT_ROLE_REPLY (OF1.4): role=primary generation_id=9223372036854775811" -# controller 1: Try to become the master using a stale generation ID +# controller 1: Try to become the primary using a stale generation ID ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000400000002000000000000000000000003 -echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3" +echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=primary generation_id=3" echo >>expout1 "OFPT_ERROR (OF1.4): OFPRRFC_STALE" -echo >>expout1 "OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3" +echo >>expout1 "OFPT_ROLE_REQUEST (OF1.4): role=primary generation_id=3" -# controller 1: Become master using a valid generation ID +# controller 1: Become primary using a valid generation ID ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000500000002000000000000000000000001 -echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=1" -echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=1" -echo >>expout2 "OFPT_ROLE_STATUS (OF1.4): role=slave generation_id=1 reason=master_request" +echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=primary generation_id=1" +echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=primary generation_id=1" +echo >>expout2 "OFPT_ROLE_STATUS (OF1.4): role=secondary generation_id=1 reason=primary_request" for i in 1 2; do ovs-appctl -t `pwd`/c$i ofctl/barrier @@ -3845,8 +3845,8 @@ AT_CLEANUP dnl This test checks that the role request/response messaging works, dnl that generation_id is handled properly, and that role status update -dnl messages are sent when a controller's role gets changed from master -dnl to slave. +dnl messages are sent when a controller's role gets changed from primary +dnl to secondary. AT_SETUP([ofproto - controller role (OpenFlow 1.3)]) OVS_VSWITCHD_START on_exit 'kill `cat c1.pid c2.pid`' @@ -3871,28 +3871,28 @@ for i in 1 2; do echo >>expout$i "OFPT_ROLE_REPLY (OF1.3): role=equal" done -# controller 1: Become slave (generation_id is initially undefined, so +# controller 1: Become secondary (generation_id is initially undefined, so # 2^63+2 should not be stale) ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000300000003000000008000000000000002 -echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=slave generation_id=9223372036854775810" -echo >>expout1 "OFPT_ROLE_REPLY (OF1.3): role=slave generation_id=9223372036854775810" +echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=secondary generation_id=9223372036854775810" +echo >>expout1 "OFPT_ROLE_REPLY (OF1.3): role=secondary generation_id=9223372036854775810" -# controller 2: Become master. +# controller 2: Become primary. ovs-appctl -t `pwd`/c2 ofctl/send 041800180000000300000002000000008000000000000003 -echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.3): role=master generation_id=9223372036854775811" -echo >>expout2 "OFPT_ROLE_REPLY (OF1.3): role=master generation_id=9223372036854775811" +echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.3): role=primary generation_id=9223372036854775811" +echo >>expout2 "OFPT_ROLE_REPLY (OF1.3): role=primary generation_id=9223372036854775811" -# controller 1: Try to become the master using a stale generation ID +# controller 1: Try to become the primary using a stale generation ID ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000400000002000000000000000000000003 -echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=master generation_id=3" +echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=primary generation_id=3" echo >>expout1 "OFPT_ERROR (OF1.3): OFPRRFC_STALE" -echo >>expout1 "OFPT_ROLE_REQUEST (OF1.3): role=master generation_id=3" +echo >>expout1 "OFPT_ROLE_REQUEST (OF1.3): role=primary generation_id=3" -# controller 1: Become master using a valid generation ID +# controller 1: Become primary using a valid generation ID ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000500000002000000000000000000000001 -echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=master generation_id=1" -echo >>expout1 "OFPT_ROLE_REPLY (OF1.3): role=master generation_id=1" -echo >>expout2 "ONFT_ROLE_STATUS (OF1.3): role=slave generation_id=1 reason=master_request" +echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=primary generation_id=1" +echo >>expout1 "OFPT_ROLE_REPLY (OF1.3): role=primary generation_id=1" +echo >>expout2 "ONFT_ROLE_STATUS (OF1.3): role=secondary generation_id=1 reason=primary_request" for i in 1 2; do ovs-appctl -t `pwd`/c$i ofctl/barrier @@ -3978,13 +3978,13 @@ s/ (xid=0x[0-9a-fA-F]*)//'< monitor$i.log]], done } -# controller 1: Become slave +# controller 1: Become secondary ovs-appctl -t `pwd`/c1 ofctl/send 061800180000000300000003000000008000000000000002 -# controller 2: Become master +# controller 2: Become primary ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003 -# controller 1: Become slave +# controller 1: Become secondary ovs-appctl -t `pwd`/c3 ofctl/send 051800180000000300000003000000008000000000000004 # controller 1: Enabled requestforward using set Asynchronous message @@ -4074,16 +4074,16 @@ s/ (xid=0x[0-9a-fA-F]*)//'< monitor$i.log]], done } -# controller 1: Become slave -# NXT_ROLE_REQUEST (xid=0x3): role=slave +# controller 1: Become secondary +# NXT_ROLE_REQUEST (xid=0x3): role=secondary ovs-appctl -t `pwd`/c1 ofctl/send 0104001400000003000023200000000a00000002 -# controller 2: Become master -# NXT_ROLE_REQUEST (xid=0x3): role=master +# controller 2: Become primary +# NXT_ROLE_REQUEST (xid=0x3): role=primary ovs-appctl -t `pwd`/c2 ofctl/send 0104001400000003000023200000000a00000001 -# controller 1: Become slave -# NXT_ROLE_REQUEST (xid=0x3): role=slave +# controller 1: Become secondary +# NXT_ROLE_REQUEST (xid=0x3): role=secondary ovs-appctl -t `pwd`/c3 ofctl/send 0104001400000003000023200000000a00000002 # controller 1: Enabled requestforward using OFPRAW_NXT_SET_ASYNC_CONFIG2 @@ -4172,16 +4172,16 @@ s/ (xid=0x[0-9a-fA-F]*)//'< monitor$i.log]], done } -# controller 1: Become slave -# OFPT_ROLE_REQUEST (OF1.3) (xid=0x3): role=slave +# controller 1: Become secondary +# OFPT_ROLE_REQUEST (OF1.3) (xid=0x3): role=secondary ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000300000003000000008000000000000002 -# controller 2: Become master -# OFPT_ROLE_REQUEST (OF1.3) (xid=0x3): role=master +# controller 2: Become primary +# OFPT_ROLE_REQUEST (OF1.3) (xid=0x3): role=primary ovs-appctl -t `pwd`/c2 ofctl/send 041800180000000300000002000000008000000000000003 -# controller 1: Become slave -# OFPT_ROLE_REQUEST (OF1.3) (xid=0x3): role=slave +# controller 1: Become secondary +# OFPT_ROLE_REQUEST (OF1.3) (xid=0x3): role=secondary ovs-appctl -t `pwd`/c3 ofctl/send 041800180000000300000003000000008000000000000004 # controller 1: Enabled requestforward using OFPRAW_NXT_SET_ASYNC_CONFIG2 (necessary for OF1.3) @@ -4951,7 +4951,7 @@ EOF AT_CHECK([ofctl_strip < monitor.log], [], [dnl send: OFPT_GET_ASYNC_REQUEST (OF1.3): OFPT_GET_ASYNC_REPLY (OF1.3): - master: + primary: PACKET_IN: no_match action PORT_STATUS: add delete modify FLOW_REMOVED: idle hard delete group_delete @@ -4959,7 +4959,7 @@ OFPT_GET_ASYNC_REPLY (OF1.3): TABLE_STATUS: (off) REQUESTFORWARD: (off) - slave: + secondary: PACKET_IN: (off) PORT_STATUS: add delete modify FLOW_REMOVED: (off) diff --git a/utilities/ovs-ofctl.8.in b/utilities/ovs-ofctl.8.in index cb5c6120c829..2017c6eba071 100644 --- a/utilities/ovs-ofctl.8.in +++ b/utilities/ovs-ofctl.8.in @@ -562,12 +562,12 @@ between a switch and its controller. .IP When a switch has more than one controller configured, only the traffic to and from a single controller is output. If none of the -controllers is configured as a master or a slave (using a Nicira +controllers is configured as a primary or a secondary (using a Nicira extension to OpenFlow 1.0 or 1.1, or a standard request in OpenFlow 1.2 or later), then a controller is chosen arbitrarily among -them. If there is a master controller, it is chosen; otherwise, if -there are any controllers that are not masters or slaves, one is -chosen arbitrarily; otherwise, a slave controller is chosen +them. If there is a primary controller, it is chosen; otherwise, if +there are any controllers that are not primaries or secondaries, one is +chosen arbitrarily; otherwise, a secondary controller is chosen arbitrarily. This choice is made once at connection time and does not change as controllers reconfigure their roles. .IP diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index ba4ac00f7dec..6cbf5b76422a 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -3017,10 +3017,10 @@ ofp12_controller_role_to_str(enum ofp12_controller_role role) switch (role) { case OFPCR12_ROLE_EQUAL: return "other"; - case OFPCR12_ROLE_MASTER: - return "master"; - case OFPCR12_ROLE_SLAVE: - return "slave"; + case OFPCR12_ROLE_PRIMARY: + return "primary"; + case OFPCR12_ROLE_SECONDARY: + return "secondary"; case OFPCR12_ROLE_NOCHANGE: default: return NULL; diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index f84dc8fb8c18..ecb9a6b613ed 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -5263,16 +5263,21 @@ ovs-vsctl add-port br0 p0 -- set Interface p0 type=patch options:peer=p1 \
    other
    Allows the controller access to all OpenFlow features.
    master
    -
    Equivalent to other, except that there may be at - most one master controller at a time. When a controller configures - itself as master, any existing master is demoted to - the slave role.
    +
    + Equivalent to other, except that there may be at + most one such controller at a time. If a given controller + promotes itself to this role, ovs-vswitchd + demotes any existing controller with the role to slave. +
    +
    slave
    -
    Allows the controller read-only access to OpenFlow features. - Attempts to modify the flow table will be rejected with an - error. Slave controllers do not receive OFPT_PACKET_IN or - OFPT_FLOW_REMOVED messages, but they do receive OFPT_PORT_STATUS - messages.
    +
    + Allows the controller read-only access to OpenFlow features. + Attempts to modify the flow table will be rejected with an + error. Such controllers do not receive OFPT_PACKET_IN or + OFPT_FLOW_REMOVED messages, but they do receive OFPT_PORT_STATUS + messages. +
    From patchwork Mon Jul 6 20:35:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1323936 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4B0y4w3cQvz9sRK for ; Tue, 7 Jul 2020 06:35:44 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id E9CCD88B70; Mon, 6 Jul 2020 20:35:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uw-TyYaheG26; Mon, 6 Jul 2020 20:35:36 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id B74B888A81; Mon, 6 Jul 2020 20:35:36 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id A15D0C0891; Mon, 6 Jul 2020 20:35:36 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id A5901C016F for ; Mon, 6 Jul 2020 20:35:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id A22FE88A75 for ; Mon, 6 Jul 2020 20:35:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oYlAcnumlUAS for ; Mon, 6 Jul 2020 20:35:33 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by whitealder.osuosl.org (Postfix) with ESMTPS id 0F2D1887C6 for ; Mon, 6 Jul 2020 20:35:32 +0000 (UTC) Received: from sigfpe.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay11.mail.gandi.net (Postfix) with ESMTPSA id 75B74100004; Mon, 6 Jul 2020 20:35:30 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Mon, 6 Jul 2020 13:35:19 -0700 Message-Id: <20200706203521.719453-4-blp@ovn.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200706203521.719453-1-blp@ovn.org> References: <20200706203521.719453-1-blp@ovn.org> MIME-Version: 1.0 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH v2 3/5] conntrack: Rename "master" connection to "primary" connection. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Signed-off-by: Ben Pfaff --- include/openvswitch/meta-flow.h | 14 +++---- lib/conntrack-private.h | 10 ++--- lib/conntrack.c | 74 ++++++++++++++++----------------- lib/ct-dpif.c | 6 +-- lib/ct-dpif.h | 2 +- lib/meta-flow.xml | 2 +- lib/netlink-conntrack.c | 6 +-- tests/ofproto-dpif.at | 6 +-- tests/system-traffic.at | 6 +-- 9 files changed, 63 insertions(+), 63 deletions(-) diff --git a/include/openvswitch/meta-flow.h b/include/openvswitch/meta-flow.h index d529a9f0d21c..106b8b2d8c11 100644 --- a/include/openvswitch/meta-flow.h +++ b/include/openvswitch/meta-flow.h @@ -852,7 +852,7 @@ enum OVS_PACKED_ENUM mf_field_id { /* "ct_nw_proto". * * The "protocol" byte in the IPv4 or IPv6 header for the original - * direction conntrack tuple, or of the master conntrack entry, if the + * direction conntrack tuple, or of the primary conntrack entry, if the * current connection is a related connection. * * The value is initially zero and populated by the CT action. The value @@ -873,7 +873,7 @@ enum OVS_PACKED_ENUM mf_field_id { /* "ct_nw_src". * * IPv4 source address of the original direction tuple of the conntrack - * entry, or of the master conntrack entry, if the current connection is a + * entry, or of the primary conntrack entry, if the current connection is a * related connection. * * The value is populated by the CT action. @@ -892,7 +892,7 @@ enum OVS_PACKED_ENUM mf_field_id { /* "ct_nw_dst". * * IPv4 destination address of the original direction tuple of the - * conntrack entry, or of the master conntrack entry, if the current + * conntrack entry, or of the primary conntrack entry, if the current * connection is a related connection. * * The value is populated by the CT action. @@ -911,7 +911,7 @@ enum OVS_PACKED_ENUM mf_field_id { /* "ct_ipv6_src". * * IPv6 source address of the original direction tuple of the conntrack - * entry, or of the master conntrack entry, if the current connection is a + * entry, or of the primary conntrack entry, if the current connection is a * related connection. * * The value is populated by the CT action. @@ -930,7 +930,7 @@ enum OVS_PACKED_ENUM mf_field_id { /* "ct_ipv6_dst". * * IPv6 destination address of the original direction tuple of the - * conntrack entry, or of the master conntrack entry, if the current + * conntrack entry, or of the primary conntrack entry, if the current * connection is a related connection. * * The value is populated by the CT action. @@ -949,7 +949,7 @@ enum OVS_PACKED_ENUM mf_field_id { /* "ct_tp_src". * * Transport layer source port of the original direction tuple of the - * conntrack entry, or of the master conntrack entry, if the current + * conntrack entry, or of the primary conntrack entry, if the current * connection is a related connection. * * The value is populated by the CT action. @@ -967,7 +967,7 @@ enum OVS_PACKED_ENUM mf_field_id { /* "ct_tp_dst". * * Transport layer destination port of the original direction tuple of the - * conntrack entry, or of the master conntrack entry, if the current + * conntrack entry, or of the primary conntrack entry, if the current * connection is a related connection. * * The value is populated by the CT action. diff --git a/lib/conntrack-private.h b/lib/conntrack-private.h index 3434753016f0..0e26837d6601 100644 --- a/lib/conntrack-private.h +++ b/lib/conntrack-private.h @@ -71,13 +71,13 @@ struct alg_exp_node { /* Key of data connection to be created. */ struct conn_key key; /* Corresponding key of the control connection. */ - struct conn_key master_key; + struct conn_key primary_key; /* The NAT replacement address to be used by the data connection. */ union ct_addr alg_nat_repl_addr; - /* The data connection inherits the master control + /* The data connection inherits the primary control * connection label and mark. */ - ovs_u128 master_label; - uint32_t master_mark; + ovs_u128 primary_label; + uint32_t primary_mark; /* True if for NAT application, the alg replaces the dest address; * otherwise, the source address is replaced. */ bool nat_rpl_dst; @@ -92,7 +92,7 @@ struct conn { /* Immutable data. */ struct conn_key key; struct conn_key rev_key; - struct conn_key master_key; /* Only used for orig_tuple support. */ + struct conn_key primary_key; /* Only used for orig_tuple support. */ struct ovs_list exp_node; struct cmap_node cm_node; struct nat_action_info_t *nat_info; diff --git a/lib/conntrack.c b/lib/conntrack.c index f42ba4b601c7..a8a3787c44e7 100644 --- a/lib/conntrack.c +++ b/lib/conntrack.c @@ -144,7 +144,7 @@ detect_ftp_ctl_type(const struct conn_lookup_ctx *ctx, struct dp_packet *pkt); static void -expectation_clean(struct conntrack *ct, const struct conn_key *master_key); +expectation_clean(struct conntrack *ct, const struct conn_key *primary_key); static struct ct_l4_proto *l4_protos[] = { [IPPROTO_TCP] = &ct_proto_tcp, @@ -585,14 +585,14 @@ write_ct_md(struct dp_packet *pkt, uint16_t zone, const struct conn *conn, /* Use the original direction tuple if we have it. */ if (conn) { if (conn->alg_related) { - key = &conn->master_key; + key = &conn->primary_key; } else { key = &conn->key; } } else if (alg_exp) { - pkt->md.ct_mark = alg_exp->master_mark; - pkt->md.ct_label = alg_exp->master_label; - key = &alg_exp->master_key; + pkt->md.ct_mark = alg_exp->primary_mark; + pkt->md.ct_label = alg_exp->primary_label; + key = &alg_exp->primary_key; } pkt->md.ct_orig_tuple_ipv6 = false; @@ -1002,9 +1002,9 @@ conn_not_found(struct conntrack *ct, struct dp_packet *pkt, if (alg_exp) { nc->alg_related = true; - nc->mark = alg_exp->master_mark; - nc->label = alg_exp->master_label; - nc->master_key = alg_exp->master_key; + nc->mark = alg_exp->primary_mark; + nc->label = alg_exp->primary_label; + nc->primary_key = alg_exp->primary_key; } if (nat_action_info) { @@ -1312,7 +1312,7 @@ process_one(struct conntrack *ct, struct dp_packet *pkt, if (!conn) { pkt->md.ct_state |= CS_INVALID; write_ct_md(pkt, zone, NULL, NULL, NULL); - char *log_msg = xasprintf("Missing master conn %p", rev_conn); + char *log_msg = xasprintf("Missing primary conn %p", rev_conn); ct_print_conn_info(rev_conn, log_msg, VLL_INFO, true, true); free(log_msg); return; @@ -2677,16 +2677,16 @@ expectation_remove(struct hmap *alg_expectations, /* This function must be called with the ct->resources read lock taken. */ static struct alg_exp_node * expectation_ref_lookup_unique(const struct hindex *alg_expectation_refs, - const struct conn_key *master_key, + const struct conn_key *primary_key, const struct conn_key *alg_exp_key, uint32_t basis) { struct alg_exp_node *alg_exp_node; HINDEX_FOR_EACH_WITH_HASH (alg_exp_node, node_ref, - conn_key_hash(master_key, basis), + conn_key_hash(primary_key, basis), alg_expectation_refs) { - if (!conn_key_cmp(&alg_exp_node->master_key, master_key) && + if (!conn_key_cmp(&alg_exp_node->primary_key, primary_key) && !conn_key_cmp(&alg_exp_node->key, alg_exp_key)) { return alg_exp_node; } @@ -2701,23 +2701,23 @@ expectation_ref_create(struct hindex *alg_expectation_refs, uint32_t basis) { if (!expectation_ref_lookup_unique(alg_expectation_refs, - &alg_exp_node->master_key, + &alg_exp_node->primary_key, &alg_exp_node->key, basis)) { hindex_insert(alg_expectation_refs, &alg_exp_node->node_ref, - conn_key_hash(&alg_exp_node->master_key, basis)); + conn_key_hash(&alg_exp_node->primary_key, basis)); } } static void -expectation_clean(struct conntrack *ct, const struct conn_key *master_key) +expectation_clean(struct conntrack *ct, const struct conn_key *primary_key) { ovs_rwlock_wrlock(&ct->resources_lock); struct alg_exp_node *node, *next; HINDEX_FOR_EACH_WITH_HASH_SAFE (node, next, node_ref, - conn_key_hash(master_key, ct->hash_basis), + conn_key_hash(primary_key, ct->hash_basis), &ct->alg_expectation_refs) { - if (!conn_key_cmp(&node->master_key, master_key)) { + if (!conn_key_cmp(&node->primary_key, primary_key)) { expectation_remove(&ct->alg_expectations, &node->key, ct->hash_basis); hindex_remove(&ct->alg_expectation_refs, &node->node_ref); @@ -2730,7 +2730,7 @@ expectation_clean(struct conntrack *ct, const struct conn_key *master_key) static void expectation_create(struct conntrack *ct, ovs_be16 dst_port, - const struct conn *master_conn, bool reply, bool src_ip_wc, + const struct conn *primary_conn, bool reply, bool src_ip_wc, bool skip_nat) { union ct_addr src_addr; @@ -2739,47 +2739,47 @@ expectation_create(struct conntrack *ct, ovs_be16 dst_port, struct alg_exp_node *alg_exp_node = xzalloc(sizeof *alg_exp_node); if (reply) { - src_addr = master_conn->key.src.addr; - dst_addr = master_conn->key.dst.addr; + src_addr = primary_conn->key.src.addr; + dst_addr = primary_conn->key.dst.addr; alg_exp_node->nat_rpl_dst = true; if (skip_nat) { alg_nat_repl_addr = dst_addr; - } else if (master_conn->nat_info && - master_conn->nat_info->nat_action & NAT_ACTION_DST) { - alg_nat_repl_addr = master_conn->rev_key.src.addr; + } else if (primary_conn->nat_info && + primary_conn->nat_info->nat_action & NAT_ACTION_DST) { + alg_nat_repl_addr = primary_conn->rev_key.src.addr; alg_exp_node->nat_rpl_dst = false; } else { - alg_nat_repl_addr = master_conn->rev_key.dst.addr; + alg_nat_repl_addr = primary_conn->rev_key.dst.addr; } } else { - src_addr = master_conn->rev_key.src.addr; - dst_addr = master_conn->rev_key.dst.addr; + src_addr = primary_conn->rev_key.src.addr; + dst_addr = primary_conn->rev_key.dst.addr; alg_exp_node->nat_rpl_dst = false; if (skip_nat) { alg_nat_repl_addr = src_addr; - } else if (master_conn->nat_info && - master_conn->nat_info->nat_action & NAT_ACTION_DST) { - alg_nat_repl_addr = master_conn->key.dst.addr; + } else if (primary_conn->nat_info && + primary_conn->nat_info->nat_action & NAT_ACTION_DST) { + alg_nat_repl_addr = primary_conn->key.dst.addr; alg_exp_node->nat_rpl_dst = true; } else { - alg_nat_repl_addr = master_conn->key.src.addr; + alg_nat_repl_addr = primary_conn->key.src.addr; } } if (src_ip_wc) { memset(&src_addr, 0, sizeof src_addr); } - alg_exp_node->key.dl_type = master_conn->key.dl_type; - alg_exp_node->key.nw_proto = master_conn->key.nw_proto; - alg_exp_node->key.zone = master_conn->key.zone; + alg_exp_node->key.dl_type = primary_conn->key.dl_type; + alg_exp_node->key.nw_proto = primary_conn->key.nw_proto; + alg_exp_node->key.zone = primary_conn->key.zone; alg_exp_node->key.src.addr = src_addr; alg_exp_node->key.dst.addr = dst_addr; alg_exp_node->key.src.port = ALG_WC_SRC_PORT; alg_exp_node->key.dst.port = dst_port; - alg_exp_node->master_mark = master_conn->mark; - alg_exp_node->master_label = master_conn->label; - memcpy(&alg_exp_node->master_key, &master_conn->key, - sizeof alg_exp_node->master_key); + alg_exp_node->primary_mark = primary_conn->mark; + alg_exp_node->primary_label = primary_conn->label; + memcpy(&alg_exp_node->primary_key, &primary_conn->key, + sizeof alg_exp_node->primary_key); /* Take the write lock here because it is almost 100% * likely that the lookup will fail and * expectation_create() will be called below. */ diff --git a/lib/ct-dpif.c b/lib/ct-dpif.c index 8c2480e7ac39..8fa5a6a10253 100644 --- a/lib/ct-dpif.c +++ b/lib/ct-dpif.c @@ -323,9 +323,9 @@ ct_dpif_format_entry(const struct ct_dpif_entry *entry, struct ds *ds, } ct_dpif_format_protoinfo(ds, ",protoinfo=", &entry->protoinfo, verbose); ct_dpif_format_helper(ds, ",helper=", &entry->helper); - if (verbose && entry->tuple_master.l3_type != 0) { - ds_put_cstr(ds, ",master=("); - ct_dpif_format_tuple(ds, &entry->tuple_master); + if (verbose && entry->tuple_primary.l3_type != 0) { + ds_put_cstr(ds, ",primary=("); + ct_dpif_format_tuple(ds, &entry->tuple_primary); ds_put_cstr(ds, ")"); } } diff --git a/lib/ct-dpif.h b/lib/ct-dpif.h index e4c7a640b113..10b13a7b8b53 100644 --- a/lib/ct-dpif.h +++ b/lib/ct-dpif.h @@ -177,7 +177,7 @@ struct ct_dpif_entry { /* Const members. */ struct ct_dpif_tuple tuple_orig; struct ct_dpif_tuple tuple_reply; - struct ct_dpif_tuple tuple_master; + struct ct_dpif_tuple tuple_primary; struct ct_dpif_helper helper; uint32_t id; uint16_t zone; diff --git a/lib/meta-flow.xml b/lib/meta-flow.xml index d4495552b3c2..13a8ee238f75 100644 --- a/lib/meta-flow.xml +++ b/lib/meta-flow.xml @@ -2792,7 +2792,7 @@ actions=clone(load:0->NXM_OF_IN_PORT[],output:123) connection), or be of different protocol (i.e., when an ICMP response is sent to an UDP packet). In case of related connections, e.g., an FTP data connection, the original direction tuple contains the - original direction headers from the master connection, e.g., an FTP + original direction headers from the primary connection, e.g., an FTP control connection.

    diff --git a/lib/netlink-conntrack.c b/lib/netlink-conntrack.c index 86ab866cf591..f7af4822b4cc 100644 --- a/lib/netlink-conntrack.c +++ b/lib/netlink-conntrack.c @@ -237,7 +237,7 @@ nl_ct_flush(void) ofpbuf_uninit(&buf); /* Expectations are flushed automatically, because they do not - * have a master connection anymore */ + * have a primary connection anymore */ return err; } @@ -344,7 +344,7 @@ nl_ct_flush_zone(uint16_t flush_zone) ofpbuf_uninit(&buf); /* Expectations are flushed automatically, because they do not - * have a master connection anymore */ + * have a primary connection anymore */ return 0; } #endif @@ -1263,7 +1263,7 @@ nl_ct_attrs_to_ct_dpif_entry(struct ct_dpif_entry *entry, return false; } if (attrs[CTA_TUPLE_MASTER] && - !nl_ct_parse_tuple(attrs[CTA_TUPLE_MASTER], &entry->tuple_master, + !nl_ct_parse_tuple(attrs[CTA_TUPLE_MASTER], &entry->tuple_primary, nfgen_family)) { return false; } diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at index 17d2422224ea..254299f70d27 100644 --- a/tests/ofproto-dpif.at +++ b/tests/ofproto-dpif.at @@ -9521,7 +9521,7 @@ dnl Non-REPLY/RELATED packets get the ACL lookup with the packet headers dnl in the actual packet direction in reg0 (IN=1, OUT=2). REPLY packets dnl get the ACL lookup using the conntrack tuple and the inverted direction. dnl RELATED packets get ACL lookup using the conntrack tuple in the direction -dnl of the master connection, as storted in ct_mark. +dnl of the primary connection, as storted in ct_mark. dnl dnl Incoming non-related packet in the original direction (ACL IN) table=1 reg3=1, ip, ct_state=-rel-rpl+trk-inv action=set_field:1->reg0,resubmit(,3),goto_table:5 @@ -9532,7 +9532,7 @@ table=1 reg3=2, ip, ct_state=-rel-rpl+trk-inv action=set_field:2->reg0,resubmit( dnl Outgoing non-related reply packet (CT ACL IN) table=1 reg3=2, ip, ct_state=-rel+rpl+trk-inv action=set_field:1->reg0,resubmit(,3,ct),goto_table:4 dnl -dnl Related packet (CT ACL in the direction of the master connection.) +dnl Related packet (CT ACL in the direction of the primary connection.) table=1 ip, ct_state=+rel+trk-inv, action=move:NXM_NX_CT_MARK[[]]->NXM_NX_REG0[[]],resubmit(,3,ct),goto_table:4 dnl Drop everything else. table=1 priority=0, action=drop @@ -9565,7 +9565,7 @@ table=5 reg2=0 priority=1000 action=drop dnl Commit new non-related IP connections. table=5 priority=10 reg2=1 ct_state=+new-rel, ip, action=ct(zone=NXM_NX_REG4[[0..15]],commit,exec(move:NXM_NX_REG3[[0..31]]->NXM_NX_CT_MARK[[0..31]],move:NXM_NX_REG1[[0..31]]->NXM_NX_CT_LABEL[[96..127]])),goto_table:6 dnl Commit new related connections in either direction, which inherit the mark -dnl (the direction of the original direction master tuple) from the master +dnl (the direction of the original direction primary tuple) from the primary dnl connection. table=5 priority=10 reg2=1 ct_state=+new+rel, ip, action=ct(zone=NXM_NX_REG4[[0..15]],commit,exec(move:NXM_NX_REG1[[0..31]]->NXM_NX_CT_LABEL[[96..127]])),goto_table:6 dnl Forward everything else, including stateless accepts. diff --git a/tests/system-traffic.at b/tests/system-traffic.at index 2a0fbadff4a1..ff79b6a4795d 100644 --- a/tests/system-traffic.at +++ b/tests/system-traffic.at @@ -4818,7 +4818,7 @@ dnl Non-REPLY/RELATED packets get the ACL lookup with the packet headers dnl in the actual packet direction in reg0 (IN=1, OUT=2). REPLY packets dnl get the ACL lookup using the conntrack tuple and the inverted direction. dnl RELATED packets get ACL lookup using the conntrack tuple in the direction -dnl of the master connection, as stored in ct_label[0]. +dnl of the primary connection, as stored in ct_label[0]. dnl dnl Incoming non-related packet in the original direction (ACL IN) table=1 reg3=1, ip, ct_state=-rel-rpl+trk-inv action=set_field:1->reg0,resubmit(,3),goto_table:5 @@ -4829,7 +4829,7 @@ table=1 reg3=2, ip, ct_state=-rel-rpl+trk-inv action=set_field:2->reg0,resubmit( dnl Outgoing non-related reply packet (CT ACL IN) table=1 reg3=2, ip, ct_state=-rel+rpl+trk-inv action=set_field:1->reg0,resubmit(,3,ct),goto_table:4 dnl -dnl Related packet (CT ACL in the direction of the master connection.) +dnl Related packet (CT ACL in the direction of the primary connection.) table=1 ip, ct_state=+rel+trk-inv, action=move:NXM_NX_CT_LABEL[[0]]->NXM_NX_REG0[[0]],resubmit(,3,ct),goto_table:4 dnl Drop everything else. table=1 priority=0, action=drop @@ -4871,7 +4871,7 @@ dnl (This should not get any packets in this test.) table=5 priority=10 reg2=1 reg3=2 ct_state=+new-rel, ip, action=ct(zone=NXM_NX_REG4[[0..15]],commit,nat(dst=$2),exec(move:NXM_NX_REG3[[0]]->NXM_NX_CT_LABEL[[0]],move:NXM_NX_REG1[[0..31]]->NXM_NX_CT_LABEL[[96..127]])),goto_table:6 dnl Commit new related connections in either direction, which need 'nat' dnl and which inherit the label (the direction of the original direction -dnl master tuple) from the master connection. +dnl primary tuple) from the primary connection. table=5 priority=10 reg2=1 ct_state=+new+rel, ip, action=ct(zone=NXM_NX_REG4[[0..15]],commit,nat,exec(move:NXM_NX_REG1[[0..31]]->NXM_NX_CT_LABEL[[96..127]])),goto_table:6 dnl dnl NAT incoming non-NEW packets. Outgoing packets were NATted in table 0. From patchwork Mon Jul 6 20:35:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1323938 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4B0y5S2DP2z9sRK for ; Tue, 7 Jul 2020 06:36:12 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id DDE0C27B1D; Mon, 6 Jul 2020 20:36:09 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iJgFAmucBJkR; Mon, 6 Jul 2020 20:35:42 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 95F7E2728B; Mon, 6 Jul 2020 20:35:41 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 74047C016F; Mon, 6 Jul 2020 20:35:41 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7C69DC0891 for ; Mon, 6 Jul 2020 20:35:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 50377888F6 for ; Mon, 6 Jul 2020 20:35:39 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ovNsRNUJVd0Y for ; Mon, 6 Jul 2020 20:35:34 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by hemlock.osuosl.org (Postfix) with ESMTPS id 2772C88928 for ; Mon, 6 Jul 2020 20:35:33 +0000 (UTC) Received: from sigfpe.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay11.mail.gandi.net (Postfix) with ESMTPSA id D59BA100009; Mon, 6 Jul 2020 20:35:31 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Mon, 6 Jul 2020 13:35:20 -0700 Message-Id: <20200706203521.719453-5-blp@ovn.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200706203521.719453-1-blp@ovn.org> References: <20200706203521.719453-1-blp@ovn.org> MIME-Version: 1.0 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH v2 4/5] Eliminate "whitelist" and "blacklist" terms. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" There is one remaining use under datapath. That change should happen upstream in Linux first according to our usual policy. Signed-off-by: Ben Pfaff --- Documentation/howto/ipsec.rst | 2 +- Documentation/howto/selinux.rst | 8 +-- Documentation/topics/datapath.rst | 2 +- Documentation/topics/ovsdb-replication.rst | 9 ++- Makefile.am | 10 +-- build-aux/automake.mk | 2 +- ...ab-whitelist => initial-tab-allowed-files} | 0 ...fety-blacklist => thread-safety-forbidden} | 0 datapath/Makefile.am | 2 +- datapath/linux/Modules.mk | 2 +- ...heck-whitelist => export-check-allow-list} | 0 include/openvswitch/automake.mk | 2 +- lib/daemon.man | 2 +- lib/daemon.xml | 2 +- lib/dpif.c | 14 ++-- lib/dpif.h | 2 +- lib/ovsdb-idl.h | 4 +- ovsdb/ovsdb-server.c | 8 +-- ovsdb/replication.c | 72 +++++++++---------- ovsdb/replication.h | 10 +-- tests/ofproto-macros.at | 4 +- tests/system-kmod-macros.at | 6 +- tests/system-userspace-macros.at | 6 +- tests/test-classifier.c | 3 +- utilities/checkpatch.py | 8 +-- vswitchd/bridge.c | 27 ++++--- vswitchd/ovs-vswitchd.c | 2 +- vswitchd/vswitch.xml | 2 +- 28 files changed, 105 insertions(+), 106 deletions(-) rename build-aux/{initial-tab-whitelist => initial-tab-allowed-files} (100%) rename build-aux/{thread-safety-blacklist => thread-safety-forbidden} (100%) rename datapath/linux/compat/build-aux/{export-check-whitelist => export-check-allow-list} (100%) diff --git a/Documentation/howto/ipsec.rst b/Documentation/howto/ipsec.rst index 17153ac2be68..cd93484204c8 100644 --- a/Documentation/howto/ipsec.rst +++ b/Documentation/howto/ipsec.rst @@ -162,7 +162,7 @@ undesirable situation. `ipsec_skb_mark`. By setting the ipsec_skb_mark as 0/1, OVS IPsec prevents all unencrypted tunnel packets leaving the host since the default skb_mark value for tunnel packets are 0. This affects all OVS tunnels including those - without IPsec being set up. You can install OpenFlow rules to whitelist + without IPsec being set up. You can install OpenFlow rules to enable those non-IPsec tunnels by setting the skb_mark of the tunnel traffic as non-zero value. diff --git a/Documentation/howto/selinux.rst b/Documentation/howto/selinux.rst index 55c3e39cece4..f657d5e518b9 100644 --- a/Documentation/howto/selinux.rst +++ b/Documentation/howto/selinux.rst @@ -67,8 +67,8 @@ differently than SELinux. SELinux and Open vSwitch are moving targets. What this means is that, if you solely rely on your Linux distribution's SELinux policy, then this policy might not have correctly anticipated that a newer Open vSwitch version needs extra -white list rules. However, if you solely rely on SELinux policy that ships -with Open vSwitch, then Open vSwitch developers might not have correctly +rules to allow behavior. However, if you solely rely on SELinux policy that +ships with Open vSwitch, then Open vSwitch developers might not have correctly anticipated the feature set that your SELinux implementation supports. Installation @@ -136,8 +136,8 @@ Then verify that this module was indeed loaded:: openvswitch 1.1.1 If you still see Permission denied errors, then take a look into -``selinux/openvswitch.te.in`` file in the OVS source tree and try to add white -list rules. This is really simple, just run SELinux audit2allow tool:: +``selinux/openvswitch.te.in`` file in the OVS source tree and try to add allow +rules. This is really simple, just run SELinux audit2allow tool:: $ grep "openvswitch_t" /var/log/audit/audit.log | audit2allow -M ovslocal diff --git a/Documentation/topics/datapath.rst b/Documentation/topics/datapath.rst index 8585c79eb936..e6dcfbc199e2 100644 --- a/Documentation/topics/datapath.rst +++ b/Documentation/topics/datapath.rst @@ -261,5 +261,5 @@ Implement the headers and codes for compatibility with older kernel in function should be prefixed with ``rpl_``. Otherwise, the function should be prefixed with ``ovs_``. For special case when it is not possible to follow this rule (e.g., the ``pskb_expand_head()`` function), the function name must -be added to ``linux/compat/build-aux/export-check-whitelist``, otherwise, the +be added to ``linux/compat/build-aux/export-check-allowlist``, otherwise, the compilation check ``check-export-symbol`` will fail. diff --git a/Documentation/topics/ovsdb-replication.rst b/Documentation/topics/ovsdb-replication.rst index 950dfc9b7cde..e762f07302fa 100644 --- a/Documentation/topics/ovsdb-replication.rst +++ b/Documentation/topics/ovsdb-replication.rst @@ -91,7 +91,7 @@ When sending a monitor request the standby server is doing the following: 4. For each database with the same schema in both the active and standby servers: construct and send a monitor request message specifying the tables that will be monitored (i.e all the tables on the database except the ones - blacklisted [*]). + explicitly excluded [*]). 5. Set the standby database to the current state of the active database. @@ -100,10 +100,9 @@ receive notifications of changes occurring to the tables specified in the request. The process of handling this notifications is detailed in the next section. -[*] A set of tables that will be excluded from replication can be configure as -a blacklist of tables via the command line option -``--sync-exclude-tables=db:table[,db:table]...``, where db corresponds to the -database where the table resides. +[*] A set of tables that will be excluded from replication can be configured +via the command line option ``--sync-exclude-tables=db:table[,db:table]...``, +where db corresponds to the database where the table resides. Replication Process ------------------- diff --git a/Makefile.am b/Makefile.am index 27ef9e4b483f..27040473616a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -276,7 +276,7 @@ static-check: fi .PHONY: static-check -# Check that assert.h is not used outside a whitelist of files. +# Check that assert.h is not used (outside a small set of files). ALL_LOCAL += check-assert-h-usage check-assert-h-usage: @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \ @@ -323,7 +323,7 @@ check-tabs: if test -e .git && (git --version) >/dev/null 2>&1 && \ grep -ln "^ " \ `git ls-files \ - | grep -v -f build-aux/initial-tab-whitelist` /dev/null \ + | grep -v -f build-aux/initial-tab-allowed-files` /dev/null \ | $(EGREP) -v ':[ ]*/?\*'; \ then \ echo "See above for files that use tabs for indentation."; \ @@ -336,16 +336,16 @@ ALL_LOCAL += thread-safety-check thread-safety-check: @cd $(srcdir); \ if test -e .git && (git --version) >/dev/null 2>&1 && \ - grep -n -f build-aux/thread-safety-blacklist \ + grep -n -f build-aux/thread-safety-forbidden \ `git ls-files | grep '\.[ch]$$' \ | $(EGREP) -v '^datapath|^lib/sflow|^third-party'` /dev/null \ | $(EGREP) -v ':[ ]*/?\*'; \ then \ echo "See above for list of calls to functions that are"; \ - echo "blacklisted due to thread safety issues"; \ + echo "forbidden due to thread safety issues"; \ exit 1; \ fi -EXTRA_DIST += build-aux/thread-safety-blacklist +EXTRA_DIST += build-aux/thread-safety-forbidden .PHONY: thread-safety-check # Check that "ip" is used in preference to "ifconfig", because diff --git a/build-aux/automake.mk b/build-aux/automake.mk index 9007ecda9c19..6267ccd7cf43 100644 --- a/build-aux/automake.mk +++ b/build-aux/automake.mk @@ -5,7 +5,7 @@ EXTRA_DIST += \ build-aux/dist-docs \ build-aux/dpdkstrip.py \ build-aux/generate-dhparams-c \ - build-aux/initial-tab-whitelist \ + build-aux/initial-tab-allowed-files \ build-aux/sodepends.py \ build-aux/soexpand.py \ build-aux/text2c \ diff --git a/build-aux/initial-tab-whitelist b/build-aux/initial-tab-allowed-files similarity index 100% rename from build-aux/initial-tab-whitelist rename to build-aux/initial-tab-allowed-files diff --git a/build-aux/thread-safety-blacklist b/build-aux/thread-safety-forbidden similarity index 100% rename from build-aux/thread-safety-blacklist rename to build-aux/thread-safety-forbidden diff --git a/datapath/Makefile.am b/datapath/Makefile.am index f2a85bc3bc3c..e4dd0c7044d4 100644 --- a/datapath/Makefile.am +++ b/datapath/Makefile.am @@ -42,7 +42,7 @@ COMPAT_EXPORTS := $(shell $(COMPAT_GET_EXPORTS)) # Checks that all EXPORT_SYMBOL_GPL() export 'rpl_' or 'ovs_' prefixed functions. check-export-symbol: @for fun_ in $(COMPAT_FUNCTIONS); do \ - if ! grep -- $${fun_} $(top_srcdir)/datapath/linux/compat/build-aux/export-check-whitelist > /dev/null; then \ + if ! grep -- $${fun_} $(top_srcdir)/datapath/linux/compat/build-aux/export-check-allow-list > /dev/null; then \ if ! echo $${fun_} | grep -q -E '^(rpl|ovs)_'; then \ echo "error: $${fun_}() needs to be prefixed with 'rpl_' or 'ovs_'."; \ exit 1; \ diff --git a/datapath/linux/Modules.mk b/datapath/linux/Modules.mk index 63a5cbae40cc..37224398800c 100644 --- a/datapath/linux/Modules.mk +++ b/datapath/linux/Modules.mk @@ -120,4 +120,4 @@ openvswitch_headers += \ linux/compat/include/linux/netfilter.h \ linux/compat/include/linux/overflow.h \ linux/compat/include/linux/rbtree.h -EXTRA_DIST += linux/compat/build-aux/export-check-whitelist +EXTRA_DIST += linux/compat/build-aux/export-check-allow-list diff --git a/datapath/linux/compat/build-aux/export-check-whitelist b/datapath/linux/compat/build-aux/export-check-allow-list similarity index 100% rename from datapath/linux/compat/build-aux/export-check-whitelist rename to datapath/linux/compat/build-aux/export-check-allow-list diff --git a/include/openvswitch/automake.mk b/include/openvswitch/automake.mk index 73c346175733..1fa6d88fabbf 100644 --- a/include/openvswitch/automake.mk +++ b/include/openvswitch/automake.mk @@ -72,7 +72,7 @@ endif # header file has the proper extern declaration for use with C++. # # Some header files don't declare any external functions, so they -# don't really need extern "C". We only white list a couple of these +# don't really need extern "C". We only permit a couple of these # below, which are the ones that seem unlikely to ever declare # external functions. For the rest, we add extern "C" anyway; it # doesn't hurt. diff --git a/lib/daemon.man b/lib/daemon.man index 68c0a312db6a..a92f8c4d5a1d 100644 --- a/lib/daemon.man +++ b/lib/daemon.man @@ -58,7 +58,7 @@ This option has no effect when \fB\-\-detach\fR is not specified. .TP \fB\-\-no\-self\-confinement\fR By default daemon will try to self-confine itself to work with -files under well-know, at build-time whitelisted directories. It +files under well-known directories determined during build. It is better to stick with this default behavior and not to use this flag unless some other Access Control is used to confine daemon. Note that in contrast to other access control implementations that diff --git a/lib/daemon.xml b/lib/daemon.xml index 1b5e8acae21a..5a421ccab385 100644 --- a/lib/daemon.xml +++ b/lib/daemon.xml @@ -82,7 +82,7 @@
    --no-self-confinement
    By default this daemon will try to self-confine itself to work with files - under well-known directories whitelisted at build time. It is better to + under well-known directories determined at build time. It is better to stick with this default behavior and not to use this flag unless some other Access Control is used to confine daemon. Note that in contrast to other access control implementations that are typically enforced from diff --git a/lib/dpif.c b/lib/dpif.c index c529a93f1be0..64229ca4aef0 100644 --- a/lib/dpif.c +++ b/lib/dpif.c @@ -79,9 +79,9 @@ struct registered_dpif_class { int refcount; }; static struct shash dpif_classes = SHASH_INITIALIZER(&dpif_classes); -static struct sset dpif_blacklist = SSET_INITIALIZER(&dpif_blacklist); +static struct sset dpif_disallowed = SSET_INITIALIZER(&dpif_disallowed); -/* Protects 'dpif_classes', including the refcount, and 'dpif_blacklist'. */ +/* Protects 'dpif_classes', including the refcount, and 'dpif_disallowed'. */ static struct ovs_mutex dpif_mutex = OVS_MUTEX_INITIALIZER; /* Rate limit for individual messages going to or from the datapath, output at @@ -134,8 +134,8 @@ dp_register_provider__(const struct dpif_class *new_class) struct registered_dpif_class *registered_class; int error; - if (sset_contains(&dpif_blacklist, new_class->type)) { - VLOG_DBG("attempted to register blacklisted provider: %s", + if (sset_contains(&dpif_disallowed, new_class->type)) { + VLOG_DBG("attempted to register disallowed provider: %s", new_class->type); return EINVAL; } @@ -219,13 +219,13 @@ dp_unregister_provider(const char *type) return error; } -/* Blacklists a provider. Causes future calls of dp_register_provider() with +/* Disallows a provider. Causes future calls of dp_register_provider() with * a dpif_class which implements 'type' to fail. */ void -dp_blacklist_provider(const char *type) +dp_disallow_provider(const char *type) { ovs_mutex_lock(&dpif_mutex); - sset_add(&dpif_blacklist, type); + sset_add(&dpif_disallowed, type); ovs_mutex_unlock(&dpif_mutex); } diff --git a/lib/dpif.h b/lib/dpif.h index 2d52f0186019..f8bba23fe103 100644 --- a/lib/dpif.h +++ b/lib/dpif.h @@ -400,7 +400,7 @@ struct sset; int dp_register_provider(const struct dpif_class *); int dp_unregister_provider(const char *type); -void dp_blacklist_provider(const char *type); +void dp_disallow_provider(const char *type); void dp_enumerate_types(struct sset *types); const char *dpif_normalize_type(const char *); diff --git a/lib/ovsdb-idl.h b/lib/ovsdb-idl.h index c56cd19b1f74..a1a577664e8e 100644 --- a/lib/ovsdb-idl.h +++ b/lib/ovsdb-idl.h @@ -100,12 +100,12 @@ const struct ovsdb_idl_table_class *ovsdb_idl_table_class_from_column( * The client may choose any subset of the columns and tables to replicate, * specifying it one of two ways: * - * - As a blacklist (adding the columns or tables to replicate). To do so, + * - As a deny list (adding the columns or tables to replicate). To do so, * the client passes false as 'monitor_everything_by_default' to * ovsdb_idl_create() and then calls ovsdb_idl_add_column() and * ovsdb_idl_add_table() for the desired columns and, if necessary, tables. * - * - As a whitelist (replicating all columns and tables except those + * - As an allow list (replicating all columns and tables except those * explicitly removed). To do so, the client passes true as * 'monitor_everything_by_default' to ovsdb_idl_create() and then calls * ovsdb_idl_omit() to remove columns. diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c index ef4e996df22e..95d5ea3299de 100644 --- a/ovsdb/ovsdb-server.c +++ b/ovsdb/ovsdb-server.c @@ -1382,7 +1382,7 @@ ovsdb_server_set_sync_exclude_tables(struct unixctl_conn *conn, { struct server_config *config = config_; - char *err = set_blacklist_tables(argv[1], true); + char *err = set_excluded_tables(argv[1], true); if (!err) { free(*config->sync_exclude); *config->sync_exclude = xstrdup(argv[1]); @@ -1394,7 +1394,7 @@ ovsdb_server_set_sync_exclude_tables(struct unixctl_conn *conn, config->all_dbs, server_uuid, *config->replication_probe_interval); } - err = set_blacklist_tables(argv[1], false); + err = set_excluded_tables(argv[1], false); } unixctl_command_reply(conn, err); free(err); @@ -1406,7 +1406,7 @@ ovsdb_server_get_sync_exclude_tables(struct unixctl_conn *conn, const char *argv[] OVS_UNUSED, void *arg_ OVS_UNUSED) { - char *reply = get_blacklist_tables(); + char *reply = get_excluded_tables(); unixctl_command_reply(conn, reply); free(reply); } @@ -1809,7 +1809,7 @@ parse_options(int argc, char *argv[], break; case OPT_SYNC_EXCLUDE: { - char *err = set_blacklist_tables(optarg, false); + char *err = set_excluded_tables(optarg, false); if (err) { ovs_fatal(0, "%s", err); } diff --git a/ovsdb/replication.c b/ovsdb/replication.c index cbbce64dfbf5..8e430f467b92 100644 --- a/ovsdb/replication.c +++ b/ovsdb/replication.c @@ -68,11 +68,11 @@ static struct ovsdb_error *execute_update(struct ovsdb_txn *txn, struct json *new); /* Maps from db name to sset of table names. */ -static struct shash blacklist_tables = SHASH_INITIALIZER(&blacklist_tables); +static struct shash excluded_tables = SHASH_INITIALIZER(&excluded_tables); -static void blacklist_tables_clear(void); -static void blacklist_tables_add(const char *database, const char *table); -static bool blacklist_tables_find(const char *database, const char* table); +static void excluded_tables_clear(void); +static void excluded_tables_add(const char *database, const char *table); +static bool excluded_tables_find(const char *database, const char* table); /* Keep track of request IDs of all outstanding OVSDB requests. */ @@ -131,7 +131,7 @@ replication_init(const char *sync_from_, const char *exclude_tables, sync_from = xstrdup(sync_from_); /* Caller should have verified that the 'exclude_tables' is * parseable. An error here is unexpected. */ - ovs_assert(!set_blacklist_tables(exclude_tables, false)); + ovs_assert(!set_excluded_tables(exclude_tables, false)); replication_dbs_destroy(); @@ -407,38 +407,38 @@ replication_wait(void) } } -/* Parse 'blacklist' to rebuild 'blacklist_tables'. If 'dryrun' is false, the - * current black list tables will be wiped out, regardless of whether - * 'blacklist' can be parsed. If 'dryrun' is true, only parses 'blacklist' and - * reports any errors, without modifying the blacklist. +/* Parse 'excluded' to rebuild 'excluded_tables'. If 'dryrun' is false, the + * current set of excluded tables will be wiped out, regardless of whether + * 'excluded' can be parsed. If 'dryrun' is true, only parses 'excluded' and + * reports any errors, without modifying the list of exclusions. * * On error, returns the error string, which the caller is * responsible for freeing. Returns NULL otherwise. */ char * OVS_WARN_UNUSED_RESULT -set_blacklist_tables(const char *blacklist, bool dryrun) +set_excluded_tables(const char *excluded, bool dryrun) { struct sset set = SSET_INITIALIZER(&set); char *err = NULL; - if (blacklist) { + if (excluded) { const char *longname; if (!dryrun) { /* Can only add to an empty shash. */ - blacklist_tables_clear(); + excluded_tables_clear(); } - sset_from_delimited_string(&set, blacklist, " ,"); + sset_from_delimited_string(&set, excluded, " ,"); SSET_FOR_EACH (longname, &set) { char *database = xstrdup(longname), *table = NULL; strtok_r(database, ":", &table); if (table && !dryrun) { - blacklist_tables_add(database, table); + excluded_tables_add(database, table); } free(database); if (!table) { - err = xasprintf("Can't parse black list table: %s", longname); + err = xasprintf("Can't parse excluded table: %s", longname); goto done; } } @@ -447,19 +447,19 @@ set_blacklist_tables(const char *blacklist, bool dryrun) done: sset_destroy(&set); if (err && !dryrun) { - /* On error, destroy the partially built 'blacklist_tables'. */ - blacklist_tables_clear(); + /* On error, destroy the partially built 'excluded_tables'. */ + excluded_tables_clear(); } return err; } char * OVS_WARN_UNUSED_RESULT -get_blacklist_tables(void) +get_excluded_tables(void) { struct shash_node *node; struct sset set = SSET_INITIALIZER(&set); - SHASH_FOR_EACH (node, &blacklist_tables) { + SHASH_FOR_EACH (node, &excluded_tables) { const char *database = node->name; const char *table; struct sset *tables = node->data; @@ -489,35 +489,35 @@ get_blacklist_tables(void) } static void -blacklist_tables_clear(void) +excluded_tables_clear(void) { struct shash_node *node; - SHASH_FOR_EACH (node, &blacklist_tables) { + SHASH_FOR_EACH (node, &excluded_tables) { struct sset *tables = node->data; sset_destroy(tables); } - shash_clear_free_data(&blacklist_tables); + shash_clear_free_data(&excluded_tables); } static void -blacklist_tables_add(const char *database, const char *table) +excluded_tables_add(const char *database, const char *table) { - struct sset *tables = shash_find_data(&blacklist_tables, database); + struct sset *tables = shash_find_data(&excluded_tables, database); if (!tables) { tables = xmalloc(sizeof *tables); sset_init(tables); - shash_add(&blacklist_tables, database, tables); + shash_add(&excluded_tables, database, tables); } sset_add(tables, table); } static bool -blacklist_tables_find(const char *database, const char *table) +excluded_tables_find(const char *database, const char *table) { - struct sset *tables = shash_find_data(&blacklist_tables, database); + struct sset *tables = shash_find_data(&excluded_tables, database); return tables && sset_contains(tables, table); } @@ -531,8 +531,8 @@ disconnect_active_server(void) void replication_destroy(void) { - blacklist_tables_clear(); - shash_destroy(&blacklist_tables); + excluded_tables_clear(); + shash_destroy(&excluded_tables); if (sync_from) { free(sync_from); @@ -558,8 +558,8 @@ reset_database(struct ovsdb *db) struct shash_node *table_node; SHASH_FOR_EACH (table_node, &db->tables) { - /* Delete all rows if the table is not blacklisted. */ - if (!blacklist_tables_find(db->schema->name, table_node->name)) { + /* Delete all rows if the table is not excluded. */ + if (!excluded_tables_find(db->schema->name, table_node->name)) { struct ovsdb_table *table = table_node->data; struct ovsdb_row *row, *next; HMAP_FOR_EACH_SAFE (row, next, hmap_node, &table->rows) { @@ -572,7 +572,7 @@ reset_database(struct ovsdb *db) } /* Create a monitor request for 'db'. The monitor request will include - * any tables from 'blacklisted_tables' + * any tables from 'excluded_tables' * * Caller is responsible for disposing 'request'. */ @@ -590,8 +590,8 @@ create_monitor_request(struct ovsdb_schema *schema) for (int j = 0; j < n; j++) { struct ovsdb_table_schema *table = nodes[j]->data; - /* Monitor all tables not blacklisted. */ - if (!blacklist_tables_find(db_name, table->name)) { + /* Monitor all tables not excluded. */ + if (!excluded_tables_find(db_name, table->name)) { add_monitored_table(table, monitor_request); } } @@ -914,10 +914,10 @@ replication_status(void) } ds_chomp(&ds, ','); - if (!shash_is_empty(&blacklist_tables)) { + if (!shash_is_empty(&excluded_tables)) { ds_put_char(&ds, '\n'); ds_put_cstr(&ds, "exclude: "); - ds_put_and_free_cstr(&ds, get_blacklist_tables()); + ds_put_and_free_cstr(&ds, get_excluded_tables()); } break; } diff --git a/ovsdb/replication.h b/ovsdb/replication.h index c45f33e2629f..6d1be820f3d1 100644 --- a/ovsdb/replication.h +++ b/ovsdb/replication.h @@ -39,9 +39,9 @@ struct ovsdb; * replication_get_last_error() should be call within the main loop * whenever OVSDB server runs in the backup mode. * - * - set_blacklist_tables(), get_blacklist_tables(), - * disconnect_active_server() and replication_usage() are support functions - * used mainly by uinxctl commands. + * - set_excluded_tables(), get_excluded_tables(), disconnect_active_server() + * and replication_usage() are support functions used mainly by unixctl + * commands. */ #define REPLICATION_DEFAULT_PROBE_INTERVAL 60000 @@ -58,9 +58,9 @@ int replication_get_last_error(void); char *replication_status(void); void replication_set_probe_interval(int); -char *set_blacklist_tables(const char *blacklist, bool dryrun) +char *set_excluded_tables(const char *excluded, bool dryrun) OVS_WARN_UNUSED_RESULT; -char *get_blacklist_tables(void) OVS_WARN_UNUSED_RESULT; +char *get_excluded_tables(void) OVS_WARN_UNUSED_RESULT; void disconnect_active_server(void); #endif /* ovsdb/replication.h */ diff --git a/tests/ofproto-macros.at b/tests/ofproto-macros.at index b2b17eed335a..eb794cd755f6 100644 --- a/tests/ofproto-macros.at +++ b/tests/ofproto-macros.at @@ -303,11 +303,11 @@ add_pmd_of_ports () { m4_divert_pop([PREPARE_TESTS]) -# OVS_VSWITCHD_STOP([WHITELIST]) +# OVS_VSWITCHD_STOP([ALLOWLIST]) # # Gracefully stops ovs-vswitchd and ovsdb-server, checking their log files # for messages with severity WARN or higher and signaling an error if any -# is present. The optional WHITELIST may contain shell-quoted "sed" +# is present. The optional ALLOWLIST may contain shell-quoted "sed" # commands to delete any warnings that are actually expected, e.g.: # # OVS_VSWITCHD_STOP(["/expected error/d"]) diff --git a/tests/system-kmod-macros.at b/tests/system-kmod-macros.at index daf66bdec827..15628a7c6f42 100644 --- a/tests/system-kmod-macros.at +++ b/tests/system-kmod-macros.at @@ -29,16 +29,16 @@ m4_define([OVS_TRAFFIC_VSWITCHD_START], AT_CHECK([ovs-vsctl -- _ADD_BR([br0]) -- $1 m4_if([$2], [], [], [| uuidfilt])], [0], [$2]) ]) -# OVS_TRAFFIC_VSWITCHD_STOP([WHITELIST], [extra_cmds]) +# OVS_TRAFFIC_VSWITCHD_STOP([ALLOWLIST], [extra_cmds]) # # Gracefully stops ovs-vswitchd and ovsdb-server, checking their log files # for messages with severity WARN or higher and signaling an error if any -# is present. The optional WHITELIST may contain shell-quoted "sed" +# is present. The optional ALLOWLIST may contain shell-quoted "sed" # commands to delete any warnings that are actually expected, e.g.: # # OVS_TRAFFIC_VSWITCHD_STOP(["/expected error/d"]) # -# 'extra_cmds' are shell commands to be executed afte OVS_VSWITCHD_STOP() is +# 'extra_cmds' are shell commands to be executed after OVS_VSWITCHD_STOP() is # invoked. They can be used to perform additional cleanups such as name space # removal. m4_define([OVS_TRAFFIC_VSWITCHD_STOP], diff --git a/tests/system-userspace-macros.at b/tests/system-userspace-macros.at index 72c84b9c7c82..34f82cee3db6 100644 --- a/tests/system-userspace-macros.at +++ b/tests/system-userspace-macros.at @@ -21,16 +21,16 @@ m4_define([OVS_TRAFFIC_VSWITCHD_START], AT_CHECK([ovs-vsctl -- _ADD_BR([br0]) -- $1 m4_if([$2], [], [], [| uuidfilt])], [0], [$2]) ]) -# OVS_TRAFFIC_VSWITCHD_STOP([WHITELIST], [extra_cmds]) +# OVS_TRAFFIC_VSWITCHD_STOP([ALLOWLIST], [extra_cmds]) # # Gracefully stops ovs-vswitchd and ovsdb-server, checking their log files # for messages with severity WARN or higher and signaling an error if any -# is present. The optional WHITELIST may contain shell-quoted "sed" +# is present. The optional ALLOWLIST may contain shell-quoted "sed" # commands to delete any warnings that are actually expected, e.g.: # # OVS_TRAFFIC_VSWITCHD_STOP(["/expected error/d"]) # -# 'extra_cmds' are shell commands to be executed afte OVS_VSWITCHD_STOP() is +# 'extra_cmds' are shell commands to be executed after OVS_VSWITCHD_STOP() is # invoked. They can be used to perform additional cleanups such as name space # removal. m4_define([OVS_TRAFFIC_VSWITCHD_STOP], diff --git a/tests/test-classifier.c b/tests/test-classifier.c index 2d98fad485c8..cff00c8fa35e 100644 --- a/tests/test-classifier.c +++ b/tests/test-classifier.c @@ -14,7 +14,8 @@ * limitations under the License. */ -/* "White box" tests for classifier. +/* Tests for classifier, written with knowledge of and to advantage of the + * classifier's internal structure. * * With very few exceptions, these tests obtain complete coverage of every * basic block and every branch in the classifier implementation, e.g. a clean diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py index fc9e20bf1b5f..9eb4084f9323 100755 --- a/utilities/checkpatch.py +++ b/utilities/checkpatch.py @@ -189,13 +189,13 @@ skip_signoff_check = False # name, as they may have legitimate reasons to have longer lines. # # Python isn't checked as flake8 performs these checks during build. -line_length_blacklist = re.compile( +line_length_ignore_list = re.compile( r'\.(am|at|etc|in|m4|mk|patch|py)$|debian/rules') # Don't enforce a requirement that leading whitespace be all spaces on # files that include these characters in their name, since these kinds # of files need lines with leading tabs. -leading_whitespace_blacklist = re.compile(r'\.(mk|am|at)$|debian/rules') +leading_whitespace_ignore_list = re.compile(r'\.(mk|am|at)$|debian/rules') def is_subtracted_line(line): @@ -522,11 +522,11 @@ file_checks = [ checks = [ {'regex': None, - 'match_name': lambda x: not line_length_blacklist.search(x), + 'match_name': lambda x: not line_length_ignore_list.search(x), 'check': lambda x: line_length_check(x)}, {'regex': None, - 'match_name': lambda x: not leading_whitespace_blacklist.search(x), + 'match_name': lambda x: not leading_whitespace_ignore_list.search(x), 'check': lambda x: not leading_whitespace_is_spaces(x), 'print': lambda: print_warning("Line has non-spaces leading whitespace")}, diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 6cbf5b76422a..1eb1aa1b0d31 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -3909,49 +3909,48 @@ bridge_configure_remotes(struct bridge *br, && (!strncmp(c->target, "punix:", 6) || !strncmp(c->target, "unix:", 5))) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); - char *whitelist; + char *allowed; if (!strncmp(c->target, "unix:", 5)) { /* Connect to a listening socket */ - whitelist = xasprintf("unix:%s/", ovs_rundir()); + allowed = xasprintf("unix:%s/", ovs_rundir()); if (strchr(c->target, '/') && - !equal_pathnames(c->target, whitelist, - strlen(whitelist))) { + !equal_pathnames(c->target, allowed, strlen(allowed))) { /* Absolute path specified, but not in ovs_rundir */ VLOG_ERR_RL(&rl, "bridge %s: Not connecting to socket " "controller \"%s\" due to possibility for " "remote exploit. Instead, specify socket " - "in whitelisted \"%s\" or connect to " + "in permitted directory \"%s\" or connect to " "\"unix:%s/%s.mgmt\" (which is always " "available without special configuration).", - br->name, c->target, whitelist, + br->name, c->target, allowed, ovs_rundir(), br->name); - free(whitelist); + free(allowed); continue; } } else { - whitelist = xasprintf("punix:%s/%s.", + allowed = xasprintf("punix:%s/%s.", ovs_rundir(), br->name); - if (!equal_pathnames(c->target, whitelist, strlen(whitelist)) - || strchr(c->target + strlen(whitelist), '/')) { + if (!equal_pathnames(c->target, allowed, strlen(allowed)) + || strchr(c->target + strlen(allowed), '/')) { /* Prevent remote ovsdb-server users from accessing * arbitrary Unix domain sockets and overwriting arbitrary * local files. */ VLOG_ERR_RL(&rl, "bridge %s: Not adding Unix domain socket " "controller \"%s\" due to possibility of " "overwriting local files. Instead, specify " - "path in whitelisted format \"%s*\" or " + "path in permitteded format \"%s*\" or " "connect to \"unix:%s/%s.mgmt\" (which is " "always available without special " "configuration).", - br->name, c->target, whitelist, + br->name, c->target, allowed, ovs_rundir(), br->name); - free(whitelist); + free(allowed); continue; } } - free(whitelist); + free(allowed); } bridge_configure_local_iface_netdev(br, c); diff --git a/vswitchd/ovs-vswitchd.c b/vswitchd/ovs-vswitchd.c index 1e72b628b1bd..f007f9c0bc06 100644 --- a/vswitchd/ovs-vswitchd.c +++ b/vswitchd/ovs-vswitchd.c @@ -228,7 +228,7 @@ parse_options(int argc, char *argv[], char **unixctl_pathp) break; case OPT_DISABLE_SYSTEM: - dp_blacklist_provider("system"); + dp_disallow_provider("system"); break; case OPT_DISABLE_SYSTEM_ROUTE: diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index ecb9a6b613ed..3382b79d97e0 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -1072,7 +1072,7 @@ Drop all unencrypted tunneled packets in which the least-significant bit of skb_mark is 0. This would be a useful policy if no unencrypted tunneled traffic should exit - the system without being specially whitelisted by setting + the system without being specially permitted by setting skb_mark to 1.
    From patchwork Mon Jul 6 20:35:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1323937 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4B0y541lYbz9sRK for ; Tue, 7 Jul 2020 06:35:52 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 56429876E6; Mon, 6 Jul 2020 20:35:50 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id obN_4BObUyBC; Mon, 6 Jul 2020 20:35:47 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 1E491876FF; Mon, 6 Jul 2020 20:35:44 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 01E3CC1797; Mon, 6 Jul 2020 20:35:44 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7D3A3C0891 for ; Mon, 6 Jul 2020 20:35:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 62ED3272B4 for ; Mon, 6 Jul 2020 20:35:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Sqk8uWQ0RzVq for ; Mon, 6 Jul 2020 20:35:37 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by silver.osuosl.org (Postfix) with ESMTPS id CFED0271CE for ; Mon, 6 Jul 2020 20:35:35 +0000 (UTC) Received: from sigfpe.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay11.mail.gandi.net (Postfix) with ESMTPSA id 4178910000B; Mon, 6 Jul 2020 20:35:32 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Mon, 6 Jul 2020 13:35:21 -0700 Message-Id: <20200706203521.719453-6-blp@ovn.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200706203521.719453-1-blp@ovn.org> References: <20200706203521.719453-1-blp@ovn.org> MIME-Version: 1.0 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH v2 5/5] checkpatch: Add argument to skip gerrit change id check X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Roi Dayan This arg can be used internally by groups using gerrit for code reviews. Signed-off-by: Roi Dayan Signed-off-by: Ben Pfaff --- utilities/checkpatch.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py index 9eb4084f9323..0d8ef4b4a315 100755 --- a/utilities/checkpatch.py +++ b/utilities/checkpatch.py @@ -182,6 +182,7 @@ __regex_if_macros = re.compile(r'^ +(%s) \([\S]([\s\S]+[\S])*\) { +\\' % skip_leading_whitespace_check = False skip_trailing_whitespace_check = False +skip_gerrit_change_id_check = False skip_block_whitespace_check = False skip_signoff_check = False @@ -814,7 +815,7 @@ def ovs_checkpatch_parse(text, filename, author=None, committer=None): elif is_co_author.match(line): m = is_co_author.match(line) co_authors.append(m.group(2)) - elif is_gerrit_change_id.match(line): + elif is_gerrit_change_id.match(line) and not skip_gerrit_change_id_check: print_error( "Remove Gerrit Change-Id's before submitting upstream.") print("%d: %s\n" % (lineno, line)) @@ -885,7 +886,8 @@ Check options: -s|--skip-signoff-lines Tolerate missing Signed-off-by line -S|--spellcheck Check C comments and commit-message for possible spelling mistakes --t|--skip-trailing-whitespace Skips the trailing whitespace test""" +-t|--skip-trailing-whitespace Skips the trailing whitespace test + --skip-gerrit-change-id Skips the gerrit change id test""" % sys.argv[0]) @@ -942,6 +944,7 @@ if __name__ == '__main__': "skip-leading-whitespace", "skip-signoff-lines", "skip-trailing-whitespace", + "skip-gerrit-change-id", "spellcheck", "quiet"]) except: @@ -960,6 +963,8 @@ if __name__ == '__main__': skip_signoff_check = True elif o in ("-t", "--skip-trailing-whitespace"): skip_trailing_whitespace_check = True + elif o in ("--skip-gerrit-change-id"): + skip_gerrit_change_id_check = True elif o in ("-f", "--check-file"): checking_file = True elif o in ("-S", "--spellcheck"):