#include "compiler.h"
#include "dynamic-string.h"
#include "flow.h"
+#include "learn.h"
#include "multipath.h"
#include "nx-match.h"
#include "ofp-util.h"
#include "unaligned.h"
#include "util.h"
-static void ofp_print_port_name(struct ds *string, uint16_t port);
static void ofp_print_queue_name(struct ds *string, uint32_t port);
static void ofp_print_error(struct ds *, int error);
ds_put_format(string, " total_len=%"PRIu16" in_port=",
ntohs(op->total_len));
- ofp_print_port_name(string, ntohs(op->in_port));
+ ofputil_format_port(ntohs(op->in_port), string);
if (op->reason == OFPR_ACTION)
ds_put_cstr(string, " (via action)");
}
}
-static void ofp_print_port_name(struct ds *string, uint16_t port)
-{
- const char *name;
- switch (port) {
- case OFPP_IN_PORT:
- name = "IN_PORT";
- break;
- case OFPP_TABLE:
- name = "TABLE";
- break;
- case OFPP_NORMAL:
- name = "NORMAL";
- break;
- case OFPP_FLOOD:
- name = "FLOOD";
- break;
- case OFPP_ALL:
- name = "ALL";
- break;
- case OFPP_CONTROLLER:
- name = "CONTROLLER";
- break;
- case OFPP_LOCAL:
- name = "LOCAL";
- break;
- case OFPP_NONE:
- name = "NONE";
- break;
- default:
- ds_put_format(string, "%"PRIu16, port);
- return;
- }
- ds_put_cstr(string, name);
-}
-
-
static void
print_note(struct ds *string, const struct nx_action_note *nan)
{
if (port < OFPP_MAX) {
ds_put_format(s, "output:%"PRIu16, port);
} else {
- ofp_print_port_name(s, port);
+ ofputil_format_port(port, s);
if (port == OFPP_CONTROLLER) {
if (a->output.max_len != htons(0)) {
ds_put_format(s, ":%"PRIu16, ntohs(a->output.max_len));
case OFPUTIL_OFPAT_ENQUEUE:
oae = (const struct ofp_action_enqueue *) a;
ds_put_format(s, "enqueue:");
- ofp_print_port_name(s, ntohs(oae->port));
+ ofputil_format_port(ntohs(oae->port), s);
ds_put_format(s, "q%"PRIu32, ntohl(oae->queue_id));
break;
case OFPUTIL_NXAST_RESUBMIT:
nar = (struct nx_action_resubmit *)a;
ds_put_format(s, "resubmit:");
- ofp_print_port_name(s, ntohs(nar->in_port));
+ ofputil_format_port(ntohs(nar->in_port), s);
break;
case OFPUTIL_NXAST_RESUBMIT_TABLE:
nar = (struct nx_action_resubmit *)a;
ds_put_format(s, "resubmit(");
if (nar->in_port != htons(OFPP_IN_PORT)) {
- ofp_print_port_name(s, ntohs(nar->in_port));
+ ofputil_format_port(ntohs(nar->in_port), s);
}
ds_put_char(s, ',');
if (nar->table != 255) {
nxm_decode_n_bits(naor->ofs_nbits));
break;
+ case OFPUTIL_NXAST_LEARN:
+ learn_format((const struct nx_action_learn *) a, s);
+ break;
+
default:
break;
}
size_t actions_len = ntohs(opo->actions_len);
ds_put_cstr(string, " in_port=");
- ofp_print_port_name(string, ntohs(opo->in_port));
+ ofputil_format_port(ntohs(opo->in_port), string);
ds_put_format(string, " actions_len=%zu ", actions_len);
if (actions_len > (ntohs(opo->header.length) - sizeof *opo)) {
name[j] = '\0';
ds_put_char(string, ' ');
- ofp_print_port_name(string, ntohs(port->port_no));
+ ofputil_format_port(ntohs(port->port_no), string);
ds_put_format(string, "(%s): addr:"ETH_ADDR_FMT"\n",
name, ETH_ADDR_ARGS(port->hw_addr));
if (fsr.out_port != OFPP_NONE) {
ds_put_cstr(string, " out_port=");
- ofp_print_port_name(string, fsr.out_port);
+ ofputil_format_port(fsr.out_port, string);
}
/* A flow stats request doesn't include a priority, but cls_rule_format()
const struct ofp_queue_stats_request *qsr)
{
ds_put_cstr(string, "port=");
- ofp_print_port_name(string, ntohs(qsr->port_no));
+ ofputil_format_port(ntohs(qsr->port_no), string);
ds_put_cstr(string, " queue=");
ofp_print_queue_name(string, ntohl(qsr->queue_id));
for (; n--; qs++) {
ds_put_cstr(string, " port ");
- ofp_print_port_name(string, ntohs(qs->port_no));
+ ofputil_format_port(ntohs(qs->port_no), string);
ds_put_cstr(string, " queue ");
ofp_print_queue_name(string, ntohl(qs->queue_id));
ds_put_cstr(string, ": ");