]> xenbits.xensource.com Git - people/ssmith/netchannel2-pvops.bak.git/.git/commitdiff
Get bypass support working on the pvops kernel.
authorSteven Smith <ssmith@weybridge.uk.xensource.com>
Mon, 20 Apr 2009 13:20:28 +0000 (14:20 +0100)
committerSteven Smith <ssmith@weybridge.uk.xensource.com>
Tue, 19 May 2009 14:04:14 +0000 (15:04 +0100)
drivers/net/Kconfig
drivers/net/xen-netchannel2/bypass.c
drivers/net/xen-netchannel2/bypassee.c

index 211c2fadc3fee98879e2295017969adac98a13e1..0f9b949835c283ed081b364dc16c50784ded728a 100644 (file)
@@ -2735,6 +2735,28 @@ config XEN_NETCHANNEL2
        help
          Support for Xen version 2 network devices
 
+config XEN_NETDEV2_BYPASSABLE
+       bool "Allow netchannel2 interfaces in this domain to be bypassed"
+       depends on XEN_NETCHANNEL2
+       default y
+       help
+         Netchannel2 allows interdomain traffic to be sent directly from
+         one domain to another, without going through domain 0, which can
+         significantly increase performance.  This option controls whether
+         interfaces created into this domain can be bypassed in this way.
+         You should also say yes to XEN_NETDEV2_BYPASS_ENDPOINT in the
+         frontend domains for this to be useful.
+
+config XEN_NETDEV2_BYPASS_ENDPOINT
+       bool "Allow netchannel2 interfaces in this domain to establish bypasses"
+       depends on XEN_NETCHANNEL2
+       default y
+       help
+         Netchannel2 allows interdomain traffic to be sent directly from
+         one domain to another, without going through domain 0, which can
+         significantly increase performance.  This option controls whether
+         interfaces in this domain can be the endpoints of these bypasses.
+
 config ISERIES_VETH
        tristate "iSeries Virtual Ethernet driver support"
        depends on PPC_ISERIES
index 582c8f2c851354e6e46ec75413db99768cecdfd2..91917ee035cd9a7883d4d6663f81376d59aa868e 100644 (file)
@@ -3,7 +3,8 @@
 #include <linux/interrupt.h>
 #include <linux/delay.h>
 #include <xen/evtchn.h>
-#include <xen/driver_util.h>
+#include <xen/events.h>
+#include <asm/xen/page.h>
 #include "netchannel2_core.h"
 
 /* Can we send this packet on this bypass?  True if the destination
@@ -95,9 +96,10 @@ void nc2_aux_ring_start_disable_sequence(struct nc2_alternate_ring *nar)
         spin_unlock(&nar->rings.lock);
 }
 
-static void start_detach_worker(void *data)
+static void start_detach_worker(struct work_struct *ws)
 {
-        struct nc2_alternate_ring *ncr = data;
+        struct nc2_alternate_ring *ncr =
+               container_of(ws, struct nc2_alternate_ring, detach_work_item);
 
         ENTER();
 
@@ -143,8 +145,7 @@ void nc2_aux_ring_start_detach_sequence(struct nc2_alternate_ring *nar)
         /* We can't do unbind_from_irqhandler() from a tasklet, so
            punt it to a workitem. */
         INIT_WORK(&nar->detach_work_item,
-                  start_detach_worker,
-                  nar);
+                  start_detach_worker);
         schedule_work(&nar->detach_work_item);
 }
 
@@ -186,8 +187,7 @@ void _nc2_crank_aux_ring_state_machine(struct netchannel2 *nc)
                                 spin_unlock(&nar->rings.lock);
                                 return;
                         }
-                        frontend_ready_msg.port =
-                                irq_to_evtchn_port(nar->rings.irq);
+                        frontend_ready_msg.port = nar->rings.evtchn;
                         nc2_send_message(&nc->rings.prod_ring,
                                          NETCHANNEL2_MSG_BYPASS_FRONTEND_READY,
                                          0,
@@ -386,9 +386,10 @@ void _nc2_alternate_ring_disable_finish(struct nc2_alternate_ring *ncr)
         nc2_kick(&ncr->rings.interface->rings);
 }
 
