aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sun/sunvnet.h
diff options
context:
space:
mode:
authorJeff Kirsher <jeffrey.t.kirsher@intel.com>2011-05-13 02:04:46 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2011-08-11 05:33:43 -0400
commite689cf4a042772f727450035b102579b0c01bdc7 (patch)
treef2b17aa21b8358a8f7589fed46fa08688b439464 /drivers/net/ethernet/sun/sunvnet.h
parent8efc91254fda97ee78e2e0b8e016120e664131de (diff)
cassini/niu/sun*: Move the Sun drivers
Moves the Sun drivers into drivers/net/ethernet/sun/ and make the necessary Kconfig and Makefile changes. Oliver Hartkopp <socketcan@hartkopp.net> suggested removing the sun* prefix on the driver names. This type of change I will leave up to the driver maintainers. CC: Sam Creasey <sammy@sammy.net> CC: Adrian Sun <asun@darksunrising.com> CC: Benjamin Herrenscmidt <benh@kernel.crashing.org> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/sun/sunvnet.h')
-rw-r--r--drivers/net/ethernet/sun/sunvnet.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/drivers/net/ethernet/sun/sunvnet.h b/drivers/net/ethernet/sun/sunvnet.h
new file mode 100644
index 000000000000..d347a5bf24b0
--- /dev/null
+++ b/drivers/net/ethernet/sun/sunvnet.h
@@ -0,0 +1,83 @@
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 u8 switch_port;
34 u8 __pad;
35
36 struct vnet *vp;
37
38 struct vnet_tx_entry tx_bufs[VNET_TX_RING_SIZE];
39
40 struct list_head list;
41};
42
43static inline struct vnet_port *to_vnet_port(struct vio_driver_state *vio)
44{
45 return container_of(vio, struct vnet_port, vio);
46}
47
48#define VNET_PORT_HASH_SIZE 16
49#define VNET_PORT_HASH_MASK (VNET_PORT_HASH_SIZE - 1)
50
51static inline unsigned int vnet_hashfn(u8 *mac)
52{
53 unsigned int val = mac[4] ^ mac[5];
54
55 return val & (VNET_PORT_HASH_MASK);
56}
57
58struct vnet_mcast_entry {
59 u8 addr[ETH_ALEN];
60 u8 sent;
61 u8 hit;
62 struct vnet_mcast_entry *next;
63};
64
65struct vnet {
66 /* Protects port_list and port_hash. */
67 spinlock_t lock;
68
69 struct net_device *dev;
70
71 u32 msg_enable;
72
73 struct list_head port_list;
74
75 struct hlist_head port_hash[VNET_PORT_HASH_SIZE];
76
77 struct vnet_mcast_entry *mcast_list;
78
79 struct list_head list;
80 u64 local_mac;
81};
82
83#endif /* _SUNVNET_H */