mirror of
https://github.com/openvswitch/ovs
synced 2025-09-01 14:55:18 +00:00
ofproto-dpif: Query port existence by name to prevent warnings.
The port_destruct() function checks if the port still exists in the datapath to see if additional cleanup is necessary. It used dpif_port_query_by_number(), since the datapath port number is readily available and cheap to use as a lookup handle. Unfortunately, that function logs a warning message if a port with that number doesn't exist (because the datapath did remove it), which is confusing. The dpif_port_query_by_name() function doesn't log such an warning, so use it instead. Signed-off-by: Justin Pettit <jpettit@nicira.com>
This commit is contained in:
@@ -1538,19 +1538,17 @@ port_destruct(struct ofport *port_)
|
|||||||
{
|
{
|
||||||
struct ofport_dpif *port = ofport_dpif_cast(port_);
|
struct ofport_dpif *port = ofport_dpif_cast(port_);
|
||||||
struct ofproto_dpif *ofproto = ofproto_dpif_cast(port->up.ofproto);
|
struct ofproto_dpif *ofproto = ofproto_dpif_cast(port->up.ofproto);
|
||||||
struct dpif_port dpif_port;
|
const char *devname = netdev_get_name(port->up.netdev);
|
||||||
|
|
||||||
if (!dpif_port_query_by_number(ofproto->backer->dpif,
|
if (dpif_port_exists(ofproto->backer->dpif, devname)) {
|
||||||
port->odp_port, &dpif_port)) {
|
|
||||||
/* The underlying device is still there, so delete it. This
|
/* The underlying device is still there, so delete it. This
|
||||||
* happens when the ofproto is being destroyed, since the caller
|
* happens when the ofproto is being destroyed, since the caller
|
||||||
* assumes that removal of attached ports will happen as part of
|
* assumes that removal of attached ports will happen as part of
|
||||||
* destruction. */
|
* destruction. */
|
||||||
dpif_port_del(ofproto->backer->dpif, port->odp_port);
|
dpif_port_del(ofproto->backer->dpif, port->odp_port);
|
||||||
dpif_port_destroy(&dpif_port);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sset_find_and_delete(&ofproto->ports, netdev_get_name(port->up.netdev));
|
sset_find_and_delete(&ofproto->ports, devname);
|
||||||
hmap_remove(&ofproto->backer->odp_to_ofport_map, &port->odp_port_node);
|
hmap_remove(&ofproto->backer->odp_to_ofport_map, &port->odp_port_node);
|
||||||
ofproto->need_revalidate = REV_RECONFIGURE;
|
ofproto->need_revalidate = REV_RECONFIGURE;
|
||||||
bundle_remove(port_);
|
bundle_remove(port_);
|
||||||
|
Reference in New Issue
Block a user