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]);
73 s =
format (s,
"0x%04x", type);
81 u32 vlan_tci = va_arg (*va,
u32);
83 u32 vid = (vlan_tci & 0xfff);
84 u32 cfi = (vlan_tci >> 12) & 1;
85 u32 pri = (vlan_tci >> 13);
89 s =
format (s,
" priority %d", pri);
99 ethernet_pbb_header_packed_t *
ph =
100 va_arg (*args, ethernet_pbb_header_packed_t *);
102 u32 max_header_bytes = va_arg (*args,
u32);
108 u32 n_vlan = 0,
i, header_bytes;
111 while ((type == ETHERNET_TYPE_VLAN || type == ETHERNET_TYPE_DOT1AD
112 || type == ETHERNET_TYPE_DOT1AH) && n_vlan <
ARRAY_LEN (m->
vlan))
114 vlan_type[n_vlan] =
type;
115 if (type != ETHERNET_TYPE_DOT1AH)
117 v = m->
vlan + n_vlan;
118 type = clib_net_to_host_u16 (v->
type);
123 header_bytes =
sizeof (e[0]) + n_vlan *
sizeof (v[0]);
124 if (max_header_bytes != 0 && header_bytes > max_header_bytes)
125 return format (s,
"ethernet header truncated");
129 s =
format (s,
"%U: %U -> %U",
134 if (type != ETHERNET_TYPE_DOT1AH)
136 for (
i = 0;
i < n_vlan;
i++)
139 if (*vlan_type == ETHERNET_TYPE_VLAN)
145 if (max_header_bytes != 0 && header_bytes < max_header_bytes)
157 max_header_bytes - header_bytes);
163 format (s,
" %s b-tag %04X",
164 (clib_net_to_host_u16 (ph->b_type) ==
165 ETHERNET_TYPE_DOT1AD) ?
"802.1ad" :
"",
166 clib_net_to_host_u16 (ph->priority_dei_id));
168 format (s,
" %s i-tag %08X",
169 (clib_net_to_host_u16 (ph->i_type) ==
170 ETHERNET_TYPE_DOT1AH) ?
"802.1ah" :
"",
171 clib_net_to_host_u32 (ph->priority_dei_uca_res_sid));
188 u8 *result = va_arg (*args,
u8 *);
191 if (!
unformat (input,
"%_%x:%x:%x:%x:%x:%x%_",
192 &a[0], &a[1], &a[2], &a[3], &a[4], &a[5]))
197 if (a[i] >= (1 << 8))
210 u8 *result = va_arg (*args,
u8 *);
213 if (!
unformat (input,
"%_%x.%x.%x%_", &a[0], &a[1], &a[2]))
218 if (a[i] >= (1 << 16))
221 result[0] = (a[0] >> 8) & 0xff;
222 result[1] = (a[0] >> 0) & 0xff;
223 result[2] = (a[1] >> 8) & 0xff;
224 result[3] = (a[1] >> 0) & 0xff;
225 result[4] = (a[2] >> 8) & 0xff;
226 result[5] = (a[2] >> 0) & 0xff;
235 u8 *result = va_arg (*args,
u8 *);
252 u16 *result = va_arg (*args,
u16 *);
259 if (type >= (1 << 16))
281 u16 *result = va_arg (*args,
u16 *);
285 *result = clib_host_to_net_u16 ((
u16) * result);
292 u8 **result = va_arg (*args,
u8 **);
298 if (!
unformat (input,
"%U: %U -> %U",
313 if (
unformat (input,
"priority %d", &priority))
317 id |= priority << 13;
332 e->
type = clib_host_to_net_u16 (type);
337 e->
type = clib_host_to_net_u16 (ETHERNET_TYPE_VLAN);
338 for (i = 0; i < n_vlan - 1; i++)
339 m->
vlan[i].
type = clib_host_to_net_u16 (ETHERNET_TYPE_VLAN);
340 m->
vlan[n_vlan - 1].
type = clib_host_to_net_u16 (type);
346 u32 n_bytes =
sizeof (e[0]) + n_vlan *
sizeof (m->
vlan[0]);
ethernet_type_info_t * type_infos
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
#define clib_memcpy(d, s, n)
ethernet_main_t ethernet_main
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
pool_header_t * ph(void *p)
GDB callable function: ph - call pool_header - get pool header.
vl_api_fib_path_type_t type
static ethernet_type_info_t * ethernet_get_type_info(ethernet_main_t *em, ethernet_type_t type)
uword * type_info_by_name
format_function_t * format_buffer
sll srl srl sll sra u16x4 i
vlib_main_t vlib_node_runtime_t * node
int format_ethernet_address_16bit
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.