Commit 2bef3378 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: separate out CISCO HDLC receive function

Another step in splitting isdn_net_receive into type specific functions.
parent d8309034
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "isdn_common.h" #include "isdn_common.h"
#include "isdn_net.h" #include "isdn_net.h"
#include "isdn_ciscohdlck.h"
#include <linux/inetdevice.h> #include <linux/inetdevice.h>
...@@ -37,7 +38,7 @@ isdn_net_ciscohdlck_alloc_skb(isdn_net_local *lp, int len) ...@@ -37,7 +38,7 @@ isdn_net_ciscohdlck_alloc_skb(isdn_net_local *lp, int len)
} }
/* cisco hdlck device private ioctls */ /* cisco hdlck device private ioctls */
int static int
isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{ {
isdn_net_local *lp = (isdn_net_local *) dev->priv; isdn_net_local *lp = (isdn_net_local *) dev->priv;
...@@ -324,8 +325,10 @@ isdn_net_ciscohdlck_slarp_in(isdn_net_local *lp, struct sk_buff *skb) ...@@ -324,8 +325,10 @@ isdn_net_ciscohdlck_slarp_in(isdn_net_local *lp, struct sk_buff *skb)
} }
void void
isdn_ciscohdlck_receive(isdn_net_local *lp, struct sk_buff *skb) isdn_ciscohdlck_receive(isdn_net_dev *idev, isdn_net_local *olp,
struct sk_buff *skb)
{ {
isdn_net_local *lp = &idev->local;
unsigned char *p; unsigned char *p;
u8 addr; u8 addr;
u8 ctrl; u8 ctrl;
...@@ -340,14 +343,10 @@ isdn_ciscohdlck_receive(isdn_net_local *lp, struct sk_buff *skb) ...@@ -340,14 +343,10 @@ isdn_ciscohdlck_receive(isdn_net_local *lp, struct sk_buff *skb)
p += get_u16(p, &type); p += get_u16(p, &type);
skb_pull(skb, 4); skb_pull(skb, 4);
if (addr != CISCO_ADDR_UNICAST && addr != CISCO_ADDR_BROADCAST) { if ((addr != CISCO_ADDR_UNICAST && addr != CISCO_ADDR_BROADCAST) ||
printk(KERN_WARNING "%s: Unknown Cisco addr 0x%02x\n", ctrl != CISCO_CTRL) {
lp->name, addr); printk(KERN_DEBUG "%s: Unknown Cisco header %#02x %#02x\n",
goto out_free; lp->name, addr, ctrl);
}
if (ctrl != CISCO_CTRL) {
printk(KERN_WARNING "%s: Unknown Cisco ctrl 0x%02x\n",
lp->name, ctrl);
goto out_free; goto out_free;
} }
...@@ -362,6 +361,7 @@ isdn_ciscohdlck_receive(isdn_net_local *lp, struct sk_buff *skb) ...@@ -362,6 +361,7 @@ isdn_ciscohdlck_receive(isdn_net_local *lp, struct sk_buff *skb)
goto out_free; goto out_free;
default: default:
/* no special cisco protocol */ /* no special cisco protocol */
isdn_net_reset_huptimer(lp, olp);
skb->protocol = htons(type); skb->protocol = htons(type);
netif_rx(skb); netif_rx(skb);
return; return;
...@@ -388,16 +388,11 @@ isdn_ciscohdlck_header(struct sk_buff *skb, struct net_device *dev, ...@@ -388,16 +388,11 @@ isdn_ciscohdlck_header(struct sk_buff *skb, struct net_device *dev,
int int
isdn_ciscohdlck_setup(isdn_net_dev *p) isdn_ciscohdlck_setup(isdn_net_dev *p)
{ {
isdn_net_local *lp = &p->local;
p->dev.hard_header = isdn_ciscohdlck_header; p->dev.hard_header = isdn_ciscohdlck_header;
p->dev.hard_header_cache = NULL; p->dev.hard_header_cache = NULL;
p->dev.header_cache_update = NULL; p->dev.header_cache_update = NULL;
p->dev.flags = IFF_NOARP|IFF_POINTOPOINT; p->dev.flags = IFF_NOARP|IFF_POINTOPOINT;
if (lp->p_encap == ISDN_NET_ENCAP_CISCOHDLCK)
p->dev.do_ioctl = isdn_ciscohdlck_dev_ioctl; p->dev.do_ioctl = isdn_ciscohdlck_dev_ioctl;
else
p->dev.do_ioctl = NULL;
return 0; return 0;
} }
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
int isdn_ciscohdlck_setup(isdn_net_dev *p); 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);
void isdn_ciscohdlck_receive(isdn_net_local *lp, struct sk_buff *skb); void isdn_ciscohdlck_receive(isdn_net_dev *p, isdn_net_local *olp,
struct sk_buff *skb);
#endif #endif
...@@ -1238,12 +1238,9 @@ isdn_net_receive(struct net_device *ndev, struct sk_buff *skb) ...@@ -1238,12 +1238,9 @@ isdn_net_receive(struct net_device *ndev, struct sk_buff *skb)
isdn_rawip_receive(lp->netdev, olp, skb); isdn_rawip_receive(lp->netdev, olp, skb);
break; break;
case ISDN_NET_ENCAP_CISCOHDLCK: case ISDN_NET_ENCAP_CISCOHDLCK:
isdn_ciscohdlck_receive(lp, skb);
return;
case ISDN_NET_ENCAP_CISCOHDLC: case ISDN_NET_ENCAP_CISCOHDLC:
/* CISCO-HDLC IP with type field and fake I-frame-header */ isdn_ciscohdlck_receive(lp->netdev, olp, skb);
skb_pull(skb, 2); return;
/* Fall through */
case ISDN_NET_ENCAP_IPTYP: case ISDN_NET_ENCAP_IPTYP:
/* IP with type field */ /* IP with type field */
olp->huptimer = 0; olp->huptimer = 0;
...@@ -2645,7 +2642,6 @@ isdn_eth_type_trans(struct sk_buff *skb, struct net_device *dev) ...@@ -2645,7 +2642,6 @@ isdn_eth_type_trans(struct sk_buff *skb, struct net_device *dev)
return htons(ETH_P_802_2); return htons(ETH_P_802_2);
} }
static void static void
isdn_ether_receive(isdn_net_dev *p, isdn_net_local *olp, isdn_ether_receive(isdn_net_dev *p, isdn_net_local *olp,
struct sk_buff *skb) struct sk_buff *skb)
...@@ -2653,7 +2649,7 @@ isdn_ether_receive(isdn_net_dev *p, isdn_net_local *olp, ...@@ -2653,7 +2649,7 @@ isdn_ether_receive(isdn_net_dev *p, isdn_net_local *olp,
isdn_net_local *lp = &p->local; isdn_net_local *lp = &p->local;
isdn_net_reset_huptimer(lp, olp); isdn_net_reset_huptimer(lp, olp);
skb->protocol = isdn_eth_type_trans(skb, &p->dev); skb->protocol = isdn_eth_type_trans(skb, skb->dev);
netif_rx(skb); netif_rx(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