]> xenbits.xensource.com Git - people/ssmith/nc2-2.6.27.git/commitdiff
patch forward-port-drivers-xen.patch
authorSteven Smith <ssmith@weybridge.uk.xensource.com>
Tue, 30 Jun 2009 11:55:47 +0000 (12:55 +0100)
committerSteven Smith <ssmith@weybridge.uk.xensource.com>
Tue, 30 Jun 2009 11:55:47 +0000 (12:55 +0100)
45 files changed:
drivers/xen/Kconfig
drivers/xen/balloon/balloon.c
drivers/xen/balloon/sysfs.c
drivers/xen/blkback/blkback.c
drivers/xen/blkback/common.h
drivers/xen/blkback/interface.c
drivers/xen/blkback/xenbus.c
drivers/xen/blkfront/blkfront.c
drivers/xen/blkfront/block.h
drivers/xen/blkfront/vbd.c
drivers/xen/blktap/blktap.c
drivers/xen/blktap/common.h
drivers/xen/blktap/interface.c
drivers/xen/blktap/xenbus.c
drivers/xen/console/console.c
drivers/xen/netback/accel.c
drivers/xen/netback/common.h
drivers/xen/netback/interface.c
drivers/xen/netback/loopback.c
drivers/xen/netback/netback.c
drivers/xen/netback/xenbus.c
drivers/xen/netfront/accel.c
drivers/xen/netfront/netfront.c
drivers/xen/netfront/netfront.h
drivers/xen/pciback/conf_space_header.c
drivers/xen/pciback/pciback.h
drivers/xen/pciback/pciback_ops.c
drivers/xen/pciback/xenbus.c
drivers/xen/privcmd/compat_privcmd.c
drivers/xen/privcmd/privcmd.c
drivers/xen/sfc_netback/accel.h
drivers/xen/sfc_netback/accel_fwd.c
drivers/xen/sfc_netback/accel_solarflare.c
drivers/xen/sfc_netback/accel_xenbus.c
drivers/xen/sfc_netback/ci/efrm/nic_table.h
drivers/xen/sfc_netfront/accel.h
drivers/xen/sfc_netfront/accel_msg.c
drivers/xen/sfc_netfront/accel_tso.c
drivers/xen/sfc_netfront/accel_vi.c
drivers/xen/sfc_netfront/accel_xenbus.c
drivers/xen/sfc_netutil/accel_util.h
drivers/xen/xenbus/xenbus_comms.c
drivers/xen/xenbus/xenbus_probe.c
drivers/xen/xenbus/xenbus_probe.h
drivers/xen/xenbus/xenbus_probe_backend.c

index 99373b57b766f1912238107a269593bace3b2724..c672d059711c899df6e30b3dc8ed750e4d9f1b50 100644 (file)
@@ -73,15 +73,6 @@ config XEN_NETDEV_BACKEND
          network devices to other guests via a high-performance shared-memory
          interface.
 
-config XEN_NETDEV_TX_SHIFT
-       int "Maximum simultaneous transmit requests (as a power of 2)"
-       depends on XEN_NETDEV_BACKEND
-       range 5 16
-       default 8
-       help
-         The maximum number transmits the driver can hold pending, expressed
-         as the exponent of a power of 2.
-
 config XEN_NETDEV_PIPELINED_TRANSMITTER
        bool "Pipelined transmitter (DANGEROUS)"
        depends on XEN_NETDEV_BACKEND
index f2fbf318458edcd4cb5790145ed4a07759a2f626..d0ee16cd279c0d1634d58eaa27f37ccca4997a75 100644 (file)
@@ -84,7 +84,7 @@ static unsigned long frame_list[PAGE_SIZE / sizeof(unsigned long)];
 /* VM /proc information for memory */
 extern unsigned long totalram_pages;
 
-#ifndef MODULE
+#if !defined(MODULE) && defined(CONFIG_HIGHMEM)
 extern unsigned long totalhigh_pages;
 #define inc_totalhigh_pages() (totalhigh_pages++)
 #define dec_totalhigh_pages() (totalhigh_pages--)
@@ -97,8 +97,8 @@ extern unsigned long totalhigh_pages;
 static LIST_HEAD(ballooned_pages);
 
 /* Main work function, always executed in process context. */
-static void balloon_process(void *unused);
-static DECLARE_WORK(balloon_worker, balloon_process, NULL);
+static void balloon_process(struct work_struct *unused);
+static DECLARE_WORK(balloon_worker, balloon_process);
 static struct timer_list balloon_timer;
 
 /* When ballooning out (allocating memory to return to Xen) we don't really 
@@ -389,7 +389,7 @@ static int decrease_reservation(unsigned long nr_pages)
  * by the balloon lock), or with changes to the Xen hard limit, but we will
  * recover from these in time.
  */
-static void balloon_process(void *unused)
+static void balloon_process(struct work_struct *unused)
 {
        int need_sleep = 0;
        long credit;
@@ -684,7 +684,7 @@ struct page **alloc_empty_pages_and_pagevec(int nr_pages)
        goto out;
 }
 
-void free_empty_pages_and_pagevec(struct page **pagevec, int nr_pages)
+static void _free_empty_pages_and_pagevec(struct page **pagevec, int nr_pages, int free_vec)
 {
        unsigned long flags;
        int i;
@@ -699,11 +699,24 @@ void free_empty_pages_and_pagevec(struct page **pagevec, int nr_pages)
        }
        balloon_unlock(flags);
 
-       kfree(pagevec);
+       if (free_vec)
+               kfree(pagevec);
+       else
+               totalram_pages = bs.current_pages -= nr_pages;
 
        schedule_work(&balloon_worker);
 }
 
+void free_empty_pages_and_pagevec(struct page **pagevec, int nr_pages)
+{
+       _free_empty_pages_and_pagevec(pagevec, nr_pages, 1);
+}
+
+void free_empty_pages(struct page **pagevec, int nr_pages)
+{
+       _free_empty_pages_and_pagevec(pagevec, nr_pages, 0);
+}
+
 void balloon_release_driver_page(struct page *page)
 {
        unsigned long flags;
index 16411cbcca2ac11f375d94f26c2d404c8394a04f..cf9a809c2f753a9a294799ca614d85040c334088 100644 (file)
@@ -44,6 +44,7 @@
 
 #define BALLOON_SHOW(name, format, args...)                    \
        static ssize_t show_##name(struct sys_device *dev,      \
+                                  struct sysdev_attribute *attr, \
                                   char *buf)                   \
        {                                                       \
                return sprintf(buf, format, ##args);            \
@@ -58,14 +59,15 @@ BALLOON_SHOW(hard_limit_kb,
             (bs.hard_limit!=~0UL) ? PAGES2KB(bs.hard_limit) : 0);
 BALLOON_SHOW(driver_kb, "%lu\n", PAGES2KB(bs.driver_pages));
 
-static ssize_t show_target_kb(struct sys_device *dev, char *buf)
+static ssize_t show_target_kb(struct sys_device *dev,
+                             struct sysdev_attribute *attr, char *buf)
 {
        return sprintf(buf, "%lu\n", PAGES2KB(bs.target_pages));
 }
 
 static ssize_t store_target_kb(struct sys_device *dev,
-                              const char *buf,
-                              size_t count)
+                              struct sysdev_attribute *attr,
+                              const char *buf, size_t count)
 {
        char memstring[64], *endchar;
        unsigned long long target_bytes;
@@ -107,7 +109,7 @@ static struct attribute_group balloon_info_group = {
 };
 
 static struct sysdev_class balloon_sysdev_class = {
-       set_kset_name(BALLOON_CLASS_NAME),
+       .name = BALLOON_CLASS_NAME,
 };
 
 static struct sys_device balloon_sysdev;
index a9a74373fd5a5c023b1d1759a29adaa8ba956495..3280e2af7310da267e3f18fa076255f8b7289c7a 100644 (file)
@@ -37,6 +37,7 @@
 
 #include <linux/spinlock.h>
 #include <linux/kthread.h>
+#include <linux/freezer.h>
 #include <linux/list.h>
 #include <linux/delay.h>
 #include <xen/balloon.h>
@@ -153,7 +154,7 @@ static void unplug_queue(blkif_t *blkif)
 
 static void plug_queue(blkif_t *blkif, struct block_device *bdev)
 {
-       request_queue_t *q = bdev_get_queue(bdev);
+       struct request_queue *q = bdev_get_queue(bdev);
 
        if (q == blkif->plug)
                return;
@@ -268,13 +269,10 @@ static void __end_block_io_op(pending_req_t *pending_req, int error)
        }
 }
 
-static int end_block_io_op(struct bio *bio, unsigned int done, int error)
+static void end_block_io_op(struct bio *bio, int error)
 {
-       if (bio->bi_size != 0)
-               return 1;
        __end_block_io_op(bio->bi_private, error);
        bio_put(bio);
-       return error;
 }
 
 
@@ -288,7 +286,7 @@ static void blkif_notify_work(blkif_t *blkif)
        wake_up(&blkif->wq);
 }
 
