diff --git a/build-aux/extract-ofp-errors b/build-aux/extract-ofp-errors index c32730414..fd53001de 100755 --- a/build-aux/extract-ofp-errors +++ b/build-aux/extract-ofp-errors @@ -294,7 +294,6 @@ struct ofperr_domain { const char *name; uint8_t version; enum ofperr (*decode)(uint16_t type, uint16_t code); - enum ofperr (*decode_type)(uint16_t type); struct pair errors[OFPERR_N_ERRORS]; }; @@ -332,24 +331,6 @@ static enum ofperr print """\ } - return 0; -} - -static enum ofperr -%s_decode_type(uint16_t type) -{ - switch (type) {""" % name - for enum in names: - if enum not in map: - continue - type_, code = map[enum] - if code is not None: - continue - print " case %d:" % type_ - print " return OFPERR_%s;" % enum - print """\ - } - return 0; }""" @@ -358,8 +339,7 @@ static const struct ofperr_domain %s = { "%s", %d, %s_decode, - %s_decode_type, - {""" % (name, description, version, name, name) + {""" % (name, description, version, name) for enum in names: if enum in map: type_, code = map[enum] diff --git a/lib/ofp-errors.c b/lib/ofp-errors.c index 697e5a609..599733415 100644 --- a/lib/ofp-errors.c +++ b/lib/ofp-errors.c @@ -53,16 +53,6 @@ ofperr_is_valid(enum ofperr error) return error >= OFPERR_OFS && error < OFPERR_OFS + OFPERR_N_ERRORS; } -/* Returns true if 'error' is a valid OFPERR_* value that designates a whole - * category of errors instead of a particular error, e.g. if it is an - * OFPERR_OFPET_* value, and false otherwise. */ -bool -ofperr_is_category(enum ofperr error) -{ - return (ofperr_is_valid(error) - && ofperr_of10.errors[error - OFPERR_OFS].code == -1 - && ofperr_of11.errors[error - OFPERR_OFS].code == -1); -} /* Returns true if 'error' can be encoded as an OpenFlow error message in * 'domain', false otherwise. * @@ -86,16 +76,6 @@ ofperr_decode(enum ofp_version version, uint16_t type, uint16_t code) return domain ? domain->decode(type, code) : 0; } -/* Returns the OFPERR_* value that corresponds to the category 'type' within - * 'version', or 0 if either no such OFPERR_* value exists or 'version' is - * unknown. */ -enum ofperr -ofperr_decode_type(enum ofp_version version, uint16_t type) -{ - const struct ofperr_domain *domain = ofperr_domain_from_version(version); - return domain ? domain->decode_type(type) : 0; -} - /* Returns the name of 'error', e.g. "OFPBRC_BAD_TYPE" if 'error' is * OFPBRC_BAD_TYPE, or "" if 'error' is not a valid OFPERR_* value. * @@ -331,12 +311,8 @@ ofperr_decode_msg(const struct ofp_header *oh, struct ofpbuf *payload) code = ntohs(nve->code); } - /* Translate the error type and code into an ofperr. - * If we don't know the error type and code, at least try for the type. */ + /* Translate the error type and code into an ofperr. */ error = ofperr_decode(oh->version, type, code); - if (!error) { - error = ofperr_decode_type(oh->version, type); - } if (error && payload) { ofpbuf_use_const(payload, b.data, b.size); } diff --git a/lib/ofp-errors.h b/lib/ofp-errors.h index 9f6911ca8..9d529549f 100644 --- a/lib/ofp-errors.h +++ b/lib/ofp-errors.h @@ -68,11 +68,8 @@ enum ofperr { /* ## OFPET_HELLO_FAILED ## */ /* ## ------------------ ## */ - /* OF1.0+(0). Hello protocol failed. */ - OFPERR_OFPET_HELLO_FAILED = OFPERR_OFS, - /* OF1.0+(0,0). No compatible version. */ - OFPERR_OFPHFC_INCOMPATIBLE, + OFPERR_OFPHFC_INCOMPATIBLE = OFPERR_OFS, /* OF1.0+(0,1). Permissions error. */ OFPERR_OFPHFC_EPERM, @@ -81,9 +78,6 @@ enum ofperr { /* ## OFPET_BAD_REQUEST ## */ /* ## ----------------- ## */ - /* OF1.0+(1). Request was not understood. */ - OFPERR_OFPET_BAD_REQUEST, - /* OF1.0+(1,0). ofp_header.version not supported. */ OFPERR_OFPBRC_BAD_VERSION, @@ -170,9 +164,6 @@ enum ofperr { /* ## OFPET_BAD_ACTION ## */ /* ## ---------------- ## */ - /* OF1.0+(2). Error in action description. */ - OFPERR_OFPET_BAD_ACTION, - /* OF1.0+(2,0). Unknown action type. */ OFPERR_OFPBAC_BAD_TYPE, @@ -229,9 +220,6 @@ enum ofperr { /* ## OFPET_BAD_INSTRUCTION ## */ /* ## --------------------- ## */ - /* OF1.1+(3). Error in instruction list. */ - OFPERR_OFPIT_BAD_INSTRUCTION, - /* OF1.1+(3,0). Unknown instruction. */ OFPERR_OFPBIC_UNKNOWN_INST, @@ -263,9 +251,6 @@ enum ofperr { /* ## OFPET_BAD_MATCH ## */ /* ## --------------- ## */ - /* OF1.1+(4). Error in match. */ - OFPERR_OFPET_BAD_MATCH, - /* OF1.1+(4,0). Unsupported match type specified by the match */ OFPERR_OFPBMC_BAD_TYPE, @@ -311,9 +296,6 @@ enum ofperr { /* ## OFPET_FLOW_MOD_FAILED ## */ /* ## --------------------- ## */ - /* OF1.0(3), OF1.1+(5). Problem modifying flow entry. */ - OFPERR_OFPET_FLOW_MOD_FAILED, - /* OF1.1+(5,0). Unspecified error. */ OFPERR_OFPFMFC_UNKNOWN, @@ -359,9 +341,6 @@ enum ofperr { /* ## OFPET_GROUP_MOD_FAILED ## */ /* ## ---------------------- ## */ - /* OF1.1+(6). Problem modifying group entry. */ - OFPERR_OFPET_GROUP_MOD_FAILED, - /* OF1.1+(6,0). Group not added because a group ADD attempted to replace * an already-present group. */ OFPERR_OFPGMFC_GROUP_EXISTS, @@ -417,9 +396,6 @@ enum ofperr { /* ## OFPET_PORT_MOD_FAILED ## */ /* ## --------------------- ## */ - /* OF1.0(4), OF1.1+(7). OFPT_PORT_MOD failed. */ - OFPERR_OFPET_PORT_MOD_FAILED, - /* OF1.0(4,0), OF1.1+(7,0). Specified port does not exist. */ OFPERR_OFPPMFC_BAD_PORT, @@ -440,9 +416,6 @@ enum ofperr { /* ## OFPET_TABLE_MOD_FAILED ## */ /* ## ---------------------- ## */ - /* OF1.1+(8). Table mod request failed. */ - OFPERR_OFPET_TABLE_MOD_FAILED, - /* OF1.1+(8,0). Specified table does not exist. */ OFPERR_OFPTMFC_BAD_TABLE, @@ -456,9 +429,6 @@ enum ofperr { /* ## OFPET_QUEUE_OP_FAILED ## */ /* ## --------------------- ## */ - /* OF1.0(5), OF1.1+(9). Queue operation failed. */ - OFPERR_OFPET_QUEUE_OP_FAILED, - /* OF1.0(5,0), OF1.1+(9,0). Invalid port (or port does not exist). */ OFPERR_OFPQOFC_BAD_PORT, @@ -472,9 +442,6 @@ enum ofperr { /* ## OFPET_SWITCH_CONFIG_FAILED ## */ /* ## -------------------------- ## */ - /* OF1.1+(10). Switch config request failed. */ - OFPERR_OFPET_SWITCH_CONFIG_FAILED, - /* OF1.1+(10,0). Specified flags is invalid. */ OFPERR_OFPSCFC_BAD_FLAGS, @@ -488,9 +455,6 @@ enum ofperr { /* ## OFPET_ROLE_REQUEST_FAILED ## */ /* ## ------------------------- ## */ - /* OF1.2+(11). Controller Role request failed. */ - OFPERR_OFPET_ROLE_REQUEST_FAILED, - /* OF1.2+(11,0). Stale Message: old generation_id. */ OFPERR_OFPRRFC_STALE, @@ -504,9 +468,6 @@ enum ofperr { /* ## OFPET_METER_MOD_FAILED ## */ /* ## ---------------------- ## */ - /* OF1.3+(12). Error in meter. */ - OFPERR_OFPET_METER_MOD_FAILED, - /* OF1.3+(12,0). Unspecified error. */ OFPERR_OFPMMFC_UNKNOWN, @@ -550,9 +511,6 @@ enum ofperr { /* ## OFPET_TABLE_FEATURES_FAILED ## */ /* ## --------------------------- ## */ - /* OF1.3+(13). Setting table features failed. */ - OFPERR_OFPET_TABLE_FEATURES_FAILED, - /* OF1.3+(13,0). Specified table does not exist. */ OFPERR_OFPTFFC_BAD_TABLE, @@ -574,19 +532,14 @@ enum ofperr { /* ## ------------------ ## */ /* ## OFPET_EXPERIMENTER ## */ /* ## ------------------ ## */ - - /* OF1.2+(0xffff). Experimenter error messages. */ - OFPERR_OFPET_EXPERIMENTER, }; const char *ofperr_domain_get_name(enum ofp_version); bool ofperr_is_valid(enum ofperr); -bool ofperr_is_category(enum ofperr); bool ofperr_is_encodable(enum ofperr, enum ofp_version); enum ofperr ofperr_decode(enum ofp_version, uint16_t type, uint16_t code); -enum ofperr ofperr_decode_type(enum ofp_version, uint16_t type); enum ofperr ofperr_from_name(const char *); enum ofperr ofperr_decode_msg(const struct ofp_header *,