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 ethernet_pbb_header_packed_t *ph =
94 va_arg (*args, ethernet_pbb_header_packed_t *);
96 u32 max_header_bytes = va_arg (*args,
u32);
102 u32 n_vlan = 0,
i, header_bytes;
105 while ((type == ETHERNET_TYPE_VLAN || type == ETHERNET_TYPE_DOT1AD
106 || type == ETHERNET_TYPE_DOT1AH) && n_vlan <
ARRAY_LEN (m->
vlan))
108 vlan_type[n_vlan] = type;
109 if (type != ETHERNET_TYPE_DOT1AH)
111 v = m->
vlan + n_vlan;
112 type = clib_net_to_host_u16 (v->
type);
117 header_bytes =
sizeof (e[0]) + n_vlan *
sizeof (v[0]);
118 if (max_header_bytes != 0 && header_bytes > max_header_bytes)
119 return format (s,
"ethernet header truncated");
123 s =
format (s,
"%U: %U -> %U",
128 if (type != ETHERNET_TYPE_DOT1AH)
130 for (
i = 0;
i < n_vlan;
i++)
133 if (*vlan_type == ETHERNET_TYPE_VLAN)
139 if (max_header_bytes != 0 && header_bytes < max_header_bytes)
151 max_header_bytes - header_bytes);
157 format (s,
" %s b-tag %04X",
158 (clib_net_to_host_u16 (ph->b_type) ==
159 ETHERNET_TYPE_DOT1AD) ?
"802.1ad" :
"",
160 clib_net_to_host_u16 (ph->priority_dei_id));
162 format (s,
" %s i-tag %08X",
163 (clib_net_to_host_u16 (ph->i_type) ==
164 ETHERNET_TYPE_DOT1AH) ?
"802.1ah" :
"",
165 clib_net_to_host_u32 (ph->priority_dei_uca_res_sid));
182 u8 *result = va_arg (*args,
u8 *);
185 if (!
unformat (input,
"%_%x:%x:%x:%x:%x:%x%_",
186 &a[0], &a[1], &a[2], &a[3], &a[4], &a[5]))
191 if (a[i] >= (1 << 8))
204 u8 *result = va_arg (*args,
u8 *);
207 if (!
unformat (input,
"%_%x.%x.%x%_", &a[0], &a[1], &a[2]))
212 if (a[i] >= (1 << 16))
215 result[0] = (a[0] >> 8) & 0xff;
216 result[1] = (a[0] >> 0) & 0xff;
217 result[2] = (a[1] >> 8) & 0xff;
218 result[3] = (a[1] >> 0) & 0xff;
219 result[4] = (a[2] >> 8) & 0xff;
220 result[5] = (a[2] >> 0) & 0xff;
229 u8 *result = va_arg (*args,
u8 *);
239 u16 *result = va_arg (*args,
u16 *);
246 if (type >= (1 << 16))
268 u16 *result = va_arg (*args,
u16 *);
272 *result = clib_host_to_net_u16 ((
u16) * result);
279 u8 **result = va_arg (*args,
u8 **);
285 if (!
unformat (input,
"%U: %U -> %U",
300 if (
unformat (input,
"priority %d", &priority))
304 id |= priority << 13;
319 e->
type = clib_host_to_net_u16 (type);
324 e->
type = clib_host_to_net_u16 (ETHERNET_TYPE_VLAN);
325 for (i = 0; i < n_vlan - 1; i++)
326 m->
vlan[i].
type = clib_host_to_net_u16 (ETHERNET_TYPE_VLAN);
327 m->
vlan[n_vlan - 1].
type = clib_host_to_net_u16 (type);
333 u32 n_bytes =
sizeof (e[0]) + n_vlan *
sizeof (m->
vlan[0]);
sll srl srl sll sra u16x4 i
#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