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 1518ULL /* ETH_FRAMELEN + VLAN_HDR */
20 #define VNET_TX_RING_SIZE 512
21 #define VNET_TX_WAKEUP_THRESH(dr) ((dr)->pending / 4)
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
27 #define VNET_PACKET_SKIP 6
29 struct vnet_tx_entry {
31 unsigned int ncookies;
32 struct ldc_trans_cookie cookies[2];
37 struct vio_driver_state vio;
39 struct hlist_node hash;
46 struct vnet_tx_entry tx_bufs[VNET_TX_RING_SIZE];
48 struct list_head list;
54 struct timer_list clean_timer;
59 static inline struct vnet_port *to_vnet_port(struct vio_driver_state *vio)
61 return container_of(vio, struct vnet_port, vio);
64 #define VNET_PORT_HASH_SIZE 16
65 #define VNET_PORT_HASH_MASK (VNET_PORT_HASH_SIZE - 1)
67 static inline unsigned int vnet_hashfn(u8 *mac)
69 unsigned int val = mac[4] ^ mac[5];
71 return val & (VNET_PORT_HASH_MASK);
74 struct vnet_mcast_entry {
78 struct vnet_mcast_entry *next;
82 /* Protects port_list and port_hash. */
85 struct net_device *dev;
89 struct list_head port_list;
91 struct hlist_head port_hash[VNET_PORT_HASH_SIZE];
93 struct vnet_mcast_entry *mcast_list;
95 struct list_head list;
98 struct tasklet_struct vnet_tx_wakeup;
101 #endif /* _SUNVNET_H */