ia64/xen-unstable

changeset 11785:bd2be8a8fc72

[NET] back: Fix inter-domain networking when using rx-copy path.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Thu Oct 12 10:56:41 2006 +0100 (2006-10-12)
parents fe54ba10e9ef
children 4fdcccd22352
files linux-2.6-xen-sparse/drivers/xen/netback/netback.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Thu Oct 12 10:38:45 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Thu Oct 12 10:56:41 2006 +0100
     1.3 @@ -78,7 +78,7 @@ static inline unsigned long idx_to_kaddr
     1.4  
     1.5  #define PKT_PROT_LEN 64
     1.6  
     1.7 -static struct {
     1.8 +static struct pending_tx_info {
     1.9  	netif_tx_request_t req;
    1.10  	netif_t *netif;
    1.11  } pending_tx_info[MAX_PENDING_REQS];
    1.12 @@ -374,14 +374,22 @@ static u16 netbk_gop_frag(netif_t *netif
    1.13  		   flipped. */
    1.14  		meta->copy = 1;
    1.15  		copy_gop = npo->copy + npo->copy_prod++;
    1.16 -		copy_gop->source.domid = DOMID_SELF;
    1.17 +		copy_gop->flags = GNTCOPY_dest_gref;
    1.18 +		if (PageForeign(page)) {
    1.19 +			struct pending_tx_info *src_pend =
    1.20 +				&pending_tx_info[page->index];
    1.21 +			copy_gop->source.domid = src_pend->netif->domid;
    1.22 +			copy_gop->source.u.ref = src_pend->req.gref;
    1.23 +			copy_gop->flags |= GNTCOPY_source_gref;
    1.24 +		} else {
    1.25 +			copy_gop->source.domid = DOMID_SELF;
    1.26 +			copy_gop->source.u.gmfn = old_mfn;
    1.27 +		}
    1.28  		copy_gop->source.offset = offset;
    1.29 -		copy_gop->source.u.gmfn = old_mfn;
    1.30  		copy_gop->dest.domid = netif->domid;
    1.31  		copy_gop->dest.offset = 0;
    1.32  		copy_gop->dest.u.ref = req->gref;
    1.33  		copy_gop->len = size;
    1.34 -		copy_gop->flags = GNTCOPY_dest_gref;
    1.35  	} else {
    1.36  		meta->copy = 0;
    1.37  		if (!xen_feature(XENFEAT_auto_translated_physmap)) {