Commit b2b109e8 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 2b9fa51a 0066476b
...@@ -164,7 +164,7 @@ isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data) ...@@ -164,7 +164,7 @@ isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data)
p += put_u32(p, lp->cisco_yourseq); p += put_u32(p, lp->cisco_yourseq);
p += put_u16(p, 0xffff); // reliablity, always 0xffff p += put_u16(p, 0xffff); // reliablity, always 0xffff
isdn_net_write_super(lp, skb); isdn_net_write_super(idev, skb);
lp->cisco_timer.expires = jiffies + lp->cisco_keepalive_period * HZ; lp->cisco_timer.expires = jiffies + lp->cisco_keepalive_period * HZ;
...@@ -174,6 +174,7 @@ isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data) ...@@ -174,6 +174,7 @@ isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data)
static void static void
isdn_net_ciscohdlck_slarp_send_request(isdn_net_local *lp) isdn_net_ciscohdlck_slarp_send_request(isdn_net_local *lp)
{ {
isdn_net_dev *idev = lp->netdev;
struct sk_buff *skb; struct sk_buff *skb;
unsigned char *p; unsigned char *p;
...@@ -194,7 +195,7 @@ isdn_net_ciscohdlck_slarp_send_request(isdn_net_local *lp) ...@@ -194,7 +195,7 @@ isdn_net_ciscohdlck_slarp_send_request(isdn_net_local *lp)
p += put_u32(p, 0); // netmask p += put_u32(p, 0); // netmask
p += put_u16(p, 0); // unused p += put_u16(p, 0); // unused
isdn_net_write_super(lp, skb); isdn_net_write_super(idev, skb);
} }
static void static void
...@@ -218,7 +219,7 @@ isdn_ciscohdlck_connected(isdn_net_local *lp) ...@@ -218,7 +219,7 @@ isdn_ciscohdlck_connected(isdn_net_local *lp)
lp->cisco_timer.expires = jiffies + lp->cisco_keepalive_period * HZ; lp->cisco_timer.expires = jiffies + lp->cisco_keepalive_period * HZ;
add_timer(&lp->cisco_timer); add_timer(&lp->cisco_timer);
} }
isdn_net_device_wake_queue(lp); isdn_net_dev_wake_queue(lp->netdev);
} }
static void static void
...@@ -232,13 +233,14 @@ isdn_ciscohdlck_disconnected(isdn_net_local *lp) ...@@ -232,13 +233,14 @@ isdn_ciscohdlck_disconnected(isdn_net_local *lp)
static void static void
isdn_net_ciscohdlck_slarp_send_reply(isdn_net_local *lp) isdn_net_ciscohdlck_slarp_send_reply(isdn_net_local *lp)
{ {
isdn_net_dev *idev = lp->netdev;
struct sk_buff *skb; struct sk_buff *skb;
unsigned char *p; unsigned char *p;
struct in_device *in_dev = NULL; struct in_device *in_dev = NULL;
u32 addr = 0; /* local ipv4 address */ u32 addr = 0; /* local ipv4 address */
u32 mask = 0; /* local netmask */ u32 mask = 0; /* local netmask */
if ((in_dev = lp->netdev->dev.ip_ptr) != NULL) { if ((in_dev = lp->dev.ip_ptr) != NULL) {
/* take primary(first) address of interface */ /* take primary(first) address of interface */
struct in_ifaddr *ifa = in_dev->ifa_list; struct in_ifaddr *ifa = in_dev->ifa_list;
if (ifa != NULL) { if (ifa != NULL) {
...@@ -265,7 +267,7 @@ isdn_net_ciscohdlck_slarp_send_reply(isdn_net_local *lp) ...@@ -265,7 +267,7 @@ isdn_net_ciscohdlck_slarp_send_reply(isdn_net_local *lp)
p += put_u32(p, mask); // netmask p += put_u32(p, mask); // netmask
p += put_u16(p, 0); // unused p += put_u16(p, 0); // unused
isdn_net_write_super(lp, skb); isdn_net_write_super(idev, skb);
} }
static void static void
...@@ -335,10 +337,9 @@ isdn_net_ciscohdlck_slarp_in(isdn_net_local *lp, struct sk_buff *skb) ...@@ -335,10 +337,9 @@ isdn_net_ciscohdlck_slarp_in(isdn_net_local *lp, struct sk_buff *skb)
} }
static void static void
isdn_ciscohdlck_receive(isdn_net_dev *idev, isdn_net_local *olp, isdn_ciscohdlck_receive(isdn_net_local *lp, isdn_net_dev *idev,
struct sk_buff *skb) struct sk_buff *skb)
{ {
isdn_net_local *lp = &idev->local;
unsigned char *p; unsigned char *p;
u8 addr; u8 addr;
u8 ctrl; u8 ctrl;
...@@ -371,7 +372,7 @@ isdn_ciscohdlck_receive(isdn_net_dev *idev, isdn_net_local *olp, ...@@ -371,7 +372,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(idev, olp->netdev); isdn_net_reset_huptimer(lp, idev);
skb->protocol = htons(type); skb->protocol = htons(type);
netif_rx(skb); netif_rx(skb);
return; return;
......
This diff is collapsed.
...@@ -52,16 +52,16 @@ extern int isdn_net_force_hangup(char *); ...@@ -52,16 +52,16 @@ extern int isdn_net_force_hangup(char *);
extern int isdn_net_force_dial(char *); extern int isdn_net_force_dial(char *);
extern isdn_net_dev *isdn_net_findif(char *); extern isdn_net_dev *isdn_net_findif(char *);
extern int isdn_net_rcv_skb(int, struct sk_buff *); 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_dev *);
extern void isdn_net_writebuf_skb(isdn_net_local *lp, struct sk_buff *skb); extern void isdn_net_writebuf_skb(isdn_net_dev *, 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_dev *, struct sk_buff *skb);
extern int isdn_net_online(isdn_net_dev *idev); extern int isdn_net_online(isdn_net_dev *);
static inline void static inline void
isdn_net_reset_huptimer(isdn_net_dev *idev, isdn_net_dev *idev2) isdn_net_reset_huptimer(isdn_net_local *lp, isdn_net_dev *idev)
{ {
lp->netdev->huptimer = 0;
idev->huptimer = 0; idev->huptimer = 0;
idev2->huptimer = 0;
} }
#define ISDN_NET_MAX_QUEUE_LENGTH 2 #define ISDN_NET_MAX_QUEUE_LENGTH 2
...@@ -69,9 +69,10 @@ isdn_net_reset_huptimer(isdn_net_dev *idev, isdn_net_dev *idev2) ...@@ -69,9 +69,10 @@ isdn_net_reset_huptimer(isdn_net_dev *idev, isdn_net_dev *idev2)
/* /*
* is this particular channel busy? * is this particular channel busy?
*/ */
static __inline__ int isdn_net_lp_busy(isdn_net_local *lp) static inline int
isdn_net_dev_busy(isdn_net_dev *idev)
{ {
if (atomic_read(&lp->frame_cnt) < ISDN_NET_MAX_QUEUE_LENGTH) if (atomic_read(&idev->frame_cnt) < ISDN_NET_MAX_QUEUE_LENGTH)
return 0; return 0;
else else
return 1; return 1;
...@@ -81,86 +82,93 @@ static __inline__ int isdn_net_lp_busy(isdn_net_local *lp) ...@@ -81,86 +82,93 @@ static __inline__ int isdn_net_lp_busy(isdn_net_local *lp)
* For the given net device, this will get a non-busy channel out of the * For the given net device, this will get a non-busy channel out of the
* corresponding bundle. The returned channel is locked. * corresponding bundle. The returned channel is locked.
*/ */
static __inline__ isdn_net_local * isdn_net_get_locked_lp(isdn_net_dev *nd) static inline isdn_net_dev *
isdn_net_get_locked_dev(isdn_net_local *mlp)
{ {
unsigned long flags; unsigned long flags;
isdn_net_local *lp; isdn_net_dev *idev;
isdn_net_dev *head;
spin_lock_irqsave(&nd->queue_lock, flags);
lp = nd->queue; /* get lp on top of queue */ spin_lock_irqsave(&mlp->queue_lock, flags);
spin_lock_bh(&nd->queue->xmit_lock); head = mlp->queue;
while (isdn_net_lp_busy(nd->queue)) { idev = head;
spin_unlock_bh(&nd->queue->xmit_lock); spin_lock_bh(&idev->xmit_lock);
nd->queue = nd->queue->next; while (isdn_net_dev_busy(idev)) {
if (nd->queue == lp) { /* not found -- should never happen */ spin_unlock_bh(&idev->xmit_lock);
lp = NULL; mlp->queue = mlp->queue->next;
idev = mlp->queue;
if (idev == head) { /* not found -- should never happen */
idev = NULL;
goto errout; goto errout;
} }
spin_lock_bh(&nd->queue->xmit_lock); spin_lock_bh(&idev->xmit_lock);
} }
lp = nd->queue; idev = mlp->queue;
nd->queue = nd->queue->next; mlp->queue = mlp->queue->next;
errout: errout:
spin_unlock_irqrestore(&nd->queue_lock, flags); spin_unlock_irqrestore(&mlp->queue_lock, flags);
return lp; return idev;
} }
/* /*
* add a channel to a bundle * add a channel to a bundle
*/ */
static __inline__ void isdn_net_add_to_bundle(isdn_net_dev *nd, isdn_net_local *nlp) static inline void
isdn_net_add_to_bundle(isdn_net_local *mlp, isdn_net_dev *idev)
{ {
isdn_net_local *lp; isdn_net_dev *qdev;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&nd->queue_lock, flags); spin_lock_irqsave(&mlp->queue_lock, flags);
lp = nd->queue; qdev = mlp->queue;
nlp->last = lp->last; idev->last = qdev->last;
lp->last->next = nlp; qdev->last->next = idev;
lp->last = nlp; qdev->last = idev;
nlp->next = lp; idev->next = qdev;
nd->queue = nlp; mlp->queue = idev;
spin_unlock_irqrestore(&nd->queue_lock, flags); spin_unlock_irqrestore(&mlp->queue_lock, flags);
} }
/* /*
* remove a channel from the bundle it belongs to * remove a channel from the bundle it belongs to
*/ */
static __inline__ void isdn_net_rm_from_bundle(isdn_net_local *lp) static inline void
isdn_net_rm_from_bundle(isdn_net_dev *idev)
{ {
isdn_net_local *master_lp = lp; isdn_net_local *mlp;
unsigned long flags; unsigned long flags;
if (lp->master) if (idev->master)
master_lp = (isdn_net_local *) lp->master->priv; mlp = idev->master;
else
mlp = &idev->local;
spin_lock_irqsave(&master_lp->netdev->queue_lock, flags); spin_lock_irqsave(&mlp->queue_lock, flags);
lp->last->next = lp->next; idev->last->next = idev->next;
lp->next->last = lp->last; idev->next->last = idev->last;
if (master_lp->netdev->queue == lp) { if (mlp->queue == idev) {
master_lp->netdev->queue = lp->next; mlp->queue = idev->next;
if (lp->next == lp) { /* last in queue */
master_lp->netdev->queue = &master_lp->netdev->local;
}
} }
lp->next = lp->last = lp; /* (re)set own pointers */ idev->next = idev->last = idev; /* (re)set own pointers */
spin_unlock_irqrestore(&master_lp->netdev->queue_lock, flags); spin_unlock_irqrestore(&mlp->queue_lock, flags);
} }
/* /*
* wake up the network -> net_device queue. * wake up the network -> net_device queue.
* For slaves, wake the corresponding master interface. * For slaves, wake the corresponding master interface.
*/ */
static inline void isdn_net_device_wake_queue(isdn_net_local *lp) static inline void
isdn_net_dev_wake_queue(isdn_net_dev *idev)
{ {
if (lp->master) if (idev->master)
netif_wake_queue(lp->master); netif_wake_queue(&idev->master->dev);
else else
netif_wake_queue(&lp->netdev->dev); netif_wake_queue(&idev->local.dev);
} }
static inline int isdn_net_bound(isdn_net_dev *idev) static inline int
isdn_net_bound(isdn_net_dev *idev)
{ {
return idev->isdn_slot >= 0; return idev->isdn_slot >= 0;
} }
......
This diff is collapsed.
...@@ -294,8 +294,8 @@ struct isdn_netif_ops { ...@@ -294,8 +294,8 @@ 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_dev_s *p, void (*receive)(struct isdn_net_local_s *lp,
struct isdn_net_local_s *olp, struct isdn_net_dev_s *idev,
struct sk_buff *skb); struct sk_buff *skb);
void (*connected)(struct isdn_net_local_s *lp); void (*connected)(struct isdn_net_local_s *lp);
void (*disconnected)(struct isdn_net_local_s *lp); void (*disconnected)(struct isdn_net_local_s *lp);
...@@ -329,26 +329,17 @@ typedef struct isdn_net_local_s { ...@@ -329,26 +329,17 @@ typedef struct isdn_net_local_s {
u_char l2_proto; /* Layer-2-protocol */ u_char l2_proto; /* Layer-2-protocol */
u_char l3_proto; /* Layer-3-protocol */ u_char l3_proto; /* Layer-3-protocol */
int sqfull; /* Flag: netdev-queue overloaded */
ulong sqfull_stamp; /* Start-Time of overload */
ulong slavedelay; /* Dynamic bundling delaytime */ ulong slavedelay; /* Dynamic bundling delaytime */
int triggercps; /* BogoCPS needed for trigger slave */ int triggercps; /* BogoCPS needed for trigger slave */
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 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 */
struct isdn_net_local_s *last; /* Ptr to last link in bundle */
struct isdn_net_dev_s *netdev; /* Ptr to netdev */ struct isdn_net_dev_s *netdev; /* Ptr to netdev */
struct sk_buff_head super_tx_queue; /* List of supervisory frames to */
/* be transmitted asap */ struct isdn_net_dev_s *queue; /* circular list of all bundled
atomic_t frame_cnt; /* number of frames currently */ channels, which are currently
/* queued in HL driver */ online */
/* Ptr to orig. hard_header_cache */ spinlock_t queue_lock; /* lock to protect queue */
spinlock_t xmit_lock; /* used to protect the xmit path of */
/* a particular channel (including */
/* the frame_cnt */
#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 */
...@@ -361,9 +352,11 @@ typedef struct isdn_net_local_s { ...@@ -361,9 +352,11 @@ typedef struct isdn_net_local_s {
ulong cisco_last_slarp_in; /* jiffie of last keepalive packet we received */ ulong cisco_last_slarp_in; /* jiffie of last keepalive packet we received */
char cisco_line_state; /* state of line according to keepalive packets */ char cisco_line_state; /* state of line according to keepalive packets */
char cisco_debserint; /* debugging flag of cisco hdlc with slarp */ char cisco_debserint; /* debugging flag of cisco hdlc with slarp */
struct timer_list cisco_timer; struct timer_list cisco_timer;
struct tq_struct tqueue;
struct isdn_netif_ops *ops; struct isdn_netif_ops *ops;
struct net_device dev; /* interface to upper levels */
} isdn_net_local; } isdn_net_local;
/* the interface itself */ /* the interface itself */
...@@ -386,6 +379,8 @@ typedef struct isdn_net_dev_s { ...@@ -386,6 +379,8 @@ typedef struct isdn_net_dev_s {
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 */
int last_jiffies; /* when transcount was reset */ int last_jiffies; /* when transcount was reset */
int sqfull; /* Flag: netdev-queue overloaded */
ulong sqfull_stamp; /* Start-Time of overload */
struct timer_list hup_timer; /* auto hangup timer */ struct timer_list hup_timer; /* auto hangup timer */
int huptimer; /* Timeout-counter for auto-hangup */ int huptimer; /* Timeout-counter for auto-hangup */
...@@ -397,13 +392,24 @@ typedef struct isdn_net_dev_s { ...@@ -397,13 +392,24 @@ typedef struct isdn_net_dev_s {
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 */
isdn_net_local *queue; /* circular list of all bundled spinlock_t xmit_lock; /* used to protect the xmit path of */
channels, which are currently /* a particular channel (including */
online */ /* the frame_cnt */
spinlock_t queue_lock; /* lock to protect queue */ struct sk_buff_head super_tx_queue; /* List of supervisory frames to */
/* be transmitted asap */
atomic_t frame_cnt; /* number of frames currently */
/* queued in HL driver */
struct tq_struct tqueue;
isdn_net_local *master; /* Ptr to Master device for slaves */
struct isdn_net_dev_s *slave; /* Ptr to Slave device for masters */
struct isdn_net_dev_s *next; /* Ptr to next link in bundle */
struct isdn_net_dev_s *last; /* Ptr to last link in bundle */
char name[10]; /* Name of device */ char name[10]; /* Name of device */
struct list_head global_list; /* global list of all isdn_net_devs */ struct list_head global_list; /* global list of all isdn_net_devs */
struct net_device dev; /* interface to upper levels */
#ifdef CONFIG_ISDN_PPP #ifdef CONFIG_ISDN_PPP
ippp_bundle * pb; /* pointer to the common bundle structure ippp_bundle * pb; /* pointer to the common bundle structure
* with the per-bundle data */ * with the per-bundle data */
......
...@@ -159,14 +159,7 @@ typedef struct { ...@@ -159,14 +159,7 @@ typedef struct {
isdn_mppp_stats stats; isdn_mppp_stats stats;
} ippp_bundle; } ippp_bundle;
#define NUM_RCV_BUFFS 64 #define IPPP_MAX_RQ_LEN 8
struct ippp_buf_queue {
struct ippp_buf_queue *next;
struct ippp_buf_queue *last;
char *buf; /* NULL here indicates end of queue */
int len;
};
/* The data structure for one CCP reset transaction */ /* The data structure for one CCP reset transaction */
enum ippp_ccp_reset_states { enum ippp_ccp_reset_states {
...@@ -201,9 +194,7 @@ struct ippp_ccp_reset { ...@@ -201,9 +194,7 @@ struct ippp_ccp_reset {
struct ippp_struct { struct ippp_struct {
struct ippp_struct *next_link; struct ippp_struct *next_link;
int state; int state;
struct ippp_buf_queue rq[NUM_RCV_BUFFS]; /* packet queue for isdn_ppp_read() */ struct sk_buff_head rq;
struct ippp_buf_queue *first; /* pointer to (current) first packet */
struct ippp_buf_queue *last; /* pointer to (current) last used packet in queue */
wait_queue_head_t wq; wait_queue_head_t wq;
struct task_struct *tk; struct task_struct *tk;
unsigned int mpppcfg; unsigned int mpppcfg;
......
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