af_packet: vec functions should not be used on pool
Change-Id: Ifc67db0575a7517ac24519894996906ea44ead67 Signed-off-by: Damjan Marion <damarion@cisco.com>
This commit is contained in:
@ -200,7 +200,7 @@ af_packet_create_if(vlib_main_t * vm, u8 * host_if_name, u8 * hw_addr_set)
|
||||
goto error;
|
||||
|
||||
/* So far everything looks good, let's create interface */
|
||||
vec_add2 (apm->interfaces, apif, 1);
|
||||
pool_get (apm->interfaces, apif);
|
||||
if_index = apif - apm->interfaces;
|
||||
|
||||
apif->fd = fd;
|
||||
@ -241,7 +241,7 @@ af_packet_create_if(vlib_main_t * vm, u8 * host_if_name, u8 * hw_addr_set)
|
||||
if (error)
|
||||
{
|
||||
memset(apif, 0, sizeof(*apif));
|
||||
_vec_len(apm->interfaces) -= 1;
|
||||
pool_put(apm->interfaces, apif);
|
||||
clib_error_report (error);
|
||||
ret = VNET_API_ERROR_SYSCALL_ERROR_1;
|
||||
goto error;
|
||||
|
@ -47,7 +47,7 @@ static u8 * format_af_packet_device_name (u8 * s, va_list * args)
|
||||
{
|
||||
u32 i = va_arg (*args, u32);
|
||||
af_packet_main_t * apm = &af_packet_main;
|
||||
af_packet_if_t * apif = vec_elt_at_index (apm->interfaces, i);
|
||||
af_packet_if_t * apif = pool_elt_at_index (apm->interfaces, i);
|
||||
|
||||
s = format (s, "host-%s", apif->host_if_name);
|
||||
return s;
|
||||
@ -75,7 +75,7 @@ af_packet_interface_tx (vlib_main_t * vm,
|
||||
u32 n_left = frame->n_vectors;
|
||||
u32 n_sent = 0;
|
||||
vnet_interface_output_runtime_t * rd = (void *) node->runtime_data;
|
||||
af_packet_if_t * apif = vec_elt_at_index (apm->interfaces, rd->dev_instance);
|
||||
af_packet_if_t * apif = pool_elt_at_index (apm->interfaces, rd->dev_instance);
|
||||
int block = 0;
|
||||
u32 block_size = apif->tx_req->tp_block_size;
|
||||
u32 frame_size = apif->tx_req->tp_frame_size;
|
||||
|
@ -124,7 +124,7 @@ af_packet_device_input_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
|
||||
vlib_frame_t * frame, u32 device_idx)
|
||||
{
|
||||
af_packet_main_t * apm = &af_packet_main;
|
||||
af_packet_if_t * apif = vec_elt_at_index(apm->interfaces, device_idx);
|
||||
af_packet_if_t * apif = pool_elt_at_index(apm->interfaces, device_idx);
|
||||
struct tpacket2_hdr *tph;
|
||||
u32 next_index = AF_PACKET_INPUT_NEXT_ETHERNET_INPUT;
|
||||
u32 block = 0;
|
||||
|
Reference in New Issue
Block a user