ia64/xen-unstable

changeset 7019:932aa2b425e8

Netfront/back always use grant tables now. This cleans up a
whole bunch of code.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Sep 22 14:36:20 2005 +0100 (2005-09-22)
parents ecc77b1c8612
children 28db21fb7545
files linux-2.6-xen-sparse/arch/xen/Kconfig linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_32 linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_64 linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_32 linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_64 linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_32 linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_64 linux-2.6-xen-sparse/drivers/xen/netback/common.h linux-2.6-xen-sparse/drivers/xen/netback/netback.c linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c xen/include/public/io/netif.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/Kconfig	Thu Sep 22 14:05:36 2005 +0100
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/Kconfig	Thu Sep 22 14:36:20 2005 +0100
     1.3 @@ -111,13 +111,6 @@ config XEN_NETDEV_FRONTEND
     1.4  	  dedicated device-driver domain, or your master control domain
     1.5  	  (domain 0), then you almost certainly want to say Y here.
     1.6  
     1.7 -config XEN_NETDEV_GRANT
     1.8 -        bool "Grant table substrate for network drivers (DANGEROUS)"
     1.9 -        default n
    1.10 -        help
    1.11 -          This introduces the use of grant tables as a data exhange mechanism
    1.12 -          between the frontend and backend network drivers.
    1.13 -
    1.14  config XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER
    1.15  	bool "Pipelined transmitter (DANGEROUS)"
    1.16  	depends on XEN_NETDEV_FRONTEND
     2.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_32	Thu Sep 22 14:05:36 2005 +0100
     2.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_32	Thu Sep 22 14:36:20 2005 +0100
     2.3 @@ -19,7 +19,6 @@ CONFIG_XEN_NETDEV_BACKEND=y
     2.4  # CONFIG_XEN_TPMDEV_BACKEND is not set
     2.5  CONFIG_XEN_BLKDEV_FRONTEND=y
     2.6  CONFIG_XEN_NETDEV_FRONTEND=y
     2.7 -CONFIG_XEN_NETDEV_GRANT=y
     2.8  # CONFIG_XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER is not set
     2.9  # CONFIG_XEN_BLKDEV_TAP is not set
    2.10  # CONFIG_XEN_SHADOW_MODE is not set
     3.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_64	Thu Sep 22 14:05:36 2005 +0100
     3.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_64	Thu Sep 22 14:36:20 2005 +0100
     3.3 @@ -19,7 +19,6 @@ CONFIG_XEN_NETDEV_BACKEND=y
     3.4  # CONFIG_XEN_TPMDEV_BACKEND is not set
     3.5  CONFIG_XEN_BLKDEV_FRONTEND=y
     3.6  CONFIG_XEN_NETDEV_FRONTEND=y
     3.7 -CONFIG_XEN_NETDEV_GRANT=y
     3.8  # CONFIG_XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER is not set
     3.9  # CONFIG_XEN_BLKDEV_TAP is not set
    3.10  # CONFIG_XEN_SHADOW_MODE is not set
     4.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_32	Thu Sep 22 14:05:36 2005 +0100
     4.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_32	Thu Sep 22 14:36:20 2005 +0100
     4.3 @@ -16,7 +16,6 @@ CONFIG_NO_IDLE_HZ=y
     4.4  # CONFIG_XEN_TPMDEV_BACKEND is not set
     4.5  CONFIG_XEN_BLKDEV_FRONTEND=y
     4.6  CONFIG_XEN_NETDEV_FRONTEND=y
     4.7 -CONFIG_XEN_NETDEV_GRANT=y
     4.8  # CONFIG_XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER is not set
     4.9  # CONFIG_XEN_BLKDEV_TAP is not set
    4.10  # CONFIG_XEN_SHADOW_MODE is not set
     5.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_64	Thu Sep 22 14:05:36 2005 +0100
     5.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_64	Thu Sep 22 14:36:20 2005 +0100
     5.3 @@ -16,7 +16,6 @@ CONFIG_NO_IDLE_HZ=y
     5.4  # CONFIG_XEN_TPMDEV_BACKEND is not set
     5.5  CONFIG_XEN_BLKDEV_FRONTEND=y
     5.6  CONFIG_XEN_NETDEV_FRONTEND=y
     5.7 -CONFIG_XEN_NETDEV_GRANT=y
     5.8  # CONFIG_XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER is not set
     5.9  # CONFIG_XEN_BLKDEV_TAP is not set
    5.10  # CONFIG_XEN_SHADOW_MODE is not set
     6.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_32	Thu Sep 22 14:05:36 2005 +0100
     6.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_32	Thu Sep 22 14:36:20 2005 +0100
     6.3 @@ -19,7 +19,6 @@ CONFIG_XEN_NETDEV_BACKEND=y
     6.4  # CONFIG_XEN_TPMDEV_BACKEND is not set
     6.5  CONFIG_XEN_BLKDEV_FRONTEND=y
     6.6  CONFIG_XEN_NETDEV_FRONTEND=y
     6.7 -CONFIG_XEN_NETDEV_GRANT=y
     6.8  # CONFIG_XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER is not set
     6.9  # CONFIG_XEN_BLKDEV_TAP is not set
    6.10  # CONFIG_XEN_SHADOW_MODE is not set
     7.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_64	Thu Sep 22 14:05:36 2005 +0100
     7.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_64	Thu Sep 22 14:36:20 2005 +0100
     7.3 @@ -19,7 +19,6 @@ CONFIG_XEN_NETDEV_BACKEND=y
     7.4  # CONFIG_XEN_TPMDEV_BACKEND is not set
     7.5  CONFIG_XEN_BLKDEV_FRONTEND=y
     7.6  CONFIG_XEN_NETDEV_FRONTEND=y
     7.7 -CONFIG_XEN_NETDEV_GRANT=y
     7.8  # CONFIG_XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER is not set
     7.9  # CONFIG_XEN_BLKDEV_TAP is not set
    7.10  # CONFIG_XEN_SHADOW_MODE is not set
     8.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/common.h	Thu Sep 22 14:05:36 2005 +0100
     8.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/common.h	Thu Sep 22 14:36:20 2005 +0100
     8.3 @@ -62,9 +62,7 @@ typedef struct netif_st {
     8.4  	/* Private indexes into shared ring. */
     8.5  	NETIF_RING_IDX rx_req_cons;
     8.6  	NETIF_RING_IDX rx_resp_prod; /* private version of shared variable */
     8.7 -#ifdef CONFIG_XEN_NETDEV_GRANT
     8.8  	NETIF_RING_IDX rx_resp_prod_copy;
     8.9 -#endif
    8.10  	NETIF_RING_IDX tx_req_cons;
    8.11  	NETIF_RING_IDX tx_resp_prod; /* private version of shared variable */
    8.12  
     9.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Thu Sep 22 14:05:36 2005 +0100
     9.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Thu Sep 22 14:36:20 2005 +0100
     9.3 @@ -23,7 +23,7 @@ static void make_tx_response(netif_t *ne
     9.4  static int  make_rx_response(netif_t *netif, 
     9.5                               u16      id, 
     9.6                               s8       st,
     9.7 -                             unsigned long addr,
     9.8 +                             u16      offset,
     9.9                               u16      size,
    9.10                               u16      csum_valid);
    9.11  
    9.12 @@ -41,11 +41,7 @@ static struct sk_buff_head rx_queue;
    9.13  static multicall_entry_t rx_mcl[NETIF_RX_RING_SIZE*2+1];
    9.14  static mmu_update_t rx_mmu[NETIF_RX_RING_SIZE];
    9.15  
    9.16 -#ifdef CONFIG_XEN_NETDEV_GRANT
    9.17  static gnttab_transfer_t grant_rx_op[MAX_PENDING_REQS];
    9.18 -#else
    9.19 -static struct mmuext_op rx_mmuext[NETIF_RX_RING_SIZE];
    9.20 -#endif
    9.21  static unsigned char rx_notify[NR_EVENT_CHANNELS];
    9.22  
    9.23  /* Don't currently gate addition of an interface to the tx scheduling list. */
    9.24 @@ -72,15 +68,10 @@ static PEND_RING_IDX dealloc_prod, deall
    9.25  
    9.26  static struct sk_buff_head tx_queue;
    9.27  
    9.28 -#ifdef CONFIG_XEN_NETDEV_GRANT
    9.29  static u16 grant_tx_ref[MAX_PENDING_REQS];
    9.30  static gnttab_unmap_grant_ref_t tx_unmap_ops[MAX_PENDING_REQS];
    9.31  static gnttab_map_grant_ref_t tx_map_ops[MAX_PENDING_REQS];
    9.32  
    9.33 -#else
    9.34 -static multicall_entry_t tx_mcl[MAX_PENDING_REQS];
    9.35 -#endif
    9.36 -
    9.37  static struct list_head net_schedule_list;
    9.38  static spinlock_t net_schedule_list_lock;
    9.39  
    9.40 @@ -108,7 +99,7 @@ static unsigned long alloc_mfn(void)
    9.41  	return mfn;
    9.42  }
    9.43  
    9.44 -#ifndef CONFIG_XEN_NETDEV_GRANT
    9.45 +#if 0
    9.46  static void free_mfn(unsigned long mfn)
    9.47  {
    9.48  	unsigned long flags;
    9.49 @@ -180,18 +171,7 @@ int netif_be_start_xmit(struct sk_buff *
    9.50  		dev_kfree_skb(skb);
    9.51  		skb = nskb;
    9.52  	}
    9.53 -#ifdef CONFIG_XEN_NETDEV_GRANT
    9.54 -#ifdef DEBUG_GRANT
    9.55 -	printk(KERN_ALERT "#### be_xmit: req_prod=%d req_cons=%d "
    9.56 -	       "id=%04x gr=%04x\n",
    9.57 -	       netif->rx->req_prod,
    9.58 -	       netif->rx_req_cons,
    9.59 -	       netif->rx->ring[
    9.60 -		       MASK_NETIF_RX_IDX(netif->rx_req_cons)].req.id,
    9.61 -	       netif->rx->ring[
    9.62 -		       MASK_NETIF_RX_IDX(netif->rx_req_cons)].req.gref);
    9.63 -#endif
    9.64 -#endif
    9.65 +
    9.66  	netif->rx_req_cons++;
    9.67  	netif_get(netif);
    9.68  
    9.69 @@ -232,11 +212,7 @@ static void net_rx_action(unsigned long 
    9.70  	u16 size, id, evtchn;
    9.71  	multicall_entry_t *mcl;
    9.72  	mmu_update_t *mmu;
    9.73 -#ifdef CONFIG_XEN_NETDEV_GRANT
    9.74  	gnttab_transfer_t *gop;
    9.75 -#else
    9.76 -	struct mmuext_op *mmuext;
    9.77 -#endif
    9.78  	unsigned long vdata, old_mfn, new_mfn;
    9.79  	struct sk_buff_head rxq;
    9.80  	struct sk_buff *skb;
    9.81 @@ -247,11 +223,7 @@ static void net_rx_action(unsigned long 
    9.82  
    9.83  	mcl = rx_mcl;
    9.84  	mmu = rx_mmu;
    9.85 -#ifdef CONFIG_XEN_NETDEV_GRANT
    9.86  	gop = grant_rx_op;
    9.87 -#else
    9.88 -	mmuext = rx_mmuext;
    9.89 -#endif
    9.90  
    9.91  	while ((skb = skb_dequeue(&rx_queue)) != NULL) {
    9.92  		netif   = netdev_priv(skb->dev);
    9.93 @@ -277,25 +249,13 @@ static void net_rx_action(unsigned long 
    9.94  					pfn_pte_ma(new_mfn, PAGE_KERNEL), 0);
    9.95  		mcl++;
    9.96  
    9.97 -#ifdef CONFIG_XEN_NETDEV_GRANT
    9.98  		gop->mfn = old_mfn;
    9.99  		gop->domid = netif->domid;
   9.100  		gop->ref = netif->rx->ring[
   9.101  			MASK_NETIF_RX_IDX(netif->rx_resp_prod_copy)].req.gref;
   9.102  		netif->rx_resp_prod_copy++;
   9.103  		gop++;
   9.104 -#else
   9.105 -		mcl->op = __HYPERVISOR_mmuext_op;
   9.106 -		mcl->args[0] = (unsigned long)mmuext;
   9.107 -		mcl->args[1] = 1;
   9.108 -		mcl->args[2] = 0;
   9.109 -		mcl->args[3] = netif->domid;
   9.110 -		mcl++;
   9.111  
   9.112 -		mmuext->cmd = MMUEXT_REASSIGN_PAGE;
   9.113 -		mmuext->arg1.mfn = old_mfn;
   9.114 -		mmuext++;
   9.115 -#endif
   9.116  		mmu->ptr = ((maddr_t)new_mfn << PAGE_SHIFT) |
   9.117  			MMU_MACHPHYS_UPDATE;
   9.118  		mmu->val = __pa(vdata) >> PAGE_SHIFT;  
   9.119 @@ -303,9 +263,6 @@ static void net_rx_action(unsigned long 
   9.120  
   9.121  		__skb_queue_tail(&rxq, skb);
   9.122  
   9.123 -#ifdef DEBUG_GRANT
   9.124 -		dump_packet('a', old_mfn, vdata);
   9.125 -#endif
   9.126  		/* Filled the batch queue? */
   9.127  		if ((mcl - rx_mcl) == ARRAY_SIZE(rx_mcl))
   9.128  			break;
   9.129 @@ -321,17 +278,12 @@ static void net_rx_action(unsigned long 
   9.130  	mcl->args[3] = DOMID_SELF;
   9.131  	mcl++;
   9.132  
   9.133 -#ifdef CONFIG_XEN_NETDEV_GRANT
   9.134  	mcl[-2].args[MULTI_UVMFLAGS_INDEX] = UVMF_TLB_FLUSH|UVMF_ALL;
   9.135 -#else
   9.136 -	mcl[-3].args[MULTI_UVMFLAGS_INDEX] = UVMF_TLB_FLUSH|UVMF_ALL;
   9.137 -#endif
   9.138  	BUG_ON(HYPERVISOR_multicall(rx_mcl, mcl - rx_mcl) != 0);
   9.139  
   9.140  	mcl = rx_mcl;
   9.141 -#ifdef CONFIG_XEN_NETDEV_GRANT
   9.142 -	if(HYPERVISOR_grant_table_op(GNTTABOP_transfer, grant_rx_op, 
   9.143 -				     gop - grant_rx_op)) { 
   9.144 +	if( HYPERVISOR_grant_table_op(GNTTABOP_transfer, grant_rx_op, 
   9.145 +				      gop - grant_rx_op)) { 
   9.146  		/*
   9.147  		 * The other side has given us a bad grant ref, or has no 
   9.148  		 * headroom, or has gone away. Unfortunately the current grant
   9.149 @@ -343,20 +295,14 @@ static void net_rx_action(unsigned long 
   9.150  			grant_rx_op[0].domid, gop - grant_rx_op); 
   9.151  	}
   9.152  	gop = grant_rx_op;
   9.153 -#else
   9.154 -	mmuext = rx_mmuext;
   9.155 -#endif
   9.156 +
   9.157  	while ((skb = __skb_dequeue(&rxq)) != NULL) {
   9.158  		netif   = netdev_priv(skb->dev);
   9.159  		size    = skb->tail - skb->data;
   9.160  
   9.161  		/* Rederive the machine addresses. */
   9.162  		new_mfn = mcl[0].args[1] >> PAGE_SHIFT;
   9.163 -#ifdef CONFIG_XEN_NETDEV_GRANT
   9.164  		old_mfn = 0; /* XXX Fix this so we can free_mfn() on error! */
   9.165 -#else
   9.166 -		old_mfn = mmuext[0].arg1.mfn;
   9.167 -#endif
   9.168  		atomic_set(&(skb_shinfo(skb)->dataref), 1);
   9.169  		skb_shinfo(skb)->nr_frags = 0;
   9.170  		skb_shinfo(skb)->frag_list = NULL;
   9.171 @@ -369,27 +315,17 @@ static void net_rx_action(unsigned long 
   9.172  
   9.173  		/* Check the reassignment error code. */
   9.174  		status = NETIF_RSP_OKAY;
   9.175 -#ifdef CONFIG_XEN_NETDEV_GRANT
   9.176  		if(gop->status != 0) { 
   9.177  			DPRINTK("Bad status %d from grant transfer to DOM%u\n",
   9.178  				gop->status, netif->domid);
   9.179  			/* XXX SMH: should free 'old_mfn' here */
   9.180  			status = NETIF_RSP_ERROR; 
   9.181  		} 
   9.182 -#else
   9.183 -		if (unlikely(mcl[1].result != 0)) {
   9.184 -			DPRINTK("Failed MMU update transferring to DOM%u\n",
   9.185 -				netif->domid);
   9.186 -			free_mfn(old_mfn);
   9.187 -			status = NETIF_RSP_ERROR;
   9.188 -		}
   9.189 -#endif
   9.190  		evtchn = netif->evtchn;
   9.191  		id = netif->rx->ring[
   9.192  			MASK_NETIF_RX_IDX(netif->rx_resp_prod)].req.id;
   9.193  		if (make_rx_response(netif, id, status,
   9.194 -				     (old_mfn << PAGE_SHIFT) | /* XXX */
   9.195 -				     ((unsigned long)skb->data & ~PAGE_MASK),
   9.196 +				     (unsigned long)skb->data & ~PAGE_MASK,
   9.197  				     size, skb->proto_csum_valid) &&
   9.198  		    (rx_notify[evtchn] == 0)) {
   9.199  			rx_notify[evtchn] = 1;
   9.200 @@ -398,13 +334,8 @@ static void net_rx_action(unsigned long 
   9.201  
   9.202  		netif_put(netif);
   9.203  		dev_kfree_skb(skb);
   9.204 -#ifdef CONFIG_XEN_NETDEV_GRANT
   9.205  		mcl++;
   9.206  		gop++;
   9.207 -#else
   9.208 -		mcl += 2;
   9.209 -		mmuext += 1;
   9.210 -#endif
   9.211  	}
   9.212  
   9.213  	while (notify_nr != 0) {
   9.214 @@ -486,11 +417,7 @@ static void tx_credit_callback(unsigned 
   9.215  
   9.216  inline static void net_tx_action_dealloc(void)
   9.217  {
   9.218 -#ifdef CONFIG_XEN_NETDEV_GRANT
   9.219  	gnttab_unmap_grant_ref_t *gop;
   9.220 -#else
   9.221 -	multicall_entry_t *mcl;
   9.222 -#endif
   9.223  	u16 pending_idx;
   9.224  	PEND_RING_IDX dc, dp;
   9.225  	netif_t *netif;
   9.226 @@ -498,7 +425,6 @@ inline static void net_tx_action_dealloc
   9.227  	dc = dealloc_cons;
   9.228  	dp = dealloc_prod;
   9.229  
   9.230 -#ifdef CONFIG_XEN_NETDEV_GRANT
   9.231  	/*
   9.232  	 * Free up any grants we have finished using
   9.233  	 */
   9.234 @@ -513,26 +439,8 @@ inline static void net_tx_action_dealloc
   9.235  	}
   9.236  	BUG_ON(HYPERVISOR_grant_table_op(
   9.237  		GNTTABOP_unmap_grant_ref, tx_unmap_ops, gop - tx_unmap_ops));
   9.238 -#else
   9.239 -	mcl = tx_mcl;
   9.240 -	while (dc != dp) {
   9.241 -		pending_idx = dealloc_ring[MASK_PEND_IDX(dc++)];
   9.242 -		MULTI_update_va_mapping(mcl, MMAP_VADDR(pending_idx),
   9.243 -					__pte(0), 0);
   9.244 -		mcl++;     
   9.245 -	}
   9.246  
   9.247 -	mcl[-1].args[MULTI_UVMFLAGS_INDEX] = UVMF_TLB_FLUSH|UVMF_ALL;
   9.248 -	BUG_ON(HYPERVISOR_multicall(tx_mcl, mcl - tx_mcl) != 0);
   9.249 -
   9.250 -	mcl = tx_mcl;
   9.251 -#endif
   9.252  	while (dealloc_cons != dp) {
   9.253 -#ifndef CONFIG_XEN_NETDEV_GRANT
   9.254 -		/* The update_va_mapping() must not fail. */
   9.255 -		BUG_ON(mcl[0].result != 0);
   9.256 -#endif
   9.257 -
   9.258  		pending_idx = dealloc_ring[MASK_PEND_IDX(dealloc_cons++)];
   9.259  
   9.260  		netif = pending_tx_info[pending_idx].netif;
   9.261 @@ -556,10 +464,6 @@ inline static void net_tx_action_dealloc
   9.262  			add_to_net_schedule_list_tail(netif);
   9.263          
   9.264  		netif_put(netif);
   9.265 -
   9.266 -#ifndef CONFIG_XEN_NETDEV_GRANT
   9.267 -		mcl++;
   9.268 -#endif
   9.269  	}
   9.270  }
   9.271  
   9.272 @@ -572,21 +476,13 @@ static void net_tx_action(unsigned long 
   9.273  	netif_tx_request_t txreq;
   9.274  	u16 pending_idx;
   9.275  	NETIF_RING_IDX i;
   9.276 -#ifdef CONFIG_XEN_NETDEV_GRANT
   9.277  	gnttab_map_grant_ref_t *mop;
   9.278 -#else
   9.279 -	multicall_entry_t *mcl;
   9.280 -#endif
   9.281  	unsigned int data_len;
   9.282  
   9.283  	if (dealloc_cons != dealloc_prod)
   9.284  		net_tx_action_dealloc();
   9.285  
   9.286 -#ifdef CONFIG_XEN_NETDEV_GRANT
   9.287  	mop = tx_map_ops;
   9.288 -#else
   9.289 -	mcl = tx_mcl;
   9.290 -#endif
   9.291  	while ((NR_PENDING_REQS < MAX_PENDING_REQS) &&
   9.292  		!list_empty(&net_schedule_list)) {
   9.293  		/* Get a netif from the list with work to do. */
   9.294 @@ -657,8 +553,7 @@ static void net_tx_action(unsigned long 
   9.295  		}
   9.296  
   9.297  		/* No crossing a page as the payload mustn't fragment. */
   9.298 -		if (unlikely(((txreq.addr & ~PAGE_MASK) + txreq.size) >=
   9.299 -			     PAGE_SIZE)) {
   9.300 +		if (unlikely((txreq.offset + txreq.size) >= PAGE_SIZE)) {
   9.301  			DPRINTK("txreq.addr: %lx, size: %u, end: %lu\n", 
   9.302  				txreq.addr, txreq.size, 
   9.303  				(txreq.addr &~PAGE_MASK) + txreq.size);
   9.304 @@ -682,20 +577,12 @@ static void net_tx_action(unsigned long 
   9.305  
   9.306  		/* Packets passed to netif_rx() must have some headroom. */
   9.307  		skb_reserve(skb, 16);
   9.308 -#ifdef CONFIG_XEN_NETDEV_GRANT
   9.309 +
   9.310  		mop->host_addr = MMAP_VADDR(pending_idx);
   9.311  		mop->dom       = netif->domid;
   9.312 -		mop->ref       = txreq.addr >> PAGE_SHIFT;
   9.313 +		mop->ref       = txreq.gref;
   9.314  		mop->flags     = GNTMAP_host_map | GNTMAP_readonly;
   9.315  		mop++;
   9.316 -#else
   9.317 -		MULTI_update_va_mapping_otherdomain(
   9.318 -			mcl, MMAP_VADDR(pending_idx),
   9.319 -			pfn_pte_ma(txreq.addr >> PAGE_SHIFT, PAGE_KERNEL),
   9.320 -			0, netif->domid);
   9.321 -
   9.322 -		mcl++;
   9.323 -#endif
   9.324  
   9.325  		memcpy(&pending_tx_info[pending_idx].req,
   9.326  		       &txreq, sizeof(txreq));
   9.327 @@ -706,17 +593,10 @@ static void net_tx_action(unsigned long 
   9.328  
   9.329  		pending_cons++;
   9.330  
   9.331 -#ifdef CONFIG_XEN_NETDEV_GRANT
   9.332  		if ((mop - tx_map_ops) >= ARRAY_SIZE(tx_map_ops))
   9.333  			break;
   9.334 -#else
   9.335 -		/* Filled the batch queue? */
   9.336 -		if ((mcl - tx_mcl) == ARRAY_SIZE(tx_mcl))
   9.337 -			break;
   9.338 -#endif
   9.339  	}
   9.340  
   9.341 -#ifdef CONFIG_XEN_NETDEV_GRANT
   9.342  	if (mop == tx_map_ops)
   9.343  		return;
   9.344  
   9.345 @@ -724,14 +604,6 @@ static void net_tx_action(unsigned long 
   9.346  		GNTTABOP_map_grant_ref, tx_map_ops, mop - tx_map_ops));
   9.347  
   9.348  	mop = tx_map_ops;
   9.349 -#else
   9.350 -	if (mcl == tx_mcl)
   9.351 -		return;
   9.352 -
   9.353 -	BUG_ON(HYPERVISOR_multicall(tx_mcl, mcl - tx_mcl) != 0);
   9.354 -
   9.355 -	mcl = tx_mcl;
   9.356 -#endif
   9.357  	while ((skb = __skb_dequeue(&tx_queue)) != NULL) {
   9.358  		pending_idx = *((u16 *)skb->data);
   9.359  		netif       = pending_tx_info[pending_idx].netif;
   9.360 @@ -739,7 +611,6 @@ static void net_tx_action(unsigned long 
   9.361  		       sizeof(txreq));
   9.362  
   9.363  		/* Check the remap error code. */
   9.364 -#ifdef CONFIG_XEN_NETDEV_GRANT
   9.365  		if (unlikely(mop->handle < 0)) {
   9.366  			printk(KERN_ALERT "#### netback grant fails\n");
   9.367  			make_tx_response(netif, txreq.id, NETIF_RSP_ERROR);
   9.368 @@ -754,30 +625,13 @@ static void net_tx_action(unsigned long 
   9.369  			__pa(MMAP_VADDR(pending_idx)) >> PAGE_SHIFT] =
   9.370  			FOREIGN_FRAME(mop->dev_bus_addr >> PAGE_SHIFT);
   9.371  		grant_tx_ref[pending_idx] = mop->handle;
   9.372 -#else
   9.373 -		if (unlikely(mcl[0].result != 0)) {
   9.374 -			DPRINTK("Bad page frame\n");
   9.375 -			make_tx_response(netif, txreq.id, NETIF_RSP_ERROR);
   9.376 -			netif_put(netif);
   9.377 -			kfree_skb(skb);
   9.378 -			mcl++;
   9.379 -			pending_ring[MASK_PEND_IDX(pending_prod++)] =
   9.380 -				pending_idx;
   9.381 -			continue;
   9.382 -		}
   9.383 -
   9.384 -		phys_to_machine_mapping[__pa(MMAP_VADDR(pending_idx)) >>
   9.385 -				       PAGE_SHIFT] =
   9.386 -			FOREIGN_FRAME(txreq.addr >> PAGE_SHIFT);
   9.387 -#endif
   9.388  
   9.389  		data_len = (txreq.size > PKT_PROT_LEN) ?
   9.390  			PKT_PROT_LEN : txreq.size;
   9.391  
   9.392  		__skb_put(skb, data_len);
   9.393  		memcpy(skb->data, 
   9.394 -		       (void *)(MMAP_VADDR(pending_idx)|
   9.395 -				(txreq.addr&~PAGE_MASK)),
   9.396 +		       (void *)(MMAP_VADDR(pending_idx)|txreq.offset),
   9.397  		       data_len);
   9.398  		if (data_len < txreq.size) {
   9.399  			/* Append the packet payload as a fragment. */
   9.400 @@ -786,7 +640,7 @@ static void net_tx_action(unsigned long 
   9.401  			skb_shinfo(skb)->frags[0].size        =
   9.402  				txreq.size - data_len;
   9.403  			skb_shinfo(skb)->frags[0].page_offset = 
   9.404 -				(txreq.addr + data_len) & ~PAGE_MASK;
   9.405 +				txreq.offset + data_len;
   9.406  			skb_shinfo(skb)->nr_frags = 1;
   9.407  		} else {
   9.408  			/* Schedule a response immediately. */
   9.409 @@ -813,11 +667,7 @@ static void net_tx_action(unsigned long 
   9.410  		netif_rx(skb);
   9.411  		netif->dev->last_rx = jiffies;
   9.412  
   9.413 -#ifdef CONFIG_XEN_NETDEV_GRANT
   9.414  		mop++;
   9.415 -#else
   9.416 -		mcl++;
   9.417 -#endif
   9.418  	}
   9.419  }
   9.420  
   9.421 @@ -874,7 +724,7 @@ static void make_tx_response(netif_t *ne
   9.422  static int make_rx_response(netif_t *netif, 
   9.423                              u16      id, 
   9.424                              s8       st,
   9.425 -                            unsigned long addr,
   9.426 +                            u16      offset,
   9.427                              u16      size,
   9.428                              u16      csum_valid)
   9.429  {
   9.430 @@ -882,7 +732,7 @@ static int make_rx_response(netif_t *net
   9.431  	netif_rx_response_t *resp;
   9.432  
   9.433  	resp = &netif->rx->ring[MASK_NETIF_RX_IDX(i)].resp;
   9.434 -	resp->addr       = addr;
   9.435 +	resp->offset     = offset;
   9.436  	resp->csum_valid = csum_valid;
   9.437  	resp->id         = id;
   9.438  	resp->status     = (s16)size;
   9.439 @@ -937,9 +787,6 @@ static int __init netback_init(void)
   9.440  		return 0;
   9.441  
   9.442  	IPRINTK("Initialising Xen netif backend.\n");
   9.443 -#ifdef CONFIG_XEN_NETDEV_GRANT
   9.444 -	IPRINTK("Using grant tables.\n");
   9.445 -#endif
   9.446  
   9.447  	/* We can increase reservation by this much in net_rx_action(). */
   9.448  	balloon_update_driver_allowance(NETIF_RX_RING_SIZE);
    10.1 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Thu Sep 22 14:05:36 2005 +0100
    10.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Thu Sep 22 14:36:20 2005 +0100
    10.3 @@ -256,8 +256,8 @@ static void network_tx_buf_gc(struct net
    10.4  		for (i = np->tx_resp_cons; i != prod; i++) {
    10.5  			id  = np->tx->ring[MASK_NETIF_TX_IDX(i)].resp.id;
    10.6  			skb = np->tx_skbs[id];
    10.7 -#ifdef CONFIG_XEN_NETDEV_GRANT
    10.8 -			if (unlikely(gnttab_query_foreign_access(np->grant_tx_ref[id]) != 0)) {
    10.9 +			if (unlikely(gnttab_query_foreign_access(
   10.10 +				np->grant_tx_ref[id]) != 0)) {
   10.11  				printk(KERN_ALERT "network_tx_buf_gc: warning "
   10.12  				       "-- grant still in use by backend "
   10.13  				       "domain.\n");
   10.14 @@ -268,7 +268,6 @@ static void network_tx_buf_gc(struct net
   10.15  			gnttab_release_grant_reference(
   10.16  				&np->gref_tx_head, np->grant_tx_ref[id]);
   10.17  			np->grant_tx_ref[id] = GRANT_INVALID_REF;
   10.18 -#endif
   10.19  			ADD_ID_TO_FREELIST(np->tx_skbs, id);
   10.20  			dev_kfree_skb_irq(skb);
   10.21  		}
   10.22 @@ -287,10 +286,7 @@ static void network_tx_buf_gc(struct net
   10.23  		mb();
   10.24  	} while (prod != np->tx->resp_prod);
   10.25  
   10.26 -#ifdef CONFIG_XEN_NETDEV_GRANT
   10.27   out: 
   10.28 -#endif
   10.29 -
   10.30  	if (np->tx_full && ((np->tx->req_prod - prod) < NETIF_TX_RING_SIZE)) {
   10.31  		np->tx_full = 0;
   10.32  		if (np->user_state == UST_OPEN)
   10.33 @@ -307,9 +303,7 @@ static void network_alloc_rx_buffers(str
   10.34  	int i, batch_target;
   10.35  	NETIF_RING_IDX req_prod = np->rx->req_prod;
   10.36  	struct xen_memory_reservation reservation;
   10.37 -#ifdef CONFIG_XEN_NETDEV_GRANT
   10.38  	grant_ref_t ref;
   10.39 -#endif
   10.40  
   10.41  	if (unlikely(np->backend_state != BEST_CONNECTED))
   10.42  		return;
   10.43 @@ -343,13 +337,11 @@ static void network_alloc_rx_buffers(str
   10.44  		np->rx_skbs[id] = skb;
   10.45          
   10.46  		np->rx->ring[MASK_NETIF_RX_IDX(req_prod + i)].req.id = id;
   10.47 -#ifdef CONFIG_XEN_NETDEV_GRANT
   10.48  		ref = gnttab_claim_grant_reference(&np->gref_rx_head);
   10.49  		BUG_ON((signed short)ref < 0);
   10.50  		np->grant_rx_ref[id] = ref;
   10.51  		gnttab_grant_foreign_transfer_ref(ref, np->backend_id);
   10.52  		np->rx->ring[MASK_NETIF_RX_IDX(req_prod + i)].req.gref = ref;
   10.53 -#endif
   10.54  		rx_pfn_array[i] = virt_to_mfn(skb->head);
   10.55  
   10.56  		/* Remove this page from map before passing back to Xen. */
   10.57 @@ -400,10 +392,8 @@ static int network_start_xmit(struct sk_
   10.58  	struct net_private *np = netdev_priv(dev);
   10.59  	netif_tx_request_t *tx;
   10.60  	NETIF_RING_IDX i;
   10.61 -#ifdef CONFIG_XEN_NETDEV_GRANT
   10.62  	grant_ref_t ref;
   10.63  	unsigned long mfn;
   10.64 -#endif
   10.65  
   10.66  	if (unlikely(np->tx_full)) {
   10.67  		printk(KERN_ALERT "%s: full queue wasn't stopped!\n",
   10.68 @@ -439,18 +429,13 @@ static int network_start_xmit(struct sk_
   10.69  	tx = &np->tx->ring[MASK_NETIF_TX_IDX(i)].req;
   10.70  
   10.71  	tx->id   = id;
   10.72 -#ifdef CONFIG_XEN_NETDEV_GRANT
   10.73  	ref = gnttab_claim_grant_reference(&np->gref_tx_head);
   10.74  	BUG_ON((signed short)ref < 0);
   10.75  	mfn = virt_to_mfn(skb->data);
   10.76  	gnttab_grant_foreign_access_ref(
   10.77  		ref, np->backend_id, mfn, GNTMAP_readonly);
   10.78 -	tx->addr = ref << PAGE_SHIFT;
   10.79 -	np->grant_tx_ref[id] = ref;
   10.80 -#else
   10.81 -	tx->addr = virt_to_mfn(skb->data) << PAGE_SHIFT;
   10.82 -#endif
   10.83 -	tx->addr |= (unsigned long)skb->data & ~PAGE_MASK;
   10.84 +	tx->gref = np->grant_tx_ref[id] = ref;
   10.85 +	tx->offset = (unsigned long)skb->data & ~PAGE_MASK;
   10.86  	tx->size = skb->len;
   10.87  	tx->csum_blank = (skb->ip_summed == CHECKSUM_HW);
   10.88  
   10.89 @@ -511,10 +496,8 @@ static int netif_poll(struct net_device 
   10.90  	int work_done, budget, more_to_do = 1;
   10.91  	struct sk_buff_head rxq;
   10.92  	unsigned long flags;
   10.93 -#ifdef CONFIG_XEN_NETDEV_GRANT
   10.94  	unsigned long mfn;
   10.95  	grant_ref_t ref;
   10.96 -#endif
   10.97  
   10.98  	spin_lock(&np->rx_lock);
   10.99  
  10.100 @@ -550,7 +533,6 @@ static int netif_poll(struct net_device 
  10.101  			continue;
  10.102  		}
  10.103  
  10.104 -#ifdef CONFIG_XEN_NETDEV_GRANT
  10.105  		ref = np->grant_rx_ref[rx->id]; 
  10.106  
  10.107  		if(ref == GRANT_INVALID_REF) { 
  10.108 @@ -568,17 +550,12 @@ static int netif_poll(struct net_device 
  10.109  		np->grant_rx_ref[rx->id] = GRANT_INVALID_REF;
  10.110  		mfn = gnttab_end_foreign_transfer_ref(ref);
  10.111  		gnttab_release_grant_reference(&np->gref_rx_head, ref);
  10.112 -#endif
  10.113  
  10.114  		skb = np->rx_skbs[rx->id];
  10.115  		ADD_ID_TO_FREELIST(np->rx_skbs, rx->id);
  10.116  
  10.117  		/* NB. We handle skb overflow later. */
  10.118 -#ifdef CONFIG_XEN_NETDEV_GRANT
  10.119 -		skb->data = skb->head + rx->addr;
  10.120 -#else
  10.121 -		skb->data = skb->head + (rx->addr & ~PAGE_MASK);
  10.122 -#endif
  10.123 +		skb->data = skb->head + rx->offset;
  10.124  		skb->len  = rx->status;
  10.125  		skb->tail = skb->data + skb->len;
  10.126  
  10.127 @@ -589,30 +566,14 @@ static int netif_poll(struct net_device 
  10.128  		np->stats.rx_bytes += rx->status;
  10.129  
  10.130  		/* Remap the page. */
  10.131 -#ifdef CONFIG_XEN_NETDEV_GRANT
  10.132  		mmu->ptr = ((maddr_t)mfn << PAGE_SHIFT) | MMU_MACHPHYS_UPDATE;
  10.133 -#else
  10.134 -		mmu->ptr  = (rx->addr & PAGE_MASK) | MMU_MACHPHYS_UPDATE;
  10.135 -#endif
  10.136  		mmu->val  = __pa(skb->head) >> PAGE_SHIFT;
  10.137  		mmu++;
  10.138 -#ifdef CONFIG_XEN_NETDEV_GRANT
  10.139  		MULTI_update_va_mapping(mcl, (unsigned long)skb->head,
  10.140  					pfn_pte_ma(mfn, PAGE_KERNEL), 0);
  10.141 -#else
  10.142 -		MULTI_update_va_mapping(mcl, (unsigned long)skb->head,
  10.143 -					pfn_pte_ma(rx->addr >> PAGE_SHIFT, 
  10.144 -						   PAGE_KERNEL), 0);
  10.145 -#endif
  10.146  		mcl++;
  10.147  
  10.148 -#ifdef CONFIG_XEN_NETDEV_GRANT
  10.149  		phys_to_machine_mapping[__pa(skb->head) >> PAGE_SHIFT] = mfn;
  10.150 -#else
  10.151 -		phys_to_machine_mapping[__pa(skb->head) >> PAGE_SHIFT] = 
  10.152 -			rx->addr >> PAGE_SHIFT;
  10.153 -#endif 
  10.154 -
  10.155  
  10.156  		__skb_queue_tail(&rxq, skb);
  10.157  	}
  10.158 @@ -773,16 +734,12 @@ static void network_connect(struct net_d
  10.159  			tx = &np->tx->ring[requeue_idx++].req;
  10.160  
  10.161  			tx->id   = i;
  10.162 -#ifdef CONFIG_XEN_NETDEV_GRANT
  10.163  			gnttab_grant_foreign_access_ref(
  10.164  				np->grant_tx_ref[i], np->backend_id, 
  10.165  				virt_to_mfn(np->tx_skbs[i]->data),
  10.166  				GNTMAP_readonly); 
  10.167 -			tx->addr = np->grant_tx_ref[i] << PAGE_SHIFT; 
  10.168 -#else
  10.169 -			tx->addr = virt_to_mfn(skb->data) << PAGE_SHIFT;
  10.170 -#endif
  10.171 -			tx->addr |= (unsigned long)skb->data & ~PAGE_MASK;
  10.172 +			tx->gref = np->grant_tx_ref[i];
  10.173 +			tx->offset = (unsigned long)skb->data & ~PAGE_MASK;
  10.174  			tx->size = skb->len;
  10.175  
  10.176  			np->stats.tx_bytes += skb->len;
  10.177 @@ -795,12 +752,10 @@ static void network_connect(struct net_d
  10.178  	/* Rebuild the RX buffer freelist and the RX ring itself. */
  10.179  	for (requeue_idx = 0, i = 1; i <= NETIF_RX_RING_SIZE; i++) { 
  10.180  		if ((unsigned long)np->rx_skbs[i] >= __PAGE_OFFSET) {
  10.181 -#ifdef CONFIG_XEN_NETDEV_GRANT 
  10.182  			gnttab_grant_foreign_transfer_ref(
  10.183  				np->grant_rx_ref[i], np->backend_id);
  10.184  			np->rx->ring[requeue_idx].req.gref =
  10.185  				np->grant_rx_ref[i];
  10.186 -#endif
  10.187  			np->rx->ring[requeue_idx].req.id = i;
  10.188  			requeue_idx++; 
  10.189  		}
  10.190 @@ -862,11 +817,9 @@ connect_device(struct net_private *np, u
  10.191  
  10.192  static void netif_uninit(struct net_device *dev)
  10.193  {
  10.194 -#ifdef CONFIG_XEN_NETDEV_GRANT
  10.195  	struct net_private *np = netdev_priv(dev);
  10.196  	gnttab_free_grant_references(np->gref_tx_head);
  10.197  	gnttab_free_grant_references(np->gref_rx_head);
  10.198 -#endif
  10.199  }
  10.200  
  10.201  static struct ethtool_ops network_ethtool_ops =
  10.202 @@ -911,19 +864,14 @@ static int create_netdev(int handle, str
  10.203  	/* Initialise {tx,rx}_skbs as a free chain containing every entry. */
  10.204  	for (i = 0; i <= NETIF_TX_RING_SIZE; i++) {
  10.205  		np->tx_skbs[i] = (void *)((unsigned long) i+1);
  10.206 -#ifdef CONFIG_XEN_NETDEV_GRANT
  10.207  		np->grant_tx_ref[i] = GRANT_INVALID_REF;
  10.208 -#endif
  10.209  	}
  10.210  
  10.211  	for (i = 0; i <= NETIF_RX_RING_SIZE; i++) {
  10.212  		np->rx_skbs[i] = (void *)((unsigned long) i+1);
  10.213 -#ifdef CONFIG_XEN_NETDEV_GRANT
  10.214  		np->grant_rx_ref[i] = GRANT_INVALID_REF;
  10.215 -#endif
  10.216  	}
  10.217  
  10.218 -#ifdef CONFIG_XEN_NETDEV_GRANT
  10.219  	/* A grant for every tx ring slot */
  10.220  	if (gnttab_alloc_grant_references(NETIF_TX_RING_SIZE,
  10.221  					  &np->gref_tx_head) < 0) {
  10.222 @@ -937,7 +885,6 @@ static int create_netdev(int handle, str
  10.223  		gnttab_free_grant_references(np->gref_tx_head);
  10.224  		goto exit;
  10.225  	}
  10.226 -#endif
  10.227  
  10.228  	netdev->open            = network_open;
  10.229  	netdev->hard_start_xmit = network_start_xmit;
  10.230 @@ -971,10 +918,8 @@ static int create_netdev(int handle, str
  10.231  	return err;
  10.232  
  10.233   exit_free_grefs:
  10.234 -#ifdef CONFIG_XEN_NETDEV_GRANT
  10.235  	gnttab_free_grant_references(np->gref_tx_head);
  10.236  	gnttab_free_grant_references(np->gref_rx_head);
  10.237 -#endif
  10.238  	goto exit;
  10.239  }
  10.240  
  10.241 @@ -1024,10 +969,8 @@ static int setup_device(struct xenbus_de
  10.242  	evtchn_op_t op = { .cmd = EVTCHNOP_alloc_unbound };
  10.243  	int err;
  10.244  
  10.245 -#ifdef CONFIG_XEN_NETDEV_GRANT
  10.246  	info->tx_ring_ref = GRANT_INVALID_REF;
  10.247  	info->rx_ring_ref = GRANT_INVALID_REF;
  10.248 -#endif
  10.249  
  10.250  	info->tx = (netif_tx_interface_t *)__get_free_page(GFP_KERNEL);
  10.251  	if (info->tx == 0) {
  10.252 @@ -1045,7 +988,6 @@ static int setup_device(struct xenbus_de
  10.253  	memset(info->rx, 0, PAGE_SIZE);
  10.254  	info->backend_state = BEST_DISCONNECTED;
  10.255  
  10.256 -#ifdef CONFIG_XEN_NETDEV_GRANT
  10.257  	err = gnttab_grant_foreign_access(info->backend_id,
  10.258  					  virt_to_mfn(info->tx), 0);
  10.259  	if (err < 0) {
  10.260 @@ -1062,11 +1004,6 @@ static int setup_device(struct xenbus_de
  10.261  	}
  10.262  	info->rx_ring_ref = err;
  10.263  
  10.264 -#else
  10.265 -	info->tx_ring_ref = virt_to_mfn(info->tx);
  10.266 -	info->rx_ring_ref = virt_to_mfn(info->rx);
  10.267 -#endif
  10.268 -
  10.269  	op.u.alloc_unbound.dom = info->backend_id;
  10.270  	err = HYPERVISOR_event_channel_op(&op);
  10.271  	if (err) {
  10.272 @@ -1084,7 +1021,6 @@ static int setup_device(struct xenbus_de
  10.273  		free_page((unsigned long)info->rx);
  10.274  	info->rx = 0;
  10.275  
  10.276 -#ifdef CONFIG_XEN_NETDEV_GRANT
  10.277  	if (info->tx_ring_ref != GRANT_INVALID_REF)
  10.278  		gnttab_end_foreign_access(info->tx_ring_ref, 0);
  10.279  	info->tx_ring_ref = GRANT_INVALID_REF;
  10.280 @@ -1092,7 +1028,6 @@ static int setup_device(struct xenbus_de
  10.281  	if (info->rx_ring_ref != GRANT_INVALID_REF)
  10.282  		gnttab_end_foreign_access(info->rx_ring_ref, 0);
  10.283  	info->rx_ring_ref = GRANT_INVALID_REF;
  10.284 -#endif
  10.285  
  10.286  	return err;
  10.287  }
  10.288 @@ -1106,7 +1041,6 @@ static void netif_free(struct netfront_i
  10.289  		free_page((unsigned long)info->rx);
  10.290  	info->rx = 0;
  10.291  
  10.292 -#ifdef CONFIG_XEN_NETDEV_GRANT
  10.293  	if (info->tx_ring_ref != GRANT_INVALID_REF)
  10.294  		gnttab_end_foreign_access(info->tx_ring_ref, 0);
  10.295  	info->tx_ring_ref = GRANT_INVALID_REF;
  10.296 @@ -1114,7 +1048,6 @@ static void netif_free(struct netfront_i
  10.297  	if (info->rx_ring_ref != GRANT_INVALID_REF)
  10.298  		gnttab_end_foreign_access(info->rx_ring_ref, 0);
  10.299  	info->rx_ring_ref = GRANT_INVALID_REF;
  10.300 -#endif
  10.301  
  10.302  	unbind_evtchn_from_irqhandler(info->evtchn, info->netdev);
  10.303  	info->evtchn = 0;
    11.1 --- a/xen/include/public/io/netif.h	Thu Sep 22 14:05:36 2005 +0100
    11.2 +++ b/xen/include/public/io/netif.h	Thu Sep 22 14:36:20 2005 +0100
    11.3 @@ -10,10 +10,11 @@
    11.4  #define __XEN_PUBLIC_IO_NETIF_H__
    11.5  
    11.6  typedef struct netif_tx_request {
    11.7 -    unsigned long addr;   /* Machine address of packet.  */
    11.8 +    grant_ref_t gref;      /* Reference to buffer page */
    11.9 +    u16      offset:15;    /* Offset within buffer page */
   11.10      u16      csum_blank:1; /* Proto csum field blank?   */
   11.11 -    u16      id:15;  /* Echoed in response message. */
   11.12 -    u16      size;   /* Packet size in bytes.       */
   11.13 +    u16      id;           /* Echoed in response message. */
   11.14 +    u16      size;         /* Packet size in bytes.       */
   11.15  } netif_tx_request_t;
   11.16  
   11.17  typedef struct netif_tx_response {
   11.18 @@ -22,21 +23,15 @@ typedef struct netif_tx_response {
   11.19  } netif_tx_response_t;
   11.20  
   11.21  typedef struct {
   11.22 -    u16       id;    /* Echoed in response message.        */
   11.23 -#ifdef CONFIG_XEN_NETDEV_GRANT
   11.24 -    grant_ref_t gref;	/* 2: Reference to incoming granted frame */
   11.25 -#endif
   11.26 +    u16       id;       /* Echoed in response message.        */
   11.27 +    grant_ref_t gref;	/* Reference to incoming granted frame */
   11.28  } netif_rx_request_t;
   11.29  
   11.30  typedef struct {
   11.31 -#ifdef CONFIG_XEN_NETDEV_GRANT
   11.32 -    u32      addr;   /*  0: Offset in page of start of received packet  */
   11.33 -#else
   11.34 -    unsigned long addr; /* Machine address of packet.              */
   11.35 -#endif
   11.36 -    u16      csum_valid:1; /* Protocol checksum is validated?       */
   11.37 -    u16      id:15;
   11.38 -    s16      status; /* -ve: BLKIF_RSP_* ; +ve: Rx'ed pkt size. */
   11.39 +    u16      offset;     /* Offset in page of start of received packet  */
   11.40 +    u16      csum_valid; /* Protocol checksum is validated?       */
   11.41 +    u16      id;
   11.42 +    s16      status;     /* -ve: BLKIF_RSP_* ; +ve: Rx'ed pkt size. */
   11.43  } netif_rx_response_t;
   11.44  
   11.45  /*
   11.46 @@ -53,18 +48,8 @@ typedef u32 NETIF_RING_IDX;
   11.47  #define MASK_NETIF_RX_IDX(_i) ((_i)&(NETIF_RX_RING_SIZE-1))
   11.48  #define MASK_NETIF_TX_IDX(_i) ((_i)&(NETIF_TX_RING_SIZE-1))
   11.49  
   11.50 -#ifdef __x86_64__
   11.51 -/*
   11.52 - * This restriction can be lifted when we move netfront/netback to use
   11.53 - * grant tables. This will remove memory_t fields from the above structures
   11.54 - * and thus relax natural alignment restrictions.
   11.55 - */
   11.56 -#define NETIF_TX_RING_SIZE 128
   11.57 -#define NETIF_RX_RING_SIZE 128
   11.58 -#else
   11.59  #define NETIF_TX_RING_SIZE 256
   11.60  #define NETIF_RX_RING_SIZE 256
   11.61 -#endif
   11.62  
   11.63  /* This structure must fit in a memory page. */
   11.64  typedef struct netif_tx_interface {