Skip to content

Commit

Permalink
ofp-actions: Translate OF1.0 "enqueue" actions for OF1.1+.
Browse files Browse the repository at this point in the history
Previously, the OF1.0 "enqueue" action was simply omitted when actions
were translated into OpenFlow 1.1 or later, which do not have a similar
action.  This commit translates this action into an equivalent sequence
of actions.

Signed-off-by: Ben Pfaff <[email protected]>
Acked-by: Jarno Rajahalme <[email protected]>
  • Loading branch information
blp committed Jul 14, 2016
1 parent ae3b45b commit 0f2aaee
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Post-v2.5.0
* New command OFPGC_ADD_OR_MOD for OFPT_GROUP_MOD message that adds a
new group or modifies an existing groups
* New OpenFlow extension to support the "group" action in OpenFlow 1.0.
* OpenFlow 1.0 "enqueue" action now properly translated to OpenFlow 1.1+.
- ovs-ofctl:
* queue-get-config command now allows a queue ID to be specified.
* '--bundle' option can now be used with OpenFlow 1.3.
Expand Down
8 changes: 7 additions & 1 deletion lib/ofp-actions.c
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,13 @@ encode_ENQUEUE(const struct ofpact_enqueue *enqueue,
oae->port = htons(ofp_to_u16(enqueue->port));
oae->queue_id = htonl(enqueue->queue);
} else {
/* XXX */
put_OFPAT_SET_QUEUE(out, ofp_version, enqueue->queue);

struct ofp11_action_output *oao = put_OFPAT11_OUTPUT(out);
oao->port = ofputil_port_to_ofp11(enqueue->port);
oao->max_len = OVS_BE16_MAX;

put_NXAST_POP_QUEUE(out);
}
}

Expand Down
17 changes: 17 additions & 0 deletions tests/ofp-actions.at
Original file line number Diff line number Diff line change
Expand Up @@ -751,3 +751,20 @@ NXST_FLOW reply:
])
OVS_VSWITCHD_STOP
AT_CLEANUP

AT_SETUP([enqueue action for OF1.1+])
AT_KEYWORDS([ofp-actions])
OVS_VSWITCHD_START
dnl OpenFlow 1.0 has an "enqueue" action. For OpenFlow 1.1+, we translate
dnl it to a series of actions that accomplish the same thing.
AT_CHECK([ovs-ofctl -O OpenFlow10 add-flow br0 'actions=enqueue(123,456)'])
AT_CHECK([ovs-ofctl -O OpenFlow10 dump-flows br0 | ofctl_strip], [0], [dnl
NXST_FLOW reply:
actions=enqueue:123:456
])
AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip], [0], [dnl
OFPST_FLOW reply (OF1.3):
reset_counts actions=set_queue:456,output:123,pop_queue
])
OVS_VSWITCHD_STOP
AT_CLEANUP

0 comments on commit 0f2aaee

Please sign in to comment.