+static void
+call_local_port_changed_callbacks(struct port_watcher *pw)
+{
+ char name[OFP_MAX_PORT_NAME_LEN + 1];
+ const struct ofp_phy_port *port;
+ int i;
+
+ /* Pass the local port to the callbacks, if it exists.
+ Pass a null pointer if there is no local port. */
+ port = &pw->ports[port_no_to_pw_idx(OFPP_LOCAL)];
+ if (port->port_no != htons(OFPP_LOCAL)) {
+ port = NULL;
+ }
+
+ /* Log the name of the local port. */
+ if (port) {
+ get_port_name(port, name, sizeof name);
+ } else {
+ name[0] = '\0';
+ }
+ if (strcmp(pw->local_port_name, name)) {
+ VLOG_WARN("Identified data path local port as \"%s\".", name);
+ } else {
+ VLOG_WARN("Data path has no local port.");
+ }
+ strcpy(pw->local_port_name, name);
+
+ /* Invoke callbacks. */
+ for (i = 0; i < pw->n_local_cbs; i++) {
+ local_port_changed_cb_func *cb = pw->local_cbs[i].local_port_changed;
+ (cb)(port, pw->local_cbs[i].aux);
+ }
+}
+