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
#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"
#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;
}
#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;
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
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);
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);
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
{
struct netfront2 *nf;
+ printk("<0>Found an nc2 interface.\n");
nf = kzalloc(sizeof(*nf), GFP_KERNEL);
if (nf == NULL)
goto 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
.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)
if (!is_running_on_xen())
return -ENODEV;
#endif
+ printk("<0>Hello world.\n");
return xenbus_register_frontend(&netfront2);
}
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;
*/
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);
/* 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