From 0f3d72685339e8155b699fa48ee0c0caa92d9d3b Mon Sep 17 00:00:00 2001 From: Mikio Hara Date: Wed, 1 Jul 2009 13:27:21 -0700 Subject: [PATCH] Protocol stats: Revise to support new protocol messages and error codes --- lib/ofpstat.c | 21 +++++++++++++++++++++ lib/ofpstat.h | 7 +++++++ secchan/protocol-stat.c | 7 +++++++ utilities/dpctl.c | 35 +++++++++++++++++++++++------------ 4 files changed, 58 insertions(+), 12 deletions(-) diff --git a/lib/ofpstat.c b/lib/ofpstat.c index 911303b..706b163 100644 --- a/lib/ofpstat.c +++ b/lib/ofpstat.c @@ -100,6 +100,12 @@ inc_protocol_message(struct ofpstat *ifps, struct ofp_header *hdr) case OFPT_STATS_REPLY: INC_IFP_STAT(ifps, ofps_stats_reply); break; + case OFPT_BARRIER_REQUEST: + INC_IFP_STAT(ifps, ofps_barrier_request); + break; + case OFPT_BARRIER_REPLY: + INC_IFP_STAT(ifps, ofps_barrier_reply); + break; default: INC_IFP_STAT(ifps, ofps_unknown); break; @@ -120,6 +126,9 @@ inc_error_notification(struct ofpstat *ifps, struct ofp_header *hdr) case OFPHFC_INCOMPATIBLE: INC_IFP_STAT(ifps, ofps_error_code.hf_incompat); break; + case OFPHFC_EPERM: + INC_IFP_STAT(ifps, ofps_error_code.hf_eperm); + break; default: INC_IFP_STAT(ifps, ofps_error_code.unknown); break; @@ -140,6 +149,9 @@ inc_error_notification(struct ofpstat *ifps, struct ofp_header *hdr) case OFPBRC_BAD_VENDOR: INC_IFP_STAT(ifps, ofps_error_code.br_bad_vendor); break; + case OFPBRC_EPERM: + INC_IFP_STAT(ifps, ofps_error_code.br_eperm); + break; default: INC_IFP_STAT(ifps, ofps_error_code.unknown); break; @@ -166,6 +178,9 @@ inc_error_notification(struct ofpstat *ifps, struct ofp_header *hdr) case OFPBAC_BAD_ARGUMENT: INC_IFP_STAT(ifps, ofps_error_code.ba_bad_argument); break; + case OFPBAC_EPERM: + INC_IFP_STAT(ifps, ofps_error_code.ba_eperm); + break; default: INC_IFP_STAT(ifps, ofps_error_code.unknown); break; @@ -177,6 +192,12 @@ inc_error_notification(struct ofpstat *ifps, struct ofp_header *hdr) case OFPFMFC_ALL_TABLES_FULL: INC_IFP_STAT(ifps, ofps_error_code.fmf_all_tables_full); break; + case OFPFMFC_OVERLAP: + INC_IFP_STAT(ifps, ofps_error_code.fmf_overlap); + break; + case OFPFMFC_EPERM: + INC_IFP_STAT(ifps, ofps_error_code.fmf_eperm); + break; default: INC_IFP_STAT(ifps, ofps_error_code.unknown); break; diff --git a/lib/ofpstat.h b/lib/ofpstat.h index 53486d6..64bb77b 100644 --- a/lib/ofpstat.h +++ b/lib/ofpstat.h @@ -48,17 +48,22 @@ struct ofpstat { } ofps_error_type; struct { uint64_t hf_incompat; + uint64_t hf_eperm; uint64_t br_bad_version; uint64_t br_bad_type; uint64_t br_bad_stat; uint64_t br_bad_vendor; + uint64_t br_eperm; uint64_t ba_bad_type; uint64_t ba_bad_len; uint64_t ba_bad_vendor; uint64_t ba_bad_vendor_type; uint64_t ba_bad_out_port; uint64_t ba_bad_argument; + uint64_t ba_eperm; uint64_t fmf_all_tables_full; + uint64_t fmf_overlap; + uint64_t fmf_eperm; uint64_t unknown; } ofps_error_code; uint64_t ofps_echo_request; @@ -85,6 +90,8 @@ struct ofpstat { uint64_t ofps_port_mod; uint64_t ofps_stats_request; uint64_t ofps_stats_reply; + uint64_t ofps_barrier_request; + uint64_t ofps_barrier_reply; }; void ofpstat_inc_protocol_stat(struct ofpstat *, struct ofp_header *); diff --git a/secchan/protocol-stat.c b/secchan/protocol-stat.c index 8c0d2eb..404ed26 100644 --- a/secchan/protocol-stat.c +++ b/secchan/protocol-stat.c @@ -82,6 +82,8 @@ do { \ COPY_OFPS(dst_ofps, src_ofps, ofps_port_mod); \ COPY_OFPS(dst_ofps, src_ofps, ofps_stats_request); \ COPY_OFPS(dst_ofps, src_ofps, ofps_stats_reply); \ + COPY_OFPS(dst_ofps, src_ofps, ofps_barrier_request); \ + COPY_OFPS(dst_ofps, src_ofps, ofps_barrier_reply); \ \ COPY_OFPS(dst_ofps, src_ofps, ofps_error_type.hello_fail); \ COPY_OFPS(dst_ofps, src_ofps, ofps_error_type.bad_request); \ @@ -90,16 +92,21 @@ do { \ COPY_OFPS(dst_ofps, src_ofps, ofps_error_type.unknown); \ \ COPY_OFPS(dst_ofps, src_ofps, ofps_error_code.hf_incompat); \ + COPY_OFPS(dst_ofps, src_ofps, ofps_error_code.hf_eperm); \ COPY_OFPS(dst_ofps, src_ofps, ofps_error_code.br_bad_version); \ COPY_OFPS(dst_ofps, src_ofps, ofps_error_code.br_bad_type); \ COPY_OFPS(dst_ofps, src_ofps, ofps_error_code.br_bad_stat); \ COPY_OFPS(dst_ofps, src_ofps, ofps_error_code.br_bad_vendor); \ + COPY_OFPS(dst_ofps, src_ofps, ofps_error_code.br_eperm); \ COPY_OFPS(dst_ofps, src_ofps, ofps_error_code.ba_bad_type); \ COPY_OFPS(dst_ofps, src_ofps, ofps_error_code.ba_bad_len); \ COPY_OFPS(dst_ofps, src_ofps, ofps_error_code.ba_bad_vendor); \ COPY_OFPS(dst_ofps, src_ofps, ofps_error_code.ba_bad_vendor_type); \ COPY_OFPS(dst_ofps, src_ofps, ofps_error_code.ba_bad_out_port); \ + COPY_OFPS(dst_ofps, src_ofps, ofps_error_code.ba_eperm); \ COPY_OFPS(dst_ofps, src_ofps, ofps_error_code.fmf_all_tables_full); \ + COPY_OFPS(dst_ofps, src_ofps, ofps_error_code.fmf_overlap); \ + COPY_OFPS(dst_ofps, src_ofps, ofps_error_code.fmf_eperm); \ COPY_OFPS(dst_ofps, src_ofps, ofps_error_code.unknown); \ \ COPY_OFPS(dst_ofps, src_ofps, ofps_flow_mod_ops.add); \ diff --git a/utilities/dpctl.c b/utilities/dpctl.c index b6e205d..473607a 100644 --- a/utilities/dpctl.c +++ b/utilities/dpctl.c @@ -573,9 +573,12 @@ print_protocol_stat(struct ofpstat *ofps_rcvd, struct ofpstat *ofps_sent) ntohll(ifps->ofps_port_mod)); fprintf(stdout, PREFIX_STR - "%"PRIu64" stats, %"PRIu64" stats reply\n", + "%"PRIu64" stats, %"PRIu64" stats reply, " + "%"PRIu64" barrier, %"PRIu64" barrier reply\n", ntohll(ifps->ofps_stats_request), - ntohll(ifps->ofps_stats_reply)); + ntohll(ifps->ofps_stats_reply), + ntohll(ifps->ofps_barrier_request), + ntohll(ifps->ofps_barrier_reply)); } fprintf(stdout, "\n"); @@ -603,37 +606,45 @@ print_protocol_stat(struct ofpstat *ofps_rcvd, struct ofpstat *ofps_sent) ifps = i == 0 ? ofps_rcvd : ofps_sent; fprintf(stdout, "%s" - "%"PRIu64" hello fail: %"PRIu64" incompat\n", + "%"PRIu64" hello fail: %"PRIu64" incompat, %"PRIu64" eperm\n", i == 0 ? PREFIX_RCVD : PREFIX_SENT, ntohll(ifps->ofps_error_type.hello_fail), - ntohll(ifps->ofps_error_code.hf_incompat)); + ntohll(ifps->ofps_error_code.hf_incompat), + ntohll(ifps->ofps_error_code.hf_eperm)); fprintf(stdout, PREFIX_STR - "%"PRIu64" bad request: %"PRIu64" version, %"PRIu64" type, %"PRIu64" stat\n" + "%"PRIu64" bad request: %"PRIu64" version, %"PRIu64" type, " + "%"PRIu64" stat, %"PRIu64" vendor\n" PREFIX_STR - " %"PRIu64" vendor\n", + " %"PRIu64" eperm\n", ntohll(ifps->ofps_error_type.bad_request), ntohll(ifps->ofps_error_code.br_bad_version), ntohll(ifps->ofps_error_code.br_bad_type), ntohll(ifps->ofps_error_code.br_bad_stat), - ntohll(ifps->ofps_error_code.br_bad_vendor)); + ntohll(ifps->ofps_error_code.br_bad_vendor), + ntohll(ifps->ofps_error_code.br_eperm)); fprintf(stdout, PREFIX_STR - "%"PRIu64" bad action: %"PRIu64" type, %"PRIu64" len, %"PRIu64" vendor, %"PRIu64" vendor type\n" + "%"PRIu64" bad action: %"PRIu64" type, %"PRIu64" len, " + "%"PRIu64" vendor, %"PRIu64" vendor type\n" PREFIX_STR - " %"PRIu64" out port, %"PRIu64" argument\n", + " %"PRIu64" out port, %"PRIu64" argument, %"PRIu64" eperm\n", ntohll(ifps->ofps_error_type.bad_action), ntohll(ifps->ofps_error_code.ba_bad_type), ntohll(ifps->ofps_error_code.ba_bad_len), ntohll(ifps->ofps_error_code.ba_bad_vendor), ntohll(ifps->ofps_error_code.ba_bad_vendor_type), ntohll(ifps->ofps_error_code.ba_bad_out_port), - ntohll(ifps->ofps_error_code.ba_bad_argument)); + ntohll(ifps->ofps_error_code.ba_bad_argument), + ntohll(ifps->ofps_error_code.ba_eperm)); fprintf(stdout, PREFIX_STR - "%"PRIu64" flow mod fail: %"PRIu64" all tables full\n", + "%"PRIu64" flow mod fail: %"PRIu64" all tables full, " + "%"PRIu64" overlap, %"PRIu64" eperm\n", ntohll(ifps->ofps_error_type.flow_mod_fail), - ntohll(ifps->ofps_error_code.fmf_all_tables_full)); + ntohll(ifps->ofps_error_code.fmf_all_tables_full), + ntohll(ifps->ofps_error_code.fmf_overlap), + ntohll(ifps->ofps_error_code.fmf_eperm)); fprintf(stdout, PREFIX_STR "%"PRIu64" unknown type, %"PRIu64" unknown code\n",