49 round_pow2 (most_likely_size,
sizeof (rw0[0])) /
sizeof (rw0[0]);
71 vnet_rewrite_header_t *rw = va_arg (*args, vnet_rewrite_header_t *);
72 u32 max_data_bytes = va_arg (*args,
u32);
79 if (rw->sw_if_index != ~0)
89 if (rw->data_bytes > 0)
93 rw->data + max_data_bytes - rw->data_bytes, rw->data_bytes);
102 vnet_rewrite_header_t *rw = va_arg (*args, vnet_rewrite_header_t *);
103 u8 *packet_data = va_arg (*args,
u8 *);
104 u32 packet_data_bytes = va_arg (*args,
u32);
112 packet_data, packet_data_bytes);
121 vnet_rewrite_header_t *rw = va_arg (*args, vnet_rewrite_header_t *);
122 u32 max_data_bytes = va_arg (*args,
u32);
125 u32 next_index, sw_if_index, max_packet_bytes, error;
130 max_packet_bytes = ~0;
164 if (
vec_len (rw_data) >= max_data_bytes)
170 if (
unformat (input,
"mtu %d", &tmp)
171 && tmp < (1 <<
BITS (rw->max_l3_packet_bytes)))
172 max_packet_bytes = tmp;
176 rw->sw_if_index = sw_if_index;
177 rw->max_l3_packet_bytes = max_packet_bytes;
197 u32 this_node,
u32 next_node, vnet_rewrite_header_t * rw)
199 rw->sw_if_index = sw_if_index;
200 rw->node_index = this_node;
202 rw->max_l3_packet_bytes =
212 vnet_rewrite_header_t * rw,
213 u32 max_rewrite_bytes)
225 ASSERT (hc->build_rewrite);
226 rewrite = hc->build_rewrite (vnm, sw_if_index, link_type, dst_address);
237 u32 rewrite_node_index,
238 u32 post_rewrite_node_index,
239 vnet_rewrite_header_t * rw,
240 u8 * rewrite_data,
u32 rewrite_length)
248 rw->sw_if_index = tx_sw_if_index;
249 rw->node_index = rewrite_node_index;
251 post_rewrite_node_index);
252 rw->max_l3_packet_bytes = (
u16) ~ 0;
254 ASSERT (rewrite_length <
sizeof (adj->rewrite_data));
257 rewrite_data, rewrite_length);
263 vnet_rewrite_header_t *rw = va_arg (*va, vnet_rewrite_header_t *);
264 u32 max_data_bytes = va_arg (*va,
u32);
270 sizeof (rw->max_l3_packet_bytes));
279 vnet_rewrite_header_t *rw = va_arg (*va, vnet_rewrite_header_t *);
280 u32 max_data_bytes = va_arg (*va,
u32);
290 sizeof (rw->max_l3_packet_bytes));
300 const void *dst_address)
306 ASSERT (hc->build_rewrite);
307 return (hc->build_rewrite (vnm, sw_if_index, link_type, dst_address));
319 ASSERT (hc->update_adjacency);
320 hc->update_adjacency (vnm, sw_if_index, ai);
void vnet_rewrite_init(vnet_main_t *vnm, u32 sw_if_index, u32 this_node, u32 next_node, vnet_rewrite_header_t *rw)
static uword vnet_sw_interface_get_mtu(vnet_main_t *vnm, u32 sw_if_index, vlib_rx_or_tx_t dir)
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
Definitions for all things IP (v4|v6) unicast and multicast lookup related.
uword vnet_rewrite_data_t
void vnet_rewrite_for_sw_interface(vnet_main_t *vnm, vnet_link_t link_type, u32 sw_if_index, u32 node_index, void *dst_address, vnet_rewrite_header_t *rw, u32 max_rewrite_bytes)
Deprecated.
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
unformat_function_t unformat_vnet_sw_interface
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
void serialize_vnet_rewrite(serialize_main_t *m, va_list *va)
vnet_main_t * vnet_get_main(void)
void unserialize_vnet_rewrite(serialize_main_t *m, va_list *va)
static void * serialize_get(serialize_main_t *m, uword n_bytes)
static void vnet_rewrite_copy_one(vnet_rewrite_data_t *p0, vnet_rewrite_data_t *rw0, int i)
void vnet_update_adjacency_for_sw_interface(vnet_main_t *vnm, u32 sw_if_index, u32 ai)
u8 * format_vnet_rewrite_header(u8 *s, va_list *args)
format_function_t format_vnet_sw_interface_name
uword unformat_vnet_rewrite(unformat_input_t *input, va_list *args)
void vnet_rewrite_copy_slow_path(vnet_rewrite_data_t *p0, vnet_rewrite_data_t *rw0, word n_left, uword most_likely_size)
static void * vnet_rewrite_get_data_internal(vnet_rewrite_header_t *rw, int max_size)
u8 * vnet_build_rewrite_for_sw_interface(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
static void * unserialize_get(serialize_main_t *m, uword n_bytes)
format_function_t * format_buffer
void vnet_rewrite_for_tunnel(vnet_main_t *vnm, u32 tx_sw_if_index, u32 rewrite_node_index, u32 post_rewrite_node_index, vnet_rewrite_header_t *rw, u8 *rewrite_data, u32 rewrite_length)
u8 * format_vnet_rewrite(u8 *s, va_list *args)
#define vec_free(V)
Free vector's memory (no header).
u32 vnet_tx_node_index_for_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
static void vnet_rewrite_set_data_internal(vnet_rewrite_header_t *rw, int max_size, void *data, int data_bytes)
#define clib_memcpy(a, b, c)
unformat_function_t * unformat_buffer
static void unserialize_integer(serialize_main_t *m, void *x, u32 n_bytes)
static void serialize_integer(serialize_main_t *m, u64 x, u32 n_bytes)
static uword round_pow2(uword x, uword pow2)
u32 max_l3_packet_bytes[VLIB_N_RX_TX]
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
static vnet_hw_interface_class_t * vnet_get_hw_interface_class(vnet_main_t *vnm, u32 hw_class_index)
static vlib_node_t * vlib_get_next_node(vlib_main_t *vm, u32 node_index, u32 next_index)
Get vlib node by graph arc (next) index.
struct _vnet_hw_interface_class vnet_hw_interface_class_t
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
unformat_function_t unformat_vlib_node
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.