39 #ifndef _NET_NETMAP_H_ 40 #define _NET_NETMAP_H_ 44 #define NETMAP_MIN_API 11 45 #define NETMAP_MAX_API 15 52 #define NM_CACHE_ALIGN 128 156 #define NS_BUF_CHANGED 0x0001 167 #define NS_REPORT 0x0002 175 #define NS_FORWARD 0x0004 184 #define NS_NO_LEARN 0x0008 190 #define NS_INDIRECT 0x0010 196 #define NS_MOREFRAG 0x0020 203 #define NS_PORT_SHIFT 8 204 #define NS_PORT_MASK (0xff << NS_PORT_SHIFT) 211 #define NS_RFRAGS(_slot) ( ((_slot)->flags >> 8) & 0xff) 280 #if !defined(_WIN32) || defined(__CYGWIN__) 294 #define NR_TIMESTAMP 0x0002 301 #define NR_FORWARD 0x0004 319 char ni_name[IFNAMSIZ];
322 #define NI_PRIV_MEM 0x1 335 uint32_t ni_spare1[5];
345 const ssize_t ring_ofs[0];
475 char nr_name[IFNAMSIZ];
485 #define NETMAP_HW_RING 0x4000 486 #define NETMAP_SW_RING 0x2000 488 #define NETMAP_RING_MASK 0x0fff 490 #define NETMAP_NO_TX_POLL 0x1000 492 #define NETMAP_DO_RX_POLL 0x8000 495 #define NETMAP_BDG_ATTACH 1 496 #define NETMAP_BDG_DETACH 2 497 #define NETMAP_BDG_REGOPS 3 498 #define NETMAP_BDG_LIST 4 499 #define NETMAP_BDG_VNET_HDR 5 500 #define NETMAP_BDG_OFFSET NETMAP_BDG_VNET_HDR 501 #define NETMAP_BDG_NEWIF 6 502 #define NETMAP_BDG_DELIF 7 503 #define NETMAP_PT_HOST_CREATE 8 504 #define NETMAP_PT_HOST_DELETE 9 505 #define NETMAP_BDG_POLLING_ON 10 506 #define NETMAP_BDG_POLLING_OFF 11 507 #define NETMAP_VNET_HDR_GET 12 509 #define NETMAP_BDG_HOST 1 518 #define NR_REG_MASK 0xf 528 #define NR_MONITOR_TX 0x100 529 #define NR_MONITOR_RX 0x200 530 #define NR_ZCOPY_MON 0x400 532 #define NR_EXCLUSIVE 0x800 534 #define NR_PASSTHROUGH_HOST NR_PTNETMAP_HOST 535 #define NR_PTNETMAP_HOST 0x1000 536 #define NR_RX_RINGS_ONLY 0x2000 537 #define NR_TX_RINGS_ONLY 0x4000 543 #define NR_ACCEPT_VNET_HDR 0x8000 553 #undef _IO // ws2def.h 554 #define _WIN_NM_IOCTL_TYPE 40000 555 #define _IO(_c, _n) CTL_CODE(_WIN_NM_IOCTL_TYPE, ((_n) + 0x800) , \ 556 METHOD_BUFFERED, FILE_ANY_ACCESS ) 557 #define _IO_direct(_c, _n) CTL_CODE(_WIN_NM_IOCTL_TYPE, ((_n) + 0x800) , \ 558 METHOD_OUT_DIRECT, FILE_ANY_ACCESS ) 560 #define _IOWR(_c, _n, _s) _IO(_c, _n) 563 #define NETMAP_MMAP _IO_direct('i', 160) // note METHOD_OUT_DIRECT 564 #define NETMAP_POLL _IO('i', 162) 567 #define NETMAP_SETSOCKOPT _IO('i', 140) 568 #define NETMAP_GETSOCKOPT _IO('i', 141) 572 #define NETMAP_NT_DEVICE_NAME L"\\Device\\NETMAP" 573 #define NETMAP_DOS_DEVICE_NAME L"\\DosDevices\\netmap" 576 typedef struct _MEMORY_ENTRY {
577 PVOID pUsermodeVirtualAddress;
578 } MEMORY_ENTRY, *PMEMORY_ENTRY;
580 typedef struct _POLL_REQUEST_DATA {
594 #define NIOCGINFO _IOWR('i', 145, struct nmreq) 595 #define NIOCREGIF _IOWR('i', 146, struct nmreq) 596 #define NIOCTXSYNC _IO('i', 148) 597 #define NIOCRXSYNC _IO('i', 149) 598 #define NIOCCONFIG _IOWR('i',150, struct nm_ifreq) 612 return (ring->
cur == ring->
tail);
620 #define NM_IFRDATA_LEN 256 622 char nifr_name[IFNAMSIZ];
static int nm_ring_empty(struct netmap_ring *ring)
const uint32_t ni_tx_rings
const uint32_t ni_rx_rings
const uint32_t ni_version
const uint32_t nr_buf_size