Commit 8d04001d authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: net_device->header for CISCO HDLC

Break the CISCO specific part out of the generic isdn_net_header()
and move it to the CISCO code.
parent b29cbe77
......@@ -371,10 +371,33 @@ isdn_ciscohdlck_receive(isdn_net_local *lp, struct sk_buff *skb)
kfree_skb(skb);
}
int isdn_ciscohdlck_setup(isdn_net_dev *p)
static int
isdn_ciscohdlck_header(struct sk_buff *skb, struct net_device *dev,
unsigned short type,
void *daddr, void *saddr, unsigned plen)
{
isdn_other_setup(p);
p->dev.do_ioctl = isdn_ciscohdlck_dev_ioctl;
unsigned char *p = skb_push(skb, 4);
p += put_u8 (p, CISCO_ADDR_UNICAST);
p += put_u8 (p, CISCO_CTRL);
p += put_u16(p, type);
return 4;
}
int
isdn_ciscohdlck_setup(isdn_net_dev *p)
{
isdn_net_local *lp = &p->local;
p->dev.hard_header = isdn_ciscohdlck_header;
p->dev.hard_header_cache = NULL;
p->dev.header_cache_update = NULL;
p->dev.flags = IFF_NOARP|IFF_POINTOPOINT;
if (lp->p_encap == ISDN_NET_ENCAP_CISCOHDLCK)
p->dev.do_ioctl = isdn_ciscohdlck_dev_ioctl;
else
p->dev.do_ioctl = NULL;
return 0;
}
......
......@@ -11,9 +11,9 @@
#ifndef ISDN_CISCOHDLCK_H
#define ISDN_CISCOHDLCK_H
int isdn_ciscohdlck_setup(isdn_net_dev *p);
void isdn_ciscohdlck_connected(isdn_net_local *lp);
void isdn_ciscohdlck_disconnected(isdn_net_local *lp);
int isdn_ciscohdlck_setup(isdn_net_dev *p);
void isdn_ciscohdlck_receive(isdn_net_local *lp, struct sk_buff *skb);
#endif
......@@ -1365,7 +1365,6 @@ isdn_net_header(struct sk_buff *skb, struct net_device *dev, unsigned short type
void *daddr, void *saddr, unsigned plen)
{
isdn_net_local *lp = dev->priv;
unsigned char *p;
ushort len = 0;
switch (lp->p_encap) {
......@@ -1384,14 +1383,6 @@ isdn_net_header(struct sk_buff *skb, struct net_device *dev, unsigned short type
*((ushort *) skb_push(skb, 2)) = htons(0x0103);
len = 2;
break;
case ISDN_NET_ENCAP_CISCOHDLC:
case ISDN_NET_ENCAP_CISCOHDLCK:
p = skb_push(skb, 4);
p += put_u8 (p, CISCO_ADDR_UNICAST);
p += put_u8 (p, CISCO_CTRL);
p += put_u16(p, type);
len = 4;
break;
default:
printk(KERN_WARNING "isdn_net_header called with encap %d!\n", lp->p_encap);
len = 0;
......@@ -2078,13 +2069,16 @@ isdn_net_set_encap(isdn_net_dev *p, isdn_net_ioctl_cfg *cfg)
break;
}
switch (cfg->p_encap) {
lp->p_encap = cfg->p_encap;
switch (lp->p_encap) {
case ISDN_NET_ENCAP_SYNCPPP:
retval = isdn_ppp_setup(p);
break;
case ISDN_NET_ENCAP_X25IFACE:
retval = isdn_x25_setup(p, cfg->p_encap);
break;
case ISDN_NET_ENCAP_CISCOHDLC:
case ISDN_NET_ENCAP_CISCOHDLCK:
retval = isdn_ciscohdlck_setup(p);
break;
......@@ -2098,8 +2092,6 @@ isdn_net_set_encap(isdn_net_dev *p, isdn_net_ioctl_cfg *cfg)
retval = isdn_other_setup(p);
break;
}
if (retval == 0)
lp->p_encap = cfg->p_encap;
out:
return retval;
......
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