Commit 5fd62b58 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: More cleanup to isdn_net.c (X.25 / PPP)

Again, instead of having stuff cluttered all over isdn_net.c, put
it into the files where it belongs and get rid of the 
#ifdef CONFIG_ISDN_X25 / CONFIG_ISDN_PPP by using dummy stubs if
necessary.

Same thing for CONFIG_ISDN_PPP.
parent a46ecdfa
......@@ -142,3 +142,124 @@ int isdn_x25_setup_dev(isdn_net_dev *p)
return 0;
}
void isdn_x25_open(struct net_device *dev)
{
struct concap_device_ops * dops =
( (isdn_net_local *) dev->priv ) -> dops;
struct concap_proto * cprot =
( (isdn_net_local *) dev->priv ) -> netdev -> cprot;
unsigned long flags;
save_flags(flags);
cli(); /* Avoid glitch on writes to CMD regs */
if( cprot && cprot -> pops && dops )
cprot -> pops -> restart ( cprot, dev, dops );
restore_flags(flags);
}
void isdn_x25_close(struct net_device *dev)
{
struct concap_proto * cprot =
( (isdn_net_local *) dev->priv ) -> netdev -> cprot;
if( cprot && cprot -> pops ) cprot -> pops -> close( cprot );
}
void isdn_x25_connected(isdn_net_local *lp)
{
struct concap_proto *cprot = lp -> netdev -> cprot;
struct concap_proto_ops *pops = cprot ? cprot -> pops : 0;
/* try if there are generic concap receiver routines */
if( pops )
if( pops->connect_ind)
pops->connect_ind(cprot);
}
void isdn_x25_dhup(isdn_net_local *lp)
{
struct concap_proto *cprot = lp -> netdev -> cprot;
struct concap_proto_ops *pops = cprot ? cprot -> pops : 0;
/* If we are not connected then dialing had
failed. If there are generic encap protocol
receiver routines signal the closure of
the link */
if (!(lp->flags & ISDN_NET_CONNECTED)
&& pops && pops->disconn_ind)
pops -> disconn_ind(cprot);
}
void isdn_x25_bhup(isdn_net_local *lp)
{
struct concap_proto *cprot = lp -> netdev -> cprot;
struct concap_proto_ops *pops = cprot ? cprot -> pops : 0;
/* B-Channel-hangup */
/* try if there are generic encap protocol
receiver routines and signal the closure of
the link */
if( pops && pops -> disconn_ind )
pops -> disconn_ind(cprot);
}
void isdn_x25_hangup(isdn_net_local *lp)
{
struct concap_proto *cprot = lp -> netdev -> cprot;
struct concap_proto_ops *pops = cprot ? cprot -> pops : 0;
/* try if there are generic encap protocol
receiver routines and signal the closure of
the link */
if( pops && pops -> disconn_ind )
pops -> disconn_ind(cprot);
}
int isdn_x25_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
/* At this point hard_start_xmit() passes control to the encapsulation
protocol (if present).
For X.25 auto-dialing is completly bypassed because:
- It does not conform with the semantics of a reliable datalink
service as needed by X.25 PLP.
- I don't want that the interface starts dialing when the network layer
sends a message which requests to disconnect the lapb link (or if it
sends any other message not resulting in data transmission).
Instead, dialing will be initiated by the encapsulation protocol entity
when a dl_establish request is received from the upper layer.
*/
isdn_net_local *lp = (isdn_net_local *) dev->priv;
struct concap_proto * cprot = lp -> netdev -> cprot;
int ret = cprot -> pops -> encap_and_xmit ( cprot , skb);
if (ret)
netif_stop_queue(dev);
return ret;
}
void isdn_x25_receive(isdn_net_local *lp, struct sk_buff *skb)
{
struct concap_proto *cprot = lp -> netdev -> cprot;
/* try if there are generic sync_device receiver routines */
if(cprot)
if(cprot -> pops)
if( cprot -> pops -> data_ind) {
cprot -> pops -> data_ind(cprot,skb);
return;
}
printk(KERN_WARNING "%s: unknown encapsulation, dropping\n",
lp->name);
kfree_skb(skb);
}
void isdn_x25_realrm(isdn_net_dev *p)
{
if( p -> cprot && p -> cprot -> pops )
p -> cprot -> pops -> proto_del ( p -> cprot );
}
#endif /* CONFIG_ISDN_X25 */
......@@ -16,6 +16,14 @@ struct concap_proto *isdn_concap_new(int);
void isdn_x25_encap_changed(isdn_net_dev *p, isdn_net_ioctl_cfg *cfg);
int isdn_x25_setup_dev(isdn_net_dev *p);
void isdn_x25_open(struct net_device *dev);
void isdn_x25_close(struct net_device *dev);
void isdn_x25_connected(isdn_net_local *lp);
void isdn_x25_bhup(isdn_net_local *lp);
void isdn_x25_hangup(isdn_net_local *lp);
int isdn_x25_start_xmit(struct sk_buff *skb, struct net_device *dev);
void isdn_x25_receive(isdn_net_local *lp, struct sk_buff *skb);
void isdn_x25_realrm(isdn_net_dev *p);
#else
......@@ -31,5 +39,47 @@ isdn_x25_setup_dev(isdn_net_dev *p)
return -EINVAL;
}
static inline void
isdn_x25_open(struct net_device *dev)
{
}
static inline void
isdn_x25_close(struct net_device *dev)
{
}
static inline void
isdn_x25_connected(isdn_net_local *lp)
{
}
static inline void
isdn_x25_dhup(isdn_net_local *lp)
{
}
static inline void
isdn_x25_bhup(isdn_net_local *lp)
{
}
static inline void
isdn_x25_hangup(isdn_net_local *lp)
{
}
static inline void
isdn_x25_receive(isdn_net_local *lp, struct sk_buff *skb)
{
printk(KERN_WARNING "%s: unknown encapsulation, dropping\n",
lp->name);
kfree_skb(skb);
}
static inline void
isdn_x25_realrm(isdn_net_dev *p)
{
}
#endif
This diff is collapsed.
......@@ -99,7 +99,7 @@ isdn_ppp_frame_log(char *info, char *data, int len, int maxlen,int unit,int slot
* note: it can happen, that we hangup/free the master before the slaves
* in this case we bind another lp to the master device
*/
int
void
isdn_ppp_free(isdn_net_local * lp)
{
unsigned long flags;
......@@ -108,7 +108,7 @@ isdn_ppp_free(isdn_net_local * lp)
if (lp->ppp_slot < 0 || lp->ppp_slot > ISDN_MAX_CHANNELS) {
printk(KERN_ERR "%s: ppp_slot(%d) out of range\n",
__FUNCTION__ , lp->ppp_slot);
return 0;
return;
}
save_flags(flags);
......@@ -129,7 +129,7 @@ isdn_ppp_free(isdn_net_local * lp)
printk(KERN_ERR "%s: ppp_slot(%d) now invalid\n",
__FUNCTION__ , lp->ppp_slot);
restore_flags(flags);
return 0;
return;
}
is = ippp_table[lp->ppp_slot];
if ((is->state & IPPP_CONNECT))
......@@ -144,7 +144,7 @@ isdn_ppp_free(isdn_net_local * lp)
lp->ppp_slot = -1; /* is this OK ?? */
restore_flags(flags);
return 0;
return;
}
/*
......
......@@ -16,19 +16,17 @@ extern struct file_operations isdn_ppp_fops;
extern int isdn_ppp_init(void);
extern void isdn_ppp_cleanup(void);
extern int isdn_ppp_free(isdn_net_local *);
extern int isdn_ppp_bind(isdn_net_local *);
extern int isdn_ppp_xmit(struct sk_buff *, struct net_device *);
extern void isdn_ppp_receive(isdn_net_dev *, isdn_net_local *, struct sk_buff *);
extern int isdn_ppp_dial_slave(char *);
extern void isdn_ppp_wakeup_daemon(isdn_net_local *);
extern int isdn_ppp_register_compressor(struct isdn_ppp_compressor *ipc);
extern int isdn_ppp_unregister_compressor(struct isdn_ppp_compressor *ipc);
extern int isdn_ppp_hangup_slave(char *);
#ifdef CONFIG_ISDN_PPP
int isdn_ppp_setup_dev(isdn_net_dev *p);
void isdn_ppp_wakeup_daemon(isdn_net_local *);
int isdn_ppp_bind(isdn_net_local *);
void isdn_ppp_free(isdn_net_local *);
void isdn_ppp_receive(isdn_net_dev *, isdn_net_local *, struct sk_buff *);
int isdn_ppp_xmit(struct sk_buff *, struct net_device *);
#else
......@@ -39,6 +37,33 @@ isdn_ppp_setup_dev(isdn_net_dev *p)
return -EINVAL;
}
static inline void
isdn_ppp_wakeup_daemon(isdn_net_local *lp);
{
}
static inline int
isdn_ppp_bind(isdn_net_local *)
{
return 0;
}
static inline void
isdn_ppp_free(isdn_net_local *lp)
{
}
static inline void
isdn_ppp_receive(isdn_net_dev *, isdn_net_local *, struct sk_buff *)
{
}
static inline int
isdn_ppp_xmit(struct sk_buff *, struct net_device *);
{
return 0;
}
#endif
#define IPPP_OPEN 0x01
......
......@@ -138,8 +138,6 @@ struct isdn_ppp_compressor {
extern int isdn_ppp_register_compressor(struct isdn_ppp_compressor *);
extern int isdn_ppp_unregister_compressor(struct isdn_ppp_compressor *);
extern int isdn_ppp_dial_slave(char *);
extern int isdn_ppp_hangup_slave(char *);
typedef struct {
unsigned long seqerrs;
......
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