mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
openflow: Table maintenance commands for Geneve options.
In order to work with Geneve options, we need to maintain a mapping table between an option (defined by <class, type, length>) and an NXM field that can be operated on for the purposes of matches, actions, etc. This mapping must be explicitly specified by the user. Conceptually, this table could be communicated using either OpenFlow or OVSDB. Using OVSDB requires less code and definition of extensions than OpenFlow but introduces the possibility that mapping table updates and flow modifications are desynchronized from each other. This is dangerous because the mapping table signifcantly impacts the way that flows using Geneve options are installed and processed by OVS. Therefore, the mapping table is maintained using OpenFlow commands instead, which opens the possibility of using synchronization between table changes and flow modifications through barriers, bundles, etc. There are two primary groups of OpenFlow messages that are introduced as Nicira extensions: modification commands (add, delete, clear mappings) and table status request/reply to dump the current table along with switch information. Note that mappings should not be changed while they are in active use by a flow. The result of doing so is undefined. This only adds the OpenFlow infrastructure but doesn't actually do anything with the information yet after the messages have been decoded. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
@@ -1584,3 +1584,36 @@ parse_ofp_group_mod_file(const char *file_name, uint16_t command,
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char * OVS_WARN_UNUSED_RESULT
|
||||
parse_ofp_geneve_table_mod_str(struct ofputil_geneve_table_mod *gtm,
|
||||
uint16_t command, const char *s,
|
||||
enum ofputil_protocol *usable_protocols)
|
||||
{
|
||||
*usable_protocols = OFPUTIL_P_NXM_OXM_ANY;
|
||||
|
||||
gtm->command = command;
|
||||
list_init(>m->mappings);
|
||||
|
||||
while (*s) {
|
||||
struct ofputil_geneve_map *map = xmalloc(sizeof *map);
|
||||
int n;
|
||||
|
||||
if (*s == ',') {
|
||||
s++;
|
||||
}
|
||||
|
||||
list_push_back(>m->mappings, &map->list_node);
|
||||
|
||||
if (!ovs_scan(s, "{class=%"SCNi16",type=%"SCNi8",len=%"SCNi8"}->tun_metadata%"SCNi16"%n",
|
||||
&map->option_class, &map->option_type, &map->option_len,
|
||||
&map->index, &n)) {
|
||||
ofputil_uninit_geneve_table(>m->mappings);
|
||||
return xstrdup("invalid geneve mapping");
|
||||
}
|
||||
|
||||
s += n;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user