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);
94 u32 max_header_bytes = va_arg (*args,
u32);
100 u32 n_vlan = 0,
i, header_bytes;
103 while ((type == ETHERNET_TYPE_VLAN || type == ETHERNET_TYPE_DOT1AD)
106 vlan_type[n_vlan] =
type;
107 v = m->
vlan + n_vlan;
108 type = clib_net_to_host_u16 (v->
type);
112 header_bytes =
sizeof (e[0]) + n_vlan *
sizeof (v[0]);
113 if (max_header_bytes != 0 && header_bytes > max_header_bytes)
114 return format (s,
"ethernet header truncated");
118 s =
format (s,
"%U: %U -> %U",
123 for (
i = 0;
i < n_vlan;
i++)
126 if (*vlan_type == ETHERNET_TYPE_VLAN)
132 if (max_header_bytes != 0 && header_bytes < max_header_bytes)
144 max_header_bytes - header_bytes);
161 u8 *result = va_arg (*args,
u8 *);
164 if (!
unformat (input,
"%_%x:%x:%x:%x:%x:%x%_",
165 &a[0], &a[1], &a[2], &a[3], &a[4], &a[5]))
170 if (a[i] >= (1 << 8))
183 u8 *result = va_arg (*args,
u8 *);
186 if (!
unformat (input,
"%_%x.%x.%x%_", &a[0], &a[1], &a[2]))
191 if (a[i] >= (1 << 16))
194 result[0] = (a[0] >> 8) & 0xff;
195 result[1] = (a[0] >> 0) & 0xff;
196 result[2] = (a[1] >> 8) & 0xff;
197 result[3] = (a[1] >> 0) & 0xff;
198 result[4] = (a[2] >> 8) & 0xff;
199 result[5] = (a[2] >> 0) & 0xff;
208 u8 *result = va_arg (*args,
u8 *);
218 u16 *result = va_arg (*args,
u16 *);
225 if (type >= (1 << 16))
247 u16 *result = va_arg (*args,
u16 *);
251 *result = clib_host_to_net_u16 ((
u16) * result);
258 u8 **result = va_arg (*args,
u8 **);
264 if (!
unformat (input,
"%U: %U -> %U",
279 if (
unformat (input,
"priority %d", &priority))
283 id |= priority << 13;
298 e->
type = clib_host_to_net_u16 (type);
303 e->
type = clib_host_to_net_u16 (ETHERNET_TYPE_VLAN);
304 for (i = 0; i < n_vlan - 1; i++)
305 m->
vlan[i].
type = clib_host_to_net_u16 (ETHERNET_TYPE_VLAN);
306 m->
vlan[n_vlan - 1].
type = clib_host_to_net_u16 (type);
312 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