|
AquilaOS documentation
How it works, and its code
|
Packet buffers (see net/netbuf.h). More...
Go to the source code of this file.
Macros | |
| #define | NETBUF_KEEP 64 |
| #define | NETBUF_PER_PAGE (PAGE_SIZE / NETBUF_SIZE) |
Functions | |
| static void | free_push (struct netbuf *nb) |
| Puts a netbuf on the free list. | |
| static void | free_remove (struct netbuf *nb) |
| Takes a netbuf off the free list. | |
| struct netbuf * | netbuf_alloc (void) |
| Allocates a netbuf, empty, with room for the headers that will be put in front of its data. | |
| void | netbuf_free (struct netbuf *nb) |
| Frees a netbuf. | |
Variables | |
| static struct netbuf * | free_netbufs |
| static size_t | free_count |
Packet buffers (see net/netbuf.h).
A netbuf holds one packet: NETBUF_SIZE bytes, two to a page of memory. Freed netbufs are kept on a free list, ready for the next packets, and a page goes back to the page allocator only when all its netbufs are free and the list has enough without them.
Definition in file netbuf.c.
| #define NETBUF_KEEP 64 |
Definition at line 19 of file netbuf.c.
Referenced by netbuf_free().
| #define NETBUF_PER_PAGE (PAGE_SIZE / NETBUF_SIZE) |
Definition at line 20 of file netbuf.c.
Referenced by netbuf_free().
|
static |
Puts a netbuf on the free list.
Definition at line 26 of file netbuf.c.
References free_count, free_netbufs, netbuf::free_prev, free_push(), netbuf::next, and NULL.
Referenced by free_push(), netbuf_alloc(), and netbuf_free().
|
static |
Takes a netbuf off the free list.
Definition at line 39 of file netbuf.c.
References free_count, free_netbufs, netbuf::free_prev, free_remove(), and netbuf::next.
Referenced by free_remove(), netbuf_alloc(), and netbuf_free().
| struct netbuf * netbuf_alloc | ( | void | ) |
Allocates a netbuf, empty, with room for the headers that will be put in front of its data.
Definition at line 58 of file netbuf.c.
References arch_phys_map(), netbuf::data, free_netbufs, free_push(), free_remove(), netbuf::len, mm_page_alloc(), mm_page_dealloc(), mm_page_incref(), netbuf_alloc(), NETBUF_HEADROOM, NETBUF_SIZE, netbuf::netif, netbuf::next, NULL, vm_page::off, vm_page::paddr, netbuf::page, and PAGE_SIZE.
Referenced by arp_request(), icmp_unreachable(), loopback_transmit(), netbuf_alloc(), rx_poll(), segment(), socket_inet_send(), and tcp_reply_rst().
| void netbuf_free | ( | struct netbuf * | nb | ) |
Frees a netbuf.
| nb | the netbuf |
Definition at line 99 of file netbuf.c.
References free_count, free_push(), free_remove(), mm_page_dealloc(), mm_page_decref(), mm_page_ref(), netbuf_free(), NETBUF_KEEP, NETBUF_PER_PAGE, NETBUF_SIZE, netbuf::page, and PAGE_MASK.
Referenced by arp_input(), arp_resolve(), ether_input(), ether_output(), icmp_input(), inet_sock_deliver(), ipv4_input(), ipv4_output(), ipv4_send(), netbuf_free(), ooo_drain(), ooo_insert(), ooo_purge(), pending_drop(), segment_input(), socket_inet_recv(), socket_inet_send(), socket_inet_shutdown(), tcp_input(), tcp_pcb_free(), and udp_input().
|
static |
Definition at line 23 of file netbuf.c.
Referenced by free_push(), free_remove(), and netbuf_free().
|
static |
Definition at line 22 of file netbuf.c.
Referenced by free_push(), free_remove(), and netbuf_alloc().