summaryrefslogtreecommitdiff
path: root/accel-dp/dev.h
blob: 1039a17b17dc27806c20d1de9cf52a301d7a5334 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef __NET_DEVICE_H
#define __NET_DEVICE_H

#ifndef IFNAMSIZ
#define IFNAMSIZ 16
#endif

struct rte_mbuf;

struct net_device {
	char name[IFNAMSIZ];
	int index;

	unsigned char hwaddr[6];

	int refs;

	void (*xmit)(struct rte_mbuf *mbuf, struct net_device *dev);
	void (*destructor)(struct net_device *dev);
};

struct net_device *netdev_get_by_index(int id);
void netdev_put(struct net_device *dev);
void netdev_free(struct net_device *dev);
struct net_device *netdev_alloc(const char *name, int priv_size, void (*setup)(struct net_device *dev));
void netdev_unregister(struct net_device *dev);

static inline void *netdev_priv(struct net_device *dev)
{
	return dev + 1;
}

#endif