4 #define DESC_NCOOKIES(entry_size) \
5 ((entry_size) - sizeof(struct vio_net_desc))
7 /* length of time before we decide the hardware is borked,
8 * and dev->tx_timeout() should be called to fix the problem
10 #define VNET_TX_TIMEOUT (5 * HZ)
12 #define VNET_TX_RING_SIZE 512
13 #define VNET_TX_WAKEUP_THRESH(dr) ((dr)->pending / 4)
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
19 #define VNET_PACKET_SKIP 6
21 struct vnet_tx_entry
{
23 unsigned int ncookies
;
24 struct ldc_trans_cookie cookies
[2];
29 struct vio_driver_state vio
;
31 struct hlist_node hash
;
36 struct vnet_tx_entry tx_bufs
[VNET_TX_RING_SIZE
];
38 struct list_head list
;
41 static inline struct vnet_port
*to_vnet_port(struct vio_driver_state
*vio
)
43 return container_of(vio
, struct vnet_port
, vio
);
46 #define VNET_PORT_HASH_SIZE 16
47 #define VNET_PORT_HASH_MASK (VNET_PORT_HASH_SIZE - 1)
49 static inline unsigned int vnet_hashfn(u8
*mac
)
51 unsigned int val
= mac
[4] ^ mac
[5];
53 return val
& (VNET_PORT_HASH_MASK
);
57 /* Protects port_list and port_hash. */
60 struct net_device
*dev
;
65 struct list_head port_list
;
67 struct hlist_head port_hash
[VNET_PORT_HASH_SIZE
];
70 #endif /* _SUNVNET_H */