Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 12074a35 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6

parents 49c91fb0 34a0b3cd
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -5,6 +5,13 @@
menu "ATM drivers"
	depends on NETDEVICES && ATM

config ATM_DUMMY
	tristate "Dummy ATM driver"
	depends on ATM
	help
	  Dummy ATM driver. Useful for proxy signalling, testing,
	  and development.  If unsure, say N.

config ATM_TCP
	tristate "ATM over TCP"
	depends on INET && ATM
+1 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ ifeq ($(CONFIG_ATM_IDT77252_USE_SUNI),y)
  obj-$(CONFIG_ATM_IDT77252)	+= suni.o
endif

obj-$(CONFIG_ATM_DUMMY)		+= adummy.o
obj-$(CONFIG_ATM_TCP)		+= atmtcp.o
obj-$(CONFIG_ATM_FIRESTREAM)	+= firestream.o
obj-$(CONFIG_ATM_LANAI)		+= lanai.o

drivers/atm/adummy.c

0 → 100644
+168 −0
Original line number Diff line number Diff line
/*
 * adummy.c: a dummy ATM driver
 */

#include <linux/config.h>
#include <linux/module.h>
#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/skbuff.h>
#include <linux/pci.h>
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/string.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/mm.h>
#include <linux/sched.h>
#include <linux/timer.h>
#include <linux/interrupt.h>
#include <asm/io.h>
#include <asm/byteorder.h>
#include <asm/uaccess.h>

#include <linux/atmdev.h>
#include <linux/atm.h>
#include <linux/sonet.h>

/* version definition */

#define DRV_VERSION "1.0"

#define DEV_LABEL "adummy"

#define ADUMMY_DEV(dev) ((struct adummy_dev *) (dev)->dev_data)

struct adummy_dev {
	struct atm_dev *atm_dev;

	struct list_head entry;
};

/* globals */

static LIST_HEAD(adummy_devs);

static int __init
adummy_start(struct atm_dev *dev)
{
	dev->ci_range.vpi_bits = 4;
	dev->ci_range.vci_bits = 12;

	return 0;
}

static int
adummy_open(struct atm_vcc *vcc)
{
	short vpi = vcc->vpi;
	int vci = vcc->vci;

	if (vci == ATM_VCI_UNSPEC || vpi == ATM_VPI_UNSPEC)
		return 0;

	set_bit(ATM_VF_ADDR, &vcc->flags);
	set_bit(ATM_VF_READY, &vcc->flags);

	return 0;
}

static void
adummy_close(struct atm_vcc *vcc)
{
	clear_bit(ATM_VF_READY, &vcc->flags);
	clear_bit(ATM_VF_ADDR, &vcc->flags);
}

static int
adummy_send(struct atm_vcc *vcc, struct sk_buff *skb)
{
	if (vcc->pop)
		vcc->pop(vcc, skb);
	else
		dev_kfree_skb_any(skb);
	atomic_inc(&vcc->stats->tx);

	return 0;
}

static int
adummy_proc_read(struct atm_dev *dev, loff_t *pos, char *page)
{
	int left = *pos;

	if (!left--)
		return sprintf(page, "version %s\n", DRV_VERSION);

	return 0;
}

static struct atmdev_ops adummy_ops =
{
	.open =		adummy_open,
	.close =	adummy_close,	
	.send =		adummy_send,
	.proc_read =	adummy_proc_read,
	.owner =	THIS_MODULE
};

static int __init adummy_init(void)
{
	struct atm_dev *atm_dev;
	struct adummy_dev *adummy_dev;
	int err = 0;

	printk(KERN_ERR "adummy: version %s\n", DRV_VERSION);

	adummy_dev = (struct adummy_dev *) kmalloc(sizeof(struct adummy_dev),
						   GFP_KERNEL);
	if (!adummy_dev) {
		printk(KERN_ERR DEV_LABEL ": kmalloc() failed\n");
		err = -ENOMEM;
		goto out;
	}
	memset(adummy_dev, 0, sizeof(struct adummy_dev));

	atm_dev = atm_dev_register(DEV_LABEL, &adummy_ops, -1, 0);
	if (!atm_dev) {
		printk(KERN_ERR DEV_LABEL ": atm_dev_register() failed\n");
		err = -ENODEV;
		goto out_kfree;
	}

	adummy_dev->atm_dev = atm_dev;
	atm_dev->dev_data = adummy_dev;

	if (adummy_start(atm_dev)) {
		printk(KERN_ERR DEV_LABEL ": adummy_start() failed\n");
		err = -ENODEV;
		goto out_unregister;
	}

	list_add(&adummy_dev->entry, &adummy_devs);
out:
	return err;

out_unregister:
	atm_dev_deregister(atm_dev);
out_kfree:
	kfree(adummy_dev);
	goto out;
}

