GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — HomaModule/homa_tx_pool.h at main · PlatformLab/HomaModule Expand file tree/ Copy pathhoma_tx_pool.hMore file actions 141 lines (120 loc) · 4.09 KB / Copy pathhoma_tx_pool.hFile metadata and controls141 lines (120 loc) · 4.09 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 /* SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0+ */ /* This module manages a pool of memory pages used for outgoing sk_buffs. */ #ifndef _HOMA_TX_POOL_H #define _HOMA_TX_POOL_H #include <linux/percpu-defs.h> /** * define HOMA_TX_PAGE_ORDER - exponent (power of two) determining how * many pages to allocate in a high-order page for skb pages (e.g., * 2 means allocate in units of 4 pages). */ #define HOMA_TX_PAGE_ORDER 4 /** * define HOMA_TX_PAGE_SIZE - number of bytes corresponding to HOMA_PAGE_ORDER. */ #define HOMA_TX_PAGE_SIZE (PAGE_SIZE << HOMA_TX_PAGE_ORDER) /** * define HOMA_TX_PAGE_SHIFT: HOMA_PAGE_SIZE == 1 << HOMA_TX_PAGE_SHIFT */ #define HOMA_TX_PAGE_SHIFT (PAGE_SHIFT + HOMA_TX_PAGE_ORDER) /** * struct homa_tx_pool - A cache of free pages available for use. * Each page is of size HOMA_TX_PAGE_SIZE, and a given pool is dedicated for * use by a single NUMA node. */ struct homa_tx_pool { /** @mutex: Used to synchronize access to the fields in this struct. */ spinlock_t mutex; /** @avail: Number of free pages currently in the pool. */ int avail; /** * @low_mark: Low water mark: smallest value of avail since the * last time homa_tx_pool_gc reset it. */ int low_mark; #define HOMA_TX_POOL_LIMIT 1000 /** * @pages: Pointers to pages that are currently free; the ref count * is 1 in each of these pages. */ struct page *pages[HOMA_TX_POOL_LIMIT]; }; /** * struct homa_tx_pool_core - Stores core-specific information related to * tx memory allocation. All values are assumed to be zero initially. */ struct homa_tx_pool_core { /** * @page: a page of data that is "owned" by this core and used for * allocation on this core (or NULL). This pointer is included in * the page's reference count. */ struct page *page; /** * @page_size: total number of bytes in @page (including any * already allocated). */ int page_size; /** * @allocated: number of (initial) bytes in @page that have already * been allocated for use. */ int allocated; /** * @nid: The identifier for the preferred NUMA node that will be * used to allocate memory for this core (index of pool within * homa->tx_pools). This value only affects performance: if it is * incorrect then pages may not be cached for the core. */ int nid; }; DECLARE_PER_CPU(struct homa_tx_pool_core, homa_tx_pool_core); /** * struct homa_frag_filler - Used to iterate over an array of skb_frag_t's * to copy data into them. */ struct homa_frag_filler { /** @frag: Fragment currently being filled (in an array of frags). */ skb_frag_t *frag; /** * @offset: Offset within @frag where the next byte of data should be * stored. */ int offset; /** * @num_frags: Number of fragments in the array including @frag: * if this reaches zero then we have run out of space. */ int num_frags; }; /** * homa_frag_filler_init() - Initialize a frag filler. * @filler: Struct to initialize. * @num_frags: Number of fragments available to fill. * @frags: First in array of @num_frags fragments. */ static inline void homa_frag_filler_init(struct homa_frag_filler *filler, int num_frags, skb_frag_t *frags) { filler->frag = frags; filler->offset = 0; filler->num_frags = num_frags; } int homa_copy_iter_to_frags(struct homa_frag_filler *filler, struct iov_iter *iter, int num_bytes); int homa_copy_to_frags(struct homa_frag_filler *filler, void *src, int num_bytes); int homa_tx_pool_alloc(struct homa *homa, int length, int *num_frags, skb_frag_t **frags); int __homa_tx_pool_alloc_frag(struct homa_tx_pool_core *tx_core, struct homa_tx_pool *pool, int length, skb_frag_t *frag); struct page *homa_tx_pool_alloc_page(struct homa_tx_pool_core *tx_core, struct homa_tx_pool *pool, int *length); void homa_tx_pool_cleanup(struct homa *homa); void homa_tx_pool_free(struct homa *homa, int nid, int num_frags, skb_frag_t *frags); void homa_tx_pool_gc(struct homa *homa); int homa_tx_pool_init(struct homa *homa); int homa_tx_pool_mem_nid(int core); #endif /* _HOMA_TX_POOL_H */ |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |