ofproto: Provide cookie and xid values to wdp_flow_put().
authorBen Pfaff <blp@nicira.com>
Wed, 25 Aug 2010 00:05:19 +0000 (17:05 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 27 Aug 2010 17:18:00 +0000 (10:18 -0700)
Requested-by: Andrey Tsigler <atsigler@broadcom.com>
ofproto/ofproto.c
ofproto/wdp.h

index cd8e7f0..90bdf39 100644 (file)
@@ -82,7 +82,6 @@ ofproto_rule_init(struct wdp_rule *wdp_rule)
     wdp_rule->client_data = xzalloc(sizeof(struct ofproto_rule));
 }
 
-
 static inline bool
 rule_is_hidden(const struct wdp_rule *rule)
 {
@@ -1107,6 +1106,8 @@ ofproto_add_flow(struct ofproto *p, const flow_t *flow,
     put.idle_timeout = idle_timeout;
     put.hard_timeout = 0;
     put.ofp_table_id = 0xff;
+    put.cookie = htonll(0);
+    put.xid = htonl(0);
 
     if (!wdp_flow_put(p->wdp, &put, NULL, &rule)) {
         ofproto_rule_init(rule);
@@ -2117,6 +2118,8 @@ add_flow(struct ofproto *p, struct ofconn *ofconn,
     put.idle_timeout = ntohs(ofm->idle_timeout);
     put.hard_timeout = ntohs(ofm->hard_timeout);
     put.ofp_table_id = flow_mod_table_id(ofconn, ofm);
+    put.cookie = ofm->cookie;
+    put.xid = ofm->header.xid;
     error = wdp_flow_put(p->wdp, &put, NULL, &rule);
     if (error) {
         /* XXX wdp_flow_put should return OpenFlow error code. */
@@ -2286,6 +2289,8 @@ modify_flow(struct ofproto *p, const struct ofp_flow_mod *ofm,
     put.n_actions = n_actions;
     put.idle_timeout = put.hard_timeout = 0;
     put.ofp_table_id = rule->ofp_table_id;
+    put.cookie = ofm->cookie;
+    put.xid = ofm->header.xid;
     return wdp_flow_put(p->wdp, &put, NULL, NULL);
 }
 \f
index 1a89fed..c749f8a 100644 (file)
@@ -183,6 +183,15 @@ struct wdp_flow_put {
     /* OpenFlow 'table_id' to which a new flow is to be added.  Value 0xff
      * means that the WDP implementation should select a table. */
     uint8_t ofp_table_id;
+
+    /* If this is a new flow being created due to an OpenFlow OFPT_FLOW_MOD
+     * request, these values are copied from the ofp_header and ofp_flow_mod,
+     * respectively, in network byte order.  Otherwise they are zero.
+     *
+     * These values are provided to enable better logging.  The WDP provider
+     * may otherwise ignore them. */
+    uint64_t cookie;
+    uint32_t xid;
 };
 
 int wdp_flow_put(struct wdp *, struct wdp_flow_put *,