2 * Copyright (c) 2015, 2016 Nicira, Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #define OVN_ACTIONS_H 1
32 /* "arp { ...actions... }".
34 * The actions, in OpenFlow 1.3 format, follow the action_header.
38 /* "put_arp(port, ip, mac)"
40 * Arguments are passed through the packet metadata and data, as follows:
43 * MFF_LOG_INPORT = port
46 ACTION_OPCODE_PUT_ARP
,
48 /* "result = put_dhcp_opts(offer_ip, option, ...)".
50 * Arguments follow the action_header, in this format:
51 * - A 32-bit or 64-bit OXM header designating the result field.
52 * - A 32-bit integer specifying a bit offset within the result field.
53 * - The 32-bit DHCP offer IP.
54 * - Any number of DHCP options.
56 ACTION_OPCODE_PUT_DHCP_OPTS
,
58 /* "na { ...actions... }".
60 * The actions, in OpenFlow 1.3 format, follow the action_header.
66 struct action_header
{
67 ovs_be32 opcode
; /* One of ACTION_OPCODE_* */
70 BUILD_ASSERT_DECL(sizeof(struct action_header
) == 8);
72 struct action_params
{
73 /* A table of "struct expr_symbol"s to support (as one would provide to
75 const struct shash
*symtab
;
77 /* hmap of 'struct dhcp_opts_map' to support 'put_dhcp_opts' action */
78 const struct hmap
*dhcp_opts
;
80 /* Looks up logical port 'port_name'. If found, stores its port number in
81 * '*portp' and returns true; otherwise, returns false. */
82 bool (*lookup_port
)(const void *aux
, const char *port_name
,
86 /* A map from a port name to its connection tracking zone. */
87 const struct simap
*ct_zones
;
89 /* OVN maps each logical flow table (ltable), one-to-one, onto a physical
90 * OpenFlow flow table (ptable). A number of parameters describe this
91 * mapping and data related to flow tables:
93 * - 'first_ptable' and 'n_tables' define the range of OpenFlow tables
94 * to which the logical "next" action should be able to jump.
95 * Logical table 0 maps to OpenFlow table 'first_ptable', logical
96 * table 1 to 'first_ptable + 1', and so on. If 'n_tables' is 0
97 * then "next" is disallowed entirely.
99 * - 'cur_ltable' is an offset from 'first_ptable' (e.g. 0 <=
100 * cur_ltable < n_ptables) of the logical flow that contains the
101 * actions. If cur_ltable + 1 < n_tables, then this defines the
102 * default table that "next" will jump to.
104 * - 'output_ptable' should be the OpenFlow table to which the logical
105 * "output" action will resubmit. */
106 uint8_t n_tables
; /* Number of flow tables. */
107 uint8_t first_ptable
; /* First OpenFlow table. */
108 uint8_t cur_ltable
; /* 0 <= cur_ltable < n_tables. */
109 uint8_t output_ptable
; /* OpenFlow table for 'output' to resubmit. */
110 uint8_t arp_ptable
; /* OpenFlow table for 'get_arp' to resubmit. */
113 char *actions_parse(struct lexer
*, const struct action_params
*,
114 struct ofpbuf
*ofpacts
, struct expr
**prereqsp
)
115 OVS_WARN_UNUSED_RESULT
;
116 char *actions_parse_string(const char *s
, const struct action_params
*,
117 struct ofpbuf
*ofpacts
, struct expr
**prereqsp
)
118 OVS_WARN_UNUSED_RESULT
;
120 #endif /* ovn/actions.h */