summaryrefslogtreecommitdiff
path: root/ofproto
diff options
context:
space:
mode:
authorYi-Hung Wei <yihung.wei@gmail.com>2018-09-21 09:46:51 -0700
committerBen Pfaff <blp@ovn.org>2018-09-21 13:21:50 -0700
commit2f355bffcd9d465dea86f1dd415a24b9dbe42791 (patch)
tree33bd46e66b18a59a1b1171dd498b0bc388b64009 /ofproto
parentb37f8c15ca6ee079541b0c02ee77ce9d392b18fc (diff)
downloadopenvswitch-2f355bffcd9d465dea86f1dd415a24b9dbe42791.tar.gz
ofproto-dpif: Fix NXT_RESUME flow stats
Currently, OVS does not update the flow stats after a packet is restarted by NXT_RESUME message. This patch fixes the aforementioned issue and adds an unit test to prevent regression. Fixes: 77ab5fd2a95b ("Implement serializing the state of packet traversal in "continuations".") VMware-BZ: #2198435 Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'ofproto')
-rw-r--r--ofproto/ofproto-dpif-xlate.c10
-rw-r--r--ofproto/ofproto-dpif-xlate.h4
-rw-r--r--ofproto/ofproto-dpif.c13
3 files changed, 20 insertions, 7 deletions
diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 507e14dd0..d0e7c6b9f 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -7464,19 +7464,21 @@ enum ofperr
xlate_resume(struct ofproto_dpif *ofproto,
const struct ofputil_packet_in_private *pin,
struct ofpbuf *odp_actions,
- enum slow_path_reason *slow)
+ enum slow_path_reason *slow,
+ struct flow *flow,
+ struct xlate_cache *xcache)
{
struct dp_packet packet;
dp_packet_use_const(&packet, pin->base.packet,
pin->base.packet_len);
- struct flow flow;
- flow_extract(&packet, &flow);
+ flow_extract(&packet, flow);
struct xlate_in xin;
xlate_in_init(&xin, ofproto, ofproto_dpif_get_tables_version(ofproto),
- &flow, 0, NULL, ntohs(flow.tcp_flags),
+ flow, 0, NULL, ntohs(flow->tcp_flags),
&packet, NULL, odp_actions);
+ xin.xcache = xcache;
struct ofpact_note noop;
ofpact_init_NOTE(&noop);
diff --git a/ofproto/ofproto-dpif-xlate.h b/ofproto/ofproto-dpif-xlate.h
index 2cbb3c909..0a5a52887 100644
--- a/ofproto/ofproto-dpif-xlate.h
+++ b/ofproto/ofproto-dpif-xlate.h
@@ -230,8 +230,8 @@ void xlate_out_uninit(struct xlate_out *);
enum ofperr xlate_resume(struct ofproto_dpif *,
const struct ofputil_packet_in_private *,
- struct ofpbuf *odp_actions, enum slow_path_reason *);
-
+ struct ofpbuf *odp_actions, enum slow_path_reason *,
+ struct flow *, struct xlate_cache *);
int xlate_send_packet(const struct ofport_dpif *, bool oam, struct dp_packet *);
void xlate_mac_learning_update(const struct ofproto_dpif *ofproto,
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 0a0c69a7a..5ccf23955 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -5051,18 +5051,29 @@ nxt_resume(struct ofproto *ofproto_,
const struct ofputil_packet_in_private *pin)
{
struct ofproto_dpif *ofproto = ofproto_dpif_cast(ofproto_);
+ struct dpif_flow_stats stats;
+ struct xlate_cache xcache;
+ struct flow flow;
+ xlate_cache_init(&xcache);
/* Translate pin into datapath actions. */
uint64_t odp_actions_stub[1024 / 8];
struct ofpbuf odp_actions = OFPBUF_STUB_INITIALIZER(odp_actions_stub);
enum slow_path_reason slow;
- enum ofperr error = xlate_resume(ofproto, pin, &odp_actions, &slow);
+ enum ofperr error = xlate_resume(ofproto, pin, &odp_actions, &slow,
+ &flow, &xcache);
/* Steal 'pin->packet' and put it into a dp_packet. */
struct dp_packet packet;
dp_packet_init(&packet, pin->base.packet_len);
dp_packet_put(&packet, pin->base.packet, pin->base.packet_len);
+ /* Run the side effects from the xcache. */
+ dpif_flow_stats_extract(&flow, &packet, time_msec(), &stats);
+ ovs_mutex_lock(&ofproto_mutex);
+ ofproto_dpif_xcache_execute(ofproto, &xcache, &stats);
+ ovs_mutex_unlock(&ofproto_mutex);
+
pkt_metadata_from_flow(&packet.md, &pin->base.flow_metadata.flow);
/* Fix up in_port. */