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;
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;
{
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;
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;
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;