Commit da111000 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: Move dial/hangup related stuff to isdn_net_dev

Keeping track of dialing / auto hangup is per ISDN channel, so should
go into isdn_net_dev.
parent 890ca7d1
...@@ -371,7 +371,7 @@ isdn_ciscohdlck_receive(isdn_net_dev *idev, isdn_net_local *olp, ...@@ -371,7 +371,7 @@ isdn_ciscohdlck_receive(isdn_net_dev *idev, isdn_net_local *olp,
goto out_free; goto out_free;
default: default:
/* no special cisco protocol */ /* no special cisco protocol */
isdn_net_reset_huptimer(lp, olp); isdn_net_reset_huptimer(idev, olp->netdev);
skb->protocol = htons(type); skb->protocol = htons(type);
netif_rx(skb); netif_rx(skb);
return; return;
......
...@@ -339,29 +339,29 @@ static void isdn_net_hup_timer(unsigned long data) ...@@ -339,29 +339,29 @@ static void isdn_net_hup_timer(unsigned long data)
dbg_net_dial("%s: huptimer %d, onhtime %d, chargetime %ld, chargeint %d\n", dbg_net_dial("%s: huptimer %d, onhtime %d, chargetime %ld, chargeint %d\n",
l->name, l->huptimer, l->onhtime, l->chargetime, l->chargeint); l->name, l->huptimer, l->onhtime, l->chargetime, l->chargeint);
if (!(lp->onhtime)) if (lp->onhtime == 0)
return; return;
if (lp->huptimer++ <= lp->onhtime) if (idev->huptimer++ <= lp->onhtime)
goto mod_timer; goto mod_timer;
if (lp->hupflags & ISDN_MANCHARGE && lp->hupflags & ISDN_CHARGEHUP) { if ((lp->hupflags & (ISDN_MANCHARGE | ISDN_CHARGEHUP)) == (ISDN_MANCHARGE | ISDN_CHARGEHUP)) {
while (time_after(jiffies, lp->chargetime + lp->chargeint)) while (time_after(jiffies, idev->chargetime + idev->chargeint))
lp->chargetime += lp->chargeint; idev->chargetime += idev->chargeint;
if (time_after(jiffies, lp->chargetime + lp->chargeint - 2 * HZ)) { if (time_after(jiffies, idev->chargetime + idev->chargeint - 2 * HZ)) {
if (lp->outgoing || lp->hupflags & ISDN_INHUP) { if (idev->outgoing || lp->hupflags & ISDN_INHUP) {
isdn_net_hangup(idev); isdn_net_hangup(idev);
return; return;
} }
} }
} else if (lp->outgoing) { } else if (idev->outgoing) {
if (lp->hupflags & ISDN_CHARGEHUP) { if (lp->hupflags & ISDN_CHARGEHUP) {
if (lp->charge_state != ST_CHARGE_HAVE_CINT) { if (idev->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(idev); isdn_net_hangup(idev);
return; return;
} else if (time_after(jiffies, lp->chargetime + lp->chargeint)) { } else if (time_after(jiffies, idev->chargetime + idev->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(idev); isdn_net_hangup(idev);
...@@ -399,15 +399,15 @@ static void isdn_net_connected(isdn_net_local *lp) ...@@ -399,15 +399,15 @@ static void isdn_net_connected(isdn_net_local *lp)
/* If first Chargeinfo comes before B-Channel connect, /* If first Chargeinfo comes before B-Channel connect,
* we correct the timestamp here. * we correct the timestamp here.
*/ */
lp->chargetime = jiffies; idev->chargetime = jiffies;
/* reset dial-timeout */ /* reset dial-timeout */
lp->dialstarted = 0; idev->dialstarted = 0;
lp->dialwait_timer = 0; idev->dialwait_timer = 0;
lp->transcount = 0; idev->transcount = 0;
lp->cps = 0; idev->cps = 0;
lp->last_jiffies = jiffies; idev->last_jiffies = jiffies;
if (lp->ops->connected) if (lp->ops->connected)
lp->ops->connected(lp); lp->ops->connected(lp);
...@@ -451,13 +451,15 @@ isdn_net_dial_timer(unsigned long data) ...@@ -451,13 +451,15 @@ isdn_net_dial_timer(unsigned long data)
static void static void
init_dialout(isdn_net_local *lp) init_dialout(isdn_net_local *lp)
{ {
lp->dial = 0; isdn_net_dev *idev = lp->netdev;
idev->dial = 0;
if (lp->dialtimeout > 0 && if (lp->dialtimeout > 0 &&
(lp->dialstarted == 0 || (idev->dialstarted == 0 ||
time_after(jiffies, lp->dialstarted + lp->dialtimeout + lp->dialwait))) { time_after(jiffies, idev->dialstarted + lp->dialtimeout + lp->dialwait))) {
lp->dialstarted = jiffies; idev->dialstarted = jiffies;
lp->dialwait_timer = 0; idev->dialwait_timer = 0;
} }
lp->dialretry = 0; lp->dialretry = 0;
do_dialout(lp); do_dialout(lp);
...@@ -492,31 +494,31 @@ do_dialout(isdn_net_local *lp) ...@@ -492,31 +494,31 @@ do_dialout(isdn_net_local *lp)
} }
i = 0; i = 0;
list_for_each_entry(phone, &lp->phone[1], list) { list_for_each_entry(phone, &lp->phone[1], list) {
if (i++ == lp->dial) if (i++ == idev->dial)
goto found; goto found;
} }
/* otherwise start in front */ /* otherwise start in front */
phone = list_entry(lp->phone[1].next, struct isdn_net_phone, list); phone = list_entry(lp->phone[1].next, struct isdn_net_phone, list);
lp->dial = 0; idev->dial = 0;
lp->dialretry++; lp->dialretry++;
found: found:
lp->dial++; idev->dial++;
dial.phone = phone->num; dial.phone = phone->num;
spin_unlock_irqrestore(&lp->lock, flags); spin_unlock_irqrestore(&lp->lock, flags);
if (lp->dialretry > lp->dialmax) { if (lp->dialretry > lp->dialmax) {
if (lp->dialtimeout == 0) { if (lp->dialtimeout == 0) {
lp->dialwait_timer = jiffies + lp->dialwait; idev->dialwait_timer = jiffies + lp->dialwait;
lp->dialstarted = 0; idev->dialstarted = 0;
} }
isdn_net_hangup(idev); isdn_net_hangup(idev);
return; return;
} }
if(lp->dialtimeout > 0 && if(lp->dialtimeout > 0 &&
time_after(jiffies, lp->dialstarted + lp->dialtimeout)) { time_after(jiffies, idev->dialstarted + lp->dialtimeout)) {
lp->dialwait_timer = jiffies + lp->dialwait; idev->dialwait_timer = jiffies + lp->dialwait;
lp->dialstarted = 0; idev->dialstarted = 0;
isdn_net_hangup(idev); isdn_net_hangup(idev);
return; return;
} }
...@@ -525,12 +527,12 @@ do_dialout(isdn_net_local *lp) ...@@ -525,12 +527,12 @@ do_dialout(isdn_net_local *lp)
*/ */
isdn_slot_dial(idev->isdn_slot, &dial); isdn_slot_dial(idev->isdn_slot, &dial);
lp->huptimer = 0; idev->huptimer = 0;
lp->outgoing = 1; idev->outgoing = 1;
if (lp->chargeint) if (idev->chargeint)
lp->charge_state = ST_CHARGE_HAVE_CINT; idev->charge_state = ST_CHARGE_HAVE_CINT;
else else
lp->charge_state = ST_CHARGE_NULL; idev->charge_state = ST_CHARGE_NULL;
if (lp->cbdelay && (lp->flags & ISDN_NET_CBOUT)) { if (lp->cbdelay && (lp->flags & ISDN_NET_CBOUT)) {
idev->dial_timer.expires = jiffies + lp->cbdelay; idev->dial_timer.expires = jiffies + lp->cbdelay;
...@@ -572,7 +574,7 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg) ...@@ -572,7 +574,7 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg)
isdn_slot_all_eaz(idev->isdn_slot); isdn_slot_all_eaz(idev->isdn_slot);
printk(KERN_INFO "%s: remote hangup\n", idev->name); printk(KERN_INFO "%s: remote hangup\n", idev->name);
printk(KERN_INFO "%s: Chargesum is %d\n", idev->name, printk(KERN_INFO "%s: Chargesum is %d\n", idev->name,
lp->charge); idev->charge);
isdn_net_unbind_channel(lp); isdn_net_unbind_channel(lp);
return 1; return 1;
case ISDN_STAT_CINF: case ISDN_STAT_CINF:
...@@ -580,19 +582,19 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg) ...@@ -580,19 +582,19 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg)
* charge-infos and set timestamp for last info for * charge-infos and set timestamp for last info for
* usage by isdn_net_autohup() * usage by isdn_net_autohup()
*/ */
lp->charge++; idev->charge++;
switch (lp->charge_state) { switch (idev->charge_state) {
case ST_CHARGE_NULL: case ST_CHARGE_NULL:
lp->charge_state = ST_CHARGE_GOT_CINF; idev->charge_state = ST_CHARGE_GOT_CINF;
break; break;
case ST_CHARGE_GOT_CINF: case ST_CHARGE_GOT_CINF:
lp->charge_state = ST_CHARGE_HAVE_CINT; idev->charge_state = ST_CHARGE_HAVE_CINT;
/* fall through */ /* fall through */
case ST_CHARGE_HAVE_CINT: case ST_CHARGE_HAVE_CINT:
lp->chargeint = jiffies - lp->chargetime - 2 * HZ; idev->chargeint = jiffies - idev->chargetime - 2 * HZ;
break; break;
} }
lp->chargetime = jiffies; idev->chargetime = jiffies;
dbg_net_dial("%s: got CINF\n", lp->name); dbg_net_dial("%s: got CINF\n", lp->name);
return 1; return 1;
} }
...@@ -731,7 +733,7 @@ isdn_net_hangup(isdn_net_dev *idev) ...@@ -731,7 +733,7 @@ isdn_net_hangup(isdn_net_dev *idev)
isdn_net_lp_disconnected(lp); isdn_net_lp_disconnected(lp);
isdn_slot_command(idev->isdn_slot, ISDN_CMD_HANGUP, &cmd); isdn_slot_command(idev->isdn_slot, ISDN_CMD_HANGUP, &cmd);
printk(KERN_INFO "%s: Chargesum is %d\n", idev->name, lp->charge); printk(KERN_INFO "%s: Chargesum is %d\n", idev->name, idev->charge);
isdn_slot_all_eaz(idev->isdn_slot); isdn_slot_all_eaz(idev->isdn_slot);
isdn_net_unbind_channel(lp); isdn_net_unbind_channel(lp);
} }
...@@ -910,7 +912,7 @@ void isdn_net_writebuf_skb(isdn_net_local *lp, struct sk_buff *skb) ...@@ -910,7 +912,7 @@ void isdn_net_writebuf_skb(isdn_net_local *lp, struct sk_buff *skb)
goto error; goto error;
} }
lp->transcount += len; idev->transcount += len;
isdn_net_inc_frame_cnt(lp); isdn_net_inc_frame_cnt(lp);
return; return;
...@@ -934,7 +936,7 @@ void isdn_net_writebuf_skb(isdn_net_local *lp, struct sk_buff *skb) ...@@ -934,7 +936,7 @@ void isdn_net_writebuf_skb(isdn_net_local *lp, struct sk_buff *skb)
static int static int
isdn_net_xmit(struct net_device *ndev, struct sk_buff *skb) isdn_net_xmit(struct net_device *ndev, struct sk_buff *skb)
{ {
isdn_net_dev *nd; isdn_net_dev *nd, *idev;
isdn_net_local *slp; isdn_net_local *slp;
isdn_net_local *lp = ndev->priv; isdn_net_local *lp = ndev->priv;
int retv = 0; int retv = 0;
...@@ -955,10 +957,11 @@ isdn_net_xmit(struct net_device *ndev, struct sk_buff *skb) ...@@ -955,10 +957,11 @@ isdn_net_xmit(struct net_device *ndev, struct sk_buff *skb)
printk(KERN_WARNING "%s: all channels busy - requeuing!\n", ndev->name); printk(KERN_WARNING "%s: all channels busy - requeuing!\n", ndev->name);
return 1; return 1;
} }
idev = lp->netdev;
/* we have our lp locked from now on */ /* we have our lp locked from now on */
/* Reset hangup-timeout */ /* Reset hangup-timeout */
lp->huptimer = 0; // FIXME? idev->huptimer = 0; // FIXME?
isdn_net_writebuf_skb(lp, skb); isdn_net_writebuf_skb(lp, skb);
spin_unlock_bh(&lp->xmit_lock); spin_unlock_bh(&lp->xmit_lock);
...@@ -967,15 +970,15 @@ isdn_net_xmit(struct net_device *ndev, struct sk_buff *skb) ...@@ -967,15 +970,15 @@ isdn_net_xmit(struct net_device *ndev, struct sk_buff *skb)
* should move to userspace and get based on an overall cps * should move to userspace and get based on an overall cps
* calculation * calculation
*/ */
if (jiffies != lp->last_jiffies) { if (jiffies != idev->last_jiffies) {
lp->cps = lp->transcount * HZ / (jiffies - lp->last_jiffies); idev->cps = idev->transcount * HZ / (jiffies - idev->last_jiffies);
lp->last_jiffies = jiffies; idev->last_jiffies = jiffies;
lp->transcount = 0; idev->transcount = 0;
} }
if (dev->net_verbose > 3) if (dev->net_verbose > 3)
printk(KERN_DEBUG "%s: %d bogocps\n", lp->netdev->name, lp->cps); printk(KERN_DEBUG "%s: %d bogocps\n", idev->name, idev->cps);
if (lp->cps > lp->triggercps) { if (idev->cps > lp->triggercps) {
if (lp->slave) { if (lp->slave) {
if (!lp->sqfull) { if (!lp->sqfull) {
/* First time overload: set timestamp only */ /* First time overload: set timestamp only */
...@@ -1034,19 +1037,20 @@ static int ...@@ -1034,19 +1037,20 @@ static int
isdn_net_autodial(struct sk_buff *skb, struct net_device *ndev) isdn_net_autodial(struct sk_buff *skb, struct net_device *ndev)
{ {
isdn_net_local *lp = ndev->priv; isdn_net_local *lp = ndev->priv;
isdn_net_dev *idev = lp->netdev;
if (!(ISDN_NET_DIALMODE(*lp) == ISDN_NET_DM_AUTO)) if (!(ISDN_NET_DIALMODE(*lp) == ISDN_NET_DM_AUTO))
goto discard; goto discard;
if(lp->dialwait_timer <= 0) if (idev->dialwait_timer <= 0)
if(lp->dialstarted > 0 && lp->dialtimeout > 0 && time_before(jiffies, lp->dialstarted + lp->dialtimeout + lp->dialwait)) if (idev->dialstarted > 0 && lp->dialtimeout > 0 && time_before(jiffies, idev->dialstarted + lp->dialtimeout + lp->dialwait))
lp->dialwait_timer = lp->dialstarted + lp->dialtimeout + lp->dialwait; idev->dialwait_timer = idev->dialstarted + lp->dialtimeout + lp->dialwait;
if(lp->dialwait_timer > 0) { if (idev->dialwait_timer > 0) {
if(time_before(jiffies, lp->dialwait_timer)) if(time_before(jiffies, idev->dialwait_timer))
goto discard; goto discard;
lp->dialwait_timer = 0; idev->dialwait_timer = 0;
} }
if (isdn_net_force_dial_lp(lp) < 0) if (isdn_net_force_dial_lp(lp) < 0)
...@@ -1142,9 +1146,10 @@ static void ...@@ -1142,9 +1146,10 @@ static void
isdn_net_receive(struct net_device *ndev, struct sk_buff *skb) isdn_net_receive(struct net_device *ndev, struct sk_buff *skb)
{ {
isdn_net_local *lp = (isdn_net_local *) ndev->priv; isdn_net_local *lp = (isdn_net_local *) ndev->priv;
isdn_net_dev *idev = lp->netdev;
isdn_net_local *olp = lp; /* original 'lp' */ isdn_net_local *olp = lp; /* original 'lp' */
lp->transcount += skb->len; idev->transcount += skb->len;
lp->stats.rx_packets++; lp->stats.rx_packets++;
lp->stats.rx_bytes += skb->len; lp->stats.rx_bytes += skb->len;
...@@ -1422,9 +1427,9 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup) ...@@ -1422,9 +1427,9 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
isdn_net_bind_channel(lp, idx); isdn_net_bind_channel(lp, idx);
lp->outgoing = 0; idev->outgoing = 0;
lp->huptimer = 0; idev->huptimer = 0;
lp->charge_state = ST_CHARGE_NULL; idev->charge_state = ST_CHARGE_NULL;
/* Got incoming Call, setup L2 and L3 protocols, /* Got incoming Call, setup L2 and L3 protocols,
* then wait for D-Channel-connect * then wait for D-Channel-connect
*/ */
...@@ -1617,8 +1622,8 @@ isdn_net_new(char *name, struct net_device *master) ...@@ -1617,8 +1622,8 @@ isdn_net_new(char *name, struct net_device *master)
netdev->local.cbdelay = 5 * HZ; /* Wait 5 secs before Callback */ netdev->local.cbdelay = 5 * HZ; /* Wait 5 secs before Callback */
netdev->local.dialtimeout = -1; /* Infinite Dial-Timeout */ netdev->local.dialtimeout = -1; /* Infinite Dial-Timeout */
netdev->local.dialwait = 5 * HZ; /* Wait 5 sec. after failed dial */ netdev->local.dialwait = 5 * HZ; /* Wait 5 sec. after failed dial */
netdev->local.dialstarted = 0; /* Jiffies of last dial-start */ netdev->dialstarted = 0; /* Jiffies of last dial-start */
netdev->local.dialwait_timer = 0; /* Jiffies of earliest next dial-start */ netdev->dialwait_timer = 0; /* Jiffies of earliest next dial-start */
init_timer(&netdev->dial_timer); init_timer(&netdev->dial_timer);
netdev->dial_timer.data = (unsigned long) netdev; netdev->dial_timer.data = (unsigned long) netdev;
...@@ -1818,7 +1823,7 @@ isdn_net_setcfg(isdn_net_ioctl_cfg *cfg) ...@@ -1818,7 +1823,7 @@ isdn_net_setcfg(isdn_net_ioctl_cfg *cfg)
strncpy(lp->msn, cfg->eaz, ISDN_MSNLEN-1); strncpy(lp->msn, cfg->eaz, ISDN_MSNLEN-1);
lp->msn[ISDN_MSNLEN-1] = 0; lp->msn[ISDN_MSNLEN-1] = 0;
lp->onhtime = cfg->onhtime; lp->onhtime = cfg->onhtime;
lp->charge = cfg->charge; idev->charge = cfg->charge;
lp->l2_proto = cfg->l2_proto; lp->l2_proto = cfg->l2_proto;
lp->l3_proto = cfg->l3_proto; lp->l3_proto = cfg->l3_proto;
lp->cbdelay = cfg->cbdelay * HZ / 5; lp->cbdelay = cfg->cbdelay * HZ / 5;
...@@ -1857,7 +1862,7 @@ isdn_net_setcfg(isdn_net_ioctl_cfg *cfg) ...@@ -1857,7 +1862,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->netdev); isdn_net_hangup(idev);
if (cfg->chargehup) if (cfg->chargehup)
lp->hupflags |= ISDN_CHARGEHUP; lp->hupflags |= ISDN_CHARGEHUP;
...@@ -1870,8 +1875,8 @@ isdn_net_setcfg(isdn_net_ioctl_cfg *cfg) ...@@ -1870,8 +1875,8 @@ isdn_net_setcfg(isdn_net_ioctl_cfg *cfg)
lp->hupflags &= ~ISDN_INHUP; lp->hupflags &= ~ISDN_INHUP;
if (cfg->chargeint > 10) { if (cfg->chargeint > 10) {
lp->chargeint = cfg->chargeint * HZ; idev->chargeint = cfg->chargeint * HZ;
lp->charge_state = ST_CHARGE_HAVE_CINT; idev->charge_state = ST_CHARGE_HAVE_CINT;
lp->hupflags |= ISDN_MANCHARGE; lp->hupflags |= ISDN_MANCHARGE;
} }
retval = 0; retval = 0;
...@@ -1900,7 +1905,7 @@ isdn_net_getcfg(isdn_net_ioctl_cfg * cfg) ...@@ -1900,7 +1905,7 @@ isdn_net_getcfg(isdn_net_ioctl_cfg * cfg)
} else } else
cfg->drvid[0] = '\0'; cfg->drvid[0] = '\0';
cfg->onhtime = lp->onhtime; cfg->onhtime = lp->onhtime;
cfg->charge = lp->charge; cfg->charge = idev->charge;
cfg->l2_proto = lp->l2_proto; cfg->l2_proto = lp->l2_proto;
cfg->l3_proto = lp->l3_proto; cfg->l3_proto = lp->l3_proto;
cfg->p_encap = lp->p_encap; cfg->p_encap = lp->p_encap;
...@@ -1912,14 +1917,14 @@ isdn_net_getcfg(isdn_net_ioctl_cfg * cfg) ...@@ -1912,14 +1917,14 @@ isdn_net_getcfg(isdn_net_ioctl_cfg * cfg)
cfg->callback = 2; cfg->callback = 2;
cfg->cbhup = (lp->flags & ISDN_NET_CBHUP) ? 1 : 0; cfg->cbhup = (lp->flags & ISDN_NET_CBHUP) ? 1 : 0;
cfg->dialmode = lp->flags & ISDN_NET_DIALMODE_MASK; cfg->dialmode = lp->flags & ISDN_NET_DIALMODE_MASK;
cfg->chargehup = (lp->hupflags & 4) ? 1 : 0; cfg->chargehup = (lp->hupflags & ISDN_CHARGEHUP) ? 1 : 0;
cfg->ihup = (lp->hupflags & 8) ? 1 : 0; cfg->ihup = (lp->hupflags & ISDN_INHUP) ? 1 : 0;
cfg->cbdelay = lp->cbdelay * 5 / HZ; cfg->cbdelay = lp->cbdelay * 5 / HZ;
cfg->dialmax = lp->dialmax; cfg->dialmax = lp->dialmax;
cfg->triggercps = lp->triggercps; cfg->triggercps = lp->triggercps;
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; (idev->chargeint / HZ) : 0;
cfg->pppbind = idev->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;
...@@ -2099,7 +2104,7 @@ isdn_net_force_hangup(char *name) ...@@ -2099,7 +2104,7 @@ isdn_net_force_hangup(char *name)
isdn_net_hangup(((isdn_net_local *) q->priv)->netdev); 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);
return 0; return 0;
} }
...@@ -2214,9 +2219,7 @@ static void ...@@ -2214,9 +2219,7 @@ static void
isdn_iptyp_receive(isdn_net_dev *p, isdn_net_local *olp, isdn_iptyp_receive(isdn_net_dev *p, isdn_net_local *olp,
struct sk_buff *skb) struct sk_buff *skb)
{ {
isdn_net_local *lp = &p->local; isdn_net_reset_huptimer(p, olp->netdev);
isdn_net_reset_huptimer(lp, olp);
get_u16(skb->data, &skb->protocol); get_u16(skb->data, &skb->protocol);
skb_pull(skb, 2); skb_pull(skb, 2);
netif_rx(skb); netif_rx(skb);
...@@ -2247,9 +2250,7 @@ static void ...@@ -2247,9 +2250,7 @@ static void
isdn_uihdlc_receive(isdn_net_dev *p, isdn_net_local *olp, isdn_uihdlc_receive(isdn_net_dev *p, isdn_net_local *olp,
struct sk_buff *skb) struct sk_buff *skb)
{ {
isdn_net_local *lp = &p->local; isdn_net_reset_huptimer(p, olp->netdev);
isdn_net_reset_huptimer(lp, olp);
skb_pull(skb, 2); skb_pull(skb, 2);
skb->protocol = htons(ETH_P_IP); skb->protocol = htons(ETH_P_IP);
netif_rx(skb); netif_rx(skb);
...@@ -2271,9 +2272,7 @@ static void ...@@ -2271,9 +2272,7 @@ static void
isdn_rawip_receive(isdn_net_dev *p, isdn_net_local *olp, isdn_rawip_receive(isdn_net_dev *p, isdn_net_local *olp,
struct sk_buff *skb) struct sk_buff *skb)
{ {
isdn_net_local *lp = &p->local; isdn_net_reset_huptimer(p, olp->netdev);
isdn_net_reset_huptimer(lp, olp);
skb->protocol = htons(ETH_P_IP); skb->protocol = htons(ETH_P_IP);
netif_rx(skb); netif_rx(skb);
} }
...@@ -2346,9 +2345,7 @@ static void ...@@ -2346,9 +2345,7 @@ static void
isdn_ether_receive(isdn_net_dev *p, isdn_net_local *olp, isdn_ether_receive(isdn_net_dev *p, isdn_net_local *olp,
struct sk_buff *skb) struct sk_buff *skb)
{ {
isdn_net_local *lp = &p->local; isdn_net_reset_huptimer(p, olp->netdev);
isdn_net_reset_huptimer(lp, olp);
skb->protocol = isdn_eth_type_trans(skb, skb->dev); skb->protocol = isdn_eth_type_trans(skb, skb->dev);
netif_rx(skb); netif_rx(skb);
} }
......
...@@ -58,10 +58,10 @@ extern void isdn_net_write_super(isdn_net_local *lp, struct sk_buff *skb); ...@@ -58,10 +58,10 @@ extern void isdn_net_write_super(isdn_net_local *lp, struct sk_buff *skb);
extern int isdn_net_online(isdn_net_dev *idev); extern int isdn_net_online(isdn_net_dev *idev);
static inline void static inline void
isdn_net_reset_huptimer(isdn_net_local *lp, isdn_net_local *olp) isdn_net_reset_huptimer(isdn_net_dev *idev, isdn_net_dev *idev2)
{ {
olp->huptimer = 0; idev->huptimer = 0;
lp->huptimer = 0; idev2->huptimer = 0;
} }
#define ISDN_NET_MAX_QUEUE_LENGTH 2 #define ISDN_NET_MAX_QUEUE_LENGTH 2
......
...@@ -495,7 +495,7 @@ isdn_ppp_ioctl(struct inode *ino, struct file *file, unsigned int cmd, unsigned ...@@ -495,7 +495,7 @@ isdn_ppp_ioctl(struct inode *ino, struct file *file, unsigned int cmd, unsigned
case PPPIOCGIDLE: /* get idle time information */ case PPPIOCGIDLE: /* get idle time information */
if (idev) { if (idev) {
struct ppp_idle pidle; struct ppp_idle pidle;
pidle.xmit_idle = pidle.recv_idle = idev->local.huptimer; pidle.xmit_idle = pidle.recv_idle = idev->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;
} }
...@@ -570,13 +570,13 @@ isdn_ppp_ioctl(struct inode *ino, struct file *file, unsigned int cmd, unsigned ...@@ -570,13 +570,13 @@ isdn_ppp_ioctl(struct inode *ino, struct file *file, unsigned int cmd, unsigned
strncpy(pci.local_num,idev->local.msn,63); strncpy(pci.local_num,idev->local.msn,63);
i = 0; i = 0;
list_for_each_entry(phone, &idev->local.phone[1], list) { list_for_each_entry(phone, &idev->local.phone[1], list) {
if (i++ == idev->local.dial) { if (i++ == idev->dial) {
strncpy(pci.remote_num,phone->num,63); strncpy(pci.remote_num,phone->num,63);
break; break;
} }
} }
pci.charge_units = idev->local.charge; pci.charge_units = idev->charge;
if(idev->local.outgoing) if(idev->outgoing)
pci.calltype = CALLTYPE_OUTGOING; pci.calltype = CALLTYPE_OUTGOING;
else else
pci.calltype = CALLTYPE_INCOMING; pci.calltype = CALLTYPE_INCOMING;
...@@ -798,7 +798,7 @@ isdn_ppp_write(struct file *file, const char *buf, size_t count, loff_t *off) ...@@ -798,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)
idev->local.huptimer = 0; idev->huptimer = 0;
if (idev->isdn_slot < 0) { if (idev->isdn_slot < 0) {
retval = 0; retval = 0;
...@@ -976,7 +976,7 @@ static void isdn_ppp_receive(isdn_net_dev *net_dev, isdn_net_local *lp, ...@@ -976,7 +976,7 @@ static void isdn_ppp_receive(isdn_net_dev *net_dev, isdn_net_local *lp,
* huptimer on LCP packets. * huptimer on LCP packets.
*/ */
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,lp->netdev);
slot = idev->ppp_slot; slot = idev->ppp_slot;
if (slot < 0 || slot > ISDN_MAX_CHANNELS) { if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
...@@ -1137,7 +1137,7 @@ isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff ...@@ -1137,7 +1137,7 @@ isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff
} }
/* Reset hangup-timer */ /* Reset hangup-timer */
lp->huptimer = 0; idev->huptimer = 0;
skb->dev = dev; skb->dev = dev;
skb->mac.raw = skb->data; skb->mac.raw = skb->data;
...@@ -1241,7 +1241,7 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev) ...@@ -1241,7 +1241,7 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev)
return 0; return 0;
} }
ipt = ippp_table[slot]; ipt = ippp_table[slot];
lp->huptimer = 0; idev->huptimer = 0;
/* /*
* after this line .. requeueing in the device queue is no longer allowed!!! * after this line .. requeueing in the device queue is no longer allowed!!!
...@@ -2037,7 +2037,7 @@ isdn_ppp_hangup_slave(char *name) ...@@ -2037,7 +2037,7 @@ isdn_ppp_hangup_slave(char *name)
if (!sdev) if (!sdev)
return 2; return 2;
isdn_net_hangup(mlp); isdn_net_hangup(mlp->netdev);
return 0; return 0;
#else #else
return -1; return -1;
......
...@@ -315,40 +315,20 @@ typedef struct isdn_net_local_s { ...@@ -315,40 +315,20 @@ typedef struct isdn_net_local_s {
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 */
int dialtimeout; /* How long shall we try on dialing */
int dialwait; /* wait after failed attempt */
int cbdelay; /* Delay before Callback starts */ int cbdelay; /* Delay before Callback starts */
char msn[ISDN_MSNLEN]; /* MSNs/EAZs for this interface */ char msn[ISDN_MSNLEN]; /* MSNs/EAZs for this interface */
u_char cbhup; /* Flag: Reject Call before Callback*/ u_char cbhup; /* Flag: Reject Call before Callback*/
int hupflags; /* Flags for charge-unit-hangup: */
int onhtime; /* Time to keep link up */
u_char p_encap; /* Packet encapsulation */ u_char p_encap; /* Packet encapsulation */
/* 0 = Ethernet over ISDN */
/* 1 = RAW-IP */
/* 2 = IP with type field */
u_char l2_proto; /* Layer-2-protocol */ u_char l2_proto; /* Layer-2-protocol */
/* See ISDN_PROTO_L2..-constants in */
/* isdnif.h */
/* 0 = X75/LAPB with I-Frames */
/* 1 = X75/LAPB with UI-Frames */
/* 2 = X75/LAPB with BUI-Frames */
/* 3 = HDLC */
u_char l3_proto; /* Layer-3-protocol */ u_char l3_proto; /* Layer-3-protocol */
/* See ISDN_PROTO_L3..-constants in */
/* isdnif.h */
/* 0 = Transparent */
int huptimer; /* Timeout-counter for auto-hangup */
int charge; /* Counter for charging units */
int charge_state; /* ChargeInfo state machine */
ulong chargetime; /* Timer for Charging info */
int hupflags; /* Flags for charge-unit-hangup: */
/* bit0: chargeint is invalid */
/* bit1: Getting charge-interval */
/* bit2: Do charge-unit-hangup */
/* bit3: Do hangup even on incoming */
int outgoing; /* Flag: outgoing call */
int onhtime; /* Time to keep link up */
int chargeint; /* Interval between charge-infos */
int onum; /* Flag: at least 1 outgoing number */
int cps; /* current speed of this interface */
int transcount; /* byte-counter for cps-calculation */
int last_jiffies; /* when transcount was reset */
int sqfull; /* Flag: netdev-queue overloaded */ int sqfull; /* Flag: netdev-queue overloaded */
ulong sqfull_stamp; /* Start-Time of overload */ ulong sqfull_stamp; /* Start-Time of overload */
ulong slavedelay; /* Dynamic bundling delaytime */ ulong slavedelay; /* Dynamic bundling delaytime */
...@@ -356,7 +336,6 @@ typedef struct isdn_net_local_s { ...@@ -356,7 +336,6 @@ typedef struct isdn_net_local_s {
struct list_head phone[2]; /* List of remote-phonenumbers */ struct list_head phone[2]; /* List of remote-phonenumbers */
/* phone[0] = Incoming Numbers */ /* phone[0] = Incoming Numbers */
/* phone[1] = Outgoing Numbers */ /* phone[1] = Outgoing Numbers */
int dial; /* # of phone number just dialed */
struct net_device *master; /* Ptr to Master device for slaves */ struct net_device *master; /* Ptr to Master device for slaves */
struct net_device *slave; /* Ptr to Slave device for masters */ struct net_device *slave; /* Ptr to Slave device for masters */
struct isdn_net_local_s *next; /* Ptr to next link in bundle */ struct isdn_net_local_s *next; /* Ptr to next link in bundle */
...@@ -371,11 +350,6 @@ typedef struct isdn_net_local_s { ...@@ -371,11 +350,6 @@ typedef struct isdn_net_local_s {
/* a particular channel (including */ /* a particular channel (including */
/* the frame_cnt */ /* the frame_cnt */
int dialtimeout; /* How long shall we try on dialing? (jiffies) */
int dialwait; /* How long shall we wait after failed attempt? (jiffies) */
ulong dialstarted; /* jiffies of first dialing-attempt */
ulong dialwait_timer; /* jiffies of earliest next dialing-attempt */
int huptimeout; /* How long will the connection be up? (seconds) */
#ifdef CONFIG_ISDN_X25 #ifdef CONFIG_ISDN_X25
struct concap_device_ops *dops; /* callbacks used by encapsulator */ struct concap_device_ops *dops; /* callbacks used by encapsulator */
#endif #endif
...@@ -404,7 +378,21 @@ typedef struct isdn_net_dev_s { ...@@ -404,7 +378,21 @@ typedef struct isdn_net_dev_s {
struct timer_list dial_timer; /* dial events timer */ struct timer_list dial_timer; /* dial events timer */
int dial_event; /* event in case of timer expiry */ int dial_event; /* event in case of timer expiry */
int dialstate; /* State for dialing */ int dialstate; /* State for dialing */
int dial; /* # of phone number just dialed */
int outgoing; /* Flag: outgoing call */
unsigned long dialstarted; /* first dialing-attempt */
unsigned long dialwait_timer;/* earliest next dialing-attempt */
int cps; /* current speed of this interface */
int transcount; /* byte-counter for cps-calculation */
int last_jiffies; /* when transcount was reset */
struct timer_list hup_timer; /* auto hangup timer */ struct timer_list hup_timer; /* auto hangup timer */
int huptimer; /* Timeout-counter for auto-hangup */
int charge; /* Counter for charging units */
int charge_state; /* ChargeInfo state machine */
unsigned long chargetime; /* Timer for Charging info */
int chargeint; /* Interval between charge-infos */
int pppbind; /* ippp device for bindings */ int pppbind; /* ippp device for bindings */
int ppp_slot; /* PPPD device slot number */ int ppp_slot; /* PPPD device slot number */
......
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