]> xenbits.xensource.com Git - people/ssmith/nc2-2.6.27.git/commitdiff
Add support to netback for delivering packets at a certain offset into
authorSteven Smith <ssmith@weybridge.uk.xensource.com>
Tue, 30 Jun 2009 11:55:48 +0000 (12:55 +0100)
committerSteven Smith <ssmith@weybridge.uk.xensource.com>
Tue, 30 Jun 2009 11:55:48 +0000 (12:55 +0100)
the page.

drivers/xen/netback/common.h
drivers/xen/netback/netback.c
drivers/xen/netback/xenbus.c

index 813612a5d3906cf7b6d4216bc37c5e14d36ce368..c9ff79113c0a8c1b3207148d74b58bb4982589e4 100644 (file)
@@ -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;
index cb2d56229658b3de7b0e39d3fea381a78d0cf428..d6ccd0a48bd967d2fd1ae4fbf0d754f0ff7e6edc 100644 (file)
@@ -412,8 +412,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;
index e0a0dea425b4f4cdd3f07b3fb00c83d8d2fccde5..f95acb835305f1e3cd71b2f3c79e65433851b641 100644 (file)
@@ -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).
@@ -347,7 +355,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;
 
@@ -377,6 +385,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)