46 uword most_likely_size)
48 uword n_done =
round_pow2 (most_likely_size,
sizeof (rw0[0])) /
sizeof (rw0[0]);
69 vnet_rewrite_header_t * rw = va_arg (*args, vnet_rewrite_header_t *);
70 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,
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);
120 vnet_rewrite_header_t * rw = va_arg (*args, vnet_rewrite_header_t *);
121 u32 max_data_bytes = va_arg (*args,
u32);
124 u32 next_index, sw_if_index, max_packet_bytes, error;
129 max_packet_bytes = ~0;
165 if (
vec_len (rw_data) >= max_data_bytes)
171 if (
unformat (input,
"mtu %d", &tmp)
172 && tmp < (1 <<
BITS (rw->max_l3_packet_bytes)))
173 max_packet_bytes = tmp;
177 rw->sw_if_index = sw_if_index;
178 rw->max_l3_packet_bytes = max_packet_bytes;
192 vnet_rewrite_header_t * rw,
193 u32 max_rewrite_bytes)
197 static u8 * rw_tmp = 0;
200 rw->sw_if_index = sw_if_index;
201 rw->node_index = node_index;
205 ASSERT (max_rewrite_bytes > 0);
210 n_rw_tmp = hc->set_rewrite (vnm, sw_if_index, packet_type, dst_address, rw_tmp, max_rewrite_bytes);
212 ASSERT (n_rw_tmp >= 0 && n_rw_tmp < max_rewrite_bytes);
218 u32 rewrite_node_index,
219 u32 post_rewrite_node_index,
220 vnet_rewrite_header_t * rw,
230 rw->sw_if_index = tx_sw_if_index;
231 rw->node_index = rewrite_node_index;
233 post_rewrite_node_index);
234 rw->max_l3_packet_bytes = (
u16) ~0;
236 ASSERT (rewrite_length <
sizeof (adj->rewrite_data));
239 rewrite_data, rewrite_length);
244 vnet_rewrite_header_t * rw = va_arg (*va, vnet_rewrite_header_t *);
245 u32 max_data_bytes = va_arg (*va,
u32);
250 serialize_integer (m, rw->max_l3_packet_bytes, sizeof (rw->max_l3_packet_bytes));
257 vnet_rewrite_header_t * rw = va_arg (*va, vnet_rewrite_header_t *);
258 u32 max_data_bytes = va_arg (*va,
u32);
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
always_inline uword round_pow2(uword x, uword pow2)
always_inline void * vnet_rewrite_get_data_internal(vnet_rewrite_header_t *rw, int max_size)
always_inline vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
always_inline vnet_hw_interface_class_t * vnet_get_hw_interface_class(vnet_main_t *vnm, u32 hw_class_index)
uword vnet_rewrite_data_t
unformat_function_t unformat_vnet_sw_interface
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
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)
always_inline void unserialize_integer(serialize_main_t *m, void *x, u32 n_bytes)
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)
always_inline 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)
always_inline vlib_node_t * vlib_get_next_node(vlib_main_t *vm, u32 node_index, u32 next_index)
u8 * format_vnet_rewrite(u8 *s, va_list *args)
#define vec_free(V)
Free vector's memory (no header).
void vnet_rewrite_for_sw_interface(vnet_main_t *vnm, vnet_l3_packet_type_t packet_type, u32 sw_if_index, u32 node_index, void *dst_address, vnet_rewrite_header_t *rw, u32 max_rewrite_bytes)
#define clib_memcpy(a, b, c)
unformat_function_t * unformat_buffer
always_inline vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
always_inline void serialize_integer(serialize_main_t *m, u64 x, u32 n_bytes)
u32 max_l3_packet_bytes[VLIB_N_RX_TX]
always_inline uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
struct _vnet_hw_interface_class vnet_hw_interface_class_t
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
always_inline vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
always_inline void vnet_rewrite_set_data_internal(vnet_rewrite_header_t *rw, int max_size, void *data, int data_bytes)
unformat_function_t unformat_vlib_node
always_inline void * serialize_get(serialize_main_t *m, uword n_bytes)
always_inline void vnet_rewrite_copy_one(vnet_rewrite_data_t *p0, vnet_rewrite_data_t *rw0, int i)