Skip to content

Commit ad55200

Browse files
blpPravin B Shelar
authored andcommitted
openvswitch: Fix tracking of flags seen in TCP flows.
Flow statistics need to take into account the TCP flags from the packet currently being processed (in 'key'), not the TCP flags matched by the flow found in the kernel flow table (in 'flow'). This bug made the Open vSwitch userspace fin_timeout action have no effect in many cases. This bug is introduced by commit 88d73f6 (openvswitch: Use TCP flags in the flow key for stats.) Reported-by: Len Gao <leng@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com> Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
1 parent e0bb8c4 commit ad55200

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

‎net/openvswitch/datapath.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2007-2013 Nicira, Inc.
2+
* Copyright (c) 2007-2014 Nicira, Inc.
33
*
44
* This program is free software; you can redistribute it and/or
55
* modify it under the terms of version 2 of the GNU General Public
@@ -276,7 +276,7 @@ void ovs_dp_process_received_packet(struct vport *p, struct sk_buff *skb)
276276
OVS_CB(skb)->flow = flow;
277277
OVS_CB(skb)->pkt_key = &key;
278278

279-
ovs_flow_stats_update(OVS_CB(skb)->flow, skb);
279+
ovs_flow_stats_update(OVS_CB(skb)->flow, key.tp.flags, skb);
280280
ovs_execute_actions(dp, skb);
281281
stats_counter = &stats->n_hit;
282282

‎net/openvswitch/flow.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ u64 ovs_flow_used_time(unsigned long flow_jiffies)
6161

6262
#define TCP_FLAGS_BE16(tp) (*(__be16 *)&tcp_flag_word(tp) & htons(0x0FFF))
6363

64-
void ovs_flow_stats_update(struct sw_flow *flow, struct sk_buff *skb)
64+
void ovs_flow_stats_update(struct sw_flow *flow, __be16 tcp_flags,
65+
struct sk_buff *skb)
6566
{
6667
struct flow_stats *stats;
67-
__be16 tcp_flags = flow->key.tp.flags;
6868
int node = numa_node_id();
6969

7070
stats = rcu_dereference(flow->stats[node]);

‎net/openvswitch/flow.h‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2007-2013 Nicira, Inc.
2+
* Copyright (c) 2007-2014 Nicira, Inc.
33
*
44
* This program is free software; you can redistribute it and/or
55
* modify it under the terms of version 2 of the GNU General Public
@@ -180,7 +180,8 @@ struct arp_eth_header {
180180
unsigned char ar_tip[4]; /* target IP address */
181181
} __packed;
182182

183-
void ovs_flow_stats_update(struct sw_flow *, struct sk_buff *);
183+
void ovs_flow_stats_update(struct sw_flow *, __be16 tcp_flags,
184+
struct sk_buff *);
184185
void ovs_flow_stats_get(const struct sw_flow *, struct ovs_flow_stats *,
185186
unsigned long *used, __be16 *tcp_flags);
186187
void ovs_flow_stats_clear(struct sw_flow *);

0 commit comments

Comments
 (0)