MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ng_alloc_item

Function ng_alloc_item

freebsd/netgraph/ng_base.c:2977–2999  ·  view source on GitHub ↗

* Get a queue entry. * This is usually called when a packet first enters netgraph. * By definition, this is usually from an interrupt, or from a user. * Users are not so important, but try be quick for the times that it's * an interrupt. */

Source from the content-addressed store, hash-verified

2975 * an interrupt.
2976 */
2977static __inline item_p
2978ng_alloc_item(int type, int flags)
2979{
2980 item_p item;
2981
2982 KASSERT(((type & ~NGQF_TYPE) == 0),
2983 ("%s: incorrect item type: %d", __func__, type));
2984
2985 item = uma_zalloc((type == NGQF_DATA) ? ng_qdzone : ng_qzone,
2986 ((flags & NG_WAITOK) ? M_WAITOK : M_NOWAIT) | M_ZERO);
2987
2988 if (item) {
2989 item->el_flags = type;
2990#ifdef NETGRAPH_DEBUG
2991 mtx_lock(&ngq_mtx);
2992 TAILQ_INSERT_TAIL(&ng_itemlist, item, all);
2993 allocated++;
2994 mtx_unlock(&ngq_mtx);
2995#endif
2996 }
2997
2998 return (item);
2999}
3000
3001/*
3002 * Release a queue entry

Callers 7

ng_realloc_itemFunction · 0.70
ng_package_dataFunction · 0.70
ng_package_msgFunction · 0.70
ng_package_msg_selfFunction · 0.70
ng_send_fn1Function · 0.70
ng_send_fn2Function · 0.70
ng_calloutFunction · 0.70

Calls 3

uma_zallocFunction · 0.50
mtx_lockFunction · 0.50
mtx_unlockFunction · 0.50

Tested by

no test coverage detected