u8 *r = va_arg (*va, u8 *);
if (0);
-#define _(v,f,str) else if (unformat (input, str)) *r = VNET_DSCP_##f;
- foreach_vnet_dscp
+#define _(v, f) else if (unformat (input, #f)) *r = IP_DSCP_##f;
+ foreach_ip_dscp
#undef _
- else
- return 0;
+ else return 0;
return 1;
}
switch (i)
{
-#define _(v,f,str) case VNET_DSCP_##f: t = str; break;
- foreach_vnet_dscp
+#define _(v, f) \
+ case IP_DSCP_##f: \
+ return (format (s, "%s", #f));
+ foreach_ip_dscp
#undef _
- default:
- return format (s, "ILLEGAL");
}
s = format (s, "%s", t);
- return s;
+ return (format (s, "ILLEGAL"));
}
static void
#include <vnet/policer/policer.h>
#include <vnet/policer/police_inlines.h>
#include <vnet/classify/vnet_classify.h>
+#include <vnet/ip/ip_packet.h>
vnet_policer_main_t vnet_policer_main;
return s;
}
-static u8 *
-format_dscp (u8 * s, va_list * va)
-{
- u32 i = va_arg (*va, u32);
- char *t = 0;
-
- switch (i)
- {
-#define _(v,f,str) case VNET_DSCP_##f: t = str; break;
- foreach_vnet_dscp
-#undef _
- default:
- return format (s, "ILLEGAL");
- }
- s = format (s, "%s", t);
- return s;
-}
-
static u8 *
format_policer_action_type (u8 * s, va_list * va)
{
else if (a->action_type == SSE2_QOS_ACTION_TRANSMIT)
s = format (s, "transmit");
else if (a->action_type == SSE2_QOS_ACTION_MARK_AND_TRANSMIT)
- s = format (s, "mark-and-transmit %U", format_dscp, a->dscp);
+ s = format (s, "mark-and-transmit %U", format_ip_dscp, a->dscp);
else
s = format (s, "ILLEGAL");
return s;
return 0;
}
-static uword
-unformat_dscp (unformat_input_t * input, va_list * va)
-{
- u8 *r = va_arg (*va, u8 *);
-
- if (0);
-#define _(v,f,str) else if (unformat (input, str)) *r = VNET_DSCP_##f;
- foreach_vnet_dscp
-#undef _
- else
- return 0;
- return 1;
-}
-
static uword
unformat_policer_action_type (unformat_input_t * input, va_list * va)
{
a->action_type = SSE2_QOS_ACTION_DROP;
else if (unformat (input, "transmit"))
a->action_type = SSE2_QOS_ACTION_TRANSMIT;
- else if (unformat (input, "mark-and-transmit %U", unformat_dscp, &a->dscp))
+ else if (unformat (input, "mark-and-transmit %U", unformat_ip_dscp,
+ &a->dscp))
a->action_type = SSE2_QOS_ACTION_MARK_AND_TRANSMIT;
else
return 0;
{
u32 action = va_arg (*va, u32);
u32 dscp = va_arg (*va, u32);
- char *t = 0;
if (action == SSE2_QOS_ACTION_DROP)
s = format (s, "drop");
s = format (s, "mark-and-transmit ");
switch (dscp)
{
-#define _(v,f,str) case VNET_DSCP_##f: t = str; break;
- foreach_vnet_dscp
+#define _(v, f) \
+ case IP_DSCP_##f: \
+ format (s, "%s", #f);
+ foreach_ip_dscp
#undef _
- default:
- break;
}
- s = format (s, "%s", t);
}
return s;
}