summaryrefslogtreecommitdiff
path: root/ofproto
diff options
context:
space:
mode:
authorYi-Hung Wei <yihung.wei@gmail.com>2017-04-17 14:11:30 -0700
committerBen Pfaff <blp@ovn.org>2017-04-24 09:54:22 -0700
commit331c07ac3418aa57853284678bbd40d728ea6992 (patch)
tree39f62f4451f5670515830abc515652bdf67df0bc /ofproto
parente19a67692d17301c6ebcd5d634f03a9a46da0a5d (diff)
downloadopenvswitch-331c07ac3418aa57853284678bbd40d728ea6992.tar.gz
ofproto: Add support of OFPR_PACKET_OUT as packet-in reason
This patch adds support of OFPR_PACKET_OUT as the packet-in reason. This packet-in reason is a required feature for OF1.4+, and it indicates that the associated packet-in message to the controller is triggered when the switch is processing a packet-out message. This reason code is enabled by default when OF1.4+ is used. 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.c7
-rw-r--r--ofproto/ofproto-dpif-xlate.h3
-rw-r--r--ofproto/ofproto-dpif.c1
3 files changed, 10 insertions, 1 deletions
diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 6a1e7f77d..73192478d 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -231,6 +231,8 @@ struct xlate_ctx {
int resubmits; /* Total number of resubmits. */
bool in_group; /* Currently translating ofgroup, if true. */
bool in_action_set; /* Currently translating action_set, if true. */
+ bool in_packet_out; /* Currently translating a packet_out msg, if
+ * true. */
uint8_t table_id; /* OpenFlow table ID where flow was found. */
ovs_be64 rule_cookie; /* Cookie of the rule being translated. */
@@ -4535,7 +4537,8 @@ xlate_output_action(struct xlate_ctx *ctx,
break;
case OFPP_CONTROLLER:
execute_controller_action(ctx, max_len,
- (ctx->in_group ? OFPR_GROUP
+ (ctx->in_packet_out ? OFPR_PACKET_OUT
+ : ctx->in_group ? OFPR_GROUP
: ctx->in_action_set ? OFPR_ACTION_SET
: OFPR_ACTION),
0, NULL, 0);
@@ -5917,6 +5920,7 @@ xlate_in_init(struct xlate_in *xin, struct ofproto_dpif *ofproto,
xin->resubmits = 0;
xin->wc = wc;
xin->odp_actions = odp_actions;
+ xin->in_packet_out = false;
/* Do recirc lookup. */
xin->frozen_state = NULL;
@@ -6179,6 +6183,7 @@ xlate_actions(struct xlate_in *xin, struct xlate_out *xout)
.resubmits = xin->resubmits,
.in_group = false,
.in_action_set = false,
+ .in_packet_out = xin->in_packet_out,
.table_id = 0,
.rule_cookie = OVS_BE64_MAX,
diff --git a/ofproto/ofproto-dpif-xlate.h b/ofproto/ofproto-dpif-xlate.h
index 12abfa32b..68e114afb 100644
--- a/ofproto/ofproto-dpif-xlate.h
+++ b/ofproto/ofproto-dpif-xlate.h
@@ -155,6 +155,9 @@ struct xlate_in {
/* The frozen state to be resumed, as returned by xlate_lookup(). */
const struct frozen_state *frozen_state;
+
+ /* If true, the packet to be translated is from a packet_out msg. */
+ bool in_packet_out;
};
void xlate_ofproto_set(struct ofproto_dpif *, const char *name, struct dpif *,
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 6108c84ad..c73c2738c 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -4404,6 +4404,7 @@ packet_xlate(struct ofproto *ofproto_, struct ofproto_packet_out *opo)
xin.allow_side_effects = false;
xin.resubmit_stats = NULL;
xin.xcache = &aux->xcache;
+ xin.in_packet_out = true;
if (xlate_actions(&xin, &xout) != XLATE_OK) {
error = OFPERR_OFPFMFC_UNKNOWN; /* Error processing actions. */