patch-2.4.0-test11 linux/drivers/net/wan/lapbether.c
Next file: linux/drivers/net/wan/x25_asy.c
Previous file: linux/drivers/net/wan/comx.c
Back to the patch index
Back to the overall index
- Lines: 84
- Date:
Fri Nov 17 16:48:51 2000
- Orig file:
v2.4.0-test10/linux/drivers/net/wan/lapbether.c
- Orig date:
Thu May 4 11:31:21 2000
diff -u --recursive --new-file v2.4.0-test10/linux/drivers/net/wan/lapbether.c linux/drivers/net/wan/lapbether.c
@@ -16,6 +16,8 @@
*
* History
* LAPBETH 001 Jonathan Naylor Cloned from bpqether.c
+ * 2000-10-29 Henner Eisen lapb_data_indication() return status.
+ * 2000-11-14 Henner Eisen dev_hold/put, NETDEV_GOING_DOWN support
*/
#include <linux/errno.h>
@@ -79,6 +81,7 @@
/*
* Get the ethernet device for a LAPB device
*/
+#if 0
static __inline__ struct net_device *lapbeth_get_ether_dev(struct net_device *dev)
{
struct lapbethdev *lapbeth;
@@ -87,7 +90,7 @@
return (lapbeth != NULL) ? lapbeth->ethdev : NULL;
}
-
+#endif
/*
* Get the LAPB device for the ethernet device
*/
@@ -136,6 +139,7 @@
result = 1;
unregister_netdev(&lapbeth->axdev);
+ dev_put(lapbeth->ethdev);
kfree(lapbeth);
}
@@ -185,7 +189,7 @@
return 0;
}
-static void lapbeth_data_indication(void *token, struct sk_buff *skb)
+static int lapbeth_data_indication(void *token, struct sk_buff *skb)
{
struct lapbethdev *lapbeth = (struct lapbethdev *)token;
unsigned char *ptr;
@@ -198,7 +202,7 @@
skb->mac.raw = skb->data;
skb->pkt_type = PACKET_HOST;
- netif_rx(skb);
+ return netif_rx(skb);
}
/*
@@ -418,6 +422,7 @@
memset(lapbeth, 0, sizeof(struct lapbethdev));
+ dev_hold(dev);
lapbeth->ethdev = dev;
lapbeth->ethname[sizeof(lapbeth->ethname)-1] = '\0';
@@ -436,6 +441,7 @@
}
if (k == MAXLAPBDEV) {
+ dev_put(dev);
kfree(lapbeth);
return -ENODEV;
}
@@ -445,6 +451,7 @@
dev->init = lapbeth_dev_init;
if (register_netdev(dev) != 0) {
+ dev_put(dev);
kfree(lapbeth);
return -EIO;
}
@@ -498,6 +505,7 @@
lapbeth_new_device(dev);
break;
+ case NETDEV_GOING_DOWN:
case NETDEV_DOWN: /* ethernet device closed -> close LAPB interface */
if ((dev = lapbeth_get_x25_dev(dev)) != NULL)
dev_close(dev);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)