Commit 967ee5ae authored by Kai Germaschewski's avatar Kai Germaschewski

Merge tp1.ruhr-uni-bochum.de:/home/kai/kernel/v2.5/linux-2.5.isdn

into tp1.ruhr-uni-bochum.de:/home/kai/kernel/v2.5/linux-2.5.make
parents cc8f2609 cf2e99d6
...@@ -348,7 +348,7 @@ isdn_net_unbind_channel(isdn_net_local * lp) ...@@ -348,7 +348,7 @@ isdn_net_unbind_channel(isdn_net_local * lp)
} }
/* /*
* Perform auto-hangup and cps-calculation for net-interfaces. * Perform auto-hangup for net-interfaces.
* *
* auto-hangup: * auto-hangup:
* Increment idle-counter (this counter is reset on any incoming or * Increment idle-counter (this counter is reset on any incoming or
...@@ -357,65 +357,70 @@ isdn_net_unbind_channel(isdn_net_local * lp) ...@@ -357,65 +357,70 @@ isdn_net_unbind_channel(isdn_net_local * lp)
* charge-info. * charge-info.
*/ */
static void isdn_net_hup_timer(unsigned long data)
{
isdn_net_local *lp = (isdn_net_local *) data;
if (!(lp->flags & ISDN_NET_CONNECTED) || lp->dialstate != ST_ACTIVE) {
isdn_BUG();
return;
}
dbg_net_dial("%s: huptimer %d, onhtime %d, chargetime %ld, chargeint %d\n",
l->name, l->huptimer, l->onhtime, l->chargetime, l->chargeint);
if (!(lp->onhtime))
return;
if (lp->huptimer++ <= lp->onhtime)
goto mod_timer;
if (lp->hupflags & ISDN_MANCHARGE && lp->hupflags & ISDN_CHARGEHUP) {
while (time_after(jiffies, lp->chargetime + lp->chargeint))
lp->chargetime += lp->chargeint;
if (time_after(jiffies, lp->chargetime + lp->chargeint - 2 * HZ)) {
if (lp->outgoing || lp->hupflags & ISDN_INHUP) {
isdn_net_hangup(lp);
return;
}
}
} else if (lp->outgoing) {
if (lp->hupflags & ISDN_CHARGEHUP) {
if (lp->charge_state != ST_CHARGE_HAVE_CINT) {
dbg_net_dial("%s: did not get CINT\n", lp->name);
isdn_net_hangup(lp);
return;
} else if (time_after(jiffies, lp->chargetime + lp->chargeint)) {
dbg_net_dial("%s: chtime = %lu, chint = %d\n",
lp->name, lp->chargetime, lp->chargeint);
isdn_net_hangup(lp);
return;
}
}
} else if (lp->hupflags & ISDN_INHUP) {
isdn_net_hangup(lp);
return;
}
mod_timer:
mod_timer(&lp->hup_timer, lp->hup_timer.expires + HZ);
}
void void
isdn_net_autohup() isdn_net_autohup()
{ {
struct list_head *l; struct list_head *l;
int anymore;
anymore = 0;
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 *l = &p->local; isdn_net_local *l = &p->local;
if (!(l->flags & ISDN_NET_CONNECTED) || l->dialstate != ST_ACTIVE)
continue;
if(dev->global_flags & ISDN_GLOBAL_STOPPED || if(dev->global_flags & ISDN_GLOBAL_STOPPED ||
ISDN_NET_DIALMODE(*l) == ISDN_NET_DM_OFF) { ISDN_NET_DIALMODE(*l) == ISDN_NET_DM_OFF) {
isdn_net_hangup(&p->dev); isdn_net_hangup(l);
continue;
}
dbg_net_dial("%s: huptimer %d, onhtime %d, chargetime %ld, chargeint %d\n",
l->name, l->huptimer, l->onhtime, l->chargetime, l->chargeint);
if (!(l->onhtime))
continue;
if (l->huptimer++ <= l->onhtime) {
anymore = 1;
continue; continue;
} }
if (l->hupflags & ISDN_MANCHARGE && l->hupflags & ISDN_CHARGEHUP) {
while (time_after(jiffies, l->chargetime + l->chargeint))
l->chargetime += l->chargeint;
if (time_after(jiffies, l->chargetime + l->chargeint - 2 * HZ)) {
if (l->outgoing || l->hupflags & ISDN_INHUP) {
isdn_net_hangup(&p->dev);
continue;
}
}
} else if (l->outgoing) {
if (l->hupflags & ISDN_CHARGEHUP) {
if (l->charge_state != ST_CHARGE_HAVE_CINT) {
dbg_net_dial("%s: did not get CINT\n", l->name);
isdn_net_hangup(&p->dev);
continue;
} else if (time_after(jiffies, l->chargetime + l->chargeint)) {
dbg_net_dial("%s: chtime = %lu, chint = %d\n",
l->name, l->chargetime, l->chargeint);
isdn_net_hangup(&p->dev);
continue;
}
}
} else if (l->hupflags & ISDN_INHUP) {
isdn_net_hangup(&p->dev);
continue;
}
anymore = 1;
} }
isdn_timer_ctrl(ISDN_TIMER_NETHANGUP, anymore);
} }
static void isdn_net_lp_disconnected(isdn_net_local *lp) static void isdn_net_lp_disconnected(isdn_net_local *lp)
...@@ -430,7 +435,9 @@ static void isdn_net_connected(isdn_net_local *lp) ...@@ -430,7 +435,9 @@ static void isdn_net_connected(isdn_net_local *lp)
struct concap_proto_ops *pops = cprot ? cprot -> pops : 0; struct concap_proto_ops *pops = cprot ? cprot -> pops : 0;
#endif #endif
lp->dialstate = ST_ACTIVE; lp->dialstate = ST_ACTIVE;
isdn_timer_ctrl(ISDN_TIMER_NETHANGUP, 1); lp->hup_timer.expires = jiffies + HZ;
add_timer(&lp->hup_timer);
if (lp->p_encap == ISDN_NET_ENCAP_CISCOHDLCK) if (lp->p_encap == ISDN_NET_ENCAP_CISCOHDLCK)
isdn_net_ciscohdlck_connected(lp); isdn_net_ciscohdlck_connected(lp);
if (lp->p_encap != ISDN_NET_ENCAP_SYNCPPP) { if (lp->p_encap != ISDN_NET_ENCAP_SYNCPPP) {
...@@ -495,11 +502,6 @@ isdn_net_dial_timer(unsigned long data) ...@@ -495,11 +502,6 @@ isdn_net_dial_timer(unsigned long data)
{ {
isdn_net_local *lp = (isdn_net_local *) data; isdn_net_local *lp = (isdn_net_local *) data;
if (!lp) {
isdn_BUG();
return;
}
printk("%s: %s %#x\n", __FUNCTION__ , lp->name, lp->dial_event);
isdn_net_handle_event(lp, lp->dial_event, NULL); isdn_net_handle_event(lp, lp->dial_event, NULL);
} }
...@@ -519,7 +521,7 @@ init_dialout(isdn_net_local *lp) ...@@ -519,7 +521,7 @@ init_dialout(isdn_net_local *lp)
if (!lp->dial) { if (!lp->dial) {
printk(KERN_WARNING "%s: phone number deleted?\n", printk(KERN_WARNING "%s: phone number deleted?\n",
lp->name); lp->name);
isdn_net_hangup(&lp->netdev->dev); isdn_net_hangup(lp);
return 0; return 0;
} }
if (lp->dialtimeout > 0 && if (lp->dialtimeout > 0 &&
...@@ -548,7 +550,7 @@ do_dialout(isdn_net_local *lp) ...@@ -548,7 +550,7 @@ do_dialout(isdn_net_local *lp)
else else
s = "dial suppressed: dialmode `off'"; s = "dial suppressed: dialmode `off'";
isdn_net_unreachable(&lp->netdev->dev, 0, s); isdn_net_unreachable(&lp->netdev->dev, 0, s);
isdn_net_hangup(&lp->netdev->dev); isdn_net_hangup(lp);
return 0; return 0;
} }
...@@ -558,7 +560,7 @@ do_dialout(isdn_net_local *lp) ...@@ -558,7 +560,7 @@ do_dialout(isdn_net_local *lp)
restore_flags(flags); restore_flags(flags);
printk(KERN_WARNING "%s: phone number deleted?\n", printk(KERN_WARNING "%s: phone number deleted?\n",
lp->name); lp->name);
isdn_net_hangup(&lp->netdev->dev); isdn_net_hangup(lp);
return 0; return 0;
} }
if (!strncmp(lp->dial->num, "LEASED", strlen("LEASED"))) { if (!strncmp(lp->dial->num, "LEASED", strlen("LEASED"))) {
...@@ -581,7 +583,7 @@ do_dialout(isdn_net_local *lp) ...@@ -581,7 +583,7 @@ 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_unreachable(&lp->netdev->dev, 0, "dial: timed out"); isdn_net_unreachable(&lp->netdev->dev, 0, "dial: timed out");
isdn_net_hangup(&lp->netdev->dev); isdn_net_hangup(lp);
return 0; return 0;
} }
} }
...@@ -599,7 +601,7 @@ do_dialout(isdn_net_local *lp) ...@@ -599,7 +601,7 @@ do_dialout(isdn_net_local *lp)
lp->dialstarted = 0; lp->dialstarted = 0;
isdn_net_unreachable(&lp->netdev->dev, 0, "dial: tried all numbers dialmax times"); isdn_net_unreachable(&lp->netdev->dev, 0, "dial: tried all numbers dialmax times");
} }
isdn_net_hangup(&lp->netdev->dev); isdn_net_hangup(lp);
return 0; return 0;
} }
} }
...@@ -725,7 +727,7 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg) ...@@ -725,7 +727,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", lp->name); printk(KERN_INFO "%s: hangup waiting for callback ...\n", lp->name);
isdn_net_hangup(&lp->netdev->dev); isdn_net_hangup(lp);
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 */
...@@ -766,7 +768,7 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg) ...@@ -766,7 +768,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(&p->dev); isdn_net_hangup(lp);
return 1; return 1;
case ISDN_STAT_DCONN: case ISDN_STAT_DCONN:
del_timer(&lp->dial_timer); del_timer(&lp->dial_timer);
...@@ -787,7 +789,7 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg) ...@@ -787,7 +789,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(&p->dev); isdn_net_hangup(lp);
break; break;
case ISDN_STAT_BCONN: case ISDN_STAT_BCONN:
del_timer(&lp->dial_timer); del_timer(&lp->dial_timer);
...@@ -822,15 +824,15 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg) ...@@ -822,15 +824,15 @@ 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(struct net_device *d) isdn_net_hangup(isdn_net_local *lp)
{ {
isdn_net_local *lp = (isdn_net_local *) d->priv;
isdn_ctrl cmd; isdn_ctrl cmd;
#ifdef CONFIG_ISDN_X25 #ifdef CONFIG_ISDN_X25
struct concap_proto *cprot = lp -> netdev -> cprot; struct concap_proto *cprot = lp -> netdev -> cprot;
struct concap_proto_ops *pops = cprot ? cprot -> pops : 0; struct concap_proto_ops *pops = cprot ? cprot -> pops : 0;
#endif #endif
del_timer_sync(&lp->hup_timer);
if (lp->flags & ISDN_NET_CONNECTED) { if (lp->flags & ISDN_NET_CONNECTED) {
if (lp->slave != NULL) { if (lp->slave != NULL) {
isdn_net_local *slp = (isdn_net_local *)lp->slave->priv; isdn_net_local *slp = (isdn_net_local *)lp->slave->priv;
...@@ -838,7 +840,7 @@ isdn_net_hangup(struct net_device *d) ...@@ -838,7 +840,7 @@ isdn_net_hangup(struct net_device *d)
printk(KERN_INFO printk(KERN_INFO
"isdn_net: hang up slave %s before %s\n", "isdn_net: hang up slave %s before %s\n",
slp->name, lp->name); slp->name, lp->name);
isdn_net_hangup(lp->slave); isdn_net_hangup(slp);
} }
} }
printk(KERN_INFO "isdn_net: local hangup %s\n", lp->name); printk(KERN_INFO "isdn_net: local hangup %s\n", lp->name);
...@@ -1324,11 +1326,11 @@ isdn_net_close(struct net_device *dev) ...@@ -1324,11 +1326,11 @@ isdn_net_close(struct net_device *dev)
if( cprot && cprot -> pops ) if( cprot && cprot -> pops )
cprot -> pops -> close( cprot ); cprot -> pops -> close( cprot );
#endif #endif
isdn_net_hangup(p); isdn_net_hangup(p->priv);
p = (((isdn_net_local *) p->priv)->slave); p = (((isdn_net_local *) p->priv)->slave);
} }
} }
isdn_net_hangup(dev); isdn_net_hangup(dev->priv);
isdn_MOD_DEC_USE_COUNT(); isdn_MOD_DEC_USE_COUNT();
return 0; return 0;
} }
...@@ -2608,6 +2610,9 @@ isdn_net_new(char *name, struct net_device *master) ...@@ -2608,6 +2610,9 @@ isdn_net_new(char *name, struct net_device *master)
init_timer(&netdev->local.dial_timer); init_timer(&netdev->local.dial_timer);
netdev->local.dial_timer.data = (unsigned long) &netdev->local; netdev->local.dial_timer.data = (unsigned long) &netdev->local;
netdev->local.dial_timer.function = isdn_net_dial_timer; netdev->local.dial_timer.function = isdn_net_dial_timer;
init_timer(&netdev->local.hup_timer);
netdev->local.hup_timer.data = (unsigned long) &netdev->local;
netdev->local.hup_timer.function = isdn_net_hup_timer;
/* Put into to netdev-chain */ /* Put into to netdev-chain */
list_add(&netdev->global_list, &isdn_net_devs); list_add(&netdev->global_list, &isdn_net_devs);
...@@ -3089,10 +3094,10 @@ isdn_net_force_hangup(char *name) ...@@ -3089,10 +3094,10 @@ isdn_net_force_hangup(char *name)
q = p->local.slave; q = p->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(q); isdn_net_hangup(&p->local);
q = (((isdn_net_local *) q->priv)->slave); q = (((isdn_net_local *) q->priv)->slave);
} }
isdn_net_hangup(&p->dev); isdn_net_hangup(&p->local);
return 0; return 0;
} }
return -ENODEV; return -ENODEV;
......
...@@ -41,7 +41,7 @@ extern int isdn_net_getphones(isdn_net_ioctl_phone *, char *); ...@@ -41,7 +41,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(struct net_device *); extern void isdn_net_hangup(isdn_net_local *);
extern void isdn_net_autohup(void); extern void isdn_net_autohup(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 *);
......
...@@ -285,9 +285,10 @@ typedef struct { ...@@ -285,9 +285,10 @@ typedef struct {
typedef struct isdn_net_local_s { typedef struct isdn_net_local_s {
ulong magic; ulong magic;
char name[10]; /* Name of device */ char name[10]; /* Name of device */
struct timer_list dial_timer; /* dial timeout */ 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 */
struct net_device_stats stats; /* Ethernet Statistics */ struct net_device_stats stats; /* Ethernet Statistics */
struct timer_list hup_timer; /* auto hangup timer */
int isdn_slot; /* Index to isdn device/channel */ int isdn_slot; /* Index to isdn device/channel */
int ppp_slot; /* PPPD device slot number */ int ppp_slot; /* PPPD device slot number */
int pre_device; /* Preselected isdn-device */ int pre_device; /* Preselected isdn-device */
......
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