Skip to content

Commit

Permalink
Logic to reset statistics of the evicted reverse flow
Browse files Browse the repository at this point in the history
The point where we reset statistics for an evicted flow is when we
trap the first packet to the agent. The trap message carries the
old statistics. However, for the reverse flow, there is no trap.
Hence, the statistics of the evicted reverse flow entry is sent
back to the agent in the sandesh flow message and reset once the
agent tries to add the reverse flow entry.

Change-Id: Ic67318b9632f39560292512be503f90eb6f33068
Closes-BUG: 1362701
  • Loading branch information
anandhk-juniper committed Nov 30, 2015
1 parent 9d275b8 commit 8d9a87f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 12 additions & 1 deletion dp-core/vr_flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -1688,6 +1688,17 @@ vr_flow_set(struct vrouter *router, vr_flow_req *req)

fe->fe_flags = VR_FLOW_FLAG_MASK(req->fr_flags);
if (new_flow) {

req->fr_flow_bytes = fe->fe_stats.flow_bytes;
req->fr_flow_packets = fe->fe_stats.flow_packets;
req->fr_flow_stats_oflow = (fe->fe_stats.flow_bytes_oflow |
(fe->fe_stats.flow_packets_oflow << 16));

if (fe->fe_flags & VR_FLOW_FLAG_NEW_FLOW) {
if (fe->fe_stats.flow_packets || fe->fe_stats.flow_packets_oflow)
memset(&fe->fe_stats, 0, sizeof(fe->fe_stats));
}

if (fe->fe_flags & VR_RFLOW_VALID) {
rfe = vr_get_flow_entry(router, fe->fe_rflow);
if (rfe) {
Expand All @@ -1702,7 +1713,7 @@ vr_flow_set(struct vrouter *router, vr_flow_req *req)
vr_flow_udp_src_port(router, fe);

if (fe->fe_flags & VR_FLOW_FLAG_NEW_FLOW)
fe->fe_flags ^= VR_FLOW_FLAG_NEW_FLOW;
fe->fe_flags &= ~VR_FLOW_FLAG_NEW_FLOW;

ret = vr_flow_schedule_transition(router, req, fe);

Expand Down
3 changes: 3 additions & 0 deletions sandesh/vr.sandesh
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ buffer sandesh vr_flow_req {
31: i32 fr_hold_oflows;
32: list<i32> fr_hold_stat;
33: i32 fr_oflow_entries;
34: u32 fr_flow_bytes;
35: u32 fr_flow_packets;
36: u32 fr_flow_stats_oflow;
}

buffer sandesh vr_vrf_assign_req {
Expand Down

0 comments on commit 8d9a87f

Please sign in to comment.