summaryrefslogtreecommitdiff
path: root/lib/dpif-provider.h
diff options
context:
space:
mode:
authorDaniele Di Proietto <diproiettod@vmware.com>2017-01-05 20:21:23 -0800
committerDaniele Di Proietto <diproiettod@vmware.com>2017-01-06 15:12:44 -0800
commit0f6a066f638eb2ebf1b49b0e193fa1f5932edb61 (patch)
tree770784e8a1c680d2824d835a1ecbd3aa5d33e4f2 /lib/dpif-provider.h
parent5351980b047f4dd40be7a59a1e4b910df21eca0a (diff)
downloadopenvswitch-0f6a066f638eb2ebf1b49b0e193fa1f5932edb61.tar.gz
dpif: Return ENODEV from dpif_port_query_by_*() if there's no port.
bridge_delete_or_reconfigure() deletes every interface that's not dumped by OFPROTO_PORT_FOR_EACH(). ofproto_dpif.c:port_dump_next(), used by OFPROTO_PORT_FOR_EACH, checks if the ofport is in the datapath by calling port_query_by_name(). If port_query_by_name() returns an error, the dump is interrupted. If port_query_by_name() returns ENODEV, the device doesn't exist and the dump can continue. port_query_by_name() for the userspace datapath returns ENOENT instead of ENODEV. This is expected by dpif_port_query_by_name(), but it's not handled correctly by port_dump_next(). dpif-netdev handles reconfiguration errors for an interface by deleting it from the datapath, so it's possible that a device is missing. When this happens we must make sure that port_dump_next() continues to dump other devices, otherwise they will be deleted and the two layers will have an inconsistent view. This commit fixes the problem by returning ENODEV from the userspace datapath if the port doesn't exist, and by documenting this clearly in the dpif interfaces. The problem was found while developing new code. Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Acked-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'lib/dpif-provider.h')
-rw-r--r--lib/dpif-provider.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/dpif-provider.h b/lib/dpif-provider.h
index 56b88f93d..d3b2bb91d 100644
--- a/lib/dpif-provider.h
+++ b/lib/dpif-provider.h
@@ -176,6 +176,10 @@ struct dpif_class {
* If 'port' is not null, stores information about the port into
* '*port' if successful.
*
+ * If the port doesn't exist, the provider must return ENODEV. Other
+ * error numbers means that something wrong happened and will be
+ * treated differently by upper layers.
+ *
* If 'port' is not null, the caller takes ownership of data in
* 'port' and must free it with dpif_port_destroy() when it is no
* longer needed. */