Lines Matching +full:unlock +full:- +full:keys
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
32 /* if thread-safety is not needed, define LIBNETMAP_NOTHREADSAFE before including
78 * -NN bind individual NIC ring pair
94 * option:key1=value1,key2=value2,... (multi-key option)
96 * For multi-key options, the keys can be assigned in any order, but they
98 * option keys: unmentioned keys will receive default values. Some multi-key
99 * options define a default key and also accept the single-key syntax, by
105 * The currently available options are (default keys, when defined, are marked
108 * share (single-key)
113 * conf (multi-key)
118 * The keys are:
121 * tx-rings number of tx rings
122 * rx-rings number of rx rings
123 * host-rings number of tx and rx host rings
124 * host-tx-rings number of host tx rings
125 * host-rx-rings number of host rx rings
128 * tx-slots number of slots in each tx ring
129 * rx-slots number of slots in each rx ring
131 * (more specific keys override the less specific ones)
132 * All keys default to zero if not assigned, and the
135 * extmem (multi-key)
139 * The keys are:
142 * if-num number of pre-allocated netmap_if's
143 * if-size size of each netmap_if
144 * ring-num number of pre-allocated netmap_ring's
145 * ring-size size of each netmap_ring
146 * buf-num number of pre-allocated buffers
147 * buf-size size of each buffer
149 * file must be assigned. The other keys default to zero,
153 * offset (multi-key)
157 * The keys are:
174 /* struct nmport_d - describes a netmap port */
180 /* all the fields below should be considered read-only */
182 /* if the same context is used throughout the program, d1->mem ==
183 * d2->mem iff d1 and d2 are using the memory region (i.e., zero
197 int fd; /* "/dev/netmap", -1 if not open */
210 /* nmport_open - opens a port from a portspec
228 /* nport_close - close a netmap port
236 /* nmport_inject - sends a packet
244 * Returns 0 on success an -1 on error.
264 /* nmport_new - create a new nmport_d
271 /* nmport_parse - fills the nmport_d netmap-register request
275 * This function parses the portspec and initizalizes the @d->hdr and @d->reg
279 * It returns 0 on success. On failure it returns -1, sets errno to an error
285 /* nmport_register - registers the port with netmap
289 * netmap. The @d->hdr and @d->reg data structures must have been previously
292 * It returns 0 on success. On failure it returns -1, sets errno to an error
298 /* nmport_mmap - maps the port resources into the process memory
306 * It returns 0 on success. On failure it returns -1, sets errno to an error
320 /* nmport_prepare - create a port descriptor, but do not open it
326 * It returns 0 on success. On failure it returns -1, sets errno to an error
332 /* nmport_open_desc - open an initialized port descriptor
339 * It returns 0 on success. On failure it returns -1, sets errno to an error
351 /* nmport_clone - copy an nmport_d
370 /* nmport_extmem - use extmem for this port
385 * It returns 0 on success. On failure it returns -1, sets errno to an error
391 /* nmport_extmem_from_file - use the extmem obtained by mapping a file
398 * It returns 0 on success. On failure it returns -1, sets errno to an error
404 /* nmport_extmem_getinfo - opbtai a pointer to the extmem configuration
416 /* nmport_offset - use offsets for this port
419 * @bits the number of bits of slot->ptr to use for the offsets
427 * ring->offset_mask after a successful register. netmap_user.h contains
442 * ring->buf_align field. It is also possible that empty slots already come
443 * with a non-zero offset o specified in the offset field. In this case, the
465 * nmport_enable_option returns -1 and sets errno to EOPNOTSUPP.
475 * nmreq_header_init - initialize an nmreq_header
490 /* nmreq_header_decode - initialize an nmreq_header
499 * Returns 0 on success. In case of error, -1 is returned with errno set to
501 * is sent through @ctx->error().
506 /* nmreq_regiter_decode - initialize an nmreq_register
521 * Returns 0 on success. In case of error, -1 is returned with errno set to
523 * is sent through @ctx->error().
528 /* nmreq_options_decode - parse the "options" part of the portspec
537 * keys mentioned in the option. It then passes control to the parser, to
538 * interpret the keys values.
540 * Returns 0 on success. In case of error, -1 is returned, errno is set to an
541 * error value and a message is sent to @ctx->error(). The effects of partially
549 /* type of the option-parsers callbacks */
552 #define NMREQ_OPT_MAXKEYS 16 /* max nr of recognized keys per option */
554 /* struct nmreq_opt_key - describes an option key */
564 /* struct nmreq_opt_parser - describes an option parser */
569 parser is multi-key (-1 if none) */
577 /* recognized keys */
578 struct nmreq_opt_key keys[NMREQ_OPT_MAXKEYS]; member
581 /* struct nmreq_parse_ctx - the parse context received by the parse callback */
588 * key id. Unassigned keys are left at NULL.
590 const char *keys[NMREQ_OPT_MAXKEYS]; member
593 /* nmreq_get_mem_id - get the mem_id of the given port
601 * subsystem:vpname part of the input. In case of error it returns -1, sets
602 * errno to an error value and sends an error message to ctx->error().
613 for ((o_) = (struct nmreq_option *)((uintptr_t)((h_)->nr_options));\
615 (o_) = (struct nmreq_option *)((uintptr_t)((o_)->nro_next)))
621 * - maintain a list of all memory regions open by the program, so that two
625 * - allow the user to specify how to lock accesses to the above list, if
628 * - allow the user to specify how error messages should be delivered (error()
631 * - select the verbosity of the library (verbose field); if verbose==0, no
634 * - allow the user to override the malloc/free functions used by the library
653 /* nmctx_get - obtain a pointer to the current default context */
656 /* nmctx_set_default - change the default context
665 /* struct nmem_d - describes a memory region currently used */
690 /* dummy assignment to link-in the nmctx-pthread.o object. The proper in libnetmap_init()
698 /* nmctx_set_threadsafe - install a threadsafe default context
700 * called by the constructor in nmctx-pthread.o to initialize a lock and install
705 /* nmctx_ferror - format and send an error message */
707 /* nmctx_malloc - allocate memory */
709 /* nmctx_free - free memory allocated via nmctx_malloc */
711 /* nmctx_lock - lock the list of nmem_d */
713 /* nmctx_unlock - unlock the list of nmem_d */