datapath: Drop port information from odp_stats.
[sliver-openvswitch.git] / lib / dpif.c
index 1fff27f..d744196 100644 (file)
@@ -561,6 +561,14 @@ dpif_port_query_by_name(const struct dpif *dpif, const char *devname,
     return error;
 }
 
+/* Returns one greater than the maximum port number accepted in flow
+ * actions. */
+int
+dpif_get_max_ports(const struct dpif *dpif)
+{
+    return dpif->dpif_class->get_max_ports(dpif);
+}
+
 /* Looks up port number 'port_no' in 'dpif'.  On success, returns 0 and copies
  * the port's name into the 'name_size' bytes in 'name', ensuring that the
  * result is null-terminated.  On failure, returns a positive errno value and
@@ -1030,30 +1038,14 @@ dpif_recv(struct dpif *dpif, struct dpif_upcall *upcall)
 }
 
 /* Discards all messages that would otherwise be received by dpif_recv() on
- * 'dpif'.  Returns 0 if successful, otherwise a positive errno value. */
-int
+ * 'dpif'. */
+void
 dpif_recv_purge(struct dpif *dpif)
 {
-    struct odp_stats stats;
-    unsigned int i;
-    int error;
-
     COVERAGE_INC(dpif_purge);
-
-    error = dpif_get_dp_stats(dpif, &stats);
-    if (error) {
-        return error;
-    }
-
-    for (i = 0; i < stats.max_miss_queue + stats.max_action_queue + stats.max_sflow_queue; i++) {
-        struct dpif_upcall upcall;
-        error = dpif_recv(dpif, &upcall);
-        if (error) {
-            return error == EAGAIN ? 0 : error;
-        }
-        ofpbuf_delete(upcall.packet);
+    if (dpif->dpif_class->recv_purge) {
+        dpif->dpif_class->recv_purge(dpif);
     }
-    return 0;
 }
 
 /* Arranges for the poll loop to wake up when 'dpif' has a message queued to be