Commit 33397a71 authored by David S. Miller's avatar David S. Miller

Merge branch 'delete-wanrouter' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux

Paul Gortmaker says:

====================
The removal of wanrouter code was originally listed in the (now
gone) feature removal file since May 2012, and an RFC of the
deletion was posted[1] in late 2012.  The overall concept was given
an OK, but defconfig contamination, build failures, etc. meant that
it didn't quite make it into mainline for 3.8.

Since that time, Dan discovered (via code audit) a runtime bug that
proves nobody has been using this for over four years[2].  With that
new information, I think it makes sense for someone to follow through
on Joe's original RFC and get this done for the 3.9 release.

In addition to resolving the build failures of the RFC by keeping
stub headers, this also splits the change into two parts, just like
the token ring removal did.  Part #1 decouples the mainline kernel
from the expired subsystem, and part #2 does the large scale
deletion of the subsystem content.

The advantage of the above, is that a "git blame" will never lead
you to a 4000+ line deletion commit.  The large scale deletion will
never show up in a "git blame" and hence the same advantages that we
get from the "--irreversible-delete" in the review stage of "git
format-patch" are also embedded into the git history itself.  This
may seem like a moot point to some, but for those who spend a
considerable amount of time data mining in the git history, this is
probably worth doing.

I have done build tests of all[mod/yes]config for both the stage 1
(Makefile and Kconfig) and stage 2 (full driver delete) as a sanity
check, and the issues with the previously posted RFC should be gone.

Speaking of "--irreversible-delete" -- these patches were created
with that option, so if you want to use them locally, you are going
to have to pull (location below) the content instead of doing a
"git am" of the mailed out content.

