Update check_table_id() so that rather than returning a flow_mod specific
error it simply returns true of false. And update callers accordingly.
This is in preparation for using check_table_id() in conjunction
with table_mod.
Also update check_table_id to use OFPTT_ALL.
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
}
/* Checks whether 'table_id' is 0xff or a valid table ID in 'ofproto'. Returns
}
/* Checks whether 'table_id' is 0xff or a valid table ID in 'ofproto'. Returns
- * 0 if 'table_id' is OK, otherwise an OpenFlow error code. */
-static enum ofperr
+ * true if 'table_id' is OK, false otherwise. */
+static bool
check_table_id(const struct ofproto *ofproto, uint8_t table_id)
{
check_table_id(const struct ofproto *ofproto, uint8_t table_id)
{
- return (table_id == 0xff || table_id < ofproto->n_tables
- ? 0
- : OFPERR_OFPBRC_BAD_TABLE_ID);
-
+ return table_id == OFPTT_ALL || table_id < ofproto->n_tables;
}
static struct oftable *
}
static struct oftable *
OVS_REQUIRES(ofproto_mutex)
{
struct oftable *table;
OVS_REQUIRES(ofproto_mutex)
{
struct oftable *table;
rule_collection_init(rules);
rule_collection_init(rules);
- error = check_table_id(ofproto, criteria->table_id);
- if (error) {
+ if (!check_table_id(ofproto, criteria->table_id)) {
+ error = OFPERR_OFPBRC_BAD_TABLE_ID;
OVS_REQUIRES(ofproto_mutex)
{
struct oftable *table;
OVS_REQUIRES(ofproto_mutex)
{
struct oftable *table;
rule_collection_init(rules);
rule_collection_init(rules);
- error = check_table_id(ofproto, criteria->table_id);
- if (error) {
+ if (!check_table_id(ofproto, criteria->table_id)) {
+ error = OFPERR_OFPBRC_BAD_TABLE_ID;
struct cls_rule cr;
struct rule *rule;
uint8_t table_id;
struct cls_rule cr;
struct rule *rule;
uint8_t table_id;
- error = check_table_id(ofproto, fm->table_id);
- if (error) {
+ if (!check_table_id(ofproto, fm->table_id)) {
+ error = OFPERR_OFPBRC_BAD_TABLE_ID;