X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fdpif-netdev.c;h=8a0363c948dba7f66423aa3dd30b836c05fd536f;hb=1ba530f4b2cd5476a224dbbf87a3089a831a24b6;hp=d17b82b69cf7a3ec006af0cc2bd109d8dbc8c117;hpb=ea7bd5973fb426f3a6ea66b0953c6000980e77ec;p=sliver-openvswitch.git diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index d17b82b69..8a0363c94 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -246,27 +246,32 @@ dpif_netdev_open(const struct dpif_class *class, const char *name, } static void -dp_netdev_free(struct dp_netdev *dp) +dp_netdev_purge_queues(struct dp_netdev *dp) { int i; - dp_netdev_flow_flush(dp); - while (dp->n_ports > 0) { - struct dp_netdev_port *port = CONTAINER_OF( - dp->port_list.next, struct dp_netdev_port, node); - do_del_port(dp, port->port_no); - } for (i = 0; i < N_QUEUES; i++) { struct dp_netdev_queue *q = &dp->queues[i]; - unsigned int j; - for (j = q->tail; j != q->head; j++) { - struct dpif_upcall *upcall = q->upcalls[j & QUEUE_MASK]; + while (q->tail != q->head) { + struct dpif_upcall *upcall = q->upcalls[q->tail++ & QUEUE_MASK]; ofpbuf_delete(upcall->packet); free(upcall); } } +} + +static void +dp_netdev_free(struct dp_netdev *dp) +{ + dp_netdev_flow_flush(dp); + while (dp->n_ports > 0) { + struct dp_netdev_port *port = CONTAINER_OF( + dp->port_list.next, struct dp_netdev_port, node); + do_del_port(dp, port->port_no); + } + dp_netdev_purge_queues(dp); hmap_destroy(&dp->flow_table); free(dp->name); free(dp); @@ -303,8 +308,6 @@ dpif_netdev_get_stats(const struct dpif *dpif, struct odp_stats *stats) stats->n_hit = dp->n_hit; stats->n_missed = dp->n_missed; stats->n_lost = dp->n_lost; - stats->max_miss_queue = MAX_QUEUE_LEN; - stats->max_action_queue = MAX_QUEUE_LEN; return 0; } @@ -1011,6 +1014,13 @@ dpif_netdev_recv_wait(struct dpif *dpif) * wake up to queue new messages, so there is nothing to do. */ } } + +static void +dpif_netdev_recv_purge(struct dpif *dpif) +{ + struct dpif_netdev *dpif_netdev = dpif_netdev_cast(dpif); + dp_netdev_purge_queues(dpif_netdev->dp); +} static void dp_netdev_flow_used(struct dp_netdev_flow *flow, struct flow *key, @@ -1403,6 +1413,7 @@ const struct dpif_class dpif_netdev_class = { NULL, /* queue_to_priority */ dpif_netdev_recv, dpif_netdev_recv_wait, + dpif_netdev_recv_purge, }; void