1 #ifndef __DPDK_IFACE_COMMON_H__
2 #define __DPDK_IFACE_COMMON_H__
3 /*--------------------------------------------------------------------------*/
4 /* for ETH_ALEN */
5 #ifndef __KERNEL__
6 #include <net/if.h>
7 #endif
8 #include <asm/bitsperlong.h>
9 /*--------------------------------------------------------------------------*/
10 /* dev name */
11 #define DEV_NAME		"dpdk-iface"
12 #define DEV_PATH		"/dev/"DEV_NAME
13 #define DEV_PROC_PATH		"/proc/devices"
14 /* ioctl# */
15 #define SEND_STATS		 0
16 #define CREATE_IFACE		 1
17 #define CLEAR_IFACE		 4
18 #define FETCH_PCI_ADDRESS	 5
19 /* max qid */
20 #define MAX_QID			128
21 #ifndef MAX_DEVICES
22 #define MAX_DEVICES		128
23 #endif
24 #define PCI_DOM			"%04hX"
25 #define PCI_BUS			"%02hhX"
26 #define PCI_DEVICE		"%02hhX"
27 #define PCI_FUNC		"%01hhX"
28 #define PCI_LENGTH		13
29 /*--------------------------------------------------------------------------*/
30 typedef struct PciAddress {
31 	uint16_t domain;
32 	uint8_t bus;
33 	uint8_t device;
34 	uint8_t function;
35 } PciAddress;
36 /*--------------------------------------------------------------------------*/
37 typedef struct PciDevice {
38 	union {
39 		uint8_t *ports_eth_addr;
40 		char ifname[IFNAMSIZ];
41 	};
42 	PciAddress pa;
43 	int numa_socket;
44 } PciDevice __attribute__((aligned(__BITS_PER_LONG)));
45 /*--------------------------------------------------------------------------*/
46 #endif /* __DPDK_IFACE_COMMON_H__ */
47