4 #include <linux/interrupt.h>
6 #define DESC_NCOOKIES(entry_size) \
7 ((entry_size) - sizeof(struct vio_net_desc))
9 /* length of time before we decide the hardware is borked,
10 * and dev->tx_timeout() should be called to fix the problem
12 #define VNET_TX_TIMEOUT (5 * HZ)
14 /* length of time (or less) we expect pending descriptors to be marked
15 * as VIO_DESC_DONE and skbs ready to be freed
17 #define VNET_CLEAN_TIMEOUT ((HZ/100)+1)
19 #define VNET_MAXPACKET (65535ULL + ETH_HLEN + VLAN_HLEN)
20 #define VNET_TX_RING_SIZE 512
21 #define VNET_TX_WAKEUP_THRESH(dr) ((dr)->pending / 4)
23 #define VNET_MINTSO 2048 /* VIO protocol's minimum TSO len */
24 #define VNET_MAXTSO 65535 /* VIO protocol's maximum TSO len */
26 /* VNET packets are sent in buffers with the first 6 bytes skipped
27 * so that after the ethernet header the IPv4/IPv6 headers are aligned
30 #define VNET_PACKET_SKIP 6
32 #define VNET_MAXCOOKIES (VNET_MAXPACKET/PAGE_SIZE + 1)
34 struct vnet_tx_entry {
36 unsigned int ncookies;
37 struct ldc_trans_cookie cookies[VNET_MAXCOOKIES];
42 struct vio_driver_state vio;
44 struct hlist_node hash;
46 unsigned switch_port:1;
52 struct vnet_tx_entry tx_bufs[VNET_TX_RING_SIZE];
54 struct list_head list;
60 struct timer_list clean_timer;
65 struct napi_struct napi;
72 static inline struct vnet_port *to_vnet_port(struct vio_driver_state *vio)
74 return container_of(vio, struct vnet_port, vio);
77 #define VNET_PORT_HASH_SIZE 16
78 #define VNET_PORT_HASH_MASK (VNET_PORT_HASH_SIZE - 1)
80 static inline unsigned int vnet_hashfn(u8 *mac)
82 unsigned int val = mac[4] ^ mac[5];
84 return val & (VNET_PORT_HASH_MASK);
87 struct vnet_mcast_entry {
91 struct vnet_mcast_entry *next;
95 /* Protects port_list and port_hash. */
98 struct net_device *dev;
102 struct list_head port_list;
104 struct hlist_head port_hash[VNET_PORT_HASH_SIZE];
106 struct vnet_mcast_entry *mcast_list;
108 struct list_head list;
114 #endif /* _SUNVNET_H */