[ovs-discuss] problem compiling ovs-2.3.2 extended with a new definition of action.
Haosen Wen
wenhaosen at gmail.com
Fri Apr 22 07:55:07 UTC 2016
Hi all,
I'm trying to add a new action, "FLAT" to ovs-2.3.2 action definitions.
When compiling, I met the following errors:
*lib/ofp-actions.c: In function 'ofpact_from_openflow11':*
*lib/ofp-actions.c:1155:5: error: duplicate case value*
*lib/ofp-util.def:66:1: error: previously used here*
and here is the content of the patch of my version:
diff -ru
/home/hensen/ovs-origin/openvswitch-2.3.2/include/openflow/openflow-1.3.h
./include/openflow/openflow-1.3.h
---
/home/hensen/ovs-origin/openvswitch-2.3.2/include/openflow/openflow-1.3.h
2015-06-19
03:32:47.000000000 +0800
+++ ./include/openflow/openflow-1.3.h 2016-04-21 17:46:13.365100554 +0800
@@ -121,7 +121,8 @@
OFPAT13_DEC_NW_TTL = 24, /* Decrement IP TTL. */
OFPAT13_SET_FIELD = 25, /* Set a header field using OXM TLV
format. */
OFPAT13_PUSH_PBB = 26, /* Push a new PBB service tag (I-TAG) */
- OFPAT13_POP_PBB = 27 /* Pop the outer PBB service tag (I-TAG) */
+ OFPAT13_POP_PBB = 27, /* Pop the outer PBB service tag (I-TAG) */
+ OFPAT13_FLAT = 4096 /*hs: for FLAT*/
};
/* enum ofp_config_flags value OFPC_INVALID_TTL_TO_CONTROLLER
@@ -138,6 +139,17 @@
OFPFF13_NO_BYT_COUNTS = 1 << 4 /* Don't keep track of byte count. */
};
+/*hs: Action structure for FLAT.*/
+struct flat_action{
+ /*hs: it's kind of dirty, i'd say...*/
+ ovs_be16 type; /* flat, 4096 */
+ ovs_be16 len; /* Length is 16. */
+ ovs_be16 timeflake; /* FLAT timeflake, 1 or 5 */
+ ovs_be16 max_len;
+ ovs_be32 port; /* Output port. */
+ uint8_t pad[4]; /* 8-byte alignment rule */
+};
+
/* Common header for all meter bands */
struct ofp13_meter_band_header {
ovs_be16 type; /* One of OFPMBT_*. */
diff -ru /home/hensen/ovs-origin/openvswitch-2.3.2/lib/ofp-actions.c
./lib/ofp-actions.c
--- /home/hensen/ovs-origin/openvswitch-2.3.2/lib/ofp-actions.c 2015-06-19
03:32:47.000000000 +0800
+++ ./lib/ofp-actions.c 2016-04-21 18:00:44.869107865 +0800
@@ -35,7 +35,7 @@
/* Converting OpenFlow 1.0 to ofpacts. */
-union ofp_action {
+union ofp_action {/*hs: action list*/
ovs_be16 type;
struct ofp_action_header header;
struct ofp_action_vendor_header vendor;
@@ -81,6 +81,7 @@
struct nx_action_learn learn;
struct nx_action_mpls_label mpls_label;
struct nx_action_mpls_tc mpls_tc;
+ struct flat_action flat;/*hs:*/
};
static enum ofperr
@@ -1151,6 +1152,10 @@
case OFPUTIL_OFPAT11_OUTPUT:
return output_from_openflow11(&a->ofp11_output, out);
+ case OFPUTIL_OFPAT13_FLAT:/*hs: TODO: need further extension.*/
+ ofpact_put_FLAT(out);
+ break;
+
case OFPUTIL_OFPAT11_SET_VLAN_VID:
if (a->vlan_vid.vlan_vid & ~htons(0xfff)) {
return OFPERR_OFPBAC_BAD_ARGUMENT;
@@ -1589,6 +1594,7 @@
case OFPACT_GOTO_TABLE:
return OVSINST_OFPIT11_GOTO_TABLE;
case OFPACT_OUTPUT:
+ case OFPACT_FLAT:/*hs: for abstract action type verification.*/
case OFPACT_GROUP:
case OFPACT_CONTROLLER:
case OFPACT_ENQUEUE:
@@ -1906,12 +1912,16 @@
{
const struct ofpact_enqueue *enqueue;
const struct mf_field *mf;
+ FILE *fp;/*hs: for testing.*/
switch (a->type) {
case OFPACT_OUTPUT:
return ofpact_check_output_port(ofpact_get_OUTPUT(a)->port,
max_ports);
+ case OFPACT_FLAT:/*hs:for ofpact consistency detection. TODO: output
port check as OUTPUT does.*/
+ return 0;
+
case OFPACT_CONTROLLER:
return 0;
diff -ru /home/hensen/ovs-origin/openvswitch-2.3.2/lib/ofp-actions.h
./lib/ofp-actions.h
--- /home/hensen/ovs-origin/openvswitch-2.3.2/lib/ofp-actions.h 2015-06-19
03:32:47.000000000 +0800
+++ ./lib/ofp-actions.h 2016-04-21 17:30:03.925092421 +0800
@@ -108,7 +108,10 @@
DEFINE_OFPACT(CLEAR_ACTIONS, ofpact_null, ofpact) \
DEFINE_OFPACT(WRITE_ACTIONS, ofpact_nest, ofpact) \
DEFINE_OFPACT(WRITE_METADATA, ofpact_metadata, ofpact) \
- DEFINE_OFPACT(GOTO_TABLE, ofpact_goto_table, ofpact)
+ DEFINE_OFPACT(GOTO_TABLE, ofpact_goto_table, ofpact) \
+ \
+ /*hs:FLAT */ \
+ DEFINE_OFPACT(FLAT, ofpact_flat, ofpact)
/* enum ofpact_type, with a member OFPACT_<ENUM> for each action. */
enum OVS_PACKED_ENUM ofpact_type {
@@ -201,6 +204,17 @@
struct ofpact ofpact;
};
+/*hs:OFPACT_FLAT.
+ *
+ * Used for OFPAT_FLAT. */
+struct ofpact_flat{/*i don't know if it's right...with no pads.*/
+ struct ofpact ofpact;
+ ovs_be16 timeflake; /* FLAT timeflake, 1 or 5 */
+ ovs_be16 max_len;
+ ofp_port_t port; /* Output port. */
+};
+
+
/* OFPACT_OUTPUT.
*
* Used for OFPAT10_OUTPUT. */
diff -ru /home/hensen/ovs-origin/openvswitch-2.3.2/lib/ofp-util.def
./lib/ofp-util.def
--- /home/hensen/ovs-origin/openvswitch-2.3.2/lib/ofp-util.def 2015-06-19
03:32:47.000000000 +0800
+++ ./lib/ofp-util.def 2016-04-20 18:38:53.288230912 +0800
@@ -63,6 +63,7 @@
OFPAT13_ACTION(OFPAT13_SET_FIELD, ofp12_action_set_field, 1,
"set_field")
OFPAT13_ACTION(OFPAT13_PUSH_PBB, ofp11_action_push, 0, "push_pbb")
OFPAT13_ACTION(OFPAT13_POP_PBB, ofp_action_header, 0, "pop_pbb")
+OFPAT13_ACTION(OFPAT13_FLAT, flat_action, 0, "flat")
#ifndef NXAST_ACTION
#define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME)
As the code suggests, the ofp13_type is set as 0x1000(4096). I haven't
finish the execution module of this action, but up to now, the error kept
coming up and I can't continue.
What's the problem of my extension? Did I miss anything?
Thanks a lot,
Hs
Haosen Wen
Beijing Foreign Studies University
Addr: 2nd Xisanhuan North Ave., Haidian Dist., Beijing, China
E-Mail: wenhaosen at gmail.com
Tel: 86-183-1003-2269
Site: http://www.hensen-wen.cn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openvswitch.org/pipermail/ovs-discuss/attachments/20160422/23f68f97/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ovs+flat3.patch
Type: text/x-patch
Size: 5267 bytes
Desc: not available
URL: <http://openvswitch.org/pipermail/ovs-discuss/attachments/20160422/23f68f97/attachment-0002.bin>
More information about the discuss
mailing list