netmap.h (257529) | netmap.h (259412) |
---|---|
1/* 2 * Copyright (C) 2011-2013 Matteo Landi, Luigi Rizzo. All rights reserved. | 1/* 2 * Copyright (C) 2011-2013 Matteo Landi, Luigi Rizzo. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are 6 * met: 7 * | 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * |
8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. | 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. |
10 * | |
11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the | 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the |
13 * documentation and/or other materials provided with the 14 * distribution. 15 * 16 * 3. Neither the name of the authors nor the names of their contributors 17 * may be used to endorse or promote products derived from this 18 * software without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY MATTEO LANDI AND CONTRIBUTORS "AS IS" AND | 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``S IS''AND |
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTEO LANDI OR CONTRIBUTORS 24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30 * THE POSSIBILITY OF SUCH DAMAGE. | 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. |
31 */ 32 33/* | 25 */ 26 27/* |
34 * $FreeBSD: head/sys/net/netmap.h 257529 2013-11-01 21:21:14Z luigi $ | 28 * $FreeBSD: head/sys/net/netmap.h 259412 2013-12-15 08:37:24Z luigi $ |
35 * 36 * Definitions of constants and the structures used by the netmap 37 * framework, for the part visible to both kernel and userspace. 38 * Detailed info on netmap is available with "man netmap" or at | 29 * 30 * Definitions of constants and the structures used by the netmap 31 * framework, for the part visible to both kernel and userspace. 32 * Detailed info on netmap is available with "man netmap" or at |
39 * | 33 * |
40 * http://info.iet.unipi.it/~luigi/netmap/ 41 * 42 * This API is also used to communicate with the VALE software switch 43 */ 44 45#ifndef _NET_NETMAP_H_ 46#define _NET_NETMAP_H_ 47 --- 218 unchanged lines hidden (view full) --- 266 * to the tx rings, the next ni_rx_rings+1 refer to the rx rings 267 * (the last entry in each block refers to the host stack rings). 268 * The area is filled up by the kernel on NIOCREGIF, 269 * and then only read by userspace code. 270 */ 271 const ssize_t ring_ofs[0]; 272}; 273 | 34 * http://info.iet.unipi.it/~luigi/netmap/ 35 * 36 * This API is also used to communicate with the VALE software switch 37 */ 38 39#ifndef _NET_NETMAP_H_ 40#define _NET_NETMAP_H_ 41 --- 218 unchanged lines hidden (view full) --- 260 * to the tx rings, the next ni_rx_rings+1 refer to the rx rings 261 * (the last entry in each block refers to the host stack rings). 262 * The area is filled up by the kernel on NIOCREGIF, 263 * and then only read by userspace code. 264 */ 265 const ssize_t ring_ofs[0]; 266}; 267 |
274#ifndef NIOCREGIF | 268#ifndef NIOCREGIF |
275/* 276 * ioctl names and related fields 277 * 278 * NIOCGINFO takes a struct ifreq, the interface name is the input, 279 * the outputs are number of queues and number of descriptor 280 * for each queue (useful to set number of threads etc.). 281 * The info returned is only advisory and may change before 282 * the interface is bound to a file descriptor. --- 18 unchanged lines hidden (view full) --- 301 * a single ring pair. 302 * NETMAP_SW_RING binds only the host tx/rx rings 303 * NETMAP_NO_TX_POLL prevents select()/poll() from pushing 304 * out packets on the tx ring unless POLLOUT is specified. 305 * 306 * NETMAP_PRIV_MEM is a return value used to indicate that 307 * this ring is in a private memory region hence buffer 308 * swapping cannot be used | 269/* 270 * ioctl names and related fields 271 * 272 * NIOCGINFO takes a struct ifreq, the interface name is the input, 273 * the outputs are number of queues and number of descriptor 274 * for each queue (useful to set number of threads etc.). 275 * The info returned is only advisory and may change before 276 * the interface is bound to a file descriptor. --- 18 unchanged lines hidden (view full) --- 295 * a single ring pair. 296 * NETMAP_SW_RING binds only the host tx/rx rings 297 * NETMAP_NO_TX_POLL prevents select()/poll() from pushing 298 * out packets on the tx ring unless POLLOUT is specified. 299 * 300 * NETMAP_PRIV_MEM is a return value used to indicate that 301 * this ring is in a private memory region hence buffer 302 * swapping cannot be used |
309 * | 303 * |
310 * nr_cmd is used to configure NICs attached to a VALE switch, 311 * or to dump the configuration of a VALE switch. | 304 * nr_cmd is used to configure NICs attached to a VALE switch, 305 * or to dump the configuration of a VALE switch. |
312 * | 306 * |
313 * nr_cmd = NETMAP_BDG_ATTACH and nr_name = vale*:ifname 314 * attaches the NIC to the switch, with nr_ringid specifying 315 * which rings to use 316 * 317 * nr_cmd = NETMAP_BDG_DETACH and nr_name = vale*:ifname 318 * disconnects a previously attached NIC 319 * 320 * nr_cmd = NETMAP_BDG_LIST is used to list the configuration --- 24 unchanged lines hidden (view full) --- 345#define NETMAP_SW_RING 0x2000 /* process the sw ring */ 346#define NETMAP_NO_TX_POLL 0x1000 /* no automatic txsync on poll */ 347#define NETMAP_RING_MASK 0xfff /* the ring number */ 348 uint16_t nr_cmd; 349#define NETMAP_BDG_ATTACH 1 /* attach the NIC */ 350#define NETMAP_BDG_DETACH 2 /* detach the NIC */ 351#define NETMAP_BDG_LOOKUP_REG 3 /* register lookup function */ 352#define NETMAP_BDG_LIST 4 /* get bridge's info */ | 307 * nr_cmd = NETMAP_BDG_ATTACH and nr_name = vale*:ifname 308 * attaches the NIC to the switch, with nr_ringid specifying 309 * which rings to use 310 * 311 * nr_cmd = NETMAP_BDG_DETACH and nr_name = vale*:ifname 312 * disconnects a previously attached NIC 313 * 314 * nr_cmd = NETMAP_BDG_LIST is used to list the configuration --- 24 unchanged lines hidden (view full) --- 339#define NETMAP_SW_RING 0x2000 /* process the sw ring */ 340#define NETMAP_NO_TX_POLL 0x1000 /* no automatic txsync on poll */ 341#define NETMAP_RING_MASK 0xfff /* the ring number */ 342 uint16_t nr_cmd; 343#define NETMAP_BDG_ATTACH 1 /* attach the NIC */ 344#define NETMAP_BDG_DETACH 2 /* detach the NIC */ 345#define NETMAP_BDG_LOOKUP_REG 3 /* register lookup function */ 346#define NETMAP_BDG_LIST 4 /* get bridge's info */ |
347#define NETMAP_BDG_OFFSET 5 /* set the port offset */ |
|
353 uint16_t nr_arg1; 354#define NETMAP_BDG_HOST 1 /* attach the host stack on ATTACH */ | 348 uint16_t nr_arg1; 349#define NETMAP_BDG_HOST 1 /* attach the host stack on ATTACH */ |
350#define NETMAP_BDG_MAX_OFFSET 12 |
|
355 uint16_t nr_arg2; 356 uint32_t spare2[3]; 357}; 358 359/* 360 * FreeBSD uses the size value embedded in the _IOWR to determine 361 * how much to copy in/out. So we need it to match the actual 362 * data structure we pass. We put some spares in the structure 363 * to ease compatibility with other versions 364 */ 365#define NIOCGINFO _IOWR('i', 145, struct nmreq) /* return IF info */ 366#define NIOCREGIF _IOWR('i', 146, struct nmreq) /* interface register */ 367#define NIOCUNREGIF _IO('i', 147) /* deprecated. Was interface unregister */ 368#define NIOCTXSYNC _IO('i', 148) /* sync tx queues */ 369#define NIOCRXSYNC _IO('i', 149) /* sync rx queues */ 370#endif /* !NIOCREGIF */ 371 372#endif /* _NET_NETMAP_H_ */ | 351 uint16_t nr_arg2; 352 uint32_t spare2[3]; 353}; 354 355/* 356 * FreeBSD uses the size value embedded in the _IOWR to determine 357 * how much to copy in/out. So we need it to match the actual 358 * data structure we pass. We put some spares in the structure 359 * to ease compatibility with other versions 360 */ 361#define NIOCGINFO _IOWR('i', 145, struct nmreq) /* return IF info */ 362#define NIOCREGIF _IOWR('i', 146, struct nmreq) /* interface register */ 363#define NIOCUNREGIF _IO('i', 147) /* deprecated. Was interface unregister */ 364#define NIOCTXSYNC _IO('i', 148) /* sync tx queues */ 365#define NIOCRXSYNC _IO('i', 149) /* sync rx queues */ 366#endif /* !NIOCREGIF */ 367 368#endif /* _NET_NETMAP_H_ */ |