From: t_jeang Date: Tue, 6 Jan 2009 12:06:01 +0000 (+0000) Subject: Add support to netback for delivering packets at a certain offset into X-Git-Tag: blktap2 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=e0fc7c5daa0f77d9acbc8b438f29008470cb3a40;p=xenclient%2Fkernel.git Add support to netback for delivering packets at a certain offset into the page. --- diff --git a/drivers/xen/netback/common.h b/drivers/xen/netback/common.h index 10a1d58f..44d1dbf1 100644 --- a/drivers/xen/netback/common.h +++ b/drivers/xen/netback/common.h @@ -81,6 +81,7 @@ typedef struct netif_st { /* Internal feature information. */ u8 can_queue:1; /* can queue packets for receiver? */ u8 copying_receiver:1; /* copy packets to receiver? */ + unsigned copying_rx_offset; /* Allow netif_be_start_xmit() to peek ahead in the rx request ring. */ RING_IDX rx_req_cons_peek; diff --git a/drivers/xen/netback/netback.c b/drivers/xen/netback/netback.c index d771bf06..526f0fe1 100644 --- a/drivers/xen/netback/netback.c +++ b/drivers/xen/netback/netback.c @@ -409,8 +409,13 @@ static u16 netbk_gop_frag(netif_t *netif, struct netbk_rx_meta *meta, } copy_gop->source.offset = offset; copy_gop->dest.domid = netif->domid; - copy_gop->dest.offset = 0; + if (i == 0) + copy_gop->dest.offset = netif->copying_rx_offset; + else + copy_gop->dest.offset = 0; copy_gop->dest.u.ref = req->gref; + /* We rely on Xen to enforce that offset + size <= + * PAGE_SIZE */ copy_gop->len = size; } else { meta->copy = 0; diff --git a/drivers/xen/netback/xenbus.c b/drivers/xen/netback/xenbus.c index d7faeb62..a7835068 100644 --- a/drivers/xen/netback/xenbus.c +++ b/drivers/xen/netback/xenbus.c @@ -104,6 +104,14 @@ static int netback_probe(struct xenbus_device *dev, goto abort_transaction; } + /* We rx-copy at an offset.. */ + err = xenbus_printf(xbt, dev->nodename, + "feature-rx-copy-offset", "%d", 1); + if (err) { + message = "writing feature-rx-copy-offset"; + goto abort_transaction; + } + /* * We don't support rx-flip path (except old guests who don't * grok this feature flag). @@ -352,7 +360,7 @@ static int connect_rings(struct backend_info *be) { struct xenbus_device *dev = be->dev; unsigned long tx_ring_ref, rx_ring_ref; - unsigned int evtchn, rx_copy; + unsigned int evtchn, rx_copy, rx_copy_offset; int err; int val; @@ -382,6 +390,19 @@ static int connect_rings(struct backend_info *be) } be->netif->copying_receiver = !!rx_copy; + err = xenbus_scanf(XBT_NIL, dev->otherend, "request-rx-copy-offset", + "%u", &rx_copy_offset); + if (err == -ENOENT) { + err = 0; + rx_copy_offset = 0; + } + if (err < 0) { + xenbus_dev_fatal(dev, err, "reading %s/request-rx-copy-offset", + dev->otherend); + return err; + } + be->netif->copying_rx_offset = rx_copy_offset; + if (be->netif->dev->tx_queue_len != 0) { if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-rx-notify", "%d", &val) < 0)