lib: Use tcp_flags from flow.
authorJarno Rajahalme <jrajahalme@nicira.com>
Wed, 19 Mar 2014 23:13:32 +0000 (16:13 -0700)
committerJarno Rajahalme <jrajahalme@nicira.com>
Wed, 19 Mar 2014 23:13:32 +0000 (16:13 -0700)
TCP flags are already extracted from the flow, no need to parse them
again.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/dpif-netdev.c
lib/dpif.c
ofproto/ofproto-dpif-upcall.c
ofproto/ofproto-dpif.c

index 9305b36..21f0d9a 100644 (file)
@@ -1713,7 +1713,7 @@ dp_netdev_flow_used(struct dp_netdev_flow *netdev_flow,
                     const struct ofpbuf *packet,
                     const struct flow *key)
 {
-    uint16_t tcp_flags = packet_get_tcp_flags(packet, key);
+    uint16_t tcp_flags = ntohs(key->tcp_flags);
     long long int now = time_msec();
     struct dp_netdev_flow_stats *bucket;
 
index b983b25..08fffe4 100644 (file)
@@ -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;
index 005023a..db81dbe 100644 (file)
@@ -1031,7 +1031,7 @@ handle_upcalls(struct handler *handler, struct list *upcalls)
             } else {
                 miss = existing_miss;
             }
-            miss->stats.tcp_flags |= packet_get_tcp_flags(packet, &miss->flow);
+            miss->stats.tcp_flags |= ntohs(miss->flow.tcp_flags);
             miss->stats.n_bytes += packet->size;
             miss->stats.n_packets++;
 
index d131ec2..1122f5f 100644 (file)
@@ -3964,12 +3964,10 @@ ofproto_trace(struct ofproto_dpif *ofproto, const struct flow *flow,
     }
 
     if (rule || ofpacts) {
-        uint16_t tcp_flags;
-
-        tcp_flags = packet ? packet_get_tcp_flags(packet, flow) : 0;
         trace.result = ds;
         trace.flow = *flow;
-        xlate_in_init(&trace.xin, ofproto, flow, rule, tcp_flags, packet);
+        xlate_in_init(&trace.xin, ofproto, flow, rule, ntohs(flow->tcp_flags),
+                      packet);
         if (ofpacts) {
             trace.xin.ofpacts = ofpacts;
             trace.xin.ofpacts_len = ofpacts_len;