Commit cc666ffa authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: net_device->header for syncPPP and UI HDLC

Break syncPPP and UI HDLC specific parts out of isdn_net_header()
and move it to more appropriate places.
parent 8d04001d
...@@ -207,6 +207,8 @@ static int isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg); ...@@ -207,6 +207,8 @@ static int isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg);
static int isdn_rawip_setup(isdn_net_dev *p); static int isdn_rawip_setup(isdn_net_dev *p);
static int isdn_ether_setup(isdn_net_dev *p); static int isdn_ether_setup(isdn_net_dev *p);
static int isdn_uihdlc_setup(isdn_net_dev *p);
static int isdn_other_setup(isdn_net_dev *p);
char *isdn_net_revision = "$Revision: 1.140.6.11 $"; char *isdn_net_revision = "$Revision: 1.140.6.11 $";
...@@ -1368,21 +1370,11 @@ isdn_net_header(struct sk_buff *skb, struct net_device *dev, unsigned short type ...@@ -1368,21 +1370,11 @@ isdn_net_header(struct sk_buff *skb, struct net_device *dev, unsigned short type
ushort len = 0; ushort len = 0;
switch (lp->p_encap) { switch (lp->p_encap) {
case ISDN_NET_ENCAP_SYNCPPP:
/* stick on a fake header to keep fragmentation code happy. */
len = IPPP_MAX_HEADER;
skb_push(skb,len);
break;
case ISDN_NET_ENCAP_IPTYP: case ISDN_NET_ENCAP_IPTYP:
/* ethernet type field */ /* ethernet type field */
*((ushort *) skb_push(skb, 2)) = htons(type); *((ushort *) skb_push(skb, 2)) = htons(type);
len = 2; len = 2;
break; break;
case ISDN_NET_ENCAP_UIHDLC:
/* HDLC with UI-Frames (for ispa with -h1 option) */
*((ushort *) skb_push(skb, 2)) = htons(0x0103);
len = 2;
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;
...@@ -2088,6 +2080,9 @@ isdn_net_set_encap(isdn_net_dev *p, isdn_net_ioctl_cfg *cfg) ...@@ -2088,6 +2080,9 @@ isdn_net_set_encap(isdn_net_dev *p, isdn_net_ioctl_cfg *cfg)
case ISDN_NET_ENCAP_ETHER: case ISDN_NET_ENCAP_ETHER:
retval = isdn_ether_setup(p); retval = isdn_ether_setup(p);
break; break;
case ISDN_NET_ENCAP_UIHDLC:
retval = isdn_uihdlc_setup(p);
break;
default: default:
retval = isdn_other_setup(p); retval = isdn_other_setup(p);
break; break;
...@@ -2591,6 +2586,32 @@ isdn_net_rmall(void) ...@@ -2591,6 +2586,32 @@ isdn_net_rmall(void)
return 0; return 0;
} }
// ISDN_NET_ENCAP_UIHDLC
// HDLC with UI-Frames (for ispa with -h1 option) */
// ======================================================================
static int
isdn_uihdlc_header(struct sk_buff *skb, struct net_device *dev,
unsigned short type, void *daddr, void *saddr,
unsigned plen)
{
put_u16(skb_push(skb, 2), 0x0103);
return 2;
}
int
isdn_uihdlc_setup(isdn_net_dev *p)
{
p->dev.hard_header = isdn_uihdlc_header;
p->dev.hard_header_cache = NULL;
p->dev.header_cache_update = NULL;
p->dev.flags = IFF_NOARP|IFF_POINTOPOINT;
return 0;
}
// ISDN_NET_ENCAP_RAWIP
// ======================================================================
static int static int
isdn_rawip_setup(isdn_net_dev *p) isdn_rawip_setup(isdn_net_dev *p)
...@@ -2603,6 +2624,9 @@ isdn_rawip_setup(isdn_net_dev *p) ...@@ -2603,6 +2624,9 @@ isdn_rawip_setup(isdn_net_dev *p)
return 0; return 0;
} }
// ISDN_NET_ENCAP_ETHER
// ======================================================================
static int static int
isdn_ether_setup(isdn_net_dev *p) isdn_ether_setup(isdn_net_dev *p)
{ {
......
...@@ -53,7 +53,6 @@ extern int isdn_net_rcv_skb(int, struct sk_buff *); ...@@ -53,7 +53,6 @@ extern int isdn_net_rcv_skb(int, struct sk_buff *);
extern int isdn_net_dial_req(isdn_net_local *); 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_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 void isdn_net_write_super(isdn_net_local *lp, struct sk_buff *skb);
extern int isdn_other_setup(isdn_net_dev *p);
#define ISDN_NET_MAX_QUEUE_LENGTH 2 #define ISDN_NET_MAX_QUEUE_LENGTH 2
......
...@@ -2895,9 +2895,27 @@ static int isdn_ppp_set_compressor(struct ippp_struct *is, struct isdn_ppp_comp_ ...@@ -2895,9 +2895,27 @@ static int isdn_ppp_set_compressor(struct ippp_struct *is, struct isdn_ppp_comp_
return -EINVAL; return -EINVAL;
} }
// ISDN_NET_ENCAP_SYNCPPP
// ======================================================================
static int
isdn_ppp_header(struct sk_buff *skb, struct net_device *dev,
unsigned short type, void *daddr, void *saddr,
unsigned plen)
{
skb_push(skb, IPPP_MAX_HEADER);
return IPPP_MAX_HEADER;
}
int isdn_ppp_setup(isdn_net_dev *p) int isdn_ppp_setup(isdn_net_dev *p)
{ {
isdn_other_setup(p); p->dev.hard_header = isdn_ppp_header;
p->dev.hard_header_cache = NULL;
p->dev.header_cache_update = NULL;
p->dev.flags = IFF_NOARP|IFF_POINTOPOINT;
p->dev.type = ARPHRD_PPP; /* change ARP type */ p->dev.type = ARPHRD_PPP; /* change ARP type */
p->dev.addr_len = 0; p->dev.addr_len = 0;
p->dev.do_ioctl = isdn_ppp_dev_ioctl; p->dev.do_ioctl = isdn_ppp_dev_ioctl;
......
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