[ovs-dev] [PATCH v2 3/4] lib: Use tcp_flags from flow.

Jarno Rajahalme jrajahalme at nicira.com
Wed Mar 19 16:16:59 UTC 2014


TCP flags are already extracted from the flow, no need to parse them
again.

Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
---
v2: rebase

 lib/dpif-netdev.c             |    2 +-
 lib/dpif.c                    |    2 +-
 ofproto/ofproto-dpif-upcall.c |    2 +-
 ofproto/ofproto-dpif.c        |    6 ++----
 4 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 9305b36..21f0d9a 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -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;
 
diff --git a/lib/dpif.c b/lib/dpif.c
index b983b25..08fffe4 100644
--- a/lib/dpif.c
+++ b/lib/dpif.c
@@ -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;
diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c
index 005023a..db81dbe 100644
--- a/ofproto/ofproto-dpif-upcall.c
+++ b/ofproto/ofproto-dpif-upcall.c
@@ -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++;
 
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index d131ec2..1122f5f 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -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;
-- 
1.7.10.4




More information about the dev mailing list