From 58c6adda89411391d076ee45e503c2788c61ebf5 Mon Sep 17 00:00:00 2001 From: Ethan Jackson Date: Thu, 24 Jan 2013 20:07:51 -0800 Subject: [PATCH] ofproto-dpif: Use ofproto_receive() in update_stats(). This removes a bit of duplicate code, and will be necessary to support future patches. Signed-off-by: Ethan Jackson --- ofproto/ofproto-dpif.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 1d08bafb8..10860366e 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -3918,29 +3918,15 @@ update_stats(struct dpif_backer *backer) while (dpif_flow_dump_next(&dump, &key, &key_len, NULL, NULL, &stats)) { struct flow flow; struct subfacet *subfacet; - enum odp_key_fitness fitness; struct ofproto_dpif *ofproto; - struct ofport_dpif *port; uint32_t key_hash; - fitness = odp_flow_key_to_flow(key, key_len, &flow); - if (fitness == ODP_FIT_ERROR) { - continue; - } - - port = odp_port_to_ofport(backer, flow.in_port); - if (!port) { - /* This flow is for a port for which we couldn't associate an - * ofproto. This can happen if a port is removed while - * traffic is being received. Ignore this flow, since it - * will get timed out. */ + if (ofproto_receive(backer, NULL, key, key_len, &flow, NULL, &ofproto, + NULL, NULL)) { continue; } - ofproto = ofproto_dpif_cast(port->up.ofproto); - flow.in_port = port->up.ofp_port; key_hash = odp_flow_key_hash(key, key_len); - subfacet = subfacet_find(ofproto, key, key_len, key_hash, &flow); switch (subfacet ? subfacet->path : SF_NOT_INSTALLED) { case SF_FAST_PATH: -- 2.43.0