aboutsummaryrefslogtreecommitdiffstats
path: root/vnet
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2016-03-16 22:59:21 +0100
committerDamjan Marion <damarion@cisco.com>2016-03-16 22:59:21 +0100
commit048ee2ebe5e0fe88a5748f15a82898c632208c16 (patch)
tree05fbc2398669f91d871d5a72e716ed8e99c7fc2f /vnet
parent334806ccc2bf21e00eeb3c59ad71b9ca77f5aef8 (diff)
af_packet: vec functions should not be used on pool
Change-Id: Ifc67db0575a7517ac24519894996906ea44ead67 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'vnet')
-rw-r--r--vnet/vnet/devices/af_packet/af_packet.c4
-rw-r--r--vnet/vnet/devices/af_packet/device.c4
-rw-r--r--vnet/vnet/devices/af_packet/node.c2
3 files changed, 5 insertions, 5 deletions
diff --git a/vnet/vnet/devices/af_packet/af_packet.c b/vnet/vnet/devices/af_packet/af_packet.c
index 93c8e0c6c95..bbaabad2fd0 100644
--- a/vnet/vnet/devices/af_packet/af_packet.c
+++ b/vnet/vnet/devices/af_packet/af_packet.c
@@ -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;
diff --git a/vnet/vnet/devices/af_packet/device.c b/vnet/vnet/devices/af_packet/device.c
index c00c6895801..1e05104cf2a 100644
--- a/vnet/vnet/devices/af_packet/device.c
+++ b/vnet/vnet/devices/af_packet/device.c
@@ -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;
diff --git a/vnet/vnet/devices/af_packet/node.c b/vnet/vnet/devices/af_packet/node.c
index eadb59238a7..19c0188bb6c 100644
--- a/vnet/vnet/devices/af_packet/node.c
+++ b/vnet/vnet/devices/af_packet/node.c
@@ -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;