+ /* Since the sock can only be assigned in either all or none
+ * of "dpif->handlers" channels, the following check would
+ * suffice. */
+ if (!dpif->handlers[0].channels[i].sock) {
+ continue;
+ }
+
+ /* Turn off upcalls. */
+ dpif_linux_vport_init(&vport_request);
+ vport_request.cmd = OVS_VPORT_CMD_SET;
+ vport_request.dp_ifindex = dpif->dp_ifindex;
+ vport_request.port_no = u32_to_odp(i);
+ vport_request.upcall_pids = &upcall_pids;
+ dpif_linux_vport_transact(&vport_request, NULL, NULL);
+
+ vport_del_channels(dpif, u32_to_odp(i));
+ }
+
+ for (i = 0; i < dpif->n_handlers; i++) {
+ struct dpif_handler *handler = &dpif->handlers[i];
+
+ close(handler->epoll_fd);
+ free(handler->epoll_events);
+ free(handler->channels);
+ }
+
+ free(dpif->handlers);
+ dpif->handlers = NULL;
+ dpif->n_handlers = 0;
+ dpif->uc_array_size = 0;