};
OFP_ASSERT(sizeof(struct ofp_packet_in) == 20);
-enum ofp_action_type {
- OFPAT_OUTPUT, /* Output to switch port. */
- OFPAT_SET_VLAN_VID, /* Set the 802.1q VLAN id. */
- OFPAT_SET_VLAN_PCP, /* Set the 802.1q priority. */
- OFPAT_STRIP_VLAN, /* Strip the 802.1q header. */
- OFPAT_SET_DL_SRC, /* Ethernet source address. */
- OFPAT_SET_DL_DST, /* Ethernet destination address. */
- OFPAT_SET_NW_SRC, /* IP source address. */
- OFPAT_SET_NW_DST, /* IP destination address. */
- OFPAT_SET_NW_TOS, /* IP ToS (DSCP field, 6 bits). */
- OFPAT_SET_TP_SRC, /* TCP/UDP source port. */
- OFPAT_SET_TP_DST, /* TCP/UDP destination port. */
- OFPAT_ENQUEUE, /* Output to queue. */
- OFPAT_VENDOR = 0xffff
-};
-
-/* Action structure for OFPAT_OUTPUT, which sends packets out 'port'.
+enum ofp10_action_type {
+ OFPAT10_OUTPUT, /* Output to switch port. */
+ OFPAT10_SET_VLAN_VID, /* Set the 802.1q VLAN id. */
+ OFPAT10_SET_VLAN_PCP, /* Set the 802.1q priority. */
+ OFPAT10_STRIP_VLAN, /* Strip the 802.1q header. */
+ OFPAT10_SET_DL_SRC, /* Ethernet source address. */
+ OFPAT10_SET_DL_DST, /* Ethernet destination address. */
+ OFPAT10_SET_NW_SRC, /* IP source address. */
+ OFPAT10_SET_NW_DST, /* IP destination address. */
+ OFPAT10_SET_NW_TOS, /* IP ToS (DSCP field, 6 bits). */
+ OFPAT10_SET_TP_SRC, /* TCP/UDP source port. */
+ OFPAT10_SET_TP_DST, /* TCP/UDP destination port. */
+ OFPAT10_ENQUEUE, /* Output to queue. */
+ OFPAT10_VENDOR = 0xffff
+};
+
+/* Action structure for OFPAT10_OUTPUT, which sends packets out 'port'.
* When the 'port' is the OFPP_CONTROLLER, 'max_len' indicates the max
* number of bytes to send. A 'max_len' of zero means no bytes of the
* packet should be sent. */
struct ofp_action_output {
- ovs_be16 type; /* OFPAT_OUTPUT. */
+ ovs_be16 type; /* OFPAT10_OUTPUT. */
ovs_be16 len; /* Length is 8. */
ovs_be16 port; /* Output port. */
ovs_be16 max_len; /* Max length to send to controller. */
* set. */
#define OFP_VLAN_NONE 0xffff
-/* Action structure for OFPAT_SET_VLAN_VID. */
+/* Action structure for OFPAT10_SET_VLAN_VID. */
struct ofp_action_vlan_vid {
- ovs_be16 type; /* OFPAT_SET_VLAN_VID. */
+ ovs_be16 type; /* OFPAT10_SET_VLAN_VID. */
ovs_be16 len; /* Length is 8. */
ovs_be16 vlan_vid; /* VLAN id. */
uint8_t pad[2];
};
OFP_ASSERT(sizeof(struct ofp_action_vlan_vid) == 8);
-/* Action structure for OFPAT_SET_VLAN_PCP. */
+/* Action structure for OFPAT10_SET_VLAN_PCP. */
struct ofp_action_vlan_pcp {
- ovs_be16 type; /* OFPAT_SET_VLAN_PCP. */
+ ovs_be16 type; /* OFPAT10_SET_VLAN_PCP. */
ovs_be16 len; /* Length is 8. */
uint8_t vlan_pcp; /* VLAN priority. */
uint8_t pad[3];
};
OFP_ASSERT(sizeof(struct ofp_action_vlan_pcp) == 8);
-/* Action structure for OFPAT_SET_DL_SRC/DST. */
+/* Action structure for OFPAT10_SET_DL_SRC/DST. */
struct ofp_action_dl_addr {
- ovs_be16 type; /* OFPAT_SET_DL_SRC/DST. */
+ ovs_be16 type; /* OFPAT10_SET_DL_SRC/DST. */
ovs_be16 len; /* Length is 16. */
uint8_t dl_addr[OFP_ETH_ALEN]; /* Ethernet address. */
uint8_t pad[6];
};
OFP_ASSERT(sizeof(struct ofp_action_dl_addr) == 16);
-/* Action structure for OFPAT_SET_NW_SRC/DST. */
+/* Action structure for OFPAT10_SET_NW_SRC/DST. */
struct ofp_action_nw_addr {
- ovs_be16 type; /* OFPAT_SET_TW_SRC/DST. */
+ ovs_be16 type; /* OFPAT10_SET_TW_SRC/DST. */
ovs_be16 len; /* Length is 8. */
ovs_be32 nw_addr; /* IP address. */
};
OFP_ASSERT(sizeof(struct ofp_action_nw_addr) == 8);
-/* Action structure for OFPAT_SET_NW_TOS. */
+/* Action structure for OFPAT10_SET_NW_TOS. */
struct ofp_action_nw_tos {
- ovs_be16 type; /* OFPAT_SET_TW_TOS. */
+ ovs_be16 type; /* OFPAT10_SET_TW_TOS. */
ovs_be16 len; /* Length is 8. */
uint8_t nw_tos; /* IP TOS (DSCP field, 6 bits). */
uint8_t pad[3];
};
OFP_ASSERT(sizeof(struct ofp_action_nw_tos) == 8);
-/* Action structure for OFPAT_SET_TP_SRC/DST. */
+/* Action structure for OFPAT10_SET_TP_SRC/DST. */
struct ofp_action_tp_port {
- ovs_be16 type; /* OFPAT_SET_TP_SRC/DST. */
+ ovs_be16 type; /* OFPAT10_SET_TP_SRC/DST. */
ovs_be16 len; /* Length is 8. */
ovs_be16 tp_port; /* TCP/UDP port. */
uint8_t pad[2];
};
OFP_ASSERT(sizeof(struct ofp_action_tp_port) == 8);
-/* Action header for OFPAT_VENDOR. The rest of the body is vendor-defined. */
+/* Action header for OFPAT10_VENDOR. The rest of the body is vendor-defined. */
struct ofp_action_vendor_header {
- ovs_be16 type; /* OFPAT_VENDOR. */
+ ovs_be16 type; /* OFPAT10_VENDOR. */
ovs_be16 len; /* Length is a multiple of 8. */
ovs_be32 vendor; /* Vendor ID, which takes the same form
as in "struct ofp_vendor_header". */
* header and any padding used to make the action 64-bit aligned.
* NB: The length of an action *must* always be a multiple of eight. */
struct ofp_action_header {
- ovs_be16 type; /* One of OFPAT_*. */
+ ovs_be16 type; /* One of OFPAT10_*. */
ovs_be16 len; /* Length of action, including this
header. This is the length of action,
including any padding to make it
};
OFP_ASSERT(sizeof(struct ofp_action_header) == 8);
-/* OFPAT_ENQUEUE action struct: send packets to given queue on port. */
+/* OFPAT10_ENQUEUE action struct: send packets to given queue on port. */
struct ofp_action_enqueue {
- ovs_be16 type; /* OFPAT_ENQUEUE. */
+ ovs_be16 type; /* OFPAT10_ENQUEUE. */
ovs_be16 len; /* Len is 16. */
ovs_be16 port; /* Port that queue belongs. Should
refer to a valid physical port
OFPT11_QUEUE_GET_CONFIG_REPLY, /* Controller/switch message */
};
+enum ofp11_action_type {
+ OFPAT11_OUTPUT, /* Output to switch port. */
+ OFPAT11_SET_VLAN_VID, /* Set the 802.1q VLAN id. */
+ OFPAT11_SET_VLAN_PCP, /* Set the 802.1q priority. */
+ OFPAT11_SET_DL_SRC, /* Ethernet source address. */
+ OFPAT11_SET_DL_DST, /* Ethernet destination address. */
+ OFPAT11_SET_NW_SRC, /* IP source address. */
+ OFPAT11_SET_NW_DST, /* IP destination address. */
+ OFPAT11_SET_NW_TOS, /* IP ToS (DSCP field, 6 bits). */
+ OFPAT11_SET_NW_ECN, /* IP ECN (2 bits). */
+ OFPAT11_SET_TP_SRC, /* TCP/UDP/SCTP source port. */
+ OFPAT11_SET_TP_DST, /* TCP/UDP/SCTP destination port. */
+ OFPAT11_COPY_TTL_OUT, /* Copy TTL "outwards" -- from next-to-outermost
+ to outermost */
+ OFPAT11_COPY_TTL_IN, /* Copy TTL "inwards" -- from outermost to
+ next-to-outermost */
+ OFPAT11_SET_MPLS_LABEL, /* MPLS label */
+ OFPAT11_SET_MPLS_TC, /* MPLS TC */
+ OFPAT11_SET_MPLS_TTL, /* MPLS TTL */
+ OFPAT11_DEC_MPLS_TTL, /* Decrement MPLS TTL */
+
+ OFPAT11_PUSH_VLAN, /* Push a new VLAN tag */
+ OFPAT11_POP_VLAN, /* Pop the outer VLAN tag */
+ OFPAT11_PUSH_MPLS, /* Push a new MPLS tag */
+ OFPAT11_POP_MPLS, /* Pop the outer MPLS tag */
+ OFPAT11_SET_QUEUE, /* Set queue id when outputting to a port */
+ OFPAT11_GROUP, /* Apply group. */
+ OFPAT11_SET_NW_TTL, /* IP TTL. */
+ OFPAT11_DEC_NW_TTL, /* Decrement IP TTL. */
+ OFPAT11_EXPERIMENTER = 0xffff
+};
+
#endif /* openflow/openflow-1.1.h */
break;
case NX_LEARN_DST_OUTPUT:
- ofputil_put_OFPAT_OUTPUT(&actions)->port = htons(value);
+ ofputil_put_OFPAT10_OUTPUT(&actions)->port = htons(value);
break;
}
}
struct ofp_action_output oao;
memset(&oao, 0, sizeof oao);
- oao.type = htons(OFPAT_OUTPUT);
+ oao.type = htons(OFPAT10_OUTPUT);
oao.len = htons(sizeof oao);
oao.port = htons(out_port);
struct ofp_action_enqueue oae;
memset(&oae, 0, sizeof oae);
- oae.type = htons(OFPAT_ENQUEUE);
+ oae.type = htons(OFPAT10_ENQUEUE);
oae.len = htons(sizeof oae);
oae.port = htons(out_port);
oae.queue_id = htonl(queue_id);
{
struct ofp_action_output *oao;
- oao = ofputil_put_OFPAT_OUTPUT(b);
+ oao = ofputil_put_OFPAT10_OUTPUT(b);
oao->port = htons(port);
return oao;
}
ovs_fatal(0, "\"enqueue\" syntax is \"enqueue:PORT:QUEUE\"");
}
- oae = ofputil_put_OFPAT_ENQUEUE(b);
+ oae = ofputil_put_OFPAT10_ENQUEUE(b);
oae->port = htons(str_to_u32(port));
oae->queue_id = htonl(str_to_u32(queue));
}
struct ofp_action_tp_port *oata;
switch (code) {
- case OFPUTIL_OFPAT_OUTPUT:
+ case OFPUTIL_OFPAT10_OUTPUT:
parse_output(b, arg);
break;
- case OFPUTIL_OFPAT_SET_VLAN_VID:
- oavv = ofputil_put_OFPAT_SET_VLAN_VID(b);
+ case OFPUTIL_OFPAT10_SET_VLAN_VID:
+ oavv = ofputil_put_OFPAT10_SET_VLAN_VID(b);
oavv->vlan_vid = htons(str_to_u32(arg));
break;
- case OFPUTIL_OFPAT_SET_VLAN_PCP:
- oavp = ofputil_put_OFPAT_SET_VLAN_PCP(b);
+ case OFPUTIL_OFPAT10_SET_VLAN_PCP:
+ oavp = ofputil_put_OFPAT10_SET_VLAN_PCP(b);
oavp->vlan_pcp = str_to_u32(arg);
break;
- case OFPUTIL_OFPAT_STRIP_VLAN:
- ofputil_put_OFPAT_STRIP_VLAN(b);
+ case OFPUTIL_OFPAT10_STRIP_VLAN:
+ ofputil_put_OFPAT10_STRIP_VLAN(b);
break;
- case OFPUTIL_OFPAT_SET_DL_SRC:
- case OFPUTIL_OFPAT_SET_DL_DST:
+ case OFPUTIL_OFPAT10_SET_DL_SRC:
+ case OFPUTIL_OFPAT10_SET_DL_DST:
oada = ofputil_put_action(code, b);
str_to_mac(arg, oada->dl_addr);
break;
- case OFPUTIL_OFPAT_SET_NW_SRC:
- case OFPUTIL_OFPAT_SET_NW_DST:
+ case OFPUTIL_OFPAT10_SET_NW_SRC:
+ case OFPUTIL_OFPAT10_SET_NW_DST:
oana = ofputil_put_action(code, b);
str_to_ip(arg, &oana->nw_addr);
break;
- case OFPUTIL_OFPAT_SET_NW_TOS:
- ofputil_put_OFPAT_SET_NW_TOS(b)->nw_tos = str_to_u32(arg);
+ case OFPUTIL_OFPAT10_SET_NW_TOS:
+ ofputil_put_OFPAT10_SET_NW_TOS(b)->nw_tos = str_to_u32(arg);
break;
- case OFPUTIL_OFPAT_SET_TP_SRC:
- case OFPUTIL_OFPAT_SET_TP_DST:
+ case OFPUTIL_OFPAT10_SET_TP_SRC:
+ case OFPUTIL_OFPAT10_SET_TP_DST:
oata = ofputil_put_action(code, b);
oata->tp_port = htons(str_to_u32(arg));
break;
- case OFPUTIL_OFPAT_ENQUEUE:
+ case OFPUTIL_OFPAT10_ENQUEUE:
parse_enqueue(b, arg);
break;
uint16_t port;
switch (code) {
- case OFPUTIL_OFPAT_OUTPUT:
+ case OFPUTIL_OFPAT10_OUTPUT:
port = ntohs(a->output.port);
if (port < OFPP_MAX) {
ds_put_format(s, "output:%"PRIu16, port);
}
break;
- case OFPUTIL_OFPAT_ENQUEUE:
+ case OFPUTIL_OFPAT10_ENQUEUE:
oae = (const struct ofp_action_enqueue *) a;
ds_put_format(s, "enqueue:");
ofputil_format_port(ntohs(oae->port), s);
ds_put_format(s, "q%"PRIu32, ntohl(oae->queue_id));
break;
- case OFPUTIL_OFPAT_SET_VLAN_VID:
+ case OFPUTIL_OFPAT10_SET_VLAN_VID:
ds_put_format(s, "mod_vlan_vid:%"PRIu16,
ntohs(a->vlan_vid.vlan_vid));
break;
- case OFPUTIL_OFPAT_SET_VLAN_PCP:
+ case OFPUTIL_OFPAT10_SET_VLAN_PCP:
ds_put_format(s, "mod_vlan_pcp:%"PRIu8, a->vlan_pcp.vlan_pcp);
break;
- case OFPUTIL_OFPAT_STRIP_VLAN:
+ case OFPUTIL_OFPAT10_STRIP_VLAN:
ds_put_cstr(s, "strip_vlan");
break;
- case OFPUTIL_OFPAT_SET_DL_SRC:
+ case OFPUTIL_OFPAT10_SET_DL_SRC:
oada = (const struct ofp_action_dl_addr *) a;
ds_put_format(s, "mod_dl_src:"ETH_ADDR_FMT,
ETH_ADDR_ARGS(oada->dl_addr));
break;
- case OFPUTIL_OFPAT_SET_DL_DST:
+ case OFPUTIL_OFPAT10_SET_DL_DST:
oada = (const struct ofp_action_dl_addr *) a;
ds_put_format(s, "mod_dl_dst:"ETH_ADDR_FMT,
ETH_ADDR_ARGS(oada->dl_addr));
break;
- case OFPUTIL_OFPAT_SET_NW_SRC:
+ case OFPUTIL_OFPAT10_SET_NW_SRC:
ds_put_format(s, "mod_nw_src:"IP_FMT, IP_ARGS(&a->nw_addr.nw_addr));
break;
- case OFPUTIL_OFPAT_SET_NW_DST:
+ case OFPUTIL_OFPAT10_SET_NW_DST:
ds_put_format(s, "mod_nw_dst:"IP_FMT, IP_ARGS(&a->nw_addr.nw_addr));
break;
- case OFPUTIL_OFPAT_SET_NW_TOS:
+ case OFPUTIL_OFPAT10_SET_NW_TOS:
ds_put_format(s, "mod_nw_tos:%d", a->nw_tos.nw_tos);
break;
- case OFPUTIL_OFPAT_SET_TP_SRC:
+ case OFPUTIL_OFPAT10_SET_TP_SRC:
ds_put_format(s, "mod_tp_src:%d", ntohs(a->tp_port.tp_port));
break;
- case OFPUTIL_OFPAT_SET_TP_DST:
+ case OFPUTIL_OFPAT10_SET_TP_DST:
ds_put_format(s, "mod_tp_dst:%d", ntohs(a->tp_port.tp_port));
break;
struct ofpbuf *buffer;
buffer = make_add_flow(rule, buffer_id, idle_timeout, sizeof *oao);
- ofputil_put_OFPAT_OUTPUT(buffer)->port = htons(out_port);
+ ofputil_put_OFPAT10_OUTPUT(buffer)->port = htons(out_port);
return buffer;
} else {
return make_add_flow(rule, buffer_id, idle_timeout, 0);
: ofp10_port + OFPP11_OFFSET);
}
-/* Checks that 'port' is a valid output port for the OFPAT_OUTPUT action, given
+/* Checks that 'port' is a valid output port for the OFPAT10_OUTPUT action, given
* that the switch will never have more than 'max_ports' ports. Returns 0 if
* 'port' is valid, otherwise an OpenFlow return code. */
enum ofperr
error = 0;
switch ((enum ofputil_action_code) code) {
- case OFPUTIL_OFPAT_OUTPUT:
+ case OFPUTIL_OFPAT10_OUTPUT:
error = ofputil_check_output_port(ntohs(a->output.port),
max_ports);
break;
- case OFPUTIL_OFPAT_SET_VLAN_VID:
+ case OFPUTIL_OFPAT10_SET_VLAN_VID:
if (a->vlan_vid.vlan_vid & ~htons(0xfff)) {
error = OFPERR_OFPBAC_BAD_ARGUMENT;
}
break;
- case OFPUTIL_OFPAT_SET_VLAN_PCP:
+ case OFPUTIL_OFPAT10_SET_VLAN_PCP:
if (a->vlan_pcp.vlan_pcp & ~7) {
error = OFPERR_OFPBAC_BAD_ARGUMENT;
}
break;
- case OFPUTIL_OFPAT_ENQUEUE:
+ case OFPUTIL_OFPAT10_ENQUEUE:
port = ntohs(((const struct ofp_action_enqueue *) a)->port);
if (port >= max_ports && port != OFPP_IN_PORT
&& port != OFPP_LOCAL) {
}
break;
- case OFPUTIL_OFPAT_STRIP_VLAN:
- case OFPUTIL_OFPAT_SET_NW_SRC:
- case OFPUTIL_OFPAT_SET_NW_DST:
- case OFPUTIL_OFPAT_SET_NW_TOS:
- case OFPUTIL_OFPAT_SET_TP_SRC:
- case OFPUTIL_OFPAT_SET_TP_DST:
- case OFPUTIL_OFPAT_SET_DL_SRC:
- case OFPUTIL_OFPAT_SET_DL_DST:
+ case OFPUTIL_OFPAT10_STRIP_VLAN:
+ case OFPUTIL_OFPAT10_SET_NW_SRC:
+ case OFPUTIL_OFPAT10_SET_NW_DST:
+ case OFPUTIL_OFPAT10_SET_NW_TOS:
+ case OFPUTIL_OFPAT10_SET_TP_SRC:
+ case OFPUTIL_OFPAT10_SET_TP_DST:
+ case OFPUTIL_OFPAT10_SET_DL_SRC:
+ case OFPUTIL_OFPAT10_SET_DL_DST:
case OFPUTIL_NXAST_RESUBMIT:
case OFPUTIL_NXAST_SET_TUNNEL:
case OFPUTIL_NXAST_SET_QUEUE:
static const struct ofputil_action *
ofputil_decode_ofpat_action(const union ofp_action *a)
{
- enum ofp_action_type type = ntohs(a->type);
+ enum ofp10_action_type type = ntohs(a->type);
switch (type) {
-#define OFPAT_ACTION(ENUM, STRUCT, NAME) \
+#define OFPAT10_ACTION(ENUM, STRUCT, NAME) \
case ENUM: { \
static const struct ofputil_action action = { \
OFPUTIL_##ENUM, \
}
#include "ofp-util.def"
- case OFPAT_VENDOR:
+ case OFPAT10_VENDOR:
default:
return &action_bad_type;
}
}
}
-/* Parses 'a' to determine its type. Returns a nonnegative OFPUTIL_OFPAT_* or
+/* Parses 'a' to determine its type. Returns a nonnegative OFPUTIL_OFPAT10_* or
* OFPUTIL_NXAST_* constant if successful, otherwise a negative OFPERR_* error
* code.
*
const struct ofputil_action *action;
uint16_t len = ntohs(a->header.len);
- if (a->type != htons(OFPAT_VENDOR)) {
+ if (a->type != htons(OFPAT10_VENDOR)) {
action = ofputil_decode_ofpat_action(a);
} else {
switch (ntohl(a->vendor.vendor)) {
: -OFPERR_OFPBAC_BAD_LEN);
}
-/* Parses 'a' and returns its type as an OFPUTIL_OFPAT_* or OFPUTIL_NXAST_*
+/* Parses 'a' and returns its type as an OFPUTIL_OFPAT10_* or OFPUTIL_NXAST_*
* constant. The caller must have already validated that 'a' is a valid action
* understood by Open vSwitch (e.g. by a previous successful call to
* ofputil_decode_action()). */
{
const struct ofputil_action *action;
- if (a->type != htons(OFPAT_VENDOR)) {
+ if (a->type != htons(OFPAT10_VENDOR)) {
action = ofputil_decode_ofpat_action(a);
} else {
action = ofputil_decode_nxast_action(a);
}
/* Returns the 'enum ofputil_action_code' corresponding to 'name' (e.g. if
- * 'name' is "output" then the return value is OFPUTIL_OFPAT_OUTPUT), or -1 if
+ * 'name' is "output" then the return value is OFPUTIL_OFPAT10_OUTPUT), or -1 if
* 'name' is not the name of any action.
*
* ofp-util.def lists the mapping from names to action. */
ofputil_action_code_from_name(const char *name)
{
static const char *names[OFPUTIL_N_ACTIONS] = {
-#define OFPAT_ACTION(ENUM, STRUCT, NAME) NAME,
+#define OFPAT10_ACTION(ENUM, STRUCT, NAME) NAME,
#define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) NAME,
#include "ofp-util.def"
};
ofputil_put_action(enum ofputil_action_code code, struct ofpbuf *buf)
{
switch (code) {
-#define OFPAT_ACTION(ENUM, STRUCT, NAME) \
+#define OFPAT10_ACTION(ENUM, STRUCT, NAME) \
case OFPUTIL_##ENUM: return ofputil_put_##ENUM(buf);
#define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) \
case OFPUTIL_##ENUM: return ofputil_put_##ENUM(buf);
NOT_REACHED();
}
-#define OFPAT_ACTION(ENUM, STRUCT, NAME) \
+#define OFPAT10_ACTION(ENUM, STRUCT, NAME) \
void \
ofputil_init_##ENUM(struct STRUCT *s) \
{ \
ofputil_init_##ENUM(struct STRUCT *s) \
{ \
memset(s, 0, sizeof *s); \
- s->type = htons(OFPAT_VENDOR); \
+ s->type = htons(OFPAT10_VENDOR); \
s->len = htons(sizeof *s); \
s->vendor = htonl(NX_VENDOR_ID); \
s->subtype = htons(ENUM); \
action_outputs_to_port(const union ofp_action *action, ovs_be16 port)
{
switch (ntohs(action->type)) {
- case OFPAT_OUTPUT:
+ case OFPAT10_OUTPUT:
return action->output.port == port;
- case OFPAT_ENQUEUE:
+ case OFPAT10_ENQUEUE:
return ((const struct ofp_action_enqueue *) action)->port == port;
default:
return false;
/* -*- c -*- */
-#ifndef OFPAT_ACTION
-#define OFPAT_ACTION(ENUM, STRUCT, NAME)
+#ifndef OFPAT10_ACTION
+#define OFPAT10_ACTION(ENUM, STRUCT, NAME)
#endif
-OFPAT_ACTION(OFPAT_OUTPUT, ofp_action_output, "output")
-OFPAT_ACTION(OFPAT_SET_VLAN_VID, ofp_action_vlan_vid, "mod_vlan_vid")
-OFPAT_ACTION(OFPAT_SET_VLAN_PCP, ofp_action_vlan_pcp, "mod_vlan_pcp")
-OFPAT_ACTION(OFPAT_STRIP_VLAN, ofp_action_header, "strip_vlan")
-OFPAT_ACTION(OFPAT_SET_DL_SRC, ofp_action_dl_addr, "mod_dl_src")
-OFPAT_ACTION(OFPAT_SET_DL_DST, ofp_action_dl_addr, "mod_dl_dst")
-OFPAT_ACTION(OFPAT_SET_NW_SRC, ofp_action_nw_addr, "mod_nw_src")
-OFPAT_ACTION(OFPAT_SET_NW_DST, ofp_action_nw_addr, "mod_nw_dst")
-OFPAT_ACTION(OFPAT_SET_NW_TOS, ofp_action_nw_tos, "mod_nw_tos")
-OFPAT_ACTION(OFPAT_SET_TP_SRC, ofp_action_tp_port, "mod_tp_src")
-OFPAT_ACTION(OFPAT_SET_TP_DST, ofp_action_tp_port, "mod_tp_dst")
-OFPAT_ACTION(OFPAT_ENQUEUE, ofp_action_enqueue, "enqueue")
-#undef OFPAT_ACTION
+OFPAT10_ACTION(OFPAT10_OUTPUT, ofp_action_output, "output")
+OFPAT10_ACTION(OFPAT10_SET_VLAN_VID, ofp_action_vlan_vid, "mod_vlan_vid")
+OFPAT10_ACTION(OFPAT10_SET_VLAN_PCP, ofp_action_vlan_pcp, "mod_vlan_pcp")
+OFPAT10_ACTION(OFPAT10_STRIP_VLAN, ofp_action_header, "strip_vlan")
+OFPAT10_ACTION(OFPAT10_SET_DL_SRC, ofp_action_dl_addr, "mod_dl_src")
+OFPAT10_ACTION(OFPAT10_SET_DL_DST, ofp_action_dl_addr, "mod_dl_dst")
+OFPAT10_ACTION(OFPAT10_SET_NW_SRC, ofp_action_nw_addr, "mod_nw_src")
+OFPAT10_ACTION(OFPAT10_SET_NW_DST, ofp_action_nw_addr, "mod_nw_dst")
+OFPAT10_ACTION(OFPAT10_SET_NW_TOS, ofp_action_nw_tos, "mod_nw_tos")
+OFPAT10_ACTION(OFPAT10_SET_TP_SRC, ofp_action_tp_port, "mod_tp_src")
+OFPAT10_ACTION(OFPAT10_SET_TP_DST, ofp_action_tp_port, "mod_tp_dst")
+OFPAT10_ACTION(OFPAT10_ENQUEUE, ofp_action_enqueue, "enqueue")
+#undef OFPAT10_ACTION
#ifndef NXAST_ACTION
#define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME)
/* The type of an action.
*
- * For each implemented OFPAT_* and NXAST_* action type, there is a
+ * For each implemented OFPAT10_* and NXAST_* action type, there is a
* corresponding constant prefixed with OFPUTIL_, e.g.:
*
- * OFPUTIL_OFPAT_OUTPUT
- * OFPUTIL_OFPAT_SET_VLAN_VID
- * OFPUTIL_OFPAT_SET_VLAN_PCP
- * OFPUTIL_OFPAT_STRIP_VLAN
- * OFPUTIL_OFPAT_SET_DL_SRC
- * OFPUTIL_OFPAT_SET_DL_DST
- * OFPUTIL_OFPAT_SET_NW_SRC
- * OFPUTIL_OFPAT_SET_NW_DST
- * OFPUTIL_OFPAT_SET_NW_TOS
- * OFPUTIL_OFPAT_SET_TP_SRC
- * OFPUTIL_OFPAT_SET_TP_DST
- * OFPUTIL_OFPAT_ENQUEUE
+ * OFPUTIL_OFPAT10_OUTPUT
+ * OFPUTIL_OFPAT10_SET_VLAN_VID
+ * OFPUTIL_OFPAT10_SET_VLAN_PCP
+ * OFPUTIL_OFPAT10_STRIP_VLAN
+ * OFPUTIL_OFPAT10_SET_DL_SRC
+ * OFPUTIL_OFPAT10_SET_DL_DST
+ * OFPUTIL_OFPAT10_SET_NW_SRC
+ * OFPUTIL_OFPAT10_SET_NW_DST
+ * OFPUTIL_OFPAT10_SET_NW_TOS
+ * OFPUTIL_OFPAT10_SET_TP_SRC
+ * OFPUTIL_OFPAT10_SET_TP_DST
+ * OFPUTIL_OFPAT10_ENQUEUE
* OFPUTIL_NXAST_RESUBMIT
* OFPUTIL_NXAST_SET_TUNNEL
* OFPUTIL_NXAST_SET_QUEUE
* (The above list helps developers who want to "grep" for these definitions.)
*/
enum ofputil_action_code {
-#define OFPAT_ACTION(ENUM, STRUCT, NAME) OFPUTIL_##ENUM,
+#define OFPAT10_ACTION(ENUM, STRUCT, NAME) OFPUTIL_##ENUM,
#define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) OFPUTIL_##ENUM,
#include "ofp-util.def"
};
/* The number of values of "enum ofputil_action_code". */
enum {
-#define OFPAT_ACTION(ENUM, STRUCT, NAME) + 1
+#define OFPAT10_ACTION(ENUM, STRUCT, NAME) + 1
#define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) + 1
OFPUTIL_N_ACTIONS = 0
#include "ofp-util.def"
* Appends a new 'action', of length 'sizeof(struct <STRUCT>)', to 'buf',
* initializes it with ofputil_init_<ENUM>(), and returns it.
*/
-#define OFPAT_ACTION(ENUM, STRUCT, NAME) \
+#define OFPAT10_ACTION(ENUM, STRUCT, NAME) \
void ofputil_init_##ENUM(struct STRUCT *); \
struct STRUCT *ofputil_put_##ENUM(struct ofpbuf *);
#define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) \
struct cls_rule rule;
memset(&action, 0, sizeof action);
- action.type = htons(OFPAT_OUTPUT);
+ action.type = htons(OFPAT10_OUTPUT);
action.output.len = htons(sizeof action);
action.output.port = htons(OFPP_NORMAL);
cls_rule_init_catchall(&rule, 0);
/*
- * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira Networks.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/* Set up a flow that matches every packet and directs them to
* OFPP_NORMAL. */
memset(&action, 0, sizeof action);
- action.type = htons(OFPAT_OUTPUT);
+ action.type = htons(OFPAT10_OUTPUT);
action.output.len = htons(sizeof action);
action.output.port = htons(OFPP_NORMAL);
struct in_band_rule *rule, *next;
memset(&actions, 0, sizeof actions);
- actions.oa.output.type = htons(OFPAT_OUTPUT);
+ actions.oa.output.type = htons(OFPAT10_OUTPUT);
actions.oa.output.len = htons(sizeof actions.oa);
actions.oa.output.port = htons(OFPP_NORMAL);
actions.oa.output.max_len = htons(0);
a = &actions.oa;
na = sizeof actions.oa / sizeof(union ofp_action);
} else {
- actions.nxsq.type = htons(OFPAT_VENDOR);
+ actions.nxsq.type = htons(OFPAT10_VENDOR);
actions.nxsq.len = htons(sizeof actions.nxsq);
actions.nxsq.vendor = htonl(NX_VENDOR_ID);
actions.nxsq.subtype = htons(NXAST_SET_QUEUE);
bool *arp_match_ip, uint32_t *actions)
{
*arp_match_ip = true;
- *actions = ((1u << OFPAT_OUTPUT) |
- (1u << OFPAT_SET_VLAN_VID) |
- (1u << OFPAT_SET_VLAN_PCP) |
- (1u << OFPAT_STRIP_VLAN) |
- (1u << OFPAT_SET_DL_SRC) |
- (1u << OFPAT_SET_DL_DST) |
- (1u << OFPAT_SET_NW_SRC) |
- (1u << OFPAT_SET_NW_DST) |
- (1u << OFPAT_SET_NW_TOS) |
- (1u << OFPAT_SET_TP_SRC) |
- (1u << OFPAT_SET_TP_DST) |
- (1u << OFPAT_ENQUEUE));
+ *actions = ((1u << OFPAT10_OUTPUT) |
+ (1u << OFPAT10_SET_VLAN_VID) |
+ (1u << OFPAT10_SET_VLAN_PCP) |
+ (1u << OFPAT10_STRIP_VLAN) |
+ (1u << OFPAT10_SET_DL_SRC) |
+ (1u << OFPAT10_SET_DL_DST) |
+ (1u << OFPAT10_SET_NW_SRC) |
+ (1u << OFPAT10_SET_NW_DST) |
+ (1u << OFPAT10_SET_NW_TOS) |
+ (1u << OFPAT10_SET_TP_SRC) |
+ (1u << OFPAT10_SET_TP_DST) |
+ (1u << OFPAT10_ENQUEUE));
}
static void
code = ofputil_decode_action_unsafe(ia);
switch (code) {
- case OFPUTIL_OFPAT_OUTPUT:
+ case OFPUTIL_OFPAT10_OUTPUT:
xlate_output_action(ctx, &ia->output);
break;
- case OFPUTIL_OFPAT_SET_VLAN_VID:
+ case OFPUTIL_OFPAT10_SET_VLAN_VID:
ctx->flow.vlan_tci &= ~htons(VLAN_VID_MASK);
ctx->flow.vlan_tci |= ia->vlan_vid.vlan_vid | htons(VLAN_CFI);
break;
- case OFPUTIL_OFPAT_SET_VLAN_PCP:
+ case OFPUTIL_OFPAT10_SET_VLAN_PCP:
ctx->flow.vlan_tci &= ~htons(VLAN_PCP_MASK);
ctx->flow.vlan_tci |= htons(
(ia->vlan_pcp.vlan_pcp << VLAN_PCP_SHIFT) | VLAN_CFI);
break;
- case OFPUTIL_OFPAT_STRIP_VLAN:
+ case OFPUTIL_OFPAT10_STRIP_VLAN:
ctx->flow.vlan_tci = htons(0);
break;
- case OFPUTIL_OFPAT_SET_DL_SRC:
+ case OFPUTIL_OFPAT10_SET_DL_SRC:
oada = ((struct ofp_action_dl_addr *) ia);
memcpy(ctx->flow.dl_src, oada->dl_addr, ETH_ADDR_LEN);
break;
- case OFPUTIL_OFPAT_SET_DL_DST:
+ case OFPUTIL_OFPAT10_SET_DL_DST:
oada = ((struct ofp_action_dl_addr *) ia);
memcpy(ctx->flow.dl_dst, oada->dl_addr, ETH_ADDR_LEN);
break;
- case OFPUTIL_OFPAT_SET_NW_SRC:
+ case OFPUTIL_OFPAT10_SET_NW_SRC:
ctx->flow.nw_src = ia->nw_addr.nw_addr;
break;
- case OFPUTIL_OFPAT_SET_NW_DST:
+ case OFPUTIL_OFPAT10_SET_NW_DST:
ctx->flow.nw_dst = ia->nw_addr.nw_addr;
break;
- case OFPUTIL_OFPAT_SET_NW_TOS:
+ case OFPUTIL_OFPAT10_SET_NW_TOS:
/* OpenFlow 1.0 only supports IPv4. */
if (ctx->flow.dl_type == htons(ETH_TYPE_IP)) {
ctx->flow.nw_tos &= ~IP_DSCP_MASK;
}
break;
- case OFPUTIL_OFPAT_SET_TP_SRC:
+ case OFPUTIL_OFPAT10_SET_TP_SRC:
ctx->flow.tp_src = ia->tp_port.tp_port;
break;
- case OFPUTIL_OFPAT_SET_TP_DST:
+ case OFPUTIL_OFPAT10_SET_TP_DST:
ctx->flow.tp_dst = ia->tp_port.tp_port;
break;
- case OFPUTIL_OFPAT_ENQUEUE:
+ case OFPUTIL_OFPAT10_ENQUEUE:
xlate_enqueue_action(ctx, (const struct ofp_action_enqueue *) ia);
break;
uint32_t actions;
ofproto->ofproto_class->get_features(ofproto, &arp_match_ip, &actions);
- assert(actions & (1 << OFPAT_OUTPUT)); /* sanity check */
+ assert(actions & (1 << OFPAT10_OUTPUT)); /* sanity check */
osf = make_openflow_xid(sizeof *osf, OFPT_FEATURES_REPLY, oh->xid, &buf);
osf->datapath_id = htonll(ofproto->datapath_id);