mirror of
https://github.com/openvswitch/ovs
synced 2025-09-04 16:25:17 +00:00
ofp-util: Use table_id in OF1.1 and OF1.2 Flow Remove Messages
Previously this field was ignored on decode and set to zero on encode Signed-off-by: Simon Horman <horms@verge.net.au> [blp@nicira.com changed "missing" value, removed OFPTT_ALL] Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
@@ -843,6 +843,10 @@ ofp_print_flow_removed(struct ds *string, const struct ofp_header *oh)
|
||||
ds_put_format(string, " reason=%s",
|
||||
ofp_flow_removed_reason_to_string(fr.reason));
|
||||
|
||||
if (fr.table_id != 255) {
|
||||
ds_put_format(string, " table_id=%"PRIu8, fr.table_id);
|
||||
}
|
||||
|
||||
if (fr.cookie != htonll(0)) {
|
||||
ds_put_format(string, " cookie:0x%"PRIx64, ntohll(fr.cookie));
|
||||
}
|
||||
|
@@ -1913,7 +1913,7 @@ ofputil_decode_flow_removed(struct ofputil_flow_removed *fr,
|
||||
fr->priority = ntohs(ofr->priority);
|
||||
fr->cookie = ofr->cookie;
|
||||
fr->reason = ofr->reason;
|
||||
/* XXX: ofr->table_id is ignored */
|
||||
fr->table_id = ofr->table_id;
|
||||
fr->duration_sec = ntohl(ofr->duration_sec);
|
||||
fr->duration_nsec = ntohl(ofr->duration_nsec);
|
||||
fr->idle_timeout = ntohs(ofr->idle_timeout);
|
||||
@@ -1929,6 +1929,7 @@ ofputil_decode_flow_removed(struct ofputil_flow_removed *fr,
|
||||
fr->priority = ntohs(ofr->priority);
|
||||
fr->cookie = ofr->cookie;
|
||||
fr->reason = ofr->reason;
|
||||
fr->table_id = 255;
|
||||
fr->duration_sec = ntohl(ofr->duration_sec);
|
||||
fr->duration_nsec = ntohl(ofr->duration_nsec);
|
||||
fr->idle_timeout = ntohs(ofr->idle_timeout);
|
||||
@@ -1952,6 +1953,7 @@ ofputil_decode_flow_removed(struct ofputil_flow_removed *fr,
|
||||
fr->priority = ntohs(nfr->priority);
|
||||
fr->cookie = nfr->cookie;
|
||||
fr->reason = nfr->reason;
|
||||
fr->table_id = 255;
|
||||
fr->duration_sec = ntohl(nfr->duration_sec);
|
||||
fr->duration_nsec = ntohl(nfr->duration_nsec);
|
||||
fr->idle_timeout = ntohs(nfr->idle_timeout);
|
||||
@@ -1985,7 +1987,7 @@ ofputil_encode_flow_removed(const struct ofputil_flow_removed *fr,
|
||||
ofr->cookie = fr->cookie;
|
||||
ofr->priority = htons(fr->priority);
|
||||
ofr->reason = fr->reason;
|
||||
ofr->table_id = 0;
|
||||
ofr->table_id = fr->table_id;
|
||||
ofr->duration_sec = htonl(fr->duration_sec);
|
||||
ofr->duration_nsec = htonl(fr->duration_nsec);
|
||||
ofr->idle_timeout = htons(fr->idle_timeout);
|
||||
|
@@ -243,6 +243,7 @@ struct ofputil_flow_removed {
|
||||
uint16_t priority;
|
||||
ovs_be64 cookie;
|
||||
uint8_t reason; /* One of OFPRR_*. */
|
||||
uint8_t table_id; /* 255 if message didn't include table ID. */
|
||||
uint32_t duration_sec;
|
||||
uint32_t duration_nsec;
|
||||
uint16_t idle_timeout;
|
||||
|
@@ -3225,6 +3225,7 @@ ofproto_rule_send_removed(struct rule *rule, uint8_t reason)
|
||||
fr.priority = rule->cr.priority;
|
||||
fr.cookie = rule->flow_cookie;
|
||||
fr.reason = reason;
|
||||
fr.table_id = rule->table_id;
|
||||
calc_flow_duration__(rule->created, time_msec(),
|
||||
&fr.duration_sec, &fr.duration_nsec);
|
||||
fr.idle_timeout = rule->idle_timeout;
|
||||
|
@@ -376,7 +376,7 @@ AT_CHECK([ovs-ofctl ofp-print "\
|
||||
80 00 01 05 00 00 00 01 00 98 96 80 00 3c 00 78 \
|
||||
00 00 00 00 00 12 d6 87 00 00 00 00 6f 68 ba 66 \
|
||||
00 01 00 0a 80 00 0c 02 10 09 00 00 00 00 00 00"], [0], [dnl
|
||||
OFPT_FLOW_REMOVED (OF1.2) (xid=0x0): dl_vlan=9 reason=hard cookie:0xfedcba9876543210 duration1.01s idle60 hard120 pkts1234567 bytes1869134438
|
||||
OFPT_FLOW_REMOVED (OF1.2) (xid=0x0): dl_vlan=9 reason=hard table_id=5 cookie:0xfedcba9876543210 duration1.01s idle60 hard120 pkts1234567 bytes1869134438
|
||||
])
|
||||
AT_CLEANUP
|
||||
|
||||
|
Reference in New Issue
Block a user