From: Jarno Rajahalme Date: Wed, 19 Mar 2014 23:13:32 +0000 (-0700) Subject: lib: Use tcp_flags from flow. X-Git-Tag: sliver-openvswitch-2.2.90-1~6^2~72 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=e0eecb1ca122bd8a22058e42161bd93c8474a74f lib: Use tcp_flags from flow. TCP flags are already extracted from the flow, no need to parse them again. Signed-off-by: Jarno Rajahalme Signed-off-by: Ben Pfaff --- diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 9305b3620..21f0d9a58 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 b983b253d..08fffe430 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 005023a6c..db81dbecc 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 d131ec2a8..1122f5fa4 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;