From: Isaku Yamahata Date: Wed, 17 Oct 2012 18:51:58 +0000 (+0900) Subject: ofpaction: support OF11 pop_vlan X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e61c1104eddbe737a67cbf559fcb48971f59569;p=openvswitch ofpaction: support OF11 pop_vlan This patch adds support of OF11+ pop_vlan. Signed-off-by: Isaku Yamahata [blp@nicira.com added a test] Signed-off-by: Ben Pfaff --- diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index 0d1a2acd..b774a61e 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -685,6 +685,10 @@ ofpact_from_openflow11(const union ofp_action *a, struct ofpbuf *out) ofpact_put_SET_VLAN_PCP(out)->vlan_pcp = a->vlan_pcp.vlan_pcp; break; + case OFPUTIL_OFPAT11_POP_VLAN: + ofpact_put_STRIP_VLAN(out); + break; + case OFPUTIL_OFPAT11_SET_DL_SRC: memcpy(ofpact_put_SET_ETH_SRC(out)->mac, ((const struct ofp_action_dl_addr *) a)->dl_addr, ETH_ADDR_LEN); @@ -1443,7 +1447,7 @@ ofpact_to_openflow11(const struct ofpact *a, struct ofpbuf *out) break; case OFPACT_STRIP_VLAN: - /* XXX */ + ofputil_put_OFPAT11_POP_VLAN(out); break; case OFPACT_SET_ETH_SRC: diff --git a/lib/ofp-actions.h b/lib/ofp-actions.h index 3049aaaf..37a60825 100644 --- a/lib/ofp-actions.h +++ b/lib/ofp-actions.h @@ -177,7 +177,7 @@ ofpact_end(const struct ofpact *ofpacts, size_t ofpacts_len) /* OFPACT_STRIP_VLAN, OFPACT_POP_QUEUE, OFPACT_EXIT, OFPACT_CLEAR_ACTIONS. * * Used for OFPAT10_STRIP_VLAN, NXAST_POP_QUEUE, NXAST_EXIT, - * OFPIT11_CLEAR_ACTIONS. + * OFPAT11_POP_VLAN, OFPIT11_CLEAR_ACTIONS. * * Action structure for actions that do not have any extra data beyond the * action type. */ diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c index 04f5ab17..122f4b36 100644 --- a/lib/ofp-parse.c +++ b/lib/ofp-parse.c @@ -403,6 +403,7 @@ parse_named_action(enum ofputil_action_code code, const struct flow *flow, break; case OFPUTIL_OFPAT10_STRIP_VLAN: + case OFPUTIL_OFPAT11_POP_VLAN: ofpact_put_STRIP_VLAN(ofpacts); break; diff --git a/lib/ofp-util.def b/lib/ofp-util.def index e61049bb..3954dc0c 100644 --- a/lib/ofp-util.def +++ b/lib/ofp-util.def @@ -31,7 +31,7 @@ OFPAT11_ACTION(OFPAT11_SET_NW_TOS, ofp_action_nw_tos, 0, "mod_nw_tos") OFPAT11_ACTION(OFPAT11_SET_TP_SRC, ofp_action_tp_port, 0, "mod_tp_src") OFPAT11_ACTION(OFPAT11_SET_TP_DST, ofp_action_tp_port, 0, "mod_tp_dst") //OFPAT11_ACTION(OFPAT11_PUSH_VLAN, ofp11_action_push, 0, "push_vlan") -//OFPAT11_ACTION(OFPAT11_POP_VLAN, ofp_action_header, 0, "pop_vlan") +OFPAT11_ACTION(OFPAT11_POP_VLAN, ofp_action_header, 0, "pop_vlan") //OFPAT11_ACTION(OFPAT11_SET_QUEUE, ofp11_action_set_queue, 0, "set_queue") //OFPAT11_ACTION(OFPAT11_SET_NW_TTL, ofp11_action_nw_ttl, 0, "set_nw_ttl") OFPAT11_ACTION(OFPAT11_DEC_NW_TTL, ofp_action_header, 0, NULL) diff --git a/tests/ofp-actions.at b/tests/ofp-actions.at index c5d666ce..8d95ae90 100644 --- a/tests/ofp-actions.at +++ b/tests/ofp-actions.at @@ -160,6 +160,9 @@ AT_DATA([test-data], [dnl # actions=mod_tp_dst:443 000a 0008 01bb 0000 +# actions=strip_vlan +0012 0008 00000000 + # actions=resubmit:5 ffff 0010 00002320 0001 0005 00000000