]> xenbits.xensource.com Git - people/ssmith/netchannel2-pvops.bak.git/.git/commitdiff
Make the frontend work again.
authorSteven Smith <ssmith@weybridge.uk.xensource.com>
Thu, 16 Apr 2009 12:19:55 +0000 (13:19 +0100)
committerSteven Smith <ssmith@weybridge.uk.xensource.com>
Tue, 19 May 2009 14:02:40 +0000 (15:02 +0100)
drivers/net/xen-netchannel2/Makefile
drivers/net/xen-netchannel2/chan.c
drivers/net/xen-netchannel2/netchannel2_core.h
drivers/net/xen-netchannel2/netchannel2_endpoint.h
drivers/net/xen-netchannel2/netfront2.c
drivers/xen/events.c
drivers/xen/xenbus/xenbus_client.c
include/xen/events.h

index 69d510282d893f7a6396f874a4f425b196a16914..4ae3d3e2ffe2f77dddc10b2e1316ce99693e6082 100644 (file)
@@ -30,9 +30,7 @@ ifeq ($(CONFIG_XEN_NETDEV2_BACKEND),y)
 netchannel2-objs += netback2.o
 endif
 
-ifeq ($(CONFIG_XEN_NETDEV2_FRONTEND),y)
 netchannel2-objs += netfront2.o
-endif
 
 ifeq ($(CONFIG_XEN_NETDEV2_VMQ),y)
 netchannel2-objs += vmq.o
index 90fca1e904231bf5752b888c1f98b3d61609f949..c2a88db507171464604617950a3a98cc4e2783a7 100644 (file)
@@ -8,12 +8,8 @@
 #include <linux/spinlock.h>
 #include <linux/delay.h>
 #include <linux/version.h>
-#ifdef CONFIG_PARAVIRT
 #include <xen/interface/xen.h>
 #include <xen/events.h>
-#else
-#include <xen/evtchn.h>
-#endif
 #include <xen/xenbus.h>
 
 #include "netchannel2_endpoint.h"
@@ -60,7 +56,7 @@ static void nc2_enable_irq(struct netchannel2_ring_pair *ncrp)
 #endif
 }
 
