diff options
author | Damjan Marion <damarion@cisco.com> | 2019-01-18 20:24:44 +0100 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2019-01-18 23:18:05 +0000 |
commit | ab9b7ec210059573c2cbe3ed961de533ba43e435 (patch) | |
tree | 943cf516742a8537607181ebad9966cee0109698 | |
parent | 64d557cd6723cc3a7ae3a0a68a52e220f8f2c7f1 (diff) |
buffers: remove freelist argument from vlib_buffer_add_data
Change-Id: Idb224b807373128b78dc46f177b2d2e0ed288349
Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r-- | src/vlib/buffer.c | 14 | ||||
-rw-r--r-- | src/vlib/buffer_funcs.h | 5 | ||||
-rwxr-xr-x | src/vnet/ip/ip6_neighbor.c | 20 | ||||
-rw-r--r-- | src/vnet/srp/node.c | 8 |
4 files changed, 17 insertions, 30 deletions
diff --git a/src/vlib/buffer.c b/src/vlib/buffer.c index 5370d501293..07f91c39a0e 100644 --- a/src/vlib/buffer.c +++ b/src/vlib/buffer.c @@ -706,22 +706,20 @@ vlib_packet_template_get_packet (vlib_main_t * vm, /* Append given data to end of buffer, possibly allocating new buffers. */ int -vlib_buffer_add_data (vlib_main_t * vm, - vlib_buffer_free_list_index_t free_list_index, - u32 * buffer_index, void *data, u32 n_data_bytes) +vlib_buffer_add_data (vlib_main_t * vm, u32 * buffer_index, void *data, + u32 n_data_bytes) { u32 n_buffer_bytes, n_left, n_left_this_buffer, bi; vlib_buffer_t *b; void *d; bi = *buffer_index; - if (bi == ~0 - && 1 != vlib_buffer_alloc_from_free_list (vm, &bi, 1, free_list_index)) + if (bi == ~0 && 1 != vlib_buffer_alloc (vm, &bi, 1)) goto out_of_buffers; d = data; n_left = n_data_bytes; - n_buffer_bytes = vlib_buffer_free_list_buffer_size (vm, free_list_index); + n_buffer_bytes = VLIB_BUFFER_DATA_SIZE; b = vlib_get_buffer (vm, bi); b->flags &= ~VLIB_BUFFER_TOTAL_LENGTH_VALID; @@ -746,9 +744,7 @@ vlib_buffer_add_data (vlib_main_t * vm, break; d += n; - if (1 != - vlib_buffer_alloc_from_free_list (vm, &b->next_buffer, 1, - free_list_index)) + if (1 != vlib_buffer_alloc (vm, &b->next_buffer, 1)) goto out_of_buffers; b->flags |= VLIB_BUFFER_NEXT_PRESENT; diff --git a/src/vlib/buffer_funcs.h b/src/vlib/buffer_funcs.h index f5781c8b173..cc72c57d5e8 100644 --- a/src/vlib/buffer_funcs.h +++ b/src/vlib/buffer_funcs.h @@ -684,9 +684,8 @@ vlib_buffer_free_list_buffer_size (vlib_main_t * vm, } /* Append given data to end of buffer, possibly allocating new buffers. */ -int vlib_buffer_add_data (vlib_main_t * vm, - vlib_buffer_free_list_index_t free_list_index, - u32 * buffer_index, void *data, u32 n_data_bytes); +int vlib_buffer_add_data (vlib_main_t * vm, u32 * buffer_index, void *data, + u32 n_data_bytes); /* duplicate all buffers in chain */ always_inline vlib_buffer_t * diff --git a/src/vnet/ip/ip6_neighbor.c b/src/vnet/ip/ip6_neighbor.c index 3acfb1a4897..d501832bed2 100755 --- a/src/vnet/ip/ip6_neighbor.c +++ b/src/vnet/ip/ip6_neighbor.c @@ -1691,8 +1691,7 @@ icmp6_router_solicitation (vlib_main_t * vm, sizeof (icmp6_router_advertisement_header_t); if (vlib_buffer_add_data - (vm, vlib_buffer_get_free_list_index - (p0), &bi0, (void *) &rh, + (vm, &bi0, (void *) &rh, sizeof (icmp6_router_advertisement_header_t))) { /* buffer allocation failed, drop the pkt */ @@ -1714,8 +1713,7 @@ icmp6_router_solicitation (vlib_main_t * vm, eth_if0->address, 6); if (vlib_buffer_add_data - (vm, vlib_buffer_get_free_list_index - (p0), &bi0, (void *) &h, + (vm, &bi0, (void *) &h, sizeof (icmp6_neighbor_discovery_ethernet_link_layer_address_option_t))) { @@ -1743,8 +1741,7 @@ icmp6_router_solicitation (vlib_main_t * vm, sizeof (icmp6_neighbor_discovery_mtu_option_t); if (vlib_buffer_add_data - (vm, vlib_buffer_get_free_list_index - (p0), &bi0, (void *) &h, + (vm, &bi0, (void *) &h, sizeof (icmp6_neighbor_discovery_mtu_option_t))) { @@ -1800,10 +1797,8 @@ icmp6_router_solicitation (vlib_main_t * vm, payload_length += sizeof( icmp6_neighbor_discovery_prefix_information_option_t); if (vlib_buffer_add_data - (vm, vlib_buffer_get_free_list_index (p0), - &bi0, - (void *)&h, - sizeof(icmp6_neighbor_discovery_prefix_information_option_t))) + (vm, &bi0, (void *)&h, + sizeof(icmp6_neighbor_discovery_prefix_information_option_t))) { error0 = ICMP6_ERROR_ALLOC_FAILURE; goto drop0; @@ -2846,9 +2841,8 @@ ip6_neighbor_send_mldpv2_report (u32 sw_if_index) num_addr_records++; - if(vlib_buffer_add_data - (vm, vlib_buffer_get_free_list_index (b0), &bo0, - (void *)&rr, sizeof(icmp6_multicast_address_record_t))) + if(vlib_buffer_add_data (vm, &bo0, (void *)&rr, + sizeof(icmp6_multicast_address_record_t))) { vlib_buffer_free (vm, &bo0, 1); goto alloc_fail; diff --git a/src/vnet/srp/node.c b/src/vnet/srp/node.c index cf9bd31c513..a852f61ab4d 100644 --- a/src/vnet/srp/node.c +++ b/src/vnet/srp/node.c @@ -333,8 +333,7 @@ srp_topology_packet (vlib_main_t * vm, u32 sw_if_index, u8 ** contents) u32 * to_next; u32 bi = ~0; - if (vlib_buffer_add_data (vm, VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX, - /* buffer to append to */ &bi, + if (vlib_buffer_add_data (vm, /* buffer to append to */ &bi, *contents, vec_len (*contents))) { /* complete or partial buffer allocation failure */ @@ -628,9 +627,8 @@ static void tx_ips_packet (srp_interface_t * si, = ~ip_csum_fold (ip_incremental_checksum (0, &i->control, sizeof (i[0]) - STRUCT_OFFSET_OF (srp_ips_header_t, control))); - if (vlib_buffer_add_data (vm, VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX, - /* buffer to append to */ &bi, - i, sizeof (i[0]))) + if (vlib_buffer_add_data (vm, /* buffer to append to */ &bi, i, + sizeof (i[0]))) { /* complete or partial allocation failure */ if (bi != ~0) |