debuggers.hg

view linux-2.6.10-xen-sparse/drivers/xen/netback/common.h @ 3639:ef59b38283a5

bitkeeper revision 1.1159.212.64 (42000361XrdUoEK_vD6RMga2eLmwZg)

Allow specification of backend vif MAC addresses. If a backend
MAC is not provided, generate one as before

Signed-off-by: Jody Belka <knew-xen@pimb.org>
Signed-off-by: ian.pratt@cl.cam.ac.uk
author iap10@labyrinth.cl.cam.ac.uk
date Tue Feb 01 22:32:01 2005 +0000 (2005-02-01)
parents 2abc9e0c7f87
children bbe8541361dd
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 u8 fe_dev_addr[6];
40 /* Physical parameters of the comms window. */
41 unsigned long tx_shmem_frame;
42 unsigned long rx_shmem_frame;
43 unsigned int evtchn;
44 int irq;
46 /* The shared rings and indexes. */
47 netif_tx_interface_t *tx;
48 netif_rx_interface_t *rx;
50 /* Private indexes into shared ring. */
51 NETIF_RING_IDX rx_req_cons;
52 NETIF_RING_IDX rx_resp_prod; /* private version of shared variable */
53 NETIF_RING_IDX tx_req_cons;
54 NETIF_RING_IDX tx_resp_prod; /* private version of shared variable */
56 /* Transmit shaping: allow 'credit_bytes' every 'credit_usec'. */
57 unsigned long credit_bytes;
58 unsigned long credit_usec;
59 unsigned long remaining_credit;
60 struct timer_list credit_timeout;
62 /* Miscellaneous private stuff. */
63 enum { DISCONNECTED, DISCONNECTING, CONNECTED } status;
64 int active;
65 /*
66 * DISCONNECT response is deferred until pending requests are ack'ed.
67 * We therefore need to store the id from the original request.
68 */
69 u8 disconnect_rspid;
70 struct netif_st *hash_next;
71 struct list_head list; /* scheduling list */
72 atomic_t refcnt;
73 struct net_device *dev;
74 struct net_device_stats stats;
76 struct work_struct work;
77 } netif_t;
79 void netif_create(netif_be_create_t *create);
80 void netif_destroy(netif_be_destroy_t *destroy);
81 void netif_connect(netif_be_connect_t *connect);
82 int netif_disconnect(netif_be_disconnect_t *disconnect, u8 rsp_id);
83 void netif_disconnect_complete(netif_t *netif);
84 netif_t *netif_find_by_handle(domid_t domid, unsigned int handle);
85 #define netif_get(_b) (atomic_inc(&(_b)->refcnt))
86 #define netif_put(_b) \
87 do { \
88 if ( atomic_dec_and_test(&(_b)->refcnt) ) \
89 netif_disconnect_complete(_b); \
90 } while (0)
92 void netif_interface_init(void);
93 void netif_ctrlif_init(void);
95 void netif_schedule_work(netif_t *netif);
96 void netif_deschedule_work(netif_t *netif);
98 int netif_be_start_xmit(struct sk_buff *skb, struct net_device *dev);
99 struct net_device_stats *netif_be_get_stats(struct net_device *dev);
100 irqreturn_t netif_be_int(int irq, void *dev_id, struct pt_regs *regs);
102 #endif /* __NETIF__BACKEND__COMMON_H__ */