47 u8 *
a = va_arg (*args,
u8 *);
50 return format (s,
"%02x%02x.%02x%02x.%02x%02x",
51 a[0], a[1], a[2], a[3], a[4], a[5]);
53 return format (s,
"%02x:%02x:%02x:%02x:%02x:%02x",
54 a[0], a[1], a[2], a[3], a[4], a[5]);
67 s =
format (s,
"0x%04x", type);
75 u32 vlan_tci = va_arg (*va,
u32);
77 u32 vid = (vlan_tci & 0xfff);
78 u32 cfi = (vlan_tci >> 12) & 1;
79 u32 pri = (vlan_tci >> 13);
83 s =
format (s,
" priority %d", pri);
93 u32 b_tag = va_arg (*va,
u32);
94 u32 i_tag = va_arg (*va,
u32);
95 u32 vid = (b_tag & 0xfff);
96 u32 bdei = (b_tag >> 12) & 1;
97 u32 bpcp = (b_tag >> 13);
98 u32 sid = (i_tag & 0xffffff);
99 u8 ires = (i_tag >> 24) & 3;
100 u8 iuca = (i_tag >> 27) & 1;
101 u8 idei = (i_tag >> 28) & 1;
102 u8 ipcp = (i_tag >> 29);
105 format (s,
"B_tag %04X (vid %d, dei %d, pcp %d), ", b_tag, vid, bdei,
108 format (s,
"I_tag %08X (sid %d, res %d, dei %d, pcp %d)", i_tag, sid,
109 ires, iuca, idei, ipcp);
117 ethernet_pbb_header_packed_t *ph =
118 va_arg (*args, ethernet_pbb_header_packed_t *);
120 u32 max_header_bytes = va_arg (*args,
u32);
126 u32 n_vlan = 0,
i, header_bytes;
129 while ((type == ETHERNET_TYPE_VLAN || type == ETHERNET_TYPE_DOT1AD
130 || type == ETHERNET_TYPE_DOT1AH) && n_vlan <
ARRAY_LEN (m->
vlan))
132 vlan_type[n_vlan] =
type;
133 if (type != ETHERNET_TYPE_DOT1AH)
135 v = m->
vlan + n_vlan;
136 type = clib_net_to_host_u16 (v->
type);
141 header_bytes =
sizeof (e[0]) + n_vlan *
sizeof (v[0]);
142 if (max_header_bytes != 0 && header_bytes > max_header_bytes)
143 return format (s,
"ethernet header truncated");
147 s =
format (s,
"%U: %U -> %U",
152 if (type != ETHERNET_TYPE_DOT1AH)
154 for (
i = 0;
i < n_vlan;
i++)
157 if (*vlan_type == ETHERNET_TYPE_VLAN)
163 if (max_header_bytes != 0 && header_bytes < max_header_bytes)
175 max_header_bytes - header_bytes);
182 clib_net_to_host_u16 (ph->priority_dei_id),
183 clib_net_to_host_u32 (ph->priority_dei_uca_res_sid));
200 u8 *result = va_arg (*args,
u8 *);
203 if (!
unformat (input,
"%_%x:%x:%x:%x:%x:%x%_",
204 &a[0], &a[1], &a[2], &a[3], &a[4], &a[5]))
209 if (a[i] >= (1 << 8))
222 u8 *result = va_arg (*args,
u8 *);
225 if (!
unformat (input,
"%_%x.%x.%x%_", &a[0], &a[1], &a[2]))
230 if (a[i] >= (1 << 16))
233 result[0] = (a[0] >> 8) & 0xff;
234 result[1] = (a[0] >> 0) & 0xff;
235 result[2] = (a[1] >> 8) & 0xff;
236 result[3] = (a[1] >> 0) & 0xff;
237 result[4] = (a[2] >> 8) & 0xff;
238 result[5] = (a[2] >> 0) & 0xff;
247 u8 *result = va_arg (*args,
u8 *);
257 u16 *result = va_arg (*args,
u16 *);
264 if (type >= (1 << 16))
286 u16 *result = va_arg (*args,
u16 *);
290 *result = clib_host_to_net_u16 ((
u16) * result);
297 u8 **result = va_arg (*args,
u8 **);
303 if (!
unformat (input,
"%U: %U -> %U",
318 if (
unformat (input,
"priority %d", &priority))
322 id |= priority << 13;
337 e->
type = clib_host_to_net_u16 (type);
342 e->
type = clib_host_to_net_u16 (ETHERNET_TYPE_VLAN);
343 for (i = 0; i < n_vlan - 1; i++)
344 m->
vlan[i].
type = clib_host_to_net_u16 (ETHERNET_TYPE_VLAN);
345 m->
vlan[n_vlan - 1].
type = clib_host_to_net_u16 (type);
351 u32 n_bytes =
sizeof (e[0]) + n_vlan *
sizeof (m->
vlan[0]);
sll srl srl sll sra u16x4 i
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
uword * type_info_by_name
ethernet_main_t ethernet_main
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
int format_ethernet_address_16bit
static ethernet_type_info_t * ethernet_get_type_info(ethernet_main_t *em, ethernet_type_t type)
format_function_t * format_buffer
#define clib_memcpy(a, b, c)
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
ethernet_type_info_t * type_infos