Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sunvnet.h
Go to the documentation of this file.
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 
21 struct vnet_tx_entry {
22  void *buf;
23  unsigned int ncookies;
25 };
26 
27 struct vnet;
28 struct vnet_port {
30 
31  struct hlist_node hash;
35 
36  struct vnet *vp;
37 
39 
40  struct list_head list;
41 };
42 
43 static 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 
51 static 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 
63 };
64 
65 struct vnet {
66  /* Protects port_list and port_hash. */
68 
69  struct net_device *dev;
70 
72 
74 
76 
78 
79  struct list_head list;
81 };
82 
83 #endif /* _SUNVNET_H */