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

Simon Horman horms at verge.net.au
Mon Jun 25 06:44:41 UTC 2012


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

---

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
---
 lib/ofp-util.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 42955e0..44d3f2a 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -3337,7 +3337,15 @@ ofputil_encode_packet_out(const struct ofputil_packet_out *po,
         packet_len = po->packet_len;
     }
 
-    if (ofp_version == OFP10_VERSION) {
+    if (ofp_version == OFP11_VERSION || ofp_version == OFP12_VERSION) {
+        struct ofp11_packet_out *opo;
+
+        msg = ofpbuf_new(packet_len + sizeof *opo);
+        opo = put_openflow(sizeof *opo, ofp_version, OFPT11_PACKET_OUT, msg);
+        opo->buffer_id = htonl(po->buffer_id);
+        opo->in_port = ofputil_port_to_ofp11(po->in_port);
+        opo->actions_len = htons(msg->size - sizeof *opo);
+    } else if (ofp_version == OFP10_VERSION) {
         struct ofp_packet_out *opo;
 
         msg = ofpbuf_new(packet_len + sizeof *opo);
-- 
1.7.10.2.484.gcd07cc5




More information about the dev mailing list