ia64/xen-unstable

changeset 10858:275660d492c6

[NET] front: Move rx req pushing to one spot

This patch moves all rx request pushing to network_alloc_rx_buffers.
This is needed to reduce churn for TSO. More importantly, this makes
it easier to send notifications when adding rx requests which is
required for having a queue in dom0.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
author kfraser@localhost.localdomain
date Fri Jul 28 17:03:26 2006 +0100 (2006-07-28)
parents 762ae310d878
children 2e91ad1a89ce
files linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Fri Jul 28 17:00:10 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Fri Jul 28 17:03:26 2006 +0100
     1.3 @@ -600,14 +600,17 @@ static void network_alloc_rx_buffers(str
     1.4  			/* Could not allocate any skbuffs. Try again later. */
     1.5  			mod_timer(&np->rx_refill_timer,
     1.6  				  jiffies + (HZ/10));
     1.7 -			return;
     1.8 +			break;
     1.9  		}
    1.10  		__skb_queue_tail(&np->rx_batch, skb);
    1.11  	}
    1.12  
    1.13  	/* Is the batch large enough to be worthwhile? */
    1.14 -	if (i < (np->rx_target/2))
    1.15 +	if (i < (np->rx_target/2)) {
    1.16 +		if (req_prod > np->rx.sring->req_prod)
    1.17 +			goto push;
    1.18  		return;
    1.19 +	}
    1.20  
    1.21  	/* Adjust our fill target if we risked running out of buffers. */
    1.22  	if (((req_prod - np->rx.sring->rsp_prod) < (np->rx_target / 4)) &&
    1.23 @@ -678,6 +681,7 @@ static void network_alloc_rx_buffers(str
    1.24  
    1.25  	/* Above is a suitable barrier to ensure backend will see requests. */
    1.26  	np->rx.req_prod_pvt = req_prod + i;
    1.27 + push:
    1.28  	RING_PUSH_REQUESTS(&np->rx);
    1.29  }
    1.30  
    1.31 @@ -875,7 +879,6 @@ static void xennet_move_rx_slot(struct n
    1.32  	RING_GET_REQUEST(&np->rx, np->rx.req_prod_pvt)->id = new;
    1.33  	RING_GET_REQUEST(&np->rx, np->rx.req_prod_pvt)->gref = ref;
    1.34  	np->rx.req_prod_pvt++;
    1.35 -	RING_PUSH_REQUESTS(&np->rx);
    1.36  }
    1.37  
    1.38  static int netif_poll(struct net_device *dev, int *pbudget)
    1.39 @@ -1207,7 +1210,6 @@ static void network_connect(struct net_d
    1.40  	}
    1.41  
    1.42  	np->rx.req_prod_pvt = requeue_idx;
    1.43 -	RING_PUSH_REQUESTS(&np->rx);
    1.44  
    1.45  	/*
    1.46  	 * Step 3: All public and private state should now be sane.  Get