From fde05aded2906e113d02aa13d207d9a6e3e0ea99 Mon Sep 17 00:00:00 2001 From: Jesse Gross Date: Fri, 6 Nov 2009 14:18:58 -0800 Subject: [PATCH] udatapath: Implement ZERO_TCP_FLAGS option. An option to zero the TCP flags when querying flow stats was added to the kernel datapath to support NetFlow active timeouts. This adds that same support to the user datapath. --- lib/dpif-netdev.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 4c25f139..35724d9b 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -665,7 +665,7 @@ dp_netdev_lookup_flow(const struct dp_netdev *dp, const flow_t *key) } static void -answer_flow_query(const struct dp_netdev_flow *flow, +answer_flow_query(struct dp_netdev_flow *flow, uint32_t query_flags, struct odp_flow *odp_flow) { if (flow) { @@ -683,6 +683,11 @@ answer_flow_query(const struct dp_netdev_flow *flow, n * sizeof *odp_flow->actions); odp_flow->n_actions = flow->n_actions; } + + if (query_flags & ODPFF_ZERO_TCP_FLAGS) { + flow->tcp_ctl = 0; + } + } else { odp_flow->stats.error = ENOENT; } @@ -696,7 +701,8 @@ dpif_netdev_flow_get(const struct dpif *dpif, struct odp_flow flows[], int n) for (i = 0; i < n; i++) { struct odp_flow *odp_flow = &flows[i]; - answer_flow_query(dp_netdev_lookup_flow(dp, &odp_flow->key), odp_flow); + answer_flow_query(dp_netdev_lookup_flow(dp, &odp_flow->key), + odp_flow->flags, odp_flow); } return 0; } @@ -852,7 +858,7 @@ dpif_netdev_flow_del(struct dpif *dpif, struct odp_flow *odp_flow) flow = dp_netdev_lookup_flow(dp, &odp_flow->key); if (flow) { - answer_flow_query(flow, odp_flow); + answer_flow_query(flow, 0, odp_flow); dp_netdev_free_flow(dp, flow); return 0; } else { @@ -872,7 +878,7 @@ dpif_netdev_flow_list(const struct dpif *dpif, struct odp_flow flows[], int n) if (i >= n) { break; } - answer_flow_query(flow, &flows[i++]); + answer_flow_query(flow, 0, &flows[i++]); } return hmap_count(&dp->flow_table); } -- 2.30.2