aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sunvnet.h
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2007-07-10 01:23:51 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-07-16 07:03:23 -0400
commit4c521e422f2837b9652fa00a064a01d009f939b6 (patch)
treec9e9031fd2216cce89afe01840841fca0718f61f /drivers/net/sunvnet.h
parente53e97ce3c7119199d2788d8fd1618efa9c2d1eb (diff)
[SPARC64]: Add Sun LDOM virtual network driver.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sunvnet.h')
-rw-r--r--drivers/net/sunvnet.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/drivers/net/sunvnet.h b/drivers/net/sunvnet.h
new file mode 100644
index 000000000000..1c887302d46d
--- /dev/null
+++ b/drivers/net/sunvnet.h
@@ -0,0 +1,70 @@
1#ifndef _SUNVNET_H
2#define _SUNVNET_H
3
4#define DESC_NCOOKIES(entry_size) \
5 ((entry_size) - sizeof(struct vio_net_desc))
6
7/* length of time before we decide the hardware is borked,
8 * and dev->tx_timeout() should be called to fix the problem
9 */
10#define VNET_TX_TIMEOUT (5 * HZ)
11
12#define VNET_TX_RING_SIZE 512
13#define VNET_TX_WAKEUP_THRESH(dr) ((dr)->pending / 4)
14
15/* VNET packets are sent in buffers with the first 6 bytes skipped
16 * so that after the ethernet header the IPv4/IPv6 headers are aligned
17 * properly.
18 */
19#define VNET_PACKET_SKIP 6
20
21struct vnet_tx_entry {
22 void *buf;
23 unsigned int ncookies;
24 struct ldc_trans_cookie cookies[2];
25};
26
27struct vnet;
28struct vnet_port {
29 struct vio_driver_state vio;
30
31 struct hlist_node hash;
32 u8 raddr[ETH_ALEN];
33
34 struct vnet *vp;
35
36 struct vnet_tx_entry tx_bufs[VNET_TX_RING_SIZE];
37
38 struct list_head list;
39};
40
41static inline struct vnet_port *to_vnet_port(struct vio_driver_state *vio)
42{
43 return container_of(vio, struct vnet_port, vio);
44}
45
46#define VNET_PORT_HASH_SIZE 16
47#define VNET_PORT_HASH_MASK (VNET_PORT_HASH_SIZE - 1)
48
49static inline unsigned int vnet_hashfn(u8 *mac)
50{
51 unsigned int val = mac[4] ^ mac[5];
52
53 return val & (VNET_PORT_HASH_MASK);
54}
55
56struct vnet {
57 /* Protects port_list and port_hash. */
58 spinlock_t lock;
59
60 struct net_device *dev;
61
62 u32 msg_enable;
63 struct vio_dev *vdev;
64
65 struct list_head port_list;
66
67 struct hlist_head port_hash[VNET_PORT_HASH_SIZE];
68};
69
70#endif /* _SUNVNET_H */