diff --git a/SOURCES/openvswitch-2.17.0.patch b/SOURCES/openvswitch-2.17.0.patch index 0b77caf..62493c2 100644 --- a/SOURCES/openvswitch-2.17.0.patch +++ b/SOURCES/openvswitch-2.17.0.patch @@ -51681,9 +51681,18 @@ index d344514343..1afcc65adb 100644 } diff --git a/lib/dpctl.c b/lib/dpctl.c -index 29041fa3e3..0fc053e061 100644 +index 29041fa3e3..61553426d0 100644 --- a/lib/dpctl.c +++ b/lib/dpctl.c +@@ -672,7 +672,7 @@ show_dpif(struct dpif *dpif, struct dpctl_params *dpctl_p) + } + + for (int i = 0; i < n_port_nos; i++) { +- if (dpif_port_query_by_number(dpif, port_nos[i], &dpif_port)) { ++ if (dpif_port_query_by_number(dpif, port_nos[i], &dpif_port, true)) { + continue; + } + @@ -1727,26 +1727,23 @@ dpctl_flush_conntrack(int argc, const char *argv[], /* Report error if there are more than one unparsed argument. */ @@ -52812,10 +52821,52 @@ index 12477a24fe..b8ead8a02a 100644 * startup. Returning an error from this function will prevent any * datapath with this class from being created. diff --git a/lib/dpif.c b/lib/dpif.c -index 40f5fe4460..3305401fe0 100644 +index 40f5fe4460..4397aeaf4f 100644 --- a/lib/dpif.c +++ b/lib/dpif.c -@@ -1213,7 +1213,7 @@ dpif_execute_helper_cb(void *aux_, struct dp_packet_batch *packets_, +@@ -701,13 +701,14 @@ dpif_port_set_config(struct dpif *dpif, odp_port_t port_no, + * initializes '*port' appropriately; on failure, returns a positive errno + * value. + * +- * Retuns ENODEV if the port doesn't exist. ++ * Retuns ENODEV if the port doesn't exist. Will not log a warning in this ++ * case unless 'warn_if_not_found' is true. + * + * The caller owns the data in 'port' and must free it with + * dpif_port_destroy() when it is no longer needed. */ + int + dpif_port_query_by_number(const struct dpif *dpif, odp_port_t port_no, +- struct dpif_port *port) ++ struct dpif_port *port, bool warn_if_not_found) + { + int error = dpif->dpif_class->port_query_by_number(dpif, port_no, port); + if (!error) { +@@ -715,8 +716,13 @@ dpif_port_query_by_number(const struct dpif *dpif, odp_port_t port_no, + dpif_name(dpif), port_no, port->name); + } else { + memset(port, 0, sizeof *port); +- VLOG_WARN_RL(&error_rl, "%s: failed to query port %"PRIu32": %s", +- dpif_name(dpif), port_no, ovs_strerror(error)); ++ if (error == ENODEV && !warn_if_not_found) { ++ VLOG_DBG_RL(&dpmsg_rl, "%s: failed to query port %"PRIu32": %s", ++ dpif_name(dpif), port_no, ovs_strerror(error)); ++ } else { ++ VLOG_WARN_RL(&error_rl, "%s: failed to query port %"PRIu32": %s", ++ dpif_name(dpif), port_no, ovs_strerror(error)); ++ } + } + return error; + } +@@ -784,7 +790,7 @@ dpif_port_get_name(struct dpif *dpif, odp_port_t port_no, + + ovs_assert(name_size > 0); + +- error = dpif_port_query_by_number(dpif, port_no, &port); ++ error = dpif_port_query_by_number(dpif, port_no, &port, true); + if (!error) { + ovs_strlcpy(name, port.name, name_size); + dpif_port_destroy(&port); +@@ -1213,7 +1219,7 @@ dpif_execute_helper_cb(void *aux_, struct dp_packet_batch *packets_, /* The Linux kernel datapath throws away the tunnel information * that we supply as metadata. We have to use a "set" action to * supply it. */ @@ -52824,7 +52875,7 @@ index 40f5fe4460..3305401fe0 100644 odp_put_tunnel_action(&md->tunnel, &execute_actions, NULL); } ofpbuf_put(&execute_actions, action, NLA_ALIGN(action->nla_len)); -@@ -2109,3 +2109,9 @@ dpif_cache_set_size(struct dpif *dpif, uint32_t level, uint32_t size) +@@ -2109,3 +2115,9 @@ dpif_cache_set_size(struct dpif *dpif, uint32_t level, uint32_t size) ? dpif->dpif_class->cache_set_size(dpif, level, size) : EOPNOTSUPP; } @@ -52835,9 +52886,18 @@ index 40f5fe4460..3305401fe0 100644 + return dpif->dpif_class->synced_dp_layers; +} diff --git a/lib/dpif.h b/lib/dpif.h -index 6cb4dae6d8..129cbf6a1d 100644 +index 6cb4dae6d8..2a36497209 100644 --- a/lib/dpif.h +++ b/lib/dpif.h +@@ -461,7 +461,7 @@ void dpif_port_clone(struct dpif_port *, const struct dpif_port *); + void dpif_port_destroy(struct dpif_port *); + bool dpif_port_exists(const struct dpif *dpif, const char *devname); + int dpif_port_query_by_number(const struct dpif *, odp_port_t port_no, +- struct dpif_port *); ++ struct dpif_port *, bool warn_if_not_found); + int dpif_port_query_by_name(const struct dpif *, const char *devname, + struct dpif_port *); + int dpif_port_get_name(struct dpif *, odp_port_t port_no, @@ -939,6 +939,7 @@ int dpif_get_pmds_for_port(const struct dpif * dpif, odp_port_t port_no, char *dpif_get_dp_version(const struct dpif *); bool dpif_supports_tnl_push_pop(const struct dpif *); @@ -61303,7 +61363,7 @@ index 851088d794..2ba90e999c 100644 void xlate_bundle_set(struct ofproto_dpif *, struct ofbundle *, const char *name, enum port_vlan_mode, diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c -index 8143dd965f..b3e575bcd0 100644 +index 8143dd965f..bd235ce2b8 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -215,10 +215,6 @@ struct shash all_dpif_backers = SHASH_INITIALIZER(&all_dpif_backers); @@ -61438,7 +61498,42 @@ index 8143dd965f..b3e575bcd0 100644 &ofproto->up.expirable) { rule_expire(rule_dpif_cast(rule), now); } -@@ -2346,6 +2329,7 @@ set_ipfix( +@@ -2178,8 +2161,7 @@ port_destruct(struct ofport *port_, bool del) + struct ofproto_dpif *ofproto = ofproto_dpif_cast(port->up.ofproto); + const char *devname = netdev_get_name(port->up.netdev); + const char *netdev_type = netdev_get_type(port->up.netdev); +- char namebuf[NETDEV_VPORT_NAME_BUFSIZE]; +- const char *dp_port_name; ++ struct dpif_port dpif_port; + + ofproto->backer->need_revalidate = REV_RECONFIGURE; + xlate_txn_start(); +@@ -2193,9 +2175,13 @@ port_destruct(struct ofport *port_, bool del) + del = dpif_cleanup_required(ofproto->backer->dpif); + } + +- dp_port_name = netdev_vport_get_dpif_port(port->up.netdev, namebuf, +- sizeof namebuf); +- if (del && dpif_port_exists(ofproto->backer->dpif, dp_port_name)) { ++ /* Don't try to delete ports that are not part of the datapath. */ ++ if (del && port->odp_port == ODPP_NONE) { ++ del = false; ++ } ++ ++ if (del && !dpif_port_query_by_number(ofproto->backer->dpif, ++ port->odp_port, &dpif_port, false)) { + /* The underlying device is still there, so delete it. This + * happens when the ofproto is being destroyed, since the caller + * assumes that removal of attached ports will happen as part of +@@ -2203,6 +2189,7 @@ port_destruct(struct ofport *port_, bool del) + if (!port->is_tunnel) { + dpif_port_del(ofproto->backer->dpif, port->odp_port, false); + } ++ dpif_port_destroy(&dpif_port); + } else if (del) { + /* The underlying device is already deleted (e.g. tunctl -d). + * Calling dpif_port_remove to do local cleanup for the netdev */ +@@ -2346,6 +2333,7 @@ set_ipfix( struct dpif_ipfix *di = ofproto->ipfix; bool has_options = bridge_exporter_options || flow_exporters_options; bool new_di = false; @@ -61446,7 +61541,7 @@ index 8143dd965f..b3e575bcd0 100644 if (has_options && !di) { di = ofproto->ipfix = dpif_ipfix_create(); -@@ -2355,7 +2339,7 @@ set_ipfix( +@@ -2355,7 +2343,7 @@ set_ipfix( if (di) { /* Call set_options in any case to cleanly flush the flow * caches in the last exporters that are to be destroyed. */ @@ -61455,7 +61550,7 @@ index 8143dd965f..b3e575bcd0 100644 di, bridge_exporter_options, flow_exporters_options, n_flow_exporters_options); -@@ -2371,6 +2355,10 @@ set_ipfix( +@@ -2371,6 +2359,10 @@ set_ipfix( dpif_ipfix_unref(di); ofproto->ipfix = NULL; } @@ -61466,7 +61561,7 @@ index 8143dd965f..b3e575bcd0 100644 } return 0; -@@ -2493,11 +2481,11 @@ set_lldp(struct ofport *ofport_, +@@ -2493,11 +2485,11 @@ set_lldp(struct ofport *ofport_, { struct ofport_dpif *ofport = ofport_dpif_cast(ofport_); struct ofproto_dpif *ofproto = ofproto_dpif_cast(ofport->up.ofproto); @@ -61480,7 +61575,7 @@ index 8143dd965f..b3e575bcd0 100644 ofport->lldp = lldp_create(ofport->up.netdev, ofport_->mtu, cfg); } -@@ -2509,6 +2497,9 @@ set_lldp(struct ofport *ofport_, +@@ -2509,6 +2501,9 @@ set_lldp(struct ofport *ofport_, } else if (ofport->lldp) { lldp_unref(ofport->lldp); ofport->lldp = NULL; @@ -61490,7 +61585,7 @@ index 8143dd965f..b3e575bcd0 100644 ofproto->backer->need_revalidate = REV_RECONFIGURE; } -@@ -3106,11 +3097,11 @@ bundle_flush_macs(struct ofbundle *bundle, bool all_ofprotos) +@@ -3106,11 +3101,11 @@ bundle_flush_macs(struct ofbundle *bundle, bool all_ofprotos) { struct ofproto_dpif *ofproto = bundle->ofproto; struct mac_learning *ml = ofproto->ml; @@ -61504,7 +61599,7 @@ index 8143dd965f..b3e575bcd0 100644 if (mac_entry_get_port(ml, mac) == bundle) { if (all_ofprotos) { struct ofproto_dpif *o; -@@ -3141,13 +3132,13 @@ bundle_move(struct ofbundle *old, struct ofbundle *new) +@@ -3141,13 +3136,13 @@ bundle_move(struct ofbundle *old, struct ofbundle *new) { struct ofproto_dpif *ofproto = old->ofproto; struct mac_learning *ml = ofproto->ml; @@ -61520,7 +61615,7 @@ index 8143dd965f..b3e575bcd0 100644 if (mac_entry_get_port(ml, mac) == old) { mac_entry_set_port(ml, mac, new); } -@@ -3244,7 +3235,7 @@ static void +@@ -3244,7 +3239,7 @@ static void bundle_destroy(struct ofbundle *bundle) { struct ofproto_dpif *ofproto; @@ -61529,7 +61624,7 @@ index 8143dd965f..b3e575bcd0 100644 if (!bundle) { return; -@@ -3257,7 +3248,7 @@ bundle_destroy(struct ofbundle *bundle) +@@ -3257,7 +3252,7 @@ bundle_destroy(struct ofbundle *bundle) xlate_bundle_remove(bundle); xlate_txn_commit(); @@ -61538,7 +61633,7 @@ index 8143dd965f..b3e575bcd0 100644 bundle_del_port(port); } -@@ -3347,9 +3338,7 @@ bundle_set(struct ofproto *ofproto_, void *aux, +@@ -3347,9 +3342,7 @@ bundle_set(struct ofproto *ofproto_, void *aux, } } if (!ok || ovs_list_size(&bundle->ports) != s->n_members) { @@ -61549,7 +61644,7 @@ index 8143dd965f..b3e575bcd0 100644 for (i = 0; i < s->n_members; i++) { if (s->members[i] == port->up.ofp_port) { goto found; -@@ -3963,6 +3952,10 @@ port_add(struct ofproto *ofproto_, struct netdev *netdev) +@@ -3963,6 +3956,10 @@ port_add(struct ofproto *ofproto_, struct netdev *netdev) simap_put(&ofproto->backer->tnl_backers, dp_port_name, odp_to_u32(port_no)); } @@ -61560,7 +61655,7 @@ index 8143dd965f..b3e575bcd0 100644 } if (netdev_get_tunnel_config(netdev)) { -@@ -4471,12 +4464,14 @@ rule_dpif_lookup_from_table(struct ofproto_dpif *ofproto, +@@ -4471,12 +4468,14 @@ rule_dpif_lookup_from_table(struct ofproto_dpif *ofproto, atomic_add_relaxed(&tbl->n_matched, stats->n_packets, &orig); } if (xcache) { @@ -61580,7 +61675,7 @@ index 8143dd965f..b3e575bcd0 100644 } return rule; } -@@ -4507,12 +4502,14 @@ rule_dpif_lookup_from_table(struct ofproto_dpif *ofproto, +@@ -4507,12 +4506,14 @@ rule_dpif_lookup_from_table(struct ofproto_dpif *ofproto, stats->n_packets, &orig); } if (xcache) { @@ -61600,7 +61695,7 @@ index 8143dd965f..b3e575bcd0 100644 } if (rule) { goto out; /* Match. */ -@@ -5550,9 +5547,9 @@ ct_zone_timeout_policy_sweep(struct dpif_backer *backer) +@@ -5550,9 +5551,9 @@ ct_zone_timeout_policy_sweep(struct dpif_backer *backer) { if (!ovs_list_is_empty(&backer->ct_tp_kill_list) && time_msec() >= timeout_policy_cleanup_timer) { @@ -61612,7 +61707,7 @@ index 8143dd965f..b3e575bcd0 100644 if (!ct_dpif_del_timeout_policy(backer->dpif, ct_tp->tp_id)) { ovs_list_remove(&ct_tp->list_node); ct_timeout_policy_destroy(ct_tp, backer->tp_ids); -@@ -5594,6 +5591,7 @@ ct_set_zone_timeout_policy(const char *datapath_type, uint16_t zone_id, +@@ -5594,6 +5595,7 @@ ct_set_zone_timeout_policy(const char *datapath_type, uint16_t zone_id, ct_timeout_policy_unref(backer, ct_zone->ct_tp); ct_zone->ct_tp = ct_tp; ct_tp->ref_count++; @@ -61620,7 +61715,7 @@ index 8143dd965f..b3e575bcd0 100644 } } else { struct ct_zone *new_ct_zone = ct_zone_alloc(zone_id); -@@ -5601,6 +5599,7 @@ ct_set_zone_timeout_policy(const char *datapath_type, uint16_t zone_id, +@@ -5601,6 +5603,7 @@ ct_set_zone_timeout_policy(const char *datapath_type, uint16_t zone_id, cmap_insert(&backer->ct_zones, &new_ct_zone->node, hash_int(zone_id, 0)); ct_tp->ref_count++; @@ -61628,7 +61723,7 @@ index 8143dd965f..b3e575bcd0 100644 } } -@@ -5617,6 +5616,7 @@ ct_del_zone_timeout_policy(const char *datapath_type, uint16_t zone_id) +@@ -5617,6 +5620,7 @@ ct_del_zone_timeout_policy(const char *datapath_type, uint16_t zone_id) if (ct_zone) { ct_timeout_policy_unref(backer, ct_zone->ct_tp); ct_zone_remove_and_destroy(backer, ct_zone); @@ -61636,7 +61731,7 @@ index 8143dd965f..b3e575bcd0 100644 } } -@@ -5818,15 +5818,7 @@ ofproto_dpif_lookup_by_name(const char *name) +@@ -5818,15 +5822,7 @@ ofproto_dpif_lookup_by_name(const char *name) struct ofproto_dpif * ofproto_dpif_lookup_by_uuid(const struct uuid *uuid) { @@ -69587,10 +69682,10 @@ index c3ee6990ca..7d2715c4a7 100644 Miniflow extract implementation set to autovalidator. ]) diff --git a/tests/system-interface.at b/tests/system-interface.at -index 784bada12c..3bf339582d 100644 +index 784bada12c..15e789a245 100644 --- a/tests/system-interface.at +++ b/tests/system-interface.at -@@ -63,3 +63,62 @@ AT_CHECK([ +@@ -63,3 +63,119 @@ AT_CHECK([ [stdout], [Device "br-p1" does not exist.] ) AT_CLEANUP @@ -69653,6 +69748,63 @@ index 784bada12c..3bf339582d 100644 + +OVS_TRAFFIC_VSWITCHD_STOP +AT_CLEANUP ++ ++AT_SETUP([interface - datapath port rename]) ++OVS_TRAFFIC_VSWITCHD_START() ++ ++dnl Not relevant for userspace datapath. ++AT_SKIP_IF([! ovs-appctl dpctl/show | grep -q ovs-system]) ++ ++AT_CHECK([ip link add ovs-veth0 type veth peer name ovs-veth1]) ++dnl We will rename ovs-veth0, so removing the peer on exit. ++on_exit 'ip link del ovs-veth1' ++ ++AT_CHECK([ovs-vsctl add-port br0 ovs-veth0]) ++ ++OVS_WAIT_UNTIL([ip link show | grep -q "ovs-veth0.* ovs-system "]) ++ ++AT_CHECK([ovs-appctl dpctl/show | grep port], [0], [dnl ++ port 0: ovs-system (internal) ++ port 1: br0 (internal) ++ port 2: ovs-veth0 ++]) ++ ++dnl Rename the interface while attached to OVS. ++AT_CHECK([ip l set ovs-veth0 name ovs-new-port]) ++ ++dnl Wait for the port to be detached from the OVS datapath. ++OVS_WAIT_UNTIL([ip link show | grep "ovs-new-port" | grep -v "ovs-system"]) ++ ++dnl Check that database indicates the error. ++AT_CHECK([ovs-vsctl get interface ovs-veth0 error], [0], [dnl ++"could not open network device ovs-veth0 (No such device)" ++]) ++ ++dnl Check that the port is no longer in the datapath. ++AT_CHECK([ovs-appctl dpctl/show | grep port], [0], [dnl ++ port 0: ovs-system (internal) ++ port 1: br0 (internal) ++]) ++ ++dnl Rename the interface back and check that it is in use again. ++AT_CHECK([ip l set ovs-new-port name ovs-veth0]) ++ ++OVS_WAIT_UNTIL([ip link show | grep -q "ovs-veth0.* ovs-system "]) ++ ++AT_CHECK([ovs-vsctl get interface ovs-veth0 error], [0], [dnl ++[[]] ++]) ++ ++AT_CHECK([ovs-appctl dpctl/show | grep port], [0], [dnl ++ port 0: ovs-system (internal) ++ port 1: br0 (internal) ++ port 2: ovs-veth0 ++]) ++ ++OVS_TRAFFIC_VSWITCHD_STOP([" ++ /could not open network device ovs-veth0 (No such device)/d ++"]) ++AT_CLEANUP diff --git a/tests/system-kmod-macros.at b/tests/system-kmod-macros.at index 86d633ac4f..a9c7398e1c 100644 --- a/tests/system-kmod-macros.at diff --git a/SPECS/openvswitch2.17.spec b/SPECS/openvswitch2.17.spec index 6519f57..ec35b8d 100644 --- a/SPECS/openvswitch2.17.spec +++ b/SPECS/openvswitch2.17.spec @@ -57,7 +57,7 @@ Summary: Open vSwitch Group: System Environment/Daemons daemon/database/utilities URL: http://www.openvswitch.org/ Version: 2.17.0 -Release: 95%{?dist} +Release: 96%{?dist} # Nearly all of openvswitch is ASL 2.0. The bugtool is LGPLv2+, and the # lib/sflow*.[ch] files are SISSL @@ -751,6 +751,12 @@ exit 0 %endif %changelog +* Wed Aug 02 2023 Open vSwitch CI - 2.17.0-96 +- Merging upstream branch-2.17 [RH git: 507c546250] + Commit list: + dba7482e02 ofproto-dpif: Fix removal of renamed datapath ports. + + * Fri Jul 21 2023 Open vSwitch CI - 2.17.0-95 - Merging upstream branch-2.17 [RH git: 99709cc365] Commit list: