]> xenbits.xensource.com Git - xenclient/kernel.git/commitdiff
Add support to netback for delivering packets at a certain offset into blktap2
authort_jeang <devnull@localhost>
Tue, 6 Jan 2009 12:06:01 +0000 (12:06 +0000)
committert_jeang <devnull@localhost>
Tue, 6 Jan 2009 12:06:01 +0000 (12:06 +0000)
the page.

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

index 10a1d58f59d944bb5f72203640d9d52165dc125e..44d1dbf1def0f31bf8c97bded29d043989e3408f 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 d771bf067ed8126e5cccd82e2d476fef951bce6b..526f0fe18a45fd74c3378afbbf0e87baa4767bc1 100644 (file)
@@ -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;
index d7faeb624d1d2718f7d410fd7027c17029f08e63..a7835068ac655062e0215613f3b7e81198909af4 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).
@@ -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)