aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlibmemory/vlib_api.c
AgeCommit message (Expand)AuthorFilesLines
2020-05-27dhcp: vat support for the dhcp_client_dump APIDave Barach1-0/+11
2020-02-05api: fix vl_api_clnt_node process stack overflowChenmin Sun1-0/+1
2019-12-10api: multiple connections per processDave Barach1-7/+7
2019-12-09api: fix sock reg passing on read eventFlorin Coras1-3/+9
2019-12-06api: fix free socket process argsFlorin Coras1-0/+1
2019-10-02vlib: improve summary vector-rate statisticsDave Barach1-1/+1
2019-08-27api: revert use string type for strings in memclnt.apiOle Troan1-20/+15
2019-08-27api: use string type for strings in memclnt.apiOle Troan1-15/+20
2019-08-08api: vppapitrace JSON/API trace converterOle Troan1-23/+0
2019-05-16init / exit function orderingDave Barach1-1/+1
2018-11-14Remove c-11 memcpy checks from perf-critical codeDave Barach1-1/+1
2018-11-13vlib rename vlib_frame_args(...) to vlib_frame_scalar_args(..)Damjan Marion1-2/+2
2018-11-01Move RPC calls off the binary API input queueDave Barach1-29/+14
2018-10-25Revert "Keep RPC traffic off the shared-memory API queue"Florin Coras1-16/+29
2018-10-24Keep RPC traffic off the shared-memory API queueDave Barach1-29/+16
2018-10-23c11 safe string handling supportDave Barach1-4/+4
2018-10-02PAPI: Use UNIX domain sockets instead of shared memoryOle Troan1-2/+2
2018-08-17vlibapi: validate private segment rotor prior to useFlorin Coras1-1/+1
2018-06-27gcc8 and Wstringop-truncationMarco Varlese1-4/+6
2018-06-08export counters in a memfd segmentDave Barach1-6/+0
2018-01-11api: remove transport specific code from handlersFlorin Coras1-4/+4
2018-01-09api: refactor vlibmemoryFlorin Coras1-0/+750
len; #else u32 len; /**< Number of elements in vector (NOT its allocated length). */ #endif u8 vector_data[0]; /**< Vector data . */ } vec_header_t; /** \brief Find the vector header Given the user's pointer to a vector, find the corresponding vector header @param v pointer to a vector @return pointer to the vector's vector_header_t */ #define _vec_find(v) ((vec_header_t *) (v) - 1) #define _vec_round_size(s) \ (((s) + sizeof (uword) - 1) &~ (sizeof (uword) - 1)) always_inline uword vec_header_bytes (uword header_bytes) { return round_pow2 (header_bytes + sizeof (vec_header_t), sizeof (vec_header_t)); } /** \brief Find a user vector header Finds the user header of a vector with unspecified alignment given the user pointer to the vector. */ always_inline void * vec_header (void *v, uword header_bytes) { return v - vec_header_bytes (header_bytes); } /** \brief Find the end of user vector header Finds the end of the user header of a vector with unspecified alignment given the user pointer to the vector. */ always_inline void * vec_header_end (void *v, uword header_bytes) { return v + vec_header_bytes (header_bytes); } always_inline uword vec_aligned_header_bytes (uword header_bytes, uword align) { return round_pow2 (header_bytes + sizeof (vec_header_t), align); } always_inline void * vec_aligned_header (void *v, uword header_bytes, uword align) { return v - vec_aligned_header_bytes (header_bytes, align); } always_inline void * vec_aligned_header_end (void *v, uword header_bytes, uword align) { return v + vec_aligned_header_bytes (header_bytes, align); } /** \brief Number of elements in vector (lvalue-capable) _vec_len (v) does not check for null, but can be used as a lvalue (e.g. _vec_len (v) = 99). */ #define _vec_len(v) (_vec_find(v)->len) /** \brief Number of elements in vector (rvalue-only, NULL tolerant) vec_len (v) checks for NULL, but cannot be used as an lvalue. If in doubt, use vec_len... */ #define vec_len(v) ((v) ? _vec_len(v) : 0) /** \brief Reset vector length to zero NULL-pointer tolerant */ #define vec_reset_length(v) do { if (v) _vec_len (v) = 0; } while (0) /** \brief Number of data bytes in vector. */ #define vec_bytes(v) (vec_len (v) * sizeof (v[0])) /** \brief Total number of bytes that can fit in vector with current allocation. */ #define vec_capacity(v,b) \ ({ \ void * _vec_capacity_v = (void *) (v); \ uword _vec_capacity_b = (b); \ _vec_capacity_b = sizeof (vec_header_t) + _vec_round_size (_vec_capacity_b); \ _vec_capacity_v ? clib_mem_size (_vec_capacity_v - _vec_capacity_b) : 0; \ }) /** \brief Total number of elements that can fit into vector. */ #define vec_max_len(v) (vec_capacity(v,0) / sizeof (v[0])) /** \brief End (last data address) of vector. */ #define vec_end(v) ((v) + vec_len (v)) /** \brief True if given pointer is within given vector. */ #define vec_is_member(v,e) ((e) >= (v) && (e) < vec_end (v)) /** \brief Get vector value at index i checking that i is in bounds. */ #define vec_elt_at_index(v,i) \ ({ \ ASSERT ((i) < vec_len (v)); \ (v) + (i); \ }) /** \brief Get vector value at index i */ #define vec_elt(v,i) (vec_elt_at_index(v,i))[0] /** \brief Vector iterator */ #define vec_foreach(var,vec) for (var = (vec); var < vec_end (vec); var++) /** \brief Vector iterator (reverse) */ #define vec_foreach_backwards(var,vec) \ for (var = vec_end (vec) - 1; var >= (vec); var--) /** \brief Iterate over vector indices. */ #define vec_foreach_index(var,v) for ((var) = 0; (var) < vec_len (v); (var)++) #endif /* included_clib_vec_bootstrap_h */ /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */