Skip to content

Commit

Permalink
ofproto-dpif: Restore packet metadata when a continuation is resumed.
Browse files Browse the repository at this point in the history
Recirculations due to NXT_RESUME are failing if the packet metadata is not
restored prior to the packet execution.

Reported-at: http://openvswitch.org/pipermail/dev/2016-May/070723.html
Signed-off-by: Numan Siddique <[email protected]>
Signed-off-by: Jarno Rajahalme <[email protected]>
  • Loading branch information
numansiddique authored and Jarno Rajahalme committed May 10, 2016
1 parent 2ff8484 commit 1df7f7a
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions ofproto/ofproto-dpif.c
Original file line number Diff line number Diff line change
Expand Up @@ -3656,6 +3656,16 @@ rule_expire(struct rule_dpif *rule)
}
}

static void
ofproto_dpif_set_packet_odp_port(const struct ofproto_dpif *ofproto,
ofp_port_t in_port, struct dp_packet *packet)
{
if (in_port == OFPP_NONE) {
in_port = OFPP_LOCAL;
}
packet->md.in_port.odp_port = ofp_port_to_odp_port(ofproto, in_port);
}

int
ofproto_dpif_execute_actions__(struct ofproto_dpif *ofproto,
const struct flow *flow,
Expand All @@ -3667,7 +3677,6 @@ ofproto_dpif_execute_actions__(struct ofproto_dpif *ofproto,
struct dpif_flow_stats stats;
struct xlate_out xout;
struct xlate_in xin;
ofp_port_t in_port;
struct dpif_execute execute;
int error;

Expand Down Expand Up @@ -3704,11 +3713,7 @@ ofproto_dpif_execute_actions__(struct ofproto_dpif *ofproto,
execute.mtu = 0;

/* Fix up in_port. */
in_port = flow->in_port.ofp_port;
if (in_port == OFPP_NONE) {
in_port = OFPP_LOCAL;
}
execute.packet->md.in_port.odp_port = ofp_port_to_odp_port(ofproto, in_port);
ofproto_dpif_set_packet_odp_port(ofproto, flow->in_port.ofp_port, packet);

error = dpif_execute(ofproto->backer->dpif, &execute);
out:
Expand Down Expand Up @@ -4399,6 +4404,13 @@ nxt_resume(struct ofproto *ofproto_,
dp_packet_init(&packet, pin->public.packet_len);
dp_packet_put(&packet, pin->public.packet, pin->public.packet_len);

pkt_metadata_from_flow(&packet.md, &pin->public.flow_metadata.flow);

/* Fix up in_port. */
ofproto_dpif_set_packet_odp_port(ofproto,
pin->public.flow_metadata.flow.in_port.ofp_port,
&packet);

struct flow headers;
flow_extract(&packet, &headers);

Expand Down

0 comments on commit 1df7f7a

Please sign in to comment.