Commit 53fcb937 authored by Kai Germaschewski's avatar Kai Germaschewski

Merge zephyr:src/kernel/v2.5/linux-2.5.isdn

into tp1.ruhr-uni-bochum.de:/home/kai/kernel/v2.5/linux-2.5.isdn
parents f5076217 cd2d00c6
......@@ -264,8 +264,6 @@ isdn_timer_funct(ulong dummy)
if (tf & ISDN_TIMER_SLOW) {
if (++isdn_timer_cnt2 >= ISDN_TIMER_1SEC) {
isdn_timer_cnt2 = 0;
if (tf & ISDN_TIMER_NETHANGUP)
isdn_net_autohup();
if (++isdn_timer_cnt3 >= ISDN_TIMER_RINGING) {
isdn_timer_cnt3 = 0;
if (tf & ISDN_TIMER_MODEMRING)
......@@ -451,8 +449,6 @@ isdn_status_callback(isdn_ctrl * c)
case ISDN_STAT_BSENT:
if (i < 0)
return -1;
if (dev->global_flags & ISDN_GLOBAL_STOPPED)
return 0;
if (isdn_net_stat_callback(i, c))
return 0;
if (isdn_v110_stat_callback(&slot[i].iv110, c))
......@@ -482,15 +478,11 @@ isdn_status_callback(isdn_ctrl * c)
if (i < 0)
return -1;
dbg_statcallb("ICALL: %d (%d,%ld) %s\n", i, di, c->arg, c->parm.num);
if (dev->global_flags & ISDN_GLOBAL_STOPPED) {
cmd.driver = di;
cmd.arg = c->arg;
cmd.command = ISDN_CMD_HANGUP;
isdn_command(&cmd);
if (dev->global_flags & ISDN_GLOBAL_STOPPED)
return 0;
}
/* Try to find a network-interface which will accept incoming call */
r = ((c->command == ISDN_STAT_ICALLW) ? 0 : isdn_net_find_icall(di, c->arg, i, &c->parm.setup));
r = isdn_net_find_icall(di, c->arg, i, &c->parm.setup);
switch (r) {
case 0:
/* No network-device replies.
......@@ -550,8 +542,6 @@ isdn_status_callback(isdn_ctrl * c)
if (i < 0)
return -1;
dbg_statcallb("CINF: %d %s\n", i, c->parm.num);
if (dev->global_flags & ISDN_GLOBAL_STOPPED)
return 0;
if (strcmp(c->parm.num, "0"))
isdn_net_stat_callback(i, c);
isdn_tty_stat_callback(i, c);
......@@ -574,8 +564,6 @@ isdn_status_callback(isdn_ctrl * c)
if (i < 0)
return -1;
dbg_statcallb("DCONN: %d\n", i);
if (dev->global_flags & ISDN_GLOBAL_STOPPED)
return 0;
/* Find any net-device, waiting for D-channel setup */
if (isdn_net_stat_callback(i, c))
break;
......@@ -593,8 +581,6 @@ isdn_status_callback(isdn_ctrl * c)
if (i < 0)
return -1;
dbg_statcallb("DHUP: %d\n", i);
if (dev->global_flags & ISDN_GLOBAL_STOPPED)
return 0;
dev->drv[di]->online &= ~(1 << (c->arg));
isdn_info_update();
/* Signal hangup to network-devices */
......@@ -611,8 +597,6 @@ isdn_status_callback(isdn_ctrl * c)
return -1;
dbg_statcallb("BCONN: %ld\n", c->arg);
/* Signal B-channel-connect to network-devices */
if (dev->global_flags & ISDN_GLOBAL_STOPPED)
return 0;
dev->drv[di]->online |= (1 << (c->arg));
isdn_info_update();
if (isdn_net_stat_callback(i, c))
......@@ -625,8 +609,6 @@ isdn_status_callback(isdn_ctrl * c)
if (i < 0)
return -1;
dbg_statcallb("BHUP: %d\n", i);
if (dev->global_flags & ISDN_GLOBAL_STOPPED)
return 0;
dev->drv[di]->online &= ~(1 << (c->arg));
isdn_info_update();
#ifdef CONFIG_ISDN_X25
......@@ -642,8 +624,6 @@ isdn_status_callback(isdn_ctrl * c)
if (i < 0)
return -1;
dbg_statcallb("NODCH: %ld\n", c->arg);
if (dev->global_flags & ISDN_GLOBAL_STOPPED)
return 0;
if (isdn_net_stat_callback(i, c))
break;
if (isdn_tty_stat_callback(i, c))
......@@ -1397,12 +1377,12 @@ isdn_ctrl_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
printk(KERN_INFO "isdn: Verbose-Level is %d\n", dev->net_verbose);
return 0;
case IIOCSETGST:
if (arg)
if (arg) {
dev->global_flags |= ISDN_GLOBAL_STOPPED;
else
isdn_net_hangup_all();
} else {
dev->global_flags &= ~ISDN_GLOBAL_STOPPED;
printk(KERN_INFO "isdn: Global Mode %s\n",
(dev->global_flags & ISDN_GLOBAL_STOPPED) ? "stopped" : "running");
}
return 0;
case IIOCSETBRJ:
drvidx = -1;
......@@ -1619,8 +1599,9 @@ static struct file_operations isdn_ctrl_fops =
.release = isdn_ctrl_release,
};
/*
* file_operations for major 43, /dev/isdn*
* file_operations for major 45, /dev/isdn*
* stolen from drivers/char/misc.c
*/
......@@ -2119,14 +2100,20 @@ isdn_slot_map_eaz2msn(int sl, char *msn)
int
isdn_slot_command(int sl, int cmd, isdn_ctrl *ctrl)
{
ctrl->command = cmd;
ctrl->driver = isdn_slot_driver(sl);
switch (cmd) {
case ISDN_CMD_SETL2:
case ISDN_CMD_SETL3:
case ISDN_CMD_PROT_IO:
ctrl->arg &= ~0xff; ctrl->arg |= isdn_slot_channel(sl);
break;
case ISDN_CMD_DIAL:
if (dev->global_flags & ISDN_GLOBAL_STOPPED)
return -EBUSY;
/* fall through */
default:
ctrl->arg = isdn_slot_channel(sl);
break;
......
This diff is collapsed.
......@@ -41,8 +41,8 @@ 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_delphone(isdn_net_ioctl_phone *);
extern int isdn_net_find_icall(int, int, int, setup_parm *);
extern void isdn_net_hangup(struct net_device *);
extern void isdn_net_autohup(void);
extern void isdn_net_hangup(isdn_net_local *);
extern void isdn_net_hangup_all(void);
extern int isdn_net_force_hangup(char *);
extern int isdn_net_force_dial(char *);
extern isdn_net_dev *isdn_net_findif(char *);
......
......@@ -19,10 +19,6 @@
#include "isdn_ppp.h"
#include "isdn_net.h"
#ifndef PPP_IPX
#define PPP_IPX 0x002b
#endif
/* Prototypes */
static int isdn_ppp_fill_rq(unsigned char *buf, int len, int proto, int slot);
static int isdn_ppp_closewait(int slot);
......@@ -348,20 +344,13 @@ isdn_ppp_release(struct inode *ino, struct file *file)
printk(KERN_DEBUG "ippp: release, minor: %d %lx\n", minor, (long) is->lp);
if (is->lp) { /* a lp address says: this link is still up */
isdn_net_dev *p = is->lp->netdev;
if (!p) {
printk(KERN_ERR "%s: no lp->netdev\n", __FUNCTION__ );
unlock_kernel();
return 0;
}
is->state &= ~IPPP_CONNECT; /* -> effect: no call of wakeup */
/*
* isdn_net_hangup() calls isdn_ppp_free()
* 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()
*/
isdn_net_hangup(&p->dev);
is->state &= ~IPPP_CONNECT;
isdn_net_hangup(is->lp);
}
for (i = 0; i < NUM_RCV_BUFFS; i++) {
if (is->rq[i].buf) {
......@@ -424,8 +413,6 @@ get_arg(void *b, void *val, int len)
static int
set_arg(void *b, void *val,int len)
{
if(len <= 0)
len = sizeof(void *);
if (copy_to_user(b, (void *) val, len))
return -EFAULT;
return 0;
......@@ -571,13 +558,18 @@ isdn_ppp_ioctl(struct inode *ino, struct file *file, unsigned int cmd, unsigned
return isdn_ppp_set_compressor(is, &data);
case PPPIOCGCALLINFO:
{
struct isdn_net_phone *phone;
struct pppcallinfo pci;
int i;
memset((char *) &pci,0,sizeof(struct pppcallinfo));
if(lp)
{
if(lp) {
strncpy(pci.local_num,lp->msn,63);
if(lp->dial) {
strncpy(pci.remote_num,lp->dial->num,63);
i = 0;
list_for_each_entry(phone, &lp->phone[1], list) {
if (i++ == lp->dial) {
strncpy(pci.remote_num,phone->num,63);
break;
}
}
pci.charge_units = lp->charge;
if(lp->outgoing)
......@@ -2003,7 +1995,7 @@ isdn_ppp_hangup_slave(char *name)
{
#ifdef CONFIG_ISDN_MPP
isdn_net_dev *ndev;
isdn_net_local *lp;
isdn_net_local *lp, *mlp = NULL;
struct net_device *sdev;
if (!(ndev = isdn_net_findif(name)))
......@@ -2014,7 +2006,7 @@ isdn_ppp_hangup_slave(char *name)
sdev = lp->slave;
while (sdev) {
isdn_net_local *mlp = (isdn_net_local *) sdev->priv;
mlp = (isdn_net_local *) sdev->priv;
if (mlp->slave) { /* find last connected link in chain */
isdn_net_local *nlp = (isdn_net_local *) mlp->slave->priv;
......@@ -2029,7 +2021,7 @@ isdn_ppp_hangup_slave(char *name)
if (!sdev)
return 2;
isdn_net_hangup(sdev);
isdn_net_hangup(mlp);
return 0;
#else
return -1;
......
......@@ -245,12 +245,10 @@ typedef struct {
#define ISDN_TIMER_MODEMPLUS 2
#define ISDN_TIMER_MODEMRING 4
#define ISDN_TIMER_MODEMXMIT 8
#define ISDN_TIMER_NETHANGUP 32
#define ISDN_TIMER_CARRIER 256 /* Wait for Carrier */
#define ISDN_TIMER_FAST (ISDN_TIMER_MODEMREAD | ISDN_TIMER_MODEMPLUS | \
ISDN_TIMER_MODEMXMIT)
#define ISDN_TIMER_SLOW (ISDN_TIMER_MODEMRING | ISDN_TIMER_NETHANGUP | \
ISDN_TIMER_CARRIER)
#define ISDN_TIMER_SLOW (ISDN_TIMER_MODEMRING | ISDN_TIMER_CARRIER)
/* GLOBAL_FLAGS */
#define ISDN_GLOBAL_STOPPED 1
......@@ -267,10 +265,10 @@ typedef struct {
#define ISDN_NET_MAGIC 0x49344C02 /* for paranoia-checking */
/* Phone-list-element */
typedef struct {
void *next;
char num[ISDN_MSNLEN];
} isdn_net_phone;
struct isdn_net_phone {
struct list_head list;
char num[ISDN_MSNLEN];
};
/*
Principles when extending structures for generic encapsulation protocol
......@@ -283,11 +281,13 @@ typedef struct {
/* Local interface-data */
typedef struct isdn_net_local_s {
spinlock_t lock;
ulong magic;
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 */
struct net_device_stats stats; /* Ethernet Statistics */
struct timer_list hup_timer; /* auto hangup timer */
int isdn_slot; /* Index to isdn device/channel */
int ppp_slot; /* PPPD device slot number */
int pre_device; /* Preselected isdn-device */
......@@ -335,10 +335,10 @@ typedef struct isdn_net_local_s {
ulong sqfull_stamp; /* Start-Time of overload */
ulong slavedelay; /* Dynamic bundling delaytime */
int triggercps; /* BogoCPS needed for trigger slave */
isdn_net_phone *phone[2]; /* List of remote-phonenumbers */
struct list_head phone[2]; /* List of remote-phonenumbers */
/* phone[0] = Incoming Numbers */
/* phone[1] = Outgoing Numbers */
isdn_net_phone *dial; /* Pointer to dialed number */
int dial; /* # of phone number just dialed */
struct net_device *master; /* Ptr to Master device for slaves */
struct net_device *slave; /* Ptr to Slave device for masters */
struct isdn_net_local_s *next; /* Ptr to next link in bundle */
......
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