Previously this field was ignored on decode and set to zero on encode Also add OFPTT_ALL and OFPTT_MAX and use OFPTT_ALL in the one location where it seems appropriate.
Signed-off-by: Simon Horman <ho...@verge.net.au> --- include/openflow/openflow-1.1.h | 9 +++++++++ lib/ofp-print.c | 4 ++++ lib/ofp-util.c | 8 +++++--- lib/ofp-util.h | 1 + ofproto/ofproto.c | 1 + tests/ofp-print.at | 2 +- 6 files changed, 21 insertions(+), 4 deletions(-) diff --git a/include/openflow/openflow-1.1.h b/include/openflow/openflow-1.1.h index 9785db4..8cead55 100644 --- a/include/openflow/openflow-1.1.h +++ b/include/openflow/openflow-1.1.h @@ -771,4 +771,13 @@ struct ofp11_flow_removed { }; OFP_ASSERT(sizeof(struct ofp11_flow_removed) == 40); +enum ofp_table { + /* Last usable table number. */ + OFPTT_MAX = 0xfe, + /* Fake tables. */ + OFPTT_ALL = 0xff + /* Wildcard table used for table config, flow stats and flow deletes. */ +}; + + #endif /* openflow/openflow-1.1.h */ diff --git a/lib/ofp-print.c b/lib/ofp-print.c index 6789625..7682b7f 100644 --- a/lib/ofp-print.c +++ b/lib/ofp-print.c @@ -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) { + 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)); } diff --git a/lib/ofp-util.c b/lib/ofp-util.c index c78199f..4417e2c 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -1249,7 +1249,7 @@ ofputil_decode_flow_mod(struct ofputil_flow_mod *fm, fm->table_id = command >> 8; } else { fm->command = command; - fm->table_id = 0xff; + fm->table_id = OFPTT_ALL; } } @@ -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 = 0; 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 = 0; 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); diff --git a/lib/ofp-util.h b/lib/ofp-util.h index 38e7b02..80de72d 100644 --- a/lib/ofp-util.h +++ b/lib/ofp-util.h @@ -243,6 +243,7 @@ struct ofputil_flow_removed { uint16_t priority; ovs_be64 cookie; uint8_t reason; /* One of OFPRR_*. */ + uint8_t table_id; uint32_t duration_sec; uint32_t duration_nsec; uint16_t idle_timeout; diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 7c92d71..52203fd 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -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; diff --git a/tests/ofp-print.at b/tests/ofp-print.at index c2eb002..fee3d28 100644 --- a/tests/ofp-print.at +++ b/tests/ofp-print.at @@ -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 -- 1.7.10.4 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev