Commit 851785c4 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: Convert ISDN/PPP to inl_priv / ind_priv

Interface type specific stuff is now gone from isdn_net_lib and
taken care of in the individual interface type modules.
parent d26d04dc
...@@ -83,20 +83,15 @@ struct isdn_net_phone { ...@@ -83,20 +83,15 @@ struct isdn_net_phone {
char num[ISDN_MSNLEN]; char num[ISDN_MSNLEN];
}; };
/*
Principles when extending structures for generic encapsulation protocol
("concap") support:
- Stuff which is hardware specific (here i4l-specific) goes in
the netdev -> local structure (here: isdn_net_local)
- Stuff which is encapsulation protocol specific goes in the structure
which holds the linux device structure (here: isdn_net_device)
*/
/* per network interface data (dev->priv) */ /* per network interface data (dev->priv) */
struct isdn_net_local_s { struct isdn_net_local_s {
ulong magic; ulong magic;
struct net_device dev; /* interface to upper levels */
struct net_device_stats stats; /* Ethernet Statistics */ struct net_device_stats stats; /* Ethernet Statistics */
struct isdn_netif_ops *ops;
void *inl_priv; /* interface types can put their
private data here */
int flags; /* Connection-flags */ int flags; /* Connection-flags */
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 */
...@@ -134,25 +129,6 @@ struct isdn_net_local_s { ...@@ -134,25 +129,6 @@ struct isdn_net_local_s {
struct list_head running_devs; /* member of global running_devs */ struct list_head running_devs; /* member of global running_devs */
atomic_t refcnt; /* references held by ISDN code */ atomic_t refcnt; /* references held by ISDN code */
#ifdef CONFIG_ISDN_PPP
unsigned int mp_cfg;
u32 mp_txseq;
struct sk_buff_head mp_frags; /* fragments sl list */
u32 mp_rxseq; /* last processed packet seq #: any
packets with smaller seq # will
be dropped unconditionally */
struct ippp_ccp *ccp;
unsigned long debug;
#ifdef CONFIG_ISDN_PPP_VJ
unsigned char *cbuf;
struct slcompress *slcomp;
#endif
#endif
void *inl_priv; /* interface types can put their
private data here */
struct isdn_netif_ops *ops;
struct net_device dev; /* interface to upper levels */
}; };
...@@ -184,7 +160,6 @@ struct isdn_net_dev_s { ...@@ -184,7 +160,6 @@ struct isdn_net_dev_s {
int chargeint; /* Interval between charge-infos */ int chargeint; /* Interval between charge-infos */
int pppbind; /* ippp device for bindings */ int pppbind; /* ippp device for bindings */
struct ipppd *ipppd; /* /dev/ipppX which controls us */
struct sk_buff_head super_tx_queue; /* List of supervisory frames to */ struct sk_buff_head super_tx_queue; /* List of supervisory frames to */
/* be transmitted asap */ /* be transmitted asap */
...@@ -199,12 +174,6 @@ struct isdn_net_dev_s { ...@@ -199,12 +174,6 @@ struct isdn_net_dev_s {
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 */
#ifdef CONFIG_ISDN_PPP
unsigned int pppcfg;
u32 mp_rxseq; /* last seq no seen on this channel */
struct ippp_ccp *ccp;
unsigned long debug;
#endif
void *ind_priv; /* interface types can put their void *ind_priv; /* interface types can put their
private data here */ private data here */
}; };
......
This diff is collapsed.
...@@ -17,6 +17,24 @@ void isdn_ppp_cleanup(void); ...@@ -17,6 +17,24 @@ void isdn_ppp_cleanup(void);
int isdn_ppp_dial_slave(char *); int isdn_ppp_dial_slave(char *);
int isdn_ppp_hangup_slave(char *); int isdn_ppp_hangup_slave(char *);
struct inl_ppp {
unsigned long debug;
struct slcompress *slcomp;
struct ippp_ccp *ccp; /* CCP for this channel */
unsigned int mp_cfg;
struct sk_buff_head mp_frags; /* fragments list */
u32 mp_rxseq; /* last processed packet seq # */
u32 mp_txseq; /* current tx seq # */
};
struct ind_ppp {
struct ipppd *ipppd; /* /dev/ipppX which controls us */
unsigned int pppcfg;
unsigned long debug;
struct ippp_ccp *ccp; /* CCP for this channel (multilink) */
u32 mp_rxseq; /* last seq no seen on this channel */
};
void void
isdn_ppp_frame_log(char *info, char *data, int len, int maxlen, isdn_ppp_frame_log(char *info, char *data, int len, int maxlen,
int unit, int slot); int unit, int slot);
...@@ -25,7 +43,7 @@ int ...@@ -25,7 +43,7 @@ int
isdn_ppp_strip_proto(struct sk_buff *skb, u16 *proto); isdn_ppp_strip_proto(struct sk_buff *skb, u16 *proto);
void void
ippp_push_proto(isdn_net_dev *idev, struct sk_buff *skb, u16 proto); ippp_push_proto(struct ind_ppp *ind_ppp, struct sk_buff *skb, u16 proto);
void void
ippp_xmit(isdn_net_dev *idev, struct sk_buff *skb); ippp_xmit(isdn_net_dev *idev, struct sk_buff *skb);
......
...@@ -27,20 +27,21 @@ ...@@ -27,20 +27,21 @@
int int
ippp_mp_bind(isdn_net_dev *idev) ippp_mp_bind(isdn_net_dev *idev)
{ {
isdn_net_local *lp = idev->mlp; struct ind_ppp *ind_ppp = idev->ind_priv;
struct inl_ppp *inl_ppp = idev->mlp->inl_priv;
/* seq no last seen, maybe set to bundle min, when joining? */ /* seq no last seen, maybe set to bundle min, when joining? */
idev->mp_rxseq = 0; ind_ppp->mp_rxseq = 0;
if (!list_empty(&lp->online)) if (!list_empty(&idev->mlp->online))
return 0; return 0;
/* first channel for this link, do some setup */ /* first channel for this link, do some setup */
lp->mp_cfg = 0; /* MPPP configuration */ inl_ppp->mp_cfg = 0; /* MPPP configuration */
lp->mp_txseq = 0; /* MPPP tx sequence number */ inl_ppp->mp_txseq = 0; /* MPPP tx sequence number */
lp->mp_rxseq = (u32) -1; inl_ppp->mp_rxseq = (u32) -1;
skb_queue_head_init(&lp->mp_frags); skb_queue_head_init(&inl_ppp->mp_frags);
return 0; return 0;
} }
...@@ -51,6 +52,7 @@ ippp_mp_bundle(isdn_net_dev *idev, int unit) ...@@ -51,6 +52,7 @@ ippp_mp_bundle(isdn_net_dev *idev, int unit)
isdn_net_local *lp = idev->mlp; isdn_net_local *lp = idev->mlp;
char ifn[IFNAMSIZ + 1]; char ifn[IFNAMSIZ + 1];
isdn_net_dev *n_idev; isdn_net_dev *n_idev;
struct ind_ppp *ind_ppp;
printk(KERN_DEBUG "%s: %s: slave unit: %d\n", printk(KERN_DEBUG "%s: %s: slave unit: %d\n",
__FUNCTION__, idev->name, unit); __FUNCTION__, idev->name, unit);
...@@ -65,11 +67,12 @@ ippp_mp_bundle(isdn_net_dev *idev, int unit) ...@@ -65,11 +67,12 @@ ippp_mp_bundle(isdn_net_dev *idev, int unit)
return -ENODEV; return -ENODEV;
found: found:
if (!n_idev->ipppd) { ind_ppp = n_idev->ind_priv;
if (!ind_ppp->ipppd) {
printk(KERN_INFO "%s: no ipppd?\n", __FUNCTION__); printk(KERN_INFO "%s: no ipppd?\n", __FUNCTION__);
return -ENXIO; return -ENXIO;
} }
n_idev->pppcfg |= SC_ENABLE_IP; ind_ppp->pppcfg |= SC_ENABLE_IP;
isdn_net_online(n_idev); isdn_net_online(n_idev);
return 0; return 0;
...@@ -78,32 +81,33 @@ ippp_mp_bundle(isdn_net_dev *idev, int unit) ...@@ -78,32 +81,33 @@ ippp_mp_bundle(isdn_net_dev *idev, int unit)
void void
ippp_mp_disconnected(isdn_net_dev *idev) ippp_mp_disconnected(isdn_net_dev *idev)
{ {
isdn_net_local *lp = idev->mlp; struct inl_ppp *inl_ppp = idev->mlp->inl_priv;
if (!list_empty(&lp->online)) if (!list_empty(&idev->mlp->online))
return; return;
/* we're the last link going down */ /* we're the last link going down */
skb_queue_purge(&lp->mp_frags); skb_queue_purge(&inl_ppp->mp_frags);
} }
void void
ippp_mp_xmit(isdn_net_dev *idev, struct sk_buff *skb, u16 proto) ippp_mp_xmit(isdn_net_dev *idev, struct sk_buff *skb, u16 proto)
{ {
isdn_net_local *lp = idev->mlp; struct ind_ppp *ind_ppp = idev->ind_priv;
struct inl_ppp *inl_ppp = idev->mlp->inl_priv;
unsigned char *p; unsigned char *p;
long txseq; long txseq;
if (!(lp->mp_cfg & SC_MP_PROT)) { if (!(inl_ppp->mp_cfg & SC_MP_PROT)) {
return ippp_xmit(idev, skb); return ippp_xmit(idev, skb);
} }
/* we could do something smarter than just sending /* we could do something smarter than just sending
* the complete packet as fragment... */ * the complete packet as fragment... */
txseq = lp->mp_txseq++; txseq = inl_ppp->mp_txseq++;
if (lp->mp_cfg & SC_OUT_SHORT_SEQ) { if (inl_ppp->mp_cfg & SC_OUT_SHORT_SEQ) {
/* sequence number: 12bit */ /* sequence number: 12bit */
p = skb_push(skb, 2); p = skb_push(skb, 2);
p[0] = MP_BEGIN_FRAG | MP_END_FRAG | ((txseq >> 8) & 0xf); p[0] = MP_BEGIN_FRAG | MP_END_FRAG | ((txseq >> 8) & 0xf);
...@@ -117,8 +121,8 @@ ippp_mp_xmit(isdn_net_dev *idev, struct sk_buff *skb, u16 proto) ...@@ -117,8 +121,8 @@ ippp_mp_xmit(isdn_net_dev *idev, struct sk_buff *skb, u16 proto)
p[3] = (txseq >> 0) & 0xff; p[3] = (txseq >> 0) & 0xff;
} }
proto = PPP_MP; proto = PPP_MP;
skb = ippp_ccp_compress(idev->ccp, skb, &proto); skb = ippp_ccp_compress(ind_ppp->ccp, skb, &proto);
ippp_push_proto(idev, skb, proto); ippp_push_proto(ind_ppp, skb, proto);
ippp_xmit(idev, skb); ippp_xmit(idev, skb);
} }
...@@ -127,12 +131,13 @@ static void mp_receive(isdn_net_dev *idev, struct sk_buff *skb); ...@@ -127,12 +131,13 @@ static void mp_receive(isdn_net_dev *idev, struct sk_buff *skb);
void void
ippp_mp_receive(isdn_net_dev *idev, struct sk_buff *skb, u16 proto) ippp_mp_receive(isdn_net_dev *idev, struct sk_buff *skb, u16 proto)
{ {
isdn_net_local *lp = idev->mlp; struct ind_ppp *ind_ppp = idev->ind_priv;
struct inl_ppp *inl_ppp = idev->mlp->inl_priv;
if (lp->mp_cfg & SC_REJ_MP_PROT) if (inl_ppp->mp_cfg & SC_REJ_MP_PROT)
goto out; goto out;
skb = ippp_ccp_decompress(idev->ccp, skb, &proto); skb = ippp_ccp_decompress(ind_ppp->ccp, skb, &proto);
if (!skb) if (!skb)
goto drop; goto drop;
...@@ -143,7 +148,7 @@ ippp_mp_receive(isdn_net_dev *idev, struct sk_buff *skb, u16 proto) ...@@ -143,7 +148,7 @@ ippp_mp_receive(isdn_net_dev *idev, struct sk_buff *skb, u16 proto)
return ippp_receive(idev, skb, proto); return ippp_receive(idev, skb, proto);
drop: drop:
lp->stats.rx_errors++; idev->mlp->stats.rx_errors++;
kfree_skb(skb); kfree_skb(skb);
} }
...@@ -257,9 +262,10 @@ mp_complete_seq(isdn_net_local *lp, struct sk_buff *b, struct sk_buff *e) ...@@ -257,9 +262,10 @@ mp_complete_seq(isdn_net_local *lp, struct sk_buff *b, struct sk_buff *e)
struct sk_buff * struct sk_buff *
mp_reassemble(isdn_net_local *lp) mp_reassemble(isdn_net_local *lp)
{ {
struct sk_buff_head *frags = &lp->mp_frags; struct inl_ppp *inl_ppp = lp->inl_priv;
struct sk_buff_head *frags = &inl_ppp->mp_frags;
struct sk_buff *p, *n, *pp, *start; struct sk_buff *p, *n, *pp, *start;
u32 min_seq = lp->mp_rxseq; u32 min_seq = inl_ppp->mp_rxseq;
u32 next_seq = 0; u32 next_seq = 0;
again: again:
...@@ -307,32 +313,35 @@ static void ...@@ -307,32 +313,35 @@ static void
mp_receive(isdn_net_dev *idev, struct sk_buff *skb) mp_receive(isdn_net_dev *idev, struct sk_buff *skb)
{ {
isdn_net_local *lp = idev->mlp; isdn_net_local *lp = idev->mlp;
struct inl_ppp *inl_ppp = lp->inl_priv;
struct ind_ppp *ind_ppp = idev->ind_priv;
isdn_net_dev *qdev; isdn_net_dev *qdev;
struct sk_buff_head *frags = &lp->mp_frags; struct sk_buff_head *frags = &inl_ppp->mp_frags;
u32 seq; u32 seq;
u16 proto; u16 proto;
print_recv_pkt(-1, skb); print_recv_pkt(-1, skb);
if (skb->len < (lp->mp_cfg & SC_IN_SHORT_SEQ ? 2 : 4)) if (skb->len < (inl_ppp->mp_cfg & SC_IN_SHORT_SEQ ? 2 : 4))
goto drop; goto drop;
seq = get_seq(skb, idev->mp_rxseq, lp->mp_cfg & SC_IN_SHORT_SEQ); seq = get_seq(skb, ind_ppp->mp_rxseq, inl_ppp->mp_cfg & SC_IN_SHORT_SEQ);
idev->mp_rxseq = seq; ind_ppp->mp_rxseq = seq;
if (lp->mp_rxseq == (u32) -1) { if (inl_ppp->mp_rxseq == (u32) -1) {
/* first packet */ /* first packet */
lp->mp_rxseq = seq; inl_ppp->mp_rxseq = seq;
} }
if (MP_LT(seq, lp->mp_rxseq)) { if (MP_LT(seq, inl_ppp->mp_rxseq)) {
goto drop; goto drop;
} }
/* Find the minimum sequence number received over all channels. /* Find the minimum sequence number received over all channels.
* No fragments with numbers lower than this will arrive later. */ * No fragments with numbers lower than this will arrive later. */
lp->mp_rxseq = seq; inl_ppp->mp_rxseq = seq;
list_for_each_entry(qdev, &lp->online, online) { list_for_each_entry(qdev, &lp->online, online) {
if (MP_LT(qdev->mp_rxseq, lp->mp_rxseq)) struct ind_ppp *ind_ppp = qdev->ind_priv;
lp->mp_rxseq = qdev->mp_rxseq; if (MP_LT(ind_ppp->mp_rxseq, inl_ppp->mp_rxseq))
inl_ppp->mp_rxseq = ind_ppp->mp_rxseq;
} }
/* Insert the skb into the list of received fragments, ordered by /* Insert the skb into the list of received fragments, ordered by
......
...@@ -27,23 +27,25 @@ ippp_vj_free(struct slcompress *slcomp) ...@@ -27,23 +27,25 @@ ippp_vj_free(struct slcompress *slcomp)
int int
ippp_vj_set_maxcid(isdn_net_dev *idev, int val) ippp_vj_set_maxcid(isdn_net_dev *idev, int val)
{ {
struct inl_ppp *inl_ppp = idev->mlp->inl_priv;
struct slcompress *sltmp; struct slcompress *sltmp;
sltmp = slhc_init(16, val + 1); sltmp = slhc_init(16, val + 1);
if (!sltmp) if (!sltmp)
return -ENOMEM; return -ENOMEM;
if (idev->mlp->slcomp) if (inl_ppp->slcomp)
slhc_free(idev->mlp->slcomp); slhc_free(inl_ppp->slcomp);
idev->mlp->slcomp = sltmp; inl_ppp->slcomp = sltmp;
return 0; return 0;
} }
void void
ippp_vj_decompress(isdn_net_dev *idev, struct sk_buff *skb_old, u16 proto) ippp_vj_decompress(isdn_net_dev *idev, struct sk_buff *skb_old, u16 proto)
{ {
struct slcompress *slcomp = idev->mlp->slcomp; struct inl_ppp *inl_ppp = idev->mlp->inl_priv;
struct slcompress *slcomp = inl_ppp->slcomp;
struct sk_buff *skb; struct sk_buff *skb;
int len; int len;
...@@ -84,11 +86,14 @@ ippp_vj_decompress(isdn_net_dev *idev, struct sk_buff *skb_old, u16 proto) ...@@ -84,11 +86,14 @@ ippp_vj_decompress(isdn_net_dev *idev, struct sk_buff *skb_old, u16 proto)
struct sk_buff * struct sk_buff *
ippp_vj_compress(isdn_net_dev *idev, struct sk_buff *skb_old, u16 *proto) ippp_vj_compress(isdn_net_dev *idev, struct sk_buff *skb_old, u16 *proto)
{ {
struct inl_ppp *inl_ppp = idev->mlp->inl_priv;
struct ind_ppp *ind_ppp = idev->ind_priv;
struct slcompress *slcomp = inl_ppp->slcomp;
struct sk_buff *skb; struct sk_buff *skb;
unsigned char *buf; unsigned char *buf;
int len; int len;
if (!(idev->pppcfg & SC_COMP_TCP) || *proto != PPP_IP) if (!(ind_ppp->pppcfg & SC_COMP_TCP) || *proto != PPP_IP)
return skb_old; return skb_old;
skb = isdn_ppp_dev_alloc_skb(idev, skb_old->len, GFP_ATOMIC); skb = isdn_ppp_dev_alloc_skb(idev, skb_old->len, GFP_ATOMIC);
...@@ -97,8 +102,9 @@ ippp_vj_compress(isdn_net_dev *idev, struct sk_buff *skb_old, u16 *proto) ...@@ -97,8 +102,9 @@ ippp_vj_compress(isdn_net_dev *idev, struct sk_buff *skb_old, u16 *proto)
skb_put(skb, skb_old->len); skb_put(skb, skb_old->len);
buf = skb_old->data; buf = skb_old->data;
len = slhc_compress(idev->mlp->slcomp, skb_old->data, skb_old->len, // FIXME flag should be per bundle
skb->data, &buf, !(idev->pppcfg & SC_NO_TCP_CCID)); len = slhc_compress(slcomp, skb_old->data, skb_old->len, skb->data,
&buf, !(ind_ppp->pppcfg & SC_NO_TCP_CCID));
if (buf == skb_old->data) { if (buf == skb_old->data) {
kfree_skb(skb); kfree_skb(skb);
......
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