direct-io.hg

view linux-2.6.11-xen-sparse/drivers/xen/netback/common.h @ 4959:2c0074c64c33

bitkeeper revision 1.1159.258.134 (428a2efbVjatsyWzpCT8mcdj0YbvXw)

Do not build netfront/netback loopback by default.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue May 17 17:50:51 2005 +0000 (2005-05-17)
parents cff0d3baf599
children db5a30a327e6 0dc3b8b8c298
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/ctrl_if.h>
18 #include <asm-xen/xen-public/io/netif.h>
19 #include <asm/io.h>
20 #include <asm/pgalloc.h>
22 #if 0
23 #define ASSERT(_p) \
24 if ( !(_p) ) { printk("Assertion '%s' failed, line %d, file %s", #_p , \
25 __LINE__, __FILE__); *(int*)0=0; }
26 #define DPRINTK(_f, _a...) printk(KERN_ALERT "(file=%s, line=%d) " _f, \
27 __FILE__ , __LINE__ , ## _a )
28 #else
29 #define ASSERT(_p) ((void)0)
30 #define DPRINTK(_f, _a...) ((void)0)
31 #endif
33 typedef struct netif_st {
34 /* Unique identifier for this interface. */
35 domid_t domid;
36 unsigned int handle;
38 /* Physical parameters of the comms window. */
39 unsigned long tx_shmem_frame;
40 unsigned long rx_shmem_frame;
41 unsigned int evtchn;
42 int irq;
44 /* The shared rings and indexes. */
45 netif_tx_interface_t *tx;
46 netif_rx_interface_t *rx;
48 /* Private indexes into shared ring. */
49 NETIF_RING_IDX rx_req_cons;
50 NETIF_RING_IDX rx_resp_prod; /* private version of shared variable */
51 NETIF_RING_IDX tx_req_cons;
52 NETIF_RING_IDX tx_resp_prod; /* private version of shared variable */
54 /* Transmit shaping: allow 'credit_bytes' every 'credit_usec'. */
55 unsigned long credit_bytes;
56 unsigned long credit_usec;
57 unsigned long remaining_credit;
58 struct timer_list credit_timeout;
60 /* Miscellaneous private stuff. */
61 enum { DISCONNECTED, DISCONNECTING, CONNECTED } status;
62 int active;
63 /*
64 * DISCONNECT response is deferred until pending requests are ack'ed.
65 * We therefore need to store the id from the original request.
66 */
67 u8 disconnect_rspid;
68 struct netif_st *hash_next;
69 struct list_head list; /* scheduling list */
70 atomic_t refcnt;
71 struct net_device *dev;
72 struct net_device_stats stats;
74 struct work_struct work;
75 } netif_t;
77 void netif_create(netif_be_create_t *create);
78 void netif_destroy(netif_be_destroy_t *destroy);
79 void netif_connect(netif_be_connect_t *connect);
80 int netif_disconnect(netif_be_disconnect_t *disconnect, u8 rsp_id);
81 void netif_disconnect_complete(netif_t *netif);
82 netif_t *netif_find_by_handle(domid_t domid, unsigned int handle);
83 #define netif_get(_b) (atomic_inc(&(_b)->refcnt))
84 #define netif_put(_b) \
85 do { \
86 if ( atomic_dec_and_test(&(_b)->refcnt) ) \
87 netif_disconnect_complete(_b); \
88 } while (0)
90 void netif_interface_init(void);
91 void netif_ctrlif_init(void);
93 void netif_schedule_work(netif_t *netif);
94 void netif_deschedule_work(netif_t *netif);
96 int netif_be_start_xmit(struct sk_buff *skb, struct net_device *dev);
97 struct net_device_stats *netif_be_get_stats(struct net_device *dev);
98 irqreturn_t netif_be_int(int irq, void *dev_id, struct pt_regs *regs);
100 #endif /* __NETIF__BACKEND__COMMON_H__ */