summaryrefslogtreecommitdiffstats
path: root/drivers/net/wan
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-02-05 06:47:02 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-02-05 06:47:02 +0000
commit99a7e12f34b3661a0d1354eef83a0eef4df5e34c (patch)
tree3560aca9ca86792f9ab7bd87861ea143a1b3c7a3 /drivers/net/wan
parente73a04659c0b8cdee4dd40e58630e2cf63afb316 (diff)
Merge with Linux 2.3.38.
Diffstat (limited to 'drivers/net/wan')
-rw-r--r--drivers/net/wan/cosa.c21
-rw-r--r--drivers/net/wan/hostess_sv11.c16
-rw-r--r--drivers/net/wan/sealevel.c28
-rw-r--r--drivers/net/wan/syncppp.c19
-rw-r--r--drivers/net/wan/syncppp.h6
5 files changed, 60 insertions, 30 deletions
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
index a48c5d31c..9dc380fbb 100644
--- a/drivers/net/wan/cosa.c
+++ b/drivers/net/wan/cosa.c
@@ -118,6 +118,7 @@ typedef struct wait_queue *wait_queue_head_t;
/* Per-channel data structure */
struct channel_data {
+ void *if_ptr; /* General purpose pointer (used by SPPP) */
int usage; /* Usage count; >0 for chrdev, -1 for netdev */
int num; /* Number of the channel */
struct cosa_data *cosa; /* Pointer to the per-card structure */
@@ -328,8 +329,6 @@ static struct file_operations cosa_fops = {
#else
NULL,
#endif
- NULL, /* check media change */
- NULL, /* revalidate */
NULL /* lock */
};
@@ -577,8 +576,10 @@ bad1: release_region(cosa->datareg,is_8bit(cosa)?2:4);
static void sppp_channel_init(struct channel_data *chan)
{
struct net_device *d;
+ chan->if_ptr = &chan->pppdev;
+ chan->pppdev.dev = kmalloc(sizeof(struct net_device), GFP_KERNEL);
sppp_attach(&chan->pppdev);
- d=&chan->pppdev.dev;
+ d=chan->pppdev.dev;
d->name = chan->name;
d->base_addr = chan->cosa->datareg;
d->irq = chan->cosa->irq;
@@ -593,15 +594,15 @@ static void sppp_channel_init(struct channel_data *chan)
dev_init_buffers(d);
if (register_netdev(d) == -1) {
printk(KERN_WARNING "%s: register_netdev failed.\n", d->name);
- sppp_detach(&chan->pppdev.dev);
+ sppp_detach(chan->pppdev.dev);
return;
}
}
static void sppp_channel_delete(struct channel_data *chan)
{
- sppp_detach(&chan->pppdev.dev);
- unregister_netdev(&chan->pppdev.dev);
+ sppp_detach(chan->pppdev.dev);
+ unregister_netdev(chan->pppdev.dev);
}
@@ -717,7 +718,7 @@ static char *sppp_setup_rx(struct channel_data *chan, int size)
chan->stats.rx_dropped++;
return NULL;
}
- chan->pppdev.dev.trans_start = jiffies;
+ chan->pppdev.dev->trans_start = jiffies;
return skb_put(chan->rx_skb, size);
}
@@ -731,13 +732,13 @@ static int sppp_rx_done(struct channel_data *chan)
return 0;
}
chan->rx_skb->protocol = htons(ETH_P_WAN_PPP);
- chan->rx_skb->dev = &chan->pppdev.dev;
+ chan->rx_skb->dev = chan->pppdev.dev;
chan->rx_skb->mac.raw = chan->rx_skb->data;
chan->stats.rx_packets++;
chan->stats.rx_bytes += chan->cosa->rxsize;
netif_rx(chan->rx_skb);
chan->rx_skb = 0;
- chan->pppdev.dev.trans_start = jiffies;
+ chan->pppdev.dev->trans_start = jiffies;
return 0;
}
@@ -755,7 +756,7 @@ static int sppp_tx_done(struct channel_data *chan, int size)
chan->tx_skb = 0;
chan->stats.tx_packets++;
chan->stats.tx_bytes += size;
- chan->pppdev.dev.tbusy = 0;
+ chan->pppdev.dev->tbusy = 0;
mark_bh(NET_BH);
return 1;
}
diff --git a/drivers/net/wan/hostess_sv11.c b/drivers/net/wan/hostess_sv11.c
index ba4e49c83..d5c7ebd5e 100644
--- a/drivers/net/wan/hostess_sv11.c
+++ b/drivers/net/wan/hostess_sv11.c
@@ -41,6 +41,7 @@ static int dma;
struct sv11_device
{
+ void *if_ptr; /* General purpose pointer (used by SPPP) */
struct z8530_dev sync;
struct ppp_device netdev;
char name[16];
@@ -240,7 +241,12 @@ static struct sv11_device *sv11_init(int iobase, int irq)
goto fail3;
memset(sv, 0, sizeof(*sv));
+ sv->if_ptr=&sv->netdev;
+ sv->netdev.dev=(struct net_device *)kmalloc(sizeof(struct net_device), GFP_KERNEL);
+ if(!sv->netdev.dev)
+ goto fail2;
+
dev=&sv->sync;
/*
@@ -264,12 +270,12 @@ static struct sv11_device *sv11_init(int iobase, int irq)
if(request_irq(irq, &z8530_interrupt, SA_INTERRUPT, "Hostess SV/11", dev)<0)
{
printk(KERN_WARNING "hostess: IRQ %d already in use.\n", irq);
- goto fail2;
+ goto fail1;
}
dev->irq=irq;
dev->chanA.private=sv;
- dev->chanA.netdevice=&sv->netdev.dev;
+ dev->chanA.netdevice=sv->netdev.dev;
dev->chanA.dev=dev;
dev->chanB.dev=dev;
dev->name=sv->name;
@@ -374,6 +380,8 @@ dmafail:
free_dma(dev->chanA.txdma);
fail:
free_irq(irq, dev);
+fail1:
+ kfree(sv->netdev.dev);
fail2:
kfree(sv);
fail3:
@@ -383,9 +391,9 @@ fail3:
static void sv11_shutdown(struct sv11_device *dev)
{
- sppp_detach(&dev->netdev.dev);
+ sppp_detach(dev->netdev.dev);
z8530_shutdown(&dev->sync);
- unregister_netdev(&dev->netdev.dev);
+ unregister_netdev(dev->netdev.dev);
free_irq(dev->sync.irq, dev);
if(dma)
{
diff --git a/drivers/net/wan/sealevel.c b/drivers/net/wan/sealevel.c
index 5cbbff8c9..90cccf81d 100644
--- a/drivers/net/wan/sealevel.c
+++ b/drivers/net/wan/sealevel.c
@@ -32,6 +32,7 @@
struct slvl_device
{
+ void *if_ptr; /* General purpose pointer (used by SPPP) */
struct z8530_channel *chan;
struct ppp_device netdev;
char name[16];
@@ -243,8 +244,19 @@ static struct slvl_board *slvl_init(int iobase, int irq, int txdma, int rxdma, i
memset(b, 0, sizeof(*sv));
b->dev[0].chan = &b->board.chanA;
+ b->dev[0].if_ptr = &b->dev[0].netdev;
+ b->dev[0].netdev.dev=(struct net_device *)
+ kmalloc(sizeof(struct net_device), GFP_KERNEL);
+ if(!b->dev[0].netdev.dev)
+ goto fail2;
+
b->dev[1].chan = &b->board.chanB;
-
+ b->dev[1].if_ptr = &b->dev[1].netdev;
+ b->dev[1].netdev.dev=(struct net_device *)
+ kmalloc(sizeof(struct net_device), GFP_KERNEL);
+ if(!b->dev[1].netdev.dev)
+ goto fail1_0;
+
dev=&b->board;
/*
@@ -283,14 +295,14 @@ static struct slvl_board *slvl_init(int iobase, int irq, int txdma, int rxdma, i
if(request_irq(irq, &z8530_interrupt, SA_INTERRUPT, "SeaLevel", dev)<0)
{
printk(KERN_WARNING "sealevel: IRQ %d already in use.\n", irq);
- goto fail2;
+ goto fail1_1;
}
dev->irq=irq;
dev->chanA.private=&b->dev[0];
dev->chanB.private=&b->dev[1];
- dev->chanA.netdevice=&b->dev[0].netdev.dev;
- dev->chanB.netdevice=&b->dev[1].netdev.dev;
+ dev->chanA.netdevice=b->dev[0].netdev.dev;
+ dev->chanB.netdevice=b->dev[1].netdev.dev;
dev->chanA.dev=dev;
dev->chanB.dev=dev;
dev->name=b->dev[0].name;
@@ -399,6 +411,10 @@ dmafail:
free_dma(dev->chanA.txdma);
fail:
free_irq(irq, dev);
+fail1_1:
+ kfree(b->dev[1].netdev.dev);
+fail1_0:
+ kfree(b->dev[0].netdev.dev);
fail2:
kfree(b);
fail3:
@@ -414,8 +430,8 @@ static void slvl_shutdown(struct slvl_board *b)
for(u=0; u<2; u++)
{
- sppp_detach(&b->dev[u].netdev.dev);
- unregister_netdev(&b->dev[u].netdev.dev);
+ sppp_detach(b->dev[u].netdev.dev);
+ unregister_netdev(b->dev[u].netdev.dev);
}
free_irq(b->board.irq, &b->board);
diff --git a/drivers/net/wan/syncppp.c b/drivers/net/wan/syncppp.c
index eee3fceb8..bfa2bf89f 100644
--- a/drivers/net/wan/syncppp.c
+++ b/drivers/net/wan/syncppp.c
@@ -187,7 +187,7 @@ static void sppp_clear_timeout(struct sppp *p)
void sppp_input (struct net_device *dev, struct sk_buff *skb)
{
struct ppp_header *h;
- struct sppp *sp = &((struct ppp_device *)dev)->sppp;
+ struct sppp *sp = (struct sppp *)sppp_of(dev);
skb->dev=dev;
skb->mac.raw=skb->data;
@@ -316,7 +316,7 @@ EXPORT_SYMBOL(sppp_input);
static int sppp_hard_header(struct sk_buff *skb, struct net_device *dev, __u16 type,
void *daddr, void *saddr, unsigned int len)
{
- struct sppp *sp = &((struct ppp_device *)dev)->sppp;
+ struct sppp *sp = (struct sppp *)sppp_of(dev);
struct ppp_header *h;
skb_push(skb,sizeof(struct ppp_header));
h=(struct ppp_header *)skb->data;
@@ -826,7 +826,7 @@ static void sppp_cisco_send (struct sppp *sp, int type, long par1, long par2)
int sppp_close (struct net_device *dev)
{
- struct sppp *sp = &((struct ppp_device *)dev)->sppp;
+ struct sppp *sp = (struct sppp *)sppp_of(dev);
dev->flags &= ~IFF_RUNNING;
sp->lcp.state = LCP_STATE_CLOSED;
sp->ipcp.state = IPCP_STATE_CLOSED;
@@ -839,7 +839,7 @@ EXPORT_SYMBOL(sppp_close);
int sppp_open (struct net_device *dev)
{
- struct sppp *sp = &((struct ppp_device *)dev)->sppp;
+ struct sppp *sp = (struct sppp *)sppp_of(dev);
sppp_close(dev);
dev->flags |= IFF_RUNNING;
if (!(sp->pp_flags & PP_CISCO))
@@ -851,7 +851,7 @@ EXPORT_SYMBOL(sppp_open);
int sppp_reopen (struct net_device *dev)
{
- struct sppp *sp = &((struct ppp_device *)dev)->sppp;
+ struct sppp *sp = (struct sppp *)sppp_of(dev);
sppp_close(dev);
dev->flags |= IFF_RUNNING;
if (!(sp->pp_flags & PP_CISCO))
@@ -880,7 +880,7 @@ EXPORT_SYMBOL(sppp_change_mtu);
int sppp_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
- struct sppp *sp = &((struct ppp_device *)dev)->sppp;
+ struct sppp *sp = (struct sppp *)sppp_of(dev);
if(dev->flags&IFF_UP)
return -EBUSY;
@@ -913,7 +913,7 @@ EXPORT_SYMBOL(sppp_do_ioctl);
void sppp_attach(struct ppp_device *pd)
{
- struct net_device *dev=&pd->dev;
+ struct net_device *dev = pd->dev;
struct sppp *sp = &pd->sppp;
/* Initialize keepalive handler. */
@@ -970,8 +970,7 @@ EXPORT_SYMBOL(sppp_attach);
void sppp_detach (struct net_device *dev)
{
- struct sppp **q, *p, *sp = &((struct ppp_device *)dev)->sppp;
-
+ struct sppp **q, *p, *sp = (struct sppp *)sppp_of(dev);
/* Remove the entry from the keepalive list. */
for (q = &spppq; (p = *q); q = &p->pp_next)
@@ -1297,6 +1296,8 @@ void sync_ppp_init(void)
dev_add_pack(&sppp_packet_type);
}
+EXPORT_SYMBOL(sync_ppp_init);
+
#ifdef MODULE
int init_module(void)
diff --git a/drivers/net/wan/syncppp.h b/drivers/net/wan/syncppp.h
index c03c720ca..1e2056869 100644
--- a/drivers/net/wan/syncppp.h
+++ b/drivers/net/wan/syncppp.h
@@ -51,10 +51,13 @@ struct sppp
struct ppp_device
{
- struct net_device dev; /* Network device */
+ struct net_device *dev; /* Network device pointer */
struct sppp sppp; /* Synchronous PPP */
};
+#define sppp_of(dev) \
+ (&((struct ppp_device *)(*(unsigned long *)((dev)->priv)))->sppp)
+
#define PP_KEEPALIVE 0x01 /* use keepalive protocol */
#define PP_CISCO 0x02 /* use Cisco protocol instead of PPP */
#define PP_TIMO 0x04 /* cp_timeout routine active */
@@ -82,6 +85,7 @@ void sppp_flush (struct net_device *dev);
int sppp_open (struct net_device *dev);
int sppp_reopen (struct net_device *dev);
int sppp_close (struct net_device *dev);
+void sync_ppp_init (void);
#endif
#define SPPPIOCCISCO (SIOCDEVPRIVATE)