Commit a1dfdb3b authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: Alloc isdn_net_dev and struct net_device separately

This a big patch, which now mostly finishes the separation work
of isdn_net_dev, isdn_net_local and struct net_device.
The latter two are allocated per network-layer known network interface,
while isdn_net_dev is the entity which is accessed using isdnctrl,
i.e. a per-channel thing.

Since we allow for channel bundling, isdn_net_local, the priv data of
an ISDN network interface, gets a list of isdn_net_dev's which can be
used for transfering data on that interface.
parent 4b99dcc3
This diff is collapsed.
...@@ -508,7 +508,7 @@ isdn_status_callback(isdn_ctrl * c) ...@@ -508,7 +508,7 @@ isdn_status_callback(isdn_ctrl * c)
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->isdn_slot == i) { if (p->isdn_slot == i) {
strcpy(cmd.parm.setup.eazmsn, p->local.msn); strcpy(cmd.parm.setup.eazmsn, p->mlp->msn);
isdn_slot_command(i, ISDN_CMD_ACCEPTD, &cmd); isdn_slot_command(i, ISDN_CMD_ACCEPTD, &cmd);
retval = 1; retval = 1;
break; break;
......
...@@ -22,11 +22,11 @@ ...@@ -22,11 +22,11 @@
#undef ISDN_DEBUG_MODEM_DUMP #undef ISDN_DEBUG_MODEM_DUMP
#undef ISDN_DEBUG_MODEM_VOICE #undef ISDN_DEBUG_MODEM_VOICE
#undef ISDN_DEBUG_AT #undef ISDN_DEBUG_AT
#undef ISDN_DEBUG_NET_DUMP #define ISDN_DEBUG_NET_DUMP
#undef ISDN_DEBUG_NET_DIAL #define ISDN_DEBUG_NET_DIAL
#undef ISDN_DEBUG_NET_ICALL #define ISDN_DEBUG_NET_ICALL
#undef ISDN_DEBUG_STATCALLB #define ISDN_DEBUG_STATCALLB
#undef ISDN_DEBUG_COMMAND #define ISDN_DEBUG_COMMAND
#ifdef ISDN_DEBUG_NET_DIAL #ifdef ISDN_DEBUG_NET_DIAL
#define dbg_net_dial(arg...) printk(KERN_DEBUG arg) #define dbg_net_dial(arg...) printk(KERN_DEBUG arg)
......
This diff is collapsed.
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
extern void isdn_net_init_module(void); extern void isdn_net_init_module(void);
extern int isdn_net_new(char *, struct net_device *); extern int isdn_net_new(char *, isdn_net_local *);
extern int isdn_net_newslave(char *); extern int isdn_net_newslave(char *);
extern int isdn_net_rm(char *); extern int isdn_net_rm(char *);
extern int isdn_net_rmall(void); extern int isdn_net_rmall(void);
...@@ -57,13 +57,6 @@ extern void isdn_net_writebuf_skb(isdn_net_dev *, struct sk_buff *skb); ...@@ -57,13 +57,6 @@ extern void isdn_net_writebuf_skb(isdn_net_dev *, struct sk_buff *skb);
extern void isdn_net_write_super(isdn_net_dev *, struct sk_buff *skb); extern void isdn_net_write_super(isdn_net_dev *, struct sk_buff *skb);
extern int isdn_net_online(isdn_net_dev *); extern int isdn_net_online(isdn_net_dev *);
static inline void
isdn_net_reset_huptimer(isdn_net_local *lp, isdn_net_dev *idev)
{
lp->netdev->huptimer = 0;
idev->huptimer = 0;
}
#define ISDN_NET_MAX_QUEUE_LENGTH 2 #define ISDN_NET_MAX_QUEUE_LENGTH 2
/* /*
...@@ -125,14 +118,9 @@ isdn_net_add_to_bundle(isdn_net_local *mlp, isdn_net_dev *idev) ...@@ -125,14 +118,9 @@ isdn_net_add_to_bundle(isdn_net_local *mlp, isdn_net_dev *idev)
static inline void static inline void
isdn_net_rm_from_bundle(isdn_net_dev *idev) isdn_net_rm_from_bundle(isdn_net_dev *idev)
{ {
isdn_net_local *mlp; isdn_net_local *mlp = idev->mlp;
unsigned long flags; unsigned long flags;
if (idev->master)
mlp = idev->master;
else
mlp = &idev->local;
spin_lock_irqsave(&mlp->online_lock, flags); spin_lock_irqsave(&mlp->online_lock, flags);
list_del(&idev->online); list_del(&idev->online);
spin_unlock_irqrestore(&mlp->online_lock, flags); spin_unlock_irqrestore(&mlp->online_lock, flags);
...@@ -145,10 +133,7 @@ isdn_net_rm_from_bundle(isdn_net_dev *idev) ...@@ -145,10 +133,7 @@ isdn_net_rm_from_bundle(isdn_net_dev *idev)
static inline void static inline void
isdn_net_dev_wake_queue(isdn_net_dev *idev) isdn_net_dev_wake_queue(isdn_net_dev *idev)
{ {
if (idev->master) netif_wake_queue(&idev->mlp->dev);
netif_wake_queue(&idev->master->dev);
else
netif_wake_queue(&idev->local.dev);
} }
static inline int static inline int
......
This diff is collapsed.
...@@ -294,17 +294,17 @@ struct isdn_netif_ops { ...@@ -294,17 +294,17 @@ struct isdn_netif_ops {
unsigned short flags; /* interface flags (a la BSD) */ unsigned short flags; /* interface flags (a la BSD) */
unsigned short type; /* interface hardware type */ unsigned short type; /* interface hardware type */
unsigned char addr_len;/* hardware address length */ unsigned char addr_len;/* hardware address length */
void (*receive)(struct isdn_net_local_s *lp, void (*receive)(struct isdn_net_local_s *,
struct isdn_net_dev_s *idev, struct isdn_net_dev_s *,
struct sk_buff *skb); struct sk_buff *);
void (*connected)(struct isdn_net_local_s *lp); void (*connected)(struct isdn_net_dev_s *);
void (*disconnected)(struct isdn_net_local_s *lp); void (*disconnected)(struct isdn_net_dev_s *);
int (*bind)(struct isdn_net_local_s *lp); int (*bind)(struct isdn_net_dev_s *);
void (*unbind)(struct isdn_net_local_s *lp); void (*unbind)(struct isdn_net_dev_s *);
int (*init)(struct isdn_net_local_s *lp); int (*init)(struct isdn_net_local_s *);
void (*cleanup)(struct isdn_net_local_s *lp); void (*cleanup)(struct isdn_net_local_s *);
int (*open)(struct isdn_net_local_s *lp); int (*open)(struct isdn_net_local_s *);
void (*close)(struct isdn_net_local_s *lp); void (*close)(struct isdn_net_local_s *);
}; };
/* Local interface-data */ /* Local interface-data */
...@@ -313,7 +313,6 @@ typedef struct isdn_net_local_s { ...@@ -313,7 +313,6 @@ typedef struct isdn_net_local_s {
spinlock_t lock; spinlock_t lock;
struct net_device_stats stats; /* Ethernet Statistics */ struct net_device_stats stats; /* Ethernet Statistics */
int flags; /* Connection-flags */ int flags; /* Connection-flags */
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 dialtimeout; /* How long shall we try on dialing */
int dialwait; /* wait after failed attempt */ int dialwait; /* wait after failed attempt */
...@@ -334,8 +333,8 @@ typedef struct isdn_net_local_s { ...@@ -334,8 +333,8 @@ 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 */
struct isdn_net_dev_s *netdev; /* Ptr to netdev */
struct list_head slaves; /* list of all bundled channels */
struct list_head online; /* circular list of all bundled struct list_head online; /* circular list of all bundled
channels, which are currently channels, which are currently
online */ online */
...@@ -361,8 +360,6 @@ typedef struct isdn_net_local_s { ...@@ -361,8 +360,6 @@ 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;
int isdn_slot; /* Index to isdn device/channel */ int isdn_slot; /* Index to isdn device/channel */
int pre_device; /* Preselected isdn-device */ int pre_device; /* Preselected isdn-device */
int pre_channel; /* Preselected isdn-channel */ int pre_channel; /* Preselected isdn-channel */
...@@ -375,6 +372,7 @@ typedef struct isdn_net_dev_s { ...@@ -375,6 +372,7 @@ typedef struct isdn_net_dev_s {
int outgoing; /* Flag: outgoing call */ int outgoing; /* Flag: outgoing call */
unsigned long dialstarted; /* first dialing-attempt */ unsigned long dialstarted; /* first dialing-attempt */
unsigned long dialwait_timer;/* earliest next dialing-attempt */ unsigned long dialwait_timer;/* earliest next dialing-attempt */
int dialretry; /* Counter for Dialout-retries */
int cps; /* current speed of this interface */ int cps; /* current speed of this interface */
int transcount; /* byte-counter for cps-calculation */ int transcount; /* byte-counter for cps-calculation */
...@@ -401,9 +399,10 @@ typedef struct isdn_net_dev_s { ...@@ -401,9 +399,10 @@ typedef struct isdn_net_dev_s {
/* queued in HL driver */ /* queued in HL driver */
struct tasklet_struct tlet; struct tasklet_struct tlet;
isdn_net_local *master; /* Ptr to Master device for slaves */ isdn_net_local *mlp; /* Ptr to master device for all devs*/
struct isdn_net_dev_s *slave; /* Ptr to Slave device for masters */ struct isdn_net_dev_s *slave; /* Ptr to Slave device for masters */
struct list_head slaves; /* Members of local->slaves */
struct list_head online; /* Members of local->online */ struct list_head online; /* Members of local->online */
char name[10]; /* Name of device */ char name[10]; /* Name of 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