ia64/xen-unstable

changeset 11784:fe54ba10e9ef

[NET] front: Fix error handling to correctly skip bogus frags.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Thu Oct 12 10:38:45 2006 +0100 (2006-10-12)
parents f7d65fb7299b
children bd2be8a8fc72
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	Tue Oct 10 22:04:01 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Thu Oct 12 10:38:45 2006 +0100
     1.3 @@ -1120,6 +1120,7 @@ static int xennet_get_responses(struct n
     1.4  			if (net_ratelimit())
     1.5  				WPRINTK("rx->offset: %x, size: %u\n",
     1.6  					rx->offset, rx->status);
     1.7 +			xennet_move_rx_slot(np, skb, ref);
     1.8  			err = -EINVAL;
     1.9  			goto next;
    1.10  		}
    1.11 @@ -1130,7 +1131,8 @@ static int xennet_get_responses(struct n
    1.12  		 * situation to the system controller to reboot the backed.
    1.13  		 */
    1.14  		if (ref == GRANT_INVALID_REF) {
    1.15 -			WPRINTK("Bad rx response id %d.\n", rx->id);
    1.16 +			if (net_ratelimit())
    1.17 +				WPRINTK("Bad rx response id %d.\n", rx->id);
    1.18  			err = -EINVAL;
    1.19  			goto next;
    1.20  		}
    1.21 @@ -1202,6 +1204,9 @@ next:
    1.22  		err = -E2BIG;
    1.23  	}
    1.24  
    1.25 +	if (unlikely(err))
    1.26 +		np->rx.rsp_cons = cons + frags;
    1.27 +
    1.28  	*pages_flipped_p = pages_flipped;
    1.29  
    1.30  	return err;
    1.31 @@ -1306,9 +1311,9 @@ static int netif_poll(struct net_device 
    1.32  	rp = np->rx.sring->rsp_prod;
    1.33  	rmb(); /* Ensure we see queued responses up to 'rp'. */
    1.34  
    1.35 -	for (i = np->rx.rsp_cons, work_done = 0;
    1.36 -	     (i != rp) && (work_done < budget);
    1.37 -	     np->rx.rsp_cons = ++i, work_done++) {
    1.38 +	i = np->rx.rsp_cons;
    1.39 +	work_done = 0;
    1.40 +	while ((i != rp) && (work_done < budget)) {
    1.41  		memcpy(rx, RING_GET_RESPONSE(&np->rx, i), sizeof(*rx));
    1.42  		memset(extras, 0, sizeof(extras));
    1.43  
    1.44 @@ -1316,12 +1321,11 @@ static int netif_poll(struct net_device 
    1.45  					   &pages_flipped);
    1.46  
    1.47  		if (unlikely(err)) {
    1.48 -err:
    1.49 -			i = np->rx.rsp_cons + skb_queue_len(&tmpq) - 1;
    1.50 -			work_done--;
    1.51 +err:	
    1.52  			while ((skb = __skb_dequeue(&tmpq)))
    1.53  				__skb_queue_tail(&errq, skb);
    1.54  			np->stats.rx_errors++;
    1.55 +			i = np->rx.rsp_cons;
    1.56  			continue;
    1.57  		}
    1.58  
    1.59 @@ -1333,6 +1337,7 @@ err:
    1.60  
    1.61  			if (unlikely(xennet_set_skb_gso(skb, gso))) {
    1.62  				__skb_queue_head(&tmpq, skb);
    1.63 +				np->rx.rsp_cons += skb_queue_len(&tmpq);
    1.64  				goto err;
    1.65  			}
    1.66  		}
    1.67 @@ -1396,6 +1401,9 @@ err:
    1.68  		np->stats.rx_bytes += skb->len;
    1.69  
    1.70  		__skb_queue_tail(&rxq, skb);
    1.71 +
    1.72 +		np->rx.rsp_cons = ++i;
    1.73 +		work_done++;
    1.74  	}
    1.75  
    1.76  	if (pages_flipped) {