Deleted Added
full compact
netmap_mem2.h (270063) netmap_mem2.h (285349)
1/*
2 * Copyright (C) 2012-2014 Matteo Landi, Luigi Rizzo, Giuseppe Lettieri. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 10 unchanged lines hidden (view full) ---

19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 */
25
26/*
1/*
2 * Copyright (C) 2012-2014 Matteo Landi, Luigi Rizzo, Giuseppe Lettieri. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 10 unchanged lines hidden (view full) ---

19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 */
25
26/*
27 * $FreeBSD: head/sys/dev/netmap/netmap_mem2.h 270063 2014-08-16 15:00:01Z luigi $
27 * $FreeBSD: head/sys/dev/netmap/netmap_mem2.h 285349 2015-07-10 05:51:36Z luigi $
28 *
29 * (New) memory allocator for netmap
30 */
31
32/*
33 * This allocator creates three memory pools:
34 * nm_if_pool for the struct netmap_if
35 * nm_ring_pool for the struct netmap_ring

--- 76 unchanged lines hidden (view full) ---

112 * structure. The global allocator uses this information to prevent/allow
113 * reconfiguration. The private allocators release all their memory when there
114 * are no active users. By 'active user' we mean an existing netmap_priv
115 * structure holding a reference to the allocator.
116 */
117
118extern struct netmap_mem_d nm_mem;
119
28 *
29 * (New) memory allocator for netmap
30 */
31
32/*
33 * This allocator creates three memory pools:
34 * nm_if_pool for the struct netmap_if
35 * nm_ring_pool for the struct netmap_ring

--- 76 unchanged lines hidden (view full) ---

112 * structure. The global allocator uses this information to prevent/allow
113 * reconfiguration. The private allocators release all their memory when there
114 * are no active users. By 'active user' we mean an existing netmap_priv
115 * structure holding a reference to the allocator.
116 */
117
118extern struct netmap_mem_d nm_mem;
119
120struct lut_entry* netmap_mem_get_lut(struct netmap_mem_d *);
121u_int netmap_mem_get_buftotal(struct netmap_mem_d *);
122size_t netmap_mem_get_bufsize(struct netmap_mem_d *);
120void netmap_mem_get_lut(struct netmap_mem_d *, struct netmap_lut *);
123vm_paddr_t netmap_mem_ofstophys(struct netmap_mem_d *, vm_ooffset_t);
124int netmap_mem_finalize(struct netmap_mem_d *, struct netmap_adapter *);
125int netmap_mem_init(void);
126void netmap_mem_fini(void);
127struct netmap_if * netmap_mem_if_new(struct netmap_adapter *);
128void netmap_mem_if_delete(struct netmap_adapter *, struct netmap_if *);
129int netmap_mem_rings_create(struct netmap_adapter *);
130void netmap_mem_rings_delete(struct netmap_adapter *);
131void netmap_mem_deref(struct netmap_mem_d *, struct netmap_adapter *);
132int netmap_mem_get_info(struct netmap_mem_d *, u_int *size, u_int *memflags, uint16_t *id);
133ssize_t netmap_mem_if_offset(struct netmap_mem_d *, const void *vaddr);
134struct netmap_mem_d* netmap_mem_private_new(const char *name,
135 u_int txr, u_int txd, u_int rxr, u_int rxd, u_int extra_bufs, u_int npipes,
136 int* error);
121vm_paddr_t netmap_mem_ofstophys(struct netmap_mem_d *, vm_ooffset_t);
122int netmap_mem_finalize(struct netmap_mem_d *, struct netmap_adapter *);
123int netmap_mem_init(void);
124void netmap_mem_fini(void);
125struct netmap_if * netmap_mem_if_new(struct netmap_adapter *);
126void netmap_mem_if_delete(struct netmap_adapter *, struct netmap_if *);
127int netmap_mem_rings_create(struct netmap_adapter *);
128void netmap_mem_rings_delete(struct netmap_adapter *);
129void netmap_mem_deref(struct netmap_mem_d *, struct netmap_adapter *);
130int netmap_mem_get_info(struct netmap_mem_d *, u_int *size, u_int *memflags, uint16_t *id);
131ssize_t netmap_mem_if_offset(struct netmap_mem_d *, const void *vaddr);
132struct netmap_mem_d* netmap_mem_private_new(const char *name,
133 u_int txr, u_int txd, u_int rxr, u_int rxd, u_int extra_bufs, u_int npipes,
134 int* error);
137void netmap_mem_private_delete(struct netmap_mem_d *);
135void netmap_mem_delete(struct netmap_mem_d *);
138
136
137//#define NM_DEBUG_MEM_PUTGET 1
138
139#ifdef NM_DEBUG_MEM_PUTGET
140
141#define netmap_mem_get(nmd) \
142 do { \
143 __netmap_mem_get(nmd, __FUNCTION__, __LINE__); \
144 } while (0)
145
146#define netmap_mem_put(nmd) \
147 do { \
148 __netmap_mem_put(nmd, __FUNCTION__, __LINE__); \
149 } while (0)
150
151void __netmap_mem_get(struct netmap_mem_d *, const char *, int);
152void __netmap_mem_put(struct netmap_mem_d *, const char *, int);
153#else /* !NM_DEBUG_MEM_PUTGET */
154
155void netmap_mem_get(struct netmap_mem_d *);
156void netmap_mem_put(struct netmap_mem_d *);
157
158#endif /* !NM_DEBUG_PUTGET */
159
139#define NETMAP_MEM_PRIVATE 0x2 /* allocator uses private address space */
140#define NETMAP_MEM_IO 0x4 /* the underlying memory is mmapped I/O */
141
142uint32_t netmap_extra_alloc(struct netmap_adapter *, uint32_t *, uint32_t n);
143
160#define NETMAP_MEM_PRIVATE 0x2 /* allocator uses private address space */
161#define NETMAP_MEM_IO 0x4 /* the underlying memory is mmapped I/O */
162
163uint32_t netmap_extra_alloc(struct netmap_adapter *, uint32_t *, uint32_t n);
164
144
145#endif
165#endif