[1] http://patchwork.ozlabs.org/patch/198794/
[2] http://www.spinics.net/lists/netdev/msg218670.html
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 7bc48646 6fcdf4fa
...@@ -179,7 +179,7 @@ Code Seq#(hex) Include File Comments ...@@ -179,7 +179,7 @@ Code Seq#(hex) Include File Comments
'V' C0 media/davinci/vpfe_capture.h conflict! 'V' C0 media/davinci/vpfe_capture.h conflict!
'V' C0 media/si4713.h conflict! 'V' C0 media/si4713.h conflict!
'W' 00-1F linux/watchdog.h conflict! 'W' 00-1F linux/watchdog.h conflict!
'W' 00-1F linux/wanrouter.h conflict! 'W' 00-1F linux/wanrouter.h conflict! (pre 3.9)
'W' 00-3F sound/asound.h conflict! 'W' 00-3F sound/asound.h conflict!
'X' all fs/xfs/xfs_fs.h conflict! 'X' all fs/xfs/xfs_fs.h conflict!
and fs/xfs/linux-2.6/xfs_ioctl32.h and fs/xfs/linux-2.6/xfs_ioctl32.h
......
...@@ -122,7 +122,7 @@ SLAB_C_MAGIC 0x4f17a36d kmem_cache mm/slab.c ...@@ -122,7 +122,7 @@ SLAB_C_MAGIC 0x4f17a36d kmem_cache mm/slab.c
COW_MAGIC 0x4f4f4f4d cow_header_v1 arch/um/drivers/ubd_user.c COW_MAGIC 0x4f4f4f4d cow_header_v1 arch/um/drivers/ubd_user.c
I810_CARD_MAGIC 0x5072696E i810_card sound/oss/i810_audio.c I810_CARD_MAGIC 0x5072696E i810_card sound/oss/i810_audio.c
TRIDENT_CARD_MAGIC 0x5072696E trident_card sound/oss/trident.c TRIDENT_CARD_MAGIC 0x5072696E trident_card sound/oss/trident.c
ROUTER_MAGIC 0x524d4157 wan_device include/linux/wanrouter.h ROUTER_MAGIC 0x524d4157 wan_device [in wanrouter.h pre 3.9]
SCC_MAGIC 0x52696368 gs_port drivers/char/scc.h SCC_MAGIC 0x52696368 gs_port drivers/char/scc.h
SAVEKMSG_MAGIC1 0x53415645 savekmsg arch/*/amiga/config.c SAVEKMSG_MAGIC1 0x53415645 savekmsg arch/*/amiga/config.c
GDA_MAGIC 0x58464552 gda arch/mips/include/asm/sn/gda.h GDA_MAGIC 0x58464552 gda arch/mips/include/asm/sn/gda.h
......
...@@ -122,7 +122,7 @@ SLAB_C_MAGIC 0x4f17a36d kmem_cache mm/slab.c ...@@ -122,7 +122,7 @@ SLAB_C_MAGIC 0x4f17a36d kmem_cache mm/slab.c
COW_MAGIC 0x4f4f4f4d cow_header_v1 arch/um/drivers/ubd_user.c COW_MAGIC 0x4f4f4f4d cow_header_v1 arch/um/drivers/ubd_user.c
I810_CARD_MAGIC 0x5072696E i810_card sound/oss/i810_audio.c I810_CARD_MAGIC 0x5072696E i810_card sound/oss/i810_audio.c
TRIDENT_CARD_MAGIC 0x5072696E trident_card sound/oss/trident.c TRIDENT_CARD_MAGIC 0x5072696E trident_card sound/oss/trident.c
ROUTER_MAGIC 0x524d4157 wan_device include/linux/wanrouter.h ROUTER_MAGIC 0x524d4157 wan_device [in wanrouter.h pre 3.9]
SCC_MAGIC 0x52696368 gs_port drivers/char/scc.h SCC_MAGIC 0x52696368 gs_port drivers/char/scc.h
SAVEKMSG_MAGIC1 0x53415645 savekmsg arch/*/amiga/config.c SAVEKMSG_MAGIC1 0x53415645 savekmsg arch/*/amiga/config.c
GDA_MAGIC 0x58464552 gda arch/mips/include/asm/sn/gda.h GDA_MAGIC 0x58464552 gda arch/mips/include/asm/sn/gda.h
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#endif #endif
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/wanrouter.h>
#include <linux/isdn.h> #include <linux/isdn.h>
#include <linux/concap.h> #include <linux/concap.h>
......
...@@ -356,60 +356,6 @@ config SDLA ...@@ -356,60 +356,6 @@ config SDLA
To compile this driver as a module, choose M here: the To compile this driver as a module, choose M here: the
module will be called sdla. module will be called sdla.
# Wan router core.
config WAN_ROUTER_DRIVERS
tristate "WAN router drivers"
depends on WAN_ROUTER
---help---
Connect LAN to WAN via Linux box.
Select driver your card and remember to say Y to "Wan Router."
You will need the wan-tools package which is available from
<ftp://ftp.sangoma.com/>.
Note that the answer to this question won't directly affect the
kernel except for how subordinate drivers may be built:
saying N will just cause the configurator to skip all
the questions about WAN router drivers.
If unsure, say N.
config CYCLADES_SYNC
tristate "Cyclom 2X(tm) cards (EXPERIMENTAL)"
depends on WAN_ROUTER_DRIVERS && (PCI || ISA)
---help---
Cyclom 2X from Cyclades Corporation <http://www.avocent.com/> is an
intelligent multiprotocol WAN adapter with data transfer rates up to
512 Kbps. These cards support the X.25 and SNA related protocols.
While no documentation is available at this time please grab the
wanconfig tarball in
<http://www.conectiva.com.br/~acme/cycsyn-devel/> (with minor changes
to make it compile with the current wanrouter include files; efforts
are being made to use the original package available at
<ftp://ftp.sangoma.com/>).
Feel free to contact me or the cycsyn-devel mailing list at
<acme@conectiva.com.br> and <cycsyn-devel@bazar.conectiva.com.br> for
additional details, I hope to have documentation available as soon as
possible. (Cyclades Brazil is writing the Documentation).
The next questions will ask you about the protocols you want the
driver to support (for now only X.25 is supported).
If you have one or more of these cards, say Y to this option.
To compile this driver as a module, choose M here: the
module will be called cyclomx.
config CYCLOMX_X25
bool "Cyclom 2X X.25 support (EXPERIMENTAL)"
depends on CYCLADES_SYNC
help
Connect a Cyclom 2X card to an X.25 network.
Enabling X.25 support will enlarge your kernel by about 11 kB.
# X.25 network drivers # X.25 network drivers
config LAPBETHER config LAPBETHER
tristate "LAPB over Ethernet driver (EXPERIMENTAL)" tristate "LAPB over Ethernet driver (EXPERIMENTAL)"
......
...@@ -5,10 +5,6 @@ ...@@ -5,10 +5,6 @@
# Rewritten to use lists instead of if-statements. # Rewritten to use lists instead of if-statements.
# #
cyclomx-y := cycx_main.o
cyclomx-$(CONFIG_CYCLOMX_X25) += cycx_x25.o
cyclomx-objs := $(cyclomx-y)
obj-$(CONFIG_HDLC) += hdlc.o obj-$(CONFIG_HDLC) += hdlc.o
obj-$(CONFIG_HDLC_RAW) += hdlc_raw.o obj-$(CONFIG_HDLC_RAW) += hdlc_raw.o
obj-$(CONFIG_HDLC_RAW_ETH) += hdlc_raw_eth.o obj-$(CONFIG_HDLC_RAW_ETH) += hdlc_raw_eth.o
...@@ -28,7 +24,6 @@ obj-$(CONFIG_LANMEDIA) += lmc/ ...@@ -28,7 +24,6 @@ obj-$(CONFIG_LANMEDIA) += lmc/
obj-$(CONFIG_DLCI) += dlci.o obj-$(CONFIG_DLCI) += dlci.o
obj-$(CONFIG_SDLA) += sdla.o obj-$(CONFIG_SDLA) += sdla.o
obj-$(CONFIG_CYCLADES_SYNC) += cycx_drv.o cyclomx.o
obj-$(CONFIG_LAPBETHER) += lapbether.o obj-$(CONFIG_LAPBETHER) += lapbether.o
obj-$(CONFIG_SBNI) += sbni.o obj-$(CONFIG_SBNI) += sbni.o
obj-$(CONFIG_N2) += n2.o obj-$(CONFIG_N2) += n2.o
......
This diff is collapsed.
/*
* cycx_main.c Cyclades Cyclom 2X WAN Link Driver. Main module.
*
* Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
*
* Copyright: (c) 1998-2003 Arnaldo Carvalho de Melo
*
* Based on sdlamain.c by Gene Kozin <genek@compuserve.com> &
* Jaspreet Singh <jaspreet@sangoma.com>
*
* 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.
* ============================================================================
* Please look at the bitkeeper changelog (or any other scm tool that ends up
* importing bitkeeper changelog or that replaces bitkeeper in the future as
* main tool for linux development).
*
* 2001/05/09 acme Fix MODULE_DESC for debug, .bss nitpicks,
* some cleanups
* 2000/07/13 acme remove useless #ifdef MODULE and crap
* #if KERNEL_VERSION > blah
* 2000/07/06 acme __exit at cyclomx_cleanup
* 2000/04/02 acme dprintk and cycx_debug
* module_init/module_exit
* 2000/01/21 acme rename cyclomx_open to cyclomx_mod_inc_use_count
* and cyclomx_close to cyclomx_mod_dec_use_count
* 2000/01/08 acme cleanup
* 1999/11/06 acme cycx_down back to life (it needs to be
* called to iounmap the dpmbase)
* 1999/08/09 acme removed references to enable_tx_int
* use spinlocks instead of cli/sti in
* cyclomx_set_state
* 1999/05/19 acme works directly linked into the kernel
* init_waitqueue_head for 2.3.* kernel
* 1999/05/18 acme major cleanup (polling not needed), etc
* 1998/08/28 acme minor cleanup (ioctls for firmware deleted)
* queue_task activated
* 1998/08/08 acme Initial version.
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/stddef.h> /* offsetof(), etc. */
#include <linux/errno.h> /* return codes */
#include <linux/string.h> /* inline memset(), etc. */
#include <linux/slab.h> /* kmalloc(), kfree() */
#include <linux/kernel.h> /* printk(), and other useful stuff */
#include <linux/module.h> /* support for loadable modules */
#include <linux/ioport.h> /* request_region(), release_region() */
#include <linux/wanrouter.h> /* WAN router definitions */
#include <linux/cyclomx.h> /* cyclomx common user API definitions */
#include <linux/init.h> /* __init (when not using as a module) */
#include <linux/interrupt.h>
unsigned int cycx_debug;
MODULE_AUTHOR("Arnaldo Carvalho de Melo");
MODULE_DESCRIPTION("Cyclom 2X Sync Card Driver.");
MODULE_LICENSE("GPL");
module_param(cycx_debug, int, 0);
MODULE_PARM_DESC(cycx_debug, "cyclomx debug level");
/* Defines & Macros */
#define CYCX_DRV_VERSION 0 /* version number */
#define CYCX_DRV_RELEASE 11 /* release (minor version) number */
#define CYCX_MAX_CARDS 1 /* max number of adapters */
#define CONFIG_CYCX_CARDS 1
/* Function Prototypes */
/* WAN link driver entry points */
static int cycx_wan_setup(struct wan_device *wandev, wandev_conf_t *conf);
static int cycx_wan_shutdown(struct wan_device *wandev);
/* Miscellaneous functions */
static irqreturn_t cycx_isr(int irq, void *dev_id);
/* Global Data
* Note: All data must be explicitly initialized!!!
*/
/* private data */
static const char cycx_drvname[] = "cyclomx";
static const char cycx_fullname[] = "CYCLOM 2X(tm) Sync Card Driver";
static const char cycx_copyright[] = "(c) 1998-2003 Arnaldo Carvalho de Melo "
"<acme@conectiva.com.br>";
static int cycx_ncards = CONFIG_CYCX_CARDS;
static struct cycx_device *cycx_card_array; /* adapter data space */
/* Kernel Loadable Module Entry Points */
/*
* Module 'insert' entry point.
* o print announcement
* o allocate adapter data space
* o initialize static data
* o register all cards with WAN router
* o calibrate Cyclom 2X shared memory access delay.
*
* Return: 0 Ok
* < 0 error.
* Context: process
*/
static int __init cycx_init(void)
{
int cnt, err = -ENOMEM;
pr_info("%s v%u.%u %s\n",
cycx_fullname, CYCX_DRV_VERSION, CYCX_DRV_RELEASE,
cycx_copyright);
/* Verify number of cards and allocate adapter data space */
cycx_ncards = min_t(int, cycx_ncards, CYCX_MAX_CARDS);
cycx_ncards = max_t(int, cycx_ncards, 1);
cycx_card_array = kcalloc(cycx_ncards, sizeof(struct cycx_device), GFP_KERNEL);
if (!cycx_card_array)
goto out;
/* Register adapters with WAN router */
for (cnt = 0; cnt < cycx_ncards; ++cnt) {
struct cycx_device *card = &cycx_card_array[cnt];
struct wan_device *wandev = &card->wandev;
sprintf(card->devname, "%s%d", cycx_drvname, cnt + 1);
wandev->magic = ROUTER_MAGIC;
wandev->name = card->devname;
wandev->private = card;
wandev->setup = cycx_wan_setup;
wandev->shutdown = cycx_wan_shutdown;
err = register_wan_device(wandev);
if (err) {
pr_err("%s registration failed with error %d!\n",
card->devname, err);
break;
}
}
err = -ENODEV;
if (!cnt) {
kfree(cycx_card_array);
goto out;
}
err = 0;
cycx_ncards = cnt; /* adjust actual number of cards */
out: return err;
}
/*
* Module 'remove' entry point.
* o unregister all adapters from the WAN router
* o release all remaining system resources
*/
static void __exit cycx_exit(void)
{
int i = 0;
for (; i < cycx_ncards; ++i) {
struct cycx_device *card = &cycx_card_array[i];
unregister_wan_device(card->devname);
}
kfree(cycx_card_array);
}
/* WAN Device Driver Entry Points */
/*
* Setup/configure WAN link driver.
* o check adapter state
* o make sure firmware is present in configuration
* o allocate interrupt vector
* o setup Cyclom 2X hardware
* o call appropriate routine to perform protocol-specific initialization
*
* This function is called when router handles ROUTER_SETUP IOCTL. The
* configuration structure is in kernel memory (including extended data, if
* any).
*/
static int cycx_wan_setup(struct wan_device *wandev, wandev_conf_t *conf)
{
int rc = -EFAULT;
struct cycx_device *card;
int irq;
/* Sanity checks */
if (!wandev || !wandev->private || !conf)
goto out;
card = wandev->private;
rc = -EBUSY;
if (wandev->state != WAN_UNCONFIGURED)
goto out;
rc = -EINVAL;
if (!conf->data_size || !conf->data) {
pr_err("%s: firmware not found in configuration data!\n",
wandev->name);
goto out;
}
if (conf->irq <= 0) {
pr_err("%s: can't configure without IRQ!\n", wandev->name);
goto out;
}
/* Allocate IRQ */
irq = conf->irq == 2 ? 9 : conf->irq; /* IRQ2 -> IRQ9 */
if (request_irq(irq, cycx_isr, 0, wandev->name, card)) {
pr_err("%s: can't reserve IRQ %d!\n", wandev->name, irq);
goto out;
}
/* Configure hardware, load firmware, etc. */
memset(&card->hw, 0, sizeof(card->hw));
card->hw.irq = irq;
card->hw.dpmsize = CYCX_WINDOWSIZE;
card->hw.fwid = CFID_X25_2X;
spin_lock_init(&card->lock);
init_waitqueue_head(&card->wait_stats);
rc = cycx_setup(&card->hw, conf->data, conf->data_size, conf->maddr);
if (rc)
goto out_irq;
/* Initialize WAN device data space */
wandev->irq = irq;
wandev->dma = wandev->ioport = 0;
wandev->maddr = (unsigned long)card->hw.dpmbase;
wandev->msize = card->hw.dpmsize;
wandev->hw_opt[2] = 0;
wandev->hw_opt[3] = card->hw.fwid;
/* Protocol-specific initialization */
switch (card->hw.fwid) {
#ifdef CONFIG_CYCLOMX_X25
case CFID_X25_2X:
rc = cycx_x25_wan_init(card, conf);
break;
#endif
default:
pr_err("%s: this firmware is not supported!\n", wandev->name);
rc = -EINVAL;
}
if (rc) {
cycx_down(&card->hw);
goto out_irq;
}
rc = 0;
out:
return rc;
out_irq:
free_irq(irq, card);
goto out;
}
/*
* Shut down WAN link driver.
* o shut down adapter hardware
* o release system resources.
*
* This function is called by the router when device is being unregistered or
* when it handles ROUTER_DOWN IOCTL.
*/
static int cycx_wan_shutdown(struct wan_device *wandev)
{
int ret = -EFAULT;
struct cycx_device *card;
/* sanity checks */
if (!wandev || !wandev->private)
goto out;
ret = 0;
if (wandev->state == WAN_UNCONFIGURED)
goto out;
card = wandev->private;
wandev->state = WAN_UNCONFIGURED;
cycx_down(&card->hw);
pr_info("%s: irq %d being freed!\n", wandev->name, wandev->irq);
free_irq(wandev->irq, card);
out: return ret;
}
/* Miscellaneous */
/*
* Cyclom 2X Interrupt Service Routine.
* o acknowledge Cyclom 2X hardware interrupt.
* o call protocol-specific interrupt service routine, if any.
*/
static irqreturn_t cycx_isr(int irq, void *dev_id)
{
struct cycx_device *card = dev_id;
if (card->wandev.state == WAN_UNCONFIGURED)
goto out;
if (card->in_isr) {
pr_warn("%s: interrupt re-entrancy on IRQ %d!\n",
card->devname, card->wandev.irq);
goto out;
}
if (card->isr)
card->isr(card);
return IRQ_HANDLED;
out:
return IRQ_NONE;
}
/* Set WAN device state. */
void cycx_set_state(struct cycx_device *card, int state)
{
unsigned long flags;
char *string_state = NULL;
spin_lock_irqsave(&card->lock, flags);
if (card->wandev.state != state) {
switch (state) {
case WAN_CONNECTED:
string_state = "connected!";
break;
case WAN_DISCONNECTED:
string_state = "disconnected!";
break;
}
pr_info("%s: link %s\n", card->devname, string_state);
card->wandev.state = state;
}
card->state_tick = jiffies;
spin_unlock_irqrestore(&card->lock, flags);
}
module_init(cycx_init);
module_exit(cycx_exit);
This diff is collapsed.
#ifndef _CYCLOMX_H
#define _CYCLOMX_H
/*
* cyclomx.h Cyclom 2X WAN Link Driver.
* User-level API definitions.
*
* Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
*
* Copyright: (c) 1998-2003 Arnaldo Carvalho de Melo
*
* Based on wanpipe.h by Gene Kozin <genek@compuserve.com>
*
* 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.
* ============================================================================
* 2000/07/13 acme remove crap #if KERNEL_VERSION > blah
* 2000/01/21 acme rename cyclomx_open to cyclomx_mod_inc_use_count
* and cyclomx_close to cyclomx_mod_dec_use_count
* 1999/05/19 acme wait_queue_head_t wait_stats(support for 2.3.*)
* 1999/01/03 acme judicious use of data types
* 1998/12/27 acme cleanup: PACKED not needed
* 1998/08/08 acme Version 0.0.1
*/
#include <linux/wanrouter.h>
#include <linux/spinlock.h>
#ifdef __KERNEL__
/* Kernel Interface */
#include <linux/cycx_drv.h> /* Cyclom 2X support module API definitions */
#include <linux/cycx_cfm.h> /* Cyclom 2X firmware module definitions */
#ifdef CONFIG_CYCLOMX_X25
#include <linux/cycx_x25.h>
#endif
/* Adapter Data Space.
* This structure is needed because we handle multiple cards, otherwise
* static data would do it.
*/
struct cycx_device {
char devname[WAN_DRVNAME_SZ + 1];/* card name */
struct cycx_hw hw; /* hardware configuration */
struct wan_device wandev; /* WAN device data space */
u32 state_tick; /* link state timestamp */
spinlock_t lock;
char in_isr; /* interrupt-in-service flag */
char buff_int_mode_unbusy; /* flag for carrying out dev_tint */
wait_queue_head_t wait_stats; /* to wait for the STATS indication */
void __iomem *mbox; /* -> mailbox */
void (*isr)(struct cycx_device* card); /* interrupt service routine */
int (*exec)(struct cycx_device* card, void* u_cmd, void* u_data);
union {
#ifdef CONFIG_CYCLOMX_X25
struct { /* X.25 specific data */
u32 lo_pvc;
u32 hi_pvc;
u32 lo_svc;
u32 hi_svc;
struct cycx_x25_stats stats;
spinlock_t lock;
u32 connection_keys;
} x;
#endif
} u;
};
/* Public Functions */
void cycx_set_state(struct cycx_device *card, int state);
#ifdef CONFIG_CYCLOMX_X25
int cycx_x25_wan_init(struct cycx_device *card, wandev_conf_t *conf);
#endif
#endif /* __KERNEL__ */
#endif /* _CYCLOMX_H */
/*
* cycx_drv.h CYCX Support Module. Kernel API Definitions.
*
* Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
*
* Copyright: (c) 1998-2003 Arnaldo Carvalho de Melo
*
* Based on sdladrv.h by Gene Kozin <genek@compuserve.com>
*
* 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.
* ============================================================================
* 1999/10/23 acme cycxhw_t cleanup
* 1999/01/03 acme more judicious use of data types...
* uclong, ucchar, etc deleted, the u8, u16, u32
* types are the portable way to go.
* 1999/01/03 acme judicious use of data types... u16, u32, etc
* 1998/12/26 acme FIXED_BUFFERS, CONF_OFFSET,
* removal of cy_read{bwl}
* 1998/08/08 acme Initial version.
*/
#ifndef _CYCX_DRV_H
#define _CYCX_DRV_H
#define CYCX_WINDOWSIZE 0x4000 /* default dual-port memory window size */
#define GEN_CYCX_INTR 0x02
#define RST_ENABLE 0x04
#define START_CPU 0x06
#define RST_DISABLE 0x08
#define FIXED_BUFFERS 0x08
#define TEST_PATTERN 0xaa55
#define CMD_OFFSET 0x20
#define CONF_OFFSET 0x0380
#define RESET_OFFSET 0x3c00 /* For reset file load */
#define DATA_OFFSET 0x0100 /* For code and data files load */
#define START_OFFSET 0x3ff0 /* 80186 starts here */
/**
* struct cycx_hw - Adapter hardware configuration
* @fwid - firmware ID
* @irq - interrupt request level
* @dpmbase - dual-port memory base
* @dpmsize - dual-port memory size
* @reserved - reserved for future use
*/
struct cycx_hw {
u32 fwid;
int irq;
void __iomem *dpmbase;
u32 dpmsize;
u32 reserved[5];
};
/* Function Prototypes */
extern int cycx_setup(struct cycx_hw *hw, void *sfm, u32 len, unsigned long base);
extern int cycx_down(struct cycx_hw *hw);
extern int cycx_peek(struct cycx_hw *hw, u32 addr, void *buf, u32 len);
extern int cycx_poke(struct cycx_hw *hw, u32 addr, void *buf, u32 len);
extern int cycx_exec(void __iomem *addr);
extern void cycx_intr(struct cycx_hw *hw);
#endif /* _CYCX_DRV_H */
/***************************************************************************** /*
* wanrouter.h Definitions for the WAN Multiprotocol Router Module. * wanrouter.h Legacy declarations kept around until X25 is removed
* This module provides API and common services for WAN Link */
* Drivers and is completely hardware-independent.
*
* Author: Nenad Corbic <ncorbic@sangoma.com>
* Gideon Hack
* Additions: Arnaldo Melo
*
* Copyright: (c) 1995-2000 Sangoma Technologies Inc.
*
* 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.
* ============================================================================
* Jul 21, 2000 Nenad Corbic Added WAN_FT1_READY State
* Feb 24, 2000 Nenad Corbic Added support for socket based x25api
* Jan 28, 2000 Nenad Corbic Added support for the ASYNC protocol.
* Oct 04, 1999 Nenad Corbic Updated for 2.1.0 release
* Jun 02, 1999 Gideon Hack Added support for the S514 adapter.
* May 23, 1999 Arnaldo Melo Added local_addr to wanif_conf_t
* WAN_DISCONNECTING state added
* Jul 20, 1998 David Fong Added Inverse ARP options to 'wanif_conf_t'
* Jun 12, 1998 David Fong Added Cisco HDLC support.
* Dec 16, 1997 Jaspreet Singh Moved 'enable_IPX' and 'network_number' to
* 'wanif_conf_t'
* Dec 05, 1997 Jaspreet Singh Added 'pap', 'chap' to 'wanif_conf_t'
* Added 'authenticator' to 'wan_ppp_conf_t'
* Nov 06, 1997 Jaspreet Singh Changed Router Driver version to 1.1 from 1.0
* Oct 20, 1997 Jaspreet Singh Added 'cir','bc','be' and 'mc' to 'wanif_conf_t'
* Added 'enable_IPX' and 'network_number' to
* 'wan_device_t'. Also added defines for
* UDP PACKET TYPE, Interrupt test, critical values
* for RACE conditions.
* Oct 05, 1997 Jaspreet Singh Added 'dlci_num' and 'dlci[100]' to
* 'wan_fr_conf_t' to configure a list of dlci(s)
* for a NODE
* Jul 07, 1997 Jaspreet Singh Added 'ttl' to 'wandev_conf_t' & 'wan_device_t'
* May 29, 1997 Jaspreet Singh Added 'tx_int_enabled' to 'wan_device_t'
* May 21, 1997 Jaspreet Singh Added 'udp_port' to 'wan_device_t'
* Apr 25, 1997 Farhan Thawar Added 'udp_port' to 'wandev_conf_t'
* Jan 16, 1997 Gene Kozin router_devlist made public
* Jan 02, 1997 Gene Kozin Initial version (based on wanpipe.h).
*****************************************************************************/
#ifndef _ROUTER_H #ifndef _ROUTER_H
#define _ROUTER_H #define _ROUTER_H
#include <uapi/linux/wanrouter.h> #include <uapi/linux/wanrouter.h>
/****** Kernel Interface ****************************************************/
#include <linux/fs.h> /* support for device drivers */
#include <linux/proc_fs.h> /* proc filesystem pragmatics */
#include <linux/netdevice.h> /* support for network drivers */
#include <linux/spinlock.h> /* Support for SMP Locking */
/*----------------------------------------------------------------------------
* WAN device data space.
*/
struct wan_device {
unsigned magic; /* magic number */
char* name; /* -> WAN device name (ASCIIZ) */
void* private; /* -> driver private data */
unsigned config_id; /* Configuration ID */
/****** hardware configuration ******/
unsigned ioport; /* adapter I/O port base #1 */
char S514_cpu_no[1]; /* PCI CPU Number */
unsigned char S514_slot_no; /* PCI Slot Number */
unsigned long maddr; /* dual-port memory address */
unsigned msize; /* dual-port memory size */
int irq; /* interrupt request level */
int dma; /* DMA request level */
unsigned bps; /* data transfer rate */
unsigned mtu; /* max physical transmit unit size */
unsigned udp_port; /* UDP port for management */
unsigned char ttl; /* Time To Live for UDP security */
unsigned enable_tx_int; /* Transmit Interrupt enabled or not */
char interface; /* RS-232/V.35, etc. */
char clocking; /* external/internal */
char line_coding; /* NRZ/NRZI/FM0/FM1, etc. */
char station; /* DTE/DCE, primary/secondary, etc. */
char connection; /* permanent/switched/on-demand */
char signalling; /* Signalling RS232 or V35 */
char read_mode; /* read mode: Polling or interrupt */
char new_if_cnt; /* Number of interfaces per wanpipe */
char del_if_cnt; /* Number of times del_if() gets called */
unsigned char piggyback; /* Piggibacking a port */
unsigned hw_opt[4]; /* other hardware options */
/****** status and statistics *******/
char state; /* device state */
char api_status; /* device api status */
struct net_device_stats stats; /* interface statistics */
unsigned reserved[16]; /* reserved for future use */
unsigned long critical; /* critical section flag */
spinlock_t lock; /* Support for SMP Locking */
/****** device management methods ***/
int (*setup) (struct wan_device *wandev, wandev_conf_t *conf);
int (*shutdown) (struct wan_device *wandev);
int (*update) (struct wan_device *wandev);
int (*ioctl) (struct wan_device *wandev, unsigned cmd,
unsigned long arg);
int (*new_if)(struct wan_device *wandev, struct net_device *dev,
wanif_conf_t *conf);
int (*del_if)(struct wan_device *wandev, struct net_device *dev);
/****** maintained by the router ****/
struct wan_device* next; /* -> next device */
struct net_device* dev; /* list of network interfaces */
unsigned ndev; /* number of interfaces */
struct proc_dir_entry *dent; /* proc filesystem entry */
};
/* Public functions available for device drivers */
extern int register_wan_device(struct wan_device *wandev);
extern int unregister_wan_device(char *name);
/* Proc interface functions. These must not be called by the drivers! */
extern int wanrouter_proc_init(void);
extern void wanrouter_proc_cleanup(void);
extern int wanrouter_proc_add(struct wan_device *wandev);
extern int wanrouter_proc_delete(struct wan_device *wandev);
extern long wanrouter_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
/* Public Data */
/* list of registered devices */
extern struct wan_device *wanrouter_router_devlist;
#endif /* _ROUTER_H */ #endif /* _ROUTER_H */
This diff is collapsed.
...@@ -209,7 +209,6 @@ source "net/ipx/Kconfig" ...@@ -209,7 +209,6 @@ source "net/ipx/Kconfig"
source "drivers/net/appletalk/Kconfig" source "drivers/net/appletalk/Kconfig"
source "net/x25/Kconfig" source "net/x25/Kconfig"
source "net/lapb/Kconfig" source "net/lapb/Kconfig"
source "net/wanrouter/Kconfig"
source "net/phonet/Kconfig" source "net/phonet/Kconfig"
source "net/ieee802154/Kconfig" source "net/ieee802154/Kconfig"
source "net/mac802154/Kconfig" source "net/mac802154/Kconfig"
......
...@@ -26,7 +26,6 @@ obj-$(CONFIG_BRIDGE) += bridge/ ...@@ -26,7 +26,6 @@ obj-$(CONFIG_BRIDGE) += bridge/
obj-$(CONFIG_NET_DSA) += dsa/ obj-$(CONFIG_NET_DSA) += dsa/
obj-$(CONFIG_IPX) += ipx/ obj-$(CONFIG_IPX) += ipx/
obj-$(CONFIG_ATALK) += appletalk/ obj-$(CONFIG_ATALK) += appletalk/
obj-$(CONFIG_WAN_ROUTER) += wanrouter/
obj-$(CONFIG_X25) += x25/ obj-$(CONFIG_X25) += x25/
obj-$(CONFIG_LAPB) += lapb/ obj-$(CONFIG_LAPB) += lapb/
obj-$(CONFIG_NETROM) += netrom/ obj-$(CONFIG_NETROM) += netrom/
......
...@@ -69,7 +69,6 @@ ...@@ -69,7 +69,6 @@
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/wanrouter.h>
#include <linux/if_bridge.h> #include <linux/if_bridge.h>
#include <linux/if_frad.h> #include <linux/if_frad.h>
#include <linux/if_vlan.h> #include <linux/if_vlan.h>
......
#
# Configuration for WAN router
#
config WAN_ROUTER
tristate "WAN router (DEPRECATED)"
depends on EXPERIMENTAL
---help---
Wide Area Networks (WANs), such as X.25, frame relay and leased
lines, are used to interconnect Local Area Networks (LANs) over vast
distances with data transfer rates significantly higher than those
achievable with commonly used asynchronous modem connections.
Usually, a quite expensive external device called a `WAN router' is
needed to connect to a WAN.
As an alternative, WAN routing can be built into the Linux kernel.
With relatively inexpensive WAN interface cards available on the
market, a perfectly usable router can be built for less than half
the price of an external router. If you have one of those cards and
wish to use your Linux box as a WAN router, say Y here and also to
the WAN driver for your card, below. You will then need the
wan-tools package which is available from <ftp://ftp.sangoma.com/>.
To compile WAN routing support as a module, choose M here: the
module will be called wanrouter.
If unsure, say N.
#
# Makefile for the Linux WAN router layer.
#
obj-$(CONFIG_WAN_ROUTER) += wanrouter.o
wanrouter-y := wanproc.o wanmain.o
This diff is collapsed.
/*****************************************************************************
* wanproc.c WAN Router Module. /proc filesystem interface.
*
* This module is completely hardware-independent and provides
* access to the router using Linux /proc filesystem.
*
* Author: Gideon Hack
*
* Copyright: (c) 1995-1999 Sangoma Technologies Inc.
*
* 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.
* ============================================================================
* Jun 02, 1999 Gideon Hack Updates for Linux 2.2.X kernels.
* Jun 29, 1997 Alan Cox Merged with 1.0.3 vendor code
* Jan 29, 1997 Gene Kozin v1.0.1. Implemented /proc read routines
* Jan 30, 1997 Alan Cox Hacked around for 2.1
* Dec 13, 1996 Gene Kozin Initial version (based on Sangoma's WANPIPE)
*****************************************************************************/
#include <linux/init.h> /* __initfunc et al. */
#include <linux/stddef.h> /* offsetof(), etc. */
#include <linux/errno.h> /* return codes */
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/wanrouter.h> /* WAN router API definitions */
#include <linux/seq_file.h>
#include <linux/mutex.h>
#include <net/net_namespace.h>
#include <asm/io.h>
#define PROC_STATS_FORMAT "%30s: %12lu\n"
/****** Defines and Macros **************************************************/
#define PROT_DECODE(prot) ((prot == WANCONFIG_FR) ? " FR" :\
(prot == WANCONFIG_X25) ? " X25" : \
(prot == WANCONFIG_PPP) ? " PPP" : \
(prot == WANCONFIG_CHDLC) ? " CHDLC": \
(prot == WANCONFIG_MPPP) ? " MPPP" : \
" Unknown" )
/****** Function Prototypes *************************************************/
#ifdef CONFIG_PROC_FS
/* Miscellaneous */
/*
* Structures for interfacing with the /proc filesystem.
* Router creates its own directory /proc/net/router with the following
* entries:
* config device configuration
* status global device statistics
* <device> entry for each WAN device
*/
/*
* Generic /proc/net/router/<file> file and inode operations
*/
/*
* /proc/net/router
*/
static DEFINE_MUTEX(config_mutex);
static struct proc_dir_entry *proc_router;
/* Strings */
/*
* Interface functions
*/
/****** Proc filesystem entry points ****************************************/
/*
* Iterator
*/
static void *r_start(struct seq_file *m, loff_t *pos)
{
struct wan_device *wandev;
loff_t l = *pos;
mutex_lock(&config_mutex);
if (!l--)
return SEQ_START_TOKEN;
for (wandev = wanrouter_router_devlist; l-- && wandev;
wandev = wandev->next)
;
return wandev;
}
static void *r_next(struct seq_file *m, void *v, loff_t *pos)
{
struct wan_device *wandev = v;
(*pos)++;
return (v == SEQ_START_TOKEN) ? wanrouter_router_devlist : wandev->next;
}
static void r_stop(struct seq_file *m, void *v)
{
mutex_unlock(&config_mutex);
}
static int config_show(struct seq_file *m, void *v)
{
struct wan_device *p = v;
if (v == SEQ_START_TOKEN) {
seq_puts(m, "Device name | port |IRQ|DMA| mem.addr |"
"mem.size|option1|option2|option3|option4\n");
return 0;
}
if (!p->state)
return 0;
seq_printf(m, "%-15s|0x%-4X|%3u|%3u| 0x%-8lX |0x%-6X|%7u|%7u|%7u|%7u\n",
p->name, p->ioport, p->irq, p->dma, p->maddr, p->msize,
p->hw_opt[0], p->hw_opt[1], p->hw_opt[2], p->hw_opt[3]);
return 0;
}
static int status_show(struct seq_file *m, void *v)
{
struct wan_device *p = v;
if (v == SEQ_START_TOKEN) {
seq_puts(m, "Device name |protocol|station|interface|"
"clocking|baud rate| MTU |ndev|link state\n");
return 0;
}
if (!p->state)
return 0;
seq_printf(m, "%-15s|%-8s| %-7s| %-9s|%-8s|%9u|%5u|%3u |",
p->name,
PROT_DECODE(p->config_id),
p->config_id == WANCONFIG_FR ?
(p->station ? "Node" : "CPE") :
(p->config_id == WANCONFIG_X25 ?
(p->station ? "DCE" : "DTE") :
("N/A")),
p->interface ? "V.35" : "RS-232",
p->clocking ? "internal" : "external",
p->bps,
p->mtu,
p->ndev);
switch (p->state) {
case WAN_UNCONFIGURED:
seq_printf(m, "%-12s\n", "unconfigured");
break;
case WAN_DISCONNECTED:
seq_printf(m, "%-12s\n", "disconnected");
break;
case WAN_CONNECTING:
seq_printf(m, "%-12s\n", "connecting");
break;
case WAN_CONNECTED:
seq_printf(m, "%-12s\n", "connected");
break;
default:
seq_printf(m, "%-12s\n", "invalid");
break;
}
return 0;
}
static const struct seq_operations config_op = {
.start = r_start,
.next = r_next,
.stop = r_stop,
.show = config_show,
};
static const struct seq_operations status_op = {
.start = r_start,
.next = r_next,
.stop = r_stop,
.show = status_show,
};
static int config_open(struct inode *inode, struct file *file)
{
return seq_open(file, &config_op);
}
static int status_open(struct inode *inode, struct file *file)
{
return seq_open(file, &status_op);
}
static const struct file_operations config_fops = {
.owner = THIS_MODULE,
.open = config_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
static const struct file_operations status_fops = {
.owner = THIS_MODULE,
.open = status_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
static int wandev_show(struct seq_file *m, void *v)
{
struct wan_device *wandev = m->private;
if (wandev->magic != ROUTER_MAGIC)
return 0;
if (!wandev->state) {
seq_puts(m, "device is not configured!\n");
return 0;
}
/* Update device statistics */
if (wandev->update) {
int err = wandev->update(wandev);
if (err == -EAGAIN) {
seq_puts(m, "Device is busy!\n");
return 0;
}
if (err) {
seq_puts(m, "Device is not configured!\n");
return 0;
}
}
seq_printf(m, PROC_STATS_FORMAT,
"total packets received", wandev->stats.rx_packets);
seq_printf(m, PROC_STATS_FORMAT,
"total packets transmitted", wandev->stats.tx_packets);
seq_printf(m, PROC_STATS_FORMAT,
"total bytes received", wandev->stats.rx_bytes);
seq_printf(m, PROC_STATS_FORMAT,
"total bytes transmitted", wandev->stats.tx_bytes);
seq_printf(m, PROC_STATS_FORMAT,
"bad packets received", wandev->stats.rx_errors);
seq_printf(m, PROC_STATS_FORMAT,
"packet transmit problems", wandev->stats.tx_errors);
seq_printf(m, PROC_STATS_FORMAT,
"received frames dropped", wandev->stats.rx_dropped);
seq_printf(m, PROC_STATS_FORMAT,
"transmit frames dropped", wandev->stats.tx_dropped);
seq_printf(m, PROC_STATS_FORMAT,
"multicast packets received", wandev->stats.multicast);
seq_printf(m, PROC_STATS_FORMAT,
"transmit collisions", wandev->stats.collisions);
seq_printf(m, PROC_STATS_FORMAT,
"receive length errors", wandev->stats.rx_length_errors);
seq_printf(m, PROC_STATS_FORMAT,
"receiver overrun errors", wandev->stats.rx_over_errors);
seq_printf(m, PROC_STATS_FORMAT,
"CRC errors", wandev->stats.rx_crc_errors);
seq_printf(m, PROC_STATS_FORMAT,
"frame format errors (aborts)", wandev->stats.rx_frame_errors);
seq_printf(m, PROC_STATS_FORMAT,
"receiver fifo overrun", wandev->stats.rx_fifo_errors);
seq_printf(m, PROC_STATS_FORMAT,
"receiver missed packet", wandev->stats.rx_missed_errors);
seq_printf(m, PROC_STATS_FORMAT,
"aborted frames transmitted", wandev->stats.tx_aborted_errors);
return 0;
}
static int wandev_open(struct inode *inode, struct file *file)
{
return single_open(file, wandev_show, PDE(inode)->data);
}
static const struct file_operations wandev_fops = {
.owner = THIS_MODULE,
.open = wandev_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
.unlocked_ioctl = wanrouter_ioctl,
};
/*
* Initialize router proc interface.
*/
int __init wanrouter_proc_init(void)
{
struct proc_dir_entry *p;
proc_router = proc_mkdir(ROUTER_NAME, init_net.proc_net);
if (!proc_router)
goto fail;
p = proc_create("config", S_IRUGO, proc_router, &config_fops);
if (!p)
goto fail_config;
p = proc_create("status", S_IRUGO, proc_router, &status_fops);
if (!p)
goto fail_stat;
return 0;
fail_stat:
remove_proc_entry("config", proc_router);
fail_config:
remove_proc_entry(ROUTER_NAME, init_net.proc_net);
fail:
return -ENOMEM;
}
/*
* Clean up router proc interface.
*/
void wanrouter_proc_cleanup(void)
{
remove_proc_entry("config", proc_router);
remove_proc_entry("status", proc_router);
remove_proc_entry(ROUTER_NAME, init_net.proc_net);
}
/*
* Add directory entry for WAN device.
*/
int wanrouter_proc_add(struct wan_device* wandev)
{
if (wandev->magic != ROUTER_MAGIC)
return -EINVAL;
wandev->dent = proc_create(wandev->name, S_IRUGO,
proc_router, &wandev_fops);
if (!wandev->dent)
return -ENOMEM;
wandev->dent->data = wandev;
return 0;
}
/*
* Delete directory entry for WAN device.
*/
int wanrouter_proc_delete(struct wan_device* wandev)
{
if (wandev->magic != ROUTER_MAGIC)
return -EINVAL;
remove_proc_entry(wandev->name, proc_router);
return 0;
}
#else
/*
* No /proc - output stubs
*/
int __init wanrouter_proc_init(void)
{
return 0;
}
void wanrouter_proc_cleanup(void)
{
}
int wanrouter_proc_add(struct wan_device *wandev)
{
return 0;
}
int wanrouter_proc_delete(struct wan_device *wandev)
{
return 0;
}
#endif
/*
* End
*/
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment