1 /* SPDX-License-Identifier: GPL-2.0 */
8 static inline char *ila_csum_mode2name(__u8 csum_mode
)
11 case ILA_CSUM_ADJUST_TRANSPORT
:
12 return "adj-transport";
13 case ILA_CSUM_NEUTRAL_MAP
:
15 case ILA_CSUM_NO_ACTION
:
17 case ILA_CSUM_NEUTRAL_MAP_AUTO
:
18 return "neutral-map-auto";
24 static inline int ila_csum_name2mode(char *name
)
26 if (strcmp(name
, "adj-transport") == 0)
27 return ILA_CSUM_ADJUST_TRANSPORT
;
28 else if (strcmp(name
, "neutral-map") == 0)
29 return ILA_CSUM_NEUTRAL_MAP
;
30 else if (strcmp(name
, "neutral-map-auto") == 0)
31 return ILA_CSUM_NEUTRAL_MAP_AUTO
;
32 else if (strcmp(name
, "no-action") == 0)
33 return ILA_CSUM_NO_ACTION
;
34 else if (strcmp(name
, "neutral-map-auto") == 0)
35 return ILA_CSUM_NEUTRAL_MAP_AUTO
;
40 static inline char *ila_ident_type2name(__u8 ident_type
)
47 case ILA_ATYPE_VIRT_V4
:
49 case ILA_ATYPE_VIRT_UNI_V6
:
51 case ILA_ATYPE_VIRT_MULTI_V6
:
52 return "virt-multi-v6";
53 case ILA_ATYPE_NONLOCAL_ADDR
:
54 return "nonlocal-addr";
55 case ILA_ATYPE_USE_FORMAT
:
62 static inline int ila_ident_name2type(char *name
)
64 if (!strcmp(name
, "luid"))
65 return ILA_ATYPE_LUID
;
66 else if (!strcmp(name
, "use-format"))
67 return ILA_ATYPE_USE_FORMAT
;
68 #if 0 /* No kernel support for configuring these yet */
69 else if (!strcmp(name
, "iid"))
71 else if (!strcmp(name
, "virt-v4"))
72 return ILA_ATYPE_VIRT_V4
;
73 else if (!strcmp(name
, "virt-uni-v6"))
74 return ILA_ATYPE_VIRT_UNI_V6
;
75 else if (!strcmp(name
, "virt-multi-v6"))
76 return ILA_ATYPE_VIRT_MULTI_V6
;
77 else if (!strcmp(name
, "nonlocal-addr"))
78 return ILA_ATYPE_NONLOCAL_ADDR
;
84 static inline char *ila_hook_type2name(__u8 hook_type
)
87 case ILA_HOOK_ROUTE_OUTPUT
:
89 case ILA_HOOK_ROUTE_INPUT
:
96 static inline int ila_hook_name2type(char *name
)
98 if (!strcmp(name
, "output"))
99 return ILA_HOOK_ROUTE_OUTPUT
;
100 else if (!strcmp(name
, "input"))
101 return ILA_HOOK_ROUTE_INPUT
;
106 #endif /* _ILA_COMMON_H_ */