- Add priority to flow expiration messages.
authorJustin Pettit <jpettit@nicira.com>
Fri, 2 May 2008 00:10:20 +0000 (17:10 -0700)
committerJustin Pettit <jpettit@nicira.com>
Fri, 2 May 2008 00:11:29 +0000 (17:11 -0700)
- Clear contents of "pad" field port status messages.

datapath/datapath.c
include/openflow.h
lib/ofp-print.c
switch/datapath.c

index d5cd1dc..1f7d432 100644 (file)
@@ -788,6 +788,7 @@ send_port_status(struct net_bridge_port *p, uint8_t status)
        if (!ops)
                return -ENOMEM;
        ops->reason = status;
+       memset(ops->pad, 0, sizeof ops->pad);
        fill_port_desc(p, &ops->desc);
 
        return send_openflow_skb(skb, NULL);
@@ -805,10 +806,15 @@ dp_send_flow_expired(struct datapath *dp, struct sw_flow *flow)
                return -ENOMEM;
 
        flow_fill_match(&ofe->match, &flow->key);
+
+       memset(ofe->pad, 0, sizeof ofe->pad);
+       ofe->priority = htons(flow->priority);
+
        duration_j = (flow->timeout - HZ * flow->max_idle) - flow->init_time;
-       ofe->duration   = htonl(duration_j / HZ);
-       ofe->packet_count   = cpu_to_be64(flow->packet_count);
-       ofe->byte_count     = cpu_to_be64(flow->byte_count);
+       ofe->duration     = htonl(duration_j / HZ);
+       ofe->packet_count = cpu_to_be64(flow->packet_count);
+       ofe->byte_count   = cpu_to_be64(flow->byte_count);
+
        return send_openflow_skb(skb, NULL);
 }
 
index 776dafd..10eee8b 100644 (file)
@@ -50,7 +50,7 @@
 /* The most significant bit being set in the version field indicates an
  * experimental OpenFlow version.  
  */
-#define OFP_VERSION   0x82
+#define OFP_VERSION   0x83
 
 #define OFP_MAX_TABLE_NAME_LEN 32
 #define OFP_MAX_PORT_NAME_LEN  16
@@ -350,6 +350,9 @@ struct ofp_flow_expired {
     struct ofp_header header;
     struct ofp_match match;   /* Description of fields */
 
+    uint16_t priority;        /* Priority level of flow entry. */
+    uint8_t pad[2];           /* Align to 32-bits. */
+
     uint32_t duration;        /* Time flow was alive in seconds. */
     uint64_t packet_count;    
     uint64_t byte_count;
index 4c19bb9..d5dc0d8 100644 (file)
@@ -406,8 +406,10 @@ ofp_print_flow_expired(struct ds *string, const void *oh, size_t len,
 
     ofp_print_match(string, &ofe->match);
     ds_put_format(string, 
-         " secs%d pkts%lld bytes%lld\n", ntohl(ofe->duration),
-         ntohll(ofe->packet_count), ntohll(ofe->byte_count));
+         " pri%d secs%d pkts%lld bytes%lld\n", 
+         ofe->match.wildcards ? ntohs(ofe->priority) : (uint16_t)-1,
+         ntohl(ofe->duration), ntohll(ofe->packet_count), 
+         ntohll(ofe->byte_count));
 }
 
 /* Pretty-print the OFPT_ERROR_MSG packet of 'len' bytes at 'oh' to 'string'
index b569b77..c1b124b 100644 (file)
@@ -674,8 +674,10 @@ send_port_status(struct sw_port *p, uint8_t status)
     struct ofp_port_status *ops;
     ops = alloc_openflow_buffer(p->dp, sizeof *ops, OFPT_PORT_STATUS, NULL,
                                 &buffer);
-    ops->reason         = status;
+    ops->reason = status;
+    memset(ops->pad, 0, sizeof ops->pad);
     fill_port_desc(p->dp, p, &ops->desc);
+
     send_openflow_buffer(p->dp, buffer, NULL);
 }
 
@@ -687,9 +689,13 @@ send_flow_expired(struct datapath *dp, struct sw_flow *flow)
     ofe = alloc_openflow_buffer(dp, sizeof *ofe, OFPT_FLOW_EXPIRED, NULL,
                                 &buffer);
     flow_fill_match(&ofe->match, &flow->key);
-    ofe->duration   = htonl(flow->timeout - flow->max_idle - flow->created);
-    ofe->packet_count   = htonll(flow->packet_count);
-    ofe->byte_count     = htonll(flow->byte_count);
+
+    memset(ofe->pad, 0, sizeof ofe->pad);
+    ofe->priority = htons(flow->priority);
+
+    ofe->duration     = htonl(flow->timeout - flow->max_idle - flow->created);
+    ofe->packet_count = htonll(flow->packet_count);
+    ofe->byte_count   = htonll(flow->byte_count);
     send_openflow_buffer(dp, buffer, NULL);
 }