Commit 7ece26ee authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

[PATCH] remove a pile of 2.0 and 2.2 support

parent e49392aa
...@@ -812,13 +812,8 @@ static int munich_probe(void) ...@@ -812,13 +812,8 @@ static int munich_probe(void)
printk("munich_probe: munich chip found, IRQ %d\n", pci->irq); printk("munich_probe: munich chip found, IRQ %d\n", pci->irq);
#if (LINUX_VERSION_CODE < 0x02030d)
bar1 = ioremap_nocache(pci->base_address[0], 0x100);
lbi = ioremap_nocache(pci->base_address[1], 0x100);
#else
bar1 = ioremap_nocache(pci->resource[0].start, 0x100); bar1 = ioremap_nocache(pci->resource[0].start, 0x100);
lbi = ioremap_nocache(pci->resource[1].start, 0x100); lbi = ioremap_nocache(pci->resource[1].start, 0x100);
#endif
if (bar1 && lbi) if (bar1 && lbi)
{ {
......
...@@ -198,12 +198,6 @@ void cpc_tty_init(pc300dev_t *pc300dev) ...@@ -198,12 +198,6 @@ void cpc_tty_init(pc300dev_t *pc300dev)
int port, aux; int port, aux;
st_cpc_tty_area * cpc_tty; st_cpc_tty_area * cpc_tty;
if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) {
printk("%s-tty: Error: TTY driver is supported on 2.4.X kernel!\n",
((struct net_device*)(pc300dev->hdlc))->name);
return;
}
/* hdlcX - X=interface number */ /* hdlcX - X=interface number */
port = ((struct net_device*)(pc300dev->hdlc))->name[4] - '0'; port = ((struct net_device*)(pc300dev->hdlc))->name[4] - '0';
if (port >= CPC_TTY_NPORTS) { if (port >= CPC_TTY_NPORTS) {
......
This diff is collapsed.
This diff is collapsed.
...@@ -252,8 +252,6 @@ static int wpft1_exec(sdla_t *card, void *u_cmd, void *u_data) ...@@ -252,8 +252,6 @@ static int wpft1_exec(sdla_t *card, void *u_cmd, void *u_data)
CHDLC_MAILBOX_STRUCT* mbox = card->mbox; CHDLC_MAILBOX_STRUCT* mbox = card->mbox;
int len; int len;
#if defined(LINUX_2_1) || defined(LINUX_2_4)
if (copy_from_user((void*)&mbox->command, u_cmd, sizeof(ft1_exec_cmd_t))){ if (copy_from_user((void*)&mbox->command, u_cmd, sizeof(ft1_exec_cmd_t))){
return -EFAULT; return -EFAULT;
} }
...@@ -282,36 +280,6 @@ static int wpft1_exec(sdla_t *card, void *u_cmd, void *u_data) ...@@ -282,36 +280,6 @@ static int wpft1_exec(sdla_t *card, void *u_cmd, void *u_data)
return -EFAULT; return -EFAULT;
} }
#else
if (!u_cmd || verify_area(VERIFY_WRITE, u_cmd, sizeof(ft1_exec_cmd_t))){
return -EFAULT;
}
memcpy_fromfs((void*)&mbox->command, u_cmd, sizeof(ft1_exec_cmd_t));
len = mbox->buffer_length;
if (len) {
if (!u_data || verify_area(VERIFY_READ, u_data, len))
return -EFAULT;
memcpy_fromfs((void*)&mbox->data, u_data, len);
}
/* execute command */
if (!sdla_exec(mbox))
return -EIO;
/* return result */
memcpy_tofs(u_cmd, (void*)&mbox->command, sizeof(ft1_exec_cmd_t));
len = mbox->buffer_length;
if (len && u_data && !verify_area(VERIFY_WRITE, u_data, len)){
memcpy_tofs(u_data, (void*)&mbox->data, len);
}
#endif
return 0; return 0;
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -64,26 +64,10 @@ ...@@ -64,26 +64,10 @@
#include <linux/sdlapci.h> #include <linux/sdlapci.h>
#include <linux/if_wanpipe_common.h> #include <linux/if_wanpipe_common.h>
#if defined(LINUX_2_4) #define netdevice_t struct net_device
#include <asm/uaccess.h> /* kernel <-> user copy */ #include <asm/uaccess.h> /* kernel <-> user copy */
#include <linux/inetdevice.h> #include <linux/inetdevice.h>
#define netdevice_t struct net_device
#elif defined(LINUX_2_1)
#include <asm/uaccess.h> /* kernel <-> user copy */
#include <linux/inetdevice.h>
#define netdevice_t struct device
#else
#include <asm/segment.h>
#define devinet_ioctl(x,y) dev_ioctl(x,y)
#define netdevice_t struct device
#define test_and_set_bit set_bit
typedef unsigned long mm_segment_t;
#endif
#include <linux/ip.h> #include <linux/ip.h>
#include <net/route.h> #include <net/route.h>
...@@ -240,23 +224,12 @@ static sdla_t* card_array = NULL; /* adapter data space */ ...@@ -240,23 +224,12 @@ static sdla_t* card_array = NULL; /* adapter data space */
* function, which will execute all pending, * function, which will execute all pending,
* tasks in wanpipe_tq_custom queue */ * tasks in wanpipe_tq_custom queue */
#ifdef LINUX_2_4
DECLARE_TASK_QUEUE(wanpipe_tq_custom); DECLARE_TASK_QUEUE(wanpipe_tq_custom);
static struct tq_struct wanpipe_tq_task = static struct tq_struct wanpipe_tq_task =
{ {
.routine = (void (*)(void *)) run_wanpipe_tq, .routine = (void (*)(void *)) run_wanpipe_tq,
.data = &wanpipe_tq_custom .data = &wanpipe_tq_custom
}; };
#else
static struct tq_struct *wanpipe_tq_custom = NULL;
static struct tq_struct wanpipe_tq_task =
{
NULL,
0,
(void *)(void *) run_wanpipe_tq,
&wanpipe_tq_custom
};
#endif
static int wanpipe_bh_critical=0; static int wanpipe_bh_critical=0;
...@@ -511,9 +484,7 @@ static int setup (wan_device_t* wandev, wandev_conf_t* conf) ...@@ -511,9 +484,7 @@ static int setup (wan_device_t* wandev, wandev_conf_t* conf)
if (!card->configured){ if (!card->configured){
/* Initialize the Spin lock */ /* Initialize the Spin lock */
#if defined(__SMP__) || defined(LINUX_2_4)
printk(KERN_INFO "%s: Initializing for SMP\n",wandev->name); printk(KERN_INFO "%s: Initializing for SMP\n",wandev->name);
#endif
/* Piggyback spin lock has already been initialized, /* Piggyback spin lock has already been initialized,
* in check_s514/s508_conflicts() */ * in check_s514/s508_conflicts() */
...@@ -974,26 +945,13 @@ static int ioctl_dump (sdla_t* card, sdla_dump_t* u_dump) ...@@ -974,26 +945,13 @@ static int ioctl_dump (sdla_t* card, sdla_dump_t* u_dump)
unsigned long smp_flags; unsigned long smp_flags;
int err = 0; int err = 0;
#if defined(LINUX_2_1) || defined(LINUX_2_4)
if(copy_from_user((void*)&dump, (void*)u_dump, sizeof(sdla_dump_t))) if(copy_from_user((void*)&dump, (void*)u_dump, sizeof(sdla_dump_t)))
return -EFAULT; return -EFAULT;
#else
if ((u_dump == NULL) ||
verify_area(VERIFY_READ, u_dump, sizeof(sdla_dump_t)))
return -EFAULT;
memcpy_fromfs((void*)&dump, (void*)u_dump, sizeof(sdla_dump_t));
#endif
if ((dump.magic != WANPIPE_MAGIC) || if ((dump.magic != WANPIPE_MAGIC) ||
(dump.offset + dump.length > card->hw.memory)) (dump.offset + dump.length > card->hw.memory))
return -EINVAL; return -EINVAL;
#ifdef LINUX_2_0
if ((dump.ptr == NULL) ||
verify_area(VERIFY_WRITE, dump.ptr, dump.length))
return -EFAULT;
#endif
winsize = card->hw.dpmsize; winsize = card->hw.dpmsize;
if(card->hw.type != SDLA_S514) { if(card->hw.type != SDLA_S514) {
...@@ -1014,17 +972,13 @@ static int ioctl_dump (sdla_t* card, sdla_dump_t* u_dump) ...@@ -1014,17 +972,13 @@ static int ioctl_dump (sdla_t* card, sdla_dump_t* u_dump)
break; break;
} }
#if defined(LINUX_2_1) || defined(LINUX_2_4)
if(copy_to_user((void *)dump.ptr, if(copy_to_user((void *)dump.ptr,
(u8 *)card->hw.dpmbase + pos, len)){ (u8 *)card->hw.dpmbase + pos, len)){
unlock_adapter_irq(&card->wandev.lock, &smp_flags); unlock_adapter_irq(&card->wandev.lock, &smp_flags);
return -EFAULT; return -EFAULT;
} }
#else
memcpy_tofs((void*)(dump.ptr),
(void*)(card->hw.dpmbase + pos), len);
#endif
dump.length -= len; dump.length -= len;
dump.offset += len; dump.offset += len;
(char*)dump.ptr += len; (char*)dump.ptr += len;
...@@ -1035,15 +989,10 @@ static int ioctl_dump (sdla_t* card, sdla_dump_t* u_dump) ...@@ -1035,15 +989,10 @@ static int ioctl_dump (sdla_t* card, sdla_dump_t* u_dump)
}else { }else {
#if defined(LINUX_2_1) || defined(LINUX_2_4)
if(copy_to_user((void *)dump.ptr, if(copy_to_user((void *)dump.ptr,
(u8 *)card->hw.dpmbase + dump.offset, dump.length)){ (u8 *)card->hw.dpmbase + dump.offset, dump.length)){
return -EFAULT; return -EFAULT;
} }
#else
memcpy_tofs((void*)(dump.ptr),
(void*)(card->hw.dpmbase + dump.offset), dump.length);
#endif
} }
return err; return err;
...@@ -1064,15 +1013,8 @@ static int ioctl_exec (sdla_t* card, sdla_exec_t* u_exec, int cmd) ...@@ -1064,15 +1013,8 @@ static int ioctl_exec (sdla_t* card, sdla_exec_t* u_exec, int cmd)
return -ENODEV; return -ENODEV;
} }
#if defined(LINUX_2_1) || defined(LINUX_2_4)
if(copy_from_user((void*)&exec, (void*)u_exec, sizeof(sdla_exec_t))) if(copy_from_user((void*)&exec, (void*)u_exec, sizeof(sdla_exec_t)))
return -EFAULT; return -EFAULT;
#else
if ((u_exec == NULL) ||
verify_area(VERIFY_READ, u_exec, sizeof(sdla_exec_t)))
return -EFAULT;
memcpy_fromfs((void*)&exec, (void*)u_exec, sizeof(sdla_exec_t));
#endif
if ((exec.magic != WANPIPE_MAGIC) || (exec.cmd == NULL)) if ((exec.magic != WANPIPE_MAGIC) || (exec.cmd == NULL))
return -EINVAL; return -EINVAL;
...@@ -1345,60 +1287,33 @@ int change_dev_flags (netdevice_t *dev, unsigned flags) ...@@ -1345,60 +1287,33 @@ int change_dev_flags (netdevice_t *dev, unsigned flags)
unsigned long get_ip_address (netdevice_t *dev, int option) unsigned long get_ip_address (netdevice_t *dev, int option)
{ {
#ifdef LINUX_2_4
struct in_ifaddr *ifaddr; struct in_ifaddr *ifaddr;
struct in_device *in_dev; struct in_device *in_dev;
if ((in_dev = __in_dev_get(dev)) == NULL){ if ((in_dev = __in_dev_get(dev)) == NULL){
return 0; return 0;
} }
#elif defined(LINUX_2_1)
struct in_ifaddr *ifaddr;
struct in_device *in_dev;
if ((in_dev = dev->ip_ptr) == NULL){
return 0;
}
#endif
#if defined(LINUX_2_1) || defined(LINUX_2_4)
if ((ifaddr = in_dev->ifa_list)== NULL ){ if ((ifaddr = in_dev->ifa_list)== NULL ){
return 0; return 0;
} }
#endif
switch (option){ switch (option){
case WAN_LOCAL_IP: case WAN_LOCAL_IP:
#ifdef LINUX_2_0
return dev->pa_addr;
#else
return ifaddr->ifa_local; return ifaddr->ifa_local;
#endif
break; break;
case WAN_POINTOPOINT_IP: case WAN_POINTOPOINT_IP:
#ifdef LINUX_2_0
return dev->pa_dstaddr;
#else
return ifaddr->ifa_address; return ifaddr->ifa_address;
#endif
break; break;
case WAN_NETMASK_IP: case WAN_NETMASK_IP:
#ifdef LINUX_2_0
return dev->pa_mask;
#else
return ifaddr->ifa_mask; return ifaddr->ifa_mask;
#endif
break; break;
case WAN_BROADCAST_IP: case WAN_BROADCAST_IP:
#ifdef LINUX_2_0
return dev->pa_brdaddr;
#else
return ifaddr->ifa_broadcast; return ifaddr->ifa_broadcast;
#endif
break; break;
default: default:
return 0; return 0;
...@@ -1431,11 +1346,7 @@ void add_gateway(sdla_t *card, netdevice_t *dev) ...@@ -1431,11 +1346,7 @@ void add_gateway(sdla_t *card, netdevice_t *dev)
oldfs = get_fs(); oldfs = get_fs();
set_fs(get_ds()); set_fs(get_ds());
#if defined(LINUX_2_1) || defined(LINUX_2_4)
res = ip_rt_ioctl(SIOCADDRT,&route); res = ip_rt_ioctl(SIOCADDRT,&route);
#else
res = ip_rt_new(&route);
#endif
set_fs(oldfs); set_fs(oldfs);
if (res == 0){ if (res == 0){
......
...@@ -42,19 +42,11 @@ ...@@ -42,19 +42,11 @@
#include <linux/if_wanpipe.h> #include <linux/if_wanpipe.h>
#if defined(LINUX_2_1) || defined(LINUX_2_4) #include <linux/inetdevice.h>
#include <linux/inetdevice.h> #include <asm/uaccess.h>
#include <asm/uaccess.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,3) #include <net/syncppp.h>
#include <net/syncppp.h>
#else
#include "syncppp.h"
#endif
#else
#include <net/route.h> /* Adding new route entries */
#endif
/****** Defines & Macros ****************************************************/ /****** Defines & Macros ****************************************************/
...@@ -148,15 +140,9 @@ static int if_init (netdevice_t* dev); ...@@ -148,15 +140,9 @@ static int if_init (netdevice_t* dev);
static int if_open (netdevice_t* dev); static int if_open (netdevice_t* dev);
static int if_close (netdevice_t* dev); static int if_close (netdevice_t* dev);
static int if_send (struct sk_buff* skb, netdevice_t* dev); static int if_send (struct sk_buff* skb, netdevice_t* dev);
#if defined(LINUX_2_1) || defined(LINUX_2_4)
static struct net_device_stats* if_stats (netdevice_t* dev); static struct net_device_stats* if_stats (netdevice_t* dev);
#else
static struct enet_statistics* if_stats (netdevice_t* dev);
#endif
#ifdef LINUX_2_4
static void if_tx_timeout (netdevice_t *dev); static void if_tx_timeout (netdevice_t *dev);
#endif
/* CHDLC Firmware interface functions */ /* CHDLC Firmware interface functions */
static int chdlc_configure (sdla_t* card, void* data); static int chdlc_configure (sdla_t* card, void* data);
...@@ -601,18 +587,8 @@ static int new_if (wan_device_t* wandev, netdevice_t* pdev, wanif_conf_t* conf) ...@@ -601,18 +587,8 @@ static int new_if (wan_device_t* wandev, netdevice_t* pdev, wanif_conf_t* conf)
/* prepare network device data space for registration */ /* prepare network device data space for registration */
#ifdef LINUX_2_4
strcpy(dev->name,card->u.c.if_name); strcpy(dev->name,card->u.c.if_name);
#else
dev->name = (char *)kmalloc(strlen(card->u.c.if_name) + 2, GFP_KERNEL);
if(dev->name == NULL)
{
kfree(chdlc_priv_area);
return -ENOMEM;
}
sprintf(dev->name, "%s", card->u.c.if_name);
#endif
/* Attach PPP protocol layer to pppdev /* Attach PPP protocol layer to pppdev
* The sppp_attach() will initilize the dev structure * The sppp_attach() will initilize the dev structure
* and setup ppp layer protocols. * and setup ppp layer protocols.
...@@ -620,11 +596,7 @@ static int new_if (wan_device_t* wandev, netdevice_t* pdev, wanif_conf_t* conf) ...@@ -620,11 +596,7 @@ static int new_if (wan_device_t* wandev, netdevice_t* pdev, wanif_conf_t* conf)
* if_open(), if_close(), if_send() and get_stats() functions. * if_open(), if_close(), if_send() and get_stats() functions.
*/ */
sppp_attach(pppdev); sppp_attach(pppdev);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,16)
dev = pppdev->dev; dev = pppdev->dev;
#else
dev = &pppdev->dev;
#endif
sp = &pppdev->sppp; sp = &pppdev->sppp;
/* Enable PPP Debugging */ /* Enable PPP Debugging */
...@@ -684,9 +656,6 @@ static int if_init (netdevice_t* dev) ...@@ -684,9 +656,6 @@ static int if_init (netdevice_t* dev)
chdlc_private_area_t* chdlc_priv_area = dev->priv; chdlc_private_area_t* chdlc_priv_area = dev->priv;
sdla_t* card = chdlc_priv_area->card; sdla_t* card = chdlc_priv_area->card;
wan_device_t* wandev = &card->wandev; wan_device_t* wandev = &card->wandev;
#ifdef LINUX_2_0
int i;
#endif
/* NOTE: Most of the dev initialization was /* NOTE: Most of the dev initialization was
* done in sppp_attach(), called by new_if() * done in sppp_attach(), called by new_if()
...@@ -699,16 +668,10 @@ static int if_init (netdevice_t* dev) ...@@ -699,16 +668,10 @@ static int if_init (netdevice_t* dev)
dev->stop = &if_close; dev->stop = &if_close;
dev->hard_start_xmit = &if_send; dev->hard_start_xmit = &if_send;
dev->get_stats = &if_stats; dev->get_stats = &if_stats;
#ifdef LINUX_2_4
dev->tx_timeout = &if_tx_timeout; dev->tx_timeout = &if_tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT; dev->watchdog_timeo = TX_TIMEOUT;
#endif
#ifdef LINUX_2_0
dev->family = AF_INET;
#endif
/* Initialize hardware parameters */ /* Initialize hardware parameters */
dev->irq = wandev->irq; dev->irq = wandev->irq;
dev->dma = wandev->dma; dev->dma = wandev->dma;
...@@ -724,17 +687,10 @@ static int if_init (netdevice_t* dev) ...@@ -724,17 +687,10 @@ static int if_init (netdevice_t* dev)
*/ */
dev->tx_queue_len = 100; dev->tx_queue_len = 100;
/* Initialize socket buffers */
#if !defined(LINUX_2_1) && !defined(LINUX_2_4)
for (i = 0; i < DEV_NUMBUFFS; ++i)
skb_queue_head_init(&dev->buffs[i]);
#endif
return 0; return 0;
} }
#ifdef LINUX_2_4
/*============================================================================ /*============================================================================
* Handle transmit timeout event from netif watchdog * Handle transmit timeout event from netif watchdog
*/ */
...@@ -754,8 +710,6 @@ static void if_tx_timeout (netdevice_t *dev) ...@@ -754,8 +710,6 @@ static void if_tx_timeout (netdevice_t *dev)
printk (KERN_INFO "%s: Transmit timed out on %s\n", card->devname,dev->name); printk (KERN_INFO "%s: Transmit timed out on %s\n", card->devname,dev->name);
netif_wake_queue (dev); netif_wake_queue (dev);
} }
#endif
/*============================================================================ /*============================================================================
...@@ -773,14 +727,8 @@ static int if_open (netdevice_t* dev) ...@@ -773,14 +727,8 @@ static int if_open (netdevice_t* dev)
SHARED_MEMORY_INFO_STRUCT *flags = card->u.c.flags; SHARED_MEMORY_INFO_STRUCT *flags = card->u.c.flags;
/* Only one open per interface is allowed */ /* Only one open per interface is allowed */
#ifdef LINUX_2_4
if (netif_running(dev)) if (netif_running(dev))
return -EBUSY; return -EBUSY;
#else
if (dev->start)
return -EBUSY; /* only one open is allowed */
#endif
/* Start PPP Layer */ /* Start PPP Layer */
if (sppp_open(dev)){ if (sppp_open(dev)){
...@@ -790,13 +738,7 @@ static int if_open (netdevice_t* dev) ...@@ -790,13 +738,7 @@ static int if_open (netdevice_t* dev)
do_gettimeofday(&tv); do_gettimeofday(&tv);
chdlc_priv_area->router_start_time = tv.tv_sec; chdlc_priv_area->router_start_time = tv.tv_sec;
#ifdef LINUX_2_4
netif_start_queue(dev); netif_start_queue(dev);
#else
dev->interrupt = 0;
dev->tbusy = 0;
dev->start = 1;
#endif
wanpipe_open(card); wanpipe_open(card);
...@@ -817,11 +759,7 @@ static int if_close (netdevice_t* dev) ...@@ -817,11 +759,7 @@ static int if_close (netdevice_t* dev)
/* Stop the PPP Layer */ /* Stop the PPP Layer */
sppp_close(dev); sppp_close(dev);
stop_net_queue(dev); netif_stop_queue(dev);
#ifndef LINUX_2_4
dev->start=0;
#endif
wanpipe_close(card); wanpipe_close(card);
...@@ -855,9 +793,7 @@ static int if_send (struct sk_buff* skb, netdevice_t* dev) ...@@ -855,9 +793,7 @@ static int if_send (struct sk_buff* skb, netdevice_t* dev)
unsigned long smp_flags; unsigned long smp_flags;
int err=0; int err=0;
#ifdef LINUX_2_4
netif_stop_queue(dev); netif_stop_queue(dev);
#endif
if (skb == NULL){ if (skb == NULL){
...@@ -867,32 +803,10 @@ static int if_send (struct sk_buff* skb, netdevice_t* dev) ...@@ -867,32 +803,10 @@ static int if_send (struct sk_buff* skb, netdevice_t* dev)
printk(KERN_INFO "%s: Received NULL skb buffer! interface %s got kicked!\n", printk(KERN_INFO "%s: Received NULL skb buffer! interface %s got kicked!\n",
card->devname, dev->name); card->devname, dev->name);
wake_net_dev(dev); netif_wake_queue(dev);
return 0; return 0;
} }
#ifndef LINUX_2_4
if (dev->tbusy){
/* If our device stays busy for at least 5 seconds then we will
* kick start the device by making dev->tbusy = 0. We expect
* that our device never stays busy more than 5 seconds. So this
* is only used as a last resort.
*/
++card->wandev.stats.collisions;
if((jiffies - chdlc_priv_area->tick_counter) < (5 * HZ)) {
return 1;
}
printk (KERN_INFO "%s: Transmit (tbusy) timeout !\n",
card->devname);
/* unbusy the interface */
dev->tbusy = 0;
}
#endif
if (ntohs(skb->protocol) != htons(PVC_PROT)){ if (ntohs(skb->protocol) != htons(PVC_PROT)){
/* check the udp packet type */ /* check the udp packet type */
...@@ -903,7 +817,7 @@ static int if_send (struct sk_buff* skb, netdevice_t* dev) ...@@ -903,7 +817,7 @@ static int if_send (struct sk_buff* skb, netdevice_t* dev)
chdlc_int->interrupt_permission |= chdlc_int->interrupt_permission |=
APP_INT_ON_TIMER; APP_INT_ON_TIMER;
} }
start_net_queue(dev); netif_start_queue(dev);
return 0; return 0;
} }
} }
...@@ -918,33 +832,29 @@ static int if_send (struct sk_buff* skb, netdevice_t* dev) ...@@ -918,33 +832,29 @@ static int if_send (struct sk_buff* skb, netdevice_t* dev)
printk(KERN_INFO "%s: Critical in if_send: %lx\n", printk(KERN_INFO "%s: Critical in if_send: %lx\n",
card->wandev.name,card->wandev.critical); card->wandev.name,card->wandev.critical);
++card->wandev.stats.tx_dropped; ++card->wandev.stats.tx_dropped;
start_net_queue(dev); netif_start_queue(dev);
goto if_send_crit_exit; goto if_send_crit_exit;
} }
if (card->wandev.state != WAN_CONNECTED){ if (card->wandev.state != WAN_CONNECTED){
++card->wandev.stats.tx_dropped; ++card->wandev.stats.tx_dropped;
start_net_queue(dev); netif_start_queue(dev);
goto if_send_crit_exit; goto if_send_crit_exit;
} }
if (chdlc_send(card, skb->data, skb->len)){ if (chdlc_send(card, skb->data, skb->len)){
stop_net_queue(dev); netif_stop_queue(dev);
}else{ }else{
++card->wandev.stats.tx_packets; ++card->wandev.stats.tx_packets;
#if defined(LINUX_2_1) || defined(LINUX_2_4)
card->wandev.stats.tx_bytes += skb->len; card->wandev.stats.tx_bytes += skb->len;
#endif
#ifdef LINUX_2_4
dev->trans_start = jiffies; dev->trans_start = jiffies;
#endif netif_start_queue(dev);
start_net_queue(dev);
} }
if_send_crit_exit: if_send_crit_exit:
if (!(err=is_queue_stopped(dev))){ if (!(err=netif_queue_stopped(dev))){
wan_dev_kfree_skb(skb, FREE_WRITE); dev_kfree_skb_any(skb);
}else{ }else{
chdlc_priv_area->tick_counter = jiffies; chdlc_priv_area->tick_counter = jiffies;
chdlc_int->interrupt_permission |= APP_INT_ON_TX_FRAME; chdlc_int->interrupt_permission |= APP_INT_ON_TX_FRAME;
...@@ -1063,7 +973,6 @@ unsigned short calc_checksum (char *data, int len) ...@@ -1063,7 +973,6 @@ unsigned short calc_checksum (char *data, int len)
* Get ethernet-style interface statistics. * Get ethernet-style interface statistics.
* Return a pointer to struct enet_statistics. * Return a pointer to struct enet_statistics.
*/ */
#if defined(LINUX_2_1) || defined(LINUX_2_4)
static struct net_device_stats* if_stats (netdevice_t* dev) static struct net_device_stats* if_stats (netdevice_t* dev)
{ {
sdla_t *my_card; sdla_t *my_card;
...@@ -1079,23 +988,7 @@ static struct net_device_stats* if_stats (netdevice_t* dev) ...@@ -1079,23 +988,7 @@ static struct net_device_stats* if_stats (netdevice_t* dev)
my_card = chdlc_priv_area->card; my_card = chdlc_priv_area->card;
return &my_card->wandev.stats; return &my_card->wandev.stats;
} }
#else
static struct enet_statistics* if_stats (netdevice_t* dev)
{
sdla_t *my_card;
chdlc_private_area_t* chdlc_priv_area = dev->priv;
/* Shutdown bug fix. In del_if() we kill
* dev->priv pointer. This function, gets
* called after del_if(), thus check
* if pointer has been deleted */
if ((chdlc_priv_area=dev->priv) == NULL)
return NULL;
my_card = chdlc_priv_area->card;
return &my_card->wandev.stats;
}
#endif
/****** Cisco HDLC Firmware Interface Functions *******************************/ /****** Cisco HDLC Firmware Interface Functions *******************************/
...@@ -1417,7 +1310,7 @@ STATIC void wsppp_isr (sdla_t* card) ...@@ -1417,7 +1310,7 @@ STATIC void wsppp_isr (sdla_t* card)
flags->interrupt_info_struct.interrupt_permission &= flags->interrupt_info_struct.interrupt_permission &=
~APP_INT_ON_TX_FRAME; ~APP_INT_ON_TX_FRAME;
wake_net_dev(dev); netif_wake_queue(dev);
break; break;
case COMMAND_COMPLETE_APP_INT_PEND:/* 0x04: cmd cplt */ case COMMAND_COMPLETE_APP_INT_PEND:/* 0x04: cmd cplt */
...@@ -1505,15 +1398,9 @@ static void rx_intr (sdla_t* card) ...@@ -1505,15 +1398,9 @@ static void rx_intr (sdla_t* card)
goto rx_exit; goto rx_exit;
} }
#ifdef LINUX_2_4
if (!netif_running(dev)){ if (!netif_running(dev)){
goto rx_exit; goto rx_exit;
} }
#else
if (!dev->start){
goto rx_exit;
}
#endif
chdlc_priv_area = dev->priv; chdlc_priv_area = dev->priv;
...@@ -1555,9 +1442,7 @@ static void rx_intr (sdla_t* card) ...@@ -1555,9 +1442,7 @@ static void rx_intr (sdla_t* card)
skb->protocol = htons(ETH_P_WAN_PPP); skb->protocol = htons(ETH_P_WAN_PPP);
card->wandev.stats.rx_packets ++; card->wandev.stats.rx_packets ++;
#if defined(LINUX_2_1) || defined(LINUX_2_4)
card->wandev.stats.rx_bytes += skb->len; card->wandev.stats.rx_bytes += skb->len;
#endif
udp_type = udp_pkt_type( skb, card ); udp_type = udp_pkt_type( skb, card );
if(udp_type == UDP_CPIPE_TYPE) { if(udp_type == UDP_CPIPE_TYPE) {
...@@ -1795,9 +1680,9 @@ static int store_udp_mgmt_pkt(char udp_pkt_src, sdla_t* card, ...@@ -1795,9 +1680,9 @@ static int store_udp_mgmt_pkt(char udp_pkt_src, sdla_t* card,
} }
if(udp_pkt_src == UDP_PKT_FRM_STACK) if(udp_pkt_src == UDP_PKT_FRM_STACK)
wan_dev_kfree_skb(skb, FREE_WRITE); dev_kfree_skb_any(skb);
else else
wan_dev_kfree_skb(skb, FREE_READ); dev_kfree_skb_any(skb);
return(udp_pkt_stored); return(udp_pkt_stored);
} }
...@@ -2156,9 +2041,7 @@ static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* dev, ...@@ -2156,9 +2041,7 @@ static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* dev,
if(chdlc_priv_area->udp_pkt_src == UDP_PKT_FRM_NETWORK) { if(chdlc_priv_area->udp_pkt_src == UDP_PKT_FRM_NETWORK) {
if(!chdlc_send(card, chdlc_priv_area->udp_pkt_data, len)) { if(!chdlc_send(card, chdlc_priv_area->udp_pkt_data, len)) {
++ card->wandev.stats.tx_packets; ++ card->wandev.stats.tx_packets;
#if defined(LINUX_2_1) || defined(LINUX_2_4)
card->wandev.stats.tx_bytes += len; card->wandev.stats.tx_bytes += len;
#endif
} }
} else { } else {
...@@ -2360,28 +2243,20 @@ static void port_set_state (sdla_t *card, int state) ...@@ -2360,28 +2243,20 @@ static void port_set_state (sdla_t *card, int state)
void s508_lock (sdla_t *card, unsigned long *smp_flags) void s508_lock (sdla_t *card, unsigned long *smp_flags)
{ {
#if defined(__SMP__) || defined(LINUX_2_4)
spin_lock_irqsave(&card->wandev.lock, *smp_flags); spin_lock_irqsave(&card->wandev.lock, *smp_flags);
if (card->next){ if (card->next){
/* It is ok to use spin_lock here, since we /* It is ok to use spin_lock here, since we
* already turned off interrupts */ * already turned off interrupts */
spin_lock(&card->next->wandev.lock); spin_lock(&card->next->wandev.lock);
} }
#else
disable_irq(card->hw.irq);
#endif
} }
void s508_unlock (sdla_t *card, unsigned long *smp_flags) void s508_unlock (sdla_t *card, unsigned long *smp_flags)
{ {
#if defined(__SMP__) || defined(LINUX_2_4)
if (card->next){ if (card->next){
spin_unlock(&card->next->wandev.lock); spin_unlock(&card->next->wandev.lock);
} }
spin_unlock_irqrestore(&card->wandev.lock, *smp_flags); spin_unlock_irqrestore(&card->wandev.lock, *smp_flags);
#else
enable_irq(card->hw.irq);
#endif
} }
......
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