openvswitch: Use TCP flags in the flow key for stats.
authorJarno Rajahalme <jrajahalme@nicira.com>
Thu, 27 Mar 2014 19:51:49 +0000 (12:51 -0700)
committerJesse Gross <jesse@nicira.com>
Fri, 16 May 2014 20:40:29 +0000 (13:40 -0700)
We already extract the TCP flags for the key, might as well use that
for stats.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
net/openvswitch/flow.c

index 432f04d5c896dd38fd97d3193ca06dda3dcdc6a9..e0fc12bbeeb165e89ce1a844a9df0a75910bcd12 100644 (file)
@@ -69,14 +69,12 @@ void ovs_flow_stats_update(struct sw_flow *flow, struct sk_buff *skb)
 
        stats = rcu_dereference(flow->stats[node]);
 
-       if ((flow->key.eth.type == htons(ETH_P_IP) ||
-            flow->key.eth.type == htons(ETH_P_IPV6)) &&
-           flow->key.ip.frag != OVS_FRAG_TYPE_LATER &&
-           flow->key.ip.proto == IPPROTO_TCP &&
-           likely(skb->len >= skb_transport_offset(skb) + sizeof(struct tcphdr))) {
-               tcp_flags = TCP_FLAGS_BE16(tcp_hdr(skb));
+       if (likely(flow->key.ip.proto == IPPROTO_TCP)) {
+               if (likely(flow->key.eth.type == htons(ETH_P_IP)))
+                       tcp_flags = flow->key.ipv4.tp.flags;
+               else if (likely(flow->key.eth.type == htons(ETH_P_IPV6)))
+                       tcp_flags = flow->key.ipv6.tp.flags;
        }
-
        /* Check if already have node-specific stats. */
        if (likely(stats)) {
                spin_lock(&stats->lock);