Suggested by Justin.
ofs->match.tp_src = flow->key.tp_src;
ofs->match.tp_dst = flow->key.tp_dst;
ofs->duration = htonl((jiffies - flow->init_time) / HZ);
- ofs->table_id = htons(table_idx);
+ ofs->table_id = table_idx;
ofs->packet_count = cpu_to_be64(flow->packet_count);
ofs->byte_count = cpu_to_be64(flow->byte_count);
}
struct sw_table_stats stats;
dp->chain->tables[i]->stats(dp->chain->tables[i], &stats);
strncpy(ots->name, stats.name, sizeof ots->name);
- ots->table_id = htons(i);
+ ots->table_id = i;
ots->pad[0] = ots->pad[1] = 0;
ots->max_entries = htonl(stats.max_flows);
ots->active_count = htonl(stats.n_flows);
used for non-aggregated results. */
uint64_t packet_count; /* Number of packets in flow. */
uint64_t byte_count; /* Number of bytes in flow. */
- uint16_t table_id; /* ID of table flow came from. */
- uint8_t pad[6]; /* Align to 64-bits. */
+ uint8_t table_id; /* ID of table flow came from. */
+ uint8_t pad[7]; /* Align to 64-bits. */
};
enum ofp_stat_type {
struct ofp_flow_stat_request {
struct ofp_header header;
struct ofp_match match; /* Fields to match */
- uint16_t table_id; /* ID of table to read (from ofp_table_stats)
+ uint8_t table_id; /* ID of table to read (from ofp_table_stats)
or 0xffff for all tables. */
uint8_t type; /* One of OFPFS_ */
- uint8_t pad; /* Align to 32-bits */
+ uint16_t pad; /* Align to 32-bits */
};
/* Current flow statistics reply */
/* Statistics about a particular table */
struct ofp_table_stats {
- uint16_t table_id;
- uint8_t pad[2]; /* Align to 32-bits */
+ uint8_t table_id;
+ uint8_t pad[3]; /* Align to 32-bits */
char name[OFP_MAX_TABLE_NAME_LEN];
uint32_t max_entries; /* Max number of entries supported */
uint32_t active_count; /* Number of active entries */
{
const struct ofp_flow_stat_request *fsr = oh;
- if (fsr->table_id == htons(0xffff)) {
+ if (fsr->table_id == 0xff) {
ds_put_format(string, " table_id=any, ");
} else {
- ds_put_format(string, " table_id=%"PRIu16", ", ntohs(fsr->table_id));
+ ds_put_format(string, " table_id=%"PRIu8", ", fsr->table_id);
}
if (fsr->type == OFPFS_INDIV) {
}
for (fs = &fsr->flows[0]; fs < &fsr->flows[n]; fs++) {
- ds_put_format(string, " table_id=%"PRIu16", ", ntohs(fs->table_id));
+ ds_put_format(string, " duration=%"PRIu32" s, ", ntohs(fs->duration));
+ ds_put_format(string, "table_id=%"PRIu8", ", fs->table_id);
ds_put_format(string, "n_packets=%"PRIu64", ",
ntohll(fs->packet_count));
ds_put_format(string, "n_bytes=%"PRIu64", ", ntohll(fs->byte_count));
- ds_put_format(string, "duration=%"PRIu32" s, ", ntohl(fs->duration));
ofp_print_match(string, &fs->match);
}
}
strncpy(name, ts->name, sizeof name);
name[OFP_MAX_TABLE_NAME_LEN] = '\0';
- ds_put_format(string, " table %"PRIu16": ", ntohs(ts->table_id));
+ ds_put_format(string, " table %"PRIu8": ", ts->table_id);
ds_put_format(string, "name %-8s, ", name);
ds_put_format(string, "max %6"PRIu32", ", ntohl(ts->max_entries));
ds_put_format(string, "active %6"PRIu32", ", ntohl(ts->active_count));
ofs->match.tp_src = flow->key.flow.tp_src;
ofs->match.tp_dst = flow->key.flow.tp_dst;
ofs->duration = htonl(now - flow->created);
- ofs->table_id = htons(table_idx);
+ ofs->table_id = table_idx;
ofs->packet_count = htonll(flow->packet_count);
ofs->byte_count = htonll(flow->byte_count);
}
struct sw_table_stats stats;
dp->chain->tables[i]->stats(dp->chain->tables[i], &stats);
strncpy(ots->name, stats.name, sizeof ots->name);
- ots->table_id = htons(i);
+ ots->table_id = i;
ots->pad[0] = ots->pad[1] = 0;
ots->max_entries = htonl(stats.max_flows);
ots->active_count = htonl(stats.n_flows);
static void
str_to_flow(char *string, struct ofp_match *match, struct ofp_action *action,
- uint16_t *table_idx)
+ uint8_t *table_idx)
{
struct field {
const char *name;
bool got_action = false;
if (table_idx) {
- *table_idx = htons(0xffff);
+ *table_idx = 0xff;
}
memset(match, 0, sizeof *match);
wildcards = OFPFW_ALL;
}
if (table_idx && !strcmp(name, "table")) {
- *table_idx = htons(atoi(value));
+ *table_idx = atoi(value);
continue;
}