Descriptions of section entries: M: Maintainer Full name and E-mail address: Full Name One maintainer per line. Multiple M: lines acceptable. F: Files and directories with wildcard patterns. A trailing slash includes all files and subdirectory files. F: drivers/net/ all files in and below drivers/net F: drivers/net/* all files in drivers/net, but not below One pattern per line. Multiple F: lines acceptable. E: exclude file(s) matched by F: C: Single line comment related to current section. I: single word feature/component identifier Y: path to feature YAML file ----------------------------------- Build System I: build M: Damjan Marion F: Makefile F: src/CMakeLists.txt F: src/cmake/ F: build/ Build System Internal I: ebuild M: Dave Barach F: build-root/Makefile F: build-data/ VNET I: vnet M: Damjan Marion F: src/vnet/error.* VNET Link Bonding I: bonding M: Steven Luong F: src/vnet/bonding/ Sphinx Documents I: docs M: John DeNisco M: Ray Kinsella F: docs/ Infrastructure Library I: vppinfra M: Dave Barach F: src/vppinfra/ Physical Memory Allocator I: pmalloc M: Damjan Marion F: src/vppinfra/pmalloc.[ch] Vector Library I: vlib M: Dave Barach M: Damjan Marion F: src/vlib/ E: src/vlib/buffer*.[ch] E: src/vlib/pci/ E: src/vlib/linux/pci.[ch] E: src/vlib/linux/vfio.[ch] Vector Library - Buffer Management I: buffers M: Damjan Marion M: Dave Barach F: src/vlib/buffer*.[ch] Vector Library - PCI I: pci M: Damjan Marion F: src/vlib/pci/ F: src/vlib/linux/pci.[ch] F: src/vlib/linux/vfio.[ch] Binary API Libraries I: api M: Dave Barach F: src/vlibapi/ F: src/vlibmemory/ VNET Bidirectional Forwarding Detection (BFD) I: bfd M: Klement Sekera F: src/vnet/bfd/ VNET Classifier I: classify M: Dave Barach F: src/vnet/classify VNET Policer I: policer M: Neale Ranns F: src/vnet/policer/ VNET Device Drivers I: devices Y: src/vnet/devices/af_packet/FEATURE.yaml Y: src/vnet/devices/pipe/FEATURE.yaml M: Damjan Marion F: src/vnet/devices/ VNET TAP Drivers I: tap Y: src/vnet/devices/tap/FEATURE.yaml M: Damjan Marion M: Steven Luong M: Mohsin Kazmi F: src/vnet/devices/tap/ VNET Vhost User Driver I: vhost Y: src/vnet/devices/virtio/FEATURE.yaml M: Steven Luong F: src/vnet/devices/virtio/vhost_user* VNET Native Virtio Drivers I: virtio Y: src/vnet/devices/virtio/FEATURE.yaml M: Mohsin Kazmi M: Damjan Marion F: src/vnet/devices/virtio/ VNET Ethernet I: ethernet M: Dave Barach M: Damjan Marion F: src/vnet/ethernet/ VNET Feature Arcs I: feature M: Dave Barach M: Damjan Marion F: src/vnet/feature/ VNET FIB I: fib M: Neale Ranns F: src/vnet/fib/ F: src/vnet/mfib/ F: src/vnet/dpo F: src/vnet/adj VNET IPv4 LPM I: ip M: Dave Barach F: src/vnet/ip/ VNET IPv6 LPM I: ip6 M: Neale Ranns M: Jon Loeliger F: src/vnet/ip/ VNET IP Neighbors I: ip-neighbor M: Neale Ranns F: src/vnet/ip-neighbor VNET QoS I: qos M: Neale Ranns F: src/vnet/qos/ VNET Interface Common I: interface M: Dave Barach F: src/vnet/interface*.[ch] VNET Packet Generator I: pg M: Dave Barach F: src/vnet/pg/ VNET Segment Routing (IPv6 and MPLS) I: sr M: Pablo Camarillo F: src/vnet/srv6/ F: src/vnet/srmpls/ F: src/examples/srv6-sample-localsid/ VNET IPSec I: ipsec M: Neale Ranns M: Radu Nicolau M: Fan Zhang F: src/vnet/ipsec/ VNET Crypto Infra I: crypto M: Damjan Marion M: Neale Ranns F: src/vnet/crypto/ VNET TEIB I: teib M: Neale Ranns F: src/vnet/teib/ VNET SPAN I: span M: N/A F: src/vnet/span Plugin - Crypto - native I: crypto-native M: Damjan Marion F: src/plugins/crypto_native/ Plugin - Crypto - OpenSSL I: crypto-openssl M: Damjan Marion F: src/plugins/crypto_openssl/ Plugin - Crypto - ipsecmb I: crypto-ipsecmb M: Neale Ranns M: Fan Zhang F: src/plugins/crypto_ipsecmb/ Plugin - Crypto - sw_scheduler I: crypto-sw-scheduler M: Fan Zhang F: src/plugs/crypto_sw_scheduler/ VNET L2 I: l2 M: John Lo M: Steven Luong F: src/vnet/l2/ VNET GRE I: gre M: Neale Ranns F: src/vnet/gre/ VNET GSO I: gso M: Andrew Yourtchenko M: Mohsin Kazmi F: src/vnet/gso/ Plugin - MAP I: map Y: src/plugins/map/FEATURE.yaml M: Ole Troan M: Jon Loeliger F: src/plugins/map VNET MPLS I: mpls M: Neale Ranns F: src/vnet/mpls/ VNET BIER I: bier M: Neale Ranns F: src/vnet/bier/ VNET Session Layer I: session Y: src/vnet/session/FEATURE.yaml M: Florin Coras F: src/vnet/session VNET TCP I: tcp Y: src/vnet/tcp/FEATURE.yaml M: Florin Coras F: src/vnet/tcp VNET UDP I: udp Y: src/vnet/udp/FEATURE.yaml M: Florin Coras F: src/vnet/udp VNET VXLAN I: vxlan M: John Lo M: Steven Luong F: src/vnet/vxlan/ VNET VXLAN-GPE I: vxlan-gpe M: Hongjun Ni F: src/vnet/vxlan-gpe/ VNET IPIP I: ipip Y: src/vnet/ipip/FEATURE.yaml M: Ole Troan F: src/vnet/ipip/ VNET tunnel I: tunnel M: Neale Ranns F: src/vnet/tunnel' VNET TLS and TLS engine plugins I: tls M: Florin Coras M: Ping Yu F: src/vnet/tls F: src/plugins/tlsopenssl F: src/plugins/tlsmbedtls F: src/plugins/tlspicotls VNET SYSLOG I: syslog M: Matus Fabian F: src/vnet/syslog Plugin - DHCP I: dhcp M: Dave Barach M: Neale Ranns F: src/plugins/dhcp/ VNET - ARP I: arp M: Dave Barach M: Neale Ranns F: src/vnet/arp/ Plugin - ARPing CLI I: arping M: Steven Luong F: src/plugins/arping/ VNET - IP6 Neighbor Discovery I: ip6-nd M: Dave Barach M: Neale Ranns F: src/vnet/ip6-nd/ VNET GENEVE I: ge
/*
 * Copyright (c) 2018 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef included_valloc_h
#define included_valloc_h
#include <vppinfra/clib.h>
#include <vppinfra/pool.h>
#include <vppinfra/bitmap.h>
#include <vppinfra/lock.h>
#include <vppinfra/hash.h>

/** @file
    @brief Simple first-fit virtual space allocator
*/

typedef struct
{
  u32 next;			/**< next chunk pool index */
  u32 prev;			/**< previous chunk pool index */
  uword baseva;			/**< base VA for this chunk */
  uword size;			/**< size in bytes of this chunk */
  uword flags;			/**< flags (free/busy)  */
} clib_valloc_chunk_t;

#define CLIB_VALLOC_BUSY	(1<<0) /**< chunk is in use */

typedef struct
{
  clib_valloc_chunk_t *chunks;	/**< pool of virtual chunks  */
  uword *chunk_index_by_baseva;	/**< chunk by baseva hash */
  clib_spinlock_t lock;		/**< spinlock */
  uword flags;			/**< flags */
  u32 first_index;		/**< pool index of first chunk in list */
} clib_valloc_main_t;

#define CLIB_VALLOC_INITIALIZED	(1<<0) /**< object has been initialized */

/* doxygen tags in valloc.c */
void clib_valloc_init (clib_valloc_main_t * vam,
		       clib_valloc_chunk_t * template, int need_lock);
void
clib_valloc_add_chunk (clib_valloc_main_t