direct-io.hg

view linux-2.6-xen-sparse/drivers/xen/netback/common.h @ 8443:ebe84a7f2a8b

Missing file from previous changeset.
author kaf24@firebug.cl.cam.ac.uk
date Wed Dec 28 15:07:16 2005 +0100 (2005-12-28)
parents 2cc09c21cdba
children 927cd2e4f150
line source
1 /******************************************************************************
2 * arch/xen/drivers/netif/backend/common.h
3 */
5 #ifndef __NETIF__BACKEND__COMMON_H__
6 #define __NETIF__BACKEND__COMMON_H__
8 #include <linux/config.h>
9 #include <linux/version.h>
10 #include <linux/module.h>
11 #include <linux/interrupt.h>
12 #include <linux/slab.h>
13 #include <linux/ip.h>
14 #include <linux/in.h>
15 #include <linux/netdevice.h>
16 #include <linux/etherdevice.h>
17 #include <asm-xen/evtchn.h>
18 #include <asm-xen/xen-public/io/netif.h>
19 #include <asm/io.h>
20 #include <asm/pgalloc.h>
21 #include <asm-xen/xen-public/grant_table.h>
22 #include <asm-xen/gnttab.h>
23 #include <asm-xen/driver_util.h>
25 #if 0
26 #define ASSERT(_p) \
27 if ( !(_p) ) { printk("Assertion '%s' failed, line %d, file %s", #_p , \
28 __LINE__, __FILE__); *(int*)0=0; }
29 #define DPRINTK(_f, _a...) printk(KERN_ALERT "(file=%s, line=%d) " _f, \
30 __FILE__ , __LINE__ , ## _a )
31 #else
32 #define ASSERT(_p) ((void)0)
33 #define DPRINTK(_f, _a...) ((void)0)
34 #endif
35 #define IPRINTK(fmt, args...) \
36 printk(KERN_INFO "xen_net: " fmt, ##args)
37 #define WPRINTK(fmt, args...) \
38 printk(KERN_WARNING "xen_net: " fmt, ##args)
40 typedef struct netif_st {
41 /* Unique identifier for this interface. */
42 domid_t domid;
43 unsigned int handle;
45 u8 fe_dev_addr[6];
47 /* Physical parameters of the comms window. */
48 grant_handle_t tx_shmem_handle;
49 grant_ref_t tx_shmem_ref;
50 grant_handle_t rx_shmem_handle;
51 grant_ref_t rx_shmem_ref;
52 unsigned int evtchn;
53 unsigned int irq;
55 /* The shared rings and indexes. */
56 netif_tx_back_ring_t tx;
57 netif_rx_back_ring_t rx;
58 struct vm_struct *tx_comms_area;
59 struct vm_struct *rx_comms_area;
61 /* Allow netif_be_start_xmit() to peek ahead in the rx request ring. */
62 RING_IDX rx_req_cons_peek;
64 /* Transmit shaping: allow 'credit_bytes' every 'credit_usec'. */
65 unsigned long credit_bytes;
66 unsigned long credit_usec;
67 unsigned long remaining_credit;
68 struct timer_list credit_timeout;
70 /* Miscellaneous private stuff. */
71 enum { DISCONNECTED, DISCONNECTING, CONNECTED } status;
72 int active;
73 struct list_head list; /* scheduling list */
74 atomic_t refcnt;
75 struct net_device *dev;
76 struct net_device_stats stats;
78 struct work_struct free_work;
79 } netif_t;
81 #define NET_TX_RING_SIZE __RING_SIZE((netif_tx_sring_t *)0, PAGE_SIZE)
82 #define NET_RX_RING_SIZE __RING_SIZE((netif_rx_sring_t *)0, PAGE_SIZE)
84 void netif_creditlimit(netif_t *netif);
85 void netif_disconnect(netif_t *netif);
87 netif_t *alloc_netif(domid_t domid, unsigned int handle, u8 be_mac[ETH_ALEN]);
88 void free_netif(netif_t *netif);
89 int netif_map(netif_t *netif, unsigned long tx_ring_ref,
90 unsigned long rx_ring_ref, unsigned int evtchn);
92 #define netif_get(_b) (atomic_inc(&(_b)->refcnt))
93 #define netif_put(_b) \
94 do { \
95 if ( atomic_dec_and_test(&(_b)->refcnt) ) \
96 free_netif(_b); \
97 } while (0)
99 void netif_xenbus_init(void);
101 void netif_schedule_work(netif_t *netif);
102 void netif_deschedule_work(netif_t *netif);
104 int netif_be_start_xmit(struct sk_buff *skb, struct net_device *dev);
105 struct net_device_stats *netif_be_get_stats(struct net_device *dev);
106 irqreturn_t netif_be_int(int irq, void *dev_id, struct pt_regs *regs);
108 #endif /* __NETIF__BACKEND__COMMON_H__ */
110 /*
111 * Local variables:
112 * c-file-style: "linux"
113 * indent-tabs-mode: t
114 * c-indent-level: 8
115 * c-basic-offset: 8
116 * tab-width: 8
117 * End:
118 */