Commit ec0100d2 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: Move dial/channel related members to isdn_net_dev

Dialing happens per channel / isdn_net_dev, so the move the
corresponding members there.
parent 3814794a
...@@ -26,13 +26,14 @@ ...@@ -26,13 +26,14 @@
static struct sk_buff* static struct sk_buff*
isdn_net_ciscohdlck_alloc_skb(isdn_net_local *lp, int len) isdn_net_ciscohdlck_alloc_skb(isdn_net_local *lp, int len)
{ {
unsigned short hl = isdn_slot_hdrlen(lp->isdn_slot); isdn_net_dev *idev = lp->netdev;
unsigned short hl = isdn_slot_hdrlen(idev->isdn_slot);
struct sk_buff *skb; struct sk_buff *skb;
skb = alloc_skb(hl + len, GFP_ATOMIC); skb = alloc_skb(hl + len, GFP_ATOMIC);
if (!skb) { if (!skb) {
printk("isdn out of mem at %s:%d!\n", __FILE__, __LINE__); printk("isdn out of mem at %s:%d!\n", __FILE__, __LINE__);
return 0; return NULL;
} }
skb_reserve(skb, hl); skb_reserve(skb, hl);
return skb; return skb;
......
...@@ -507,7 +507,7 @@ isdn_status_callback(isdn_ctrl * c) ...@@ -507,7 +507,7 @@ isdn_status_callback(isdn_ctrl * c)
case 1: case 1:
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);
if (p->local.isdn_slot == i) { if (p->isdn_slot == i) {
strcpy(cmd.parm.setup.eazmsn, p->local.msn); strcpy(cmd.parm.setup.eazmsn, p->local.msn);
isdn_slot_command(i, ISDN_CMD_ACCEPTD, &cmd); isdn_slot_command(i, ISDN_CMD_ACCEPTD, &cmd);
retval = 1; retval = 1;
......
This diff is collapsed.
...@@ -55,6 +55,7 @@ extern int isdn_net_rcv_skb(int, struct sk_buff *); ...@@ -55,6 +55,7 @@ extern int isdn_net_rcv_skb(int, struct sk_buff *);
extern int isdn_net_dial_req(isdn_net_local *); extern int isdn_net_dial_req(isdn_net_local *);
extern void isdn_net_writebuf_skb(isdn_net_local *lp, struct sk_buff *skb); extern void isdn_net_writebuf_skb(isdn_net_local *lp, struct sk_buff *skb);
extern void isdn_net_write_super(isdn_net_local *lp, struct sk_buff *skb); extern void isdn_net_write_super(isdn_net_local *lp, struct sk_buff *skb);
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_local *lp, isdn_net_local *olp)
...@@ -159,9 +160,9 @@ static inline void isdn_net_device_wake_queue(isdn_net_local *lp) ...@@ -159,9 +160,9 @@ static inline void isdn_net_device_wake_queue(isdn_net_local *lp)
netif_wake_queue(&lp->netdev->dev); netif_wake_queue(&lp->netdev->dev);
} }
static inline int isdn_net_bound(isdn_net_local *lp) static inline int isdn_net_bound(isdn_net_dev *idev)
{ {
return lp->isdn_slot >= 0; return idev->isdn_slot >= 0;
} }
static inline int static inline int
......
...@@ -765,6 +765,7 @@ static ssize_t ...@@ -765,6 +765,7 @@ 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_local *lp;
isdn_net_dev *idev;
struct ippp_struct *is; struct ippp_struct *is;
int proto; int proto;
unsigned char protobuf[4]; unsigned char protobuf[4];
...@@ -789,6 +790,7 @@ isdn_ppp_write(struct file *file, const char *buf, size_t count, loff_t *off) ...@@ -789,6 +790,7 @@ isdn_ppp_write(struct file *file, const char *buf, size_t count, loff_t *off)
if (!lp) if (!lp)
printk(KERN_DEBUG "isdn_ppp_write: lp == NULL\n"); printk(KERN_DEBUG "isdn_ppp_write: lp == 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,13 +803,12 @@ isdn_ppp_write(struct file *file, const char *buf, size_t count, loff_t *off) ...@@ -801,13 +803,12 @@ isdn_ppp_write(struct file *file, const char *buf, size_t count, loff_t *off)
if (proto != PPP_LCP) if (proto != PPP_LCP)
lp->huptimer = 0; lp->huptimer = 0;
if (lp->isdn_slot < 0) { if (idev->isdn_slot < 0) {
retval = 0; retval = 0;
goto out; goto out;
} }
if ((dev->drv[isdn_slot_driver(lp->isdn_slot)]->flags & DRV_FLAG_RUNNING) && if ((dev->drv[isdn_slot_driver(idev->isdn_slot)]->flags & DRV_FLAG_RUNNING) &&
lp->dialstate == 0 && isdn_net_online(idev)) {
isdn_net_bound(lp)) {
unsigned short hl; unsigned short hl;
struct sk_buff *skb; struct sk_buff *skb;
/* /*
...@@ -815,7 +816,7 @@ isdn_ppp_write(struct file *file, const char *buf, size_t count, loff_t *off) ...@@ -815,7 +816,7 @@ isdn_ppp_write(struct file *file, const char *buf, size_t count, loff_t *off)
* sk_buff. old call to dev_alloc_skb only reserved * sk_buff. old call to dev_alloc_skb only reserved
* 16 bytes, now we are looking what the driver want * 16 bytes, now we are looking what the driver want
*/ */
hl = isdn_slot_hdrlen(lp->isdn_slot); hl = isdn_slot_hdrlen(idev->isdn_slot);
skb = alloc_skb(hl+count, GFP_ATOMIC); skb = alloc_skb(hl+count, GFP_ATOMIC);
if (!skb) { if (!skb) {
printk(KERN_WARNING "isdn_ppp_write: out of memory!\n"); printk(KERN_WARNING "isdn_ppp_write: out of memory!\n");
...@@ -1188,6 +1189,7 @@ int ...@@ -1188,6 +1189,7 @@ int
isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev) isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev)
{ {
isdn_net_local *lp,*mlp; isdn_net_local *lp,*mlp;
isdn_net_dev *idev;
isdn_net_dev *nd; isdn_net_dev *nd;
unsigned int proto = PPP_IP; /* 0x21 */ unsigned int proto = PPP_IP; /* 0x21 */
struct ippp_struct *ipt,*ipts; struct ippp_struct *ipt,*ipts;
...@@ -1231,7 +1233,7 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev) ...@@ -1231,7 +1233,7 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev)
return 1; return 1;
} }
/* we have our lp locked from now on */ /* we have our lp locked from now on */
idev = lp->netdev;
slot = lp->ppp_slot; slot = lp->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",
...@@ -1265,7 +1267,7 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev) ...@@ -1265,7 +1267,7 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev)
* sk_buff. old call to dev_alloc_skb only reserved * sk_buff. old call to dev_alloc_skb only reserved
* 16 bytes, now we are looking what the driver want. * 16 bytes, now we are looking what the driver want.
*/ */
hl = isdn_slot_hdrlen(lp->isdn_slot) + IPPP_MAX_HEADER;; hl = isdn_slot_hdrlen(idev->isdn_slot) + IPPP_MAX_HEADER;;
/* /*
* Note: hl might still be insufficient because the method * Note: hl might still be insufficient because the method
* above does not account for a possibible MPPP slave channel * above does not account for a possibible MPPP slave channel
...@@ -1972,20 +1974,22 @@ int ...@@ -1972,20 +1974,22 @@ int
isdn_ppp_dial_slave(char *name) isdn_ppp_dial_slave(char *name)
{ {
#ifdef CONFIG_ISDN_MPP #ifdef CONFIG_ISDN_MPP
isdn_net_dev *ndev; isdn_net_dev *idev;
isdn_net_local *lp; isdn_net_local *lp;
struct net_device *sdev; struct net_device *sdev;
if (!(ndev = isdn_net_findif(name))) idev = isdn_net_findif(name);
if (!idev)
return 1; return 1;
lp = &ndev->local;
if (!isdn_net_bound(lp)) lp = &idev->local;
if (!isdn_net_bound(idev))
return 5; return 5;
sdev = lp->slave; sdev = lp->slave;
while (sdev) { while (sdev) {
isdn_net_local *mlp = (isdn_net_local *) sdev->priv; isdn_net_local *mlp = (isdn_net_local *) sdev->priv;
if (!isdn_net_bound(mlp)) if (!isdn_net_bound(mlp->netdev))
break; break;
sdev = mlp->slave; sdev = mlp->slave;
} }
...@@ -2003,14 +2007,15 @@ int ...@@ -2003,14 +2007,15 @@ int
isdn_ppp_hangup_slave(char *name) isdn_ppp_hangup_slave(char *name)
{ {
#ifdef CONFIG_ISDN_MPP #ifdef CONFIG_ISDN_MPP
isdn_net_dev *ndev; isdn_net_dev *idev;
isdn_net_local *lp, *mlp = NULL; isdn_net_local *lp, *mlp = NULL;
struct net_device *sdev; struct net_device *sdev;
if (!(ndev = isdn_net_findif(name))) idev = isdn_net_findif(name);
if (!idev)
return 1; return 1;
lp = &ndev->local; lp = &idev->local;
if (!isdn_net_bound(lp)) if (!isdn_net_bound(idev))
return 5; return 5;
sdev = lp->slave; sdev = lp->slave;
...@@ -2020,9 +2025,9 @@ isdn_ppp_hangup_slave(char *name) ...@@ -2020,9 +2025,9 @@ isdn_ppp_hangup_slave(char *name)
if (mlp->slave) { /* find last connected link in chain */ if (mlp->slave) { /* find last connected link in chain */
isdn_net_local *nlp = (isdn_net_local *) mlp->slave->priv; isdn_net_local *nlp = (isdn_net_local *) mlp->slave->priv;
if (!isdn_net_bound(nlp)) if (!isdn_net_bound(nlp->netdev))
break; break;
} else if (isdn_net_bound(mlp)) } else if (isdn_net_bound(mlp->netdev))
break; break;
sdev = mlp->slave; sdev = mlp->slave;
...@@ -2094,9 +2099,10 @@ static void isdn_ppp_ccp_xmit_reset(struct ippp_struct *is, int proto, ...@@ -2094,9 +2099,10 @@ static void isdn_ppp_ccp_xmit_reset(struct ippp_struct *is, int proto,
int hl; int hl;
int cnt = 0; int cnt = 0;
isdn_net_local *lp = is->lp; isdn_net_local *lp = is->lp;
isdn_net_dev *idev = lp->netdev;
/* Alloc large enough skb */ /* Alloc large enough skb */
hl = isdn_slot_hdrlen(lp->isdn_slot); hl = isdn_slot_hdrlen(idev->isdn_slot);
skb = alloc_skb(len + hl + 16,GFP_ATOMIC); skb = alloc_skb(len + hl + 16,GFP_ATOMIC);
if(!skb) { if(!skb) {
printk(KERN_WARNING printk(KERN_WARNING
......
...@@ -309,24 +309,16 @@ struct isdn_netif_ops { ...@@ -309,24 +309,16 @@ struct isdn_netif_ops {
/* Local interface-data */ /* Local interface-data */
typedef struct isdn_net_local_s { typedef struct isdn_net_local_s {
spinlock_t lock;
ulong magic; ulong magic;
struct timer_list dial_timer; /* dial events timer */ spinlock_t lock;
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 ppp_slot; /* PPPD device slot number */ int ppp_slot; /* PPPD device slot number */
int pre_device; /* Preselected isdn-device */
int pre_channel; /* Preselected isdn-channel */
int exclusive; /* -1 if non excl./idx to excl chan */
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 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*/
u_char dialstate; /* State for dialing */
u_char p_encap; /* Packet encapsulation */ u_char p_encap; /* Packet encapsulation */
/* 0 = Ethernet over ISDN */ /* 0 = Ethernet over ISDN */
/* 1 = RAW-IP */ /* 1 = RAW-IP */
...@@ -404,8 +396,20 @@ typedef struct isdn_net_local_s { ...@@ -404,8 +396,20 @@ typedef struct isdn_net_local_s {
/* the interface itself */ /* the interface itself */
typedef struct isdn_net_dev_s { typedef struct isdn_net_dev_s {
isdn_net_local local; isdn_net_local local;
isdn_net_local *queue; /* circular list of all bundled
int isdn_slot; /* Index to isdn device/channel */
int pre_device; /* Preselected isdn-device */
int pre_channel; /* Preselected isdn-channel */
int exclusive; /* -1 if non excl./idx to excl chan */
struct timer_list dial_timer; /* dial events timer */
int dial_event; /* event in case of timer expiry */
int dialstate; /* State for dialing */
struct timer_list hup_timer; /* auto hangup timer */
isdn_net_local *queue; /* circular list of all bundled
channels, which are currently channels, which are currently
online */ online */
spinlock_t queue_lock; /* lock to protect queue */ spinlock_t queue_lock; /* lock to protect queue */
......
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