AC_PREREQ(2.59)
-AC_INIT(openflow, v0.2.1, info@openflowswitch.org)
+AC_INIT(openflow, v0.2.2a2, info@openflowswitch.org)
AM_INIT_AUTOMAKE
AC_PROG_CC
const struct ofp_match *match)
{
struct sk_buff *skb;
- struct ofp_flow_stat_reply *fsr;
+ struct ofp_flow_stats_reply *fsr;
size_t header_size, fudge, flow_size;
struct sw_flow_key match_key;
int table_idx, n_flows, max_flows;
- header_size = offsetof(struct ofp_flow_stat_reply, flows);
+ header_size = offsetof(struct ofp_flow_stats_reply, flows);
fudge = 128;
flow_size = sizeof fsr->flows[0];
max_flows = (NLMSG_GOODSIZE - header_size - fudge) / flow_size;
fsr = alloc_openflow_skb(dp, header_size + max_flows * flow_size,
- OFPT_FLOW_STAT_REPLY, sender, &skb);
+ OFPT_FLOW_STATS_REPLY, sender, &skb);
if (!fsr)
return -ENOMEM;
}
static int
-fill_port_stat_reply(struct datapath *dp, struct ofp_port_stat_reply *psr)
+fill_port_stats_reply(struct datapath *dp, struct ofp_port_stats_reply *psr)
{
struct net_bridge_port *p;
int port_count = 0;
dp_send_port_stats(struct datapath *dp, const struct sender *sender)
{
struct sk_buff *skb;
- struct ofp_port_stat_reply *psr;
+ struct ofp_port_stats_reply *psr;
size_t psr_len, port_max_len;
int port_count;
/* Overallocate. */
port_max_len = sizeof(struct ofp_port_stats) * OFPP_MAX;
psr = alloc_openflow_skb(dp, sizeof *psr + port_max_len,
- OFPT_PORT_STAT_REPLY, sender, &skb);
+ OFPT_PORT_STATS_REPLY, sender, &skb);
if (!psr)
return -ENOMEM;
/* Fill. */
- port_count = fill_port_stat_reply(dp, psr);
+ port_count = fill_port_stats_reply(dp, psr);
/* Shrink to fit. */
psr_len = sizeof *psr + sizeof(struct ofp_port_stats) * port_count;
dp_send_table_stats(struct datapath *dp, const struct sender *sender)
{
struct sk_buff *skb;
- struct ofp_table_stat_reply *tsr;
+ struct ofp_table_stats_reply *tsr;
int i, n_tables;
n_tables = dp->chain->n_tables;
- tsr = alloc_openflow_skb(dp, (offsetof(struct ofp_table_stat_reply,
+ tsr = alloc_openflow_skb(dp, (offsetof(struct ofp_table_stats_reply,
tables)
+ sizeof tsr->tables[0] * n_tables),
- OFPT_TABLE_STAT_REPLY, sender, &skb);
+ OFPT_TABLE_STATS_REPLY, sender, &skb);
if (!tsr)
return -ENOMEM;
for (i = 0; i < n_tables; i++) {
}
static int
-recv_flow_status_request(struct sw_chain *chain, const struct sender *sender,
+recv_flow_stats_request(struct sw_chain *chain, const struct sender *sender,
const void *msg)
{
- const struct ofp_flow_stat_request *fsr = msg;
+ const struct ofp_flow_stats_request *fsr = msg;
if (fsr->type == OFPFS_INDIV) {
return dp_send_flow_stats(chain->dp, sender, &fsr->match);
} else {
}
static int
-recv_port_status_request(struct sw_chain *chain, const struct sender *sender,
+recv_port_stats_request(struct sw_chain *chain, const struct sender *sender,
const void *msg)
{
return dp_send_port_stats(chain->dp, sender);
}
static int
-recv_table_status_request(struct sw_chain *chain, const struct sender *sender,
+recv_table_stats_request(struct sw_chain *chain, const struct sender *sender,
const void *msg)
{
return dp_send_table_stats(chain->dp, sender);
sizeof (struct ofp_port_mod),
recv_port_mod,
},
- [OFPT_FLOW_STAT_REQUEST] = {
- sizeof (struct ofp_flow_stat_request),
- recv_flow_status_request,
+ [OFPT_FLOW_STATS_REQUEST] = {
+ sizeof (struct ofp_flow_stats_request),
+ recv_flow_stats_request,
},
- [OFPT_PORT_STAT_REQUEST] = {
- sizeof (struct ofp_port_stat_request),
- recv_port_status_request,
+ [OFPT_PORT_STATS_REQUEST] = {
+ sizeof (struct ofp_port_stats_request),
+ recv_port_stats_request,
},
- [OFPT_TABLE_STAT_REQUEST] = {
- sizeof (struct ofp_table_stat_request),
- recv_table_status_request,
+ [OFPT_TABLE_STATS_REQUEST] = {
+ sizeof (struct ofp_table_stats_request),
+ recv_table_stats_request,
},
};
};
enum ofp_type {
- OFPT_FEATURES_REQUEST, /* 0 Controller/switch message */
- OFPT_FEATURES_REPLY, /* 1 Controller/switch message */
- OFPT_GET_CONFIG_REQUEST, /* 2 Controller/switch message */
- OFPT_GET_CONFIG_REPLY, /* 3 Controller/switch message */
- OFPT_SET_CONFIG, /* 4 Controller/switch message */
- OFPT_PACKET_IN, /* 5 Async message */
- OFPT_PACKET_OUT, /* 6 Controller/switch message */
- OFPT_FLOW_MOD, /* 7 Controller/switch message */
- OFPT_FLOW_EXPIRED, /* 8 Async message */
- OFPT_TABLE, /* 9 Controller/switch message */
- OFPT_PORT_MOD, /* 10 Controller/switch message */
- OFPT_PORT_STATUS, /* 11 Async message */
- OFPT_FLOW_STAT_REQUEST, /* 12 Controller/switch message */
- OFPT_FLOW_STAT_REPLY, /* 13 Controller/switch message */
- OFPT_TABLE_STAT_REQUEST, /* 14 Controller/switch message */
- OFPT_TABLE_STAT_REPLY, /* 15 Controller/switch message */
- OFPT_PORT_STAT_REQUEST, /* 16 Controller/switch message */
- OFPT_PORT_STAT_REPLY /* 17 Controller/switch message */
+ OFPT_FEATURES_REQUEST, /* 0 Controller/switch message */
+ OFPT_FEATURES_REPLY, /* 1 Controller/switch message */
+ OFPT_GET_CONFIG_REQUEST, /* 2 Controller/switch message */
+ OFPT_GET_CONFIG_REPLY, /* 3 Controller/switch message */
+ OFPT_SET_CONFIG, /* 4 Controller/switch message */
+ OFPT_PACKET_IN, /* 5 Async message */
+ OFPT_PACKET_OUT, /* 6 Controller/switch message */
+ OFPT_FLOW_MOD, /* 7 Controller/switch message */
+ OFPT_FLOW_EXPIRED, /* 8 Async message */
+ OFPT_TABLE, /* 9 Controller/switch message */
+ OFPT_PORT_MOD, /* 10 Controller/switch message */
+ OFPT_PORT_STATUS, /* 11 Async message */
+ OFPT_FLOW_STATS_REQUEST, /* 12 Controller/switch message */
+ OFPT_FLOW_STATS_REPLY, /* 13 Controller/switch message */
+ OFPT_TABLE_STATS_REQUEST, /* 14 Controller/switch message */
+ OFPT_TABLE_STATS_REPLY, /* 15 Controller/switch message */
+ OFPT_PORT_STATS_REQUEST, /* 16 Controller/switch message */
+ OFPT_PORT_STATS_REPLY /* 17 Controller/switch message */
};
/* Header on all OpenFlow packets. */
uint8_t pad[7]; /* Align to 64-bits. */
};
-enum ofp_stat_type {
+enum ofp_stats_type {
OFPFS_INDIV, /* Send an entry for each matching flow */
OFPFS_AGGREGATE /* Aggregate matching flows */
};
/* Current flow statistics request */
-struct ofp_flow_stat_request {
+struct ofp_flow_stats_request {
struct ofp_header header;
struct ofp_match match; /* Fields to match */
uint8_t table_id; /* ID of table to read (from ofp_table_stats)
};
/* Current flow statistics reply */
-struct ofp_flow_stat_reply {
+struct ofp_flow_stats_reply {
struct ofp_header header;
/* If request was of type OFPFS_INDIV, this will contain an array of
};
/* Current table statistics request */
-struct ofp_table_stat_request {
+struct ofp_table_stats_request {
struct ofp_header header;
};
};
/* Current table statistics reply */
-struct ofp_table_stat_reply {
+struct ofp_table_stats_reply {
struct ofp_header header;
struct ofp_table_stats tables[]; /* The number of entries is inferred from
the length field in the header. */
};
/* Current port statistics request */
-struct ofp_port_stat_request {
+struct ofp_port_stats_request {
struct ofp_header header;
};
/* Current port statistics reply */
-struct ofp_port_stat_reply {
+struct ofp_port_stats_reply {
struct ofp_header header;
struct ofp_port_stats ports[]; /* The number of entries is inferred from
the length field in the header. */
}
static void
-ofp_flow_stat_request(struct ds *string, const void *oh, size_t len,
+ofp_flow_stats_request(struct ds *string, const void *oh, size_t len,
int verbosity)
{
- const struct ofp_flow_stat_request *fsr = oh;
+ const struct ofp_flow_stats_request *fsr = oh;
if (fsr->table_id == 0xff) {
ds_put_format(string, " table_id=any, ");
}
static void
-ofp_flow_stat_reply(struct ds *string, const void *oh, size_t len,
+ofp_flow_stats_reply(struct ds *string, const void *oh, size_t len,
int verbosity)
{
- const struct ofp_flow_stat_reply *fsr = oh;
+ const struct ofp_flow_stats_reply *fsr = oh;
const struct ofp_flow_stats *fs;
size_t n;
- n = (len - offsetof(struct ofp_flow_stat_reply, flows)) / sizeof *fs;
+ n = (len - offsetof(struct ofp_flow_stats_reply, flows)) / sizeof *fs;
ds_put_format(string, " %zu flows\n", n);
if (verbosity < 1) {
return;
}
static void
-ofp_port_stat_reply(struct ds *string, const void *oh, size_t len,
+ofp_port_stats_reply(struct ds *string, const void *oh, size_t len,
int verbosity)
{
- const struct ofp_port_stat_reply *psr = oh;
+ const struct ofp_port_stats_reply *psr = oh;
const struct ofp_port_stats *ps;
size_t n;
- n = (len - offsetof(struct ofp_port_stat_reply, ports)) / sizeof *ps;
+ n = (len - offsetof(struct ofp_port_stats_reply, ports)) / sizeof *ps;
ds_put_format(string, " %zu ports\n", n);
if (verbosity < 1) {
return;
}
static void
-ofp_table_stat_reply(struct ds *string, const void *oh, size_t len,
+ofp_table_stats_reply(struct ds *string, const void *oh, size_t len,
int verbosity)
{
- const struct ofp_table_stat_reply *tsr = oh;
+ const struct ofp_table_stats_reply *tsr = oh;
const struct ofp_table_stats *ts;
size_t n;
- n = (len - offsetof(struct ofp_table_stat_reply, tables)) / sizeof *ts;
+ n = (len - offsetof(struct ofp_table_stats_reply, tables)) / sizeof *ts;
ds_put_format(string, " %zu tables\n", n);
if (verbosity < 1) {
return;
sizeof (struct ofp_port_status),
ofp_print_port_status
},
- [OFPT_FLOW_STAT_REQUEST] = {
- "flow_stat_request",
- sizeof (struct ofp_flow_stat_request),
- ofp_flow_stat_request,
+ [OFPT_FLOW_STATS_REQUEST] = {
+ "flow_stats_request",
+ sizeof (struct ofp_flow_stats_request),
+ ofp_flow_stats_request,
},
- [OFPT_FLOW_STAT_REPLY] = {
- "flow_stat_reply",
- sizeof (struct ofp_flow_stat_reply),
- ofp_flow_stat_reply,
+ [OFPT_FLOW_STATS_REPLY] = {
+ "flow_stats_reply",
+ sizeof (struct ofp_flow_stats_reply),
+ ofp_flow_stats_reply,
},
- [OFPT_PORT_STAT_REQUEST] = {
- "port_stat_request",
- sizeof (struct ofp_port_stat_request),
+ [OFPT_PORT_STATS_REQUEST] = {
+ "port_stats_request",
+ sizeof (struct ofp_port_stats_request),
NULL,
},
- [OFPT_PORT_STAT_REPLY] = {
- "port_stat_reply",
- sizeof (struct ofp_port_stat_reply),
- ofp_port_stat_reply,
+ [OFPT_PORT_STATS_REPLY] = {
+ "port_stats_reply",
+ sizeof (struct ofp_port_stats_reply),
+ ofp_port_stats_reply,
},
- [OFPT_TABLE_STAT_REQUEST] = {
- "table_stat_request",
- sizeof (struct ofp_table_stat_request),
+ [OFPT_TABLE_STATS_REQUEST] = {
+ "table_stats_request",
+ sizeof (struct ofp_table_stats_request),
NULL,
},
- [OFPT_TABLE_STAT_REPLY] = {
- "table_stat_reply",
- sizeof (struct ofp_table_stat_reply),
- ofp_table_stat_reply,
+ [OFPT_TABLE_STATS_REPLY] = {
+ "table_stats_reply",
+ sizeof (struct ofp_table_stats_reply),
+ ofp_table_stats_reply,
},
};
const struct ofp_match *match)
{
struct buffer *buffer;
- struct ofp_flow_stat_reply *fsr;
+ struct ofp_flow_stats_reply *fsr;
size_t header_size, fudge, flow_size;
struct sw_flow_key match_key;
int table_idx, n_flows, max_flows;
time_t now;
- header_size = offsetof(struct ofp_flow_stat_reply, flows);
+ header_size = offsetof(struct ofp_flow_stats_reply, flows);
fudge = 128;
flow_size = sizeof fsr->flows[0];
max_flows = (65536 - header_size - fudge) / flow_size;
fsr = alloc_openflow_buffer(dp, header_size,
- OFPT_FLOW_STAT_REPLY, sender, &buffer);
+ OFPT_FLOW_STATS_REPLY, sender, &buffer);
n_flows = 0;
flow_extract_match(&match_key, match);
dp_send_port_stats(struct datapath *dp, const struct sender *sender)
{
struct buffer *buffer;
- struct ofp_port_stat_reply *psr;
+ struct ofp_port_stats_reply *psr;
struct sw_port *p;
- psr = alloc_openflow_buffer(dp, offsetof(struct ofp_port_stat_reply,
+ psr = alloc_openflow_buffer(dp, offsetof(struct ofp_port_stats_reply,
ports),
- OFPT_PORT_STAT_REPLY, sender, &buffer);
+ OFPT_PORT_STATS_REPLY, sender, &buffer);
LIST_FOR_EACH (p, struct sw_port, node, &dp->port_list) {
struct ofp_port_stats *ps = buffer_put_uninit(buffer, sizeof *ps);
ps->port_no = htons(port_no(dp, p));
dp_send_table_stats(struct datapath *dp, const struct sender *sender)
{
struct buffer *buffer;
- struct ofp_table_stat_reply *tsr;
+ struct ofp_table_stats_reply *tsr;
int i;
- tsr = alloc_openflow_buffer(dp, offsetof(struct ofp_table_stat_reply,
+ tsr = alloc_openflow_buffer(dp, offsetof(struct ofp_table_stats_reply,
tables),
- OFPT_TABLE_STAT_REPLY, sender, &buffer);
+ OFPT_TABLE_STATS_REPLY, sender, &buffer);
for (i = 0; i < dp->chain->n_tables; i++) {
struct ofp_table_stats *ots = buffer_put_uninit(buffer, sizeof *ots);
struct sw_table_stats stats;
}
static int
-recv_flow_status_request(struct datapath *dp, const struct sender *sender,
+recv_flow_stats_request(struct datapath *dp, const struct sender *sender,
const void *msg)
{
- const struct ofp_flow_stat_request *fsr = msg;
+ const struct ofp_flow_stats_request *fsr = msg;
if (fsr->type == OFPFS_INDIV) {
return dp_send_flow_stats(dp, sender, &fsr->match);
} else {
}
static int
-recv_port_status_request(struct datapath *dp, const struct sender *sender,
+recv_port_stats_request(struct datapath *dp, const struct sender *sender,
const void *msg)
{
return dp_send_port_stats(dp, sender);
}
static int
-recv_table_status_request(struct datapath *dp, const struct sender *sender,
+recv_table_stats_request(struct datapath *dp, const struct sender *sender,
const void *msg)
{
return dp_send_table_stats(dp, sender);
sizeof (struct ofp_port_mod),
recv_port_mod,
},
- [OFPT_FLOW_STAT_REQUEST] = {
- sizeof (struct ofp_flow_stat_request),
- recv_flow_status_request,
+ [OFPT_FLOW_STATS_REQUEST] = {
+ sizeof (struct ofp_flow_stats_request),
+ recv_flow_stats_request,
},
- [OFPT_PORT_STAT_REQUEST] = {
- sizeof (struct ofp_port_stat_request),
- recv_port_status_request,
+ [OFPT_PORT_STATS_REQUEST] = {
+ sizeof (struct ofp_port_stats_request),
+ recv_port_stats_request,
},
- [OFPT_TABLE_STAT_REQUEST] = {
- sizeof (struct ofp_table_stat_request),
- recv_table_status_request,
+ [OFPT_TABLE_STATS_REQUEST] = {
+ sizeof (struct ofp_table_stats_request),
+ recv_table_stats_request,
},
};
static void
do_dump_tables(int argc, char *argv[])
{
- dump_transaction(argv[1], OFPT_TABLE_STAT_REQUEST);
+ dump_transaction(argv[1], OFPT_TABLE_STATS_REQUEST);
}
{
struct vconn *vconn;
struct buffer *request, *reply;
- struct ofp_flow_stat_request *fsr;
+ struct ofp_flow_stats_request *fsr;
run(vconn_open_block(argv[1], &vconn), "connecting to %s", argv[1]);
- fsr = alloc_openflow_buffer(sizeof *fsr, OFPT_FLOW_STAT_REQUEST, &request);
+ fsr = alloc_openflow_buffer(sizeof *fsr, OFPT_FLOW_STATS_REQUEST, &request);
str_to_flow(argc > 2 ? argv[2] : "", &fsr->match, NULL, &fsr->table_id);
fsr->type = OFPFS_INDIV;
fsr->pad = 0;
static void
do_dump_ports(int argc, char *argv[])
{
- dump_transaction(argv[1], OFPT_PORT_STAT_REQUEST);
+ dump_transaction(argv[1], OFPT_PORT_STATS_REQUEST);
}
static void do_help(int argc UNUSED, char *argv[] UNUSED)