Netdev List
 help / color / mirror / Atom feed
* [2/4] DST: Core distributed storage files.
From: Evgeniy Polyakov @ 2007-12-17 15:03 UTC (permalink / raw)
  To: lkml; +Cc: netdev, linux-fsdevel
In-Reply-To: <11979038192980@2ka.mipt.ru>


Core distributed storage files.
Include userspace interfaces, initialization,
block layer bindings and other core functionality.

Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>


diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index b4c8319..ca6592d 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -451,6 +451,8 @@ config ATA_OVER_ETH
 	This driver provides Support for ATA over Ethernet block
 	devices like the Coraid EtherDrive (R) Storage Blade.
 
+source "drivers/block/dst/Kconfig"
+
 source "drivers/s390/block/Kconfig"
 
 endmenu
diff --git a/drivers/block/Makefile b/drivers/block/Makefile
index dd88e33..fcf042d 100644
--- a/drivers/block/Makefile
+++ b/drivers/block/Makefile
@@ -29,3 +29,4 @@ obj-$(CONFIG_VIODASD)		+= viodasd.o
 obj-$(CONFIG_BLK_DEV_SX8)	+= sx8.o
 obj-$(CONFIG_BLK_DEV_UB)	+= ub.o
 
+obj-$(CONFIG_DST)		+= dst/
diff --git a/drivers/block/dst/Kconfig b/drivers/block/dst/Kconfig
new file mode 100644
index 0000000..67a7dad
--- /dev/null
+++ b/drivers/block/dst/Kconfig
@@ -0,0 +1,28 @@
+config DST
+	tristate "Distributed storage"
+	depends on NET
+	select CONNECTOR
+	select LIBCRC32C
+	---help---
+	This driver allows to create a distributed storage.
+
+config DST_DEBUG
+	bool "DST debug"
+	depends on DST
+	---help---
+	This option will turn HEAVY debugging of the DST.
+	Turn it on ONLY if you have to debug some really obscure problem.
+
+config DST_ALG_LINEAR
+	tristate "Linear distribution algorithm"
+	depends on DST
+	---help---
+	This module allows to create linear mapping of the nodes
+	in the distributed storage.
+
+config DST_ALG_MIRROR
+	tristate "Mirror distribution algorithm"
+	depends on DST
+	---help---
+	This module allows to create a mirror of the nodes in the
+	distributed storage.
diff --git a/drivers/block/dst/Makefile b/drivers/block/dst/Makefile
new file mode 100644
index 0000000..1400e94
--- /dev/null
+++ b/drivers/block/dst/Makefile
@@ -0,0 +1,6 @@
+obj-$(CONFIG_DST) += dst.o
+
+dst-y := dcore.o kst.o
+
+obj-$(CONFIG_DST_ALG_LINEAR) += alg_linear.o
+obj-$(CONFIG_DST_ALG_MIRROR) += alg_mirror.o
diff --git a/drivers/block/dst/dcore.c b/drivers/block/dst/dcore.c
new file mode 100644
index 0000000..423e7b2
--- /dev/null
+++ b/drivers/block/dst/dcore.c
@@ -0,0 +1,1622 @@
+/*
+ * 2007+ Copyright (c) Evgeniy Polyakov <johnpol@2ka.mipt.ru>
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/blkdev.h>
+#include <linux/bio.h>
+#include <linux/slab.h>
+#include <linux/connector.h>
+#include <linux/socket.h>
+#include <linux/dst.h>
+#include <linux/device.h>
+#include <linux/in.h>
+#include <linux/in6.h>
+#include <linux/buffer_head.h>
+
+#include <net/sock.h>
+
+static LIST_HEAD(dst_storage_list);
+static LIST_HEAD(dst_alg_list);
+static DEFINE_MUTEX(dst_storage_lock);
+static DEFINE_MUTEX(dst_alg_lock);
+static int dst_major;
+static struct kst_worker *kst_main_worker;
+static struct cb_id cn_dst_id = { CN_DST_IDX, CN_DST_VAL };
+
+struct kmem_cache *dst_request_cache;
+
+static char dst_name[] = "Dancing with the smoked neutrino";
+
+/*
+ * DST sysfs tree. For device called 'storage' which is formed
+ * on top of two nodes this looks like this:
+ *
+ * /sys/devices/storage/
+ * /sys/devices/storage/alg : alg_linear
+ * /sys/devices/storage/n-800/type : R: 192.168.4.80:1025
+ * /sys/devices/storage/n-800/size : 800
+ * /sys/devices/storage/n-800/start : 800
+ * /sys/devices/storage/n-800/clean
+ * /sys/devices/storage/n-800/dirty
+ * /sys/devices/storage/n-0/type : R: 192.168.4.81:1025
+ * /sys/devices/storage/n-0/size : 800
+ * /sys/devices/storage/n-0/start : 0
+ * /sys/devices/storage/n-0/clean
+ * /sys/devices/storage/n-0/dirty
+ * /sys/devices/storage/remove_all_nodes
+ * /sys/devices/storage/nodes : sectors (start [size]): 0 [800] | 800 [800]
+ * /sys/devices/storage/name : storage
+ */
+
+static int dst_dev_match(struct device *dev, struct device_driver *drv)
+{
+	return 1;
+}
+
+static void dst_dev_release(struct device *dev)
+{
+}
+
+static struct bus_type dst_dev_bus_type = {
+	.name 		= "dst",
+	.match 		= &dst_dev_match,
+};
+
+static struct device dst_dev = {
+	.bus 		= &dst_dev_bus_type,
+	.release 	= &dst_dev_release
+};
+
+static void dst_node_release(struct device *dev)
+{
+}
+
+static struct device dst_node_dev = {
+	.release 	= &dst_node_release
+};
+
+static void dst_free_alg(struct dst_alg *alg)
+{
+	kfree(alg);
+}
+
+/*
+ * Algorithm is never freed directly,
+ * since its module reference counter is increased
+ * by storage when it is created - just like network protocols.
+ */
+static inline void dst_put_alg(struct dst_alg *alg)
+{
+	module_put(alg->ops->owner);
+	if (atomic_dec_and_test(&alg->refcnt))
+		dst_free_alg(alg);
+}
+
+static void dst_remove_disk(struct dst_storage *st)
+{
+	put_disk(st->disk);
+	blk_cleanup_queue(st->queue);
+}
+
+static void dst_free_storage(struct dst_storage *st)
+{
+	BUG_ON(rb_first(&st->tree_root) != NULL);
+
+	dst_remove_disk(st);
+	dst_put_alg(st->alg);
+	kfree(st);
+}
+
+static inline void dst_put_storage(struct dst_storage *st)
+{
+	if (atomic_dec_and_test(&st->refcnt))
+		dst_free_storage(st);
+}
+
+static struct bio_set *dst_bio_set;
+
+static void dst_destructor(struct bio *bio)
+{
+	bio_free(bio, dst_bio_set);
+}
+
+/*
+ * Internal callback for local requests (i.e. for local disk),
+ * which are splitted between nodes (part with local node destination
+ * ends up with this ->bi_end_io() callback).
+ */
+static int dst_end_io(struct bio *bio, unsigned int size, int err)
+{
+	struct bio *orig_bio = bio->bi_private;
+
+	if (bio->bi_size)
+		return 0;
+
+	dprintk("%s: bio: %p, orig_bio: %p, size: %u, orig_size: %u.\n",
+		__func__, bio, orig_bio, size, orig_bio->bi_size);
+
+	bio_endio(orig_bio, size, 0);
+	bio_put(bio);
+	return 0;
+}
+
+/*
+ * This function sends processing request down to block layer (for local node)
+ * or to network state machine (for remote node).
+ */
+static int dst_node_push(struct dst_request *req)
+{
+	int err = 0;
+	struct dst_node *n = req->node;
+
+	if (n->bdev) {
+		struct bio *bio = req->bio;
+
+		dprintk("%s: start: %llu, num: %d, idx: %d, offset: %u, "
+				"size: %llu, bi_idx: %d, bi_vcnt: %d.\n",
+			__func__, req->start, req->num, req->idx,
+			req->offset, req->size,	bio->bi_idx, bio->bi_vcnt);
+
+		if (likely(bio->bi_idx == req->idx &&
+					bio->bi_vcnt == req->num)) {
+			bio->bi_bdev = n->bdev;
+			bio->bi_sector = req->start;
+		} else {
+			struct bio *clone = bio_alloc_bioset(GFP_NOIO,
+					bio->bi_max_vecs, dst_bio_set);
+			struct bio_vec *bv;
+
+			err = -ENOMEM;
+			if (!clone)
+				goto out_put;
+
+			__bio_clone(clone, bio);
+
+			bv = bio_iovec_idx(clone, req->idx);
+			bv->bv_offset += req->offset;
+			clone->bi_idx = req->idx;
+			clone->bi_vcnt = req->num;
+			clone->bi_bdev = n->bdev;
+			clone->bi_sector = req->start;
+			clone->bi_destructor = dst_destructor;
+			clone->bi_private = bio;
+			clone->bi_size = req->orig_size;
+			clone->bi_end_io = &dst_end_io;
+			req->bio = clone;
+
+			dprintk("%s: start: %llu, num: %d, idx: %d, "
+				"offset: %u, size: %llu, "
+				"bi_idx: %d, bi_vcnt: %d, req: %p, bio: %p.\n",
+				__func__, req->start, req->num, req->idx,
+				req->offset, req->size,
+				clone->bi_idx, clone->bi_vcnt, req, req->bio);
+
+		}
+	}
+
+	err = n->st->alg->ops->remap(req);
+
+out_put:
+	dst_node_put(n);
+	return err;
+}
+
+/*
+ * This function is invoked from block layer request processing function,
+ * its task is to remap block request to different nodes.
+ */
+static int dst_remap(struct dst_storage *st, struct bio *bio)
+{
+	struct dst_node *n;
+	int err = -EINVAL, i, cnt;
+	unsigned int bio_sectors = bio->bi_size>>9;
+	struct bio_vec *bv;
+	struct dst_request req;
+	u64 rest_in_node, start, total_size;
+
+	mutex_lock(&st->tree_lock);
+	n = dst_storage_tree_search(st, bio->bi_sector);
+	mutex_unlock(&st->tree_lock);
+
+	if (!n) {
+		dprintk("%s: failed to find a node for bio: %p, "
+				"sector: %llu.\n",
+				__func__, bio, (u64)bio->bi_sector);
+		return -ENODEV;
+	}
+
+	dprintk("%s: bio: %llu-%llu, dev: %llu-%llu, in sectors.\n",
+			__func__, (u64)bio->bi_sector, (u64)bio->bi_sector+bio_sectors,
+			n->start, n->start+n->size);
+
+	memset(&req, 0, sizeof(struct dst_request));
+
+	start = bio->bi_sector;
+	total_size = bio->bi_size;
+
+	dst_fill_request(&req, bio, start - n->start, n, &kst_bio_endio);
+
+	/*
+	 * Common fast path - block request does not cross
+	 * boundaries between nodes.
+	 */
+	if (likely(bio->bi_sector + bio_sectors <= n->start + n->size))
+		return dst_node_push(&req);
+
+	req.size = 0;
+	req.idx = 0;
+	req.num = 1;
+
+	cnt = bio->bi_vcnt;
+
+	rest_in_node = to_bytes(n->size - req.start);
+
+	for (i = 0; i < cnt; ++i) {
+		bv = bio_iovec_idx(bio, i);
+
+		if (req.size + bv->bv_len >= rest_in_node) {
+			unsigned int diff = req.size + bv->bv_len -
+				rest_in_node;
+
+			req.size += bv->bv_len - diff;
+			req.start = start - n->start;
+			req.orig_size = req.size;
+			req.bio = bio;
+			req.bio_endio = &kst_bio_endio;
+
+			dprintk("%s: split: start: %llu/%llu, size: %llu, "
+					"total_size: %llu, diff: %u, idx: %d, "
+					"num: %d, bv_len: %u, bv_offset: %u.\n",
+					__func__, start, req.start, req.size,
+					total_size, diff, req.idx, req.num,
+					bv->bv_len, bv->bv_offset);
+
+			err = dst_node_push(&req);
+			if (err)
+				break;
+
+			total_size -= req.orig_size;
+
+			if (!total_size)
+				break;
+
+			start += to_sector(req.orig_size);
+
+			req.flags = (test_bit(DST_NODE_FROZEN, &n->flags))?
+				DST_REQ_ALWAYS_QUEUE:0;
+			req.orig_size = req.size = diff;
+
+			if (diff) {
+				req.offset = bv->bv_len - diff;
+				req.idx = req.num - 1;
+			} else {
+				req.idx = req.num;
+				req.offset = 0;
+			}
+
+			dprintk("%s: next: start: %llu, size: %llu, "
+				"total_size: %llu, diff: %u, idx: %d, "
+				"num: %d, offset: %u, bv_len: %u, "
+				"bv_offset: %u.\n",
+				__func__, start, req.size, total_size, diff,
+				req.idx, req.num, req.offset,
+				bv->bv_len, bv->bv_offset);
+
+			mutex_lock(&st->tree_lock);
+			n = dst_storage_tree_search(st, start);
+			mutex_unlock(&st->tree_lock);
+
+			if (!n) {
+				err = -ENODEV;
+				dprintk("%s: failed to find a split node for "
+				  "bio: %p, sector: %llu, start: %llu.\n",
+						__func__, bio, (u64)bio->bi_sector,
+						req.start);
+				break;
+			}
+
+			req.state = n->state;
+			req.node = n;
+			req.start = start - n->start;
+			rest_in_node = to_bytes(n->size - req.start);
+
+			dprintk("%s: req.start: %llu, start: %llu, "
+					"dev_start: %llu, dev_size: %llu, "
+					"rest_in_node: %llu.\n",
+				__func__, req.start, start, n->start,
+				n->size, rest_in_node);
+		} else {
+			req.size += bv->bv_len;
+			req.num++;
+		}
+	}
+
+	dprintk("%s: last request: start: %llu, size: %llu, "
+			"total_size: %llu.\n", __func__,
+			req.start, req.size, total_size);
+	if (total_size) {
+		req.orig_size = req.size;
+		req.bio = bio;
+		req.bio_endio = &kst_bio_endio;
+
+		dprintk("%s: last: start: %llu/%llu, size: %llu, "
+				"total_size: %llu, idx: %d, num: %d.\n",
+			__func__, start, req.start, req.size,
+			total_size, req.idx, req.num);
+
+		err = dst_node_push(&req);
+		if (!err) {
+			total_size -= req.orig_size;
+
+			BUG_ON(total_size != 0);
+		}
+	}
+
+	dprintk("%s: end bio: %p, err: %d.\n", __func__, bio, err);
+	return err;
+}
+
+/*
+ * Distributed storage erquest processing function.
+ * It calls algorithm spcific remapping code only.
+ */
+static int dst_request(struct request_queue *q, struct bio *bio)
+{
+	struct dst_storage *st = q->queuedata;
+	int err;
+
+	dprintk("\n%s: start: st: %p, bio: %p, cnt: %u.\n",
+			__func__, st, bio, bio->bi_vcnt);
+
+	err = dst_remap(st, bio);
+	if (err)
+		bio_endio(bio, bio->bi_size, err);
+
+	dprintk("%s: end: st: %p, bio: %p, err: %d.\n",
+			__func__, st, bio, err);
+	return 0;
+}
+
+static void dst_unplug(struct request_queue *q)
+{
+}
+
+static int dst_flush(struct request_queue *q, struct gendisk *disk, sector_t *sec)
+{
+	return 0;
+}
+
+static int dst_blk_open(struct inode *inode, struct file *file)
+{
+	struct dst_storage *st = inode->i_bdev->bd_disk->private_data;
+
+	atomic_inc(&st->refcnt);
+	return 0;
+}
+
+static int dst_blk_release(struct inode *inode, struct file *file)
+{
+	struct dst_storage *st = inode->i_bdev->bd_disk->private_data;
+
+	dst_put_storage(st);
+	return 0;
+}
+
+static struct block_device_operations dst_blk_ops = {
+	.open = &dst_blk_open,
+	.release = &dst_blk_release,
+	.owner = THIS_MODULE,
+};
+
+/*
+ * Block layer binding - disk is created when array is fully configured
+ * by userspace request.
+ */
+static int dst_create_disk(struct dst_storage *st)
+{
+	int err = -ENOMEM;
+
+	st->queue = blk_alloc_queue(GFP_KERNEL);
+	if (!st->queue)
+		goto err_out_exit;
+
+	st->queue->queuedata = st;
+	blk_queue_make_request(st->queue, dst_request);
+	blk_queue_bounce_limit(st->queue, BLK_BOUNCE_ANY);
+	st->queue->unplug_fn = dst_unplug;
+	st->queue->issue_flush_fn = dst_flush;
+
+	err = -EINVAL;
+	st->disk = alloc_disk(1);
+	if (!st->disk)
+		goto err_out_free_queue;
+
+	st->disk->major = dst_major;
+	st->disk->first_minor = (((unsigned long)st->disk) ^
+		(((unsigned long)st->disk) >> 31)) & 0xff;
+	st->disk->fops = &dst_blk_ops;
+	st->disk->queue = st->queue;
+	st->disk->private_data = st;
+	snprintf(st->disk->disk_name, sizeof(st->disk->disk_name),
+			"dst-%s-%d", st->name, st->disk->first_minor);
+
+	return 0;
+
+err_out_free_queue:
+	blk_cleanup_queue(st->queue);
+err_out_exit:
+	return err;
+}
+
+/*
+ * Shows node name in sysfs.
+ */
+static ssize_t dst_name_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct dst_storage *st = container_of(dev, struct dst_storage, device);
+
+	return sprintf(buf, "%s\n", st->name);
+}
+
+static void dst_remove_all_nodes(struct dst_storage *st)
+{
+	struct dst_node *n, *node, *tmp;
+	struct rb_node *rb_node;
+
+	mutex_lock(&st->tree_lock);
+	while ((rb_node = rb_first(&st->tree_root)) != NULL) {
+		n = rb_entry(rb_node, struct dst_node, tree_node);
+		rb_erase(&n->tree_node, &st->tree_root);
+		if (!n->shared_head && atomic_read(&n->shared_num)) {
+			list_for_each_entry_safe(node, tmp, &n->shared, shared) {
+				list_del(&node->shared);
+				atomic_dec(&n->shared_num);
+				dst_node_put(node->shared_head);
+				node->shared_head = NULL;
+				dst_node_put(node);
+			}
+		}
+		dst_node_put(n);
+	}
+	mutex_unlock(&st->tree_lock);
+}
+
+/*
+ * Shows node layout in syfs.
+ */
+static ssize_t dst_nodes_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct dst_storage *st = container_of(dev, struct dst_storage, device);
+	int size = PAGE_CACHE_SIZE, sz;
+	struct dst_node *n;
+	struct rb_node *rb_node;
+
+	sz = sprintf(buf, "sectors (start [size]): ");
+	size -= sz;
+	buf += sz;
+
+	mutex_lock(&st->tree_lock);
+	for (rb_node = rb_first(&st->tree_root); rb_node;
+			rb_node = rb_next(rb_node)) {
+		n = rb_entry(rb_node, struct dst_node, tree_node);
+		if (size < 32)
+			break;
+		sz = sprintf(buf, "%llu [%llu]", n->start, n->size);
+		buf += sz;
+		size -= sz;
+
+		if (!rb_next(rb_node))
+			break;
+
+		sz = sprintf(buf, " | ");
+		buf += sz;
+		size -= sz;
+	}
+	mutex_unlock(&st->tree_lock);
+	size -= sprintf(buf, "\n");
+	return PAGE_CACHE_SIZE - size;
+}
+
+/*
+ * Algorithm currently being used by given storage.
+ */
+static ssize_t dst_alg_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct dst_storage *st = container_of(dev, struct dst_storage, device);
+	return sprintf(buf, "%s\n", st->alg->name);
+}
+
+/*
+ * Writing to this sysfs file allows to remove all nodes
+ * and storage itself automatically.
+ */
+static ssize_t dst_remove_nodes(struct device *dev,
+		struct device_attribute *attr,
+		const char *buf, size_t count)
+{
+	struct dst_storage *st = container_of(dev, struct dst_storage, device);
+	dst_remove_all_nodes(st);
+	return count;
+}
+
+static DEVICE_ATTR(name, 0444, dst_name_show, NULL);
+static DEVICE_ATTR(nodes, 0444, dst_nodes_show, NULL);
+static DEVICE_ATTR(alg, 0444, dst_alg_show, NULL);
+static DEVICE_ATTR(remove_all_nodes, 0644, NULL, dst_remove_nodes);
+
+static int dst_create_storage_attributes(struct dst_storage *st)
+{
+	int err;
+
+	err = device_create_file(&st->device, &dev_attr_name);
+	err = device_create_file(&st->device, &dev_attr_nodes);
+	err = device_create_file(&st->device, &dev_attr_alg);
+	err = device_create_file(&st->device, &dev_attr_remove_all_nodes);
+	return 0;
+}
+
+static void dst_remove_storage_attributes(struct dst_storage *st)
+{
+	device_remove_file(&st->device, &dev_attr_name);
+	device_remove_file(&st->device, &dev_attr_nodes);
+	device_remove_file(&st->device, &dev_attr_alg);
+	device_remove_file(&st->device, &dev_attr_remove_all_nodes);
+}
+
+static void dst_storage_sysfs_exit(struct dst_storage *st)
+{
+	dst_remove_storage_attributes(st);
+	device_unregister(&st->device);
+}
+
+static int dst_storage_sysfs_init(struct dst_storage *st)
+{
+	int err;
+
+	memcpy(&st->device, &dst_dev, sizeof(struct device));
+	snprintf(st->device.bus_id, sizeof(st->device.bus_id), "%s", st->name);
+
+	err = device_register(&st->device);
+	if (err) {
+		dprintk(KERN_ERR "Failed to register dst device %s, err: %d.\n",
+			st->name, err);
+		goto err_out_exit;
+	}
+
+	dst_create_storage_attributes(st);
+
+	return 0;
+
+err_out_exit:
+	return err;
+}
+
+/*
+ * This functions shows size and start of the appropriate node.
+ * Both are in sectors.
+ */
+static ssize_t dst_show_start(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct dst_node *n = container_of(dev, struct dst_node, device);
+
+	return sprintf(buf, "%llu\n", n->start);
+}
+
+static ssize_t dst_show_size(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct dst_node *n = container_of(dev, struct dst_node, device);
+
+	return sprintf(buf, "%llu\n", n->size);
+}
+
+/*
+ * This function shows node's flags in hex.
+ */
+static ssize_t dst_show_flags(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct dst_node *n = container_of(dev, struct dst_node, device);
+
+	return sprintf(buf, "0x%lx\n", n->flags);
+}
+
+/*
+ * Shows type of the remote node - device major/minor number
+ * for local nodes and address (af_inet ipv4/ipv6 only) for remote nodes.
+ */
+static ssize_t dst_show_type(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct dst_node *n = container_of(dev, struct dst_node, device);
+	struct sockaddr addr;
+	struct socket *sock;
+	int addrlen;
+
+	if (!n->state && !n->bdev)
+		return 0;
+
+	if (n->bdev)
+		return sprintf(buf, "L: %d:%d\n",
+				MAJOR(n->bdev->bd_dev), MINOR(n->bdev->bd_dev));
+
+	sock = n->state->socket;
+	if (sock->ops->getname(sock, &addr, &addrlen, 2))
+		return 0;
+
+	if (sock->ops->family == AF_INET) {
+		struct sockaddr_in *sin = (struct sockaddr_in *)&addr;
+		return sprintf(buf, "R: %u.%u.%u.%u:%d\n",
+			NIPQUAD(sin->sin_addr.s_addr), ntohs(sin->sin_port));
+	} else if (sock->ops->family == AF_INET6) {
+		struct sockaddr_in6 *sin = (struct sockaddr_in6 *)&addr;
+		return sprintf(buf,
+			"R: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x:%d\n",
+			NIP6(sin->sin6_addr), ntohs(sin->sin6_port));
+	}
+	return 0;
+}
+
+static struct device_attribute dst_node_attrs[] = {
+	__ATTR(start, 0444, dst_show_start, NULL),
+	__ATTR(size, 0444, dst_show_size, NULL),
+	__ATTR(flags, 0444, dst_show_flags, NULL),
+	__ATTR(type, 0444, dst_show_type, NULL),
+};
+
+static int dst_create_node_attributes(struct dst_node *n)
+{
+	int err, i;
+
+	for (i=0; i<ARRAY_SIZE(dst_node_attrs); ++i)
+		err = device_create_file(&n->device,
+				&dst_node_attrs[i]);
+	return 0;
+}
+
+static void dst_remove_node_attributes(struct dst_node *n)
+{
+	int i;
+
+	for (i=0; i<ARRAY_SIZE(dst_node_attrs); ++i)
+		device_remove_file(&n->device,
+				&dst_node_attrs[i]);
+}
+
+static void dst_node_sysfs_exit(struct dst_node *n)
+{
+	if (n->device.parent == &n->st->device) {
+		dst_remove_node_attributes(n);
+		device_unregister(&n->device);
+		n->device.parent = NULL;
+	}
+}
+
+static int dst_node_sysfs_init(struct dst_node *n)
+{
+	int err;
+
+	memcpy(&n->device, &dst_node_dev, sizeof(struct device));
+
+	n->device.parent = &n->st->device;
+
+	snprintf(n->device.bus_id, sizeof(n->device.bus_id),
+			"n-%llu-%p", n->start, n);
+	err = device_register(&n->device);
+	if (err) {
+		dprintk(KERN_ERR "Failed to register node, err: %d.\n", err);
+		goto err_out_exit;
+	}
+
+	dst_create_node_attributes(n);
+
+	return 0;
+
+err_out_exit:
+	n->device.parent = NULL;
+	return err;
+}
+
+/*
+ * Gets a reference for given storage, if
+ * storage with given name and algorithm being used
+ * does not exist it is created.
+ */
+static struct dst_storage *dst_get_storage(char *name, char *aname, int alloc)
+{
+	struct dst_storage *st, *rst = NULL;
+	int err;
+	struct dst_alg *alg;
+
+	mutex_lock(&dst_storage_lock);
+	list_for_each_entry(st, &dst_storage_list, entry) {
+		if (!strcmp(name, st->name) && !strcmp(st->alg->name, aname)) {
+			rst = st;
+			atomic_inc(&st->refcnt);
+			break;
+		}
+	}
+
+	if (rst || !alloc) {
+		mutex_unlock(&dst_storage_lock);
+		return rst;
+	}
+
+	st = kzalloc(sizeof(struct dst_storage), GFP_KERNEL);
+	if (!st) {
+		mutex_unlock(&dst_storage_lock);
+		return NULL;
+	}
+
+	mutex_init(&st->tree_lock);
+	/*
+	 * One for storage itself,
+	 * another one for attached node below.
+	 */
+	atomic_set(&st->refcnt, 2);
+	snprintf(st->name, DST_NAMELEN, "%s", name);
+	st->tree_root.rb_node = NULL;
+
+	err = dst_storage_sysfs_init(st);
+	if (err)
+		goto err_out_free;
+
+	err = dst_create_disk(st);
+	if (err)
+		goto err_out_sysfs_exit;
+
+	mutex_lock(&dst_alg_lock);
+	list_for_each_entry(alg, &dst_alg_list, entry) {
+		if (!strcmp(alg->name, aname)) {
+			atomic_inc(&alg->refcnt);
+			try_module_get(alg->ops->owner);
+			st->alg = alg;
+			break;
+		}
+	}
+	mutex_unlock(&dst_alg_lock);
+
+	if (!st->alg)
+		goto err_out_disk_remove;
+
+	list_add_tail(&st->entry, &dst_storage_list);
+	mutex_unlock(&dst_storage_lock);
+
+	return st;
+
+err_out_disk_remove:
+	dst_remove_disk(st);
+err_out_sysfs_exit:
+	dst_storage_sysfs_exit(st);
+err_out_free:
+	mutex_unlock(&dst_storage_lock);
+	kfree(st);
+	return NULL;
+}
+
+/*
+ * Allows to allocate and add new algorithm by external modules.
+ */
+struct dst_alg *dst_alloc_alg(char *name, struct dst_alg_ops *ops)
+{
+	struct dst_alg *alg;
+
+	alg = kzalloc(sizeof(struct dst_alg), GFP_KERNEL);
+	if (!alg)
+		return NULL;
+	snprintf(alg->name, DST_NAMELEN, "%s", name);
+	atomic_set(&alg->refcnt, 1);
+	alg->ops = ops;
+
+	mutex_lock(&dst_alg_lock);
+	list_add_tail(&alg->entry, &dst_alg_list);
+	mutex_unlock(&dst_alg_lock);
+
+	return alg;
+}
+EXPORT_SYMBOL_GPL(dst_alloc_alg);
+
+/*
+ * Removing algorithm from main list of supported algorithms.
+ */
+void dst_remove_alg(struct dst_alg *alg)
+{
+	mutex_lock(&dst_alg_lock);
+	list_del_init(&alg->entry);
+	mutex_unlock(&dst_alg_lock);
+
+	dst_put_alg(alg);
+}
+EXPORT_SYMBOL_GPL(dst_remove_alg);
+
+static void dst_cleanup_node(struct dst_node *n)
+{
+	struct dst_storage *st = n->st;
+
+	if (n->shared_head) {
+		mutex_lock(&st->tree_lock);
+		list_del(&n->shared);
+		mutex_unlock(&st->tree_lock);
+
+		atomic_dec(&n->shared_head->refcnt);
+		dst_node_put(n->shared_head);
+		n->shared_head = NULL;
+	}
+
+	if (n->cleanup)
+		n->cleanup(n);
+	dst_node_sysfs_exit(n);
+	n->st->alg->ops->del_node(n);
+	kfree(n);
+}
+
+/*
+ * This can deadlock if called under st->tree_lock being held,
+ * so take care to only call this when reference counter can not
+ * hit zero and thus start node freeing.
+ */
+void dst_node_put(struct dst_node *n)
+{
+	if (atomic_dec_and_test(&n->refcnt)) {
+		struct dst_storage *st = n->st;
+
+		dprintk("%s: freeing node: %p, start: %llu, size: %llu, "
+			"shared_head: %p, shared_num: %d, flags: %lx.\n",
+			__func__, n, n->start, n->size,
+			n->shared_head, atomic_read(&n->shared_num),
+			n->flags);
+
+		dst_cleanup_node(n);
+		dst_put_storage(st);
+	}
+}
+EXPORT_SYMBOL_GPL(dst_node_put);
+
+static inline int dst_compare_id(struct dst_node *old, u64 new)
+{
+	if (old->start + old->size <= new)
+		return 1;
+	if (old->start > new)
+		return -1;
+	return 0;
+}
+
+/*
+ * Tree of of the nodes, which form the storage.
+ * Tree is indexed via start of the node and its size.
+ * Comparison function above.
+ */
+struct dst_node *dst_storage_tree_search(struct dst_storage *st, u64 start)
+{
+	struct rb_node *n = st->tree_root.rb_node;
+	struct dst_node *dn;
+	int cmp;
+
+	while (n) {
+		dn = rb_entry(n, struct dst_node, tree_node);
+
+		cmp = dst_compare_id(dn, start);
+		dprintk("%s: tree: %llu-%llu, new: %llu.\n",
+			__func__, dn->start, dn->start+dn->size, start);
+		if (cmp < 0)
+			n = n->rb_left;
+		else if (cmp > 0)
+			n = n->rb_right;
+		else {
+			return dst_node_get(dn);
+		}
+	}
+	return NULL;
+}
+EXPORT_SYMBOL_GPL(dst_storage_tree_search);
+
+/*
+ * This function allows to remove a node with given start address
+ * from the storage.
+ */
+static struct dst_node *dst_storage_tree_del(struct dst_storage *st, u64 start)
+{
+	struct dst_node *n = dst_storage_tree_search(st, start);
+
+	if (!n)
+		return NULL;
+
+	rb_erase(&n->tree_node, &st->tree_root);
+	dst_node_put(n);
+	return n;
+}
+
+/*
+ * This function allows to add given node to the storage.
+ * Returns -EEXIST if the same area is already covered by another node.
+ * This is return must be checked for redundancy algorithms.
+ */
+static struct dst_node *dst_storage_tree_add(struct dst_node *new,
+		struct dst_storage *st)
+{
+	struct rb_node **n = &st->tree_root.rb_node, *parent = NULL;
+	struct dst_node *dn;
+	int cmp;
+
+	while (*n) {
+		parent = *n;
+		dn = rb_entry(parent, struct dst_node, tree_node);
+
+		cmp = dst_compare_id(dn, new->start);
+		dprintk("%s: tree: %llu-%llu, new: %llu.\n",
+				__func__, dn->start, dn->start+dn->size,
+				new->start);
+		if (cmp < 0)
+			n = &parent->rb_left;
+		else if (cmp > 0)
+			n = &parent->rb_right;
+		else {
+			return dn;
+		}
+	}
+
+	rb_link_node(&new->tree_node, parent, n);
+	rb_insert_color(&new->tree_node, &st->tree_root);
+
+	return NULL;
+}
+
+/*
+ * This function finds devices major/minor numbers for given pathname.
+ */
+static int dst_lookup_device(const char *path, dev_t *dev)
+{
+	int err;
+	struct nameidata nd;
+	struct inode *inode;
+
+	err = path_lookup(path, LOOKUP_FOLLOW, &nd);
+	if (err)
+		return err;
+
+	inode = nd.dentry->d_inode;
+	if (!inode) {
+		err = -ENOENT;
+		goto out;
+	}
+
+	if (!S_ISBLK(inode->i_mode)) {
+		err = -ENOTBLK;
+		goto out;
+	}
+
+	*dev = inode->i_rdev;
+
+out:
+	path_release(&nd);
+	return err;
+}
+
+/*
+ * Cleanup routings for local, local exporting and remote nodes.
+ */
+static void dst_cleanup_remote(struct dst_node *n)
+{
+	if (n->state) {
+		kst_state_exit(n->state);
+		n->state = NULL;
+	}
+}
+
+static void dst_cleanup_local(struct dst_node *n)
+{
+	if (n->bdev) {
+		sync_blockdev(n->bdev);
+		blkdev_put(n->bdev);
+		n->bdev = NULL;
+	}
+}
+
+static void dst_cleanup_local_export(struct dst_node *n)
+{
+	dst_cleanup_local(n);
+	dst_cleanup_remote(n);
+}
+
+/*
+ * Header receiving function - may block.
+ */
+int dst_data_recv_header(struct socket *sock,
+		struct dst_remote_request *r, int block)
+{
+	struct msghdr msg;
+	struct kvec iov;
+
+	iov.iov_base = r;
+	iov.iov_len = sizeof(struct dst_remote_request);
+
+	msg.msg_iov = (struct iovec *)&iov;
+	msg.msg_iovlen = 1;
+	msg.msg_name = NULL;
+	msg.msg_namelen = 0;
+	msg.msg_control = NULL;
+	msg.msg_controllen = 0;
+	msg.msg_flags = (block)?MSG_WAITALL:MSG_DONTWAIT | MSG_NOSIGNAL;
+
+	return kernel_recvmsg(sock, &msg, &iov, 1, iov.iov_len,
+			msg.msg_flags);
+}
+
+/*
+ * Header sending function - may block.
+ */
+int dst_data_send_header(struct socket *sock,
+		struct dst_remote_request *r)
+{
+	struct msghdr msg;
+	struct kvec iov;
+
+	iov.iov_base = r;
+	iov.iov_len = sizeof(struct dst_remote_request);
+
+	msg.msg_iov = (struct iovec *)&iov;
+	msg.msg_iovlen = 1;
+	msg.msg_name = NULL;
+	msg.msg_namelen = 0;
+	msg.msg_control = NULL;
+	msg.msg_controllen = 0;
+	msg.msg_flags = MSG_WAITALL | MSG_NOSIGNAL;
+
+	return kernel_sendmsg(sock, &msg, &iov, 1, iov.iov_len);
+}
+
+static inline void dst_node_set_size(struct dst_node *n, u64 size)
+{
+	if (n->size)
+		n->size = min(size, n->size);
+	else
+		n->size = size;
+}
+
+/*
+ * Setup routings for local, local exporting and remote nodes.
+ */
+static int dst_setup_local(struct dst_node *n, struct dst_ctl *ctl,
+		struct dst_local_ctl *l)
+{
+	dev_t dev;
+	int err;
+
+	err = dst_lookup_device(l->name, &dev);
+	if (err)
+		return err;
+
+	n->bdev = open_by_devnum(dev, FMODE_READ|FMODE_WRITE);
+	if (!n->bdev)
+		return -ENODEV;
+
+	dst_node_set_size(n, to_sector(n->bdev->bd_inode->i_size));
+
+	return 0;
+}
+
+static int dst_setup_local_export(struct dst_node *n, struct dst_ctl *ctl,
+		struct dst_le_template *tmp)
+{
+	int err;
+
+	err = dst_setup_local(n, ctl, &tmp->le->lctl);
+	if (err)
+		goto err_out_exit;
+
+	n->state = kst_listener_state_init(n, tmp);
+	if (IS_ERR(n->state)) {
+		err = PTR_ERR(n->state);
+		goto err_out_cleanup;
+	}
+
+	return 0;
+
+err_out_cleanup:
+	dst_cleanup_local(n);
+err_out_exit:
+	return err;
+}
+
+static int dst_request_remote_config(struct dst_node *n, struct socket *sock)
+{
+	struct dst_remote_request cfg;
+	int err = -EINVAL;
+
+	memset(&cfg, 0, sizeof(struct dst_remote_request));
+	cfg.cmd = cpu_to_be32(DST_REMOTE_CFG);
+
+	dprintk("%s: sending header.\n", __func__);
+	err = dst_data_send_header(sock, &cfg);
+	if (err != sizeof(struct dst_remote_request))
+		goto out;
+
+	dprintk("%s: receiving header.\n", __func__);
+	err = dst_data_recv_header(sock, &cfg, 1);
+	if (err != sizeof(struct dst_remote_request))
+		goto out;
+
+	err = -EINVAL;
+	dprintk("%s: checking result: cmd: %d, size reported: %llu, csum is supported: %u.\n",
+			__func__, be32_to_cpu(cfg.cmd), be64_to_cpu(cfg.sector), !!cfg.csum);
+	if (be32_to_cpu(cfg.cmd) != DST_REMOTE_CFG)
+		goto out;
+
+	err = 0;
+	dst_node_set_size(n, be64_to_cpu(cfg.sector));
+
+	if (cfg.csum)
+		__set_bit(DST_NODE_USE_CSUM, &n->flags);
+	else
+		__clear_bit(DST_NODE_USE_CSUM, &n->flags);
+
+out:
+	dprintk("%s: n: %p, err: %d.\n", __func__, n, err);
+	return err;
+}
+
+static int dst_setup_remote(struct dst_node *n, struct dst_ctl *ctl,
+		struct dst_remote_ctl *r)
+{
+	int err;
+	struct socket *sock;
+
+	err = sock_create(r->addr.sa_family, r->type, r->proto, &sock);
+	if (err < 0)
+		goto err_out_exit;
+
+	sock->sk->sk_sndtimeo = sock->sk->sk_rcvtimeo =
+		msecs_to_jiffies(DST_DEFAULT_TIMEO);
+
+	err = sock->ops->connect(sock, (struct sockaddr *)&r->addr,
+			r->addr.sa_data_len, 0);
+	if (err)
+		goto err_out_destroy;
+
+	err = dst_request_remote_config(n, sock);
+	if (err)
+		goto err_out_destroy;
+
+	n->state = kst_data_state_init(n, sock);
+	if (IS_ERR(n->state)) {
+		err = PTR_ERR(n->state);
+		goto err_out_destroy;
+	}
+
+	return 0;
+
+err_out_destroy:
+	sock_release(sock);
+err_out_exit:
+
+	dprintk("%s: n: %p, err: %d.\n", __func__, n, err);
+	return err;
+}
+
+/*
+ * This function inserts node into storage.
+ */
+static int dst_insert_node(struct dst_node *n)
+{
+	int err;
+	struct dst_storage *st = n->st;
+	struct dst_node *dn;
+
+	err = st->alg->ops->add_node(n);
+	if (err)
+		goto err_out_exit;
+
+	err = dst_node_sysfs_init(n);
+	if (err)
+		goto err_out_remove_node;
+
+	mutex_lock(&st->tree_lock);
+	dn = dst_storage_tree_add(n, st);
+	if (dn) {
+		err = -EINVAL;
+		dn->size = st->disk_size;
+		if (dn->start == n->start)
+			err = 0;
+	}
+	mutex_unlock(&st->tree_lock);
+	if (err)
+		goto err_out_sysfs_exit;
+
+	if (n->priv_callback)
+		n->priv_callback(n);
+
+	return 0;
+
+err_out_sysfs_exit:
+	dst_node_sysfs_exit(n);
+err_out_remove_node:
+	st->alg->ops->del_node(n);
+err_out_exit:
+	return err;
+}
+
+static struct dst_node *dst_alloc_node(struct dst_ctl *ctl,
+		void (*cleanup)(struct dst_node *))
+{
+	struct dst_storage *st;
+	struct dst_node *n;
+
+	st = dst_get_storage(ctl->st, ctl->alg, 1);
+	if (!st)
+		goto err_out_exit;
+
+	n = kzalloc(sizeof(struct dst_node), GFP_KERNEL);
+	if (!n)
+		goto err_out_put_storage;
+
+	if (ctl->flags & DST_CTL_USE_CSUM)
+		__set_bit(DST_NODE_USE_CSUM, &n->flags);
+
+	n->w = kst_main_worker;
+	n->st = st;
+	n->cleanup = cleanup;
+	n->start = ctl->start;
+	n->size = ctl->size;
+	INIT_LIST_HEAD(&n->shared);
+	n->shared_head = NULL;
+	atomic_set(&n->shared_num, 0);
+	atomic_set(&n->refcnt, 1);
+
+	return n;
+
+err_out_put_storage:
+	mutex_lock(&dst_storage_lock);
+	list_del_init(&st->entry);
+	mutex_unlock(&dst_storage_lock);
+
+	dst_put_storage(st);
+err_out_exit:
+	return NULL;
+}
+
+/*
+ * Control callback for userspace commands to setup
+ * different nodes and start/stop array.
+ */
+static int dst_add_remote(struct dst_ctl *ctl, void *data, unsigned int len)
+{
+	struct dst_node *n;
+	int err;
+	struct dst_remote_ctl *rctl = data;
+
+	if (len != sizeof(struct dst_remote_ctl))
+		return -EINVAL;
+
+	n = dst_alloc_node(ctl, &dst_cleanup_remote);
+	if (!n)
+		return -ENOMEM;
+
+	err = dst_setup_remote(n, ctl, rctl);
+	if (err < 0)
+		goto err_out_free;
+
+	err = dst_insert_node(n);
+	if (err)
+		goto err_out_cleanup;
+
+	return 0;
+
+err_out_cleanup:
+	if (n->cleanup)
+		n->cleanup(n);
+err_out_free:
+	dst_put_storage(n->st);
+	kfree(n);
+	return err;
+}
+
+static int dst_add_local_export(struct dst_ctl *ctl, void *data, unsigned int len)
+{
+	struct dst_node *n;
+	int err;
+	struct dst_le_template tmp;
+
+	if (len < sizeof(struct dst_local_export_ctl))
+		return -EINVAL;
+
+	tmp.le = data;
+
+	len -= sizeof(struct dst_local_export_ctl);
+	data += sizeof(struct dst_local_export_ctl);
+
+	if (len != tmp.le->secure_attr_num * sizeof(struct dst_secure_user))
+		return -EINVAL;
+
+	tmp.data = data;
+
+	n = dst_alloc_node(ctl, &dst_cleanup_local_export);
+	if (!n)
+		return -EINVAL;
+
+	err = dst_setup_local_export(n, ctl, &tmp);
+	if (err < 0)
+		goto err_out_free;
+
+	err = dst_insert_node(n);
+	if (err)
+		goto err_out_cleanup;
+
+	return 0;
+
+err_out_cleanup:
+	if (n->cleanup)
+		n->cleanup(n);
+err_out_free:
+	dst_put_storage(n->st);
+	kfree(n);
+	return err;
+}
+
+static int dst_add_local(struct dst_ctl *ctl, void *data, unsigned int len)
+{
+	struct dst_node *n;
+	int err;
+	struct dst_local_ctl *lctl = data;
+
+	if (len != sizeof(struct dst_local_ctl))
+		return -EINVAL;
+
+	n = dst_alloc_node(ctl, &dst_cleanup_local);
+	if (!n)
+		return -EINVAL;
+
+	err = dst_setup_local(n, ctl, lctl);
+	if (err < 0)
+		goto err_out_free;
+
+	err = dst_insert_node(n);
+	if (err)
+		goto err_out_cleanup;
+
+	return 0;
+
+err_out_cleanup:
+	if (n->cleanup)
+		n->cleanup(n);
+err_out_free:
+	dst_put_storage(n->st);
+	kfree(n);
+	return err;
+}
+
+static int dst_del_node(struct dst_ctl *ctl, void *data, unsigned int len)
+{
+	struct dst_node *n;
+	struct dst_storage *st;
+	int err = -ENODEV;
+
+	if (len)
+		return -EINVAL;
+
+	st = dst_get_storage(ctl->st, ctl->alg, 0);
+	if (!st)
+		goto err_out_exit;
+
+	mutex_lock(&st->tree_lock);
+	n = dst_storage_tree_del(st, ctl->start);
+	mutex_unlock(&st->tree_lock);
+	if (!n)
+		goto err_out_put;
+
+	dst_node_put(n);
+	dst_put_storage(st);
+
+	return 0;
+
+err_out_put:
+	dst_put_storage(st);
+err_out_exit:
+	return err;
+}
+
+static int dst_start_storage(struct dst_ctl *ctl, void *data, unsigned int len)
+{
+	struct dst_storage *st;
+	int err = -ENXIO;
+
+	if (len)
+		return -EINVAL;
+
+	st = dst_get_storage(ctl->st, ctl->alg, 0);
+	if (!st)
+		return -ENODEV;
+
+	mutex_lock(&st->tree_lock);
+	if (!(st->flags & DST_ST_STARTED) && st->disk_size) {
+		set_capacity(st->disk, st->disk_size);
+		add_disk(st->disk);
+		st->flags |= DST_ST_STARTED;
+		printk("%s: STARTED name: '%s', st: %p, disk_size: %llu.\n",
+				__func__, st->name, st, st->disk_size);
+		err = 0;
+	}
+	mutex_unlock(&st->tree_lock);
+
+	dst_put_storage(st);
+
+	return err;
+}
+
+static int dst_stop_storage(struct dst_ctl *ctl, void *data, unsigned int len)
+{
+	struct dst_storage *st;
+
+	if (len)
+		return -EINVAL;
+
+	st = dst_get_storage(ctl->st, ctl->alg, 0);
+	if (!st)
+		return -ENODEV;
+
+	printk("%s: STOPPED storage: %s.\n", __func__, st->name);
+
+	dst_storage_sysfs_exit(st);
+
+	mutex_lock(&dst_storage_lock);
+	list_del_init(&st->entry);
+	mutex_unlock(&dst_storage_lock);
+
+	if (st->flags & DST_ST_STARTED)
+		del_gendisk(st->disk);
+
+	dst_remove_all_nodes(st);
+	dst_put_storage(st); /* One reference got above */
+	dst_put_storage(st); /* Another reference set during initialization */
+
+	return 0;
+}
+
+typedef int (*dst_command_func)(struct dst_ctl *ctl, void *data, unsigned int len);
+
+/*
+ * List of userspace commands.
+ */
+static dst_command_func dst_commands[] = {
+	[DST_ADD_REMOTE] = &dst_add_remote,
+	[DST_ADD_LOCAL] = &dst_add_local,
+	[DST_ADD_LOCAL_EXPORT] = &dst_add_local_export,
+	[DST_DEL_NODE] = &dst_del_node,
+	[DST_START_STORAGE] = &dst_start_storage,
+	[DST_STOP_STORAGE] = &dst_stop_storage,
+};
+
+/*
+ * Configuration parser.
+ */
+static void cn_dst_callback(void *data)
+{
+	struct dst_ctl *ctl;
+	struct cn_msg *msg = data;
+	int err;
+	struct dst_ctl_ack *ack;
+
+	if (msg->len < sizeof(struct dst_ctl)) {
+		err = -EBADMSG;
+		goto out;
+	}
+
+	ctl = (struct dst_ctl *)msg->data;
+
+	if (ctl->cmd >= DST_CMD_MAX) {
+		err = -EINVAL;
+		goto out;
+	}
+
+	err = dst_commands[ctl->cmd](ctl, msg->data + sizeof(struct dst_ctl),
+			msg->len - sizeof(struct dst_ctl));
+
+out:
+	ack = kmalloc(sizeof(struct dst_ctl_ack), GFP_KERNEL);
+	if (!ack)
+		return;
+
+	memcpy(&ack->msg, msg, sizeof(struct cn_msg));
+
+	ack->msg.ack = msg->ack + 1;
+	ack->msg.len = sizeof(struct dst_ctl_ack) - sizeof(struct cn_msg);
+
+	ack->error = err;
+
+	cn_netlink_send(&ack->msg, 0, GFP_KERNEL);
+	kfree(ack);
+}
+
+static int dst_sysfs_init(void)
+{
+	return bus_register(&dst_dev_bus_type);
+}
+
+static void dst_sysfs_exit(void)
+{
+	bus_unregister(&dst_dev_bus_type);
+}
+
+static int __init dst_sys_init(void)
+{
+	int err = -ENOMEM;
+
+	dst_request_cache = kmem_cache_create("dst", sizeof(struct dst_request),
+				       0, 0, NULL, NULL);
+	if (!dst_request_cache)
+		return -ENOMEM;
+
+	dst_bio_set = bioset_create(32, 32);
+	if (!dst_bio_set)
+		goto err_out_destroy;
+
+	err = register_blkdev(dst_major, DST_NAME);
+	if (err < 0)
+		goto err_out_destroy_bioset;
+	if (err)
+		dst_major = err;
+
+	err = dst_sysfs_init();
+	if (err)
+		goto err_out_unregister;
+
+	kst_main_worker = kst_worker_init(0);
+	if (IS_ERR(kst_main_worker)) {
+		err = PTR_ERR(kst_main_worker);
+		goto err_out_sysfs_exit;
+	}
+
+	err = cn_add_callback(&cn_dst_id, "DST", cn_dst_callback);
+	if (err)
+		goto err_out_worker_exit;
+
+	printk(KERN_INFO "Distributed storage, '%s' release.\n", dst_name);
+
+	return 0;
+
+err_out_worker_exit:
+	kst_worker_exit(kst_main_worker);
+err_out_sysfs_exit:
+	dst_sysfs_exit();
+err_out_unregister:
+	unregister_blkdev(dst_major, DST_NAME);
+err_out_destroy_bioset:
+	bioset_free(dst_bio_set);
+err_out_destroy:
+	kmem_cache_destroy(dst_request_cache);
+	return err;
+}
+
+static void __exit dst_sys_exit(void)
+{
+	cn_del_callback(&cn_dst_id);
+	dst_sysfs_exit();
+	unregister_blkdev(dst_major, DST_NAME);
+	kst_exit_all();
+	bioset_free(dst_bio_set);
+	kmem_cache_destroy(dst_request_cache);
+}
+
+module_init(dst_sys_init);
+module_exit(dst_sys_exit);
+
+MODULE_DESCRIPTION("Distributed storage");
+MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>");
+MODULE_LICENSE("GPL");
diff --git a/include/linux/connector.h b/include/linux/connector.h
index 10eb56b..9e67d58 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -36,9 +36,11 @@
 #define CN_VAL_CIFS                     0x1
 #define CN_W1_IDX			0x3	/* w1 communication */
 #define CN_W1_VAL			0x1
+#define CN_DST_IDX			0x4	/* Distributed storage */
+#define CN_DST_VAL			0x1
 
 
-#define CN_NETLINK_USERS		4
+#define CN_NETLINK_USERS		5
 
 /*
  * Maximum connector's message size.
diff --git a/include/linux/dst.h b/include/linux/dst.h
new file mode 100644
index 0000000..df92d54
--- /dev/null
+++ b/include/linux/dst.h
@@ -0,0 +1,404 @@
+/*
+ * 2007+ Copyright (c) Evgeniy Polyakov <johnpol@2ka.mipt.ru>
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __DST_H
+#define __DST_H
+
+#include <linux/types.h>
+#include <linux/connector.h>
+
+#define DST_NAMELEN		32
+#define DST_NAME		"dst"
+#define DST_IOCTL		0xba
+
+enum {
+	DST_DEL_NODE	= 0,	/* Remove node with given id from storage */
+	DST_ADD_REMOTE,		/* Add remote node with given id to the storage */
+	DST_ADD_LOCAL,		/* Add local node with given id to the storage */
+	DST_ADD_LOCAL_EXPORT,	/* Add local node with given id to the storage to be exported and used by remote peers */
+	DST_START_STORAGE,	/* Array is ready and storage can be started, if there will be new nodes
+				 * added to the storage, they will be checked against existing size and
+				 * probably be dropped (for example in mirror format when new node has smaller
+				 * size than array created) or inserted.
+				 */
+	DST_STOP_STORAGE,	/* Remove array and all nodes. */
+	DST_CMD_MAX
+};
+
+#define DST_CTL_FLAGS_REMOTE	(1<<0)
+#define DST_CTL_FLAGS_EXPORT	(1<<1)
+#define DST_CTL_USE_CSUM	(1<<2)
+
+struct dst_ctl
+{
+	char			st[DST_NAMELEN];
+	char			alg[DST_NAMELEN];
+	__u32			flags, cmd;
+	__u64			start, size;
+};
+
+struct dst_ctl_ack
+{
+	struct cn_msg		msg;
+	int			error;
+	int			unused[3];
+};
+
+struct dst_local_ctl
+{
+	char			name[DST_NAMELEN];
+};
+
+#define SADDR_MAX_DATA	128
+
+struct saddr {
+	unsigned short		sa_family;			/* address family, AF_xxx	*/
+	char			sa_data[SADDR_MAX_DATA];	/* 14 bytes of protocol address	*/
+	unsigned short		sa_data_len;			/* Number of bytes used in sa_data */
+};
+
+struct dst_remote_ctl
+{
+	__u16			type;
+	__u16			proto;
+	struct saddr		addr;
+};
+
+#define DST_PERM_READ		(1<<0)
+#define DST_PERM_WRITE		(1<<1)
+
+/*
+ * Right now it is simple model, where each remote address
+ * is assigned to set of permissions it is allowed to perform.
+ * In real world block device does not know anything but
+ * reading and writing, so it should be more than enough.
+ */
+struct dst_secure_user
+{
+	unsigned int		permissions;
+	unsigned short		check_offset;
+	struct saddr		addr;
+};
+
+struct dst_local_export_ctl
+{
+	__u32			backlog;
+	int			secure_attr_num;
+	struct dst_local_ctl	lctl;
+	struct dst_remote_ctl	rctl;
+};
+
+enum {
+	DST_REMOTE_CFG		= 1, 		/* Request remote configuration */
+	DST_WRITE,				/* Writing */
+	DST_READ,				/* Reading */
+	DST_NCMD_MAX,
+};
+
+struct dst_remote_request
+{
+	__u32			cmd;
+	__u32			csum;
+	__u32			size;
+	__u32			offset;
+	__u64			sector;
+};
+
+#ifdef __KERNEL__
+
+#include <linux/rbtree.h>
+#include <linux/net.h>
+#include <linux/blkdev.h>
+#include <linux/bio.h>
+#include <linux/mempool.h>
+#include <linux/device.h>
+#include <linux/crc32c.h>
+
+//#define CONFIG_DST_DEBUG
+
+#ifdef CONFIG_DST_DEBUG
+#define dprintk(f, a...) printk(KERN_NOTICE f, ##a)
+#else
+static inline void __attribute__ ((format (printf, 1, 2))) dprintk(const char * fmt, ...) {}
+#endif
+
+struct kst_worker
+{
+	struct list_head	entry;
+
+	struct list_head	state_list;
+	struct mutex		state_mutex;
+
+	struct list_head	ready_list;
+	spinlock_t		ready_lock;
+
+	mempool_t		*req_pool;
+
+	struct task_struct	*thread;
+
+	wait_queue_head_t 	wait;
+
+	int			id;
+};
+
+struct kst_state;
+struct dst_node;
+
+#define DST_REQ_HEADER_SENT	(1<<0)
+#define DST_REQ_EXPORT		(1<<1)
+#define DST_REQ_EXPORT_WRITE	(1<<2)
+#define DST_REQ_EXPORT_READ	(1<<3)
+#define DST_REQ_ALWAYS_QUEUE	(1<<4)
+#define DST_REQ_CHEKSUM_RECV	(1<<5)
+#define DST_REQ_CHECK_QUEUE	(1<<6)
+
+struct dst_request
+{
+	struct list_head	request_list_entry;
+	struct bio		*bio;
+	struct kst_state 	*state;
+	struct dst_node 	*node;
+
+	u32			tmp_csum, tmp_offset;
+
+	u32			flags;
+
+	u32			offset;
+	int			idx, num;
+
+	int 			(*callback)(struct dst_request *dst,
+						unsigned int revents);
+	void			(*bio_endio)(struct dst_request *dst, 
+						int err);
+
+	atomic_t		refcnt;
+	void			*priv;
+
+	u64			size, orig_size, start;
+};
+
+struct kst_state_ops
+{
+	int 		(*init)(struct kst_state *, void *);
+	int 		(*push)(struct dst_request *req);
+	int		(*ready)(struct kst_state *);
+	int		(*recovery)(struct kst_state *, int err);
+	void 		(*exit)(struct kst_state *);
+};
+
+struct kst_state
+{
+	struct list_head	entry;
+	struct list_head	ready_entry;
+
+	wait_queue_t 		wait;
+	wait_queue_head_t 	*whead;
+
+	struct dst_node		*node;
+	struct socket		*socket;
+
+	u32			permissions;
+
+	struct mutex		request_lock;
+	struct list_head	request_list;
+
+	struct kst_state_ops	*ops;
+};
+
+#define DST_DEFAULT_TIMEO	2000
+
+struct dst_storage;
+
+struct dst_alg_ops
+{
+	int			(*add_node)(struct dst_node *n);
+	void			(*del_node)(struct dst_node *n);
+	int 			(*remap)(struct dst_request *req);
+	int			(*error)(struct kst_state *state, int err);
+	struct module 		*owner;
+};
+
+struct dst_alg
+{
+	struct list_head	entry;
+	char			name[DST_NAMELEN];
+	atomic_t		refcnt;
+	struct dst_alg_ops	*ops;
+};
+
+#define DST_ST_STARTED		(1<<0)
+
+struct dst_storage
+{
+	struct list_head	entry;
+	char			name[DST_NAMELEN];
+	struct dst_alg		*alg;
+	atomic_t		refcnt;
+	struct mutex		tree_lock;
+	struct rb_root		tree_root;
+
+	struct request_queue	*queue;
+	struct gendisk		*disk;
+
+	long			flags;
+	u64			disk_size;
+
+	struct device		device;
+};
+
+#define DST_NODE_FROZEN		0
+#define DST_NODE_NOTSYNC	1
+#define DST_NODE_USE_CSUM	2
+
+struct dst_node
+{
+	struct rb_node		tree_node;
+
+	struct list_head	shared;
+	struct dst_node		*shared_head;
+
+	struct block_device 	*bdev;
+	struct dst_storage	*st;
+	struct kst_state	*state;
+	struct kst_worker	*w;
+
+	atomic_t		refcnt;
+	atomic_t		shared_num;
+
+	void			(*cleanup)(struct dst_node *);
+
+	long			flags;
+
+	u64			start, size;
+
+	void			(*priv_callback)(struct dst_node *);
+	void			*priv;
+
+	struct device		device;
+};
+
+struct dst_le_template
+{
+	struct dst_local_export_ctl	*le;
+	void 				*data;
+};
+
+struct dst_secure
+{
+	struct list_head	sec_entry;
+	struct dst_secure_user	sec;
+};
+
+void kst_state_exit(struct kst_state *st);
+
+struct kst_worker *kst_worker_init(int id);
+void kst_worker_exit(struct kst_worker *w);
+
+struct kst_state *kst_listener_state_init(struct dst_node *node,
+		struct dst_le_template *tmp);
+struct kst_state *kst_data_state_init(struct dst_node *node,
+		struct socket *newsock);
+
+void kst_wake(struct kst_state *st);
+
+void kst_exit_all(void);
+
+struct dst_alg *dst_alloc_alg(char *name, struct dst_alg_ops *ops);
+void dst_remove_alg(struct dst_alg *alg);
+
+struct dst_node *dst_storage_tree_search(struct dst_storage *st, u64 start);
+
+void dst_node_put(struct dst_node *n);
+
+static inline struct dst_node *dst_node_get(struct dst_node *n)
+{
+	atomic_inc(&n->refcnt);
+	return n;
+}
+
+struct dst_request *dst_clone_request(struct dst_request *req, mempool_t *pool);
+void dst_free_request(struct dst_request *req);
+
+void kst_complete_req(struct dst_request *req, int err);
+void kst_bio_endio(struct dst_request *req, int err);
+void kst_del_req(struct dst_request *req);
+int kst_enqueue_req(struct kst_state *st, struct dst_request *req);
+
+int kst_data_callback(struct dst_request *req, unsigned int revents);
+
+extern struct kmem_cache *dst_request_cache;
+
+static inline sector_t to_sector(unsigned long long n)
+{
+	return (n >> 9);
+}
+
+static inline unsigned long to_bytes(sector_t n)
+{
+	return (n << 9);
+}
+
+/*
+ * Checks state's permissions.
+ * Returns -EPERM if check failed.
+ */
+static inline int kst_check_permissions(struct kst_state *st, struct bio *bio)
+{
+	if ((bio_rw(bio) == WRITE) && !(st->permissions & DST_PERM_WRITE))
+		return -EPERM;
+
+	return 0;
+}
+
+static inline __u32 dst_csum_data(unsigned char *d, unsigned int size)
+{
+	return crc32c_le(0, d, size);
+}
+
+static inline void kst_convert_header(struct dst_remote_request *r)
+{
+	r->cmd = be32_to_cpu(r->cmd);
+	r->sector = be64_to_cpu(r->sector);
+	r->offset = be32_to_cpu(r->offset);
+	r->size = be32_to_cpu(r->size);
+	r->csum = be32_to_cpu(r->csum);
+}
+
+extern int dst_data_send_header(struct socket *sock,
+		struct dst_remote_request *r);
+extern int dst_data_recv_header(struct socket *sock,
+		struct dst_remote_request *r, int block);
+
+static inline void dst_fill_request(struct dst_request *req, struct bio *bio,
+	u64 start, struct dst_node *n, void (*req_bio_endio)(struct dst_request *req, int err))
+{
+	req->flags = (test_bit(DST_NODE_FROZEN, &n->flags))?
+				DST_REQ_ALWAYS_QUEUE:0;
+	req->start = start;
+	req->offset = 0;
+	req->state = n->state;
+	req->node = n;
+	req->bio = bio;
+
+	req->size = bio->bi_size;
+	req->orig_size = bio->bi_size;
+	req->idx = bio->bi_idx;
+	req->num = bio->bi_vcnt;
+
+	req->bio_endio = req_bio_endio;
+}
+
+#endif /* __KERNEL__ */
+#endif /* __DST_H */


^ permalink raw reply related

* [1/4] DST: Distributed storage documentation.
From: Evgeniy Polyakov @ 2007-12-17 15:03 UTC (permalink / raw)
  To: lkml; +Cc: netdev, linux-fsdevel
In-Reply-To: <11979038181687@2ka.mipt.ru>


Distributed storage documentation.

Algorithms used in the system, userspace interfaces
(sysfs dirs and files), design and implementation details
are described here.

Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>


diff --git a/Documentation/dst/algorithms.txt b/Documentation/dst/algorithms.txt
new file mode 100644
index 0000000..1437a6a
--- /dev/null
+++ b/Documentation/dst/algorithms.txt
@@ -0,0 +1,115 @@
+Each storage by itself is just a set of contiguous logical blocks, with
+allowed number of operations. Nodes, each of which has own start and size,
+are placed into storage by appropriate algorithm, which remaps
+logical sector number into real node's sector. One can create
+own algorithms, since DST has pluggable interface for that.
+Currently mirrored and linear algorithms are supported.
+
+Let's briefly describe how they work.
+
+Linear algorithm.
+Simple approach of concatenating storages into single device with
+increased size is used in this algorithm. Essentially new device
+has size equal to sum of sizes of underlying nodes and nodes are
+placed one after another.
+
+  /----- Node 1 ---\                         /------ Node 3 ----\
+start              end                     start               end
+ |==================|========================|==================|
+ |                start                     end                 |
+ |                  \------- Node 2 ---------/                  |
+ |                                                              |
+start                                                          end
+ \-------------------------- DST storage ----------------------/
+
+			        /\
+			        ||
+			        ||
+
+			   IO operations
+
+			    Figure 1. 
+     3 nodes combined into single storage using linear algorithm.
+
+Mirror algorithm.
+In this algorithms nodes are placed under each other, so when
+operation comes to the first one, it can be mirrored to all
+underlying nodes. In case of reading, actual data is obtained from
+the nearest node - algoritm keeps track of previous operation
+and knows where it was stopped, so that subsequent seek to the 
+start of the new request will take the shortest time.
+Writing is always mirrored to all underlying nodes.
+
+                  IO operations
+                       ||
+                       ||
+                       \/
+
+|---------------- DST storage -------------------|
+|      prev position                             |
+|-------|------------ Node 1 --------------------|
+|                              prev pos          |
+|-------------------- Node 2 -----|--------------|
+|prev pos                                        |
+|---|---------------- Node 3 --------------------|
+
+		Figure 2.
+   3 nodes combined into single storage using mirror algorithm.
+
+Each algorithm must implement number of callbacks,
+which must be registered during initialization time.
+
+struct dst_alg_ops
+{
+	int			(*add_node)(struct dst_node *n);
+	void			(*del_node)(struct dst_node *n);
+	int 			(*remap)(struct dst_request *req);
+	int			(*error)(struct kst_state *state, int err);
+	struct module 		*owner;
+};
+
+@add_node.
+This callback is invoked when new node is being added into the storage,
+but before node is actually added into the storage, so that it could
+be accessed from it. When it is called, all appropriate initialization
+of the underlying device is already completed (system has been connected
+to remote node or got a reference to the local block device). At this
+stage algorithm can add node into private map. 
+It must return zero on success or negative value otherwise.
+
+@del_node.
+This callback is invoked when node is being deleted from the storage,
+i.e. when its reference counter hits zero. It is called before
+any cleaning is performed.
+It must return zero on success or negative value otherwise.
+
+@remap.
+This callback is invoked each time new bio hits the storage.
+Request structure contains BIO itself, pointer to the node, which originally
+stores the whole region under given IO request, and various parameters
+used by storage core to process this block request.
+It must return zero on success or negative value otherwise. It is upto
+this method to call all cleaning if remapping failed, for example it must
+call kst_bio_endio() for given callback in case of error, which in turn
+will call bio_endio(). Note, that dst_request structure provided in this
+callback is allocated on stack, so if there is a need to use it outside
+of the given function, it must be cloned (it will happen automatically
+in state's push callback, but that copy will not be shared by any other
+user).
+
+@error.
+This callback is invoked for each error, which happend when processed
+requests for remote nodes or when talking to remote size
+of the local export node (state contains data related to data
+transfers over the network).
+If this function has fixed given error, it must return 0 or negative
+error value otherwise.
+
+@owner.
+This is module reference counter updated automatically by DST core.
+
+Algorithm must provide its name and above structure to the 
+dst_alloc_alg() function, which will return a reference to the newly
+created algorithm.
+To remove it, one needs to call dst_remove_alg() with given algorithm
+pointer.
diff --git a/Documentation/dst/dst.txt b/Documentation/dst/dst.txt
new file mode 100644
index 0000000..a6ea126
--- /dev/null
+++ b/Documentation/dst/dst.txt
@@ -0,0 +1,69 @@
+Distributed storage. Design and implementation.
+http://tservice.net.ru/~s0mbre/old/?section=projects&item=dst
+
+	     Evgeniy Polyakov
+
+This document is intended to briefly describe design and
+implementation details of the distributed storage project,
+aimed to create ability to group physically and/or logically
+distributed storages into single device.
+
+Main operational unit in the storage is node. Node can represent
+either remote storage, connected to local machine, or local
+device, or storage exported to the outside of the system.
+Here goes small explaination of basic therms.
+
+Local node.
+This node is just a logical link between block device (with given
+major and minor numbers) and structure in the DST hierarchy,
+which represents number of sectors on the area, corresponding to given
+block device. it can be a disk, a device mapper node or stacked
+block device on top of another underlying DST nodes.
+
+Local export node.
+Essentially the same as local node, but it allows to access
+to its data via network. Remote clients can connect to given local 
+export node and read or write blocks according to its size.
+Blocks are then forwarded to underlying local node and processed
+there accordingly to the nature of the local node.
+
+Remote node.
+This type of nodes contain remotely accessible devices. One can think
+about remote nodes as remote disks, which can be connected to
+local system and combined into single storage. Remote nodes
+are presented as number of sectors accessed over the network
+by the local machine, where distributed storage is being formed.
+Remote node allows autoconfiguration - size of the storage and
+checksumming will be requested during node initialization (if remote
+node supports checksumming it will be turned on).
+
+
+Each node or set of them can be formed into single array, which
+in turn becomes a local node, which can be exported further by stacking
+a local export node on top of it.
+
+Each storage by itself is just a set of contiguous logical blocks, with
+allowed number of operations. Nodes, each of which has own start and size,
+are placed into storage by appropriate algorithm, which remaps
+logical sector number into real node's sector. One can create
+own algorithms, since DST has pluggable interface for that.
+Currently mirrored and linear algorithms are supported.
+One can find more details in Documentation/dst/algorithms.txt file.
+
+Main goal of the distributed storage is to combine remote nodes into
+single device, so each block IO request is being sent over the network
+(contrary requests for local nodes are handled by the gneric block
+layer features). Each network connection has number of variables which
+describe it (socket, list of requests, error handling and so on),
+which form kst_state structure. This network state is added into per-socket
+polling state machine, and can be processed by dedicated thread when
+becomes ready. This system forms asynchronous IO for given block
+requests. If block request can be processed without blocking, then
+no new structures are allocated and async part of the state is not used.
+
+When connection to the remote peer breaks, DST core tries to reconnect
+to failed node and no requests are marked as errorneous, instead
+they live in the queue until reconnectin is established.
+
+Userspace code, setup documentation and examples can be found on project's
+homepage above.
diff --git a/Documentation/dst/sysfs.txt b/Documentation/dst/sysfs.txt
new file mode 100644
index 0000000..63e5c00
--- /dev/null
+++ b/Documentation/dst/sysfs.txt
@@ -0,0 +1,33 @@
+This file describes sysfs files created for each storage.
+
+1. Per-storage files.
+Each storage has its own dir /sysfs/devices/$storage_name,
+which contains following files:
+
+alg - contains name of the algorithm used to created given storage
+name - name of the storage
+nodes - map of the storage (list of nodes and their sizes and starts)
+remove_all_nodes - writable file which allows to remove all nodes from given
+	storage
+n-$start-$cookie - per node directory, where
+	$start - start of the given node in sectors,
+	$cookie - unique node's id used by DST
+
+2. Per-node files.
+Node's files are located in /sysfs/devices/$storage_name/n-$start-$cookie
+directory, described above.
+
+clean - writable file, writing leads to marking node as clean (in sync)
+dirty - writable file, writing leads to marking node as dirty (not in sync)
+resync_size - size of the resync sliding window
+resync_timout - resync requests checking timeout (in milliseconds) of
+	the background worker thread
+state - sync/notsync state of the node in the mirror
+
+flags - flags of the given node
+size - size of the given node in sectors
+start - start of the given node in the storage in sectors
+type - contains type of the node in the following format: $type: $dev
+	where $type is either 'L' or 'R' - local or remote acordingly,
+	and $dev is device name for local node (/dev/sda1 for example)
+	or address of the remote node (192.168.4.81:1025 for example)


^ permalink raw reply related

* [3/4] DST: Network state machine.
From: Evgeniy Polyakov @ 2007-12-17 15:03 UTC (permalink / raw)
  To: lkml; +Cc: netdev, linux-fsdevel
In-Reply-To: <11979038192663@2ka.mipt.ru>


Network state machine.

Includes network async processing state machine and related tasks.

Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>


diff --git a/drivers/block/dst/kst.c b/drivers/block/dst/kst.c
new file mode 100644
index 0000000..6d92014
--- /dev/null
+++ b/drivers/block/dst/kst.c
@@ -0,0 +1,1515 @@
+/*
+ * 2007+ Copyright (c) Evgeniy Polyakov <johnpol@2ka.mipt.ru>
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/list.h>
+#include <linux/slab.h>
+#include <linux/socket.h>
+#include <linux/kthread.h>
+#include <linux/net.h>
+#include <linux/in.h>
+#include <linux/poll.h>
+#include <linux/bio.h>
+#include <linux/dst.h>
+
+#include <net/sock.h>
+
+struct kst_poll_helper
+{
+	poll_table 		pt;
+	struct kst_state	*st;
+};
+
+static LIST_HEAD(kst_worker_list);
+static DEFINE_MUTEX(kst_worker_mutex);
+
+/*
+ * This function creates bound socket for local export node.
+ */
+static int kst_sock_create(struct kst_state *st, struct saddr *addr,
+		int type, int proto, int backlog)
+{
+	int err;
+
+	err = sock_create(addr->sa_family, type, proto, &st->socket);
+	if (err)
+		goto err_out_exit;
+
+	err = st->socket->ops->bind(st->socket, (struct sockaddr *)addr,
+			addr->sa_data_len);
+
+	err = st->socket->ops->listen(st->socket, backlog);
+	if (err)
+		goto err_out_release;
+
+	st->socket->sk->sk_allocation = GFP_NOIO;
+
+	return 0;
+
+err_out_release:
+	sock_release(st->socket);
+err_out_exit:
+	return err;
+}
+
+static void kst_sock_release(struct kst_state *st)
+{
+	if (st->socket) {
+		sock_release(st->socket);
+		st->socket = NULL;
+	}
+}
+
+void kst_wake(struct kst_state *st)
+{
+	if (st) {
+		struct kst_worker *w = st->node->w;
+		unsigned long flags;
+
+		spin_lock_irqsave(&w->ready_lock, flags);
+		if (list_empty(&st->ready_entry))
+			list_add_tail(&st->ready_entry, &w->ready_list);
+		spin_unlock_irqrestore(&w->ready_lock, flags);
+
+		wake_up(&w->wait);
+	}
+}
+EXPORT_SYMBOL_GPL(kst_wake);
+
+/*
+ * Polling machinery.
+ */
+static int kst_state_wake_callback(wait_queue_t *wait, unsigned mode,
+		int sync, void *key)
+{
+	struct kst_state *st = container_of(wait, struct kst_state, wait);
+	kst_wake(st);
+	return 1;
+}
+
+static void kst_queue_func(struct file *file, wait_queue_head_t *whead,
+				 poll_table *pt)
+{
+	struct kst_state *st = container_of(pt, struct kst_poll_helper, pt)->st;
+
+	st->whead = whead;
+	init_waitqueue_func_entry(&st->wait, kst_state_wake_callback);
+	add_wait_queue(whead, &st->wait);
+}
+
+static void kst_poll_exit(struct kst_state *st)
+{
+	if (st->whead) {
+		remove_wait_queue(st->whead, &st->wait);
+		st->whead = NULL;
+	}
+}
+
+/*
+ * This function removes request from state tree and ordering list.
+ */
+void kst_del_req(struct dst_request *req)
+{
+	list_del_init(&req->request_list_entry);
+}
+EXPORT_SYMBOL_GPL(kst_del_req);
+
+static struct dst_request *kst_req_first(struct kst_state *st)
+{
+	struct dst_request *req = NULL;
+
+	if (!list_empty(&st->request_list))
+		req = list_entry(st->request_list.next, struct dst_request,
+				request_list_entry);
+	return req;
+}
+
+/*
+ * This function dequeues first request from the queue and tree.
+ */
+static struct dst_request *kst_dequeue_req(struct kst_state *st)
+{
+	struct dst_request *req;
+
+	mutex_lock(&st->request_lock);
+	req = kst_req_first(st);
+	if (req)
+		kst_del_req(req);
+	mutex_unlock(&st->request_lock);
+	return req;
+}
+
+/*
+ * This function enqueues request into tree, indexed by start of the request,
+ * and also puts request into ordered queue.
+ */
+int kst_enqueue_req(struct kst_state *st, struct dst_request *req)
+{
+	if (unlikely(req->flags & DST_REQ_CHECK_QUEUE)) {
+		struct dst_request *r;
+
+		list_for_each_entry(r, &st->request_list, request_list_entry) {
+			if (bio_rw(r->bio) != bio_rw(req->bio))
+				continue;
+
+			if (r->start >= req->start + req->size)
+				continue;
+
+			if (r->start + r->size <= req->start)
+				continue;
+
+			return -EEXIST;
+		}
+	}
+
+	list_add_tail(&req->request_list_entry, &st->request_list);
+	return 0;
+}
+EXPORT_SYMBOL_GPL(kst_enqueue_req);
+
+/*
+ * BIOs for local exporting node are freed via this function.
+ */
+static void kst_export_put_bio(struct bio *bio)
+{
+	int i;
+	struct bio_vec *bv;
+
+	dprintk("%s: bio: %p, size: %u, idx: %d, num: %d, req: %p.\n",
+			__func__, bio, bio->bi_size, bio->bi_idx,
+			bio->bi_vcnt, bio->bi_private);
+
+	bio_for_each_segment(bv, bio, i)
+		__free_page(bv->bv_page);
+	bio_put(bio);
+}
+
+/*
+ * This is a generic request completion function for requests,
+ * queued for async processing.
+ * If it is local export node, state machine is different,
+ * see details below.
+ */
+void kst_complete_req(struct dst_request *req, int err)
+{
+	dprintk("%s: bio: %p, req: %p, size: %llu, orig_size: %llu, "
+			"bi_size: %u, err: %d, flags: %u.\n",
+			__func__, req->bio, req, req->size, req->orig_size,
+			req->bio->bi_size, err, req->flags);
+
+	if (req->flags & DST_REQ_EXPORT) {
+		if (err || !(req->flags & DST_REQ_EXPORT_WRITE)) {
+			req->bio_endio(req, err);
+			goto out;
+		}
+
+		req->bio->bi_rw = WRITE;
+		generic_make_request(req->bio);
+	} else {
+		req->bio_endio(req, err);
+	}
+out:
+	dst_free_request(req);
+}
+EXPORT_SYMBOL_GPL(kst_complete_req);
+
+static void kst_flush_requests(struct kst_state *st)
+{
+	struct dst_request *req;
+
+	while ((req = kst_dequeue_req(st)) != NULL)
+		kst_complete_req(req, -EIO);
+}
+
+static int kst_poll_init(struct kst_state *st)
+{
+	struct kst_poll_helper ph;
+
+	ph.st = st;
+	init_poll_funcptr(&ph.pt, &kst_queue_func);
+
+	st->socket->ops->poll(NULL, st->socket, &ph.pt);
+	return 0;
+}
+
+/*
+ * Main state creation function.
+ * It creates new state according to given operations
+ * and links it into worker structure and node.
+ */
+static struct kst_state *kst_state_init(struct dst_node *node,
+		unsigned int permissions,
+		struct kst_state_ops *ops, void *data)
+{
+	struct kst_state *st;
+	int err;
+
+	st = kzalloc(sizeof(struct kst_state), GFP_KERNEL);
+	if (!st)
+		return ERR_PTR(-ENOMEM);
+
+	st->permissions = permissions;
+	st->node = node;
+	st->ops = ops;
+	INIT_LIST_HEAD(&st->ready_entry);
+	INIT_LIST_HEAD(&st->entry);
+	INIT_LIST_HEAD(&st->request_list);
+	mutex_init(&st->request_lock);
+
+	err = st->ops->init(st, data);
+	if (err)
+		goto err_out_free;
+	mutex_lock(&node->w->state_mutex);
+	list_add_tail(&st->entry, &node->w->state_list);
+	mutex_unlock(&node->w->state_mutex);
+
+	kst_wake(st);
+
+	return st;
+
+err_out_free:
+	kfree(st);
+	return ERR_PTR(err);
+}
+
+/*
+ * This function is called when node is removed,
+ * or when state is destroyed for connected to local exporting
+ * node client.
+ */
+void kst_state_exit(struct kst_state *st)
+{
+	struct kst_worker *w = st->node->w;
+
+	mutex_lock(&w->state_mutex);
+	list_del_init(&st->entry);
+	mutex_unlock(&w->state_mutex);
+
+	st->ops->exit(st);
+
+	if (st == st->node->state)
+		st->node->state = NULL;
+
+	kfree(st);
+}
+
+static int kst_error(struct kst_state *st, int err)
+{
+	if ((err == -ECONNRESET || err == -EPIPE) && st->ops->recovery)
+		err = st->ops->recovery(st, err);
+
+	return st->node->st->alg->ops->error(st, err);
+}
+
+/*
+ * This is main state processing function.
+ * It tries to complete request and invoke appropriate
+ * callbacks in case of errors or successfull operation finish.
+ */
+static int kst_thread_process_state(struct kst_state *st)
+{
+	int err, empty;
+	unsigned int revents;
+	struct dst_request *req, *tmp;
+
+	mutex_lock(&st->request_lock);
+	if (st->ops->ready) {
+		err = st->ops->ready(st);
+		if (err) {
+			mutex_unlock(&st->request_lock);
+			if (err < 0)
+				kst_state_exit(st);
+			return err;
+		}
+	}
+
+	err = 0;
+	empty = 1;
+	req = NULL;
+	list_for_each_entry_safe(req, tmp, &st->request_list, request_list_entry) {
+		empty = 0;
+		revents = st->socket->ops->poll(st->socket->file,
+				st->socket, NULL);
+		if (!revents)
+			break;
+		err = req->callback(req, revents);
+		if (req->size && !err)
+			err = 1;
+
+		if (err < 0 || !req->size) {
+			if (!req->size)
+				err = 0;
+			kst_del_req(req);
+			kst_complete_req(req, err);
+		}
+
+		if (err)
+			break;
+	}
+
+	dprintk("%s: broke the loop: err: %d, list_empty: %d.\n",
+			__func__, err, list_empty(&st->request_list));
+	mutex_unlock(&st->request_lock);
+
+	if (err < 0) {
+		dprintk("%s: req: %p, err: %d, st: %p, node->state: %p.\n",
+			__func__, req, err, st, st->node->state);
+
+		if (st != st->node->state) {
+			/*
+			 * Accepted client has state not related to storage
+			 * node, so it must be freed explicitely.
+			 * We do not try to fix clients connections to local
+			 * export nodes, just drop the client.
+			 */
+
+			kst_state_exit(st);
+			return err;
+		}
+
+		err = kst_error(st, err);
+		if (err)
+			return err;
+
+		kst_wake(st);
+	}
+
+	if (list_empty(&st->request_list) && !empty)
+		kst_wake(st);
+
+	return err;
+}
+
+/*
+ * Main worker thread - one per storage.
+ */
+static int kst_thread_func(void *data)
+{
+	struct kst_worker *w = data;
+	struct kst_state *st;
+	unsigned long flags;
+	int err = 0;
+
+	while (!kthread_should_stop()) {
+		wait_event_interruptible_timeout(w->wait,
+			(!list_empty(&w->ready_list) && !list_empty(&w->state_list)) ||
+			kthread_should_stop(), HZ);
+		st = NULL;
+		spin_lock_irqsave(&w->ready_lock, flags);
+		if (!list_empty(&w->ready_list)) {
+			st = list_entry(w->ready_list.next, struct kst_state,
+				ready_entry);
+			list_del_init(&st->ready_entry);
+		}
+		spin_unlock_irqrestore(&w->ready_lock, flags);
+
+		if (!st)
+			continue;
+
+		err = kst_thread_process_state(st);
+	}
+
+	return err;
+}
+
+/*
+ * Worker initialization - this object will host andprocess all states,
+ * which in turn host requests for remote targets.
+ */
+struct kst_worker *kst_worker_init(int id)
+{
+	struct kst_worker *w;
+	int err;
+
+	w = kzalloc(sizeof(struct kst_worker), GFP_KERNEL);
+	if (!w)
+		return ERR_PTR(-ENOMEM);
+
+	w->id = id;
+	init_waitqueue_head(&w->wait);
+	spin_lock_init(&w->ready_lock);
+	mutex_init(&w->state_mutex);
+
+	INIT_LIST_HEAD(&w->ready_list);
+	INIT_LIST_HEAD(&w->state_list);
+
+	w->req_pool = mempool_create_slab_pool(256, dst_request_cache);
+	if (!w->req_pool) {
+		err = -ENOMEM;
+		goto err_out_free;
+	}
+
+	w->thread = kthread_run(&kst_thread_func, w, "kst%d", w->id);
+	if (IS_ERR(w->thread)) {
+		err = PTR_ERR(w->thread);
+		goto err_out_destroy;
+	}
+
+	mutex_lock(&kst_worker_mutex);
+	list_add_tail(&w->entry, &kst_worker_list);
+	mutex_unlock(&kst_worker_mutex);
+
+	return w;
+
+err_out_destroy:
+	mempool_destroy(w->req_pool);
+err_out_free:
+	kfree(w);
+	return ERR_PTR(err);
+}
+
+void kst_worker_exit(struct kst_worker *w)
+{
+	struct kst_state *st, *n;
+
+	mutex_lock(&kst_worker_mutex);
+	list_del(&w->entry);
+	mutex_unlock(&kst_worker_mutex);
+
+	kthread_stop(w->thread);
+
+	list_for_each_entry_safe(st, n, &w->state_list, entry) {
+		kst_state_exit(st);
+	}
+
+	mempool_destroy(w->req_pool);
+	kfree(w);
+}
+
+/*
+ * Common state exit callback.
+ * Removes itself from worker's list of states,
+ * releases socket and flushes all requests.
+ */
+static void kst_common_exit(struct kst_state *st)
+{
+	unsigned long flags;
+	struct kst_worker *w = st->node->w;
+
+	kst_poll_exit(st);
+
+	spin_lock_irqsave(&w->ready_lock, flags);
+	list_del_init(&st->ready_entry);
+	spin_unlock_irqrestore(&w->ready_lock, flags);
+
+	kst_flush_requests(st);
+	kst_sock_release(st);
+}
+
+/*
+ * Listen socket contains security attributes in request_list,
+ * so it can not be flushed via usual way.
+ */
+static void kst_listen_flush(struct kst_state *st)
+{
+	struct dst_secure *s, *tmp;
+
+	list_for_each_entry_safe(s, tmp, &st->request_list, sec_entry) {
+		list_del(&s->sec_entry);
+		kfree(s);
+	}
+}
+
+static void kst_listen_exit(struct kst_state *st)
+{
+	kst_listen_flush(st);
+	kst_common_exit(st);
+}
+
+/*
+ * BIO vector receiving function - does not block, but may sleep because
+ * of scheduling policy.
+ */
+static int kst_data_recv_bio_vec(struct kst_state *st, struct bio_vec *bv,
+		unsigned int offset, unsigned int size)
+{
+	struct msghdr msg;
+	struct kvec iov;
+	void *kaddr;
+	int err;
+
+	kaddr = kmap(bv->bv_page);
+
+	iov.iov_base = kaddr + bv->bv_offset + offset;
+	iov.iov_len = size;
+
+	msg.msg_iov = (struct iovec *)&iov;
+	msg.msg_iovlen = 1;
+	msg.msg_name = NULL;
+	msg.msg_namelen = 0;
+	msg.msg_control = NULL;
+	msg.msg_controllen = 0;
+	msg.msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL;
+
+	err = kernel_recvmsg(st->socket, &msg, &iov, 1, iov.iov_len,
+			msg.msg_flags);
+	kunmap(bv->bv_page);
+
+	return err;
+}
+
+/*
+ * BIO vector sending function - does not block, but may sleep because
+ * of scheduling policy.
+ */
+static int kst_data_send_bio_vec(struct kst_state *st, struct bio_vec *bv,
+		unsigned int offset, unsigned int size)
+{
+	return kernel_sendpage(st->socket, bv->bv_page,
+			bv->bv_offset + offset, size,
+			MSG_DONTWAIT | MSG_NOSIGNAL);
+}
+
+static int kst_data_send_bio_vec_slow(struct kst_state *st, struct bio_vec *bv,
+		unsigned int offset, unsigned int size)
+{
+	struct msghdr msg;
+	struct kvec iov;
+	void *addr;
+	int err;
+
+	addr = kmap(bv->bv_page);
+	iov.iov_base = addr + bv->bv_offset + offset;
+	iov.iov_len = size;
+
+	msg.msg_iov = (struct iovec *)&iov;
+	msg.msg_iovlen = 1;
+	msg.msg_name = NULL;
+	msg.msg_namelen = 0;
+	msg.msg_control = NULL;
+	msg.msg_controllen = 0;
+	msg.msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL;
+
+	err = kernel_sendmsg(st->socket, &msg, &iov, 1, iov.iov_len);
+	kunmap(bv->bv_page);
+
+	return err;
+}
+
+static u32 dst_csum_bvec(struct bio_vec *bv, unsigned int offset, unsigned int size)
+{
+	void *addr;
+	u32 csum;
+
+	addr = kmap_atomic(bv->bv_page, KM_USER0);
+	csum =  dst_csum_data(addr + bv->bv_offset + offset, size);
+	kunmap_atomic(addr, KM_USER0);
+
+	return csum;
+}
+
+typedef int (*kst_data_process_bio_vec_t)(struct kst_state *st,
+		struct bio_vec *bv, unsigned int offset, unsigned int size);
+
+/*
+ * @req: processing request.
+ * Contains BIO and all related to its processing info.
+ *
+ * This function sends or receives requested number of pages from given BIO.
+ *
+ * In case of errors negative value is returned and @size,
+ * @index and @off are set to the:
+ * - number of bytes not yet processed (i.e. the rest of the bytes to be
+ *   processed).
+ * - index of the last bio_vec started to be processed (header sent).
+ * - offset of the first byte to be processed in the bio_vec.
+ *
+ * If there are no errors, zero is returned.
+ * -EAGAIN is not an error and is transformed into zero return value,
+ * called must check if @size is zero, in that case whole BIO is processed
+ * and thus req->bio_endio() can be called, othervise new request must be allocated
+ * to be processed later.
+ */
+static int kst_data_process_bio(struct dst_request *req)
+{
+	int err = -ENOSPC;
+	struct dst_remote_request r;
+	kst_data_process_bio_vec_t func;
+	unsigned int cur_size;
+	int use_csum = test_bit(DST_NODE_USE_CSUM, &req->node->flags);
+
+	if (bio_rw(req->bio) == WRITE) {
+		int i;
+
+		func = kst_data_send_bio_vec;
+		for (i=req->idx; i<req->num; ++i) {
+			struct bio_vec *bv = bio_iovec_idx(req->bio, i);
+
+			if (PageSlab(bv->bv_page)) {
+				func = kst_data_send_bio_vec_slow;
+				break;
+			}
+		}
+		r.cmd = cpu_to_be32(DST_WRITE);
+	} else {
+		r.cmd = cpu_to_be32(DST_READ);
+		func = kst_data_recv_bio_vec;
+	}
+
+	dprintk("%s: start: [%c], state: %p, node: %p, start: %llu, idx: %d, num: %d, "
+			"size: %llu, offset: %u, flags: %x, use_csum: %d.\n",
+			__func__, (bio_rw(req->bio) == WRITE)?'W':'R', req->state, req->node,
+			req->start, req->idx, req->num, req->size, req->offset,
+			req->flags, use_csum);
+
+	while (req->idx < req->num) {
+		struct bio_vec *bv = bio_iovec_idx(req->bio, req->idx);
+
+		cur_size = min_t(u64, bv->bv_len - req->offset, req->size);
+
+		dprintk("%s: page: %p, slab: %d, count: %d, max: %d, off: %u, len: %u, req->offset: %u, "
+				"req->size: %llu, cur_size: %u, flags: %x, "
+				"use_csum: %d, req->csum: %x.\n",
+				__func__, bv->bv_page, PageSlab(bv->bv_page),
+				atomic_read(&bv->bv_page->_count), req->bio->bi_vcnt,
+				bv->bv_offset, bv->bv_len,
+				req->offset, req->size, cur_size,
+				req->flags, use_csum, req->tmp_csum);
+
+		if (cur_size == 0) {
+			printk(KERN_ERR "%s: %d/%d: start: %llu, "
+				"bv_offset: %u, bv_len: %u, "
+				"req_offset: %u, req_size: %llu, "
+				"req: %p, bio: %p, err: %d.\n",
+				__func__, req->idx, req->num, req->start,
+				bv->bv_offset, bv->bv_len,
+				req->offset, req->size,
+				req, req->bio, err);
+			BUG();
+		}
+
+		if (!(req->flags & DST_REQ_HEADER_SENT)) {
+			r.sector = cpu_to_be64(req->start);
+			r.offset = cpu_to_be32(bv->bv_offset + req->offset);
+			r.size = cpu_to_be32(cur_size);
+			r.csum = 0;
+
+			if (use_csum && bio_rw(req->bio) == WRITE &&
+					!req->tmp_offset) {
+				req->tmp_offset = req->offset;
+				r.csum = cpu_to_be32(dst_csum_bvec(bv,
+						req->offset, cur_size));
+			}
+
+			err = dst_data_send_header(req->state->socket, &r);
+			dprintk("%s: %d/%d: sending header: cmd: %u, start: %llu, "
+				"bv_offset: %u, bv_len: %u, "
+				"a offset: %u, offset: %u, "
+				"cur_size: %u, err: %d.\n",
+				__func__, req->idx, req->num, be32_to_cpu(r.cmd),
+				req->start, bv->bv_offset, bv->bv_len,
+				bv->bv_offset + req->offset,
+				req->offset, cur_size, err);
+
+			if (err != sizeof(struct dst_remote_request)) {
+				if (err >= 0)
+					err = -EINVAL;
+				break;
+			}
+
+			req->flags |= DST_REQ_HEADER_SENT;
+		}
+
+		if (use_csum && (bio_rw(req->bio) != WRITE) &&
+				!(req->flags & DST_REQ_CHEKSUM_RECV)) {
+			struct dst_remote_request tmp_req;
+
+			err = dst_data_recv_header(req->state->socket, &tmp_req, 0);
+			dprintk("%s: %d/%d: receiving header: start: %llu, "
+				"bv_offset: %u, bv_len: %u, "
+				"a offset: %u, offset: %u, "
+				"cur_size: %u, err: %d.\n",
+				__func__, req->idx, req->num,
+				req->start, bv->bv_offset, bv->bv_len,
+				bv->bv_offset + req->offset,
+				req->offset, cur_size, err);
+
+			if (err != sizeof(struct dst_remote_request)) {
+				if (err >= 0)
+					err = -EINVAL;
+				break;
+			}
+
+			if (req->tmp_csum) {
+				printk(KERN_ERR "%s: req: %p, old csum: %x, new: %x.\n",
+						__func__, req, req->tmp_csum,
+						be32_to_cpu(tmp_req.csum));
+				BUG_ON(1);
+			}
+
+			dprintk("%s: req: %p, old csum: %x, new: %x.\n",
+					__func__, req, req->tmp_csum,
+					be32_to_cpu(tmp_req.csum));
+			req->tmp_csum = be32_to_cpu(tmp_req.csum);
+
+			req->flags |= DST_REQ_CHEKSUM_RECV;
+		}
+
+		err = func(req->state, bv, req->offset, cur_size);
+		if (err <= 0)
+			break;
+
+		req->offset += err;
+		req->size -= err;
+
+		if (req->offset != bv->bv_len) {
+			dprintk("%s: %d/%d: this: start: %llu, bv_offset: %u, "
+				"bv_len: %u, offset: %u, "
+				"cur_size: %u, err: %d.\n",
+				__func__, req->idx, req->num, req->start,
+				bv->bv_offset, bv->bv_len,
+				req->offset, cur_size, err);
+			err = -EAGAIN;
+			break;
+		}
+
+		if (use_csum && bio_rw(req->bio) != WRITE) {
+			u32 csum = dst_csum_bvec(bv, req->tmp_offset,
+					bv->bv_len - req->tmp_offset);
+
+			dprintk("%s: req: %p, csum: %x, received csum: %x.\n",
+					__func__, req, csum, req->tmp_csum);
+
+			if (csum != req->tmp_csum) {
+				if (printk_ratelimit()) {
+					printk(KERN_INFO "%s: %d/%d: broken checksum: start: %llu, "
+						"bv_offset: %u, bv_len: %u, "
+						"a offset: %u, offset: %u, "
+						"cur_size: %u, orig_size: %llu.\n",
+						__func__, req->idx, req->num,
+						req->start, bv->bv_offset, bv->bv_len,
+						bv->bv_offset + req->offset,
+						req->offset, cur_size, req->orig_size);
+					printk(KERN_INFO "%s: broken checksum: req: %p, csum: %x, "
+						"should be: %x, flags: %x, "
+						"req->tmp_offset: %u, rw: %lu.\n",
+						__func__, req, csum, req->tmp_csum,
+						req->flags, req->tmp_offset, bio_rw(req->bio));
+				}
+
+				req->offset -= err;
+				req->size += err;
+
+				err = -EREMOTEIO;
+				break;
+			}
+		}
+
+		req->offset = 0;
+		req->idx++;
+		req->flags &= ~(DST_REQ_HEADER_SENT | DST_REQ_CHEKSUM_RECV);
+		req->tmp_csum = 0;
+		req->start += to_sector(bv->bv_len);
+	}
+
+	if (err <= 0 && err != -EAGAIN) {
+		if (err == 0)
+			err = -ECONNRESET;
+	} else
+		err = 0;
+
+	if (err < 0 || (req->idx == req->num && req->size)) {
+		dprintk("%s: return: idx: %d, num: %d, offset: %u, "
+				"size: %llu, err: %d.\n",
+			__func__, req->idx, req->num, req->offset,
+			req->size, err);
+	}
+	dprintk("%s: end: start: %llu, idx: %d, num: %d, "
+			"size: %llu, offset: %u.\n",
+		__func__, req->start, req->idx, req->num,
+		req->size, req->offset);
+
+	return err;
+}
+
+void kst_bio_endio(struct dst_request *req, int err)
+{
+	if (err && printk_ratelimit())
+		printk(KERN_INFO "%s: freeing bio: %p, bi_size: %u, "
+			"orig_size: %llu, req: %p, err: %d.\n",
+		__func__, req->bio, req->bio->bi_size, req->orig_size,
+		req, err);
+	bio_endio(req->bio, req->orig_size, err);
+}
+EXPORT_SYMBOL_GPL(kst_bio_endio);
+
+/*
+ * This callback is invoked by worker thread to process given request.
+ */
+int kst_data_callback(struct dst_request *req, unsigned int revents)
+{
+	int err;
+
+	dprintk("%s: req: %p, num: %d, idx: %d, bio: %p, "
+			"revents: %x, flags: %x.\n",
+			__func__, req, req->num, req->idx, req->bio,
+			revents, req->flags);
+
+	if (req->flags & DST_REQ_EXPORT_READ)
+		return 1;
+
+	err = kst_data_process_bio(req);
+
+	if (revents & (POLLERR | POLLHUP | POLLRDHUP))
+		err = -EPIPE;
+
+	return err;
+}
+EXPORT_SYMBOL_GPL(kst_data_callback);
+
+struct dst_request *dst_clone_request(struct dst_request *req, mempool_t *pool)
+{
+	struct dst_request *new_req;
+
+	new_req = mempool_alloc(pool, GFP_NOIO);
+	if (!new_req)
+		return NULL;
+
+	memset(new_req, 0, sizeof(struct dst_request));
+
+	dprintk("%s: req: %p, new_req: %p.\n", __func__, req, new_req);
+
+	if (req) {
+		new_req->bio = req->bio;
+		new_req->state = req->state;
+		new_req->node = req->node;
+		new_req->idx = req->idx;
+		new_req->num = req->num;
+		new_req->size = req->size;
+		new_req->orig_size = req->orig_size;
+		new_req->offset = req->offset;
+		new_req->tmp_offset = req->tmp_offset;
+		new_req->tmp_csum = req->tmp_csum;
+		new_req->start = req->start;
+		new_req->flags = req->flags;
+		new_req->bio_endio = req->bio_endio;
+		new_req->priv = req->priv;
+	}
+
+	return new_req;
+}
+EXPORT_SYMBOL_GPL(dst_clone_request);
+
+void dst_free_request(struct dst_request *req)
+{
+	dprintk("%s: free req: %p, pool: %p, bio: %p, state: %p, node: %p.\n",
+			__func__, req, req->node->w->req_pool,
+			req->bio, req->state, req->node);
+	mempool_free(req, req->node->w->req_pool);
+}
+EXPORT_SYMBOL_GPL(dst_free_request);
+
+/*
+ * This is main data processing function, eventually invoked from block layer.
+ * It tries to complte request, but if it is about to block, it allocates
+ * new request and queues it to main worker to be processed when events allow.
+ */
+static int kst_data_push(struct dst_request *req)
+{
+	struct kst_state *st = req->state;
+	struct dst_request *new_req;
+	unsigned int revents;
+	int err, locked = 0;
+
+	dprintk("%s: start: %llu, size: %llu, bio: %p.\n",
+			__func__, req->start, req->size, req->bio);
+
+	if (!list_empty(&st->request_list) || (req->flags & DST_REQ_ALWAYS_QUEUE))
+		goto alloc_new_req;
+
+	if (mutex_trylock(&st->request_lock)) {
+		locked = 1;
+
+		if (!list_empty(&st->request_list))
+			goto alloc_new_req;
+
+		revents = st->socket->ops->poll(NULL, st->socket, NULL);
+		if (revents & POLLOUT) {
+			err = kst_data_process_bio(req);
+			if (err < 0)
+				goto out_unlock;
+
+			if (!req->size)
+				goto out_bio_endio;
+		}
+	}
+
+alloc_new_req:
+	err = -ENOMEM;
+	new_req = dst_clone_request(req, req->node->w->req_pool);
+	if (!new_req)
+		goto out_unlock;
+
+	new_req->callback = &kst_data_callback;
+
+	if (!locked)
+		mutex_lock(&st->request_lock);
+
+	locked = 1;
+
+	err = kst_enqueue_req(st, new_req);
+	if (err)
+		goto out_unlock;
+	mutex_unlock(&st->request_lock);
+
+	err = 0;
+	goto out;
+
+out_bio_endio:
+	req->bio_endio(req, err);
+out_unlock:
+	if (locked)
+		mutex_unlock(&st->request_lock);
+	locked = 0;
+
+	if (err) {
+		err = kst_error(st, err);
+		if (!err)
+			goto alloc_new_req;
+	}
+
+	if (err && printk_ratelimit()) {
+		printk(KERN_INFO "%s: error [%c], start: %llu, idx: %d, num: %d, "
+				"size: %llu, offset: %u, err: %d.\n",
+			__func__, (bio_rw(req->bio) == WRITE)?'W':'R',
+			req->start, req->idx, req->num, req->size,
+			req->offset, err);
+	}
+
+out:
+
+	kst_wake(st);
+	return err;
+}
+
+/*
+ * Remote node initialization callback.
+ */
+static int kst_data_init(struct kst_state *st, void *data)
+{
+	int err;
+
+	st->socket = data;
+	st->socket->sk->sk_allocation = GFP_NOIO;
+	/*
+	 * Why not?
+	 */
+	st->socket->sk->sk_sndbuf = st->socket->sk->sk_sndbuf = 1024*1024*10;
+
+	err = kst_poll_init(st);
+	if (err)
+		return err;
+
+	return 0;
+}
+
+/*
+ * Remote node recovery function - tries to reconnect to given target.
+ */
+static int kst_data_recovery(struct kst_state *st, int err)
+{
+	struct socket *sock;
+	struct sockaddr addr;
+	int addrlen;
+	struct dst_request *req;
+
+	if (err != -ECONNRESET && err != -EPIPE) {
+		dprintk("%s: state %p does not know how "
+				"to recover from error %d.\n",
+				__func__, st, err);
+		return err;
+	}
+
+	err = sock_create(st->socket->ops->family, st->socket->type,
+			st->socket->sk->sk_protocol, &sock);
+	if (err < 0)
+		goto err_out_exit;
+
+	sock->sk->sk_sndtimeo = sock->sk->sk_rcvtimeo =
+		msecs_to_jiffies(DST_DEFAULT_TIMEO);
+
+	err = sock->ops->getname(st->socket, &addr, &addrlen, 2);
+	if (err)
+		goto err_out_destroy;
+
+	err = sock->ops->connect(sock, &addr, addrlen, 0);
+	if (err)
+		goto err_out_destroy;
+
+	kst_poll_exit(st);
+	kst_sock_release(st);
+
+	mutex_lock(&st->request_lock);
+	err = st->ops->init(st, sock);
+	if (!err) {
+		/*
+		 * After reconnection is completed all requests
+		 * must be resent from the state they were finished previously,
+		 * but with new headers.
+		 */
+		list_for_each_entry(req, &st->request_list, request_list_entry)
+			req->flags &= ~(DST_REQ_HEADER_SENT | DST_REQ_CHEKSUM_RECV);
+	}
+	mutex_unlock(&st->request_lock);
+	if (err < 0)
+		goto err_out_destroy;
+
+	kst_wake(st);
+	dprintk("%s: reconnected.\n", __func__);
+
+	return 0;
+
+err_out_destroy:
+	sock_release(sock);
+err_out_exit:
+	dprintk("%s: recovery failed: st: %p, err: %d.\n", __func__, st, err);
+	return err;
+}
+
+/*
+ * Local exporting node end IO callbacks.
+ */
+static int kst_export_write_end_io(struct bio *bio, unsigned int size, int err)
+{
+	dprintk("%s: bio: %p, size: %u, idx: %d, num: %d, err: %d.\n",
+		__func__, bio, bio->bi_size, bio->bi_idx, bio->bi_vcnt, err);
+
+	if (bio->bi_size)
+		return 1;
+
+	kst_export_put_bio(bio);
+	return 0;
+}
+
+static int kst_export_read_end_io(struct bio *bio, unsigned int size, int err)
+{
+	struct dst_request *req = bio->bi_private;
+	struct kst_state *st = req->state;
+	int use_csum = test_bit(DST_NODE_USE_CSUM, &req->node->flags);
+
+	dprintk("%s: bio: %p, req: %p, size: %u, idx: %d, num: %d, err: %d.\n",
+		__func__, bio, req, bio->bi_size, bio->bi_idx,
+		bio->bi_vcnt, err);
+
+	if (bio->bi_size)
+		return 1;
+
+	if (err) {
+		kst_export_put_bio(bio);
+		return 0;
+	}
+
+	bio->bi_size = req->size = req->orig_size;
+	bio->bi_rw = WRITE;
+	bio->bi_end_io = kst_export_write_end_io;
+	if (use_csum)
+		req->flags &= ~(DST_REQ_HEADER_SENT | DST_REQ_CHEKSUM_RECV);
+
+	/*
+	 * This is a race with kst_data_callback(), which checks
+	 * this bit to determine if it can or can not process given
+	 * request. This does not harm actually, since subsequent
+	 * state wakeup will call it again and thus will pick
+	 * given request in time.
+	 */
+	req->flags &= ~DST_REQ_EXPORT_READ;
+	kst_wake(st);
+	return 0;
+}
+
+/*
+ * This callback is invoked each time new request from remote
+ * node to given local export node is received.
+ * It allocates new block IO request and queues it for processing.
+ */
+static int kst_export_ready(struct kst_state *st)
+{
+	struct dst_remote_request r;
+	struct bio *bio;
+	int err, nr, i;
+	struct dst_request *req;
+	unsigned int revents = st->socket->ops->poll(NULL, st->socket, NULL);
+
+	if (revents & (POLLERR | POLLHUP)) {
+		err = -EPIPE;
+		goto err_out_exit;
+	}
+
+	if (!(revents & POLLIN) || !list_empty(&st->request_list))
+		return 0;
+
+	err = dst_data_recv_header(st->socket, &r, 1);
+	if (err != sizeof(struct dst_remote_request)) {
+		err = -ECONNRESET;
+		goto err_out_exit;
+	}
+
+	kst_convert_header(&r);
+
+	dprintk("\n%s: st: %p, cmd: %u, sector: %llu, size: %u, "
+			"csum: %x, offset: %u.\n",
+			__func__, st, r.cmd, r.sector,
+			r.size, r.csum, r.offset);
+
+	err = -EINVAL;
+	if (r.cmd != DST_READ && r.cmd != DST_WRITE && r.cmd != DST_REMOTE_CFG)
+		goto err_out_exit;
+
+	if ((s64)(r.sector + to_sector(r.size)) < 0 ||
+		(r.sector + to_sector(r.size)) > st->node->size ||
+		r.offset >= PAGE_SIZE)
+		goto err_out_exit;
+
+	if (r.cmd == DST_REMOTE_CFG) {
+		r.sector = st->node->size;
+
+		if (test_bit(DST_NODE_USE_CSUM, &st->node->flags))
+			r.csum = 1;
+
+		kst_convert_header(&r);
+
+		err = dst_data_send_header(st->socket, &r);
+		if (err != sizeof(struct dst_remote_request)) {
+			err = -EINVAL;
+			goto err_out_exit;
+		}
+		kst_wake(st);
+		return 0;
+	}
+
+	nr = DIV_ROUND_UP(r.size, PAGE_SIZE);
+
+	while (r.size) {
+		int nr_pages = min(BIO_MAX_PAGES, nr);
+		unsigned int size;
+		struct page *page;
+
+		err = -ENOMEM;
+		req = dst_clone_request(NULL, st->node->w->req_pool);
+		if (!req)
+			goto err_out_exit;
+
+		bio = bio_alloc(GFP_NOIO, nr_pages);
+		if (!bio)
+			goto err_out_free_req;
+
+		req->flags = DST_REQ_EXPORT | DST_REQ_HEADER_SENT |
+				DST_REQ_CHEKSUM_RECV;
+		req->bio = bio;
+		req->state = st;
+		req->node = st->node;
+		req->callback = &kst_data_callback;
+		req->bio_endio = &kst_bio_endio;
+
+		req->tmp_offset = 0;
+		req->tmp_csum = r.csum;
+
+		/*
+		 * Yes, looks a bit weird.
+		 * Logic is simple - for local exporting node all operations
+		 * are reversed compared to usual nodes, since usual nodes
+		 * process remote data and local export node process remote
+		 * requests, so that writing data means sending data to
+		 * remote node and receiving on the local export one.
+		 *
+		 * So, to process writing to the exported node we need first
+		 * to receive data from the net (i.e. to perform READ
+		 * operationin terms of usual node), and then put it to the
+		 * storage (WRITE command, so it will be changed before
+		 * calling generic_make_request()).
+		 *
+		 * To process read request from the exported node we need
+		 * first to read it from storage (READ command for BIO)
+		 * and then send it over the net (perform WRITE operation
+		 * in terms of network).
+		 */
+		if (r.cmd == DST_WRITE) {
+			req->flags |= DST_REQ_EXPORT_WRITE;
+			bio->bi_end_io = kst_export_write_end_io;
+		} else {
+			req->flags |= DST_REQ_EXPORT_READ;
+			bio->bi_end_io = kst_export_read_end_io;
+		}
+		bio->bi_rw = READ;
+		bio->bi_private = req;
+		bio->bi_sector = r.sector;
+		bio->bi_bdev = st->node->bdev;
+
+		for (i = 0; i < nr_pages; ++i) {
+			page = alloc_page(GFP_NOIO);
+			if (!page)
+				break;
+
+			size = min_t(u32, PAGE_SIZE - r.offset, r.size);
+
+			err = bio_add_page(bio, page, size, 0);
+			dprintk("%s: %d/%d: page: %p, size: %u, "
+					"offset: %u (used zero), err: %d.\n",
+					__func__, i, nr_pages, page, size,
+					r.offset, err);
+			if (err <= 0)
+				break;
+
+			if (err == size)
+				nr--;
+
+			r.size -= err;
+			r.sector += to_sector(err);
+
+			if (!r.size)
+				break;
+		}
+
+		if (!bio->bi_vcnt) {
+			err = -ENOMEM;
+			goto err_out_put;
+		}
+
+		req->size = req->orig_size = bio->bi_size;
+		req->start = bio->bi_sector;
+		req->idx = 0;
+		req->num = bio->bi_vcnt;
+
+		dprintk("%s: submitting: bio: %p, req: %p, start: %llu, "
+			"size: %llu, idx: %d, num: %d, offset: %u, csum: %x.\n",
+			__func__, bio, req, req->start, req->size,
+			req->idx, req->num, req->offset, req->tmp_csum);
+
+		err = kst_enqueue_req(st, req);
+		if (err)
+			goto err_out_put;
+
+		if (r.cmd == DST_READ) {
+			generic_make_request(bio);
+		}
+	}
+
+	kst_wake(st);
+	return 0;
+
+err_out_put:
+	bio_put(bio);
+err_out_free_req:
+	dst_free_request(req);
+err_out_exit:
+	return err;
+}
+
+static void kst_export_exit(struct kst_state *st)
+{
+	struct dst_node *n = st->node;
+
+	kst_common_exit(st);
+	dst_node_put(n);
+}
+
+static struct kst_state_ops kst_data_export_ops = {
+	.init = &kst_data_init,
+	.push = &kst_data_push,
+	.exit = &kst_export_exit,
+	.ready = &kst_export_ready,
+};
+
+/*
+ * This callback is invoked each time listening socket for
+ * given local export node becomes ready.
+ * It creates new state for connected client and queues for processing.
+ */
+static int kst_listen_ready(struct kst_state *st)
+{
+	struct socket *newsock;
+	struct saddr addr;
+	struct kst_state *newst;
+	int err;
+	unsigned int revents, permissions = 0;
+	struct dst_secure *s;
+
+	revents = st->socket->ops->poll(NULL, st->socket, NULL);
+	if (!(revents & POLLIN))
+		return 1;
+
+	err = sock_create(st->socket->ops->family, st->socket->type,
+			st->socket->sk->sk_protocol, &newsock);
+	if (err)
+		goto err_out_exit;
+
+	err = st->socket->ops->accept(st->socket, newsock, 0);
+	if (err)
+		goto err_out_put;
+
+	if (newsock->ops->getname(newsock, (struct sockaddr *)&addr,
+				  (int *)&addr.sa_data_len, 2) < 0) {
+		err = -ECONNABORTED;
+		goto err_out_put;
+	}
+
+	list_for_each_entry(s, &st->request_list, sec_entry) {
+		void *sec_addr, *new_addr;
+
+		sec_addr = ((void *)&s->sec.addr) + s->sec.check_offset;
+		new_addr = ((void *)&addr) + s->sec.check_offset;
+
+		if (!memcmp(sec_addr, new_addr,
+				addr.sa_data_len - s->sec.check_offset)) {
+			permissions = s->sec.permissions;
+			break;
+		}
+	}
+
+	/*
+	 * So far only reading and writing are supported.
+	 * Block device does not know about anything else,
+	 * but as far as I recall, there was a prognosis,
+	 * that computer will never require more than 640kb of RAM.
+	 */
+	if (permissions == 0) {
+		err = -EPERM;
+		goto err_out_put;
+	}
+
+	if (st->socket->ops->family == AF_INET) {
+		struct sockaddr_in *sin = (struct sockaddr_in *)&addr;
+		printk(KERN_INFO "%s: Client: %u.%u.%u.%u:%d.\n", __func__,
+			NIPQUAD(sin->sin_addr.s_addr), ntohs(sin->sin_port));
+	} else if (st->socket->ops->family == AF_INET6) {
+		struct sockaddr_in6 *sin = (struct sockaddr_in6 *)&addr;
+		printk(KERN_INFO "%s: Client: "
+			"%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x:%d",
+			__func__,
+			NIP6(sin->sin6_addr), ntohs(sin->sin6_port));
+	}
+
+	dst_node_get(st->node);
+	newst = kst_state_init(st->node, permissions,
+			&kst_data_export_ops, newsock);
+	if (IS_ERR(newst)) {
+		err = PTR_ERR(newst);
+		goto err_out_put;
+	}
+
+	/*
+	 * Negative return value means error, positive - stop this state
+	 * processing. Zero allows to check state for pending requests.
+	 * Listening socket contains security objects in request list,
+	 * since it does not have any requests.
+	 */
+	return 1;
+
+err_out_put:
+	sock_release(newsock);
+err_out_exit:
+	return 1;
+}
+
+static int kst_listen_init(struct kst_state *st, void *data)
+{
+	int err = -ENOMEM, i;
+	struct dst_le_template *tmp = data;
+	struct dst_secure *s;
+
+	for (i=0; i<tmp->le->secure_attr_num; ++i) {
+		s = kmalloc(sizeof(struct dst_secure), GFP_KERNEL);
+		if (!s)
+			goto err_out_exit;
+
+		memcpy(&s->sec, tmp->data, sizeof(struct dst_secure_user));
+
+		list_add_tail(&s->sec_entry, &st->request_list);
+		tmp->data += sizeof(struct dst_secure_user);
+
+		if (s->sec.addr.sa_family == AF_INET) {
+			struct sockaddr_in *sin =
+				(struct sockaddr_in *)&s->sec.addr;
+			printk(KERN_INFO "%s: Client: %u.%u.%u.%u:%d, "
+					"permissions: %x.\n",
+				__func__, NIPQUAD(sin->sin_addr.s_addr),
+				ntohs(sin->sin_port), s->sec.permissions);
+		} else if (s->sec.addr.sa_family == AF_INET6) {
+			struct sockaddr_in6 *sin =
+				(struct sockaddr_in6 *)&s->sec.addr;
+			printk(KERN_INFO "%s: Client: "
+				"%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x:%d, "
+				"permissions: %x.\n",
+				__func__, NIP6(sin->sin6_addr),
+				ntohs(sin->sin6_port), s->sec.permissions);
+		}
+	}
+
+	err = kst_sock_create(st, &tmp->le->rctl.addr, tmp->le->rctl.type,
+			tmp->le->rctl.proto, tmp->le->backlog);
+	if (err)
+		goto err_out_exit;
+
+	err = kst_poll_init(st);
+	if (err)
+		goto err_out_release;
+
+	return 0;
+
+err_out_release:
+	kst_sock_release(st);
+err_out_exit:
+	kst_listen_flush(st);
+	return err;
+}
+
+/*
+ * Operations for different types of states.
+ * There are three:
+ * data state - created for remote node, when distributed storage connects
+ * 	to remote node, which contain data.
+ * listen state - created for local export node, when remote distributed
+ * 	storage's node connects to given node to get/put data.
+ * data export state - created for each client connected to above listen
+ * 	state.
+ */
+static struct kst_state_ops kst_listen_ops = {
+	.init = &kst_listen_init,
+	.exit = &kst_listen_exit,
+	.ready = &kst_listen_ready,
+};
+static struct kst_state_ops kst_data_ops = {
+	.init = &kst_data_init,
+	.push = &kst_data_push,
+	.exit = &kst_common_exit,
+	.recovery = &kst_data_recovery,
+};
+
+struct kst_state *kst_listener_state_init(struct dst_node *node,
+		struct dst_le_template *tmp)
+{
+	return kst_state_init(node, DST_PERM_READ | DST_PERM_WRITE,
+			&kst_listen_ops, tmp);
+}
+
+struct kst_state *kst_data_state_init(struct dst_node *node,
+		struct socket *newsock)
+{
+	return kst_state_init(node, DST_PERM_READ | DST_PERM_WRITE,
+			&kst_data_ops, newsock);
+}
+
+/*
+ * Remove all workers and associated states.
+ */
+void kst_exit_all(void)
+{
+	struct kst_worker *w, *n;
+
+	list_for_each_entry_safe(w, n, &kst_worker_list, entry) {
+		kst_worker_exit(w);
+	}
+}


^ permalink raw reply related

* [4/4] DST: Algorithms used in distributed storage.
From: Evgeniy Polyakov @ 2007-12-17 15:03 UTC (permalink / raw)
  To: lkml; +Cc: netdev, linux-fsdevel
In-Reply-To: <1197903819903@2ka.mipt.ru>


Algorithms used in distributed storage.
Mirror and linear mapping code.

Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>


diff --git a/drivers/block/dst/alg_linear.c b/drivers/block/dst/alg_linear.c
new file mode 100644
index 0000000..836764d
--- /dev/null
+++ b/drivers/block/dst/alg_linear.c
@@ -0,0 +1,114 @@
+/*
+ * 2007+ Copyright (c) Evgeniy Polyakov <johnpol@2ka.mipt.ru>
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/dst.h>
+
+static struct dst_alg *alg_linear;
+
+/*
+ * This callback is invoked when node is removed from storage.
+ */
+static void dst_linear_del_node(struct dst_node *n)
+{
+}
+
+/*
+ * This callback is invoked when node is added to storage.
+ */
+static int dst_linear_add_node(struct dst_node *n)
+{
+	struct dst_storage *st = n->st;
+	struct block_device *bdev;
+
+	dprintk("%s: disk_size: %llu, node_size: %llu.\n",
+			__func__, st->disk_size, n->size);
+
+	mutex_lock(&st->tree_lock);
+	n->start = st->disk_size;
+	st->disk_size += n->size;
+	set_capacity(st->disk, st->disk_size);
+	
+	bdev = bdget_disk(st->disk, 0);
+	if (bdev) {
+		mutex_lock(&bdev->bd_inode->i_mutex);
+		i_size_write(bdev->bd_inode, to_bytes(st->disk_size));
+		mutex_unlock(&bdev->bd_inode->i_mutex);
+		bdput(bdev);
+	}
+	mutex_unlock(&st->tree_lock);
+
+	return 0;
+}
+
+static int dst_linear_remap(struct dst_request *req)
+{
+	int err;
+
+	if (req->node->bdev) {
+		generic_make_request(req->bio);
+		return 0;
+	}
+
+	err = kst_check_permissions(req->state, req->bio);
+	if (err)
+		return err;
+
+	return req->state->ops->push(req);
+}
+
+/*
+ * Failover callback - it is invoked each time error happens during
+ * request processing.
+ */
+static int dst_linear_error(struct kst_state *st, int err)
+{
+	if (err)
+		set_bit(DST_NODE_FROZEN, &st->node->flags);
+	else
+		clear_bit(DST_NODE_FROZEN, &st->node->flags);
+	return 0;
+}
+
+static struct dst_alg_ops alg_linear_ops = {
+	.remap		= dst_linear_remap,
+	.add_node 	= dst_linear_add_node,
+	.del_node 	= dst_linear_del_node,
+	.error		= dst_linear_error,
+	.owner		= THIS_MODULE,
+};
+
+static int __devinit alg_linear_init(void)
+{
+	alg_linear = dst_alloc_alg("alg_linear", &alg_linear_ops);
+	if (!alg_linear)
+		return -ENOMEM;
+
+	return 0;
+}
+
+static void __devexit alg_linear_exit(void)
+{
+	dst_remove_alg(alg_linear);
+}
+
+module_init(alg_linear_init);
+module_exit(alg_linear_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>");
+MODULE_DESCRIPTION("Linear distributed algorithm.");
diff --git a/drivers/block/dst/alg_mirror.c b/drivers/block/dst/alg_mirror.c
new file mode 100644
index 0000000..c10d582
--- /dev/null
+++ b/drivers/block/dst/alg_mirror.c
@@ -0,0 +1,1536 @@
+/*
+ * 2007+ Copyright (c) Evgeniy Polyakov <johnpol@2ka.mipt.ru>
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/poll.h>
+#include <linux/dst.h>
+#include <linux/vmstat.h>
+
+struct dst_write_entry
+{
+	int		error;
+	u32		size;
+	u64		start;
+};
+#define DST_LOG_ENTRIES_PER_PAGE	(PAGE_SIZE/sizeof(struct dst_write_entry))
+
+struct dst_mirror_node_data
+{
+	u64			age;
+	u64			num, write_idx, resync_idx;
+};
+
+struct dst_mirror_log
+{
+	unsigned int		nr_pages;
+	struct dst_write_entry	**entries;
+};
+
+struct dst_mirror_priv
+{
+	u64			resync_start, resync_size;
+	atomic_t		resync_num;
+	struct completion	resync_complete;
+	struct delayed_work	resync_work;
+	unsigned int		resync_timeout;
+
+	u64			last_start;
+	
+	spinlock_t		resync_wait_lock;
+	struct list_head	resync_wait_list;
+	int			resync_wait_num;
+	int			full_resync;
+
+	spinlock_t		backlog_lock;
+	struct list_head	backlog_list;
+
+	struct dst_node		*node;
+
+	u64			old_age, ndp_sector;
+	struct dst_mirror_node_data	data;
+
+	spinlock_t		log_lock;
+	struct dst_mirror_log	log;
+};
+
+struct dst_mirror_sync_container
+{
+	struct list_head	sync_entry;
+	u64			start, size;
+	struct dst_node		*node;
+	struct bio		*bio;
+};
+
+static struct dst_alg *alg_mirror;
+static struct bio_set *dst_mirror_bio_set;
+
+static int dst_mirror_resync(struct dst_node *n, int ndp);
+
+static int dst_mirror_mark_notsync(struct dst_node *n)
+{
+	if (!test_and_set_bit(DST_NODE_NOTSYNC, &n->flags)) {
+		struct dst_mirror_priv *priv = n->priv;
+		printk(KERN_NOTICE "%s: not synced node n: %p.\n", __func__, n);
+
+		priv->data.resync_idx = priv->data.write_idx;
+		return 1;
+	}
+
+	return 0;
+}
+
+static void dst_mirror_mark_node_sync(struct dst_node *n)
+{
+	struct dst_mirror_priv *priv = n->priv;
+
+	if (test_and_clear_bit(DST_NODE_NOTSYNC, &n->flags))
+		printk(KERN_NOTICE "%s: node: %p, %llu:%llu synchronization "
+				"has been completed.\n",
+			__func__, n, n->start, n->size);
+
+	priv->full_resync = 0;
+	complete(&priv->resync_complete);
+}
+
+static ssize_t dst_mirror_mark_dirty(struct device *dev, struct device_attribute *attr,
+			 const char *buf, size_t count)
+{
+	struct dst_node *n = container_of(dev, struct dst_node, device);
+
+	dst_mirror_mark_notsync(n);
+	return count;
+}
+
+static ssize_t dst_mirror_mark_clean(struct device *dev, struct device_attribute *attr,
+			 const char *buf, size_t count)
+{
+	struct dst_node *n = container_of(dev, struct dst_node, device);
+
+	dst_mirror_mark_node_sync(n);
+	return count;
+}
+
+static ssize_t dst_mirror_show_state(struct device *dev, struct device_attribute *attr,
+			char *buf)
+{
+	struct dst_node *n = container_of(dev, struct dst_node, device);
+
+	return sprintf(buf, "%s\n", test_bit(DST_NODE_NOTSYNC, &n->flags) ? "notsync" : "sync");
+}
+
+static ssize_t dst_mirror_show_resync_timeout(struct device *dev, struct device_attribute *attr,
+			char *buf)
+{
+	struct dst_node *n = container_of(dev, struct dst_node, device);
+	struct dst_mirror_priv *priv = n->priv;
+
+	return sprintf(buf, "%u\n", priv->resync_timeout);
+}
+
+static ssize_t dst_mirror_show_resync_size(struct device *dev, struct device_attribute *attr,
+			char *buf)
+{
+	struct dst_node *n = container_of(dev, struct dst_node, device);
+	struct dst_mirror_priv *priv = n->priv;
+
+	return sprintf(buf, "%llu\n", priv->resync_size);
+}
+
+static ssize_t dst_mirror_set_resync_size(struct device *dev, struct device_attribute *attr,
+			 const char *buf, size_t count)
+{
+	struct dst_node *n = container_of(dev, struct dst_node, device);
+	struct dst_mirror_priv *priv = n->priv;
+	unsigned long size;
+
+	size = simple_strtoul(buf, NULL, 0);
+
+	if (size > n->st->disk_size)
+		return -E2BIG;
+
+	priv->resync_size = size;
+
+	return count;
+}
+
+static ssize_t dst_mirror_show_log_num(struct device *dev, struct device_attribute *attr,
+			char *buf)
+{
+	struct dst_node *n = container_of(dev, struct dst_node, device);
+	struct dst_mirror_priv *priv = n->priv;
+
+	return sprintf(buf, "%llu\n", priv->data.num);
+}
+
+static ssize_t dst_mirror_set_resync_timeout(struct device *dev, struct device_attribute *attr,
+			 const char *buf, size_t count)
+{
+	struct dst_node *n = container_of(dev, struct dst_node, device);
+	struct dst_mirror_priv *priv = n->priv;
+	unsigned long tm;
+
+	tm = simple_strtoul(buf, NULL, 0);
+
+	if (tm < 100 || tm > 30000)
+		return -EINVAL;
+
+	priv->resync_timeout = (unsigned int)tm;
+
+	return count;
+}
+
+static struct device_attribute dst_mirror_attrs[] = {
+	__ATTR(dirty, S_IWUSR, NULL, dst_mirror_mark_dirty),
+	__ATTR(clean, S_IWUSR, NULL, dst_mirror_mark_clean),
+	__ATTR(resync_size, S_IWUSR | S_IRUGO, dst_mirror_show_resync_size,
+			dst_mirror_set_resync_size),
+	__ATTR(resync_timeout, S_IWUSR | S_IRUGO, dst_mirror_show_resync_timeout,
+			dst_mirror_set_resync_timeout),
+	__ATTR(state, S_IRUSR, dst_mirror_show_state, NULL),
+	__ATTR(log_num, S_IRUSR, dst_mirror_show_log_num, NULL),
+};
+
+static void dst_mirror_handle_priv(struct dst_node *n)
+{
+	if (n->priv) {
+		int err, i;
+
+		for (i=0; i<ARRAY_SIZE(dst_mirror_attrs); ++i)
+			err = device_create_file(&n->device,
+					&dst_mirror_attrs[i]);
+	}
+}
+
+static void dst_mirror_destructor(struct bio *bio)
+{
+	dprintk("%s: bio: %p.\n", __func__, bio);
+	bio_free(bio, dst_mirror_bio_set);
+}
+
+struct dst_mirror_ndp
+{
+	int			err;
+	struct page		*page;
+	struct completion	complete;
+};
+
+static void dst_mirror_ndb_complete(struct dst_mirror_ndp *cmp, int err)
+{
+	cmp->err = err;
+	dprintk("%s: completing request: cmp: %p, err: %d.\n",
+			__func__, cmp, err);
+	complete(&cmp->complete);
+}
+
+static void dst_mirror_ndp_bio_endio(struct dst_request *req, int err)
+{
+	struct dst_mirror_ndp *cmp = req->bio->bi_private;
+
+	dst_mirror_ndb_complete(cmp, err);
+}
+
+static int dst_mirror_ndp_end_io(struct bio *bio, unsigned int size, int err)
+{
+	struct dst_mirror_ndp *cmp = bio->bi_private;
+
+	if (bio->bi_size)
+		return 0;
+
+	dst_mirror_ndb_complete(cmp, err);
+	return 0;
+}
+
+/*
+ * This function reads or writes node's private data from underlying media.
+ */
+static int dst_mirror_process_node_data(struct dst_node *n,
+		struct dst_mirror_node_data *ndata, int op)
+{
+	struct bio *bio;
+	int err = -ENOMEM;
+	struct dst_mirror_ndp *cmp;
+	struct dst_mirror_priv *priv = n->priv;
+	void *addr;
+
+	cmp = kzalloc(sizeof(struct dst_mirror_ndp), GFP_KERNEL);
+	if (!cmp)
+		goto err_out_exit;
+
+	cmp->page = alloc_page(GFP_NOIO);
+	if (!cmp->page)
+		goto err_out_free_cmp;
+
+	addr = kmap(cmp->page);
+
+	init_completion(&cmp->complete);
+
+	if (op == WRITE)
+		memcpy(addr, ndata, sizeof(struct dst_mirror_node_data));
+
+	bio = bio_alloc_bioset(GFP_NOIO, 1, dst_mirror_bio_set);
+	if (!bio)
+		goto err_out_free_page;
+
+	bio->bi_rw = op;
+	bio->bi_private = cmp;
+	bio->bi_sector = priv->ndp_sector;
+	bio->bi_bdev = n->bdev;
+	bio->bi_destructor = dst_mirror_destructor;
+	bio->bi_end_io = dst_mirror_ndp_end_io;
+
+	err = bio_add_pc_page(n->st->queue, bio, cmp->page, 512, 0);
+	if (err <= 0)
+		goto err_out_free_bio;
+
+	if (n->bdev) {
+		generic_make_request(bio);
+	} else {
+		struct dst_request req;
+
+		memset(&req, 0, sizeof(struct dst_request));
+		dst_fill_request(&req, bio, bio->bi_sector, n,
+				&dst_mirror_ndp_bio_endio);
+
+		err = req.state->ops->push(&req);
+		if (err)
+			req.bio_endio(&req, err);
+	}
+
+	dprintk("%s: waiting for completion: bio: %p, cmp: %p.\n",
+			__func__, bio, cmp);
+
+	wait_for_completion(&cmp->complete);
+
+	err = cmp->err;
+	if (!err && (op != WRITE))
+		memcpy(ndata, addr, sizeof(struct dst_mirror_node_data));
+
+	kunmap(cmp->page);
+
+	dprintk("%s: freeing bio: %p, err: %d.\n", __func__, bio, err);
+
+err_out_free_bio:
+	bio_put(bio);
+err_out_free_page:
+	kunmap(cmp->page);
+	__free_page(cmp->page);
+err_out_free_cmp:
+	kfree(cmp);
+err_out_exit:
+	return err;
+}
+
+/*
+ * This function reads node's private data from underlying media.
+ */
+static int dst_mirror_read_node_data(struct dst_node *n,
+		struct dst_mirror_node_data *ndata)
+{
+	return dst_mirror_process_node_data(n, ndata, READ);
+}
+
+/*
+ * This function writes node's private data from underlying media.
+ */
+static int dst_mirror_write_node_data(struct dst_node *n,
+		struct dst_mirror_node_data *ndata)
+{
+	dprintk("%s: writing new age: %llx, node: %p %llu-%llu.\n",
+			__func__, ndata->age, n, n->start, n->size);
+	return dst_mirror_process_node_data(n, ndata, WRITE);
+}
+
+static int dst_mirror_process_log_on_disk(struct dst_node *n, int op)
+{
+	struct dst_mirror_priv *priv = n->priv;
+	struct dst_mirror_log *log = &priv->log;
+	int err = -ENOMEM;
+	unsigned int i;
+	struct bio *bio;
+	struct dst_mirror_ndp *cmp;
+
+	cmp = kzalloc(sizeof(struct dst_mirror_ndp), GFP_KERNEL);
+	if (!cmp)
+		goto err_out_exit;
+
+	bio = bio_alloc_bioset(GFP_NOIO, 1, dst_mirror_bio_set);
+	if (!bio)
+		goto err_out_free_cmp;
+
+	bio->bi_rw = op;
+	bio->bi_private = cmp;
+	bio->bi_bdev = n->bdev;
+	bio->bi_destructor = dst_mirror_destructor;
+	bio->bi_end_io = dst_mirror_ndp_end_io;
+
+	for (i=0; i<log->nr_pages; ++i) {
+		bio->bi_sector = n->size + to_sector(i*PAGE_SIZE);
+
+		err = bio_add_pc_page(n->st->queue, bio,
+				virt_to_page(log->entries[i]), PAGE_SIZE,
+				offset_in_page(log->entries[i]));
+		if (err <= 0)
+			goto err_out_free_bio;
+
+		init_completion(&cmp->complete);
+
+		if (n->bdev) {
+			generic_make_request(bio);
+		} else {
+			struct dst_request req;
+
+			memset(&req, 0, sizeof(struct dst_request));
+			dst_fill_request(&req, bio, bio->bi_sector, n,
+					&dst_mirror_ndp_bio_endio);
+
+			err = req.state->ops->push(&req);
+			if (err)
+				req.bio_endio(&req, err);
+		}
+
+		dprintk("%s: waiting for completion: bio: %p, cmp: %p.\n",
+			__func__, bio, cmp);
+
+		wait_for_completion(&cmp->complete);
+		if (cmp->err) {
+			err = cmp->err;
+			goto err_out_free_bio;
+		}
+	}
+
+	err = dst_mirror_write_node_data(n, &priv->data);
+	if (err)
+		goto err_out_free_cmp;
+
+err_out_free_bio:
+	bio_put(bio);
+err_out_free_cmp:
+	kfree(cmp);
+err_out_exit:
+	if (err)
+		dst_mirror_mark_notsync(n);
+	return err;
+}
+
+static int dst_mirror_ndp_setup(struct dst_node *n, int first_node, int clean_on_sync)
+{
+	struct dst_mirror_priv *p = n->priv;
+	int sync = 1, err;
+	struct dst_mirror_priv *fp = p;
+	struct dst_node *first;
+
+	p->full_resync = 0;
+
+	if (first_node) {
+		u64 new_age = *(u64 *)&n->st;
+
+		p->old_age = p->data.age;
+		printk(KERN_NOTICE "%s: first age: %llx -> %llx. "
+			"Old will be set to new for the first node.\n",
+				__func__, p->old_age, new_age);
+		p->data.age = new_age;
+
+		err = dst_mirror_write_node_data(n, &p->data);
+		if (err)
+			return err;
+	} else {
+		mutex_lock(&n->st->tree_lock);
+		first = dst_storage_tree_search(n->st, n->start);
+		if (!first) {
+			mutex_unlock(&n->st->tree_lock);
+			dprintk("%s: there are no nodes in the storage.\n", __func__);
+			return -ENODEV;
+		}
+
+		fp = first->priv;
+
+		if (fp->old_age != p->data.age) {
+			p->full_resync = 1;
+			sync = 0;
+		}
+
+		p->old_age = fp->old_age;
+
+		n->shared_head = first;
+		atomic_inc(&first->shared_num);
+		list_add_tail(&n->shared, &first->shared);
+		mutex_unlock(&n->st->tree_lock);
+
+		if (sync) {
+			unsigned long flags;
+			unsigned int pidx, pnum;
+
+			err = dst_mirror_process_log_on_disk(n, READ);
+			if (err)
+				goto err_out_put;
+
+			spin_lock_irqsave(&fp->log_lock, flags);
+			if (fp->data.write_idx != p->data.write_idx)
+				sync = 0;
+			spin_unlock_irqrestore(&fp->log_lock, flags);
+			
+			pnum = p->data.resync_idx / DST_LOG_ENTRIES_PER_PAGE;
+			pidx = p->data.resync_idx % DST_LOG_ENTRIES_PER_PAGE;
+
+			if (p->log.entries[pnum][pidx].error)
+				sync = 0;
+		}
+	}
+
+	if (!sync) {
+		printk(KERN_NOTICE "%s: node %llu:%llu is not synced with the first one: "
+					"first_age: %llx, new_age: %llx, indexes %s.\n",
+					__func__, n->start, n->start+n->size,
+					p->data.age, p->old_age,
+					p->full_resync ? "does not match" : "match");
+		dst_mirror_mark_notsync(n);
+	} else {
+	       	if (clean_on_sync)
+			dst_mirror_mark_node_sync(n);
+		complete(&p->resync_complete);
+
+		printk(KERN_NOTICE "%s: node %llu:%llu is in sync with the first node.\n",
+				__func__, n->start, n->start+n->size);
+	}
+
+	dprintk("%s: age: old: %llx, new: %llx.\n", __func__, p->old_age, fp->data.age);
+
+	return 0;
+
+err_out_put:
+	first = n->shared_head;
+	atomic_dec(&first->shared_num);
+	mutex_lock(&n->st->tree_lock);
+	list_del(&n->shared);
+	n->shared_head = NULL;
+	mutex_unlock(&n->st->tree_lock);
+	dst_node_put(first);
+
+	return err;
+}
+
+static int dst_mirror_end_io(struct bio *bio, unsigned int size, int err)
+{
+	struct dst_request *req = bio->bi_private;
+
+	if (bio->bi_size)
+		return 0;
+
+	dprintk("%s: req: %p, bio: %p, req->bio: %p, err: %d.\n",
+			__func__, req, bio, req->bio, err);
+	req->bio_endio(req, err);
+	bio_put(bio);
+	return 0;
+}
+
+static int dst_mirror_process_request_nosync(struct dst_request *req,
+		struct dst_node *n)
+{
+	int err = 0;
+
+	/*
+	 * Block layer requires to clone a bio.
+	 */
+	if (n->bdev) {
+		struct bio *clone = bio_alloc_bioset(GFP_NOIO,
+			req->bio->bi_max_vecs, dst_mirror_bio_set);
+
+		__bio_clone(clone, req->bio);
+
+		clone->bi_bdev = n->bdev;
+		clone->bi_destructor = dst_mirror_destructor;
+		clone->bi_private = req;
+		clone->bi_end_io = &dst_mirror_end_io;
+
+		dprintk("%s: clone: %p, bio: %p, req: %p.\n",
+				__func__, clone, req->bio, req);
+
+		generic_make_request(clone);
+		err = 1;
+	} else {
+		struct dst_request nr;
+		/*
+		 * Network state processing engine will clone request
+		 * by itself if needed. We can not use the same structure
+		 * here, since number of its fields will be modified.
+		 */
+		memcpy(&nr, req, sizeof(struct dst_request));
+
+		nr.node = n;
+		nr.state = n->state;
+		nr.priv = req;
+
+		err = kst_check_permissions(n->state, req->bio);
+		if (!err)
+			err = n->state->ops->push(&nr);
+	}
+
+	dprintk("%s: req: %p, n: %p, bdev: %p, err: %d.\n",
+			__func__, req, n, n->bdev, err);
+
+	return err;
+}
+
+static int dst_mirror_sync_requeue(struct dst_node *n, int exiting)
+{
+	struct dst_mirror_priv *p = n->priv;
+	struct dst_mirror_sync_container *sc;
+	struct dst_request req;
+	unsigned long flags;
+	int err, num = 0;
+
+	if (!list_empty(&p->backlog_list))
+		dprintk("%s: n: %p, backlog_empty: %d, resync_num: %d.\n",
+			__func__, n, list_empty(&p->backlog_list),
+			atomic_read(&p->resync_num));
+
+	while (!list_empty(&p->backlog_list)) {
+		sc = NULL;
+		spin_lock_irqsave(&p->backlog_lock, flags);
+		if (!list_empty(&p->backlog_list)) {
+			sc = list_entry(p->backlog_list.next,
+					struct dst_mirror_sync_container,
+					sync_entry);
+			if (bio_rw(sc->bio) == WRITE)
+				list_del(&sc->sync_entry);
+			else
+				sc = NULL;
+		}
+		spin_unlock_irqrestore(&p->backlog_lock, flags);
+
+		if (!sc)
+			break;
+
+		sc->bio->bi_private = n;
+		if (sc->bio->bi_size == 0 || exiting) {
+			err = -EIO;
+			goto out;
+		}
+
+		memset(&req, 0, sizeof(struct dst_request));
+		dst_fill_request(&req, sc->bio, sc->start - n->start,
+				n, &kst_bio_endio);
+
+		err = dst_mirror_process_request_nosync(&req, n);
+out:
+		if (err < 0)
+			bio_endio(sc->bio, sc->bio->bi_size, err);
+		kfree(sc);
+		num++;
+	}
+
+	return num;
+}
+
+
+static void dst_mirror_resync_work(struct work_struct *work)
+{
+	struct dst_mirror_priv *priv = container_of(work,
+			struct dst_mirror_priv, resync_work.work);
+	struct dst_node *n = priv->node;
+
+	dst_mirror_resync(n, 0);
+	dst_mirror_sync_requeue(n, 0);
+	schedule_delayed_work(&priv->resync_work, priv->resync_timeout);
+}
+
+/*
+ * Mirroring log is used to store write request information.
+ * It is allocated on disk and in memory (sync happens each time
+ * resync work queue fires), and eats about 1% of free RAM or disk
+ * (what is less). Each write updates log, so when node goes offline,
+ * its log will be updated with error values, so that this entries
+ * could be resynced when node will be back online. When number of
+ * failed writes becomes equal to number of entries in the write log,
+ * recovery becomes impossible (since old log entries were overwritten)
+ * and full resync is scheduled. 
+ *
+ * This does not work well with the situation, when there are multiple
+ * writes to the same locations - they are considered as different
+ * writes and thus will be resynced multiple times.
+ * The right solution is to check log for each write, better if log
+ * would be not array, but tree.
+ */
+static int dst_mirror_log_init(struct dst_node *n)
+{
+	struct dst_mirror_priv *priv = n->priv;
+	struct dst_mirror_log *log = &priv->log;
+	struct dst_mirror_node_data *pd = &priv->data;
+	u64 allowed_ram = DIV_ROUND_UP(global_page_state(NR_FREE_PAGES), 100);
+	u64 allowed_disk = DIV_ROUND_UP(to_bytes(n->size), 100);
+	u64 num;
+	unsigned int nr_pages, i;
+	int err;
+
+	err = dst_mirror_read_node_data(n, pd);
+	if (err)
+		return err;
+
+	allowed_ram <<= PAGE_SHIFT;
+
+	num = min(allowed_disk, allowed_ram)/sizeof(struct dst_write_entry);
+	nr_pages = min(allowed_disk, allowed_ram) >> PAGE_SHIFT;
+
+	log->entries = kzalloc(nr_pages * sizeof(void *), GFP_KERNEL);
+	if (!log->entries)
+		return -ENOMEM;
+
+	for (i=0; i<nr_pages; ++i) {
+		log->entries[i] = kzalloc(PAGE_SIZE, GFP_KERNEL);
+		if (!log->entries[i])
+			goto err_out_free;
+	}
+
+	log->nr_pages = nr_pages;
+
+	pd->num = num;
+	pd->write_idx = pd->resync_idx = 0;
+
+	printk(KERN_INFO "%s: mirror write log contains %llu entries (%u pages).\n",
+			__func__, num, nr_pages);
+
+	return 0;
+
+err_out_free:
+	while (i-- != 0)
+		kfree(log->entries[i]);
+	kfree(log->entries);
+
+	return -ENOMEM;
+}
+
+static void dst_mirror_log_exit(struct dst_node *n)
+{
+	struct dst_mirror_priv *priv = n->priv;
+	unsigned int i;
+
+	for (i=0; i<priv->log.nr_pages; ++i)
+		kfree(priv->log.entries[i]);
+	kfree(priv->log.entries);
+}
+
+/*
+ * This callback is invoked when node is added to storage.
+ */
+static int dst_mirror_add_node(struct dst_node *n)
+{
+	struct dst_storage *st = n->st;
+	struct dst_mirror_priv *priv;
+	int err = -ENOMEM, first_node = 0;
+	u64 disk_size;
+
+	n->size--; /* A sector size actually. */
+
+	priv = kzalloc(sizeof(struct dst_mirror_priv), GFP_KERNEL);
+	if (!priv)
+		return -ENOMEM;
+
+	priv->ndp_sector = n->size;
+	priv->node = n;
+	priv->resync_start = 0;
+	priv->resync_size = to_sector(1024*1024*100ULL);
+	init_completion(&priv->resync_complete);
+	atomic_set(&priv->resync_num, 0);
+	INIT_DELAYED_WORK(&priv->resync_work, dst_mirror_resync_work);
+	priv->resync_timeout = 1000;
+
+	spin_lock_init(&priv->resync_wait_lock);
+	INIT_LIST_HEAD(&priv->resync_wait_list);
+	priv->resync_wait_num = 0;
+
+	spin_lock_init(&priv->backlog_lock);
+	INIT_LIST_HEAD(&priv->backlog_list);
+
+	n->priv_callback = &dst_mirror_handle_priv;
+	n->priv = priv;
+
+	spin_lock_init(&priv->log_lock);
+	
+	err = dst_mirror_log_init(n);
+	if (err)
+		goto err_out_free;
+
+	n->size -= to_sector(priv->log.nr_pages << PAGE_SHIFT);
+
+	mutex_lock(&st->tree_lock);
+	disk_size = st->disk_size;
+	if (st->disk_size) {
+		st->disk_size = min(n->size, st->disk_size);
+	} else {
+		st->disk_size = n->size;
+		first_node = 1;
+	}
+	mutex_unlock(&st->tree_lock);
+
+	err = dst_mirror_ndp_setup(n, first_node, 1);
+	if (err)
+		goto err_out_free_log;
+
+	schedule_delayed_work(&priv->resync_work, priv->resync_timeout);
+
+	dprintk("%s: n: %p, %llu:%llu, disk_size: %llu.\n",
+		__func__, n, n->start, n->size, st->disk_size);
+
+	return 0;
+
+err_out_free_log:
+	mutex_lock(&st->tree_lock);
+	st->disk_size = disk_size;
+	mutex_unlock(&st->tree_lock);
+	dst_mirror_log_exit(n);
+err_out_free:
+	kfree(priv);
+	n->priv = NULL;
+	return err;
+}
+
+static void dst_mirror_sync_destructor(struct bio *bio)
+{
+	struct bio_vec *bv;
+	int i;
+
+	bio_for_each_segment(bv, bio, i)
+		__free_page(bv->bv_page);
+	bio_free(bio, dst_mirror_bio_set);
+}
+
+static void dst_mirror_check_resync_complete(struct dst_node *n, int num_completed)
+{
+	struct dst_mirror_priv *priv = n->priv;
+
+	if (atomic_sub_return(num_completed, &priv->resync_num) == 0) {
+		dprintk("%s: completing resync request, start: %llu, size: %llu.\n",
+				__func__, priv->resync_start, priv->resync_size);
+		complete(&priv->resync_complete);
+		if (!priv->full_resync)
+			schedule_delayed_work(&priv->resync_work, 0);
+	}
+}
+
+static int dst_mirror_sync_check(struct dst_node *n)
+{
+	struct dst_mirror_priv *priv = n->priv;
+	struct dst_mirror_node_data *pd = &priv->data;
+	unsigned int pidx, pnum, i, j;
+	struct dst_write_entry *e;
+
+	pnum = pd->resync_idx / DST_LOG_ENTRIES_PER_PAGE;
+	pidx = pd->resync_idx % DST_LOG_ENTRIES_PER_PAGE;
+
+	for (i=pnum; i<priv->log.nr_pages; ++i) {
+		for (j=pidx; j<DST_LOG_ENTRIES_PER_PAGE; ++j) {
+			e = &priv->log.entries[i][j];
+
+			if (e->error) {
+				pd->resync_idx = i*DST_LOG_ENTRIES_PER_PAGE + j;
+				return 1;
+			}
+		}
+
+		pidx = 0;
+	}
+
+	dst_mirror_mark_node_sync(n);
+	return 0;
+}
+
+static int dst_mirror_sync_endio(struct bio *bio, unsigned int size, int err)
+{
+	dprintk("%s: bio: %p, err: %d, size: %u, op: %s.\n",
+			__func__, bio, err, bio->bi_size,
+			(bio_rw(bio) != WRITE)?"read":"write");
+
+	if (bio->bi_size)
+		return 1;
+
+	if (bio_rw(bio) != WRITE) {
+		struct dst_mirror_sync_container *sc = bio->bi_private;
+
+		if (err)
+			dst_mirror_mark_notsync(sc->node);
+
+		if (!err) {
+			bio->bi_size = sc->size;
+			bio->bi_sector = sc->start;
+		}
+		bio->bi_rw = WRITE;
+	} else {
+		struct dst_node *n = bio->bi_private;
+		struct dst_mirror_priv *priv = n->priv;
+		
+		if (err)
+			dst_mirror_mark_notsync(n);
+		else if (!priv->full_resync) {
+			struct dst_mirror_node_data *pd = &priv->data;
+			unsigned long flags;
+
+			spin_lock_irqsave(&priv->log_lock, flags);
+			pd->resync_idx = (pd->resync_idx + 1) % pd->num;
+			dst_mirror_sync_check(n);
+			spin_unlock_irqrestore(&priv->log_lock, flags);
+		}
+		bio_put(bio);
+		dst_mirror_check_resync_complete(n, 1);
+	}
+
+	return 0;
+}
+
+static int dst_mirror_sync_block(struct dst_node *n,
+		u64 start, u32 size)
+{
+	struct bio *bio;
+	unsigned int nr_pages = DIV_ROUND_UP(size, PAGE_SIZE), i, nr;
+	struct page *page;
+	int err = -ENOMEM;
+	unsigned long flags;
+	struct dst_mirror_sync_container *sc;
+	struct dst_mirror_priv *priv = n->priv;
+
+	dprintk("%s: [all in sectors] start: %llu, size: %u, nr_pages: %u, disk_size: %llu.\n",
+			__func__, (u64)to_sector(start), (unsigned int)to_sector(size),
+			nr_pages, n->st->disk_size);
+
+	atomic_set(&priv->resync_num, nr_pages);
+
+	while (nr_pages) {
+		nr = min_t(unsigned int, nr_pages, BIO_MAX_PAGES);
+
+		sc = kmalloc(sizeof(struct dst_mirror_sync_container), GFP_KERNEL);
+		if (!sc)
+			return -ENOMEM;
+
+		bio = bio_alloc_bioset(GFP_NOIO, nr, dst_mirror_bio_set);
+		if (!bio)
+			goto err_out_free_sc;
+
+		bio->bi_rw = READ;
+		bio->bi_private = sc;
+		bio->bi_sector = to_sector(start);
+		bio->bi_bdev = NULL;
+		bio->bi_destructor = dst_mirror_sync_destructor;
+		bio->bi_end_io = dst_mirror_sync_endio;
+
+		for (i = 0; i < nr; ++i) {
+			page = alloc_page(GFP_NOIO);
+			if (!page)
+				break;
+
+			err = bio_add_pc_page(n->st->queue, bio, page,
+					min_t(u32, PAGE_SIZE, size), 0);
+			if (err <= 0)
+				break;
+			size -= err;
+			err = 0;
+		}
+
+		if (!bio->bi_vcnt) {
+			err = -ENOMEM;
+			goto err_out_put_bio;
+		}
+
+		sc->node = n;
+		sc->bio = bio;
+		sc->start = bio->bi_sector;
+		sc->size = bio->bi_size;
+
+		dst_mirror_check_resync_complete(n, i-1);
+
+		spin_lock_irqsave(&priv->backlog_lock, flags);
+		list_add_tail(&sc->sync_entry, &priv->backlog_list);
+		spin_unlock_irqrestore(&priv->backlog_lock, flags);
+
+		nr_pages -= bio->bi_vcnt;
+		dprintk("%s: start: %llu, size: %u/%u, bio: %p, rest_pages: %u, rest_bytes: %u.\n",
+			__func__, start, bio->bi_size, nr, bio, nr_pages, size);
+
+		start += bio->bi_size;
+
+		err = n->st->queue->make_request_fn(n->st->queue, bio);
+		if (err)
+			goto err_out_del;
+	}
+
+	return 0;
+
+err_out_del:
+	spin_lock_irqsave(&priv->backlog_lock, flags);
+	list_del(&sc->sync_entry);
+	spin_unlock_irqrestore(&priv->backlog_lock, flags);
+err_out_put_bio:
+	bio_put(bio);
+err_out_free_sc:
+	kfree(sc);
+	return err;
+}
+
+static void dst_mirror_read_endio(struct dst_request *req, int err)
+{
+	if (err)
+		dst_mirror_mark_notsync(req->node);
+
+	if (err && req->state)
+		kst_wake(req->state);
+
+	if (!err || req->callback)
+		kst_bio_endio(req, err);
+}
+
+static void dst_mirror_update_write_log(struct dst_request *req, int err)
+{
+	struct dst_mirror_priv *priv = req->node->priv;
+	struct dst_mirror_log *log = &priv->log;
+	struct dst_mirror_node_data *pd = &priv->data;
+	unsigned long flags;
+	struct dst_write_entry *e;
+	unsigned int pnum, idx;
+
+	spin_lock_irqsave(&priv->log_lock, flags);
+
+	pnum = pd->write_idx / DST_LOG_ENTRIES_PER_PAGE;
+	idx = pd->write_idx % DST_LOG_ENTRIES_PER_PAGE;
+
+	e = &log->entries[pnum][idx];
+	e->error = err;
+	e->start = req->start - to_sector(req->orig_size);
+	e->size = req->orig_size;
+
+	if (++pd->write_idx == pd->num)
+		pd->write_idx = 0;
+
+	if (test_bit(DST_NODE_NOTSYNC, &req->node->flags) &&
+			pd->write_idx == pd->resync_idx)
+		priv->full_resync = 1;
+
+	spin_unlock_irqrestore(&priv->log_lock, flags);
+}
+
+static void dst_mirror_write_endio(struct dst_request *req, int err)
+{
+	if (err) {
+		dst_mirror_mark_notsync(req->node);
+		if (req->state)
+			kst_wake(req->state);
+	}
+	dst_mirror_update_write_log(req, err);
+
+	req = req->priv;
+
+	dprintk("%s: req: %p, priv: %p err: %d, bio: %p, "
+			"cnt: %d, orig_size: %llu.\n",
+		__func__, req, req->priv, err, req->bio,
+		atomic_read(&req->refcnt), req->orig_size);
+
+	if (atomic_dec_and_test(&req->refcnt)) {
+		bio_endio(req->bio, req->orig_size, 0);
+		dst_free_request(req);
+	}
+}
+
+static int dst_mirror_process_request(struct dst_request *req,
+		struct dst_node *n)
+{
+	int err;
+
+	dst_mirror_sync_requeue(n, 0);
+	err = dst_mirror_process_request_nosync(req, n);
+	if (err > 0)
+		err = 0;
+	if (err)
+		req->bio_endio(req, err);
+
+	return err;
+}
+
+static int dst_mirror_write(struct dst_request *oreq)
+{
+	struct dst_node *n, *node = oreq->node;
+	struct dst_request *req = oreq;
+	int num, err = 0, err_num = 0, orig_num;
+	struct dst_mirror_priv *priv = node->priv;
+	unsigned long flags;
+
+	/*
+	 * This check is for requests which fell into resync window.
+	 * Such requests are written when resync window moves forward.
+	 */
+	if (oreq->bio_endio != &dst_mirror_write_endio) {
+		req = dst_clone_request(oreq, oreq->node->w->req_pool);
+		if (!req) {
+			err = -ENOMEM;
+			goto err_out_exit;
+		}
+
+		req->priv = req;
+		req->bio_endio = &dst_mirror_write_endio;
+	}
+
+	if (test_bit(DST_NODE_NOTSYNC, &node->flags) &&
+			oreq->start >= priv->resync_start &&
+			to_sector(oreq->orig_size) <= priv->resync_size &&
+			priv->full_resync) {
+		dprintk("%s: queueing request: start: %llu, size: %llu, resync window start: %llu, size: %llu.\n",
+				__func__, oreq->start, (u64)to_sector(oreq->orig_size),
+				priv->resync_start, priv->resync_size);
+		spin_lock_irqsave(&priv->resync_wait_lock, flags);
+		list_add_tail(&req->request_list_entry, &priv->resync_wait_list);
+		priv->resync_wait_num++;
+		spin_unlock_irqrestore(&priv->resync_wait_lock, flags);
+		return 0;
+	}
+
+	/*
+	 * This logic is pretty simple - req->bio_endio will not
+	 * call bio_endio() until all mirror devices completed
+	 * processing of the request (no matter with or without error).
+	 * Mirror's req->bio_endio callback will take care of that.
+	 */
+	orig_num = num = atomic_read(&req->node->shared_num) + 1;
+	atomic_set(&req->refcnt, num);
+
+	dprintk("\n%s: req: %p, mirror to %d nodes.\n",
+			__func__, req, num);
+
+	err = dst_mirror_process_request(req, node);
+	if (err)
+		err_num++;
+
+	if (--num) {
+		list_for_each_entry(n, &node->shared, shared) {
+			dprintk("\n%s: req: %p, start: %llu, size: %llu, "
+					"num: %d, n: %p, state: %p.\n",
+				__func__, req, req->start,
+				req->size, num, n, n->state);
+
+			err = dst_mirror_process_request(req, n);
+			if (err)
+				err_num++;
+
+			if (--num <= 0)
+				break;
+		}
+	}
+
+	if (err_num == orig_num)
+		dprintk("%s: req: %p, num: %d, err: %d.\n",
+				__func__, req, num, err);
+
+	err = 0;
+
+err_out_exit:
+	return err;
+}
+
+static int dst_mirror_read(struct dst_request *req)
+{
+	struct dst_node *node = req->node, *n, *min_dist_node;
+	struct dst_mirror_priv *priv = node->priv;
+	u64 dist, d;
+	int err;
+
+	req->bio_endio = &dst_mirror_read_endio;
+
+	do {
+		err = -ENODEV;
+		min_dist_node = NULL;
+		dist = -1ULL;
+
+		/*
+		 * Reading is never performed from the node under resync.
+		 */
+
+		if (!test_bit(DST_NODE_NOTSYNC, &node->flags)) {
+			priv = node->priv;
+			if (req->start > priv->last_start)
+				dist = req->start - priv->last_start;
+			else
+				dist = priv->last_start - req->start;
+			min_dist_node = req->node;
+		}
+
+		list_for_each_entry(n, &node->shared, shared) {
+			if (test_bit(DST_NODE_NOTSYNC, &n->flags))
+				continue;
+
+			priv = n->priv;
+
+			if (req->start > priv->last_start)
+				d = req->start - priv->last_start;
+			else
+				d = priv->last_start - req->start;
+
+			if (d < dist)
+				min_dist_node = n;
+		}
+
+		if (!min_dist_node)
+			break;
+
+		priv = min_dist_node->priv;
+		priv->last_start = req->start;
+
+		req->node = min_dist_node;
+		req->state = req->node->state;
+
+		if (req->node->bdev) {
+			req->bio->bi_bdev = req->node->bdev;
+			generic_make_request(req->bio);
+			err = 0;
+			break;
+		}
+
+		err = req->state->ops->push(req);
+		if (err) {
+			dprintk("%s: req: %p, bio: %p, node: %p, err: %d.\n",
+				__func__, req, req->bio, min_dist_node, err);
+			dst_mirror_mark_notsync(req->node);
+		}
+	} while (err && min_dist_node);
+
+	if (err || !min_dist_node) {
+		dprintk("%s: req: %p, bio: %p, node: %p, err: %d.\n",
+			__func__, req, req->bio, min_dist_node, err);
+		if (!err)
+			err = -ENODEV;
+	}
+	dprintk("%s: req: %p, err: %d.\n", __func__, req, err);
+	return err;
+}
+
+/*
+ * This callback is invoked from block layer request processing function,
+ * its task is to remap block request to different nodes.
+ */
+static int dst_mirror_remap(struct dst_request *req)
+{
+	int (*remap[])(struct dst_request *) =
+		{&dst_mirror_read, &dst_mirror_write};
+
+	return remap[bio_rw(req->bio) == WRITE](req);
+}
+
+static void dst_mirror_write_queued(struct dst_node *n)
+{
+	struct dst_mirror_priv *priv = n->priv;
+	unsigned long flags;
+	struct dst_request *req;
+	int num = priv->resync_wait_num, err;
+
+	while (!list_empty(&priv->resync_wait_list) && num != 0) {
+		req = NULL;
+		spin_lock_irqsave(&priv->resync_wait_lock, flags);
+		if (!list_empty(&priv->resync_wait_list)) {
+			req = list_entry(priv->resync_wait_list.next,
+					struct dst_request,
+					request_list_entry);
+			list_del_init(&req->request_list_entry);
+			num--;
+		}
+		spin_unlock_irqrestore(&priv->resync_wait_lock, flags);
+
+		if (!req)
+			break;
+
+		dprintk("%s: queued request n: %p, req: %p, start: %llu, size: %llu, num: %d.\n",
+				__func__, n, req, req->start, (u64)to_sector(req->size), num);
+		err = dst_mirror_process_request(req, n);
+		if (err)
+			break;
+	}
+}
+
+static int dst_mirror_resync_partial(struct dst_node *node)
+{
+	struct dst_storage *st = node->st;
+	struct dst_node *first = node->shared_head, *n, *sync;
+	struct dst_mirror_priv *p = node->priv, *sp;
+	struct dst_mirror_node_data *pd = &p->data;
+	struct dst_mirror_node_data *spd;
+	struct dst_write_entry *e, *ep;
+	unsigned long flags;
+	unsigned int pnum, idx;
+	u64 start;
+	u32 size;
+
+	if (!first)
+		first = node;
+
+	sync = NULL;
+	mutex_lock(&st->tree_lock);
+	list_for_each_entry(n, &first->shared, shared) {
+		if (!test_bit(DST_NODE_NOTSYNC, &n->flags)) {
+			sync = n;
+			dst_node_get(sync);
+			break;
+		}
+	}
+	mutex_unlock(&st->tree_lock);
+	dprintk("%s: n: %p, first: %p, sync: %p.\n", __func__, node, first, sync);
+
+	if (!sync)
+		return -ENODEV;
+
+	sp = sync->priv;
+	spd = &sp->data;
+
+	spin_lock_irqsave(&sp->log_lock, flags);
+	spin_lock(&p->log_lock);
+
+	pnum = pd->resync_idx / DST_LOG_ENTRIES_PER_PAGE;
+	idx = pd->resync_idx % DST_LOG_ENTRIES_PER_PAGE;
+
+	ep = sp->log.entries[pnum];
+	e = &ep[idx];
+
+	start = e->start;
+	size = e->size;
+
+	spin_unlock(&p->log_lock);
+	spin_unlock_irqrestore(&sp->log_lock, flags);
+
+	dprintk("%s: node write_idx: %llu, resync_idx: %llu, num: %llu, sync write_idx: %llu, num: %llu.\n",
+			__func__, pd->write_idx, pd->resync_idx, pd->num, spd->write_idx, spd->num);
+	dprintk("%s: sync request: start: %llu, size: %llu.\n",
+			__func__, start, (u64)to_sector(size));
+
+	dst_node_put(sync);
+
+	return dst_mirror_sync_block(node, to_bytes(start), size);
+}
+
+/*
+ * Resync logic - sliding window algorithm.
+ *
+ * At startup system checks age (unique cookie) of the node and if it
+ * does not match first node it resyncs all data from the first node in
+ * the mirror to others (non-sync nodes), each non-synced node has a
+ * window, which slides from the start of the node to the end. 
+ * During resync all requests, which enter the window are queued, thus
+ * window has to be sufficiently small. When window is synced from the
+ * other nodes, queued requests are written and window moves forward,
+ * thus subsequent resync is started when previous window is fully completed.
+ * When window reaches end of the node, it is marked as synchronized.
+ *
+ * If age of the node matches the first one, but log contains different
+ * number of write log entries compared to the first node (first node always
+ * stands as a clean), then partial resync is scheduled.
+ * Partial resync will also be scheduled when log entry pointed by resync
+ * index of the node contains error.
+ *
+ * Mechanism of this resync type is following: system selects a sync node
+ * (checking each node's flags) and fetches a log entry pointed by resync
+ * index of the given node and resync data from other nodes to given one.
+ * Then it checks the rest of the write log and checks if there are
+ * another failed writes, so that next resync block would be fetched for
+ * them.
+ */
+static int dst_mirror_resync(struct dst_node *n, int ndp)
+{
+	struct dst_mirror_priv *priv = n->priv;
+	struct dst_mirror_priv *fp = priv;
+	u64 total, allowed, size;
+	int err;
+	
+	if (n->shared_head)
+		fp = n->shared_head->priv;
+
+	if (!test_bit(DST_NODE_NOTSYNC, &n->flags))
+		return 0;
+	if (atomic_read(&priv->resync_num) != 0) {
+		dprintk("%s: n: %p, resync_num: %d.\n",
+			__func__, n, atomic_read(&priv->resync_num));
+		return -EAGAIN;
+	}
+
+	allowed = global_page_state(NR_FREE_PAGES) +
+		global_page_state(NR_FILE_PAGES);
+	allowed /= 2;
+	allowed = to_sector(allowed << PAGE_SHIFT);
+
+	size = min(priv->resync_size, n->size - priv->resync_start);
+
+	total = min(allowed, size);
+
+	printk(KERN_NOTICE "%s: node: %p, %llu:%llu %s synchronization has been started "
+			"from %llu, allowed: %llu, total: %llu.\n",
+			__func__, n, n->start, n->size,
+			(priv->data.age == fp->data.age) ? "partial" : "full",
+			priv->resync_start, allowed, total);
+
+	if (!priv->full_resync)
+		return dst_mirror_resync_partial(n);
+
+	dst_mirror_write_queued(n);
+
+	if (priv->resync_start == n->size) {
+		dst_mirror_mark_node_sync(n);
+		priv->data.age = fp->data.age;
+		dst_mirror_write_node_data(n, &priv->data);
+		return 0;
+	}
+
+	if (ndp) {
+		err = dst_mirror_ndp_setup(n, 0, 0);
+		if (err)
+			return err;
+	}
+
+	err = dst_mirror_sync_block(n, to_bytes(priv->resync_start),
+			to_bytes(total));
+	if (!err)
+		priv->resync_start += total;
+
+	return err;
+}
+
+static int dst_mirror_error(struct kst_state *st, int err)
+{
+	struct dst_request *req, *tmp;
+	unsigned int revents = st->socket->ops->poll(NULL, st->socket, NULL);
+
+	dprintk("%s: err: %d, revents: %x, notsync: %d.\n",
+			__func__, err, revents,
+			test_bit(DST_NODE_NOTSYNC, &st->node->flags));
+
+	if (err == -EEXIST)
+		return err;
+
+	if (!(revents & (POLLERR | POLLHUP)) &&
+		   	(err == -EPIPE || err == -ECONNRESET)) {
+		if (test_bit(DST_NODE_NOTSYNC, &st->node->flags))
+			return dst_mirror_resync(st->node, 1);
+		return 0;
+	}
+
+	if (atomic_read(&st->node->shared_num) == 0 &&
+			!st->node->shared_head) {
+		dprintk("%s: this node is the only one in the mirror, "
+				"can not mark it notsync.\n", __func__);
+		return err;
+	}
+
+	dst_mirror_mark_notsync(st->node);
+
+	mutex_lock(&st->request_lock);
+	list_for_each_entry_safe(req, tmp, &st->request_list,
+					request_list_entry) {
+		kst_del_req(req);
+		dprintk("%s: requeue [%c], start: %llu, idx: %d,"
+				" num: %d, size: %llu, offset: %u, err: %d.\n",
+			__func__, (bio_rw(req->bio) == WRITE)?'W':'R',
+			req->start, req->idx, req->num, req->size,
+			req->offset, err);
+
+		if (bio_rw(req->bio) != WRITE) {
+			req->start -= to_sector(req->orig_size - req->size);
+			req->size = req->orig_size;
+			req->flags &= ~(DST_REQ_HEADER_SENT | DST_REQ_CHEKSUM_RECV);
+			req->idx = 0;
+			if (dst_mirror_read(req))
+				dst_free_request(req);
+		} else {
+			kst_complete_req(req, err);
+		}
+	}
+	mutex_unlock(&st->request_lock);
+	return err;
+}
+
+/*
+ * This callback is invoked when node is removed from storage.
+ */
+static void dst_mirror_del_node(struct dst_node *n)
+{
+	struct dst_mirror_priv *priv = n->priv;
+
+	priv->full_resync = 1;
+	cancel_rearming_delayed_work(&priv->resync_work);
+	flush_scheduled_work();
+
+	dprintk("%s: n: %p, backlog_empty: %d, resync_num: %d.\n",
+		__func__, n, list_empty(&priv->backlog_list),
+		atomic_read(&priv->resync_num));
+
+	/*
+	 * This strange-looking loop waits until all resync read requests
+	 * are completed, this happens in dst_mirror_sync_requeue().
+	 */
+	while (atomic_read(&priv->resync_num)) {
+		dst_mirror_sync_requeue(n, 1);
+		if (printk_ratelimit())
+			dprintk("%s: n: %p, backlog_empty: %d, resync_num: %d.\n",
+				__func__, n, list_empty(&priv->backlog_list),
+				atomic_read(&priv->resync_num));
+		msleep(100);
+	}
+
+	wait_for_completion(&priv->resync_complete);
+	dst_mirror_sync_requeue(n, 1);
+
+	if (priv) {
+		dst_mirror_log_exit(n);
+		kfree(priv);
+		n->priv = NULL;
+	}
+
+	if (n->device.parent == &n->st->device) {
+		int i;
+
+		for (i=0; i<ARRAY_SIZE(dst_mirror_attrs); ++i)
+			device_remove_file(&n->device, &dst_mirror_attrs[i]);
+	}
+}
+
+static struct dst_alg_ops alg_mirror_ops = {
+	.remap		= dst_mirror_remap,
+	.add_node	= dst_mirror_add_node,
+	.del_node	= dst_mirror_del_node,
+	.error		= dst_mirror_error,
+	.owner		= THIS_MODULE,
+};
+
+static int __devinit alg_mirror_init(void)
+{
+	int err = -ENOMEM;
+
+	dst_mirror_bio_set = bioset_create(256, 256);
+	if (!dst_mirror_bio_set)
+		return -ENOMEM;
+
+	alg_mirror = dst_alloc_alg("alg_mirror", &alg_mirror_ops);
+	if (!alg_mirror)
+		goto err_out;
+
+	return 0;
+
+err_out:
+	bioset_free(dst_mirror_bio_set);
+	return err;
+}
+
+static void __devexit alg_mirror_exit(void)
+{
+	dst_remove_alg(alg_mirror);
+	bioset_free(dst_mirror_bio_set);
+}
+
+module_init(alg_mirror_init);
+module_exit(alg_mirror_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>");
+MODULE_DESCRIPTION("Mirror distributed algorithm.");


^ permalink raw reply related

* [0/4] DST: Distributed storage.
From: Evgeniy Polyakov @ 2007-12-17 15:03 UTC (permalink / raw)
  To: lkml; +Cc: netdev, linux-fsdevel
In-Reply-To: <20071214133747.GC31971@2ka.mipt.ru>


Distributed storage.

I'm pleased to announce the 12'th release of the distributed
storage subsystem (DST).

DST allows to form a storage on top of local and remote nodes
and combine them into linear or mirroring setup, which in
turn can be exported to remote nodes.

Short changelog:
 * new improved mirroring algorithm.
	This algorithm uses sliding window approach for full resync
	and write log for partial resync.
 * fixed number of typos and debug cleanups
 * update inode size when linear algorithm changes the size of the
	storage in run time
 * extended number of sysfs files and documentation for them
 * fixed leak in local export node setup
 * name is 'Dancing with the smoked neutrino' now

Overall list of features of the DST can be found on project's homepage:

http://tservice.net.ru/~s0mbre/old/?section=projects&item=dst

DST is also exported as a git tree available for clone and pull from
http://tservice.net.ru/~s0mbre/archive/dst/dst.git

Interested reader can test DST with 2.6.23 tree too
(it should compile fine, but was not tested).

DST passed all FS tests in LTP with XFS (modulo MAX_LOCK_DEPTH too low bug:
[ 8398.605691] BUG: MAX_LOCK_DEPTH too low!
[ 8398.609641] turning off the locking correctness validator.

this is not DST problem though), but it was not performed with
offline/online nodes.

Thank you.

Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>



^ permalink raw reply

* Re: "ip neigh show" not showing arp cache entries?
From: Chris Friesen @ 2007-12-17 15:32 UTC (permalink / raw)
  To: yoshfuji; +Cc: dada1, netdev, linux-kernel
In-Reply-To: <20071213.070641.20411400.yoshfuji@linux-ipv6.org>

YOSHIFUJI Hideaki / 吉藤英明 wrote:
> In article <47605934.2060604@nortel.com> (at Wed, 12 Dec 2007
> 15:57:08 -0600), "Chris Friesen" <cfriesen@nortel.com> says:

>>> You may try other versions of this command
>>> 
>>> http://devresources.linux-foundation.org/dev/iproute2/download/
>> 
>> They appear to be numbered by kernel version, and the above version
>> is the most recent one for 2.6.14.  Will more recent ones (for
>> newer kernels) work with my kernel?

> It should work; if it doesn't, please make a report.  Thanks.

I downloaded iproute2-2.6.23 and built it for my kernel.

I'm compiling for a different kernel than is actually running on the 
build system, so I had to add a line defining KERNEL_INCLUDE to the 
Makefile, and I had to add "-I${KERNEL_INCLUDE}" to the CFLAGS 
definition.  Someone might want to do something about that...

Anyways, the arp entry issue is still there.  The "arp" command gives a 
bunch of entries:

root@typhoon-base-unit0:/root> arp -n
Address          HWtype  HWaddress           Flags Mask            Iface
192.168.24.81    ether   00:01:AF:14:E9:8A   C                     bond2
172.24.132.2             (incomplete)                              bond0
172.24.136.0     ether   00:C0:8B:07:B3:7E   C                     bond0
172.24.137.0             (incomplete)                              bond0
172.24.0.9       ether   00:07:E9:41:4B:B4   C                     bond0
10.41.18.101     ether   00:0E:0C:5E:95:BD   C                     eth6
172.24.0.11      ether   00:03:CC:51:06:5E   C                     bond0
172.24.132.1     ether   00:01:AF:14:E9:88   C                     bond0
172.24.0.15      ether   00:0E:0C:85:FD:D2   C                     bond0
172.24.0.3       ether   00:01:AF:14:C8:CC   C                     bond0
172.24.0.5       ether   00:01:AF:15:E0:6A   C                     bond0

The original "ip" command and the new one ("/tmp/ip") both give the same 
results--some of the entries are missing.

root@typhoon-base-unit0:/root> ip neigh show all
172.24.137.0 dev bond0  FAILED
172.24.0.9 dev bond0 lladdr 00:07:e9:41:4b:b4 REACHABLE
10.41.18.101 dev eth6 lladdr 00:0e:0c:5e:95:bd REACHABLE
172.24.0.11 dev bond0 lladdr 00:03:cc:51:06:5e STALE
172.24.132.1 dev bond0 lladdr 00:01:af:14:e9:88 REACHABLE
172.24.0.15 dev bond0 lladdr 00:0e:0c:85:fd:d2 STALE
172.24.0.3 dev bond0 lladdr 00:01:af:14:c8:cc REACHABLE
172.24.0.5 dev bond0 lladdr 00:01:af:15:e0:6a STALE

root@typhoon-base-unit0:/root> /tmp/ip neigh show all
172.24.137.0 dev bond0  FAILED
172.24.0.9 dev bond0 lladdr 00:07:e9:41:4b:b4 REACHABLE
10.41.18.101 dev eth6 lladdr 00:0e:0c:5e:95:bd REACHABLE
172.24.0.11 dev bond0 lladdr 00:03:cc:51:06:5e STALE
172.24.132.1 dev bond0 lladdr 00:01:af:14:e9:88 REACHABLE
172.24.0.15 dev bond0 lladdr 00:0e:0c:85:fd:d2 STALE
172.24.0.3 dev bond0 lladdr 00:01:af:14:c8:cc REACHABLE
172.24.0.5 dev bond0 lladdr 00:01:af:15:e0:6a STALE


However, if I specifically try to print out one of the missing entries, 
it shows up:

root@typhoon-base-unit0:/root> /tmp/ip neigh show 192.168.24.81
192.168.24.81 dev bond2 lladdr 00:01:af:14:e9:8a REACHABLE


Chris

^ permalink raw reply

* [RFC] ehea: kdump support - rework
From: Thomas Klein @ 2007-12-17 15:52 UTC (permalink / raw)
  To: Paul Mackerras
  Cc: Christoph Raisch, Jan-Bernd Themann, linux-kernel, linux-ppc,
	Marcus Eder, netdev, Stefan Roscher, Michael Ellermann,
	Michael Neuling

This patch adds kdump support using the new PPC crash shutdown hook to the
ehea driver.
The reworked implementation follows the feedback I got. The crash handler
now just iterates over two simple arrays instead of handling linked lists.

Further feedback will be appreciated.

ehea kdump support RFC #1:
  http://lkml.org/lkml/2007/12/12/241


Signed-off-by: Thomas Klein <tklein@de.ibm.com>

---
diff -Nurp -X dontdiff linux-2.6.24-rc5/drivers/net/ehea/ehea.h patched_kernel/drivers/net/ehea/ehea.h
--- linux-2.6.24-rc5/drivers/net/ehea/ehea.h	2007-12-11 04:48:43.000000000 +0100
+++ patched_kernel/drivers/net/ehea/ehea.h	2007-12-17 16:18:49.000000000 +0100
@@ -40,7 +40,7 @@
 #include <asm/io.h>
 
 #define DRV_NAME	"ehea"
-#define DRV_VERSION	"EHEA_0083"
+#define DRV_VERSION	"EHEA_0085"
 
 /* eHEA capability flags */
 #define DLPAR_PORT_ADD_REM 1
@@ -386,6 +386,13 @@ struct ehea_port_res {
 
 
 #define EHEA_MAX_PORTS 16
+
+#define EHEA_NUM_PORTRES_FW_HANDLES    6  /* QP handle, SendCQ handle,
+					     RecvCQ handle, EQ handle,
+					     SendMR handle, RecvMR handle */
+#define EHEA_NUM_PORT_FW_HANDLES       1  /* EQ handle */
+#define EHEA_NUM_ADAPTER_FW_HANDLES    2  /* MR handle, NEQ handle */
+
 struct ehea_adapter {
 	u64 handle;
 	struct of_device *ofdev;
@@ -405,6 +412,31 @@ struct ehea_mc_list {
 	u64 macaddr;
 };
 
+/* kdump support */
+struct ehea_fw_handle_entry {
+	u64 adh;               /* Adapter Handle */
+	u64 fwh;               /* Firmware Handle */
+};
+
+struct ehea_fw_handle_array {
+	struct ehea_fw_handle_entry *arr;
+	int num_entries;
+	struct semaphore lock;
+};
+
+struct ehea_bcmc_reg_entry {
+	u64 adh;               /* Adapter Handle */
+	u32 port_id;           /* Logical Port Id */
+	u8 reg_type;           /* Registration Type */
+	u64 macaddr;
+};
+
+struct ehea_bcmc_reg_array {
+	struct ehea_bcmc_reg_entry *arr;
+	int num_entries;
+	struct semaphore lock;
+};
+
 #define EHEA_PORT_UP 1
 #define EHEA_PORT_DOWN 0
 #define EHEA_PHY_LINK_UP 1
diff -Nurp -X dontdiff linux-2.6.24-rc5/drivers/net/ehea/ehea_main.c patched_kernel/drivers/net/ehea/ehea_main.c
--- linux-2.6.24-rc5/drivers/net/ehea/ehea_main.c	2007-12-11 04:48:43.000000000 +0100
+++ patched_kernel/drivers/net/ehea/ehea_main.c	2007-12-17 16:18:49.000000000 +0100
@@ -35,6 +35,7 @@
 #include <linux/if_ether.h>
 #include <linux/notifier.h>
 #include <linux/reboot.h>
+#include <asm/kexec.h>
 
 #include <net/ip.h>
 
@@ -98,8 +99,10 @@ static int port_name_cnt = 0;
 static LIST_HEAD(adapter_list);
 u64 ehea_driver_flags = 0;
 struct work_struct ehea_rereg_mr_task;
-
 struct semaphore dlpar_mem_lock;
+struct ehea_fw_handle_array ehea_fw_handles;
+struct ehea_bcmc_reg_array ehea_bcmc_regs;
+
 
 static int __devinit ehea_probe_adapter(struct of_device *dev,
 					const struct of_device_id *id);
@@ -131,6 +134,160 @@ void ehea_dump(void *adr, int len, char 
 	}
 }
 
+static void ehea_update_firmware_handles(void)
+{
+	struct ehea_fw_handle_entry *arr = NULL;
+	struct ehea_adapter *adapter;
+	int num_adapters = 0;
+	int num_ports = 0;
+	int num_portres = 0;
+	int i = 0;
+	int num_fw_handles, k, l;
+
+	/* Determine number of handles */
+	list_for_each_entry(adapter, &adapter_list, list) {
+		num_adapters++;
+
+		for (k = 0; k < EHEA_MAX_PORTS; k++) {
+			struct ehea_port *port = adapter->port[k];
+
+			if (!port || (port->state != EHEA_PORT_UP))
+				continue;
+
+			num_ports++;
+			num_portres += port->num_def_qps + port->num_add_tx_qps;
+		}
+	}
+
+	num_fw_handles = num_adapters * EHEA_NUM_ADAPTER_FW_HANDLES +
+			 num_ports * EHEA_NUM_PORT_FW_HANDLES +
+			 num_portres * EHEA_NUM_PORTRES_FW_HANDLES;
+
+	if (num_fw_handles) {
+		arr = kzalloc(num_fw_handles * sizeof(*arr), GFP_KERNEL);
+		if (!arr)
+			return;  /* Keep the existing array */
+	} else
+		goto out_update;
+
+	list_for_each_entry(adapter, &adapter_list, list) {
+		for (k = 0; k < EHEA_MAX_PORTS; k++) {
+			struct ehea_port *port = adapter->port[k];
+
+			if (!port || (port->state != EHEA_PORT_UP))
+				continue;
+
+			for (l = 0;
+			     l < port->num_def_qps + port->num_add_tx_qps;
+			     l++) {
+				struct ehea_port_res *pr = &port->port_res[l];
+
+				arr[i].adh = adapter->handle;
+				arr[i++].fwh = pr->qp->fw_handle;
+				arr[i].adh = adapter->handle;
+				arr[i++].fwh = pr->send_cq->fw_handle;
+				arr[i].adh = adapter->handle;
+				arr[i++].fwh = pr->recv_cq->fw_handle;
+				arr[i].adh = adapter->handle;
+				arr[i++].fwh = pr->eq->fw_handle;
+				arr[i].adh = adapter->handle;
+				arr[i++].fwh = pr->send_mr.handle;
+				arr[i].adh = adapter->handle;
+				arr[i++].fwh = pr->recv_mr.handle;
+			}
+			arr[i].adh = adapter->handle;
+			arr[i++].fwh = port->qp_eq->fw_handle;
+		}
+
+		arr[i].adh = adapter->handle;
+		arr[i++].fwh = adapter->neq->fw_handle;
+
+		if (adapter->mr.handle) {
+			arr[i].adh = adapter->handle;
+			arr[i++].fwh = adapter->mr.handle;
+		}
+	}
+
+out_update:
+	kfree(ehea_fw_handles.arr);
+	ehea_fw_handles.arr = arr;
+	ehea_fw_handles.num_entries = i;
+}
+
+static void ehea_update_bcmc_registrations(void)
+{
+	struct ehea_bcmc_reg_entry *arr = NULL;
+	struct ehea_adapter *adapter;
+	struct ehea_mc_list *mc_entry;
+	int num_registrations = 0;
+	int i = 0;
+	int k;
+
+	/* Determine number of registrations */
+	list_for_each_entry(adapter, &adapter_list, list)
+		for (k = 0; k < EHEA_MAX_PORTS; k++) {
+			struct ehea_port *port = adapter->port[k];
+
+			if (!port || (port->state != EHEA_PORT_UP))
+				continue;
+
+			num_registrations += 2;	/* Broadcast registrations */
+
+			list_for_each_entry(mc_entry, &port->mc_list->list,list)
+				num_registrations += 2;
+		}
+
+	if (num_registrations) {
+		arr = kzalloc(num_registrations * sizeof(*arr), GFP_KERNEL);
+		if (!arr)
+			return;  /* Keep the existing array */
+	} else
+		goto out_update;
+
+	list_for_each_entry(adapter, &adapter_list, list) {
+		for (k = 0; k < EHEA_MAX_PORTS; k++) {
+			struct ehea_port *port = adapter->port[k];
+
+			if (!port || (port->state != EHEA_PORT_UP))
+				continue;
+
+			arr[i].adh = adapter->handle;
+			arr[i].port_id = port->logical_port_id;
+			arr[i].reg_type = EHEA_BCMC_BROADCAST |
+					  EHEA_BCMC_UNTAGGED;
+			arr[i++].macaddr = port->mac_addr;
+
+			arr[i].adh = adapter->handle;
+			arr[i].port_id = port->logical_port_id;
+			arr[i].reg_type = EHEA_BCMC_BROADCAST |
+					  EHEA_BCMC_VLANID_ALL;
+			arr[i++].macaddr = port->mac_addr;
+
+			list_for_each_entry(mc_entry,
+					    &port->mc_list->list, list) {
+				arr[i].adh = adapter->handle;
+				arr[i].port_id = port->logical_port_id;
+				arr[i].reg_type = EHEA_BCMC_SCOPE_ALL |
+						  EHEA_BCMC_MULTICAST |
+						  EHEA_BCMC_UNTAGGED;
+				arr[i++].macaddr = mc_entry->macaddr;
+
+				arr[i].adh = adapter->handle;
+				arr[i].port_id = port->logical_port_id;
+				arr[i].reg_type = EHEA_BCMC_SCOPE_ALL |
+						  EHEA_BCMC_MULTICAST |
+						  EHEA_BCMC_VLANID_ALL;
+				arr[i++].macaddr = mc_entry->macaddr;
+			}
+		}
+	}
+
+out_update:
+	kfree(ehea_bcmc_regs.arr);
+	ehea_bcmc_regs.arr = arr;
+	ehea_bcmc_regs.num_entries = i;
+}
+
 static struct net_device_stats *ehea_get_stats(struct net_device *dev)
 {
 	struct ehea_port *port = netdev_priv(dev);
@@ -1595,19 +1752,25 @@ static int ehea_set_mac_addr(struct net_
 
 	memcpy(dev->dev_addr, mac_addr->sa_data, dev->addr_len);
 
+	down(&ehea_bcmc_regs.lock);
+
 	/* Deregister old MAC in pHYP */
 	ret = ehea_broadcast_reg_helper(port, H_DEREG_BCMC);
 	if (ret)
-		goto out_free;
+		goto out_upregs;
 
 	port->mac_addr = cb0->port_mac_addr << 16;
 
 	/* Register new MAC in pHYP */
 	ret = ehea_broadcast_reg_helper(port, H_REG_BCMC);
 	if (ret)
-		goto out_free;
+		goto out_upregs;
 
 	ret = 0;
+
+out_upregs:
+	ehea_update_bcmc_registrations();
+	up(&ehea_bcmc_regs.lock);
 out_free:
 	kfree(cb0);
 out:
@@ -1769,9 +1932,11 @@ static void ehea_set_multicast_list(stru
 	}
 	ehea_promiscuous(dev, 0);
 
+	down(&ehea_bcmc_regs.lock);
+
 	if (dev->flags & IFF_ALLMULTI) {
 		ehea_allmulti(dev, 1);
-		return;
+		goto out;
 	}
 	ehea_allmulti(dev, 0);
 
@@ -1798,6 +1963,8 @@ static void ehea_set_multicast_list(stru
 		}
 	}
 out:
+	ehea_update_bcmc_registrations();
+	up(&ehea_bcmc_regs.lock);
 	return;
 }
 
@@ -2280,6 +2447,8 @@ static int ehea_up(struct net_device *de
 	if (port->state == EHEA_PORT_UP)
 		return 0;
 
+	down(&ehea_fw_handles.lock);
+
 	ret = ehea_port_res_setup(port, port->num_def_qps,
 				  port->num_add_tx_qps);
 	if (ret) {
@@ -2316,8 +2485,17 @@ static int ehea_up(struct net_device *de
 		}
 	}
 
-	ret = 0;
+	down(&ehea_bcmc_regs.lock);
+
+	ret = ehea_broadcast_reg_helper(port, H_REG_BCMC);
+	if (ret) {
+		ret = -EIO;
+		goto out_free_irqs;
+	}
+
 	port->state = EHEA_PORT_UP;
+
+	ret = 0;
 	goto out;
 
 out_free_irqs:
@@ -2329,6 +2507,12 @@ out:
 	if (ret)
 		ehea_info("Failed starting %s. ret=%i", dev->name, ret);
 
+	ehea_update_bcmc_registrations();
+	up(&ehea_bcmc_regs.lock);
+
+	ehea_update_firmware_handles();
+	up(&ehea_fw_handles.lock);
+
 	return ret;
 }
 
@@ -2377,16 +2561,27 @@ static int ehea_down(struct net_device *
 	if (port->state == EHEA_PORT_DOWN)
 		return 0;
 
+	down(&ehea_bcmc_regs.lock);
 	ehea_drop_multicast_list(dev);
+	ehea_broadcast_reg_helper(port, H_DEREG_BCMC);
+
 	ehea_free_interrupts(dev);
 
+	down(&ehea_fw_handles.lock);
+
 	port->state = EHEA_PORT_DOWN;
 
+	ehea_update_bcmc_registrations();
+	up(&ehea_bcmc_regs.lock);
+
 	ret = ehea_clean_all_portres(port);
 	if (ret)
 		ehea_info("Failed freeing resources for %s. ret=%i",
 			  dev->name, ret);
 
+	ehea_update_firmware_handles();
+	up(&ehea_fw_handles.lock);
+
 	return ret;
 }
 
@@ -2952,19 +3147,12 @@ struct ehea_port *ehea_setup_single_port
 	dev->watchdog_timeo = EHEA_WATCH_DOG_TIMEOUT;
 
 	INIT_WORK(&port->reset_task, ehea_reset_port);
-
-	ret = ehea_broadcast_reg_helper(port, H_REG_BCMC);
-	if (ret) {
-		ret = -EIO;
-		goto out_unreg_port;
-	}
-
 	ehea_set_ethtool_ops(dev);
 
 	ret = register_netdev(dev);
 	if (ret) {
 		ehea_error("register_netdev failed. ret=%d", ret);
-		goto out_dereg_bc;
+		goto out_unreg_port;
 	}
 
 	port->lro_max_aggr = lro_max_aggr;
@@ -2981,9 +3169,6 @@ struct ehea_port *ehea_setup_single_port
 
 	return port;
 
-out_dereg_bc:
-	ehea_broadcast_reg_helper(port, H_DEREG_BCMC);
-
 out_unreg_port:
 	ehea_unregister_port(port);
 
@@ -3003,7 +3188,6 @@ static void ehea_shutdown_single_port(st
 {
 	unregister_netdev(port->netdev);
 	ehea_unregister_port(port);
-	ehea_broadcast_reg_helper(port, H_DEREG_BCMC);
 	kfree(port->mc_list);
 	free_netdev(port->netdev);
 	port->adapter->active_ports--;
@@ -3046,7 +3230,6 @@ static int ehea_setup_ports(struct ehea_
 
 		i++;
 	};
-
 	return 0;
 }
 
@@ -3191,6 +3374,7 @@ static int __devinit ehea_probe_adapter(
 		ehea_error("Invalid ibmebus device probed");
 		return -EINVAL;
 	}
+	down(&ehea_fw_handles.lock);
 
 	adapter = kzalloc(sizeof(*adapter), GFP_KERNEL);
 	if (!adapter) {
@@ -3271,7 +3455,10 @@ out_kill_eq:
 
 out_free_ad:
 	kfree(adapter);
+
 out:
+	ehea_update_firmware_handles();
+	up(&ehea_fw_handles.lock);
 	return ret;
 }
 
@@ -3290,18 +3477,41 @@ static int __devexit ehea_remove(struct 
 
 	flush_scheduled_work();
 
+	down(&ehea_fw_handles.lock);
+
 	ibmebus_free_irq(adapter->neq->attr.ist1, adapter);
 	tasklet_kill(&adapter->neq_tasklet);
 
 	ehea_destroy_eq(adapter->neq);
 	ehea_remove_adapter_mr(adapter);
 	list_del(&adapter->list);
-
 	kfree(adapter);
 
+	ehea_update_firmware_handles();
+	up(&ehea_fw_handles.lock);
+
 	return 0;
 }
 
+void ehea_crash_handler(void)
+{
+	int i;
+
+	if (ehea_fw_handles.arr)
+		for (i = 0; i < ehea_fw_handles.num_entries; i++)
+			ehea_h_free_resource(ehea_fw_handles.arr[i].adh,
+					     ehea_fw_handles.arr[i].fwh,
+					     FORCE_FREE);
+
+	if (ehea_bcmc_regs.arr)
+		for (i = 0; i < ehea_bcmc_regs.num_entries; i++)
+			ehea_h_reg_dereg_bcmc(ehea_bcmc_regs.arr[i].adh,
+					      ehea_bcmc_regs.arr[i].port_id,
+					      ehea_bcmc_regs.arr[i].reg_type,
+					      ehea_bcmc_regs.arr[i].macaddr,
+					      0, H_DEREG_BCMC);
+}
+
 static int ehea_reboot_notifier(struct notifier_block *nb,
 				unsigned long action, void *unused)
 {
@@ -3362,7 +3572,12 @@ int __init ehea_module_init(void)
 
 
 	INIT_WORK(&ehea_rereg_mr_task, ehea_rereg_mrs);
+	memset(&ehea_fw_handles, 0, sizeof(ehea_fw_handles));
+	memset(&ehea_bcmc_regs, 0, sizeof(ehea_bcmc_regs));
+
 	sema_init(&dlpar_mem_lock, 1);
+	sema_init(&ehea_fw_handles.lock, 1);
+	sema_init(&ehea_bcmc_regs.lock, 1);
 
 	ret = check_module_parm();
 	if (ret)
@@ -3373,6 +3588,9 @@ int __init ehea_module_init(void)
 		goto out;
 
 	register_reboot_notifier(&ehea_reboot_nb);
+	ret = crash_shutdown_register(&ehea_crash_handler);
+	if (ret)
+		ehea_info("failed registering crash handler");
 
 	ret = ibmebus_register_driver(&ehea_driver);
 	if (ret) {
@@ -3386,6 +3604,7 @@ int __init ehea_module_init(void)
 		ehea_error("failed to register capabilities attribute, ret=%d",
 			   ret);
 		unregister_reboot_notifier(&ehea_reboot_nb);
+		crash_shutdown_unregister(&ehea_crash_handler);
 		ibmebus_unregister_driver(&ehea_driver);
 		goto out;
 	}
@@ -3396,10 +3615,17 @@ out:
 
 static void __exit ehea_module_exit(void)
 {
+	int ret;
+
 	flush_scheduled_work();
 	driver_remove_file(&ehea_driver.driver, &driver_attr_capabilities);
 	ibmebus_unregister_driver(&ehea_driver);
 	unregister_reboot_notifier(&ehea_reboot_nb);
+	ret = crash_shutdown_unregister(&ehea_crash_handler);
+	if (ret)
+		ehea_info("failed unregistering crash handler");
+	kfree(ehea_fw_handles.arr);
+	kfree(ehea_bcmc_regs.arr);
 	ehea_destroy_busmap();
 }

^ permalink raw reply

* Re: [1/4] DST: Distributed storage documentation.
From: Kay Sievers @ 2007-12-17 16:27 UTC (permalink / raw)
  To: Evgeniy Polyakov; +Cc: lkml, netdev, linux-fsdevel
In-Reply-To: <11979038192980@2ka.mipt.ru>

On Dec 17, 2007 4:03 PM, Evgeniy Polyakov <johnpol@2ka.mipt.ru> wrote:

> +++ b/Documentation/dst/sysfs.txt
> @@ -0,0 +1,33 @@
> +This file describes sysfs files created for each storage.
> +
> +1. Per-storage files.
> +Each storage has its own dir /sysfs/devices/$storage_name,

> +2. Per-node files.
> +Node's files are located in /sysfs/devices/$storage_name/n-$start-$cookie

As already pointed out last time, you can't reference /sys/devices/ directly,
please use the path from the bus/class directory which points there.

Thanks,
Kay

^ permalink raw reply

* Re: [PATCH 1/1] IPN: Inter Process Networking
From: Paul E. McKenney @ 2007-12-17 15:47 UTC (permalink / raw)
  To: Renzo Davoli; +Cc: netdev, linux-kernel, garden
In-Reply-To: <20071217092747.GD4356@cs.unibo.it>

On Mon, Dec 17, 2007 at 10:27:47AM +0100, Renzo Davoli wrote:
> Inter Process Networking Patch.
> 
> It applies to 2.6.24-rc5, include documentation, the new kernel option
> (experimental), kernel include file include/net/af_ipn.h and the
> protocol directory net/ipn.

Some RCU-related questions interspersed below.  Summary:

o	It is not clear to me that the updates (rcu_assign_pointer())
	are consistently locked.

o	I don't see any sign of RCU read-side primitives.

That said, I cannot claim much expertise on this area of the kernel,
so am very likely missing something.

						Thanx, Paul

> renzo
> 
> Signed-off-by: Renzo Davoli <renzo@cs.unibo.it>
> 
> diff -Naur linux-2.6.24-rc5/Documentation/networking/ipn.txt linux-2.6.24-rc5-ipn/Documentation/networking/ipn.txt
> --- linux-2.6.24-rc5/Documentation/networking/ipn.txt	1970-01-01 01:00:00.000000000 +0100
> +++ linux-2.6.24-rc5-ipn/Documentation/networking/ipn.txt	2007-12-16 16:30:01.000000000 +0100
> @@ -0,0 +1,326 @@
> +Inter Process Networking (IPN)
> +
> +IPN is an Inter Process Communication service. It uses the same programming
> +interface and protocols used for networking. Processes using IPN are connected
> +to a "network" (many to many communication). The messages or packets sent by a
> +process on an IPN network can be delivered to many other processes connected to
> +the same IPN network, potentially to all the other processes. Different
> +protocols can be defined on the IPN service. The basic one is the broadcast
> +(level 1) protocol: all the packets get received by all the processes but the
> +sender. It is also possible to define more sophisticated protocols. For example
> +it is possible to have IPN sockets dipatching packets using the Ethernet
> +protocol (like a Virtual Distributed Ethernet - VDE switch), or Internet
> +Protocol (like a layer 3 switch). These are just examples, several other
> +policies can be defined.  
> +
> +Description:
> +------------
> +
> +The Berkeley socket Application Programming Interface (API) was designed for
> +client server applications and for point-to-point communications. There is not
> +a support for broadcasting/multicasting domains.
> +
> +IPN updates the interface by introducing a new protocol family (PF_IPN or
> +AF_IPN). PF_IPN is similar to PF_UNIX but for IPN the Socket API calls have a
> +different (extended) behavior.
> +
> +   #include <sys/socket.h>
> +   #include <sys/un.h>
> +   #include <sys/ipn.h>
> +
> +   sockfd = socket(AF_IPN, int socket_type, int protocol);
> +
> +creates a communication socket. The only socket_type defined is SOCK_RAW, other
> +socket_types can be used for future extensions. A socket cannot be used to send
> +or receive data until it gets connected (using the "connect" call). The
> +protocol argument defines the policy used by the socket. Protocol IPN_BROADCAST
> +(1) is the basic policy: a packet is sent to all the receipients but the sender
> +itself. The policy IPN_ANY (0) can be used to connect or bind a pre-existing
> +IPN network regardless of the policy used. (2 will be IPN_VDESWITCH and 3
> +IPN_VDESWITCHL3).
> +
> +The address format is the same of PF_UNIX (a.k.a PF_LOCAL), see unix(7) manual.
> +
> +   int bind(int sockfd, const struct sockaddr *my_addr, socklen_t addrlen);
> +
> +This call creates an IPN network if it does not exist, or join an existing
> +network (just for management) if it already exists. The policy of the network
> +must be consistent with the protocol argument of the "socket" call. A new
> +network has the policy defined for the socket. "bind" or "connect" operations
> +on existing networks fail if the policy of the socket is neither IPN_ANY nor
> +the same of the network. (A network should not be created by a IPN_ANY socket).
> +An IPN network appears in the file system as a unix socket. The execution
> +permission (x) on this file is required for "bind' to succeed (otherwise -EPERM
> +is returned). Similarly the read/write permissions (rw) permits the "connect"
> +operation for reading (receiving) or writing (sending) packets respectively.
> +When a socket is bound (but not connected) to a IPN network the process does
> +not receive or send any data but it can call "ioctl" or "setsockopt" to
> +configure the network.
> +
> +  int connect(int sockfd, const struct sockaddr *serv_addr, socklen_t addrlen);
> +
> +This call connects a socket to an existing IPN network. The socket can be
> +already bound (through the "bind" call) or unbound. Unbound connected sockets
> +receive and send data but they cannot configure the network. The read or write
> +permission on the socket (rw) is required to "connect" the channel and
> +read/write respectively. When "connect" succeeds and provided the socket has
> +appropriate permissions, the process can sends packets and receives all the
> +packets sent by other processes and delivered to it by the network policy. The
> +socket can receive data at any time (like a network interface) so the process
> +must be able to handle incoming data (using select/poll or multithreading).
> +Obviously higher lever protocols can also prevent the reception of unexpected
> +messages by design. It is the case of networks used with with exactly one
> +sender, all the other processes can simply receive the data and the sender will
> +never receive any packet. It is also possible to have sockets with different
> +roles assigning reading permission to some and writing permissions to others.
> +If data overrun occurs there can be data loss or the sender can be blocked
> +depending on the policy of the socket (LOSSY or LOSSLESS, see over). Bind must
> +be called before connect. The correct sequences are: socket+bind: just for
> +management, socket+bind+connect: management and communication. socket+connect:
> +communication without management).
> +
> +The calls "accept" and "listen" are not defined for AF_IPN, as there is not any
> +server. All the communication takes place among peers.
> +
> +Data can be sent and received using read, write, send, recv, sendto, recvfrom, sendmsg, recvmsg.
> +
> +Socket options and flags.
> +-------------------------
> +
> +These options can be set by getsockopt and setsockopt.
> +
> +There are two different kinds of options: network options and node options. The
> +formers define the structure of the network and must be set prior to bind. It
> +is not currently possible to change this flag of an existing network. When a
> +socket is bound and/or connected to an existing network getsockopt gives the
> +current value of the options. Node options define parameters of the node. These
> +must be set prior to connect.  
> +
> +***Network Options (These options can be set prior to bind/connec
> +
> +IPN_SO_FLAGS: This tag permits to set/get the network flags.
> +
> +IPN_FLAG_LOSSLESS: this flag defines the behavior in case of network
> +overloading or data overrun, i.e. when some process are too slow in consuming
> +the packets for the network buffers. When the network is LOSSY (the flag is
> +cleared) packets get dropped in case of buffer overflow. A LOSSLESS (flag set)
> +IPN network blocks the sender if the buffer is full. LOSSY is the default
> +behavior. 
> +
> +IPN_SO_NUMNODES: max number of connected sockets (default value 32)
> +
> +IPN_SO_MTU: maximum transfer unit: maximum size of packets (default value 1514,
> +Ethernet frame, including VLAN).
> +
> +IPN_SO_MSGPOOLSIZE: size of the buffer (#of pending packets, default value 8).
> +This option has two different meanings depending on the LOSSY/LOSSLESS behavior
> +of the network. For LOSSY networks, this is the maximum number of pending
> +packets of each node. For LOSSLESS network this is the global number of the
> +pending packets in the network. When the same packet is sent to many
> +destinations it is counted just once.
> +
> +IPN_SO_MODE: this option specifies the permission to use when the socket gets
> +created on the file system. It is modified by the process' umask in the usual
> +way. The created socket permission are (mode & ~umask).  
> +
> +***Network Options (Options for bound/connected sockets)
> +
> +IPN_SO_CHANGE_NUMNODES: (runtime) change of the number of ipn network ports. 
> +
> +***Node Options
> +
> +IPN_SO_PORT: (default value IPN_PORTNO_ANY) This option specify the port number
> +where the socket must be connected. When IPN_PORTNO_ANY the port number is
> +decided by the service. There can be network services where different ports
> +have different definitions (e.g. different VLANs for ports of virtual Ethernet
> +switches).
> +
> +IPN_SO_DESCR: This is the description of the node. It is a string, having
> +maxlength IPN_DESCRLEN. It is just used by debugging tools.  
> +
> +IPN_SO_HANDLE_OOB: The node is able to manage Out Of Band protocol messages
> +
> +IPN	_SO_WANT_OOB_NUMNODES: The socket wants OOB messages to notify the change
> +of #writers #readers (requires IPN_SO_HANDLE_OOB) 
> +
> +TAP and GRAB nodes for IPN networks
> +-----------------------------------
> +
> +It is possible to connect IPN sockets to virtual and real network interfaces
> +using specific ioctl and provided the user has the permission to configure the
> +network (e.g. the CAP_NET_ADMIN Posix capability). A virtual interface
> +connected to an IPN network is similar to a tap interface (provided by the
> +tuntap module). A tap interface appears as an ethernet interface to the hosting
> +operating system, all the packets sent and received through the tap interface
> +get received and sent by the application which created the tap interface. IPN
> +virtual network interface appears in the same way but the packets are received
> +and sent through the IPN network and delivered consistently with the policy
> +(BROADCAST acts as a basic HUB for the connected processes). It is also
> +possible to *grab* a real interface. In this case the closest example is the
> +Linux kernel ethernet bridge. When a real interface is connected to a IPN all
> +the packets received from the real network are injected also into the IPN and
> +all the packets sent by the IPN through the real network 'port' get sent on the
> +real network.
> +
> +ioctl is used for creation or control of TAP or GRAB interfaces.
> +
> +    int ioctl(int d, int request, .../* arg */);
> +
> +A list of the request values currently supported follows.
> +
> +IPN_CONN_NETDEV: (struct ifreq *arg). This call creates a TAP interface or
> +implements a GRAB on an existing interface and connects it to a bound IPN
> +socket. The field ifr_flags can be IPN_NODEFLAG_TAP for a TAP interface,
> +IPN_NODEFLAG_GRAB to grab an existing interface. The field ifr_name is the
> +desired name for the new TAP interface or is the name of the interface to grab
> +(e.g. eth0). For TAP interfaces, ifr_name can be an empty string. The interface
> +in this latter case is named ipn followed by a number (e.g. ipn0, ipn1, ...).
> +This ioctl must be used on a bound but unconnected socket. When the call
> +succeeds, the socket gets the connected status, but the packets are sent and
> +received through the interface. Persistence apply only to interface nodes (TAP
> +or GRAB). 
> +
> +IPN_SETPERSIST (int arg). If (arg != 0) it gives the interface the persistent
> +status: the network interface survives and stay connected to the IPN network
> +when the socket is closed. When (arg == 0) the standard behavior is resumed:
> +the interface is deleted or the grabbing is terminated when the socket is
> +closed. 
> +
> +IPN_JOIN_NETDEV: (struct ifreq *arg). This call reconnects a socket to an
> +existing persistent node. The interface can be defined either by name
> +(ifr_name) or by index (ifr_index). If there is already a socket controlling
> +the interface this call fails (EADDRNOTAVAIL). 
> +
> +There are also some ioctl that can be used by a sysadm to give/clear
> +persistence on existing IPN interfaces. These calls apply to unbound sockets.
> +
> +IPN_SETPERSIST_NETDEV: (struct ifreq *arg). This call sets the persistence
> +status of an IPN interface. The interface can be defined either by name
> +(ifr_name) or by index (ifr_index). 
> +
> +IPN_CLRPERSIST_NETDEV: (struct ifreq *arg). This call clears the persistence
> +status of an IPN interface. The interface is specified as in the opposite call
> +above. The interface is deleted (TAP) or the grabbing is terminated when the
> +socket is closed, or immediately if the interface is not controlled by a
> +socket. If the IPN network had the interface as its sole node, the IPN network
> +is terminated, too. 
> +
> +When unloading the ipn kernel module, all the persistent flags of interfaces
> +are cleared.  
> +
> +Related Work.
> +-------------
> +
> +IPN is able to give a unifying solution to several problems and creates new
> +opportunities for applications. 
> +
> +Several existing tools can be implemented using IPN sockets:
> +
> +    * VDE. Level 2 service implements a VDE switch in the kernel, providing a
> +    considerable speedup.  
> +    * Tap (tuntap) networking for virtual machines
> +    * Kernel ethernet bridge
> +    * All the applications which need multicasting of data streams, like tee 
> +
> +A continuous stream of data (like audio/video/midi etc) can be sent on an IPN
> +network and several application can receive the broadcast just by joining the
> +channel.
> +
> +It is possible to write programs that forward packets between different IPN
> +networks running on the same or on different systems extending the IPN in the
> +same way as cables extend ethernet networks connecting switches or hubs
> +together. (VDE cables are examples of such a kind of programs).
> +
> +IPN interface to protocol modules
> +---------------------------------
> +
> +struct ipn_protocol {
> +  int refcnt;
> +  int (*ipn_p_newport)(struct ipn_node *newport);
> +  int (*ipn_p_handlemsg)(struct ipn_node *from,struct msgpool_item *msgitem, int depth);
> +  void (*ipn_p_delport)(struct ipn_node *oldport);
> +  void (*ipn_p_postnewport)(struct ipn_node *newport);
> +  void (*ipn_p_predelport)(struct ipn_node *oldport);
> +  int (*ipn_p_newnet)(struct ipn_network *newnet);
> +	int (*ipn_p_resizenet)(struct ipn_network *net,int oldsize,int newsize);
> +  void (*ipn_p_delnet)(struct ipn_network *oldnet);
> +  int (*ipn_p_setsockopt)(struct ipn_node *port,int optname,
> +      char __user *optval, int optlen);
> +  int (*ipn_p_getsockopt)(struct ipn_node *port,int optname,
> +      char __user *optval, int *optlen);
> +  int (*ipn_p_ioctl)(struct ipn_node *port,unsigned int request,
> +      unsigned long arg);
> +};
> +
> +int ipn_proto_register(int protocol,struct ipn_protocol *ipn_service);
> +int ipn_proto_deregister(int protocol);
> +
> +void ipn_proto_sendmsg(struct ipn_node *to, struct msgpool_item *msg, int depth);
> +
> +
> +A protocol (sub) module must define its own ipn_protocol structure (maybe a
> +global static variable).
> +
> +ipn_proto_register must be called in the module init to register the protocol
> +to the IPN core module. ipn_proto_deregister must be called in the destructor
> +of the module. It fails if there are already running networks based on this
> +protocol.
> +
> +Only two fields must be initialized in any case: ipn_p_newport and
> +ipn_p_handlemsg.
> +
> +ipn_p_newport is the new network node notification. The return value is the
> +port number of the new node. This call can be used to allocate and set private
> +data used by the protocol (the field proto_private of the struct ipn_node has
> +been defined for this purpose).
> +
> +ipn_p_handlemsg is the notification of a message that must be dispatched. This
> +function should call ipn_proto_sendmsg for each recipient. It is possible for
> +the protocol to change the message (provided the global length of the packet
> +does not exceed the MTU of the network). Depth is for loop control. Two IPN can
> +be interconnected by kernel cables (not implemented yet). Cycles of cables
> +would generate infinite loops of packets. After a pre-defined number of hops
> +the packet gets dropped (it is like EMLINK for symbolic links). Depth value
> +must be copied to all ipn_proto_sendmsg calls. Usually the handlemsg function
> +has the following structure:
> +
> +static int ipn_xxxxx_handlemsg(struct ipn_node *from, struct msgpool_item *msgitem, int depth)
> +{
> + /* compute the set of receipients */
> + for (/*each receipient "to"*/)
> +   ipn_proto_sendmsg(to,msgitem,depth);
> +}
> +
> +It is also possible to send different packets to different recipients.
> +
> +struct msgpool_item *newitem=ipn_msgpool_alloc(from->ipn);
> +/* create a new contents for the packet by filling in newitem->len and newitem->data */
> +ipn_proto_sendmsg(recipient1,newitem,depth);
> +ipn_proto_sendmsg(recipient2,newitem,depth);
> +....
> +ipn_msgpool_put(newitem);
> +
> +(please remember to call ipn_msgpool_put after the sendmsg of packets allocated
> +by the protocol submodule).
> +
> +ipn_p_delport is used to deallocate port related data structures.
> +
> +ipn_p_postnewport and ipn_p_predelport are used to notify new nodes or deleted
> +nodes. newport and delport get called before activating the port and after
> +disactivating it respectively, therefore it is not possible to use the new port
> +or deleted port to signal the change on the net itself. ipn_p_postnewport and
> +ipn_p_predelport get called just after the activation and just before the
> +deactivation thus the protocols can already send packets on the network.
> +
> +ipn_p_newnet and ipn_p_delnet notify the creation/deletion of a IPN network
> +using the given protocol.
> +
> +ipn_p_resizenet notifies a number of ports change
> +
> +ipn_p_setsockopt and ipn_p_getsockopt can be used to provide specific socket
> +options.
> +
> +ipn_p_ioctl protocols can implement also specific ioctl services. 
> +
> +Further documentation and examples can be found in the Virtual Square project
> +web site: wiki.virtualsquare.org 
> diff -Naur linux-2.6.24-rc5/MAINTAINERS linux-2.6.24-rc5-ipn/MAINTAINERS
> --- linux-2.6.24-rc5/MAINTAINERS	2007-12-11 04:48:43.000000000 +0100
> +++ linux-2.6.24-rc5-ipn/MAINTAINERS	2007-12-16 16:30:01.000000000 +0100
> @@ -2094,6 +2094,15 @@
>  W:	http://openipmi.sourceforge.net/
>  S:	Supported
> 
> +IPN INTER PROCESS NETWORKING
> +P:	Renzo Davoli
> +M:	renzo@cs.unibo.it
> +P:	Ludovico Gardenghi
> +M:	garden@cs.unibo.it
> +L:	netdev@vger.kernel.org
> +W:	http://wiki.virtualsquare.org
> +S:	Maintained
> +
>  IPX NETWORK LAYER
>  P:	Arnaldo Carvalho de Melo
>  M:	acme@ghostprotocols.net
> diff -Naur linux-2.6.24-rc5/include/linux/net.h linux-2.6.24-rc5-ipn/include/linux/net.h
> --- linux-2.6.24-rc5/include/linux/net.h	2007-12-11 04:48:43.000000000 +0100
> +++ linux-2.6.24-rc5-ipn/include/linux/net.h	2007-12-16 16:30:03.000000000 +0100
> @@ -25,7 +25,7 @@
>  struct inode;
>  struct net;
> 
> -#define NPROTO		34		/* should be enough for now..	*/
> +#define NPROTO		35		/* should be enough for now..	*/
> 
>  #define SYS_SOCKET	1		/* sys_socket(2)		*/
>  #define SYS_BIND	2		/* sys_bind(2)			*/
> diff -Naur linux-2.6.24-rc5/include/linux/netdevice.h linux-2.6.24-rc5-ipn/include/linux/netdevice.h
> --- linux-2.6.24-rc5/include/linux/netdevice.h	2007-12-11 04:48:43.000000000 +0100
> +++ linux-2.6.24-rc5-ipn/include/linux/netdevice.h	2007-12-16 16:30:03.000000000 +0100
> @@ -705,6 +705,8 @@
>  	struct net_bridge_port	*br_port;
>  	/* macvlan */
>  	struct macvlan_port	*macvlan_port;
> +	/* ipn */
> +	struct ipn_node		*ipn_port;
> 
>  	/* class/net/name entry */
>  	struct device		dev;
> diff -Naur linux-2.6.24-rc5/include/linux/socket.h linux-2.6.24-rc5-ipn/include/linux/socket.h
> --- linux-2.6.24-rc5/include/linux/socket.h	2007-12-11 04:48:43.000000000 +0100
> +++ linux-2.6.24-rc5-ipn/include/linux/socket.h	2007-12-16 16:30:03.000000000 +0100
> @@ -189,7 +189,8 @@
>  #define AF_BLUETOOTH	31	/* Bluetooth sockets 		*/
>  #define AF_IUCV		32	/* IUCV sockets			*/
>  #define AF_RXRPC	33	/* RxRPC sockets 		*/
> -#define AF_MAX		34	/* For now.. */
> +#define AF_IPN		34	/* IPN sockets  		*/
> +#define AF_MAX		35	/* For now.. */
> 
>  /* Protocol families, same as address families. */
>  #define PF_UNSPEC	AF_UNSPEC
> @@ -224,6 +225,7 @@
>  #define PF_BLUETOOTH	AF_BLUETOOTH
>  #define PF_IUCV		AF_IUCV
>  #define PF_RXRPC	AF_RXRPC
> +#define PF_IPN		AF_IPN
>  #define PF_MAX		AF_MAX
> 
>  /* Maximum queue length specifiable by listen.  */
> diff -Naur linux-2.6.24-rc5/include/net/af_ipn.h linux-2.6.24-rc5-ipn/include/net/af_ipn.h
> --- linux-2.6.24-rc5/include/net/af_ipn.h	1970-01-01 01:00:00.000000000 +0100
> +++ linux-2.6.24-rc5-ipn/include/net/af_ipn.h	2007-12-16 16:30:03.000000000 +0100
> @@ -0,0 +1,233 @@
> +#ifndef __LINUX_NET_AFIPN_H
> +#define __LINUX_NET_AFIPN_H
> +
> +#define IPN_ANY 0
> +#define IPN_BROADCAST 1
> +#define IPN_HUB 1
> +#define IPN_VDESWITCH 2
> +#define IPN_VDESWITCH_L3 3
> +
> +#define IPN_SO_PREBIND 0x80
> +#define IPN_SO_PORT 0
> +#define IPN_SO_DESCR 1
> +#define IPN_SO_CHANGE_NUMNODES 2
> +#define IPN_SO_HANDLE_OOB 3
> +#define IPN_SO_WANT_OOB_NUMNODES 4
> +#define IPN_SO_MTU (IPN_SO_PREBIND | 0)
> +#define IPN_SO_NUMNODES (IPN_SO_PREBIND | 1)
> +#define IPN_SO_MSGPOOLSIZE (IPN_SO_PREBIND | 2)
> +#define IPN_SO_FLAGS (IPN_SO_PREBIND | 3)
> +#define IPN_SO_MODE (IPN_SO_PREBIND | 4)
> +
> +#define IPN_PORTNO_ANY -1
> +
> +#define IPN_DESCRLEN 128
> +
> +#define IPN_FLAG_LOSSLESS 1
> +#define IPN_FLAG_TERMINATED 0x1000
> +
> +/* Ioctl defines */
> +#define IPN_SETPERSIST_NETDEV  	_IOW('I', 200, int) 
> +#define IPN_CLRPERSIST_NETDEV  	_IOW('I', 201, int) 
> +#define IPN_CONN_NETDEV          _IOW('I', 202, int) 
> +#define IPN_JOIN_NETDEV          _IOW('I', 203, int) 
> +#define IPN_SETPERSIST           _IOW('I', 204, int) 
> +
> +#define IPN_OOB_NUMNODE_TAG	0
> +
> +/* OOB message for change of numnodes
> + * Common fields for oob IPN signaling:
> + * @level=level of the service who generated the oob
> + * @tag=tag of the message
> + * Specific fields:
> + * @numreaders=number of readers
> + * @numwriters=number of writers
> + * */
> +struct numnode_oob {
> +	int level;
> +	int tag;
> +	int numreaders;
> +	int numwriters;
> +};
> +
> +#ifdef __KERNEL__
> +#include <linux/socket.h>
> +#include <linux/mutex.h>
> +#include <linux/un.h>
> +#include <net/sock.h>
> +#include <linux/netdevice.h>
> +
> +#define IPN_HASH_SIZE	256
> +
> +/* The AF_IPN socket */
> +struct msgpool_item;
> +struct ipn_network;
> +struct pre_bind_parms;
> +
> +/* 
> + * ipn_node
> + *
> + * @nodelist=pointers for connectqueue or unconnectqueue (see network)
> + * @protocol=kind of service 0->standard broadcast
> + * @flags= see IPN_NODEFLAG_xxx
> + * @shutdown= SEND_SHUTDOWN/RCV_SHUTDOWN and OOBRCV_SHUTDOWN
> + * @descr=description of this port
> + * @portno=when connected: port of the netowrk (<0 means unconnected)
> + * @msglock=mutex on the msg queue
> + * @totmsgcount=total # of pending msgs
> + * @oobmsgcount=# of pending oob msgs
> + * @msgqueue=queue of messages
> + * @oobmsgqueue=queue of messages
> + * @read_wait=waitqueue for reading
> + * @net=current network
> + * @dev=device (TAP or GRAB)
> + * @ipn=network we are connected to
> + * @pbp=temporary storage for parms that must be set prior to bind
> + * @proto_private=handle for protocol private data
> + */
> +struct ipn_node {
> +	struct list_head nodelist;
> +	int protocol;
> +	volatile unsigned char flags; 
> +	unsigned char shutdown;
> +	char descr[IPN_DESCRLEN];
> +	int portno;
> +	spinlock_t msglock;
> +	unsigned short totmsgcount;
> +	unsigned short oobmsgcount;
> +	struct list_head msgqueue;
> +	struct list_head oobmsgqueue;
> +	wait_queue_head_t read_wait;
> +	struct net *net;
> +	struct net_device *dev;
> +	struct ipn_network *ipn;
> +	struct pre_bind_parms *pbp;
> +	void *proto_private;
> +};
> +#define IPN_NODEFLAG_BOUND 0x1     /* bind succeeded */
> +#define IPN_NODEFLAG_INUSE 0x2     /* is currently "used" (0 for persistent, unbound interfaces) */
> +#define IPN_NODEFLAG_PERSIST 0x4   /* if persist does not disappear on close (net interfaces) */
> +#define IPN_NODEFLAG_TAP   0x10    /* This is a tap interface */
> +#define IPN_NODEFLAG_GRAB  0x20    /* This is a grab of a real interface */
> +#define IPN_NODEFLAG_DEVMASK 0x30  /* True if this is a device */
> +#define IPN_NODEFLAG_OOB_NUMNODES 0x40  /* Node wants OOB for NNODES */
> +
> +/*
> + * ipn_sock
> + * 
> + * unfortunately we must use a struct sock (most of the fields are useless) as
> + * this is the standard "agnostic" structure for socket implementation.
> + * This proofs that it is not "agnostic" enough!
> + */
> +
> +struct ipn_sock {
> +	struct sock sk;
> +	struct ipn_node *node;
> +};
> +
> +/* 
> + * ipn_network network descriptor
> + *
> + * @hnode=hash to find this entry (looking for i-node)
> + * @unconnectqueue=queue of unconnected (bound) nodes
> + * @connectqueue=queue of connected nodes (faster for broadcasting)
> + * @refcnt=reference count (bound or connected sockets)
> + * @dentry/@mnt=to keep the file system descriptor into memory
> + * @ipnn_lock=lock for protocol functions
> + * @protocol=kind of service
> + * @flags=flags (IPN_FLAG_LOSSLESS)
> + * @maxports=number of ports available in this network
> + * @msgpool_nelem=number of pending messages
> + * @msgpool_size=max number of pending messages *per net* when IPN_FLAG_LOSSLESS
> + * @msgpool_size=max number of pending messages *per port*when LOSSY
> + * @mtu=MTU
> + * @send_wait=wait queue waiting for a message in the msgpool (IPN_FLAG_LOSSLESS)
> + * @msgpool_cache=slab for msgpool (unused yet)
> + * @proto_private=handle for protocol private data
> + * @connports=array of connected sockets
> + */
> +struct ipn_network {
> +	struct hlist_node hnode;
> +	struct list_head unconnectqueue;
> +	struct list_head connectqueue;
> +	atomic_t refcnt;
> +	struct dentry		*dentry;
> +  struct vfsmount		*mnt;
> +	struct semaphore ipnn_mutex;
> +	int sunaddr_len;
> +	struct sockaddr_un sunaddr;
> +	unsigned int protocol;
> +	unsigned int flags;
> +	int numreaders;
> +	int numwriters;
> +	atomic_t msgpool_nelem;
> +	unsigned short maxports;
> +	unsigned short msgpool_size;
> +	unsigned short mtu;
> +	wait_queue_head_t send_wait;
> +	struct kmem_cache *msgpool_cache;
> +	void *proto_private;
> +	struct ipn_node **connport;
> +};
> +
> +/* struct msgpool_item 
> + * the local copy of the message for dispatching
> + * @count refcount
> + * @len packet len
> + * @data payload
> + */
> +struct msgpool_item {
> +	atomic_t count;
> +	int len;
> +	unsigned char data[0];
> +};
> +
> +struct msgpool_item *ipn_msgpool_alloc(struct ipn_network *ipnn);
> +void ipn_msgpool_put(struct msgpool_item *old, struct ipn_network *ipnn);
> +
> +/* 
> + * protocol service:
> + *
> + * @refcnt: number of networks using this protocol
> + * @newport=upcall for reporting a new port. returns the portno, -1=error  
> + * @handlemsg=dispatch a message.
> + *            should call ipn_proto_sendmsg for each desctination
> + *            can allocate other msgitems using ipn_msgpool_alloc to send
> + *            different messages to different destinations;
> + * @delport=(may be null) reports the terminatio of a port
> + * @postnewport,@predelport: similar to newport/delport but during these calls
> + *            the node is (still) connected. Useful when protocols need
> + *            welcome and goodbye messages.
> + * @ipn_p_setsockopt
> + * @ipn_p_getsockopt
> + * @ipn_p_ioctl=(may be null) upcall to manage specific options or ctls.
> + */
> +struct ipn_protocol {
> +	int refcnt;
> +	int (*ipn_p_newport)(struct ipn_node *newport);
> +	int (*ipn_p_handlemsg)(struct ipn_node *from,struct msgpool_item *msgitem);
> +	void (*ipn_p_delport)(struct ipn_node *oldport);
> +	void (*ipn_p_postnewport)(struct ipn_node *newport);
> +	void (*ipn_p_predelport)(struct ipn_node *oldport);
> +	int (*ipn_p_newnet)(struct ipn_network *newnet);
> +	int (*ipn_p_resizenet)(struct ipn_network *net,int oldsize,int newsize);
> +	void (*ipn_p_delnet)(struct ipn_network *oldnet);
> +	int (*ipn_p_setsockopt)(struct ipn_node *port,int optname,
> +			char __user *optval, int optlen);
> +	int (*ipn_p_getsockopt)(struct ipn_node *port,int optname,
> +			char __user *optval, int *optlen);
> +	int (*ipn_p_ioctl)(struct ipn_node *port,unsigned int request, 
> +			unsigned long arg);
> +};
> +
> +int ipn_proto_register(int protocol,struct ipn_protocol *ipn_service);
> +int ipn_proto_deregister(int protocol);
> +
> +int ipn_proto_injectmsg(struct ipn_node *from, struct msgpool_item *msg);
> +void ipn_proto_sendmsg(struct ipn_node *to, struct msgpool_item *msg);
> +void ipn_proto_oobsendmsg(struct ipn_node *to, struct msgpool_item *msg);
> +
> +extern struct sk_buff *(*ipn_handle_frame_hook)(struct ipn_node *p,
> +						struct sk_buff *skb);
> +#endif
> +#endif
> diff -Naur linux-2.6.24-rc5/net/Kconfig linux-2.6.24-rc5-ipn/net/Kconfig
> --- linux-2.6.24-rc5/net/Kconfig	2007-12-11 04:48:43.000000000 +0100
> +++ linux-2.6.24-rc5-ipn/net/Kconfig	2007-12-16 16:30:04.000000000 +0100
> @@ -37,6 +37,7 @@
> 
>  source "net/packet/Kconfig"
>  source "net/unix/Kconfig"
> +source "net/ipn/Kconfig"
>  source "net/xfrm/Kconfig"
>  source "net/iucv/Kconfig"
> 
> diff -Naur linux-2.6.24-rc5/net/Makefile linux-2.6.24-rc5-ipn/net/Makefile
> --- linux-2.6.24-rc5/net/Makefile	2007-12-11 04:48:43.000000000 +0100
> +++ linux-2.6.24-rc5-ipn/net/Makefile	2007-12-16 16:30:04.000000000 +0100
> @@ -19,6 +19,7 @@
>  obj-$(CONFIG_INET)		+= ipv4/
>  obj-$(CONFIG_XFRM)		+= xfrm/
>  obj-$(CONFIG_UNIX)		+= unix/
> +obj-$(CONFIG_IPN)		+= ipn/
>  ifneq ($(CONFIG_IPV6),)
>  obj-y				+= ipv6/
>  endif
> diff -Naur linux-2.6.24-rc5/net/core/dev.c linux-2.6.24-rc5-ipn/net/core/dev.c
> --- linux-2.6.24-rc5/net/core/dev.c	2007-12-11 04:48:43.000000000 +0100
> +++ linux-2.6.24-rc5-ipn/net/core/dev.c	2007-12-16 16:30:04.000000000 +0100
> @@ -1925,7 +1925,7 @@
>  					     int *ret,
>  					     struct net_device *orig_dev)
>  {
> -	if (skb->dev->macvlan_port == NULL)
> +	if (!skb || skb->dev->macvlan_port == NULL)
>  		return skb;
> 
>  	if (*pt_prev) {
> @@ -1938,6 +1938,32 @@
>  #define handle_macvlan(skb, pt_prev, ret, orig_dev)	(skb)
>  #endif
> 
> +#if defined(CONFIG_IPN) || defined(CONFIG_IPN_MODULE)
> +struct sk_buff *(*ipn_handle_frame_hook)(struct ipn_node *port,
> +					struct sk_buff *skb) __read_mostly;
> +EXPORT_SYMBOL_GPL(ipn_handle_frame_hook);
> +
> +static inline struct sk_buff *handle_ipn(struct sk_buff *skb,
> +					     struct packet_type **pt_prev,
> +					     int *ret,
> +					     struct net_device *orig_dev)
> +{
> +	 struct ipn_node *port;
> +
> +	 if (!skb || skb->pkt_type == PACKET_LOOPBACK ||
> +			 (port = rcu_dereference(skb->dev->ipn_port)) == NULL)

Is this protected either by rcu_read_lock() or the update-side lock
(ipnn_mutex?)?  One or the other is required.

> +		 return skb;
> +
> +	if (*pt_prev) {
> +		*ret = deliver_skb(skb, *pt_prev, orig_dev);
> +		*pt_prev = NULL;
> +	}
> +	return ipn_handle_frame_hook(port, skb);
> +}
> +#else
> +#define handle_ipn(skb, pt_prev, ret, orig_dev)	(skb)
> +#endif
> +
>  #ifdef CONFIG_NET_CLS_ACT
>  /* TODO: Maybe we should just force sch_ingress to be compiled in
>   * when CONFIG_NET_CLS_ACT is? otherwise some useless instructions
> @@ -2070,9 +2096,8 @@
>  #endif
> 
>  	skb = handle_bridge(skb, &pt_prev, &ret, orig_dev);
> -	if (!skb)
> -		goto out;
>  	skb = handle_macvlan(skb, &pt_prev, &ret, orig_dev);
> +	skb = handle_ipn(skb, &pt_prev, &ret, orig_dev);

Same here -- is this protected either by rcu_read_lock() or by the
update-side mutex?

>  	if (!skb)
>  		goto out;
> 
> diff -Naur linux-2.6.24-rc5/net/ipn/Kconfig linux-2.6.24-rc5-ipn/net/ipn/Kconfig
> --- linux-2.6.24-rc5/net/ipn/Kconfig	1970-01-01 01:00:00.000000000 +0100
> +++ linux-2.6.24-rc5-ipn/net/ipn/Kconfig	2007-12-16 16:30:04.000000000 +0100
> @@ -0,0 +1,21 @@
> +#
> +# Unix Domain Sockets
> +#
> +
> +config IPN
> +	tristate "IPN domain sockets (EXPERIMENTAL)"
> +	depends on EXPERIMENTAL
> +	---help---
> +	  If you say Y here, you will include support for IPN domain sockets.
> +	  Inter Process Networking socket are similar to Unix sockets but
> +	  they support peer-to-peer, one-to-many and many-to-many communication
> +	  among processes. 
> +	  Sub-Modules can be loaded to provide dispatching protocols.
> +	  This service include the IPN_BROADCST policy: all the messages get
> +	  sent to all the receipients (but the sender itself).
> +
> +	  To compile this driver as a module, choose M here: the module will be
> +	  called ipn.  
> +
> +	  If unsure, say 'N'.
> +
> diff -Naur linux-2.6.24-rc5/net/ipn/Makefile linux-2.6.24-rc5-ipn/net/ipn/Makefile
> --- linux-2.6.24-rc5/net/ipn/Makefile	1970-01-01 01:00:00.000000000 +0100
> +++ linux-2.6.24-rc5-ipn/net/ipn/Makefile	2007-12-16 16:30:04.000000000 +0100
> @@ -0,0 +1,8 @@
> +#
> +## Makefile for the IPN (Inter Process Networking) domain socket layer.
> +#
> +
> +obj-$(CONFIG_IPN)      += ipn.o
> +
> +ipn-y                  := af_ipn.o ipn_netdev.o
> +
> diff -Naur linux-2.6.24-rc5/net/ipn/af_ipn.c linux-2.6.24-rc5-ipn/net/ipn/af_ipn.c
> --- linux-2.6.24-rc5/net/ipn/af_ipn.c	1970-01-01 01:00:00.000000000 +0100
> +++ linux-2.6.24-rc5-ipn/net/ipn/af_ipn.c	2007-12-16 18:53:13.000000000 +0100
> @@ -0,0 +1,1540 @@
> +/*
> + * Main inter process networking (virtual distributed ethernet) module
> + *  (part of the View-OS project: wiki.virtualsquare.org) 
> + *
> + * Copyright (C) 2007   Renzo Davoli (renzo@cs.unibo.it)
> + *
> + *  This program is free software; you can redistribute it and/or modify
> + *  it under the terms of the GNU General Public License as published by
> + *  the Free Software Foundation; either version 2 of the License, or
> + *  (at your option) any later version.
> + *
> + *  Due to this file being licensed under the GPL there is controversy over
> + *  whether this permits you to write a module that #includes this file
> + *  without placing your module under the GPL.  Please consult a lawyer for
> + *  advice before doing this.
> + *
> + * WARNING: THIS CODE IS ALREADY EXPERIMENTAL
> + *
> + */
> +
> +#include <linux/init.h>
> +#include <linux/module.h>
> +#include <linux/socket.h>
> +#include <linux/poll.h>
> +#include <linux/un.h>
> +#include <linux/list.h>
> +#include <linux/mount.h>
> +#include <net/sock.h>
> +#include <net/af_ipn.h>
> +#include "ipn_netdev.h"
> +
> +MODULE_LICENSE("GPL");
> +MODULE_AUTHOR("VIEW-OS TEAM");
> +MODULE_DESCRIPTION("IPN Kernel Module");
> +
> +#define IPN_MAX_PROTO 4
> +
> +/*extension of RCV_SHUTDOWN defined in include/net/sock.h
> + * when the bit is set recv fails */
> +/* NO_OOB: do not send OOB */
> +#define RCV_SHUTDOWN_NO_OOB	4
> +/* EXTENDED MASK including OOB */
> +#define SHUTDOWN_XMASK	(SHUTDOWN_MASK | RCV_SHUTDOWN_NO_OOB)
> +/* if XRCV_SHUTDOWN is all set recv fails */
> +#define XRCV_SHUTDOWN	(RCV_SHUTDOWN | RCV_SHUTDOWN_NO_OOB)
> +
> +/* Network table and hash */
> +struct hlist_head ipn_network_table[IPN_HASH_SIZE + 1];
> +DEFINE_SPINLOCK(ipn_table_lock);
> +static struct kmem_cache *ipn_network_cache;
> +static struct kmem_cache *ipn_node_cache;
> +static struct kmem_cache *ipn_msgitem_cache;
> +static DECLARE_MUTEX(ipn_glob_mutex);
> +
> +/* Protocol 1: HUB/Broadcast default protocol. Function Prototypes */
> +static int ipn_bcast_newport(struct ipn_node *newport);
> +static int ipn_bcast_handlemsg(struct ipn_node *from, 
> +		struct msgpool_item *msgitem);
> +
> +/* default protocol IPN_BROADCAST (0) */
> +static struct ipn_protocol ipn_bcast = {
> +	.refcnt=0,
> +	.ipn_p_newport=ipn_bcast_newport, 
> +	.ipn_p_handlemsg=ipn_bcast_handlemsg};
> +/* Protocol table */
> +static struct ipn_protocol *ipn_protocol_table[IPN_MAX_PROTO]={&ipn_bcast};
> +
> +/* Socket call function prototypes */
> +static int ipn_release(struct socket *);
> +static int ipn_bind(struct socket *, struct sockaddr *, int);
> +static int ipn_connect(struct socket *, struct sockaddr *,
> +		int addr_len, int flags);
> +static int ipn_getname(struct socket *, struct sockaddr *, int *, int);
> +static unsigned int ipn_poll(struct file *, struct socket *, poll_table *);
> +static int ipn_ioctl(struct socket *, unsigned int, unsigned long);
> +static int ipn_shutdown(struct socket *, int);
> +static int ipn_sendmsg(struct kiocb *, struct socket *,
> +		struct msghdr *, size_t);
> +static int ipn_recvmsg(struct kiocb *, struct socket *,
> +		struct msghdr *, size_t, int);
> +static int ipn_setsockopt(struct socket *sock, int level, int optname,
> +		char __user *optval, int optlen);
> +static int ipn_getsockopt(struct socket *sock, int level, int optname,
> +		char __user *optval, int __user *optlen);
> +
> +/* Network table Management 
> + * inode->ipn_network hash table */
> +static inline void ipn_insert_network(struct hlist_head *list, struct ipn_network *ipnn)
> +{
> +	spin_lock(&ipn_table_lock);
> +	hlist_add_head(&ipnn->hnode, list);
> +	spin_unlock(&ipn_table_lock);
> +}
> +
> +static inline void ipn_remove_network(struct ipn_network *ipnn)
> +{
> +	spin_lock(&ipn_table_lock);
> +	hlist_del(&ipnn->hnode);
> +	spin_unlock(&ipn_table_lock);
> +}
> +
> +static struct ipn_network *ipn_find_network_byinode(struct inode *i)
> +{
> +	struct ipn_network *ipnn;
> +	struct hlist_node *node;
> +
> +	spin_lock(&ipn_table_lock);
> +	hlist_for_each_entry(ipnn, node,
> +			&ipn_network_table[i->i_ino & (IPN_HASH_SIZE - 1)], hnode) {
> +		struct dentry *dentry = ipnn->dentry;
> +
> +		if(atomic_read(&ipnn->refcnt) > 0 && dentry && dentry->d_inode == i)
> +			goto found;
> +	}
> +	ipnn = NULL;
> +found:
> +	spin_unlock(&ipn_table_lock);
> +	return ipnn;
> +}
> +
> +/* msgpool management 
> + * msgpool_item are ipn_network dependent (each net has its own MTU)
> + * for each message sent there is one msgpool_item and many struct msgitem
> + * one for each receipient. 
> + * msgitem are connected to the node's msgqueue or oobmsgqueue.
> + * when a message is delivered to a process the msgitem is deleted and
> + * the count of the msgpool_item is decreased.
> + * msgpool_item elements gets deleted automatically when count is 0*/
> +
> +struct msgitem {
> +	struct list_head list;
> +	struct msgpool_item *msg;
> +};
> +
> +/* alloc a fresh msgpool item. count is set to 1.
> + * the typical use is
> + *  ipn_msgpool_alloc
> + *  for each receipient
> + *    enqueue messages to the process (using msgitem), ipn_msgpool_hold 
> + *  ipn_msgpool_put
> + * The message can be delivered concurrently. init count to 1 guarantees
> + * that it survives at least until is has been enqueued to all
> + * receivers */
> +struct msgpool_item *ipn_msgpool_alloc(struct ipn_network *ipnn)
> +{
> +	struct msgpool_item *new;
> +	new=kmem_cache_alloc(ipnn->msgpool_cache,GFP_KERNEL);
> +	atomic_set(&new->count,1);
> +	atomic_inc(&ipnn->msgpool_nelem);
> +	return new;
> +}
> +
> +/* If the service il LOSSLESS, this msgpool call waits for an
> + * available msgpool item */
> +static struct msgpool_item *ipn_msgpool_alloc_locking(struct ipn_network *ipnn)
> +{
> +	if (ipnn->flags & IPN_FLAG_LOSSLESS) {
> +		while (atomic_read(&ipnn->msgpool_nelem) >= ipnn->msgpool_size) {
> +			if (wait_event_interruptible_exclusive(ipnn->send_wait,
> +						atomic_read(&ipnn->msgpool_nelem) < ipnn->msgpool_size))
> +				return NULL;
> +		}
> +	}
> +	return ipn_msgpool_alloc(ipnn);
> +}
> +
> +static inline void ipn_msgpool_hold(struct msgpool_item *msg)
> +{
> +	atomic_inc(&msg->count);
> +}
> +
> +/* decrease count and delete msgpool_item if count == 0 */
> +void ipn_msgpool_put(struct msgpool_item *old,
> +		struct ipn_network *ipnn)
> +{
> +	if (atomic_dec_and_test(&old->count)) {
> +		kmem_cache_free(ipnn->msgpool_cache,old);
> +		atomic_dec(&ipnn->msgpool_nelem);
> +		if (ipnn->flags & IPN_FLAG_LOSSLESS) /* could be done anyway */
> +			wake_up_interruptible(&ipnn->send_wait);
> +	}
> +}
> +
> +/* socket calls */
> +static const struct proto_ops ipn_ops = {
> +	.family = PF_IPN,
> +	.owner =  THIS_MODULE,
> +	.release =  ipn_release,
> +	.bind =   ipn_bind,
> +	.connect =  ipn_connect,
> +	.socketpair = sock_no_socketpair,
> +	.accept = sock_no_accept,
> +	.getname =  ipn_getname,
> +	.poll =   ipn_poll,
> +	.ioctl =  ipn_ioctl,
> +	.listen = sock_no_listen,
> +	.shutdown = ipn_shutdown,
> +	.setsockopt = ipn_setsockopt,
> +	.getsockopt = ipn_getsockopt,
> +	.sendmsg =  ipn_sendmsg,
> +	.recvmsg =  ipn_recvmsg,
> +	.mmap =   sock_no_mmap,
> +	.sendpage = sock_no_sendpage,
> +};
> +
> +static struct proto ipn_proto = {
> +	.name   = "IPN",
> +	.owner    = THIS_MODULE,
> +	.obj_size = sizeof(struct ipn_sock),
> +};
> +
> +/* create a socket
> + * ipn_node is a separate structure, pointed by ipn_sock -> node
> + * when a node is "persistent", ipn_node survives while ipn_sock gets released*/
> +static int ipn_create(struct net *net,struct socket *sock, int protocol)
> +{
> +	struct ipn_sock *ipn_sk;
> +	struct ipn_node *ipn_node;
> +	
> +	if (net != &init_net)
> +		return -EAFNOSUPPORT;
> +
> +	if (sock->type != SOCK_RAW)
> +		return -EPROTOTYPE;
> +	if (protocol > 0)
> +		protocol=protocol-1;
> +	else
> +		protocol=IPN_BROADCAST-1;
> +	if (protocol < 0 || protocol >= IPN_MAX_PROTO ||
> +			ipn_protocol_table[protocol] == NULL)
> +		return -EPROTONOSUPPORT;
> +	ipn_sk = (struct ipn_sock *) sk_alloc(net, PF_IPN, GFP_KERNEL, &ipn_proto);
> +
> +	if (!ipn_sk) 
> +		return -ENOMEM;
> +	ipn_sk->node=ipn_node=kmem_cache_alloc(ipn_node_cache,GFP_KERNEL);
> +	if (!ipn_node) {
> +		sock_put((struct sock *) ipn_sk);
> +		return -ENOMEM;
> +	}
> +	sock_init_data(sock,(struct sock *) ipn_sk);
> +	sock->state = SS_UNCONNECTED;
> +	sock->ops = &ipn_ops;
> +	sock->sk=(struct sock *)ipn_sk;
> +	INIT_LIST_HEAD(&ipn_node->nodelist);
> +	ipn_node->protocol=protocol;
> +	ipn_node->flags=IPN_NODEFLAG_INUSE;
> +	ipn_node->shutdown=RCV_SHUTDOWN_NO_OOB;
> +	ipn_node->descr[0]=0;
> +	ipn_node->portno=IPN_PORTNO_ANY;
> +	ipn_node->net=net;
> +	ipn_node->dev=NULL;
> +	ipn_node->proto_private=NULL;
> +	ipn_node->totmsgcount=0;
> +	ipn_node->oobmsgcount=0;
> +	spin_lock_init(&ipn_node->msglock);
> +	INIT_LIST_HEAD(&ipn_node->msgqueue);
> +	INIT_LIST_HEAD(&ipn_node->oobmsgqueue);
> +	ipn_node->ipn=NULL;
> +	init_waitqueue_head(&ipn_node->read_wait);
> +	ipn_node->pbp=NULL;
> +	return 0;
> +}
> +
> +/* update # of readers and # of writers counters for an ipn network.
> + * This function sends oob messages to nodes requesting the service */
> +static void ipn_net_update_counters(struct ipn_network *ipnn,
> +		int chg_readers, int chg_writers) {
> +	ipnn->numreaders += chg_readers;
> +	ipnn->numwriters += chg_writers;
> +	if (ipnn->mtu >= sizeof(struct numnode_oob))
> +	{
> +		struct msgpool_item *ipn_msg=ipn_msgpool_alloc(ipnn);
> +		if (ipn_msg) {
> +			struct numnode_oob *oob_msg=(struct numnode_oob *)(ipn_msg->data);
> +			struct ipn_node *ipn_node;
> +			ipn_msg->len=sizeof(struct numnode_oob);
> +			oob_msg->level=IPN_ANY;
> +			oob_msg->tag=IPN_OOB_NUMNODE_TAG;
> +			oob_msg->numreaders=ipnn->numreaders;
> +			oob_msg->numwriters=ipnn->numwriters;
> +			list_for_each_entry(ipn_node, &ipnn->connectqueue, nodelist) {
> +				if (ipn_node->flags & IPN_NODEFLAG_OOB_NUMNODES)
> +					ipn_proto_oobsendmsg(ipn_node,ipn_msg);
> +			}
> +			ipn_msgpool_put(ipn_msg,ipnn);
> +		}
> +	}
> +}
> +
> +/* flush pending messages (for close and shutdown RCV) */
> +static void ipn_flush_recvqueue(struct ipn_node *ipn_node)
> +{
> +	struct ipn_network *ipnn=ipn_node->ipn;
> +	spin_lock(&ipn_node->msglock);
> +	while (!list_empty(&ipn_node->msgqueue)) {
> +		struct msgitem *msgitem=
> +			list_first_entry(&ipn_node->msgqueue, struct msgitem, list);
> +		list_del(&msgitem->list);
> +		ipn_node->totmsgcount--;
> +		ipn_msgpool_put(msgitem->msg,ipnn);
> +		kmem_cache_free(ipn_msgitem_cache,msgitem);
> +	}
> +	spin_unlock(&ipn_node->msglock);
> +}
> +
> +/* flush pending oob messages (for socket close) */
> +static void ipn_flush_oobrecvqueue(struct ipn_node *ipn_node)
> +{
> +	struct ipn_network *ipnn=ipn_node->ipn;
> +	spin_lock(&ipn_node->msglock);
> +	while (!list_empty(&ipn_node->oobmsgqueue)) {
> +		struct msgitem *msgitem=
> +			list_first_entry(&ipn_node->oobmsgqueue, struct msgitem, list);
> +		list_del(&msgitem->list);
> +		ipn_node->totmsgcount--;
> +		ipn_node->oobmsgcount--;
> +		ipn_msgpool_put(msgitem->msg,ipnn);
> +		kmem_cache_free(ipn_msgitem_cache,msgitem);
> +	}
> +	spin_unlock(&ipn_node->msglock);
> +}
> +
> +/* Terminate node. The node is "logically" terminated. */
> +static int ipn_terminate_node(struct ipn_node *ipn_node)
> +{
> +	struct ipn_network *ipnn=ipn_node->ipn;
> +	if (ipnn) {
> +		if (down_interruptible(&ipnn->ipnn_mutex)) 
> +			return -ERESTARTSYS;
> +		if (ipn_node->portno >= 0) {
> +			ipn_protocol_table[ipnn->protocol]->ipn_p_predelport(ipn_node);
> +			ipnn->connport[ipn_node->portno]=NULL;
> +		}
> +		list_del(&ipn_node->nodelist);
> +		ipn_flush_recvqueue(ipn_node);
> +		ipn_flush_oobrecvqueue(ipn_node);
> +		if (ipn_node->portno >= 0) {
> +			ipn_protocol_table[ipnn->protocol]->ipn_p_delport(ipn_node);
> +		ipn_node->ipn=NULL;
> +		ipn_net_update_counters(ipnn,
> +				(ipn_node->shutdown & RCV_SHUTDOWN)?0:-1,
> +				(ipn_node->shutdown & SEND_SHUTDOWN)?0:-1);
> +		up(&ipnn->ipnn_mutex);
> +		if (ipn_node->dev)
> +			ipn_netdev_close(ipn_node);

The rcu_assign_pointer() invoked by ipn_netdev_close() is protected
by ipnn_mutex?

> +		}
> +		/* No more network elements */
> +		if (atomic_dec_and_test(&ipnn->refcnt))
> +		{
> +			ipn_protocol_table[ipnn->protocol]->ipn_p_delnet(ipnn);
> +			ipn_remove_network(ipnn);
> +			ipn_protocol_table[ipnn->protocol]->refcnt--;
> +			if (ipnn->dentry) {
> +				dput(ipnn->dentry);
> +				mntput(ipnn->mnt);
> +			}
> +			module_put(THIS_MODULE);
> +			if (ipnn->msgpool_cache)
> +				kmem_cache_destroy(ipnn->msgpool_cache);
> +			if (ipnn->connport)
> +				kfree(ipnn->connport);
> +			kmem_cache_free(ipn_network_cache, ipnn);
> +		}
> +	}
> +	if (ipn_node->pbp) {
> +		kfree(ipn_node->pbp);
> +		ipn_node->pbp=NULL;
> +	} 
> +	ipn_node->shutdown = SHUTDOWN_XMASK;
> +	return 0;
> +}
> +
> +/* release of a socket */
> +static int ipn_release (struct socket *sock)
> +{
> +	struct ipn_sock *ipn_sk=(struct ipn_sock *)sock->sk;
> +	struct ipn_node *ipn_node=ipn_sk->node;
> +	int rv;
> +	if (down_interruptible(&ipn_glob_mutex))
> +		return -ERESTARTSYS;
> +	if (ipn_node->flags & IPN_NODEFLAG_PERSIST) {
> +		ipn_node->flags &= ~IPN_NODEFLAG_INUSE;
> +		rv=0;
> +	} else {
> +		rv=ipn_terminate_node(ipn_node);
> +		if (rv==0) 
> +			kmem_cache_free(ipn_node_cache,ipn_node);
> +	}
> +	if (rv==0) 
> +		sock_put((struct sock *) ipn_sk);
> +	up(&ipn_glob_mutex);
> +	return rv;
> +}
> +
> +/* _set persist, change the persistence of a node,
> + * when persistence gets cleared and the node is no longer used
> + * the node is terminated and freed.
> + * ipn_glob_mutex must be locked */
> +static int _ipn_setpersist(struct ipn_node *ipn_node, int persist)
> +{
> +	int rv=0;
> +	if (persist)
> +		ipn_node->flags |= IPN_NODEFLAG_PERSIST;
> +	else {
> +		ipn_node->flags &= ~IPN_NODEFLAG_PERSIST;
> +		if (!(ipn_node->flags & IPN_NODEFLAG_INUSE)) {
> +			rv=ipn_terminate_node(ipn_node);
> +			if (rv==0)
> +				kmem_cache_free(ipn_node_cache,ipn_node);
> +		}
> +	}
> +	return rv;
> +}
> +
> +/* ipn_setpersist 
> + * lock ipn_glob_mutex and call __ipn_setpersist above */
> +static int ipn_setpersist(struct ipn_node *ipn_node, int persist)
> +{
> +	int rv=0;
> +	if (ipn_node->dev == NULL)
> +		return -ENODEV;
> +	if (down_interruptible(&ipn_glob_mutex))
> +		return -ERESTARTSYS;
> +	rv=_ipn_setpersist(ipn_node,persist);
> +	up(&ipn_glob_mutex);
> +	return rv;
> +}
> +
> +/* several network parameters can be set by setsockopt prior to bind */
> +/* struct pre_bind_parms is a temporary stucture connected to ipn_node->pbp
> + * to keep the parameter values. */
> +struct pre_bind_parms {
> +	unsigned short maxports;
> +	unsigned short flags;
> +	unsigned short msgpoolsize;
> +	unsigned short mtu;
> +	unsigned short mode;
> +};
> +
> +/* STD_PARMS:  BITS_PER_LONG nodes, no flags, BITS_PER_BYTE pending msgs, 
> + * Ethernet + VLAN MTU*/
> +#define STD_BIND_PARMS {BITS_PER_LONG, 0, BITS_PER_BYTE, 1514, 0x777};
> +
> +static int ipn_mkname(struct sockaddr_un * sunaddr, int len)
> +{
> +	if (len <= sizeof(short) || len > sizeof(*sunaddr))
> +		return -EINVAL;
> +	if (!sunaddr || sunaddr->sun_family != AF_IPN)
> +		return -EINVAL;
> +	/*
> +	 * This may look like an off by one error but it is a bit more
> +	 * subtle. 108 is the longest valid AF_IPN path for a binding.
> +	 * sun_path[108] doesnt as such exist.  However in kernel space
> +	 * we are guaranteed that it is a valid memory location in our
> +	 * kernel address buffer.
> +	 */
> +	((char *)sunaddr)[len]=0;
> +	len = strlen(sunaddr->sun_path)+1+sizeof(short);
> +	return len;
> +}
> +
> +
> +/* IPN BIND */
> +static int ipn_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
> +{
> +	struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr;
> +	struct ipn_node *ipn_node=((struct ipn_sock *)sock->sk)->node;
> +	struct nameidata nd;
> +	struct ipn_network *ipnn;
> +	struct dentry * dentry = NULL;
> +	int err;
> +	struct pre_bind_parms parms=STD_BIND_PARMS;
> +
> +	//printk("IPN bind\n");
> +
> +	if (down_interruptible(&ipn_glob_mutex))
> +		return -ERESTARTSYS;
> +	if (sock->state != SS_UNCONNECTED || 
> +			ipn_node->ipn != NULL) {
> +		err= -EISCONN;
> +		goto out;
> +	}
> +
> +	if (ipn_node->protocol >= 0 && 
> +			(ipn_node->protocol >= IPN_MAX_PROTO ||
> +			 ipn_protocol_table[ipn_node->protocol] == NULL)) {
> +		err= -EPROTONOSUPPORT;
> +		goto out;
> +	}
> +
> +	addr_len = ipn_mkname(sunaddr, addr_len);
> +	if (addr_len < 0) {
> +		err=addr_len;
> +		goto out;
> +	}
> +
> +	/* check if there is already a socket with that name */
> +	err = path_lookup(sunaddr->sun_path, LOOKUP_FOLLOW, &nd);
> +	if (err) { /* it does not exist, NEW IPN socket! */
> +		unsigned int mode;
> +		/* Is it everything okay with the parent? */
> +		err = path_lookup(sunaddr->sun_path, LOOKUP_PARENT, &nd);
> +		if (err)
> +			goto out_mknod_parent;
> +		/* Do I have the permission to create a file? */
> +		dentry = lookup_create(&nd, 0);
> +		err = PTR_ERR(dentry);
> +		if (IS_ERR(dentry))
> +			goto out_mknod_unlock;
> +		/*
> +		 * All right, let's create it.
> +		 */
> +		if (ipn_node->pbp) 
> +			mode = ipn_node->pbp->mode;
> +		else
> +			mode = SOCK_INODE(sock)->i_mode;
> +		mode = S_IFSOCK | (mode & ~current->fs->umask);
> +		err = vfs_mknod(nd.dentry->d_inode, dentry, mode, 0);
> +		if (err)
> +			goto out_mknod_dput;
> +		mutex_unlock(&nd.dentry->d_inode->i_mutex);
> +		dput(nd.dentry);
> +		nd.dentry = dentry;
> +		/* create a new ipn_network item */
> +		if (ipn_node->pbp) 
> +			parms=*ipn_node->pbp;
> +		ipnn=kmem_cache_zalloc(ipn_network_cache,GFP_KERNEL); 
> +		if (!ipnn) {
> +			err=-ENOMEM;
> +			goto out_mknod_dput_ipnn;
> +		}
> +		ipnn->connport=kzalloc(parms.maxports * sizeof(struct ipn_node *),GFP_KERNEL);
> +		if (!ipnn->connport) {
> +			err=-ENOMEM;
> +			goto out_mknod_dput_ipnn2;
> +		}
> +
> +		/* module refcnt is incremented for each network, thus
> +		 * rmmod is forbidden if there are persistent node */
> +		if (!try_module_get(THIS_MODULE)) {
> +			err = -EINVAL;
> +			goto out_mknod_dput_ipnn2;
> +		}
> +		memcpy(&ipnn->sunaddr,sunaddr,addr_len);
> +		ipnn->mtu=parms.mtu;
> +		ipnn->msgpool_cache=kmem_cache_create(ipnn->sunaddr.sun_path,sizeof(struct msgpool_item)+ipnn->mtu,0,0,NULL);
> +		if (!ipnn->msgpool_cache) {
> +			err=-ENOMEM;
> +			goto out_mknod_dput_putmodule;
> +		}
> +		INIT_LIST_HEAD(&ipnn->unconnectqueue);
> +		INIT_LIST_HEAD(&ipnn->connectqueue);
> +		atomic_set(&ipnn->refcnt,1);
> +		ipnn->dentry=nd.dentry;
> +		ipnn->mnt=nd.mnt;
> +		init_MUTEX(&ipnn->ipnn_mutex);
> +		ipnn->sunaddr_len=addr_len;
> +		ipnn->protocol=ipn_node->protocol;
> +		if (ipnn->protocol < 0) ipnn->protocol = 0;
> +		ipn_protocol_table[ipnn->protocol]->refcnt++;
> +		ipnn->flags=parms.flags;
> +		ipnn->numreaders=0;
> +		ipnn->numwriters=0;
> +		ipnn->maxports=parms.maxports;
> +		atomic_set(&ipnn->msgpool_nelem,0);
> +		ipnn->msgpool_size=parms.msgpoolsize;
> +		ipnn->proto_private=NULL;
> +		init_waitqueue_head(&ipnn->send_wait);
> +		err=ipn_protocol_table[ipnn->protocol]->ipn_p_newnet(ipnn);
> +		if (err)
> +			goto out_mknod_dput_putmodule;
> +		ipn_insert_network(&ipn_network_table[nd.dentry->d_inode->i_ino & (IPN_HASH_SIZE-1)],ipnn);
> +	} else {
> +		/* join an existing network */
> +		err = vfs_permission(&nd, MAY_EXEC);
> +		if (err)
> +			goto put_fail;
> +		err = -ECONNREFUSED;
> +		if (!S_ISSOCK(nd.dentry->d_inode->i_mode))
> +			goto put_fail;
> +		ipnn=ipn_find_network_byinode(nd.dentry->d_inode);
> +		if (!ipnn || (ipnn->flags & IPN_FLAG_TERMINATED))
> +			goto put_fail;
> +		list_add_tail(&ipn_node->nodelist,&ipnn->unconnectqueue);
> +		atomic_inc(&ipnn->refcnt);
> +	}
> +	if (ipn_node->pbp) {
> +		kfree(ipn_node->pbp);
> +		ipn_node->pbp=NULL;
> +	} 
> +	ipn_node->ipn=ipnn;
> +	ipn_node->flags |= IPN_NODEFLAG_BOUND;
> +	up(&ipn_glob_mutex);
> +	return 0;
> +
> +put_fail:
> +	path_release(&nd);
> +out:
> +	up(&ipn_glob_mutex);
> +	return err;
> +
> +out_mknod_dput_putmodule:
> +	module_put(THIS_MODULE);
> +out_mknod_dput_ipnn2:
> +	kfree(ipnn->connport);
> +out_mknod_dput_ipnn:
> +	kmem_cache_free(ipn_network_cache,ipnn);
> +out_mknod_dput:
> +	dput(dentry);
> +out_mknod_unlock:
> +	mutex_unlock(&nd.dentry->d_inode->i_mutex);
> +	path_release(&nd);
> +out_mknod_parent:
> +	if (err==-EEXIST)
> +		err=-EADDRINUSE;
> +	up(&ipn_glob_mutex);
> +	return err;
> +}
> +
> +/* IPN CONNECT */
> +static int ipn_connect(struct socket *sock, struct sockaddr *addr,
> +		int addr_len, int flags){
> +	struct sockaddr_un *sunaddr=(struct sockaddr_un*)addr;
> +	struct ipn_node *ipn_node=((struct ipn_sock *)sock->sk)->node;
> +	struct nameidata nd;
> +	struct ipn_network *ipnn,*previousipnn;
> +	int err=0;
> +	int portno;
> +
> +	/* the socket cannot be connected twice */
> +	if (sock->state != SS_UNCONNECTED) 
> +		return EISCONN;
> +
> +	if (down_interruptible(&ipn_glob_mutex))
> +		return -ERESTARTSYS;
> +
> +	if ((previousipnn=ipn_node->ipn) == NULL) { /* unbound */
> +		unsigned char mustshutdown=0;
> +		err = ipn_mkname(sunaddr, addr_len);
> +		if (err < 0)
> +			goto out;
> +		addr_len=err;
> +		err = path_lookup(sunaddr->sun_path, LOOKUP_FOLLOW, &nd);
> +		if (err)
> +			goto out;
> +		err = vfs_permission(&nd, MAY_READ);
> +		if (err) {
> +			if (err == -EACCES || err == -EROFS)
> +				mustshutdown|=RCV_SHUTDOWN;
> +			else
> +				goto put_fail;
> +		}
> +		err = vfs_permission(&nd, MAY_WRITE);
> +		if (err) {
> +			if (err == -EACCES)
> +				mustshutdown|=SEND_SHUTDOWN;
> +			else
> +				goto put_fail;
> +		}
> +		mustshutdown |= ipn_node->shutdown;
> +		/* if the combination of shutdown and permissions leaves
> +		 * no abilities, connect returns EACCES */
> +		if (mustshutdown == SHUTDOWN_XMASK) {
> +			err=-EACCES;
> +			goto put_fail;
> +		} else {
> +			err=0;
> +			ipn_node->shutdown=mustshutdown;
> +		}
> +		if (!S_ISSOCK(nd.dentry->d_inode->i_mode)) {
> +			err = -ECONNREFUSED;
> +			goto put_fail;
> +		}
> +		ipnn=ipn_find_network_byinode(nd.dentry->d_inode);
> +		if (!ipnn || (ipnn->flags & IPN_FLAG_TERMINATED)) {
> +			err = -ECONNREFUSED;
> +			goto put_fail;
> +		}
> +		if (ipn_node->protocol == IPN_ANY)
> +			ipn_node->protocol=ipnn->protocol;
> +		else if (ipnn->protocol != ipn_node->protocol) {
> +			err = -EPROTO;
> +			goto put_fail;
> +		}
> +		path_release(&nd);
> +		ipn_node->ipn=ipnn;
> +	} else
> +		ipnn=ipn_node->ipn;
> +
> +	if (down_interruptible(&ipnn->ipnn_mutex)) {
> +		err=-ERESTARTSYS;
> +		goto out;
> +	}
> +	portno = ipn_protocol_table[ipnn->protocol]->ipn_p_newport(ipn_node);
> +	if (portno >= 0 && portno<ipnn->maxports) {
> +		sock->state = SS_CONNECTED;
> +		ipn_node->portno=portno;
> +		ipnn->connport[portno]=ipn_node;
> +		if (!(ipn_node->flags & IPN_NODEFLAG_BOUND)) {
> +			atomic_inc(&ipnn->refcnt);
> +			list_del(&ipn_node->nodelist);
> +		}
> +		list_add_tail(&ipn_node->nodelist,&ipnn->connectqueue);
> +		ipn_net_update_counters(ipnn,
> +				(ipn_node->shutdown & RCV_SHUTDOWN)?0:1,
> +				(ipn_node->shutdown & SEND_SHUTDOWN)?0:1);
> +	} else {
> +		ipn_node->ipn=previousipnn; /* undo changes on ipn_node->ipn */
> +		err=-EADDRNOTAVAIL;
> +	}
> +	up(&ipnn->ipnn_mutex);
> +	up(&ipn_glob_mutex);
> +	return err;
> +
> +put_fail:
> +	path_release(&nd);
> +out:
> +	up(&ipn_glob_mutex);
> +	return err;
> +}
> +
> +static int ipn_getname(struct socket *sock, struct sockaddr *uaddr, 
> +		int *uaddr_len, int peer) {
> +	struct ipn_node *ipn_node=((struct ipn_sock *)sock->sk)->node;
> +	struct ipn_network *ipnn=ipn_node->ipn;
> +	struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr;
> +	int err=0;
> +
> +	if (down_interruptible(&ipn_glob_mutex))
> +		return -ERESTARTSYS;
> +	if (ipnn) {
> +		*uaddr_len = ipnn->sunaddr_len;
> +		memcpy(sunaddr,&ipnn->sunaddr,*uaddr_len);
> +	} else
> +		err = -ENOTCONN;
> +	up(&ipn_glob_mutex);
> +	return err;
> +}
> +
> +/* IPN POLL */
> +static unsigned int ipn_poll(struct file *file, struct socket *sock, 
> +		poll_table *wait) {
> +	struct ipn_node *ipn_node=((struct ipn_sock *)sock->sk)->node;
> +	struct ipn_network *ipnn=ipn_node->ipn;
> +	unsigned int mask=0;
> +
> +	if (ipnn) {
> +		poll_wait(file,&ipn_node->read_wait,wait);
> +		if (ipnn->flags & IPN_FLAG_LOSSLESS)
> +			poll_wait(file,&ipnn->send_wait,wait);
> +		/* POLLIN if recv succeeds, 
> +		 * POLL{PRI,RDNORM} if there are {oob,non-oob} messages */
> +		if (ipn_node->totmsgcount > 0) mask |= POLLIN;
> +		if (!(list_empty(&ipn_node->msgqueue))) mask |= POLLRDNORM;
> +		if (!(list_empty(&ipn_node->oobmsgqueue))) mask |= POLLPRI;
> +		if ((!(ipnn->flags & IPN_FLAG_LOSSLESS)) |
> +				(atomic_read(&ipnn->msgpool_nelem) < ipnn->msgpool_size))
> +			mask |= POLLOUT | POLLWRNORM;
> +	} 
> +	return mask;
> +}
> +
> +/* connect netdev (from ioctl). connect a bound socket to a 
> + * network device TAP or GRAB */
> +static int ipn_connect_netdev(struct socket *sock,struct ifreq *ifr)
> +{
> +	int err=0;
> +	struct ipn_node *ipn_node=((struct ipn_sock *)sock->sk)->node;
> +	struct ipn_network *ipnn=ipn_node->ipn;
> +	if (!capable(CAP_NET_ADMIN))
> +		return -EPERM;
> +	if (sock->state != SS_UNCONNECTED) 
> +		return -EISCONN;
> +	if (!ipnn)
> +		return -ENOTCONN;  /* Maybe we need a different error for "NOT BOUND" */
> +	if (down_interruptible(&ipn_glob_mutex))
> +		return -ERESTARTSYS;
> +	if (down_interruptible(&ipnn->ipnn_mutex)) {
> +		up(&ipn_glob_mutex);
> +		return -ERESTARTSYS;
> +	}
> +	ipn_node->dev=ipn_netdev_alloc(ipn_node->net,ifr->ifr_flags,ifr->ifr_name,&err);
> +	if (ipn_node->dev) {
> +		int portno;
> +		portno = ipn_protocol_table[ipnn->protocol]->ipn_p_newport(ipn_node);
> +		if (portno >= 0 && portno<ipnn->maxports) {
> +			sock->state = SS_CONNECTED;
> +			ipn_node->portno=portno;
> +			ipn_node->flags |= ifr->ifr_flags & IPN_NODEFLAG_DEVMASK;
> +			ipnn->connport[portno]=ipn_node;
> +			err=ipn_netdev_activate(ipn_node);
> +			if (err) {
> +				sock->state = SS_UNCONNECTED;
> +				ipn_protocol_table[ipnn->protocol]->ipn_p_delport(ipn_node);
> +				ipn_node->dev=NULL;
> +				ipn_node->portno= -1;
> +				ipn_node->flags &= ~IPN_NODEFLAG_DEVMASK;
> +				ipnn->connport[portno]=NULL;
> +			} else  {
> +				ipn_protocol_table[ipnn->protocol]->ipn_p_postnewport(ipn_node);
> +				list_del(&ipn_node->nodelist);
> +				list_add_tail(&ipn_node->nodelist,&ipnn->connectqueue);
> +			}
> +		} else {
> +			ipn_netdev_close(ipn_node); 

Again, the rcu_assign_pointer() invoked by ipn_netdev_close() is protected
by ipnn_mutex?

> +			err=-EADDRNOTAVAIL;
> +			ipn_node->dev=NULL;
> +		}
> +	} else 
> +		err=-EINVAL;
> +	up(&ipnn->ipnn_mutex);
> +	up(&ipn_glob_mutex);
> +	return err;
> +}
> +
> +/* join a netdev, a socket gets connected to a persistent node
> + * not connected to another socket */
> +static int ipn_join_netdev(struct socket *sock,struct ifreq *ifr)
> +{
> +	int err=0;
> +	struct net_device *dev;
> +	struct ipn_node *ipn_node=((struct ipn_sock *)sock->sk)->node;
> +	struct ipn_node *ipn_joined;
> +	struct ipn_network *ipnn=ipn_node->ipn;
> +	if (sock->state != SS_UNCONNECTED)
> +		return -EISCONN;
> +	if (down_interruptible(&ipn_glob_mutex))
> +		return -ERESTARTSYS;
> +	if (down_interruptible(&ipnn->ipnn_mutex)) {
> +		up(&ipn_glob_mutex);
> +		return -ERESTARTSYS;
> +	}
> +	dev=__dev_get_by_name(ipn_node->net,ifr->ifr_name);
> +	if (!dev) 
> +		dev=__dev_get_by_index(ipn_node->net,ifr->ifr_ifindex);
> +	if (dev && (ipn_joined=ipn_netdev2node(dev)) != NULL) { /* the interface does exist */
> +		int i;
> +		for (i=0;i<ipnn->maxports && ipn_joined != ipnn->connport[i] ;i++)
> +			;
> +		if (i < ipnn->maxports) { /* found */
> +			/* ipn_joined is substituted to ipn_node */
> +			((struct ipn_sock *)sock->sk)->node=ipn_joined;
> +			ipn_joined->flags |= IPN_NODEFLAG_INUSE;
> +			atomic_dec(&ipnn->refcnt);
> +			kmem_cache_free(ipn_node_cache,ipn_node);
> +		} else
> +			err=-EPERM;
> +	} else
> +		err=-EADDRNOTAVAIL;
> +	up(&ipnn->ipnn_mutex);
> +	up(&ipn_glob_mutex);
> +	return err;
> +}
> +
> +/* set persistence of a node looking for it by interface name
> + * (it is for sysadm, to close network interfaces)*/
> +static int ipn_setpersist_netdev(struct ifreq *ifr, int value)
> +{
> +	struct net_device *dev;
> +	struct ipn_node *ipn_node;
> +	int err=0;
> +	if (!capable(CAP_NET_ADMIN))
> +		return -EPERM;
> +	if (down_interruptible(&ipn_glob_mutex))
> +		return -ERESTARTSYS;
> +	dev=__dev_get_by_name(&init_net,ifr->ifr_name);
> +	if (!dev)
> +		dev=__dev_get_by_index(&init_net,ifr->ifr_ifindex);
> +	if (dev && (ipn_node=ipn_netdev2node(dev)) != NULL) 
> +		_ipn_setpersist(ipn_node,value);
> +	else
> +		err=-EADDRNOTAVAIL;
> +	up(&ipn_glob_mutex);
> +	return err;
> +}
> +
> +/* IPN IOCTL */
> +static int ipn_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) {
> +	struct ipn_node *ipn_node=((struct ipn_sock *)sock->sk)->node;
> +	struct ipn_network *ipnn=ipn_node->ipn;
> +	void __user* argp = (void __user*)arg;
> +	struct ifreq ifr;
> +
> +	if (ipn_node->shutdown == SHUTDOWN_XMASK)
> +		return -ECONNRESET;
> +
> +	/* get arguments */
> +	switch (cmd) {
> +		case IPN_SETPERSIST_NETDEV:
> +		case IPN_CLRPERSIST_NETDEV:
> +		case IPN_CONN_NETDEV:
> +		case IPN_JOIN_NETDEV:
> +		case SIOCSIFHWADDR:
> +			if (copy_from_user(&ifr, argp, sizeof ifr))
> +				return -EFAULT;
> +			ifr.ifr_name[IFNAMSIZ-1] = '\0';
> +	}
> +
> +	/* actions for unconnected and unbound sockets */
> +	switch (cmd) {
> +		case IPN_SETPERSIST_NETDEV:
> +			return ipn_setpersist_netdev(&ifr,1);
> +		case IPN_CLRPERSIST_NETDEV:
> +			return ipn_setpersist_netdev(&ifr,0);
> +		case SIOCSIFHWADDR:
> +			if (capable(CAP_NET_ADMIN))
> +				return -EPERM;
> +			if (ipn_node->dev && (ipn_node->flags &IPN_NODEFLAG_TAP))
> +				return dev_set_mac_address(ipn_node->dev, &ifr.ifr_hwaddr);
> +			else
> +				return -EADDRNOTAVAIL;
> +	}
> +	if (ipnn == NULL || (ipnn->flags & IPN_FLAG_TERMINATED))
> +		return -ENOTCONN;
> +	/* actions for connected or bound sockets */
> +	switch (cmd) {
> +		case IPN_CONN_NETDEV:
> +			return ipn_connect_netdev(sock,&ifr);
> +		case IPN_JOIN_NETDEV:
> +			return ipn_join_netdev(sock,&ifr);
> +		case IPN_SETPERSIST:
> +			return ipn_setpersist(ipn_node,arg);
> +		default:
> +			if (ipnn) {
> +				int rv;
> +				if (down_interruptible(&ipnn->ipnn_mutex))
> +					return -ERESTARTSYS;
> +				rv=ipn_protocol_table[ipn_node->protocol]->ipn_p_ioctl(ipn_node,cmd,arg);
> +				up(&ipnn->ipnn_mutex);
> +				return rv;
> +			} else
> +				return -EOPNOTSUPP;
> +	}
> +}
> +
> +/* shutdown: close socket for input or for output.
> + * shutdown can be called prior to connect and it is not reversible */
> +static int ipn_shutdown(struct socket *sock, int mode) {
> +	struct ipn_node *ipn_node=((struct ipn_sock *)sock->sk)->node;
> +	struct ipn_network *ipnn=ipn_node->ipn;
> +	int oldshutdown=ipn_node->shutdown;
> +	mode = (mode+1)&(RCV_SHUTDOWN|SEND_SHUTDOWN);
> +
> +	ipn_node->shutdown |= mode;
> +
> +	if(ipnn) {
> +		if (down_interruptible(&ipnn->ipnn_mutex)) {
> +			ipn_node->shutdown = oldshutdown;
> +			return -ERESTARTSYS;
> +		}
> +		oldshutdown=ipn_node->shutdown-oldshutdown;
> +		if (sock->state == SS_CONNECTED && oldshutdown) {
> +			ipn_net_update_counters(ipnn,
> +					(ipn_node->shutdown & RCV_SHUTDOWN)?0:-1,
> +					(ipn_node->shutdown & SEND_SHUTDOWN)?0:-1);
> +		}
> +
> +		/* if recv channel has been shut down, flush the recv queue */
> +		if ((ipn_node->shutdown & RCV_SHUTDOWN))
> +			ipn_flush_recvqueue(ipn_node);
> +		up(&ipnn->ipnn_mutex);
> +	}
> +	return 0;
> +}
> +
> +/* injectmsg: a new message is entering the ipn network.
> + * injectmsg gets called by send and by the grab/tap node */
> +int ipn_proto_injectmsg(struct ipn_node *from, struct msgpool_item *msg)
> +{
> +	struct ipn_network *ipnn=from->ipn;
> +	int err=0;
> +	if (down_interruptible(&ipnn->ipnn_mutex))
> +		err=-ERESTARTSYS;
> +	else {
> +		ipn_protocol_table[ipnn->protocol]->ipn_p_handlemsg(from, msg);
> +		up(&ipnn->ipnn_mutex);
> +	}
> +	return err;
> +}
> +
> +/* SEND MSG */
> +static int ipn_sendmsg(struct kiocb *kiocb, struct socket *sock,
> +		struct msghdr *msg, size_t len) {
> +	struct ipn_node *ipn_node=((struct ipn_sock *)sock->sk)->node;
> +	struct ipn_network *ipnn=ipn_node->ipn;
> +	struct msgpool_item *newmsg;
> +	int err=0;
> +
> +	if (unlikely(sock->state != SS_CONNECTED)) 
> +			return -ENOTCONN;
> +	if (unlikely(ipn_node->shutdown & SEND_SHUTDOWN)) {
> +		if (ipn_node->shutdown == SHUTDOWN_XMASK)
> +			return -ECONNRESET;
> +		else
> +			return -EPIPE;
> +	}
> +	if (len > ipnn->mtu)
> +		return -EOVERFLOW;
> +	newmsg=ipn_msgpool_alloc_locking(ipnn);
> +	if (!newmsg)
> +		return -ENOMEM;
> +	newmsg->len=len;
> +	err=memcpy_fromiovec(newmsg->data, msg->msg_iov, len);
> +	if (!err) 
> +		ipn_proto_injectmsg(ipn_node, newmsg);
> +	ipn_msgpool_put(newmsg,ipnn);
> +	return err;
> +}
> +
> +/* enqueue an oob message. "to" is the destination */
> +void ipn_proto_oobsendmsg(struct ipn_node *to, struct msgpool_item *msg)
> +{
> +	if (to) {
> +		if (!to->dev) { /* no oob to netdev */
> +			struct msgitem *msgitem;
> +			struct ipn_network *ipnn=to->ipn;
> +			spin_lock(&to->msglock);
> +			if ((to->shutdown & RCV_SHUTDOWN_NO_OOB) == 0 && 
> +					(ipnn->flags & IPN_FLAG_LOSSLESS ||
> +					 to->oobmsgcount < ipnn->msgpool_size)) {
> +				if ((msgitem=kmem_cache_alloc(ipn_msgitem_cache,GFP_KERNEL))!=NULL) {
> +					msgitem->msg=msg;
> +					to->totmsgcount++;
> +					to->oobmsgcount++;
> +					list_add_tail(&msgitem->list, &to->oobmsgqueue);
> +					ipn_msgpool_hold(msg);
> +				}
> +			}
> +			spin_unlock(&to->msglock);
> +			wake_up_interruptible(&to->read_wait);
> +		}
> +	}
> +}
> +
> +/* ipn_proto_sendmsg is called by protocol implementation to enqueue a 
> + * for a destination (to).*/
> +void ipn_proto_sendmsg(struct ipn_node *to, struct msgpool_item *msg)
> +{
> +	if (to) {
> +		if (to->dev) {
> +			ipn_netdev_sendmsg(to,msg);
> +		} else {
> +			/* socket send */
> +			struct msgitem *msgitem;
> +			struct ipn_network *ipnn=to->ipn;
> +			spin_lock(&to->msglock);
> +			if ((ipnn->flags & IPN_FLAG_LOSSLESS ||
> +					to->totmsgcount < ipnn->msgpool_size) &&
> +					(to->shutdown & RCV_SHUTDOWN)==0) {
> +				if ((msgitem=kmem_cache_alloc(ipn_msgitem_cache,GFP_KERNEL))!=NULL) {
> +					msgitem->msg=msg;
> +					to->totmsgcount++;
> +					list_add_tail(&msgitem->list, &to->msgqueue);
> +					ipn_msgpool_hold(msg);
> +				}
> +			}
> +			spin_unlock(&to->msglock);
> +			wake_up_interruptible(&to->read_wait);
> +		}
> +	}
> +}
> +
> +/* IPN RECV */
> +static int ipn_recvmsg(struct kiocb *kiocb, struct socket *sock,
> +		struct msghdr *msg, size_t len, int flags) {
> +	struct ipn_node *ipn_node=((struct ipn_sock *)sock->sk)->node;
> +	struct ipn_network *ipnn=ipn_node->ipn;
> +	struct msgitem *msgitem;
> +	struct msgpool_item *currmsg;
> +
> +	if (unlikely(sock->state != SS_CONNECTED)) 
> +			return -ENOTCONN;
> +
> +	if (unlikely((ipn_node->shutdown & XRCV_SHUTDOWN) == XRCV_SHUTDOWN)) {
> +		if (ipn_node->shutdown == SHUTDOWN_XMASK) /*EOF, nothing can be read*/
> +			return 0;
> +		else
> +			return -EPIPE; /*trying to read on a write only node */
> +	}
> +
> +	/* wait for a message */
> +	spin_lock(&ipn_node->msglock);
> +	while (ipn_node->totmsgcount == 0) {
> +		spin_unlock(&ipn_node->msglock);
> +		if (wait_event_interruptible(ipn_node->read_wait,
> +					!(ipn_node->totmsgcount == 0)))
> +			return -ERESTARTSYS;
> +		spin_lock(&ipn_node->msglock);
> +	}
> +	/* oob gets delivered first. oob are rare */
> +	if (likely(list_empty(&ipn_node->oobmsgqueue)))
> +		msgitem=list_first_entry(&ipn_node->msgqueue, struct msgitem, list);
> +	else {
> +		msgitem=list_first_entry(&ipn_node->oobmsgqueue, struct msgitem, list);
> +		msg->msg_flags |= MSG_OOB;
> +		ipn_node->oobmsgcount--;
> +	}
> +	list_del(&msgitem->list);
> +	ipn_node->totmsgcount--;
> +	spin_unlock(&ipn_node->msglock);
> +	currmsg=msgitem->msg;
> +	if (currmsg->len < len)
> +		len=currmsg->len;
> +	memcpy_toiovec(msg->msg_iov, currmsg->data, len);
> +	ipn_msgpool_put(currmsg,ipnn);
> +	kmem_cache_free(ipn_msgitem_cache,msgitem);
> +
> +	return len;
> +}
> +
> +/* resize a network: change the # of communication ports (connport) */
> +static int ipn_netresize(struct ipn_network *ipnn,int newsize)
> +{
> +	int oldsize,min;
> +	struct ipn_node **newconnport;
> +	struct ipn_node **oldconnport;
> +	int err;
> +	if (down_interruptible(&ipnn->ipnn_mutex))
> +		        return -ERESTARTSYS;
> +	oldsize=ipnn->maxports;
> +	if (newsize == oldsize) {
> +		up(&ipnn->ipnn_mutex);
> +		return 0;
> +	}
> +	min=oldsize;
> +	/* shrink a network. all the ports we are going to eliminate
> +	 * must be unused! */
> +	if (newsize < oldsize) {
> +		int i;
> +		for (i=newsize; i<oldsize; i++)
> +			if (ipnn->connport[i]) {
> +				up(&ipnn->ipnn_mutex);
> +				return -EADDRINUSE;
> +			}
> +		min=newsize;
> +	}
> +	oldconnport=ipnn->connport;
> +	/* allocate the new connport array and copy the old one */
> +	newconnport=kzalloc(newsize * sizeof(struct ipn_node *),GFP_KERNEL);
> +	if (!newconnport) {
> +		up(&ipnn->ipnn_mutex);
> +		return -ENOMEM;
> +	}
> +	memcpy(newconnport,oldconnport,min * sizeof(struct ipn_node *));
> +	ipnn->connport=newconnport;
> +	ipnn->maxports=newsize;
> +	/* notify the protocol that the netowrk has been resized */
> +	err=ipn_protocol_table[ipnn->protocol]->ipn_p_resizenet(ipnn,oldsize,newsize);
> +	if (err) {
> +		/* roll back if the resize operation failed for the protocol */
> +		ipnn->connport=oldconnport;
> +		ipnn->maxports=oldsize;
> +		kfree(newconnport);
> +	} else 
> +		/* successful mission, network resized */
> +		kfree(oldconnport);
> +	up(&ipnn->ipnn_mutex);
> +	return err;
> +}
> +
> +/* IPN SETSOCKOPT */
> +static int ipn_setsockopt(struct socket *sock, int level, int optname,
> +		char __user *optval, int optlen) {
> +	struct ipn_node *ipn_node=((struct ipn_sock *)sock->sk)->node;
> +	struct ipn_network *ipnn=ipn_node->ipn;
> +
> +	if (ipn_node->shutdown == SHUTDOWN_XMASK)
> +		return -ECONNRESET;
> +	if (level != 0 && level != ipn_node->protocol+1)
> +		return -EPROTONOSUPPORT;
> +	if (level > 0) {
> +		/* protocol specific sockopt */
> +		if (ipnn) {
> +			int rv;
> +			if (down_interruptible(&ipnn->ipnn_mutex))
> +				return -ERESTARTSYS;
> +			rv=ipn_protocol_table[ipn_node->protocol]->ipn_p_setsockopt(ipn_node,optname,optval,optlen);
> +			up(&ipnn->ipnn_mutex);
> +			return rv;
> +		} else
> +			return -EOPNOTSUPP;
> +	} else {
> +		if (optname == IPN_SO_DESCR) {
> +			if (optlen > IPN_DESCRLEN)
> +				return -EINVAL;
> +			else {
> +				memset(ipn_node->descr,0,IPN_DESCRLEN);
> +				copy_from_user(ipn_node->descr,optval,optlen);
> +				ipn_node->descr[optlen-1]=0;
> +				return 0;
> +			}
> +		} else {
> +			if (optlen < sizeof(int))
> +				return -EINVAL;
> +			else if ((optname & IPN_SO_PREBIND) && (ipnn != NULL))
> +				return -EISCONN;
> +			else {
> +				int val;
> +				get_user(val, (int __user *) optval);
> +				if ((optname & IPN_SO_PREBIND) && !ipn_node->pbp) {
> +					struct pre_bind_parms std=STD_BIND_PARMS;
> +					ipn_node->pbp=kzalloc(sizeof(struct pre_bind_parms),GFP_KERNEL);
> +					if (!ipn_node->pbp)
> +						return -ENOMEM;
> +					*(ipn_node->pbp)=std;
> +				}
> +				switch (optname) {
> +					case IPN_SO_PORT:
> +						if (sock->state == SS_UNCONNECTED)
> +							ipn_node->portno=val;
> +						else
> +							return -EISCONN;
> +						break;
> +					case IPN_SO_CHANGE_NUMNODES:
> +						if ((ipn_node->flags & IPN_NODEFLAG_BOUND)!=0) {
> +							if (val <= 0)
> +								return -EINVAL;
> +							else
> +								return ipn_netresize(ipnn,val);
> +						} else
> +							val=-ENOTCONN;
> +						break;
> +					case IPN_SO_WANT_OOB_NUMNODES:
> +						if (val)
> +							ipn_node->flags |= IPN_NODEFLAG_OOB_NUMNODES;
> +						else
> +							ipn_node->flags &= ~IPN_NODEFLAG_OOB_NUMNODES;
> +						break;
> +					case IPN_SO_HANDLE_OOB:
> +						if (val)
> +							ipn_node->shutdown &= ~RCV_SHUTDOWN_NO_OOB;
> +						else
> +							ipn_node->shutdown |= RCV_SHUTDOWN_NO_OOB;
> +						break;
> +					case IPN_SO_MTU:
> +						if (val <= 0)
> +							return -EINVAL;
> +						else
> +							ipn_node->pbp->mtu=val;
> +						break;
> +					case IPN_SO_NUMNODES:
> +						if (val <= 0)
> +							return -EINVAL;
> +						else
> +							ipn_node->pbp->maxports=val;
> +						break;
> +					case IPN_SO_MSGPOOLSIZE:
> +						if (val <= 0)
> +							return -EINVAL;
> +						else
> +							ipn_node->pbp->msgpoolsize=val;
> +						break;
> +					case IPN_SO_FLAGS:
> +						ipn_node->pbp->flags=val;
> +						break;
> +					case IPN_SO_MODE:
> +						ipn_node->pbp->mode=val;
> +						break;
> +				}
> +				return 0;
> +			}
> +		}
> +	}
> +}
> +
> +/* IPN GETSOCKOPT */
> +static int ipn_getsockopt(struct socket *sock, int level, int optname,
> +		char __user *optval, int __user *optlen) {
> +	struct ipn_node *ipn_node=((struct ipn_sock *)sock->sk)->node;
> +	struct ipn_network *ipnn=ipn_node->ipn;
> +	int len;
> +
> +	if (ipn_node->shutdown == SHUTDOWN_XMASK)
> +		return -ECONNRESET;
> +	if (level != 0 && level != ipn_node->protocol+1)
> +		return -EPROTONOSUPPORT;
> +	if (level > 0) {
> +		if (ipnn) {
> +			int rv;
> +			/* protocol specific sockopt */
> +			if (down_interruptible(&ipnn->ipnn_mutex))
> +				return -ERESTARTSYS;
> +			rv=ipn_protocol_table[ipn_node->protocol]->ipn_p_getsockopt(ipn_node,optname,optval,optlen);
> +			up(&ipnn->ipnn_mutex);
> +			return rv;
> +		} else
> +			return -EOPNOTSUPP;
> +	} else {
> +		if (get_user(len, optlen))
> +			return -EFAULT;
> +		if (optname == IPN_SO_DESCR) {
> +			if (len < IPN_DESCRLEN)
> +				return -EINVAL;
> +			else {
> +				if (len > IPN_DESCRLEN)
> +					len=IPN_DESCRLEN;
> +				if(put_user(len, optlen))
> +					return -EFAULT;
> +				if(copy_to_user(optval,ipn_node->descr,len))
> +					return -EFAULT;
> +				return 0;
> +			}
> +		} else {
> +			int val=-2;
> +			switch (optname) {
> +				case IPN_SO_PORT:
> +					val=ipn_node->portno;
> +					break;
> +				case IPN_SO_MTU:
> +					if (ipnn)
> +						val=ipnn->mtu;
> +					else if (ipn_node->pbp)
> +						val=ipn_node->pbp->mtu;
> +					break;
> +				case IPN_SO_NUMNODES:
> +					if (ipnn)
> +						val=ipnn->maxports;
> +					else if (ipn_node->pbp)
> +						val=ipn_node->pbp->maxports;
> +					break;
> +				case IPN_SO_MSGPOOLSIZE:
> +					if (ipnn)
> +						val=ipnn->msgpool_size;
> +					else if (ipn_node->pbp)
> +						val=ipn_node->pbp->msgpoolsize;
> +					break;
> +				case IPN_SO_FLAGS:
> +					if (ipnn)
> +						val=ipnn->flags;
> +					else if (ipn_node->pbp)
> +						val=ipn_node->pbp->flags;
> +					break;
> +				case IPN_SO_MODE:
> +					if (ipnn)
> +						val=-1;
> +					else if (ipn_node->pbp)
> +						val=ipn_node->pbp->mode;
> +					break;
> +			}
> +			if (val < -1)
> +				return -EINVAL;
> +			else {
> +				if (len < sizeof(int))
> +					return -EOVERFLOW;
> +				else {
> +					len = sizeof(int);
> +					if(put_user(len, optlen))
> +						return -EFAULT;
> +					if(copy_to_user(optval,&val,len))
> +						return -EFAULT;
> +					return 0;
> +				}
> +			}
> +		}
> +	}
> +}
> +
> +/* BROADCAST/HUB implementation */
> +
> +static int ipn_bcast_newport(struct ipn_node *newport) {
> +	struct ipn_network *ipnn=newport->ipn;
> +	int i;
> +	for (i=0;i<ipnn->maxports;i++) {
> +		if (ipnn->connport[i] == NULL) 
> +			return i;
> +	}
> +	return -1;
> +}
> +
> +static int ipn_bcast_handlemsg(struct ipn_node *from, 
> +		struct msgpool_item *msgitem){
> +	struct ipn_network *ipnn=from->ipn;
> +
> +	struct ipn_node *ipn_node;
> +	list_for_each_entry(ipn_node, &ipnn->connectqueue, nodelist) {
> +		if (ipn_node != from)
> +			ipn_proto_sendmsg(ipn_node,msgitem);
> +	}
> +	return 0;
> +}
> +
> +static void ipn_null_delport(struct ipn_node *oldport) {}
> +static void ipn_null_postnewport(struct ipn_node *newport) {}
> +static  void ipn_null_predelport(struct ipn_node *oldport) {}
> +static int ipn_null_newnet(struct ipn_network *newnet) {return 0;}
> +static int ipn_null_resizenet(struct ipn_network *net,int oldsize,int newsize) {
> +	return 0;}
> +static void ipn_null_delnet(struct ipn_network *oldnet) {}
> +static int ipn_null_setsockopt(struct ipn_node *port,int optname,
> +		char __user *optval, int optlen) {return -EOPNOTSUPP;}
> +static int ipn_null_getsockopt(struct ipn_node *port,int optname,
> +		char __user *optval, int *optlen) {return -EOPNOTSUPP;}
> +static int ipn_null_ioctl(struct ipn_node *port,unsigned int request,
> +		unsigned long arg) {return -EOPNOTSUPP;}
> +
> +/* Protocol Registration/deregisteration */
> +
> +void ipn_init_protocol(struct ipn_protocol *p)
> +{
> +	if (p->ipn_p_delport == NULL) p->ipn_p_delport=ipn_null_delport;
> +	if (p->ipn_p_postnewport == NULL) p->ipn_p_postnewport=ipn_null_postnewport;
> +	if (p->ipn_p_predelport == NULL) p->ipn_p_predelport=ipn_null_predelport;
> +	if (p->ipn_p_newnet == NULL) p->ipn_p_newnet=ipn_null_newnet;
> +	if (p->ipn_p_resizenet == NULL) p->ipn_p_resizenet=ipn_null_resizenet;
> +	if (p->ipn_p_delnet == NULL) p->ipn_p_delnet=ipn_null_delnet;
> +	if (p->ipn_p_setsockopt == NULL) p->ipn_p_setsockopt=ipn_null_setsockopt;
> +	if (p->ipn_p_getsockopt == NULL) p->ipn_p_getsockopt=ipn_null_getsockopt;
> +	if (p->ipn_p_ioctl == NULL) p->ipn_p_ioctl=ipn_null_ioctl;
> +}
> +
> +int ipn_proto_register(int protocol,struct ipn_protocol *ipn_service)
> +{
> +	int rv=0;
> +	if (ipn_service->ipn_p_newport == NULL ||
> +			ipn_service->ipn_p_handlemsg == NULL)
> +		return -EINVAL;
> +	ipn_init_protocol(ipn_service);
> +	if (down_interruptible(&ipn_glob_mutex)) 
> +		return -ERESTARTSYS;
> +	if (protocol > 1 && protocol <= IPN_MAX_PROTO) {
> +		protocol--;
> +		if (ipn_protocol_table[protocol])
> +			rv= -EEXIST;
> +		else {
> +			ipn_service->refcnt=0;
> +			ipn_protocol_table[protocol]=ipn_service;
> +			printk(KERN_INFO "IPN: Registered protocol %d\n",protocol+1);
> +		}
> +	} else
> +		rv= -EINVAL;
> +	up(&ipn_glob_mutex);
> +	return rv;
> +}
> +
> +int ipn_proto_deregister(int protocol) 
> +{
> +	int rv=0;
> +	if (down_interruptible(&ipn_glob_mutex)) 
> +		return -ERESTARTSYS;
> +	if (protocol > 1 && protocol <= IPN_MAX_PROTO) {
> +		protocol--;
> +		if (ipn_protocol_table[protocol]) {
> +			if (ipn_protocol_table[protocol]->refcnt == 0) {
> +				ipn_protocol_table[protocol]=NULL;
> +				printk(KERN_INFO "IPN: Unregistered protocol %d\n",protocol+1);
> +			} else
> +				rv=-EADDRINUSE;
> +		} else 
> +			rv= -ENOENT;
> +	} else
> +		rv= -EINVAL;
> +	up(&ipn_glob_mutex);
> +	return rv;
> +}
> +
> +/* MAIN SECTION */
> +/* Module constructor/destructor */
> +static struct net_proto_family ipn_family_ops = {
> +	.family = PF_IPN,
> +	.create = ipn_create,
> +	.owner  = THIS_MODULE,
> +};
> +
> +/* IPN constructor */
> +static int ipn_init(void)
> +{
> +	int rc;
> +
> +	ipn_init_protocol(&ipn_bcast);
> +	ipn_network_cache=kmem_cache_create("ipn_network",sizeof(struct ipn_network),0,0,NULL);
> +	if (!ipn_network_cache) {
> +		printk(KERN_CRIT "%s: Cannot create ipn_network SLAB cache!\n",
> +				__FUNCTION__);
> +		rc=-ENOMEM;
> +		goto out;
> +	}
> +
> +	ipn_node_cache=kmem_cache_create("ipn_node",sizeof(struct ipn_node),0,0,NULL);
> +	if (!ipn_node_cache) {
> +		printk(KERN_CRIT "%s: Cannot create ipn_node SLAB cache!\n",
> +				__FUNCTION__);
> +		rc=-ENOMEM;
> +		goto out_net;
> +	}
> +
> +	ipn_msgitem_cache=kmem_cache_create("ipn_msgitem",sizeof(struct msgitem),0,0,NULL);
> +	if (!ipn_msgitem_cache) {
> +		printk(KERN_CRIT "%s: Cannot create ipn_msgitem SLAB cache!\n",
> +				__FUNCTION__);
> +		rc=-ENOMEM;
> +		goto out_net_node;
> +	}
> +
> +	rc=proto_register(&ipn_proto,1);
> +	if (rc != 0) {
> +		printk(KERN_CRIT "%s: Cannot register the protocol!\n",
> +				__FUNCTION__);
> +		goto out_net_node_msg;
> +	}
> +
> +	sock_register(&ipn_family_ops);
> +	ipn_netdev_init();
> +	printk(KERN_INFO "IPN: Virtual Square Project, University of Bologna 2007\n");
> +	return 0;
> +
> +out_net_node_msg:
> +		kmem_cache_destroy(ipn_msgitem_cache);
> +out_net_node:
> +		kmem_cache_destroy(ipn_node_cache);
> +out_net:
> +		kmem_cache_destroy(ipn_network_cache);
> +out:
> +	return rc;
> +}
> +
> +/* IPN destructor */
> +static void ipn_exit(void)
> +{
> +	ipn_netdev_fini();
> +	if (ipn_msgitem_cache)
> +		kmem_cache_destroy(ipn_msgitem_cache);
> +	if (ipn_node_cache)
> +		kmem_cache_destroy(ipn_node_cache);
> +	if (ipn_network_cache)
> +		kmem_cache_destroy(ipn_network_cache);
> +	sock_unregister(PF_IPN);
> +	proto_unregister(&ipn_proto);
> +	printk(KERN_INFO "IPN removed\n");
> +}
> +
> +module_init(ipn_init);
> +module_exit(ipn_exit);
> +
> +EXPORT_SYMBOL_GPL(ipn_proto_register);
> +EXPORT_SYMBOL_GPL(ipn_proto_deregister);
> +EXPORT_SYMBOL_GPL(ipn_proto_sendmsg);
> +EXPORT_SYMBOL_GPL(ipn_proto_oobsendmsg);
> +EXPORT_SYMBOL_GPL(ipn_msgpool_alloc);
> +EXPORT_SYMBOL_GPL(ipn_msgpool_put);
> diff -Naur linux-2.6.24-rc5/net/ipn/ipn_netdev.c linux-2.6.24-rc5-ipn/net/ipn/ipn_netdev.c
> --- linux-2.6.24-rc5/net/ipn/ipn_netdev.c	1970-01-01 01:00:00.000000000 +0100
> +++ linux-2.6.24-rc5-ipn/net/ipn/ipn_netdev.c	2007-12-16 18:53:24.000000000 +0100
> @@ -0,0 +1,276 @@
> +/*
> + * Inter process networking (virtual distributed ethernet) module
> + * Net devices: tap and grab
> + *  (part of the View-OS project: wiki.virtualsquare.org) 
> + *
> + * Copyright (C) 2007   Renzo Davoli (renzo@cs.unibo.it)
> + *
> + *  This program is free software; you can redistribute it and/or modify
> + *  it under the terms of the GNU General Public License as published by
> + *  the Free Software Foundation; either version 2 of the License, or
> + *  (at your option) any later version.
> + *
> + *  Due to this file being licensed under the GPL there is controversy over
> + *  whether this permits you to write a module that #includes this file
> + *  without placing your module under the GPL.  Please consult a lawyer for
> + *  advice before doing this.
> + *
> + * WARNING: THIS CODE IS ALREADY EXPERIMENTAL
> + *
> + */
> +
> +#include <linux/init.h>
> +#include <linux/module.h>
> +#include <linux/socket.h>
> +#include <linux/poll.h>
> +#include <linux/un.h>
> +#include <linux/list.h>
> +#include <linux/mount.h>
> +#include <linux/etherdevice.h>
> +#include <linux/ethtool.h>
> +#include <net/sock.h>
> +#include <net/af_ipn.h>
> +
> +#define DRV_NAME  "ipn"
> +#define DRV_VERSION "0.3"
> +
> +static const struct ethtool_ops ipn_ethtool_ops;
> +
> +struct ipntap {
> +	struct ipn_node *ipn_node;
> +	struct net_device_stats stats;
> +};
> +
> +/* TAP Net device open. */
> +static int ipntap_net_open(struct net_device *dev)
> +{
> +	  netif_start_queue(dev);
> +		  return 0;
> +}
> +
> +/* TAP Net device close. */
> +static int ipntap_net_close(struct net_device *dev)
> +{
> +	  netif_stop_queue(dev);
> +		  return 0;
> +}
> +
> +static struct net_device_stats *ipntap_net_stats(struct net_device *dev)
> +{
> +	struct ipntap *ipntap = netdev_priv(dev);
> +	return &ipntap->stats;
> +}
> +
> +/* receive from a TAP */
> +static int ipn_net_xmit(struct sk_buff *skb, struct net_device *dev)
> +{
> +	struct ipntap *ipntap = netdev_priv(dev);
> +	struct ipn_node *ipn_node=ipntap->ipn_node;
> +	struct msgpool_item *newmsg;
> +	if (!ipn_node || !ipn_node->ipn || skb->len > ipn_node->ipn->mtu)
> +		goto drop;
> +	newmsg=ipn_msgpool_alloc(ipn_node->ipn);
> +	if (!newmsg)
> +		goto drop;
> +	newmsg->len=skb->len;
> +	memcpy(newmsg->data,skb->data,skb->len);
> +	ipn_proto_injectmsg(ipntap->ipn_node,newmsg);
> +	ipn_msgpool_put(newmsg,ipn_node->ipn);
> +	ipntap->stats.tx_packets++;
> +	ipntap->stats.tx_bytes += skb->len;
> +	kfree_skb(skb);
> +	return 0;
> +
> +drop:
> +	ipntap->stats.tx_dropped++;
> +	kfree_skb(skb);
> +	return 0;
> +}
> +
> +/* receive from a GRAB via interface hook */
> +struct sk_buff *ipn_handle_hook(struct ipn_node *ipn_node, struct sk_buff *skb)
> +{
> +	char *data=(skb->data)-(skb->mac_len);
> +	int len=skb->len+skb->mac_len;
> +
> +	if (ipn_node && 
> +			((ipn_node->flags & IPN_NODEFLAG_DEVMASK) == IPN_NODEFLAG_GRAB) &&
> +			ipn_node->ipn && len<=ipn_node->ipn->mtu) {
> +		struct msgpool_item *newmsg;
> +		newmsg=ipn_msgpool_alloc(ipn_node->ipn);
> +		if (newmsg) {
> +			newmsg->len=len;
> +			memcpy(newmsg->data,data,len);
> +			ipn_proto_injectmsg(ipn_node,newmsg);
> +			ipn_msgpool_put(newmsg,ipn_node->ipn);
> +		}
> +	}
> +
> +	return (skb);
> +}
> +
> +static void ipntap_setup(struct net_device *dev)
> +{
> +	dev->open = ipntap_net_open;
> +	dev->hard_start_xmit = ipn_net_xmit;
> +	dev->stop = ipntap_net_close;
> +	dev->get_stats = ipntap_net_stats;
> +	dev->ethtool_ops = &ipn_ethtool_ops;
> +}
> +
> +
> +struct net_device *ipn_netdev_alloc(struct net *net,int type, char *name, int *err)
> +{
> +	struct net_device *dev=NULL;
> +	*err=0;
> +	if (!name || *name==0) 
> +		name="ipn%d";
> +	switch (type) {
> +		case IPN_NODEFLAG_TAP:
> +			dev=alloc_netdev(sizeof(struct ipntap), name, ipntap_setup);
> +			if (!dev)
> +				*err= -ENOMEM;
> +			ether_setup(dev);
> +			/* this commented code is similar to tuntap MAC assignment.
> +			 * why tuntap does not use the random_ether_addr? 
> +			*(u16 *)dev->dev_addr = htons(0x00FF);
> +			get_random_bytes(dev->dev_addr + sizeof(u16), 4);*/
> +			random_ether_addr((u8 *)&dev->dev_addr);
> +			break;
> +		case IPN_NODEFLAG_GRAB:
> +			dev=dev_get_by_name(net,name);
> +			if (dev) {
> +				if (dev->flags & IFF_LOOPBACK)
> +					*err= -EINVAL;
> +				else if (rcu_dereference(dev->ipn_port) != NULL)

This one requires either rcu_read_lock() or the update-side lock.  In
theory, you omit rcu_dereference() given that you are only comparing to
NULL, but readability is greatly enhanced by marking the access anyway.

That is, assuming that you are actually using RCU here (I don't see any
sign of rcu_read_lock() or similar primitive, so I have doubts).

> +					*err= -EBUSY;
> +				if (*err)
> +					dev=NULL;
> +			}
> +			break;
> +	}
> +	return dev;
> +}
> +
> +int ipn_netdev_activate(struct ipn_node *ipn_node)
> +{
> +	int rv=-EINVAL;
> +	switch (ipn_node->flags & IPN_NODEFLAG_DEVMASK) {
> +		case IPN_NODEFLAG_TAP:
> +			{
> +				struct ipntap *ipntap=netdev_priv(ipn_node->dev);
> +				ipntap->ipn_node=ipn_node;
> +				rtnl_lock(); 
> +				if ((rv=register_netdevice(ipn_node->dev)) == 0)
> +					rcu_assign_pointer(ipn_node->dev->ipn_port, ipn_node);

Does rtnl_lock() imply the ipnn_mutex?  If not, does the caller acquire
ipnn_mutex?  Or do the other rcu_assign_pointer() calls that assign to
ipnn_port also hold RTNL?

> +				rtnl_unlock();
> +				if (rv) {/* error! */
> +					ipn_node->flags &= ~IPN_NODEFLAG_DEVMASK;
> +					free_netdev(ipn_node->dev);
> +				}
> +			}
> +			break;
> +		case IPN_NODEFLAG_GRAB:
> +			rtnl_lock(); 
> +			rcu_assign_pointer(ipn_node->dev->ipn_port, ipn_node);

Ditto.

> +			dev_set_promiscuity(ipn_node->dev,1);
> +			rtnl_unlock();
> +			rv=0;
> +			break;
> +	}
> +	return rv;
> +}
> +
> +void ipn_netdev_close(struct ipn_node *ipn_node)
> +{
> +	switch (ipn_node->flags & IPN_NODEFLAG_DEVMASK) {
> +		case IPN_NODEFLAG_TAP:
> +			ipn_node->flags &= ~IPN_NODEFLAG_DEVMASK;
> +			rtnl_lock(); 
> +			unregister_netdevice(ipn_node->dev);
> +			rtnl_unlock();
> +			free_netdev(ipn_node->dev);
> +			break;
> +		case IPN_NODEFLAG_GRAB:
> +			ipn_node->flags &= ~IPN_NODEFLAG_DEVMASK;
> +			rtnl_lock(); 
> +			rcu_assign_pointer(ipn_node->dev->ipn_port, NULL);

Ditto.

> +			dev_set_promiscuity(ipn_node->dev,-1);
> +			rtnl_unlock();
> +			break;
> +	}
> +}
> +
> +void ipn_netdev_sendmsg(struct ipn_node *to,struct msgpool_item *msg)
> +{
> +	struct sk_buff *skb;
> +	struct net_device *dev=to->dev;
> +	struct ipntap *ipntap=netdev_priv(dev);
> +	
> +	if (msg->len > dev->mtu)
> +		return;
> +	skb=alloc_skb(msg->len+NET_IP_ALIGN,GFP_KERNEL);
> +	if (!skb) {
> +		ipntap->stats.rx_dropped++;
> +		return;
> +	}
> +	memcpy(skb_put(skb,msg->len),msg->data,msg->len);
> +	switch (to->flags & IPN_NODEFLAG_DEVMASK) {
> +		case IPN_NODEFLAG_TAP:
> +			skb->protocol = eth_type_trans(skb, dev);
> +			netif_rx(skb);
> +			ipntap->stats.rx_packets++;
> +			ipntap->stats.rx_bytes += msg->len;
> +			break;
> +		case IPN_NODEFLAG_GRAB:
> +			skb->dev = dev;
> +			dev_queue_xmit(skb);
> +			break;
> +	}
> +}
> +
> +/* ethtool interface */
> +
> +static int ipn_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
> +{
> +	cmd->supported    = 0;
> +	cmd->advertising  = 0;
> +	cmd->speed    = SPEED_10;
> +	cmd->duplex   = DUPLEX_FULL;
> +	cmd->port   = PORT_TP;
> +	cmd->phy_address  = 0;
> +	cmd->transceiver  = XCVR_INTERNAL;
> +	cmd->autoneg    = AUTONEG_DISABLE;
> +	cmd->maxtxpkt   = 0;
> +	cmd->maxrxpkt   = 0;
> +	return 0;
> +}
> +
> +static void ipn_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
> +{
> +	strcpy(info->driver, DRV_NAME);
> +	strcpy(info->version, DRV_VERSION);
> +	strcpy(info->fw_version, "N/A");
> +}
> +
> +static const struct ethtool_ops ipn_ethtool_ops = {
> +	.get_settings = ipn_get_settings,
> +	.get_drvinfo  = ipn_get_drvinfo,
> +	/* not implemented (yet?)
> +	.get_msglevel = ipn_get_msglevel,
> +	.set_msglevel = ipn_set_msglevel,
> +	.get_link = ipn_get_link,
> +	.get_rx_csum  = ipn_get_rx_csum,
> +	.set_rx_csum  = ipn_set_rx_csum */
> +};
> +
> +int ipn_netdev_init(void)
> +{
> +	ipn_handle_frame_hook=ipn_handle_hook;
> +	return 0;
> +}
> +
> +void ipn_netdev_fini(void)
> +{
> +	ipn_handle_frame_hook=NULL;
> +}
> diff -Naur linux-2.6.24-rc5/net/ipn/ipn_netdev.h linux-2.6.24-rc5-ipn/net/ipn/ipn_netdev.h
> --- linux-2.6.24-rc5/net/ipn/ipn_netdev.h	1970-01-01 01:00:00.000000000 +0100
> +++ linux-2.6.24-rc5-ipn/net/ipn/ipn_netdev.h	2007-12-16 16:30:04.000000000 +0100
> @@ -0,0 +1,47 @@
> +#ifndef _IPN_NETDEV_H
> +#define _IPN_NETDEV_H
> +/*
> + * Inter process networking (virtual distributed ethernet) module
> + * Net devices: tap and grab
> + *  (part of the View-OS project: wiki.virtualsquare.org) 
> + *
> + * Copyright (C) 2007   Renzo Davoli (renzo@cs.unibo.it)
> + *
> + *  This program is free software; you can redistribute it and/or modify
> + *  it under the terms of the GNU General Public License as published by
> + *  the Free Software Foundation; either version 2 of the License, or
> + *  (at your option) any later version.
> + *
> + *  Due to this file being licensed under the GPL there is controversy over
> + *  whether this permits you to write a module that #includes this file
> + *  without placing your module under the GPL.  Please consult a lawyer for
> + *  advice before doing this.
> + *
> + * WARNING: THIS CODE IS ALREADY EXPERIMENTAL
> + *
> + */
> +
> +#include <linux/init.h>
> +#include <linux/module.h>
> +#include <linux/socket.h>
> +#include <linux/poll.h>
> +#include <linux/un.h>
> +#include <linux/list.h>
> +#include <linux/mount.h>
> +#include <linux/etherdevice.h>
> +#include <linux/if_bridge.h>
> +#include <net/sock.h>
> +#include <net/af_ipn.h>
> +
> +struct net_device *ipn_netdev_alloc(struct net *net,int type, char *name, int *err);
> +int ipn_netdev_activate(struct ipn_node *ipn_node);
> +void ipn_netdev_close(struct ipn_node *ipn_node);
> +void ipn_netdev_sendmsg(struct ipn_node *to,struct msgpool_item *msg);
> +int ipn_netdev_init(void);
> +void ipn_netdev_fini(void);
> +
> +inline struct ipn_node *ipn_netdev2node(struct net_device *dev)
> +{
> +	return rcu_dereference(dev->ipn_port);

This call seems to always be protected by ipnn_mutex.  So the
rcu_dereference() is OK, but not absolutely required.

> +}
> +#endif
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: After many hours all outbound connections get stuck in SYN_SENT
From: James Nichols @ 2007-12-17 16:27 UTC (permalink / raw)
  To: netdev
In-Reply-To: <83a51e120712160834r29112fb0xa1f61c35f180bf8f@mail.gmail.com>

Here is some additional information about this problem as requested.
I ran ss -m, but no data was returned, what options should I use with
ss to gather relevant information?

The output of netstat -s:

Ip:
    1346453452 total packets received
    0 forwarded
    0 incoming packets discarded
    1345744076 incoming packets delivered
    1338284375 requests sent out
    50 reassemblies required
    15 packets reassembled ok
    15 fragments received ok
    50 fragments created
Icmp:
    431 ICMP messages received
    0 input ICMP message failed.
    ICMP input histogram:
        destination unreachable: 42
        echo requests: 6
        echo replies: 377
        timestamp request: 2
        address mask request: 2
    747 ICMP messages sent
    0 ICMP messages failed
    ICMP output histogram:
        destination unreachable: 739
        echo replies: 6
        timestamp replies: 2
Tcp:
    13115640 active connections openings
    1291131 passive connection openings
    381803 failed connection attempts
    6445 connection resets received
    148 connections established
    1339571927 segments received
    1330375560 segments send out
    2443951 segments retransmited
    345 bad segments received.
    61292 resets sent
Udp:
    5608790 packets received
    725 packets to unknown port received.
    0 packet receive errors
    5609766 packets sent
TcpExt:
    1916 resets received for embryonic SYN_RECV sockets
    1290 packets pruned from receive queue because of socket buffer overrun
    1250631 TCP sockets finished time wait in fast timer
    43568 time wait sockets recycled by time stamp
    16323 active connections rejected because of time stamp
    262 packets rejects in established connections because of timestamp
    18505058 delayed acks sent
    3931 delayed acks further delayed because of locked socket
    Quick ack mode was activated 434830 times
    1902 times the listen queue of a socket overflowed
    1902 SYNs to LISTEN sockets ignored
    1068352581 packets directly queued to recvmsg prequeue.
    92424765 packets directly received from backlog
    800659035 packets directly received from prequeue
    1158417138 packets header predicted
    2223869 packets header predicted and directly queued to user
    22256941 acknowledgments not containing data received
    1109445014 predicted acknowledgments
    96 times recovered from packet loss due to fast retransmit
    325 times recovered from packet loss due to SACK data
    1 bad SACKs received
    Detected reordering 8 times using FACK
    Detected reordering 7 times using time stamp
    21 congestion windows fully recovered
    29 congestion windows partially recovered using Hoe heuristic
    452978 congestion windows recovered after partial ack
    97 TCP data loss events
    2269 timeouts after reno fast retransmit
    144 timeouts after SACK recovery
    12690 timeouts in loss state
    731 fast retransmits
    70 forward retransmits
    38188 retransmits in slow start
    959183 other TCP timeouts
    TCPRenoRecoveryFail: 67
    38 sack retransmits failed
    42 times receiver scheduled too late for direct processing
    75627 packets collapsed in receive queue due to low socket buffer
    6003 DSACKs sent for old packets
    13 DSACKs sent for out of order packets
    136 DSACKs received
    4038 connections reset due to unexpected data
    557 connections reset due to early user close
    319219 connections aborted due to timeout






On 12/16/07, James Nichols <jamesnichols3@gmail.com> wrote:
> Hello,
>
> I have a Java application that makes a large number of outbound
> webservice calls over HTTP/TCP.  The hosts contacted are a fixed set
> of about 2000 hosts and a web service call is made to each of them
> approximately every 5 mintues by a pool of 200 Java threads.  Over
> time, on average a percentage of these hosts are unreachable for one
> reason or another, usually because they are on wireless cell phone
> NICs, so there is a persistent count of sockets in the SYN_SENT state
> in the range of about 60-80.  This is fine, as these failed connection
> attempts eventually time out.
>
> However, after approximately 38 hours of operation, all outbound
> connection attempts get stuck in the SYN_SENT state.  It happens
> instantaneously, where I go from the baseline of about 60-80 sockets
> in SYN_SENT to a count of 200 (corresponding to the # of java threads
> that make these calls).
>
> When I stop and start the Java application, all the new outbound
> connections still get stuck in SYN_SENT state.  During this time, I am
> still able to SSH to the box and run wget to Google, cnn, etc, so the
> problem appears to be specific to the hosts that I'm accessing via the
> webservices.
>
> For a long time, the only thing that would resolve this was rebooting
> the entire machine.  Once I did this, the outbound connections could
> be made succesfully.  However, very recently when I had once of these
> incidents I disabled tcp_sack via:
>
> echo "0" > /proc/sys/net/ipv4/tcp_sack
>
> And the problem almost instanteaously resolved itself and outbound
> connection attempts were succesful.  I hadn't attempted this before
> because I assumed that if any of my network
> equipment or remote hosts had a problem with SACK, that it would never
> work.  In my case, it worked fine for about 38 hours before hitting a
> wall where no outbound connections could be made.
>
> I'm running kernel 2.6.18 on RedHat, but have had this problem occur
> on earlier kernel versions (all 2.4 and 2.6).  I know a lot of people
> will say it must be the firewall, but I've seen had this issue on
> different router vendors, firewall vendors, different co-location
> facilities, NICs, and several other variables.  I've totaly rebuilt
> every piece of the archtiecture at one time or another and still see
> this issue.  I've had this problem to varying degrees of severity for
> the past 4 years or so.  Up until this point, the only thing other
> than a complete machine restart that fixes the problem is disabling
> tcp_sack.  When I disable it, the problem goes away almost
> instantaneously.
>
> Is there a kernel buffer or some data structure that tcp_sack uses
> that gets filled up after an extended period of operation?
> How can I debug this problem in the kernel to find out what the root cause is?
>
> I emailed linux-kernel and they asked for output of netstat -s, I can
> get this the next
> time it occurs- any other usefull data to collect?
>
> I've temporarily signed up on this list, but may cancel signup if I can't
> handle the traffic, so please CC me directly on any replies.
>
> Thanks,
>
> James Nichols
>

^ permalink raw reply

* Re: [PATCH] bridge: assign random address
From: Stephen Hemminger @ 2007-12-17 16:56 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Miller, netdev, bugme-daemon, berrange, jeff, herbert, rjw
In-Reply-To: <20071216142915.c120d25c.akpm@linux-foundation.org>

On Sun, 16 Dec 2007 14:29:15 -0800
Andrew Morton <akpm@linux-foundation.org> wrote:

> On Sun, 16 Dec 2007 13:37:17 -0800 (PST) David Miller <davem@davemloft.net> wrote:
> 
> > From: Stephen Hemminger <shemminger@linux-foundation.org>
> > Date: Tue, 11 Dec 2007 15:48:35 -0800
> > 
> > > Subject: Re: [PATCH] bridge: assign random address
> > 
> > "bridge" should all-caps and in brackets,
> 
> No, "bridge" should not be in [].  Lots of people's patch-receiving scripts
> assume that any text in [] is to be removed as the patch is committed.  It
> contains text which is only relevant to the particular email which carried
> the patch.  Stuff like "patch" and "4/5" and "linux-2.6.23", etc.
> 
> > "assign random address"
> > should be capitalized like a proper english sentence with a period at
> > the end.
> 
> Actually I usually remove the caps and the waste-of-space period, but
> that's much less important than the brackets abuse.  The bracket convention
> is quite useful and I've often wondered why I need to edit the patch title
> when I merge up patches from net developers ;)
> 

I try to follow the title convention that Jeff was promoting.

It works well because he is dealing with many different drivers.


-- 
Stephen Hemminger <shemminger@linux-foundation.org>

^ permalink raw reply

* Re: init_timer_deferrable conversion
From: Stephen Hemminger @ 2007-12-17 17:00 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: parag.warudkar@gmail.com, linux-kernel, David Miller,
	netdev@vger.kernel.org
In-Reply-To: <20071217152943.10470215.dada1@cosmosbay.com>

On Mon, 17 Dec 2007 15:29:43 +0100
Eric Dumazet <dada1@cosmosbay.com> wrote:

> On Mon, 17 Dec 2007 09:55:04 +0100
> Eric Dumazet <dada1@cosmosbay.com> wrote:
> 
> > On Sun, 16 Dec 2007 22:00:23 -0500 (EST)
> > Parag Warudkar <parag.warudkar@gmail.com> wrote:
> > 
> > > In my quest to get the wake-ups from idle per second down to bare minimum, 
> > > I noticed 3 places in the kernel that could benefit from 
> > > using init_timer_deferrable() instead of init_timer() -
> > > 
> > > a) drivers/net/sky2.c - watchdog_timer. This was showing up high on 
> > > Powertop's list of things that cause routine wakeups from idle. After 
> > > converting to init_timer_deferrable() the wakeups went down and this one 
> > > no longer shows up in powertop's list. 25% reduction.

This surprises me because it is a 1 hz timer and uses round_jiffies() in
the current kernel.



-- 
Stephen Hemminger <shemminger@linux-foundation.org>

^ permalink raw reply

* Re: init_timer_deferrable conversion
From: Parag Warudkar @ 2007-12-17 17:47 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Eric Dumazet, linux-kernel, David Miller, netdev@vger.kernel.org
In-Reply-To: <20071217090000.64499fba@deepthought>

On Dec 17, 2007 12:00 PM, Stephen Hemminger
<shemminger@linux-foundation.org> wrote:
> > > >
> > > > a) drivers/net/sky2.c - watchdog_timer. This was showing up high on
> > > > Powertop's list of things that cause routine wakeups from idle. After
> > > > converting to init_timer_deferrable() the wakeups went down and this one
> > > > no longer shows up in powertop's list. 25% reduction.
>
> This surprises me because it is a 1 hz timer and uses round_jiffies() in
> the current kernel.

I am using the current git and I already have low wakeups per second
to begin with - 5-7  and out of that 25% are attributed to sky2. Not
sure if that matches up with the 1 hz + round_jiffies() logic.

But is it conceptually ok to make this deferrable? I suppose yes as
it's just a watchdog that checks if the link is up and delaying that
would not make a difference?

Thanks
Parag

^ permalink raw reply

* Re: "ip neigh show" not showing arp cache entries?
From: Patrick McHardy @ 2007-12-17 18:02 UTC (permalink / raw)
  To: Chris Friesen; +Cc: yoshfuji, dada1, netdev, linux-kernel
In-Reply-To: <476696A5.1010101@nortel.com>

Chris Friesen wrote:
> The original "ip" command and the new one ("/tmp/ip") both give the same 
> results--some of the entries are missing.
> 
> root@typhoon-base-unit0:/root> ip neigh show all
> 172.24.137.0 dev bond0  FAILED
> 172.24.0.9 dev bond0 lladdr 00:07:e9:41:4b:b4 REACHABLE
> 10.41.18.101 dev eth6 lladdr 00:0e:0c:5e:95:bd REACHABLE
> 172.24.0.11 dev bond0 lladdr 00:03:cc:51:06:5e STALE
> 172.24.132.1 dev bond0 lladdr 00:01:af:14:e9:88 REACHABLE
> 172.24.0.15 dev bond0 lladdr 00:0e:0c:85:fd:d2 STALE
> 172.24.0.3 dev bond0 lladdr 00:01:af:14:c8:cc REACHABLE
> 172.24.0.5 dev bond0 lladdr 00:01:af:15:e0:6a STALE
> 
> root@typhoon-base-unit0:/root> /tmp/ip neigh show all
> 172.24.137.0 dev bond0  FAILED
> 172.24.0.9 dev bond0 lladdr 00:07:e9:41:4b:b4 REACHABLE
> 10.41.18.101 dev eth6 lladdr 00:0e:0c:5e:95:bd REACHABLE
> 172.24.0.11 dev bond0 lladdr 00:03:cc:51:06:5e STALE
> 172.24.132.1 dev bond0 lladdr 00:01:af:14:e9:88 REACHABLE
> 172.24.0.15 dev bond0 lladdr 00:0e:0c:85:fd:d2 STALE
> 172.24.0.3 dev bond0 lladdr 00:01:af:14:c8:cc REACHABLE
> 172.24.0.5 dev bond0 lladdr 00:01:af:15:e0:6a STALE
> 
> 
> However, if I specifically try to print out one of the missing entries, 
> it shows up:
> 
> root@typhoon-base-unit0:/root> /tmp/ip neigh show 192.168.24.81
> 192.168.24.81 dev bond2 lladdr 00:01:af:14:e9:8a REACHABLE


 From a kernel perspective there are only complete dumps, the
filtering is done by iproute. So the fact that it shows them
when querying specifically implies there is a bug in the
iproute neighbour filter. Does it work if you omit "all"
from the ip neigh show command?

^ permalink raw reply

* [PATCH 2.6.25 1/2]S2io: Fixes to enable multiple transmit fifo support
From: Ramkrishna Vepa @ 2007-12-17 19:35 UTC (permalink / raw)
  To: netdev, jgarzik; +Cc: support

Fixes to enable multiple transmit fifos (upto a maximum of eight).
  - Moved single tx_lock from struct s2io_nic to struct fifo_info.
  - Moved single ufo_in_band_v structure from struct s2io_nic to struct 
    fifo_info.
  - Assign the respective interrupt number for the transmitting fifo in the 
    transmit descriptor (TXD).
- Added boundary checks for number of FIFOs enabled and FIFO length.

Signed-off-by: Surjit Reang <surjit.reang@neterion.com>
Signed-off-by: Sreenivasa Honnur <sreenivasa.honnur@neterion.com>
Signed-off-by: Ramkrishna Vepa <ram.vepa@neterion.com>
---
diff -Nurp 2-0-26-10/drivers/net/s2io.c 2-0-26-15-1/drivers/net/s2io.c
--- 2-0-26-10/drivers/net/s2io.c	2007-12-17 22:09:00.000000000 +0530
+++ 2-0-26-15-1/drivers/net/s2io.c	2007-12-17 22:10:50.000000000 +0530
@@ -84,7 +84,7 @@
 #include "s2io.h"
 #include "s2io-regs.h"
 
-#define DRV_VERSION "2.0.26.10"
+#define DRV_VERSION "2.0.26.15-1"
 
 /* S2io Driver name & version. */
 static char s2io_driver_name[] = "Neterion";
@@ -368,12 +368,19 @@ static void do_s2io_copy_mac_addr(struct
 static void s2io_vlan_rx_register(struct net_device *dev,
 					struct vlan_group *grp)
 {
+	int i;
 	struct s2io_nic *nic = dev->priv;
-	unsigned long flags;
+	unsigned long flags[MAX_TX_FIFOS];
+	struct mac_info *mac_control = &nic->mac_control;
+	struct config_param *config = &nic->config;
+
+	for (i = 0; i < config->tx_fifo_num; i++)
+		spin_lock_irqsave(&mac_control->fifos[i].tx_lock, flags[i]);
 
-	spin_lock_irqsave(&nic->tx_lock, flags);
 	nic->vlgrp = grp;
-	spin_unlock_irqrestore(&nic->tx_lock, flags);
+	for (i = config->tx_fifo_num - 1; i >= 0; i--)
+		spin_unlock_irqrestore(&mac_control->fifos[i].tx_lock,
+				flags[i]);
 }
 
 /* A flag indicating whether 'RX_PA_CFG_STRIP_VLAN_TAG' bit is set or not */
@@ -565,6 +572,21 @@ static int init_shared_mem(struct s2io_n
 		return -EINVAL;
 	}
 
+	size = 0;
+	for (i = 0; i < config->tx_fifo_num; i++) {
+		size = config->tx_cfg[i].fifo_len;
+		/*
+		 * Legal values are from 2 to 8192
+		 */
+		if (size < 2) {
+			DBG_PRINT(ERR_DBG, "s2io: Invalid fifo len (%d)", size);
+			DBG_PRINT(ERR_DBG, "for fifo %d\n", i);
+			DBG_PRINT(ERR_DBG, "s2io: Legal values for fifo len"
+				"are 2 to 8192\n");
+			return -EINVAL;
+		}
+	}
+
 	lst_size = (sizeof(struct TxD) * config->max_txds);
 	lst_per_page = PAGE_SIZE / lst_size;
 
@@ -639,10 +661,14 @@ static int init_shared_mem(struct s2io_n
 		}
 	}
 
-	nic->ufo_in_band_v = kcalloc(size, sizeof(u64), GFP_KERNEL);
-	if (!nic->ufo_in_band_v)
-		return -ENOMEM;
-	 mem_allocated += (size * sizeof(u64));
+	for (i = 0; i < config->tx_fifo_num; i++) {
+		size = config->tx_cfg[i].fifo_len;
+		mac_control->fifos[i].ufo_in_band_v
+			= kcalloc(size, sizeof(u64), GFP_KERNEL);
+		if (!mac_control->fifos[i].ufo_in_band_v)
+			return -ENOMEM;
+		mem_allocated += (size * sizeof(u64));
+	}
 
 	/* Allocation and initialization of RXDs in Rings */
 	size = 0;
@@ -829,7 +855,6 @@ static int init_shared_mem(struct s2io_n
 static void free_shared_mem(struct s2io_nic *nic)
 {
 	int i, j, blk_cnt, size;
-	u32 ufo_size = 0;
 	void *tmp_v_addr;
 	dma_addr_t tmp_p_addr;
 	struct mac_info *mac_control;
@@ -850,7 +875,6 @@ static void free_shared_mem(struct s2io_
 	lst_per_page = PAGE_SIZE / lst_size;
 
 	for (i = 0; i < config->tx_fifo_num; i++) {
-		ufo_size += config->tx_cfg[i].fifo_len;
 		page_num = TXD_MEM_PAGE_CNT(config->tx_cfg[i].fifo_len,
 							lst_per_page);
 		for (j = 0; j < page_num; j++) {
@@ -940,18 +964,21 @@ static void free_shared_mem(struct s2io_
 		}
 	}
 
+	for (i = 0; i < nic->config.tx_fifo_num; i++) {
+		if (mac_control->fifos[i].ufo_in_band_v) {
+			nic->mac_control.stats_info->sw_stat.mem_freed
+				+= (config->tx_cfg[i].fifo_len * sizeof(u64));
+			kfree(mac_control->fifos[i].ufo_in_band_v);
+		}
+	}
+
 	if (mac_control->stats_mem) {
+		nic->mac_control.stats_info->sw_stat.mem_freed +=
+			mac_control->stats_mem_sz;
 		pci_free_consistent(nic->pdev,
 				    mac_control->stats_mem_sz,
 				    mac_control->stats_mem,
 				    mac_control->stats_mem_phy);
-		nic->mac_control.stats_info->sw_stat.mem_freed +=
-			mac_control->stats_mem_sz;
-	}
-	if (nic->ufo_in_band_v) {
-		kfree(nic->ufo_in_band_v);
-		nic->mac_control.stats_info->sw_stat.mem_freed
-			+= (ufo_size * sizeof(u64));
 	}
 }
 
@@ -2241,7 +2268,7 @@ static struct sk_buff *s2io_txdl_getskb(
 	u16 j, frg_cnt;
 
 	txds = txdlp;
-	if (txds->Host_Control == (u64)(long)nic->ufo_in_band_v) {
+	if (txds->Host_Control == (u64)(long)fifo_data->ufo_in_band_v) {
 		pci_unmap_single(nic->pdev, (dma_addr_t)
 			txds->Buffer_Pointer, sizeof(u64),
 			PCI_DMA_TODEVICE);
@@ -2296,6 +2323,8 @@ static void free_tx_buffers(struct s2io_
 	config = &nic->config;
 
 	for (i = 0; i < config->tx_fifo_num; i++) {
+		unsigned long flags;
+		spin_lock_irqsave(&mac_control->fifos[i].tx_lock, flags);
 		for (j = 0; j < config->tx_cfg[i].fifo_len - 1; j++) {
 			txdp = (struct TxD *) \
 			mac_control->fifos[i].list_info[j].list_virt_addr;
@@ -2312,6 +2341,7 @@ static void free_tx_buffers(struct s2io_
 			  dev->name, cnt, i);
 		mac_control->fifos[i].tx_curr_get_info.offset = 0;
 		mac_control->fifos[i].tx_curr_put_info.offset = 0;
+		spin_unlock_irqrestore(&mac_control->fifos[i].tx_lock, flags);
 	}
 }
 
@@ -2935,8 +2965,12 @@ static void tx_intr_handler(struct fifo_
 	struct tx_curr_get_info get_info, put_info;
 	struct sk_buff *skb;
 	struct TxD *txdlp;
+	unsigned long flags = 0;
 	u8 err_mask;
 
+	if (!spin_trylock_irqsave(&fifo_data->tx_lock, flags))
+			return;
+
 	get_info = fifo_data->tx_curr_get_info;
 	memcpy(&put_info, &fifo_data->tx_curr_put_info, sizeof(put_info));
 	txdlp = (struct TxD *) fifo_data->list_info[get_info.offset].
@@ -2985,6 +3019,7 @@ static void tx_intr_handler(struct fifo_
 
 		skb = s2io_txdl_getskb(fifo_data, txdlp, get_info.offset);
 		if (skb == NULL) {
+			spin_unlock_irqrestore(&fifo_data->tx_lock, flags);
 			DBG_PRINT(ERR_DBG, "%s: Null skb ",
 			__FUNCTION__);
 			DBG_PRINT(ERR_DBG, "in Tx Free Intr\n");
@@ -3005,10 +3040,10 @@ static void tx_intr_handler(struct fifo_
 		    get_info.offset;
 	}
 
-	spin_lock(&nic->tx_lock);
 	if (netif_queue_stopped(dev))
 		netif_wake_queue(dev);
-	spin_unlock(&nic->tx_lock);
+
+	spin_unlock_irqrestore(&fifo_data->tx_lock, flags);
 }
 
 /**
@@ -3972,9 +4007,10 @@ static int s2io_xmit(struct sk_buff *skb
 	register u64 val64;
 	struct TxD *txdp;
 	struct TxFIFO_element __iomem *tx_fifo;
-	unsigned long flags;
+	unsigned long flags = 0;
 	u16 vlan_tag = 0;
 	int vlan_priority = 0;
+	struct fifo_info *fifo = NULL;
 	struct mac_info *mac_control;
 	struct config_param *config;
 	int offload_type;
@@ -3989,13 +4025,11 @@ static int s2io_xmit(struct sk_buff *skb
 		DBG_PRINT(TX_DBG, "%s:Buffer has no data..\n", dev->name);
 		dev_kfree_skb_any(skb);
 		return 0;
-}
+	}
 
-	spin_lock_irqsave(&sp->tx_lock, flags);
 	if (!is_s2io_card_up(sp)) {
 		DBG_PRINT(TX_DBG, "%s: Card going down for reset\n",
 			  dev->name);
-		spin_unlock_irqrestore(&sp->tx_lock, flags);
 		dev_kfree_skb(skb);
 		return 0;
 	}
@@ -4008,19 +4042,20 @@ static int s2io_xmit(struct sk_buff *skb
 		queue = config->fifo_mapping[vlan_priority];
 	}
 
-	put_off = (u16) mac_control->fifos[queue].tx_curr_put_info.offset;
-	get_off = (u16) mac_control->fifos[queue].tx_curr_get_info.offset;
-	txdp = (struct TxD *) mac_control->fifos[queue].list_info[put_off].
-		list_virt_addr;
+	fifo = &mac_control->fifos[queue];
+	spin_lock_irqsave(&fifo->tx_lock, flags);
+	put_off = (u16) fifo->tx_curr_put_info.offset;
+	get_off = (u16) fifo->tx_curr_get_info.offset;
+	txdp = (struct TxD *) fifo->list_info[put_off].list_virt_addr;
 
-	queue_len = mac_control->fifos[queue].tx_curr_put_info.fifo_len + 1;
+	queue_len = fifo->tx_curr_put_info.fifo_len + 1;
 	/* Avoid "put" pointer going beyond "get" pointer */
 	if (txdp->Host_Control ||
 		   ((put_off+1) == queue_len ? 0 : (put_off+1)) == get_off) {
 		DBG_PRINT(TX_DBG, "Error in xmit, No free TXDs.\n");
 		netif_stop_queue(dev);
 		dev_kfree_skb(skb);
-		spin_unlock_irqrestore(&sp->tx_lock, flags);
+		spin_unlock_irqrestore(&fifo->tx_lock, flags);
 		return 0;
 	}
 
@@ -4036,7 +4071,7 @@ static int s2io_xmit(struct sk_buff *skb
 	}
 	txdp->Control_1 |= TXD_GATHER_CODE_FIRST;
 	txdp->Control_1 |= TXD_LIST_OWN_XENA;
-	txdp->Control_2 |= config->tx_intr_type;
+	txdp->Control_2 |= TXD_INT_NUMBER(fifo->fifo_no);
 
 	if (sp->vlgrp && vlan_tx_tag_present(skb)) {
 		txdp->Control_2 |= TXD_VLAN_ENABLE;
@@ -4053,15 +4088,15 @@ static int s2io_xmit(struct sk_buff *skb
 		txdp->Control_1 |= TXD_UFO_MSS(ufo_size);
 		txdp->Control_1 |= TXD_BUFFER0_SIZE(8);
 #ifdef __BIG_ENDIAN
-		sp->ufo_in_band_v[put_off] =
+		fifo->ufo_in_band_v[put_off] =
 				(u64)skb_shinfo(skb)->ip6_frag_id;
 #else
-		sp->ufo_in_band_v[put_off] =
+		fifo->ufo_in_band_v[put_off] =
 				(u64)skb_shinfo(skb)->ip6_frag_id << 32;
 #endif
-		txdp->Host_Control = (unsigned long)sp->ufo_in_band_v;
+		txdp->Host_Control = (unsigned long)fifo->ufo_in_band_v;
 		txdp->Buffer_Pointer = pci_map_single(sp->pdev,
-					sp->ufo_in_band_v,
+					fifo->ufo_in_band_v,
 					sizeof(u64), PCI_DMA_TODEVICE);
 		if((txdp->Buffer_Pointer == 0) ||
 			(txdp->Buffer_Pointer == DMA_ERROR_CODE))
@@ -4101,7 +4136,7 @@ static int s2io_xmit(struct sk_buff *skb
 		frg_cnt++; /* as Txd0 was used for inband header */
 
 	tx_fifo = mac_control->tx_FIFO_start[queue];
-	val64 = mac_control->fifos[queue].list_info[put_off].list_phy_addr;
+	val64 = fifo->list_info[put_off].list_phy_addr;
 	writeq(val64, &tx_fifo->TxDL_Pointer);
 
 	val64 = (TX_FIFO_LAST_TXD_NUM(frg_cnt) | TX_FIFO_FIRST_LIST |
@@ -4114,9 +4149,9 @@ static int s2io_xmit(struct sk_buff *skb
 	mmiowb();
 
 	put_off++;
-	if (put_off == mac_control->fifos[queue].tx_curr_put_info.fifo_len + 1)
+	if (put_off == fifo->tx_curr_put_info.fifo_len + 1)
 		put_off = 0;
-	mac_control->fifos[queue].tx_curr_put_info.offset = put_off;
+	fifo->tx_curr_put_info.offset = put_off;
 
 	/* Avoid "put" pointer going beyond "get" pointer */
 	if (((put_off+1) == queue_len ? 0 : (put_off+1)) == get_off) {
@@ -4128,7 +4163,7 @@ static int s2io_xmit(struct sk_buff *skb
 	}
 	mac_control->stats_info->sw_stat.mem_allocated += skb->truesize;
 	dev->trans_start = jiffies;
-	spin_unlock_irqrestore(&sp->tx_lock, flags);
+	spin_unlock_irqrestore(&fifo->tx_lock, flags);
 
 	return 0;
 pci_map_failed:
@@ -4136,7 +4171,7 @@ pci_map_failed:
 	netif_stop_queue(dev);
 	stats->mem_freed += skb->truesize;
 	dev_kfree_skb(skb);
-	spin_unlock_irqrestore(&sp->tx_lock, flags);
+	spin_unlock_irqrestore(&fifo->tx_lock, flags);
 	return 0;
 }
 
@@ -6996,10 +7031,8 @@ static void do_s2io_card_down(struct s2i
 	if (do_io)
 		s2io_reset(sp);
 
-	spin_lock_irqsave(&sp->tx_lock, flags);
 	/* Free all Tx buffers */
 	free_tx_buffers(sp);
-	spin_unlock_irqrestore(&sp->tx_lock, flags);
 
 	/* Free all Rx buffers */
 	spin_lock_irqsave(&sp->rx_lock, flags);
@@ -7458,12 +7491,18 @@ static void s2io_init_pci(struct s2io_ni
 
 static int s2io_verify_parm(struct pci_dev *pdev, u8 *dev_intr_type)
 {
-	if ( tx_fifo_num > 8) {
-		DBG_PRINT(ERR_DBG, "s2io: Requested number of Tx fifos not "
-			 "supported\n");
-		DBG_PRINT(ERR_DBG, "s2io: Default to 8 Tx fifos\n");
-		tx_fifo_num = 8;
+	if ((tx_fifo_num > MAX_TX_FIFOS) ||
+		(tx_fifo_num < FIFO_DEFAULT_NUM)) {
+		DBG_PRINT(ERR_DBG, "s2io: Requested number of tx fifos "
+			"(%d) not supported\n", tx_fifo_num);
+		tx_fifo_num =
+			((tx_fifo_num > MAX_TX_FIFOS)? MAX_TX_FIFOS :
+			((tx_fifo_num < FIFO_DEFAULT_NUM) ? FIFO_DEFAULT_NUM :
+			tx_fifo_num));
+		DBG_PRINT(ERR_DBG, "s2io: Default to %d ", tx_fifo_num);
+		DBG_PRINT(ERR_DBG, "tx fifos\n");
 	}
+
 	if ( rx_ring_num > 8) {
 		DBG_PRINT(ERR_DBG, "s2io: Requested number of Rx rings not "
 			 "supported\n");
@@ -7842,7 +7881,8 @@ s2io_init_nic(struct pci_dev *pdev, cons
 	sp->state = 0;
 
 	/* Initialize spinlocks */
-	spin_lock_init(&sp->tx_lock);
+	for (i = 0; i < sp->config.tx_fifo_num; i++)
+		spin_lock_init(&mac_control->fifos[i].tx_lock);
 
 	if (!napi)
 		spin_lock_init(&sp->put_lock);
diff -Nurp 2-0-26-10/drivers/net/s2io.h 2-0-26-15-1/drivers/net/s2io.h
--- 2-0-26-10/drivers/net/s2io.h	2007-12-17 22:09:01.000000000 +0530
+++ 2-0-26-15-1/drivers/net/s2io.h	2007-12-17 22:10:58.000000000 +0530
@@ -360,6 +360,8 @@ struct stat_block {
 #define MAX_TX_FIFOS 8
 #define MAX_RX_RINGS 8
 
+#define FIFO_DEFAULT_NUM	1
+
 #define MAX_RX_DESC_1  (MAX_RX_RINGS * MAX_RX_BLOCKS_PER_RING * 127 )
 #define MAX_RX_DESC_2  (MAX_RX_RINGS * MAX_RX_BLOCKS_PER_RING * 85 )
 #define MAX_RX_DESC_3  (MAX_RX_RINGS * MAX_RX_BLOCKS_PER_RING * 85 )
@@ -719,8 +721,14 @@ struct fifo_info {
 	 */
 	struct tx_curr_get_info tx_curr_get_info;
 
+	/* Per fifo lock */
+	spinlock_t tx_lock;
+
+	/* Per fifo UFO in band structure */
+	u64 *ufo_in_band_v;
+
 	struct s2io_nic *nic;
-};
+} ____cacheline_aligned;
 
 /* Information related to the Tx and Rx FIFOs and Rings of Xena
  * is maintained in this structure.
@@ -848,7 +856,6 @@ struct s2io_nic {
 
 	atomic_t rx_bufs_left[MAX_RX_RINGS];
 
-	spinlock_t tx_lock;
 	spinlock_t put_lock;
 
 #define PROMISC     1
@@ -915,7 +922,6 @@ struct s2io_nic {
 	volatile unsigned long state;
 	spinlock_t	rx_lock;
 	u64		general_int_mask;
-	u64 *ufo_in_band_v;
 #define VPD_STRING_LEN 80
 	u8  product_name[VPD_STRING_LEN];
 	u8  serial_num[VPD_STRING_LEN];




^ permalink raw reply

* [PATCH 2.6.25 2/2]S2io: Fixes to enable multiple transmit fifos
From: Ramkrishna Vepa @ 2007-12-17 19:40 UTC (permalink / raw)
  To: netdev, jgarzik; +Cc: support

Multiple transmit fifo initialization -
  - Assigned equal scheduling priority for all configured FIFO's.
  - Modularized transmit traffic interrupt initialization since it is executed in
    s2io_card_up and s2io_link. Enable continuous tx interrupt when link is UP 
    and vice verse.
  - Enable transmit interrupts for all configured transmit fifos.
  - Fixed typo errors.

Signed-off-by: Surjit Reang <surjit.reang@neterion.com>
Signed-off-by: Sreenivasa Honnur <sreenivasa.honnur@neterion.com>
Signed-off-by: Ramkrishna Vepa <ram.vepa@neterion.com>
---
diff -Nurp 2-0-26-15-1/drivers/net/s2io.c 2-0-26-15-2/drivers/net/s2io.c
--- 2-0-26-15-1/drivers/net/s2io.c	2007-12-17 22:10:50.000000000 +0530
+++ 2-0-26-15-2/drivers/net/s2io.c	2007-12-17 22:52:13.000000000 +0530
@@ -84,7 +84,7 @@
 #include "s2io.h"
 #include "s2io-regs.h"
 
-#define DRV_VERSION "2.0.26.15-1"
+#define DRV_VERSION "2.0.26.15-2"
 
 /* S2io Driver name & version. */
 static char s2io_driver_name[] = "Neterion";
@@ -1079,8 +1079,67 @@ static int s2io_print_pci_mode(struct s2
 }
 
 /**
+ *  init_tti - Initialization transmit traffic interrupt scheme
+ *  @nic: device private variable
+ *  @link: link status (UP/DOWN) used to enable/disable continuous
+ *  transmit interrupts
+ *  Description: The function configures transmit traffic interrupts
+ *  Return Value:  SUCCESS on success and
+ *  '-1' on failure
+ */
+
+int init_tti(struct s2io_nic *nic, int link)
+{
+	struct XENA_dev_config __iomem *bar0 = nic->bar0;
+	register u64 val64 = 0;
+	int i;
+	struct config_param *config;
+
+	config = &nic->config;
+
+	for (i = 0; i < config->tx_fifo_num; i++) {
+		/*
+		 * TTI Initialization. Default Tx timer gets us about
+		 * 250 interrupts per sec. Continuous interrupts are enabled
+		 * by default.
+		 */
+		if (nic->device_type == XFRAME_II_DEVICE) {
+			int count = (nic->config.bus_speed * 125)/2;
+			val64 = TTI_DATA1_MEM_TX_TIMER_VAL(count);
+		} else
+			val64 = TTI_DATA1_MEM_TX_TIMER_VAL(0x2078);
+
+		val64 |= TTI_DATA1_MEM_TX_URNG_A(0xA) |
+				TTI_DATA1_MEM_TX_URNG_B(0x10) |
+				TTI_DATA1_MEM_TX_URNG_C(0x30) |
+				TTI_DATA1_MEM_TX_TIMER_AC_EN;
+
+		if (use_continuous_tx_intrs && (link == LINK_UP))
+			val64 |= TTI_DATA1_MEM_TX_TIMER_CI_EN;
+		writeq(val64, &bar0->tti_data1_mem);
+
+		val64 = TTI_DATA2_MEM_TX_UFC_A(0x10) |
+				TTI_DATA2_MEM_TX_UFC_B(0x20) |
+				TTI_DATA2_MEM_TX_UFC_C(0x40) |
+				TTI_DATA2_MEM_TX_UFC_D(0x80);
+
+		writeq(val64, &bar0->tti_data2_mem);
+
+		val64 = TTI_CMD_MEM_WE | TTI_CMD_MEM_STROBE_NEW_CMD |
+				TTI_CMD_MEM_OFFSET(i);
+		writeq(val64, &bar0->tti_command_mem);
+
+		if (wait_for_cmd_complete(&bar0->tti_command_mem,
+			TTI_CMD_MEM_STROBE_NEW_CMD, S2IO_BIT_RESET) != SUCCESS)
+			return FAILURE;
+	}
+
+	return SUCCESS;
+}
+
+/**
  *  init_nic - Initialization of hardware
- *  @nic: device peivate variable
+ *  @nic: device private variable
  *  Description: The function sequentially configures every block
  *  of the H/W from their reset values.
  *  Return Value:  SUCCESS on success and
@@ -1185,9 +1244,9 @@ static int init_nic(struct s2io_nic *nic
 
 	for (i = 0, j = 0; i < config->tx_fifo_num; i++) {
 		val64 |=
-		    vBIT(config->tx_cfg[i].fifo_len - 1, ((i * 32) + 19),
+		    vBIT(config->tx_cfg[i].fifo_len - 1, ((j * 32) + 19),
 			 13) | vBIT(config->tx_cfg[i].fifo_priority,
-				    ((i * 32) + 5), 3);
+				    ((j * 32) + 5), 3);
 
 		if (i == (config->tx_fifo_num - 1)) {
 			if (i % 2 == 0)
@@ -1198,17 +1257,25 @@ static int init_nic(struct s2io_nic *nic
 		case 1:
 			writeq(val64, &bar0->tx_fifo_partition_0);
 			val64 = 0;
+			j = 0;
 			break;
 		case 3:
 			writeq(val64, &bar0->tx_fifo_partition_1);
 			val64 = 0;
+			j = 0;
 			break;
 		case 5:
 			writeq(val64, &bar0->tx_fifo_partition_2);
 			val64 = 0;
+			j = 0;
 			break;
 		case 7:
 			writeq(val64, &bar0->tx_fifo_partition_3);
+			val64 = 0;
+			j = 0;
+			break;
+		default:
+			j++;
 			break;
 		}
 	}
@@ -1294,11 +1361,11 @@ static int init_nic(struct s2io_nic *nic
 
 	/*
 	 * Filling Tx round robin registers
-	 * as per the number of FIFOs
+	 * as per the number of FIFOs for equal scheduling priority
 	 */
 	switch (config->tx_fifo_num) {
 	case 1:
-		val64 = 0x0000000000000000ULL;
+		val64 = 0x0;
 		writeq(val64, &bar0->tx_w_round_robin_0);
 		writeq(val64, &bar0->tx_w_round_robin_1);
 		writeq(val64, &bar0->tx_w_round_robin_2);
@@ -1306,87 +1373,78 @@ static int init_nic(struct s2io_nic *nic
 		writeq(val64, &bar0->tx_w_round_robin_4);
 		break;
 	case 2:
-		val64 = 0x0000010000010000ULL;
+		val64 = 0x0001000100010001ULL;
 		writeq(val64, &bar0->tx_w_round_robin_0);
-		val64 = 0x0100000100000100ULL;
 		writeq(val64, &bar0->tx_w_round_robin_1);
-		val64 = 0x0001000001000001ULL;
 		writeq(val64, &bar0->tx_w_round_robin_2);
-		val64 = 0x0000010000010000ULL;
 		writeq(val64, &bar0->tx_w_round_robin_3);
-		val64 = 0x0100000000000000ULL;
+		val64 = 0x0001000100000000ULL;
 		writeq(val64, &bar0->tx_w_round_robin_4);
 		break;
 	case 3:
-		val64 = 0x0001000102000001ULL;
+		val64 = 0x0001020001020001ULL;
 		writeq(val64, &bar0->tx_w_round_robin_0);
-		val64 = 0x0001020000010001ULL;
+		val64 = 0x0200010200010200ULL;
 		writeq(val64, &bar0->tx_w_round_robin_1);
-		val64 = 0x0200000100010200ULL;
+		val64 = 0x0102000102000102ULL;
 		writeq(val64, &bar0->tx_w_round_robin_2);
-		val64 = 0x0001000102000001ULL;
+		val64 = 0x0001020001020001ULL;
 		writeq(val64, &bar0->tx_w_round_robin_3);
-		val64 = 0x0001020000000000ULL;
+		val64 = 0x0200010200000000ULL;
 		writeq(val64, &bar0->tx_w_round_robin_4);
 		break;
 	case 4:
-		val64 = 0x0001020300010200ULL;
+		val64 = 0x0001020300010203ULL;
 		writeq(val64, &bar0->tx_w_round_robin_0);
-		val64 = 0x0100000102030001ULL;
 		writeq(val64, &bar0->tx_w_round_robin_1);
-		val64 = 0x0200010000010203ULL;
 		writeq(val64, &bar0->tx_w_round_robin_2);
-		val64 = 0x0001020001000001ULL;
 		writeq(val64, &bar0->tx_w_round_robin_3);
-		val64 = 0x0203000100000000ULL;
+		val64 = 0x0001020300000000ULL;
 		writeq(val64, &bar0->tx_w_round_robin_4);
 		break;
 	case 5:
-		val64 = 0x0001000203000102ULL;
+		val64 = 0x0001020304000102ULL;
 		writeq(val64, &bar0->tx_w_round_robin_0);
-		val64 = 0x0001020001030004ULL;
+		val64 = 0x0304000102030400ULL;
 		writeq(val64, &bar0->tx_w_round_robin_1);
-		val64 = 0x0001000203000102ULL;
+		val64 = 0x0102030400010203ULL;
 		writeq(val64, &bar0->tx_w_round_robin_2);
-		val64 = 0x0001020001030004ULL;
+		val64 = 0x0400010203040001ULL;
 		writeq(val64, &bar0->tx_w_round_robin_3);
-		val64 = 0x0001000000000000ULL;
+		val64 = 0x0203040000000000ULL;
 		writeq(val64, &bar0->tx_w_round_robin_4);
 		break;
 	case 6:
-		val64 = 0x0001020304000102ULL;
+		val64 = 0x0001020304050001ULL;
 		writeq(val64, &bar0->tx_w_round_robin_0);
-		val64 = 0x0304050001020001ULL;
+		val64 = 0x0203040500010203ULL;
 		writeq(val64, &bar0->tx_w_round_robin_1);
-		val64 = 0x0203000100000102ULL;
+		val64 = 0x0405000102030405ULL;
 		writeq(val64, &bar0->tx_w_round_robin_2);
-		val64 = 0x0304000102030405ULL;
+		val64 = 0x0001020304050001ULL;
 		writeq(val64, &bar0->tx_w_round_robin_3);
-		val64 = 0x0001000200000000ULL;
+		val64 = 0x0203040500000000ULL;
 		writeq(val64, &bar0->tx_w_round_robin_4);
 		break;
 	case 7:
-		val64 = 0x0001020001020300ULL;
+		val64 = 0x0001020304050600ULL;
 		writeq(val64, &bar0->tx_w_round_robin_0);
-		val64 = 0x0102030400010203ULL;
+		val64 = 0x0102030405060001ULL;
 		writeq(val64, &bar0->tx_w_round_robin_1);
-		val64 = 0x0405060001020001ULL;
+		val64 = 0x0203040506000102ULL;
 		writeq(val64, &bar0->tx_w_round_robin_2);
-		val64 = 0x0304050000010200ULL;
+		val64 = 0x0304050600010203ULL;
 		writeq(val64, &bar0->tx_w_round_robin_3);
-		val64 = 0x0102030000000000ULL;
+		val64 = 0x0405060000000000ULL;
 		writeq(val64, &bar0->tx_w_round_robin_4);
 		break;
 	case 8:
-		val64 = 0x0001020300040105ULL;
+		val64 = 0x0001020304050607ULL;
 		writeq(val64, &bar0->tx_w_round_robin_0);
-		val64 = 0x0200030106000204ULL;
 		writeq(val64, &bar0->tx_w_round_robin_1);
-		val64 = 0x0103000502010007ULL;
 		writeq(val64, &bar0->tx_w_round_robin_2);
-		val64 = 0x0304010002060500ULL;
 		writeq(val64, &bar0->tx_w_round_robin_3);
-		val64 = 0x0103020400000000ULL;
+		val64 = 0x0001020300000000ULL;
 		writeq(val64, &bar0->tx_w_round_robin_4);
 		break;
 	}
@@ -1563,58 +1621,14 @@ static int init_nic(struct s2io_nic *nic
 	    MAC_RX_LINK_UTIL_VAL(rmac_util_period);
 	writeq(val64, &bar0->mac_link_util);
 
-
 	/*
 	 * Initializing the Transmit and Receive Traffic Interrupt
 	 * Scheme.
 	 */
-	/*
-	 * TTI Initialization. Default Tx timer gets us about
-	 * 250 interrupts per sec. Continuous interrupts are enabled
-	 * by default.
-	 */
-	if (nic->device_type == XFRAME_II_DEVICE) {
-		int count = (nic->config.bus_speed * 125)/2;
-		val64 = TTI_DATA1_MEM_TX_TIMER_VAL(count);
-	} else {
-
-		val64 = TTI_DATA1_MEM_TX_TIMER_VAL(0x2078);
-	}
-	val64 |= TTI_DATA1_MEM_TX_URNG_A(0xA) |
-	    TTI_DATA1_MEM_TX_URNG_B(0x10) |
-	    TTI_DATA1_MEM_TX_URNG_C(0x30) | TTI_DATA1_MEM_TX_TIMER_AC_EN;
-		if (use_continuous_tx_intrs)
-			val64 |= TTI_DATA1_MEM_TX_TIMER_CI_EN;
-	writeq(val64, &bar0->tti_data1_mem);
-
-	val64 = TTI_DATA2_MEM_TX_UFC_A(0x10) |
-	    TTI_DATA2_MEM_TX_UFC_B(0x20) |
-	    TTI_DATA2_MEM_TX_UFC_C(0x40) | TTI_DATA2_MEM_TX_UFC_D(0x80);
-	writeq(val64, &bar0->tti_data2_mem);
 
-	val64 = TTI_CMD_MEM_WE | TTI_CMD_MEM_STROBE_NEW_CMD;
-	writeq(val64, &bar0->tti_command_mem);
-
-	/*
-	 * Once the operation completes, the Strobe bit of the command
-	 * register will be reset. We poll for this particular condition
-	 * We wait for a maximum of 500ms for the operation to complete,
-	 * if it's not complete by then we return error.
-	 */
-	time = 0;
-	while (TRUE) {
-		val64 = readq(&bar0->tti_command_mem);
-		if (!(val64 & TTI_CMD_MEM_STROBE_NEW_CMD)) {
-			break;
-		}
-		if (time > 10) {
-			DBG_PRINT(ERR_DBG, "%s: TTI init Failed\n",
-				  dev->name);
-			return -ENODEV;
-		}
-		msleep(50);
-		time++;
-	}
+	/* Initialize TTI */
+	if (SUCCESS != init_tti(nic, nic->last_link_state))
+		return -ENODEV;
 
 	/* RTI Initialization */
 	if (nic->device_type == XFRAME_II_DEVICE) {
@@ -7439,6 +7453,7 @@ static void s2io_link(struct s2io_nic * 
 	struct net_device *dev = (struct net_device *) sp->dev;
 
 	if (link != sp->last_link_state) {
+		init_tti(sp, link);
 		if (link == LINK_DOWN) {
 			DBG_PRINT(ERR_DBG, "%s: Link down\n", dev->name);
 			netif_carrier_off(dev);
@@ -7537,7 +7552,7 @@ static int s2io_verify_parm(struct pci_d
 /**
  * rts_ds_steer - Receive traffic steering based on IPv4 or IPv6 TOS
  * or Traffic class respectively.
- * @nic: device peivate variable
+ * @nic: device private variable
  * Description: The function configures the receive steering to
  * desired receive ring.
  * Return Value:  SUCCESS on success and




^ permalink raw reply

* Re: init_timer_deferrable conversion
From: Stephen Hemminger @ 2007-12-17 18:13 UTC (permalink / raw)
  To: Parag Warudkar; +Cc: Eric Dumazet, David Miller, netdev@vger.kernel.org
In-Reply-To: <82e4877d0712170947v45929acv92e0d34c86d82c6d@mail.gmail.com>

On Mon, 17 Dec 2007 12:47:59 -0500
"Parag Warudkar" <parag.warudkar@gmail.com> wrote:

> On Dec 17, 2007 12:00 PM, Stephen Hemminger
> <shemminger@linux-foundation.org> wrote:
> > > > >
> > > > > a) drivers/net/sky2.c - watchdog_timer. This was showing up high on
> > > > > Powertop's list of things that cause routine wakeups from idle. After
> > > > > converting to init_timer_deferrable() the wakeups went down and this one
> > > > > no longer shows up in powertop's list. 25% reduction.
> >
> > This surprises me because it is a 1 hz timer and uses round_jiffies() in
> > the current kernel.
> 
> I am using the current git and I already have low wakeups per second
> to begin with - 5-7  and out of that 25% are attributed to sky2. Not
> sure if that matches up with the 1 hz + round_jiffies() logic.
> 
> But is it conceptually ok to make this deferrable? I suppose yes as
> it's just a watchdog that checks if the link is up and delaying that
> would not make a difference?

I think you are going to wake up once a second anyway, so all it
ends up changing is the accounting. Please check with the powertop
developers.

I'm fine with changing sky2, but it would be good if you could
go through all the network drivers and fix them as well.

-- 
Stephen Hemminger <shemminger@linux-foundation.org>

^ permalink raw reply

* Re: init_timer_deferrable conversion
From: Parag Warudkar @ 2007-12-17 18:37 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Eric Dumazet, David Miller, netdev@vger.kernel.org,
	Arjan van de Ven
In-Reply-To: <20071217101355.7f4e6031@deepthought>

On Dec 17, 2007 1:13 PM, Stephen Hemminger
<shemminger@linux-foundation.org> wrote:
> On Mon, 17 Dec 2007 12:47:59 -0500
> "Parag Warudkar" <parag.warudkar@gmail.com> wrote:
>
>
> > On Dec 17, 2007 12:00 PM, Stephen Hemminger
> > <shemminger@linux-foundation.org> wrote:
> > > > > >
> > > > > > a) drivers/net/sky2.c - watchdog_timer. This was showing up high on
> > > > > > Powertop's list of things that cause routine wakeups from idle. After
> > > > > > converting to init_timer_deferrable() the wakeups went down and this one
> > > > > > no longer shows up in powertop's list. 25% reduction.
> > >
> > > This surprises me because it is a 1 hz timer and uses round_jiffies() in
> > > the current kernel.
> >
> > I am using the current git and I already have low wakeups per second
> > to begin with - 5-7  and out of that 25% are attributed to sky2. Not
> > sure if that matches up with the 1 hz + round_jiffies() logic.
> >
> > But is it conceptually ok to make this deferrable? I suppose yes as
> > it's just a watchdog that checks if the link is up and delaying that
> > would not make a difference?
>
> I think you are going to wake up once a second anyway, so all it
> ends up changing is the accounting. Please check with the powertop
> developers.

As I understand it the advantage of deferrable is that sky2 won't have
to wakeup the CPU just for itself.
It can be coupled with other things that need to wake up the CPU. So
hopefully this isn't just a powertop accounting fixup :)

>
> I'm fine with changing sky2, but it would be good if you could
> go through all the network drivers and fix them as well.
>

Arjan - if there is value in converting netdev watchdogs to deferrable
from a PM perpective I will fix up other drivers as well.

Thanks

Parag

^ permalink raw reply

* [PATCH] drivers/net/: Spelling fixes
From: Joe Perches @ 2007-12-17 19:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: Pavel Roskin, David Gibson, orinoco-devel, Yi Zhu,
	Jaroslav Kysela, linuxppc-dev, netdev, Paul Mackerras,
	Peter De Shrijver, Rastapur Santosh, bonding-devel,
	Andy Gospodarek, Amit S. Kale, ipw2100-devel, ipw3945-devel,
	libertas-dev, Dan Williams, Jesse Brandeburg, Manish Lachwani,
	Jean Tourrilhes, Jeff Kirsher, Arnaldo Carvalho de Melo,
	Francois Romieu, Danie


Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/net/82596.c                            |    2 +-
 drivers/net/amd8111e.c                         |    8 ++++----
 drivers/net/amd8111e.h                         |    2 +-
 drivers/net/appletalk/ltpc.c                   |    2 +-
 drivers/net/atl1/atl1_hw.c                     |    2 +-
 drivers/net/atl1/atl1_main.c                   |    2 +-
 drivers/net/bonding/bond_3ad.c                 |    4 ++--
 drivers/net/chelsio/sge.c                      |    2 +-
 drivers/net/chelsio/subr.c                     |    2 +-
 drivers/net/cxgb3/t3_hw.c                      |    2 +-
 drivers/net/e1000/e1000_hw.c                   |    4 ++--
 drivers/net/e1000/e1000_hw.h                   |    2 +-
 drivers/net/e1000/e1000_main.c                 |    2 +-
 drivers/net/e1000e/netdev.c                    |    2 +-
 drivers/net/eepro.c                            |    2 +-
 drivers/net/ehea/ehea.h                        |    2 +-
 drivers/net/forcedeth.c                        |    2 +-
 drivers/net/hamachi.c                          |    4 ++--
 drivers/net/hp100.c                            |    2 +-
 drivers/net/hp100.h                            |    4 ++--
 drivers/net/ibm_emac/ibm_emac.h                |    2 +-
 drivers/net/ibm_newemac/emac.h                 |    2 +-
 drivers/net/ibmlana.c                          |    2 +-
 drivers/net/ibmlana.h                          |    2 +-
 drivers/net/ipg.c                              |    4 ++--
 drivers/net/irda/ali-ircc.c                    |    6 +++---
 drivers/net/irda/ali-ircc.h                    |    4 ++--
 drivers/net/irda/donauboe.h                    |    2 +-
 drivers/net/irda/irport.c                      |    4 ++--
 drivers/net/irda/nsc-ircc.h                    |    4 ++--
 drivers/net/irda/smsc-ircc2.c                  |    4 ++--
 drivers/net/irda/via-ircc.h                    |    4 ++--
 drivers/net/ixgbe/ixgbe_common.c               |    4 ++--
 drivers/net/ixgbe/ixgbe_main.c                 |    2 +-
 drivers/net/lasi_82596.c                       |    2 +-
 drivers/net/lib82596.c                         |    2 +-
 drivers/net/macb.c                             |    2 +-
 drivers/net/meth.h                             |    2 +-
 drivers/net/mv643xx_eth.c                      |    4 ++--
 drivers/net/netxen/netxen_nic_hw.h             |    2 +-
 drivers/net/ppp_generic.c                      |    2 +-
 drivers/net/ps3_gelic_net.c                    |    2 +-
 drivers/net/qla3xxx.c                          |    2 +-
 drivers/net/s2io.h                             |    2 +-
 drivers/net/sis190.c                           |    2 +-
 drivers/net/sk98lin/skgepnmi.c                 |    2 +-
 drivers/net/sk98lin/skxmac2.c                  |    4 ++--
 drivers/net/skfp/ess.c                         |    2 +-
 drivers/net/skfp/fplustm.c                     |    6 +++---
 drivers/net/skfp/h/fplustm.h                   |    4 ++--
 drivers/net/skfp/h/smt.h                       |    2 +-
 drivers/net/skfp/h/supern_2.h                  |    2 +-
 drivers/net/smc911x.c                          |    2 +-
 drivers/net/spider_net.c                       |    2 +-
 drivers/net/sunbmac.h                          |    2 +-
 drivers/net/sungem.c                           |    2 +-
 drivers/net/sunhme.h                           |    2 +-
 drivers/net/tc35815.c                          |    4 ++--
 drivers/net/tehuti.c                           |    2 +-
 drivers/net/tehuti.h                           |    2 +-
 drivers/net/tokenring/3c359.c                  |    2 +-
 drivers/net/tokenring/lanstreamer.c            |    2 +-
 drivers/net/tokenring/olympic.c                |    2 +-
 drivers/net/tokenring/smctr.c                  |    6 +++---
 drivers/net/tokenring/tms380tr.c               |    2 +-
 drivers/net/tokenring/tms380tr.h               |    2 +-
 drivers/net/tulip/xircom_cb.c                  |    2 +-
 drivers/net/tun.c                              |    4 ++--
 drivers/net/ucc_geth_ethtool.c                 |    2 +-
 drivers/net/ucc_geth_mii.c                     |    6 +++---
 drivers/net/wan/cycx_drv.c                     |    4 ++--
 drivers/net/wan/sbni.c                         |    2 +-
 drivers/net/wireless/atmel.c                   |    2 +-
 drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h |    2 +-
 drivers/net/wireless/ipw2200.c                 |    2 +-
 drivers/net/wireless/iwlwifi/iwl-4965.c        |    2 +-
 drivers/net/wireless/libertas/cmd.c            |    4 ++--
 drivers/net/wireless/libertas/scan.c           |    4 ++--
 drivers/net/wireless/netwave_cs.c              |    2 +-
 drivers/net/wireless/orinoco.h                 |    2 +-
 drivers/net/wireless/ray_cs.c                  |    2 +-
 drivers/net/wireless/rt2x00/rt2x00reg.h        |    2 +-
 drivers/net/wireless/rt2x00/rt2x00usb.h        |    6 +++---
 drivers/net/wireless/rt2x00/rt73usb.c          |    2 +-
 drivers/net/wireless/wavelan_cs.c              |    2 +-
 drivers/net/wireless/zd1211rw/zd_chip.h        |    4 ++--
 drivers/net/yellowfin.c                        |    2 +-
 87 files changed, 120 insertions(+), 120 deletions(-)

diff --git a/drivers/net/82596.c b/drivers/net/82596.c
index 2797da7..d999b63 100644
--- a/drivers/net/82596.c
+++ b/drivers/net/82596.c
@@ -19,7 +19,7 @@
    TBD:
    * look at deferring rx frames rather than discarding (as per tulip)
    * handle tx ring full as per tulip
-   * performace test to tune rx_copybreak
+   * performance test to tune rx_copybreak
 
    Most of my modifications relate to the braindead big-endian
    implementation by Intel.  When the i596 is operating in
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c
index e7fdd81..5cefe92 100644
--- a/drivers/net/amd8111e.c
+++ b/drivers/net/amd8111e.c
@@ -1283,7 +1283,7 @@ static irqreturn_t amd8111e_interrupt(int irq, void *dev_id)
 #ifdef CONFIG_AMD8111E_NAPI
 	if(intr0 & RINT0){
 		if(netif_rx_schedule_prep(dev, &lp->napi)){
-			/* Disable receive interupts */
+			/* Disable receive interrupts */
 			writel(RINTEN0, mmio + INTEN0);
 			/* Schedule a polling routine */
 			__netif_rx_schedule(dev, &lp->napi);
@@ -1493,7 +1493,7 @@ static void amd8111e_read_regs(struct amd8111e_priv *lp, u32 *buf)
 
 
 /*
-This function sets promiscuos mode, all-multi mode or the multicast address
+This function sets promiscuous mode, all-multi mode or the multicast address
 list to the device.
 */
 static void amd8111e_set_multicast_list(struct net_device *dev)
@@ -1522,7 +1522,7 @@ static void amd8111e_set_multicast_list(struct net_device *dev)
 		lp->mc_list = NULL;
 		lp->options &= ~OPTION_MULTICAST_ENABLE;
 		amd8111e_writeq(*(u64*)mc_filter,lp->mmio + LADRF);
-		/* disable promiscous mode */
+		/* disable promiscuous mode */
 		writel(PROM, lp->mmio + CMD2);
 		return;
 	}
@@ -2016,7 +2016,7 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev,
 	for(i = 0; i < ETH_ADDR_LEN; i++)
 		dev->dev_addr[i] = readb(lp->mmio + PADR + i);
 
-	/* Setting user defined parametrs */
+	/* Setting user defined parameters */
 	lp->ext_phy_option = speed_duplex[card_idx];
 	if(coalesce[card_idx])
 		lp->options |= OPTION_INTR_COAL_ENABLE;
diff --git a/drivers/net/amd8111e.h b/drivers/net/amd8111e.h
index 28c60a7..7d288de 100644
--- a/drivers/net/amd8111e.h
+++ b/drivers/net/amd8111e.h
@@ -614,7 +614,7 @@ typedef enum {
 #define CSTATE  1
 #define SSTATE  2
 
-/* Assume contoller gets data 10 times the maximum processing time */
+/* Assume controller gets data 10 times the maximum processing time */
 #define  REPEAT_CNT			10
 
 /* amd8111e decriptor flag definitions */
diff --git a/drivers/net/appletalk/ltpc.c b/drivers/net/appletalk/ltpc.c
index 6ab2c2d..86a9496 100644
--- a/drivers/net/appletalk/ltpc.c
+++ b/drivers/net/appletalk/ltpc.c
@@ -1233,7 +1233,7 @@ static int __init ltpc_setup(char *str)
 		if (ints[0] > 2) {
 			dma = ints[3];
 		}
-		/* ignore any other paramters */
+		/* ignore any other parameters */
 	}
 	return 1;
 }
diff --git a/drivers/net/atl1/atl1_hw.c b/drivers/net/atl1/atl1_hw.c
index 9d3bd22..82359f7 100644
--- a/drivers/net/atl1/atl1_hw.c
+++ b/drivers/net/atl1/atl1_hw.c
@@ -645,7 +645,7 @@ s32 atl1_init_hw(struct atl1_hw *hw)
 	atl1_init_flash_opcode(hw);
 
 	if (!hw->phy_configured) {
-		/* enable GPHY LinkChange Interrrupt */
+		/* enable GPHY LinkChange Interrupt */
 		ret_val = atl1_write_phy_reg(hw, 18, 0xC00);
 		if (ret_val)
 			return ret_val;
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 35b0a7d..7599163 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -575,7 +575,7 @@ static u32 atl1_check_link(struct atl1_adapter *adapter)
 		return ATL1_SUCCESS;
 	}
 
-	/* change orignal link status */
+	/* change original link status */
 	if (netif_carrier_ok(netdev)) {
 		adapter->link_speed = SPEED_0;
 		netif_carrier_off(netdev);
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index cb3c6fa..96f0f24 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -869,7 +869,7 @@ static int ad_lacpdu_send(struct port *port)
 	lacpdu_header = (struct lacpdu_header *)skb_put(skb, length);
 
 	lacpdu_header->ad_header.destination_address = lacpdu_multicast_address;
-	/* Note: source addres is set to be the member's PERMANENT address, because we use it
+	/* Note: source address is set to be the member's PERMANENT address, because we use it
 	   to identify loopback lacpdus in receive. */
 	lacpdu_header->ad_header.source_address = *((struct mac_addr *)(slave->perm_hwaddr));
 	lacpdu_header->ad_header.length_type = PKT_TYPE_LACPDU;
@@ -912,7 +912,7 @@ static int ad_marker_send(struct port *port, struct bond_marker *marker)
 	marker_header = (struct bond_marker_header *)skb_put(skb, length);
 
 	marker_header->ad_header.destination_address = lacpdu_multicast_address;
-	/* Note: source addres is set to be the member's PERMANENT address, because we use it
+	/* Note: source address is set to be the member's PERMANENT address, because we use it
 	   to identify loopback MARKERs in receive. */
 	marker_header->ad_header.source_address = *((struct mac_addr *)(slave->perm_hwaddr));
 	marker_header->ad_header.length_type = PKT_TYPE_LACPDU;
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c
index b301c04..ed17cd9 100644
--- a/drivers/net/chelsio/sge.c
+++ b/drivers/net/chelsio/sge.c
@@ -248,7 +248,7 @@ static void restart_sched(unsigned long);
  *
  * Interrupts are handled by a single CPU and it is likely that on a MP system
  * the application is migrated to another CPU. In that scenario, we try to
- * seperate the RX(in irq context) and TX state in order to decrease memory
+ * separate the RX(in irq context) and TX state in order to decrease memory
  * contention.
  */
 struct sge {
diff --git a/drivers/net/chelsio/subr.c b/drivers/net/chelsio/subr.c
index dc50151..7c95578 100644
--- a/drivers/net/chelsio/subr.c
+++ b/drivers/net/chelsio/subr.c
@@ -559,7 +559,7 @@ struct chelsio_vpd_t {
 #define EEPROM_MAX_POLL   4
 
 /*
- * Read SEEPROM. A zero is written to the flag register when the addres is
+ * Read SEEPROM. A zero is written to the flag register when the address is
  * written to the Control register. The hardware device will set the flag to a
  * one when 4B have been transferred to the Data register.
  */
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 522834c..2882e36 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -534,7 +534,7 @@ struct t3_vpd {
  *
  *	Read a 32-bit word from a location in VPD EEPROM using the card's PCI
  *	VPD ROM capability.  A zero is written to the flag bit when the
- *	addres is written to the control register.  The hardware device will
+ *	address is written to the control register.  The hardware device will
  *	set the flag to 1 when 4 bytes have been read into the data register.
  */
 int t3_seeprom_read(struct adapter *adapter, u32 addr, u32 *data)
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 7c6888c..fd7e6a8 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -803,7 +803,7 @@ e1000_initialize_hardware_bits(struct e1000_hw *hw)
                 E1000_WRITE_REG(hw, CTRL, reg_ctrl);
                 break;
             case e1000_80003es2lan:
-                /* improve small packet performace for fiber/serdes */
+                /* improve small packet performance for fiber/serdes */
                 if ((hw->media_type == e1000_media_type_fiber) ||
                     (hw->media_type == e1000_media_type_internal_serdes)) {
                     reg_tarc0 &= ~(1 << 20);
@@ -5001,7 +5001,7 @@ e1000_read_eeprom(struct e1000_hw *hw,
             return -E1000_ERR_EEPROM;
     }
 
-    /* Eerd register EEPROM access requires no eeprom aquire/release */
+    /* Eerd register EEPROM access requires no eeprom acquire/release */
     if (eeprom->use_eerd == TRUE)
         return e1000_read_eeprom_eerd(hw, offset, words, data);
 
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h
index a2a86c5..e40e515 100644
--- a/drivers/net/e1000/e1000_hw.h
+++ b/drivers/net/e1000/e1000_hw.h
@@ -1068,7 +1068,7 @@ struct e1000_ffvt_entry {
 
 #define E1000_KUMCTRLSTA 0x00034 /* MAC-PHY interface - RW */
 #define E1000_MDPHYA     0x0003C  /* PHY address - RW */
-#define E1000_MANC2H     0x05860  /* Managment Control To Host - RW */
+#define E1000_MANC2H     0x05860  /* Management Control To Host - RW */
 #define E1000_SW_FW_SYNC 0x05B5C /* Software-Firmware Synchronization - RW */
 
 #define E1000_GCR       0x05B00 /* PCI-Ex Control */
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 4f37506..24a2fc1 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -235,7 +235,7 @@ static struct pci_driver e1000_driver = {
 	.probe    = e1000_probe,
 	.remove   = __devexit_p(e1000_remove),
 #ifdef CONFIG_PM
-	/* Power Managment Hooks */
+	/* Power Management Hooks */
 	.suspend  = e1000_suspend,
 	.resume   = e1000_resume,
 #endif
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 4fd2e23..febe157 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -4109,7 +4109,7 @@ static struct pci_driver e1000_driver = {
 	.probe    = e1000_probe,
 	.remove   = __devexit_p(e1000_remove),
 #ifdef CONFIG_PM
-	/* Power Managment Hooks */
+	/* Power Management Hooks */
 	.suspend  = e1000_suspend,
 	.resume   = e1000_resume,
 #endif
diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c
index 83bda6c..d3789c5 100644
--- a/drivers/net/eepro.c
+++ b/drivers/net/eepro.c
@@ -1764,7 +1764,7 @@ module_param_array(io, int, NULL, 0);
 module_param_array(irq, int, NULL, 0);
 module_param_array(mem, int, NULL, 0);
 module_param(autodetect, int, 0);
-MODULE_PARM_DESC(io, "EtherExpress Pro/10 I/O base addres(es)");
+MODULE_PARM_DESC(io, "EtherExpress Pro/10 I/O base address(es)");
 MODULE_PARM_DESC(irq, "EtherExpress Pro/10 IRQ number(s)");
 MODULE_PARM_DESC(mem, "EtherExpress Pro/10 Rx buffer size(es) in kB (3-29)");
 MODULE_PARM_DESC(autodetect, "EtherExpress Pro/10 force board(s) detection (0-1)");
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index 5f82a46..a50b238 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -251,7 +251,7 @@ struct ehea_qp_init_attr {
 };
 
 /*
- * Event Queue attributes, passed as paramter
+ * Event Queue attributes, passed as parameter
  */
 struct ehea_eq_attr {
 	u32 type;
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index a96583c..7119332 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -490,7 +490,7 @@ union ring_type {
 #define NV_RX3_VLAN_TAG_PRESENT (1<<16)
 #define NV_RX3_VLAN_TAG_MASK	(0x0000FFFF)
 
-/* Miscelaneous hardware related defines: */
+/* Miscellaneous hardware related defines: */
 #define NV_PCI_REGSZ_VER1      	0x270
 #define NV_PCI_REGSZ_VER2      	0x2d4
 #define NV_PCI_REGSZ_VER3      	0x604
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c
index ed407c8..683b289 100644
--- a/drivers/net/hamachi.c
+++ b/drivers/net/hamachi.c
@@ -86,7 +86,7 @@ static int force32;
 static int options[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
 static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
 /* The Hamachi chipset supports 3 parameters each for Rx and Tx
- * interruput management.  Parameters will be loaded as specified into
+ * interrupt management.  Parameters will be loaded as specified into
  * the TxIntControl and RxIntControl registers.
  *
  * The registers are arranged as follows:
@@ -811,7 +811,7 @@ static int __devinit read_eeprom(void __iomem *ioaddr, int location)
 	return readb(ioaddr + EEData);
 }
 
-/* MII Managemen Data I/O accesses.
+/* MII Management Data I/O accesses.
    These routines assume the MDIO controller is idle, and do not exit until
    the command is finished. */
 
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c
index 49421d1..8b90d64 100644
--- a/drivers/net/hp100.c
+++ b/drivers/net/hp100.c
@@ -2643,7 +2643,7 @@ static int hp100_login_to_vg_hub(struct net_device *dev, u_short force_relogin)
 		} else {
 			hp100_andb(~HP100_PROM_MODE, VG_LAN_CFG_2);
 			/* For ETR parts we need to reset the prom. bit in the training
-			 * register, otherwise promiscious mode won't be disabled.
+			 * register, otherwise promiscuous mode won't be disabled.
 			 */
 			if (lp->chip == HP100_CHIPID_LASSEN) {
 				hp100_andw(~HP100_MACRQ_PROMSC, TRAIN_REQUEST);
diff --git a/drivers/net/hp100.h b/drivers/net/hp100.h
index e6ca128..e74e45d 100644
--- a/drivers/net/hp100.h
+++ b/drivers/net/hp100.h
@@ -476,7 +476,7 @@
 #define HP100_MACRQ_REPEATER         0x0001	/* 1: MAC tells HUB it wants to be
 						 *    a cascaded repeater
 						 * 0: ... wants to be a DTE */
-#define HP100_MACRQ_PROMSC           0x0006	/* 2 bits: Promiscious mode
+#define HP100_MACRQ_PROMSC           0x0006	/* 2 bits: Promiscuous mode
 						 * 00: Rcv only unicast packets
 						 *     specifically addr to this
 						 *     endnode
@@ -488,7 +488,7 @@
 #define HP100_CARD_MACVER            0xe000	/* R: 3 bit Cards 100VG MAC version */
 #define HP100_MALLOW_REPEATER        0x0001	/* If reset, requested access as an
 						 * end node is allowed */
-#define HP100_MALLOW_PROMSC          0x0004	/* 2 bits: Promiscious mode
+#define HP100_MALLOW_PROMSC          0x0004	/* 2 bits: Promiscuous mode
 						 * 00: Rcv only unicast packets
 						 *     specifically addr to this
 						 *     endnode
diff --git a/drivers/net/ibm_emac/ibm_emac.h b/drivers/net/ibm_emac/ibm_emac.h
index 97ed22b..655be50 100644
--- a/drivers/net/ibm_emac/ibm_emac.h
+++ b/drivers/net/ibm_emac/ibm_emac.h
@@ -1,7 +1,7 @@
 /*
  * drivers/net/ibm_emac/ibm_emac.h
  *
- * Register definitions for PowerPC 4xx on-chip ethernet contoller
+ * Register definitions for PowerPC 4xx on-chip ethernet controller
  *
  * Copyright (c) 2004, 2005 Zultys Technologies.
  * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
diff --git a/drivers/net/ibm_newemac/emac.h b/drivers/net/ibm_newemac/emac.h
index 91cb096..49a540a 100644
--- a/drivers/net/ibm_newemac/emac.h
+++ b/drivers/net/ibm_newemac/emac.h
@@ -1,7 +1,7 @@
 /*
  * drivers/net/ibm_newemac/emac.h
  *
- * Register definitions for PowerPC 4xx on-chip ethernet contoller
+ * Register definitions for PowerPC 4xx on-chip ethernet controller
  *
  * Copyright 2007 Benjamin Herrenschmidt, IBM Corp.
  *                <benh@kernel.crashing.org>
diff --git a/drivers/net/ibmlana.c b/drivers/net/ibmlana.c
index 91d83ac..5a9b6fa 100644
--- a/drivers/net/ibmlana.c
+++ b/drivers/net/ibmlana.c
@@ -481,7 +481,7 @@ static void InitBoard(struct net_device *dev)
 	if ((dev->flags & IFF_ALLMULTI) || (mcptr != NULL))
 		rcrval |= RCREG_AMC;
 
-	/* promiscous mode ? */
+	/* promiscuous mode ? */
 
 	if (dev->flags & IFF_PROMISC)
 		rcrval |= RCREG_PRO;
diff --git a/drivers/net/ibmlana.h b/drivers/net/ibmlana.h
index aa3ddbd..654af95 100644
--- a/drivers/net/ibmlana.h
+++ b/drivers/net/ibmlana.h
@@ -90,7 +90,7 @@ typedef struct {
 #define RCREG_ERR        0x8000	/* accept damaged and collided pkts */
 #define RCREG_RNT        0x4000	/* accept packets that are < 64     */
 #define RCREG_BRD        0x2000	/* accept broadcasts                */
-#define RCREG_PRO        0x1000	/* promiscous mode                  */
+#define RCREG_PRO        0x1000	/* promiscuous mode                 */
 #define RCREG_AMC        0x0800	/* accept all multicasts            */
 #define RCREG_LB_NONE    0x0000	/* no loopback                      */
 #define RCREG_LB_MAC     0x0200	/* MAC loopback                     */
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index dbd23bb..27d12eb 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -209,7 +209,7 @@ static int mdio_read(struct net_device * dev, int phy_id, int phy_reg)
 {
 	void __iomem *ioaddr = ipg_ioaddr(dev);
 	/*
-	 * The GMII mangement frame structure for a read is as follows:
+	 * The GMII management frame structure for a read is as follows:
 	 *
 	 * |Preamble|st|op|phyad|regad|ta|      data      |idle|
 	 * |< 32 1s>|01|10|AAAAA|RRRRR|z0|DDDDDDDDDDDDDDDD|z   |
@@ -300,7 +300,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int phy_reg, int val)
 {
 	void __iomem *ioaddr = ipg_ioaddr(dev);
 	/*
-	 * The GMII mangement frame structure for a read is as follows:
+	 * The GMII management frame structure for a read is as follows:
 	 *
 	 * |Preamble|st|op|phyad|regad|ta|      data      |idle|
 	 * |< 32 1s>|01|10|AAAAA|RRRRR|z0|DDDDDDDDDDDDDDDD|z   |
diff --git a/drivers/net/irda/ali-ircc.c b/drivers/net/irda/ali-ircc.c
index 9f58452..94140f7 100644
--- a/drivers/net/irda/ali-ircc.c
+++ b/drivers/net/irda/ali-ircc.c
@@ -977,7 +977,7 @@ static void ali_ircc_change_speed(struct ali_ircc_cb *self, __u32 baud)
 		/* Install FIR xmit handler*/
 		dev->hard_start_xmit = ali_ircc_fir_hard_xmit;		
 				
-		/* Enable Interuupt */
+		/* Enable Interrupt */
 		self->ier = IER_EOM; // benjamin 2000/11/20 07:24PM					
 				
 		/* Be ready for incomming frames */
@@ -1096,7 +1096,7 @@ static void ali_ircc_sir_change_speed(struct ali_ircc_cb *priv, __u32 speed)
 	outb(lcr,		  iobase+UART_LCR); /* Set 8N1	*/
 	outb(fcr,		  iobase+UART_FCR); /* Enable FIFO's */
 
-	/* without this, the conection will be broken after come back from FIR speed,
+	/* without this, the connection will be broken after come back from FIR speed,
 	   but with this, the SIR connection is harder to established */
 	outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), iobase+UART_MCR);
 	
@@ -1359,7 +1359,7 @@ static int ali_ircc_net_open(struct net_device *dev)
 		return -EAGAIN;
 	}
 	
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	outb(UART_IER_RDI , iobase+UART_IER);
 
 	/* Ready to play! */
diff --git a/drivers/net/irda/ali-ircc.h b/drivers/net/irda/ali-ircc.h
index e489c66..0787657 100644
--- a/drivers/net/irda/ali-ircc.h
+++ b/drivers/net/irda/ali-ircc.h
@@ -173,13 +173,13 @@ struct st_fifo {
 
 struct frame_cb {
 	void *start; /* Start of frame in DMA mem */
-	int len;     /* Lenght of frame in DMA mem */
+	int len;     /* Length of frame in DMA mem */
 };
 
 struct tx_fifo {
 	struct frame_cb queue[MAX_TX_WINDOW]; /* Info about frames in queue */
 	int             ptr;                  /* Currently being sent */
-	int             len;                  /* Lenght of queue */
+	int             len;                  /* Length of queue */
 	int             free;                 /* Next free slot */
 	void           *tail;                 /* Next free start in DMA mem */
 };
diff --git a/drivers/net/irda/donauboe.h b/drivers/net/irda/donauboe.h
index 1e67720..9db3cce 100644
--- a/drivers/net/irda/donauboe.h
+++ b/drivers/net/irda/donauboe.h
@@ -30,7 +30,7 @@
  *     or the type-DO IR port.
  *
  * IrDA chip set list from Toshiba Computer Engineering Corp.
- * model			method	maker	controler		Version 
+ * model			method	maker	controller		Version 
  * Portege 320CT	FIR,SIR Toshiba Oboe(Triangle) 
  * Portege 3010CT	FIR,SIR Toshiba Oboe(Sydney) 
  * Portege 3015CT	FIR,SIR Toshiba Oboe(Sydney) 
diff --git a/drivers/net/irda/irport.c b/drivers/net/irda/irport.c
index c79caa5..2b2a955 100644
--- a/drivers/net/irda/irport.c
+++ b/drivers/net/irda/irport.c
@@ -276,7 +276,7 @@ static void irport_start(struct irport_cb *self)
 	outb(UART_LCR_WLEN8, iobase+UART_LCR);  /* Reset DLAB */
 	outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), iobase+UART_MCR);
 	
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	outb(UART_IER_RLSI | UART_IER_RDI |UART_IER_THRI, iobase+UART_IER);
 }
 
@@ -352,7 +352,7 @@ static void irport_change_speed(void *priv, __u32 speed)
 	outb(lcr,		  iobase+UART_LCR); /* Set 8N1	*/
 	outb(fcr,		  iobase+UART_FCR); /* Enable FIFO's */
 
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	/* This will generate a fatal interrupt storm.
 	 * People calling us will do that properly - Jean II */
 	//outb(/*UART_IER_RLSI|*/UART_IER_RDI/*|UART_IER_THRI*/, iobase+UART_IER);
diff --git a/drivers/net/irda/nsc-ircc.h b/drivers/net/irda/nsc-ircc.h
index bbdc97f..29398a4 100644
--- a/drivers/net/irda/nsc-ircc.h
+++ b/drivers/net/irda/nsc-ircc.h
@@ -231,13 +231,13 @@ struct st_fifo {
 
 struct frame_cb {
 	void *start; /* Start of frame in DMA mem */
-	int len;     /* Lenght of frame in DMA mem */
+	int len;     /* Length of frame in DMA mem */
 };
 
 struct tx_fifo {
 	struct frame_cb queue[MAX_TX_WINDOW]; /* Info about frames in queue */
 	int             ptr;                  /* Currently being sent */
-	int             len;                  /* Lenght of queue */
+	int             len;                  /* Length of queue */
 	int             free;                 /* Next free slot */
 	void           *tail;                 /* Next free start in DMA mem */
 };
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c
index 7e7b582..7fd9a48 100644
--- a/drivers/net/irda/smsc-ircc2.c
+++ b/drivers/net/irda/smsc-ircc2.c
@@ -1165,7 +1165,7 @@ void smsc_ircc_set_sir_speed(struct smsc_ircc_cb *self, __u32 speed)
 	outb(lcr,		  iobase + UART_LCR); /* Set 8N1 */
 	outb(fcr,		  iobase + UART_FCR); /* Enable FIFO's */
 
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	outb(UART_IER_RLSI | UART_IER_RDI | UART_IER_THRI, iobase + UART_IER);
 
 	IRDA_DEBUG(2, "%s() speed changed to: %d\n", __FUNCTION__, speed);
@@ -1930,7 +1930,7 @@ void smsc_ircc_sir_start(struct smsc_ircc_cb *self)
 	outb(UART_LCR_WLEN8, sir_base + UART_LCR);  /* Reset DLAB */
 	outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), sir_base + UART_MCR);
 
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	outb(UART_IER_RLSI | UART_IER_RDI |UART_IER_THRI, sir_base + UART_IER);
 
 	IRDA_DEBUG(3, "%s() - exit\n", __FUNCTION__);
diff --git a/drivers/net/irda/via-ircc.h b/drivers/net/irda/via-ircc.h
index 204b1b3..9d012f0 100644
--- a/drivers/net/irda/via-ircc.h
+++ b/drivers/net/irda/via-ircc.h
@@ -54,13 +54,13 @@ struct st_fifo {
 
 struct frame_cb {
 	void *start;		/* Start of frame in DMA mem */
-	int len;		/* Lenght of frame in DMA mem */
+	int len;		/* Length of frame in DMA mem */
 };
 
 struct tx_fifo {
 	struct frame_cb queue[MAX_TX_WINDOW + 2];	/* Info about frames in queue */
 	int ptr;		/* Currently being sent */
-	int len;		/* Lenght of queue */
+	int len;		/* Length of queue */
 	int free;		/* Next free slot */
 	void *tail;		/* Next free start in DMA mem */
 };
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c
index 512e3b2..4b6359e 100644
--- a/drivers/net/ixgbe/ixgbe_common.c
+++ b/drivers/net/ixgbe/ixgbe_common.c
@@ -716,7 +716,7 @@ static s32 ixgbe_init_rx_addrs(struct ixgbe_hw *hw)
  *  bit-vector to set in the multicast table. The hardware uses 12 bits, from
  *  incoming rx multicast addresses, to determine the bit-vector to check in
  *  the MTA. Which of the 4 combination, of 12-bits, the hardware uses is set
- *  by the MO field of the MCSTCTRL. The MO field is set during initalization
+ *  by the MO field of the MCSTCTRL. The MO field is set during initialization
  *  to mc_filter_type.
  **/
 static s32 ixgbe_mta_vector(struct ixgbe_hw *hw, u8 *mc_addr)
@@ -1066,7 +1066,7 @@ s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw)
 
 
 /**
- *  ixgbe_acquire_swfw_sync - Aquire SWFW semaphore
+ *  ixgbe_acquire_swfw_sync - Acquire SWFW semaphore
  *  @hw: pointer to hardware structure
  *  @mask: Mask to specify wich semaphore to acquire
  *
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 00bc525..25a9cc2 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -592,7 +592,7 @@ quit_polling:
  * ixgbe_setup_msix - Initialize MSI-X interrupts
  *
  * ixgbe_setup_msix allocates MSI-X vectors and requests
- * interrutps from the kernel.
+ * interrupts from the kernel.
  **/
 static int ixgbe_setup_msix(struct ixgbe_adapter *adapter)
 {
diff --git a/drivers/net/lasi_82596.c b/drivers/net/lasi_82596.c
index efbae4b..1ba38c2 100644
--- a/drivers/net/lasi_82596.c
+++ b/drivers/net/lasi_82596.c
@@ -47,7 +47,7 @@
    TBD:
    * look at deferring rx frames rather than discarding (as per tulip)
    * handle tx ring full as per tulip
-   * performace test to tune rx_copybreak
+   * performance test to tune rx_copybreak
 
    Most of my modifications relate to the braindead big-endian
    implementation by Intel.  When the i596 is operating in
diff --git a/drivers/net/lib82596.c b/drivers/net/lib82596.c
index b59f442..c335d31 100644
--- a/drivers/net/lib82596.c
+++ b/drivers/net/lib82596.c
@@ -47,7 +47,7 @@
    TBD:
    * look at deferring rx frames rather than discarding (as per tulip)
    * handle tx ring full as per tulip
-   * performace test to tune rx_copybreak
+   * performance test to tune rx_copybreak
 
    Most of my modifications relate to the braindead big-endian
    implementation by Intel.  When the i596 is operating in
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 047ea7b..1367178 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -239,7 +239,7 @@ static int macb_mii_init(struct macb *bp)
 	struct eth_platform_data *pdata;
 	int err = -ENXIO, i;
 
-	/* Enable managment port */
+	/* Enable management port */
 	macb_writel(bp, NCR, MACB_BIT(MPE));
 
 	bp->mii_bus.name = "MACB_mii_bus",
diff --git a/drivers/net/meth.h b/drivers/net/meth.h
index a78dc1c..ecd0e97 100644
--- a/drivers/net/meth.h
+++ b/drivers/net/meth.h
@@ -127,7 +127,7 @@ typedef struct rx_packet {
 #define METH_ACCEPT_MY 0			/* 00: Accept PHY address only */
 #define METH_ACCEPT_MCAST 0x20	/* 01: Accept physical, broadcast, and multicast filter matches only */
 #define METH_ACCEPT_AMCAST 0x40	/* 10: Accept physical, broadcast, and all multicast packets */
-#define METH_PROMISC 0x60		/* 11: Promiscious mode */
+#define METH_PROMISC 0x60		/* 11: Promiscuous mode */
 
 #define METH_PHY_LINK_FAIL	BIT(7) /* 0: Link failure detection disabled, 1: Hardware scans for link failure in PHY */
 
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 651c269..c263c91 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -535,7 +535,7 @@ struct mv643xx_private {
 
 	int rx_resource_err;		/* Rx ring resource error flag */
 
-	/* Tx/Rx rings managment indexes fields. For driver use */
+	/* Tx/Rx rings management indexes fields. For driver use */
 
 	/* Next available and first returning Rx resource */
 	int rx_curr_desc_q, rx_used_desc_q;
@@ -757,7 +757,7 @@ static void mv643xx_eth_update_mac_address(struct net_device *dev)
 /*
  * mv643xx_eth_set_rx_mode
  *
- * Change from promiscuos to regular rx mode
+ * Change from promiscuous to regular rx mode
  *
  * Input :	pointer to ethernet interface network device structure
  * Output :	N/A
diff --git a/drivers/net/netxen/netxen_nic_hw.h b/drivers/net/netxen/netxen_nic_hw.h
index 245bf13..236160a 100644
--- a/drivers/net/netxen/netxen_nic_hw.h
+++ b/drivers/net/netxen/netxen_nic_hw.h
@@ -429,7 +429,7 @@ typedef enum {
 #define netxen_get_niu_enable_ge(config_word)	\
 		_netxen_crb_get_bit(config_word, 1)
 
-/* Promiscous mode options (GbE mode only) */
+/* Promiscuous mode options (GbE mode only) */
 typedef enum {
 	NETXEN_NIU_PROMISC_MODE = 0,
 	NETXEN_NIU_NON_PROMISC_MODE
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index 4f69037..9e1890f 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -2368,7 +2368,7 @@ find_compressor(int type)
 }
 
 /*
- * Miscelleneous stuff.
+ * Miscellaneous stuff.
  */
 
 static void
diff --git a/drivers/net/ps3_gelic_net.c b/drivers/net/ps3_gelic_net.c
index 0a42bf5..5efc5b4 100644
--- a/drivers/net/ps3_gelic_net.c
+++ b/drivers/net/ps3_gelic_net.c
@@ -1271,7 +1271,7 @@ static struct ethtool_ops gelic_net_ethtool_ops = {
 /**
  * gelic_net_tx_timeout_task - task scheduled by the watchdog timeout
  * function (to be called not under interrupt status)
- * @work: work is context of tx timout task
+ * @work: work is context of tx timeout task
  *
  * called as task when tx hangs, resets interface (if interface is up)
  */
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index a579111..da85b7f 100644
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -3691,7 +3691,7 @@ static int ql_adapter_up(struct ql3_adapter *qdev)
 		ql_sem_unlock(qdev, QL_DRVR_SEM_MASK);
 	} else {
 		printk(KERN_ERR PFX
-		       "%s: Could not aquire driver lock.\n",
+		       "%s: Could not acquire driver lock.\n",
 		       ndev->name);
 		goto err_lock;
 	}
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h
index cc1797a..63d45d4 100644
--- a/drivers/net/s2io.h
+++ b/drivers/net/s2io.h
@@ -740,7 +740,7 @@ struct mac_info {
 	u16 mc_pause_threshold_q0q3;
 	u16 mc_pause_threshold_q4q7;
 
-	void *stats_mem;	/* orignal pointer to allocated mem */
+	void *stats_mem;	/* original pointer to allocated mem */
 	dma_addr_t stats_mem_phy;	/* Physical address of the stat block */
 	u32 stats_mem_sz;
 	struct stat_block *stats_info;	/* Logical address of the stat block */
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
index 7200883..ff559e4 100644
--- a/drivers/net/sis190.c
+++ b/drivers/net/sis190.c
@@ -102,7 +102,7 @@ enum sis190_registers {
 	IntrStatus		= 0x20,
 	IntrMask		= 0x24,
 	IntrControl		= 0x28,
-	IntrTimer		= 0x2c,	// unused (Interupt Timer)
+	IntrTimer		= 0x2c,	// unused (Interrupt Timer)
 	PMControl		= 0x30,	// unused (Power Mgmt Control/Status)
 	rsv2			= 0x34,	// reserved
 	ROMControl		= 0x38,
diff --git a/drivers/net/sk98lin/skgepnmi.c b/drivers/net/sk98lin/skgepnmi.c
index b36dd9a..c761ff7 100644
--- a/drivers/net/sk98lin/skgepnmi.c
+++ b/drivers/net/sk98lin/skgepnmi.c
@@ -356,7 +356,7 @@ int Level)		/* Initialization level */
 	unsigned int	PortMax;	/* Number of ports */
 	unsigned int	PortIndex;	/* Current port index in loop */
 	SK_U16		Val16;		/* Multiple purpose 16 bit variable */
-	SK_U8		Val8;		/* Mulitple purpose 8 bit variable */
+	SK_U8		Val8;		/* Multiple purpose 8 bit variable */
 	SK_EVPARA	EventParam;	/* Event struct for timer event */
 	SK_PNMI_VCT	*pVctBackupData;
 
diff --git a/drivers/net/sk98lin/skxmac2.c b/drivers/net/sk98lin/skxmac2.c
index b4e7502..3994289 100644
--- a/drivers/net/sk98lin/skxmac2.c
+++ b/drivers/net/sk98lin/skxmac2.c
@@ -3891,7 +3891,7 @@ int SkXmOverflowStatus(
 SK_AC	*pAC,				/* adapter context */
 SK_IOC	IoC,				/* IO context */
 unsigned int Port,			/* Port Index (MAC_1 + n) */
-SK_U16	IStatus,			/* Interupt Status from MAC */
+SK_U16	IStatus,			/* Interrupt Status from MAC */
 SK_U64	SK_FAR *pStatus)	/* ptr for return overflow status value */
 {
 	SK_U64	Status;	/* Overflow status */
@@ -4036,7 +4036,7 @@ int SkGmOverflowStatus(
 SK_AC	*pAC,				/* adapter context */
 SK_IOC	IoC,				/* IO context */
 unsigned int Port,			/* Port Index (MAC_1 + n) */
-SK_U16	IStatus,			/* Interupt Status from MAC */
+SK_U16	IStatus,			/* Interrupt Status from MAC */
 SK_U64	SK_FAR *pStatus)	/* ptr for return overflow status value */
 {
 	SK_U64	Status;		/* Overflow status */
diff --git a/drivers/net/skfp/ess.c b/drivers/net/skfp/ess.c
index 62b0132..889f987 100644
--- a/drivers/net/skfp/ess.c
+++ b/drivers/net/skfp/ess.c
@@ -598,7 +598,7 @@ static void ess_send_alc_req(struct s_smc *smc)
 	req->cmd.sba_cmd = REQUEST_ALLOCATION ;
 
 	/*
-	 * set the parameter type and parameter lenght of all used
+	 * set the parameter type and parameter length of all used
 	 * parameters
 	 */
 
diff --git a/drivers/net/skfp/fplustm.c b/drivers/net/skfp/fplustm.c
index a45205d..b27a895 100644
--- a/drivers/net/skfp/fplustm.c
+++ b/drivers/net/skfp/fplustm.c
@@ -398,7 +398,7 @@ static void copy_tx_mac(struct s_smc *smc, u_long td, struct fddi_mac *mac,
 /* u_long td;		 transmit descriptor */
 /* struct fddi_mac *mac; mac frame pointer */
 /* unsigned off;	 start address within buffer memory */
-/* int len ;		 lenght of the frame including the FC */
+/* int len ;		 length of the frame including the FC */
 {
 	int	i ;
 	u_int	*p ;
@@ -1262,8 +1262,8 @@ Function	DOWNCALL/INTERN	(SMT, fplustm.c)
 
 Para	mode =	1	RX_ENABLE_ALLMULTI	enable all multicasts
 		2	RX_DISABLE_ALLMULTI	disable "enable all multicasts"
-		3	RX_ENABLE_PROMISC	enable promiscous
-		4	RX_DISABLE_PROMISC	disable promiscous
+		3	RX_ENABLE_PROMISC	enable promiscuous
+		4	RX_DISABLE_PROMISC	disable promiscuous
 		5	RX_ENABLE_NSA		enable reception of NSA frames
 		6	RX_DISABLE_NSA		disable reception of NSA frames
 
diff --git a/drivers/net/skfp/h/fplustm.h b/drivers/net/skfp/h/fplustm.h
index 98bbf65..586f055 100644
--- a/drivers/net/skfp/h/fplustm.h
+++ b/drivers/net/skfp/h/fplustm.h
@@ -237,8 +237,8 @@ struct s_smt_fp {
  */
 #define RX_ENABLE_ALLMULTI	1	/* enable all multicasts */
 #define RX_DISABLE_ALLMULTI	2	/* disable "enable all multicasts" */
-#define RX_ENABLE_PROMISC	3	/* enable promiscous */
-#define RX_DISABLE_PROMISC	4	/* disable promiscous */
+#define RX_ENABLE_PROMISC	3	/* enable promiscuous */
+#define RX_DISABLE_PROMISC	4	/* disable promiscuous */
 #define RX_ENABLE_NSA		5	/* enable reception of NSA frames */
 #define RX_DISABLE_NSA		6	/* disable reception of NSA frames */
 
diff --git a/drivers/net/skfp/h/smt.h b/drivers/net/skfp/h/smt.h
index 1ff5899..2976757 100644
--- a/drivers/net/skfp/h/smt.h
+++ b/drivers/net/skfp/h/smt.h
@@ -413,7 +413,7 @@ struct smt_p_reason {
 #define SMT_RDF_SUCCESS	0x00000003	/* success (PMF) */
 #define SMT_RDF_BADSET	0x00000004	/* bad set count (PMF) */
 #define SMT_RDF_ILLEGAL 0x00000005	/* read only (PMF) */
-#define SMT_RDF_NOPARAM	0x6		/* paramter not supported (PMF) */
+#define SMT_RDF_NOPARAM	0x6		/* parameter not supported (PMF) */
 #define SMT_RDF_RANGE	0x8		/* out of range */
 #define SMT_RDF_AUTHOR	0x9		/* not autohorized */
 #define SMT_RDF_LENGTH	0x0a		/* length error */
diff --git a/drivers/net/skfp/h/supern_2.h b/drivers/net/skfp/h/supern_2.h
index 5ba0b83..1074f96 100644
--- a/drivers/net/skfp/h/supern_2.h
+++ b/drivers/net/skfp/h/supern_2.h
@@ -386,7 +386,7 @@ struct tx_queue {
 #define	FM_MDISRCV	(4<<8)		/* disable receive function */
 #define	FM_MRES0	(5<<8)		/* reserve */
 #define	FM_MLIMPROM	(6<<8)		/* limited-promiscuous mode */
-#define FM_MPROMISCOUS	(7<<8)		/* address detection : promiscous */
+#define FM_MPROMISCOUS	(7<<8)		/* address detection : promiscuous */
 
 #define FM_SELSA	0x0800		/* select-short-address bit */
 
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 76cc1d3..648b904 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -466,7 +466,7 @@ static inline void	 smc911x_rcv(struct net_device *dev)
 		/* Align IP header to 32 bits
 		 * Note that the device is configured to add a 2
 		 * byte padding to the packet start, so we really
-		 * want to write to the orignal data pointer */
+		 * want to write to the original data pointer */
 		data = skb->data;
 		skb_reserve(skb, 2);
 		skb_put(skb,pkt_len-4);
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
index bccae7e..7a7f5cd 100644
--- a/drivers/net/spider_net.c
+++ b/drivers/net/spider_net.c
@@ -1826,7 +1826,7 @@ spider_net_enable_card(struct spider_net_card *card)
 
 	spider_net_write_reg(card, SPIDER_NET_ECMODE, SPIDER_NET_ECMODE_VALUE);
 
-	/* set chain tail adress for RX chains and
+	/* set chain tail address for RX chains and
 	 * enable DMA */
 	spider_net_enable_rxchtails(card);
 	spider_net_enable_rxdmac(card);
diff --git a/drivers/net/sunbmac.h b/drivers/net/sunbmac.h
index b563d3c..681442b 100644
--- a/drivers/net/sunbmac.h
+++ b/drivers/net/sunbmac.h
@@ -185,7 +185,7 @@
 #define BIGMAC_RXCFG_ENABLE    0x00000001 /* Enable the receiver                      */
 #define BIGMAC_RXCFG_FIFO      0x0000000e /* Default rx fthresh...                    */
 #define BIGMAC_RXCFG_PSTRIP    0x00000020 /* Pad byte strip enable                    */
-#define BIGMAC_RXCFG_PMISC     0x00000040 /* Enable promiscous mode                   */
+#define BIGMAC_RXCFG_PMISC     0x00000040 /* Enable promiscuous mode                  */
 #define BIGMAC_RXCFG_DERR      0x00000080 /* Disable error checking                   */
 #define BIGMAC_RXCFG_DCRCS     0x00000100 /* Disable CRC stripping                    */
 #define BIGMAC_RXCFG_ME        0x00000200 /* Receive packets addressed to me          */
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 6887214..097a065 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -780,7 +780,7 @@ static int gem_rx(struct gem *gp, int work_to_do)
 			break;
 
 		/* When writing back RX descriptor, GEM writes status
-		 * then buffer address, possibly in seperate transactions.
+		 * then buffer address, possibly in separate transactions.
 		 * If we don't wait for the chip to write both, we could
 		 * post a new buffer to this descriptor then have GEM spam
 		 * on the buffer address.  We sync on the RX completion
diff --git a/drivers/net/sunhme.h b/drivers/net/sunhme.h
index 90f446d..68bf4e1 100644
--- a/drivers/net/sunhme.h
+++ b/drivers/net/sunhme.h
@@ -223,7 +223,7 @@
 /* BigMac receive config register. */
 #define BIGMAC_RXCFG_ENABLE   0x00000001 /* Enable the receiver             */
 #define BIGMAC_RXCFG_PSTRIP   0x00000020 /* Pad byte strip enable           */
-#define BIGMAC_RXCFG_PMISC    0x00000040 /* Enable promiscous mode          */
+#define BIGMAC_RXCFG_PMISC    0x00000040 /* Enable promiscuous mode         */
 #define BIGMAC_RXCFG_DERR     0x00000080 /* Disable error checking          */
 #define BIGMAC_RXCFG_DCRCS    0x00000100 /* Disable CRC stripping           */
 #define BIGMAC_RXCFG_REJME    0x00000200 /* Reject packets addressed to me  */
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c
index d887c05..0fbf96d 100644
--- a/drivers/net/tc35815.c
+++ b/drivers/net/tc35815.c
@@ -136,7 +136,7 @@ struct tc35815_regs {
 #define DMA_RxAlign_2          0x00800000
 #define DMA_RxAlign_3          0x00c00000
 #define DMA_M66EnStat          0x00080000 /* 1:66MHz Enable State            */
-#define DMA_IntMask            0x00040000 /* 1:Interupt mask                 */
+#define DMA_IntMask            0x00040000 /* 1:Interrupt mask                 */
 #define DMA_SWIntReq           0x00020000 /* 1:Software Interrupt request    */
 #define DMA_TxWakeUp           0x00010000 /* 1:Transmit Wake Up              */
 #define DMA_RxBigE             0x00008000 /* 1:Receive Big Endian            */
@@ -281,7 +281,7 @@ struct tc35815_regs {
 #define Int_IntMacTx           0x00000001 /* 1:Tx controller & Clear         */
 
 /* MD_CA bit asign --------------------------------------------------------- */
-#define MD_CA_PreSup           0x00001000 /* 1:Preamble Supress              */
+#define MD_CA_PreSup           0x00001000 /* 1:Preamble Suppress             */
 #define MD_CA_Busy             0x00000800 /* 1:Busy (Start Operation)        */
 #define MD_CA_Wr               0x00000400 /* 1:Write 0:Read                  */
 
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c
index 21230c9..3ed1973 100644
--- a/drivers/net/tehuti.c
+++ b/drivers/net/tehuti.c
@@ -276,7 +276,7 @@ static irqreturn_t bdx_isr_napi(int irq, void *dev)
 			 * currently intrs are disabled (since we read ISR),
 			 * and we have failed to register next poll.
 			 * so we read the regs to trigger chip
-			 * and allow further interupts. */
+			 * and allow further interrupts. */
 			READ_REG(priv, regTXF_WPTR_0);
 			READ_REG(priv, regRXD_WPTR_0);
 		}
diff --git a/drivers/net/tehuti.h b/drivers/net/tehuti.h
index efd170f..992efa6 100644
--- a/drivers/net/tehuti.h
+++ b/drivers/net/tehuti.h
@@ -510,7 +510,7 @@ struct txd_desc {
 #define  GMAC_RX_FILTER_ACRC  0x0010	/* accept crc error */
 #define  GMAC_RX_FILTER_AM    0x0008	/* accept multicast */
 #define  GMAC_RX_FILTER_AB    0x0004	/* accept broadcast */
-#define  GMAC_RX_FILTER_PRM   0x0001	/* [0:1] promiscous mode */
+#define  GMAC_RX_FILTER_PRM   0x0001	/* [0:1] promiscuous mode */
 
 #define  MAX_FRAME_AB_VAL       0x3fff	/* 13:0 */
 
diff --git a/drivers/net/tokenring/3c359.c b/drivers/net/tokenring/3c359.c
index 5d31519..9d7a0c9 100644
--- a/drivers/net/tokenring/3c359.c
+++ b/drivers/net/tokenring/3c359.c
@@ -75,7 +75,7 @@ static char version[] __devinitdata  =
 MODULE_AUTHOR("Mike Phillips <mikep@linuxtr.net>") ; 
 MODULE_DESCRIPTION("3Com 3C359 Velocity XL Token Ring Adapter Driver \n") ;
 
-/* Module paramters */
+/* Module parameters */
 
 /* Ring Speed 0,4,16 
  * 0 = Autosense   
diff --git a/drivers/net/tokenring/lanstreamer.c b/drivers/net/tokenring/lanstreamer.c
index 47d84cd..21c4f3c 100644
--- a/drivers/net/tokenring/lanstreamer.c
+++ b/drivers/net/tokenring/lanstreamer.c
@@ -170,7 +170,7 @@ static char *open_min_error[] = {
 	"Monitor Contention failer for RPL", "FDX Protocol Error"
 };
 
-/* Module paramters */
+/* Module parameters */
 
 /* Ring Speed 0,4,16
  * 0 = Autosense         
diff --git a/drivers/net/tokenring/olympic.c b/drivers/net/tokenring/olympic.c
index 74c1f0f..b1178f1 100644
--- a/drivers/net/tokenring/olympic.c
+++ b/drivers/net/tokenring/olympic.c
@@ -132,7 +132,7 @@ static char *open_min_error[] = {"No error", "Function Failure", "Signal Lost",
 				   "Reserved", "Reserved", "No Monitor Detected for RPL", 
 				   "Monitor Contention failer for RPL", "FDX Protocol Error"};
 
-/* Module paramters */
+/* Module parameters */
 
 MODULE_AUTHOR("Mike Phillips <mikep@linuxtr.net>") ; 
 MODULE_DESCRIPTION("Olympic PCI/Cardbus Chipset Driver") ; 
diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c
index 93da3a3..4238a61 100644
--- a/drivers/net/tokenring/smctr.c
+++ b/drivers/net/tokenring/smctr.c
@@ -2426,7 +2426,7 @@ static irqreturn_t smctr_interrupt(int irq, void *dev_id)
                                 break ;
 
                         /* Type 0x0E - TRC Initialization Sequence Interrupt
-                         * Subtype -- 00-FF Initializatin sequence complete
+                         * Subtype -- 00-FF Initialization sequence complete
                          */
                         case ISB_IMC_TRC_INTRNL_TST_STATUS:
                                 tp->status = INITIALIZED;
@@ -3055,8 +3055,8 @@ static int smctr_load_node_addr(struct net_device *dev)
  * disabled.!?
  *
  * NOTE 2: If the monitor_state is MS_BEACON_TEST_STATE and the receive_mask
- * has any multi-cast or promiscous bits set, the receive_mask needs to
- * be changed to clear the multi-cast or promiscous mode bits, the lobe_test
+ * has any multi-cast or promiscuous bits set, the receive_mask needs to
+ * be changed to clear the multi-cast or promiscuous mode bits, the lobe_test
  * run, and then the receive mask set back to its original value if the test
  * is successful.
  */
diff --git a/drivers/net/tokenring/tms380tr.c b/drivers/net/tokenring/tms380tr.c
index d5fa36d..b15435d 100644
--- a/drivers/net/tokenring/tms380tr.c
+++ b/drivers/net/tokenring/tms380tr.c
@@ -48,7 +48,7 @@
  *	25-Sep-99	AF	Uped TPL_NUM from 3 to 9
  *				Removed extraneous 'No free TPL'
  *	22-Dec-99	AF	Added Madge PCI Mk2 support and generalized
- *				parts of the initilization procedure.
+ *				parts of the initialization procedure.
  *	30-Dec-99	AF	Turned tms380tr into a library ala 8390.
  *				Madge support is provided in the abyss module
  *				Generic PCI support is in the tmspci module.
diff --git a/drivers/net/tokenring/tms380tr.h b/drivers/net/tokenring/tms380tr.h
index 7daf74e..1cbb8b8 100644
--- a/drivers/net/tokenring/tms380tr.h
+++ b/drivers/net/tokenring/tms380tr.h
@@ -441,7 +441,7 @@ typedef struct {
 #define PASS_FIRST_BUF_ONLY	0x0100	/* Passes only first internal buffer
 					 * of each received frame; FrameSize
 					 * of RPLs must contain internal
-					 * BUFFER_SIZE bits for promiscous mode.
+					 * BUFFER_SIZE bits for promiscuous mode.
 					 */
 #define ENABLE_FULL_DUPLEX_SELECTION	0x2000 
  					/* Enable the use of full-duplex
diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c
index 70befe3..5dad012 100644
--- a/drivers/net/tulip/xircom_cb.c
+++ b/drivers/net/tulip/xircom_cb.c
@@ -646,7 +646,7 @@ static void setup_descriptors(struct xircom_private *card)
 	}
 
 	wmb();
-	/* wite the transmit descriptor ring to the card */
+	/* write the transmit descriptor ring to the card */
 	address = (unsigned long) card->tx_dma_handle;
 	val =cpu_to_le32(address);
 	outl(val, card->io_port + CSR4);	/* xmit descr list address */
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 1f76446..fc9eada 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -142,7 +142,7 @@ add_multi(u32* filter, const u8* addr)
 	filter[bit_nr >> 5] |= 1 << (bit_nr & 31);
 }
 
-/** Remove the specified Ethernet addres from this multicast filter. */
+/** Remove the specified Ethernet address from this multicast filter. */
 static void
 del_multi(u32* filter, const u8* addr)
 {
@@ -399,7 +399,7 @@ static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv,
 		 * - the packet is addressed to us.
 		 * - the packet is broadcast.
 		 * - the packet is multicast and
-		 *   - we are multicast promiscous.
+		 *   - we are multicast promiscuous.
 		 *   - we belong to the multicast group.
 		 */
 		skb_copy_from_linear_data(skb, addr, min_t(size_t, sizeof addr,
diff --git a/drivers/net/ucc_geth_ethtool.c b/drivers/net/ucc_geth_ethtool.c
index 9a9622c..f8d319b 100644
--- a/drivers/net/ucc_geth_ethtool.c
+++ b/drivers/net/ucc_geth_ethtool.c
@@ -7,7 +7,7 @@
  *
  * Limitation: 
  * Can only get/set setttings of the first queue.
- * Need to re-open the interface manually after changing some paramters.
+ * Need to re-open the interface manually after changing some parameters.
  *
  * This program is free software; you can redistribute  it and/or modify it
  * under  the terms of  the GNU General  Public License as published by the
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c
index df884f0..7c0d4a8 100644
--- a/drivers/net/ucc_geth_mii.c
+++ b/drivers/net/ucc_geth_mii.c
@@ -63,11 +63,11 @@ int uec_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value)
 {
 	struct ucc_mii_mng __iomem *regs = (void __iomem *)bus->priv;
 
-	/* Setting up the MII Mangement Address Register */
+	/* Setting up the MII Management Address Register */
 	out_be32(&regs->miimadd,
 		 (mii_id << MIIMADD_PHY_ADDRESS_SHIFT) | regnum);
 
-	/* Setting up the MII Mangement Control Register with the value */
+	/* Setting up the MII Management Control Register with the value */
 	out_be32(&regs->miimcon, value);
 
 	/* Wait till MII management write is complete */
@@ -85,7 +85,7 @@ int uec_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
 	struct ucc_mii_mng __iomem *regs = (void __iomem *)bus->priv;
 	u16 value;
 
-	/* Setting up the MII Mangement Address Register */
+	/* Setting up the MII Management Address Register */
 	out_be32(&regs->miimadd,
 		 (mii_id << MIIMADD_PHY_ADDRESS_SHIFT) | regnum);
 
diff --git a/drivers/net/wan/cycx_drv.c b/drivers/net/wan/cycx_drv.c
index d347d59..d14e667 100644
--- a/drivers/net/wan/cycx_drv.c
+++ b/drivers/net/wan/cycx_drv.c
@@ -322,7 +322,7 @@ static int cycx_data_boot(void __iomem *addr, u8 *code, u32 len)
 	void __iomem *pt_boot_cmd = addr + CMD_OFFSET;
 	u32 i;
 
-	/* boot buffer lenght */
+	/* boot buffer length */
 	writew(CFM_LOAD_BUFSZ, pt_boot_cmd + sizeof(u16));
 	writew(GEN_DEFPAR, pt_boot_cmd);
 
@@ -353,7 +353,7 @@ static int cycx_code_boot(void __iomem *addr, u8 *code, u32 len)
 	void __iomem *pt_boot_cmd = addr + CMD_OFFSET;
 	u32 i;
 
-	/* boot buffer lenght */
+	/* boot buffer length */
 	writew(CFM_LOAD_BUFSZ, pt_boot_cmd + sizeof(u16));
 	writew(GEN_DEFPAR, pt_boot_cmd);
 
diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c
index 2e8b5c2..74f87df 100644
--- a/drivers/net/wan/sbni.c
+++ b/drivers/net/wan/sbni.c
@@ -1472,7 +1472,7 @@ sbni_get_stats( struct net_device  *dev )
 static void
 set_multicast_list( struct net_device  *dev )
 {
-	return;		/* sbni always operate in promiscuos mode */
+	return;		/* sbni always operate in promiscuous mode */
 }
 
 
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index 059ce3f..60dfdd9 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -3278,7 +3278,7 @@ static void atmel_smooth_qual(struct atmel_private *priv)
 	priv->wstats.qual.updated &= ~IW_QUAL_QUAL_INVALID;
 }
 
-/* deals with incoming managment frames. */
+/* deals with incoming management frames. */
 static void atmel_management_frame(struct atmel_private *priv,
 				   struct ieee80211_hdr_4addr *header,
 				   u16 frame_len, u8 rssi)
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h
index a40d1af..edf7d8f 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h
@@ -28,7 +28,7 @@ struct bcm43xx_dfsentry {
 	struct bcm43xx_xmitstatus *xmitstatus_buffer;
 	int xmitstatus_ptr;
 	int xmitstatus_cnt;
-	/* We need a seperate buffer while printing to avoid
+	/* We need a separate buffer while printing to avoid
 	 * concurrency issues. (New xmitstatus can arrive
 	 * while we are printing).
 	 */
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 54f44e5..e24382f 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -1144,7 +1144,7 @@ static void ipw_led_shutdown(struct ipw_priv *priv)
 /*
  * The following adds a new attribute to the sysfs representation
  * of this device driver (i.e. a new file in /sys/bus/pci/drivers/ipw/)
- * used for controling the debug level.
+ * used for controlling the debug level.
  *
  * See the level definitions in ipw for details.
  */
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 891f90d..e242647 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -4051,7 +4051,7 @@ static int iwl4965_tx_status_reply_compressed_ba(struct iwl_priv *priv,
 	agg->wait_for_ba = 0;
 	IWL_DEBUG_TX_REPLY("BA %d %d\n", agg->start_idx, ba_resp->ba_seq_ctl);
 	sh = agg->start_idx - SEQ_TO_INDEX(ba_seq_ctl>>4);
-	if (sh < 0) /* tbw something is wrong with indeces */
+	if (sh < 0) /* tbw something is wrong with indices */
 		sh += 0x100;
 
 	/* don't use 64 bits for now */
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index be5cfd8..31ee4f6 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -1120,7 +1120,7 @@ int libertas_set_mac_packet_filter(wlan_private * priv)
  *  @param cmd_action	command action: GET or SET
  *  @param wait_option	wait option: wait response or not
  *  @param cmd_oid	cmd oid: treated as sub command
- *  @param pdata_buf	A pointer to informaion buffer
+ *  @param pdata_buf	A pointer to information buffer
  *  @return 		0 or -1
  */
 int libertas_prepare_and_send_command(wlan_private * priv,
@@ -1606,7 +1606,7 @@ static void cleanup_cmdnode(struct cmd_ctrl_node *ptempnode)
  *  @param ptempnode	A pointer to cmd_ctrl_node structure
  *  @param cmd_oid	cmd oid: treated as sub command
  *  @param wait_option	wait option: wait response or not
- *  @param pdata_buf	A pointer to informaion buffer
+ *  @param pdata_buf	A pointer to information buffer
  *  @return 		0 or -1
  */
 void libertas_set_cmd_ctrl_node(wlan_private * priv,
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index ad1e67d..537b36c 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -443,7 +443,7 @@ wlan_scan_setup_scan_config(wlan_private * priv,
 	ptlvpos = pscancfgout->tlvbuffer;
 
 	/*
-	 * Set the initial scan paramters for progressive scanning.  If a specific
+	 * Set the initial scan parameters for progressive scanning.  If a specific
 	 *   BSSID or SSID is used, the number of channels in the scan command
 	 *   will be increased to the absolute maximum
 	 */
@@ -1679,7 +1679,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
  *
  *  Called from libertas_prepare_and_send_command() in cmd.c
  *
- *  Sends a fixed lenght data part (specifying the BSS type and BSSID filters)
+ *  Sends a fixed length data part (specifying the BSS type and BSSID filters)
  *  as well as a variable number/length of TLVs to the firmware.
  *
  *  @param priv       A pointer to wlan_private structure
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c
index d2fa079..c4b649e 100644
--- a/drivers/net/wireless/netwave_cs.c
+++ b/drivers/net/wireless/netwave_cs.c
@@ -1408,7 +1408,7 @@ static void set_multicast_list(struct net_device *dev)
 	/* Multicast Mode */
 	rcvMode = rxConfRxEna + rxConfAMP + rxConfBcast;
     } else if (dev->flags & IFF_PROMISC) {
-	/* Promiscous mode */
+	/* Promiscuous mode */
 	rcvMode = rxConfRxEna + rxConfPro + rxConfAMP + rxConfBcast;
     } else {
 	/* Normal mode */
diff --git a/drivers/net/wireless/orinoco.h b/drivers/net/wireless/orinoco.h
index 4720fb2..703a4cf 100644
--- a/drivers/net/wireless/orinoco.h
+++ b/drivers/net/wireless/orinoco.h
@@ -108,7 +108,7 @@ struct orinoco_private {
 	int	scan_inprogress;	/* Scan pending... */
 	u32	scan_mode;		/* Type of scan done */
 	char *	scan_result;		/* Result of previous scan */
-	int	scan_len;		/* Lenght of result */
+	int	scan_len;		/* Length of result */
 };
 
 #ifdef ORINOCO_DEBUG
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index f87fe10..24f9066 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -129,7 +129,7 @@ static void ray_reset(struct net_device *dev);
 static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, int len);
 static void verify_dl_startup(u_long);
 
-/* Prototypes for interrpt time functions **********************************/
+/* Prototypes for interrupt time functions **********************************/
 static irqreturn_t ray_interrupt (int reg, void *dev_id);
 static void clear_interrupt(ray_dev_t *local);
 static void rx_deauthenticate(ray_dev_t *local, struct rcs __iomem *prcs, 
diff --git a/drivers/net/wireless/rt2x00/rt2x00reg.h b/drivers/net/wireless/rt2x00/rt2x00reg.h
index 8384212..fe9011d 100644
--- a/drivers/net/wireless/rt2x00/rt2x00reg.h
+++ b/drivers/net/wireless/rt2x00/rt2x00reg.h
@@ -230,7 +230,7 @@ static inline u8 rt2x00_get_field8(const u8 reg,
  *	corresponds with the TX register format for the current device.
  *	4 - plcp, 802.11b rates are device specific,
  *	802.11g rates are set according to the ieee802.11a-1999 p.14.
- * The bit to enable preamble is set in a seperate define.
+ * The bit to enable preamble is set in a separate define.
  */
 #define DEV_RATE	FIELD32(0x000007ff)
 #define DEV_PREAMBLE	FIELD32(0x00000800)
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.h b/drivers/net/wireless/rt2x00/rt2x00usb.h
index 2681abe..b76881f 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.h
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.h
@@ -135,13 +135,13 @@ static inline int rt2x00usb_vendor_request_sw(const struct rt2x00_dev
  * kmalloc for correct handling inside the kernel USB layer.
  */
 static inline int rt2x00usb_eeprom_read(const struct rt2x00_dev *rt2x00dev,
-					 __le16 *eeprom, const u16 lenght)
+					 __le16 *eeprom, const u16 length)
 {
-	int timeout = REGISTER_TIMEOUT * (lenght / sizeof(u16));
+	int timeout = REGISTER_TIMEOUT * (length / sizeof(u16));
 
 	return rt2x00usb_vendor_request(rt2x00dev, USB_EEPROM_READ,
 					USB_VENDOR_REQUEST_IN, 0x0000,
-					0x0000, eeprom, lenght, timeout);
+					0x0000, eeprom, length, timeout);
 }
 
 /*
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index c0671c2..d1468a1 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -833,7 +833,7 @@ static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev, void *data,
 
 	/*
 	 * Write firmware to device.
-	 * We setup a seperate cache for this action,
+	 * We setup a separate cache for this action,
 	 * since we are going to write larger chunks of data
 	 * then normally used cache size.
 	 */
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c
index 577c647..5d28105 100644
--- a/drivers/net/wireless/wavelan_cs.c
+++ b/drivers/net/wireless/wavelan_cs.c
@@ -159,7 +159,7 @@ psa_read(struct net_device *	dev,
 
 /*------------------------------------------------------------------*/
 /*
- * Write the Paramter Storage Area to the WaveLAN card's memory
+ * Write the Parameter Storage Area to the WaveLAN card's memory
  */
 static void
 psa_write(struct net_device *	dev,
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.h b/drivers/net/wireless/zd1211rw/zd_chip.h
index 8009b70..301315a 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.h
+++ b/drivers/net/wireless/zd1211rw/zd_chip.h
@@ -620,8 +620,8 @@ enum {
 #define E2P_PWR_INT_GUARD		8
 #define E2P_CHANNEL_COUNT		14
 
-/* If you compare this addresses with the ZYDAS orignal driver, please notify
- * that we use word mapping for the EEPROM.
+/* If you compare these addresses with the ZYDAS original driver,
+ * please notice that we use word mapping for the EEPROM.
  */
 
 /*
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
index 87f002a..cb6e978 100644
--- a/drivers/net/yellowfin.c
+++ b/drivers/net/yellowfin.c
@@ -533,7 +533,7 @@ static int __devinit read_eeprom(void __iomem *ioaddr, int location)
 	return ioread8(ioaddr + EERead);
 }
 
-/* MII Managemen Data I/O accesses.
+/* MII Management Data I/O accesses.
    These routines assume the MDIO controller is idle, and do not exit until
    the command is finished. */
 
-- 
1.5.3.7.949.g2221a6

^ permalink raw reply related

* [PATCH] drivers/net/: Spelling fixes
From: Joe Perches @ 2007-12-17 19:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: Pavel Roskin, Eugene Surovegin, Geoff Levand, David Gibson,
	orinoco-devel, Yi Zhu, Jaroslav Kysela, linuxppc-dev, netdev,
	Paul Mackerras, Peter De Shrijver, Rastapur Santosh,
	bonding-devel, Andy Gospodarek, Amit S. Kale, ipw2100-devel,
	ipw3945-devel, Masakazu Mokuno, libertas-dev, Dan Williams,
	Dale Farnsworth, Jay Vosburgh, Jesse Brandeburg,
	Manish Lachwani <m


Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/net/82596.c                            |    2 +-
 drivers/net/amd8111e.c                         |    8 ++++----
 drivers/net/amd8111e.h                         |    2 +-
 drivers/net/appletalk/ltpc.c                   |    2 +-
 drivers/net/atl1/atl1_hw.c                     |    2 +-
 drivers/net/atl1/atl1_main.c                   |    2 +-
 drivers/net/bonding/bond_3ad.c                 |    4 ++--
 drivers/net/chelsio/sge.c                      |    2 +-
 drivers/net/chelsio/subr.c                     |    2 +-
 drivers/net/cxgb3/t3_hw.c                      |    2 +-
 drivers/net/e1000/e1000_hw.c                   |    4 ++--
 drivers/net/e1000/e1000_hw.h                   |    2 +-
 drivers/net/e1000/e1000_main.c                 |    2 +-
 drivers/net/e1000e/netdev.c                    |    2 +-
 drivers/net/eepro.c                            |    2 +-
 drivers/net/ehea/ehea.h                        |    2 +-
 drivers/net/forcedeth.c                        |    2 +-
 drivers/net/hamachi.c                          |    4 ++--
 drivers/net/hp100.c                            |    2 +-
 drivers/net/hp100.h                            |    4 ++--
 drivers/net/ibm_emac/ibm_emac.h                |    2 +-
 drivers/net/ibm_newemac/emac.h                 |    2 +-
 drivers/net/ibmlana.c                          |    2 +-
 drivers/net/ibmlana.h                          |    2 +-
 drivers/net/ipg.c                              |    4 ++--
 drivers/net/irda/ali-ircc.c                    |    6 +++---
 drivers/net/irda/ali-ircc.h                    |    4 ++--
 drivers/net/irda/donauboe.h                    |    2 +-
 drivers/net/irda/irport.c                      |    4 ++--
 drivers/net/irda/nsc-ircc.h                    |    4 ++--
 drivers/net/irda/smsc-ircc2.c                  |    4 ++--
 drivers/net/irda/via-ircc.h                    |    4 ++--
 drivers/net/ixgbe/ixgbe_common.c               |    4 ++--
 drivers/net/ixgbe/ixgbe_main.c                 |    2 +-
 drivers/net/lasi_82596.c                       |    2 +-
 drivers/net/lib82596.c                         |    2 +-
 drivers/net/macb.c                             |    2 +-
 drivers/net/meth.h                             |    2 +-
 drivers/net/mv643xx_eth.c                      |    4 ++--
 drivers/net/netxen/netxen_nic_hw.h             |    2 +-
 drivers/net/ppp_generic.c                      |    2 +-
 drivers/net/ps3_gelic_net.c                    |    2 +-
 drivers/net/qla3xxx.c                          |    2 +-
 drivers/net/s2io.h                             |    2 +-
 drivers/net/sis190.c                           |    2 +-
 drivers/net/sk98lin/skgepnmi.c                 |    2 +-
 drivers/net/sk98lin/skxmac2.c                  |    4 ++--
 drivers/net/skfp/ess.c                         |    2 +-
 drivers/net/skfp/fplustm.c                     |    6 +++---
 drivers/net/skfp/h/fplustm.h                   |    4 ++--
 drivers/net/skfp/h/smt.h                       |    2 +-
 drivers/net/skfp/h/supern_2.h                  |    2 +-
 drivers/net/smc911x.c                          |    2 +-
 drivers/net/spider_net.c                       |    2 +-
 drivers/net/sunbmac.h                          |    2 +-
 drivers/net/sungem.c                           |    2 +-
 drivers/net/sunhme.h                           |    2 +-
 drivers/net/tc35815.c                          |    4 ++--
 drivers/net/tehuti.c                           |    2 +-
 drivers/net/tehuti.h                           |    2 +-
 drivers/net/tokenring/3c359.c                  |    2 +-
 drivers/net/tokenring/lanstreamer.c            |    2 +-
 drivers/net/tokenring/olympic.c                |    2 +-
 drivers/net/tokenring/smctr.c                  |    6 +++---
 drivers/net/tokenring/tms380tr.c               |    2 +-
 drivers/net/tokenring/tms380tr.h               |    2 +-
 drivers/net/tulip/xircom_cb.c                  |    2 +-
 drivers/net/tun.c                              |    4 ++--
 drivers/net/ucc_geth_ethtool.c                 |    2 +-
 drivers/net/ucc_geth_mii.c                     |    6 +++---
 drivers/net/wan/cycx_drv.c                     |    4 ++--
 drivers/net/wan/sbni.c                         |    2 +-
 drivers/net/wireless/atmel.c                   |    2 +-
 drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h |    2 +-
 drivers/net/wireless/ipw2200.c                 |    2 +-
 drivers/net/wireless/iwlwifi/iwl-4965.c        |    2 +-
 drivers/net/wireless/libertas/cmd.c            |    4 ++--
 drivers/net/wireless/libertas/scan.c           |    4 ++--
 drivers/net/wireless/netwave_cs.c              |    2 +-
 drivers/net/wireless/orinoco.h                 |    2 +-
 drivers/net/wireless/ray_cs.c                  |    2 +-
 drivers/net/wireless/rt2x00/rt2x00reg.h        |    2 +-
 drivers/net/wireless/rt2x00/rt2x00usb.h        |    6 +++---
 drivers/net/wireless/rt2x00/rt73usb.c          |    2 +-
 drivers/net/wireless/wavelan_cs.c              |    2 +-
 drivers/net/wireless/zd1211rw/zd_chip.h        |    4 ++--
 drivers/net/yellowfin.c                        |    2 +-
 87 files changed, 120 insertions(+), 120 deletions(-)

diff --git a/drivers/net/82596.c b/drivers/net/82596.c
index 2797da7..d999b63 100644
--- a/drivers/net/82596.c
+++ b/drivers/net/82596.c
@@ -19,7 +19,7 @@
    TBD:
    * look at deferring rx frames rather than discarding (as per tulip)
    * handle tx ring full as per tulip
-   * performace test to tune rx_copybreak
+   * performance test to tune rx_copybreak
 
    Most of my modifications relate to the braindead big-endian
    implementation by Intel.  When the i596 is operating in
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c
index e7fdd81..5cefe92 100644
--- a/drivers/net/amd8111e.c
+++ b/drivers/net/amd8111e.c
@@ -1283,7 +1283,7 @@ static irqreturn_t amd8111e_interrupt(int irq, void *dev_id)
 #ifdef CONFIG_AMD8111E_NAPI
 	if(intr0 & RINT0){
 		if(netif_rx_schedule_prep(dev, &lp->napi)){
-			/* Disable receive interupts */
+			/* Disable receive interrupts */
 			writel(RINTEN0, mmio + INTEN0);
 			/* Schedule a polling routine */
 			__netif_rx_schedule(dev, &lp->napi);
@@ -1493,7 +1493,7 @@ static void amd8111e_read_regs(struct amd8111e_priv *lp, u32 *buf)
 
 
 /*
-This function sets promiscuos mode, all-multi mode or the multicast address
+This function sets promiscuous mode, all-multi mode or the multicast address
 list to the device.
 */
 static void amd8111e_set_multicast_list(struct net_device *dev)
@@ -1522,7 +1522,7 @@ static void amd8111e_set_multicast_list(struct net_device *dev)
 		lp->mc_list = NULL;
 		lp->options &= ~OPTION_MULTICAST_ENABLE;
 		amd8111e_writeq(*(u64*)mc_filter,lp->mmio + LADRF);
-		/* disable promiscous mode */
+		/* disable promiscuous mode */
 		writel(PROM, lp->mmio + CMD2);
 		return;
 	}
@@ -2016,7 +2016,7 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev,
 	for(i = 0; i < ETH_ADDR_LEN; i++)
 		dev->dev_addr[i] = readb(lp->mmio + PADR + i);
 
-	/* Setting user defined parametrs */
+	/* Setting user defined parameters */
 	lp->ext_phy_option = speed_duplex[card_idx];
 	if(coalesce[card_idx])
 		lp->options |= OPTION_INTR_COAL_ENABLE;
diff --git a/drivers/net/amd8111e.h b/drivers/net/amd8111e.h
index 28c60a7..7d288de 100644
--- a/drivers/net/amd8111e.h
+++ b/drivers/net/amd8111e.h
@@ -614,7 +614,7 @@ typedef enum {
 #define CSTATE  1
 #define SSTATE  2
 
-/* Assume contoller gets data 10 times the maximum processing time */
+/* Assume controller gets data 10 times the maximum processing time */
 #define  REPEAT_CNT			10
 
 /* amd8111e decriptor flag definitions */
diff --git a/drivers/net/appletalk/ltpc.c b/drivers/net/appletalk/ltpc.c
index 6ab2c2d..86a9496 100644
--- a/drivers/net/appletalk/ltpc.c
+++ b/drivers/net/appletalk/ltpc.c
@@ -1233,7 +1233,7 @@ static int __init ltpc_setup(char *str)
 		if (ints[0] > 2) {
 			dma = ints[3];
 		}
-		/* ignore any other paramters */
+		/* ignore any other parameters */
 	}
 	return 1;
 }
diff --git a/drivers/net/atl1/atl1_hw.c b/drivers/net/atl1/atl1_hw.c
index 9d3bd22..82359f7 100644
--- a/drivers/net/atl1/atl1_hw.c
+++ b/drivers/net/atl1/atl1_hw.c
@@ -645,7 +645,7 @@ s32 atl1_init_hw(struct atl1_hw *hw)
 	atl1_init_flash_opcode(hw);
 
 	if (!hw->phy_configured) {
-		/* enable GPHY LinkChange Interrrupt */
+		/* enable GPHY LinkChange Interrupt */
 		ret_val = atl1_write_phy_reg(hw, 18, 0xC00);
 		if (ret_val)
 			return ret_val;
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 35b0a7d..7599163 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -575,7 +575,7 @@ static u32 atl1_check_link(struct atl1_adapter *adapter)
 		return ATL1_SUCCESS;
 	}
 
-	/* change orignal link status */
+	/* change original link status */
 	if (netif_carrier_ok(netdev)) {
 		adapter->link_speed = SPEED_0;
 		netif_carrier_off(netdev);
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index cb3c6fa..96f0f24 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -869,7 +869,7 @@ static int ad_lacpdu_send(struct port *port)
 	lacpdu_header = (struct lacpdu_header *)skb_put(skb, length);
 
 	lacpdu_header->ad_header.destination_address = lacpdu_multicast_address;
-	/* Note: source addres is set to be the member's PERMANENT address, because we use it
+	/* Note: source address is set to be the member's PERMANENT address, because we use it
 	   to identify loopback lacpdus in receive. */
 	lacpdu_header->ad_header.source_address = *((struct mac_addr *)(slave->perm_hwaddr));
 	lacpdu_header->ad_header.length_type = PKT_TYPE_LACPDU;
@@ -912,7 +912,7 @@ static int ad_marker_send(struct port *port, struct bond_marker *marker)
 	marker_header = (struct bond_marker_header *)skb_put(skb, length);
 
 	marker_header->ad_header.destination_address = lacpdu_multicast_address;
-	/* Note: source addres is set to be the member's PERMANENT address, because we use it
+	/* Note: source address is set to be the member's PERMANENT address, because we use it
 	   to identify loopback MARKERs in receive. */
 	marker_header->ad_header.source_address = *((struct mac_addr *)(slave->perm_hwaddr));
 	marker_header->ad_header.length_type = PKT_TYPE_LACPDU;
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c
index b301c04..ed17cd9 100644
--- a/drivers/net/chelsio/sge.c
+++ b/drivers/net/chelsio/sge.c
@@ -248,7 +248,7 @@ static void restart_sched(unsigned long);
  *
  * Interrupts are handled by a single CPU and it is likely that on a MP system
  * the application is migrated to another CPU. In that scenario, we try to
- * seperate the RX(in irq context) and TX state in order to decrease memory
+ * separate the RX(in irq context) and TX state in order to decrease memory
  * contention.
  */
 struct sge {
diff --git a/drivers/net/chelsio/subr.c b/drivers/net/chelsio/subr.c
index dc50151..7c95578 100644
--- a/drivers/net/chelsio/subr.c
+++ b/drivers/net/chelsio/subr.c
@@ -559,7 +559,7 @@ struct chelsio_vpd_t {
 #define EEPROM_MAX_POLL   4
 
 /*
- * Read SEEPROM. A zero is written to the flag register when the addres is
+ * Read SEEPROM. A zero is written to the flag register when the address is
  * written to the Control register. The hardware device will set the flag to a
  * one when 4B have been transferred to the Data register.
  */
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 522834c..2882e36 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -534,7 +534,7 @@ struct t3_vpd {
  *
  *	Read a 32-bit word from a location in VPD EEPROM using the card's PCI
  *	VPD ROM capability.  A zero is written to the flag bit when the
- *	addres is written to the control register.  The hardware device will
+ *	address is written to the control register.  The hardware device will
  *	set the flag to 1 when 4 bytes have been read into the data register.
  */
 int t3_seeprom_read(struct adapter *adapter, u32 addr, u32 *data)
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 7c6888c..fd7e6a8 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -803,7 +803,7 @@ e1000_initialize_hardware_bits(struct e1000_hw *hw)
                 E1000_WRITE_REG(hw, CTRL, reg_ctrl);
                 break;
             case e1000_80003es2lan:
-                /* improve small packet performace for fiber/serdes */
+                /* improve small packet performance for fiber/serdes */
                 if ((hw->media_type == e1000_media_type_fiber) ||
                     (hw->media_type == e1000_media_type_internal_serdes)) {
                     reg_tarc0 &= ~(1 << 20);
@@ -5001,7 +5001,7 @@ e1000_read_eeprom(struct e1000_hw *hw,
             return -E1000_ERR_EEPROM;
     }
 
-    /* Eerd register EEPROM access requires no eeprom aquire/release */
+    /* Eerd register EEPROM access requires no eeprom acquire/release */
     if (eeprom->use_eerd == TRUE)
         return e1000_read_eeprom_eerd(hw, offset, words, data);
 
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h
index a2a86c5..e40e515 100644
--- a/drivers/net/e1000/e1000_hw.h
+++ b/drivers/net/e1000/e1000_hw.h
@@ -1068,7 +1068,7 @@ struct e1000_ffvt_entry {
 
 #define E1000_KUMCTRLSTA 0x00034 /* MAC-PHY interface - RW */
 #define E1000_MDPHYA     0x0003C  /* PHY address - RW */
-#define E1000_MANC2H     0x05860  /* Managment Control To Host - RW */
+#define E1000_MANC2H     0x05860  /* Management Control To Host - RW */
 #define E1000_SW_FW_SYNC 0x05B5C /* Software-Firmware Synchronization - RW */
 
 #define E1000_GCR       0x05B00 /* PCI-Ex Control */
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 4f37506..24a2fc1 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -235,7 +235,7 @@ static struct pci_driver e1000_driver = {
 	.probe    = e1000_probe,
 	.remove   = __devexit_p(e1000_remove),
 #ifdef CONFIG_PM
-	/* Power Managment Hooks */
+	/* Power Management Hooks */
 	.suspend  = e1000_suspend,
 	.resume   = e1000_resume,
 #endif
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 4fd2e23..febe157 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -4109,7 +4109,7 @@ static struct pci_driver e1000_driver = {
 	.probe    = e1000_probe,
 	.remove   = __devexit_p(e1000_remove),
 #ifdef CONFIG_PM
-	/* Power Managment Hooks */
+	/* Power Management Hooks */
 	.suspend  = e1000_suspend,
 	.resume   = e1000_resume,
 #endif
diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c
index 83bda6c..d3789c5 100644
--- a/drivers/net/eepro.c
+++ b/drivers/net/eepro.c
@@ -1764,7 +1764,7 @@ module_param_array(io, int, NULL, 0);
 module_param_array(irq, int, NULL, 0);
 module_param_array(mem, int, NULL, 0);
 module_param(autodetect, int, 0);
-MODULE_PARM_DESC(io, "EtherExpress Pro/10 I/O base addres(es)");
+MODULE_PARM_DESC(io, "EtherExpress Pro/10 I/O base address(es)");
 MODULE_PARM_DESC(irq, "EtherExpress Pro/10 IRQ number(s)");
 MODULE_PARM_DESC(mem, "EtherExpress Pro/10 Rx buffer size(es) in kB (3-29)");
 MODULE_PARM_DESC(autodetect, "EtherExpress Pro/10 force board(s) detection (0-1)");
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index 5f82a46..a50b238 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -251,7 +251,7 @@ struct ehea_qp_init_attr {
 };
 
 /*
- * Event Queue attributes, passed as paramter
+ * Event Queue attributes, passed as parameter
  */
 struct ehea_eq_attr {
 	u32 type;
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index a96583c..7119332 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -490,7 +490,7 @@ union ring_type {
 #define NV_RX3_VLAN_TAG_PRESENT (1<<16)
 #define NV_RX3_VLAN_TAG_MASK	(0x0000FFFF)
 
-/* Miscelaneous hardware related defines: */
+/* Miscellaneous hardware related defines: */
 #define NV_PCI_REGSZ_VER1      	0x270
 #define NV_PCI_REGSZ_VER2      	0x2d4
 #define NV_PCI_REGSZ_VER3      	0x604
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c
index ed407c8..683b289 100644
--- a/drivers/net/hamachi.c
+++ b/drivers/net/hamachi.c
@@ -86,7 +86,7 @@ static int force32;
 static int options[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
 static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
 /* The Hamachi chipset supports 3 parameters each for Rx and Tx
- * interruput management.  Parameters will be loaded as specified into
+ * interrupt management.  Parameters will be loaded as specified into
  * the TxIntControl and RxIntControl registers.
  *
  * The registers are arranged as follows:
@@ -811,7 +811,7 @@ static int __devinit read_eeprom(void __iomem *ioaddr, int location)
 	return readb(ioaddr + EEData);
 }
 
-/* MII Managemen Data I/O accesses.
+/* MII Management Data I/O accesses.
    These routines assume the MDIO controller is idle, and do not exit until
    the command is finished. */
 
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c
index 49421d1..8b90d64 100644
--- a/drivers/net/hp100.c
+++ b/drivers/net/hp100.c
@@ -2643,7 +2643,7 @@ static int hp100_login_to_vg_hub(struct net_device *dev, u_short force_relogin)
 		} else {
 			hp100_andb(~HP100_PROM_MODE, VG_LAN_CFG_2);
 			/* For ETR parts we need to reset the prom. bit in the training
-			 * register, otherwise promiscious mode won't be disabled.
+			 * register, otherwise promiscuous mode won't be disabled.
 			 */
 			if (lp->chip == HP100_CHIPID_LASSEN) {
 				hp100_andw(~HP100_MACRQ_PROMSC, TRAIN_REQUEST);
diff --git a/drivers/net/hp100.h b/drivers/net/hp100.h
index e6ca128..e74e45d 100644
--- a/drivers/net/hp100.h
+++ b/drivers/net/hp100.h
@@ -476,7 +476,7 @@
 #define HP100_MACRQ_REPEATER         0x0001	/* 1: MAC tells HUB it wants to be
 						 *    a cascaded repeater
 						 * 0: ... wants to be a DTE */
-#define HP100_MACRQ_PROMSC           0x0006	/* 2 bits: Promiscious mode
+#define HP100_MACRQ_PROMSC           0x0006	/* 2 bits: Promiscuous mode
 						 * 00: Rcv only unicast packets
 						 *     specifically addr to this
 						 *     endnode
@@ -488,7 +488,7 @@
 #define HP100_CARD_MACVER            0xe000	/* R: 3 bit Cards 100VG MAC version */
 #define HP100_MALLOW_REPEATER        0x0001	/* If reset, requested access as an
 						 * end node is allowed */
-#define HP100_MALLOW_PROMSC          0x0004	/* 2 bits: Promiscious mode
+#define HP100_MALLOW_PROMSC          0x0004	/* 2 bits: Promiscuous mode
 						 * 00: Rcv only unicast packets
 						 *     specifically addr to this
 						 *     endnode
diff --git a/drivers/net/ibm_emac/ibm_emac.h b/drivers/net/ibm_emac/ibm_emac.h
index 97ed22b..655be50 100644
--- a/drivers/net/ibm_emac/ibm_emac.h
+++ b/drivers/net/ibm_emac/ibm_emac.h
@@ -1,7 +1,7 @@
 /*
  * drivers/net/ibm_emac/ibm_emac.h
  *
- * Register definitions for PowerPC 4xx on-chip ethernet contoller
+ * Register definitions for PowerPC 4xx on-chip ethernet controller
  *
  * Copyright (c) 2004, 2005 Zultys Technologies.
  * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
diff --git a/drivers/net/ibm_newemac/emac.h b/drivers/net/ibm_newemac/emac.h
index 91cb096..49a540a 100644
--- a/drivers/net/ibm_newemac/emac.h
+++ b/drivers/net/ibm_newemac/emac.h
@@ -1,7 +1,7 @@
 /*
  * drivers/net/ibm_newemac/emac.h
  *
- * Register definitions for PowerPC 4xx on-chip ethernet contoller
+ * Register definitions for PowerPC 4xx on-chip ethernet controller
  *
  * Copyright 2007 Benjamin Herrenschmidt, IBM Corp.
  *                <benh@kernel.crashing.org>
diff --git a/drivers/net/ibmlana.c b/drivers/net/ibmlana.c
index 91d83ac..5a9b6fa 100644
--- a/drivers/net/ibmlana.c
+++ b/drivers/net/ibmlana.c
@@ -481,7 +481,7 @@ static void InitBoard(struct net_device *dev)
 	if ((dev->flags & IFF_ALLMULTI) || (mcptr != NULL))
 		rcrval |= RCREG_AMC;
 
-	/* promiscous mode ? */
+	/* promiscuous mode ? */
 
 	if (dev->flags & IFF_PROMISC)
 		rcrval |= RCREG_PRO;
diff --git a/drivers/net/ibmlana.h b/drivers/net/ibmlana.h
index aa3ddbd..654af95 100644
--- a/drivers/net/ibmlana.h
+++ b/drivers/net/ibmlana.h
@@ -90,7 +90,7 @@ typedef struct {
 #define RCREG_ERR        0x8000	/* accept damaged and collided pkts */
 #define RCREG_RNT        0x4000	/* accept packets that are < 64     */
 #define RCREG_BRD        0x2000	/* accept broadcasts                */
-#define RCREG_PRO        0x1000	/* promiscous mode                  */
+#define RCREG_PRO        0x1000	/* promiscuous mode                 */
 #define RCREG_AMC        0x0800	/* accept all multicasts            */
 #define RCREG_LB_NONE    0x0000	/* no loopback                      */
 #define RCREG_LB_MAC     0x0200	/* MAC loopback                     */
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index dbd23bb..27d12eb 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -209,7 +209,7 @@ static int mdio_read(struct net_device * dev, int phy_id, int phy_reg)
 {
 	void __iomem *ioaddr = ipg_ioaddr(dev);
 	/*
-	 * The GMII mangement frame structure for a read is as follows:
+	 * The GMII management frame structure for a read is as follows:
 	 *
 	 * |Preamble|st|op|phyad|regad|ta|      data      |idle|
 	 * |< 32 1s>|01|10|AAAAA|RRRRR|z0|DDDDDDDDDDDDDDDD|z   |
@@ -300,7 +300,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int phy_reg, int val)
 {
 	void __iomem *ioaddr = ipg_ioaddr(dev);
 	/*
-	 * The GMII mangement frame structure for a read is as follows:
+	 * The GMII management frame structure for a read is as follows:
 	 *
 	 * |Preamble|st|op|phyad|regad|ta|      data      |idle|
 	 * |< 32 1s>|01|10|AAAAA|RRRRR|z0|DDDDDDDDDDDDDDDD|z   |
diff --git a/drivers/net/irda/ali-ircc.c b/drivers/net/irda/ali-ircc.c
index 9f58452..94140f7 100644
--- a/drivers/net/irda/ali-ircc.c
+++ b/drivers/net/irda/ali-ircc.c
@@ -977,7 +977,7 @@ static void ali_ircc_change_speed(struct ali_ircc_cb *self, __u32 baud)
 		/* Install FIR xmit handler*/
 		dev->hard_start_xmit = ali_ircc_fir_hard_xmit;		
 				
-		/* Enable Interuupt */
+		/* Enable Interrupt */
 		self->ier = IER_EOM; // benjamin 2000/11/20 07:24PM					
 				
 		/* Be ready for incomming frames */
@@ -1096,7 +1096,7 @@ static void ali_ircc_sir_change_speed(struct ali_ircc_cb *priv, __u32 speed)
 	outb(lcr,		  iobase+UART_LCR); /* Set 8N1	*/
 	outb(fcr,		  iobase+UART_FCR); /* Enable FIFO's */
 
-	/* without this, the conection will be broken after come back from FIR speed,
+	/* without this, the connection will be broken after come back from FIR speed,
 	   but with this, the SIR connection is harder to established */
 	outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), iobase+UART_MCR);
 	
@@ -1359,7 +1359,7 @@ static int ali_ircc_net_open(struct net_device *dev)
 		return -EAGAIN;
 	}
 	
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	outb(UART_IER_RDI , iobase+UART_IER);
 
 	/* Ready to play! */
diff --git a/drivers/net/irda/ali-ircc.h b/drivers/net/irda/ali-ircc.h
index e489c66..0787657 100644
--- a/drivers/net/irda/ali-ircc.h
+++ b/drivers/net/irda/ali-ircc.h
@@ -173,13 +173,13 @@ struct st_fifo {
 
 struct frame_cb {
 	void *start; /* Start of frame in DMA mem */
-	int len;     /* Lenght of frame in DMA mem */
+	int len;     /* Length of frame in DMA mem */
 };
 
 struct tx_fifo {
 	struct frame_cb queue[MAX_TX_WINDOW]; /* Info about frames in queue */
 	int             ptr;                  /* Currently being sent */
-	int             len;                  /* Lenght of queue */
+	int             len;                  /* Length of queue */
 	int             free;                 /* Next free slot */
 	void           *tail;                 /* Next free start in DMA mem */
 };
diff --git a/drivers/net/irda/donauboe.h b/drivers/net/irda/donauboe.h
index 1e67720..9db3cce 100644
--- a/drivers/net/irda/donauboe.h
+++ b/drivers/net/irda/donauboe.h
@@ -30,7 +30,7 @@
  *     or the type-DO IR port.
  *
  * IrDA chip set list from Toshiba Computer Engineering Corp.
- * model			method	maker	controler		Version 
+ * model			method	maker	controller		Version 
  * Portege 320CT	FIR,SIR Toshiba Oboe(Triangle) 
  * Portege 3010CT	FIR,SIR Toshiba Oboe(Sydney) 
  * Portege 3015CT	FIR,SIR Toshiba Oboe(Sydney) 
diff --git a/drivers/net/irda/irport.c b/drivers/net/irda/irport.c
index c79caa5..2b2a955 100644
--- a/drivers/net/irda/irport.c
+++ b/drivers/net/irda/irport.c
@@ -276,7 +276,7 @@ static void irport_start(struct irport_cb *self)
 	outb(UART_LCR_WLEN8, iobase+UART_LCR);  /* Reset DLAB */
 	outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), iobase+UART_MCR);
 	
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	outb(UART_IER_RLSI | UART_IER_RDI |UART_IER_THRI, iobase+UART_IER);
 }
 
@@ -352,7 +352,7 @@ static void irport_change_speed(void *priv, __u32 speed)
 	outb(lcr,		  iobase+UART_LCR); /* Set 8N1	*/
 	outb(fcr,		  iobase+UART_FCR); /* Enable FIFO's */
 
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	/* This will generate a fatal interrupt storm.
 	 * People calling us will do that properly - Jean II */
 	//outb(/*UART_IER_RLSI|*/UART_IER_RDI/*|UART_IER_THRI*/, iobase+UART_IER);
diff --git a/drivers/net/irda/nsc-ircc.h b/drivers/net/irda/nsc-ircc.h
index bbdc97f..29398a4 100644
--- a/drivers/net/irda/nsc-ircc.h
+++ b/drivers/net/irda/nsc-ircc.h
@@ -231,13 +231,13 @@ struct st_fifo {
 
 struct frame_cb {
 	void *start; /* Start of frame in DMA mem */
-	int len;     /* Lenght of frame in DMA mem */
+	int len;     /* Length of frame in DMA mem */
 };
 
 struct tx_fifo {
 	struct frame_cb queue[MAX_TX_WINDOW]; /* Info about frames in queue */
 	int             ptr;                  /* Currently being sent */
-	int             len;                  /* Lenght of queue */
+	int             len;                  /* Length of queue */
 	int             free;                 /* Next free slot */
 	void           *tail;                 /* Next free start in DMA mem */
 };
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c
index 7e7b582..7fd9a48 100644
--- a/drivers/net/irda/smsc-ircc2.c
+++ b/drivers/net/irda/smsc-ircc2.c
@@ -1165,7 +1165,7 @@ void smsc_ircc_set_sir_speed(struct smsc_ircc_cb *self, __u32 speed)
 	outb(lcr,		  iobase + UART_LCR); /* Set 8N1 */
 	outb(fcr,		  iobase + UART_FCR); /* Enable FIFO's */
 
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	outb(UART_IER_RLSI | UART_IER_RDI | UART_IER_THRI, iobase + UART_IER);
 
 	IRDA_DEBUG(2, "%s() speed changed to: %d\n", __FUNCTION__, speed);
@@ -1930,7 +1930,7 @@ void smsc_ircc_sir_start(struct smsc_ircc_cb *self)
 	outb(UART_LCR_WLEN8, sir_base + UART_LCR);  /* Reset DLAB */
 	outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), sir_base + UART_MCR);
 
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	outb(UART_IER_RLSI | UART_IER_RDI |UART_IER_THRI, sir_base + UART_IER);
 
 	IRDA_DEBUG(3, "%s() - exit\n", __FUNCTION__);
diff --git a/drivers/net/irda/via-ircc.h b/drivers/net/irda/via-ircc.h
index 204b1b3..9d012f0 100644
--- a/drivers/net/irda/via-ircc.h
+++ b/drivers/net/irda/via-ircc.h
@@ -54,13 +54,13 @@ struct st_fifo {
 
 struct frame_cb {
 	void *start;		/* Start of frame in DMA mem */
-	int len;		/* Lenght of frame in DMA mem */
+	int len;		/* Length of frame in DMA mem */
 };
 
 struct tx_fifo {
 	struct frame_cb queue[MAX_TX_WINDOW + 2];	/* Info about frames in queue */
 	int ptr;		/* Currently being sent */
-	int len;		/* Lenght of queue */
+	int len;		/* Length of queue */
 	int free;		/* Next free slot */
 	void *tail;		/* Next free start in DMA mem */
 };
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c
index 512e3b2..4b6359e 100644
--- a/drivers/net/ixgbe/ixgbe_common.c
+++ b/drivers/net/ixgbe/ixgbe_common.c
@@ -716,7 +716,7 @@ static s32 ixgbe_init_rx_addrs(struct ixgbe_hw *hw)
  *  bit-vector to set in the multicast table. The hardware uses 12 bits, from
  *  incoming rx multicast addresses, to determine the bit-vector to check in
  *  the MTA. Which of the 4 combination, of 12-bits, the hardware uses is set
- *  by the MO field of the MCSTCTRL. The MO field is set during initalization
+ *  by the MO field of the MCSTCTRL. The MO field is set during initialization
  *  to mc_filter_type.
  **/
 static s32 ixgbe_mta_vector(struct ixgbe_hw *hw, u8 *mc_addr)
@@ -1066,7 +1066,7 @@ s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw)
 
 
 /**
- *  ixgbe_acquire_swfw_sync - Aquire SWFW semaphore
+ *  ixgbe_acquire_swfw_sync - Acquire SWFW semaphore
  *  @hw: pointer to hardware structure
  *  @mask: Mask to specify wich semaphore to acquire
  *
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 00bc525..25a9cc2 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -592,7 +592,7 @@ quit_polling:
  * ixgbe_setup_msix - Initialize MSI-X interrupts
  *
  * ixgbe_setup_msix allocates MSI-X vectors and requests
- * interrutps from the kernel.
+ * interrupts from the kernel.
  **/
 static int ixgbe_setup_msix(struct ixgbe_adapter *adapter)
 {
diff --git a/drivers/net/lasi_82596.c b/drivers/net/lasi_82596.c
index efbae4b..1ba38c2 100644
--- a/drivers/net/lasi_82596.c
+++ b/drivers/net/lasi_82596.c
@@ -47,7 +47,7 @@
    TBD:
    * look at deferring rx frames rather than discarding (as per tulip)
    * handle tx ring full as per tulip
-   * performace test to tune rx_copybreak
+   * performance test to tune rx_copybreak
 
    Most of my modifications relate to the braindead big-endian
    implementation by Intel.  When the i596 is operating in
diff --git a/drivers/net/lib82596.c b/drivers/net/lib82596.c
index b59f442..c335d31 100644
--- a/drivers/net/lib82596.c
+++ b/drivers/net/lib82596.c
@@ -47,7 +47,7 @@
    TBD:
    * look at deferring rx frames rather than discarding (as per tulip)
    * handle tx ring full as per tulip
-   * performace test to tune rx_copybreak
+   * performance test to tune rx_copybreak
 
    Most of my modifications relate to the braindead big-endian
    implementation by Intel.  When the i596 is operating in
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 047ea7b..1367178 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -239,7 +239,7 @@ static int macb_mii_init(struct macb *bp)
 	struct eth_platform_data *pdata;
 	int err = -ENXIO, i;
 
-	/* Enable managment port */
+	/* Enable management port */
 	macb_writel(bp, NCR, MACB_BIT(MPE));
 
 	bp->mii_bus.name = "MACB_mii_bus",
diff --git a/drivers/net/meth.h b/drivers/net/meth.h
index a78dc1c..ecd0e97 100644
--- a/drivers/net/meth.h
+++ b/drivers/net/meth.h
@@ -127,7 +127,7 @@ typedef struct rx_packet {
 #define METH_ACCEPT_MY 0			/* 00: Accept PHY address only */
 #define METH_ACCEPT_MCAST 0x20	/* 01: Accept physical, broadcast, and multicast filter matches only */
 #define METH_ACCEPT_AMCAST 0x40	/* 10: Accept physical, broadcast, and all multicast packets */
-#define METH_PROMISC 0x60		/* 11: Promiscious mode */
+#define METH_PROMISC 0x60		/* 11: Promiscuous mode */
 
 #define METH_PHY_LINK_FAIL	BIT(7) /* 0: Link failure detection disabled, 1: Hardware scans for link failure in PHY */
 
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 651c269..c263c91 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -535,7 +535,7 @@ struct mv643xx_private {
 
 	int rx_resource_err;		/* Rx ring resource error flag */
 
-	/* Tx/Rx rings managment indexes fields. For driver use */
+	/* Tx/Rx rings management indexes fields. For driver use */
 
 	/* Next available and first returning Rx resource */
 	int rx_curr_desc_q, rx_used_desc_q;
@@ -757,7 +757,7 @@ static void mv643xx_eth_update_mac_address(struct net_device *dev)
 /*
  * mv643xx_eth_set_rx_mode
  *
- * Change from promiscuos to regular rx mode
+ * Change from promiscuous to regular rx mode
  *
  * Input :	pointer to ethernet interface network device structure
  * Output :	N/A
diff --git a/drivers/net/netxen/netxen_nic_hw.h b/drivers/net/netxen/netxen_nic_hw.h
index 245bf13..236160a 100644
--- a/drivers/net/netxen/netxen_nic_hw.h
+++ b/drivers/net/netxen/netxen_nic_hw.h
@@ -429,7 +429,7 @@ typedef enum {
 #define netxen_get_niu_enable_ge(config_word)	\
 		_netxen_crb_get_bit(config_word, 1)
 
-/* Promiscous mode options (GbE mode only) */
+/* Promiscuous mode options (GbE mode only) */
 typedef enum {
 	NETXEN_NIU_PROMISC_MODE = 0,
 	NETXEN_NIU_NON_PROMISC_MODE
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index 4f69037..9e1890f 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -2368,7 +2368,7 @@ find_compressor(int type)
 }
 
 /*
- * Miscelleneous stuff.
+ * Miscellaneous stuff.
  */
 
 static void
diff --git a/drivers/net/ps3_gelic_net.c b/drivers/net/ps3_gelic_net.c
index 0a42bf5..5efc5b4 100644
--- a/drivers/net/ps3_gelic_net.c
+++ b/drivers/net/ps3_gelic_net.c
@@ -1271,7 +1271,7 @@ static struct ethtool_ops gelic_net_ethtool_ops = {
 /**
  * gelic_net_tx_timeout_task - task scheduled by the watchdog timeout
  * function (to be called not under interrupt status)
- * @work: work is context of tx timout task
+ * @work: work is context of tx timeout task
  *
  * called as task when tx hangs, resets interface (if interface is up)
  */
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index a579111..da85b7f 100644
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -3691,7 +3691,7 @@ static int ql_adapter_up(struct ql3_adapter *qdev)
 		ql_sem_unlock(qdev, QL_DRVR_SEM_MASK);
 	} else {
 		printk(KERN_ERR PFX
-		       "%s: Could not aquire driver lock.\n",
+		       "%s: Could not acquire driver lock.\n",
 		       ndev->name);
 		goto err_lock;
 	}
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h
index cc1797a..63d45d4 100644
--- a/drivers/net/s2io.h
+++ b/drivers/net/s2io.h
@@ -740,7 +740,7 @@ struct mac_info {
 	u16 mc_pause_threshold_q0q3;
 	u16 mc_pause_threshold_q4q7;
 
-	void *stats_mem;	/* orignal pointer to allocated mem */
+	void *stats_mem;	/* original pointer to allocated mem */
 	dma_addr_t stats_mem_phy;	/* Physical address of the stat block */
 	u32 stats_mem_sz;
 	struct stat_block *stats_info;	/* Logical address of the stat block */
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
index 7200883..ff559e4 100644
--- a/drivers/net/sis190.c
+++ b/drivers/net/sis190.c
@@ -102,7 +102,7 @@ enum sis190_registers {
 	IntrStatus		= 0x20,
 	IntrMask		= 0x24,
 	IntrControl		= 0x28,
-	IntrTimer		= 0x2c,	// unused (Interupt Timer)
+	IntrTimer		= 0x2c,	// unused (Interrupt Timer)
 	PMControl		= 0x30,	// unused (Power Mgmt Control/Status)
 	rsv2			= 0x34,	// reserved
 	ROMControl		= 0x38,
diff --git a/drivers/net/sk98lin/skgepnmi.c b/drivers/net/sk98lin/skgepnmi.c
index b36dd9a..c761ff7 100644
--- a/drivers/net/sk98lin/skgepnmi.c
+++ b/drivers/net/sk98lin/skgepnmi.c
@@ -356,7 +356,7 @@ int Level)		/* Initialization level */
 	unsigned int	PortMax;	/* Number of ports */
 	unsigned int	PortIndex;	/* Current port index in loop */
 	SK_U16		Val16;		/* Multiple purpose 16 bit variable */
-	SK_U8		Val8;		/* Mulitple purpose 8 bit variable */
+	SK_U8		Val8;		/* Multiple purpose 8 bit variable */
 	SK_EVPARA	EventParam;	/* Event struct for timer event */
 	SK_PNMI_VCT	*pVctBackupData;
 
diff --git a/drivers/net/sk98lin/skxmac2.c b/drivers/net/sk98lin/skxmac2.c
index b4e7502..3994289 100644
--- a/drivers/net/sk98lin/skxmac2.c
+++ b/drivers/net/sk98lin/skxmac2.c
@@ -3891,7 +3891,7 @@ int SkXmOverflowStatus(
 SK_AC	*pAC,				/* adapter context */
 SK_IOC	IoC,				/* IO context */
 unsigned int Port,			/* Port Index (MAC_1 + n) */
-SK_U16	IStatus,			/* Interupt Status from MAC */
+SK_U16	IStatus,			/* Interrupt Status from MAC */
 SK_U64	SK_FAR *pStatus)	/* ptr for return overflow status value */
 {
 	SK_U64	Status;	/* Overflow status */
@@ -4036,7 +4036,7 @@ int SkGmOverflowStatus(
 SK_AC	*pAC,				/* adapter context */
 SK_IOC	IoC,				/* IO context */
 unsigned int Port,			/* Port Index (MAC_1 + n) */
-SK_U16	IStatus,			/* Interupt Status from MAC */
+SK_U16	IStatus,			/* Interrupt Status from MAC */
 SK_U64	SK_FAR *pStatus)	/* ptr for return overflow status value */
 {
 	SK_U64	Status;		/* Overflow status */
diff --git a/drivers/net/skfp/ess.c b/drivers/net/skfp/ess.c
index 62b0132..889f987 100644
--- a/drivers/net/skfp/ess.c
+++ b/drivers/net/skfp/ess.c
@@ -598,7 +598,7 @@ static void ess_send_alc_req(struct s_smc *smc)
 	req->cmd.sba_cmd = REQUEST_ALLOCATION ;
 
 	/*
-	 * set the parameter type and parameter lenght of all used
+	 * set the parameter type and parameter length of all used
 	 * parameters
 	 */
 
diff --git a/drivers/net/skfp/fplustm.c b/drivers/net/skfp/fplustm.c
index a45205d..b27a895 100644
--- a/drivers/net/skfp/fplustm.c
+++ b/drivers/net/skfp/fplustm.c
@@ -398,7 +398,7 @@ static void copy_tx_mac(struct s_smc *smc, u_long td, struct fddi_mac *mac,
 /* u_long td;		 transmit descriptor */
 /* struct fddi_mac *mac; mac frame pointer */
 /* unsigned off;	 start address within buffer memory */
-/* int len ;		 lenght of the frame including the FC */
+/* int len ;		 length of the frame including the FC */
 {
 	int	i ;
 	u_int	*p ;
@@ -1262,8 +1262,8 @@ Function	DOWNCALL/INTERN	(SMT, fplustm.c)
 
 Para	mode =	1	RX_ENABLE_ALLMULTI	enable all multicasts
 		2	RX_DISABLE_ALLMULTI	disable "enable all multicasts"
-		3	RX_ENABLE_PROMISC	enable promiscous
-		4	RX_DISABLE_PROMISC	disable promiscous
+		3	RX_ENABLE_PROMISC	enable promiscuous
+		4	RX_DISABLE_PROMISC	disable promiscuous
 		5	RX_ENABLE_NSA		enable reception of NSA frames
 		6	RX_DISABLE_NSA		disable reception of NSA frames
 
diff --git a/drivers/net/skfp/h/fplustm.h b/drivers/net/skfp/h/fplustm.h
index 98bbf65..586f055 100644
--- a/drivers/net/skfp/h/fplustm.h
+++ b/drivers/net/skfp/h/fplustm.h
@@ -237,8 +237,8 @@ struct s_smt_fp {
  */
 #define RX_ENABLE_ALLMULTI	1	/* enable all multicasts */
 #define RX_DISABLE_ALLMULTI	2	/* disable "enable all multicasts" */
-#define RX_ENABLE_PROMISC	3	/* enable promiscous */
-#define RX_DISABLE_PROMISC	4	/* disable promiscous */
+#define RX_ENABLE_PROMISC	3	/* enable promiscuous */
+#define RX_DISABLE_PROMISC	4	/* disable promiscuous */
 #define RX_ENABLE_NSA		5	/* enable reception of NSA frames */
 #define RX_DISABLE_NSA		6	/* disable reception of NSA frames */
 
diff --git a/drivers/net/skfp/h/smt.h b/drivers/net/skfp/h/smt.h
index 1ff5899..2976757 100644
--- a/drivers/net/skfp/h/smt.h
+++ b/drivers/net/skfp/h/smt.h
@@ -413,7 +413,7 @@ struct smt_p_reason {
 #define SMT_RDF_SUCCESS	0x00000003	/* success (PMF) */
 #define SMT_RDF_BADSET	0x00000004	/* bad set count (PMF) */
 #define SMT_RDF_ILLEGAL 0x00000005	/* read only (PMF) */
-#define SMT_RDF_NOPARAM	0x6		/* paramter not supported (PMF) */
+#define SMT_RDF_NOPARAM	0x6		/* parameter not supported (PMF) */
 #define SMT_RDF_RANGE	0x8		/* out of range */
 #define SMT_RDF_AUTHOR	0x9		/* not autohorized */
 #define SMT_RDF_LENGTH	0x0a		/* length error */
diff --git a/drivers/net/skfp/h/supern_2.h b/drivers/net/skfp/h/supern_2.h
index 5ba0b83..1074f96 100644
--- a/drivers/net/skfp/h/supern_2.h
+++ b/drivers/net/skfp/h/supern_2.h
@@ -386,7 +386,7 @@ struct tx_queue {
 #define	FM_MDISRCV	(4<<8)		/* disable receive function */
 #define	FM_MRES0	(5<<8)		/* reserve */
 #define	FM_MLIMPROM	(6<<8)		/* limited-promiscuous mode */
-#define FM_MPROMISCOUS	(7<<8)		/* address detection : promiscous */
+#define FM_MPROMISCOUS	(7<<8)		/* address detection : promiscuous */
 
 #define FM_SELSA	0x0800		/* select-short-address bit */
 
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 76cc1d3..648b904 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -466,7 +466,7 @@ static inline void	 smc911x_rcv(struct net_device *dev)
 		/* Align IP header to 32 bits
 		 * Note that the device is configured to add a 2
 		 * byte padding to the packet start, so we really
-		 * want to write to the orignal data pointer */
+		 * want to write to the original data pointer */
 		data = skb->data;
 		skb_reserve(skb, 2);
 		skb_put(skb,pkt_len-4);
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
index bccae7e..7a7f5cd 100644
--- a/drivers/net/spider_net.c
+++ b/drivers/net/spider_net.c
@@ -1826,7 +1826,7 @@ spider_net_enable_card(struct spider_net_card *card)
 
 	spider_net_write_reg(card, SPIDER_NET_ECMODE, SPIDER_NET_ECMODE_VALUE);
 
-	/* set chain tail adress for RX chains and
+	/* set chain tail address for RX chains and
 	 * enable DMA */
 	spider_net_enable_rxchtails(card);
 	spider_net_enable_rxdmac(card);
diff --git a/drivers/net/sunbmac.h b/drivers/net/sunbmac.h
index b563d3c..681442b 100644
--- a/drivers/net/sunbmac.h
+++ b/drivers/net/sunbmac.h
@@ -185,7 +185,7 @@
 #define BIGMAC_RXCFG_ENABLE    0x00000001 /* Enable the receiver                      */
 #define BIGMAC_RXCFG_FIFO      0x0000000e /* Default rx fthresh...                    */
 #define BIGMAC_RXCFG_PSTRIP    0x00000020 /* Pad byte strip enable                    */
-#define BIGMAC_RXCFG_PMISC     0x00000040 /* Enable promiscous mode                   */
+#define BIGMAC_RXCFG_PMISC     0x00000040 /* Enable promiscuous mode                  */
 #define BIGMAC_RXCFG_DERR      0x00000080 /* Disable error checking                   */
 #define BIGMAC_RXCFG_DCRCS     0x00000100 /* Disable CRC stripping                    */
 #define BIGMAC_RXCFG_ME        0x00000200 /* Receive packets addressed to me          */
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 6887214..097a065 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -780,7 +780,7 @@ static int gem_rx(struct gem *gp, int work_to_do)
 			break;
 
 		/* When writing back RX descriptor, GEM writes status
-		 * then buffer address, possibly in seperate transactions.
+		 * then buffer address, possibly in separate transactions.
 		 * If we don't wait for the chip to write both, we could
 		 * post a new buffer to this descriptor then have GEM spam
 		 * on the buffer address.  We sync on the RX completion
diff --git a/drivers/net/sunhme.h b/drivers/net/sunhme.h
index 90f446d..68bf4e1 100644
--- a/drivers/net/sunhme.h
+++ b/drivers/net/sunhme.h
@@ -223,7 +223,7 @@
 /* BigMac receive config register. */
 #define BIGMAC_RXCFG_ENABLE   0x00000001 /* Enable the receiver             */
 #define BIGMAC_RXCFG_PSTRIP   0x00000020 /* Pad byte strip enable           */
-#define BIGMAC_RXCFG_PMISC    0x00000040 /* Enable promiscous mode          */
+#define BIGMAC_RXCFG_PMISC    0x00000040 /* Enable promiscuous mode         */
 #define BIGMAC_RXCFG_DERR     0x00000080 /* Disable error checking          */
 #define BIGMAC_RXCFG_DCRCS    0x00000100 /* Disable CRC stripping           */
 #define BIGMAC_RXCFG_REJME    0x00000200 /* Reject packets addressed to me  */
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c
index d887c05..0fbf96d 100644
--- a/drivers/net/tc35815.c
+++ b/drivers/net/tc35815.c
@@ -136,7 +136,7 @@ struct tc35815_regs {
 #define DMA_RxAlign_2          0x00800000
 #define DMA_RxAlign_3          0x00c00000
 #define DMA_M66EnStat          0x00080000 /* 1:66MHz Enable State            */
-#define DMA_IntMask            0x00040000 /* 1:Interupt mask                 */
+#define DMA_IntMask            0x00040000 /* 1:Interrupt mask                 */
 #define DMA_SWIntReq           0x00020000 /* 1:Software Interrupt request    */
 #define DMA_TxWakeUp           0x00010000 /* 1:Transmit Wake Up              */
 #define DMA_RxBigE             0x00008000 /* 1:Receive Big Endian            */
@@ -281,7 +281,7 @@ struct tc35815_regs {
 #define Int_IntMacTx           0x00000001 /* 1:Tx controller & Clear         */
 
 /* MD_CA bit asign --------------------------------------------------------- */
-#define MD_CA_PreSup           0x00001000 /* 1:Preamble Supress              */
+#define MD_CA_PreSup           0x00001000 /* 1:Preamble Suppress             */
 #define MD_CA_Busy             0x00000800 /* 1:Busy (Start Operation)        */
 #define MD_CA_Wr               0x00000400 /* 1:Write 0:Read                  */
 
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c
index 21230c9..3ed1973 100644
--- a/drivers/net/tehuti.c
+++ b/drivers/net/tehuti.c
@@ -276,7 +276,7 @@ static irqreturn_t bdx_isr_napi(int irq, void *dev)
 			 * currently intrs are disabled (since we read ISR),
 			 * and we have failed to register next poll.
 			 * so we read the regs to trigger chip
-			 * and allow further interupts. */
+			 * and allow further interrupts. */
 			READ_REG(priv, regTXF_WPTR_0);
 			READ_REG(priv, regRXD_WPTR_0);
 		}
diff --git a/drivers/net/tehuti.h b/drivers/net/tehuti.h
index efd170f..992efa6 100644
--- a/drivers/net/tehuti.h
+++ b/drivers/net/tehuti.h
@@ -510,7 +510,7 @@ struct txd_desc {
 #define  GMAC_RX_FILTER_ACRC  0x0010	/* accept crc error */
 #define  GMAC_RX_FILTER_AM    0x0008	/* accept multicast */
 #define  GMAC_RX_FILTER_AB    0x0004	/* accept broadcast */
-#define  GMAC_RX_FILTER_PRM   0x0001	/* [0:1] promiscous mode */
+#define  GMAC_RX_FILTER_PRM   0x0001	/* [0:1] promiscuous mode */
 
 #define  MAX_FRAME_AB_VAL       0x3fff	/* 13:0 */
 
diff --git a/drivers/net/tokenring/3c359.c b/drivers/net/tokenring/3c359.c
index 5d31519..9d7a0c9 100644
--- a/drivers/net/tokenring/3c359.c
+++ b/drivers/net/tokenring/3c359.c
@@ -75,7 +75,7 @@ static char version[] __devinitdata  =
 MODULE_AUTHOR("Mike Phillips <mikep@linuxtr.net>") ; 
 MODULE_DESCRIPTION("3Com 3C359 Velocity XL Token Ring Adapter Driver \n") ;
 
-/* Module paramters */
+/* Module parameters */
 
 /* Ring Speed 0,4,16 
  * 0 = Autosense   
diff --git a/drivers/net/tokenring/lanstreamer.c b/drivers/net/tokenring/lanstreamer.c
index 47d84cd..21c4f3c 100644
--- a/drivers/net/tokenring/lanstreamer.c
+++ b/drivers/net/tokenring/lanstreamer.c
@@ -170,7 +170,7 @@ static char *open_min_error[] = {
 	"Monitor Contention failer for RPL", "FDX Protocol Error"
 };
 
-/* Module paramters */
+/* Module parameters */
 
 /* Ring Speed 0,4,16
  * 0 = Autosense         
diff --git a/drivers/net/tokenring/olympic.c b/drivers/net/tokenring/olympic.c
index 74c1f0f..b1178f1 100644
--- a/drivers/net/tokenring/olympic.c
+++ b/drivers/net/tokenring/olympic.c
@@ -132,7 +132,7 @@ static char *open_min_error[] = {"No error", "Function Failure", "Signal Lost",
 				   "Reserved", "Reserved", "No Monitor Detected for RPL", 
 				   "Monitor Contention failer for RPL", "FDX Protocol Error"};
 
-/* Module paramters */
+/* Module parameters */
 
 MODULE_AUTHOR("Mike Phillips <mikep@linuxtr.net>") ; 
 MODULE_DESCRIPTION("Olympic PCI/Cardbus Chipset Driver") ; 
diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c
index 93da3a3..4238a61 100644
--- a/drivers/net/tokenring/smctr.c
+++ b/drivers/net/tokenring/smctr.c
@@ -2426,7 +2426,7 @@ static irqreturn_t smctr_interrupt(int irq, void *dev_id)
                                 break ;
 
                         /* Type 0x0E - TRC Initialization Sequence Interrupt
-                         * Subtype -- 00-FF Initializatin sequence complete
+                         * Subtype -- 00-FF Initialization sequence complete
                          */
                         case ISB_IMC_TRC_INTRNL_TST_STATUS:
                                 tp->status = INITIALIZED;
@@ -3055,8 +3055,8 @@ static int smctr_load_node_addr(struct net_device *dev)
  * disabled.!?
  *
  * NOTE 2: If the monitor_state is MS_BEACON_TEST_STATE and the receive_mask
- * has any multi-cast or promiscous bits set, the receive_mask needs to
- * be changed to clear the multi-cast or promiscous mode bits, the lobe_test
+ * has any multi-cast or promiscuous bits set, the receive_mask needs to
+ * be changed to clear the multi-cast or promiscuous mode bits, the lobe_test
  * run, and then the receive mask set back to its original value if the test
  * is successful.
  */
diff --git a/drivers/net/tokenring/tms380tr.c b/drivers/net/tokenring/tms380tr.c
index d5fa36d..b15435d 100644
--- a/drivers/net/tokenring/tms380tr.c
+++ b/drivers/net/tokenring/tms380tr.c
@@ -48,7 +48,7 @@
  *	25-Sep-99	AF	Uped TPL_NUM from 3 to 9
  *				Removed extraneous 'No free TPL'
  *	22-Dec-99	AF	Added Madge PCI Mk2 support and generalized
- *				parts of the initilization procedure.
+ *				parts of the initialization procedure.
  *	30-Dec-99	AF	Turned tms380tr into a library ala 8390.
  *				Madge support is provided in the abyss module
  *				Generic PCI support is in the tmspci module.
diff --git a/drivers/net/tokenring/tms380tr.h b/drivers/net/tokenring/tms380tr.h
index 7daf74e..1cbb8b8 100644
--- a/drivers/net/tokenring/tms380tr.h
+++ b/drivers/net/tokenring/tms380tr.h
@@ -441,7 +441,7 @@ typedef struct {
 #define PASS_FIRST_BUF_ONLY	0x0100	/* Passes only first internal buffer
 					 * of each received frame; FrameSize
 					 * of RPLs must contain internal
-					 * BUFFER_SIZE bits for promiscous mode.
+					 * BUFFER_SIZE bits for promiscuous mode.
 					 */
 #define ENABLE_FULL_DUPLEX_SELECTION	0x2000 
  					/* Enable the use of full-duplex
diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c
index 70befe3..5dad012 100644
--- a/drivers/net/tulip/xircom_cb.c
+++ b/drivers/net/tulip/xircom_cb.c
@@ -646,7 +646,7 @@ static void setup_descriptors(struct xircom_private *card)
 	}
 
 	wmb();
-	/* wite the transmit descriptor ring to the card */
+	/* write the transmit descriptor ring to the card */
 	address = (unsigned long) card->tx_dma_handle;
 	val =cpu_to_le32(address);
 	outl(val, card->io_port + CSR4);	/* xmit descr list address */
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 1f76446..fc9eada 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -142,7 +142,7 @@ add_multi(u32* filter, const u8* addr)
 	filter[bit_nr >> 5] |= 1 << (bit_nr & 31);
 }
 
-/** Remove the specified Ethernet addres from this multicast filter. */
+/** Remove the specified Ethernet address from this multicast filter. */
 static void
 del_multi(u32* filter, const u8* addr)
 {
@@ -399,7 +399,7 @@ static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv,
 		 * - the packet is addressed to us.
 		 * - the packet is broadcast.
 		 * - the packet is multicast and
-		 *   - we are multicast promiscous.
+		 *   - we are multicast promiscuous.
 		 *   - we belong to the multicast group.
 		 */
 		skb_copy_from_linear_data(skb, addr, min_t(size_t, sizeof addr,
diff --git a/drivers/net/ucc_geth_ethtool.c b/drivers/net/ucc_geth_ethtool.c
index 9a9622c..f8d319b 100644
--- a/drivers/net/ucc_geth_ethtool.c
+++ b/drivers/net/ucc_geth_ethtool.c
@@ -7,7 +7,7 @@
  *
  * Limitation: 
  * Can only get/set setttings of the first queue.
- * Need to re-open the interface manually after changing some paramters.
+ * Need to re-open the interface manually after changing some parameters.
  *
  * This program is free software; you can redistribute  it and/or modify it
  * under  the terms of  the GNU General  Public License as published by the
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c
index df884f0..7c0d4a8 100644
--- a/drivers/net/ucc_geth_mii.c
+++ b/drivers/net/ucc_geth_mii.c
@@ -63,11 +63,11 @@ int uec_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value)
 {
 	struct ucc_mii_mng __iomem *regs = (void __iomem *)bus->priv;
 
-	/* Setting up the MII Mangement Address Register */
+	/* Setting up the MII Management Address Register */
 	out_be32(&regs->miimadd,
 		 (mii_id << MIIMADD_PHY_ADDRESS_SHIFT) | regnum);
 
-	/* Setting up the MII Mangement Control Register with the value */
+	/* Setting up the MII Management Control Register with the value */
 	out_be32(&regs->miimcon, value);
 
 	/* Wait till MII management write is complete */
@@ -85,7 +85,7 @@ int uec_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
 	struct ucc_mii_mng __iomem *regs = (void __iomem *)bus->priv;
 	u16 value;
 
-	/* Setting up the MII Mangement Address Register */
+	/* Setting up the MII Management Address Register */
 	out_be32(&regs->miimadd,
 		 (mii_id << MIIMADD_PHY_ADDRESS_SHIFT) | regnum);
 
diff --git a/drivers/net/wan/cycx_drv.c b/drivers/net/wan/cycx_drv.c
index d347d59..d14e667 100644
--- a/drivers/net/wan/cycx_drv.c
+++ b/drivers/net/wan/cycx_drv.c
@@ -322,7 +322,7 @@ static int cycx_data_boot(void __iomem *addr, u8 *code, u32 len)
 	void __iomem *pt_boot_cmd = addr + CMD_OFFSET;
 	u32 i;
 
-	/* boot buffer lenght */
+	/* boot buffer length */
 	writew(CFM_LOAD_BUFSZ, pt_boot_cmd + sizeof(u16));
 	writew(GEN_DEFPAR, pt_boot_cmd);
 
@@ -353,7 +353,7 @@ static int cycx_code_boot(void __iomem *addr, u8 *code, u32 len)
 	void __iomem *pt_boot_cmd = addr + CMD_OFFSET;
 	u32 i;
 
-	/* boot buffer lenght */
+	/* boot buffer length */
 	writew(CFM_LOAD_BUFSZ, pt_boot_cmd + sizeof(u16));
 	writew(GEN_DEFPAR, pt_boot_cmd);
 
diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c
index 2e8b5c2..74f87df 100644
--- a/drivers/net/wan/sbni.c
+++ b/drivers/net/wan/sbni.c
@@ -1472,7 +1472,7 @@ sbni_get_stats( struct net_device  *dev )
 static void
 set_multicast_list( struct net_device  *dev )
 {
-	return;		/* sbni always operate in promiscuos mode */
+	return;		/* sbni always operate in promiscuous mode */
 }
 
 
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index 059ce3f..60dfdd9 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -3278,7 +3278,7 @@ static void atmel_smooth_qual(struct atmel_private *priv)
 	priv->wstats.qual.updated &= ~IW_QUAL_QUAL_INVALID;
 }
 
-/* deals with incoming managment frames. */
+/* deals with incoming management frames. */
 static void atmel_management_frame(struct atmel_private *priv,
 				   struct ieee80211_hdr_4addr *header,
 				   u16 frame_len, u8 rssi)
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h
index a40d1af..edf7d8f 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h
@@ -28,7 +28,7 @@ struct bcm43xx_dfsentry {
 	struct bcm43xx_xmitstatus *xmitstatus_buffer;
 	int xmitstatus_ptr;
 	int xmitstatus_cnt;
-	/* We need a seperate buffer while printing to avoid
+	/* We need a separate buffer while printing to avoid
 	 * concurrency issues. (New xmitstatus can arrive
 	 * while we are printing).
 	 */
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 54f44e5..e24382f 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -1144,7 +1144,7 @@ static void ipw_led_shutdown(struct ipw_priv *priv)
 /*
  * The following adds a new attribute to the sysfs representation
  * of this device driver (i.e. a new file in /sys/bus/pci/drivers/ipw/)
- * used for controling the debug level.
+ * used for controlling the debug level.
  *
  * See the level definitions in ipw for details.
  */
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 891f90d..e242647 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -4051,7 +4051,7 @@ static int iwl4965_tx_status_reply_compressed_ba(struct iwl_priv *priv,
 	agg->wait_for_ba = 0;
 	IWL_DEBUG_TX_REPLY("BA %d %d\n", agg->start_idx, ba_resp->ba_seq_ctl);
 	sh = agg->start_idx - SEQ_TO_INDEX(ba_seq_ctl>>4);
-	if (sh < 0) /* tbw something is wrong with indeces */
+	if (sh < 0) /* tbw something is wrong with indices */
 		sh += 0x100;
 
 	/* don't use 64 bits for now */
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index be5cfd8..31ee4f6 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -1120,7 +1120,7 @@ int libertas_set_mac_packet_filter(wlan_private * priv)
  *  @param cmd_action	command action: GET or SET
  *  @param wait_option	wait option: wait response or not
  *  @param cmd_oid	cmd oid: treated as sub command
- *  @param pdata_buf	A pointer to informaion buffer
+ *  @param pdata_buf	A pointer to information buffer
  *  @return 		0 or -1
  */
 int libertas_prepare_and_send_command(wlan_private * priv,
@@ -1606,7 +1606,7 @@ static void cleanup_cmdnode(struct cmd_ctrl_node *ptempnode)
  *  @param ptempnode	A pointer to cmd_ctrl_node structure
  *  @param cmd_oid	cmd oid: treated as sub command
  *  @param wait_option	wait option: wait response or not
- *  @param pdata_buf	A pointer to informaion buffer
+ *  @param pdata_buf	A pointer to information buffer
  *  @return 		0 or -1
  */
 void libertas_set_cmd_ctrl_node(wlan_private * priv,
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index ad1e67d..537b36c 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -443,7 +443,7 @@ wlan_scan_setup_scan_config(wlan_private * priv,
 	ptlvpos = pscancfgout->tlvbuffer;
 
 	/*
-	 * Set the initial scan paramters for progressive scanning.  If a specific
+	 * Set the initial scan parameters for progressive scanning.  If a specific
 	 *   BSSID or SSID is used, the number of channels in the scan command
 	 *   will be increased to the absolute maximum
 	 */
@@ -1679,7 +1679,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
  *
  *  Called from libertas_prepare_and_send_command() in cmd.c
  *
- *  Sends a fixed lenght data part (specifying the BSS type and BSSID filters)
+ *  Sends a fixed length data part (specifying the BSS type and BSSID filters)
  *  as well as a variable number/length of TLVs to the firmware.
  *
  *  @param priv       A pointer to wlan_private structure
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c
index d2fa079..c4b649e 100644
--- a/drivers/net/wireless/netwave_cs.c
+++ b/drivers/net/wireless/netwave_cs.c
@@ -1408,7 +1408,7 @@ static void set_multicast_list(struct net_device *dev)
 	/* Multicast Mode */
 	rcvMode = rxConfRxEna + rxConfAMP + rxConfBcast;
     } else if (dev->flags & IFF_PROMISC) {
-	/* Promiscous mode */
+	/* Promiscuous mode */
 	rcvMode = rxConfRxEna + rxConfPro + rxConfAMP + rxConfBcast;
     } else {
 	/* Normal mode */
diff --git a/drivers/net/wireless/orinoco.h b/drivers/net/wireless/orinoco.h
index 4720fb2..703a4cf 100644
--- a/drivers/net/wireless/orinoco.h
+++ b/drivers/net/wireless/orinoco.h
@@ -108,7 +108,7 @@ struct orinoco_private {
 	int	scan_inprogress;	/* Scan pending... */
 	u32	scan_mode;		/* Type of scan done */
 	char *	scan_result;		/* Result of previous scan */
-	int	scan_len;		/* Lenght of result */
+	int	scan_len;		/* Length of result */
 };
 
 #ifdef ORINOCO_DEBUG
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index f87fe10..24f9066 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -129,7 +129,7 @@ static void ray_reset(struct net_device *dev);
 static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, int len);
 static void verify_dl_startup(u_long);
 
-/* Prototypes for interrpt time functions **********************************/
+/* Prototypes for interrupt time functions **********************************/
 static irqreturn_t ray_interrupt (int reg, void *dev_id);
 static void clear_interrupt(ray_dev_t *local);
 static void rx_deauthenticate(ray_dev_t *local, struct rcs __iomem *prcs, 
diff --git a/drivers/net/wireless/rt2x00/rt2x00reg.h b/drivers/net/wireless/rt2x00/rt2x00reg.h
index 8384212..fe9011d 100644
--- a/drivers/net/wireless/rt2x00/rt2x00reg.h
+++ b/drivers/net/wireless/rt2x00/rt2x00reg.h
@@ -230,7 +230,7 @@ static inline u8 rt2x00_get_field8(const u8 reg,
  *	corresponds with the TX register format for the current device.
  *	4 - plcp, 802.11b rates are device specific,
  *	802.11g rates are set according to the ieee802.11a-1999 p.14.
- * The bit to enable preamble is set in a seperate define.
+ * The bit to enable preamble is set in a separate define.
  */
 #define DEV_RATE	FIELD32(0x000007ff)
 #define DEV_PREAMBLE	FIELD32(0x00000800)
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.h b/drivers/net/wireless/rt2x00/rt2x00usb.h
index 2681abe..b76881f 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.h
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.h
@@ -135,13 +135,13 @@ static inline int rt2x00usb_vendor_request_sw(const struct rt2x00_dev
  * kmalloc for correct handling inside the kernel USB layer.
  */
 static inline int rt2x00usb_eeprom_read(const struct rt2x00_dev *rt2x00dev,
-					 __le16 *eeprom, const u16 lenght)
+					 __le16 *eeprom, const u16 length)
 {
-	int timeout = REGISTER_TIMEOUT * (lenght / sizeof(u16));
+	int timeout = REGISTER_TIMEOUT * (length / sizeof(u16));
 
 	return rt2x00usb_vendor_request(rt2x00dev, USB_EEPROM_READ,
 					USB_VENDOR_REQUEST_IN, 0x0000,
-					0x0000, eeprom, lenght, timeout);
+					0x0000, eeprom, length, timeout);
 }
 
 /*
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index c0671c2..d1468a1 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -833,7 +833,7 @@ static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev, void *data,
 
 	/*
 	 * Write firmware to device.
-	 * We setup a seperate cache for this action,
+	 * We setup a separate cache for this action,
 	 * since we are going to write larger chunks of data
 	 * then normally used cache size.
 	 */
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c
index 577c647..5d28105 100644
--- a/drivers/net/wireless/wavelan_cs.c
+++ b/drivers/net/wireless/wavelan_cs.c
@@ -159,7 +159,7 @@ psa_read(struct net_device *	dev,
 
 /*------------------------------------------------------------------*/
 /*
- * Write the Paramter Storage Area to the WaveLAN card's memory
+ * Write the Parameter Storage Area to the WaveLAN card's memory
  */
 static void
 psa_write(struct net_device *	dev,
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.h b/drivers/net/wireless/zd1211rw/zd_chip.h
index 8009b70..301315a 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.h
+++ b/drivers/net/wireless/zd1211rw/zd_chip.h
@@ -620,8 +620,8 @@ enum {
 #define E2P_PWR_INT_GUARD		8
 #define E2P_CHANNEL_COUNT		14
 
-/* If you compare this addresses with the ZYDAS orignal driver, please notify
- * that we use word mapping for the EEPROM.
+/* If you compare these addresses with the ZYDAS original driver,
+ * please notice that we use word mapping for the EEPROM.
  */
 
 /*
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
index 87f002a..cb6e978 100644
--- a/drivers/net/yellowfin.c
+++ b/drivers/net/yellowfin.c
@@ -533,7 +533,7 @@ static int __devinit read_eeprom(void __iomem *ioaddr, int location)
 	return ioread8(ioaddr + EERead);
 }
 
-/* MII Managemen Data I/O accesses.
+/* MII Management Data I/O accesses.
    These routines assume the MDIO controller is idle, and do not exit until
    the command is finished. */
 
-- 
1.5.3.7.949.g2221a6


-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

^ permalink raw reply related

* [PATCH] drivers/net/: Spelling fixes
From: Joe Perches @ 2007-12-17 19:40 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: Pavel Roskin, Eugene Surovegin, Geoff Levand, David Gibson,
	orinoco-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Yi Zhu,
	Jaroslav Kysela, linuxppc-dev-mnsaURCQ41sdnm+yROfE0A,
	netdev-u79uwXL29TY76Z2rM5mHXA, Paul Mackerras, Peter De Shrijver,
	Rastapur Santosh, bonding-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	Andy Gospodarek, Amit S. Kale,
	ipw2100-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	ipw3945-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Masakazu Mokuno,
	libertas-dev-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Dan Williams,
	Dale Farnsworth, Jay Vosburgh, Jesse Brandeburg,
	Manish Lachwani <m


Signed-off-by: Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
---
 drivers/net/82596.c                            |    2 +-
 drivers/net/amd8111e.c                         |    8 ++++----
 drivers/net/amd8111e.h                         |    2 +-
 drivers/net/appletalk/ltpc.c                   |    2 +-
 drivers/net/atl1/atl1_hw.c                     |    2 +-
 drivers/net/atl1/atl1_main.c                   |    2 +-
 drivers/net/bonding/bond_3ad.c                 |    4 ++--
 drivers/net/chelsio/sge.c                      |    2 +-
 drivers/net/chelsio/subr.c                     |    2 +-
 drivers/net/cxgb3/t3_hw.c                      |    2 +-
 drivers/net/e1000/e1000_hw.c                   |    4 ++--
 drivers/net/e1000/e1000_hw.h                   |    2 +-
 drivers/net/e1000/e1000_main.c                 |    2 +-
 drivers/net/e1000e/netdev.c                    |    2 +-
 drivers/net/eepro.c                            |    2 +-
 drivers/net/ehea/ehea.h                        |    2 +-
 drivers/net/forcedeth.c                        |    2 +-
 drivers/net/hamachi.c                          |    4 ++--
 drivers/net/hp100.c                            |    2 +-
 drivers/net/hp100.h                            |    4 ++--
 drivers/net/ibm_emac/ibm_emac.h                |    2 +-
 drivers/net/ibm_newemac/emac.h                 |    2 +-
 drivers/net/ibmlana.c                          |    2 +-
 drivers/net/ibmlana.h                          |    2 +-
 drivers/net/ipg.c                              |    4 ++--
 drivers/net/irda/ali-ircc.c                    |    6 +++---
 drivers/net/irda/ali-ircc.h                    |    4 ++--
 drivers/net/irda/donauboe.h                    |    2 +-
 drivers/net/irda/irport.c                      |    4 ++--
 drivers/net/irda/nsc-ircc.h                    |    4 ++--
 drivers/net/irda/smsc-ircc2.c                  |    4 ++--
 drivers/net/irda/via-ircc.h                    |    4 ++--
 drivers/net/ixgbe/ixgbe_common.c               |    4 ++--
 drivers/net/ixgbe/ixgbe_main.c                 |    2 +-
 drivers/net/lasi_82596.c                       |    2 +-
 drivers/net/lib82596.c                         |    2 +-
 drivers/net/macb.c                             |    2 +-
 drivers/net/meth.h                             |    2 +-
 drivers/net/mv643xx_eth.c                      |    4 ++--
 drivers/net/netxen/netxen_nic_hw.h             |    2 +-
 drivers/net/ppp_generic.c                      |    2 +-
 drivers/net/ps3_gelic_net.c                    |    2 +-
 drivers/net/qla3xxx.c                          |    2 +-
 drivers/net/s2io.h                             |    2 +-
 drivers/net/sis190.c                           |    2 +-
 drivers/net/sk98lin/skgepnmi.c                 |    2 +-
 drivers/net/sk98lin/skxmac2.c                  |    4 ++--
 drivers/net/skfp/ess.c                         |    2 +-
 drivers/net/skfp/fplustm.c                     |    6 +++---
 drivers/net/skfp/h/fplustm.h                   |    4 ++--
 drivers/net/skfp/h/smt.h                       |    2 +-
 drivers/net/skfp/h/supern_2.h                  |    2 +-
 drivers/net/smc911x.c                          |    2 +-
 drivers/net/spider_net.c                       |    2 +-
 drivers/net/sunbmac.h                          |    2 +-
 drivers/net/sungem.c                           |    2 +-
 drivers/net/sunhme.h                           |    2 +-
 drivers/net/tc35815.c                          |    4 ++--
 drivers/net/tehuti.c                           |    2 +-
 drivers/net/tehuti.h                           |    2 +-
 drivers/net/tokenring/3c359.c                  |    2 +-
 drivers/net/tokenring/lanstreamer.c            |    2 +-
 drivers/net/tokenring/olympic.c                |    2 +-
 drivers/net/tokenring/smctr.c                  |    6 +++---
 drivers/net/tokenring/tms380tr.c               |    2 +-
 drivers/net/tokenring/tms380tr.h               |    2 +-
 drivers/net/tulip/xircom_cb.c                  |    2 +-
 drivers/net/tun.c                              |    4 ++--
 drivers/net/ucc_geth_ethtool.c                 |    2 +-
 drivers/net/ucc_geth_mii.c                     |    6 +++---
 drivers/net/wan/cycx_drv.c                     |    4 ++--
 drivers/net/wan/sbni.c                         |    2 +-
 drivers/net/wireless/atmel.c                   |    2 +-
 drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h |    2 +-
 drivers/net/wireless/ipw2200.c                 |    2 +-
 drivers/net/wireless/iwlwifi/iwl-4965.c        |    2 +-
 drivers/net/wireless/libertas/cmd.c            |    4 ++--
 drivers/net/wireless/libertas/scan.c           |    4 ++--
 drivers/net/wireless/netwave_cs.c              |    2 +-
 drivers/net/wireless/orinoco.h                 |    2 +-
 drivers/net/wireless/ray_cs.c                  |    2 +-
 drivers/net/wireless/rt2x00/rt2x00reg.h        |    2 +-
 drivers/net/wireless/rt2x00/rt2x00usb.h        |    6 +++---
 drivers/net/wireless/rt2x00/rt73usb.c          |    2 +-
 drivers/net/wireless/wavelan_cs.c              |    2 +-
 drivers/net/wireless/zd1211rw/zd_chip.h        |    4 ++--
 drivers/net/yellowfin.c                        |    2 +-
 87 files changed, 120 insertions(+), 120 deletions(-)

diff --git a/drivers/net/82596.c b/drivers/net/82596.c
index 2797da7..d999b63 100644
--- a/drivers/net/82596.c
+++ b/drivers/net/82596.c
@@ -19,7 +19,7 @@
    TBD:
    * look at deferring rx frames rather than discarding (as per tulip)
    * handle tx ring full as per tulip
-   * performace test to tune rx_copybreak
+   * performance test to tune rx_copybreak
 
    Most of my modifications relate to the braindead big-endian
    implementation by Intel.  When the i596 is operating in
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c
index e7fdd81..5cefe92 100644
--- a/drivers/net/amd8111e.c
+++ b/drivers/net/amd8111e.c
@@ -1283,7 +1283,7 @@ static irqreturn_t amd8111e_interrupt(int irq, void *dev_id)
 #ifdef CONFIG_AMD8111E_NAPI
 	if(intr0 & RINT0){
 		if(netif_rx_schedule_prep(dev, &lp->napi)){
-			/* Disable receive interupts */
+			/* Disable receive interrupts */
 			writel(RINTEN0, mmio + INTEN0);
 			/* Schedule a polling routine */
 			__netif_rx_schedule(dev, &lp->napi);
@@ -1493,7 +1493,7 @@ static void amd8111e_read_regs(struct amd8111e_priv *lp, u32 *buf)
 
 
 /*
-This function sets promiscuos mode, all-multi mode or the multicast address
+This function sets promiscuous mode, all-multi mode or the multicast address
 list to the device.
 */
 static void amd8111e_set_multicast_list(struct net_device *dev)
@@ -1522,7 +1522,7 @@ static void amd8111e_set_multicast_list(struct net_device *dev)
 		lp->mc_list = NULL;
 		lp->options &= ~OPTION_MULTICAST_ENABLE;
 		amd8111e_writeq(*(u64*)mc_filter,lp->mmio + LADRF);
-		/* disable promiscous mode */
+		/* disable promiscuous mode */
 		writel(PROM, lp->mmio + CMD2);
 		return;
 	}
@@ -2016,7 +2016,7 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev,
 	for(i = 0; i < ETH_ADDR_LEN; i++)
 		dev->dev_addr[i] = readb(lp->mmio + PADR + i);
 
-	/* Setting user defined parametrs */
+	/* Setting user defined parameters */
 	lp->ext_phy_option = speed_duplex[card_idx];
 	if(coalesce[card_idx])
 		lp->options |= OPTION_INTR_COAL_ENABLE;
diff --git a/drivers/net/amd8111e.h b/drivers/net/amd8111e.h
index 28c60a7..7d288de 100644
--- a/drivers/net/amd8111e.h
+++ b/drivers/net/amd8111e.h
@@ -614,7 +614,7 @@ typedef enum {
 #define CSTATE  1
 #define SSTATE  2
 
-/* Assume contoller gets data 10 times the maximum processing time */
+/* Assume controller gets data 10 times the maximum processing time */
 #define  REPEAT_CNT			10
 
 /* amd8111e decriptor flag definitions */
diff --git a/drivers/net/appletalk/ltpc.c b/drivers/net/appletalk/ltpc.c
index 6ab2c2d..86a9496 100644
--- a/drivers/net/appletalk/ltpc.c
+++ b/drivers/net/appletalk/ltpc.c
@@ -1233,7 +1233,7 @@ static int __init ltpc_setup(char *str)
 		if (ints[0] > 2) {
 			dma = ints[3];
 		}
-		/* ignore any other paramters */
+		/* ignore any other parameters */
 	}
 	return 1;
 }
diff --git a/drivers/net/atl1/atl1_hw.c b/drivers/net/atl1/atl1_hw.c
index 9d3bd22..82359f7 100644
--- a/drivers/net/atl1/atl1_hw.c
+++ b/drivers/net/atl1/atl1_hw.c
@@ -645,7 +645,7 @@ s32 atl1_init_hw(struct atl1_hw *hw)
 	atl1_init_flash_opcode(hw);
 
 	if (!hw->phy_configured) {
-		/* enable GPHY LinkChange Interrrupt */
+		/* enable GPHY LinkChange Interrupt */
 		ret_val = atl1_write_phy_reg(hw, 18, 0xC00);
 		if (ret_val)
 			return ret_val;
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 35b0a7d..7599163 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -575,7 +575,7 @@ static u32 atl1_check_link(struct atl1_adapter *adapter)
 		return ATL1_SUCCESS;
 	}
 
-	/* change orignal link status */
+	/* change original link status */
 	if (netif_carrier_ok(netdev)) {
 		adapter->link_speed = SPEED_0;
 		netif_carrier_off(netdev);
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index cb3c6fa..96f0f24 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -869,7 +869,7 @@ static int ad_lacpdu_send(struct port *port)
 	lacpdu_header = (struct lacpdu_header *)skb_put(skb, length);
 
 	lacpdu_header->ad_header.destination_address = lacpdu_multicast_address;
-	/* Note: source addres is set to be the member's PERMANENT address, because we use it
+	/* Note: source address is set to be the member's PERMANENT address, because we use it
 	   to identify loopback lacpdus in receive. */
 	lacpdu_header->ad_header.source_address = *((struct mac_addr *)(slave->perm_hwaddr));
 	lacpdu_header->ad_header.length_type = PKT_TYPE_LACPDU;
@@ -912,7 +912,7 @@ static int ad_marker_send(struct port *port, struct bond_marker *marker)
 	marker_header = (struct bond_marker_header *)skb_put(skb, length);
 
 	marker_header->ad_header.destination_address = lacpdu_multicast_address;
-	/* Note: source addres is set to be the member's PERMANENT address, because we use it
+	/* Note: source address is set to be the member's PERMANENT address, because we use it
 	   to identify loopback MARKERs in receive. */
 	marker_header->ad_header.source_address = *((struct mac_addr *)(slave->perm_hwaddr));
 	marker_header->ad_header.length_type = PKT_TYPE_LACPDU;
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c
index b301c04..ed17cd9 100644
--- a/drivers/net/chelsio/sge.c
+++ b/drivers/net/chelsio/sge.c
@@ -248,7 +248,7 @@ static void restart_sched(unsigned long);
  *
  * Interrupts are handled by a single CPU and it is likely that on a MP system
  * the application is migrated to another CPU. In that scenario, we try to
- * seperate the RX(in irq context) and TX state in order to decrease memory
+ * separate the RX(in irq context) and TX state in order to decrease memory
  * contention.
  */
 struct sge {
diff --git a/drivers/net/chelsio/subr.c b/drivers/net/chelsio/subr.c
index dc50151..7c95578 100644
--- a/drivers/net/chelsio/subr.c
+++ b/drivers/net/chelsio/subr.c
@@ -559,7 +559,7 @@ struct chelsio_vpd_t {
 #define EEPROM_MAX_POLL   4
 
 /*
- * Read SEEPROM. A zero is written to the flag register when the addres is
+ * Read SEEPROM. A zero is written to the flag register when the address is
  * written to the Control register. The hardware device will set the flag to a
  * one when 4B have been transferred to the Data register.
  */
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 522834c..2882e36 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -534,7 +534,7 @@ struct t3_vpd {
  *
  *	Read a 32-bit word from a location in VPD EEPROM using the card's PCI
  *	VPD ROM capability.  A zero is written to the flag bit when the
- *	addres is written to the control register.  The hardware device will
+ *	address is written to the control register.  The hardware device will
  *	set the flag to 1 when 4 bytes have been read into the data register.
  */
 int t3_seeprom_read(struct adapter *adapter, u32 addr, u32 *data)
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 7c6888c..fd7e6a8 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -803,7 +803,7 @@ e1000_initialize_hardware_bits(struct e1000_hw *hw)
                 E1000_WRITE_REG(hw, CTRL, reg_ctrl);
                 break;
             case e1000_80003es2lan:
-                /* improve small packet performace for fiber/serdes */
+                /* improve small packet performance for fiber/serdes */
                 if ((hw->media_type == e1000_media_type_fiber) ||
                     (hw->media_type == e1000_media_type_internal_serdes)) {
                     reg_tarc0 &= ~(1 << 20);
@@ -5001,7 +5001,7 @@ e1000_read_eeprom(struct e1000_hw *hw,
             return -E1000_ERR_EEPROM;
     }
 
-    /* Eerd register EEPROM access requires no eeprom aquire/release */
+    /* Eerd register EEPROM access requires no eeprom acquire/release */
     if (eeprom->use_eerd == TRUE)
         return e1000_read_eeprom_eerd(hw, offset, words, data);
 
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h
index a2a86c5..e40e515 100644
--- a/drivers/net/e1000/e1000_hw.h
+++ b/drivers/net/e1000/e1000_hw.h
@@ -1068,7 +1068,7 @@ struct e1000_ffvt_entry {
 
 #define E1000_KUMCTRLSTA 0x00034 /* MAC-PHY interface - RW */
 #define E1000_MDPHYA     0x0003C  /* PHY address - RW */
-#define E1000_MANC2H     0x05860  /* Managment Control To Host - RW */
+#define E1000_MANC2H     0x05860  /* Management Control To Host - RW */
 #define E1000_SW_FW_SYNC 0x05B5C /* Software-Firmware Synchronization - RW */
 
 #define E1000_GCR       0x05B00 /* PCI-Ex Control */
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 4f37506..24a2fc1 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -235,7 +235,7 @@ static struct pci_driver e1000_driver = {
 	.probe    = e1000_probe,
 	.remove   = __devexit_p(e1000_remove),
 #ifdef CONFIG_PM
-	/* Power Managment Hooks */
+	/* Power Management Hooks */
 	.suspend  = e1000_suspend,
 	.resume   = e1000_resume,
 #endif
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 4fd2e23..febe157 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -4109,7 +4109,7 @@ static struct pci_driver e1000_driver = {
 	.probe    = e1000_probe,
 	.remove   = __devexit_p(e1000_remove),
 #ifdef CONFIG_PM
-	/* Power Managment Hooks */
+	/* Power Management Hooks */
 	.suspend  = e1000_suspend,
 	.resume   = e1000_resume,
 #endif
diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c
index 83bda6c..d3789c5 100644
--- a/drivers/net/eepro.c
+++ b/drivers/net/eepro.c
@@ -1764,7 +1764,7 @@ module_param_array(io, int, NULL, 0);
 module_param_array(irq, int, NULL, 0);
 module_param_array(mem, int, NULL, 0);
 module_param(autodetect, int, 0);
-MODULE_PARM_DESC(io, "EtherExpress Pro/10 I/O base addres(es)");
+MODULE_PARM_DESC(io, "EtherExpress Pro/10 I/O base address(es)");
 MODULE_PARM_DESC(irq, "EtherExpress Pro/10 IRQ number(s)");
 MODULE_PARM_DESC(mem, "EtherExpress Pro/10 Rx buffer size(es) in kB (3-29)");
 MODULE_PARM_DESC(autodetect, "EtherExpress Pro/10 force board(s) detection (0-1)");
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index 5f82a46..a50b238 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -251,7 +251,7 @@ struct ehea_qp_init_attr {
 };
 
 /*
- * Event Queue attributes, passed as paramter
+ * Event Queue attributes, passed as parameter
  */
 struct ehea_eq_attr {
 	u32 type;
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index a96583c..7119332 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -490,7 +490,7 @@ union ring_type {
 #define NV_RX3_VLAN_TAG_PRESENT (1<<16)
 #define NV_RX3_VLAN_TAG_MASK	(0x0000FFFF)
 
-/* Miscelaneous hardware related defines: */
+/* Miscellaneous hardware related defines: */
 #define NV_PCI_REGSZ_VER1      	0x270
 #define NV_PCI_REGSZ_VER2      	0x2d4
 #define NV_PCI_REGSZ_VER3      	0x604
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c
index ed407c8..683b289 100644
--- a/drivers/net/hamachi.c
+++ b/drivers/net/hamachi.c
@@ -86,7 +86,7 @@ static int force32;
 static int options[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
 static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
 /* The Hamachi chipset supports 3 parameters each for Rx and Tx
- * interruput management.  Parameters will be loaded as specified into
+ * interrupt management.  Parameters will be loaded as specified into
  * the TxIntControl and RxIntControl registers.
  *
  * The registers are arranged as follows:
@@ -811,7 +811,7 @@ static int __devinit read_eeprom(void __iomem *ioaddr, int location)
 	return readb(ioaddr + EEData);
 }
 
-/* MII Managemen Data I/O accesses.
+/* MII Management Data I/O accesses.
    These routines assume the MDIO controller is idle, and do not exit until
    the command is finished. */
 
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c
index 49421d1..8b90d64 100644
--- a/drivers/net/hp100.c
+++ b/drivers/net/hp100.c
@@ -2643,7 +2643,7 @@ static int hp100_login_to_vg_hub(struct net_device *dev, u_short force_relogin)
 		} else {
 			hp100_andb(~HP100_PROM_MODE, VG_LAN_CFG_2);
 			/* For ETR parts we need to reset the prom. bit in the training
-			 * register, otherwise promiscious mode won't be disabled.
+			 * register, otherwise promiscuous mode won't be disabled.
 			 */
 			if (lp->chip == HP100_CHIPID_LASSEN) {
 				hp100_andw(~HP100_MACRQ_PROMSC, TRAIN_REQUEST);
diff --git a/drivers/net/hp100.h b/drivers/net/hp100.h
index e6ca128..e74e45d 100644
--- a/drivers/net/hp100.h
+++ b/drivers/net/hp100.h
@@ -476,7 +476,7 @@
 #define HP100_MACRQ_REPEATER         0x0001	/* 1: MAC tells HUB it wants to be
 						 *    a cascaded repeater
 						 * 0: ... wants to be a DTE */
-#define HP100_MACRQ_PROMSC           0x0006	/* 2 bits: Promiscious mode
+#define HP100_MACRQ_PROMSC           0x0006	/* 2 bits: Promiscuous mode
 						 * 00: Rcv only unicast packets
 						 *     specifically addr to this
 						 *     endnode
@@ -488,7 +488,7 @@
 #define HP100_CARD_MACVER            0xe000	/* R: 3 bit Cards 100VG MAC version */
 #define HP100_MALLOW_REPEATER        0x0001	/* If reset, requested access as an
 						 * end node is allowed */
-#define HP100_MALLOW_PROMSC          0x0004	/* 2 bits: Promiscious mode
+#define HP100_MALLOW_PROMSC          0x0004	/* 2 bits: Promiscuous mode
 						 * 00: Rcv only unicast packets
 						 *     specifically addr to this
 						 *     endnode
diff --git a/drivers/net/ibm_emac/ibm_emac.h b/drivers/net/ibm_emac/ibm_emac.h
index 97ed22b..655be50 100644
--- a/drivers/net/ibm_emac/ibm_emac.h
+++ b/drivers/net/ibm_emac/ibm_emac.h
@@ -1,7 +1,7 @@
 /*
  * drivers/net/ibm_emac/ibm_emac.h
  *
- * Register definitions for PowerPC 4xx on-chip ethernet contoller
+ * Register definitions for PowerPC 4xx on-chip ethernet controller
  *
  * Copyright (c) 2004, 2005 Zultys Technologies.
  * Eugene Surovegin <eugene.surovegin-OMD3UA+2ZXrQT0dZR+AlfA@public.gmane.org> or <ebs-Iydg86zsFCHR7s880joybQ@public.gmane.org>
diff --git a/drivers/net/ibm_newemac/emac.h b/drivers/net/ibm_newemac/emac.h
index 91cb096..49a540a 100644
--- a/drivers/net/ibm_newemac/emac.h
+++ b/drivers/net/ibm_newemac/emac.h
@@ -1,7 +1,7 @@
 /*
  * drivers/net/ibm_newemac/emac.h
  *
- * Register definitions for PowerPC 4xx on-chip ethernet contoller
+ * Register definitions for PowerPC 4xx on-chip ethernet controller
  *
  * Copyright 2007 Benjamin Herrenschmidt, IBM Corp.
  *                <benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
diff --git a/drivers/net/ibmlana.c b/drivers/net/ibmlana.c
index 91d83ac..5a9b6fa 100644
--- a/drivers/net/ibmlana.c
+++ b/drivers/net/ibmlana.c
@@ -481,7 +481,7 @@ static void InitBoard(struct net_device *dev)
 	if ((dev->flags & IFF_ALLMULTI) || (mcptr != NULL))
 		rcrval |= RCREG_AMC;
 
-	/* promiscous mode ? */
+	/* promiscuous mode ? */
 
 	if (dev->flags & IFF_PROMISC)
 		rcrval |= RCREG_PRO;
diff --git a/drivers/net/ibmlana.h b/drivers/net/ibmlana.h
index aa3ddbd..654af95 100644
--- a/drivers/net/ibmlana.h
+++ b/drivers/net/ibmlana.h
@@ -90,7 +90,7 @@ typedef struct {
 #define RCREG_ERR        0x8000	/* accept damaged and collided pkts */
 #define RCREG_RNT        0x4000	/* accept packets that are < 64     */
 #define RCREG_BRD        0x2000	/* accept broadcasts                */
-#define RCREG_PRO        0x1000	/* promiscous mode                  */
+#define RCREG_PRO        0x1000	/* promiscuous mode                 */
 #define RCREG_AMC        0x0800	/* accept all multicasts            */
 #define RCREG_LB_NONE    0x0000	/* no loopback                      */
 #define RCREG_LB_MAC     0x0200	/* MAC loopback                     */
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index dbd23bb..27d12eb 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -209,7 +209,7 @@ static int mdio_read(struct net_device * dev, int phy_id, int phy_reg)
 {
 	void __iomem *ioaddr = ipg_ioaddr(dev);
 	/*
-	 * The GMII mangement frame structure for a read is as follows:
+	 * The GMII management frame structure for a read is as follows:
 	 *
 	 * |Preamble|st|op|phyad|regad|ta|      data      |idle|
 	 * |< 32 1s>|01|10|AAAAA|RRRRR|z0|DDDDDDDDDDDDDDDD|z   |
@@ -300,7 +300,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int phy_reg, int val)
 {
 	void __iomem *ioaddr = ipg_ioaddr(dev);
 	/*
-	 * The GMII mangement frame structure for a read is as follows:
+	 * The GMII management frame structure for a read is as follows:
 	 *
 	 * |Preamble|st|op|phyad|regad|ta|      data      |idle|
 	 * |< 32 1s>|01|10|AAAAA|RRRRR|z0|DDDDDDDDDDDDDDDD|z   |
diff --git a/drivers/net/irda/ali-ircc.c b/drivers/net/irda/ali-ircc.c
index 9f58452..94140f7 100644
--- a/drivers/net/irda/ali-ircc.c
+++ b/drivers/net/irda/ali-ircc.c
@@ -977,7 +977,7 @@ static void ali_ircc_change_speed(struct ali_ircc_cb *self, __u32 baud)
 		/* Install FIR xmit handler*/
 		dev->hard_start_xmit = ali_ircc_fir_hard_xmit;		
 				
-		/* Enable Interuupt */
+		/* Enable Interrupt */
 		self->ier = IER_EOM; // benjamin 2000/11/20 07:24PM					
 				
 		/* Be ready for incomming frames */
@@ -1096,7 +1096,7 @@ static void ali_ircc_sir_change_speed(struct ali_ircc_cb *priv, __u32 speed)
 	outb(lcr,		  iobase+UART_LCR); /* Set 8N1	*/
 	outb(fcr,		  iobase+UART_FCR); /* Enable FIFO's */
 
-	/* without this, the conection will be broken after come back from FIR speed,
+	/* without this, the connection will be broken after come back from FIR speed,
 	   but with this, the SIR connection is harder to established */
 	outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), iobase+UART_MCR);
 	
@@ -1359,7 +1359,7 @@ static int ali_ircc_net_open(struct net_device *dev)
 		return -EAGAIN;
 	}
 	
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	outb(UART_IER_RDI , iobase+UART_IER);
 
 	/* Ready to play! */
diff --git a/drivers/net/irda/ali-ircc.h b/drivers/net/irda/ali-ircc.h
index e489c66..0787657 100644
--- a/drivers/net/irda/ali-ircc.h
+++ b/drivers/net/irda/ali-ircc.h
@@ -173,13 +173,13 @@ struct st_fifo {
 
 struct frame_cb {
 	void *start; /* Start of frame in DMA mem */
-	int len;     /* Lenght of frame in DMA mem */
+	int len;     /* Length of frame in DMA mem */
 };
 
 struct tx_fifo {
 	struct frame_cb queue[MAX_TX_WINDOW]; /* Info about frames in queue */
 	int             ptr;                  /* Currently being sent */
-	int             len;                  /* Lenght of queue */
+	int             len;                  /* Length of queue */
 	int             free;                 /* Next free slot */
 	void           *tail;                 /* Next free start in DMA mem */
 };
diff --git a/drivers/net/irda/donauboe.h b/drivers/net/irda/donauboe.h
index 1e67720..9db3cce 100644
--- a/drivers/net/irda/donauboe.h
+++ b/drivers/net/irda/donauboe.h
@@ -30,7 +30,7 @@
  *     or the type-DO IR port.
  *
  * IrDA chip set list from Toshiba Computer Engineering Corp.
- * model			method	maker	controler		Version 
+ * model			method	maker	controller		Version 
  * Portege 320CT	FIR,SIR Toshiba Oboe(Triangle) 
  * Portege 3010CT	FIR,SIR Toshiba Oboe(Sydney) 
  * Portege 3015CT	FIR,SIR Toshiba Oboe(Sydney) 
diff --git a/drivers/net/irda/irport.c b/drivers/net/irda/irport.c
index c79caa5..2b2a955 100644
--- a/drivers/net/irda/irport.c
+++ b/drivers/net/irda/irport.c
@@ -276,7 +276,7 @@ static void irport_start(struct irport_cb *self)
 	outb(UART_LCR_WLEN8, iobase+UART_LCR);  /* Reset DLAB */
 	outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), iobase+UART_MCR);
 	
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	outb(UART_IER_RLSI | UART_IER_RDI |UART_IER_THRI, iobase+UART_IER);
 }
 
@@ -352,7 +352,7 @@ static void irport_change_speed(void *priv, __u32 speed)
 	outb(lcr,		  iobase+UART_LCR); /* Set 8N1	*/
 	outb(fcr,		  iobase+UART_FCR); /* Enable FIFO's */
 
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	/* This will generate a fatal interrupt storm.
 	 * People calling us will do that properly - Jean II */
 	//outb(/*UART_IER_RLSI|*/UART_IER_RDI/*|UART_IER_THRI*/, iobase+UART_IER);
diff --git a/drivers/net/irda/nsc-ircc.h b/drivers/net/irda/nsc-ircc.h
index bbdc97f..29398a4 100644
--- a/drivers/net/irda/nsc-ircc.h
+++ b/drivers/net/irda/nsc-ircc.h
@@ -231,13 +231,13 @@ struct st_fifo {
 
 struct frame_cb {
 	void *start; /* Start of frame in DMA mem */
-	int len;     /* Lenght of frame in DMA mem */
+	int len;     /* Length of frame in DMA mem */
 };
 
 struct tx_fifo {
 	struct frame_cb queue[MAX_TX_WINDOW]; /* Info about frames in queue */
 	int             ptr;                  /* Currently being sent */
-	int             len;                  /* Lenght of queue */
+	int             len;                  /* Length of queue */
 	int             free;                 /* Next free slot */
 	void           *tail;                 /* Next free start in DMA mem */
 };
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c
index 7e7b582..7fd9a48 100644
--- a/drivers/net/irda/smsc-ircc2.c
+++ b/drivers/net/irda/smsc-ircc2.c
@@ -1165,7 +1165,7 @@ void smsc_ircc_set_sir_speed(struct smsc_ircc_cb *self, __u32 speed)
 	outb(lcr,		  iobase + UART_LCR); /* Set 8N1 */
 	outb(fcr,		  iobase + UART_FCR); /* Enable FIFO's */
 
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	outb(UART_IER_RLSI | UART_IER_RDI | UART_IER_THRI, iobase + UART_IER);
 
 	IRDA_DEBUG(2, "%s() speed changed to: %d\n", __FUNCTION__, speed);
@@ -1930,7 +1930,7 @@ void smsc_ircc_sir_start(struct smsc_ircc_cb *self)
 	outb(UART_LCR_WLEN8, sir_base + UART_LCR);  /* Reset DLAB */
 	outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), sir_base + UART_MCR);
 
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	outb(UART_IER_RLSI | UART_IER_RDI |UART_IER_THRI, sir_base + UART_IER);
 
 	IRDA_DEBUG(3, "%s() - exit\n", __FUNCTION__);
diff --git a/drivers/net/irda/via-ircc.h b/drivers/net/irda/via-ircc.h
index 204b1b3..9d012f0 100644
--- a/drivers/net/irda/via-ircc.h
+++ b/drivers/net/irda/via-ircc.h
@@ -54,13 +54,13 @@ struct st_fifo {
 
 struct frame_cb {
 	void *start;		/* Start of frame in DMA mem */
-	int len;		/* Lenght of frame in DMA mem */
+	int len;		/* Length of frame in DMA mem */
 };
 
 struct tx_fifo {
 	struct frame_cb queue[MAX_TX_WINDOW + 2];	/* Info about frames in queue */
 	int ptr;		/* Currently being sent */
-	int len;		/* Lenght of queue */
+	int len;		/* Length of queue */
 	int free;		/* Next free slot */
 	void *tail;		/* Next free start in DMA mem */
 };
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c
index 512e3b2..4b6359e 100644
--- a/drivers/net/ixgbe/ixgbe_common.c
+++ b/drivers/net/ixgbe/ixgbe_common.c
@@ -716,7 +716,7 @@ static s32 ixgbe_init_rx_addrs(struct ixgbe_hw *hw)
  *  bit-vector to set in the multicast table. The hardware uses 12 bits, from
  *  incoming rx multicast addresses, to determine the bit-vector to check in
  *  the MTA. Which of the 4 combination, of 12-bits, the hardware uses is set
- *  by the MO field of the MCSTCTRL. The MO field is set during initalization
+ *  by the MO field of the MCSTCTRL. The MO field is set during initialization
  *  to mc_filter_type.
  **/
 static s32 ixgbe_mta_vector(struct ixgbe_hw *hw, u8 *mc_addr)
@@ -1066,7 +1066,7 @@ s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw)
 
 
 /**
- *  ixgbe_acquire_swfw_sync - Aquire SWFW semaphore
+ *  ixgbe_acquire_swfw_sync - Acquire SWFW semaphore
  *  @hw: pointer to hardware structure
  *  @mask: Mask to specify wich semaphore to acquire
  *
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 00bc525..25a9cc2 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -592,7 +592,7 @@ quit_polling:
  * ixgbe_setup_msix - Initialize MSI-X interrupts
  *
  * ixgbe_setup_msix allocates MSI-X vectors and requests
- * interrutps from the kernel.
+ * interrupts from the kernel.
  **/
 static int ixgbe_setup_msix(struct ixgbe_adapter *adapter)
 {
diff --git a/drivers/net/lasi_82596.c b/drivers/net/lasi_82596.c
index efbae4b..1ba38c2 100644
--- a/drivers/net/lasi_82596.c
+++ b/drivers/net/lasi_82596.c
@@ -47,7 +47,7 @@
    TBD:
    * look at deferring rx frames rather than discarding (as per tulip)
    * handle tx ring full as per tulip
-   * performace test to tune rx_copybreak
+   * performance test to tune rx_copybreak
 
    Most of my modifications relate to the braindead big-endian
    implementation by Intel.  When the i596 is operating in
diff --git a/drivers/net/lib82596.c b/drivers/net/lib82596.c
index b59f442..c335d31 100644
--- a/drivers/net/lib82596.c
+++ b/drivers/net/lib82596.c
@@ -47,7 +47,7 @@
    TBD:
    * look at deferring rx frames rather than discarding (as per tulip)
    * handle tx ring full as per tulip
-   * performace test to tune rx_copybreak
+   * performance test to tune rx_copybreak
 
    Most of my modifications relate to the braindead big-endian
    implementation by Intel.  When the i596 is operating in
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 047ea7b..1367178 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -239,7 +239,7 @@ static int macb_mii_init(struct macb *bp)
 	struct eth_platform_data *pdata;
 	int err = -ENXIO, i;
 
-	/* Enable managment port */
+	/* Enable management port */
 	macb_writel(bp, NCR, MACB_BIT(MPE));
 
 	bp->mii_bus.name = "MACB_mii_bus",
diff --git a/drivers/net/meth.h b/drivers/net/meth.h
index a78dc1c..ecd0e97 100644
--- a/drivers/net/meth.h
+++ b/drivers/net/meth.h
@@ -127,7 +127,7 @@ typedef struct rx_packet {
 #define METH_ACCEPT_MY 0			/* 00: Accept PHY address only */
 #define METH_ACCEPT_MCAST 0x20	/* 01: Accept physical, broadcast, and multicast filter matches only */
 #define METH_ACCEPT_AMCAST 0x40	/* 10: Accept physical, broadcast, and all multicast packets */
-#define METH_PROMISC 0x60		/* 11: Promiscious mode */
+#define METH_PROMISC 0x60		/* 11: Promiscuous mode */
 
 #define METH_PHY_LINK_FAIL	BIT(7) /* 0: Link failure detection disabled, 1: Hardware scans for link failure in PHY */
 
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 651c269..c263c91 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -535,7 +535,7 @@ struct mv643xx_private {
 
 	int rx_resource_err;		/* Rx ring resource error flag */
 
-	/* Tx/Rx rings managment indexes fields. For driver use */
+	/* Tx/Rx rings management indexes fields. For driver use */
 
 	/* Next available and first returning Rx resource */
 	int rx_curr_desc_q, rx_used_desc_q;
@@ -757,7 +757,7 @@ static void mv643xx_eth_update_mac_address(struct net_device *dev)
 /*
  * mv643xx_eth_set_rx_mode
  *
- * Change from promiscuos to regular rx mode
+ * Change from promiscuous to regular rx mode
  *
  * Input :	pointer to ethernet interface network device structure
  * Output :	N/A
diff --git a/drivers/net/netxen/netxen_nic_hw.h b/drivers/net/netxen/netxen_nic_hw.h
index 245bf13..236160a 100644
--- a/drivers/net/netxen/netxen_nic_hw.h
+++ b/drivers/net/netxen/netxen_nic_hw.h
@@ -429,7 +429,7 @@ typedef enum {
 #define netxen_get_niu_enable_ge(config_word)	\
 		_netxen_crb_get_bit(config_word, 1)
 
-/* Promiscous mode options (GbE mode only) */
+/* Promiscuous mode options (GbE mode only) */
 typedef enum {
 	NETXEN_NIU_PROMISC_MODE = 0,
 	NETXEN_NIU_NON_PROMISC_MODE
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index 4f69037..9e1890f 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -2368,7 +2368,7 @@ find_compressor(int type)
 }
 
 /*
- * Miscelleneous stuff.
+ * Miscellaneous stuff.
  */
 
 static void
diff --git a/drivers/net/ps3_gelic_net.c b/drivers/net/ps3_gelic_net.c
index 0a42bf5..5efc5b4 100644
--- a/drivers/net/ps3_gelic_net.c
+++ b/drivers/net/ps3_gelic_net.c
@@ -1271,7 +1271,7 @@ static struct ethtool_ops gelic_net_ethtool_ops = {
 /**
  * gelic_net_tx_timeout_task - task scheduled by the watchdog timeout
  * function (to be called not under interrupt status)
- * @work: work is context of tx timout task
+ * @work: work is context of tx timeout task
  *
  * called as task when tx hangs, resets interface (if interface is up)
  */
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index a579111..da85b7f 100644
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -3691,7 +3691,7 @@ static int ql_adapter_up(struct ql3_adapter *qdev)
 		ql_sem_unlock(qdev, QL_DRVR_SEM_MASK);
 	} else {
 		printk(KERN_ERR PFX
-		       "%s: Could not aquire driver lock.\n",
+		       "%s: Could not acquire driver lock.\n",
 		       ndev->name);
 		goto err_lock;
 	}
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h
index cc1797a..63d45d4 100644
--- a/drivers/net/s2io.h
+++ b/drivers/net/s2io.h
@@ -740,7 +740,7 @@ struct mac_info {
 	u16 mc_pause_threshold_q0q3;
 	u16 mc_pause_threshold_q4q7;
 
-	void *stats_mem;	/* orignal pointer to allocated mem */
+	void *stats_mem;	/* original pointer to allocated mem */
 	dma_addr_t stats_mem_phy;	/* Physical address of the stat block */
 	u32 stats_mem_sz;
 	struct stat_block *stats_info;	/* Logical address of the stat block */
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
index 7200883..ff559e4 100644
--- a/drivers/net/sis190.c
+++ b/drivers/net/sis190.c
@@ -102,7 +102,7 @@ enum sis190_registers {
 	IntrStatus		= 0x20,
 	IntrMask		= 0x24,
 	IntrControl		= 0x28,
-	IntrTimer		= 0x2c,	// unused (Interupt Timer)
+	IntrTimer		= 0x2c,	// unused (Interrupt Timer)
 	PMControl		= 0x30,	// unused (Power Mgmt Control/Status)
 	rsv2			= 0x34,	// reserved
 	ROMControl		= 0x38,
diff --git a/drivers/net/sk98lin/skgepnmi.c b/drivers/net/sk98lin/skgepnmi.c
index b36dd9a..c761ff7 100644
--- a/drivers/net/sk98lin/skgepnmi.c
+++ b/drivers/net/sk98lin/skgepnmi.c
@@ -356,7 +356,7 @@ int Level)		/* Initialization level */
 	unsigned int	PortMax;	/* Number of ports */
 	unsigned int	PortIndex;	/* Current port index in loop */
 	SK_U16		Val16;		/* Multiple purpose 16 bit variable */
-	SK_U8		Val8;		/* Mulitple purpose 8 bit variable */
+	SK_U8		Val8;		/* Multiple purpose 8 bit variable */
 	SK_EVPARA	EventParam;	/* Event struct for timer event */
 	SK_PNMI_VCT	*pVctBackupData;
 
diff --git a/drivers/net/sk98lin/skxmac2.c b/drivers/net/sk98lin/skxmac2.c
index b4e7502..3994289 100644
--- a/drivers/net/sk98lin/skxmac2.c
+++ b/drivers/net/sk98lin/skxmac2.c
@@ -3891,7 +3891,7 @@ int SkXmOverflowStatus(
 SK_AC	*pAC,				/* adapter context */
 SK_IOC	IoC,				/* IO context */
 unsigned int Port,			/* Port Index (MAC_1 + n) */
-SK_U16	IStatus,			/* Interupt Status from MAC */
+SK_U16	IStatus,			/* Interrupt Status from MAC */
 SK_U64	SK_FAR *pStatus)	/* ptr for return overflow status value */
 {
 	SK_U64	Status;	/* Overflow status */
@@ -4036,7 +4036,7 @@ int SkGmOverflowStatus(
 SK_AC	*pAC,				/* adapter context */
 SK_IOC	IoC,				/* IO context */
 unsigned int Port,			/* Port Index (MAC_1 + n) */
-SK_U16	IStatus,			/* Interupt Status from MAC */
+SK_U16	IStatus,			/* Interrupt Status from MAC */
 SK_U64	SK_FAR *pStatus)	/* ptr for return overflow status value */
 {
 	SK_U64	Status;		/* Overflow status */
diff --git a/drivers/net/skfp/ess.c b/drivers/net/skfp/ess.c
index 62b0132..889f987 100644
--- a/drivers/net/skfp/ess.c
+++ b/drivers/net/skfp/ess.c
@@ -598,7 +598,7 @@ static void ess_send_alc_req(struct s_smc *smc)
 	req->cmd.sba_cmd = REQUEST_ALLOCATION ;
 
 	/*
-	 * set the parameter type and parameter lenght of all used
+	 * set the parameter type and parameter length of all used
 	 * parameters
 	 */
 
diff --git a/drivers/net/skfp/fplustm.c b/drivers/net/skfp/fplustm.c
index a45205d..b27a895 100644
--- a/drivers/net/skfp/fplustm.c
+++ b/drivers/net/skfp/fplustm.c
@@ -398,7 +398,7 @@ static void copy_tx_mac(struct s_smc *smc, u_long td, struct fddi_mac *mac,
 /* u_long td;		 transmit descriptor */
 /* struct fddi_mac *mac; mac frame pointer */
 /* unsigned off;	 start address within buffer memory */
-/* int len ;		 lenght of the frame including the FC */
+/* int len ;		 length of the frame including the FC */
 {
 	int	i ;
 	u_int	*p ;
@@ -1262,8 +1262,8 @@ Function	DOWNCALL/INTERN	(SMT, fplustm.c)
 
 Para	mode =	1	RX_ENABLE_ALLMULTI	enable all multicasts
 		2	RX_DISABLE_ALLMULTI	disable "enable all multicasts"
-		3	RX_ENABLE_PROMISC	enable promiscous
-		4	RX_DISABLE_PROMISC	disable promiscous
+		3	RX_ENABLE_PROMISC	enable promiscuous
+		4	RX_DISABLE_PROMISC	disable promiscuous
 		5	RX_ENABLE_NSA		enable reception of NSA frames
 		6	RX_DISABLE_NSA		disable reception of NSA frames
 
diff --git a/drivers/net/skfp/h/fplustm.h b/drivers/net/skfp/h/fplustm.h
index 98bbf65..586f055 100644
--- a/drivers/net/skfp/h/fplustm.h
+++ b/drivers/net/skfp/h/fplustm.h
@@ -237,8 +237,8 @@ struct s_smt_fp {
  */
 #define RX_ENABLE_ALLMULTI	1	/* enable all multicasts */
 #define RX_DISABLE_ALLMULTI	2	/* disable "enable all multicasts" */
-#define RX_ENABLE_PROMISC	3	/* enable promiscous */
-#define RX_DISABLE_PROMISC	4	/* disable promiscous */
+#define RX_ENABLE_PROMISC	3	/* enable promiscuous */
+#define RX_DISABLE_PROMISC	4	/* disable promiscuous */
 #define RX_ENABLE_NSA		5	/* enable reception of NSA frames */
 #define RX_DISABLE_NSA		6	/* disable reception of NSA frames */
 
diff --git a/drivers/net/skfp/h/smt.h b/drivers/net/skfp/h/smt.h
index 1ff5899..2976757 100644
--- a/drivers/net/skfp/h/smt.h
+++ b/drivers/net/skfp/h/smt.h
@@ -413,7 +413,7 @@ struct smt_p_reason {
 #define SMT_RDF_SUCCESS	0x00000003	/* success (PMF) */
 #define SMT_RDF_BADSET	0x00000004	/* bad set count (PMF) */
 #define SMT_RDF_ILLEGAL 0x00000005	/* read only (PMF) */
-#define SMT_RDF_NOPARAM	0x6		/* paramter not supported (PMF) */
+#define SMT_RDF_NOPARAM	0x6		/* parameter not supported (PMF) */
 #define SMT_RDF_RANGE	0x8		/* out of range */
 #define SMT_RDF_AUTHOR	0x9		/* not autohorized */
 #define SMT_RDF_LENGTH	0x0a		/* length error */
diff --git a/drivers/net/skfp/h/supern_2.h b/drivers/net/skfp/h/supern_2.h
index 5ba0b83..1074f96 100644
--- a/drivers/net/skfp/h/supern_2.h
+++ b/drivers/net/skfp/h/supern_2.h
@@ -386,7 +386,7 @@ struct tx_queue {
 #define	FM_MDISRCV	(4<<8)		/* disable receive function */
 #define	FM_MRES0	(5<<8)		/* reserve */
 #define	FM_MLIMPROM	(6<<8)		/* limited-promiscuous mode */
-#define FM_MPROMISCOUS	(7<<8)		/* address detection : promiscous */
+#define FM_MPROMISCOUS	(7<<8)		/* address detection : promiscuous */
 
 #define FM_SELSA	0x0800		/* select-short-address bit */
 
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 76cc1d3..648b904 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -466,7 +466,7 @@ static inline void	 smc911x_rcv(struct net_device *dev)
 		/* Align IP header to 32 bits
 		 * Note that the device is configured to add a 2
 		 * byte padding to the packet start, so we really
-		 * want to write to the orignal data pointer */
+		 * want to write to the original data pointer */
 		data = skb->data;
 		skb_reserve(skb, 2);
 		skb_put(skb,pkt_len-4);
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
index bccae7e..7a7f5cd 100644
--- a/drivers/net/spider_net.c
+++ b/drivers/net/spider_net.c
@@ -1826,7 +1826,7 @@ spider_net_enable_card(struct spider_net_card *card)
 
 	spider_net_write_reg(card, SPIDER_NET_ECMODE, SPIDER_NET_ECMODE_VALUE);
 
-	/* set chain tail adress for RX chains and
+	/* set chain tail address for RX chains and
 	 * enable DMA */
 	spider_net_enable_rxchtails(card);
 	spider_net_enable_rxdmac(card);
diff --git a/drivers/net/sunbmac.h b/drivers/net/sunbmac.h
index b563d3c..681442b 100644
--- a/drivers/net/sunbmac.h
+++ b/drivers/net/sunbmac.h
@@ -185,7 +185,7 @@
 #define BIGMAC_RXCFG_ENABLE    0x00000001 /* Enable the receiver                      */
 #define BIGMAC_RXCFG_FIFO      0x0000000e /* Default rx fthresh...                    */
 #define BIGMAC_RXCFG_PSTRIP    0x00000020 /* Pad byte strip enable                    */
-#define BIGMAC_RXCFG_PMISC     0x00000040 /* Enable promiscous mode                   */
+#define BIGMAC_RXCFG_PMISC     0x00000040 /* Enable promiscuous mode                  */
 #define BIGMAC_RXCFG_DERR      0x00000080 /* Disable error checking                   */
 #define BIGMAC_RXCFG_DCRCS     0x00000100 /* Disable CRC stripping                    */
 #define BIGMAC_RXCFG_ME        0x00000200 /* Receive packets addressed to me          */
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 6887214..097a065 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -780,7 +780,7 @@ static int gem_rx(struct gem *gp, int work_to_do)
 			break;
 
 		/* When writing back RX descriptor, GEM writes status
-		 * then buffer address, possibly in seperate transactions.
+		 * then buffer address, possibly in separate transactions.
 		 * If we don't wait for the chip to write both, we could
 		 * post a new buffer to this descriptor then have GEM spam
 		 * on the buffer address.  We sync on the RX completion
diff --git a/drivers/net/sunhme.h b/drivers/net/sunhme.h
index 90f446d..68bf4e1 100644
--- a/drivers/net/sunhme.h
+++ b/drivers/net/sunhme.h
@@ -223,7 +223,7 @@
 /* BigMac receive config register. */
 #define BIGMAC_RXCFG_ENABLE   0x00000001 /* Enable the receiver             */
 #define BIGMAC_RXCFG_PSTRIP   0x00000020 /* Pad byte strip enable           */
-#define BIGMAC_RXCFG_PMISC    0x00000040 /* Enable promiscous mode          */
+#define BIGMAC_RXCFG_PMISC    0x00000040 /* Enable promiscuous mode         */
 #define BIGMAC_RXCFG_DERR     0x00000080 /* Disable error checking          */
 #define BIGMAC_RXCFG_DCRCS    0x00000100 /* Disable CRC stripping           */
 #define BIGMAC_RXCFG_REJME    0x00000200 /* Reject packets addressed to me  */
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c
index d887c05..0fbf96d 100644
--- a/drivers/net/tc35815.c
+++ b/drivers/net/tc35815.c
@@ -136,7 +136,7 @@ struct tc35815_regs {
 #define DMA_RxAlign_2          0x00800000
 #define DMA_RxAlign_3          0x00c00000
 #define DMA_M66EnStat          0x00080000 /* 1:66MHz Enable State            */
-#define DMA_IntMask            0x00040000 /* 1:Interupt mask                 */
+#define DMA_IntMask            0x00040000 /* 1:Interrupt mask                 */
 #define DMA_SWIntReq           0x00020000 /* 1:Software Interrupt request    */
 #define DMA_TxWakeUp           0x00010000 /* 1:Transmit Wake Up              */
 #define DMA_RxBigE             0x00008000 /* 1:Receive Big Endian            */
@@ -281,7 +281,7 @@ struct tc35815_regs {
 #define Int_IntMacTx           0x00000001 /* 1:Tx controller & Clear         */
 
 /* MD_CA bit asign --------------------------------------------------------- */
-#define MD_CA_PreSup           0x00001000 /* 1:Preamble Supress              */
+#define MD_CA_PreSup           0x00001000 /* 1:Preamble Suppress             */
 #define MD_CA_Busy             0x00000800 /* 1:Busy (Start Operation)        */
 #define MD_CA_Wr               0x00000400 /* 1:Write 0:Read                  */
 
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c
index 21230c9..3ed1973 100644
--- a/drivers/net/tehuti.c
+++ b/drivers/net/tehuti.c
@@ -276,7 +276,7 @@ static irqreturn_t bdx_isr_napi(int irq, void *dev)
 			 * currently intrs are disabled (since we read ISR),
 			 * and we have failed to register next poll.
 			 * so we read the regs to trigger chip
-			 * and allow further interupts. */
+			 * and allow further interrupts. */
 			READ_REG(priv, regTXF_WPTR_0);
 			READ_REG(priv, regRXD_WPTR_0);
 		}
diff --git a/drivers/net/tehuti.h b/drivers/net/tehuti.h
index efd170f..992efa6 100644
--- a/drivers/net/tehuti.h
+++ b/drivers/net/tehuti.h
@@ -510,7 +510,7 @@ struct txd_desc {
 #define  GMAC_RX_FILTER_ACRC  0x0010	/* accept crc error */
 #define  GMAC_RX_FILTER_AM    0x0008	/* accept multicast */
 #define  GMAC_RX_FILTER_AB    0x0004	/* accept broadcast */
-#define  GMAC_RX_FILTER_PRM   0x0001	/* [0:1] promiscous mode */
+#define  GMAC_RX_FILTER_PRM   0x0001	/* [0:1] promiscuous mode */
 
 #define  MAX_FRAME_AB_VAL       0x3fff	/* 13:0 */
 
diff --git a/drivers/net/tokenring/3c359.c b/drivers/net/tokenring/3c359.c
index 5d31519..9d7a0c9 100644
--- a/drivers/net/tokenring/3c359.c
+++ b/drivers/net/tokenring/3c359.c
@@ -75,7 +75,7 @@ static char version[] __devinitdata  =
 MODULE_AUTHOR("Mike Phillips <mikep-m5R9+5/bmyvR7s880joybQ@public.gmane.org>") ; 
 MODULE_DESCRIPTION("3Com 3C359 Velocity XL Token Ring Adapter Driver \n") ;
 
-/* Module paramters */
+/* Module parameters */
 
 /* Ring Speed 0,4,16 
  * 0 = Autosense   
diff --git a/drivers/net/tokenring/lanstreamer.c b/drivers/net/tokenring/lanstreamer.c
index 47d84cd..21c4f3c 100644
--- a/drivers/net/tokenring/lanstreamer.c
+++ b/drivers/net/tokenring/lanstreamer.c
@@ -170,7 +170,7 @@ static char *open_min_error[] = {
 	"Monitor Contention failer for RPL", "FDX Protocol Error"
 };
 
-/* Module paramters */
+/* Module parameters */
 
 /* Ring Speed 0,4,16
  * 0 = Autosense         
diff --git a/drivers/net/tokenring/olympic.c b/drivers/net/tokenring/olympic.c
index 74c1f0f..b1178f1 100644
--- a/drivers/net/tokenring/olympic.c
+++ b/drivers/net/tokenring/olympic.c
@@ -132,7 +132,7 @@ static char *open_min_error[] = {"No error", "Function Failure", "Signal Lost",
 				   "Reserved", "Reserved", "No Monitor Detected for RPL", 
 				   "Monitor Contention failer for RPL", "FDX Protocol Error"};
 
-/* Module paramters */
+/* Module parameters */
 
 MODULE_AUTHOR("Mike Phillips <mikep-m5R9+5/bmyvR7s880joybQ@public.gmane.org>") ; 
 MODULE_DESCRIPTION("Olympic PCI/Cardbus Chipset Driver") ; 
diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c
index 93da3a3..4238a61 100644
--- a/drivers/net/tokenring/smctr.c
+++ b/drivers/net/tokenring/smctr.c
@@ -2426,7 +2426,7 @@ static irqreturn_t smctr_interrupt(int irq, void *dev_id)
                                 break ;
 
                         /* Type 0x0E - TRC Initialization Sequence Interrupt
-                         * Subtype -- 00-FF Initializatin sequence complete
+                         * Subtype -- 00-FF Initialization sequence complete
                          */
                         case ISB_IMC_TRC_INTRNL_TST_STATUS:
                                 tp->status = INITIALIZED;
@@ -3055,8 +3055,8 @@ static int smctr_load_node_addr(struct net_device *dev)
  * disabled.!?
  *
  * NOTE 2: If the monitor_state is MS_BEACON_TEST_STATE and the receive_mask
- * has any multi-cast or promiscous bits set, the receive_mask needs to
- * be changed to clear the multi-cast or promiscous mode bits, the lobe_test
+ * has any multi-cast or promiscuous bits set, the receive_mask needs to
+ * be changed to clear the multi-cast or promiscuous mode bits, the lobe_test
  * run, and then the receive mask set back to its original value if the test
  * is successful.
  */
diff --git a/drivers/net/tokenring/tms380tr.c b/drivers/net/tokenring/tms380tr.c
index d5fa36d..b15435d 100644
--- a/drivers/net/tokenring/tms380tr.c
+++ b/drivers/net/tokenring/tms380tr.c
@@ -48,7 +48,7 @@
  *	25-Sep-99	AF	Uped TPL_NUM from 3 to 9
  *				Removed extraneous 'No free TPL'
  *	22-Dec-99	AF	Added Madge PCI Mk2 support and generalized
- *				parts of the initilization procedure.
+ *				parts of the initialization procedure.
  *	30-Dec-99	AF	Turned tms380tr into a library ala 8390.
  *				Madge support is provided in the abyss module
  *				Generic PCI support is in the tmspci module.
diff --git a/drivers/net/tokenring/tms380tr.h b/drivers/net/tokenring/tms380tr.h
index 7daf74e..1cbb8b8 100644
--- a/drivers/net/tokenring/tms380tr.h
+++ b/drivers/net/tokenring/tms380tr.h
@@ -441,7 +441,7 @@ typedef struct {
 #define PASS_FIRST_BUF_ONLY	0x0100	/* Passes only first internal buffer
 					 * of each received frame; FrameSize
 					 * of RPLs must contain internal
-					 * BUFFER_SIZE bits for promiscous mode.
+					 * BUFFER_SIZE bits for promiscuous mode.
 					 */
 #define ENABLE_FULL_DUPLEX_SELECTION	0x2000 
  					/* Enable the use of full-duplex
diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c
index 70befe3..5dad012 100644
--- a/drivers/net/tulip/xircom_cb.c
+++ b/drivers/net/tulip/xircom_cb.c
@@ -646,7 +646,7 @@ static void setup_descriptors(struct xircom_private *card)
 	}
 
 	wmb();
-	/* wite the transmit descriptor ring to the card */
+	/* write the transmit descriptor ring to the card */
 	address = (unsigned long) card->tx_dma_handle;
 	val =cpu_to_le32(address);
 	outl(val, card->io_port + CSR4);	/* xmit descr list address */
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 1f76446..fc9eada 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -142,7 +142,7 @@ add_multi(u32* filter, const u8* addr)
 	filter[bit_nr >> 5] |= 1 << (bit_nr & 31);
 }
 
-/** Remove the specified Ethernet addres from this multicast filter. */
+/** Remove the specified Ethernet address from this multicast filter. */
 static void
 del_multi(u32* filter, const u8* addr)
 {
@@ -399,7 +399,7 @@ static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv,
 		 * - the packet is addressed to us.
 		 * - the packet is broadcast.
 		 * - the packet is multicast and
-		 *   - we are multicast promiscous.
+		 *   - we are multicast promiscuous.
 		 *   - we belong to the multicast group.
 		 */
 		skb_copy_from_linear_data(skb, addr, min_t(size_t, sizeof addr,
diff --git a/drivers/net/ucc_geth_ethtool.c b/drivers/net/ucc_geth_ethtool.c
index 9a9622c..f8d319b 100644
--- a/drivers/net/ucc_geth_ethtool.c
+++ b/drivers/net/ucc_geth_ethtool.c
@@ -7,7 +7,7 @@
  *
  * Limitation: 
  * Can only get/set setttings of the first queue.
- * Need to re-open the interface manually after changing some paramters.
+ * Need to re-open the interface manually after changing some parameters.
  *
  * This program is free software; you can redistribute  it and/or modify it
  * under  the terms of  the GNU General  Public License as published by the
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c
index df884f0..7c0d4a8 100644
--- a/drivers/net/ucc_geth_mii.c
+++ b/drivers/net/ucc_geth_mii.c
@@ -63,11 +63,11 @@ int uec_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value)
 {
 	struct ucc_mii_mng __iomem *regs = (void __iomem *)bus->priv;
 
-	/* Setting up the MII Mangement Address Register */
+	/* Setting up the MII Management Address Register */
 	out_be32(&regs->miimadd,
 		 (mii_id << MIIMADD_PHY_ADDRESS_SHIFT) | regnum);
 
-	/* Setting up the MII Mangement Control Register with the value */
+	/* Setting up the MII Management Control Register with the value */
 	out_be32(&regs->miimcon, value);
 
 	/* Wait till MII management write is complete */
@@ -85,7 +85,7 @@ int uec_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
 	struct ucc_mii_mng __iomem *regs = (void __iomem *)bus->priv;
 	u16 value;
 
-	/* Setting up the MII Mangement Address Register */
+	/* Setting up the MII Management Address Register */
 	out_be32(&regs->miimadd,
 		 (mii_id << MIIMADD_PHY_ADDRESS_SHIFT) | regnum);
 
diff --git a/drivers/net/wan/cycx_drv.c b/drivers/net/wan/cycx_drv.c
index d347d59..d14e667 100644
--- a/drivers/net/wan/cycx_drv.c
+++ b/drivers/net/wan/cycx_drv.c
@@ -322,7 +322,7 @@ static int cycx_data_boot(void __iomem *addr, u8 *code, u32 len)
 	void __iomem *pt_boot_cmd = addr + CMD_OFFSET;
 	u32 i;
 
-	/* boot buffer lenght */
+	/* boot buffer length */
 	writew(CFM_LOAD_BUFSZ, pt_boot_cmd + sizeof(u16));
 	writew(GEN_DEFPAR, pt_boot_cmd);
 
@@ -353,7 +353,7 @@ static int cycx_code_boot(void __iomem *addr, u8 *code, u32 len)
 	void __iomem *pt_boot_cmd = addr + CMD_OFFSET;
 	u32 i;
 
-	/* boot buffer lenght */
+	/* boot buffer length */
 	writew(CFM_LOAD_BUFSZ, pt_boot_cmd + sizeof(u16));
 	writew(GEN_DEFPAR, pt_boot_cmd);
 
diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c
index 2e8b5c2..74f87df 100644
--- a/drivers/net/wan/sbni.c
+++ b/drivers/net/wan/sbni.c
@@ -1472,7 +1472,7 @@ sbni_get_stats( struct net_device  *dev )
 static void
 set_multicast_list( struct net_device  *dev )
 {
-	return;		/* sbni always operate in promiscuos mode */
+	return;		/* sbni always operate in promiscuous mode */
 }
 
 
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index 059ce3f..60dfdd9 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -3278,7 +3278,7 @@ static void atmel_smooth_qual(struct atmel_private *priv)
 	priv->wstats.qual.updated &= ~IW_QUAL_QUAL_INVALID;
 }
 
-/* deals with incoming managment frames. */
+/* deals with incoming management frames. */
 static void atmel_management_frame(struct atmel_private *priv,
 				   struct ieee80211_hdr_4addr *header,
 				   u16 frame_len, u8 rssi)
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h
index a40d1af..edf7d8f 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h
@@ -28,7 +28,7 @@ struct bcm43xx_dfsentry {
 	struct bcm43xx_xmitstatus *xmitstatus_buffer;
 	int xmitstatus_ptr;
 	int xmitstatus_cnt;
-	/* We need a seperate buffer while printing to avoid
+	/* We need a separate buffer while printing to avoid
 	 * concurrency issues. (New xmitstatus can arrive
 	 * while we are printing).
 	 */
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 54f44e5..e24382f 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -1144,7 +1144,7 @@ static void ipw_led_shutdown(struct ipw_priv *priv)
 /*
  * The following adds a new attribute to the sysfs representation
  * of this device driver (i.e. a new file in /sys/bus/pci/drivers/ipw/)
- * used for controling the debug level.
+ * used for controlling the debug level.
  *
  * See the level definitions in ipw for details.
  */
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 891f90d..e242647 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -4051,7 +4051,7 @@ static int iwl4965_tx_status_reply_compressed_ba(struct iwl_priv *priv,
 	agg->wait_for_ba = 0;
 	IWL_DEBUG_TX_REPLY("BA %d %d\n", agg->start_idx, ba_resp->ba_seq_ctl);
 	sh = agg->start_idx - SEQ_TO_INDEX(ba_seq_ctl>>4);
-	if (sh < 0) /* tbw something is wrong with indeces */
+	if (sh < 0) /* tbw something is wrong with indices */
 		sh += 0x100;
 
 	/* don't use 64 bits for now */
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index be5cfd8..31ee4f6 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -1120,7 +1120,7 @@ int libertas_set_mac_packet_filter(wlan_private * priv)
  *  @param cmd_action	command action: GET or SET
  *  @param wait_option	wait option: wait response or not
  *  @param cmd_oid	cmd oid: treated as sub command
- *  @param pdata_buf	A pointer to informaion buffer
+ *  @param pdata_buf	A pointer to information buffer
  *  @return 		0 or -1
  */
 int libertas_prepare_and_send_command(wlan_private * priv,
@@ -1606,7 +1606,7 @@ static void cleanup_cmdnode(struct cmd_ctrl_node *ptempnode)
  *  @param ptempnode	A pointer to cmd_ctrl_node structure
  *  @param cmd_oid	cmd oid: treated as sub command
  *  @param wait_option	wait option: wait response or not
- *  @param pdata_buf	A pointer to informaion buffer
+ *  @param pdata_buf	A pointer to information buffer
  *  @return 		0 or -1
  */
 void libertas_set_cmd_ctrl_node(wlan_private * priv,
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index ad1e67d..537b36c 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -443,7 +443,7 @@ wlan_scan_setup_scan_config(wlan_private * priv,
 	ptlvpos = pscancfgout->tlvbuffer;
 
 	/*
-	 * Set the initial scan paramters for progressive scanning.  If a specific
+	 * Set the initial scan parameters for progressive scanning.  If a specific
 	 *   BSSID or SSID is used, the number of channels in the scan command
 	 *   will be increased to the absolute maximum
 	 */
@@ -1679,7 +1679,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
  *
  *  Called from libertas_prepare_and_send_command() in cmd.c
  *
- *  Sends a fixed lenght data part (specifying the BSS type and BSSID filters)
+ *  Sends a fixed length data part (specifying the BSS type and BSSID filters)
  *  as well as a variable number/length of TLVs to the firmware.
  *
  *  @param priv       A pointer to wlan_private structure
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c
index d2fa079..c4b649e 100644
--- a/drivers/net/wireless/netwave_cs.c
+++ b/drivers/net/wireless/netwave_cs.c
@@ -1408,7 +1408,7 @@ static void set_multicast_list(struct net_device *dev)
 	/* Multicast Mode */
 	rcvMode = rxConfRxEna + rxConfAMP + rxConfBcast;
     } else if (dev->flags & IFF_PROMISC) {
-	/* Promiscous mode */
+	/* Promiscuous mode */
 	rcvMode = rxConfRxEna + rxConfPro + rxConfAMP + rxConfBcast;
     } else {
 	/* Normal mode */
diff --git a/drivers/net/wireless/orinoco.h b/drivers/net/wireless/orinoco.h
index 4720fb2..703a4cf 100644
--- a/drivers/net/wireless/orinoco.h
+++ b/drivers/net/wireless/orinoco.h
@@ -108,7 +108,7 @@ struct orinoco_private {
 	int	scan_inprogress;	/* Scan pending... */
 	u32	scan_mode;		/* Type of scan done */
 	char *	scan_result;		/* Result of previous scan */
-	int	scan_len;		/* Lenght of result */
+	int	scan_len;		/* Length of result */
 };
 
 #ifdef ORINOCO_DEBUG
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index f87fe10..24f9066 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -129,7 +129,7 @@ static void ray_reset(struct net_device *dev);
 static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, int len);
 static void verify_dl_startup(u_long);
 
-/* Prototypes for interrpt time functions **********************************/
+/* Prototypes for interrupt time functions **********************************/
 static irqreturn_t ray_interrupt (int reg, void *dev_id);
 static void clear_interrupt(ray_dev_t *local);
 static void rx_deauthenticate(ray_dev_t *local, struct rcs __iomem *prcs, 
diff --git a/drivers/net/wireless/rt2x00/rt2x00reg.h b/drivers/net/wireless/rt2x00/rt2x00reg.h
index 8384212..fe9011d 100644
--- a/drivers/net/wireless/rt2x00/rt2x00reg.h
+++ b/drivers/net/wireless/rt2x00/rt2x00reg.h
@@ -230,7 +230,7 @@ static inline u8 rt2x00_get_field8(const u8 reg,
  *	corresponds with the TX register format for the current device.
  *	4 - plcp, 802.11b rates are device specific,
  *	802.11g rates are set according to the ieee802.11a-1999 p.14.
- * The bit to enable preamble is set in a seperate define.
+ * The bit to enable preamble is set in a separate define.
  */
 #define DEV_RATE	FIELD32(0x000007ff)
 #define DEV_PREAMBLE	FIELD32(0x00000800)
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.h b/drivers/net/wireless/rt2x00/rt2x00usb.h
index 2681abe..b76881f 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.h
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.h
@@ -135,13 +135,13 @@ static inline int rt2x00usb_vendor_request_sw(const struct rt2x00_dev
  * kmalloc for correct handling inside the kernel USB layer.
  */
 static inline int rt2x00usb_eeprom_read(const struct rt2x00_dev *rt2x00dev,
-					 __le16 *eeprom, const u16 lenght)
+					 __le16 *eeprom, const u16 length)
 {
-	int timeout = REGISTER_TIMEOUT * (lenght / sizeof(u16));
+	int timeout = REGISTER_TIMEOUT * (length / sizeof(u16));
 
 	return rt2x00usb_vendor_request(rt2x00dev, USB_EEPROM_READ,
 					USB_VENDOR_REQUEST_IN, 0x0000,
-					0x0000, eeprom, lenght, timeout);
+					0x0000, eeprom, length, timeout);
 }
 
 /*
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index c0671c2..d1468a1 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -833,7 +833,7 @@ static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev, void *data,
 
 	/*
 	 * Write firmware to device.
-	 * We setup a seperate cache for this action,
+	 * We setup a separate cache for this action,
 	 * since we are going to write larger chunks of data
 	 * then normally used cache size.
 	 */
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c
index 577c647..5d28105 100644
--- a/drivers/net/wireless/wavelan_cs.c
+++ b/drivers/net/wireless/wavelan_cs.c
@@ -159,7 +159,7 @@ psa_read(struct net_device *	dev,
 
 /*------------------------------------------------------------------*/
 /*
- * Write the Paramter Storage Area to the WaveLAN card's memory
+ * Write the Parameter Storage Area to the WaveLAN card's memory
  */
 static void
 psa_write(struct net_device *	dev,
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.h b/drivers/net/wireless/zd1211rw/zd_chip.h
index 8009b70..301315a 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.h
+++ b/drivers/net/wireless/zd1211rw/zd_chip.h
@@ -620,8 +620,8 @@ enum {
 #define E2P_PWR_INT_GUARD		8
 #define E2P_CHANNEL_COUNT		14
 
-/* If you compare this addresses with the ZYDAS orignal driver, please notify
- * that we use word mapping for the EEPROM.
+/* If you compare these addresses with the ZYDAS original driver,
+ * please notice that we use word mapping for the EEPROM.
  */
 
 /*
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
index 87f002a..cb6e978 100644
--- a/drivers/net/yellowfin.c
+++ b/drivers/net/yellowfin.c
@@ -533,7 +533,7 @@ static int __devinit read_eeprom(void __iomem *ioaddr, int location)
 	return ioread8(ioaddr + EERead);
 }
 
-/* MII Managemen Data I/O accesses.
+/* MII Management Data I/O accesses.
    These routines assume the MDIO controller is idle, and do not exit until
    the command is finished. */
 
-- 
1.5.3.7.949.g2221a6


-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

^ permalink raw reply related

* [PATCH] drivers/net/: Spelling fixes
From: Joe Perches @ 2007-12-17 19:40 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: Pavel Roskin, Eugene Surovegin, Geoff Levand, David Gibson,
	orinoco-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Yi Zhu,
	Jaroslav Kysela, linuxppc-dev-mnsaURCQ41sdnm+yROfE0A,
	netdev-u79uwXL29TY76Z2rM5mHXA, Paul Mackerras, Peter De Shrijver,
	Rastapur Santosh, bonding-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	Andy Gospodarek, Amit S. Kale,
	ipw2100-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	ipw3945-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Masakazu Mokuno,
	libertas-dev-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Dan Williams,
	Dale Farnsworth, Jay Vosburgh, Jesse Brandeburg,
	Manish Lachwani <m


Signed-off-by: Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
---
 drivers/net/82596.c                            |    2 +-
 drivers/net/amd8111e.c                         |    8 ++++----
 drivers/net/amd8111e.h                         |    2 +-
 drivers/net/appletalk/ltpc.c                   |    2 +-
 drivers/net/atl1/atl1_hw.c                     |    2 +-
 drivers/net/atl1/atl1_main.c                   |    2 +-
 drivers/net/bonding/bond_3ad.c                 |    4 ++--
 drivers/net/chelsio/sge.c                      |    2 +-
 drivers/net/chelsio/subr.c                     |    2 +-
 drivers/net/cxgb3/t3_hw.c                      |    2 +-
 drivers/net/e1000/e1000_hw.c                   |    4 ++--
 drivers/net/e1000/e1000_hw.h                   |    2 +-
 drivers/net/e1000/e1000_main.c                 |    2 +-
 drivers/net/e1000e/netdev.c                    |    2 +-
 drivers/net/eepro.c                            |    2 +-
 drivers/net/ehea/ehea.h                        |    2 +-
 drivers/net/forcedeth.c                        |    2 +-
 drivers/net/hamachi.c                          |    4 ++--
 drivers/net/hp100.c                            |    2 +-
 drivers/net/hp100.h                            |    4 ++--
 drivers/net/ibm_emac/ibm_emac.h                |    2 +-
 drivers/net/ibm_newemac/emac.h                 |    2 +-
 drivers/net/ibmlana.c                          |    2 +-
 drivers/net/ibmlana.h                          |    2 +-
 drivers/net/ipg.c                              |    4 ++--
 drivers/net/irda/ali-ircc.c                    |    6 +++---
 drivers/net/irda/ali-ircc.h                    |    4 ++--
 drivers/net/irda/donauboe.h                    |    2 +-
 drivers/net/irda/irport.c                      |    4 ++--
 drivers/net/irda/nsc-ircc.h                    |    4 ++--
 drivers/net/irda/smsc-ircc2.c                  |    4 ++--
 drivers/net/irda/via-ircc.h                    |    4 ++--
 drivers/net/ixgbe/ixgbe_common.c               |    4 ++--
 drivers/net/ixgbe/ixgbe_main.c                 |    2 +-
 drivers/net/lasi_82596.c                       |    2 +-
 drivers/net/lib82596.c                         |    2 +-
 drivers/net/macb.c                             |    2 +-
 drivers/net/meth.h                             |    2 +-
 drivers/net/mv643xx_eth.c                      |    4 ++--
 drivers/net/netxen/netxen_nic_hw.h             |    2 +-
 drivers/net/ppp_generic.c                      |    2 +-
 drivers/net/ps3_gelic_net.c                    |    2 +-
 drivers/net/qla3xxx.c                          |    2 +-
 drivers/net/s2io.h                             |    2 +-
 drivers/net/sis190.c                           |    2 +-
 drivers/net/sk98lin/skgepnmi.c                 |    2 +-
 drivers/net/sk98lin/skxmac2.c                  |    4 ++--
 drivers/net/skfp/ess.c                         |    2 +-
 drivers/net/skfp/fplustm.c                     |    6 +++---
 drivers/net/skfp/h/fplustm.h                   |    4 ++--
 drivers/net/skfp/h/smt.h                       |    2 +-
 drivers/net/skfp/h/supern_2.h                  |    2 +-
 drivers/net/smc911x.c                          |    2 +-
 drivers/net/spider_net.c                       |    2 +-
 drivers/net/sunbmac.h                          |    2 +-
 drivers/net/sungem.c                           |    2 +-
 drivers/net/sunhme.h                           |    2 +-
 drivers/net/tc35815.c                          |    4 ++--
 drivers/net/tehuti.c                           |    2 +-
 drivers/net/tehuti.h                           |    2 +-
 drivers/net/tokenring/3c359.c                  |    2 +-
 drivers/net/tokenring/lanstreamer.c            |    2 +-
 drivers/net/tokenring/olympic.c                |    2 +-
 drivers/net/tokenring/smctr.c                  |    6 +++---
 drivers/net/tokenring/tms380tr.c               |    2 +-
 drivers/net/tokenring/tms380tr.h               |    2 +-
 drivers/net/tulip/xircom_cb.c                  |    2 +-
 drivers/net/tun.c                              |    4 ++--
 drivers/net/ucc_geth_ethtool.c                 |    2 +-
 drivers/net/ucc_geth_mii.c                     |    6 +++---
 drivers/net/wan/cycx_drv.c                     |    4 ++--
 drivers/net/wan/sbni.c                         |    2 +-
 drivers/net/wireless/atmel.c                   |    2 +-
 drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h |    2 +-
 drivers/net/wireless/ipw2200.c                 |    2 +-
 drivers/net/wireless/iwlwifi/iwl-4965.c        |    2 +-
 drivers/net/wireless/libertas/cmd.c            |    4 ++--
 drivers/net/wireless/libertas/scan.c           |    4 ++--
 drivers/net/wireless/netwave_cs.c              |    2 +-
 drivers/net/wireless/orinoco.h                 |    2 +-
 drivers/net/wireless/ray_cs.c                  |    2 +-
 drivers/net/wireless/rt2x00/rt2x00reg.h        |    2 +-
 drivers/net/wireless/rt2x00/rt2x00usb.h        |    6 +++---
 drivers/net/wireless/rt2x00/rt73usb.c          |    2 +-
 drivers/net/wireless/wavelan_cs.c              |    2 +-
 drivers/net/wireless/zd1211rw/zd_chip.h        |    4 ++--
 drivers/net/yellowfin.c                        |    2 +-
 87 files changed, 120 insertions(+), 120 deletions(-)

diff --git a/drivers/net/82596.c b/drivers/net/82596.c
index 2797da7..d999b63 100644
--- a/drivers/net/82596.c
+++ b/drivers/net/82596.c
@@ -19,7 +19,7 @@
    TBD:
    * look at deferring rx frames rather than discarding (as per tulip)
    * handle tx ring full as per tulip
-   * performace test to tune rx_copybreak
+   * performance test to tune rx_copybreak
 
    Most of my modifications relate to the braindead big-endian
    implementation by Intel.  When the i596 is operating in
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c
index e7fdd81..5cefe92 100644
--- a/drivers/net/amd8111e.c
+++ b/drivers/net/amd8111e.c
@@ -1283,7 +1283,7 @@ static irqreturn_t amd8111e_interrupt(int irq, void *dev_id)
 #ifdef CONFIG_AMD8111E_NAPI
 	if(intr0 & RINT0){
 		if(netif_rx_schedule_prep(dev, &lp->napi)){
-			/* Disable receive interupts */
+			/* Disable receive interrupts */
 			writel(RINTEN0, mmio + INTEN0);
 			/* Schedule a polling routine */
 			__netif_rx_schedule(dev, &lp->napi);
@@ -1493,7 +1493,7 @@ static void amd8111e_read_regs(struct amd8111e_priv *lp, u32 *buf)
 
 
 /*
-This function sets promiscuos mode, all-multi mode or the multicast address
+This function sets promiscuous mode, all-multi mode or the multicast address
 list to the device.
 */
 static void amd8111e_set_multicast_list(struct net_device *dev)
@@ -1522,7 +1522,7 @@ static void amd8111e_set_multicast_list(struct net_device *dev)
 		lp->mc_list = NULL;
 		lp->options &= ~OPTION_MULTICAST_ENABLE;
 		amd8111e_writeq(*(u64*)mc_filter,lp->mmio + LADRF);
-		/* disable promiscous mode */
+		/* disable promiscuous mode */
 		writel(PROM, lp->mmio + CMD2);
 		return;
 	}
@@ -2016,7 +2016,7 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev,
 	for(i = 0; i < ETH_ADDR_LEN; i++)
 		dev->dev_addr[i] = readb(lp->mmio + PADR + i);
 
-	/* Setting user defined parametrs */
+	/* Setting user defined parameters */
 	lp->ext_phy_option = speed_duplex[card_idx];
 	if(coalesce[card_idx])
 		lp->options |= OPTION_INTR_COAL_ENABLE;
diff --git a/drivers/net/amd8111e.h b/drivers/net/amd8111e.h
index 28c60a7..7d288de 100644
--- a/drivers/net/amd8111e.h
+++ b/drivers/net/amd8111e.h
@@ -614,7 +614,7 @@ typedef enum {
 #define CSTATE  1
 #define SSTATE  2
 
-/* Assume contoller gets data 10 times the maximum processing time */
+/* Assume controller gets data 10 times the maximum processing time */
 #define  REPEAT_CNT			10
 
 /* amd8111e decriptor flag definitions */
diff --git a/drivers/net/appletalk/ltpc.c b/drivers/net/appletalk/ltpc.c
index 6ab2c2d..86a9496 100644
--- a/drivers/net/appletalk/ltpc.c
+++ b/drivers/net/appletalk/ltpc.c
@@ -1233,7 +1233,7 @@ static int __init ltpc_setup(char *str)
 		if (ints[0] > 2) {
 			dma = ints[3];
 		}
-		/* ignore any other paramters */
+		/* ignore any other parameters */
 	}
 	return 1;
 }
diff --git a/drivers/net/atl1/atl1_hw.c b/drivers/net/atl1/atl1_hw.c
index 9d3bd22..82359f7 100644
--- a/drivers/net/atl1/atl1_hw.c
+++ b/drivers/net/atl1/atl1_hw.c
@@ -645,7 +645,7 @@ s32 atl1_init_hw(struct atl1_hw *hw)
 	atl1_init_flash_opcode(hw);
 
 	if (!hw->phy_configured) {
-		/* enable GPHY LinkChange Interrrupt */
+		/* enable GPHY LinkChange Interrupt */
 		ret_val = atl1_write_phy_reg(hw, 18, 0xC00);
 		if (ret_val)
 			return ret_val;
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 35b0a7d..7599163 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -575,7 +575,7 @@ static u32 atl1_check_link(struct atl1_adapter *adapter)
 		return ATL1_SUCCESS;
 	}
 
-	/* change orignal link status */
+	/* change original link status */
 	if (netif_carrier_ok(netdev)) {
 		adapter->link_speed = SPEED_0;
 		netif_carrier_off(netdev);
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index cb3c6fa..96f0f24 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -869,7 +869,7 @@ static int ad_lacpdu_send(struct port *port)
 	lacpdu_header = (struct lacpdu_header *)skb_put(skb, length);
 
 	lacpdu_header->ad_header.destination_address = lacpdu_multicast_address;
-	/* Note: source addres is set to be the member's PERMANENT address, because we use it
+	/* Note: source address is set to be the member's PERMANENT address, because we use it
 	   to identify loopback lacpdus in receive. */
 	lacpdu_header->ad_header.source_address = *((struct mac_addr *)(slave->perm_hwaddr));
 	lacpdu_header->ad_header.length_type = PKT_TYPE_LACPDU;
@@ -912,7 +912,7 @@ static int ad_marker_send(struct port *port, struct bond_marker *marker)
 	marker_header = (struct bond_marker_header *)skb_put(skb, length);
 
 	marker_header->ad_header.destination_address = lacpdu_multicast_address;
-	/* Note: source addres is set to be the member's PERMANENT address, because we use it
+	/* Note: source address is set to be the member's PERMANENT address, because we use it
 	   to identify loopback MARKERs in receive. */
 	marker_header->ad_header.source_address = *((struct mac_addr *)(slave->perm_hwaddr));
 	marker_header->ad_header.length_type = PKT_TYPE_LACPDU;
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c
index b301c04..ed17cd9 100644
--- a/drivers/net/chelsio/sge.c
+++ b/drivers/net/chelsio/sge.c
@@ -248,7 +248,7 @@ static void restart_sched(unsigned long);
  *
  * Interrupts are handled by a single CPU and it is likely that on a MP system
  * the application is migrated to another CPU. In that scenario, we try to
- * seperate the RX(in irq context) and TX state in order to decrease memory
+ * separate the RX(in irq context) and TX state in order to decrease memory
  * contention.
  */
 struct sge {
diff --git a/drivers/net/chelsio/subr.c b/drivers/net/chelsio/subr.c
index dc50151..7c95578 100644
--- a/drivers/net/chelsio/subr.c
+++ b/drivers/net/chelsio/subr.c
@@ -559,7 +559,7 @@ struct chelsio_vpd_t {
 #define EEPROM_MAX_POLL   4
 
 /*
- * Read SEEPROM. A zero is written to the flag register when the addres is
+ * Read SEEPROM. A zero is written to the flag register when the address is
  * written to the Control register. The hardware device will set the flag to a
  * one when 4B have been transferred to the Data register.
  */
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 522834c..2882e36 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -534,7 +534,7 @@ struct t3_vpd {
  *
  *	Read a 32-bit word from a location in VPD EEPROM using the card's PCI
  *	VPD ROM capability.  A zero is written to the flag bit when the
- *	addres is written to the control register.  The hardware device will
+ *	address is written to the control register.  The hardware device will
  *	set the flag to 1 when 4 bytes have been read into the data register.
  */
 int t3_seeprom_read(struct adapter *adapter, u32 addr, u32 *data)
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 7c6888c..fd7e6a8 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -803,7 +803,7 @@ e1000_initialize_hardware_bits(struct e1000_hw *hw)
                 E1000_WRITE_REG(hw, CTRL, reg_ctrl);
                 break;
             case e1000_80003es2lan:
-                /* improve small packet performace for fiber/serdes */
+                /* improve small packet performance for fiber/serdes */
                 if ((hw->media_type == e1000_media_type_fiber) ||
                     (hw->media_type == e1000_media_type_internal_serdes)) {
                     reg_tarc0 &= ~(1 << 20);
@@ -5001,7 +5001,7 @@ e1000_read_eeprom(struct e1000_hw *hw,
             return -E1000_ERR_EEPROM;
     }
 
-    /* Eerd register EEPROM access requires no eeprom aquire/release */
+    /* Eerd register EEPROM access requires no eeprom acquire/release */
     if (eeprom->use_eerd == TRUE)
         return e1000_read_eeprom_eerd(hw, offset, words, data);
 
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h
index a2a86c5..e40e515 100644
--- a/drivers/net/e1000/e1000_hw.h
+++ b/drivers/net/e1000/e1000_hw.h
@@ -1068,7 +1068,7 @@ struct e1000_ffvt_entry {
 
 #define E1000_KUMCTRLSTA 0x00034 /* MAC-PHY interface - RW */
 #define E1000_MDPHYA     0x0003C  /* PHY address - RW */
-#define E1000_MANC2H     0x05860  /* Managment Control To Host - RW */
+#define E1000_MANC2H     0x05860  /* Management Control To Host - RW */
 #define E1000_SW_FW_SYNC 0x05B5C /* Software-Firmware Synchronization - RW */
 
 #define E1000_GCR       0x05B00 /* PCI-Ex Control */
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 4f37506..24a2fc1 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -235,7 +235,7 @@ static struct pci_driver e1000_driver = {
 	.probe    = e1000_probe,
 	.remove   = __devexit_p(e1000_remove),
 #ifdef CONFIG_PM
-	/* Power Managment Hooks */
+	/* Power Management Hooks */
 	.suspend  = e1000_suspend,
 	.resume   = e1000_resume,
 #endif
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 4fd2e23..febe157 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -4109,7 +4109,7 @@ static struct pci_driver e1000_driver = {
 	.probe    = e1000_probe,
 	.remove   = __devexit_p(e1000_remove),
 #ifdef CONFIG_PM
-	/* Power Managment Hooks */
+	/* Power Management Hooks */
 	.suspend  = e1000_suspend,
 	.resume   = e1000_resume,
 #endif
diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c
index 83bda6c..d3789c5 100644
--- a/drivers/net/eepro.c
+++ b/drivers/net/eepro.c
@@ -1764,7 +1764,7 @@ module_param_array(io, int, NULL, 0);
 module_param_array(irq, int, NULL, 0);
 module_param_array(mem, int, NULL, 0);
 module_param(autodetect, int, 0);
-MODULE_PARM_DESC(io, "EtherExpress Pro/10 I/O base addres(es)");
+MODULE_PARM_DESC(io, "EtherExpress Pro/10 I/O base address(es)");
 MODULE_PARM_DESC(irq, "EtherExpress Pro/10 IRQ number(s)");
 MODULE_PARM_DESC(mem, "EtherExpress Pro/10 Rx buffer size(es) in kB (3-29)");
 MODULE_PARM_DESC(autodetect, "EtherExpress Pro/10 force board(s) detection (0-1)");
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index 5f82a46..a50b238 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -251,7 +251,7 @@ struct ehea_qp_init_attr {
 };
 
 /*
- * Event Queue attributes, passed as paramter
+ * Event Queue attributes, passed as parameter
  */
 struct ehea_eq_attr {
 	u32 type;
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index a96583c..7119332 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -490,7 +490,7 @@ union ring_type {
 #define NV_RX3_VLAN_TAG_PRESENT (1<<16)
 #define NV_RX3_VLAN_TAG_MASK	(0x0000FFFF)
 
-/* Miscelaneous hardware related defines: */
+/* Miscellaneous hardware related defines: */
 #define NV_PCI_REGSZ_VER1      	0x270
 #define NV_PCI_REGSZ_VER2      	0x2d4
 #define NV_PCI_REGSZ_VER3      	0x604
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c
index ed407c8..683b289 100644
--- a/drivers/net/hamachi.c
+++ b/drivers/net/hamachi.c
@@ -86,7 +86,7 @@ static int force32;
 static int options[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
 static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
 /* The Hamachi chipset supports 3 parameters each for Rx and Tx
- * interruput management.  Parameters will be loaded as specified into
+ * interrupt management.  Parameters will be loaded as specified into
  * the TxIntControl and RxIntControl registers.
  *
  * The registers are arranged as follows:
@@ -811,7 +811,7 @@ static int __devinit read_eeprom(void __iomem *ioaddr, int location)
 	return readb(ioaddr + EEData);
 }
 
-/* MII Managemen Data I/O accesses.
+/* MII Management Data I/O accesses.
    These routines assume the MDIO controller is idle, and do not exit until
    the command is finished. */
 
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c
index 49421d1..8b90d64 100644
--- a/drivers/net/hp100.c
+++ b/drivers/net/hp100.c
@@ -2643,7 +2643,7 @@ static int hp100_login_to_vg_hub(struct net_device *dev, u_short force_relogin)
 		} else {
 			hp100_andb(~HP100_PROM_MODE, VG_LAN_CFG_2);
 			/* For ETR parts we need to reset the prom. bit in the training
-			 * register, otherwise promiscious mode won't be disabled.
+			 * register, otherwise promiscuous mode won't be disabled.
 			 */
 			if (lp->chip == HP100_CHIPID_LASSEN) {
 				hp100_andw(~HP100_MACRQ_PROMSC, TRAIN_REQUEST);
diff --git a/drivers/net/hp100.h b/drivers/net/hp100.h
index e6ca128..e74e45d 100644
--- a/drivers/net/hp100.h
+++ b/drivers/net/hp100.h
@@ -476,7 +476,7 @@
 #define HP100_MACRQ_REPEATER         0x0001	/* 1: MAC tells HUB it wants to be
 						 *    a cascaded repeater
 						 * 0: ... wants to be a DTE */
-#define HP100_MACRQ_PROMSC           0x0006	/* 2 bits: Promiscious mode
+#define HP100_MACRQ_PROMSC           0x0006	/* 2 bits: Promiscuous mode
 						 * 00: Rcv only unicast packets
 						 *     specifically addr to this
 						 *     endnode
@@ -488,7 +488,7 @@
 #define HP100_CARD_MACVER            0xe000	/* R: 3 bit Cards 100VG MAC version */
 #define HP100_MALLOW_REPEATER        0x0001	/* If reset, requested access as an
 						 * end node is allowed */
-#define HP100_MALLOW_PROMSC          0x0004	/* 2 bits: Promiscious mode
+#define HP100_MALLOW_PROMSC          0x0004	/* 2 bits: Promiscuous mode
 						 * 00: Rcv only unicast packets
 						 *     specifically addr to this
 						 *     endnode
diff --git a/drivers/net/ibm_emac/ibm_emac.h b/drivers/net/ibm_emac/ibm_emac.h
index 97ed22b..655be50 100644
--- a/drivers/net/ibm_emac/ibm_emac.h
+++ b/drivers/net/ibm_emac/ibm_emac.h
@@ -1,7 +1,7 @@
 /*
  * drivers/net/ibm_emac/ibm_emac.h
  *
- * Register definitions for PowerPC 4xx on-chip ethernet contoller
+ * Register definitions for PowerPC 4xx on-chip ethernet controller
  *
  * Copyright (c) 2004, 2005 Zultys Technologies.
  * Eugene Surovegin <eugene.surovegin-OMD3UA+2ZXrQT0dZR+AlfA@public.gmane.org> or <ebs-Iydg86zsFCHR7s880joybQ@public.gmane.org>
diff --git a/drivers/net/ibm_newemac/emac.h b/drivers/net/ibm_newemac/emac.h
index 91cb096..49a540a 100644
--- a/drivers/net/ibm_newemac/emac.h
+++ b/drivers/net/ibm_newemac/emac.h
@@ -1,7 +1,7 @@
 /*
  * drivers/net/ibm_newemac/emac.h
  *
- * Register definitions for PowerPC 4xx on-chip ethernet contoller
+ * Register definitions for PowerPC 4xx on-chip ethernet controller
  *
  * Copyright 2007 Benjamin Herrenschmidt, IBM Corp.
  *                <benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
diff --git a/drivers/net/ibmlana.c b/drivers/net/ibmlana.c
index 91d83ac..5a9b6fa 100644
--- a/drivers/net/ibmlana.c
+++ b/drivers/net/ibmlana.c
@@ -481,7 +481,7 @@ static void InitBoard(struct net_device *dev)
 	if ((dev->flags & IFF_ALLMULTI) || (mcptr != NULL))
 		rcrval |= RCREG_AMC;
 
-	/* promiscous mode ? */
+	/* promiscuous mode ? */
 
 	if (dev->flags & IFF_PROMISC)
 		rcrval |= RCREG_PRO;
diff --git a/drivers/net/ibmlana.h b/drivers/net/ibmlana.h
index aa3ddbd..654af95 100644
--- a/drivers/net/ibmlana.h
+++ b/drivers/net/ibmlana.h
@@ -90,7 +90,7 @@ typedef struct {
 #define RCREG_ERR        0x8000	/* accept damaged and collided pkts */
 #define RCREG_RNT        0x4000	/* accept packets that are < 64     */
 #define RCREG_BRD        0x2000	/* accept broadcasts                */
-#define RCREG_PRO        0x1000	/* promiscous mode                  */
+#define RCREG_PRO        0x1000	/* promiscuous mode                 */
 #define RCREG_AMC        0x0800	/* accept all multicasts            */
 #define RCREG_LB_NONE    0x0000	/* no loopback                      */
 #define RCREG_LB_MAC     0x0200	/* MAC loopback                     */
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index dbd23bb..27d12eb 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -209,7 +209,7 @@ static int mdio_read(struct net_device * dev, int phy_id, int phy_reg)
 {
 	void __iomem *ioaddr = ipg_ioaddr(dev);
 	/*
-	 * The GMII mangement frame structure for a read is as follows:
+	 * The GMII management frame structure for a read is as follows:
 	 *
 	 * |Preamble|st|op|phyad|regad|ta|      data      |idle|
 	 * |< 32 1s>|01|10|AAAAA|RRRRR|z0|DDDDDDDDDDDDDDDD|z   |
@@ -300,7 +300,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int phy_reg, int val)
 {
 	void __iomem *ioaddr = ipg_ioaddr(dev);
 	/*
-	 * The GMII mangement frame structure for a read is as follows:
+	 * The GMII management frame structure for a read is as follows:
 	 *
 	 * |Preamble|st|op|phyad|regad|ta|      data      |idle|
 	 * |< 32 1s>|01|10|AAAAA|RRRRR|z0|DDDDDDDDDDDDDDDD|z   |
diff --git a/drivers/net/irda/ali-ircc.c b/drivers/net/irda/ali-ircc.c
index 9f58452..94140f7 100644
--- a/drivers/net/irda/ali-ircc.c
+++ b/drivers/net/irda/ali-ircc.c
@@ -977,7 +977,7 @@ static void ali_ircc_change_speed(struct ali_ircc_cb *self, __u32 baud)
 		/* Install FIR xmit handler*/
 		dev->hard_start_xmit = ali_ircc_fir_hard_xmit;		
 				
-		/* Enable Interuupt */
+		/* Enable Interrupt */
 		self->ier = IER_EOM; // benjamin 2000/11/20 07:24PM					
 				
 		/* Be ready for incomming frames */
@@ -1096,7 +1096,7 @@ static void ali_ircc_sir_change_speed(struct ali_ircc_cb *priv, __u32 speed)
 	outb(lcr,		  iobase+UART_LCR); /* Set 8N1	*/
 	outb(fcr,		  iobase+UART_FCR); /* Enable FIFO's */
 
-	/* without this, the conection will be broken after come back from FIR speed,
+	/* without this, the connection will be broken after come back from FIR speed,
 	   but with this, the SIR connection is harder to established */
 	outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), iobase+UART_MCR);
 	
@@ -1359,7 +1359,7 @@ static int ali_ircc_net_open(struct net_device *dev)
 		return -EAGAIN;
 	}
 	
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	outb(UART_IER_RDI , iobase+UART_IER);
 
 	/* Ready to play! */
diff --git a/drivers/net/irda/ali-ircc.h b/drivers/net/irda/ali-ircc.h
index e489c66..0787657 100644
--- a/drivers/net/irda/ali-ircc.h
+++ b/drivers/net/irda/ali-ircc.h
@@ -173,13 +173,13 @@ struct st_fifo {
 
 struct frame_cb {
 	void *start; /* Start of frame in DMA mem */
-	int len;     /* Lenght of frame in DMA mem */
+	int len;     /* Length of frame in DMA mem */
 };
 
 struct tx_fifo {
 	struct frame_cb queue[MAX_TX_WINDOW]; /* Info about frames in queue */
 	int             ptr;                  /* Currently being sent */
-	int             len;                  /* Lenght of queue */
+	int             len;                  /* Length of queue */
 	int             free;                 /* Next free slot */
 	void           *tail;                 /* Next free start in DMA mem */
 };
diff --git a/drivers/net/irda/donauboe.h b/drivers/net/irda/donauboe.h
index 1e67720..9db3cce 100644
--- a/drivers/net/irda/donauboe.h
+++ b/drivers/net/irda/donauboe.h
@@ -30,7 +30,7 @@
  *     or the type-DO IR port.
  *
  * IrDA chip set list from Toshiba Computer Engineering Corp.
- * model			method	maker	controler		Version 
+ * model			method	maker	controller		Version 
  * Portege 320CT	FIR,SIR Toshiba Oboe(Triangle) 
  * Portege 3010CT	FIR,SIR Toshiba Oboe(Sydney) 
  * Portege 3015CT	FIR,SIR Toshiba Oboe(Sydney) 
diff --git a/drivers/net/irda/irport.c b/drivers/net/irda/irport.c
index c79caa5..2b2a955 100644
--- a/drivers/net/irda/irport.c
+++ b/drivers/net/irda/irport.c
@@ -276,7 +276,7 @@ static void irport_start(struct irport_cb *self)
 	outb(UART_LCR_WLEN8, iobase+UART_LCR);  /* Reset DLAB */
 	outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), iobase+UART_MCR);
 	
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	outb(UART_IER_RLSI | UART_IER_RDI |UART_IER_THRI, iobase+UART_IER);
 }
 
@@ -352,7 +352,7 @@ static void irport_change_speed(void *priv, __u32 speed)
 	outb(lcr,		  iobase+UART_LCR); /* Set 8N1	*/
 	outb(fcr,		  iobase+UART_FCR); /* Enable FIFO's */
 
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	/* This will generate a fatal interrupt storm.
 	 * People calling us will do that properly - Jean II */
 	//outb(/*UART_IER_RLSI|*/UART_IER_RDI/*|UART_IER_THRI*/, iobase+UART_IER);
diff --git a/drivers/net/irda/nsc-ircc.h b/drivers/net/irda/nsc-ircc.h
index bbdc97f..29398a4 100644
--- a/drivers/net/irda/nsc-ircc.h
+++ b/drivers/net/irda/nsc-ircc.h
@@ -231,13 +231,13 @@ struct st_fifo {
 
 struct frame_cb {
 	void *start; /* Start of frame in DMA mem */
-	int len;     /* Lenght of frame in DMA mem */
+	int len;     /* Length of frame in DMA mem */
 };
 
 struct tx_fifo {
 	struct frame_cb queue[MAX_TX_WINDOW]; /* Info about frames in queue */
 	int             ptr;                  /* Currently being sent */
-	int             len;                  /* Lenght of queue */
+	int             len;                  /* Length of queue */
 	int             free;                 /* Next free slot */
 	void           *tail;                 /* Next free start in DMA mem */
 };
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c
index 7e7b582..7fd9a48 100644
--- a/drivers/net/irda/smsc-ircc2.c
+++ b/drivers/net/irda/smsc-ircc2.c
@@ -1165,7 +1165,7 @@ void smsc_ircc_set_sir_speed(struct smsc_ircc_cb *self, __u32 speed)
 	outb(lcr,		  iobase + UART_LCR); /* Set 8N1 */
 	outb(fcr,		  iobase + UART_FCR); /* Enable FIFO's */
 
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	outb(UART_IER_RLSI | UART_IER_RDI | UART_IER_THRI, iobase + UART_IER);
 
 	IRDA_DEBUG(2, "%s() speed changed to: %d\n", __FUNCTION__, speed);
@@ -1930,7 +1930,7 @@ void smsc_ircc_sir_start(struct smsc_ircc_cb *self)
 	outb(UART_LCR_WLEN8, sir_base + UART_LCR);  /* Reset DLAB */
 	outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), sir_base + UART_MCR);
 
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	outb(UART_IER_RLSI | UART_IER_RDI |UART_IER_THRI, sir_base + UART_IER);
 
 	IRDA_DEBUG(3, "%s() - exit\n", __FUNCTION__);
diff --git a/drivers/net/irda/via-ircc.h b/drivers/net/irda/via-ircc.h
index 204b1b3..9d012f0 100644
--- a/drivers/net/irda/via-ircc.h
+++ b/drivers/net/irda/via-ircc.h
@@ -54,13 +54,13 @@ struct st_fifo {
 
 struct frame_cb {
 	void *start;		/* Start of frame in DMA mem */
-	int len;		/* Lenght of frame in DMA mem */
+	int len;		/* Length of frame in DMA mem */
 };
 
 struct tx_fifo {
 	struct frame_cb queue[MAX_TX_WINDOW + 2];	/* Info about frames in queue */
 	int ptr;		/* Currently being sent */
-	int len;		/* Lenght of queue */
+	int len;		/* Length of queue */
 	int free;		/* Next free slot */
 	void *tail;		/* Next free start in DMA mem */
 };
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c
index 512e3b2..4b6359e 100644
--- a/drivers/net/ixgbe/ixgbe_common.c
+++ b/drivers/net/ixgbe/ixgbe_common.c
@@ -716,7 +716,7 @@ static s32 ixgbe_init_rx_addrs(struct ixgbe_hw *hw)
  *  bit-vector to set in the multicast table. The hardware uses 12 bits, from
  *  incoming rx multicast addresses, to determine the bit-vector to check in
  *  the MTA. Which of the 4 combination, of 12-bits, the hardware uses is set
- *  by the MO field of the MCSTCTRL. The MO field is set during initalization
+ *  by the MO field of the MCSTCTRL. The MO field is set during initialization
  *  to mc_filter_type.
  **/
 static s32 ixgbe_mta_vector(struct ixgbe_hw *hw, u8 *mc_addr)
@@ -1066,7 +1066,7 @@ s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw)
 
 
 /**
- *  ixgbe_acquire_swfw_sync - Aquire SWFW semaphore
+ *  ixgbe_acquire_swfw_sync - Acquire SWFW semaphore
  *  @hw: pointer to hardware structure
  *  @mask: Mask to specify wich semaphore to acquire
  *
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 00bc525..25a9cc2 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -592,7 +592,7 @@ quit_polling:
  * ixgbe_setup_msix - Initialize MSI-X interrupts
  *
  * ixgbe_setup_msix allocates MSI-X vectors and requests
- * interrutps from the kernel.
+ * interrupts from the kernel.
  **/
 static int ixgbe_setup_msix(struct ixgbe_adapter *adapter)
 {
diff --git a/drivers/net/lasi_82596.c b/drivers/net/lasi_82596.c
index efbae4b..1ba38c2 100644
--- a/drivers/net/lasi_82596.c
+++ b/drivers/net/lasi_82596.c
@@ -47,7 +47,7 @@
    TBD:
    * look at deferring rx frames rather than discarding (as per tulip)
    * handle tx ring full as per tulip
-   * performace test to tune rx_copybreak
+   * performance test to tune rx_copybreak
 
    Most of my modifications relate to the braindead big-endian
    implementation by Intel.  When the i596 is operating in
diff --git a/drivers/net/lib82596.c b/drivers/net/lib82596.c
index b59f442..c335d31 100644
--- a/drivers/net/lib82596.c
+++ b/drivers/net/lib82596.c
@@ -47,7 +47,7 @@
    TBD:
    * look at deferring rx frames rather than discarding (as per tulip)
    * handle tx ring full as per tulip
-   * performace test to tune rx_copybreak
+   * performance test to tune rx_copybreak
 
    Most of my modifications relate to the braindead big-endian
    implementation by Intel.  When the i596 is operating in
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 047ea7b..1367178 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -239,7 +239,7 @@ static int macb_mii_init(struct macb *bp)
 	struct eth_platform_data *pdata;
 	int err = -ENXIO, i;
 
-	/* Enable managment port */
+	/* Enable management port */
 	macb_writel(bp, NCR, MACB_BIT(MPE));
 
 	bp->mii_bus.name = "MACB_mii_bus",
diff --git a/drivers/net/meth.h b/drivers/net/meth.h
index a78dc1c..ecd0e97 100644
--- a/drivers/net/meth.h
+++ b/drivers/net/meth.h
@@ -127,7 +127,7 @@ typedef struct rx_packet {
 #define METH_ACCEPT_MY 0			/* 00: Accept PHY address only */
 #define METH_ACCEPT_MCAST 0x20	/* 01: Accept physical, broadcast, and multicast filter matches only */
 #define METH_ACCEPT_AMCAST 0x40	/* 10: Accept physical, broadcast, and all multicast packets */
-#define METH_PROMISC 0x60		/* 11: Promiscious mode */
+#define METH_PROMISC 0x60		/* 11: Promiscuous mode */
 
 #define METH_PHY_LINK_FAIL	BIT(7) /* 0: Link failure detection disabled, 1: Hardware scans for link failure in PHY */
 
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 651c269..c263c91 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -535,7 +535,7 @@ struct mv643xx_private {
 
 	int rx_resource_err;		/* Rx ring resource error flag */
 
-	/* Tx/Rx rings managment indexes fields. For driver use */
+	/* Tx/Rx rings management indexes fields. For driver use */
 
 	/* Next available and first returning Rx resource */
 	int rx_curr_desc_q, rx_used_desc_q;
@@ -757,7 +757,7 @@ static void mv643xx_eth_update_mac_address(struct net_device *dev)
 /*
  * mv643xx_eth_set_rx_mode
  *
- * Change from promiscuos to regular rx mode
+ * Change from promiscuous to regular rx mode
  *
  * Input :	pointer to ethernet interface network device structure
  * Output :	N/A
diff --git a/drivers/net/netxen/netxen_nic_hw.h b/drivers/net/netxen/netxen_nic_hw.h
index 245bf13..236160a 100644
--- a/drivers/net/netxen/netxen_nic_hw.h
+++ b/drivers/net/netxen/netxen_nic_hw.h
@@ -429,7 +429,7 @@ typedef enum {
 #define netxen_get_niu_enable_ge(config_word)	\
 		_netxen_crb_get_bit(config_word, 1)
 
-/* Promiscous mode options (GbE mode only) */
+/* Promiscuous mode options (GbE mode only) */
 typedef enum {
 	NETXEN_NIU_PROMISC_MODE = 0,
 	NETXEN_NIU_NON_PROMISC_MODE
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index 4f69037..9e1890f 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -2368,7 +2368,7 @@ find_compressor(int type)
 }
 
 /*
- * Miscelleneous stuff.
+ * Miscellaneous stuff.
  */
 
 static void
diff --git a/drivers/net/ps3_gelic_net.c b/drivers/net/ps3_gelic_net.c
index 0a42bf5..5efc5b4 100644
--- a/drivers/net/ps3_gelic_net.c
+++ b/drivers/net/ps3_gelic_net.c
@@ -1271,7 +1271,7 @@ static struct ethtool_ops gelic_net_ethtool_ops = {
 /**
  * gelic_net_tx_timeout_task - task scheduled by the watchdog timeout
  * function (to be called not under interrupt status)
- * @work: work is context of tx timout task
+ * @work: work is context of tx timeout task
  *
  * called as task when tx hangs, resets interface (if interface is up)
  */
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index a579111..da85b7f 100644
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -3691,7 +3691,7 @@ static int ql_adapter_up(struct ql3_adapter *qdev)
 		ql_sem_unlock(qdev, QL_DRVR_SEM_MASK);
 	} else {
 		printk(KERN_ERR PFX
-		       "%s: Could not aquire driver lock.\n",
+		       "%s: Could not acquire driver lock.\n",
 		       ndev->name);
 		goto err_lock;
 	}
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h
index cc1797a..63d45d4 100644
--- a/drivers/net/s2io.h
+++ b/drivers/net/s2io.h
@@ -740,7 +740,7 @@ struct mac_info {
 	u16 mc_pause_threshold_q0q3;
 	u16 mc_pause_threshold_q4q7;
 
-	void *stats_mem;	/* orignal pointer to allocated mem */
+	void *stats_mem;	/* original pointer to allocated mem */
 	dma_addr_t stats_mem_phy;	/* Physical address of the stat block */
 	u32 stats_mem_sz;
 	struct stat_block *stats_info;	/* Logical address of the stat block */
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
index 7200883..ff559e4 100644
--- a/drivers/net/sis190.c
+++ b/drivers/net/sis190.c
@@ -102,7 +102,7 @@ enum sis190_registers {
 	IntrStatus		= 0x20,
 	IntrMask		= 0x24,
 	IntrControl		= 0x28,
-	IntrTimer		= 0x2c,	// unused (Interupt Timer)
+	IntrTimer		= 0x2c,	// unused (Interrupt Timer)
 	PMControl		= 0x30,	// unused (Power Mgmt Control/Status)
 	rsv2			= 0x34,	// reserved
 	ROMControl		= 0x38,
diff --git a/drivers/net/sk98lin/skgepnmi.c b/drivers/net/sk98lin/skgepnmi.c
index b36dd9a..c761ff7 100644
--- a/drivers/net/sk98lin/skgepnmi.c
+++ b/drivers/net/sk98lin/skgepnmi.c
@@ -356,7 +356,7 @@ int Level)		/* Initialization level */
 	unsigned int	PortMax;	/* Number of ports */
 	unsigned int	PortIndex;	/* Current port index in loop */
 	SK_U16		Val16;		/* Multiple purpose 16 bit variable */
-	SK_U8		Val8;		/* Mulitple purpose 8 bit variable */
+	SK_U8		Val8;		/* Multiple purpose 8 bit variable */
 	SK_EVPARA	EventParam;	/* Event struct for timer event */
 	SK_PNMI_VCT	*pVctBackupData;
 
diff --git a/drivers/net/sk98lin/skxmac2.c b/drivers/net/sk98lin/skxmac2.c
index b4e7502..3994289 100644
--- a/drivers/net/sk98lin/skxmac2.c
+++ b/drivers/net/sk98lin/skxmac2.c
@@ -3891,7 +3891,7 @@ int SkXmOverflowStatus(
 SK_AC	*pAC,				/* adapter context */
 SK_IOC	IoC,				/* IO context */
 unsigned int Port,			/* Port Index (MAC_1 + n) */
-SK_U16	IStatus,			/* Interupt Status from MAC */
+SK_U16	IStatus,			/* Interrupt Status from MAC */
 SK_U64	SK_FAR *pStatus)	/* ptr for return overflow status value */
 {
 	SK_U64	Status;	/* Overflow status */
@@ -4036,7 +4036,7 @@ int SkGmOverflowStatus(
 SK_AC	*pAC,				/* adapter context */
 SK_IOC	IoC,				/* IO context */
 unsigned int Port,			/* Port Index (MAC_1 + n) */
-SK_U16	IStatus,			/* Interupt Status from MAC */
+SK_U16	IStatus,			/* Interrupt Status from MAC */
 SK_U64	SK_FAR *pStatus)	/* ptr for return overflow status value */
 {
 	SK_U64	Status;		/* Overflow status */
diff --git a/drivers/net/skfp/ess.c b/drivers/net/skfp/ess.c
index 62b0132..889f987 100644
--- a/drivers/net/skfp/ess.c
+++ b/drivers/net/skfp/ess.c
@@ -598,7 +598,7 @@ static void ess_send_alc_req(struct s_smc *smc)
 	req->cmd.sba_cmd = REQUEST_ALLOCATION ;
 
 	/*
-	 * set the parameter type and parameter lenght of all used
+	 * set the parameter type and parameter length of all used
 	 * parameters
 	 */
 
diff --git a/drivers/net/skfp/fplustm.c b/drivers/net/skfp/fplustm.c
index a45205d..b27a895 100644
--- a/drivers/net/skfp/fplustm.c
+++ b/drivers/net/skfp/fplustm.c
@@ -398,7 +398,7 @@ static void copy_tx_mac(struct s_smc *smc, u_long td, struct fddi_mac *mac,
 /* u_long td;		 transmit descriptor */
 /* struct fddi_mac *mac; mac frame pointer */
 /* unsigned off;	 start address within buffer memory */
-/* int len ;		 lenght of the frame including the FC */
+/* int len ;		 length of the frame including the FC */
 {
 	int	i ;
 	u_int	*p ;
@@ -1262,8 +1262,8 @@ Function	DOWNCALL/INTERN	(SMT, fplustm.c)
 
 Para	mode =	1	RX_ENABLE_ALLMULTI	enable all multicasts
 		2	RX_DISABLE_ALLMULTI	disable "enable all multicasts"
-		3	RX_ENABLE_PROMISC	enable promiscous
-		4	RX_DISABLE_PROMISC	disable promiscous
+		3	RX_ENABLE_PROMISC	enable promiscuous
+		4	RX_DISABLE_PROMISC	disable promiscuous
 		5	RX_ENABLE_NSA		enable reception of NSA frames
 		6	RX_DISABLE_NSA		disable reception of NSA frames
 
diff --git a/drivers/net/skfp/h/fplustm.h b/drivers/net/skfp/h/fplustm.h
index 98bbf65..586f055 100644
--- a/drivers/net/skfp/h/fplustm.h
+++ b/drivers/net/skfp/h/fplustm.h
@@ -237,8 +237,8 @@ struct s_smt_fp {
  */
 #define RX_ENABLE_ALLMULTI	1	/* enable all multicasts */
 #define RX_DISABLE_ALLMULTI	2	/* disable "enable all multicasts" */
-#define RX_ENABLE_PROMISC	3	/* enable promiscous */
-#define RX_DISABLE_PROMISC	4	/* disable promiscous */
+#define RX_ENABLE_PROMISC	3	/* enable promiscuous */
+#define RX_DISABLE_PROMISC	4	/* disable promiscuous */
 #define RX_ENABLE_NSA		5	/* enable reception of NSA frames */
 #define RX_DISABLE_NSA		6	/* disable reception of NSA frames */
 
diff --git a/drivers/net/skfp/h/smt.h b/drivers/net/skfp/h/smt.h
index 1ff5899..2976757 100644
--- a/drivers/net/skfp/h/smt.h
+++ b/drivers/net/skfp/h/smt.h
@@ -413,7 +413,7 @@ struct smt_p_reason {
 #define SMT_RDF_SUCCESS	0x00000003	/* success (PMF) */
 #define SMT_RDF_BADSET	0x00000004	/* bad set count (PMF) */
 #define SMT_RDF_ILLEGAL 0x00000005	/* read only (PMF) */
-#define SMT_RDF_NOPARAM	0x6		/* paramter not supported (PMF) */
+#define SMT_RDF_NOPARAM	0x6		/* parameter not supported (PMF) */
 #define SMT_RDF_RANGE	0x8		/* out of range */
 #define SMT_RDF_AUTHOR	0x9		/* not autohorized */
 #define SMT_RDF_LENGTH	0x0a		/* length error */
diff --git a/drivers/net/skfp/h/supern_2.h b/drivers/net/skfp/h/supern_2.h
index 5ba0b83..1074f96 100644
--- a/drivers/net/skfp/h/supern_2.h
+++ b/drivers/net/skfp/h/supern_2.h
@@ -386,7 +386,7 @@ struct tx_queue {
 #define	FM_MDISRCV	(4<<8)		/* disable receive function */
 #define	FM_MRES0	(5<<8)		/* reserve */
 #define	FM_MLIMPROM	(6<<8)		/* limited-promiscuous mode */
-#define FM_MPROMISCOUS	(7<<8)		/* address detection : promiscous */
+#define FM_MPROMISCOUS	(7<<8)		/* address detection : promiscuous */
 
 #define FM_SELSA	0x0800		/* select-short-address bit */
 
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 76cc1d3..648b904 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -466,7 +466,7 @@ static inline void	 smc911x_rcv(struct net_device *dev)
 		/* Align IP header to 32 bits
 		 * Note that the device is configured to add a 2
 		 * byte padding to the packet start, so we really
-		 * want to write to the orignal data pointer */
+		 * want to write to the original data pointer */
 		data = skb->data;
 		skb_reserve(skb, 2);
 		skb_put(skb,pkt_len-4);
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
index bccae7e..7a7f5cd 100644
--- a/drivers/net/spider_net.c
+++ b/drivers/net/spider_net.c
@@ -1826,7 +1826,7 @@ spider_net_enable_card(struct spider_net_card *card)
 
 	spider_net_write_reg(card, SPIDER_NET_ECMODE, SPIDER_NET_ECMODE_VALUE);
 
-	/* set chain tail adress for RX chains and
+	/* set chain tail address for RX chains and
 	 * enable DMA */
 	spider_net_enable_rxchtails(card);
 	spider_net_enable_rxdmac(card);
diff --git a/drivers/net/sunbmac.h b/drivers/net/sunbmac.h
index b563d3c..681442b 100644
--- a/drivers/net/sunbmac.h
+++ b/drivers/net/sunbmac.h
@@ -185,7 +185,7 @@
 #define BIGMAC_RXCFG_ENABLE    0x00000001 /* Enable the receiver                      */
 #define BIGMAC_RXCFG_FIFO      0x0000000e /* Default rx fthresh...                    */
 #define BIGMAC_RXCFG_PSTRIP    0x00000020 /* Pad byte strip enable                    */
-#define BIGMAC_RXCFG_PMISC     0x00000040 /* Enable promiscous mode                   */
+#define BIGMAC_RXCFG_PMISC     0x00000040 /* Enable promiscuous mode                  */
 #define BIGMAC_RXCFG_DERR      0x00000080 /* Disable error checking                   */
 #define BIGMAC_RXCFG_DCRCS     0x00000100 /* Disable CRC stripping                    */
 #define BIGMAC_RXCFG_ME        0x00000200 /* Receive packets addressed to me          */
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 6887214..097a065 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -780,7 +780,7 @@ static int gem_rx(struct gem *gp, int work_to_do)
 			break;
 
 		/* When writing back RX descriptor, GEM writes status
-		 * then buffer address, possibly in seperate transactions.
+		 * then buffer address, possibly in separate transactions.
 		 * If we don't wait for the chip to write both, we could
 		 * post a new buffer to this descriptor then have GEM spam
 		 * on the buffer address.  We sync on the RX completion
diff --git a/drivers/net/sunhme.h b/drivers/net/sunhme.h
index 90f446d..68bf4e1 100644
--- a/drivers/net/sunhme.h
+++ b/drivers/net/sunhme.h
@@ -223,7 +223,7 @@
 /* BigMac receive config register. */
 #define BIGMAC_RXCFG_ENABLE   0x00000001 /* Enable the receiver             */
 #define BIGMAC_RXCFG_PSTRIP   0x00000020 /* Pad byte strip enable           */
-#define BIGMAC_RXCFG_PMISC    0x00000040 /* Enable promiscous mode          */
+#define BIGMAC_RXCFG_PMISC    0x00000040 /* Enable promiscuous mode         */
 #define BIGMAC_RXCFG_DERR     0x00000080 /* Disable error checking          */
 #define BIGMAC_RXCFG_DCRCS    0x00000100 /* Disable CRC stripping           */
 #define BIGMAC_RXCFG_REJME    0x00000200 /* Reject packets addressed to me  */
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c
index d887c05..0fbf96d 100644
--- a/drivers/net/tc35815.c
+++ b/drivers/net/tc35815.c
@@ -136,7 +136,7 @@ struct tc35815_regs {
 #define DMA_RxAlign_2          0x00800000
 #define DMA_RxAlign_3          0x00c00000
 #define DMA_M66EnStat          0x00080000 /* 1:66MHz Enable State            */
-#define DMA_IntMask            0x00040000 /* 1:Interupt mask                 */
+#define DMA_IntMask            0x00040000 /* 1:Interrupt mask                 */
 #define DMA_SWIntReq           0x00020000 /* 1:Software Interrupt request    */
 #define DMA_TxWakeUp           0x00010000 /* 1:Transmit Wake Up              */
 #define DMA_RxBigE             0x00008000 /* 1:Receive Big Endian            */
@@ -281,7 +281,7 @@ struct tc35815_regs {
 #define Int_IntMacTx           0x00000001 /* 1:Tx controller & Clear         */
 
 /* MD_CA bit asign --------------------------------------------------------- */
-#define MD_CA_PreSup           0x00001000 /* 1:Preamble Supress              */
+#define MD_CA_PreSup           0x00001000 /* 1:Preamble Suppress             */
 #define MD_CA_Busy             0x00000800 /* 1:Busy (Start Operation)        */
 #define MD_CA_Wr               0x00000400 /* 1:Write 0:Read                  */
 
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c
index 21230c9..3ed1973 100644
--- a/drivers/net/tehuti.c
+++ b/drivers/net/tehuti.c
@@ -276,7 +276,7 @@ static irqreturn_t bdx_isr_napi(int irq, void *dev)
 			 * currently intrs are disabled (since we read ISR),
 			 * and we have failed to register next poll.
 			 * so we read the regs to trigger chip
-			 * and allow further interupts. */
+			 * and allow further interrupts. */
 			READ_REG(priv, regTXF_WPTR_0);
 			READ_REG(priv, regRXD_WPTR_0);
 		}
diff --git a/drivers/net/tehuti.h b/drivers/net/tehuti.h
index efd170f..992efa6 100644
--- a/drivers/net/tehuti.h
+++ b/drivers/net/tehuti.h
@@ -510,7 +510,7 @@ struct txd_desc {
 #define  GMAC_RX_FILTER_ACRC  0x0010	/* accept crc error */
 #define  GMAC_RX_FILTER_AM    0x0008	/* accept multicast */
 #define  GMAC_RX_FILTER_AB    0x0004	/* accept broadcast */
-#define  GMAC_RX_FILTER_PRM   0x0001	/* [0:1] promiscous mode */
+#define  GMAC_RX_FILTER_PRM   0x0001	/* [0:1] promiscuous mode */
 
 #define  MAX_FRAME_AB_VAL       0x3fff	/* 13:0 */
 
diff --git a/drivers/net/tokenring/3c359.c b/drivers/net/tokenring/3c359.c
index 5d31519..9d7a0c9 100644
--- a/drivers/net/tokenring/3c359.c
+++ b/drivers/net/tokenring/3c359.c
@@ -75,7 +75,7 @@ static char version[] __devinitdata  =
 MODULE_AUTHOR("Mike Phillips <mikep-m5R9+5/bmyvR7s880joybQ@public.gmane.org>") ; 
 MODULE_DESCRIPTION("3Com 3C359 Velocity XL Token Ring Adapter Driver \n") ;
 
-/* Module paramters */
+/* Module parameters */
 
 /* Ring Speed 0,4,16 
  * 0 = Autosense   
diff --git a/drivers/net/tokenring/lanstreamer.c b/drivers/net/tokenring/lanstreamer.c
index 47d84cd..21c4f3c 100644
--- a/drivers/net/tokenring/lanstreamer.c
+++ b/drivers/net/tokenring/lanstreamer.c
@@ -170,7 +170,7 @@ static char *open_min_error[] = {
 	"Monitor Contention failer for RPL", "FDX Protocol Error"
 };
 
-/* Module paramters */
+/* Module parameters */
 
 /* Ring Speed 0,4,16
  * 0 = Autosense         
diff --git a/drivers/net/tokenring/olympic.c b/drivers/net/tokenring/olympic.c
index 74c1f0f..b1178f1 100644
--- a/drivers/net/tokenring/olympic.c
+++ b/drivers/net/tokenring/olympic.c
@@ -132,7 +132,7 @@ static char *open_min_error[] = {"No error", "Function Failure", "Signal Lost",
 				   "Reserved", "Reserved", "No Monitor Detected for RPL", 
 				   "Monitor Contention failer for RPL", "FDX Protocol Error"};
 
-/* Module paramters */
+/* Module parameters */
 
 MODULE_AUTHOR("Mike Phillips <mikep-m5R9+5/bmyvR7s880joybQ@public.gmane.org>") ; 
 MODULE_DESCRIPTION("Olympic PCI/Cardbus Chipset Driver") ; 
diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c
index 93da3a3..4238a61 100644
--- a/drivers/net/tokenring/smctr.c
+++ b/drivers/net/tokenring/smctr.c
@@ -2426,7 +2426,7 @@ static irqreturn_t smctr_interrupt(int irq, void *dev_id)
                                 break ;
 
                         /* Type 0x0E - TRC Initialization Sequence Interrupt
-                         * Subtype -- 00-FF Initializatin sequence complete
+                         * Subtype -- 00-FF Initialization sequence complete
                          */
                         case ISB_IMC_TRC_INTRNL_TST_STATUS:
                                 tp->status = INITIALIZED;
@@ -3055,8 +3055,8 @@ static int smctr_load_node_addr(struct net_device *dev)
  * disabled.!?
  *
  * NOTE 2: If the monitor_state is MS_BEACON_TEST_STATE and the receive_mask
- * has any multi-cast or promiscous bits set, the receive_mask needs to
- * be changed to clear the multi-cast or promiscous mode bits, the lobe_test
+ * has any multi-cast or promiscuous bits set, the receive_mask needs to
+ * be changed to clear the multi-cast or promiscuous mode bits, the lobe_test
  * run, and then the receive mask set back to its original value if the test
  * is successful.
  */
diff --git a/drivers/net/tokenring/tms380tr.c b/drivers/net/tokenring/tms380tr.c
index d5fa36d..b15435d 100644
--- a/drivers/net/tokenring/tms380tr.c
+++ b/drivers/net/tokenring/tms380tr.c
@@ -48,7 +48,7 @@
  *	25-Sep-99	AF	Uped TPL_NUM from 3 to 9
  *				Removed extraneous 'No free TPL'
  *	22-Dec-99	AF	Added Madge PCI Mk2 support and generalized
- *				parts of the initilization procedure.
+ *				parts of the initialization procedure.
  *	30-Dec-99	AF	Turned tms380tr into a library ala 8390.
  *				Madge support is provided in the abyss module
  *				Generic PCI support is in the tmspci module.
diff --git a/drivers/net/tokenring/tms380tr.h b/drivers/net/tokenring/tms380tr.h
index 7daf74e..1cbb8b8 100644
--- a/drivers/net/tokenring/tms380tr.h
+++ b/drivers/net/tokenring/tms380tr.h
@@ -441,7 +441,7 @@ typedef struct {
 #define PASS_FIRST_BUF_ONLY	0x0100	/* Passes only first internal buffer
 					 * of each received frame; FrameSize
 					 * of RPLs must contain internal
-					 * BUFFER_SIZE bits for promiscous mode.
+					 * BUFFER_SIZE bits for promiscuous mode.
 					 */
 #define ENABLE_FULL_DUPLEX_SELECTION	0x2000 
  					/* Enable the use of full-duplex
diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c
index 70befe3..5dad012 100644
--- a/drivers/net/tulip/xircom_cb.c
+++ b/drivers/net/tulip/xircom_cb.c
@@ -646,7 +646,7 @@ static void setup_descriptors(struct xircom_private *card)
 	}
 
 	wmb();
-	/* wite the transmit descriptor ring to the card */
+	/* write the transmit descriptor ring to the card */
 	address = (unsigned long) card->tx_dma_handle;
 	val =cpu_to_le32(address);
 	outl(val, card->io_port + CSR4);	/* xmit descr list address */
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 1f76446..fc9eada 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -142,7 +142,7 @@ add_multi(u32* filter, const u8* addr)
 	filter[bit_nr >> 5] |= 1 << (bit_nr & 31);
 }
 
-/** Remove the specified Ethernet addres from this multicast filter. */
+/** Remove the specified Ethernet address from this multicast filter. */
 static void
 del_multi(u32* filter, const u8* addr)
 {
@@ -399,7 +399,7 @@ static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv,
 		 * - the packet is addressed to us.
 		 * - the packet is broadcast.
 		 * - the packet is multicast and
-		 *   - we are multicast promiscous.
+		 *   - we are multicast promiscuous.
 		 *   - we belong to the multicast group.
 		 */
 		skb_copy_from_linear_data(skb, addr, min_t(size_t, sizeof addr,
diff --git a/drivers/net/ucc_geth_ethtool.c b/drivers/net/ucc_geth_ethtool.c
index 9a9622c..f8d319b 100644
--- a/drivers/net/ucc_geth_ethtool.c
+++ b/drivers/net/ucc_geth_ethtool.c
@@ -7,7 +7,7 @@
  *
  * Limitation: 
  * Can only get/set setttings of the first queue.
- * Need to re-open the interface manually after changing some paramters.
+ * Need to re-open the interface manually after changing some parameters.
  *
  * This program is free software; you can redistribute  it and/or modify it
  * under  the terms of  the GNU General  Public License as published by the
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c
index df884f0..7c0d4a8 100644
--- a/drivers/net/ucc_geth_mii.c
+++ b/drivers/net/ucc_geth_mii.c
@@ -63,11 +63,11 @@ int uec_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value)
 {
 	struct ucc_mii_mng __iomem *regs = (void __iomem *)bus->priv;
 
-	/* Setting up the MII Mangement Address Register */
+	/* Setting up the MII Management Address Register */
 	out_be32(&regs->miimadd,
 		 (mii_id << MIIMADD_PHY_ADDRESS_SHIFT) | regnum);
 
-	/* Setting up the MII Mangement Control Register with the value */
+	/* Setting up the MII Management Control Register with the value */
 	out_be32(&regs->miimcon, value);
 
 	/* Wait till MII management write is complete */
@@ -85,7 +85,7 @@ int uec_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
 	struct ucc_mii_mng __iomem *regs = (void __iomem *)bus->priv;
 	u16 value;
 
-	/* Setting up the MII Mangement Address Register */
+	/* Setting up the MII Management Address Register */
 	out_be32(&regs->miimadd,
 		 (mii_id << MIIMADD_PHY_ADDRESS_SHIFT) | regnum);
 
diff --git a/drivers/net/wan/cycx_drv.c b/drivers/net/wan/cycx_drv.c
index d347d59..d14e667 100644
--- a/drivers/net/wan/cycx_drv.c
+++ b/drivers/net/wan/cycx_drv.c
@@ -322,7 +322,7 @@ static int cycx_data_boot(void __iomem *addr, u8 *code, u32 len)
 	void __iomem *pt_boot_cmd = addr + CMD_OFFSET;
 	u32 i;
 
-	/* boot buffer lenght */
+	/* boot buffer length */
 	writew(CFM_LOAD_BUFSZ, pt_boot_cmd + sizeof(u16));
 	writew(GEN_DEFPAR, pt_boot_cmd);
 
@@ -353,7 +353,7 @@ static int cycx_code_boot(void __iomem *addr, u8 *code, u32 len)
 	void __iomem *pt_boot_cmd = addr + CMD_OFFSET;
 	u32 i;
 
-	/* boot buffer lenght */
+	/* boot buffer length */
 	writew(CFM_LOAD_BUFSZ, pt_boot_cmd + sizeof(u16));
 	writew(GEN_DEFPAR, pt_boot_cmd);
 
diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c
index 2e8b5c2..74f87df 100644
--- a/drivers/net/wan/sbni.c
+++ b/drivers/net/wan/sbni.c
@@ -1472,7 +1472,7 @@ sbni_get_stats( struct net_device  *dev )
 static void
 set_multicast_list( struct net_device  *dev )
 {
-	return;		/* sbni always operate in promiscuos mode */
+	return;		/* sbni always operate in promiscuous mode */
 }
 
 
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index 059ce3f..60dfdd9 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -3278,7 +3278,7 @@ static void atmel_smooth_qual(struct atmel_private *priv)
 	priv->wstats.qual.updated &= ~IW_QUAL_QUAL_INVALID;
 }
 
-/* deals with incoming managment frames. */
+/* deals with incoming management frames. */
 static void atmel_management_frame(struct atmel_private *priv,
 				   struct ieee80211_hdr_4addr *header,
 				   u16 frame_len, u8 rssi)
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h
index a40d1af..edf7d8f 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h
@@ -28,7 +28,7 @@ struct bcm43xx_dfsentry {
 	struct bcm43xx_xmitstatus *xmitstatus_buffer;
 	int xmitstatus_ptr;
 	int xmitstatus_cnt;
-	/* We need a seperate buffer while printing to avoid
+	/* We need a separate buffer while printing to avoid
 	 * concurrency issues. (New xmitstatus can arrive
 	 * while we are printing).
 	 */
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 54f44e5..e24382f 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -1144,7 +1144,7 @@ static void ipw_led_shutdown(struct ipw_priv *priv)
 /*
  * The following adds a new attribute to the sysfs representation
  * of this device driver (i.e. a new file in /sys/bus/pci/drivers/ipw/)
- * used for controling the debug level.
+ * used for controlling the debug level.
  *
  * See the level definitions in ipw for details.
  */
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 891f90d..e242647 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -4051,7 +4051,7 @@ static int iwl4965_tx_status_reply_compressed_ba(struct iwl_priv *priv,
 	agg->wait_for_ba = 0;
 	IWL_DEBUG_TX_REPLY("BA %d %d\n", agg->start_idx, ba_resp->ba_seq_ctl);
 	sh = agg->start_idx - SEQ_TO_INDEX(ba_seq_ctl>>4);
-	if (sh < 0) /* tbw something is wrong with indeces */
+	if (sh < 0) /* tbw something is wrong with indices */
 		sh += 0x100;
 
 	/* don't use 64 bits for now */
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index be5cfd8..31ee4f6 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -1120,7 +1120,7 @@ int libertas_set_mac_packet_filter(wlan_private * priv)
  *  @param cmd_action	command action: GET or SET
  *  @param wait_option	wait option: wait response or not
  *  @param cmd_oid	cmd oid: treated as sub command
- *  @param pdata_buf	A pointer to informaion buffer
+ *  @param pdata_buf	A pointer to information buffer
  *  @return 		0 or -1
  */
 int libertas_prepare_and_send_command(wlan_private * priv,
@@ -1606,7 +1606,7 @@ static void cleanup_cmdnode(struct cmd_ctrl_node *ptempnode)
  *  @param ptempnode	A pointer to cmd_ctrl_node structure
  *  @param cmd_oid	cmd oid: treated as sub command
  *  @param wait_option	wait option: wait response or not
- *  @param pdata_buf	A pointer to informaion buffer
+ *  @param pdata_buf	A pointer to information buffer
  *  @return 		0 or -1
  */
 void libertas_set_cmd_ctrl_node(wlan_private * priv,
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index ad1e67d..537b36c 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -443,7 +443,7 @@ wlan_scan_setup_scan_config(wlan_private * priv,
 	ptlvpos = pscancfgout->tlvbuffer;
 
 	/*
-	 * Set the initial scan paramters for progressive scanning.  If a specific
+	 * Set the initial scan parameters for progressive scanning.  If a specific
 	 *   BSSID or SSID is used, the number of channels in the scan command
 	 *   will be increased to the absolute maximum
 	 */
@@ -1679,7 +1679,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
  *
  *  Called from libertas_prepare_and_send_command() in cmd.c
  *
- *  Sends a fixed lenght data part (specifying the BSS type and BSSID filters)
+ *  Sends a fixed length data part (specifying the BSS type and BSSID filters)
  *  as well as a variable number/length of TLVs to the firmware.
  *
  *  @param priv       A pointer to wlan_private structure
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c
index d2fa079..c4b649e 100644
--- a/drivers/net/wireless/netwave_cs.c
+++ b/drivers/net/wireless/netwave_cs.c
@@ -1408,7 +1408,7 @@ static void set_multicast_list(struct net_device *dev)
 	/* Multicast Mode */
 	rcvMode = rxConfRxEna + rxConfAMP + rxConfBcast;
     } else if (dev->flags & IFF_PROMISC) {
-	/* Promiscous mode */
+	/* Promiscuous mode */
 	rcvMode = rxConfRxEna + rxConfPro + rxConfAMP + rxConfBcast;
     } else {
 	/* Normal mode */
diff --git a/drivers/net/wireless/orinoco.h b/drivers/net/wireless/orinoco.h
index 4720fb2..703a4cf 100644
--- a/drivers/net/wireless/orinoco.h
+++ b/drivers/net/wireless/orinoco.h
@@ -108,7 +108,7 @@ struct orinoco_private {
 	int	scan_inprogress;	/* Scan pending... */
 	u32	scan_mode;		/* Type of scan done */
 	char *	scan_result;		/* Result of previous scan */
-	int	scan_len;		/* Lenght of result */
+	int	scan_len;		/* Length of result */
 };
 
 #ifdef ORINOCO_DEBUG
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index f87fe10..24f9066 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -129,7 +129,7 @@ static void ray_reset(struct net_device *dev);
 static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, int len);
 static void verify_dl_startup(u_long);
 
-/* Prototypes for interrpt time functions **********************************/
+/* Prototypes for interrupt time functions **********************************/
 static irqreturn_t ray_interrupt (int reg, void *dev_id);
 static void clear_interrupt(ray_dev_t *local);
 static void rx_deauthenticate(ray_dev_t *local, struct rcs __iomem *prcs, 
diff --git a/drivers/net/wireless/rt2x00/rt2x00reg.h b/drivers/net/wireless/rt2x00/rt2x00reg.h
index 8384212..fe9011d 100644
--- a/drivers/net/wireless/rt2x00/rt2x00reg.h
+++ b/drivers/net/wireless/rt2x00/rt2x00reg.h
@@ -230,7 +230,7 @@ static inline u8 rt2x00_get_field8(const u8 reg,
  *	corresponds with the TX register format for the current device.
  *	4 - plcp, 802.11b rates are device specific,
  *	802.11g rates are set according to the ieee802.11a-1999 p.14.
- * The bit to enable preamble is set in a seperate define.
+ * The bit to enable preamble is set in a separate define.
  */
 #define DEV_RATE	FIELD32(0x000007ff)
 #define DEV_PREAMBLE	FIELD32(0x00000800)
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.h b/drivers/net/wireless/rt2x00/rt2x00usb.h
index 2681abe..b76881f 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.h
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.h
@@ -135,13 +135,13 @@ static inline int rt2x00usb_vendor_request_sw(const struct rt2x00_dev
  * kmalloc for correct handling inside the kernel USB layer.
  */
 static inline int rt2x00usb_eeprom_read(const struct rt2x00_dev *rt2x00dev,
-					 __le16 *eeprom, const u16 lenght)
+					 __le16 *eeprom, const u16 length)
 {
-	int timeout = REGISTER_TIMEOUT * (lenght / sizeof(u16));
+	int timeout = REGISTER_TIMEOUT * (length / sizeof(u16));
 
 	return rt2x00usb_vendor_request(rt2x00dev, USB_EEPROM_READ,
 					USB_VENDOR_REQUEST_IN, 0x0000,
-					0x0000, eeprom, lenght, timeout);
+					0x0000, eeprom, length, timeout);
 }
 
 /*
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index c0671c2..d1468a1 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -833,7 +833,7 @@ static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev, void *data,
 
 	/*
 	 * Write firmware to device.
-	 * We setup a seperate cache for this action,
+	 * We setup a separate cache for this action,
 	 * since we are going to write larger chunks of data
 	 * then normally used cache size.
 	 */
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c
index 577c647..5d28105 100644
--- a/drivers/net/wireless/wavelan_cs.c
+++ b/drivers/net/wireless/wavelan_cs.c
@@ -159,7 +159,7 @@ psa_read(struct net_device *	dev,
 
 /*------------------------------------------------------------------*/
 /*
- * Write the Paramter Storage Area to the WaveLAN card's memory
+ * Write the Parameter Storage Area to the WaveLAN card's memory
  */
 static void
 psa_write(struct net_device *	dev,
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.h b/drivers/net/wireless/zd1211rw/zd_chip.h
index 8009b70..301315a 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.h
+++ b/drivers/net/wireless/zd1211rw/zd_chip.h
@@ -620,8 +620,8 @@ enum {
 #define E2P_PWR_INT_GUARD		8
 #define E2P_CHANNEL_COUNT		14
 
-/* If you compare this addresses with the ZYDAS orignal driver, please notify
- * that we use word mapping for the EEPROM.
+/* If you compare these addresses with the ZYDAS original driver,
+ * please notice that we use word mapping for the EEPROM.
  */
 
 /*
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
index 87f002a..cb6e978 100644
--- a/drivers/net/yellowfin.c
+++ b/drivers/net/yellowfin.c
@@ -533,7 +533,7 @@ static int __devinit read_eeprom(void __iomem *ioaddr, int location)
 	return ioread8(ioaddr + EERead);
 }
 
-/* MII Managemen Data I/O accesses.
+/* MII Management Data I/O accesses.
    These routines assume the MDIO controller is idle, and do not exit until
    the command is finished. */
 
-- 
1.5.3.7.949.g2221a6


-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

^ permalink raw reply related

* [PATCH] drivers/net/: Spelling fixes
From: Joe Perches @ 2007-12-17 19:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: Pavel Roskin, Eugene Surovegin, Geoff Levand, David Gibson,
	orinoco-devel, Yi Zhu, Jaroslav Kysela, linuxppc-dev, netdev,
	Paul Mackerras, Peter De Shrijver, Rastapur Santosh,
	bonding-devel, Andy Gospodarek, Amit S. Kale, ipw2100-devel,
	ipw3945-devel, Masakazu Mokuno, libertas-dev, Dan Williams,
	Dale Farnsworth, Jay Vosburgh, Jesse Brandeburg,
	Manish Lachwani <m


Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/net/82596.c                            |    2 +-
 drivers/net/amd8111e.c                         |    8 ++++----
 drivers/net/amd8111e.h                         |    2 +-
 drivers/net/appletalk/ltpc.c                   |    2 +-
 drivers/net/atl1/atl1_hw.c                     |    2 +-
 drivers/net/atl1/atl1_main.c                   |    2 +-
 drivers/net/bonding/bond_3ad.c                 |    4 ++--
 drivers/net/chelsio/sge.c                      |    2 +-
 drivers/net/chelsio/subr.c                     |    2 +-
 drivers/net/cxgb3/t3_hw.c                      |    2 +-
 drivers/net/e1000/e1000_hw.c                   |    4 ++--
 drivers/net/e1000/e1000_hw.h                   |    2 +-
 drivers/net/e1000/e1000_main.c                 |    2 +-
 drivers/net/e1000e/netdev.c                    |    2 +-
 drivers/net/eepro.c                            |    2 +-
 drivers/net/ehea/ehea.h                        |    2 +-
 drivers/net/forcedeth.c                        |    2 +-
 drivers/net/hamachi.c                          |    4 ++--
 drivers/net/hp100.c                            |    2 +-
 drivers/net/hp100.h                            |    4 ++--
 drivers/net/ibm_emac/ibm_emac.h                |    2 +-
 drivers/net/ibm_newemac/emac.h                 |    2 +-
 drivers/net/ibmlana.c                          |    2 +-
 drivers/net/ibmlana.h                          |    2 +-
 drivers/net/ipg.c                              |    4 ++--
 drivers/net/irda/ali-ircc.c                    |    6 +++---
 drivers/net/irda/ali-ircc.h                    |    4 ++--
 drivers/net/irda/donauboe.h                    |    2 +-
 drivers/net/irda/irport.c                      |    4 ++--
 drivers/net/irda/nsc-ircc.h                    |    4 ++--
 drivers/net/irda/smsc-ircc2.c                  |    4 ++--
 drivers/net/irda/via-ircc.h                    |    4 ++--
 drivers/net/ixgbe/ixgbe_common.c               |    4 ++--
 drivers/net/ixgbe/ixgbe_main.c                 |    2 +-
 drivers/net/lasi_82596.c                       |    2 +-
 drivers/net/lib82596.c                         |    2 +-
 drivers/net/macb.c                             |    2 +-
 drivers/net/meth.h                             |    2 +-
 drivers/net/mv643xx_eth.c                      |    4 ++--
 drivers/net/netxen/netxen_nic_hw.h             |    2 +-
 drivers/net/ppp_generic.c                      |    2 +-
 drivers/net/ps3_gelic_net.c                    |    2 +-
 drivers/net/qla3xxx.c                          |    2 +-
 drivers/net/s2io.h                             |    2 +-
 drivers/net/sis190.c                           |    2 +-
 drivers/net/sk98lin/skgepnmi.c                 |    2 +-
 drivers/net/sk98lin/skxmac2.c                  |    4 ++--
 drivers/net/skfp/ess.c                         |    2 +-
 drivers/net/skfp/fplustm.c                     |    6 +++---
 drivers/net/skfp/h/fplustm.h                   |    4 ++--
 drivers/net/skfp/h/smt.h                       |    2 +-
 drivers/net/skfp/h/supern_2.h                  |    2 +-
 drivers/net/smc911x.c                          |    2 +-
 drivers/net/spider_net.c                       |    2 +-
 drivers/net/sunbmac.h                          |    2 +-
 drivers/net/sungem.c                           |    2 +-
 drivers/net/sunhme.h                           |    2 +-
 drivers/net/tc35815.c                          |    4 ++--
 drivers/net/tehuti.c                           |    2 +-
 drivers/net/tehuti.h                           |    2 +-
 drivers/net/tokenring/3c359.c                  |    2 +-
 drivers/net/tokenring/lanstreamer.c            |    2 +-
 drivers/net/tokenring/olympic.c                |    2 +-
 drivers/net/tokenring/smctr.c                  |    6 +++---
 drivers/net/tokenring/tms380tr.c               |    2 +-
 drivers/net/tokenring/tms380tr.h               |    2 +-
 drivers/net/tulip/xircom_cb.c                  |    2 +-
 drivers/net/tun.c                              |    4 ++--
 drivers/net/ucc_geth_ethtool.c                 |    2 +-
 drivers/net/ucc_geth_mii.c                     |    6 +++---
 drivers/net/wan/cycx_drv.c                     |    4 ++--
 drivers/net/wan/sbni.c                         |    2 +-
 drivers/net/wireless/atmel.c                   |    2 +-
 drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h |    2 +-
 drivers/net/wireless/ipw2200.c                 |    2 +-
 drivers/net/wireless/iwlwifi/iwl-4965.c        |    2 +-
 drivers/net/wireless/libertas/cmd.c            |    4 ++--
 drivers/net/wireless/libertas/scan.c           |    4 ++--
 drivers/net/wireless/netwave_cs.c              |    2 +-
 drivers/net/wireless/orinoco.h                 |    2 +-
 drivers/net/wireless/ray_cs.c                  |    2 +-
 drivers/net/wireless/rt2x00/rt2x00reg.h        |    2 +-
 drivers/net/wireless/rt2x00/rt2x00usb.h        |    6 +++---
 drivers/net/wireless/rt2x00/rt73usb.c          |    2 +-
 drivers/net/wireless/wavelan_cs.c              |    2 +-
 drivers/net/wireless/zd1211rw/zd_chip.h        |    4 ++--
 drivers/net/yellowfin.c                        |    2 +-
 87 files changed, 120 insertions(+), 120 deletions(-)

diff --git a/drivers/net/82596.c b/drivers/net/82596.c
index 2797da7..d999b63 100644
--- a/drivers/net/82596.c
+++ b/drivers/net/82596.c
@@ -19,7 +19,7 @@
    TBD:
    * look at deferring rx frames rather than discarding (as per tulip)
    * handle tx ring full as per tulip
-   * performace test to tune rx_copybreak
+   * performance test to tune rx_copybreak
 
    Most of my modifications relate to the braindead big-endian
    implementation by Intel.  When the i596 is operating in
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c
index e7fdd81..5cefe92 100644
--- a/drivers/net/amd8111e.c
+++ b/drivers/net/amd8111e.c
@@ -1283,7 +1283,7 @@ static irqreturn_t amd8111e_interrupt(int irq, void *dev_id)
 #ifdef CONFIG_AMD8111E_NAPI
 	if(intr0 & RINT0){
 		if(netif_rx_schedule_prep(dev, &lp->napi)){
-			/* Disable receive interupts */
+			/* Disable receive interrupts */
 			writel(RINTEN0, mmio + INTEN0);
 			/* Schedule a polling routine */
 			__netif_rx_schedule(dev, &lp->napi);
@@ -1493,7 +1493,7 @@ static void amd8111e_read_regs(struct amd8111e_priv *lp, u32 *buf)
 
 
 /*
-This function sets promiscuos mode, all-multi mode or the multicast address
+This function sets promiscuous mode, all-multi mode or the multicast address
 list to the device.
 */
 static void amd8111e_set_multicast_list(struct net_device *dev)
@@ -1522,7 +1522,7 @@ static void amd8111e_set_multicast_list(struct net_device *dev)
 		lp->mc_list = NULL;
 		lp->options &= ~OPTION_MULTICAST_ENABLE;
 		amd8111e_writeq(*(u64*)mc_filter,lp->mmio + LADRF);
-		/* disable promiscous mode */
+		/* disable promiscuous mode */
 		writel(PROM, lp->mmio + CMD2);
 		return;
 	}
@@ -2016,7 +2016,7 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev,
 	for(i = 0; i < ETH_ADDR_LEN; i++)
 		dev->dev_addr[i] = readb(lp->mmio + PADR + i);
 
-	/* Setting user defined parametrs */
+	/* Setting user defined parameters */
 	lp->ext_phy_option = speed_duplex[card_idx];
 	if(coalesce[card_idx])
 		lp->options |= OPTION_INTR_COAL_ENABLE;
diff --git a/drivers/net/amd8111e.h b/drivers/net/amd8111e.h
index 28c60a7..7d288de 100644
--- a/drivers/net/amd8111e.h
+++ b/drivers/net/amd8111e.h
@@ -614,7 +614,7 @@ typedef enum {
 #define CSTATE  1
 #define SSTATE  2
 
-/* Assume contoller gets data 10 times the maximum processing time */
+/* Assume controller gets data 10 times the maximum processing time */
 #define  REPEAT_CNT			10
 
 /* amd8111e decriptor flag definitions */
diff --git a/drivers/net/appletalk/ltpc.c b/drivers/net/appletalk/ltpc.c
index 6ab2c2d..86a9496 100644
--- a/drivers/net/appletalk/ltpc.c
+++ b/drivers/net/appletalk/ltpc.c
@@ -1233,7 +1233,7 @@ static int __init ltpc_setup(char *str)
 		if (ints[0] > 2) {
 			dma = ints[3];
 		}
-		/* ignore any other paramters */
+		/* ignore any other parameters */
 	}
 	return 1;
 }
diff --git a/drivers/net/atl1/atl1_hw.c b/drivers/net/atl1/atl1_hw.c
index 9d3bd22..82359f7 100644
--- a/drivers/net/atl1/atl1_hw.c
+++ b/drivers/net/atl1/atl1_hw.c
@@ -645,7 +645,7 @@ s32 atl1_init_hw(struct atl1_hw *hw)
 	atl1_init_flash_opcode(hw);
 
 	if (!hw->phy_configured) {
-		/* enable GPHY LinkChange Interrrupt */
+		/* enable GPHY LinkChange Interrupt */
 		ret_val = atl1_write_phy_reg(hw, 18, 0xC00);
 		if (ret_val)
 			return ret_val;
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 35b0a7d..7599163 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -575,7 +575,7 @@ static u32 atl1_check_link(struct atl1_adapter *adapter)
 		return ATL1_SUCCESS;
 	}
 
-	/* change orignal link status */
+	/* change original link status */
 	if (netif_carrier_ok(netdev)) {
 		adapter->link_speed = SPEED_0;
 		netif_carrier_off(netdev);
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index cb3c6fa..96f0f24 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -869,7 +869,7 @@ static int ad_lacpdu_send(struct port *port)
 	lacpdu_header = (struct lacpdu_header *)skb_put(skb, length);
 
 	lacpdu_header->ad_header.destination_address = lacpdu_multicast_address;
-	/* Note: source addres is set to be the member's PERMANENT address, because we use it
+	/* Note: source address is set to be the member's PERMANENT address, because we use it
 	   to identify loopback lacpdus in receive. */
 	lacpdu_header->ad_header.source_address = *((struct mac_addr *)(slave->perm_hwaddr));
 	lacpdu_header->ad_header.length_type = PKT_TYPE_LACPDU;
@@ -912,7 +912,7 @@ static int ad_marker_send(struct port *port, struct bond_marker *marker)
 	marker_header = (struct bond_marker_header *)skb_put(skb, length);
 
 	marker_header->ad_header.destination_address = lacpdu_multicast_address;
-	/* Note: source addres is set to be the member's PERMANENT address, because we use it
+	/* Note: source address is set to be the member's PERMANENT address, because we use it
 	   to identify loopback MARKERs in receive. */
 	marker_header->ad_header.source_address = *((struct mac_addr *)(slave->perm_hwaddr));
 	marker_header->ad_header.length_type = PKT_TYPE_LACPDU;
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c
index b301c04..ed17cd9 100644
--- a/drivers/net/chelsio/sge.c
+++ b/drivers/net/chelsio/sge.c
@@ -248,7 +248,7 @@ static void restart_sched(unsigned long);
  *
  * Interrupts are handled by a single CPU and it is likely that on a MP system
  * the application is migrated to another CPU. In that scenario, we try to
- * seperate the RX(in irq context) and TX state in order to decrease memory
+ * separate the RX(in irq context) and TX state in order to decrease memory
  * contention.
  */
 struct sge {
diff --git a/drivers/net/chelsio/subr.c b/drivers/net/chelsio/subr.c
index dc50151..7c95578 100644
--- a/drivers/net/chelsio/subr.c
+++ b/drivers/net/chelsio/subr.c
@@ -559,7 +559,7 @@ struct chelsio_vpd_t {
 #define EEPROM_MAX_POLL   4
 
 /*
- * Read SEEPROM. A zero is written to the flag register when the addres is
+ * Read SEEPROM. A zero is written to the flag register when the address is
  * written to the Control register. The hardware device will set the flag to a
  * one when 4B have been transferred to the Data register.
  */
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 522834c..2882e36 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -534,7 +534,7 @@ struct t3_vpd {
  *
  *	Read a 32-bit word from a location in VPD EEPROM using the card's PCI
  *	VPD ROM capability.  A zero is written to the flag bit when the
- *	addres is written to the control register.  The hardware device will
+ *	address is written to the control register.  The hardware device will
  *	set the flag to 1 when 4 bytes have been read into the data register.
  */
 int t3_seeprom_read(struct adapter *adapter, u32 addr, u32 *data)
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 7c6888c..fd7e6a8 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -803,7 +803,7 @@ e1000_initialize_hardware_bits(struct e1000_hw *hw)
                 E1000_WRITE_REG(hw, CTRL, reg_ctrl);
                 break;
             case e1000_80003es2lan:
-                /* improve small packet performace for fiber/serdes */
+                /* improve small packet performance for fiber/serdes */
                 if ((hw->media_type == e1000_media_type_fiber) ||
                     (hw->media_type == e1000_media_type_internal_serdes)) {
                     reg_tarc0 &= ~(1 << 20);
@@ -5001,7 +5001,7 @@ e1000_read_eeprom(struct e1000_hw *hw,
             return -E1000_ERR_EEPROM;
     }
 
-    /* Eerd register EEPROM access requires no eeprom aquire/release */
+    /* Eerd register EEPROM access requires no eeprom acquire/release */
     if (eeprom->use_eerd == TRUE)
         return e1000_read_eeprom_eerd(hw, offset, words, data);
 
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h
index a2a86c5..e40e515 100644
--- a/drivers/net/e1000/e1000_hw.h
+++ b/drivers/net/e1000/e1000_hw.h
@@ -1068,7 +1068,7 @@ struct e1000_ffvt_entry {
 
 #define E1000_KUMCTRLSTA 0x00034 /* MAC-PHY interface - RW */
 #define E1000_MDPHYA     0x0003C  /* PHY address - RW */
-#define E1000_MANC2H     0x05860  /* Managment Control To Host - RW */
+#define E1000_MANC2H     0x05860  /* Management Control To Host - RW */
 #define E1000_SW_FW_SYNC 0x05B5C /* Software-Firmware Synchronization - RW */
 
 #define E1000_GCR       0x05B00 /* PCI-Ex Control */
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 4f37506..24a2fc1 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -235,7 +235,7 @@ static struct pci_driver e1000_driver = {
 	.probe    = e1000_probe,
 	.remove   = __devexit_p(e1000_remove),
 #ifdef CONFIG_PM
-	/* Power Managment Hooks */
+	/* Power Management Hooks */
 	.suspend  = e1000_suspend,
 	.resume   = e1000_resume,
 #endif
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 4fd2e23..febe157 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -4109,7 +4109,7 @@ static struct pci_driver e1000_driver = {
 	.probe    = e1000_probe,
 	.remove   = __devexit_p(e1000_remove),
 #ifdef CONFIG_PM
-	/* Power Managment Hooks */
+	/* Power Management Hooks */
 	.suspend  = e1000_suspend,
 	.resume   = e1000_resume,
 #endif
diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c
index 83bda6c..d3789c5 100644
--- a/drivers/net/eepro.c
+++ b/drivers/net/eepro.c
@@ -1764,7 +1764,7 @@ module_param_array(io, int, NULL, 0);
 module_param_array(irq, int, NULL, 0);
 module_param_array(mem, int, NULL, 0);
 module_param(autodetect, int, 0);
-MODULE_PARM_DESC(io, "EtherExpress Pro/10 I/O base addres(es)");
+MODULE_PARM_DESC(io, "EtherExpress Pro/10 I/O base address(es)");
 MODULE_PARM_DESC(irq, "EtherExpress Pro/10 IRQ number(s)");
 MODULE_PARM_DESC(mem, "EtherExpress Pro/10 Rx buffer size(es) in kB (3-29)");
 MODULE_PARM_DESC(autodetect, "EtherExpress Pro/10 force board(s) detection (0-1)");
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index 5f82a46..a50b238 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -251,7 +251,7 @@ struct ehea_qp_init_attr {
 };
 
 /*
- * Event Queue attributes, passed as paramter
+ * Event Queue attributes, passed as parameter
  */
 struct ehea_eq_attr {
 	u32 type;
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index a96583c..7119332 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -490,7 +490,7 @@ union ring_type {
 #define NV_RX3_VLAN_TAG_PRESENT (1<<16)
 #define NV_RX3_VLAN_TAG_MASK	(0x0000FFFF)
 
-/* Miscelaneous hardware related defines: */
+/* Miscellaneous hardware related defines: */
 #define NV_PCI_REGSZ_VER1      	0x270
 #define NV_PCI_REGSZ_VER2      	0x2d4
 #define NV_PCI_REGSZ_VER3      	0x604
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c
index ed407c8..683b289 100644
--- a/drivers/net/hamachi.c
+++ b/drivers/net/hamachi.c
@@ -86,7 +86,7 @@ static int force32;
 static int options[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
 static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
 /* The Hamachi chipset supports 3 parameters each for Rx and Tx
- * interruput management.  Parameters will be loaded as specified into
+ * interrupt management.  Parameters will be loaded as specified into
  * the TxIntControl and RxIntControl registers.
  *
  * The registers are arranged as follows:
@@ -811,7 +811,7 @@ static int __devinit read_eeprom(void __iomem *ioaddr, int location)
 	return readb(ioaddr + EEData);
 }
 
-/* MII Managemen Data I/O accesses.
+/* MII Management Data I/O accesses.
    These routines assume the MDIO controller is idle, and do not exit until
    the command is finished. */
 
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c
index 49421d1..8b90d64 100644
--- a/drivers/net/hp100.c
+++ b/drivers/net/hp100.c
@@ -2643,7 +2643,7 @@ static int hp100_login_to_vg_hub(struct net_device *dev, u_short force_relogin)
 		} else {
 			hp100_andb(~HP100_PROM_MODE, VG_LAN_CFG_2);
 			/* For ETR parts we need to reset the prom. bit in the training
-			 * register, otherwise promiscious mode won't be disabled.
+			 * register, otherwise promiscuous mode won't be disabled.
 			 */
 			if (lp->chip == HP100_CHIPID_LASSEN) {
 				hp100_andw(~HP100_MACRQ_PROMSC, TRAIN_REQUEST);
diff --git a/drivers/net/hp100.h b/drivers/net/hp100.h
index e6ca128..e74e45d 100644
--- a/drivers/net/hp100.h
+++ b/drivers/net/hp100.h
@@ -476,7 +476,7 @@
 #define HP100_MACRQ_REPEATER         0x0001	/* 1: MAC tells HUB it wants to be
 						 *    a cascaded repeater
 						 * 0: ... wants to be a DTE */
-#define HP100_MACRQ_PROMSC           0x0006	/* 2 bits: Promiscious mode
+#define HP100_MACRQ_PROMSC           0x0006	/* 2 bits: Promiscuous mode
 						 * 00: Rcv only unicast packets
 						 *     specifically addr to this
 						 *     endnode
@@ -488,7 +488,7 @@
 #define HP100_CARD_MACVER            0xe000	/* R: 3 bit Cards 100VG MAC version */
 #define HP100_MALLOW_REPEATER        0x0001	/* If reset, requested access as an
 						 * end node is allowed */
-#define HP100_MALLOW_PROMSC          0x0004	/* 2 bits: Promiscious mode
+#define HP100_MALLOW_PROMSC          0x0004	/* 2 bits: Promiscuous mode
 						 * 00: Rcv only unicast packets
 						 *     specifically addr to this
 						 *     endnode
diff --git a/drivers/net/ibm_emac/ibm_emac.h b/drivers/net/ibm_emac/ibm_emac.h
index 97ed22b..655be50 100644
--- a/drivers/net/ibm_emac/ibm_emac.h
+++ b/drivers/net/ibm_emac/ibm_emac.h
@@ -1,7 +1,7 @@
 /*
  * drivers/net/ibm_emac/ibm_emac.h
  *
- * Register definitions for PowerPC 4xx on-chip ethernet contoller
+ * Register definitions for PowerPC 4xx on-chip ethernet controller
  *
  * Copyright (c) 2004, 2005 Zultys Technologies.
  * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
diff --git a/drivers/net/ibm_newemac/emac.h b/drivers/net/ibm_newemac/emac.h
index 91cb096..49a540a 100644
--- a/drivers/net/ibm_newemac/emac.h
+++ b/drivers/net/ibm_newemac/emac.h
@@ -1,7 +1,7 @@
 /*
  * drivers/net/ibm_newemac/emac.h
  *
- * Register definitions for PowerPC 4xx on-chip ethernet contoller
+ * Register definitions for PowerPC 4xx on-chip ethernet controller
  *
  * Copyright 2007 Benjamin Herrenschmidt, IBM Corp.
  *                <benh@kernel.crashing.org>
diff --git a/drivers/net/ibmlana.c b/drivers/net/ibmlana.c
index 91d83ac..5a9b6fa 100644
--- a/drivers/net/ibmlana.c
+++ b/drivers/net/ibmlana.c
@@ -481,7 +481,7 @@ static void InitBoard(struct net_device *dev)
 	if ((dev->flags & IFF_ALLMULTI) || (mcptr != NULL))
 		rcrval |= RCREG_AMC;
 
-	/* promiscous mode ? */
+	/* promiscuous mode ? */
 
 	if (dev->flags & IFF_PROMISC)
 		rcrval |= RCREG_PRO;
diff --git a/drivers/net/ibmlana.h b/drivers/net/ibmlana.h
index aa3ddbd..654af95 100644
--- a/drivers/net/ibmlana.h
+++ b/drivers/net/ibmlana.h
@@ -90,7 +90,7 @@ typedef struct {
 #define RCREG_ERR        0x8000	/* accept damaged and collided pkts */
 #define RCREG_RNT        0x4000	/* accept packets that are < 64     */
 #define RCREG_BRD        0x2000	/* accept broadcasts                */
-#define RCREG_PRO        0x1000	/* promiscous mode                  */
+#define RCREG_PRO        0x1000	/* promiscuous mode                 */
 #define RCREG_AMC        0x0800	/* accept all multicasts            */
 #define RCREG_LB_NONE    0x0000	/* no loopback                      */
 #define RCREG_LB_MAC     0x0200	/* MAC loopback                     */
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index dbd23bb..27d12eb 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -209,7 +209,7 @@ static int mdio_read(struct net_device * dev, int phy_id, int phy_reg)
 {
 	void __iomem *ioaddr = ipg_ioaddr(dev);
 	/*
-	 * The GMII mangement frame structure for a read is as follows:
+	 * The GMII management frame structure for a read is as follows:
 	 *
 	 * |Preamble|st|op|phyad|regad|ta|      data      |idle|
 	 * |< 32 1s>|01|10|AAAAA|RRRRR|z0|DDDDDDDDDDDDDDDD|z   |
@@ -300,7 +300,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int phy_reg, int val)
 {
 	void __iomem *ioaddr = ipg_ioaddr(dev);
 	/*
-	 * The GMII mangement frame structure for a read is as follows:
+	 * The GMII management frame structure for a read is as follows:
 	 *
 	 * |Preamble|st|op|phyad|regad|ta|      data      |idle|
 	 * |< 32 1s>|01|10|AAAAA|RRRRR|z0|DDDDDDDDDDDDDDDD|z   |
diff --git a/drivers/net/irda/ali-ircc.c b/drivers/net/irda/ali-ircc.c
index 9f58452..94140f7 100644
--- a/drivers/net/irda/ali-ircc.c
+++ b/drivers/net/irda/ali-ircc.c
@@ -977,7 +977,7 @@ static void ali_ircc_change_speed(struct ali_ircc_cb *self, __u32 baud)
 		/* Install FIR xmit handler*/
 		dev->hard_start_xmit = ali_ircc_fir_hard_xmit;		
 				
-		/* Enable Interuupt */
+		/* Enable Interrupt */
 		self->ier = IER_EOM; // benjamin 2000/11/20 07:24PM					
 				
 		/* Be ready for incomming frames */
@@ -1096,7 +1096,7 @@ static void ali_ircc_sir_change_speed(struct ali_ircc_cb *priv, __u32 speed)
 	outb(lcr,		  iobase+UART_LCR); /* Set 8N1	*/
 	outb(fcr,		  iobase+UART_FCR); /* Enable FIFO's */
 
-	/* without this, the conection will be broken after come back from FIR speed,
+	/* without this, the connection will be broken after come back from FIR speed,
 	   but with this, the SIR connection is harder to established */
 	outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), iobase+UART_MCR);
 	
@@ -1359,7 +1359,7 @@ static int ali_ircc_net_open(struct net_device *dev)
 		return -EAGAIN;
 	}
 	
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	outb(UART_IER_RDI , iobase+UART_IER);
 
 	/* Ready to play! */
diff --git a/drivers/net/irda/ali-ircc.h b/drivers/net/irda/ali-ircc.h
index e489c66..0787657 100644
--- a/drivers/net/irda/ali-ircc.h
+++ b/drivers/net/irda/ali-ircc.h
@@ -173,13 +173,13 @@ struct st_fifo {
 
 struct frame_cb {
 	void *start; /* Start of frame in DMA mem */
-	int len;     /* Lenght of frame in DMA mem */
+	int len;     /* Length of frame in DMA mem */
 };
 
 struct tx_fifo {
 	struct frame_cb queue[MAX_TX_WINDOW]; /* Info about frames in queue */
 	int             ptr;                  /* Currently being sent */
-	int             len;                  /* Lenght of queue */
+	int             len;                  /* Length of queue */
 	int             free;                 /* Next free slot */
 	void           *tail;                 /* Next free start in DMA mem */
 };
diff --git a/drivers/net/irda/donauboe.h b/drivers/net/irda/donauboe.h
index 1e67720..9db3cce 100644
--- a/drivers/net/irda/donauboe.h
+++ b/drivers/net/irda/donauboe.h
@@ -30,7 +30,7 @@
  *     or the type-DO IR port.
  *
  * IrDA chip set list from Toshiba Computer Engineering Corp.
- * model			method	maker	controler		Version 
+ * model			method	maker	controller		Version 
  * Portege 320CT	FIR,SIR Toshiba Oboe(Triangle) 
  * Portege 3010CT	FIR,SIR Toshiba Oboe(Sydney) 
  * Portege 3015CT	FIR,SIR Toshiba Oboe(Sydney) 
diff --git a/drivers/net/irda/irport.c b/drivers/net/irda/irport.c
index c79caa5..2b2a955 100644
--- a/drivers/net/irda/irport.c
+++ b/drivers/net/irda/irport.c
@@ -276,7 +276,7 @@ static void irport_start(struct irport_cb *self)
 	outb(UART_LCR_WLEN8, iobase+UART_LCR);  /* Reset DLAB */
 	outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), iobase+UART_MCR);
 	
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	outb(UART_IER_RLSI | UART_IER_RDI |UART_IER_THRI, iobase+UART_IER);
 }
 
@@ -352,7 +352,7 @@ static void irport_change_speed(void *priv, __u32 speed)
 	outb(lcr,		  iobase+UART_LCR); /* Set 8N1	*/
 	outb(fcr,		  iobase+UART_FCR); /* Enable FIFO's */
 
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	/* This will generate a fatal interrupt storm.
 	 * People calling us will do that properly - Jean II */
 	//outb(/*UART_IER_RLSI|*/UART_IER_RDI/*|UART_IER_THRI*/, iobase+UART_IER);
diff --git a/drivers/net/irda/nsc-ircc.h b/drivers/net/irda/nsc-ircc.h
index bbdc97f..29398a4 100644
--- a/drivers/net/irda/nsc-ircc.h
+++ b/drivers/net/irda/nsc-ircc.h
@@ -231,13 +231,13 @@ struct st_fifo {
 
 struct frame_cb {
 	void *start; /* Start of frame in DMA mem */
-	int len;     /* Lenght of frame in DMA mem */
+	int len;     /* Length of frame in DMA mem */
 };
 
 struct tx_fifo {
 	struct frame_cb queue[MAX_TX_WINDOW]; /* Info about frames in queue */
 	int             ptr;                  /* Currently being sent */
-	int             len;                  /* Lenght of queue */
+	int             len;                  /* Length of queue */
 	int             free;                 /* Next free slot */
 	void           *tail;                 /* Next free start in DMA mem */
 };
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c
index 7e7b582..7fd9a48 100644
--- a/drivers/net/irda/smsc-ircc2.c
+++ b/drivers/net/irda/smsc-ircc2.c
@@ -1165,7 +1165,7 @@ void smsc_ircc_set_sir_speed(struct smsc_ircc_cb *self, __u32 speed)
 	outb(lcr,		  iobase + UART_LCR); /* Set 8N1 */
 	outb(fcr,		  iobase + UART_FCR); /* Enable FIFO's */
 
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	outb(UART_IER_RLSI | UART_IER_RDI | UART_IER_THRI, iobase + UART_IER);
 
 	IRDA_DEBUG(2, "%s() speed changed to: %d\n", __FUNCTION__, speed);
@@ -1930,7 +1930,7 @@ void smsc_ircc_sir_start(struct smsc_ircc_cb *self)
 	outb(UART_LCR_WLEN8, sir_base + UART_LCR);  /* Reset DLAB */
 	outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), sir_base + UART_MCR);
 
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	outb(UART_IER_RLSI | UART_IER_RDI |UART_IER_THRI, sir_base + UART_IER);
 
 	IRDA_DEBUG(3, "%s() - exit\n", __FUNCTION__);
diff --git a/drivers/net/irda/via-ircc.h b/drivers/net/irda/via-ircc.h
index 204b1b3..9d012f0 100644
--- a/drivers/net/irda/via-ircc.h
+++ b/drivers/net/irda/via-ircc.h
@@ -54,13 +54,13 @@ struct st_fifo {
 
 struct frame_cb {
 	void *start;		/* Start of frame in DMA mem */
-	int len;		/* Lenght of frame in DMA mem */
+	int len;		/* Length of frame in DMA mem */
 };
 
 struct tx_fifo {
 	struct frame_cb queue[MAX_TX_WINDOW + 2];	/* Info about frames in queue */
 	int ptr;		/* Currently being sent */
-	int len;		/* Lenght of queue */
+	int len;		/* Length of queue */
 	int free;		/* Next free slot */
 	void *tail;		/* Next free start in DMA mem */
 };
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c
index 512e3b2..4b6359e 100644
--- a/drivers/net/ixgbe/ixgbe_common.c
+++ b/drivers/net/ixgbe/ixgbe_common.c
@@ -716,7 +716,7 @@ static s32 ixgbe_init_rx_addrs(struct ixgbe_hw *hw)
  *  bit-vector to set in the multicast table. The hardware uses 12 bits, from
  *  incoming rx multicast addresses, to determine the bit-vector to check in
  *  the MTA. Which of the 4 combination, of 12-bits, the hardware uses is set
- *  by the MO field of the MCSTCTRL. The MO field is set during initalization
+ *  by the MO field of the MCSTCTRL. The MO field is set during initialization
  *  to mc_filter_type.
  **/
 static s32 ixgbe_mta_vector(struct ixgbe_hw *hw, u8 *mc_addr)
@@ -1066,7 +1066,7 @@ s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw)
 
 
 /**
- *  ixgbe_acquire_swfw_sync - Aquire SWFW semaphore
+ *  ixgbe_acquire_swfw_sync - Acquire SWFW semaphore
  *  @hw: pointer to hardware structure
  *  @mask: Mask to specify wich semaphore to acquire
  *
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 00bc525..25a9cc2 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -592,7 +592,7 @@ quit_polling:
  * ixgbe_setup_msix - Initialize MSI-X interrupts
  *
  * ixgbe_setup_msix allocates MSI-X vectors and requests
- * interrutps from the kernel.
+ * interrupts from the kernel.
  **/
 static int ixgbe_setup_msix(struct ixgbe_adapter *adapter)
 {
diff --git a/drivers/net/lasi_82596.c b/drivers/net/lasi_82596.c
index efbae4b..1ba38c2 100644
--- a/drivers/net/lasi_82596.c
+++ b/drivers/net/lasi_82596.c
@@ -47,7 +47,7 @@
    TBD:
    * look at deferring rx frames rather than discarding (as per tulip)
    * handle tx ring full as per tulip
-   * performace test to tune rx_copybreak
+   * performance test to tune rx_copybreak
 
    Most of my modifications relate to the braindead big-endian
    implementation by Intel.  When the i596 is operating in
diff --git a/drivers/net/lib82596.c b/drivers/net/lib82596.c
index b59f442..c335d31 100644
--- a/drivers/net/lib82596.c
+++ b/drivers/net/lib82596.c
@@ -47,7 +47,7 @@
    TBD:
    * look at deferring rx frames rather than discarding (as per tulip)
    * handle tx ring full as per tulip
-   * performace test to tune rx_copybreak
+   * performance test to tune rx_copybreak
 
    Most of my modifications relate to the braindead big-endian
    implementation by Intel.  When the i596 is operating in
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 047ea7b..1367178 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -239,7 +239,7 @@ static int macb_mii_init(struct macb *bp)
 	struct eth_platform_data *pdata;
 	int err = -ENXIO, i;
 
-	/* Enable managment port */
+	/* Enable management port */
 	macb_writel(bp, NCR, MACB_BIT(MPE));
 
 	bp->mii_bus.name = "MACB_mii_bus",
diff --git a/drivers/net/meth.h b/drivers/net/meth.h
index a78dc1c..ecd0e97 100644
--- a/drivers/net/meth.h
+++ b/drivers/net/meth.h
@@ -127,7 +127,7 @@ typedef struct rx_packet {
 #define METH_ACCEPT_MY 0			/* 00: Accept PHY address only */
 #define METH_ACCEPT_MCAST 0x20	/* 01: Accept physical, broadcast, and multicast filter matches only */
 #define METH_ACCEPT_AMCAST 0x40	/* 10: Accept physical, broadcast, and all multicast packets */
-#define METH_PROMISC 0x60		/* 11: Promiscious mode */
+#define METH_PROMISC 0x60		/* 11: Promiscuous mode */
 
 #define METH_PHY_LINK_FAIL	BIT(7) /* 0: Link failure detection disabled, 1: Hardware scans for link failure in PHY */
 
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 651c269..c263c91 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -535,7 +535,7 @@ struct mv643xx_private {
 
 	int rx_resource_err;		/* Rx ring resource error flag */
 
-	/* Tx/Rx rings managment indexes fields. For driver use */
+	/* Tx/Rx rings management indexes fields. For driver use */
 
 	/* Next available and first returning Rx resource */
 	int rx_curr_desc_q, rx_used_desc_q;
@@ -757,7 +757,7 @@ static void mv643xx_eth_update_mac_address(struct net_device *dev)
 /*
  * mv643xx_eth_set_rx_mode
  *
- * Change from promiscuos to regular rx mode
+ * Change from promiscuous to regular rx mode
  *
  * Input :	pointer to ethernet interface network device structure
  * Output :	N/A
diff --git a/drivers/net/netxen/netxen_nic_hw.h b/drivers/net/netxen/netxen_nic_hw.h
index 245bf13..236160a 100644
--- a/drivers/net/netxen/netxen_nic_hw.h
+++ b/drivers/net/netxen/netxen_nic_hw.h
@@ -429,7 +429,7 @@ typedef enum {
 #define netxen_get_niu_enable_ge(config_word)	\
 		_netxen_crb_get_bit(config_word, 1)
 
-/* Promiscous mode options (GbE mode only) */
+/* Promiscuous mode options (GbE mode only) */
 typedef enum {
 	NETXEN_NIU_PROMISC_MODE = 0,
 	NETXEN_NIU_NON_PROMISC_MODE
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index 4f69037..9e1890f 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -2368,7 +2368,7 @@ find_compressor(int type)
 }
 
 /*
- * Miscelleneous stuff.
+ * Miscellaneous stuff.
  */
 
 static void
diff --git a/drivers/net/ps3_gelic_net.c b/drivers/net/ps3_gelic_net.c
index 0a42bf5..5efc5b4 100644
--- a/drivers/net/ps3_gelic_net.c
+++ b/drivers/net/ps3_gelic_net.c
@@ -1271,7 +1271,7 @@ static struct ethtool_ops gelic_net_ethtool_ops = {
 /**
  * gelic_net_tx_timeout_task - task scheduled by the watchdog timeout
  * function (to be called not under interrupt status)
- * @work: work is context of tx timout task
+ * @work: work is context of tx timeout task
  *
  * called as task when tx hangs, resets interface (if interface is up)
  */
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index a579111..da85b7f 100644
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -3691,7 +3691,7 @@ static int ql_adapter_up(struct ql3_adapter *qdev)
 		ql_sem_unlock(qdev, QL_DRVR_SEM_MASK);
 	} else {
 		printk(KERN_ERR PFX
-		       "%s: Could not aquire driver lock.\n",
+		       "%s: Could not acquire driver lock.\n",
 		       ndev->name);
 		goto err_lock;
 	}
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h
index cc1797a..63d45d4 100644
--- a/drivers/net/s2io.h
+++ b/drivers/net/s2io.h
@@ -740,7 +740,7 @@ struct mac_info {
 	u16 mc_pause_threshold_q0q3;
 	u16 mc_pause_threshold_q4q7;
 
-	void *stats_mem;	/* orignal pointer to allocated mem */
+	void *stats_mem;	/* original pointer to allocated mem */
 	dma_addr_t stats_mem_phy;	/* Physical address of the stat block */
 	u32 stats_mem_sz;
 	struct stat_block *stats_info;	/* Logical address of the stat block */
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
index 7200883..ff559e4 100644
--- a/drivers/net/sis190.c
+++ b/drivers/net/sis190.c
@@ -102,7 +102,7 @@ enum sis190_registers {
 	IntrStatus		= 0x20,
 	IntrMask		= 0x24,
 	IntrControl		= 0x28,
-	IntrTimer		= 0x2c,	// unused (Interupt Timer)
+	IntrTimer		= 0x2c,	// unused (Interrupt Timer)
 	PMControl		= 0x30,	// unused (Power Mgmt Control/Status)
 	rsv2			= 0x34,	// reserved
 	ROMControl		= 0x38,
diff --git a/drivers/net/sk98lin/skgepnmi.c b/drivers/net/sk98lin/skgepnmi.c
index b36dd9a..c761ff7 100644
--- a/drivers/net/sk98lin/skgepnmi.c
+++ b/drivers/net/sk98lin/skgepnmi.c
@@ -356,7 +356,7 @@ int Level)		/* Initialization level */
 	unsigned int	PortMax;	/* Number of ports */
 	unsigned int	PortIndex;	/* Current port index in loop */
 	SK_U16		Val16;		/* Multiple purpose 16 bit variable */
-	SK_U8		Val8;		/* Mulitple purpose 8 bit variable */
+	SK_U8		Val8;		/* Multiple purpose 8 bit variable */
 	SK_EVPARA	EventParam;	/* Event struct for timer event */
 	SK_PNMI_VCT	*pVctBackupData;
 
diff --git a/drivers/net/sk98lin/skxmac2.c b/drivers/net/sk98lin/skxmac2.c
index b4e7502..3994289 100644
--- a/drivers/net/sk98lin/skxmac2.c
+++ b/drivers/net/sk98lin/skxmac2.c
@@ -3891,7 +3891,7 @@ int SkXmOverflowStatus(
 SK_AC	*pAC,				/* adapter context */
 SK_IOC	IoC,				/* IO context */
 unsigned int Port,			/* Port Index (MAC_1 + n) */
-SK_U16	IStatus,			/* Interupt Status from MAC */
+SK_U16	IStatus,			/* Interrupt Status from MAC */
 SK_U64	SK_FAR *pStatus)	/* ptr for return overflow status value */
 {
 	SK_U64	Status;	/* Overflow status */
@@ -4036,7 +4036,7 @@ int SkGmOverflowStatus(
 SK_AC	*pAC,				/* adapter context */
 SK_IOC	IoC,				/* IO context */
 unsigned int Port,			/* Port Index (MAC_1 + n) */
-SK_U16	IStatus,			/* Interupt Status from MAC */
+SK_U16	IStatus,			/* Interrupt Status from MAC */
 SK_U64	SK_FAR *pStatus)	/* ptr for return overflow status value */
 {
 	SK_U64	Status;		/* Overflow status */
diff --git a/drivers/net/skfp/ess.c b/drivers/net/skfp/ess.c
index 62b0132..889f987 100644
--- a/drivers/net/skfp/ess.c
+++ b/drivers/net/skfp/ess.c
@@ -598,7 +598,7 @@ static void ess_send_alc_req(struct s_smc *smc)
 	req->cmd.sba_cmd = REQUEST_ALLOCATION ;
 
 	/*
-	 * set the parameter type and parameter lenght of all used
+	 * set the parameter type and parameter length of all used
 	 * parameters
 	 */
 
diff --git a/drivers/net/skfp/fplustm.c b/drivers/net/skfp/fplustm.c
index a45205d..b27a895 100644
--- a/drivers/net/skfp/fplustm.c
+++ b/drivers/net/skfp/fplustm.c
@@ -398,7 +398,7 @@ static void copy_tx_mac(struct s_smc *smc, u_long td, struct fddi_mac *mac,
 /* u_long td;		 transmit descriptor */
 /* struct fddi_mac *mac; mac frame pointer */
 /* unsigned off;	 start address within buffer memory */
-/* int len ;		 lenght of the frame including the FC */
+/* int len ;		 length of the frame including the FC */
 {
 	int	i ;
 	u_int	*p ;
@@ -1262,8 +1262,8 @@ Function	DOWNCALL/INTERN	(SMT, fplustm.c)
 
 Para	mode =	1	RX_ENABLE_ALLMULTI	enable all multicasts
 		2	RX_DISABLE_ALLMULTI	disable "enable all multicasts"
-		3	RX_ENABLE_PROMISC	enable promiscous
-		4	RX_DISABLE_PROMISC	disable promiscous
+		3	RX_ENABLE_PROMISC	enable promiscuous
+		4	RX_DISABLE_PROMISC	disable promiscuous
 		5	RX_ENABLE_NSA		enable reception of NSA frames
 		6	RX_DISABLE_NSA		disable reception of NSA frames
 
diff --git a/drivers/net/skfp/h/fplustm.h b/drivers/net/skfp/h/fplustm.h
index 98bbf65..586f055 100644
--- a/drivers/net/skfp/h/fplustm.h
+++ b/drivers/net/skfp/h/fplustm.h
@@ -237,8 +237,8 @@ struct s_smt_fp {
  */
 #define RX_ENABLE_ALLMULTI	1	/* enable all multicasts */
 #define RX_DISABLE_ALLMULTI	2	/* disable "enable all multicasts" */
-#define RX_ENABLE_PROMISC	3	/* enable promiscous */
-#define RX_DISABLE_PROMISC	4	/* disable promiscous */
+#define RX_ENABLE_PROMISC	3	/* enable promiscuous */
+#define RX_DISABLE_PROMISC	4	/* disable promiscuous */
 #define RX_ENABLE_NSA		5	/* enable reception of NSA frames */
 #define RX_DISABLE_NSA		6	/* disable reception of NSA frames */
 
diff --git a/drivers/net/skfp/h/smt.h b/drivers/net/skfp/h/smt.h
index 1ff5899..2976757 100644
--- a/drivers/net/skfp/h/smt.h
+++ b/drivers/net/skfp/h/smt.h
@@ -413,7 +413,7 @@ struct smt_p_reason {
 #define SMT_RDF_SUCCESS	0x00000003	/* success (PMF) */
 #define SMT_RDF_BADSET	0x00000004	/* bad set count (PMF) */
 #define SMT_RDF_ILLEGAL 0x00000005	/* read only (PMF) */
-#define SMT_RDF_NOPARAM	0x6		/* paramter not supported (PMF) */
+#define SMT_RDF_NOPARAM	0x6		/* parameter not supported (PMF) */
 #define SMT_RDF_RANGE	0x8		/* out of range */
 #define SMT_RDF_AUTHOR	0x9		/* not autohorized */
 #define SMT_RDF_LENGTH	0x0a		/* length error */
diff --git a/drivers/net/skfp/h/supern_2.h b/drivers/net/skfp/h/supern_2.h
index 5ba0b83..1074f96 100644
--- a/drivers/net/skfp/h/supern_2.h
+++ b/drivers/net/skfp/h/supern_2.h
@@ -386,7 +386,7 @@ struct tx_queue {
 #define	FM_MDISRCV	(4<<8)		/* disable receive function */
 #define	FM_MRES0	(5<<8)		/* reserve */
 #define	FM_MLIMPROM	(6<<8)		/* limited-promiscuous mode */
-#define FM_MPROMISCOUS	(7<<8)		/* address detection : promiscous */
+#define FM_MPROMISCOUS	(7<<8)		/* address detection : promiscuous */
 
 #define FM_SELSA	0x0800		/* select-short-address bit */
 
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 76cc1d3..648b904 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -466,7 +466,7 @@ static inline void	 smc911x_rcv(struct net_device *dev)
 		/* Align IP header to 32 bits
 		 * Note that the device is configured to add a 2
 		 * byte padding to the packet start, so we really
-		 * want to write to the orignal data pointer */
+		 * want to write to the original data pointer */
 		data = skb->data;
 		skb_reserve(skb, 2);
 		skb_put(skb,pkt_len-4);
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
index bccae7e..7a7f5cd 100644
--- a/drivers/net/spider_net.c
+++ b/drivers/net/spider_net.c
@@ -1826,7 +1826,7 @@ spider_net_enable_card(struct spider_net_card *card)
 
 	spider_net_write_reg(card, SPIDER_NET_ECMODE, SPIDER_NET_ECMODE_VALUE);
 
-	/* set chain tail adress for RX chains and
+	/* set chain tail address for RX chains and
 	 * enable DMA */
 	spider_net_enable_rxchtails(card);
 	spider_net_enable_rxdmac(card);
diff --git a/drivers/net/sunbmac.h b/drivers/net/sunbmac.h
index b563d3c..681442b 100644
--- a/drivers/net/sunbmac.h
+++ b/drivers/net/sunbmac.h
@@ -185,7 +185,7 @@
 #define BIGMAC_RXCFG_ENABLE    0x00000001 /* Enable the receiver                      */
 #define BIGMAC_RXCFG_FIFO      0x0000000e /* Default rx fthresh...                    */
 #define BIGMAC_RXCFG_PSTRIP    0x00000020 /* Pad byte strip enable                    */
-#define BIGMAC_RXCFG_PMISC     0x00000040 /* Enable promiscous mode                   */
+#define BIGMAC_RXCFG_PMISC     0x00000040 /* Enable promiscuous mode                  */
 #define BIGMAC_RXCFG_DERR      0x00000080 /* Disable error checking                   */
 #define BIGMAC_RXCFG_DCRCS     0x00000100 /* Disable CRC stripping                    */
 #define BIGMAC_RXCFG_ME        0x00000200 /* Receive packets addressed to me          */
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 6887214..097a065 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -780,7 +780,7 @@ static int gem_rx(struct gem *gp, int work_to_do)
 			break;
 
 		/* When writing back RX descriptor, GEM writes status
-		 * then buffer address, possibly in seperate transactions.
+		 * then buffer address, possibly in separate transactions.
 		 * If we don't wait for the chip to write both, we could
 		 * post a new buffer to this descriptor then have GEM spam
 		 * on the buffer address.  We sync on the RX completion
diff --git a/drivers/net/sunhme.h b/drivers/net/sunhme.h
index 90f446d..68bf4e1 100644
--- a/drivers/net/sunhme.h
+++ b/drivers/net/sunhme.h
@@ -223,7 +223,7 @@
 /* BigMac receive config register. */
 #define BIGMAC_RXCFG_ENABLE   0x00000001 /* Enable the receiver             */
 #define BIGMAC_RXCFG_PSTRIP   0x00000020 /* Pad byte strip enable           */
-#define BIGMAC_RXCFG_PMISC    0x00000040 /* Enable promiscous mode          */
+#define BIGMAC_RXCFG_PMISC    0x00000040 /* Enable promiscuous mode         */
 #define BIGMAC_RXCFG_DERR     0x00000080 /* Disable error checking          */
 #define BIGMAC_RXCFG_DCRCS    0x00000100 /* Disable CRC stripping           */
 #define BIGMAC_RXCFG_REJME    0x00000200 /* Reject packets addressed to me  */
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c
index d887c05..0fbf96d 100644
--- a/drivers/net/tc35815.c
+++ b/drivers/net/tc35815.c
@@ -136,7 +136,7 @@ struct tc35815_regs {
 #define DMA_RxAlign_2          0x00800000
 #define DMA_RxAlign_3          0x00c00000
 #define DMA_M66EnStat          0x00080000 /* 1:66MHz Enable State            */
-#define DMA_IntMask            0x00040000 /* 1:Interupt mask                 */
+#define DMA_IntMask            0x00040000 /* 1:Interrupt mask                 */
 #define DMA_SWIntReq           0x00020000 /* 1:Software Interrupt request    */
 #define DMA_TxWakeUp           0x00010000 /* 1:Transmit Wake Up              */
 #define DMA_RxBigE             0x00008000 /* 1:Receive Big Endian            */
@@ -281,7 +281,7 @@ struct tc35815_regs {
 #define Int_IntMacTx           0x00000001 /* 1:Tx controller & Clear         */
 
 /* MD_CA bit asign --------------------------------------------------------- */
-#define MD_CA_PreSup           0x00001000 /* 1:Preamble Supress              */
+#define MD_CA_PreSup           0x00001000 /* 1:Preamble Suppress             */
 #define MD_CA_Busy             0x00000800 /* 1:Busy (Start Operation)        */
 #define MD_CA_Wr               0x00000400 /* 1:Write 0:Read                  */
 
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c
index 21230c9..3ed1973 100644
--- a/drivers/net/tehuti.c
+++ b/drivers/net/tehuti.c
@@ -276,7 +276,7 @@ static irqreturn_t bdx_isr_napi(int irq, void *dev)
 			 * currently intrs are disabled (since we read ISR),
 			 * and we have failed to register next poll.
 			 * so we read the regs to trigger chip
-			 * and allow further interupts. */
+			 * and allow further interrupts. */
 			READ_REG(priv, regTXF_WPTR_0);
 			READ_REG(priv, regRXD_WPTR_0);
 		}
diff --git a/drivers/net/tehuti.h b/drivers/net/tehuti.h
index efd170f..992efa6 100644
--- a/drivers/net/tehuti.h
+++ b/drivers/net/tehuti.h
@@ -510,7 +510,7 @@ struct txd_desc {
 #define  GMAC_RX_FILTER_ACRC  0x0010	/* accept crc error */
 #define  GMAC_RX_FILTER_AM    0x0008	/* accept multicast */
 #define  GMAC_RX_FILTER_AB    0x0004	/* accept broadcast */
-#define  GMAC_RX_FILTER_PRM   0x0001	/* [0:1] promiscous mode */
+#define  GMAC_RX_FILTER_PRM   0x0001	/* [0:1] promiscuous mode */
 
 #define  MAX_FRAME_AB_VAL       0x3fff	/* 13:0 */
 
diff --git a/drivers/net/tokenring/3c359.c b/drivers/net/tokenring/3c359.c
index 5d31519..9d7a0c9 100644
--- a/drivers/net/tokenring/3c359.c
+++ b/drivers/net/tokenring/3c359.c
@@ -75,7 +75,7 @@ static char version[] __devinitdata  =
 MODULE_AUTHOR("Mike Phillips <mikep@linuxtr.net>") ; 
 MODULE_DESCRIPTION("3Com 3C359 Velocity XL Token Ring Adapter Driver \n") ;
 
-/* Module paramters */
+/* Module parameters */
 
 /* Ring Speed 0,4,16 
  * 0 = Autosense   
diff --git a/drivers/net/tokenring/lanstreamer.c b/drivers/net/tokenring/lanstreamer.c
index 47d84cd..21c4f3c 100644
--- a/drivers/net/tokenring/lanstreamer.c
+++ b/drivers/net/tokenring/lanstreamer.c
@@ -170,7 +170,7 @@ static char *open_min_error[] = {
 	"Monitor Contention failer for RPL", "FDX Protocol Error"
 };
 
-/* Module paramters */
+/* Module parameters */
 
 /* Ring Speed 0,4,16
  * 0 = Autosense         
diff --git a/drivers/net/tokenring/olympic.c b/drivers/net/tokenring/olympic.c
index 74c1f0f..b1178f1 100644
--- a/drivers/net/tokenring/olympic.c
+++ b/drivers/net/tokenring/olympic.c
@@ -132,7 +132,7 @@ static char *open_min_error[] = {"No error", "Function Failure", "Signal Lost",
 				   "Reserved", "Reserved", "No Monitor Detected for RPL", 
 				   "Monitor Contention failer for RPL", "FDX Protocol Error"};
 
-/* Module paramters */
+/* Module parameters */
 
 MODULE_AUTHOR("Mike Phillips <mikep@linuxtr.net>") ; 
 MODULE_DESCRIPTION("Olympic PCI/Cardbus Chipset Driver") ; 
diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c
index 93da3a3..4238a61 100644
--- a/drivers/net/tokenring/smctr.c
+++ b/drivers/net/tokenring/smctr.c
@@ -2426,7 +2426,7 @@ static irqreturn_t smctr_interrupt(int irq, void *dev_id)
                                 break ;
 
                         /* Type 0x0E - TRC Initialization Sequence Interrupt
-                         * Subtype -- 00-FF Initializatin sequence complete
+                         * Subtype -- 00-FF Initialization sequence complete
                          */
                         case ISB_IMC_TRC_INTRNL_TST_STATUS:
                                 tp->status = INITIALIZED;
@@ -3055,8 +3055,8 @@ static int smctr_load_node_addr(struct net_device *dev)
  * disabled.!?
  *
  * NOTE 2: If the monitor_state is MS_BEACON_TEST_STATE and the receive_mask
- * has any multi-cast or promiscous bits set, the receive_mask needs to
- * be changed to clear the multi-cast or promiscous mode bits, the lobe_test
+ * has any multi-cast or promiscuous bits set, the receive_mask needs to
+ * be changed to clear the multi-cast or promiscuous mode bits, the lobe_test
  * run, and then the receive mask set back to its original value if the test
  * is successful.
  */
diff --git a/drivers/net/tokenring/tms380tr.c b/drivers/net/tokenring/tms380tr.c
index d5fa36d..b15435d 100644
--- a/drivers/net/tokenring/tms380tr.c
+++ b/drivers/net/tokenring/tms380tr.c
@@ -48,7 +48,7 @@
  *	25-Sep-99	AF	Uped TPL_NUM from 3 to 9
  *				Removed extraneous 'No free TPL'
  *	22-Dec-99	AF	Added Madge PCI Mk2 support and generalized
- *				parts of the initilization procedure.
+ *				parts of the initialization procedure.
  *	30-Dec-99	AF	Turned tms380tr into a library ala 8390.
  *				Madge support is provided in the abyss module
  *				Generic PCI support is in the tmspci module.
diff --git a/drivers/net/tokenring/tms380tr.h b/drivers/net/tokenring/tms380tr.h
index 7daf74e..1cbb8b8 100644
--- a/drivers/net/tokenring/tms380tr.h
+++ b/drivers/net/tokenring/tms380tr.h
@@ -441,7 +441,7 @@ typedef struct {
 #define PASS_FIRST_BUF_ONLY	0x0100	/* Passes only first internal buffer
 					 * of each received frame; FrameSize
 					 * of RPLs must contain internal
-					 * BUFFER_SIZE bits for promiscous mode.
+					 * BUFFER_SIZE bits for promiscuous mode.
 					 */
 #define ENABLE_FULL_DUPLEX_SELECTION	0x2000 
  					/* Enable the use of full-duplex
diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c
index 70befe3..5dad012 100644
--- a/drivers/net/tulip/xircom_cb.c
+++ b/drivers/net/tulip/xircom_cb.c
@@ -646,7 +646,7 @@ static void setup_descriptors(struct xircom_private *card)
 	}
 
 	wmb();
-	/* wite the transmit descriptor ring to the card */
+	/* write the transmit descriptor ring to the card */
 	address = (unsigned long) card->tx_dma_handle;
 	val =cpu_to_le32(address);
 	outl(val, card->io_port + CSR4);	/* xmit descr list address */
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 1f76446..fc9eada 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -142,7 +142,7 @@ add_multi(u32* filter, const u8* addr)
 	filter[bit_nr >> 5] |= 1 << (bit_nr & 31);
 }
 
-/** Remove the specified Ethernet addres from this multicast filter. */
+/** Remove the specified Ethernet address from this multicast filter. */
 static void
 del_multi(u32* filter, const u8* addr)
 {
@@ -399,7 +399,7 @@ static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv,
 		 * - the packet is addressed to us.
 		 * - the packet is broadcast.
 		 * - the packet is multicast and
-		 *   - we are multicast promiscous.
+		 *   - we are multicast promiscuous.
 		 *   - we belong to the multicast group.
 		 */
 		skb_copy_from_linear_data(skb, addr, min_t(size_t, sizeof addr,
diff --git a/drivers/net/ucc_geth_ethtool.c b/drivers/net/ucc_geth_ethtool.c
index 9a9622c..f8d319b 100644
--- a/drivers/net/ucc_geth_ethtool.c
+++ b/drivers/net/ucc_geth_ethtool.c
@@ -7,7 +7,7 @@
  *
  * Limitation: 
  * Can only get/set setttings of the first queue.
- * Need to re-open the interface manually after changing some paramters.
+ * Need to re-open the interface manually after changing some parameters.
  *
  * This program is free software; you can redistribute  it and/or modify it
  * under  the terms of  the GNU General  Public License as published by the
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c
index df884f0..7c0d4a8 100644
--- a/drivers/net/ucc_geth_mii.c
+++ b/drivers/net/ucc_geth_mii.c
@@ -63,11 +63,11 @@ int uec_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value)
 {
 	struct ucc_mii_mng __iomem *regs = (void __iomem *)bus->priv;
 
-	/* Setting up the MII Mangement Address Register */
+	/* Setting up the MII Management Address Register */
 	out_be32(&regs->miimadd,
 		 (mii_id << MIIMADD_PHY_ADDRESS_SHIFT) | regnum);
 
-	/* Setting up the MII Mangement Control Register with the value */
+	/* Setting up the MII Management Control Register with the value */
 	out_be32(&regs->miimcon, value);
 
 	/* Wait till MII management write is complete */
@@ -85,7 +85,7 @@ int uec_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
 	struct ucc_mii_mng __iomem *regs = (void __iomem *)bus->priv;
 	u16 value;
 
-	/* Setting up the MII Mangement Address Register */
+	/* Setting up the MII Management Address Register */
 	out_be32(&regs->miimadd,
 		 (mii_id << MIIMADD_PHY_ADDRESS_SHIFT) | regnum);
 
diff --git a/drivers/net/wan/cycx_drv.c b/drivers/net/wan/cycx_drv.c
index d347d59..d14e667 100644
--- a/drivers/net/wan/cycx_drv.c
+++ b/drivers/net/wan/cycx_drv.c
@@ -322,7 +322,7 @@ static int cycx_data_boot(void __iomem *addr, u8 *code, u32 len)
 	void __iomem *pt_boot_cmd = addr + CMD_OFFSET;
 	u32 i;
 
-	/* boot buffer lenght */
+	/* boot buffer length */
 	writew(CFM_LOAD_BUFSZ, pt_boot_cmd + sizeof(u16));
 	writew(GEN_DEFPAR, pt_boot_cmd);
 
@@ -353,7 +353,7 @@ static int cycx_code_boot(void __iomem *addr, u8 *code, u32 len)
 	void __iomem *pt_boot_cmd = addr + CMD_OFFSET;
 	u32 i;
 
-	/* boot buffer lenght */
+	/* boot buffer length */
 	writew(CFM_LOAD_BUFSZ, pt_boot_cmd + sizeof(u16));
 	writew(GEN_DEFPAR, pt_boot_cmd);
 
diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c
index 2e8b5c2..74f87df 100644
--- a/drivers/net/wan/sbni.c
+++ b/drivers/net/wan/sbni.c
@@ -1472,7 +1472,7 @@ sbni_get_stats( struct net_device  *dev )
 static void
 set_multicast_list( struct net_device  *dev )
 {
-	return;		/* sbni always operate in promiscuos mode */
+	return;		/* sbni always operate in promiscuous mode */
 }
 
 
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index 059ce3f..60dfdd9 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -3278,7 +3278,7 @@ static void atmel_smooth_qual(struct atmel_private *priv)
 	priv->wstats.qual.updated &= ~IW_QUAL_QUAL_INVALID;
 }
 
-/* deals with incoming managment frames. */
+/* deals with incoming management frames. */
 static void atmel_management_frame(struct atmel_private *priv,
 				   struct ieee80211_hdr_4addr *header,
 				   u16 frame_len, u8 rssi)
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h
index a40d1af..edf7d8f 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h
@@ -28,7 +28,7 @@ struct bcm43xx_dfsentry {
 	struct bcm43xx_xmitstatus *xmitstatus_buffer;
 	int xmitstatus_ptr;
 	int xmitstatus_cnt;
-	/* We need a seperate buffer while printing to avoid
+	/* We need a separate buffer while printing to avoid
 	 * concurrency issues. (New xmitstatus can arrive
 	 * while we are printing).
 	 */
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 54f44e5..e24382f 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -1144,7 +1144,7 @@ static void ipw_led_shutdown(struct ipw_priv *priv)
 /*
  * The following adds a new attribute to the sysfs representation
  * of this device driver (i.e. a new file in /sys/bus/pci/drivers/ipw/)
- * used for controling the debug level.
+ * used for controlling the debug level.
  *
  * See the level definitions in ipw for details.
  */
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 891f90d..e242647 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -4051,7 +4051,7 @@ static int iwl4965_tx_status_reply_compressed_ba(struct iwl_priv *priv,
 	agg->wait_for_ba = 0;
 	IWL_DEBUG_TX_REPLY("BA %d %d\n", agg->start_idx, ba_resp->ba_seq_ctl);
 	sh = agg->start_idx - SEQ_TO_INDEX(ba_seq_ctl>>4);
-	if (sh < 0) /* tbw something is wrong with indeces */
+	if (sh < 0) /* tbw something is wrong with indices */
 		sh += 0x100;
 
 	/* don't use 64 bits for now */
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index be5cfd8..31ee4f6 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -1120,7 +1120,7 @@ int libertas_set_mac_packet_filter(wlan_private * priv)
  *  @param cmd_action	command action: GET or SET
  *  @param wait_option	wait option: wait response or not
  *  @param cmd_oid	cmd oid: treated as sub command
- *  @param pdata_buf	A pointer to informaion buffer
+ *  @param pdata_buf	A pointer to information buffer
  *  @return 		0 or -1
  */
 int libertas_prepare_and_send_command(wlan_private * priv,
@@ -1606,7 +1606,7 @@ static void cleanup_cmdnode(struct cmd_ctrl_node *ptempnode)
  *  @param ptempnode	A pointer to cmd_ctrl_node structure
  *  @param cmd_oid	cmd oid: treated as sub command
  *  @param wait_option	wait option: wait response or not
- *  @param pdata_buf	A pointer to informaion buffer
+ *  @param pdata_buf	A pointer to information buffer
  *  @return 		0 or -1
  */
 void libertas_set_cmd_ctrl_node(wlan_private * priv,
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index ad1e67d..537b36c 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -443,7 +443,7 @@ wlan_scan_setup_scan_config(wlan_private * priv,
 	ptlvpos = pscancfgout->tlvbuffer;
 
 	/*
-	 * Set the initial scan paramters for progressive scanning.  If a specific
+	 * Set the initial scan parameters for progressive scanning.  If a specific
 	 *   BSSID or SSID is used, the number of channels in the scan command
 	 *   will be increased to the absolute maximum
 	 */
@@ -1679,7 +1679,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
  *
  *  Called from libertas_prepare_and_send_command() in cmd.c
  *
- *  Sends a fixed lenght data part (specifying the BSS type and BSSID filters)
+ *  Sends a fixed length data part (specifying the BSS type and BSSID filters)
  *  as well as a variable number/length of TLVs to the firmware.
  *
  *  @param priv       A pointer to wlan_private structure
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c
index d2fa079..c4b649e 100644
--- a/drivers/net/wireless/netwave_cs.c
+++ b/drivers/net/wireless/netwave_cs.c
@@ -1408,7 +1408,7 @@ static void set_multicast_list(struct net_device *dev)
 	/* Multicast Mode */
 	rcvMode = rxConfRxEna + rxConfAMP + rxConfBcast;
     } else if (dev->flags & IFF_PROMISC) {
-	/* Promiscous mode */
+	/* Promiscuous mode */
 	rcvMode = rxConfRxEna + rxConfPro + rxConfAMP + rxConfBcast;
     } else {
 	/* Normal mode */
diff --git a/drivers/net/wireless/orinoco.h b/drivers/net/wireless/orinoco.h
index 4720fb2..703a4cf 100644
--- a/drivers/net/wireless/orinoco.h
+++ b/drivers/net/wireless/orinoco.h
@@ -108,7 +108,7 @@ struct orinoco_private {
 	int	scan_inprogress;	/* Scan pending... */
 	u32	scan_mode;		/* Type of scan done */
 	char *	scan_result;		/* Result of previous scan */
-	int	scan_len;		/* Lenght of result */
+	int	scan_len;		/* Length of result */
 };
 
 #ifdef ORINOCO_DEBUG
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index f87fe10..24f9066 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -129,7 +129,7 @@ static void ray_reset(struct net_device *dev);
 static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, int len);
 static void verify_dl_startup(u_long);
 
-/* Prototypes for interrpt time functions **********************************/
+/* Prototypes for interrupt time functions **********************************/
 static irqreturn_t ray_interrupt (int reg, void *dev_id);
 static void clear_interrupt(ray_dev_t *local);
 static void rx_deauthenticate(ray_dev_t *local, struct rcs __iomem *prcs, 
diff --git a/drivers/net/wireless/rt2x00/rt2x00reg.h b/drivers/net/wireless/rt2x00/rt2x00reg.h
index 8384212..fe9011d 100644
--- a/drivers/net/wireless/rt2x00/rt2x00reg.h
+++ b/drivers/net/wireless/rt2x00/rt2x00reg.h
@@ -230,7 +230,7 @@ static inline u8 rt2x00_get_field8(const u8 reg,
  *	corresponds with the TX register format for the current device.
  *	4 - plcp, 802.11b rates are device specific,
  *	802.11g rates are set according to the ieee802.11a-1999 p.14.
- * The bit to enable preamble is set in a seperate define.
+ * The bit to enable preamble is set in a separate define.
  */
 #define DEV_RATE	FIELD32(0x000007ff)
 #define DEV_PREAMBLE	FIELD32(0x00000800)
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.h b/drivers/net/wireless/rt2x00/rt2x00usb.h
index 2681abe..b76881f 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.h
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.h
@@ -135,13 +135,13 @@ static inline int rt2x00usb_vendor_request_sw(const struct rt2x00_dev
  * kmalloc for correct handling inside the kernel USB layer.
  */
 static inline int rt2x00usb_eeprom_read(const struct rt2x00_dev *rt2x00dev,
-					 __le16 *eeprom, const u16 lenght)
+					 __le16 *eeprom, const u16 length)
 {
-	int timeout = REGISTER_TIMEOUT * (lenght / sizeof(u16));
+	int timeout = REGISTER_TIMEOUT * (length / sizeof(u16));
 
 	return rt2x00usb_vendor_request(rt2x00dev, USB_EEPROM_READ,
 					USB_VENDOR_REQUEST_IN, 0x0000,
-					0x0000, eeprom, lenght, timeout);
+					0x0000, eeprom, length, timeout);
 }
 
 /*
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index c0671c2..d1468a1 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -833,7 +833,7 @@ static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev, void *data,
 
 	/*
 	 * Write firmware to device.
-	 * We setup a seperate cache for this action,
+	 * We setup a separate cache for this action,
 	 * since we are going to write larger chunks of data
 	 * then normally used cache size.
 	 */
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c
index 577c647..5d28105 100644
--- a/drivers/net/wireless/wavelan_cs.c
+++ b/drivers/net/wireless/wavelan_cs.c
@@ -159,7 +159,7 @@ psa_read(struct net_device *	dev,
 
 /*------------------------------------------------------------------*/
 /*
- * Write the Paramter Storage Area to the WaveLAN card's memory
+ * Write the Parameter Storage Area to the WaveLAN card's memory
  */
 static void
 psa_write(struct net_device *	dev,
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.h b/drivers/net/wireless/zd1211rw/zd_chip.h
index 8009b70..301315a 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.h
+++ b/drivers/net/wireless/zd1211rw/zd_chip.h
@@ -620,8 +620,8 @@ enum {
 #define E2P_PWR_INT_GUARD		8
 #define E2P_CHANNEL_COUNT		14
 
-/* If you compare this addresses with the ZYDAS orignal driver, please notify
- * that we use word mapping for the EEPROM.
+/* If you compare these addresses with the ZYDAS original driver,
+ * please notice that we use word mapping for the EEPROM.
  */
 
 /*
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
index 87f002a..cb6e978 100644
--- a/drivers/net/yellowfin.c
+++ b/drivers/net/yellowfin.c
@@ -533,7 +533,7 @@ static int __devinit read_eeprom(void __iomem *ioaddr, int location)
 	return ioread8(ioaddr + EERead);
 }
 
-/* MII Managemen Data I/O accesses.
+/* MII Management Data I/O accesses.
    These routines assume the MDIO controller is idle, and do not exit until
    the command is finished. */
 
-- 
1.5.3.7.949.g2221a6


-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

^ permalink raw reply related

* [PATCH] drivers/net/: Spelling fixes
From: Joe Perches @ 2007-12-17 19:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: Pavel Roskin, Eugene Surovegin, Geoff Levand, David Gibson,
	orinoco-devel, Yi Zhu, Jaroslav Kysela, linuxppc-dev, netdev,
	Paul Mackerras, Peter De Shrijver, Rastapur Santosh,
	bonding-devel, Andy Gospodarek, Amit S. Kale, ipw2100-devel,
	ipw3945-devel, Masakazu Mokuno, libertas-dev, Dan Williams,
	Dale Farnsworth, Jay Vosburgh, Jesse Brandeburg,
	Manish Lachwani <m


Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/net/82596.c                            |    2 +-
 drivers/net/amd8111e.c                         |    8 ++++----
 drivers/net/amd8111e.h                         |    2 +-
 drivers/net/appletalk/ltpc.c                   |    2 +-
 drivers/net/atl1/atl1_hw.c                     |    2 +-
 drivers/net/atl1/atl1_main.c                   |    2 +-
 drivers/net/bonding/bond_3ad.c                 |    4 ++--
 drivers/net/chelsio/sge.c                      |    2 +-
 drivers/net/chelsio/subr.c                     |    2 +-
 drivers/net/cxgb3/t3_hw.c                      |    2 +-
 drivers/net/e1000/e1000_hw.c                   |    4 ++--
 drivers/net/e1000/e1000_hw.h                   |    2 +-
 drivers/net/e1000/e1000_main.c                 |    2 +-
 drivers/net/e1000e/netdev.c                    |    2 +-
 drivers/net/eepro.c                            |    2 +-
 drivers/net/ehea/ehea.h                        |    2 +-
 drivers/net/forcedeth.c                        |    2 +-
 drivers/net/hamachi.c                          |    4 ++--
 drivers/net/hp100.c                            |    2 +-
 drivers/net/hp100.h                            |    4 ++--
 drivers/net/ibm_emac/ibm_emac.h                |    2 +-
 drivers/net/ibm_newemac/emac.h                 |    2 +-
 drivers/net/ibmlana.c                          |    2 +-
 drivers/net/ibmlana.h                          |    2 +-
 drivers/net/ipg.c                              |    4 ++--
 drivers/net/irda/ali-ircc.c                    |    6 +++---
 drivers/net/irda/ali-ircc.h                    |    4 ++--
 drivers/net/irda/donauboe.h                    |    2 +-
 drivers/net/irda/irport.c                      |    4 ++--
 drivers/net/irda/nsc-ircc.h                    |    4 ++--
 drivers/net/irda/smsc-ircc2.c                  |    4 ++--
 drivers/net/irda/via-ircc.h                    |    4 ++--
 drivers/net/ixgbe/ixgbe_common.c               |    4 ++--
 drivers/net/ixgbe/ixgbe_main.c                 |    2 +-
 drivers/net/lasi_82596.c                       |    2 +-
 drivers/net/lib82596.c                         |    2 +-
 drivers/net/macb.c                             |    2 +-
 drivers/net/meth.h                             |    2 +-
 drivers/net/mv643xx_eth.c                      |    4 ++--
 drivers/net/netxen/netxen_nic_hw.h             |    2 +-
 drivers/net/ppp_generic.c                      |    2 +-
 drivers/net/ps3_gelic_net.c                    |    2 +-
 drivers/net/qla3xxx.c                          |    2 +-
 drivers/net/s2io.h                             |    2 +-
 drivers/net/sis190.c                           |    2 +-
 drivers/net/sk98lin/skgepnmi.c                 |    2 +-
 drivers/net/sk98lin/skxmac2.c                  |    4 ++--
 drivers/net/skfp/ess.c                         |    2 +-
 drivers/net/skfp/fplustm.c                     |    6 +++---
 drivers/net/skfp/h/fplustm.h                   |    4 ++--
 drivers/net/skfp/h/smt.h                       |    2 +-
 drivers/net/skfp/h/supern_2.h                  |    2 +-
 drivers/net/smc911x.c                          |    2 +-
 drivers/net/spider_net.c                       |    2 +-
 drivers/net/sunbmac.h                          |    2 +-
 drivers/net/sungem.c                           |    2 +-
 drivers/net/sunhme.h                           |    2 +-
 drivers/net/tc35815.c                          |    4 ++--
 drivers/net/tehuti.c                           |    2 +-
 drivers/net/tehuti.h                           |    2 +-
 drivers/net/tokenring/3c359.c                  |    2 +-
 drivers/net/tokenring/lanstreamer.c            |    2 +-
 drivers/net/tokenring/olympic.c                |    2 +-
 drivers/net/tokenring/smctr.c                  |    6 +++---
 drivers/net/tokenring/tms380tr.c               |    2 +-
 drivers/net/tokenring/tms380tr.h               |    2 +-
 drivers/net/tulip/xircom_cb.c                  |    2 +-
 drivers/net/tun.c                              |    4 ++--
 drivers/net/ucc_geth_ethtool.c                 |    2 +-
 drivers/net/ucc_geth_mii.c                     |    6 +++---
 drivers/net/wan/cycx_drv.c                     |    4 ++--
 drivers/net/wan/sbni.c                         |    2 +-
 drivers/net/wireless/atmel.c                   |    2 +-
 drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h |    2 +-
 drivers/net/wireless/ipw2200.c                 |    2 +-
 drivers/net/wireless/iwlwifi/iwl-4965.c        |    2 +-
 drivers/net/wireless/libertas/cmd.c            |    4 ++--
 drivers/net/wireless/libertas/scan.c           |    4 ++--
 drivers/net/wireless/netwave_cs.c              |    2 +-
 drivers/net/wireless/orinoco.h                 |    2 +-
 drivers/net/wireless/ray_cs.c                  |    2 +-
 drivers/net/wireless/rt2x00/rt2x00reg.h        |    2 +-
 drivers/net/wireless/rt2x00/rt2x00usb.h        |    6 +++---
 drivers/net/wireless/rt2x00/rt73usb.c          |    2 +-
 drivers/net/wireless/wavelan_cs.c              |    2 +-
 drivers/net/wireless/zd1211rw/zd_chip.h        |    4 ++--
 drivers/net/yellowfin.c                        |    2 +-
 87 files changed, 120 insertions(+), 120 deletions(-)

diff --git a/drivers/net/82596.c b/drivers/net/82596.c
index 2797da7..d999b63 100644
--- a/drivers/net/82596.c
+++ b/drivers/net/82596.c
@@ -19,7 +19,7 @@
    TBD:
    * look at deferring rx frames rather than discarding (as per tulip)
    * handle tx ring full as per tulip
-   * performace test to tune rx_copybreak
+   * performance test to tune rx_copybreak
 
    Most of my modifications relate to the braindead big-endian
    implementation by Intel.  When the i596 is operating in
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c
index e7fdd81..5cefe92 100644
--- a/drivers/net/amd8111e.c
+++ b/drivers/net/amd8111e.c
@@ -1283,7 +1283,7 @@ static irqreturn_t amd8111e_interrupt(int irq, void *dev_id)
 #ifdef CONFIG_AMD8111E_NAPI
 	if(intr0 & RINT0){
 		if(netif_rx_schedule_prep(dev, &lp->napi)){
-			/* Disable receive interupts */
+			/* Disable receive interrupts */
 			writel(RINTEN0, mmio + INTEN0);
 			/* Schedule a polling routine */
 			__netif_rx_schedule(dev, &lp->napi);
@@ -1493,7 +1493,7 @@ static void amd8111e_read_regs(struct amd8111e_priv *lp, u32 *buf)
 
 
 /*
-This function sets promiscuos mode, all-multi mode or the multicast address
+This function sets promiscuous mode, all-multi mode or the multicast address
 list to the device.
 */
 static void amd8111e_set_multicast_list(struct net_device *dev)
@@ -1522,7 +1522,7 @@ static void amd8111e_set_multicast_list(struct net_device *dev)
 		lp->mc_list = NULL;
 		lp->options &= ~OPTION_MULTICAST_ENABLE;
 		amd8111e_writeq(*(u64*)mc_filter,lp->mmio + LADRF);
-		/* disable promiscous mode */
+		/* disable promiscuous mode */
 		writel(PROM, lp->mmio + CMD2);
 		return;
 	}
@@ -2016,7 +2016,7 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev,
 	for(i = 0; i < ETH_ADDR_LEN; i++)
 		dev->dev_addr[i] = readb(lp->mmio + PADR + i);
 
-	/* Setting user defined parametrs */
+	/* Setting user defined parameters */
 	lp->ext_phy_option = speed_duplex[card_idx];
 	if(coalesce[card_idx])
 		lp->options |= OPTION_INTR_COAL_ENABLE;
diff --git a/drivers/net/amd8111e.h b/drivers/net/amd8111e.h
index 28c60a7..7d288de 100644
--- a/drivers/net/amd8111e.h
+++ b/drivers/net/amd8111e.h
@@ -614,7 +614,7 @@ typedef enum {
 #define CSTATE  1
 #define SSTATE  2
 
-/* Assume contoller gets data 10 times the maximum processing time */
+/* Assume controller gets data 10 times the maximum processing time */
 #define  REPEAT_CNT			10
 
 /* amd8111e decriptor flag definitions */
diff --git a/drivers/net/appletalk/ltpc.c b/drivers/net/appletalk/ltpc.c
index 6ab2c2d..86a9496 100644
--- a/drivers/net/appletalk/ltpc.c
+++ b/drivers/net/appletalk/ltpc.c
@@ -1233,7 +1233,7 @@ static int __init ltpc_setup(char *str)
 		if (ints[0] > 2) {
 			dma = ints[3];
 		}
-		/* ignore any other paramters */
+		/* ignore any other parameters */
 	}
 	return 1;
 }
diff --git a/drivers/net/atl1/atl1_hw.c b/drivers/net/atl1/atl1_hw.c
index 9d3bd22..82359f7 100644
--- a/drivers/net/atl1/atl1_hw.c
+++ b/drivers/net/atl1/atl1_hw.c
@@ -645,7 +645,7 @@ s32 atl1_init_hw(struct atl1_hw *hw)
 	atl1_init_flash_opcode(hw);
 
 	if (!hw->phy_configured) {
-		/* enable GPHY LinkChange Interrrupt */
+		/* enable GPHY LinkChange Interrupt */
 		ret_val = atl1_write_phy_reg(hw, 18, 0xC00);
 		if (ret_val)
 			return ret_val;
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 35b0a7d..7599163 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -575,7 +575,7 @@ static u32 atl1_check_link(struct atl1_adapter *adapter)
 		return ATL1_SUCCESS;
 	}
 
-	/* change orignal link status */
+	/* change original link status */
 	if (netif_carrier_ok(netdev)) {
 		adapter->link_speed = SPEED_0;
 		netif_carrier_off(netdev);
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index cb3c6fa..96f0f24 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -869,7 +869,7 @@ static int ad_lacpdu_send(struct port *port)
 	lacpdu_header = (struct lacpdu_header *)skb_put(skb, length);
 
 	lacpdu_header->ad_header.destination_address = lacpdu_multicast_address;
-	/* Note: source addres is set to be the member's PERMANENT address, because we use it
+	/* Note: source address is set to be the member's PERMANENT address, because we use it
 	   to identify loopback lacpdus in receive. */
 	lacpdu_header->ad_header.source_address = *((struct mac_addr *)(slave->perm_hwaddr));
 	lacpdu_header->ad_header.length_type = PKT_TYPE_LACPDU;
@@ -912,7 +912,7 @@ static int ad_marker_send(struct port *port, struct bond_marker *marker)
 	marker_header = (struct bond_marker_header *)skb_put(skb, length);
 
 	marker_header->ad_header.destination_address = lacpdu_multicast_address;
-	/* Note: source addres is set to be the member's PERMANENT address, because we use it
+	/* Note: source address is set to be the member's PERMANENT address, because we use it
 	   to identify loopback MARKERs in receive. */
 	marker_header->ad_header.source_address = *((struct mac_addr *)(slave->perm_hwaddr));
 	marker_header->ad_header.length_type = PKT_TYPE_LACPDU;
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c
index b301c04..ed17cd9 100644
--- a/drivers/net/chelsio/sge.c
+++ b/drivers/net/chelsio/sge.c
@@ -248,7 +248,7 @@ static void restart_sched(unsigned long);
  *
  * Interrupts are handled by a single CPU and it is likely that on a MP system
  * the application is migrated to another CPU. In that scenario, we try to
- * seperate the RX(in irq context) and TX state in order to decrease memory
+ * separate the RX(in irq context) and TX state in order to decrease memory
  * contention.
  */
 struct sge {
diff --git a/drivers/net/chelsio/subr.c b/drivers/net/chelsio/subr.c
index dc50151..7c95578 100644
--- a/drivers/net/chelsio/subr.c
+++ b/drivers/net/chelsio/subr.c
@@ -559,7 +559,7 @@ struct chelsio_vpd_t {
 #define EEPROM_MAX_POLL   4
 
 /*
- * Read SEEPROM. A zero is written to the flag register when the addres is
+ * Read SEEPROM. A zero is written to the flag register when the address is
  * written to the Control register. The hardware device will set the flag to a
  * one when 4B have been transferred to the Data register.
  */
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 522834c..2882e36 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -534,7 +534,7 @@ struct t3_vpd {
  *
  *	Read a 32-bit word from a location in VPD EEPROM using the card's PCI
  *	VPD ROM capability.  A zero is written to the flag bit when the
- *	addres is written to the control register.  The hardware device will
+ *	address is written to the control register.  The hardware device will
  *	set the flag to 1 when 4 bytes have been read into the data register.
  */
 int t3_seeprom_read(struct adapter *adapter, u32 addr, u32 *data)
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 7c6888c..fd7e6a8 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -803,7 +803,7 @@ e1000_initialize_hardware_bits(struct e1000_hw *hw)
                 E1000_WRITE_REG(hw, CTRL, reg_ctrl);
                 break;
             case e1000_80003es2lan:
-                /* improve small packet performace for fiber/serdes */
+                /* improve small packet performance for fiber/serdes */
                 if ((hw->media_type == e1000_media_type_fiber) ||
                     (hw->media_type == e1000_media_type_internal_serdes)) {
                     reg_tarc0 &= ~(1 << 20);
@@ -5001,7 +5001,7 @@ e1000_read_eeprom(struct e1000_hw *hw,
             return -E1000_ERR_EEPROM;
     }
 
-    /* Eerd register EEPROM access requires no eeprom aquire/release */
+    /* Eerd register EEPROM access requires no eeprom acquire/release */
     if (eeprom->use_eerd == TRUE)
         return e1000_read_eeprom_eerd(hw, offset, words, data);
 
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h
index a2a86c5..e40e515 100644
--- a/drivers/net/e1000/e1000_hw.h
+++ b/drivers/net/e1000/e1000_hw.h
@@ -1068,7 +1068,7 @@ struct e1000_ffvt_entry {
 
 #define E1000_KUMCTRLSTA 0x00034 /* MAC-PHY interface - RW */
 #define E1000_MDPHYA     0x0003C  /* PHY address - RW */
-#define E1000_MANC2H     0x05860  /* Managment Control To Host - RW */
+#define E1000_MANC2H     0x05860  /* Management Control To Host - RW */
 #define E1000_SW_FW_SYNC 0x05B5C /* Software-Firmware Synchronization - RW */
 
 #define E1000_GCR       0x05B00 /* PCI-Ex Control */
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 4f37506..24a2fc1 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -235,7 +235,7 @@ static struct pci_driver e1000_driver = {
 	.probe    = e1000_probe,
 	.remove   = __devexit_p(e1000_remove),
 #ifdef CONFIG_PM
-	/* Power Managment Hooks */
+	/* Power Management Hooks */
 	.suspend  = e1000_suspend,
 	.resume   = e1000_resume,
 #endif
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 4fd2e23..febe157 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -4109,7 +4109,7 @@ static struct pci_driver e1000_driver = {
 	.probe    = e1000_probe,
 	.remove   = __devexit_p(e1000_remove),
 #ifdef CONFIG_PM
-	/* Power Managment Hooks */
+	/* Power Management Hooks */
 	.suspend  = e1000_suspend,
 	.resume   = e1000_resume,
 #endif
diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c
index 83bda6c..d3789c5 100644
--- a/drivers/net/eepro.c
+++ b/drivers/net/eepro.c
@@ -1764,7 +1764,7 @@ module_param_array(io, int, NULL, 0);
 module_param_array(irq, int, NULL, 0);
 module_param_array(mem, int, NULL, 0);
 module_param(autodetect, int, 0);
-MODULE_PARM_DESC(io, "EtherExpress Pro/10 I/O base addres(es)");
+MODULE_PARM_DESC(io, "EtherExpress Pro/10 I/O base address(es)");
 MODULE_PARM_DESC(irq, "EtherExpress Pro/10 IRQ number(s)");
 MODULE_PARM_DESC(mem, "EtherExpress Pro/10 Rx buffer size(es) in kB (3-29)");
 MODULE_PARM_DESC(autodetect, "EtherExpress Pro/10 force board(s) detection (0-1)");
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index 5f82a46..a50b238 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -251,7 +251,7 @@ struct ehea_qp_init_attr {
 };
 
 /*
- * Event Queue attributes, passed as paramter
+ * Event Queue attributes, passed as parameter
  */
 struct ehea_eq_attr {
 	u32 type;
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index a96583c..7119332 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -490,7 +490,7 @@ union ring_type {
 #define NV_RX3_VLAN_TAG_PRESENT (1<<16)
 #define NV_RX3_VLAN_TAG_MASK	(0x0000FFFF)
 
-/* Miscelaneous hardware related defines: */
+/* Miscellaneous hardware related defines: */
 #define NV_PCI_REGSZ_VER1      	0x270
 #define NV_PCI_REGSZ_VER2      	0x2d4
 #define NV_PCI_REGSZ_VER3      	0x604
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c
index ed407c8..683b289 100644
--- a/drivers/net/hamachi.c
+++ b/drivers/net/hamachi.c
@@ -86,7 +86,7 @@ static int force32;
 static int options[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
 static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
 /* The Hamachi chipset supports 3 parameters each for Rx and Tx
- * interruput management.  Parameters will be loaded as specified into
+ * interrupt management.  Parameters will be loaded as specified into
  * the TxIntControl and RxIntControl registers.
  *
  * The registers are arranged as follows:
@@ -811,7 +811,7 @@ static int __devinit read_eeprom(void __iomem *ioaddr, int location)
 	return readb(ioaddr + EEData);
 }
 
-/* MII Managemen Data I/O accesses.
+/* MII Management Data I/O accesses.
    These routines assume the MDIO controller is idle, and do not exit until
    the command is finished. */
 
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c
index 49421d1..8b90d64 100644
--- a/drivers/net/hp100.c
+++ b/drivers/net/hp100.c
@@ -2643,7 +2643,7 @@ static int hp100_login_to_vg_hub(struct net_device *dev, u_short force_relogin)
 		} else {
 			hp100_andb(~HP100_PROM_MODE, VG_LAN_CFG_2);
 			/* For ETR parts we need to reset the prom. bit in the training
-			 * register, otherwise promiscious mode won't be disabled.
+			 * register, otherwise promiscuous mode won't be disabled.
 			 */
 			if (lp->chip == HP100_CHIPID_LASSEN) {
 				hp100_andw(~HP100_MACRQ_PROMSC, TRAIN_REQUEST);
diff --git a/drivers/net/hp100.h b/drivers/net/hp100.h
index e6ca128..e74e45d 100644
--- a/drivers/net/hp100.h
+++ b/drivers/net/hp100.h
@@ -476,7 +476,7 @@
 #define HP100_MACRQ_REPEATER         0x0001	/* 1: MAC tells HUB it wants to be
 						 *    a cascaded repeater
 						 * 0: ... wants to be a DTE */
-#define HP100_MACRQ_PROMSC           0x0006	/* 2 bits: Promiscious mode
+#define HP100_MACRQ_PROMSC           0x0006	/* 2 bits: Promiscuous mode
 						 * 00: Rcv only unicast packets
 						 *     specifically addr to this
 						 *     endnode
@@ -488,7 +488,7 @@
 #define HP100_CARD_MACVER            0xe000	/* R: 3 bit Cards 100VG MAC version */
 #define HP100_MALLOW_REPEATER        0x0001	/* If reset, requested access as an
 						 * end node is allowed */
-#define HP100_MALLOW_PROMSC          0x0004	/* 2 bits: Promiscious mode
+#define HP100_MALLOW_PROMSC          0x0004	/* 2 bits: Promiscuous mode
 						 * 00: Rcv only unicast packets
 						 *     specifically addr to this
 						 *     endnode
diff --git a/drivers/net/ibm_emac/ibm_emac.h b/drivers/net/ibm_emac/ibm_emac.h
index 97ed22b..655be50 100644
--- a/drivers/net/ibm_emac/ibm_emac.h
+++ b/drivers/net/ibm_emac/ibm_emac.h
@@ -1,7 +1,7 @@
 /*
  * drivers/net/ibm_emac/ibm_emac.h
  *
- * Register definitions for PowerPC 4xx on-chip ethernet contoller
+ * Register definitions for PowerPC 4xx on-chip ethernet controller
  *
  * Copyright (c) 2004, 2005 Zultys Technologies.
  * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
diff --git a/drivers/net/ibm_newemac/emac.h b/drivers/net/ibm_newemac/emac.h
index 91cb096..49a540a 100644
--- a/drivers/net/ibm_newemac/emac.h
+++ b/drivers/net/ibm_newemac/emac.h
@@ -1,7 +1,7 @@
 /*
  * drivers/net/ibm_newemac/emac.h
  *
- * Register definitions for PowerPC 4xx on-chip ethernet contoller
+ * Register definitions for PowerPC 4xx on-chip ethernet controller
  *
  * Copyright 2007 Benjamin Herrenschmidt, IBM Corp.
  *                <benh@kernel.crashing.org>
diff --git a/drivers/net/ibmlana.c b/drivers/net/ibmlana.c
index 91d83ac..5a9b6fa 100644
--- a/drivers/net/ibmlana.c
+++ b/drivers/net/ibmlana.c
@@ -481,7 +481,7 @@ static void InitBoard(struct net_device *dev)
 	if ((dev->flags & IFF_ALLMULTI) || (mcptr != NULL))
 		rcrval |= RCREG_AMC;
 
-	/* promiscous mode ? */
+	/* promiscuous mode ? */
 
 	if (dev->flags & IFF_PROMISC)
 		rcrval |= RCREG_PRO;
diff --git a/drivers/net/ibmlana.h b/drivers/net/ibmlana.h
index aa3ddbd..654af95 100644
--- a/drivers/net/ibmlana.h
+++ b/drivers/net/ibmlana.h
@@ -90,7 +90,7 @@ typedef struct {
 #define RCREG_ERR        0x8000	/* accept damaged and collided pkts */
 #define RCREG_RNT        0x4000	/* accept packets that are < 64     */
 #define RCREG_BRD        0x2000	/* accept broadcasts                */
-#define RCREG_PRO        0x1000	/* promiscous mode                  */
+#define RCREG_PRO        0x1000	/* promiscuous mode                 */
 #define RCREG_AMC        0x0800	/* accept all multicasts            */
 #define RCREG_LB_NONE    0x0000	/* no loopback                      */
 #define RCREG_LB_MAC     0x0200	/* MAC loopback                     */
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index dbd23bb..27d12eb 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -209,7 +209,7 @@ static int mdio_read(struct net_device * dev, int phy_id, int phy_reg)
 {
 	void __iomem *ioaddr = ipg_ioaddr(dev);
 	/*
-	 * The GMII mangement frame structure for a read is as follows:
+	 * The GMII management frame structure for a read is as follows:
 	 *
 	 * |Preamble|st|op|phyad|regad|ta|      data      |idle|
 	 * |< 32 1s>|01|10|AAAAA|RRRRR|z0|DDDDDDDDDDDDDDDD|z   |
@@ -300,7 +300,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int phy_reg, int val)
 {
 	void __iomem *ioaddr = ipg_ioaddr(dev);
 	/*
-	 * The GMII mangement frame structure for a read is as follows:
+	 * The GMII management frame structure for a read is as follows:
 	 *
 	 * |Preamble|st|op|phyad|regad|ta|      data      |idle|
 	 * |< 32 1s>|01|10|AAAAA|RRRRR|z0|DDDDDDDDDDDDDDDD|z   |
diff --git a/drivers/net/irda/ali-ircc.c b/drivers/net/irda/ali-ircc.c
index 9f58452..94140f7 100644
--- a/drivers/net/irda/ali-ircc.c
+++ b/drivers/net/irda/ali-ircc.c
@@ -977,7 +977,7 @@ static void ali_ircc_change_speed(struct ali_ircc_cb *self, __u32 baud)
 		/* Install FIR xmit handler*/
 		dev->hard_start_xmit = ali_ircc_fir_hard_xmit;		
 				
-		/* Enable Interuupt */
+		/* Enable Interrupt */
 		self->ier = IER_EOM; // benjamin 2000/11/20 07:24PM					
 				
 		/* Be ready for incomming frames */
@@ -1096,7 +1096,7 @@ static void ali_ircc_sir_change_speed(struct ali_ircc_cb *priv, __u32 speed)
 	outb(lcr,		  iobase+UART_LCR); /* Set 8N1	*/
 	outb(fcr,		  iobase+UART_FCR); /* Enable FIFO's */
 
-	/* without this, the conection will be broken after come back from FIR speed,
+	/* without this, the connection will be broken after come back from FIR speed,
 	   but with this, the SIR connection is harder to established */
 	outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), iobase+UART_MCR);
 	
@@ -1359,7 +1359,7 @@ static int ali_ircc_net_open(struct net_device *dev)
 		return -EAGAIN;
 	}
 	
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	outb(UART_IER_RDI , iobase+UART_IER);
 
 	/* Ready to play! */
diff --git a/drivers/net/irda/ali-ircc.h b/drivers/net/irda/ali-ircc.h
index e489c66..0787657 100644
--- a/drivers/net/irda/ali-ircc.h
+++ b/drivers/net/irda/ali-ircc.h
@@ -173,13 +173,13 @@ struct st_fifo {
 
 struct frame_cb {
 	void *start; /* Start of frame in DMA mem */
-	int len;     /* Lenght of frame in DMA mem */
+	int len;     /* Length of frame in DMA mem */
 };
 
 struct tx_fifo {
 	struct frame_cb queue[MAX_TX_WINDOW]; /* Info about frames in queue */
 	int             ptr;                  /* Currently being sent */
-	int             len;                  /* Lenght of queue */
+	int             len;                  /* Length of queue */
 	int             free;                 /* Next free slot */
 	void           *tail;                 /* Next free start in DMA mem */
 };
diff --git a/drivers/net/irda/donauboe.h b/drivers/net/irda/donauboe.h
index 1e67720..9db3cce 100644
--- a/drivers/net/irda/donauboe.h
+++ b/drivers/net/irda/donauboe.h
@@ -30,7 +30,7 @@
  *     or the type-DO IR port.
  *
  * IrDA chip set list from Toshiba Computer Engineering Corp.
- * model			method	maker	controler		Version 
+ * model			method	maker	controller		Version 
  * Portege 320CT	FIR,SIR Toshiba Oboe(Triangle) 
  * Portege 3010CT	FIR,SIR Toshiba Oboe(Sydney) 
  * Portege 3015CT	FIR,SIR Toshiba Oboe(Sydney) 
diff --git a/drivers/net/irda/irport.c b/drivers/net/irda/irport.c
index c79caa5..2b2a955 100644
--- a/drivers/net/irda/irport.c
+++ b/drivers/net/irda/irport.c
@@ -276,7 +276,7 @@ static void irport_start(struct irport_cb *self)
 	outb(UART_LCR_WLEN8, iobase+UART_LCR);  /* Reset DLAB */
 	outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), iobase+UART_MCR);
 	
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	outb(UART_IER_RLSI | UART_IER_RDI |UART_IER_THRI, iobase+UART_IER);
 }
 
@@ -352,7 +352,7 @@ static void irport_change_speed(void *priv, __u32 speed)
 	outb(lcr,		  iobase+UART_LCR); /* Set 8N1	*/
 	outb(fcr,		  iobase+UART_FCR); /* Enable FIFO's */
 
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	/* This will generate a fatal interrupt storm.
 	 * People calling us will do that properly - Jean II */
 	//outb(/*UART_IER_RLSI|*/UART_IER_RDI/*|UART_IER_THRI*/, iobase+UART_IER);
diff --git a/drivers/net/irda/nsc-ircc.h b/drivers/net/irda/nsc-ircc.h
index bbdc97f..29398a4 100644
--- a/drivers/net/irda/nsc-ircc.h
+++ b/drivers/net/irda/nsc-ircc.h
@@ -231,13 +231,13 @@ struct st_fifo {
 
 struct frame_cb {
 	void *start; /* Start of frame in DMA mem */
-	int len;     /* Lenght of frame in DMA mem */
+	int len;     /* Length of frame in DMA mem */
 };
 
 struct tx_fifo {
 	struct frame_cb queue[MAX_TX_WINDOW]; /* Info about frames in queue */
 	int             ptr;                  /* Currently being sent */
-	int             len;                  /* Lenght of queue */
+	int             len;                  /* Length of queue */
 	int             free;                 /* Next free slot */
 	void           *tail;                 /* Next free start in DMA mem */
 };
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c
index 7e7b582..7fd9a48 100644
--- a/drivers/net/irda/smsc-ircc2.c
+++ b/drivers/net/irda/smsc-ircc2.c
@@ -1165,7 +1165,7 @@ void smsc_ircc_set_sir_speed(struct smsc_ircc_cb *self, __u32 speed)
 	outb(lcr,		  iobase + UART_LCR); /* Set 8N1 */
 	outb(fcr,		  iobase + UART_FCR); /* Enable FIFO's */
 
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	outb(UART_IER_RLSI | UART_IER_RDI | UART_IER_THRI, iobase + UART_IER);
 
 	IRDA_DEBUG(2, "%s() speed changed to: %d\n", __FUNCTION__, speed);
@@ -1930,7 +1930,7 @@ void smsc_ircc_sir_start(struct smsc_ircc_cb *self)
 	outb(UART_LCR_WLEN8, sir_base + UART_LCR);  /* Reset DLAB */
 	outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), sir_base + UART_MCR);
 
-	/* Turn on interrups */
+	/* Turn on interrupts */
 	outb(UART_IER_RLSI | UART_IER_RDI |UART_IER_THRI, sir_base + UART_IER);
 
 	IRDA_DEBUG(3, "%s() - exit\n", __FUNCTION__);
diff --git a/drivers/net/irda/via-ircc.h b/drivers/net/irda/via-ircc.h
index 204b1b3..9d012f0 100644
--- a/drivers/net/irda/via-ircc.h
+++ b/drivers/net/irda/via-ircc.h
@@ -54,13 +54,13 @@ struct st_fifo {
 
 struct frame_cb {
 	void *start;		/* Start of frame in DMA mem */
-	int len;		/* Lenght of frame in DMA mem */
+	int len;		/* Length of frame in DMA mem */
 };
 
 struct tx_fifo {
 	struct frame_cb queue[MAX_TX_WINDOW + 2];	/* Info about frames in queue */
 	int ptr;		/* Currently being sent */
-	int len;		/* Lenght of queue */
+	int len;		/* Length of queue */
 	int free;		/* Next free slot */
 	void *tail;		/* Next free start in DMA mem */
 };
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c
index 512e3b2..4b6359e 100644
--- a/drivers/net/ixgbe/ixgbe_common.c
+++ b/drivers/net/ixgbe/ixgbe_common.c
@@ -716,7 +716,7 @@ static s32 ixgbe_init_rx_addrs(struct ixgbe_hw *hw)
  *  bit-vector to set in the multicast table. The hardware uses 12 bits, from
  *  incoming rx multicast addresses, to determine the bit-vector to check in
  *  the MTA. Which of the 4 combination, of 12-bits, the hardware uses is set
- *  by the MO field of the MCSTCTRL. The MO field is set during initalization
+ *  by the MO field of the MCSTCTRL. The MO field is set during initialization
  *  to mc_filter_type.
  **/
 static s32 ixgbe_mta_vector(struct ixgbe_hw *hw, u8 *mc_addr)
@@ -1066,7 +1066,7 @@ s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw)
 
 
 /**
- *  ixgbe_acquire_swfw_sync - Aquire SWFW semaphore
+ *  ixgbe_acquire_swfw_sync - Acquire SWFW semaphore
  *  @hw: pointer to hardware structure
  *  @mask: Mask to specify wich semaphore to acquire
  *
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 00bc525..25a9cc2 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -592,7 +592,7 @@ quit_polling:
  * ixgbe_setup_msix - Initialize MSI-X interrupts
  *
  * ixgbe_setup_msix allocates MSI-X vectors and requests
- * interrutps from the kernel.
+ * interrupts from the kernel.
  **/
 static int ixgbe_setup_msix(struct ixgbe_adapter *adapter)
 {
diff --git a/drivers/net/lasi_82596.c b/drivers/net/lasi_82596.c
index efbae4b..1ba38c2 100644
--- a/drivers/net/lasi_82596.c
+++ b/drivers/net/lasi_82596.c
@@ -47,7 +47,7 @@
    TBD:
    * look at deferring rx frames rather than discarding (as per tulip)
    * handle tx ring full as per tulip
-   * performace test to tune rx_copybreak
+   * performance test to tune rx_copybreak
 
    Most of my modifications relate to the braindead big-endian
    implementation by Intel.  When the i596 is operating in
diff --git a/drivers/net/lib82596.c b/drivers/net/lib82596.c
index b59f442..c335d31 100644
--- a/drivers/net/lib82596.c
+++ b/drivers/net/lib82596.c
@@ -47,7 +47,7 @@
    TBD:
    * look at deferring rx frames rather than discarding (as per tulip)
    * handle tx ring full as per tulip
-   * performace test to tune rx_copybreak
+   * performance test to tune rx_copybreak
 
    Most of my modifications relate to the braindead big-endian
    implementation by Intel.  When the i596 is operating in
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 047ea7b..1367178 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -239,7 +239,7 @@ static int macb_mii_init(struct macb *bp)
 	struct eth_platform_data *pdata;
 	int err = -ENXIO, i;
 
-	/* Enable managment port */
+	/* Enable management port */
 	macb_writel(bp, NCR, MACB_BIT(MPE));
 
 	bp->mii_bus.name = "MACB_mii_bus",
diff --git a/drivers/net/meth.h b/drivers/net/meth.h
index a78dc1c..ecd0e97 100644
--- a/drivers/net/meth.h
+++ b/drivers/net/meth.h
@@ -127,7 +127,7 @@ typedef struct rx_packet {
 #define METH_ACCEPT_MY 0			/* 00: Accept PHY address only */
 #define METH_ACCEPT_MCAST 0x20	/* 01: Accept physical, broadcast, and multicast filter matches only */
 #define METH_ACCEPT_AMCAST 0x40	/* 10: Accept physical, broadcast, and all multicast packets */
-#define METH_PROMISC 0x60		/* 11: Promiscious mode */
+#define METH_PROMISC 0x60		/* 11: Promiscuous mode */
 
 #define METH_PHY_LINK_FAIL	BIT(7) /* 0: Link failure detection disabled, 1: Hardware scans for link failure in PHY */
 
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 651c269..c263c91 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -535,7 +535,7 @@ struct mv643xx_private {
 
 	int rx_resource_err;		/* Rx ring resource error flag */
 
-	/* Tx/Rx rings managment indexes fields. For driver use */
+	/* Tx/Rx rings management indexes fields. For driver use */
 
 	/* Next available and first returning Rx resource */
 	int rx_curr_desc_q, rx_used_desc_q;
@@ -757,7 +757,7 @@ static void mv643xx_eth_update_mac_address(struct net_device *dev)
 /*
  * mv643xx_eth_set_rx_mode
  *
- * Change from promiscuos to regular rx mode
+ * Change from promiscuous to regular rx mode
  *
  * Input :	pointer to ethernet interface network device structure
  * Output :	N/A
diff --git a/drivers/net/netxen/netxen_nic_hw.h b/drivers/net/netxen/netxen_nic_hw.h
index 245bf13..236160a 100644
--- a/drivers/net/netxen/netxen_nic_hw.h
+++ b/drivers/net/netxen/netxen_nic_hw.h
@@ -429,7 +429,7 @@ typedef enum {
 #define netxen_get_niu_enable_ge(config_word)	\
 		_netxen_crb_get_bit(config_word, 1)
 
-/* Promiscous mode options (GbE mode only) */
+/* Promiscuous mode options (GbE mode only) */
 typedef enum {
 	NETXEN_NIU_PROMISC_MODE = 0,
 	NETXEN_NIU_NON_PROMISC_MODE
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index 4f69037..9e1890f 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -2368,7 +2368,7 @@ find_compressor(int type)
 }
 
 /*
- * Miscelleneous stuff.
+ * Miscellaneous stuff.
  */
 
 static void
diff --git a/drivers/net/ps3_gelic_net.c b/drivers/net/ps3_gelic_net.c
index 0a42bf5..5efc5b4 100644
--- a/drivers/net/ps3_gelic_net.c
+++ b/drivers/net/ps3_gelic_net.c
@@ -1271,7 +1271,7 @@ static struct ethtool_ops gelic_net_ethtool_ops = {
 /**
  * gelic_net_tx_timeout_task - task scheduled by the watchdog timeout
  * function (to be called not under interrupt status)
- * @work: work is context of tx timout task
+ * @work: work is context of tx timeout task
  *
  * called as task when tx hangs, resets interface (if interface is up)
  */
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index a579111..da85b7f 100644
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -3691,7 +3691,7 @@ static int ql_adapter_up(struct ql3_adapter *qdev)
 		ql_sem_unlock(qdev, QL_DRVR_SEM_MASK);
 	} else {
 		printk(KERN_ERR PFX
-		       "%s: Could not aquire driver lock.\n",
+		       "%s: Could not acquire driver lock.\n",
 		       ndev->name);
 		goto err_lock;
 	}
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h
index cc1797a..63d45d4 100644
--- a/drivers/net/s2io.h
+++ b/drivers/net/s2io.h
@@ -740,7 +740,7 @@ struct mac_info {
 	u16 mc_pause_threshold_q0q3;
 	u16 mc_pause_threshold_q4q7;
 
-	void *stats_mem;	/* orignal pointer to allocated mem */
+	void *stats_mem;	/* original pointer to allocated mem */
 	dma_addr_t stats_mem_phy;	/* Physical address of the stat block */
 	u32 stats_mem_sz;
 	struct stat_block *stats_info;	/* Logical address of the stat block */
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
index 7200883..ff559e4 100644
--- a/drivers/net/sis190.c
+++ b/drivers/net/sis190.c
@@ -102,7 +102,7 @@ enum sis190_registers {
 	IntrStatus		= 0x20,
 	IntrMask		= 0x24,
 	IntrControl		= 0x28,
-	IntrTimer		= 0x2c,	// unused (Interupt Timer)
+	IntrTimer		= 0x2c,	// unused (Interrupt Timer)
 	PMControl		= 0x30,	// unused (Power Mgmt Control/Status)
 	rsv2			= 0x34,	// reserved
 	ROMControl		= 0x38,
diff --git a/drivers/net/sk98lin/skgepnmi.c b/drivers/net/sk98lin/skgepnmi.c
index b36dd9a..c761ff7 100644
--- a/drivers/net/sk98lin/skgepnmi.c
+++ b/drivers/net/sk98lin/skgepnmi.c
@@ -356,7 +356,7 @@ int Level)		/* Initialization level */
 	unsigned int	PortMax;	/* Number of ports */
 	unsigned int	PortIndex;	/* Current port index in loop */
 	SK_U16		Val16;		/* Multiple purpose 16 bit variable */
-	SK_U8		Val8;		/* Mulitple purpose 8 bit variable */
+	SK_U8		Val8;		/* Multiple purpose 8 bit variable */
 	SK_EVPARA	EventParam;	/* Event struct for timer event */
 	SK_PNMI_VCT	*pVctBackupData;
 
diff --git a/drivers/net/sk98lin/skxmac2.c b/drivers/net/sk98lin/skxmac2.c
index b4e7502..3994289 100644
--- a/drivers/net/sk98lin/skxmac2.c
+++ b/drivers/net/sk98lin/skxmac2.c
@@ -3891,7 +3891,7 @@ int SkXmOverflowStatus(
 SK_AC	*pAC,				/* adapter context */
 SK_IOC	IoC,				/* IO context */
 unsigned int Port,			/* Port Index (MAC_1 + n) */
-SK_U16	IStatus,			/* Interupt Status from MAC */
+SK_U16	IStatus,			/* Interrupt Status from MAC */
 SK_U64	SK_FAR *pStatus)	/* ptr for return overflow status value */
 {
 	SK_U64	Status;	/* Overflow status */
@@ -4036,7 +4036,7 @@ int SkGmOverflowStatus(
 SK_AC	*pAC,				/* adapter context */
 SK_IOC	IoC,				/* IO context */
 unsigned int Port,			/* Port Index (MAC_1 + n) */
-SK_U16	IStatus,			/* Interupt Status from MAC */
+SK_U16	IStatus,			/* Interrupt Status from MAC */
 SK_U64	SK_FAR *pStatus)	/* ptr for return overflow status value */
 {
 	SK_U64	Status;		/* Overflow status */
diff --git a/drivers/net/skfp/ess.c b/drivers/net/skfp/ess.c
index 62b0132..889f987 100644
--- a/drivers/net/skfp/ess.c
+++ b/drivers/net/skfp/ess.c
@@ -598,7 +598,7 @@ static void ess_send_alc_req(struct s_smc *smc)
 	req->cmd.sba_cmd = REQUEST_ALLOCATION ;
 
 	/*
-	 * set the parameter type and parameter lenght of all used
+	 * set the parameter type and parameter length of all used
 	 * parameters
 	 */
 
diff --git a/drivers/net/skfp/fplustm.c b/drivers/net/skfp/fplustm.c
index a45205d..b27a895 100644
--- a/drivers/net/skfp/fplustm.c
+++ b/drivers/net/skfp/fplustm.c
@@ -398,7 +398,7 @@ static void copy_tx_mac(struct s_smc *smc, u_long td, struct fddi_mac *mac,
 /* u_long td;		 transmit descriptor */
 /* struct fddi_mac *mac; mac frame pointer */
 /* unsigned off;	 start address within buffer memory */
-/* int len ;		 lenght of the frame including the FC */
+/* int len ;		 length of the frame including the FC */
 {
 	int	i ;
 	u_int	*p ;
@@ -1262,8 +1262,8 @@ Function	DOWNCALL/INTERN	(SMT, fplustm.c)
 
 Para	mode =	1	RX_ENABLE_ALLMULTI	enable all multicasts
 		2	RX_DISABLE_ALLMULTI	disable "enable all multicasts"
-		3	RX_ENABLE_PROMISC	enable promiscous
-		4	RX_DISABLE_PROMISC	disable promiscous
+		3	RX_ENABLE_PROMISC	enable promiscuous
+		4	RX_DISABLE_PROMISC	disable promiscuous
 		5	RX_ENABLE_NSA		enable reception of NSA frames
 		6	RX_DISABLE_NSA		disable reception of NSA frames
 
diff --git a/drivers/net/skfp/h/fplustm.h b/drivers/net/skfp/h/fplustm.h
index 98bbf65..586f055 100644
--- a/drivers/net/skfp/h/fplustm.h
+++ b/drivers/net/skfp/h/fplustm.h
@@ -237,8 +237,8 @@ struct s_smt_fp {
  */
 #define RX_ENABLE_ALLMULTI	1	/* enable all multicasts */
 #define RX_DISABLE_ALLMULTI	2	/* disable "enable all multicasts" */
-#define RX_ENABLE_PROMISC	3	/* enable promiscous */
-#define RX_DISABLE_PROMISC	4	/* disable promiscous */
+#define RX_ENABLE_PROMISC	3	/* enable promiscuous */
+#define RX_DISABLE_PROMISC	4	/* disable promiscuous */
 #define RX_ENABLE_NSA		5	/* enable reception of NSA frames */
 #define RX_DISABLE_NSA		6	/* disable reception of NSA frames */
 
diff --git a/drivers/net/skfp/h/smt.h b/drivers/net/skfp/h/smt.h
index 1ff5899..2976757 100644
--- a/drivers/net/skfp/h/smt.h
+++ b/drivers/net/skfp/h/smt.h
@@ -413,7 +413,7 @@ struct smt_p_reason {
 #define SMT_RDF_SUCCESS	0x00000003	/* success (PMF) */
 #define SMT_RDF_BADSET	0x00000004	/* bad set count (PMF) */
 #define SMT_RDF_ILLEGAL 0x00000005	/* read only (PMF) */
-#define SMT_RDF_NOPARAM	0x6		/* paramter not supported (PMF) */
+#define SMT_RDF_NOPARAM	0x6		/* parameter not supported (PMF) */
 #define SMT_RDF_RANGE	0x8		/* out of range */
 #define SMT_RDF_AUTHOR	0x9		/* not autohorized */
 #define SMT_RDF_LENGTH	0x0a		/* length error */
diff --git a/drivers/net/skfp/h/supern_2.h b/drivers/net/skfp/h/supern_2.h
index 5ba0b83..1074f96 100644
--- a/drivers/net/skfp/h/supern_2.h
+++ b/drivers/net/skfp/h/supern_2.h
@@ -386,7 +386,7 @@ struct tx_queue {
 #define	FM_MDISRCV	(4<<8)		/* disable receive function */
 #define	FM_MRES0	(5<<8)		/* reserve */
 #define	FM_MLIMPROM	(6<<8)		/* limited-promiscuous mode */
-#define FM_MPROMISCOUS	(7<<8)		/* address detection : promiscous */
+#define FM_MPROMISCOUS	(7<<8)		/* address detection : promiscuous */
 
 #define FM_SELSA	0x0800		/* select-short-address bit */
 
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 76cc1d3..648b904 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -466,7 +466,7 @@ static inline void	 smc911x_rcv(struct net_device *dev)
 		/* Align IP header to 32 bits
 		 * Note that the device is configured to add a 2
 		 * byte padding to the packet start, so we really
-		 * want to write to the orignal data pointer */
+		 * want to write to the original data pointer */
 		data = skb->data;
 		skb_reserve(skb, 2);
 		skb_put(skb,pkt_len-4);
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
index bccae7e..7a7f5cd 100644
--- a/drivers/net/spider_net.c
+++ b/drivers/net/spider_net.c
@@ -1826,7 +1826,7 @@ spider_net_enable_card(struct spider_net_card *card)
 
 	spider_net_write_reg(card, SPIDER_NET_ECMODE, SPIDER_NET_ECMODE_VALUE);
 
-	/* set chain tail adress for RX chains and
+	/* set chain tail address for RX chains and
 	 * enable DMA */
 	spider_net_enable_rxchtails(card);
 	spider_net_enable_rxdmac(card);
diff --git a/drivers/net/sunbmac.h b/drivers/net/sunbmac.h
index b563d3c..681442b 100644
--- a/drivers/net/sunbmac.h
+++ b/drivers/net/sunbmac.h
@@ -185,7 +185,7 @@
 #define BIGMAC_RXCFG_ENABLE    0x00000001 /* Enable the receiver                      */
 #define BIGMAC_RXCFG_FIFO      0x0000000e /* Default rx fthresh...                    */
 #define BIGMAC_RXCFG_PSTRIP    0x00000020 /* Pad byte strip enable                    */
-#define BIGMAC_RXCFG_PMISC     0x00000040 /* Enable promiscous mode                   */
+#define BIGMAC_RXCFG_PMISC     0x00000040 /* Enable promiscuous mode                  */
 #define BIGMAC_RXCFG_DERR      0x00000080 /* Disable error checking                   */
 #define BIGMAC_RXCFG_DCRCS     0x00000100 /* Disable CRC stripping                    */
 #define BIGMAC_RXCFG_ME        0x00000200 /* Receive packets addressed to me          */
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 6887214..097a065 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -780,7 +780,7 @@ static int gem_rx(struct gem *gp, int work_to_do)
 			break;
 
 		/* When writing back RX descriptor, GEM writes status
-		 * then buffer address, possibly in seperate transactions.
+		 * then buffer address, possibly in separate transactions.
 		 * If we don't wait for the chip to write both, we could
 		 * post a new buffer to this descriptor then have GEM spam
 		 * on the buffer address.  We sync on the RX completion
diff --git a/drivers/net/sunhme.h b/drivers/net/sunhme.h
index 90f446d..68bf4e1 100644
--- a/drivers/net/sunhme.h
+++ b/drivers/net/sunhme.h
@@ -223,7 +223,7 @@
 /* BigMac receive config register. */
 #define BIGMAC_RXCFG_ENABLE   0x00000001 /* Enable the receiver             */
 #define BIGMAC_RXCFG_PSTRIP   0x00000020 /* Pad byte strip enable           */
-#define BIGMAC_RXCFG_PMISC    0x00000040 /* Enable promiscous mode          */
+#define BIGMAC_RXCFG_PMISC    0x00000040 /* Enable promiscuous mode         */
 #define BIGMAC_RXCFG_DERR     0x00000080 /* Disable error checking          */
 #define BIGMAC_RXCFG_DCRCS    0x00000100 /* Disable CRC stripping           */
 #define BIGMAC_RXCFG_REJME    0x00000200 /* Reject packets addressed to me  */
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c
index d887c05..0fbf96d 100644
--- a/drivers/net/tc35815.c
+++ b/drivers/net/tc35815.c
@@ -136,7 +136,7 @@ struct tc35815_regs {
 #define DMA_RxAlign_2          0x00800000
 #define DMA_RxAlign_3          0x00c00000
 #define DMA_M66EnStat          0x00080000 /* 1:66MHz Enable State            */
-#define DMA_IntMask            0x00040000 /* 1:Interupt mask                 */
+#define DMA_IntMask            0x00040000 /* 1:Interrupt mask                 */
 #define DMA_SWIntReq           0x00020000 /* 1:Software Interrupt request    */
 #define DMA_TxWakeUp           0x00010000 /* 1:Transmit Wake Up              */
 #define DMA_RxBigE             0x00008000 /* 1:Receive Big Endian            */
@@ -281,7 +281,7 @@ struct tc35815_regs {
 #define Int_IntMacTx           0x00000001 /* 1:Tx controller & Clear         */
 
 /* MD_CA bit asign --------------------------------------------------------- */
-#define MD_CA_PreSup           0x00001000 /* 1:Preamble Supress              */
+#define MD_CA_PreSup           0x00001000 /* 1:Preamble Suppress             */
 #define MD_CA_Busy             0x00000800 /* 1:Busy (Start Operation)        */
 #define MD_CA_Wr               0x00000400 /* 1:Write 0:Read                  */
 
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c
index 21230c9..3ed1973 100644
--- a/drivers/net/tehuti.c
+++ b/drivers/net/tehuti.c
@@ -276,7 +276,7 @@ static irqreturn_t bdx_isr_napi(int irq, void *dev)
 			 * currently intrs are disabled (since we read ISR),
 			 * and we have failed to register next poll.
 			 * so we read the regs to trigger chip
-			 * and allow further interupts. */
+			 * and allow further interrupts. */
 			READ_REG(priv, regTXF_WPTR_0);
 			READ_REG(priv, regRXD_WPTR_0);
 		}
diff --git a/drivers/net/tehuti.h b/drivers/net/tehuti.h
index efd170f..992efa6 100644
--- a/drivers/net/tehuti.h
+++ b/drivers/net/tehuti.h
@@ -510,7 +510,7 @@ struct txd_desc {
 #define  GMAC_RX_FILTER_ACRC  0x0010	/* accept crc error */
 #define  GMAC_RX_FILTER_AM    0x0008	/* accept multicast */
 #define  GMAC_RX_FILTER_AB    0x0004	/* accept broadcast */
-#define  GMAC_RX_FILTER_PRM   0x0001	/* [0:1] promiscous mode */
+#define  GMAC_RX_FILTER_PRM   0x0001	/* [0:1] promiscuous mode */
 
 #define  MAX_FRAME_AB_VAL       0x3fff	/* 13:0 */
 
diff --git a/drivers/net/tokenring/3c359.c b/drivers/net/tokenring/3c359.c
index 5d31519..9d7a0c9 100644
--- a/drivers/net/tokenring/3c359.c
+++ b/drivers/net/tokenring/3c359.c
@@ -75,7 +75,7 @@ static char version[] __devinitdata  =
 MODULE_AUTHOR("Mike Phillips <mikep@linuxtr.net>") ; 
 MODULE_DESCRIPTION("3Com 3C359 Velocity XL Token Ring Adapter Driver \n") ;
 
-/* Module paramters */
+/* Module parameters */
 
 /* Ring Speed 0,4,16 
  * 0 = Autosense   
diff --git a/drivers/net/tokenring/lanstreamer.c b/drivers/net/tokenring/lanstreamer.c
index 47d84cd..21c4f3c 100644
--- a/drivers/net/tokenring/lanstreamer.c
+++ b/drivers/net/tokenring/lanstreamer.c
@@ -170,7 +170,7 @@ static char *open_min_error[] = {
 	"Monitor Contention failer for RPL", "FDX Protocol Error"
 };
 
-/* Module paramters */
+/* Module parameters */
 
 /* Ring Speed 0,4,16
  * 0 = Autosense         
diff --git a/drivers/net/tokenring/olympic.c b/drivers/net/tokenring/olympic.c
index 74c1f0f..b1178f1 100644
--- a/drivers/net/tokenring/olympic.c
+++ b/drivers/net/tokenring/olympic.c
@@ -132,7 +132,7 @@ static char *open_min_error[] = {"No error", "Function Failure", "Signal Lost",
 				   "Reserved", "Reserved", "No Monitor Detected for RPL", 
 				   "Monitor Contention failer for RPL", "FDX Protocol Error"};
 
-/* Module paramters */
+/* Module parameters */
 
 MODULE_AUTHOR("Mike Phillips <mikep@linuxtr.net>") ; 
 MODULE_DESCRIPTION("Olympic PCI/Cardbus Chipset Driver") ; 
diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c
index 93da3a3..4238a61 100644
--- a/drivers/net/tokenring/smctr.c
+++ b/drivers/net/tokenring/smctr.c
@@ -2426,7 +2426,7 @@ static irqreturn_t smctr_interrupt(int irq, void *dev_id)
                                 break ;
 
                         /* Type 0x0E - TRC Initialization Sequence Interrupt
-                         * Subtype -- 00-FF Initializatin sequence complete
+                         * Subtype -- 00-FF Initialization sequence complete
                          */
                         case ISB_IMC_TRC_INTRNL_TST_STATUS:
                                 tp->status = INITIALIZED;
@@ -3055,8 +3055,8 @@ static int smctr_load_node_addr(struct net_device *dev)
  * disabled.!?
  *
  * NOTE 2: If the monitor_state is MS_BEACON_TEST_STATE and the receive_mask
- * has any multi-cast or promiscous bits set, the receive_mask needs to
- * be changed to clear the multi-cast or promiscous mode bits, the lobe_test
+ * has any multi-cast or promiscuous bits set, the receive_mask needs to
+ * be changed to clear the multi-cast or promiscuous mode bits, the lobe_test
  * run, and then the receive mask set back to its original value if the test
  * is successful.
  */
diff --git a/drivers/net/tokenring/tms380tr.c b/drivers/net/tokenring/tms380tr.c
index d5fa36d..b15435d 100644
--- a/drivers/net/tokenring/tms380tr.c
+++ b/drivers/net/tokenring/tms380tr.c
@@ -48,7 +48,7 @@
  *	25-Sep-99	AF	Uped TPL_NUM from 3 to 9
  *				Removed extraneous 'No free TPL'
  *	22-Dec-99	AF	Added Madge PCI Mk2 support and generalized
- *				parts of the initilization procedure.
+ *				parts of the initialization procedure.
  *	30-Dec-99	AF	Turned tms380tr into a library ala 8390.
  *				Madge support is provided in the abyss module
  *				Generic PCI support is in the tmspci module.
diff --git a/drivers/net/tokenring/tms380tr.h b/drivers/net/tokenring/tms380tr.h
index 7daf74e..1cbb8b8 100644
--- a/drivers/net/tokenring/tms380tr.h
+++ b/drivers/net/tokenring/tms380tr.h
@@ -441,7 +441,7 @@ typedef struct {
 #define PASS_FIRST_BUF_ONLY	0x0100	/* Passes only first internal buffer
 					 * of each received frame; FrameSize
 					 * of RPLs must contain internal
-					 * BUFFER_SIZE bits for promiscous mode.
+					 * BUFFER_SIZE bits for promiscuous mode.
 					 */
 #define ENABLE_FULL_DUPLEX_SELECTION	0x2000 
  					/* Enable the use of full-duplex
diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c
index 70befe3..5dad012 100644
--- a/drivers/net/tulip/xircom_cb.c
+++ b/drivers/net/tulip/xircom_cb.c
@@ -646,7 +646,7 @@ static void setup_descriptors(struct xircom_private *card)
 	}
 
 	wmb();
-	/* wite the transmit descriptor ring to the card */
+	/* write the transmit descriptor ring to the card */
 	address = (unsigned long) card->tx_dma_handle;
 	val =cpu_to_le32(address);
 	outl(val, card->io_port + CSR4);	/* xmit descr list address */
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 1f76446..fc9eada 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -142,7 +142,7 @@ add_multi(u32* filter, const u8* addr)
 	filter[bit_nr >> 5] |= 1 << (bit_nr & 31);
 }
 
-/** Remove the specified Ethernet addres from this multicast filter. */
+/** Remove the specified Ethernet address from this multicast filter. */
 static void
 del_multi(u32* filter, const u8* addr)
 {
@@ -399,7 +399,7 @@ static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv,
 		 * - the packet is addressed to us.
 		 * - the packet is broadcast.
 		 * - the packet is multicast and
-		 *   - we are multicast promiscous.
+		 *   - we are multicast promiscuous.
 		 *   - we belong to the multicast group.
 		 */
 		skb_copy_from_linear_data(skb, addr, min_t(size_t, sizeof addr,
diff --git a/drivers/net/ucc_geth_ethtool.c b/drivers/net/ucc_geth_ethtool.c
index 9a9622c..f8d319b 100644
--- a/drivers/net/ucc_geth_ethtool.c
+++ b/drivers/net/ucc_geth_ethtool.c
@@ -7,7 +7,7 @@
  *
  * Limitation: 
  * Can only get/set setttings of the first queue.
- * Need to re-open the interface manually after changing some paramters.
+ * Need to re-open the interface manually after changing some parameters.
  *
  * This program is free software; you can redistribute  it and/or modify it
  * under  the terms of  the GNU General  Public License as published by the
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c
index df884f0..7c0d4a8 100644
--- a/drivers/net/ucc_geth_mii.c
+++ b/drivers/net/ucc_geth_mii.c
@@ -63,11 +63,11 @@ int uec_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value)
 {
 	struct ucc_mii_mng __iomem *regs = (void __iomem *)bus->priv;
 
-	/* Setting up the MII Mangement Address Register */
+	/* Setting up the MII Management Address Register */
 	out_be32(&regs->miimadd,
 		 (mii_id << MIIMADD_PHY_ADDRESS_SHIFT) | regnum);
 
-	/* Setting up the MII Mangement Control Register with the value */
+	/* Setting up the MII Management Control Register with the value */
 	out_be32(&regs->miimcon, value);
 
 	/* Wait till MII management write is complete */
@@ -85,7 +85,7 @@ int uec_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
 	struct ucc_mii_mng __iomem *regs = (void __iomem *)bus->priv;
 	u16 value;
 
-	/* Setting up the MII Mangement Address Register */
+	/* Setting up the MII Management Address Register */
 	out_be32(&regs->miimadd,
 		 (mii_id << MIIMADD_PHY_ADDRESS_SHIFT) | regnum);
 
diff --git a/drivers/net/wan/cycx_drv.c b/drivers/net/wan/cycx_drv.c
index d347d59..d14e667 100644
--- a/drivers/net/wan/cycx_drv.c
+++ b/drivers/net/wan/cycx_drv.c
@@ -322,7 +322,7 @@ static int cycx_data_boot(void __iomem *addr, u8 *code, u32 len)
 	void __iomem *pt_boot_cmd = addr + CMD_OFFSET;
 	u32 i;
 
-	/* boot buffer lenght */
+	/* boot buffer length */
 	writew(CFM_LOAD_BUFSZ, pt_boot_cmd + sizeof(u16));
 	writew(GEN_DEFPAR, pt_boot_cmd);
 
@@ -353,7 +353,7 @@ static int cycx_code_boot(void __iomem *addr, u8 *code, u32 len)
 	void __iomem *pt_boot_cmd = addr + CMD_OFFSET;
 	u32 i;
 
-	/* boot buffer lenght */
+	/* boot buffer length */
 	writew(CFM_LOAD_BUFSZ, pt_boot_cmd + sizeof(u16));
 	writew(GEN_DEFPAR, pt_boot_cmd);
 
diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c
index 2e8b5c2..74f87df 100644
--- a/drivers/net/wan/sbni.c
+++ b/drivers/net/wan/sbni.c
@@ -1472,7 +1472,7 @@ sbni_get_stats( struct net_device  *dev )
 static void
 set_multicast_list( struct net_device  *dev )
 {
-	return;		/* sbni always operate in promiscuos mode */
+	return;		/* sbni always operate in promiscuous mode */
 }
 
 
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index 059ce3f..60dfdd9 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -3278,7 +3278,7 @@ static void atmel_smooth_qual(struct atmel_private *priv)
 	priv->wstats.qual.updated &= ~IW_QUAL_QUAL_INVALID;
 }
 
-/* deals with incoming managment frames. */
+/* deals with incoming management frames. */
 static void atmel_management_frame(struct atmel_private *priv,
 				   struct ieee80211_hdr_4addr *header,
 				   u16 frame_len, u8 rssi)
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h
index a40d1af..edf7d8f 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h
@@ -28,7 +28,7 @@ struct bcm43xx_dfsentry {
 	struct bcm43xx_xmitstatus *xmitstatus_buffer;
 	int xmitstatus_ptr;
 	int xmitstatus_cnt;
-	/* We need a seperate buffer while printing to avoid
+	/* We need a separate buffer while printing to avoid
 	 * concurrency issues. (New xmitstatus can arrive
 	 * while we are printing).
 	 */
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 54f44e5..e24382f 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -1144,7 +1144,7 @@ static void ipw_led_shutdown(struct ipw_priv *priv)
 /*
  * The following adds a new attribute to the sysfs representation
  * of this device driver (i.e. a new file in /sys/bus/pci/drivers/ipw/)
- * used for controling the debug level.
+ * used for controlling the debug level.
  *
  * See the level definitions in ipw for details.
  */
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 891f90d..e242647 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -4051,7 +4051,7 @@ static int iwl4965_tx_status_reply_compressed_ba(struct iwl_priv *priv,
 	agg->wait_for_ba = 0;
 	IWL_DEBUG_TX_REPLY("BA %d %d\n", agg->start_idx, ba_resp->ba_seq_ctl);
 	sh = agg->start_idx - SEQ_TO_INDEX(ba_seq_ctl>>4);
-	if (sh < 0) /* tbw something is wrong with indeces */
+	if (sh < 0) /* tbw something is wrong with indices */
 		sh += 0x100;
 
 	/* don't use 64 bits for now */
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index be5cfd8..31ee4f6 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -1120,7 +1120,7 @@ int libertas_set_mac_packet_filter(wlan_private * priv)
  *  @param cmd_action	command action: GET or SET
  *  @param wait_option	wait option: wait response or not
  *  @param cmd_oid	cmd oid: treated as sub command
- *  @param pdata_buf	A pointer to informaion buffer
+ *  @param pdata_buf	A pointer to information buffer
  *  @return 		0 or -1
  */
 int libertas_prepare_and_send_command(wlan_private * priv,
@@ -1606,7 +1606,7 @@ static void cleanup_cmdnode(struct cmd_ctrl_node *ptempnode)
  *  @param ptempnode	A pointer to cmd_ctrl_node structure
  *  @param cmd_oid	cmd oid: treated as sub command
  *  @param wait_option	wait option: wait response or not
- *  @param pdata_buf	A pointer to informaion buffer
+ *  @param pdata_buf	A pointer to information buffer
  *  @return 		0 or -1
  */
 void libertas_set_cmd_ctrl_node(wlan_private * priv,
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index ad1e67d..537b36c 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -443,7 +443,7 @@ wlan_scan_setup_scan_config(wlan_private * priv,
 	ptlvpos = pscancfgout->tlvbuffer;
 
 	/*
-	 * Set the initial scan paramters for progressive scanning.  If a specific
+	 * Set the initial scan parameters for progressive scanning.  If a specific
 	 *   BSSID or SSID is used, the number of channels in the scan command
 	 *   will be increased to the absolute maximum
 	 */
@@ -1679,7 +1679,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
  *
  *  Called from libertas_prepare_and_send_command() in cmd.c
  *
- *  Sends a fixed lenght data part (specifying the BSS type and BSSID filters)
+ *  Sends a fixed length data part (specifying the BSS type and BSSID filters)
  *  as well as a variable number/length of TLVs to the firmware.
  *
  *  @param priv       A pointer to wlan_private structure
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c
index d2fa079..c4b649e 100644
--- a/drivers/net/wireless/netwave_cs.c
+++ b/drivers/net/wireless/netwave_cs.c
@@ -1408,7 +1408,7 @@ static void set_multicast_list(struct net_device *dev)
 	/* Multicast Mode */
 	rcvMode = rxConfRxEna + rxConfAMP + rxConfBcast;
     } else if (dev->flags & IFF_PROMISC) {
-	/* Promiscous mode */
+	/* Promiscuous mode */
 	rcvMode = rxConfRxEna + rxConfPro + rxConfAMP + rxConfBcast;
     } else {
 	/* Normal mode */
diff --git a/drivers/net/wireless/orinoco.h b/drivers/net/wireless/orinoco.h
index 4720fb2..703a4cf 100644
--- a/drivers/net/wireless/orinoco.h
+++ b/drivers/net/wireless/orinoco.h
@@ -108,7 +108,7 @@ struct orinoco_private {
 	int	scan_inprogress;	/* Scan pending... */
 	u32	scan_mode;		/* Type of scan done */
 	char *	scan_result;		/* Result of previous scan */
-	int	scan_len;		/* Lenght of result */
+	int	scan_len;		/* Length of result */
 };
 
 #ifdef ORINOCO_DEBUG
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index f87fe10..24f9066 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -129,7 +129,7 @@ static void ray_reset(struct net_device *dev);
 static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, int len);
 static void verify_dl_startup(u_long);
 
-/* Prototypes for interrpt time functions **********************************/
+/* Prototypes for interrupt time functions **********************************/
 static irqreturn_t ray_interrupt (int reg, void *dev_id);
 static void clear_interrupt(ray_dev_t *local);
 static void rx_deauthenticate(ray_dev_t *local, struct rcs __iomem *prcs, 
diff --git a/drivers/net/wireless/rt2x00/rt2x00reg.h b/drivers/net/wireless/rt2x00/rt2x00reg.h
index 8384212..fe9011d 100644
--- a/drivers/net/wireless/rt2x00/rt2x00reg.h
+++ b/drivers/net/wireless/rt2x00/rt2x00reg.h
@@ -230,7 +230,7 @@ static inline u8 rt2x00_get_field8(const u8 reg,
  *	corresponds with the TX register format for the current device.
  *	4 - plcp, 802.11b rates are device specific,
  *	802.11g rates are set according to the ieee802.11a-1999 p.14.
- * The bit to enable preamble is set in a seperate define.
+ * The bit to enable preamble is set in a separate define.
  */
 #define DEV_RATE	FIELD32(0x000007ff)
 #define DEV_PREAMBLE	FIELD32(0x00000800)
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.h b/drivers/net/wireless/rt2x00/rt2x00usb.h
index 2681abe..b76881f 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.h
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.h
@@ -135,13 +135,13 @@ static inline int rt2x00usb_vendor_request_sw(const struct rt2x00_dev
  * kmalloc for correct handling inside the kernel USB layer.
  */
 static inline int rt2x00usb_eeprom_read(const struct rt2x00_dev *rt2x00dev,
-					 __le16 *eeprom, const u16 lenght)
+					 __le16 *eeprom, const u16 length)
 {
-	int timeout = REGISTER_TIMEOUT * (lenght / sizeof(u16));
+	int timeout = REGISTER_TIMEOUT * (length / sizeof(u16));
 
 	return rt2x00usb_vendor_request(rt2x00dev, USB_EEPROM_READ,
 					USB_VENDOR_REQUEST_IN, 0x0000,
-					0x0000, eeprom, lenght, timeout);
+					0x0000, eeprom, length, timeout);
 }
 
 /*
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index c0671c2..d1468a1 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -833,7 +833,7 @@ static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev, void *data,
 
 	/*
 	 * Write firmware to device.
-	 * We setup a seperate cache for this action,
+	 * We setup a separate cache for this action,
 	 * since we are going to write larger chunks of data
 	 * then normally used cache size.
 	 */
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c
index 577c647..5d28105 100644
--- a/drivers/net/wireless/wavelan_cs.c
+++ b/drivers/net/wireless/wavelan_cs.c
@@ -159,7 +159,7 @@ psa_read(struct net_device *	dev,
 
 /*------------------------------------------------------------------*/
 /*
- * Write the Paramter Storage Area to the WaveLAN card's memory
+ * Write the Parameter Storage Area to the WaveLAN card's memory
  */
 static void
 psa_write(struct net_device *	dev,
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.h b/drivers/net/wireless/zd1211rw/zd_chip.h
index 8009b70..301315a 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.h
+++ b/drivers/net/wireless/zd1211rw/zd_chip.h
@@ -620,8 +620,8 @@ enum {
 #define E2P_PWR_INT_GUARD		8
 #define E2P_CHANNEL_COUNT		14
 
-/* If you compare this addresses with the ZYDAS orignal driver, please notify
- * that we use word mapping for the EEPROM.
+/* If you compare these addresses with the ZYDAS original driver,
+ * please notice that we use word mapping for the EEPROM.
  */
 
 /*
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
index 87f002a..cb6e978 100644
--- a/drivers/net/yellowfin.c
+++ b/drivers/net/yellowfin.c
@@ -533,7 +533,7 @@ static int __devinit read_eeprom(void __iomem *ioaddr, int location)
 	return ioread8(ioaddr + EERead);
 }
 
-/* MII Managemen Data I/O accesses.
+/* MII Management Data I/O accesses.
    These routines assume the MDIO controller is idle, and do not exit until
    the command is finished. */
 
-- 
1.5.3.7.949.g2221a6


-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

^ permalink raw reply related

* [PATCH] drivers/ssb/: Spelling fixes
From: Joe Perches @ 2007-12-17 19:40 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton, Michael Buesch, netdev


Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/ssb/b43_pci_bridge.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/ssb/b43_pci_bridge.c b/drivers/ssb/b43_pci_bridge.c
index f145d8a..310b84f 100644
--- a/drivers/ssb/b43_pci_bridge.c
+++ b/drivers/ssb/b43_pci_bridge.c
@@ -1,7 +1,7 @@
 /*
  * Broadcom 43xx PCI-SSB bridge module
  *
- * This technically is a seperate PCI driver module, but
+ * This technically is a separate PCI driver module, but
  * because of its small size we include it in the SSB core
  * instead of creating a standalone module.
  *
-- 
1.5.3.7.949.g2221a6


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox