lib: Use tcp_flags from flow.
[sliver-openvswitch.git] / lib / dpif.c
index 117d720..08fffe4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@ COVERAGE_DEFINE(dpif_purge);
 COVERAGE_DEFINE(dpif_execute_with_help);
 
 static const struct dpif_class *base_dpif_classes[] = {
-#ifdef LINUX_DATAPATH
+#ifdef __linux__
     &dpif_linux_class,
 #endif
     &dpif_netdev_class,
@@ -778,7 +778,7 @@ void
 dpif_flow_stats_extract(const struct flow *flow, const struct ofpbuf *packet,
                         long long int used, struct dpif_flow_stats *stats)
 {
-    stats->tcp_flags = packet_get_tcp_flags(packet, flow);
+    stats->tcp_flags = ntohs(flow->tcp_flags);
     stats->n_bytes = packet->size;
     stats->n_packets = 1;
     stats->used = used;
@@ -1056,6 +1056,27 @@ dpif_flow_dump_next(struct dpif_flow_dump *dump, void *state,
     return !error;
 }
 
+/* Determines whether the next call to 'dpif_flow_dump_next' for 'dump' and
+ * 'state' will modify or free the keys that it previously returned. 'state'
+ * must have been initialized by a call to 'dpif_flow_dump_state_init' for
+ * 'dump'.
+ *
+ * 'dpif' guarantees that data returned by flow_dump_next() will remain
+ * accessible and unchanging until the next call. This function provides a way
+ * for callers to determine whether that guarantee extends beyond the next
+ * call.
+ *
+ * Returns true if the next call to flow_dump_next() is expected to be
+ * destructive to previously returned keys for 'state', false otherwise. */
+bool
+dpif_flow_dump_next_may_destroy_keys(struct dpif_flow_dump *dump, void *state)
+{
+    const struct dpif *dpif = dump->dpif;
+    return (dpif->dpif_class->flow_dump_next_may_destroy_keys
+            ? dpif->dpif_class->flow_dump_next_may_destroy_keys(state)
+            : true);
+}
+
 /* Completes flow table dump operation 'dump', which must have been initialized
  * with a successful call to dpif_flow_dump_start().  Returns 0 if the dump
  * operation was error-free, otherwise a positive errno value describing the