ia64/xen-unstable

view linux-2.6-xen-sparse/drivers/xen/netback/common.h @ 10040:91c77df11b43

When we copy packet sin netback/netfront make sure the new skb has
all the necessary fields initialised. In particular, before we were
not copying ip_summed and that screws up checksum offload.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed May 10 17:30:42 2006 +0100 (2006-05-10)
parents 019411cc3ae5
children 48c0f5489d44
line source
1 /******************************************************************************
2 * arch/xen/drivers/netif/backend/common.h
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License version 2
6 * as published by the Free Software Foundation; or, when distributed
7 * separately from the Linux kernel or incorporated into other
8 * software packages, subject to the following license:
9 *
10 * Permission is hereby granted, free of charge, to any person obtaining a copy
11 * of this source file (the "Software"), to deal in the Software without
12 * restriction, including without limitation the rights to use, copy, modify,
13 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
14 * and to permit persons to whom the Software is furnished to do so, subject to
15 * the following conditions:
16 *
17 * The above copyright notice and this permission notice shall be included in
18 * all copies or substantial portions of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
26 * IN THE SOFTWARE.
27 */
29 #ifndef __NETIF__BACKEND__COMMON_H__
30 #define __NETIF__BACKEND__COMMON_H__
32 #include <linux/config.h>
33 #include <linux/version.h>
34 #include <linux/module.h>
35 #include <linux/interrupt.h>
36 #include <linux/slab.h>
37 #include <linux/ip.h>
38 #include <linux/in.h>
39 #include <linux/netdevice.h>
40 #include <linux/etherdevice.h>
41 #include <linux/wait.h>
42 #include <xen/evtchn.h>
43 #include <xen/interface/io/netif.h>
44 #include <asm/io.h>
45 #include <asm/pgalloc.h>
46 #include <xen/interface/grant_table.h>
47 #include <xen/gnttab.h>
48 #include <xen/driver_util.h>
50 #define DPRINTK(_f, _a...) pr_debug("(file=%s, line=%d) " _f, \
51 __FILE__ , __LINE__ , ## _a )
52 #define IPRINTK(fmt, args...) \
53 printk(KERN_INFO "xen_net: " fmt, ##args)
54 #define WPRINTK(fmt, args...) \
55 printk(KERN_WARNING "xen_net: " fmt, ##args)
57 typedef struct netif_st {
58 /* Unique identifier for this interface. */
59 domid_t domid;
60 unsigned int handle;
62 u8 fe_dev_addr[6];
64 /* Physical parameters of the comms window. */
65 grant_handle_t tx_shmem_handle;
66 grant_ref_t tx_shmem_ref;
67 grant_handle_t rx_shmem_handle;
68 grant_ref_t rx_shmem_ref;
69 unsigned int evtchn;
70 unsigned int irq;
72 /* The shared rings and indexes. */
73 netif_tx_back_ring_t tx;
74 netif_rx_back_ring_t rx;
75 struct vm_struct *tx_comms_area;
76 struct vm_struct *rx_comms_area;
78 /* Allow netif_be_start_xmit() to peek ahead in the rx request ring. */
79 RING_IDX rx_req_cons_peek;
81 /* Transmit shaping: allow 'credit_bytes' every 'credit_usec'. */
82 unsigned long credit_bytes;
83 unsigned long credit_usec;
84 unsigned long remaining_credit;
85 struct timer_list credit_timeout;
87 /* Miscellaneous private stuff. */
88 enum { DISCONNECTED, DISCONNECTING, CONNECTED } status;
89 int active;
90 struct list_head list; /* scheduling list */
91 atomic_t refcnt;
92 struct net_device *dev;
93 struct net_device_stats stats;
95 wait_queue_head_t waiting_to_free;
96 } netif_t;
98 #define NET_TX_RING_SIZE __RING_SIZE((netif_tx_sring_t *)0, PAGE_SIZE)
99 #define NET_RX_RING_SIZE __RING_SIZE((netif_rx_sring_t *)0, PAGE_SIZE)
101 void netif_disconnect(netif_t *netif);
103 netif_t *netif_alloc(domid_t domid, unsigned int handle, u8 be_mac[ETH_ALEN]);
104 int netif_map(netif_t *netif, unsigned long tx_ring_ref,
105 unsigned long rx_ring_ref, unsigned int evtchn);
107 #define netif_get(_b) (atomic_inc(&(_b)->refcnt))
108 #define netif_put(_b) \
109 do { \
110 if ( atomic_dec_and_test(&(_b)->refcnt) ) \
111 wake_up(&(_b)->waiting_to_free); \
112 } while (0)
114 void netif_xenbus_init(void);
116 void netif_schedule_work(netif_t *netif);
117 void netif_deschedule_work(netif_t *netif);
119 int netif_be_start_xmit(struct sk_buff *skb, struct net_device *dev);
120 struct net_device_stats *netif_be_get_stats(struct net_device *dev);
121 irqreturn_t netif_be_int(int irq, void *dev_id, struct pt_regs *regs);
123 #endif /* __NETIF__BACKEND__COMMON_H__ */
125 /*
126 * Local variables:
127 * c-file-style: "linux"
128 * indent-tabs-mode: t
129 * c-indent-level: 8
130 * c-basic-offset: 8
131 * tab-width: 8
132 * End:
133 */