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) ...@@ -371,10 +371,33 @@ isdn_ciscohdlck_receive(isdn_net_local *lp, struct sk_buff *skb)
kfree_skb(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); unsigned char *p = skb_push(skb, 4);
p->dev.do_ioctl = isdn_ciscohdlck_dev_ioctl;
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; return 0;
} }
......
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
#ifndef ISDN_CISCOHDLCK_H #ifndef ISDN_CISCOHDLCK_H
#define 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_connected(isdn_net_local *lp);
void isdn_ciscohdlck_disconnected(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); void isdn_ciscohdlck_receive(isdn_net_local *lp, struct sk_buff *skb);
#endif #endif
...@@ -1365,7 +1365,6 @@ isdn_net_header(struct sk_buff *skb, struct net_device *dev, unsigned short type ...@@ -1365,7 +1365,6 @@ isdn_net_header(struct sk_buff *skb, struct net_device *dev, unsigned short type
void *daddr, void *saddr, unsigned plen) void *daddr, void *saddr, unsigned plen)
{ {
isdn_net_local *lp = dev->priv; isdn_net_local *lp = dev->priv;
unsigned char *p;
ushort len = 0; ushort len = 0;
switch (lp->p_encap) { switch (lp->p_encap) {
...@@ -1384,14 +1383,6 @@ isdn_net_header(struct sk_buff *skb, struct net_device *dev, unsigned short type ...@@ -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); *((ushort *) skb_push(skb, 2)) = htons(0x0103);
len = 2; len = 2;
break; 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: default:
printk(KERN_WARNING "isdn_net_header called with encap %d!\n", lp->p_encap); printk(KERN_WARNING "isdn_net_header called with encap %d!\n", lp->p_encap);
len = 0; len = 0;
...@@ -2078,13 +2069,16 @@ isdn_net_set_encap(isdn_net_dev *p, isdn_net_ioctl_cfg *cfg) ...@@ -2078,13 +2069,16 @@ isdn_net_set_encap(isdn_net_dev *p, isdn_net_ioctl_cfg *cfg)
break; break;
} }
switch (cfg->p_encap) { lp->p_encap = cfg->p_encap;
switch (lp->p_encap) {
case ISDN_NET_ENCAP_SYNCPPP: case ISDN_NET_ENCAP_SYNCPPP:
retval = isdn_ppp_setup(p); retval = isdn_ppp_setup(p);
break; break;
case ISDN_NET_ENCAP_X25IFACE: case ISDN_NET_ENCAP_X25IFACE:
retval = isdn_x25_setup(p, cfg->p_encap); retval = isdn_x25_setup(p, cfg->p_encap);
break; break;
case ISDN_NET_ENCAP_CISCOHDLC:
case ISDN_NET_ENCAP_CISCOHDLCK: case ISDN_NET_ENCAP_CISCOHDLCK:
retval = isdn_ciscohdlck_setup(p); retval = isdn_ciscohdlck_setup(p);
break; break;
...@@ -2098,8 +2092,6 @@ isdn_net_set_encap(isdn_net_dev *p, isdn_net_ioctl_cfg *cfg) ...@@ -2098,8 +2092,6 @@ isdn_net_set_encap(isdn_net_dev *p, isdn_net_ioctl_cfg *cfg)
retval = isdn_other_setup(p); retval = isdn_other_setup(p);
break; break;
} }
if (retval == 0)
lp->p_encap = cfg->p_encap;
out: out:
return retval; 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