New upstream version 18.02
[deb_dpdk.git] / examples / netmap_compat / lib / compat_netmap.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2014 Intel Corporation
3  */
4
5 #ifndef _RTE_COMPAT_NETMAP_H_
6
7 #include <poll.h>
8 #include <linux/ioctl.h>
9 #include <net/if.h>
10
11 #include <rte_ethdev.h>
12 #include <rte_mempool.h>
13
14 #include "netmap.h"
15 #include "netmap_user.h"
16
17 /**
18  * One can overwrite Netmap macros here as needed
19  */
20
21 struct rte_netmap_conf {
22         int32_t  socket_id;
23         uint32_t max_rings; /* number of rings(queues) per netmap_if(port) */
24         uint32_t max_slots; /* number of slots(descriptors) per netmap ring. */
25         uint16_t max_bufsz; /* size of each netmap buffer. */
26 };
27
28 struct rte_netmap_port_conf {
29         struct rte_eth_conf   *eth_conf;
30         struct rte_mempool    *pool;
31         int32_t socket_id;
32         uint16_t nr_tx_rings;
33         uint16_t nr_rx_rings;
34         uint32_t nr_tx_slots;
35         uint32_t nr_rx_slots;
36         uint16_t tx_burst;
37         uint16_t rx_burst;
38 };
39
40 int rte_netmap_init(const struct rte_netmap_conf *conf);
41 int rte_netmap_init_port(uint16_t portid,
42         const struct rte_netmap_port_conf *conf);
43
44 int rte_netmap_close(int fd);
45 int rte_netmap_ioctl(int fd, uint32_t op, void *param);
46 int rte_netmap_open(const char *pathname, int flags);
47 int rte_netmap_poll(struct pollfd *fds, nfds_t nfds, int timeout);
48 void *rte_netmap_mmap(void *addr, size_t length, int prot, int flags, int fd,
49                           off_t offset);
50
51 #endif /* _RTE_COMPAT_NETMAP_H_ */