diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1999-10-09 00:00:47 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1999-10-09 00:00:47 +0000 |
commit | d6434e1042f3b0a6dfe1b1f615af369486f9b1fa (patch) | |
tree | e2be02f33984c48ec019c654051d27964e42c441 /drivers/isdn/isdn_ppp.c | |
parent | 609d1e803baf519487233b765eb487f9ec227a18 (diff) |
Merge with 2.3.19.
Diffstat (limited to 'drivers/isdn/isdn_ppp.c')
-rw-r--r-- | drivers/isdn/isdn_ppp.c | 101 |
1 files changed, 72 insertions, 29 deletions
diff --git a/drivers/isdn/isdn_ppp.c b/drivers/isdn/isdn_ppp.c index 7bce66d44..78c71c7fe 100644 --- a/drivers/isdn/isdn_ppp.c +++ b/drivers/isdn/isdn_ppp.c @@ -1,4 +1,4 @@ -/* $Id: isdn_ppp.c,v 1.47 1999/04/18 14:06:59 fritz Exp $ +/* $Id: isdn_ppp.c,v 1.52 1999/08/22 20:26:07 calle Exp $ * * Linux ISDN subsystem, functions for synchronous PPP (linklevel). * @@ -19,6 +19,26 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log: isdn_ppp.c,v $ + * Revision 1.52 1999/08/22 20:26:07 calle + * backported changes from kernel 2.3.14: + * - several #include "config.h" gone, others come. + * - "struct device" changed to "struct net_device" in 2.3.14, added a + * define in isdn_compat.h for older kernel versions. + * + * Revision 1.51 1999/08/18 16:19:17 hipp + * applied MPPP-resize-headroom patch + * + * Revision 1.50 1999/08/16 07:11:41 hipp + * Additional VJ decomp-buffer-size increased from 40 to 128 + * + * Revision 1.49 1999/07/06 07:47:11 calle + * bugfix: dev_alloc_skb only reserve 16 bytes. We need to look at the + * hdrlen the driver want. So I changed dev_alloc_skb calls + * to alloc_skb and skb_reserve. + * + * Revision 1.48 1999/07/01 08:29:56 keil + * compatibility to 2.3 kernel + * * Revision 1.47 1999/04/18 14:06:59 fritz * Removed TIMRU stuff. * @@ -261,7 +281,7 @@ static int isdn_ppp_fill_mpqueue(isdn_net_dev *, struct sk_buff **skb, static void isdn_ppp_free_mpqueue(isdn_net_dev *); #endif -char *isdn_ppp_revision = "$Revision: 1.47 $"; +char *isdn_ppp_revision = "$Revision: 1.52 $"; static struct ippp_struct *ippp_table[ISDN_MAX_CHANNELS]; static struct isdn_ppp_compressor *ipc_head = NULL; @@ -430,7 +450,7 @@ isdn_ppp_wakeup_daemon(isdn_net_local * lp) ippp_table[lp->ppp_slot]->state = IPPP_OPEN | IPPP_CONNECT | IPPP_NOBLOCK; -#if LINUX_VERSION_CODE < 131841 +#ifndef COMPAT_HAS_NEW_WAITQ if (ippp_table[lp->ppp_slot]->wq) #endif wake_up_interruptible(&ippp_table[lp->ppp_slot]->wq); @@ -450,10 +470,10 @@ isdn_ppp_closewait(int slot) return 0; is = ippp_table[slot]; -#if LINUX_VERSION_CODE < 131841 - if (is->state && is->wq) -#else +#ifdef COMPAT_HAS_NEW_WAITQ if (is->state) +#else + if (is->state && is->wq) #endif wake_up_interruptible(&is->wq); @@ -519,10 +539,10 @@ isdn_ppp_open(int min, struct file *file) is->mru = 1524; /* MRU, default 1524 */ is->maxcid = 16; /* VJ: maxcid */ is->tk = current; -#if LINUX_VERSION_CODE < 131841 - is->wq = NULL; /* read() wait queue */ -#else +#ifdef COMPAT_HAS_NEW_WAITQ init_waitqueue_head(&is->wq); +#else + is->wq = NULL; /* read() wait queue */ #endif is->first = is->rq + NUM_RCV_BUFFS - 1; /* receive queue */ is->last = is->rq; @@ -891,7 +911,7 @@ isdn_ppp_fill_rq(unsigned char *buf, int len, int proto, int slot) is->last = bl->next; restore_flags(flags); -#if LINUX_VERSION_CODE < 131841 +#ifndef COMPAT_HAS_NEW_WAITQ if (is->wq) #endif wake_up_interruptible(&is->wq); @@ -983,13 +1003,21 @@ isdn_ppp_write(int min, struct file *file, const char *buf, int count) if ((dev->drv[lp->isdn_device]->flags & DRV_FLAG_RUNNING) && lp->dialstate == 0 && (lp->flags & ISDN_NET_CONNECTED)) { + unsigned short hl; int cnt; struct sk_buff *skb; - skb = dev_alloc_skb(count); + /* + * we need to reserve enought space in front of + * sk_buff. old call to dev_alloc_skb only reserved + * 16 bytes, now we are looking what the driver want + */ + hl = dev->drv[lp->isdn_device]->interface->hl_hdrlen; + skb = alloc_skb(hl+count, GFP_ATOMIC); if (!skb) { printk(KERN_WARNING "isdn_ppp_write: out of memory!\n"); return count; } + skb_reserve(skb, hl); if (copy_from_user(skb_put(skb, count), buf, count)) return -EFAULT; if (is->debug & 0x40) { @@ -1271,7 +1299,7 @@ void isdn_ppp_receive(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buf static void isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff *skb, int proto) { - struct device *dev = &net_dev->dev; + struct net_device *dev = &net_dev->dev; struct ippp_struct *is = ippp_table[lp->ppp_slot]; if (is->debug & 0x10) { @@ -1336,7 +1364,7 @@ isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff { struct sk_buff *skb_old = skb; int pkt_len; - skb = dev_alloc_skb(skb_old->len + 40); + skb = dev_alloc_skb(skb_old->len + 128); if (!skb) { printk(KERN_WARNING "%s: Memory squeeze, dropping packet.\n", dev->name); @@ -1345,7 +1373,7 @@ isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff return; } skb->dev = dev; - skb_put(skb, skb_old->len + 40); + skb_put(skb, skb_old->len + 128); memcpy(skb->data, skb_old->data, skb_old->len); skb->mac.raw = skb->data; pkt_len = slhc_uncompress(ippp_table[net_dev->local->ppp_slot]->slcomp, @@ -1399,9 +1427,17 @@ static unsigned char *isdn_ppp_skb_push(struct sk_buff **skb_p,int len) struct sk_buff *skb = *skb_p; if(skb_headroom(skb) < len) { - printk(KERN_ERR "isdn_ppp_skb_push:under %d %d\n",skb_headroom(skb),len); + struct sk_buff *nskb = skb_realloc_headroom(skb, len); + + if (!nskb) { + printk(KERN_ERR "isdn_ppp_skb_push: can't realloc headroom!\n"); + dev_kfree_skb(skb); + return NULL; + } + printk(KERN_DEBUG "isdn_ppp_skb_push:under %d %d\n",skb_headroom(skb),len); dev_kfree_skb(skb); - return NULL; + *skb_p = nskb; + return skb_push(nskb, len); } return skb_push(skb,len); } @@ -1416,9 +1452,9 @@ static unsigned char *isdn_ppp_skb_push(struct sk_buff **skb_p,int len) */ int -isdn_ppp_xmit(struct sk_buff *skb, struct device *dev) +isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev) { - struct device *mdev = ((isdn_net_local *) (dev->priv))->master; /* get master (for redundancy) */ + struct net_device *mdev = ((isdn_net_local *) (netdev->priv))->master; /* get master (for redundancy) */ isdn_net_local *lp,*mlp; isdn_net_dev *nd; unsigned int proto = PPP_IP; /* 0x21 */ @@ -1427,8 +1463,8 @@ isdn_ppp_xmit(struct sk_buff *skb, struct device *dev) if (mdev) mlp = (isdn_net_local *) (mdev->priv); else { - mdev = dev; - mlp = (isdn_net_local *) (dev->priv); + mdev = netdev; + mlp = (isdn_net_local *) (netdev->priv); } nd = mlp->netdev; /* get master lp */ ipts = ippp_table[mlp->ppp_slot]; @@ -1441,7 +1477,7 @@ isdn_ppp_xmit(struct sk_buff *skb, struct device *dev) ipts->old_pa_dstaddr = mdev->pa_dstaddr; #endif if (ipts->debug & 0x1) - printk(KERN_INFO "%s: IP frame delayed.\n", dev->name); + printk(KERN_INFO "%s: IP frame delayed.\n", netdev->name); return 1; } @@ -1506,12 +1542,19 @@ isdn_ppp_xmit(struct sk_buff *skb, struct device *dev) #ifdef CONFIG_ISDN_PPP_VJ if (proto == PPP_IP && ipts->pppcfg & SC_COMP_TCP) { /* ipts here? probably yes, but check this again */ struct sk_buff *new_skb; - - new_skb = dev_alloc_skb(skb->len); + unsigned short hl; + /* + * we need to reserve enought space in front of + * sk_buff. old call to dev_alloc_skb only reserved + * 16 bytes, now we are looking what the driver want. + */ + hl = dev->drv[lp->isdn_device]->interface->hl_hdrlen; + new_skb = alloc_skb(hl+skb->len, GFP_ATOMIC); if (new_skb) { u_char *buf; int pktlen; + skb_reserve(new_skb, hl); new_skb->dev = skb->dev; skb_put(new_skb, skb->len); buf = skb->data; @@ -1611,9 +1654,9 @@ isdn_ppp_xmit(struct sk_buff *skb, struct device *dev) printk(KERN_DEBUG "skb xmit: len: %d\n", (int) skb->len); isdn_ppp_frame_log("xmit", skb->data, skb->len, 32,ipt->unit,lp->ppp_slot); } - if (isdn_net_send_skb(dev, lp, skb)) { + if (isdn_net_send_skb(netdev, lp, skb)) { if (lp->sav_skb) { /* whole sav_skb processing with disabled IRQs ?? */ - printk(KERN_ERR "%s: whoops .. there is another stored skb!\n", dev->name); + printk(KERN_ERR "%s: whoops .. there is another stored skb!\n", netdev->name); dev_kfree_skb(skb); } else lp->sav_skb = skb; @@ -1985,7 +2028,7 @@ isdn_ppp_timer_timeout(void) */ static int -isdn_ppp_dev_ioctl_stats(int slot, struct ifreq *ifr, struct device *dev) +isdn_ppp_dev_ioctl_stats(int slot, struct ifreq *ifr, struct net_device *dev) { struct ppp_stats *res, t; @@ -2025,7 +2068,7 @@ isdn_ppp_dev_ioctl_stats(int slot, struct ifreq *ifr, struct device *dev) } int -isdn_ppp_dev_ioctl(struct device *dev, struct ifreq *ifr, int cmd) +isdn_ppp_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { int error=0; char *r; @@ -2088,7 +2131,7 @@ isdn_ppp_dial_slave(char *name) #ifdef CONFIG_ISDN_MPP isdn_net_dev *ndev; isdn_net_local *lp; - struct device *sdev; + struct net_device *sdev; if (!(ndev = isdn_net_findif(name))) return 1; @@ -2119,7 +2162,7 @@ isdn_ppp_hangup_slave(char *name) #ifdef CONFIG_ISDN_MPP isdn_net_dev *ndev; isdn_net_local *lp; - struct device *sdev; + struct net_device *sdev; if (!(ndev = isdn_net_findif(name))) return 1; |