git://ftp.safe.ca
/
safe
/
jmp
/
linux-2.6
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[safe/jmp/linux-2.6]
/
drivers
/
net
/
wan
/
lapbether.c
diff --git
a/drivers/net/wan/lapbether.c
b/drivers/net/wan/lapbether.c
index
5b61b3e
..
4d4dc38
100644
(file)
--- a/
drivers/net/wan/lapbether.c
+++ b/
drivers/net/wan/lapbether.c
@@
-24,6
+24,7
@@
#include <linux/types.h>
#include <linux/socket.h>
#include <linux/in.h>
#include <linux/types.h>
#include <linux/socket.h>
#include <linux/in.h>
+#include <linux/slab.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/net.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/net.h>
@@
-55,7
+56,6
@@
struct lapbethdev {
struct list_head node;
struct net_device *ethdev; /* link to ethernet device */
struct net_device *axdev; /* lapbeth device (lapb#) */
struct list_head node;
struct net_device *ethdev; /* link to ethernet device */
struct net_device *axdev; /* lapbeth device (lapb#) */
- struct net_device_stats stats; /* some statistics */
};
static LIST_HEAD(lapbeth_devices);
};
static LIST_HEAD(lapbeth_devices);
@@
-107,10
+107,9
@@
static int lapbeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
if (!netif_running(lapbeth->axdev))
goto drop_unlock;
if (!netif_running(lapbeth->axdev))
goto drop_unlock;
- lapbeth->stats.rx_packets++;
-
len = skb->data[0] + skb->data[1] * 256;
len = skb->data[0] + skb->data[1] * 256;
- lapbeth->stats.rx_bytes += len;
+ dev->stats.rx_packets++;
+ dev->stats.rx_bytes += len;
skb_pull(skb, 2); /* Remove the length bytes */
skb_trim(skb, len); /* Set the length of the data */
skb_pull(skb, 2); /* Remove the length bytes */
skb_trim(skb, len); /* Set the length of the data */
@@
-140,7
+139,7
@@
static int lapbeth_data_indication(struct net_device *dev, struct sk_buff *skb)
return NET_RX_DROP;
ptr = skb->data;
return NET_RX_DROP;
ptr = skb->data;
- *ptr =
0x00
;
+ *ptr =
X25_IFACE_DATA
;
skb->protocol = x25_type_trans(skb, dev);
return netif_rx(skb);
skb->protocol = x25_type_trans(skb, dev);
return netif_rx(skb);
@@
-149,48
+148,43
@@
static int lapbeth_data_indication(struct net_device *dev, struct sk_buff *skb)
/*
* Send a LAPB frame via an ethernet interface
*/
/*
* Send a LAPB frame via an ethernet interface
*/
-static int lapbeth_xmit(struct sk_buff *skb, struct net_device *dev)
+static netdev_tx_t lapbeth_xmit(struct sk_buff *skb,
+ struct net_device *dev)
{
{
- int err
= -ENODEV
;
+ int err;
/*
* Just to be *really* sure not to send anything if the interface
* is down, the ethernet device may have gone.
*/
/*
* Just to be *really* sure not to send anything if the interface
* is down, the ethernet device may have gone.
*/
- if (!netif_running(dev))
{
+ if (!netif_running(dev))
goto drop;
goto drop;
- }
switch (skb->data[0]) {
switch (skb->data[0]) {
- case 0x00:
- err = 0;
+ case X25_IFACE_DATA:
break;
break;
- case
0x01
:
+ case
X25_IFACE_CONNECT
:
if ((err = lapb_connect_request(dev)) != LAPB_OK)
printk(KERN_ERR "lapbeth: lapb_connect_request "
"error: %d\n", err);
if ((err = lapb_connect_request(dev)) != LAPB_OK)
printk(KERN_ERR "lapbeth: lapb_connect_request "
"error: %d\n", err);
- goto drop
_ok
;
- case
0x02
:
+ goto drop;
+ case
X25_IFACE_DISCONNECT
:
if ((err = lapb_disconnect_request(dev)) != LAPB_OK)
printk(KERN_ERR "lapbeth: lapb_disconnect_request "
"err: %d\n", err);
/* Fall thru */
default:
if ((err = lapb_disconnect_request(dev)) != LAPB_OK)
printk(KERN_ERR "lapbeth: lapb_disconnect_request "
"err: %d\n", err);
/* Fall thru */
default:
- goto drop
_ok
;
+ goto drop;
}
skb_pull(skb, 1);
if ((err = lapb_data_request(dev, skb)) != LAPB_OK) {
printk(KERN_ERR "lapbeth: lapb_data_request error - %d\n", err);
}
skb_pull(skb, 1);
if ((err = lapb_data_request(dev, skb)) != LAPB_OK) {
printk(KERN_ERR "lapbeth: lapb_data_request error - %d\n", err);
- err = -ENOMEM;
goto drop;
}
goto drop;
}
- err = 0;
out:
out:
- return err;
-drop_ok:
- err = 0;
+ return NETDEV_TX_OK;
drop:
kfree_skb(skb);
goto out;
drop:
kfree_skb(skb);
goto out;
@@
-210,8
+204,8
@@
static void lapbeth_data_transmit(struct net_device *ndev, struct sk_buff *skb)
*ptr++ = size % 256;
*ptr++ = size / 256;
*ptr++ = size % 256;
*ptr++ = size / 256;
-
lapbeth
->stats.tx_packets++;
-
lapbeth
->stats.tx_bytes += size;
+
ndev
->stats.tx_packets++;
+
ndev
->stats.tx_bytes += size;
skb->dev = dev = lapbeth->ethdev;
skb->dev = dev = lapbeth->ethdev;
@@
-231,7
+225,7
@@
static void lapbeth_connected(struct net_device *dev, int reason)
}
ptr = skb_put(skb, 1);
}
ptr = skb_put(skb, 1);
- *ptr =
0x01
;
+ *ptr =
X25_IFACE_CONNECT
;
skb->protocol = x25_type_trans(skb, dev);
netif_rx(skb);
skb->protocol = x25_type_trans(skb, dev);
netif_rx(skb);
@@
-248,22
+242,13
@@
static void lapbeth_disconnected(struct net_device *dev, int reason)
}
ptr = skb_put(skb, 1);
}
ptr = skb_put(skb, 1);
- *ptr =
0x02
;
+ *ptr =
X25_IFACE_DISCONNECT
;
skb->protocol = x25_type_trans(skb, dev);
netif_rx(skb);
}
/*
skb->protocol = x25_type_trans(skb, dev);
netif_rx(skb);
}
/*
- * Statistics
- */
-static struct net_device_stats *lapbeth_get_stats(struct net_device *dev)
-{
- struct lapbethdev *lapbeth = netdev_priv(dev);
- return &lapbeth->stats;
-}
-
-/*
* Set AX.25 callsign
*/
static int lapbeth_set_mac_address(struct net_device *dev, void *addr)
* Set AX.25 callsign
*/
static int lapbeth_set_mac_address(struct net_device *dev, void *addr)
@@
-314,14
+299,17
@@
static int lapbeth_close(struct net_device *dev)
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
+static const struct net_device_ops lapbeth_netdev_ops = {
+ .ndo_open = lapbeth_open,
+ .ndo_stop = lapbeth_close,
+ .ndo_start_xmit = lapbeth_xmit,
+ .ndo_set_mac_address = lapbeth_set_mac_address,
+};
+
static void lapbeth_setup(struct net_device *dev)
{
static void lapbeth_setup(struct net_device *dev)
{
- dev->hard_start_xmit = lapbeth_xmit;
- dev->open = lapbeth_open;
- dev->stop = lapbeth_close;
+ dev->netdev_ops = &lapbeth_netdev_ops;
dev->destructor = free_netdev;
dev->destructor = free_netdev;
- dev->set_mac_address = lapbeth_set_mac_address;
- dev->get_stats = lapbeth_get_stats;
dev->type = ARPHRD_X25;
dev->hard_header_len = 3;
dev->mtu = 1000;
dev->type = ARPHRD_X25;
dev->hard_header_len = 3;
dev->mtu = 1000;
@@
-421,8
+409,8
@@
static int lapbeth_device_event(struct notifier_block *this,
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
-static struct packet_type lapbeth_packet_type = {
- .type =
__constant_htons
(ETH_P_DEC),
+static struct packet_type lapbeth_packet_type
__read_mostly
= {
+ .type =
cpu_to_be16
(ETH_P_DEC),
.func = lapbeth_rcv,
};
.func = lapbeth_rcv,
};
@@
-430,7
+418,8
@@
static struct notifier_block lapbeth_dev_notifier = {
.notifier_call = lapbeth_device_event,
};
.notifier_call = lapbeth_device_event,
};
-static char banner[] __initdata = KERN_INFO "LAPB Ethernet driver version 0.02\n";
+static const char banner[] __initconst =
+ KERN_INFO "LAPB Ethernet driver version 0.02\n";
static int __init lapbeth_init_driver(void)
{
static int __init lapbeth_init_driver(void)
{