diff options
author | Mohammed Hawari <mohammed@hawari.fr> | 2021-02-05 15:40:00 +0100 |
---|---|---|
committer | Neale Ranns <neale@graphiant.com> | 2021-03-14 14:37:01 +0000 |
commit | 45723b8d305c7c6d034e16fcbf1904fd72dd6bb2 (patch) | |
tree | bb010ccd464efcfb90ccfabddded7b63b8223e6a /src/vnet/ip/punt.h | |
parent | 4e3f7b2869925b0812a58d04c4bf6371e6773630 (diff) |
ip: extend punt CLI for exception packets
Change-Id: I20e48a5ac8068eccb8d998346d35227c4802bb68
Signed-off-by: Mohammed Hawari <mohammed@hawari.fr>
Type: feature
Diffstat (limited to 'src/vnet/ip/punt.h')
-rw-r--r-- | src/vnet/ip/punt.h | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/src/vnet/ip/punt.h b/src/vnet/ip/punt.h index 33124846ba6..858ea531ef7 100644 --- a/src/vnet/ip/punt.h +++ b/src/vnet/ip/punt.h @@ -24,17 +24,49 @@ #include <stdbool.h> #include <vnet/ip/ip.h> +/* Punting reason flags bitfield + * (position, length, value, name, string) + */ +#define foreach_vnet_punt_reason_flag \ + _ (0, 1, 0, IP4_PACKET, "ip4-packet") \ + _ (0, 1, 1, IP6_PACKET, "ip6-packet") + +typedef enum vnet_punt_reason_flag_t_ +{ +#define _(pos, len, value, name, str) \ + VNET_PUNT_REASON_F_##name = ((value) << (pos)), + foreach_vnet_punt_reason_flag +#undef _ +} __clib_packed vnet_punt_reason_flag_t; + +enum vnet_punt_reason_flag_mask_t_ +{ +#define _(pos, len, value, name, str) \ + VNET_PUNT_REASON_F_MASK_##name = (((1 << (len)) - 1) << (pos)), + foreach_vnet_punt_reason_flag +#undef _ +}; + +/* predicates associated with vlib_punt_reason_flag_t*/ +#define _(pos, len, value, name, str) \ + static_always_inline int vnet_punt_reason_flag_is_##name ( \ + vnet_punt_reason_flag_t f) \ + { \ + return (f & VNET_PUNT_REASON_F_MASK_##name) == VNET_PUNT_REASON_F_##name; \ + } +foreach_vnet_punt_reason_flag +#undef _ + #define foreach_punt_type \ _(L4, "l4") \ _(EXCEPTION, "exception") \ _(IP_PROTO, "ip-proto") -typedef enum punt_type_t_ -{ + typedef enum punt_type_t_ { #define _(v, s) PUNT_TYPE_##v, - foreach_punt_type + foreach_punt_type #undef _ -} punt_type_t; + } punt_type_t; typedef struct punt_l4_t_ { @@ -138,6 +170,8 @@ typedef walk_rc_t (*punt_client_walk_cb_t) (const punt_client_t * pc, extern void punt_client_walk (punt_type_t pt, punt_client_walk_cb_t cb, void *ctx); +extern u8 *format_vnet_punt_reason_flags (u8 *s, va_list *args); + /* * inlines for the data-plane */ |