[ovs-dev] [PATCH 4/5] lib: Use tcp_flags from flow.
Jarno Rajahalme
jrajahalme at nicira.com
Tue Mar 18 23:42:58 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>
---
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 827e8ae..ecc2007 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -1710,7 +1710,7 @@ dp_netdev_flow_used(struct dp_netdev_flow *netdev_flow,
netdev_flow->used = time_msec();
netdev_flow->packet_count++;
netdev_flow->byte_count += packet->size;
- netdev_flow->tcp_flags |= packet_get_tcp_flags(packet, key);
+ netdev_flow->tcp_flags |= ntohs(key->tcp_flags);
}
static void
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 c6236de..670dae5 100644
--- a/ofproto/ofproto-dpif-upcall.c
+++ b/ofproto/ofproto-dpif-upcall.c
@@ -1026,7 +1026,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 4b00d47..7a7145d 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -3966,12 +3966,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