git://git.onelab.eu
/
sliver-openvswitch.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ofproto: New helper macro OFPROTO_FOR_EACH_TABLE.
[sliver-openvswitch.git]
/
ofproto
/
ofproto.c
diff --git
a/ofproto/ofproto.c
b/ofproto/ofproto.c
index
8d22c50
..
2dd3c9f
100644
(file)
--- a/
ofproto/ofproto.c
+++ b/
ofproto/ofproto.c
@@
-289,10
+289,10
@@
ofproto_create(const char *datapath_name, const char *datapath_type,
struct ofproto **ofprotop)
{
const struct ofproto_class *class;
struct ofproto **ofprotop)
{
const struct ofproto_class *class;
+ struct classifier *table;
struct ofproto *ofproto;
int n_tables;
int error;
struct ofproto *ofproto;
int n_tables;
int error;
- int i;
*ofprotop = NULL;
*ofprotop = NULL;
@@
-350,8
+350,8
@@
ofproto_create(const char *datapath_name, const char *datapath_type,
assert(n_tables >= 1 && n_tables <= 255);
ofproto->n_tables = n_tables;
ofproto->tables = xmalloc(n_tables * sizeof *ofproto->tables);
assert(n_tables >= 1 && n_tables <= 255);
ofproto->n_tables = n_tables;
ofproto->tables = xmalloc(n_tables * sizeof *ofproto->tables);
-
for (i = 0; i < n_tables; i++
) {
- classifier_init(
&ofproto->tables[i]
);
+
OFPROTO_FOR_EACH_TABLE (table, ofproto
) {
+ classifier_init(
table
);
}
ofproto->datapath_id = pick_datapath_id(ofproto);
}
ofproto->datapath_id = pick_datapath_id(ofproto);
@@
-675,8
+675,7
@@
ofproto_flush__(struct ofproto *ofproto)
}
group = ofopgroup_create(ofproto);
}
group = ofopgroup_create(ofproto);
- for (table = ofproto->tables; table < &ofproto->tables[ofproto->n_tables];
- table++) {
+ OFPROTO_FOR_EACH_TABLE (table, ofproto) {
struct rule *rule, *next_rule;
struct cls_cursor cursor;
struct rule *rule, *next_rule;
struct cls_cursor cursor;
@@
-695,7
+694,7
@@
ofproto_flush__(struct ofproto *ofproto)
static void
ofproto_destroy__(struct ofproto *ofproto)
{
static void
ofproto_destroy__(struct ofproto *ofproto)
{
- s
ize_t i
;
+ s
truct classifier *table
;
assert(list_is_empty(&ofproto->pending));
assert(list_is_empty(&ofproto->pending));
@@
-712,9
+711,9
@@
ofproto_destroy__(struct ofproto *ofproto)
hmap_destroy(&ofproto->ports);
shash_destroy(&ofproto->port_by_name);
hmap_destroy(&ofproto->ports);
shash_destroy(&ofproto->port_by_name);
-
for (i = 0; i < ofproto->n_tables; i++
) {
- assert(classifier_is_empty(
&ofproto->tables[i]
));
- classifier_destroy(
&ofproto->tables[i]
);
+
OFPROTO_FOR_EACH_TABLE (table, ofproto
) {
+ assert(classifier_is_empty(
table
));
+ classifier_destroy(
table
);
}
free(ofproto->tables);
}
free(ofproto->tables);
@@
-1956,7
+1955,7
@@
ofproto_get_all_flows(struct ofproto *p, struct ds *results)
{
struct classifier *cls;
{
struct classifier *cls;
-
for (cls = &p->tables[0]; cls < &p->tables[p->n_tables]; cls++
) {
+
OFPROTO_FOR_EACH_TABLE (cls, p
) {
struct cls_cursor cursor;
struct rule *rule;
struct cls_cursor cursor;
struct rule *rule;