[ovs-dev] [PATCH 21/45] ofp-util: Allow encoding of Open Flow 1.1 and 1.2 Packet Out Messages

Simon Horman horms at verge.net.au
Mon Jul 30 02:03:19 UTC 2012


Signed-off-by: Simon Horman <horms at verge.net.au>

---

v8
* Manual Rebase
* ofpacts_put_openflow11_actions() now returns the length of encoded
  actions, make use of this.

v7
* Manual Rebase

v6
* No change

v5
* No change

v4
* Manual rebase

v3
* Correct title: this patch relates to Packet Out not Packet In
* Correct decoding of buffer_id, it is 32bits wide not 16bits wide
* Add decoding of stats reply messages

v2
* No change

ofp-actions: Return action size

Modify ofpacts_put_openflow11_actions() to return the length of actions
appended. This will be used when encoding Packet Out messages for
Open Flow 1.1 and 1.2. The motivation for this is to avoid open coding
the size calculation which may end up being needed elsewhere too.

Signed-off-by: Simon Horman <horms at verge.net.au>
---
 lib/ofp-util.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index b833335..408bdd2 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -3151,7 +3151,21 @@ ofputil_encode_packet_out(const struct ofputil_packet_out *po,
     }
 
     case OFP11_VERSION:
-    case OFP12_VERSION:
+    case OFP12_VERSION: {
+        struct ofp11_packet_out *opo;
+        size_t len;
+
+        msg = ofpraw_alloc(OFPRAW_OFPT11_PACKET_OUT, ofp_version, size);
+        ofpbuf_put_zeros(msg, sizeof *opo);
+        len = ofpacts_put_openflow11_actions(po->ofpacts, po->ofpacts_len, msg);
+
+        opo = msg->l3;
+        opo->buffer_id = htonl(po->buffer_id);
+        opo->in_port = ofputil_port_to_ofp11(po->in_port);
+        opo->actions_len = htons(len);
+        break;
+    }
+
     default:
         NOT_REACHED();
     }
-- 
1.7.10.2.484.gcd07cc5




More information about the dev mailing list