Commit 890ca7d1 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: Move ppp-specifics to isdn_net_dev

Again, ipppd has one kernel connection per channel in a MPPP
setting, so we should keep track in isdn_net_dev.
parent ec0100d2
...@@ -351,7 +351,7 @@ static void isdn_net_hup_timer(unsigned long data) ...@@ -351,7 +351,7 @@ static void isdn_net_hup_timer(unsigned long data)
if (time_after(jiffies, lp->chargetime + lp->chargeint - 2 * HZ)) { if (time_after(jiffies, lp->chargetime + lp->chargeint - 2 * HZ)) {
if (lp->outgoing || lp->hupflags & ISDN_INHUP) { if (lp->outgoing || lp->hupflags & ISDN_INHUP) {
isdn_net_hangup(lp); isdn_net_hangup(idev);
return; return;
} }
} }
...@@ -359,17 +359,17 @@ static void isdn_net_hup_timer(unsigned long data) ...@@ -359,17 +359,17 @@ static void isdn_net_hup_timer(unsigned long data)
if (lp->hupflags & ISDN_CHARGEHUP) { if (lp->hupflags & ISDN_CHARGEHUP) {
if (lp->charge_state != ST_CHARGE_HAVE_CINT) { if (lp->charge_state != ST_CHARGE_HAVE_CINT) {
dbg_net_dial("%s: did not get CINT\n", lp->name); dbg_net_dial("%s: did not get CINT\n", lp->name);
isdn_net_hangup(lp); isdn_net_hangup(idev);
return; return;
} else if (time_after(jiffies, lp->chargetime + lp->chargeint)) { } else if (time_after(jiffies, lp->chargetime + lp->chargeint)) {
dbg_net_dial("%s: chtime = %lu, chint = %d\n", dbg_net_dial("%s: chtime = %lu, chint = %d\n",
lp->name, lp->chargetime, lp->chargeint); lp->name, lp->chargetime, lp->chargeint);
isdn_net_hangup(lp); isdn_net_hangup(idev);
return; return;
} }
} }
} else if (lp->hupflags & ISDN_INHUP) { } else if (lp->hupflags & ISDN_INHUP) {
isdn_net_hangup(lp); isdn_net_hangup(idev);
return; return;
} }
mod_timer: mod_timer:
...@@ -510,14 +510,14 @@ do_dialout(isdn_net_local *lp) ...@@ -510,14 +510,14 @@ do_dialout(isdn_net_local *lp)
lp->dialwait_timer = jiffies + lp->dialwait; lp->dialwait_timer = jiffies + lp->dialwait;
lp->dialstarted = 0; lp->dialstarted = 0;
} }
isdn_net_hangup(lp); isdn_net_hangup(idev);
return; return;
} }
if(lp->dialtimeout > 0 && if(lp->dialtimeout > 0 &&
time_after(jiffies, lp->dialstarted + lp->dialtimeout)) { time_after(jiffies, lp->dialstarted + lp->dialtimeout)) {
lp->dialwait_timer = jiffies + lp->dialwait; lp->dialwait_timer = jiffies + lp->dialwait;
lp->dialstarted = 0; lp->dialstarted = 0;
isdn_net_hangup(lp); isdn_net_hangup(idev);
return; return;
} }
/* /*
...@@ -607,7 +607,7 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg) ...@@ -607,7 +607,7 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg)
/* Remote does callback. Hangup after cbdelay, /* Remote does callback. Hangup after cbdelay,
* then wait for incoming call */ * then wait for incoming call */
printk(KERN_INFO "%s: hangup waiting for callback ...\n", idev->name); printk(KERN_INFO "%s: hangup waiting for callback ...\n", idev->name);
isdn_net_hangup(lp); isdn_net_hangup(idev);
return 1; return 1;
case ISDN_STAT_DCONN: case ISDN_STAT_DCONN:
/* Got D-Channel-Connect, send B-Channel-request */ /* Got D-Channel-Connect, send B-Channel-request */
...@@ -648,7 +648,7 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg) ...@@ -648,7 +648,7 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg)
case ST_IN_WAIT_DCONN: case ST_IN_WAIT_DCONN:
switch (pr) { switch (pr) {
case EV_NET_TIMER_IN_DCONN: case EV_NET_TIMER_IN_DCONN:
isdn_net_hangup(lp); isdn_net_hangup(idev);
return 1; return 1;
case ISDN_STAT_DCONN: case ISDN_STAT_DCONN:
del_timer(&idev->dial_timer); del_timer(&idev->dial_timer);
...@@ -669,7 +669,7 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg) ...@@ -669,7 +669,7 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg)
case ST_IN_WAIT_BCONN: case ST_IN_WAIT_BCONN:
switch (pr) { switch (pr) {
case EV_NET_TIMER_IN_BCONN: case EV_NET_TIMER_IN_BCONN:
isdn_net_hangup(lp); isdn_net_hangup(idev);
break; break;
case ISDN_STAT_BCONN: case ISDN_STAT_BCONN:
del_timer(&idev->dial_timer); del_timer(&idev->dial_timer);
...@@ -704,9 +704,9 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg) ...@@ -704,9 +704,9 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg)
* Perform hangup for a net-interface. * Perform hangup for a net-interface.
*/ */
void void
isdn_net_hangup(isdn_net_local *lp) isdn_net_hangup(isdn_net_dev *idev)
{ {
isdn_net_dev *idev = lp->netdev; isdn_net_local *lp = &idev->local;
isdn_ctrl cmd; isdn_ctrl cmd;
del_timer_sync(&idev->hup_timer); del_timer_sync(&idev->hup_timer);
...@@ -721,7 +721,7 @@ isdn_net_hangup(isdn_net_local *lp) ...@@ -721,7 +721,7 @@ isdn_net_hangup(isdn_net_local *lp)
printk(KERN_INFO printk(KERN_INFO
"isdn_net: hang up slave %s before %s\n", "isdn_net: hang up slave %s before %s\n",
sidev->name, idev->name); sidev->name, idev->name);
isdn_net_hangup(slp); isdn_net_hangup(sidev);
} }
} }
printk(KERN_INFO "isdn_net: local hangup %s\n", idev->name); printk(KERN_INFO "isdn_net: local hangup %s\n", idev->name);
...@@ -743,7 +743,7 @@ isdn_net_hangup_all() ...@@ -743,7 +743,7 @@ isdn_net_hangup_all()
list_for_each(l, &isdn_net_devs) { list_for_each(l, &isdn_net_devs) {
isdn_net_dev *p = list_entry(l, isdn_net_dev, global_list); isdn_net_dev *p = list_entry(l, isdn_net_dev, global_list);
isdn_net_hangup(&p->local); isdn_net_hangup(p);
} }
} }
...@@ -1599,8 +1599,10 @@ isdn_net_new(char *name, struct net_device *master) ...@@ -1599,8 +1599,10 @@ isdn_net_new(char *name, struct net_device *master)
netdev->pre_device = -1; netdev->pre_device = -1;
netdev->pre_channel = -1; netdev->pre_channel = -1;
netdev->exclusive = -1; netdev->exclusive = -1;
netdev->local.ppp_slot = -1;
netdev->local.pppbind = -1; netdev->ppp_slot = -1;
netdev->pppbind = -1;
netdev->local.p_encap = -1; netdev->local.p_encap = -1;
skb_queue_head_init(&netdev->local.super_tx_queue); skb_queue_head_init(&netdev->local.super_tx_queue);
netdev->local.l2_proto = ISDN_PROTO_L2_X75I; netdev->local.l2_proto = ISDN_PROTO_L2_X75I;
...@@ -1782,12 +1784,12 @@ isdn_net_bind(isdn_net_dev *idev, isdn_net_ioctl_cfg *cfg) ...@@ -1782,12 +1784,12 @@ isdn_net_bind(isdn_net_dev *idev, isdn_net_ioctl_cfg *cfg)
int int
isdn_net_setcfg(isdn_net_ioctl_cfg *cfg) isdn_net_setcfg(isdn_net_ioctl_cfg *cfg)
{ {
isdn_net_dev *p = isdn_net_findif(cfg->name); isdn_net_dev *idev = isdn_net_findif(cfg->name);
isdn_net_local *lp = &p->local; isdn_net_local *lp = &idev->local;
ulong features; ulong features;
int i, retval; int i, retval;
if (!p) { if (!idev) {
retval = -ENODEV; retval = -ENODEV;
goto out; goto out;
} }
...@@ -1805,11 +1807,11 @@ isdn_net_setcfg(isdn_net_ioctl_cfg *cfg) ...@@ -1805,11 +1807,11 @@ isdn_net_setcfg(isdn_net_ioctl_cfg *cfg)
goto out; goto out;
} }
retval = isdn_net_set_encap(p, cfg->p_encap); retval = isdn_net_set_encap(idev, cfg->p_encap);
if (retval) if (retval)
goto out; goto out;
retval = isdn_net_bind(p, cfg); retval = isdn_net_bind(idev, cfg);
if (retval) if (retval)
goto out; goto out;
...@@ -1823,7 +1825,7 @@ isdn_net_setcfg(isdn_net_ioctl_cfg *cfg) ...@@ -1823,7 +1825,7 @@ isdn_net_setcfg(isdn_net_ioctl_cfg *cfg)
lp->dialmax = cfg->dialmax; lp->dialmax = cfg->dialmax;
lp->triggercps = cfg->triggercps; lp->triggercps = cfg->triggercps;
lp->slavedelay = cfg->slavedelay * HZ; lp->slavedelay = cfg->slavedelay * HZ;
lp->pppbind = cfg->pppbind; idev->pppbind = cfg->pppbind;
lp->dialtimeout = cfg->dialtimeout >= 0 ? cfg->dialtimeout * HZ : -1; lp->dialtimeout = cfg->dialtimeout >= 0 ? cfg->dialtimeout * HZ : -1;
lp->dialwait = cfg->dialwait * HZ; lp->dialwait = cfg->dialwait * HZ;
if (cfg->secure) if (cfg->secure)
...@@ -1855,7 +1857,7 @@ isdn_net_setcfg(isdn_net_ioctl_cfg *cfg) ...@@ -1855,7 +1857,7 @@ isdn_net_setcfg(isdn_net_ioctl_cfg *cfg)
lp->flags |= cfg->dialmode; /* turn on selected bits */ lp->flags |= cfg->dialmode; /* turn on selected bits */
if (lp->flags & ISDN_NET_DM_OFF) if (lp->flags & ISDN_NET_DM_OFF)
isdn_net_hangup(lp); isdn_net_hangup(lp->netdev);
if (cfg->chargehup) if (cfg->chargehup)
lp->hupflags |= ISDN_CHARGEHUP; lp->hupflags |= ISDN_CHARGEHUP;
...@@ -1918,7 +1920,7 @@ isdn_net_getcfg(isdn_net_ioctl_cfg * cfg) ...@@ -1918,7 +1920,7 @@ isdn_net_getcfg(isdn_net_ioctl_cfg * cfg)
cfg->slavedelay = lp->slavedelay / HZ; cfg->slavedelay = lp->slavedelay / HZ;
cfg->chargeint = (lp->hupflags & ISDN_CHARGEHUP) ? cfg->chargeint = (lp->hupflags & ISDN_CHARGEHUP) ?
(lp->chargeint / HZ) : 0; (lp->chargeint / HZ) : 0;
cfg->pppbind = lp->pppbind; cfg->pppbind = idev->pppbind;
cfg->dialtimeout = lp->dialtimeout >= 0 ? lp->dialtimeout / HZ : -1; cfg->dialtimeout = lp->dialtimeout >= 0 ? lp->dialtimeout / HZ : -1;
cfg->dialwait = lp->dialwait / HZ; cfg->dialwait = lp->dialwait / HZ;
if (lp->slave) if (lp->slave)
...@@ -2094,7 +2096,7 @@ isdn_net_force_hangup(char *name) ...@@ -2094,7 +2096,7 @@ isdn_net_force_hangup(char *name)
q = idev->local.slave; q = idev->local.slave;
/* If this interface has slaves, do a hangup for them also. */ /* If this interface has slaves, do a hangup for them also. */
while (q) { while (q) {
isdn_net_hangup((isdn_net_local *) q->priv); isdn_net_hangup(((isdn_net_local *) q->priv)->netdev);
q = (((isdn_net_local *) q->priv)->slave); q = (((isdn_net_local *) q->priv)->slave);
} }
isdn_net_hangup(&idev->local); isdn_net_hangup(&idev->local);
......
...@@ -46,7 +46,7 @@ extern int isdn_net_getphones(isdn_net_ioctl_phone *, char *); ...@@ -46,7 +46,7 @@ extern int isdn_net_getphones(isdn_net_ioctl_phone *, char *);
extern int isdn_net_getpeer(isdn_net_ioctl_phone *, isdn_net_ioctl_phone *); extern int isdn_net_getpeer(isdn_net_ioctl_phone *, isdn_net_ioctl_phone *);
extern int isdn_net_delphone(isdn_net_ioctl_phone *); extern int isdn_net_delphone(isdn_net_ioctl_phone *);
extern int isdn_net_find_icall(int, int, int, setup_parm *); extern int isdn_net_find_icall(int, int, int, setup_parm *);
extern void isdn_net_hangup(isdn_net_local *); extern void isdn_net_hangup(isdn_net_dev *);
extern void isdn_net_hangup_all(void); extern void isdn_net_hangup_all(void);
extern int isdn_net_force_hangup(char *); extern int isdn_net_force_hangup(char *);
extern int isdn_net_force_dial(char *); extern int isdn_net_force_dial(char *);
......
...@@ -102,12 +102,13 @@ isdn_ppp_frame_log(char *info, char *data, int len, int maxlen,int unit,int slot ...@@ -102,12 +102,13 @@ isdn_ppp_frame_log(char *info, char *data, int len, int maxlen,int unit,int slot
static void static void
isdn_ppp_free(isdn_net_local * lp) isdn_ppp_free(isdn_net_local * lp)
{ {
isdn_net_dev *idev = lp->netdev;
unsigned long flags; unsigned long flags;
struct ippp_struct *is; struct ippp_struct *is;
if (lp->ppp_slot < 0 || lp->ppp_slot > ISDN_MAX_CHANNELS) { if (idev->ppp_slot < 0 || idev->ppp_slot > ISDN_MAX_CHANNELS) {
printk(KERN_ERR "%s: ppp_slot(%d) out of range\n", printk(KERN_ERR "%s: ppp_slot(%d) out of range\n",
__FUNCTION__ , lp->ppp_slot); __FUNCTION__ , idev->ppp_slot);
return; return;
} }
...@@ -125,23 +126,23 @@ isdn_ppp_free(isdn_net_local * lp) ...@@ -125,23 +126,23 @@ isdn_ppp_free(isdn_net_local * lp)
lp->netdev->pb->ref_ct--; lp->netdev->pb->ref_ct--;
spin_unlock(&lp->netdev->pb->lock); spin_unlock(&lp->netdev->pb->lock);
#endif /* CONFIG_ISDN_MPP */ #endif /* CONFIG_ISDN_MPP */
if (lp->ppp_slot < 0 || lp->ppp_slot > ISDN_MAX_CHANNELS) { if (idev->ppp_slot < 0 || idev->ppp_slot > ISDN_MAX_CHANNELS) {
printk(KERN_ERR "%s: ppp_slot(%d) now invalid\n", printk(KERN_ERR "%s: ppp_slot(%d) now invalid\n",
__FUNCTION__ , lp->ppp_slot); __FUNCTION__ , idev->ppp_slot);
restore_flags(flags); restore_flags(flags);
return; return;
} }
is = ippp_table[lp->ppp_slot]; is = ippp_table[idev->ppp_slot];
if ((is->state & IPPP_CONNECT)) if ((is->state & IPPP_CONNECT))
isdn_ppp_closewait(lp->ppp_slot); /* force wakeup on ippp device */ isdn_ppp_closewait(idev->ppp_slot); /* force wakeup on ippp device */
else if (is->state & IPPP_ASSIGNED) else if (is->state & IPPP_ASSIGNED)
is->state = IPPP_OPEN; /* fallback to 'OPEN but not ASSIGNED' state */ is->state = IPPP_OPEN; /* fallback to 'OPEN but not ASSIGNED' state */
if (is->debug & 0x1) if (is->debug & 0x1)
printk(KERN_DEBUG "isdn_ppp_free %d %lx %lx\n", lp->ppp_slot, (long) lp, (long) is->lp); printk(KERN_DEBUG "isdn_ppp_free %d %p %p\n", idev->ppp_slot, lp, is->idev);
is->lp = NULL; /* link is down .. set lp to NULL */ is->idev = NULL; /* link is down .. set lp to NULL */
lp->ppp_slot = -1; /* is this OK ?? */ idev->ppp_slot = -1; /* is this OK ?? */
restore_flags(flags); restore_flags(flags);
return; return;
...@@ -162,16 +163,15 @@ isdn_ppp_bind(isdn_net_local * lp) ...@@ -162,16 +163,15 @@ isdn_ppp_bind(isdn_net_local * lp)
save_flags(flags); save_flags(flags);
cli(); cli();
if (lp->pppbind < 0) { /* device bounded to ippp device ? */ if (idev->pppbind < 0) { /* device bound to ippp device ? */
struct list_head *l; struct list_head *l;
char exclusive[ISDN_MAX_CHANNELS]; /* exclusive flags */ char exclusive[ISDN_MAX_CHANNELS]; /* exclusive flags */
memset(exclusive, 0, ISDN_MAX_CHANNELS); memset(exclusive, 0, ISDN_MAX_CHANNELS);
/* step through net devices to find exclusive minors */ /* step through net devices to find exclusive minors */
list_for_each(l, &isdn_net_devs) { list_for_each(l, &isdn_net_devs) {
isdn_net_dev *p = list_entry(l, isdn_net_dev, global_list); isdn_net_dev *p = list_entry(l, isdn_net_dev, global_list);
isdn_net_local *lp = &p->local; if (p->pppbind >= 0)
if (lp->pppbind >= 0) exclusive[p->pppbind] = 1;
exclusive[lp->pppbind] = 1;
} }
/* /*
* search a free device / slot * search a free device / slot
...@@ -183,7 +183,7 @@ isdn_ppp_bind(isdn_net_local * lp) ...@@ -183,7 +183,7 @@ isdn_ppp_bind(isdn_net_local * lp)
} }
} else { } else {
for (i = 0; i < ISDN_MAX_CHANNELS; i++) { for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
if (ippp_table[i]->minor == lp->pppbind && if (ippp_table[i]->minor == idev->pppbind &&
(ippp_table[i]->state & IPPP_OPEN) == IPPP_OPEN) (ippp_table[i]->state & IPPP_OPEN) == IPPP_OPEN)
break; break;
} }
...@@ -202,9 +202,9 @@ isdn_ppp_bind(isdn_net_local * lp) ...@@ -202,9 +202,9 @@ isdn_ppp_bind(isdn_net_local * lp)
goto out; goto out;
} }
lp->ppp_slot = i; idev->ppp_slot = i;
is = ippp_table[i]; is = ippp_table[i];
is->lp = lp; is->idev = idev;
is->unit = unit; is->unit = unit;
is->state = IPPP_OPEN | IPPP_ASSIGNED; /* assigned to a netdevice but not connected */ is->state = IPPP_OPEN | IPPP_ASSIGNED; /* assigned to a netdevice but not connected */
#ifdef CONFIG_ISDN_MPP #ifdef CONFIG_ISDN_MPP
...@@ -213,7 +213,7 @@ isdn_ppp_bind(isdn_net_local * lp) ...@@ -213,7 +213,7 @@ isdn_ppp_bind(isdn_net_local * lp)
goto out; goto out;
#endif /* CONFIG_ISDN_MPP */ #endif /* CONFIG_ISDN_MPP */
retval = lp->ppp_slot; retval = idev->ppp_slot;
out: out:
restore_flags(flags); restore_flags(flags);
...@@ -226,15 +226,17 @@ isdn_ppp_bind(isdn_net_local * lp) ...@@ -226,15 +226,17 @@ isdn_ppp_bind(isdn_net_local * lp)
*/ */
static void static void
isdn_ppp_wakeup_daemon(isdn_net_local * lp) isdn_ppp_wakeup_daemon(isdn_net_local *lp)
{ {
if (lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS) { isdn_net_dev *idev = lp->netdev;
if (idev->ppp_slot < 0 || idev->ppp_slot >= ISDN_MAX_CHANNELS) {
printk(KERN_ERR "%s: ppp_slot(%d) out of range\n", printk(KERN_ERR "%s: ppp_slot(%d) out of range\n",
__FUNCTION__, lp->ppp_slot); __FUNCTION__, idev->ppp_slot);
return; return;
} }
ippp_table[lp->ppp_slot]->state = IPPP_OPEN | IPPP_CONNECT | IPPP_NOBLOCK; ippp_table[idev->ppp_slot]->state = IPPP_OPEN | IPPP_CONNECT | IPPP_NOBLOCK;
wake_up_interruptible(&ippp_table[lp->ppp_slot]->wq); wake_up_interruptible(&ippp_table[idev->ppp_slot]->wq);
} }
/* /*
...@@ -302,7 +304,7 @@ isdn_ppp_open(struct inode *ino, struct file *file) ...@@ -302,7 +304,7 @@ isdn_ppp_open(struct inode *ino, struct file *file)
is->reset = isdn_ppp_ccp_reset_alloc(is); is->reset = isdn_ppp_ccp_reset_alloc(is);
is->lp = NULL; is->idev = NULL;
is->mp_seqno = 0; /* MP sequence number */ is->mp_seqno = 0; /* MP sequence number */
is->pppcfg = 0; /* ppp configuration */ is->pppcfg = 0; /* ppp configuration */
is->mpppcfg = 0; /* mppp configuration */ is->mpppcfg = 0; /* mppp configuration */
...@@ -343,16 +345,16 @@ isdn_ppp_release(struct inode *ino, struct file *file) ...@@ -343,16 +345,16 @@ isdn_ppp_release(struct inode *ino, struct file *file)
is = file->private_data; is = file->private_data;
if (is->debug & 0x1) if (is->debug & 0x1)
printk(KERN_DEBUG "ippp: release, minor: %d %lx\n", minor, (long) is->lp); printk(KERN_DEBUG "ippp: release, minor: %d %p\n", minor, is->idev);
if (is->lp) { /* a lp address says: this link is still up */ if (is->idev) { /* a lp address says: this link is still up */
/* /*
* isdn_net_hangup() calls isdn_ppp_free() * isdn_net_hangup() calls isdn_ppp_free()
* isdn_ppp_free() sets is->lp to NULL and lp->ppp_slot to -1 * isdn_ppp_free() sets is->lp to NULL and lp->ppp_slot to -1
* removing the IPPP_CONNECT flag omits calling of isdn_ppp_wakeup_daemon() * removing the IPPP_CONNECT flag omits calling of isdn_ppp_wakeup_daemon()
*/ */
is->state &= ~IPPP_CONNECT; is->state &= ~IPPP_CONNECT;
isdn_net_hangup(is->lp); isdn_net_hangup(is->idev);
} }
for (i = 0; i < NUM_RCV_BUFFS; i++) { for (i = 0; i < NUM_RCV_BUFFS; i++) {
if (is->rq[i].buf) { if (is->rq[i].buf) {
...@@ -426,16 +428,14 @@ set_arg(void *b, void *val,int len) ...@@ -426,16 +428,14 @@ set_arg(void *b, void *val,int len)
static int static int
isdn_ppp_ioctl(struct inode *ino, struct file *file, unsigned int cmd, unsigned long arg) isdn_ppp_ioctl(struct inode *ino, struct file *file, unsigned int cmd, unsigned long arg)
{ {
isdn_net_dev *idev;
unsigned long val; unsigned long val;
int r,i,j; int r,i,j;
struct ippp_struct *is; struct ippp_struct *is;
isdn_net_dev *idev;
isdn_net_local *lp;
struct isdn_ppp_comp_data data; struct isdn_ppp_comp_data data;
is = (struct ippp_struct *) file->private_data; is = (struct ippp_struct *) file->private_data;
lp = is->lp; idev = is->idev;
idev = lp->netdev;
if (is->debug & 0x1) if (is->debug & 0x1)
printk(KERN_DEBUG "isdn_ppp_ioctl: minor: %d cmd: %x state: %x\n", is->minor, cmd, is->state); printk(KERN_DEBUG "isdn_ppp_ioctl: minor: %d cmd: %x state: %x\n", is->minor, cmd, is->state);
...@@ -462,7 +462,7 @@ isdn_ppp_ioctl(struct inode *ino, struct file *file, unsigned int cmd, unsigned ...@@ -462,7 +462,7 @@ isdn_ppp_ioctl(struct inode *ino, struct file *file, unsigned int cmd, unsigned
return r; return r;
break; break;
case PPPIOCGIFNAME: case PPPIOCGIFNAME:
if(!lp) if(!idev)
return -EINVAL; return -EINVAL;
if ((r = set_arg((void *) arg, idev->name, strlen(idev->name)))) if ((r = set_arg((void *) arg, idev->name, strlen(idev->name))))
return r; return r;
...@@ -485,17 +485,17 @@ isdn_ppp_ioctl(struct inode *ino, struct file *file, unsigned int cmd, unsigned ...@@ -485,17 +485,17 @@ isdn_ppp_ioctl(struct inode *ino, struct file *file, unsigned int cmd, unsigned
return r; return r;
} }
if (val & SC_ENABLE_IP && !(is->pppcfg & SC_ENABLE_IP) && (is->state & IPPP_CONNECT)) { if (val & SC_ENABLE_IP && !(is->pppcfg & SC_ENABLE_IP) && (is->state & IPPP_CONNECT)) {
if (lp) { if (idev) {
/* OK .. we are ready to send buffers */ /* OK .. we are ready to send buffers */
netif_wake_queue(&lp->netdev->dev); netif_wake_queue(&idev->dev);
} }
} }
is->pppcfg = val; is->pppcfg = val;
break; break;
case PPPIOCGIDLE: /* get idle time information */ case PPPIOCGIDLE: /* get idle time information */
if (lp) { if (idev) {
struct ppp_idle pidle; struct ppp_idle pidle;
pidle.xmit_idle = pidle.recv_idle = lp->huptimer; pidle.xmit_idle = pidle.recv_idle = idev->local.huptimer;
if ((r = set_arg((void *) arg, &pidle,sizeof(struct ppp_idle)))) if ((r = set_arg((void *) arg, &pidle,sizeof(struct ppp_idle))))
return r; return r;
} }
...@@ -566,21 +566,21 @@ isdn_ppp_ioctl(struct inode *ino, struct file *file, unsigned int cmd, unsigned ...@@ -566,21 +566,21 @@ isdn_ppp_ioctl(struct inode *ino, struct file *file, unsigned int cmd, unsigned
struct pppcallinfo pci; struct pppcallinfo pci;
int i; int i;
memset((char *) &pci,0,sizeof(struct pppcallinfo)); memset((char *) &pci,0,sizeof(struct pppcallinfo));
if(lp) { if(idev) {
strncpy(pci.local_num,lp->msn,63); strncpy(pci.local_num,idev->local.msn,63);
i = 0; i = 0;
list_for_each_entry(phone, &lp->phone[1], list) { list_for_each_entry(phone, &idev->local.phone[1], list) {
if (i++ == lp->dial) { if (i++ == idev->local.dial) {
strncpy(pci.remote_num,phone->num,63); strncpy(pci.remote_num,phone->num,63);
break; break;
} }
} }
pci.charge_units = lp->charge; pci.charge_units = idev->local.charge;
if(lp->outgoing) if(idev->local.outgoing)
pci.calltype = CALLTYPE_OUTGOING; pci.calltype = CALLTYPE_OUTGOING;
else else
pci.calltype = CALLTYPE_INCOMING; pci.calltype = CALLTYPE_INCOMING;
if(lp->flags & ISDN_NET_CALLBACK) if(idev->local.flags & ISDN_NET_CALLBACK)
pci.calltype |= CALLTYPE_CALLBACK; pci.calltype |= CALLTYPE_CALLBACK;
} }
return set_arg((void *)arg,&pci,sizeof(struct pppcallinfo)); return set_arg((void *)arg,&pci,sizeof(struct pppcallinfo));
...@@ -764,7 +764,6 @@ isdn_ppp_read(struct file *file, char *buf, size_t count, loff_t *off) ...@@ -764,7 +764,6 @@ isdn_ppp_read(struct file *file, char *buf, size_t count, loff_t *off)
static ssize_t static ssize_t
isdn_ppp_write(struct file *file, const char *buf, size_t count, loff_t *off) isdn_ppp_write(struct file *file, const char *buf, size_t count, loff_t *off)
{ {
isdn_net_local *lp;
isdn_net_dev *idev; isdn_net_dev *idev;
struct ippp_struct *is; struct ippp_struct *is;
int proto; int proto;
...@@ -783,14 +782,12 @@ isdn_ppp_write(struct file *file, const char *buf, size_t count, loff_t *off) ...@@ -783,14 +782,12 @@ isdn_ppp_write(struct file *file, const char *buf, size_t count, loff_t *off)
goto out; goto out;
} }
lp = is->lp;
/* -> push it directly to the lowlevel interface */ /* -> push it directly to the lowlevel interface */
if (!lp) idev = is->idev;
printk(KERN_DEBUG "isdn_ppp_write: lp == NULL\n"); if (!idev)
printk(KERN_DEBUG "isdn_ppp_write: idev == NULL\n");
else { else {
idev = lp->netdev;
/* /*
* Don't reset huptimer for * Don't reset huptimer for
* LCP packets. (Echo requests). * LCP packets. (Echo requests).
...@@ -801,7 +798,7 @@ isdn_ppp_write(struct file *file, const char *buf, size_t count, loff_t *off) ...@@ -801,7 +798,7 @@ isdn_ppp_write(struct file *file, const char *buf, size_t count, loff_t *off)
} }
proto = PPP_PROTOCOL(protobuf); proto = PPP_PROTOCOL(protobuf);
if (proto != PPP_LCP) if (proto != PPP_LCP)
lp->huptimer = 0; idev->local.huptimer = 0;
if (idev->isdn_slot < 0) { if (idev->isdn_slot < 0) {
retval = 0; retval = 0;
...@@ -832,12 +829,12 @@ isdn_ppp_write(struct file *file, const char *buf, size_t count, loff_t *off) ...@@ -832,12 +829,12 @@ isdn_ppp_write(struct file *file, const char *buf, size_t count, loff_t *off)
} }
if (is->debug & 0x40) { if (is->debug & 0x40) {
printk(KERN_DEBUG "ppp xmit: len %d\n", (int) skb->len); printk(KERN_DEBUG "ppp xmit: len %d\n", (int) skb->len);
isdn_ppp_frame_log("xmit", skb->data, skb->len, 32,is->unit,lp->ppp_slot); isdn_ppp_frame_log("xmit", skb->data, skb->len, 32,is->unit,idev->ppp_slot);
} }
isdn_ppp_send_ccp(lp->netdev,lp,skb); /* keeps CCP/compression states in sync */ isdn_ppp_send_ccp(idev,&idev->local,skb); /* keeps CCP/compression states in sync */
isdn_net_write_super(lp, skb); isdn_net_write_super(&idev->local, skb);
} }
} }
retval = count; retval = count;
...@@ -969,6 +966,7 @@ static int isdn_ppp_strip_proto(struct sk_buff *skb) ...@@ -969,6 +966,7 @@ static int isdn_ppp_strip_proto(struct sk_buff *skb)
static void isdn_ppp_receive(isdn_net_dev *net_dev, isdn_net_local *lp, static void isdn_ppp_receive(isdn_net_dev *net_dev, isdn_net_local *lp,
struct sk_buff *skb) struct sk_buff *skb)
{ {
isdn_net_dev *idev = lp->netdev;
struct ippp_struct *is; struct ippp_struct *is;
int slot; int slot;
int proto; int proto;
...@@ -980,19 +978,19 @@ static void isdn_ppp_receive(isdn_net_dev *net_dev, isdn_net_local *lp, ...@@ -980,19 +978,19 @@ static void isdn_ppp_receive(isdn_net_dev *net_dev, isdn_net_local *lp,
if (PPP_PROTOCOL(skb->data) != PPP_LCP) if (PPP_PROTOCOL(skb->data) != PPP_LCP)
isdn_net_reset_huptimer(&net_dev->local,lp); isdn_net_reset_huptimer(&net_dev->local,lp);
slot = lp->ppp_slot; slot = idev->ppp_slot;
if (slot < 0 || slot > ISDN_MAX_CHANNELS) { if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
printk(KERN_ERR "isdn_ppp_receive: lp->ppp_slot(%d)\n", printk(KERN_ERR "isdn_ppp_receive: lp->ppp_slot(%d)\n",
lp->ppp_slot); slot);
kfree_skb(skb); kfree_skb(skb);
return; return;
} }
is = ippp_table[slot]; is = ippp_table[slot];
if (is->debug & 0x4) { if (is->debug & 0x4) {
printk(KERN_DEBUG "ippp_receive: is:%08lx lp:%08lx slot:%d unit:%d len:%d\n", printk(KERN_DEBUG "ippp_receive: is:%p lp:%p slot:%d unit:%d len:%d\n",
(long)is,(long)lp,lp->ppp_slot,is->unit,(int) skb->len); is,lp,idev->ppp_slot,is->unit,(int) skb->len);
isdn_ppp_frame_log("receive", skb->data, skb->len, 32,is->unit,lp->ppp_slot); isdn_ppp_frame_log("receive", skb->data, skb->len, 32,is->unit,idev->ppp_slot);
} }
if (isdn_ppp_skip_ac(is, skb) < 0) { if (isdn_ppp_skip_ac(is, skb) < 0) {
...@@ -1030,23 +1028,24 @@ static void isdn_ppp_receive(isdn_net_dev *net_dev, isdn_net_local *lp, ...@@ -1030,23 +1028,24 @@ static void isdn_ppp_receive(isdn_net_dev *net_dev, isdn_net_local *lp,
static void static void
isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff *skb, int proto) isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff *skb, int proto)
{ {
isdn_net_dev *idev = lp->netdev;
struct net_device *dev = &net_dev->dev; struct net_device *dev = &net_dev->dev;
struct ippp_struct *is, *mis; struct ippp_struct *is, *mis;
int slot; int slot;
slot = lp->ppp_slot; slot = idev->ppp_slot;
if (slot < 0 || slot > ISDN_MAX_CHANNELS) { if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
printk(KERN_ERR "isdn_ppp_push_higher: lp->ppp_slot(%d)\n", printk(KERN_ERR "isdn_ppp_push_higher: lp->ppp_slot(%d)\n",
lp->ppp_slot); slot);
goto drop_packet; goto drop_packet;
} }
is = ippp_table[slot]; is = ippp_table[slot];
if (lp->master) { // FIXME? if (lp->master) { // FIXME?
slot = ((isdn_net_local *) (lp->master->priv))->ppp_slot; slot = ((isdn_net_local *) (lp->master->priv))->netdev->ppp_slot;
if (slot < 0 || slot > ISDN_MAX_CHANNELS) { if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
printk(KERN_ERR "isdn_ppp_push_higher: master->ppp_slot(%d)\n", printk(KERN_ERR "isdn_ppp_push_higher: master->ppp_slot(%d)\n",
lp->ppp_slot); slot);
goto drop_packet; goto drop_packet;
} }
} }
...@@ -1054,7 +1053,7 @@ isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff ...@@ -1054,7 +1053,7 @@ isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff
if (is->debug & 0x10) { if (is->debug & 0x10) {
printk(KERN_DEBUG "push, skb %d %04x\n", (int) skb->len, proto); printk(KERN_DEBUG "push, skb %d %04x\n", (int) skb->len, proto);
isdn_ppp_frame_log("rpush", skb->data, skb->len, 32,is->unit,lp->ppp_slot); isdn_ppp_frame_log("rpush", skb->data, skb->len, 32,is->unit,slot);
} }
if (mis->compflags & SC_DECOMP_ON) { if (mis->compflags & SC_DECOMP_ON) {
skb = isdn_ppp_decompress(skb, is, mis, &proto); skb = isdn_ppp_decompress(skb, is, mis, &proto);
...@@ -1080,12 +1079,12 @@ isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff ...@@ -1080,12 +1079,12 @@ isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff
case PPP_VJC_UNCOMP: case PPP_VJC_UNCOMP:
if (is->debug & 0x20) if (is->debug & 0x20)
printk(KERN_DEBUG "isdn_ppp: VJC_UNCOMP\n"); printk(KERN_DEBUG "isdn_ppp: VJC_UNCOMP\n");
if (net_dev->local.ppp_slot < 0) { if (net_dev->ppp_slot < 0) {
printk(KERN_ERR "%s: net_dev->local->ppp_slot(%d) out of range\n", printk(KERN_ERR "%s: net_dev->ppp_slot(%d) out of range\n",
__FUNCTION__ , net_dev->local.ppp_slot); __FUNCTION__ , net_dev->ppp_slot);
goto drop_packet; goto drop_packet;
} }
if (slhc_remember(ippp_table[net_dev->local.ppp_slot]->slcomp, skb->data, skb->len) <= 0) { if (slhc_remember(ippp_table[net_dev->ppp_slot]->slcomp, skb->data, skb->len) <= 0) {
printk(KERN_WARNING "isdn_ppp: received illegal VJC_UNCOMP frame!\n"); printk(KERN_WARNING "isdn_ppp: received illegal VJC_UNCOMP frame!\n");
goto drop_packet; goto drop_packet;
} }
...@@ -1106,12 +1105,12 @@ isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff ...@@ -1106,12 +1105,12 @@ isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff
} }
skb_put(skb, skb_old->len + 128); skb_put(skb, skb_old->len + 128);
memcpy(skb->data, skb_old->data, skb_old->len); memcpy(skb->data, skb_old->data, skb_old->len);
if (net_dev->local.ppp_slot < 0) { if (net_dev->ppp_slot < 0) {
printk(KERN_ERR "%s: net_dev->local->ppp_slot(%d) out of range\n", printk(KERN_ERR "%s: net_dev->ppp_slot(%d) out of range\n",
__FUNCTION__ , net_dev->local.ppp_slot); __FUNCTION__ , net_dev->ppp_slot);
goto drop_packet; goto drop_packet;
} }
pkt_len = slhc_uncompress(ippp_table[net_dev->local.ppp_slot]->slcomp, pkt_len = slhc_uncompress(ippp_table[net_dev->ppp_slot]->slcomp,
skb->data, skb_old->len); skb->data, skb_old->len);
kfree_skb(skb_old); kfree_skb(skb_old);
if (pkt_len < 0) if (pkt_len < 0)
...@@ -1132,7 +1131,7 @@ isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff ...@@ -1132,7 +1131,7 @@ isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff
break; break;
/* fall through */ /* fall through */
default: default:
isdn_ppp_fill_rq(skb->data, skb->len, proto, lp->ppp_slot); /* push data to pppd device */ isdn_ppp_fill_rq(skb->data, skb->len, proto, idev->ppp_slot); /* push data to pppd device */
kfree_skb(skb); kfree_skb(skb);
return; return;
} }
...@@ -1198,10 +1197,10 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev) ...@@ -1198,10 +1197,10 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev)
mlp = (isdn_net_local *) (netdev->priv); mlp = (isdn_net_local *) (netdev->priv);
nd = mlp->netdev; /* get master lp */ nd = mlp->netdev; /* get master lp */
slot = mlp->ppp_slot; slot = nd->ppp_slot;
if (slot < 0 || slot > ISDN_MAX_CHANNELS) { if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
printk(KERN_ERR "isdn_ppp_xmit: lp->ppp_slot(%d)\n", printk(KERN_ERR "isdn_ppp_xmit: lp->ppp_slot(%d)\n",
mlp->ppp_slot); slot);
kfree_skb(skb); kfree_skb(skb);
return 0; return 0;
} }
...@@ -1234,10 +1233,10 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev) ...@@ -1234,10 +1233,10 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev)
} }
/* we have our lp locked from now on */ /* we have our lp locked from now on */
idev = lp->netdev; idev = lp->netdev;
slot = lp->ppp_slot; slot = idev->ppp_slot;
if (slot < 0 || slot > ISDN_MAX_CHANNELS) { if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
printk(KERN_ERR "isdn_ppp_xmit: lp->ppp_slot(%d)\n", printk(KERN_ERR "isdn_ppp_xmit: lp->ppp_slot(%d)\n",
lp->ppp_slot); slot);
kfree_skb(skb); kfree_skb(skb);
return 0; return 0;
} }
...@@ -1256,7 +1255,7 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev) ...@@ -1256,7 +1255,7 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev)
if (ipt->debug & 0x4) if (ipt->debug & 0x4)
printk(KERN_DEBUG "xmit skb, len %d\n", (int) skb->len); printk(KERN_DEBUG "xmit skb, len %d\n", (int) skb->len);
if (ipts->debug & 0x40) if (ipts->debug & 0x40)
isdn_ppp_frame_log("xmit0", skb->data, skb->len, 32,ipts->unit,lp->ppp_slot); isdn_ppp_frame_log("xmit0", skb->data, skb->len, 32,ipts->unit,idev->ppp_slot);
#ifdef CONFIG_ISDN_PPP_VJ #ifdef CONFIG_ISDN_PPP_VJ
if (proto == PPP_IP && ipts->pppcfg & SC_COMP_TCP) { /* ipts here? probably yes, but check this again */ if (proto == PPP_IP && ipts->pppcfg & SC_COMP_TCP) { /* ipts here? probably yes, but check this again */
...@@ -1383,7 +1382,7 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev) ...@@ -1383,7 +1382,7 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev)
if (ipts->debug & 0x40) { if (ipts->debug & 0x40) {
printk(KERN_DEBUG "skb xmit: len: %d\n", (int) skb->len); 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); isdn_ppp_frame_log("xmit", skb->data, skb->len, 32,ipt->unit,idev->ppp_slot);
} }
isdn_net_writebuf_skb(lp, skb); isdn_net_writebuf_skb(lp, skb);
...@@ -1442,15 +1441,16 @@ static ippp_bundle * isdn_ppp_mp_bundle_alloc(void) ...@@ -1442,15 +1441,16 @@ static ippp_bundle * isdn_ppp_mp_bundle_alloc(void)
static int isdn_ppp_mp_init( isdn_net_local * lp, ippp_bundle * add_to ) static int isdn_ppp_mp_init( isdn_net_local * lp, ippp_bundle * add_to )
{ {
isdn_net_dev *idev = lp->netdev;
struct ippp_struct * is; struct ippp_struct * is;
if (lp->ppp_slot < 0) { if (idev->ppp_slot < 0) {
printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n", printk(KERN_ERR "%s: >ppp_slot(%d) out of range\n",
__FUNCTION__ , lp->ppp_slot); __FUNCTION__ , idev->ppp_slot);
return(-EINVAL); return -EINVAL;
} }
is = ippp_table[lp->ppp_slot]; is = ippp_table[idev->ppp_slot];
if (add_to) { if (add_to) {
if( lp->netdev->pb ) if( lp->netdev->pb )
lp->netdev->pb->ref_ct--; lp->netdev->pb->ref_ct--;
...@@ -1482,6 +1482,7 @@ static void isdn_ppp_mp_print_recv_pkt( int slot, struct sk_buff * skb ); ...@@ -1482,6 +1482,7 @@ static void isdn_ppp_mp_print_recv_pkt( int slot, struct sk_buff * skb );
static void isdn_ppp_mp_receive(isdn_net_dev * net_dev, isdn_net_local * lp, static void isdn_ppp_mp_receive(isdn_net_dev * net_dev, isdn_net_local * lp,
struct sk_buff *skb) struct sk_buff *skb)
{ {
isdn_net_dev *idev = lp->netdev;
struct ippp_struct *is; struct ippp_struct *is;
isdn_net_local * lpq; isdn_net_local * lpq;
ippp_bundle * mp; ippp_bundle * mp;
...@@ -1494,10 +1495,10 @@ static void isdn_ppp_mp_receive(isdn_net_dev * net_dev, isdn_net_local * lp, ...@@ -1494,10 +1495,10 @@ static void isdn_ppp_mp_receive(isdn_net_dev * net_dev, isdn_net_local * lp,
spin_lock_irqsave(&net_dev->pb->lock, flags); spin_lock_irqsave(&net_dev->pb->lock, flags);
mp = net_dev->pb; mp = net_dev->pb;
stats = &mp->stats; stats = &mp->stats;
slot = lp->ppp_slot; slot = idev->ppp_slot;
if (slot < 0 || slot > ISDN_MAX_CHANNELS) { if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
printk(KERN_ERR "%s: lp->ppp_slot(%d)\n", printk(KERN_ERR "%s: ppp_slot(%d)\n",
__FUNCTION__, lp->ppp_slot); __FUNCTION__, slot);
stats->frame_drops++; stats->frame_drops++;
dev_kfree_skb(skb); dev_kfree_skb(skb);
spin_unlock_irqrestore(&mp->lock, flags); spin_unlock_irqrestore(&mp->lock, flags);
...@@ -1508,7 +1509,7 @@ static void isdn_ppp_mp_receive(isdn_net_dev * net_dev, isdn_net_local * lp, ...@@ -1508,7 +1509,7 @@ static void isdn_ppp_mp_receive(isdn_net_dev * net_dev, isdn_net_local * lp,
stats->max_queue_len = mp->frames; stats->max_queue_len = mp->frames;
if (is->debug & 0x8) if (is->debug & 0x8)
isdn_ppp_mp_print_recv_pkt(lp->ppp_slot, skb); isdn_ppp_mp_print_recv_pkt(slot, skb);
newseq = isdn_ppp_mp_get_seq(is->mpppcfg & SC_IN_SHORT_SEQ, newseq = isdn_ppp_mp_get_seq(is->mpppcfg & SC_IN_SHORT_SEQ,
skb, is->last_link_seqno); skb, is->last_link_seqno);
...@@ -1531,10 +1532,10 @@ static void isdn_ppp_mp_receive(isdn_net_dev * net_dev, isdn_net_local * lp, ...@@ -1531,10 +1532,10 @@ static void isdn_ppp_mp_receive(isdn_net_dev * net_dev, isdn_net_local * lp,
/* find the minimum received sequence number over all links */ /* find the minimum received sequence number over all links */
is->last_link_seqno = minseq = newseq; is->last_link_seqno = minseq = newseq;
for (lpq = net_dev->queue;;) { for (lpq = net_dev->queue;;) {
slot = lpq->ppp_slot; slot = lpq->netdev->ppp_slot;
if (slot < 0 || slot > ISDN_MAX_CHANNELS) { if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
printk(KERN_ERR "%s: lpq->ppp_slot(%d)\n", printk(KERN_ERR "%s: lpq->ppp_slot(%d)\n",
__FUNCTION__ , lpq->ppp_slot); __FUNCTION__ ,slot);
} else { } else {
u32 lls = ippp_table[slot]->last_link_seqno; u32 lls = ippp_table[slot]->last_link_seqno;
if (MP_LT(lls, minseq)) if (MP_LT(lls, minseq))
...@@ -1761,18 +1762,19 @@ struct sk_buff * isdn_ppp_mp_discard( ippp_bundle * mp, ...@@ -1761,18 +1762,19 @@ struct sk_buff * isdn_ppp_mp_discard( ippp_bundle * mp,
void isdn_ppp_mp_reassembly( isdn_net_dev * net_dev, isdn_net_local * lp, void isdn_ppp_mp_reassembly( isdn_net_dev * net_dev, isdn_net_local * lp,
struct sk_buff * from, struct sk_buff * to ) struct sk_buff * from, struct sk_buff * to )
{ {
isdn_net_dev *idev = lp->netdev;
ippp_bundle * mp = net_dev->pb; ippp_bundle * mp = net_dev->pb;
int proto; int proto;
struct sk_buff * skb; struct sk_buff * skb;
unsigned int tot_len; unsigned int tot_len;
if (lp->ppp_slot < 0 || lp->ppp_slot > ISDN_MAX_CHANNELS) { if (idev->ppp_slot < 0 || idev->ppp_slot > ISDN_MAX_CHANNELS) {
printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n", printk(KERN_ERR "%s: ppp_slot(%d) out of range\n",
__FUNCTION__ , lp->ppp_slot); __FUNCTION__ , idev->ppp_slot);
return; return;
} }
if( MP_FLAGS(from) == (MP_BEGIN_FRAG | MP_END_FRAG) ) { if( MP_FLAGS(from) == (MP_BEGIN_FRAG | MP_END_FRAG) ) {
if( ippp_table[lp->ppp_slot]->debug & 0x40 ) if( ippp_table[idev->ppp_slot]->debug & 0x40 )
printk(KERN_DEBUG "isdn_mppp: reassembly: frame %d, " printk(KERN_DEBUG "isdn_mppp: reassembly: frame %d, "
"len %d\n", MP_SEQ(from), from->len ); "len %d\n", MP_SEQ(from), from->len );
skb = from; skb = from;
...@@ -1785,7 +1787,7 @@ void isdn_ppp_mp_reassembly( isdn_net_dev * net_dev, isdn_net_local * lp, ...@@ -1785,7 +1787,7 @@ void isdn_ppp_mp_reassembly( isdn_net_dev * net_dev, isdn_net_local * lp,
for(tot_len=n=0, frag=from; frag != to; frag=frag->next, n++) for(tot_len=n=0, frag=from; frag != to; frag=frag->next, n++)
tot_len += frag->len - MP_HEADER_LEN; tot_len += frag->len - MP_HEADER_LEN;
if( ippp_table[lp->ppp_slot]->debug & 0x40 ) if( ippp_table[idev->ppp_slot]->debug & 0x40 )
printk(KERN_DEBUG"isdn_mppp: reassembling frames %d " printk(KERN_DEBUG"isdn_mppp: reassembling frames %d "
"to %d, len %d\n", MP_SEQ(from), "to %d, len %d\n", MP_SEQ(from),
(MP_SEQ(from)+n-1) & MP_LONGSEQ_MASK, tot_len ); (MP_SEQ(from)+n-1) & MP_LONGSEQ_MASK, tot_len );
...@@ -1828,7 +1830,7 @@ isdn_ppp_bundle(struct ippp_struct *is, int unit) ...@@ -1828,7 +1830,7 @@ isdn_ppp_bundle(struct ippp_struct *is, int unit)
{ {
char ifn[IFNAMSIZ + 1]; char ifn[IFNAMSIZ + 1];
isdn_net_dev *p; isdn_net_dev *p;
isdn_net_local *lp, *nlp; isdn_net_dev *idev, *nidev;
int rc; int rc;
unsigned long flags; unsigned long flags;
...@@ -1841,27 +1843,27 @@ isdn_ppp_bundle(struct ippp_struct *is, int unit) ...@@ -1841,27 +1843,27 @@ isdn_ppp_bundle(struct ippp_struct *is, int unit)
spin_lock_irqsave(&p->pb->lock, flags); spin_lock_irqsave(&p->pb->lock, flags);
nlp = is->lp; nidev = is->idev;
lp = p->queue; idev = p->queue->netdev;
if( nlp->ppp_slot < 0 || nlp->ppp_slot >= ISDN_MAX_CHANNELS || if( nidev->ppp_slot < 0 || nidev->ppp_slot >= ISDN_MAX_CHANNELS ||
lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS ) { idev ->ppp_slot < 0 || idev ->ppp_slot >= ISDN_MAX_CHANNELS ) {
printk(KERN_ERR "ippp_bundle: binding to invalid slot %d\n", printk(KERN_ERR "ippp_bundle: binding to invalid slot %d\n",
nlp->ppp_slot < 0 || nlp->ppp_slot >= ISDN_MAX_CHANNELS ? nidev->ppp_slot < 0 || nidev->ppp_slot >= ISDN_MAX_CHANNELS ?
nlp->ppp_slot : lp->ppp_slot ); nidev->ppp_slot : idev->ppp_slot );
rc = -EINVAL; rc = -EINVAL;
goto out; goto out;
} }
isdn_net_add_to_bundle(p, nlp); isdn_net_add_to_bundle(p, &nidev->local);
ippp_table[nlp->ppp_slot]->unit = ippp_table[lp->ppp_slot]->unit; ippp_table[nidev->ppp_slot]->unit = ippp_table[idev->ppp_slot]->unit;
/* maybe also SC_CCP stuff */ /* maybe also SC_CCP stuff */
ippp_table[nlp->ppp_slot]->pppcfg |= ippp_table[lp->ppp_slot]->pppcfg & ippp_table[nidev->ppp_slot]->pppcfg |= ippp_table[idev->ppp_slot]->pppcfg &
(SC_ENABLE_IP | SC_NO_TCP_CCID | SC_REJ_COMP_TCP); (SC_ENABLE_IP | SC_NO_TCP_CCID | SC_REJ_COMP_TCP);
ippp_table[nlp->ppp_slot]->mpppcfg |= ippp_table[lp->ppp_slot]->mpppcfg & ippp_table[nidev->ppp_slot]->mpppcfg |= ippp_table[idev->ppp_slot]->mpppcfg &
(SC_MP_PROT | SC_REJ_MP_PROT | SC_OUT_SHORT_SEQ | SC_IN_SHORT_SEQ); (SC_MP_PROT | SC_REJ_MP_PROT | SC_OUT_SHORT_SEQ | SC_IN_SHORT_SEQ);
rc = isdn_ppp_mp_init(nlp, p->pb); rc = isdn_ppp_mp_init(&nidev->local, p->pb);
out: out:
spin_unlock_irqrestore(&p->pb->lock, flags); spin_unlock_irqrestore(&p->pb->lock, flags);
return rc; return rc;
...@@ -1934,7 +1936,7 @@ isdn_ppp_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -1934,7 +1936,7 @@ isdn_ppp_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
if(copy_to_user(r, PPP_VERSION, len)) error = -EFAULT; if(copy_to_user(r, PPP_VERSION, len)) error = -EFAULT;
break; break;
case SIOCGPPPSTATS: case SIOCGPPPSTATS:
error = isdn_ppp_dev_ioctl_stats(lp->ppp_slot, ifr, dev); error = isdn_ppp_dev_ioctl_stats(lp->netdev->ppp_slot, ifr, dev);
break; break;
default: default:
error = -EINVAL; error = -EINVAL;
...@@ -2052,7 +2054,7 @@ isdn_ppp_hangup_slave(char *name) ...@@ -2052,7 +2054,7 @@ isdn_ppp_hangup_slave(char *name)
static void isdn_ppp_ccp_kickup(struct ippp_struct *is) static void isdn_ppp_ccp_kickup(struct ippp_struct *is)
{ {
isdn_ppp_fill_rq(NULL, 0, PPP_COMP, is->lp->ppp_slot); isdn_ppp_fill_rq(NULL, 0, PPP_COMP, is->idev->ppp_slot);
} }
/* In-kernel handling of CCP Reset-Request and Reset-Ack is necessary, /* In-kernel handling of CCP Reset-Request and Reset-Ack is necessary,
...@@ -2098,8 +2100,7 @@ static void isdn_ppp_ccp_xmit_reset(struct ippp_struct *is, int proto, ...@@ -2098,8 +2100,7 @@ static void isdn_ppp_ccp_xmit_reset(struct ippp_struct *is, int proto,
unsigned char *p; unsigned char *p;
int hl; int hl;
int cnt = 0; int cnt = 0;
isdn_net_local *lp = is->lp; isdn_net_dev *idev = is->idev;
isdn_net_dev *idev = lp->netdev;
/* Alloc large enough skb */ /* Alloc large enough skb */
hl = isdn_slot_hdrlen(idev->isdn_slot); hl = isdn_slot_hdrlen(idev->isdn_slot);
...@@ -2136,9 +2137,9 @@ static void isdn_ppp_ccp_xmit_reset(struct ippp_struct *is, int proto, ...@@ -2136,9 +2137,9 @@ static void isdn_ppp_ccp_xmit_reset(struct ippp_struct *is, int proto,
/* skb is now ready for xmit */ /* skb is now ready for xmit */
printk(KERN_DEBUG "Sending CCP Frame:\n"); printk(KERN_DEBUG "Sending CCP Frame:\n");
isdn_ppp_frame_log("ccp-xmit", skb->data, skb->len, 32, is->unit,lp->ppp_slot); isdn_ppp_frame_log("ccp-xmit", skb->data, skb->len, 32, is->unit,idev->ppp_slot);
isdn_net_write_super(lp, skb); isdn_net_write_super(&idev->local, skb);
} }
/* Allocate the reset state vector */ /* Allocate the reset state vector */
...@@ -2539,6 +2540,7 @@ static struct sk_buff *isdn_ppp_compress(struct sk_buff *skb_in,int *proto, ...@@ -2539,6 +2540,7 @@ static struct sk_buff *isdn_ppp_compress(struct sk_buff *skb_in,int *proto,
static void isdn_ppp_receive_ccp(isdn_net_dev *net_dev, isdn_net_local *lp, static void isdn_ppp_receive_ccp(isdn_net_dev *net_dev, isdn_net_local *lp,
struct sk_buff *skb,int proto) struct sk_buff *skb,int proto)
{ {
isdn_net_dev *idev = lp->netdev;
struct ippp_struct *is; struct ippp_struct *is;
struct ippp_struct *mis; struct ippp_struct *mis;
int len; int len;
...@@ -2546,17 +2548,17 @@ static void isdn_ppp_receive_ccp(isdn_net_dev *net_dev, isdn_net_local *lp, ...@@ -2546,17 +2548,17 @@ static void isdn_ppp_receive_ccp(isdn_net_dev *net_dev, isdn_net_local *lp,
unsigned char rsdata[IPPP_RESET_MAXDATABYTES]; unsigned char rsdata[IPPP_RESET_MAXDATABYTES];
printk(KERN_DEBUG "Received CCP frame from peer slot(%d)\n", printk(KERN_DEBUG "Received CCP frame from peer slot(%d)\n",
lp->ppp_slot); idev->ppp_slot);
if (lp->ppp_slot < 0 || lp->ppp_slot > ISDN_MAX_CHANNELS) { if (idev->ppp_slot < 0 || idev->ppp_slot > ISDN_MAX_CHANNELS) {
printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n", printk(KERN_ERR "%s: ppp_slot(%d) out of range\n",
__FUNCTION__ , lp->ppp_slot); __FUNCTION__ , idev->ppp_slot);
return; return;
} }
is = ippp_table[lp->ppp_slot]; is = ippp_table[idev->ppp_slot];
isdn_ppp_frame_log("ccp-rcv", skb->data, skb->len, 32, is->unit,lp->ppp_slot); isdn_ppp_frame_log("ccp-rcv", skb->data, skb->len, 32, is->unit,idev->ppp_slot);
if(lp->master) { if(lp->master) {
int slot = ((isdn_net_local *) (lp->master->priv))->ppp_slot; int slot = ((isdn_net_local *) (lp->master->priv))->netdev->ppp_slot;
if (slot < 0 || slot > ISDN_MAX_CHANNELS) { if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
printk(KERN_ERR "%s: slot(%d) out of range\n", printk(KERN_ERR "%s: slot(%d) out of range\n",
__FUNCTION__ , slot); __FUNCTION__ , slot);
...@@ -2715,8 +2717,9 @@ static void isdn_ppp_receive_ccp(isdn_net_dev *net_dev, isdn_net_local *lp, ...@@ -2715,8 +2717,9 @@ static void isdn_ppp_receive_ccp(isdn_net_dev *net_dev, isdn_net_local *lp,
static void isdn_ppp_send_ccp(isdn_net_dev *net_dev, isdn_net_local *lp, struct sk_buff *skb) static void isdn_ppp_send_ccp(isdn_net_dev *net_dev, isdn_net_local *lp, struct sk_buff *skb)
{ {
isdn_net_dev *idev = lp->netdev;
struct ippp_struct *mis,*is; struct ippp_struct *mis,*is;
int proto, slot = lp->ppp_slot; int proto, slot = idev->ppp_slot;
unsigned char *data; unsigned char *data;
if(!skb || skb->len < 3) if(!skb || skb->len < 3)
...@@ -2740,10 +2743,10 @@ static void isdn_ppp_send_ccp(isdn_net_dev *net_dev, isdn_net_local *lp, struct ...@@ -2740,10 +2743,10 @@ static void isdn_ppp_send_ccp(isdn_net_dev *net_dev, isdn_net_local *lp, struct
return; return;
printk(KERN_DEBUG "Received CCP frame from daemon:\n"); printk(KERN_DEBUG "Received CCP frame from daemon:\n");
isdn_ppp_frame_log("ccp-xmit", skb->data, skb->len, 32, is->unit,lp->ppp_slot); isdn_ppp_frame_log("ccp-xmit", skb->data, skb->len, 32, is->unit,idev->ppp_slot);
if (lp->master) { if (lp->master) {
slot = ((isdn_net_local *) (lp->master->priv))->ppp_slot; slot = ((isdn_net_local *) (lp->master->priv))->netdev->ppp_slot;
if (slot < 0 || slot > ISDN_MAX_CHANNELS) { if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
printk(KERN_ERR "%s: slot(%d) out of range\n", printk(KERN_ERR "%s: slot(%d) out of range\n",
__FUNCTION__ , slot); __FUNCTION__ , slot);
......
...@@ -312,7 +312,6 @@ typedef struct isdn_net_local_s { ...@@ -312,7 +312,6 @@ typedef struct isdn_net_local_s {
ulong magic; ulong magic;
spinlock_t lock; spinlock_t lock;
struct net_device_stats stats; /* Ethernet Statistics */ struct net_device_stats stats; /* Ethernet Statistics */
int ppp_slot; /* PPPD device slot number */
int flags; /* Connection-flags */ int flags; /* Connection-flags */
int dialretry; /* Counter for Dialout-retries */ int dialretry; /* Counter for Dialout-retries */
int dialmax; /* Max. Number of Dial-retries */ int dialmax; /* Max. Number of Dial-retries */
...@@ -372,7 +371,6 @@ typedef struct isdn_net_local_s { ...@@ -372,7 +371,6 @@ typedef struct isdn_net_local_s {
/* a particular channel (including */ /* a particular channel (including */
/* the frame_cnt */ /* the frame_cnt */
int pppbind; /* ippp device for bindings */
int dialtimeout; /* How long shall we try on dialing? (jiffies) */ int dialtimeout; /* How long shall we try on dialing? (jiffies) */
int dialwait; /* How long shall we wait after failed attempt? (jiffies) */ int dialwait; /* How long shall we wait after failed attempt? (jiffies) */
ulong dialstarted; /* jiffies of first dialing-attempt */ ulong dialstarted; /* jiffies of first dialing-attempt */
...@@ -408,6 +406,8 @@ typedef struct isdn_net_dev_s { ...@@ -408,6 +406,8 @@ typedef struct isdn_net_dev_s {
int dialstate; /* State for dialing */ int dialstate; /* State for dialing */
struct timer_list hup_timer; /* auto hangup timer */ struct timer_list hup_timer; /* auto hangup timer */
int pppbind; /* ippp device for bindings */
int ppp_slot; /* PPPD device slot number */
isdn_net_local *queue; /* circular list of all bundled isdn_net_local *queue; /* circular list of all bundled
channels, which are currently channels, which are currently
......
...@@ -212,7 +212,7 @@ struct ippp_struct { ...@@ -212,7 +212,7 @@ struct ippp_struct {
unsigned int mpmru; unsigned int mpmru;
unsigned int mpmtu; unsigned int mpmtu;
unsigned int maxcid; unsigned int maxcid;
struct isdn_net_local_s *lp; struct isdn_net_dev_s *idev;
int unit; int unit;
int minor; int minor;
unsigned int last_link_seqno; unsigned int last_link_seqno;
......
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