def mlx5_ste_v1_tag_parser(entry_format, tag, raw): if entry_format not in switch_tag_parser.keys(): print("Err: Unsupported STEv1 tag format") return {} func, inner = switch_tag_parser[entry_format] parsed_tag = func(tag) if not raw: parsed_tag = dr_prettify.prettify_tag(parsed_tag) if inner: add_inner_to_key(parsed_tag) return parsed_tag
def mlx5_ste_v0_tag_parser(lookup_type, tag, raw): if lookup_type not in switch_tag_parser.keys(): # Silent fail lookup type is not supported return {} if lookup_type not in switch_tag_parser.keys(): return mlx5_ifc_ste_v0_unsupported_tag() func, inner = switch_tag_parser[lookup_type] parsed_tag = func(tag) if not raw and (lookup_type not in ["0x22", 0x23]): parsed_tag = dr_prettify.prettify_tag(parsed_tag) if inner: add_inner_to_key(parsed_tag) return parsed_tag
def mlx5_ste_v0_tag_parser(lookup_type, tag, raw): if lookup_type not in switch_tag_parser.keys(): # Silent fail lookup type is not supported return {} if lookup_type not in switch_tag_parser.keys(): print("Err: Unsupported STEv0 tag format") func, inner = switch_tag_parser[lookup_type] parsed_tag = func(tag) if not raw: parsed_tag = dr_prettify.prettify_tag(parsed_tag) if inner: add_inner_to_key(parsed_tag) return parsed_tag
def mlx5_ste_v1_tag_parser(lookup_type, definer_id, tag, raw): func, inner = None, None if lookup_type in switch_tag_parser.keys(): func, inner = switch_tag_parser[lookup_type] # The default value for definer_id is None, and value -1 means definer not supported. elif definer_id not in [None, "-1"] and int(definer_id, 16) in switch_definer_parser.keys(): func = switch_definer_parser[int(definer_id, 16)] else: return mlx5_ifc_ste_v1_unsupported_tag() parsed_tag = func(tag) if not raw and (lookup_type not in [DR_STE_V1_LU_TYPE_FLEX_PARSER_0,\ DR_STE_V1_LU_TYPE_FLEX_PARSER_0]): parsed_tag = dr_prettify.prettify_tag(parsed_tag) if inner: add_inner_to_key(parsed_tag) return parsed_tag