return ap < bp ? -1 : ap > bp;
}
+static void ofp_print_port_features(struct ds *string, uint32_t features)
+{
+ if (features == 0) {
+ ds_put_cstr(string, "Unsupported\n");
+ return;
+ }
+ if (features & OFPPF_10MB_HD) {
+ ds_put_cstr(string, "10MB-HD ");
+ }
+ if (features & OFPPF_10MB_FD) {
+ ds_put_cstr(string, "10MB-FD ");
+ }
+ if (features & OFPPF_100MB_HD) {
+ ds_put_cstr(string, "100MB-HD ");
+ }
+ if (features & OFPPF_100MB_FD) {
+ ds_put_cstr(string, "100MB-FD ");
+ }
+ if (features & OFPPF_1GB_HD) {
+ ds_put_cstr(string, "1GB-HD ");
+ }
+ if (features & OFPPF_1GB_FD) {
+ ds_put_cstr(string, "1GB-FD ");
+ }
+ if (features & OFPPF_10GB_FD) {
+ ds_put_cstr(string, "10GB-FD ");
+ }
+ if (features & OFPPF_COPPER) {
+ ds_put_cstr(string, "COPPER ");
+ }
+ if (features & OFPPF_FIBER) {
+ ds_put_cstr(string, "FIBER ");
+ }
+ if (features & OFPPF_AUTONEG) {
+ ds_put_cstr(string, "AUTO_NEG ");
+ }
+ if (features & OFPPF_PAUSE) {
+ ds_put_cstr(string, "AUTO_PAUSE ");
+ }
+ if (features & OFPPF_PAUSE_ASYM) {
+ ds_put_cstr(string, "AUTO_PAUSE_ASYM ");
+ }
+ ds_put_char(string, '\n');
+}
+
static void
ofp_print_phy_port(struct ds *string, const struct ofp_phy_port *port)
{
ds_put_char(string, ' ');
ofp_print_port_name(string, ntohs(port->port_no));
- ds_put_format(string, "(%s): addr:"ETH_ADDR_FMT", speed:%d, flags:%#x, "
- "feat:%#x\n", name,
- ETH_ADDR_ARGS(port->hw_addr), ntohl(port->speed),
- ntohl(port->flags), ntohl(port->features));
+ ds_put_format(string, "(%s): addr:"ETH_ADDR_FMT", config: %#x, state:%#x\n",
+ name, ETH_ADDR_ARGS(port->hw_addr), ntohl(port->config),
+ ntohl(port->state));
+ if (port->curr) {
+ ds_put_format(string, " current: ");
+ ofp_print_port_features(string, ntohl(port->curr));
+ }
+ if (port->advertised) {
+ ds_put_format(string, " advertised: ");
+ ofp_print_port_features(string, ntohl(port->advertised));
+ }
+ if (port->supported) {
+ ds_put_format(string, " supported: ");
+ ofp_print_port_features(string, ntohl(port->supported));
+ }
+ if (port->peer) {
+ ds_put_format(string, " peer: ");
+ ofp_print_port_features(string, ntohl(port->peer));
+ }
}
/* Pretty-print the struct ofp_switch_features of 'len' bytes at 'oh' to
const struct ofp_flow_mod *ofm = oh;
ofp_print_match(string, &ofm->match, verbosity);
- ds_put_format(string, " cmd:%d idle:%d hard:%d pri:%d buf:%#x",
- ntohs(ofm->command), ntohs(ofm->idle_timeout),
- ntohs(ofm->hard_timeout),
+ switch (ntohs(ofm->command)) {
+ case OFPFC_ADD:
+ ds_put_cstr(string, " ADD: ");
+ break;
+ case OFPFC_MODIFY:
+ ds_put_cstr(string, " MOD: ");
+ break;
+ case OFPFC_MODIFY_STRICT:
+ ds_put_cstr(string, " MOD_STRICT: ");
+ break;
+ case OFPFC_DELETE:
+ ds_put_cstr(string, " DEL: ");
+ break;
+ case OFPFC_DELETE_STRICT:
+ ds_put_cstr(string, " DEL_STRICT: ");
+ break;
+ default:
+ ds_put_format(string, " cmd:%d ", ntohs(ofm->command));
+ }
+ ds_put_format(string, "idle:%d hard:%d pri:%d buf:%#x",
+ ntohs(ofm->idle_timeout), ntohs(ofm->hard_timeout),
ofm->match.wildcards ? ntohs(ofm->priority) : (uint16_t)-1,
ntohl(ofm->buffer_id));
ofp_print_actions(string, ofm->actions,
const struct ofp_port_status *ops = oh;
if (ops->reason == OFPPR_ADD) {
- ds_put_format(string, "add:");
+ ds_put_format(string, " ADD:");
} else if (ops->reason == OFPPR_DELETE) {
- ds_put_format(string, "del:");
- } else if (ops->reason == OFPPR_MOD) {
- ds_put_format(string, "mod:");
- } else {
- ds_put_format(string, "err:");
+ ds_put_format(string, " DEL:");
+ } else if (ops->reason == OFPPR_MODIFY) {
+ ds_put_format(string, " MOD:");
}
ofp_print_phy_port(string, &ops->desc);
ds_put_format(string, " %d: %-8s: ", ts->table_id, name);
ds_put_format(string, "wild=0x%05"PRIx32", ", ntohl(ts->wildcards));
ds_put_format(string, "max=%6"PRIu32", ", ntohl(ts->max_entries));
- ds_put_format(string, "active=%6"PRIu32", ", ntohl(ts->active_count));
- ds_put_format(string, "matched=%6"PRIu64"\n",
- ntohll(ts->matched_count));
+ ds_put_format(string, "active=%"PRIu32"\n", ntohl(ts->active_count));
+ ds_put_cstr(string, " ");
+ ds_put_format(string, "lookup=%"PRIu64", ",
+ ntohll(ts->lookup_count));
+ ds_put_format(string, "matched=%"PRIu64"\n",
+ ntohll(ts->matched_count));
}
}