[ovs-dev] [PATCH 9/9] ofp-actions: add func to get inst name by OpenFlow instruction type directly.
Alexander Wu
alexander.wu at huawei.com
Thu Nov 21 09:04:36 UTC 2013
V3:
First commit. Add translate function from OpenFlow enum to OVS-internal enum.
Signed-off-by: Alexander Wu <alexander.wu at huawei.com>
---
lib/ofp-actions.c | 16 ++++++++++++++++
lib/ofp-actions.h | 3 +++
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c
index 4558669..4f065df 100644
--- a/lib/ofp-actions.c
+++ b/lib/ofp-actions.c
@@ -1637,6 +1637,22 @@ ovs_instruction_type_from_ofpact_type(enum ofpact_type type)
}
}
+enum ovs_instruction_type
+ovs_instruction_type_from_inst_type(const uint16_t inst_type)
+{
+ switch (inst_type) {
+
+#define DEFINE_INST(ENUM, STRUCT, EXTENSIBLE, NAME) \
+ case ENUM: \
+ return OVSINST_##ENUM;
+OVS_INSTRUCTIONS
+#undef DEFINE_INST
+
+ default:
+ return OFPERR_OFPTFFC_BAD_ARGUMENT;
+ }
+}
+
static inline struct ofp11_instruction *
instruction_next(const struct ofp11_instruction *inst)
{
diff --git a/lib/ofp-actions.h b/lib/ofp-actions.h
index 70ad4b6..72842e6 100644
--- a/lib/ofp-actions.h
+++ b/lib/ofp-actions.h
@@ -760,4 +760,7 @@ const char *ovs_instruction_name_from_type(enum ovs_instruction_type type);
int ovs_instruction_type_from_name(const char *name);
enum ovs_instruction_type ovs_instruction_type_from_ofpact_type(
enum ofpact_type);
+enum ovs_instruction_type ovs_instruction_type_from_inst_type(
+ const uint16_t oinst_type);
+
#endif /* ofp-actions.h */
--
1.7.3.1.msysgit.0
More information about the dev
mailing list