-irqreturn_t nc2_int(int irq, void *dev_id, struct pt_regs *ptregs)
+irqreturn_t nc2_int(int irq, void *dev_id)
 {
         struct netchannel2_ring_pair *ncr = dev_id;
 
@@ -959,10 +955,8 @@ int nc2_connect_evtchn(struct netchannel2 *nc, domid_t domid,
 }
 #endif
 
-#if defined(CONFIG_XEN_NETDEV2_FRONTEND)
 /* Listen for incoming event channel connections from domain domid.
    Similar semantics to nc2_connect_evtchn(). */
-#ifdef CONFIG_PARAVIRT
 int nc2_listen_evtchn(struct netchannel2 *nc, domid_t domid)
 {
         int err;
@@ -981,28 +975,6 @@ int nc2_listen_evtchn(struct netchannel2 *nc, domid_t domid)
         nc->rings.irq = err;
         return 0;
 }
-#else
-int nc2_listen_evtchn(struct netchannel2 *nc, domid_t domid)
-{
-        int err;
-
-        BUG_ON(nc->rings.irq >= 0);
-
-        err = bind_listening_port_to_irqhandler(domid,
-                                                nc2_int,
-                                                IRQF_SAMPLE_RANDOM,
-                                                "netchannel2",
-                                                &nc->rings);
-        if (err >= 0) {
-                nc->rings.irq = err;
-                nc->rings.evtchn = irq_to_evtchn_port(err);
-                return 0;
-        } else {
-                return err;
-        }
-}
-#endif
-#endif
 
 /* Find the local event channel port which was allocated by
  * nc2_listen_evtchn() or nc2_connect_evtchn().  It is an error to
index 7c5f46a665c6441b7bf232ac6f3ea99fc0aefe82..315877973a401e2d1b1d8476e64915fa4d531338 100644 (file)
@@ -1041,7 +1041,7 @@ void queue_packet_to_interface(struct sk_buff *skb,
 unsigned get_transmitted_packet_msg_size(struct sk_buff *skb);
 void init_ring_pair(struct netchannel2_ring_pair *ncrp);
 
-irqreturn_t nc2_int(int irq, void *dev_id, struct pt_regs *ptregs);
+irqreturn_t nc2_int(int irq, void *dev_id);
 
 void cleanup_ring_pair(struct netchannel2_ring_pair *ncrp);
 void nc2_rscb_on_gntcopy_fail(void *ctxt, gnttab_copy_t *gop);
index ca3a7078e5a00fcf52b07c80f1385ef66559f8fa..ff38dd42e333eac346bff9ce7cb01a4b929db188 100644 (file)
@@ -24,9 +24,7 @@ int nc2_attach_rings(struct netchannel2 *nc,
                      size_t prod_size,
                      domid_t otherend_id);
 void nc2_detach_rings(struct netchannel2 *nc);
-#if defined(CONFIG_XEN_NETDEV2_FRONTEND)
 int nc2_listen_evtchn(struct netchannel2 *nc, domid_t dom);
-#endif
 #if defined(CONFIG_XEN_NETDEV2_BACKEND)
 int nc2_connect_evtchn(struct netchannel2 *nc, domid_t domid,
                        int evtchn);
@@ -37,18 +35,8 @@ void nc2_suspend(struct netchannel2 *nc);
 void nc2_set_nr_tx_buffers(struct netchannel2 *nc, unsigned nr_buffers);
 
 /* Interface which the endpoints provide to the core. */
-#ifdef CONFIG_XEN_NETDEV2_FRONTEND
 int __init netfront2_init(void);
 void __exit netfront2_exit(void);
-#else
-static inline int netfront2_init(void)
-{
-    return 0;
-}
-static inline void netfront2_exit(void)
-{
-}
-#endif
 #ifdef CONFIG_XEN_NETDEV2_BACKEND
 int __init netback2_init(void);
 #else
index 0894740bda4e46506684f3f07b122808267bc8c4..57997b7eb07a9b78701fa093b488aa2e1d6e43b2 100644 (file)
@@ -453,6 +453,7 @@ static int __devinit netfront_probe(struct xenbus_device *xd,
 {
         struct netfront2 *nf;
 
+       printk("<0>Found an nc2 interface.\n");
         nf = kzalloc(sizeof(*nf), GFP_KERNEL);
         if (nf == NULL)
                 goto err;
@@ -474,17 +475,6 @@ err:
         return -ENOMEM;
 }
 
-static int netfront_suspend(struct xenbus_device *xd)
-{
-        /* We're about to suspend.  Do the minimum amount of work to
-           make that safe. */
-        struct netfront2 *nf = xenbus_device_to_nf2(xd);
-
-        nc2_suspend(nf->chan);
-
-        return 0;
-}
-
 static int netfront_resume(struct xenbus_device *xd)
 {
         /* We've been suspended and come back.  The rings are
@@ -523,8 +513,7 @@ static struct xenbus_driver netfront2 = {
        .probe = netfront_probe,
        .remove = __devexit_p(netfront_remove),
        .otherend_changed = backend_changed,
-        .resume = netfront_resume,
-        .suspend = netfront_suspend,
+        .resume = netfront_resume
 };
 
 int __init netfront2_init(void)
@@ -533,6 +522,7 @@ int __init netfront2_init(void)
         if (!is_running_on_xen())
                 return -ENODEV;
 #endif
+       printk("<0>Hello world.\n");
         return xenbus_register_frontend(&netfront2);
 }
 
index a7beb2354091683e0a96a14e8e3482d84a9923d2..d30c75cfd094cd827014fef43a64d212b3d43850 100644 (file)
@@ -775,6 +775,23 @@ int bind_virq_to_irq(unsigned int virq, unsigned int cpu)
        return irq;
 }
 
+int xen_alloc_evtchn(domid_t otherend_id)
+{
+       struct evtchn_alloc_unbound alloc_unbound;
+       int err;
+
+       alloc_unbound.dom = DOMID_SELF;
+       alloc_unbound.remote_dom = otherend_id;
+
+       err = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound,
+                                         &alloc_unbound);
+       if (err)
+               return err;
+       else
+               return alloc_unbound.port;
+}
+EXPORT_SYMBOL_GPL(xen_alloc_evtchn);
+
 static void unbind_from_irq(unsigned int irq)
 {
        struct evtchn_close close;
index 92a1ef80a288173a7ccae8d5fc10f484d1acd613..b39e0d85b99ea9cbcf4182402d0f7f3abc6fc998 100644 (file)
@@ -309,20 +309,16 @@ EXPORT_SYMBOL_GPL(xenbus_grant_ring);
  */
 int xenbus_alloc_evtchn(struct xenbus_device *dev, int *port)
 {
-       struct evtchn_alloc_unbound alloc_unbound;
        int err;
 
-       alloc_unbound.dom = DOMID_SELF;
-       alloc_unbound.remote_dom = dev->otherend_id;
-
-       err = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound,
-                                         &alloc_unbound);
-       if (err)
+       err = xen_alloc_evtchn(dev->otherend_id);
+       if (err < 0) {
                xenbus_dev_fatal(dev, err, "allocating event channel");
-       else
-               *port = alloc_unbound.port;
-
-       return err;
+               return err;
+       } else {
+               *port = err;
+               return 0;
+       }
 }
 EXPORT_SYMBOL_GPL(xenbus_alloc_evtchn);
 
index a5d4a5d54c93d2aa4c6fe2ff5167bee82a19fc0e..571046df40d6ad63df21b6aa168b46a86aa33cf1 100644 (file)
@@ -78,6 +78,8 @@ int xen_vector_from_irq(unsigned pirq);
 /* Return gsi allocated to pirq */
 int xen_gsi_from_irq(unsigned pirq);
 
+int xen_alloc_evtchn(domid_t otherend_id);
+
 #ifdef CONFIG_XEN_DOM0_PCI
 void xen_setup_pirqs(void);
 #else