-irqreturn_t blkif_be_int(int irq, void *dev_id, struct pt_regs *regs)
+irqreturn_t blkif_be_int(int irq, void *dev_id)
 {
        blkif_notify_work(dev_id);
        return IRQ_HANDLED;
index 663bfeefd56c68b3e71b972d800a9540d1689e55..751399b4d25f34e674d31b0a90c029dab1f229ba 100644 (file)
@@ -79,7 +79,7 @@ typedef struct blkif_st {
        wait_queue_head_t   wq;
        struct task_struct  *xenblkd;
        unsigned int        waiting_reqs;
-       request_queue_t     *plug;
+       struct request_queue     *plug;
 
        /* statistics */
        unsigned long       st_print;
@@ -130,7 +130,7 @@ void blkif_interface_init(void);
 
 void blkif_xenbus_init(void);
 
-irqreturn_t blkif_be_int(int irq, void *dev_id, struct pt_regs *regs);
+irqreturn_t blkif_be_int(int irq, void *dev_id);
 int blkif_schedule(void *arg);
 
 int blkback_barrier(struct xenbus_transaction xbt,
index 6df7b734d694d591de1f212249df1faeab0c3a5f..cd38c85d5f36419a2163046a7ea06c1365260f04 100644 (file)
@@ -34,7 +34,7 @@
 #include <xen/evtchn.h>
 #include <linux/kthread.h>
 
-static kmem_cache_t *blkif_cachep;
+static struct kmem_cache *blkif_cachep;
 
 blkif_t *blkif_alloc(domid_t domid)
 {
@@ -177,5 +177,5 @@ void blkif_free(blkif_t *blkif)
 void __init blkif_interface_init(void)
 {
        blkif_cachep = kmem_cache_create("blkif_cache", sizeof(blkif_t), 
-                                        0, 0, NULL, NULL);
+                                        0, 0, NULL);
 }
index 7e689c758117f299dc4969924ac8270168577b2e..0746fd033a11f46e5394ecaa86a8720a8f4b375d 100644 (file)
@@ -527,7 +527,6 @@ static const struct xenbus_device_id blkback_ids[] = {
 
 static struct xenbus_driver blkback = {
        .name = "vbd",
-       .owner = THIS_MODULE,
        .ids = blkback_ids,
        .probe = blkback_probe,
        .remove = blkback_remove,
index c4b1ecd65242608a1552d9a9769c015368d3a69a..cf47a1cbd0885734709f360e09355fb44779c864 100644 (file)
@@ -69,8 +69,8 @@ static int setup_blkring(struct xenbus_device *, struct blkfront_info *);
 
 static void kick_pending_request_queues(struct blkfront_info *);
 
-static irqreturn_t blkif_int(int irq, void *dev_id, struct pt_regs *ptregs);
-static void blkif_restart_queue(void *arg);
+static irqreturn_t blkif_int(int irq, void *dev_id);
+static void blkif_restart_queue(struct work_struct *arg);
 static void blkif_recover(struct blkfront_info *);
 static void blkif_completion(struct blk_shadow *);
 static void blkif_free(struct blkfront_info *, int);
@@ -110,7 +110,7 @@ static int blkfront_probe(struct xenbus_device *dev,
        info->xbdev = dev;
        info->vdevice = vdevice;
        info->connected = BLKIF_STATE_DISCONNECTED;
-       INIT_WORK(&info->work, blkif_restart_queue, (void *)info);
+       INIT_WORK(&info->work, blkif_restart_queue);
 
        for (i = 0; i < BLK_RING_SIZE; i++)
                info->shadow[i].req.id = i+1;
@@ -241,7 +241,7 @@ static int setup_blkring(struct xenbus_device *dev,
        info->ring_ref = err;
 
        err = bind_listening_port_to_irqhandler(
-               dev->otherend_id, blkif_int, SA_SAMPLE_RANDOM, "blkif", info);
+               dev->otherend_id, blkif_int, IRQF_SAMPLE_RANDOM, "blkif", info);
        if (err <= 0) {
                xenbus_dev_fatal(dev, err,
                                 "bind_listening_port_to_irqhandler");
@@ -459,9 +459,9 @@ static void kick_pending_request_queues(struct blkfront_info *info)
        }
 }
 
-static void blkif_restart_queue(void *arg)
+static void blkif_restart_queue(struct work_struct *arg)
 {
-       struct blkfront_info *info = (struct blkfront_info *)arg;
+       struct blkfront_info *info = container_of(arg, struct blkfront_info, work);
        spin_lock_irq(&blkif_io_lock);
        if (info->connected == BLKIF_STATE_CONNECTED)
                kick_pending_request_queues(info);
@@ -587,9 +587,8 @@ static int blkif_queue_request(struct request *req)
        struct blkfront_info *info = req->rq_disk->private_data;
        unsigned long buffer_mfn;
        blkif_request_t *ring_req;
-       struct bio *bio;
        struct bio_vec *bvec;
-       int idx;
+       struct req_iterator iter;
        unsigned long id;
        unsigned int fsect, lsect;
        int ref;
@@ -623,8 +622,7 @@ static int blkif_queue_request(struct request *req)
                ring_req->operation = BLKIF_OP_WRITE_BARRIER;
 
        ring_req->nr_segments = 0;
-       rq_for_each_bio (bio, req) {
-               bio_for_each_segment (bvec, bio, idx) {
+       rq_for_each_segment(bvec, req, iter) {
                        BUG_ON(ring_req->nr_segments
                               == BLKIF_MAX_SEGMENTS_PER_REQUEST);
                        buffer_mfn = page_to_phys(bvec->bv_page) >> PAGE_SHIFT;
@@ -650,7 +648,6 @@ static int blkif_queue_request(struct request *req)
                                        .last_sect  = lsect };
 
                        ring_req->nr_segments++;
-               }
        }
 
        info->ring.req_prod_pvt++;
@@ -667,7 +664,7 @@ static int blkif_queue_request(struct request *req)
  * do_blkif_request
  *  read a block; request is in a request queue
  */
-void do_blkif_request(request_queue_t *rq)
+void do_blkif_request(struct request_queue *rq)
 {
        struct blkfront_info *info = NULL;
        struct request *req;
@@ -712,14 +709,13 @@ void do_blkif_request(request_queue_t *rq)
 }
 
 
-static irqreturn_t blkif_int(int irq, void *dev_id, struct pt_regs *ptregs)
+static irqreturn_t blkif_int(int irq, void *dev_id)
 {
        struct request *req;
        blkif_response_t *bret;
        RING_IDX i, rp;
        unsigned long flags;
        struct blkfront_info *info = (struct blkfront_info *)dev_id;
-       int uptodate;
 
        spin_lock_irqsave(&blkif_io_lock, flags);
 
@@ -744,13 +740,13 @@ static irqreturn_t blkif_int(int irq, void *dev_id, struct pt_regs *ptregs)
 
                ADD_ID_TO_FREELIST(info, id);
 
-               uptodate = (bret->status == BLKIF_RSP_OKAY);
+               ret = bret->status == BLKIF_RSP_OKAY ? 0 : -EIO;
                switch (bret->operation) {
                case BLKIF_OP_WRITE_BARRIER:
                        if (unlikely(bret->status == BLKIF_RSP_EOPNOTSUPP)) {
                                printk("blkfront: %s: write barrier op failed\n",
                                       info->gd->disk_name);
-                               uptodate = -EOPNOTSUPP;
+                               ret = -EOPNOTSUPP;
                                info->feature_barrier = 0;
                                xlvbd_barrier(info);
                        }
@@ -761,10 +757,8 @@ static irqreturn_t blkif_int(int irq, void *dev_id, struct pt_regs *ptregs)
                                DPRINTK("Bad return from blkdev data "
                                        "request: %x\n", bret->status);
 
-                       ret = end_that_request_first(req, uptodate,
-                               req->hard_nr_sectors);
+                       ret = __blk_end_request(req, ret, blk_rq_bytes(req));
                        BUG_ON(ret);
-                       end_that_request_last(req, uptodate);
                        break;
                default:
                        BUG();
@@ -907,7 +901,6 @@ MODULE_ALIAS("xen:vbd");
 
 static struct xenbus_driver blkfront = {
        .name = "vbd",
-       .owner = THIS_MODULE,
        .ids = blkfront_ids,
        .probe = blkfront_probe,
        .remove = blkfront_remove,
index b8f0cf53f7317cb961cf6a871831fb957dead496..2dc01b5c065a9dc4843994642952805182d8c66a 100644 (file)
@@ -105,7 +105,7 @@ struct blkfront_info
        blkif_front_ring_t ring;
        unsigned int irq;
        struct xlbd_major_info *mi;
-       request_queue_t *rq;
+       struct request_queue *rq;
        struct work_struct work;
        struct gnttab_free_callback callback;
        struct blk_shadow shadow[BLK_RING_SIZE];
@@ -129,7 +129,7 @@ extern int blkif_ioctl(struct inode *inode, struct file *filep,
 extern int blkif_getgeo(struct block_device *, struct hd_geometry *);
 extern int blkif_check(dev_t dev);
 extern int blkif_revalidate(dev_t dev);
-extern void do_blkif_request (request_queue_t *rq);
+extern void do_blkif_request (struct request_queue *rq);
 
 /* Virtual block-device subsystem. */
 /* Note that xlvbd_add doesn't call add_disk for you: you're expected
index 3fb0958ee21990c24596e6fa5a4de7f67cf2fd29..0fc13e4ad252d01af73e26c25496b0e416faf703 100644 (file)
@@ -211,7 +211,7 @@ xlbd_put_major_info(struct xlbd_major_info *mi)
 static int
 xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size)
 {
-       request_queue_t *rq;
+       struct request_queue *rq;
 
        rq = blk_init_queue(do_blkif_request, &blkif_io_lock);
        if (rq == NULL)
index c69c5401f0c5ad0e65b2ed3c3a6d4ed8f30deb76..605d3c9bdc950da55bb33737022a619b435c550d 100644 (file)
@@ -40,6 +40,7 @@
 
 #include <linux/spinlock.h>
 #include <linux/kthread.h>
+#include <linux/freezer.h>
 #include <linux/list.h>
 #include <asm/hypervisor.h>
 #include "common.h"
@@ -53,6 +54,7 @@
 #include <linux/gfp.h>
 #include <linux/poll.h>
 #include <linux/delay.h>
+#include <linux/nsproxy.h>
 #include <asm/tlbflush.h>
 
 #define MAX_TAP_DEV 256     /*the maximum number of tapdisk ring devices    */
@@ -110,6 +112,7 @@ typedef struct tap_blkif {
        unsigned long mode;           /*current switching mode               */
        int minor;                    /*Minor number for tapdisk device      */
        pid_t pid;                    /*tapdisk process id                   */
+       struct pid_namespace *pid_ns; /*... and its corresponding namespace  */
        enum { RUNNING, CLEANSHUTDOWN } status; /*Detect a clean userspace 
                                                  shutdown                   */
        unsigned long *idx_map;       /*Record the user ring id to kern 
@@ -294,16 +297,14 @@ static inline int OFFSET_TO_SEG(int offset)
  * BLKTAP VM OPS
  */
 
-static struct page *blktap_nopage(struct vm_area_struct *vma,
-                                 unsigned long address,
-                                 int *type)
+static int blktap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
        /*
         * if the page has not been mapped in by the driver then return
-        * NOPAGE_SIGBUS to the domain.
+        * VM_FAULT_SIGBUS to the domain.
         */
 
-       return NOPAGE_SIGBUS;
+       return VM_FAULT_SIGBUS;
 }
 
 static pte_t blktap_clear_pte(struct vm_area_struct *vma,
@@ -389,7 +390,7 @@ static pte_t blktap_clear_pte(struct vm_area_struct *vma,
 }
 
 struct vm_operations_struct blktap_vm_ops = {
-       nopage:   blktap_nopage,
+       fault:    blktap_fault,
        zap_pte:  blktap_clear_pte,
 };
 
@@ -482,9 +483,8 @@ found:
                tapfds[minor] = info;
 
                if ((class = get_xen_class()) != NULL)
-                       class_device_create(class, NULL,
-                                           MKDEV(blktap_major, minor), NULL,
-                                           "blktap%d", minor);
+                       device_create(class, NULL, MKDEV(blktap_major, minor),
+                                     NULL, "blktap%d", minor);
        }
 
 out:
@@ -526,7 +526,7 @@ void signal_tapdisk(int idx)
                return;
 
        if (info->pid > 0) {
-               ptask = find_task_by_pid(info->pid);
+               ptask = find_task_by_pid_ns(info->pid, info->pid_ns);
                if (ptask)
                        info->status = CLEANSHUTDOWN;
        }
@@ -772,8 +772,9 @@ static int blktap_ioctl(struct inode *inode, struct file *filp,
        {
                if (info) {
                        info->pid = (pid_t)arg;
-                       DPRINTK("blktap: pid received %d\n", 
-                              info->pid);
+                       info->pid_ns = current->nsproxy->pid_ns;
+                       DPRINTK("blktap: pid received %p:%d\n",
+                               info->pid_ns, info->pid);
                }
                return 0;
        }
@@ -1225,7 +1226,7 @@ static void blkif_notify_work(blkif_t *blkif)
        wake_up(&blkif->wq);
 }
 
-irqreturn_t tap_blkif_be_int(int irq, void *dev_id, struct pt_regs *regs)
+irqreturn_t tap_blkif_be_int(int irq, void *dev_id)
 {
        blkif_notify_work(dev_id);
        return IRQ_HANDLED;
@@ -1686,9 +1687,8 @@ static int __init blkif_init(void)
                 * We only create the device when a request of a new device is
                 * made.
                 */
-               class_device_create(class, NULL,
-                                   MKDEV(blktap_major, 0), NULL,
-                                   "blktap0");
+               device_create(class, NULL, MKDEV(blktap_major, 0), NULL,
+                             "blktap0");
        } else {
                /* this is bad, but not fatal */
                WPRINTK("blktap: sysfs xen_class not created\n");
index 81d1473e7cdc57cd22caf290a8f769a51bc1e921..520f6640ee98f2f17c911ca28dfaf41da582334d 100644 (file)
@@ -68,7 +68,7 @@ typedef struct blkif_st {
        wait_queue_head_t   wq;
        struct task_struct  *xenblkd;
        unsigned int        waiting_reqs;
-       request_queue_t     *plug;
+       struct request_queue     *plug;
 
        /* statistics */
        unsigned long       st_print;
@@ -113,7 +113,7 @@ void tap_blkif_interface_init(void);
 
 void tap_blkif_xenbus_init(void);
 
-irqreturn_t tap_blkif_be_int(int irq, void *dev_id, struct pt_regs *regs);
+irqreturn_t tap_blkif_be_int(int irq, void *dev_id);
 int tap_blkif_schedule(void *arg);
 
 int dom_to_devid(domid_t domid, int xenbus_id, blkif_t *blkif);
index 9009ba62f2bad302b24e640b40f84a626097ab6c..b2814e914a4671ce3a863db6e50a96e561716bde 100644 (file)
@@ -34,7 +34,7 @@
 #include "common.h"
 #include <xen/evtchn.h>
 
-static kmem_cache_t *blkif_cachep;
+static struct kmem_cache *blkif_cachep;
 
 blkif_t *tap_alloc_blkif(domid_t domid)
 {
@@ -177,5 +177,5 @@ void tap_blkif_kmem_cache_free(blkif_t *blkif)
 void __init tap_blkif_interface_init(void)
 {
        blkif_cachep = kmem_cache_create("blktapif_cache", sizeof(blkif_t), 
-                                        0, 0, NULL, NULL);
+                                        0, 0, NULL);
 }
index 64534726b3358d31568a1eb21f520ebc37797ac6..29f5513a0b31fa144527054592383469eb17d34e 100644 (file)
@@ -465,7 +465,6 @@ static const struct xenbus_device_id blktap_ids[] = {
 
 static struct xenbus_driver blktap = {
        .name = "tap",
-       .owner = THIS_MODULE,
        .ids = blktap_ids,
        .probe = blktap_probe,
        .remove = blktap_remove,
index d9c7e90031c41ae0edc18aa1db3da27ee3ac7bd5..eaf866eb8155b581432d36bf98fd80407fd90da2 100644 (file)
@@ -85,6 +85,18 @@ static int xc_num = -1;
 #define XEN_HVC_MAJOR 229
 #define XEN_HVC_MINOR 0
 
+void xencons_early_setup(void)
+{
+       extern int console_use_vt;
+
+       if (is_initial_xendomain()) {
+               xc_mode = XC_SERIAL;
+       } else {
+               xc_mode = XC_TTY;
+               console_use_vt = 0;
+       }
+}
+
 static int __init xencons_setup(char *str)
 {
        char *q;
index 181c3632503a756736465e5d57918d0d8cea0e38..d3c6ece61e1af21695c17ada428ca77a4ed68530 100644 (file)
@@ -65,7 +65,7 @@ static int match_accelerator(struct xenbus_device *xendev,
        
        if (IS_ERR(eth_name)) {
                /* Probably means not present */
-               DPRINTK("%s: no match due to xenbus_read accel error %d\n", 
+               DPRINTK("%s: no match due to xenbus_read accel error %ld\n",
                        __FUNCTION__, PTR_ERR(eth_name));
                return 0;
        } else {
index d4587b8c86fc6ef538287fb987a0845fca3a2e05..813612a5d3906cf7b6d4216bc37c5e14d36ce368 100644 (file)
@@ -203,7 +203,7 @@ void netif_deschedule_work(netif_t *netif);
 
 int netif_be_start_xmit(struct sk_buff *skb, struct net_device *dev);
 struct net_device_stats *netif_be_get_stats(struct net_device *dev);
-irqreturn_t netif_be_int(int irq, void *dev_id, struct pt_regs *regs);
+irqreturn_t netif_be_int(int irq, void *dev_id);
 
 static inline int netbk_can_queue(struct net_device *dev)
 {
index e039dc19d7b2c4efa16cb4c5fae7132469f1bf0e..215eb28ccb45f5fbc467cb8e2c7d563b463fc290 100644 (file)
@@ -120,7 +120,7 @@ static void netbk_get_drvinfo(struct net_device *dev,
                              struct ethtool_drvinfo *info)
 {
        strcpy(info->driver, "netbk");
-       strcpy(info->bus_info, dev->class_dev.dev->bus_id);
+       strcpy(info->bus_info, dev->dev.parent->bus_id);
 }
 
 static const struct netif_stat {
index d1a03b6fc2d9452d287ad75ebf15c66c3b63a9b2..1f70cd8ffb7812edfecefe8dbfb6ce94baf8ac3a 100644 (file)
@@ -54,6 +54,7 @@
 #include <net/dst.h>
 #include <net/xfrm.h>          /* secpath_reset() */
 #include <asm/hypervisor.h>    /* is_initial_xendomain() */
+#include <../net/core/kmap_skb.h> /* k{,un}map_skb_frag() */
 
 static int nloopbacks = -1;
 module_param(nloopbacks, int, 0);
@@ -151,7 +152,7 @@ static int loopback_start_xmit(struct sk_buff *skb, struct net_device *dev)
        np->stats.rx_bytes += skb->len;
        np->stats.rx_packets++;
 
-       if (skb->ip_summed == CHECKSUM_HW) {
+       if (skb->ip_summed == CHECKSUM_PARTIAL) {
                /* Defer checksum calculation. */
                skb->proto_csum_blank = 1;
                /* Must be a local packet: assert its integrity. */
@@ -284,9 +285,9 @@ static void __exit clean_loopback(int i)
        char dev_name[IFNAMSIZ];
 
        sprintf(dev_name, "vif0.%d", i);
-       dev1 = dev_get_by_name(dev_name);
+       dev1 = dev_get_by_name(&init_net, dev_name);
        sprintf(dev_name, "veth%d", i);
-       dev2 = dev_get_by_name(dev_name);
+       dev2 = dev_get_by_name(&init_net, dev_name);
        if (dev1 && dev2) {
                unregister_netdev(dev2);
                unregister_netdev(dev1);
index df84dad073a8b71b73b2d94f9d4c1b3e6f2dcfd4..efa1d17dddf1592fcaf81336509d29ea8206e263 100644 (file)
@@ -195,7 +195,7 @@ static struct sk_buff *netbk_copy_skb(struct sk_buff *skb)
                goto err;
 
        skb_reserve(nskb, 16 + NET_IP_ALIGN);
-       headlen = nskb->end - nskb->data;
+       headlen = skb_end_pointer(nskb) - nskb->data;
        if (headlen > skb_headlen(skb))
                headlen = skb_headlen(skb);
        ret = skb_copy_bits(skb, 0, __skb_put(nskb, headlen), headlen);
@@ -241,11 +241,15 @@ static struct sk_buff *netbk_copy_skb(struct sk_buff *skb)
                len -= copy;
        }
 
+#ifdef NET_SKBUFF_DATA_USES_OFFSET
+       offset = 0;
+#else
        offset = nskb->data - skb->data;
+#endif
 
-       nskb->h.raw = skb->h.raw + offset;
-       nskb->nh.raw = skb->nh.raw + offset;
-       nskb->mac.raw = skb->mac.raw + offset;
+       nskb->transport_header = skb->transport_header + offset;
+       nskb->network_header   = skb->network_header   + offset;
+       nskb->mac_header       = skb->mac_header       + offset;
 
        return nskb;
 
@@ -692,7 +696,7 @@ static void net_rx_action(unsigned long unused)
                id = meta[npo.meta_cons].id;
                flags = nr_frags ? NETRXF_more_data : 0;
 
-               if (skb->ip_summed == CHECKSUM_HW) /* local packet? */
+               if (skb->ip_summed == CHECKSUM_PARTIAL) /* local packet? */
                        flags |= NETRXF_csum_blank | NETRXF_data_validated;
                else if (skb->proto_data_valid) /* remote but checksummed? */
                        flags |= NETRXF_data_validated;
@@ -1463,7 +1467,7 @@ static void netif_page_release(struct page *page, unsigned int order)
        netif_idx_release(idx);
 }
 
-irqreturn_t netif_be_int(int irq, void *dev_id, struct pt_regs *regs)
+irqreturn_t netif_be_int(int irq, void *dev_id)
 {
        netif_t *netif = dev_id;
 
index d83d4251b6eef40729217a09e7e63d92193cbb7b..e0a0dea425b4f4cdd3f07b3fb00c83d8d2fccde5 100644 (file)
@@ -149,12 +149,10 @@ fail:
  * and vif variables to the environment, for the benefit of the vif-* hotplug
  * scripts.
  */
-static int netback_uevent(struct xenbus_device *xdev, char **envp,
-                         int num_envp, char *buffer, int buffer_size)
+static int netback_uevent(struct xenbus_device *xdev, struct kobj_uevent_env *env)
 {
        struct backend_info *be = xdev->dev.driver_data;
        netif_t *netif = be->netif;
-       int i = 0, length = 0;
        char *val;
 
        DPRINTK("netback_uevent");
@@ -166,15 +164,11 @@ static int netback_uevent(struct xenbus_device *xdev, char **envp,
                return err;
        }
        else {
-               add_uevent_var(envp, num_envp, &i, buffer, buffer_size,
-                              &length, "script=%s", val);
+               add_uevent_var(env, "script=%s", val);
                kfree(val);
        }
 
-       add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length,
-                      "vif=%s", netif->dev->name);
-
-       envp[i] = NULL;
+       add_uevent_var(env, "vif=%s", netif->dev->name);
 
        return 0;
 }
@@ -440,7 +434,6 @@ static const struct xenbus_device_id netback_ids[] = {
 
 static struct xenbus_driver netback = {
        .name = "vif",
-       .owner = THIS_MODULE,
        .ids = netback_ids,
        .probe = netback_probe,
        .remove = netback_remove,
index fda2da96aa6c82954b794c7b46831c95348428b9..75f2181c0c65ea6dfb6853aa82328f80a0780645 100644 (file)
@@ -28,6 +28,7 @@
  * IN THE SOFTWARE.
  */
 
+#include <linux/version.h>
 #include <linux/netdevice.h>
 #include <linux/skbuff.h>
 #include <linux/list.h>
@@ -325,13 +326,13 @@ accelerator_set_vif_state_hooks(struct netfront_accel_vif_state *vif_state)
        DPRINTK("%p\n",vif_state);
 
        /* Make sure there are no data path operations going on */
-       netif_poll_disable(vif_state->np->netdev);
+       napi_disable(&vif_state->np->napi);
        netif_tx_lock_bh(vif_state->np->netdev);
 
        vif_state->hooks = vif_state->np->accelerator->hooks;
 
        netif_tx_unlock_bh(vif_state->np->netdev);
-       netif_poll_enable(vif_state->np->netdev);
+       napi_enable(&vif_state->np->napi);
 }
 
 
@@ -509,7 +510,7 @@ accelerator_remove_single_hook(struct netfront_accelerator *accelerator,
                               struct netfront_accel_vif_state *vif_state)
 {
        /* Make sure there are no data path operations going on */
-       netif_poll_disable(vif_state->np->netdev);
+       napi_disable(&vif_state->np->napi);
        netif_tx_lock_bh(vif_state->np->netdev);
 
        /* 
@@ -521,7 +522,7 @@ accelerator_remove_single_hook(struct netfront_accelerator *accelerator,
        vif_state->hooks = NULL;
        
        netif_tx_unlock_bh(vif_state->np->netdev);
-       netif_poll_enable(vif_state->np->netdev);                      
+       napi_enable(&vif_state->np->napi);
 }
 
 
index 8e51aa7250f6f2b758629f2419cb1b4b144ebe0e..ab604f8f993b2c1b4c1550f8f944fdebc8b9d055 100644 (file)
@@ -136,7 +136,7 @@ static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
 {
         return skb_is_gso(skb) &&
                (!skb_gso_ok(skb, dev->features) ||
-                unlikely(skb->ip_summed != CHECKSUM_HW));
+                unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
 }
 #else
 #define HAVE_GSO                       0
@@ -222,7 +222,7 @@ static void network_tx_buf_gc(struct net_device *);
 static void network_alloc_rx_buffers(struct net_device *);
 static void send_fake_arp(struct net_device *);
 
-static irqreturn_t netif_int(int irq, void *dev_id, struct pt_regs *ptregs);
+static irqreturn_t netif_int(int irq, void *dev_id);
 
 #ifdef CONFIG_SYSFS
 static int xennet_sysfs_addif(struct net_device *netdev);
@@ -513,7 +513,7 @@ static int setup_device(struct xenbus_device *dev, struct netfront_info *info)
        memcpy(netdev->dev_addr, info->mac, ETH_ALEN);
 
        err = bind_listening_port_to_irqhandler(
-               dev->otherend_id, netif_int, SA_SAMPLE_RANDOM, netdev->name,
+               dev->otherend_id, netif_int, IRQF_SAMPLE_RANDOM, netdev->name,
                netdev);
        if (err < 0)
                goto fail;
@@ -626,6 +626,7 @@ static int network_open(struct net_device *dev)
        struct netfront_info *np = netdev_priv(dev);
 
        memset(&np->stats, 0, sizeof(np->stats));
+       napi_enable(&np->napi);
 
        spin_lock_bh(&np->rx_lock);
        if (netfront_carrier_ok(np)) {
@@ -634,12 +635,12 @@ static int network_open(struct net_device *dev)
                if (RING_HAS_UNCONSUMED_RESPONSES(&np->rx)){
                        netfront_accelerator_call_stop_napi_irq(np, dev);
 
-                       netif_rx_schedule(dev);
+                       netif_rx_schedule(dev, &np->napi);
                }
        }
        spin_unlock_bh(&np->rx_lock);
 
-       network_maybe_wake_tx(dev);
+       netif_start_queue(dev);
 
        return 0;
 }
@@ -706,7 +707,7 @@ static void rx_refill_timeout(unsigned long data)
 
        netfront_accelerator_call_stop_napi_irq(np, dev);
 
-       netif_rx_schedule(dev);
+       netif_rx_schedule(dev, &np->napi);
 }
 
 static void network_alloc_rx_buffers(struct net_device *dev)
@@ -992,7 +993,7 @@ static int network_start_xmit(struct sk_buff *skb, struct net_device *dev)
        tx->flags = 0;
        extra = NULL;
 
-       if (skb->ip_summed == CHECKSUM_HW) /* local packet? */
+       if (skb->ip_summed == CHECKSUM_PARTIAL) /* local packet? */
                tx->flags |= NETTXF_csum_blank | NETTXF_data_validated;
 #ifdef CONFIG_XEN
        if (skb->proto_data_valid) /* remote but checksummed? */
@@ -1049,7 +1050,7 @@ static int network_start_xmit(struct sk_buff *skb, struct net_device *dev)
        return 0;
 }
 
-static irqreturn_t netif_int(int irq, void *dev_id, struct pt_regs *ptregs)
+static irqreturn_t netif_int(int irq, void *dev_id)
 {
        struct net_device *dev = dev_id;
        struct netfront_info *np = netdev_priv(dev);
@@ -1063,7 +1064,7 @@ static irqreturn_t netif_int(int irq, void *dev_id, struct pt_regs *ptregs)
                if (RING_HAS_UNCONSUMED_RESPONSES(&np->rx)) {
                        netfront_accelerator_call_stop_napi_irq(np, dev);
 
-                       netif_rx_schedule(dev);
+                       netif_rx_schedule(dev, &np->napi);
                        dev->last_rx = jiffies;
                }
        }
@@ -1316,16 +1317,17 @@ static int xennet_set_skb_gso(struct sk_buff *skb,
 #endif
 }
 
-static int netif_poll(struct net_device *dev, int *pbudget)
+static int netif_poll(struct napi_struct *napi, int budget)
 {
-       struct netfront_info *np = netdev_priv(dev);
+       struct netfront_info *np = container_of(napi, struct netfront_info, napi);
+       struct net_device *dev = np->netdev;
        struct sk_buff *skb;
        struct netfront_rx_info rinfo;
        struct netif_rx_response *rx = &rinfo.rx;
        struct netif_extra_info *extras = rinfo.extras;
        RING_IDX i, rp;
        struct multicall_entry *mcl;
-       int work_done, budget, more_to_do = 1, accel_more_to_do = 1;
+       int work_done, more_to_do = 1, accel_more_to_do = 1;
        struct sk_buff_head rxq;
        struct sk_buff_head errq;
        struct sk_buff_head tmpq;
@@ -1345,8 +1347,6 @@ static int netif_poll(struct net_device *dev, int *pbudget)
        skb_queue_head_init(&errq);
        skb_queue_head_init(&tmpq);
 
-       if ((budget = *pbudget) > dev->quota)
-               budget = dev->quota;
        rp = np->rx.sring->rsp_prod;
        rmb(); /* Ensure we see queued responses up to 'rp'. */
 
@@ -1464,8 +1464,7 @@ err:
                }
        }
 
-       while ((skb = __skb_dequeue(&errq)))
-               kfree_skb(skb);
+       __skb_queue_purge(&errq);
 
        while ((skb = __skb_dequeue(&rxq)) != NULL) {
                struct page *page = NETFRONT_SKB_CB(skb)->page;
@@ -1508,9 +1507,6 @@ err:
                        accel_more_to_do = 0;
        }
 
-       *pbudget   -= work_done;
-       dev->quota -= work_done;
-
        if (work_done < budget) {
                local_irq_save(flags);
 
@@ -1527,7 +1523,7 @@ err:
                }
 
                if (!more_to_do && !accel_more_to_do)
-                       __netif_rx_complete(dev);
+                       __netif_rx_complete(dev, napi);
 
                local_irq_restore(flags);
        }
@@ -1681,6 +1677,7 @@ static int network_close(struct net_device *dev)
 {
        struct netfront_info *np = netdev_priv(dev);
        netif_stop_queue(np->netdev);
+       napi_disable(&np->napi);
        return 0;
 }
 
@@ -1892,20 +1889,19 @@ static struct ethtool_ops network_ethtool_ops =
 };
 
 #ifdef CONFIG_SYSFS
-static ssize_t show_rxbuf_min(struct class_device *cd, char *buf)
+static ssize_t show_rxbuf_min(struct device *dev,
+                             struct device_attribute *attr, char *buf)
 {
-       struct net_device *netdev = container_of(cd, struct net_device,
-                                                class_dev);
-       struct netfront_info *info = netdev_priv(netdev);
+       struct netfront_info *info = netdev_priv(to_net_dev(dev));
 
        return sprintf(buf, "%u\n", info->rx_min_target);
 }
 
-static ssize_t store_rxbuf_min(struct class_device *cd,
+static ssize_t store_rxbuf_min(struct device *dev,
+                              struct device_attribute *attr,
                               const char *buf, size_t len)
 {
-       struct net_device *netdev = container_of(cd, struct net_device,
-                                                class_dev);
+       struct net_device *netdev = to_net_dev(dev);
        struct netfront_info *np = netdev_priv(netdev);
        char *endp;
        unsigned long target;
@@ -1935,20 +1931,19 @@ static ssize_t store_rxbuf_min(struct class_device *cd,
        return len;
 }
 
-static ssize_t show_rxbuf_max(struct class_device *cd, char *buf)
+static ssize_t show_rxbuf_max(struct device *dev,
+                             struct device_attribute *attr, char *buf)
 {
-       struct net_device *netdev = container_of(cd, struct net_device,
-                                                class_dev);
-       struct netfront_info *info = netdev_priv(netdev);
+       struct netfront_info *info = netdev_priv(to_net_dev(dev));
 
        return sprintf(buf, "%u\n", info->rx_max_target);
 }
 
-static ssize_t store_rxbuf_max(struct class_device *cd,
+static ssize_t store_rxbuf_max(struct device *dev,
+                              struct device_attribute *attr,
                               const char *buf, size_t len)
 {
-       struct net_device *netdev = container_of(cd, struct net_device,
-                                                class_dev);
+       struct net_device *netdev = to_net_dev(dev);
        struct netfront_info *np = netdev_priv(netdev);
        char *endp;
        unsigned long target;
@@ -1978,16 +1973,15 @@ static ssize_t store_rxbuf_max(struct class_device *cd,
        return len;
 }
 
-static ssize_t show_rxbuf_cur(struct class_device *cd, char *buf)
+static ssize_t show_rxbuf_cur(struct device *dev,
+                             struct device_attribute *attr, char *buf)
 {
-       struct net_device *netdev = container_of(cd, struct net_device,
-                                                class_dev);
-       struct netfront_info *info = netdev_priv(netdev);
+       struct netfront_info *info = netdev_priv(to_net_dev(dev));
 
        return sprintf(buf, "%u\n", info->rx_target);
 }
 
-static const struct class_device_attribute xennet_attrs[] = {
+static struct device_attribute xennet_attrs[] = {
        __ATTR(rxbuf_min, S_IRUGO|S_IWUSR, show_rxbuf_min, store_rxbuf_min),
        __ATTR(rxbuf_max, S_IRUGO|S_IWUSR, show_rxbuf_max, store_rxbuf_max),
        __ATTR(rxbuf_cur, S_IRUGO, show_rxbuf_cur, NULL),
@@ -1999,8 +1993,8 @@ static int xennet_sysfs_addif(struct net_device *netdev)
        int error = 0;
 
        for (i = 0; i < ARRAY_SIZE(xennet_attrs); i++) {
-               error = class_device_create_file(&netdev->class_dev, 
-                                                &xennet_attrs[i]);
+               error = device_create_file(&netdev->dev,
+                                          &xennet_attrs[i]);
                if (error)
                        goto fail;
        }
@@ -2008,8 +2002,7 @@ static int xennet_sysfs_addif(struct net_device *netdev)
 
  fail:
        while (--i >= 0)
-               class_device_remove_file(&netdev->class_dev,
-                                        &xennet_attrs[i]);
+               device_remove_file(&netdev->dev, &xennet_attrs[i]);
        return error;
 }
 
@@ -2017,10 +2010,8 @@ static void xennet_sysfs_delif(struct net_device *netdev)
 {
        int i;
 
-       for (i = 0; i < ARRAY_SIZE(xennet_attrs); i++) {
-               class_device_remove_file(&netdev->class_dev,
-                                        &xennet_attrs[i]);
-       }
+       for (i = 0; i < ARRAY_SIZE(xennet_attrs); i++)
+               device_remove_file(&netdev->dev, &xennet_attrs[i]);
 }
 
 #endif /* CONFIG_SYSFS */
@@ -2094,16 +2085,14 @@ static struct net_device * __devinit create_netdev(struct xenbus_device *dev)
        netdev->hard_start_xmit = network_start_xmit;
        netdev->stop            = network_close;
        netdev->get_stats       = network_get_stats;
-       netdev->poll            = netif_poll;
+       netif_napi_add(netdev, &np->napi, netif_poll, 64);
        netdev->set_multicast_list = network_set_multicast_list;
        netdev->uninit          = netif_uninit;
        netdev->set_mac_address = xennet_set_mac_address;
        netdev->change_mtu      = xennet_change_mtu;
-       netdev->weight          = 64;
        netdev->features        = NETIF_F_IP_CSUM;
 
        SET_ETHTOOL_OPS(netdev, &network_ethtool_ops);
-       SET_MODULE_OWNER(netdev);
        SET_NETDEV_DEV(netdev, &dev->dev);
 
        np->netdev = netdev;
@@ -2186,7 +2175,6 @@ MODULE_ALIAS("xen:vif");
 
 static struct xenbus_driver netfront_driver = {
        .name = "vif",
-       .owner = THIS_MODULE,
        .ids = netfront_ids,
        .probe = netfront_probe,
        .remove = __devexit_p(netfront_remove),
index 72d0183e2fcc071c426abcdd5fbdf70d64f62ce3..4cfa98362bd6ea5abde277fd7627e67c176386a9 100644 (file)
@@ -157,6 +157,8 @@ struct netfront_info {
        spinlock_t   tx_lock;
        spinlock_t   rx_lock;
 
+       struct napi_struct      napi;
+
        unsigned int irq;
        unsigned int copying_receiver;
        unsigned int carrier;
index f794e12224a77ad51a5598a5cf9f5e590c90bef4..aba4a4e83d3f1db7eea4c5d0c2370dcaf8db03bb 100644 (file)
@@ -22,14 +22,14 @@ static int command_write(struct pci_dev *dev, int offset, u16 value, void *data)
 {
        int err;
 
-       if (!dev->is_enabled && is_enable_cmd(value)) {
+       if (!atomic_read(&dev->enable_cnt) && is_enable_cmd(value)) {
                if (unlikely(verbose_request))
                        printk(KERN_DEBUG "pciback: %s: enable\n",
                               pci_name(dev));
                err = pci_enable_device(dev);
                if (err)
                        return err;
-       } else if (dev->is_enabled && !is_enable_cmd(value)) {
+       } else if (atomic_read(&dev->enable_cnt) && !is_enable_cmd(value)) {
                if (unlikely(verbose_request))
                        printk(KERN_DEBUG "pciback: %s: disable\n",
                               pci_name(dev));
index 6744f45948aef6f7a57dcb008f8cc4b9b1acccb6..b2cb0311027ee2264671b75500d34e58f331afb6 100644 (file)
@@ -99,8 +99,8 @@ int pciback_publish_pci_roots(struct pciback_device *pdev,
 void pciback_release_devices(struct pciback_device *pdev);
 
 /* Handles events from front-end */
-irqreturn_t pciback_handle_event(int irq, void *dev_id, struct pt_regs *regs);
-void pciback_do_op(void *data);
+irqreturn_t pciback_handle_event(int irq, void *dev_id);
+void pciback_do_op(struct work_struct *work);
 
 int pciback_xenbus_register(void);
 void pciback_xenbus_unregister(void);
index b85b2db4e098c9a705160125c12b98a78fa6a2bc..d6b9bf9ebb51e390480922ac667807dc8f1cbb41 100644 (file)
@@ -26,7 +26,7 @@ void pciback_reset_device(struct pci_dev *dev)
 
                pci_write_config_word(dev, PCI_COMMAND, 0);
 
-               dev->is_enabled = 0;
+               atomic_set(&dev->enable_cnt, 0);
                dev->is_busmaster = 0;
        } else {
                pci_read_config_word(dev, PCI_COMMAND, &cmd);
@@ -67,9 +67,9 @@ void test_and_schedule_op(struct pciback_device *pdev)
  * context because some of the pci_* functions can sleep (mostly due to ACPI
  * use of semaphores). This function is intended to be called from a work
  * queue in process context taking a struct pciback_device as a parameter */
-void pciback_do_op(void *data)
+void pciback_do_op(struct work_struct *work)
 {
-       struct pciback_device *pdev = data;
+       struct pciback_device *pdev = container_of(work, struct pciback_device, op_work);
        struct pci_dev *dev;
        struct xen_pci_op *op = &pdev->sh_info->op;
 
@@ -124,7 +124,7 @@ void pciback_do_op(void *data)
        test_and_schedule_op(pdev);
 }
 
-irqreturn_t pciback_handle_event(int irq, void *dev_id, struct pt_regs *regs)
+irqreturn_t pciback_handle_event(int irq, void *dev_id)
 {
        struct pciback_device *pdev = dev_id;
 
index 70cd36bf8ac680c9dae6b7057e4e90625059408b..a8003a1f63cf11c26bfe1bd51a9679de7a05fe31 100644 (file)
@@ -33,7 +33,7 @@ static struct pciback_device *alloc_pdev(struct xenbus_device *xdev)
        pdev->evtchn_irq = INVALID_EVTCHN_IRQ;
        pdev->be_watching = 0;
 
-       INIT_WORK(&pdev->op_work, pciback_do_op, pdev);
+       INIT_WORK(&pdev->op_work, pciback_do_op);
 
        if (pciback_init_devices(pdev)) {
                kfree(pdev);
@@ -55,7 +55,6 @@ static void pciback_disconnect(struct pciback_device *pdev)
 
        /* If the driver domain started an op, make sure we complete it or
         * delete it before releasing the shared memory */
-       cancel_delayed_work(&pdev->op_work);
        flush_scheduled_work();
 
        if (pdev->sh_info != NULL) {
@@ -101,7 +100,7 @@ static int pciback_do_attach(struct pciback_device *pdev, int gnt_ref,
 
        err = bind_interdomain_evtchn_to_irqhandler(
                pdev->xdev->otherend_id, remote_evtchn, pciback_handle_event,
-               SA_SAMPLE_RANDOM, "pciback", pdev);
+               IRQF_SAMPLE_RANDOM, "pciback", pdev);
        if (err < 0) {
                xenbus_dev_fatal(pdev->xdev, err,
                                 "Error binding event channel to IRQ");
@@ -684,7 +683,6 @@ static const struct xenbus_device_id xenpci_ids[] = {
 
 static struct xenbus_driver xenbus_pciback_driver = {
        .name                   = "pciback",
-       .owner                  = THIS_MODULE,
        .ids                    = xenpci_ids,
        .probe                  = pciback_xenbus_probe,
        .remove                 = pciback_xenbus_remove,
index ba6bf84e8eb0ac9159fa92cc4fef2889be763f70..8022eec85593b71540604675d2ca99ecc20e5c6e 100644 (file)
@@ -18,7 +18,6 @@
  * Authors: Jimi Xenidis <jimix@watson.ibm.com>
  */
 
-#include <linux/config.h>
 #include <linux/compat.h>
 #include <linux/ioctl.h>
 #include <linux/syscalls.h>
index 845406e463ae4b15f70f81843f3c7630bfba7a15..233b9c47ee69f48e9037b1f3ca895ead94fb9605 100644 (file)
@@ -288,15 +288,13 @@ static long privcmd_ioctl(struct file *file,
 }
 
 #ifndef HAVE_ARCH_PRIVCMD_MMAP
-static struct page *privcmd_nopage(struct vm_area_struct *vma,
-                                  unsigned long address,
-                                  int *type)
+static int privcmd_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
-       return NOPAGE_SIGBUS;
+       return VM_FAULT_SIGBUS;
 }
 
 static struct vm_operations_struct privcmd_vm_ops = {
-       .nopage = privcmd_nopage
+       .fault = privcmd_fault
 };
 
 static int privcmd_mmap(struct file * file, struct vm_area_struct * vma)
@@ -306,7 +304,7 @@ static int privcmd_mmap(struct file * file, struct vm_area_struct * vma)
                return -ENOSYS;
 
        /* DONTCOPY is essential for Xen as copy_page_range is broken. */
-       vma->vm_flags |= VM_RESERVED | VM_IO | VM_DONTCOPY;
+       vma->vm_flags |= VM_RESERVED | VM_IO | VM_PFNMAP | VM_DONTCOPY;
        vma->vm_ops = &privcmd_vm_ops;
        vma->vm_private_data = NULL;
 
index f790d948a66f7d6c551943dac4f0f1195de150a2..9a47cabeeae302760b551de1955c2bc1d7006e85 100644 (file)
@@ -25,6 +25,7 @@
 #ifndef NETBACK_ACCEL_H
 #define NETBACK_ACCEL_H
 
+#include <linux/version.h>
 #include <linux/slab.h>
 #include <linux/ip.h>
 #include <linux/tcp.h>
index ca5844cc0e109f0fe85d47daf3ad75b245c21490..88ecc61c37085f2ab68fd4854e4e09e5861de2a9 100644 (file)
@@ -181,10 +181,11 @@ int netback_accel_fwd_add(const __u8 *mac, void *context, void *fwd_priv)
        unsigned long flags;
        cuckoo_hash_mac_key key = cuckoo_mac_to_key(mac);
        struct port_fwd *fwd_set = (struct port_fwd *)fwd_priv;
+       DECLARE_MAC_BUF(buf);
 
        BUG_ON(fwd_priv == NULL);
 
-       DPRINTK("Adding mac " MAC_FMT "\n", MAC_ARG(mac));
+       DPRINTK("Adding mac %s\n", print_mac(buf, mac));
        
        spin_lock_irqsave(&fwd_set->fwd_lock, flags);
        
@@ -199,8 +200,8 @@ int netback_accel_fwd_add(const __u8 *mac, void *context, void *fwd_priv)
        if (cuckoo_hash_lookup(&fwd_set->fwd_hash_table,
                               (cuckoo_hash_key *)(&key), &rc) != 0) {
                spin_unlock_irqrestore(&fwd_set->fwd_lock, flags);
-               EPRINTK("MAC address " MAC_FMT " already accelerated.\n",
-                       MAC_ARG(mac));
+               EPRINTK("MAC address %s already accelerated.\n",
+                       print_mac(buf, mac));
                return -EEXIST;
        }
 
@@ -235,8 +236,9 @@ void netback_accel_fwd_remove(const __u8 *mac, void *fwd_priv)
        unsigned long flags;
        cuckoo_hash_mac_key key = cuckoo_mac_to_key(mac);
        struct port_fwd *fwd_set = (struct port_fwd *)fwd_priv;
+       DECLARE_MAC_BUF(buf);
 
-       DPRINTK("Removing mac " MAC_FMT "\n", MAC_ARG(mac));
+       DPRINTK("Removing mac %s\n", print_mac(buf, mac));
 
        BUG_ON(fwd_priv == NULL);
 
@@ -308,7 +310,7 @@ static struct netback_accel *for_a_vnic(struct netback_pkt_buf *skb,
 static inline int packet_is_arp_reply(struct sk_buff *skb)
 {
        return skb->protocol == ntohs(ETH_P_ARP) 
-               && skb->nh.arph->ar_op == ntohs(ARPOP_REPLY);
+               && arp_hdr(skb)->ar_op == ntohs(ARPOP_REPLY);
 }
 
 
@@ -392,15 +394,18 @@ void netback_accel_tx_packet(struct sk_buff *skb, void *fwd_priv)
 
        BUG_ON(fwd_priv == NULL);
 
-       if (is_broadcast_ether_addr(skb->mac.raw) && packet_is_arp_reply(skb)) {
+       if (is_broadcast_ether_addr(skb_mac_header(skb))
+           && packet_is_arp_reply(skb)) {
+               DECLARE_MAC_BUF(buf);
+
                /*
                 * update our fast path forwarding to reflect this
                 * gratuitous ARP
                 */ 
-               mac = skb->mac.raw+ETH_ALEN;
+               mac = skb_mac_header(skb)+ETH_ALEN;
 
-               DPRINTK("%s: found gratuitous ARP for " MAC_FMT "\n",
-                       __FUNCTION__, MAC_ARG(mac));
+               DPRINTK("%s: found gratuitous ARP for %s\n",
+                       __FUNCTION__, print_mac(buf, mac));
 
                spin_lock_irqsave(&fwd_set->fwd_lock, flags);
                /*
index 4e232ee7c0312613cf6e5cb565b923e465071560..fb50504f5470b58bcdd11826e7648f51babbe976 100644 (file)
@@ -114,7 +114,7 @@ bend_dl_tx_packet(struct efx_dl_device *efx_dl_dev,
        BUG_ON(port == NULL);
 
        NETBACK_ACCEL_STATS_OP(global_stats.dl_tx_packets++);
-       if (skb->mac.raw != NULL)
+       if (skb_mac_header_was_set(skb))
                netback_accel_tx_packet(skb, port->fwd_priv);
        else {
                DPRINTK("Ignoring packet with missing mac address\n");
@@ -173,7 +173,7 @@ static int efx_device_to_efab_nic_index(struct efx_dl_device *efx_dl_dev)
        int i;
 
        for (i = 0; i < EFHW_MAX_NR_DEVS; i++) {
-               struct efhw_nic *nic = efrm_nic_table.nic[i];
+               struct efhw_nic *nic = efrm_nic_tablep->nic[i];
 
                /*
                 * It's possible for the nic structure to have not
index 07f40a74687c8348794c3f32b71fc33c4685cfb0..c98a23503f61f0de318e81f8945cf13de4cd1c7f 100644 (file)
@@ -68,8 +68,7 @@ static void unlink_bend(struct netback_accel *bend)
 
 
 /* Demultiplex a message IRQ from the frontend driver.  */
-static irqreturn_t msgirq_from_frontend(int irq, void *context, 
-                                    struct pt_regs *unused)
+static irqreturn_t msgirq_from_frontend(int irq, void *context)
 {
        struct xenbus_device *dev = context;
        struct netback_accel *bend = NETBACK_ACCEL_FROM_XENBUS_DEVICE(dev);
@@ -84,8 +83,7 @@ static irqreturn_t msgirq_from_frontend(int irq, void *context,
  * functionally, but we need it to pass to the bind function, and may
  * get called spuriously
  */
-static irqreturn_t netirq_from_frontend(int irq, void *context, 
-                                       struct pt_regs *unused)
+static irqreturn_t netirq_from_frontend(int irq, void *context)
 {
        VPRINTK("netirq %d from device %s\n", irq,
                ((struct xenbus_device *)context)->nodename);
index 702719e2ac7e8c0a6e31b5f528f2a3b8e6969351..e1495cdcbb95ce1755b889fa48309c8436e90b10 100644 (file)
@@ -62,21 +62,21 @@ struct efrm_nic_table {
 };
 
 /* Resource driver structures used by other drivers as well */
-extern struct efrm_nic_table efrm_nic_table;
+extern struct efrm_nic_table *efrm_nic_tablep;
 
 static inline void efrm_nic_table_hold(void)
 {
-       atomic_inc(&efrm_nic_table.ref_count);
+       atomic_inc(&efrm_nic_tablep->ref_count);
 }
 
 static inline void efrm_nic_table_rele(void)
 {
-       atomic_dec(&efrm_nic_table.ref_count);
+       atomic_dec(&efrm_nic_tablep->ref_count);
 }
 
 static inline int efrm_nic_table_held(void)
 {
-       return (atomic_read(&efrm_nic_table.ref_count) != 0);
+       return (atomic_read(&efrm_nic_tablep->ref_count) != 0);
 }
 
 /* Run code block _x multiple times with variable nic set to each
@@ -86,13 +86,13 @@ static inline int efrm_nic_table_held(void)
        for ((_nic_i) = (efrm_nic_table_hold(), 0);                     \
             (_nic_i) < EFHW_MAX_NR_DEVS || (efrm_nic_table_rele(), 0); \
             (_nic_i)++)                                                \
-               if (((_nic) = efrm_nic_table.nic[_nic_i]))
+               if (((_nic) = efrm_nic_tablep->nic[_nic_i]))
 
 #define EFRM_FOR_EACH_NIC_IN_SET(_set, _i, _nic)                       \
        for ((_i) = (efrm_nic_table_hold(), 0);                         \
             (_i) < EFHW_MAX_NR_DEVS || (efrm_nic_table_rele(), 0);     \
             ++(_i))                                                    \
-               if (((_nic) = efrm_nic_table.nic[_i]) &&                \
+               if (((_nic) = efrm_nic_tablep->nic[_i]) &&              \
                    efrm_nic_set_read((_set), (_i)))
 
 #endif /* __CI_EFRM_NIC_TABLE_H__ */
index aa0d345f345f89c8c2e7aa9510874cdacf2564b4..c23d0c5d5391caa36072e5b7f7b780c4c1fa9bf9 100644 (file)
@@ -35,6 +35,7 @@
 #include <xen/evtchn.h>
 
 #include <linux/kernel.h>
+#include <linux/version.h>
 #include <linux/list.h>
 
 enum netfront_accel_post_status {
@@ -449,10 +450,8 @@ void netfront_accel_msg_tx_fastpath(netfront_accel_vnic *vnic, const void *mac,
                                    u32 ip, u16 port, u8 protocol);
 
 /* Process an IRQ received from back end driver */
-irqreturn_t netfront_accel_msg_channel_irq_from_bend(int irq, void *context, 
-                                                    struct pt_regs *unused);
-irqreturn_t netfront_accel_net_channel_irq_from_bend(int irq, void *context, 
-                                                    struct pt_regs *unused);
+irqreturn_t netfront_accel_msg_channel_irq_from_bend(int irq, void *context);
+irqreturn_t netfront_accel_net_channel_irq_from_bend(int irq, void *context);
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
 extern void netfront_accel_msg_from_bend(struct work_struct *context);
index 8aa3b64c7a5b42e7f3ba111fbdda905aee738efe..ca183792da6e3194b20a8bd593b5d7f02cbffb8f 100644 (file)
@@ -41,11 +41,13 @@ static void vnic_start_interrupts(netfront_accel_vnic *vnic)
        /* Prime our interrupt */
        spin_lock_irqsave(&vnic->irq_enabled_lock, flags);
        if (!netfront_accel_vi_enable_interrupts(vnic)) {
+               struct netfront_info *np = netdev_priv(vnic->net_dev);
+
                /* Cripes, that was quick, better pass it up */
                netfront_accel_disable_net_interrupts(vnic);
                vnic->irq_enabled = 0;
                NETFRONT_ACCEL_STATS_OP(vnic->stats.poll_schedule_count++);
-               netif_rx_schedule(vnic->net_dev);
+               netif_rx_schedule(vnic->net_dev, &np->napi);
        } else {
                /*
                 * Nothing yet, make sure we get interrupts through
@@ -72,6 +74,7 @@ static void vnic_stop_interrupts(netfront_accel_vnic *vnic)
 static void vnic_start_fastpath(netfront_accel_vnic *vnic)
 {
        struct net_device *net_dev = vnic->net_dev;
+       struct netfront_info *np = netdev_priv(net_dev);
        unsigned long flags;
 
        DPRINTK("%s\n", __FUNCTION__);
@@ -80,9 +83,9 @@ static void vnic_start_fastpath(netfront_accel_vnic *vnic)
        vnic->tx_enabled = 1;
        spin_unlock_irqrestore(&vnic->tx_lock, flags);
        
-       netif_poll_disable(net_dev);
+       napi_disable(&np->napi);
        vnic->poll_enabled = 1;
-       netif_poll_enable(net_dev);
+       napi_enable(&np->napi);
        
        vnic_start_interrupts(vnic);
 }
@@ -114,11 +117,11 @@ void vnic_stop_fastpath(netfront_accel_vnic *vnic)
        spin_unlock_irqrestore(&vnic->tx_lock, flags1);
        
        /* Must prevent polls and hold lock to modify poll_enabled */
-       netif_poll_disable(net_dev);
+       napi_disable(&np->napi);
        spin_lock_irqsave(&vnic->irq_enabled_lock, flags1);
        vnic->poll_enabled = 0;
        spin_unlock_irqrestore(&vnic->irq_enabled_lock, flags1);
-       netif_poll_enable(net_dev);
+       napi_enable(&np->napi);
 }
 
 
@@ -326,8 +329,10 @@ static int vnic_process_localmac_msg(netfront_accel_vnic *vnic,
        cuckoo_hash_mac_key key;
 
        if (msg->u.localmac.flags & NET_ACCEL_MSG_ADD) {
-               DPRINTK("MAC has moved, could be local: " MAC_FMT "\n",
-                       MAC_ARG(msg->u.localmac.mac));
+               DECLARE_MAC_BUF(buf);
+
+               DPRINTK("MAC has moved, could be local: %s\n",
+                       print_mac(buf, msg->u.localmac.mac));
                key = cuckoo_mac_to_key(msg->u.localmac.mac);
                spin_lock_irqsave(&vnic->table_lock, flags);
                /* Try to remove it, not a big deal if not there */
@@ -490,8 +495,7 @@ void netfront_accel_msg_from_bend(void *context)
 }
 
 
-irqreturn_t netfront_accel_msg_channel_irq_from_bend(int irq, void *context, 
-                                                struct pt_regs *unused)
+irqreturn_t netfront_accel_msg_channel_irq_from_bend(int irq, void *context)
 {
        netfront_accel_vnic *vnic = (netfront_accel_vnic *)context;
        VPRINTK("irq %d from device %s\n", irq, vnic->dev->nodename);
@@ -502,8 +506,7 @@ irqreturn_t netfront_accel_msg_channel_irq_from_bend(int irq, void *context,
 }
 
 /* Process an interrupt received from the NIC via backend */
-irqreturn_t netfront_accel_net_channel_irq_from_bend(int irq, void *context, 
-                                                    struct pt_regs *unused)
+irqreturn_t netfront_accel_net_channel_irq_from_bend(int irq, void *context)
 {
        netfront_accel_vnic *vnic = (netfront_accel_vnic *)context;
        struct net_device *net_dev = vnic->net_dev;
@@ -517,6 +520,8 @@ irqreturn_t netfront_accel_net_channel_irq_from_bend(int irq, void *context,
 
        spin_lock_irqsave(&vnic->irq_enabled_lock, flags);
        if (vnic->irq_enabled) {
+               struct netfront_info *np = netdev_priv(net_dev);
+
                netfront_accel_disable_net_interrupts(vnic);
                vnic->irq_enabled = 0;
                spin_unlock_irqrestore(&vnic->irq_enabled_lock, flags);
@@ -529,7 +534,7 @@ irqreturn_t netfront_accel_net_channel_irq_from_bend(int irq, void *context,
                                vnic->stats.event_count_since_irq;
                vnic->stats.event_count_since_irq = 0;
 #endif
-               netif_rx_schedule(net_dev);
+               netif_rx_schedule(net_dev, &np->napi);
        }
        else {
                spin_unlock_irqrestore(&vnic->irq_enabled_lock, flags);
index b07f2d8ec246cbf2ae48c1ce3008be795292fd86..004980fa91396075366e3afb738dd42b868362bc 100644 (file)
 
 #include "accel_tso.h"
 
-#define PTR_DIFF(p1, p2)  ((u8*)(p1) - (u8*)(p2))
-#define ETH_HDR_LEN(skb)  ((skb)->nh.raw - (skb)->data)
-#define SKB_TCP_OFF(skb)  PTR_DIFF ((skb)->h.th, (skb)->data)
-#define SKB_IP_OFF(skb)   PTR_DIFF ((skb)->nh.iph, (skb)->data)
+#define ETH_HDR_LEN(skb)  skb_network_offset(skb)
+#define SKB_TCP_OFF(skb)  skb_transport_offset(skb)
+#define SKB_IP_OFF(skb)   skb_network_offset(skb)
 
 /*
  * Set a maximum number of buffers in each output packet to make life
@@ -114,9 +113,8 @@ struct netfront_accel_tso_state {
 static inline void tso_check_safe(struct sk_buff *skb) {
        EPRINTK_ON(skb->protocol != htons (ETH_P_IP));
        EPRINTK_ON(((struct ethhdr*) skb->data)->h_proto != htons (ETH_P_IP));
-       EPRINTK_ON(skb->nh.iph->protocol != IPPROTO_TCP);
-       EPRINTK_ON((SKB_TCP_OFF(skb)
-                   + (skb->h.th->doff << 2u)) > skb_headlen(skb));
+       EPRINTK_ON(ip_hdr(skb)->protocol != IPPROTO_TCP);
+       EPRINTK_ON((SKB_TCP_OFF(skb) + tcp_hdrlen(skb)) > skb_headlen(skb));
 }
 
 
@@ -129,17 +127,17 @@ static inline void tso_start(struct netfront_accel_tso_state *st,
         * All ethernet/IP/TCP headers combined size is TCP header size
         * plus offset of TCP header relative to start of packet.
         */
-       st->p.header_length = (skb->h.th->doff << 2u) + SKB_TCP_OFF(skb);
+       st->p.header_length = tcp_hdrlen(skb) + SKB_TCP_OFF(skb);
        st->p.full_packet_size = (st->p.header_length
                                  + skb_shinfo(skb)->gso_size);
        st->p.gso_size = skb_shinfo(skb)->gso_size;
 
-       st->p.ip_id = htons(skb->nh.iph->id);
-       st->seqnum = ntohl(skb->h.th->seq);
+       st->p.ip_id = htons(ip_hdr(skb)->id);
+       st->seqnum = ntohl(tcp_hdr(skb)->seq);
 
-       EPRINTK_ON(skb->h.th->urg);
-       EPRINTK_ON(skb->h.th->syn);
-       EPRINTK_ON(skb->h.th->rst);
+       EPRINTK_ON(tcp_hdr(skb)->urg);
+       EPRINTK_ON(tcp_hdr(skb)->syn);
+       EPRINTK_ON(tcp_hdr(skb)->rst);
 
        st->remaining_len = skb->len - st->p.header_length;
 
@@ -258,8 +256,8 @@ int tso_start_new_packet(netfront_accel_vnic *vnic,
                /* This packet will be the last in the TSO burst. */
                ip_length = (st->p.header_length - ETH_HDR_LEN(skb)
                             + st->remaining_len);
-               tsoh_th->fin = skb->h.th->fin;
-               tsoh_th->psh = skb->h.th->psh;
+               tsoh_th->fin = tcp_hdr(skb)->fin;
+               tsoh_th->psh = tcp_hdr(skb)->psh;
        }
 
        tsoh_iph->tot_len = htons(ip_length);
@@ -363,7 +361,7 @@ int netfront_accel_enqueue_skb_tso(netfront_accel_vnic *vnic,
 
        tso_check_safe(skb);
 
-       if (skb->ip_summed != CHECKSUM_HW)
+       if (skb->ip_summed != CHECKSUM_PARTIAL)
                EPRINTK("Trying to TSO send a packet without HW checksum\n");
 
        tso_start(&state, skb);
index 8431d0f4e2c3540e03bac6605f64bdfb0b885916..4dc8e9e2cb20b1427be552535a6b2f58a9e2ecb3 100644 (file)
@@ -461,9 +461,9 @@ netfront_accel_enqueue_skb_multi(netfront_accel_vnic *vnic, struct sk_buff *skb)
 
        frag_i = -1;
 
-       if (skb->ip_summed == CHECKSUM_HW) {
+       if (skb->ip_summed == CHECKSUM_PARTIAL) {
                /* Set to zero to encourage falcon to work it out for us */
-               *(u16*)(skb->h.raw + skb->csum) = 0;
+               *(u16*)(skb->head + skb->csum_start + skb->csum_offset) = 0;
        }
 
        if (multi_post_start_new_buffer(vnic, &state)) {
@@ -580,9 +580,9 @@ netfront_accel_enqueue_skb_single(netfront_accel_vnic *vnic, struct sk_buff *skb
        
        kva = buf->pkt_kva;
 
-       if (skb->ip_summed == CHECKSUM_HW) {
+       if (skb->ip_summed == CHECKSUM_PARTIAL) {
                /* Set to zero to encourage falcon to work it out for us */
-               *(u16*)(skb->h.raw + skb->csum) = 0;
+               *(u16*)(skb->head + skb->csum_start + skb->csum_offset) = 0;
        }
        NETFRONT_ACCEL_PKTBUFF_FOR_EACH_FRAGMENT
                (skb, idx, frag_data, frag_len, {
@@ -641,8 +641,10 @@ netfront_accel_vi_tx_post(netfront_accel_vnic *vnic, struct sk_buff *skb)
                                          (cuckoo_hash_key *)(&key), &value);
 
        if (!try_fastpath) {
-               VPRINTK("try fast path false for mac: " MAC_FMT "\n",
-                       MAC_ARG(skb->data));
+               DECLARE_MAC_BUF(buf);
+
+               VPRINTK("try fast path false for mac: %s\n",
+                       print_mac(buf, skb->data));
                
                return NETFRONT_ACCEL_STATUS_CANT;
        }
@@ -768,9 +770,10 @@ static void  netfront_accel_vi_rx_complete(netfront_accel_vnic *vnic,
        if (compare_ether_addr(skb->data, vnic->mac)) {
                struct iphdr *ip = (struct iphdr *)(skb->data + ETH_HLEN);
                u16 port;
+               DECLARE_MAC_BUF(buf);
 
-               DPRINTK("%s: saw wrong MAC address " MAC_FMT "\n", 
-                       __FUNCTION__, MAC_ARG(skb->data));
+               DPRINTK("%s: saw wrong MAC address %s\n",
+                       __FUNCTION__, print_mac(buf, skb->data));
 
                if (ip->protocol == IPPROTO_TCP) {
                        struct tcphdr *tcp = (struct tcphdr *)
index 95df8a08c2843c5816a06727e1d4651cb0eb1ed0..0b04b4f4680167313b4444697139feac24ce80fc 100644 (file)
@@ -356,7 +356,7 @@ static int vnic_setup_domU_shared_state(struct xenbus_device *dev,
        /* Create xenbus msg event channel */
        err = bind_listening_port_to_irqhandler
                (dev->otherend_id, netfront_accel_msg_channel_irq_from_bend,
-                SA_SAMPLE_RANDOM, "vnicctrl", vnic);
+                IRQF_SAMPLE_RANDOM, "vnicctrl", vnic);
        if (err < 0) {
                EPRINTK("Couldn't bind msg event channel\n");
                goto fail_msg_irq;
@@ -367,7 +367,7 @@ static int vnic_setup_domU_shared_state(struct xenbus_device *dev,
        /* Create xenbus net event channel */
        err = bind_listening_port_to_irqhandler
                (dev->otherend_id, netfront_accel_net_channel_irq_from_bend,
-                SA_SAMPLE_RANDOM, "vnicfront", vnic);
+                IRQF_SAMPLE_RANDOM, "vnicfront", vnic);
        if (err < 0) {
                EPRINTK("Couldn't bind net event channel\n");
                goto fail_net_irq;
index 93b459c2f6b46c57517de145e88a4e1591d7223b..66f96d8c7bace4dcb822fc80595159c519fa4054 100644 (file)
@@ -63,9 +63,6 @@
                        DPRINTK("%s at %s:%d\n", #exp, __FILE__, __LINE__); \
        } while(0)
 
-#define MAC_FMT "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x"
-#define MAC_ARG(_mac) (_mac)[0], (_mac)[1], (_mac)[2], (_mac)[3], (_mac)[4], (_mac)[5]
-
 #include <xen/xenbus.h>
 
 /*! Map a set of pages from another domain
index e1e8ee99576129a22fa3f045a01c84aaa283b36c..2c38e77ce123742a740114443bdc1add94bd4b31 100644 (file)
 
 static int xenbus_irq;
 
-extern void xenbus_probe(void *);
+extern void xenbus_probe(struct work_struct *);
 extern int xenstored_ready;
-static DECLARE_WORK(probe_work, xenbus_probe, NULL);
+static DECLARE_WORK(probe_work, xenbus_probe);
 
 static DECLARE_WAIT_QUEUE_HEAD(xb_waitq);
 
-static irqreturn_t wake_waiting(int irq, void *unused, struct pt_regs *regs)
+static irqreturn_t wake_waiting(int irq, void *unused)
 {
        if (unlikely(xenstored_ready == 0)) {
                xenstored_ready = 1;
index 45a1d55a6270a406d0e395cb2babe2db88b3e71a..3cfc5c64f958fe6f6817e309a6dfcbb3f8e645a9 100644 (file)
@@ -36,6 +36,7 @@
                 __FUNCTION__, __LINE__, ##args)
 
 #include <linux/kernel.h>
+#include <linux/version.h>
 #include <linux/err.h>
 #include <linux/string.h>
 #include <linux/ctype.h>
@@ -169,11 +170,9 @@ static int read_backend_details(struct xenbus_device *xendev)
 }
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-static int xenbus_uevent_frontend(struct device *dev, char **envp,
-                                 int num_envp, char *buffer, int buffer_size)
+static int xenbus_uevent_frontend(struct device *dev, struct kobj_uevent_env *env)
 {
        struct xenbus_device *xdev;
-       int length = 0, i = 0;
 
        if (dev == NULL)
                return -ENODEV;
@@ -182,12 +181,9 @@ static int xenbus_uevent_frontend(struct device *dev, char **envp,
                return -ENODEV;
 
        /* stuff we want to pass to /sbin/hotplug */
-       add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length,
-                      "XENBUS_TYPE=%s", xdev->devicetype);
-       add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length,
-                      "XENBUS_PATH=%s", xdev->nodename);
-       add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length,
-                      "MODALIAS=xen:%s", xdev->devicetype);
+       add_uevent_var(env, "XENBUS_TYPE=%s", xdev->devicetype);
+       add_uevent_var(env, "XENBUS_PATH=%s", xdev->nodename);
+       add_uevent_var(env, "MODALIAS=xen:%s", xdev->devicetype);
 
        return 0;
 }
@@ -365,7 +361,9 @@ static void xenbus_dev_shutdown(struct device *_dev)
 }
 
 int xenbus_register_driver_common(struct xenbus_driver *drv,
-                                 struct xen_bus_type *bus)
+                                 struct xen_bus_type *bus,
+                                 struct module *owner,
+                                 const char *mod_name)
 {
        int ret;
 
@@ -375,7 +373,10 @@ int xenbus_register_driver_common(struct xenbus_driver *drv,
        drv->driver.name = drv->name;
        drv->driver.bus = &bus->bus;
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
-       drv->driver.owner = drv->owner;
+       drv->driver.owner = owner;
+#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+       drv->driver.mod_name = mod_name;
 #endif
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
        drv->driver.probe = xenbus_dev_probe;
@@ -389,13 +390,14 @@ int xenbus_register_driver_common(struct xenbus_driver *drv,
        return ret;
 }
 
-int xenbus_register_frontend(struct xenbus_driver *drv)
+int __xenbus_register_frontend(struct xenbus_driver *drv,
+                              struct module *owner, const char *mod_name)
 {
        int ret;
 
        drv->read_otherend_details = read_backend_details;
 
-       ret = xenbus_register_driver_common(drv, &xenbus_frontend);
+       ret = xenbus_register_driver_common(drv, &xenbus_frontend, owner, mod_name);
        if (ret)
                return ret;
 
@@ -404,7 +406,7 @@ int xenbus_register_frontend(struct xenbus_driver *drv)
 
        return 0;
 }
-EXPORT_SYMBOL_GPL(xenbus_register_frontend);
+EXPORT_SYMBOL_GPL(__xenbus_register_frontend);
 
 void xenbus_unregister_driver(struct xenbus_driver *drv)
 {
index 51c533057a1f33deb5ecb6fbda9c112af8d22a4f..8bb7c5f6e8ea866bd8f8608774032fa43095b90f 100644 (file)
@@ -63,7 +63,9 @@ extern int xenbus_match(struct device *_dev, struct device_driver *_drv);
 extern int xenbus_dev_probe(struct device *_dev);
 extern int xenbus_dev_remove(struct device *_dev);
 extern int xenbus_register_driver_common(struct xenbus_driver *drv,
-                                        struct xen_bus_type *bus);
+                                        struct xen_bus_type *bus,
+                                        struct module *owner,
+                                        const char *mod_name);
 extern int xenbus_probe_node(struct xen_bus_type *bus,
                             const char *type,
                             const char *nodename);
index 6a32d0c9b2bc9ee5ccae2b58ad3ea0ccb9a78b11..cd6673dff2935c459060fc314737dca8b91cbf1a 100644 (file)
@@ -60,8 +60,7 @@
 #include <xen/platform-compat.h>
 #endif
 
-static int xenbus_uevent_backend(struct device *dev, char **envp,
-                                int num_envp, char *buffer, int buffer_size);
+static int xenbus_uevent_backend(struct device *dev, struct kobj_uevent_env *env);
 static int xenbus_probe_backend(const char *type, const char *domid);
 
 extern int read_otherend_details(struct xenbus_device *xendev,
@@ -128,13 +127,10 @@ static struct xen_bus_type xenbus_backend = {
        },
 };
 
-static int xenbus_uevent_backend(struct device *dev, char **envp,
-                                int num_envp, char *buffer, int buffer_size)
+static int xenbus_uevent_backend(struct device *dev, struct kobj_uevent_env *env)
 {
        struct xenbus_device *xdev;
        struct xenbus_driver *drv;
-       int i = 0;
-       int length = 0;
 
        DPRINTK("");
 
@@ -146,39 +142,30 @@ static int xenbus_uevent_backend(struct device *dev, char **envp,
                return -ENODEV;
 
        /* stuff we want to pass to /sbin/hotplug */
-       add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length,
-                      "XENBUS_TYPE=%s", xdev->devicetype);
+       add_uevent_var(env, "XENBUS_TYPE=%s", xdev->devicetype);
 
-       add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length,
-                      "XENBUS_PATH=%s", xdev->nodename);
+       add_uevent_var(env, "XENBUS_PATH=%s", xdev->nodename);
 
-       add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length,
-                      "XENBUS_BASE_PATH=%s", xenbus_backend.root);
-
-       /* terminate, set to next free slot, shrink available space */
-       envp[i] = NULL;
-       envp = &envp[i];
-       num_envp -= i;
-       buffer = &buffer[length];
-       buffer_size -= length;
+       add_uevent_var(env, "XENBUS_BASE_PATH=%s", xenbus_backend.root);
 
        if (dev->driver) {
                drv = to_xenbus_driver(dev->driver);
                if (drv && drv->uevent)
-                       return drv->uevent(xdev, envp, num_envp, buffer,
-                                          buffer_size);
+                       return drv->uevent(xdev, env);
        }
 
        return 0;
 }
 
-int xenbus_register_backend(struct xenbus_driver *drv)
+int __xenbus_register_backend(struct xenbus_driver *drv,
+                             struct module *owner, const char *mod_name)
 {
        drv->read_otherend_details = read_frontend_details;
 
-       return xenbus_register_driver_common(drv, &xenbus_backend);
+       return xenbus_register_driver_common(drv, &xenbus_backend,
+                                            owner, mod_name);
 }
-EXPORT_SYMBOL_GPL(xenbus_register_backend);
+EXPORT_SYMBOL_GPL(__xenbus_register_backend);
 
 /* backend/<typename>/<frontend-uuid>/<name> */
 static int xenbus_probe_backend_unit(const char *dir,