From 048ee2ebe5e0fe88a5748f15a82898c632208c16 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Wed, 16 Mar 2016 22:59:21 +0100 Subject: af_packet: vec functions should not be used on pool Change-Id: Ifc67db0575a7517ac24519894996906ea44ead67 Signed-off-by: Damjan Marion --- vnet/vnet/devices/af_packet/af_packet.c | 4 ++-- vnet/vnet/devices/af_packet/device.c | 4 ++-- vnet/vnet/devices/af_packet/node.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'vnet') 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; -- cgit 1.2.3-korg