loci: support of_instruction_bsn_disable_src_mac_check
diff --git a/c_gen/build_of_g.py b/c_gen/build_of_g.py
index 9ea6d34..46aedda 100755
--- a/c_gen/build_of_g.py
+++ b/c_gen/build_of_g.py
@@ -403,6 +403,9 @@
if wire_version >= of_g.VERSION_1_3:
cls2 = parent + "_id" + cls[len(parent):]
type_maps.extension_action_id_subtype[wire_version][experimenter][cls2] = val
+ elif parent == 'of_instruction' and experimenter:
+ val = find_type_value(ofclass, 'subtype')
+ type_maps.extension_instruction_subtype[wire_version][experimenter][cls] = val
# Messages
for version, protocol in loxi_globals.ir.items():
diff --git a/c_gen/c_code_gen.py b/c_gen/c_code_gen.py
index 1106f2d..e2bb467 100644
--- a/c_gen/c_code_gen.py
+++ b/c_gen/c_code_gen.py
@@ -2729,7 +2729,8 @@
# Some tlv16 types may be extensions requiring more work
if cls in ["of_action_bsn_mirror", "of_action_id_bsn_mirror",
"of_action_bsn_set_tunnel_dst", "of_action_id_bsn_set_tunnel_dst",
- "of_action_nicira_dec_ttl", "of_action_id_nicira_dec_ttl"]:
+ "of_action_nicira_dec_ttl", "of_action_id_nicira_dec_ttl",
+ "of_instruction_bsn_disable_src_mac_check"]:
out.write("""
/* Extended TLV obj; Call specific accessor */
of_extension_object_id_set(obj, %(enum)s);
diff --git a/c_gen/templates/of_type_maps.c b/c_gen/templates/of_type_maps.c
index 30c73ac..a48bdf8 100644
--- a/c_gen/templates/of_type_maps.c
+++ b/c_gen/templates/of_type_maps.c
@@ -37,6 +37,9 @@
#include <loci/loci.h>
#include <loci/of_message.h>
+#define OF_INSTRUCTION_EXPERIMENTER_ID_OFFSET 4
+#define OF_INSTRUCTION_EXPERIMENTER_SUBTYPE_OFFSET 8
+
/****************************************************************
* Top level OpenFlow message length functions
****************************************************************/
@@ -207,8 +210,6 @@
/**
* Set wire data for extension objects, not messages.
- *
- * Currently only handles BSN mirror; ignores all others
*/
void
@@ -235,6 +236,11 @@
OF_EXPERIMENTER_ID_NICIRA);
buf_u16_set(buf + OF_ACTION_EXPERIMENTER_SUBTYPE_OFFSET, 18);
break;
+ case OF_INSTRUCTION_BSN_DISABLE_SRC_MAC_CHECK:
+ buf_u32_set(buf + OF_INSTRUCTION_EXPERIMENTER_ID_OFFSET,
+ OF_EXPERIMENTER_ID_BSN);
+ buf_u32_set(buf + OF_INSTRUCTION_EXPERIMENTER_SUBTYPE_OFFSET, 0);
+ break;
default:
break;
}
@@ -339,10 +345,26 @@
static int
extension_instruction_object_id_get(of_object_t *obj, of_object_id_t *id)
{
- (void)obj;
+ uint32_t exp_id;
+ uint8_t *buf;
*id = OF_INSTRUCTION_EXPERIMENTER;
+ buf = OF_OBJECT_BUFFER_INDEX(obj, 0);
+
+ buf_u32_get(buf + OF_INSTRUCTION_EXPERIMENTER_ID_OFFSET, &exp_id);
+
+ switch (exp_id) {
+ case OF_EXPERIMENTER_ID_BSN: {
+ uint32_t subtype;
+ buf_u32_get(buf + OF_INSTRUCTION_EXPERIMENTER_SUBTYPE_OFFSET, &subtype);
+ switch (subtype) {
+ case 0: *id = OF_INSTRUCTION_BSN_DISABLE_SRC_MAC_CHECK; break;
+ }
+ break;
+ }
+ }
+
return OF_ERROR_NONE;
}
diff --git a/c_gen/type_maps.py b/c_gen/type_maps.py
index cf88e35..480eb29 100644
--- a/c_gen/type_maps.py
+++ b/c_gen/type_maps.py
@@ -156,7 +156,7 @@
if loxi_utils.class_is_list(cls):
return True
# TODO get this from the input file when we have virtual class syntax
- if cls in ["of_flow_mod", "of_stats_request", "of_stats_reply", "of_error_msg", "of_bsn_header", "of_nicira_header", "of_action_bsn", "of_action_nicira", "of_action_id_bsn", "of_action_id_nicira", "of_bsn_stats_request", "of_bsn_stats_reply", "of_experimenter_stats_request", "of_experimenter_stats_reply"]:
+ if cls in ["of_flow_mod", "of_stats_request", "of_stats_reply", "of_error_msg", "of_bsn_header", "of_nicira_header", "of_action_bsn", "of_action_nicira", "of_action_id_bsn", "of_action_id_nicira", "of_bsn_stats_request", "of_bsn_stats_reply", "of_experimenter_stats_request", "of_experimenter_stats_reply", "of_instruction_experimenter", "of_instruction_bsn"]:
return True
return False
@@ -597,7 +597,18 @@
}
# Set to empty dict if no extension instructions defined
-extension_instruction_subtype = {}
+extension_instruction_subtype = {
+ # version 1.0
+ of_g.VERSION_1_0:dict(),
+ of_g.VERSION_1_1:dict(),
+ of_g.VERSION_1_2:dict(),
+ of_g.VERSION_1_3:dict(
+ bsn = { # of_instruction_bsn_
+ },
+ nicira = { # of_instruction_nicira_
+ }
+ ),
+}
# Set to empty dict if no extension instructions defined
extension_queue_prop_subtype = {}