diff options
| author | Ben Pfaff <blp@nicira.com> | 2011-07-28 15:01:20 -0700 |
|---|---|---|
| committer | Ben Pfaff <blp@nicira.com> | 2011-08-08 16:05:35 -0700 |
| commit | 13521ff59379b6a7a91be18ce8d903cd698694b3 (patch) | |
| tree | 74cd9560bcb862dd9a2901b58d8c9b215593fe7b /ofproto | |
| parent | 073e2a6f2383cf7c17f78b8fa29e6e5293f60ba0 (diff) | |
| download | openvswitch-13521ff59379b6a7a91be18ce8d903cd698694b3.tar.gz | |
ofproto: Allow ->rule_choose_table() to be NULL regardless of table count.
In the upcoming software switch implementation of multiple tables, there is
no reason to prefer one table over another, so we always put rules into
table 0 by default. This commit allows this to be done simply by
specifying NULL as ->rule_choose_table().
Diffstat (limited to 'ofproto')
| -rw-r--r-- | ofproto/ofproto-provider.h | 3 | ||||
| -rw-r--r-- | ofproto/ofproto.c | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h index 985f1121f..f46ff8427 100644 --- a/ofproto/ofproto-provider.h +++ b/ofproto/ofproto-provider.h @@ -598,8 +598,7 @@ struct ofproto_class { * If multiple tables are candidates for inserting the flow, the function * should choose one arbitrarily (but deterministically). * - * This function will never be called for an ofproto that has only one - * table, so it may be NULL in that case. */ + * If this function is NULL then table 0 is always chosen. */ int (*rule_choose_table)(const struct ofproto *ofproto, const struct cls_rule *cls_rule, uint8_t *table_idp); diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 4d4c23201..8d22c50f7 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -2182,7 +2182,7 @@ add_flow(struct ofproto *ofproto, struct ofconn *ofconn, struct flow_mod *fm, /* Pick table. */ if (fm->table_id == 0xff) { uint8_t table_id; - if (ofproto->n_tables > 1) { + if (ofproto->ofproto_class->rule_choose_table) { error = ofproto->ofproto_class->rule_choose_table(ofproto, &fm->cr, &table_id); if (error) { |
