From 682c44b286d7e4622d56b52076756733747b9bb4 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 24 Aug 2010 17:05:19 -0700 Subject: [PATCH] ofproto: Provide cookie and xid values to wdp_flow_put(). Requested-by: Andrey Tsigler --- ofproto/ofproto.c | 7 ++++++- ofproto/wdp.h | 9 +++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index cd8e7f045..90bdf393b 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -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); } diff --git a/ofproto/wdp.h b/ofproto/wdp.h index 1a89fed68..c749f8a1b 100644 --- a/ofproto/wdp.h +++ b/ofproto/wdp.h @@ -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 *, -- 2.47.0