static void __exit adummy_cleanup(void)
{
	struct adummy_dev *adummy_dev, *next;

	list_for_each_entry_safe(adummy_dev, next, &adummy_devs, entry) {
		atm_dev_deregister(adummy_dev->atm_dev);
		kfree(adummy_dev);
	}
}

module_init(adummy_init);
module_exit(adummy_cleanup);

MODULE_AUTHOR("chas williams <chas@cmf.nrl.navy.mil>");
MODULE_DESCRIPTION("dummy ATM driver");
MODULE_LICENSE("GPL");

drivers/atm/atmdev_init.c

deleted100644 → 0
+0 −54
Original line number Diff line number Diff line
/* drivers/atm/atmdev_init.c - ATM device driver initialization */
 
/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
 

#include <linux/config.h>
#include <linux/init.h>


#ifdef CONFIG_ATM_ZATM
extern int zatm_detect(void);
#endif
#ifdef CONFIG_ATM_AMBASSADOR
extern int amb_detect(void);
#endif
#ifdef CONFIG_ATM_HORIZON
extern int hrz_detect(void);
#endif
#ifdef CONFIG_ATM_FORE200E
extern int fore200e_detect(void);
#endif
#ifdef CONFIG_ATM_LANAI
extern int lanai_detect(void);
#endif


/*
 * For historical reasons, atmdev_init returns the number of devices found.
 * Note that some detections may not go via atmdev_init (e.g. eni.c), so this
 * number is meaningless.
 */

int __init atmdev_init(void)
{
	int devs;

	devs = 0;
#ifdef CONFIG_ATM_ZATM
	devs += zatm_detect();
#endif
#ifdef CONFIG_ATM_AMBASSADOR
	devs += amb_detect();
#endif
#ifdef CONFIG_ATM_HORIZON
	devs += hrz_detect();
#endif
#ifdef CONFIG_ATM_FORE200E
	devs += fore200e_detect();
#endif
#ifdef CONFIG_ATM_LANAI
	devs += lanai_detect();
#endif
	return devs;
}
+2 −18
Original line number Diff line number Diff line
@@ -246,10 +246,6 @@ static void atmtcp_c_close(struct atm_vcc *vcc)
{
	struct atm_dev *atmtcp_dev;
	struct atmtcp_dev_data *dev_data;
	struct sock *s;
	struct hlist_node *node;
	struct atm_vcc *walk;
	int i;

	atmtcp_dev = (struct atm_dev *) vcc->dev_data;
	dev_data = PRIV(atmtcp_dev);
@@ -257,20 +253,8 @@ static void atmtcp_c_close(struct atm_vcc *vcc)
	if (dev_data->persist) return;
	atmtcp_dev->dev_data = NULL;
	kfree(dev_data);
	shutdown_atm_dev(atmtcp_dev);
	atm_dev_deregister(atmtcp_dev);
	vcc->dev_data = NULL;
	read_lock(&vcc_sklist_lock);
	for(i = 0; i < VCC_HTABLE_SIZE; ++i) {
		struct hlist_head *head = &vcc_hash[i];

		sk_for_each(s, node, head) {
			walk = atm_sk(s);
			if (walk->dev != atmtcp_dev)
				continue;
			wake_up(s->sk_sleep);
		}
	}
	read_unlock(&vcc_sklist_lock);
	module_put(THIS_MODULE);
}

@@ -450,7 +434,7 @@ static int atmtcp_remove_persistent(int itf)
	if (PRIV(dev)->vcc) return 0;
	kfree(dev_data);
	atm_dev_put(dev);
	shutdown_atm_dev(dev);
	atm_dev_deregister(dev);
	return 0;
}

Loading