-static void initialise_bypass_frontend_work_item(void *data)
+static void initialise_bypass_frontend_work_item(struct work_struct *ws)
 {
-        struct nc2_alternate_ring *ncr = data;
+        struct nc2_alternate_ring *ncr =
+               container_of(ws, struct nc2_alternate_ring, work_item);
         struct netchannel2 *interface = ncr->rings.interface;
         int err;
 
@@ -400,13 +401,14 @@ static void initialise_bypass_frontend_work_item(void *data)
 
         BUG_ON(ncr->rings.cons_ring.sring == NULL);
 
-        err = bind_listening_port_to_irqhandler(ncr->rings.otherend_id,
-                                                nc2_int,
-                                                0,
-                                                "netchannel2_bypass",
-                                                &ncr->rings);
-        if (err < 0)
-                goto err;
+       err = xen_alloc_evtchn(ncr->rings.otherend_id);
+       if (err < 0)
+               goto err;
+       ncr->rings.evtchn = err;
+       err = bind_evtchn_to_irqhandler(ncr->rings.evtchn,
+                                       nc2_int, 0,
+                                       "netchannel2", &ncr->rings);
+       BUG_ON(err < 0);
         ncr->rings.irq = err;
 
         /* Get it going. */
@@ -440,9 +442,10 @@ err:
         return;
 }
 
-static void initialise_bypass_backend_work_item(void *data)
+static void initialise_bypass_backend_work_item(struct work_struct *ws)
 {
-        struct nc2_alternate_ring *ncr = data;
+        struct nc2_alternate_ring *ncr =
+               container_of(ws, struct nc2_alternate_ring, work_item);
         struct netchannel2 *interface = ncr->rings.interface;
         int err;
 
@@ -560,8 +563,7 @@ void nc2_handle_bypass_frontend(struct netchannel2 *nc,
 #endif
         init_waitqueue_head(&work->eventq);
         work->handle = work->frontend_setup_msg.common.handle;
-        INIT_WORK(&work->work_item, initialise_bypass_frontend_work_item,
-                  work);
+        INIT_WORK(&work->work_item, initialise_bypass_frontend_work_item);
         init_ring_pair(&work->rings);
         work->rings.filter_mac = 1;
         work->rings.interface = nc;
@@ -630,8 +632,7 @@ void nc2_handle_bypass_backend(struct netchannel2 *nc,
         work->state = nc2_alt_ring_backend_preparing;
         init_waitqueue_head(&work->eventq);
         work->handle = work->backend_setup_msg.common.handle;
-        INIT_WORK(&work->work_item, initialise_bypass_backend_work_item,
-                  work);
+        INIT_WORK(&work->work_item, initialise_bypass_backend_work_item);
         init_ring_pair(&work->rings);
         work->rings.filter_mac = 1;
         work->rings.interface = nc;
@@ -815,8 +816,7 @@ void detach_all_bypasses(struct netchannel2 *nc)
                         nar->state = nc2_alt_ring_detaching;
                         spin_unlock(&nar->rings.lock);
                         INIT_WORK(&nar->detach_work_item,
-                                  start_detach_worker,
-                                  nar);
+                                  start_detach_worker);
                         schedule_work(&nar->detach_work_item);
                 }
                 spin_unlock_bh(&nc->rings.lock);
index a166e564e6c231f65aea3527a202b2cbff608c28..e0b273fdd49c1352f9ca61844036bc152f88fc31 100644 (file)
@@ -2,6 +2,7 @@
 #include <linux/kernel.h>
 #include <linux/delay.h>
 #include <linux/spinlock.h>
+#include <asm/xen/page.h>
 #include "netchannel2_core.h"
 
 /* Bypass disable is a bit tricky.  Enable is relatively easy:
@@ -104,7 +105,7 @@ static void schedule_disable(struct nc2_bypass_endpoint *ep)
 
 static void grant_end(grant_ref_t *gref)
 {
-        if (*gref && gnttab_end_foreign_access_ref(*gref)) {
+        if (*gref && gnttab_end_foreign_access_ref(*gref, 0)) {
                 gnttab_free_grant_reference(*gref);
                 *gref = 0;
         }
@@ -276,9 +277,11 @@ void nc2_handle_bypass_detached(struct netchannel2 *nc,
                  msg.handle);
 }
 
-static void process_suggestion_queue_workitem(void *ctxt)
+static void process_suggestion_queue_workitem(struct work_struct *ws)
 {
-        struct netchannel2 *nc = ctxt;
+        struct netchannel2 *nc =
+               container_of(ws, struct netchannel2,
+                            incoming_bypass_suggestions.workitem);
         struct nc2_incoming_bypass_suggestions *sugg =
                 &nc->incoming_bypass_suggestions;
         unsigned ind;
@@ -803,5 +806,5 @@ void nc2_init_incoming_bypass_suggestions(
         struct nc2_incoming_bypass_suggestions *nibs)
 {
         spin_lock_init(&nibs->lock);
-        INIT_WORK(&nibs->workitem, process_suggestion_queue_workitem, nc2);
+        INIT_WORK(&nibs->workitem, process_suggestion_queue_workitem);
 }