46 u8 *
a = va_arg (*args,
u8 *);
49 return format (s,
"%02x%02x.%02x%02x.%02x%02x",
50 a[0], a[1], a[2], a[3], a[4], a[5]);
52 return format (s,
"%02x:%02x:%02x:%02x:%02x:%02x",
53 a[0], a[1], a[2], a[3], a[4], a[5]);
65 s =
format (s,
"0x%04x", type);
73 u32 max_header_bytes = va_arg (*args,
u32);
78 u32 n_vlan = 0,
i, header_bytes;
81 while (type == ETHERNET_TYPE_VLAN
85 type = clib_net_to_host_u16 (v->
type);
89 header_bytes =
sizeof (e[0]) + n_vlan *
sizeof (v[0]);
90 if (max_header_bytes != 0 && header_bytes > max_header_bytes)
91 return format (s,
"ethernet header truncated");
95 s =
format (s,
"%U: %U -> %U",
100 for (
i = 0;
i < n_vlan;
i++)
103 u32 vid = (v & 0xfff);
104 u32 cfi = (v >> 12) & 1;
107 s =
format (s,
" vlan %d", vid);
109 s =
format (s,
" priority %d", pri);
114 if (max_header_bytes != 0 && header_bytes < max_header_bytes)
126 max_header_bytes - header_bytes);
142 u8 * result = va_arg (*args,
u8 *);
145 if (!
unformat (input,
"%_%x:%x:%x:%x:%x:%x%_",
146 &a[0], &a[1], &a[2], &a[3], &a[4], &a[5]))
151 if (a[i] >= (1 << 8))
164 u8 * result = va_arg (*args,
u8 *);
167 if (!
unformat (input,
"%_%x.%x.%x%_", &a[0], &a[1], &a[2]))
172 if (a[i] >= (1 << 16))
175 result[0] = (a[0] >> 8) & 0xff;
176 result[1] = (a[0] >> 0) & 0xff;
177 result[2] = (a[1] >> 8) & 0xff;
178 result[3] = (a[1] >> 0) & 0xff;
179 result[4] = (a[2] >> 8) & 0xff;
180 result[5] = (a[2] >> 0) & 0xff;
189 u8 * result = va_arg (*args,
u8 *);
199 u16 * result = va_arg (*args,
u16 *);
207 if (type >= (1 << 16))
229 u16 * result = va_arg (*args,
u16 *);
233 *result = clib_host_to_net_u16 ((
u16) *result);
240 u8 ** result = va_arg (*args,
u8 **);
246 if (!
unformat (input,
"%U: %U -> %U",
261 if (
unformat (input,
"priority %d", &priority))
265 id |= priority << 13;
280 e->
type = clib_host_to_net_u16 (type);
285 e->
type = clib_host_to_net_u16 (ETHERNET_TYPE_VLAN);
286 for (i = 0; i < n_vlan - 1; i++)
287 m->
vlan[i].
type = clib_host_to_net_u16 (ETHERNET_TYPE_VLAN);
288 m->
vlan[n_vlan - 1].
type = clib_host_to_net_u16 (type);
294 u32 n_bytes =
sizeof (e[0]) + n_vlan *
sizeof (m->
vlan[0]);
sll srl srl sll sra u16x4 i
always_inline ethernet_type_info_t * ethernet_get_type_info(ethernet_main_t *em, ethernet_type_t type)
always_inline vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 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
format_function_t * format_buffer
#define clib_memcpy(a, b, c)
ethernet_type_info_t * type_infos