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)
p += put_u32(p, lp->cisco_yourseq);
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;
......@@ -174,6 +174,7 @@ isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data)
static void
isdn_net_ciscohdlck_slarp_send_request(isdn_net_local *lp)
{
isdn_net_dev *idev = lp->netdev;
struct sk_buff *skb;
unsigned char *p;
......@@ -194,7 +195,7 @@ isdn_net_ciscohdlck_slarp_send_request(isdn_net_local *lp)
p += put_u32(p, 0); // netmask
p += put_u16(p, 0); // unused
isdn_net_write_super(lp, skb);
isdn_net_write_super(idev, skb);
}
static void
......@@ -218,7 +219,7 @@ isdn_ciscohdlck_connected(isdn_net_local *lp)
lp->cisco_timer.expires = jiffies + lp->cisco_keepalive_period * HZ;
add_timer(&lp->cisco_timer);
}
isdn_net_device_wake_queue(lp);
isdn_net_dev_wake_queue(lp->netdev);
}
static void
......@@ -232,13 +233,14 @@ isdn_ciscohdlck_disconnected(isdn_net_local *lp)
static void
isdn_net_ciscohdlck_slarp_send_reply(isdn_net_local *lp)
{
isdn_net_dev *idev = lp->netdev;
struct sk_buff *skb;
unsigned char *p;
struct in_device *in_dev = NULL;
u32 addr = 0; /* local ipv4 address */
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 */
struct in_ifaddr *ifa = in_dev->ifa_list;
if (ifa != NULL) {
......@@ -265,7 +267,7 @@ isdn_net_ciscohdlck_slarp_send_reply(isdn_net_local *lp)
p += put_u32(p, mask); // netmask
p += put_u16(p, 0); // unused
isdn_net_write_super(lp, skb);
isdn_net_write_super(idev, skb);
}
static void
......@@ -335,10 +337,9 @@ isdn_net_ciscohdlck_slarp_in(isdn_net_local *lp, struct sk_buff *skb)
}
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)
{
isdn_net_local *lp = &idev->local;
unsigned char *p;
u8 addr;
u8 ctrl;
......@@ -371,7 +372,7 @@ isdn_ciscohdlck_receive(isdn_net_dev *idev, isdn_net_local *olp,
goto out_free;
default:
/* no special cisco protocol */
isdn_net_reset_huptimer(idev, olp->netdev);
isdn_net_reset_huptimer(lp, idev);
skb->protocol = htons(type);
netif_rx(skb);
return;
......
This diff is collapsed.
......@@ -52,16 +52,16 @@ extern int isdn_net_force_hangup(char *);
extern int isdn_net_force_dial(char *);
extern isdn_net_dev *isdn_net_findif(char *);
extern int isdn_net_rcv_skb(int, struct sk_buff *);
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_write_super(isdn_net_local *lp, struct sk_buff *skb);
extern int isdn_net_online(isdn_net_dev *idev);
extern int isdn_net_dial_req(isdn_net_dev *);
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 int isdn_net_online(isdn_net_dev *);
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;
idev2->huptimer = 0;
}
#define ISDN_NET_MAX_QUEUE_LENGTH 2
......@@ -69,9 +69,10 @@ isdn_net_reset_huptimer(isdn_net_dev *idev, isdn_net_dev *idev2)
/*
* 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;
else
return 1;
......@@ -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
* 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;
isdn_net_local *lp;
spin_lock_irqsave(&nd->queue_lock, flags);
lp = nd->queue; /* get lp on top of queue */
spin_lock_bh(&nd->queue->xmit_lock);
while (isdn_net_lp_busy(nd->queue)) {
spin_unlock_bh(&nd->queue->xmit_lock);
nd->queue = nd->queue->next;
if (nd->queue == lp) { /* not found -- should never happen */
lp = NULL;
isdn_net_dev *idev;
isdn_net_dev *head;
spin_lock_irqsave(&mlp->queue_lock, flags);
head = mlp->queue;
idev = head;
spin_lock_bh(&idev->xmit_lock);
while (isdn_net_dev_busy(idev)) {
spin_unlock_bh(&idev->xmit_lock);
mlp->queue = mlp->queue->next;
idev = mlp->queue;
if (idev == head) { /* not found -- should never happen */
idev = NULL;
goto errout;
}
spin_lock_bh(&nd->queue->xmit_lock);
spin_lock_bh(&idev->xmit_lock);
}
lp = nd->queue;
nd->queue = nd->queue->next;
idev = mlp->queue;
mlp->queue = mlp->queue->next;
errout:
spin_unlock_irqrestore(&nd->queue_lock, flags);
return lp;
spin_unlock_irqrestore(&mlp->queue_lock, flags);
return idev;
}
/*
* 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;
spin_lock_irqsave(&nd->queue_lock, flags);
spin_lock_irqsave(&mlp->queue_lock, flags);
lp = nd->queue;
nlp->last = lp->last;
lp->last->next = nlp;
lp->last = nlp;
nlp->next = lp;
nd->queue = nlp;
qdev = mlp->queue;
idev->last = qdev->last;
qdev->last->next = idev;
qdev->last = idev;
idev->next = qdev;
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
*/
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;
if (lp->master)
master_lp = (isdn_net_local *) lp->master->priv;
if (idev->master)
mlp = idev->master;
else
mlp = &idev->local;
spin_lock_irqsave(&master_lp->netdev->queue_lock, flags);
lp->last->next = lp->next;
lp->next->last = lp->last;
if (master_lp->netdev->queue == lp) {
master_lp->netdev->queue = lp->next;
if (lp->next == lp) { /* last in queue */
master_lp->netdev->queue = &master_lp->netdev->local;
}
spin_lock_irqsave(&mlp->queue_lock, flags);
idev->last->next = idev->next;
idev->next->last = idev->last;
if (mlp->queue == idev) {
mlp->queue = idev->next;
}
lp->next = lp->last = lp; /* (re)set own pointers */
spin_unlock_irqrestore(&master_lp->netdev->queue_lock, flags);
idev->next = idev->last = idev; /* (re)set own pointers */
spin_unlock_irqrestore(&mlp->queue_lock, flags);
}
/*
* wake up the network -> net_device queue.
* 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)
netif_wake_queue(lp->master);
if (idev->master)
netif_wake_queue(&idev->master->dev);
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;
}
......
This diff is collapsed.
......@@ -294,8 +294,8 @@ struct isdn_netif_ops {
unsigned short flags; /* interface flags (a la BSD) */
unsigned short type; /* interface hardware type */
unsigned char addr_len;/* hardware address length */
void (*receive)(struct isdn_net_dev_s *p,
struct isdn_net_local_s *olp,
void (*receive)(struct isdn_net_local_s *lp,
struct isdn_net_dev_s *idev,
struct sk_buff *skb);
void (*connected)(struct isdn_net_local_s *lp);
void (*disconnected)(struct isdn_net_local_s *lp);
......@@ -329,26 +329,17 @@ typedef struct isdn_net_local_s {
u_char l2_proto; /* Layer-2-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 */
int triggercps; /* BogoCPS needed for trigger slave */
struct list_head phone[2]; /* List of remote-phonenumbers */
/* phone[0] = Incoming 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 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 */
/* Ptr to orig. hard_header_cache */
spinlock_t xmit_lock; /* used to protect the xmit path of */
/* a particular channel (including */
/* the frame_cnt */
struct isdn_net_dev_s *queue; /* circular list of all bundled
channels, which are currently
online */
spinlock_t queue_lock; /* lock to protect queue */
#ifdef CONFIG_ISDN_X25
struct concap_device_ops *dops; /* callbacks used by encapsulator */
......@@ -361,9 +352,11 @@ typedef struct isdn_net_local_s {
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_debserint; /* debugging flag of cisco hdlc with slarp */
struct timer_list cisco_timer;
struct tq_struct tqueue;
struct isdn_netif_ops *ops;
struct timer_list cisco_timer;
struct isdn_netif_ops *ops;
struct net_device dev; /* interface to upper levels */
} isdn_net_local;
/* the interface itself */
......@@ -386,6 +379,8 @@ typedef struct isdn_net_dev_s {
int cps; /* current speed of this interface */
int transcount; /* byte-counter for cps-calculation */
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 */
int huptimer; /* Timeout-counter for auto-hangup */
......@@ -397,13 +392,24 @@ typedef struct isdn_net_dev_s {
int pppbind; /* ippp device for bindings */
int ppp_slot; /* PPPD device slot number */
isdn_net_local *queue; /* circular list of all bundled
channels, which are currently
online */
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 */
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 */
struct list_head global_list; /* global list of all isdn_net_devs */
struct net_device dev; /* interface to upper levels */
#ifdef CONFIG_ISDN_PPP
ippp_bundle * pb; /* pointer to the common bundle structure
* with the per-bundle data */
......
......@@ -159,14 +159,7 @@ typedef struct {
isdn_mppp_stats stats;
} ippp_bundle;
#define NUM_RCV_BUFFS 64
struct ippp_buf_queue {
struct ippp_buf_queue *next;
struct ippp_buf_queue *last;
char *buf; /* NULL here indicates end of queue */
int len;
};
#define IPPP_MAX_RQ_LEN 8
/* The data structure for one CCP reset transaction */
enum ippp_ccp_reset_states {
......@@ -201,9 +194,7 @@ struct ippp_ccp_reset {
struct ippp_struct {
struct ippp_struct *next_link;
int state;
struct ippp_buf_queue rq[NUM_RCV_BUFFS]; /* packet queue for isdn_ppp_read() */
struct ippp_buf_queue *first; /* pointer to (current) first packet */
struct ippp_buf_queue *last; /* pointer to (current) last used packet in queue */
struct sk_buff_head rq;
wait_queue_head_t wq;
struct task_struct *tk;
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