sunvnet: Use one Tx queue per vnet_port
[deliverable/linux.git] / drivers / net / ethernet / sun / sunvnet.h
CommitLineData
4c521e42
DM
1#ifndef _SUNVNET_H
2#define _SUNVNET_H
3
1d311ad2
SV
4#include <linux/interrupt.h>
5
4c521e42
DM
6#define DESC_NCOOKIES(entry_size) \
7 ((entry_size) - sizeof(struct vio_net_desc))
8
9/* length of time before we decide the hardware is borked,
10 * and dev->tx_timeout() should be called to fix the problem
11 */
12#define VNET_TX_TIMEOUT (5 * HZ)
13
8e845f4c
DS
14/* length of time (or less) we expect pending descriptors to be marked
15 * as VIO_DESC_DONE and skbs ready to be freed
16 */
17#define VNET_CLEAN_TIMEOUT ((HZ/100)+1)
18
42db672d 19#define VNET_MAXPACKET (65535ULL + ETH_HLEN + VLAN_HLEN)
4c521e42
DM
20#define VNET_TX_RING_SIZE 512
21#define VNET_TX_WAKEUP_THRESH(dr) ((dr)->pending / 4)
22
23/* VNET packets are sent in buffers with the first 6 bytes skipped
24 * so that after the ethernet header the IPv4/IPv6 headers are aligned
25 * properly.
26 */
27#define VNET_PACKET_SKIP 6
28
42db672d
DS
29#define VNET_MAXCOOKIES (VNET_MAXPACKET/PAGE_SIZE + 1)
30
4c521e42 31struct vnet_tx_entry {
8e845f4c 32 struct sk_buff *skb;
4c521e42 33 unsigned int ncookies;
42db672d 34 struct ldc_trans_cookie cookies[VNET_MAXCOOKIES];
4c521e42
DM
35};
36
37struct vnet;
38struct vnet_port {
39 struct vio_driver_state vio;
40
41 struct hlist_node hash;
42 u8 raddr[ETH_ALEN];
028ebff2
DM
43 u8 switch_port;
44 u8 __pad;
4c521e42
DM
45
46 struct vnet *vp;
47
48 struct vnet_tx_entry tx_bufs[VNET_TX_RING_SIZE];
49
50 struct list_head list;
d1015645
SV
51
52 u32 stop_rx_idx;
53 bool stop_rx;
54 bool start_cons;
e4defc77 55
8e845f4c
DS
56 struct timer_list clean_timer;
57
e4defc77 58 u64 rmtu;
69088822
SV
59
60 struct napi_struct napi;
61 u32 napi_stop_idx;
62 bool napi_resume;
63 int rx_event;
d51bffd1 64 u16 q_index;
4c521e42
DM
65};
66
67static inline struct vnet_port *to_vnet_port(struct vio_driver_state *vio)
68{
69 return container_of(vio, struct vnet_port, vio);
70}
71
72#define VNET_PORT_HASH_SIZE 16
73#define VNET_PORT_HASH_MASK (VNET_PORT_HASH_SIZE - 1)
74
75static inline unsigned int vnet_hashfn(u8 *mac)
76{
77 unsigned int val = mac[4] ^ mac[5];
78
79 return val & (VNET_PORT_HASH_MASK);
80}
81
028ebff2
DM
82struct vnet_mcast_entry {
83 u8 addr[ETH_ALEN];
84 u8 sent;
85 u8 hit;
86 struct vnet_mcast_entry *next;
87};
88
4c521e42
DM
89struct vnet {
90 /* Protects port_list and port_hash. */
91 spinlock_t lock;
92
93 struct net_device *dev;
94
95 u32 msg_enable;
4c521e42
DM
96
97 struct list_head port_list;
98
99 struct hlist_head port_hash[VNET_PORT_HASH_SIZE];
9184a046 100
028ebff2
DM
101 struct vnet_mcast_entry *mcast_list;
102
9184a046
DM
103 struct list_head list;
104 u64 local_mac;
1d311ad2 105
d51bffd1 106 int nports;
4c521e42
DM
107};
108
109#endif /* _SUNVNET_H */
This page took 0.744153 seconds and 5 git commands to generate.