Commit f789f058 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: Use ether_setup() for ethernet over ISDN only

The ->init() callback can be used for calling ether_setup() in case
of encapsulation "ISDN over ethernet", for the other cases it does not
make sense anyway.
parent 1ad691d2
...@@ -2249,6 +2249,21 @@ isdn_slot_st_netdev(int sl) ...@@ -2249,6 +2249,21 @@ isdn_slot_st_netdev(int sl)
return slot[sl].st_netdev; return slot[sl].st_netdev;
} }
int
isdn_hard_header_len(void)
{
int drvidx;
int max = 0;
for (drvidx = 0; drvidx < ISDN_MAX_DRIVERS; drvidx++) {
if (dev->drv[drvidx] &&
max < dev->drv[drvidx]->interface->hl_hdrlen) {
max = dev->drv[drvidx]->interface->hl_hdrlen;
}
}
return max;
}
/* /*
***************************************************************************** *****************************************************************************
* And now the modules code. * And now the modules code.
......
...@@ -104,4 +104,4 @@ extern void isdn_slot_set_rx_netdev(int sl, isdn_net_dev *nd); ...@@ -104,4 +104,4 @@ extern void isdn_slot_set_rx_netdev(int sl, isdn_net_dev *nd);
extern void isdn_slot_set_st_netdev(int sl, isdn_net_dev *nd); extern void isdn_slot_set_st_netdev(int sl, isdn_net_dev *nd);
extern isdn_net_dev *isdn_slot_rx_netdev(int sl); extern isdn_net_dev *isdn_slot_rx_netdev(int sl);
extern isdn_net_dev *isdn_slot_st_netdev(int sl); extern isdn_net_dev *isdn_slot_st_netdev(int sl);
extern int isdn_hard_header_len(void);
...@@ -1215,45 +1215,16 @@ isdn_net_rcv_skb(int idx, struct sk_buff *skb) ...@@ -1215,45 +1215,16 @@ isdn_net_rcv_skb(int idx, struct sk_buff *skb)
static int static int
isdn_net_init(struct net_device *ndev) isdn_net_init(struct net_device *ndev)
{ {
ushort max_hlhdr_len = 0;
int drvidx, i;
ether_setup(ndev);
/* Setup the generic properties */ /* Setup the generic properties */
ndev->hard_header = NULL;
ndev->hard_header_cache = NULL;
ndev->header_cache_update = NULL;
ndev->mtu = 1500; ndev->mtu = 1500;
ndev->flags = IFF_NOARP|IFF_POINTOPOINT; ndev->tx_queue_len = 10;
ndev->type = ARPHRD_ETHER;
ndev->addr_len = ETH_ALEN;
/* for clients with MPPP maybe higher values better */
ndev->tx_queue_len = 30;
for (i = 0; i < ETH_ALEN; i++)
ndev->broadcast[i] = 0xff;
/* The ISDN-specific entries in the device structure. */
ndev->open = &isdn_net_open; ndev->open = &isdn_net_open;
ndev->hard_start_xmit = &isdn_net_start_xmit; ndev->hard_start_xmit = &isdn_net_start_xmit;
ndev->hard_header_len = ETH_HLEN + isdn_hard_header_len();
/*
* up till binding we ask the protocol layer to reserve as much
* as we might need for HL layer
*/
for (drvidx = 0; drvidx < ISDN_MAX_DRIVERS; drvidx++)
if (dev->drv[drvidx])
if (max_hlhdr_len < dev->drv[drvidx]->interface->hl_hdrlen)
max_hlhdr_len = dev->drv[drvidx]->interface->hl_hdrlen;
ndev->hard_header_len = ETH_HLEN + max_hlhdr_len;
ndev->stop = &isdn_net_close; ndev->stop = &isdn_net_close;
ndev->get_stats = &isdn_net_get_stats; ndev->get_stats = &isdn_net_get_stats;
ndev->do_ioctl = NULL;
return 0; return 0;
} }
...@@ -1738,10 +1709,7 @@ isdn_net_set_encap(isdn_net_dev *p, int encap) ...@@ -1738,10 +1709,7 @@ isdn_net_set_encap(isdn_net_dev *p, int encap)
lp->ops = netif_ops[encap]; lp->ops = netif_ops[encap];
p->dev.hard_header = lp->ops->hard_header; p->dev.hard_header = lp->ops->hard_header;
p->dev.rebuild_header = lp->ops->rebuild_header;
p->dev.do_ioctl = lp->ops->do_ioctl; p->dev.do_ioctl = lp->ops->do_ioctl;
p->dev.hard_header_cache = lp->ops->hard_header_cache;
p->dev.header_cache_update = lp->ops->header_cache_update;
p->dev.flags = lp->ops->flags; p->dev.flags = lp->ops->flags;
p->dev.type = lp->ops->type; p->dev.type = lp->ops->type;
p->dev.addr_len = lp->ops->addr_len; p->dev.addr_len = lp->ops->addr_len;
...@@ -2404,15 +2372,22 @@ isdn_ether_receive(isdn_net_dev *p, isdn_net_local *olp, ...@@ -2404,15 +2372,22 @@ isdn_ether_receive(isdn_net_dev *p, isdn_net_local *olp,
netif_rx(skb); netif_rx(skb);
} }
static int
isdn_ether_init(isdn_net_local *lp)
{
struct net_device *dev = &lp->netdev->dev;
ether_setup(dev);
dev->tx_queue_len = 10;
dev->hard_header_len += isdn_hard_header_len();
return 0;
}
static struct isdn_netif_ops ether_ops = { static struct isdn_netif_ops ether_ops = {
.hard_header = eth_header, .hard_header = eth_header,
.hard_header_cache = eth_header_cache,
.header_cache_update = eth_header_cache_update,
.rebuild_header = eth_rebuild_header,
.flags = IFF_BROADCAST | IFF_MULTICAST,
.type = ARPHRD_ETHER,
.addr_len = ETH_ALEN,
.receive = isdn_ether_receive, .receive = isdn_ether_receive,
.init = isdn_ether_init,
}; };
// ====================================================================== // ======================================================================
......
...@@ -288,14 +288,9 @@ struct isdn_netif_ops { ...@@ -288,14 +288,9 @@ struct isdn_netif_ops {
void *daddr, void *daddr,
void *saddr, void *saddr,
unsigned len); unsigned len);
int (*rebuild_header)(struct sk_buff *skb);
int (*do_ioctl)(struct net_device *dev, int (*do_ioctl)(struct net_device *dev,
struct ifreq *ifr, int cmd); struct ifreq *ifr, int cmd);
int (*hard_header_cache)(struct neighbour *neigh,
struct hh_cache *hh);
void (*header_cache_update)(struct hh_cache *hh,
struct net_device *dev,
unsigned char * haddr);
unsigned short flags; /* interface flags (a la BSD) */ unsigned short flags; /* interface flags (a la BSD) */
unsigned short type; /* interface hardware type */ unsigned short type; /* interface hardware type */
unsigned char addr_len;/* hardware address length */ unsigned char addr_len;/* hardware address length */
......
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