Commit c5838f46 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://kernel.bkbits.net/jgarzik/net-drivers-2.5

into home.osdl.org:/home/torvalds/v2.5/linux
parents 74541720 f258f44a
...@@ -2068,13 +2068,14 @@ e100_rx_srv(struct e100_private *bdp) ...@@ -2068,13 +2068,14 @@ e100_rx_srv(struct e100_private *bdp)
skb->ip_summed = CHECKSUM_NONE; skb->ip_summed = CHECKSUM_NONE;
} }
bdp->drv_stats.net_stats.rx_bytes += skb->len;
if(bdp->vlgrp && (rfd_status & CB_STATUS_VLAN)) { if(bdp->vlgrp && (rfd_status & CB_STATUS_VLAN)) {
vlan_hwaccel_rx(skb, bdp->vlgrp, be16_to_cpu(rfd->vlanid)); vlan_hwaccel_rx(skb, bdp->vlgrp, be16_to_cpu(rfd->vlanid));
} else { } else {
netif_rx(skb); netif_rx(skb);
} }
dev->last_rx = jiffies; dev->last_rx = jiffies;
bdp->drv_stats.net_stats.rx_bytes += skb->len;
rfd_cnt++; rfd_cnt++;
} /* end of rfd loop */ } /* end of rfd loop */
......
...@@ -77,7 +77,6 @@ MODULE_PARM_DESC (rx_copybreak, "de2104x Breakpoint at which Rx packets are copi ...@@ -77,7 +77,6 @@ MODULE_PARM_DESC (rx_copybreak, "de2104x Breakpoint at which Rx packets are copi
#define DE_DEF_MSG_ENABLE (NETIF_MSG_DRV | \ #define DE_DEF_MSG_ENABLE (NETIF_MSG_DRV | \
NETIF_MSG_PROBE | \ NETIF_MSG_PROBE | \
NETIF_MSG_LINK | \ NETIF_MSG_LINK | \
NETIF_MSG_TIMER | \
NETIF_MSG_IFDOWN | \ NETIF_MSG_IFDOWN | \
NETIF_MSG_IFUP | \ NETIF_MSG_IFUP | \
NETIF_MSG_RX_ERR | \ NETIF_MSG_RX_ERR | \
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
/* Set the copy breakpoint for the copy-only-tiny-frames scheme. /* Set the copy breakpoint for the copy-only-tiny-frames scheme.
* Setting to > 1518 effectively disables this feature. * Setting to > 1518 effectively disables this feature.
*/ */
static int rx_copybreak = 0; static int rx_copybreak = 200;
/* end user-configurable values */ /* end user-configurable values */
...@@ -85,8 +85,8 @@ static const int multicast_filter_limit = 32; ...@@ -85,8 +85,8 @@ static const int multicast_filter_limit = 32;
#define PKT_BUF_SZ 1536 #define PKT_BUF_SZ 1536
#define DRV_MODULE_NAME "typhoon" #define DRV_MODULE_NAME "typhoon"
#define DRV_MODULE_VERSION "1.0" #define DRV_MODULE_VERSION "1.5.1"
#define DRV_MODULE_RELDATE "03/02/14" #define DRV_MODULE_RELDATE "03/06/26"
#define PFX DRV_MODULE_NAME ": " #define PFX DRV_MODULE_NAME ": "
#define ERR_PFX KERN_ERR PFX #define ERR_PFX KERN_ERR PFX
...@@ -150,7 +150,7 @@ struct typhoon_card_info { ...@@ -150,7 +150,7 @@ struct typhoon_card_info {
#define TYPHOON_CRYPTO_DES 1 #define TYPHOON_CRYPTO_DES 1
#define TYPHOON_CRYPTO_3DES 2 #define TYPHOON_CRYPTO_3DES 2
#define TYPHOON_CRYPTO_VARIABLE 4 #define TYPHOON_CRYPTO_VARIABLE 4
#define TYPHOON_FIBER 5 #define TYPHOON_FIBER 8
enum typhoon_cards { enum typhoon_cards {
TYPHOON_TX = 0, TYPHOON_TX95, TYPHOON_TX97, TYPHOON_SVR, TYPHOON_TX = 0, TYPHOON_TX95, TYPHOON_TX97, TYPHOON_SVR,
...@@ -1798,7 +1798,7 @@ typhoon_interrupt(int irq, void *dev_instance, struct pt_regs *rgs) ...@@ -1798,7 +1798,7 @@ typhoon_interrupt(int irq, void *dev_instance, struct pt_regs *rgs)
u32 intr_status; u32 intr_status;
intr_status = readl(ioaddr + TYPHOON_REG_INTR_STATUS); intr_status = readl(ioaddr + TYPHOON_REG_INTR_STATUS);
if(!intr_status) if(!(intr_status & TYPHOON_INTR_HOST_INT))
return IRQ_NONE; return IRQ_NONE;
writel(intr_status, ioaddr + TYPHOON_REG_INTR_STATUS); writel(intr_status, ioaddr + TYPHOON_REG_INTR_STATUS);
......
...@@ -2901,6 +2901,7 @@ static int setup_proc_entry( struct net_device *dev, ...@@ -2901,6 +2901,7 @@ static int setup_proc_entry( struct net_device *dev,
airo_entry); airo_entry);
apriv->proc_entry->uid = proc_uid; apriv->proc_entry->uid = proc_uid;
apriv->proc_entry->gid = proc_gid; apriv->proc_entry->gid = proc_gid;
apriv->proc_entry->owner = THIS_MODULE;
/* Setup the StatsDelta */ /* Setup the StatsDelta */
entry = create_proc_entry("StatsDelta", entry = create_proc_entry("StatsDelta",
...@@ -2909,6 +2910,7 @@ static int setup_proc_entry( struct net_device *dev, ...@@ -2909,6 +2910,7 @@ static int setup_proc_entry( struct net_device *dev,
entry->uid = proc_uid; entry->uid = proc_uid;
entry->gid = proc_gid; entry->gid = proc_gid;
entry->data = dev; entry->data = dev;
entry->owner = THIS_MODULE;
SETPROC_OPS(entry, proc_statsdelta_ops); SETPROC_OPS(entry, proc_statsdelta_ops);
/* Setup the Stats */ /* Setup the Stats */
...@@ -2918,6 +2920,7 @@ static int setup_proc_entry( struct net_device *dev, ...@@ -2918,6 +2920,7 @@ static int setup_proc_entry( struct net_device *dev,
entry->uid = proc_uid; entry->uid = proc_uid;
entry->gid = proc_gid; entry->gid = proc_gid;
entry->data = dev; entry->data = dev;
entry->owner = THIS_MODULE;
SETPROC_OPS(entry, proc_stats_ops); SETPROC_OPS(entry, proc_stats_ops);
/* Setup the Status */ /* Setup the Status */
...@@ -2927,6 +2930,7 @@ static int setup_proc_entry( struct net_device *dev, ...@@ -2927,6 +2930,7 @@ static int setup_proc_entry( struct net_device *dev,
entry->uid = proc_uid; entry->uid = proc_uid;
entry->gid = proc_gid; entry->gid = proc_gid;
entry->data = dev; entry->data = dev;
entry->owner = THIS_MODULE;
SETPROC_OPS(entry, proc_status_ops); SETPROC_OPS(entry, proc_status_ops);
/* Setup the Config */ /* Setup the Config */
...@@ -2936,6 +2940,7 @@ static int setup_proc_entry( struct net_device *dev, ...@@ -2936,6 +2940,7 @@ static int setup_proc_entry( struct net_device *dev,
entry->uid = proc_uid; entry->uid = proc_uid;
entry->gid = proc_gid; entry->gid = proc_gid;
entry->data = dev; entry->data = dev;
entry->owner = THIS_MODULE;
SETPROC_OPS(entry, proc_config_ops); SETPROC_OPS(entry, proc_config_ops);
/* Setup the SSID */ /* Setup the SSID */
...@@ -2945,6 +2950,7 @@ static int setup_proc_entry( struct net_device *dev, ...@@ -2945,6 +2950,7 @@ static int setup_proc_entry( struct net_device *dev,
entry->uid = proc_uid; entry->uid = proc_uid;
entry->gid = proc_gid; entry->gid = proc_gid;
entry->data = dev; entry->data = dev;
entry->owner = THIS_MODULE;
SETPROC_OPS(entry, proc_SSID_ops); SETPROC_OPS(entry, proc_SSID_ops);
/* Setup the APList */ /* Setup the APList */
...@@ -2954,6 +2960,7 @@ static int setup_proc_entry( struct net_device *dev, ...@@ -2954,6 +2960,7 @@ static int setup_proc_entry( struct net_device *dev,
entry->uid = proc_uid; entry->uid = proc_uid;
entry->gid = proc_gid; entry->gid = proc_gid;
entry->data = dev; entry->data = dev;
entry->owner = THIS_MODULE;
SETPROC_OPS(entry, proc_APList_ops); SETPROC_OPS(entry, proc_APList_ops);
/* Setup the BSSList */ /* Setup the BSSList */
...@@ -2963,6 +2970,7 @@ static int setup_proc_entry( struct net_device *dev, ...@@ -2963,6 +2970,7 @@ static int setup_proc_entry( struct net_device *dev,
entry->uid = proc_uid; entry->uid = proc_uid;
entry->gid = proc_gid; entry->gid = proc_gid;
entry->data = dev; entry->data = dev;
entry->owner = THIS_MODULE;
SETPROC_OPS(entry, proc_BSSList_ops); SETPROC_OPS(entry, proc_BSSList_ops);
/* Setup the WepKey */ /* Setup the WepKey */
...@@ -2972,6 +2980,7 @@ static int setup_proc_entry( struct net_device *dev, ...@@ -2972,6 +2980,7 @@ static int setup_proc_entry( struct net_device *dev,
entry->uid = proc_uid; entry->uid = proc_uid;
entry->gid = proc_gid; entry->gid = proc_gid;
entry->data = dev; entry->data = dev;
entry->owner = THIS_MODULE;
SETPROC_OPS(entry, proc_wepkey_ops); SETPROC_OPS(entry, proc_wepkey_ops);
return 0; return 0;
...@@ -3062,8 +3071,6 @@ static int proc_status_open( struct inode *inode, struct file *file ) { ...@@ -3062,8 +3071,6 @@ static int proc_status_open( struct inode *inode, struct file *file ) {
StatusRid status_rid; StatusRid status_rid;
int i; int i;
MOD_INC_USE_COUNT;
if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL)
return -ENOMEM; return -ENOMEM;
memset(file->private_data, 0, sizeof(struct proc_data)); memset(file->private_data, 0, sizeof(struct proc_data));
...@@ -3143,8 +3150,6 @@ static int proc_stats_rid_open( struct inode *inode, ...@@ -3143,8 +3150,6 @@ static int proc_stats_rid_open( struct inode *inode,
StatsRid stats; StatsRid stats;
int i, j; int i, j;
int *vals = stats.vals; int *vals = stats.vals;
MOD_INC_USE_COUNT;
if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL)
return -ENOMEM; return -ENOMEM;
...@@ -3421,8 +3426,6 @@ static int proc_config_open( struct inode *inode, struct file *file ) { ...@@ -3421,8 +3426,6 @@ static int proc_config_open( struct inode *inode, struct file *file ) {
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->priv;
int i; int i;
MOD_INC_USE_COUNT;
if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL)
return -ENOMEM; return -ENOMEM;
memset(file->private_data, 0, sizeof(struct proc_data)); memset(file->private_data, 0, sizeof(struct proc_data));
...@@ -3692,8 +3695,6 @@ static int proc_wepkey_open( struct inode *inode, struct file *file ) { ...@@ -3692,8 +3695,6 @@ static int proc_wepkey_open( struct inode *inode, struct file *file ) {
int j=0; int j=0;
int rc; int rc;
MOD_INC_USE_COUNT;
if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL)
return -ENOMEM; return -ENOMEM;
memset(file->private_data, 0, sizeof(struct proc_data)); memset(file->private_data, 0, sizeof(struct proc_data));
...@@ -3742,8 +3743,6 @@ static int proc_SSID_open( struct inode *inode, struct file *file ) { ...@@ -3742,8 +3743,6 @@ static int proc_SSID_open( struct inode *inode, struct file *file ) {
char *ptr; char *ptr;
SsidRid SSID_rid; SsidRid SSID_rid;
MOD_INC_USE_COUNT;
if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL)
return -ENOMEM; return -ENOMEM;
memset(file->private_data, 0, sizeof(struct proc_data)); memset(file->private_data, 0, sizeof(struct proc_data));
...@@ -3788,8 +3787,6 @@ static int proc_APList_open( struct inode *inode, struct file *file ) { ...@@ -3788,8 +3787,6 @@ static int proc_APList_open( struct inode *inode, struct file *file ) {
char *ptr; char *ptr;
APListRid APList_rid; APListRid APList_rid;
MOD_INC_USE_COUNT;
if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL)
return -ENOMEM; return -ENOMEM;
memset(file->private_data, 0, sizeof(struct proc_data)); memset(file->private_data, 0, sizeof(struct proc_data));
...@@ -3840,8 +3837,6 @@ static int proc_BSSList_open( struct inode *inode, struct file *file ) { ...@@ -3840,8 +3837,6 @@ static int proc_BSSList_open( struct inode *inode, struct file *file ) {
/* If doLoseSync is not 1, we won't do a Lose Sync */ /* If doLoseSync is not 1, we won't do a Lose Sync */
int doLoseSync = -1; int doLoseSync = -1;
MOD_INC_USE_COUNT;
if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL)
return -ENOMEM; return -ENOMEM;
memset(file->private_data, 0, sizeof(struct proc_data)); memset(file->private_data, 0, sizeof(struct proc_data));
...@@ -3904,7 +3899,6 @@ static int proc_close( struct inode *inode, struct file *file ) ...@@ -3904,7 +3899,6 @@ static int proc_close( struct inode *inode, struct file *file )
{ {
struct proc_data *data = (struct proc_data *)file->private_data; struct proc_data *data = (struct proc_data *)file->private_data;
if ( data->on_close != NULL ) data->on_close( inode, file ); if ( data->on_close != NULL ) data->on_close( inode, file );
MOD_DEC_USE_COUNT;
if ( data->rbuffer ) kfree( data->rbuffer ); if ( data->rbuffer ) kfree( data->rbuffer );
if ( data->wbuffer ) kfree( data->wbuffer ); if ( data->wbuffer ) kfree( data->wbuffer );
kfree( data ); kfree( data );
......
...@@ -321,7 +321,6 @@ struct site_survey { ...@@ -321,7 +321,6 @@ struct site_survey {
typedef struct netwave_private { typedef struct netwave_private {
dev_link_t link; dev_link_t link;
struct net_device dev;
spinlock_t spinlock; /* Serialize access to the hardware (SMP) */ spinlock_t spinlock; /* Serialize access to the hardware (SMP) */
dev_node_t node; dev_node_t node;
u_char *ramBase; u_char *ramBase;
...@@ -449,11 +448,13 @@ static dev_link_t *netwave_attach(void) ...@@ -449,11 +448,13 @@ static dev_link_t *netwave_attach(void)
netwave_flush_stale_links(); netwave_flush_stale_links();
/* Initialize the dev_link_t structure */ /* Initialize the dev_link_t structure */
priv = kmalloc(sizeof(*priv), GFP_KERNEL); dev = alloc_etherdev(sizeof(netwave_private));
if (!priv) return NULL; if (!dev)
memset(priv, 0, sizeof(*priv)); return NULL;
link = &priv->link; dev = &priv->dev; priv = dev->priv;
link->priv = dev->priv = priv; link = &priv->link;
link->priv = dev;
init_timer(&link->release); init_timer(&link->release);
link->release.function = &netwave_release; link->release.function = &netwave_release;
link->release.data = (u_long)link; link->release.data = (u_long)link;
...@@ -504,7 +505,6 @@ static dev_link_t *netwave_attach(void) ...@@ -504,7 +505,6 @@ static dev_link_t *netwave_attach(void)
dev->tx_timeout = &netwave_watchdog; dev->tx_timeout = &netwave_watchdog;
dev->watchdog_timeo = TX_TIMEOUT; dev->watchdog_timeo = TX_TIMEOUT;
ether_setup(dev);
dev->open = &netwave_open; dev->open = &netwave_open;
dev->stop = &netwave_close; dev->stop = &netwave_close;
link->irq.Instance = dev; link->irq.Instance = dev;
...@@ -541,7 +541,7 @@ static dev_link_t *netwave_attach(void) ...@@ -541,7 +541,7 @@ static dev_link_t *netwave_attach(void)
*/ */
static void netwave_detach(dev_link_t *link) static void netwave_detach(dev_link_t *link)
{ {
netwave_private *priv = link->priv; struct net_device *dev = link->priv;
dev_link_t **linkp; dev_link_t **linkp;
DEBUG(0, "netwave_detach(0x%p)\n", link); DEBUG(0, "netwave_detach(0x%p)\n", link);
...@@ -580,8 +580,8 @@ static void netwave_detach(dev_link_t *link) ...@@ -580,8 +580,8 @@ static void netwave_detach(dev_link_t *link)
/* Unlink device structure, free pieces */ /* Unlink device structure, free pieces */
*linkp = link->next; *linkp = link->next;
if (link->dev) if (link->dev)
unregister_netdev(&priv->dev); unregister_netdev(dev);
kfree(priv); kfree(dev);
} /* netwave_detach */ } /* netwave_detach */
...@@ -1038,8 +1038,8 @@ while ((last_ret=CardServices(last_fn=(fn), args))!=0) goto cs_failed ...@@ -1038,8 +1038,8 @@ while ((last_ret=CardServices(last_fn=(fn), args))!=0) goto cs_failed
static void netwave_pcmcia_config(dev_link_t *link) { static void netwave_pcmcia_config(dev_link_t *link) {
client_handle_t handle = link->handle; client_handle_t handle = link->handle;
netwave_private *priv = link->priv; struct net_device *dev = link->priv;
struct net_device *dev = &priv->dev; netwave_private *priv = dev->priv;
tuple_t tuple; tuple_t tuple;
cisparse_t parse; cisparse_t parse;
int i, j, last_ret, last_fn; int i, j, last_ret, last_fn;
...@@ -1099,7 +1099,7 @@ static void netwave_pcmcia_config(dev_link_t *link) { ...@@ -1099,7 +1099,7 @@ static void netwave_pcmcia_config(dev_link_t *link) {
* Allocate a 32K memory window. Note that the dev_link_t * Allocate a 32K memory window. Note that the dev_link_t
* structure provides space for one window handle -- if your * structure provides space for one window handle -- if your
* device needs several windows, you'll need to keep track of * device needs several windows, you'll need to keep track of
* the handles in your private data structure, link->priv. * the handles in your private data structure, dev->priv.
*/ */
DEBUG(1, "Setting mem speed of %d\n", mem_speed); DEBUG(1, "Setting mem speed of %d\n", mem_speed);
...@@ -1161,7 +1161,8 @@ static void netwave_pcmcia_config(dev_link_t *link) { ...@@ -1161,7 +1161,8 @@ static void netwave_pcmcia_config(dev_link_t *link) {
*/ */
static void netwave_release(u_long arg) { static void netwave_release(u_long arg) {
dev_link_t *link = (dev_link_t *)arg; dev_link_t *link = (dev_link_t *)arg;
netwave_private *priv = link->priv; struct net_device *dev = link->priv;
netwave_private *priv = dev->priv;
DEBUG(0, "netwave_release(0x%p)\n", link); DEBUG(0, "netwave_release(0x%p)\n", link);
...@@ -1206,8 +1207,7 @@ static void netwave_release(u_long arg) { ...@@ -1206,8 +1207,7 @@ static void netwave_release(u_long arg) {
static int netwave_event(event_t event, int priority, static int netwave_event(event_t event, int priority,
event_callback_args_t *args) { event_callback_args_t *args) {
dev_link_t *link = args->client_data; dev_link_t *link = args->client_data;
netwave_private *priv = link->priv; struct net_device *dev = link->priv;
struct net_device *dev = &priv->dev;
DEBUG(1, "netwave_event(0x%06x)\n", event); DEBUG(1, "netwave_event(0x%06x)\n", event);
......
...@@ -284,7 +284,7 @@ struct strip { ...@@ -284,7 +284,7 @@ struct strip {
*/ */
struct tty_struct *tty; /* ptr to TTY structure */ struct tty_struct *tty; /* ptr to TTY structure */
struct net_device dev; /* Our device structure */ struct net_device *dev; /* Our device structure */
/* /*
* Neighbour radio records * Neighbour radio records
...@@ -509,7 +509,7 @@ static void DumpData(char *msg, struct strip *strip_info, __u8 * ptr, ...@@ -509,7 +509,7 @@ static void DumpData(char *msg, struct strip *strip_info, __u8 * ptr,
*p++ = '\"'; *p++ = '\"';
*p++ = 0; *p++ = 0;
printk(KERN_INFO "%s: %-13s%s\n", strip_info->dev.name, msg, pkt_text); printk(KERN_INFO "%s: %-13s%s\n", strip_info->dev->name, msg, pkt_text);
} }
...@@ -846,7 +846,7 @@ static __u8 *radio_address_to_string(const MetricomAddress * addr, ...@@ -846,7 +846,7 @@ static __u8 *radio_address_to_string(const MetricomAddress * addr,
static int allocate_buffers(struct strip *strip_info) static int allocate_buffers(struct strip *strip_info)
{ {
struct net_device *dev = &strip_info->dev; struct net_device *dev = strip_info->dev;
int sx_size = MAX(STRIP_ENCAP_SIZE(MAX_RECV_MTU), 4096); int sx_size = MAX(STRIP_ENCAP_SIZE(MAX_RECV_MTU), 4096);
int tx_size = STRIP_ENCAP_SIZE(dev->mtu) + MaxCommandStringLength; int tx_size = STRIP_ENCAP_SIZE(dev->mtu) + MaxCommandStringLength;
__u8 *r = kmalloc(MAX_RECV_MTU, GFP_ATOMIC); __u8 *r = kmalloc(MAX_RECV_MTU, GFP_ATOMIC);
...@@ -881,7 +881,7 @@ static int allocate_buffers(struct strip *strip_info) ...@@ -881,7 +881,7 @@ static int allocate_buffers(struct strip *strip_info)
static void strip_changedmtu(struct strip *strip_info) static void strip_changedmtu(struct strip *strip_info)
{ {
int old_mtu = strip_info->mtu; int old_mtu = strip_info->mtu;
struct net_device *dev = &strip_info->dev; struct net_device *dev = strip_info->dev;
unsigned char *orbuff = strip_info->rx_buff; unsigned char *orbuff = strip_info->rx_buff;
unsigned char *osbuff = strip_info->sx_buff; unsigned char *osbuff = strip_info->sx_buff;
unsigned char *otbuff = strip_info->tx_buff; unsigned char *otbuff = strip_info->tx_buff;
...@@ -889,14 +889,14 @@ static void strip_changedmtu(struct strip *strip_info) ...@@ -889,14 +889,14 @@ static void strip_changedmtu(struct strip *strip_info)
if (dev->mtu > MAX_SEND_MTU) { if (dev->mtu > MAX_SEND_MTU) {
printk(KERN_ERR printk(KERN_ERR
"%s: MTU exceeds maximum allowable (%d), MTU change cancelled.\n", "%s: MTU exceeds maximum allowable (%d), MTU change cancelled.\n",
strip_info->dev.name, MAX_SEND_MTU); strip_info->dev->name, MAX_SEND_MTU);
dev->mtu = old_mtu; dev->mtu = old_mtu;
return; return;
} }
if (!allocate_buffers(strip_info)) { if (!allocate_buffers(strip_info)) {
printk(KERN_ERR "%s: unable to grow strip buffers, MTU change cancelled.\n", printk(KERN_ERR "%s: unable to grow strip buffers, MTU change cancelled.\n",
strip_info->dev.name); strip_info->dev->name);
dev->mtu = old_mtu; dev->mtu = old_mtu;
return; return;
} }
...@@ -923,7 +923,7 @@ static void strip_changedmtu(struct strip *strip_info) ...@@ -923,7 +923,7 @@ static void strip_changedmtu(struct strip *strip_info)
strip_info->tx_head = strip_info->tx_buff; strip_info->tx_head = strip_info->tx_buff;
printk(KERN_NOTICE "%s: strip MTU changed fom %d to %d.\n", printk(KERN_NOTICE "%s: strip MTU changed fom %d to %d.\n",
strip_info->dev.name, old_mtu, strip_info->mtu); strip_info->dev->name, old_mtu, strip_info->mtu);
if (orbuff) if (orbuff)
kfree(orbuff); kfree(orbuff);
...@@ -940,7 +940,7 @@ static void strip_unlock(struct strip *strip_info) ...@@ -940,7 +940,7 @@ static void strip_unlock(struct strip *strip_info)
*/ */
strip_info->idle_timer.expires = jiffies + 1 * HZ; strip_info->idle_timer.expires = jiffies + 1 * HZ;
add_timer(&strip_info->idle_timer); add_timer(&strip_info->idle_timer);
netif_wake_queue(&strip_info->dev); netif_wake_queue(strip_info->dev);
} }
...@@ -1087,10 +1087,10 @@ static int sprintf_status_info(char *buffer, struct strip *strip_info) ...@@ -1087,10 +1087,10 @@ static int sprintf_status_info(char *buffer, struct strip *strip_info)
FirmwareVersion firmware_version = strip_info->firmware_version; FirmwareVersion firmware_version = strip_info->firmware_version;
SerialNumber serial_number = strip_info->serial_number; SerialNumber serial_number = strip_info->serial_number;
BatteryVoltage battery_voltage = strip_info->battery_voltage; BatteryVoltage battery_voltage = strip_info->battery_voltage;
char *if_name = strip_info->dev.name; char *if_name = strip_info->dev->name;
MetricomAddress true_dev_addr = strip_info->true_dev_addr; MetricomAddress true_dev_addr = strip_info->true_dev_addr;
MetricomAddress dev_dev_addr = MetricomAddress dev_dev_addr =
*(MetricomAddress *) strip_info->dev.dev_addr; *(MetricomAddress *) strip_info->dev->dev_addr;
int manual_dev_addr = strip_info->manual_dev_addr; int manual_dev_addr = strip_info->manual_dev_addr;
#ifdef EXT_COUNTERS #ifdef EXT_COUNTERS
unsigned long rx_bytes = strip_info->rx_bytes; unsigned long rx_bytes = strip_info->rx_bytes;
...@@ -1133,7 +1133,7 @@ static int sprintf_status_info(char *buffer, struct strip *strip_info) ...@@ -1133,7 +1133,7 @@ static int sprintf_status_info(char *buffer, struct strip *strip_info)
p += sprintf(p, " Next gratuitous ARP:\t"); p += sprintf(p, " Next gratuitous ARP:\t");
if (!memcmp if (!memcmp
(strip_info->dev.dev_addr, zero_address.c, (strip_info->dev->dev_addr, zero_address.c,
sizeof(zero_address))) sizeof(zero_address)))
p += sprintf(p, "Disabled\n"); p += sprintf(p, "Disabled\n");
else { else {
...@@ -1210,7 +1210,7 @@ static void ResetRadio(struct strip *strip_info) ...@@ -1210,7 +1210,7 @@ static void ResetRadio(struct strip *strip_info)
*/ */
if (strip_info->working) { if (strip_info->working) {
printk(KERN_INFO "%s: No response: Resetting radio.\n", printk(KERN_INFO "%s: No response: Resetting radio.\n",
strip_info->dev.name); strip_info->dev->name);
strip_info->firmware_version.c[0] = '\0'; strip_info->firmware_version.c[0] = '\0';
strip_info->serial_number.c[0] = '\0'; strip_info->serial_number.c[0] = '\0';
strip_info->battery_voltage.c[0] = '\0'; strip_info->battery_voltage.c[0] = '\0';
...@@ -1231,7 +1231,7 @@ static void ResetRadio(struct strip *strip_info) ...@@ -1231,7 +1231,7 @@ static void ResetRadio(struct strip *strip_info)
/* Mark radio address as unknown */ /* Mark radio address as unknown */
*(MetricomAddress *) & strip_info->true_dev_addr = zero_address; *(MetricomAddress *) & strip_info->true_dev_addr = zero_address;
if (!strip_info->manual_dev_addr) if (!strip_info->manual_dev_addr)
*(MetricomAddress *) strip_info->dev.dev_addr = *(MetricomAddress *) strip_info->dev->dev_addr =
zero_address; zero_address;
strip_info->working = FALSE; strip_info->working = FALSE;
strip_info->firmware_level = NoStructure; strip_info->firmware_level = NoStructure;
...@@ -1285,7 +1285,7 @@ static void strip_write_some_more(struct tty_struct *tty) ...@@ -1285,7 +1285,7 @@ static void strip_write_some_more(struct tty_struct *tty)
/* First make sure we're connected. */ /* First make sure we're connected. */
if (!strip_info || strip_info->magic != STRIP_MAGIC || if (!strip_info || strip_info->magic != STRIP_MAGIC ||
!netif_running(&strip_info->dev)) !netif_running(strip_info->dev))
return; return;
if (strip_info->tx_left > 0) { if (strip_info->tx_left > 0) {
...@@ -1340,14 +1340,14 @@ static unsigned char *strip_make_packet(unsigned char *buffer, ...@@ -1340,14 +1340,14 @@ static unsigned char *strip_make_packet(unsigned char *buffer,
else { else {
printk(KERN_ERR printk(KERN_ERR
"%s: strip_make_packet: Unknown packet type 0x%04X\n", "%s: strip_make_packet: Unknown packet type 0x%04X\n",
strip_info->dev.name, ntohs(header->protocol)); strip_info->dev->name, ntohs(header->protocol));
return (NULL); return (NULL);
} }
if (len > strip_info->mtu) { if (len > strip_info->mtu) {
printk(KERN_ERR printk(KERN_ERR
"%s: Dropping oversized transmit packet: %d bytes\n", "%s: Dropping oversized transmit packet: %d bytes\n",
strip_info->dev.name, len); strip_info->dev->name, len);
return (NULL); return (NULL);
} }
...@@ -1357,7 +1357,7 @@ static unsigned char *strip_make_packet(unsigned char *buffer, ...@@ -1357,7 +1357,7 @@ static unsigned char *strip_make_packet(unsigned char *buffer,
*/ */
if (!memcmp(haddr.c, strip_info->true_dev_addr.c, sizeof(haddr))) { if (!memcmp(haddr.c, strip_info->true_dev_addr.c, sizeof(haddr))) {
printk(KERN_ERR "%s: Dropping packet addressed to self\n", printk(KERN_ERR "%s: Dropping packet addressed to self\n",
strip_info->dev.name); strip_info->dev->name);
return (NULL); return (NULL);
} }
...@@ -1367,7 +1367,7 @@ static unsigned char *strip_make_packet(unsigned char *buffer, ...@@ -1367,7 +1367,7 @@ static unsigned char *strip_make_packet(unsigned char *buffer,
*/ */
if (haddr.c[0] == 0xFF) { if (haddr.c[0] == 0xFF) {
u32 brd = 0; u32 brd = 0;
struct in_device *in_dev = in_dev_get(&strip_info->dev); struct in_device *in_dev = in_dev_get(strip_info->dev);
if (in_dev == NULL) if (in_dev == NULL)
return NULL; return NULL;
read_lock(&in_dev->lock); read_lock(&in_dev->lock);
...@@ -1377,10 +1377,10 @@ static unsigned char *strip_make_packet(unsigned char *buffer, ...@@ -1377,10 +1377,10 @@ static unsigned char *strip_make_packet(unsigned char *buffer,
in_dev_put(in_dev); in_dev_put(in_dev);
/* arp_query returns 1 if it succeeds in looking up the address, 0 if it fails */ /* arp_query returns 1 if it succeeds in looking up the address, 0 if it fails */
if (!arp_query(haddr.c, brd, &strip_info->dev)) { if (!arp_query(haddr.c, brd, strip_info->dev)) {
printk(KERN_ERR printk(KERN_ERR
"%s: Unable to send packet (no broadcast hub configured)\n", "%s: Unable to send packet (no broadcast hub configured)\n",
strip_info->dev.name); strip_info->dev->name);
return (NULL); return (NULL);
} }
/* /*
...@@ -1491,7 +1491,7 @@ static void strip_send(struct strip *strip_info, struct sk_buff *skb) ...@@ -1491,7 +1491,7 @@ static void strip_send(struct strip *strip_info, struct sk_buff *skb)
#endif #endif
strip_info->watchdog_doprobe = jiffies + 10 * HZ; strip_info->watchdog_doprobe = jiffies + 10 * HZ;
strip_info->watchdog_doreset = jiffies + 1 * HZ; strip_info->watchdog_doreset = jiffies + 1 * HZ;
/*printk(KERN_INFO "%s: Routine radio test.\n", strip_info->dev.name); */ /*printk(KERN_INFO "%s: Routine radio test.\n", strip_info->dev->name); */
} }
/* /*
...@@ -1506,7 +1506,7 @@ static void strip_send(struct strip *strip_info, struct sk_buff *skb) ...@@ -1506,7 +1506,7 @@ static void strip_send(struct strip *strip_info, struct sk_buff *skb)
*/ */
if (strip_info->tx_size - strip_info->tx_left < 20) if (strip_info->tx_size - strip_info->tx_left < 20)
printk(KERN_ERR "%s: Sending%5d bytes;%5d bytes free.\n", printk(KERN_ERR "%s: Sending%5d bytes;%5d bytes free.\n",
strip_info->dev.name, strip_info->tx_left, strip_info->dev->name, strip_info->tx_left,
strip_info->tx_size - strip_info->tx_left); strip_info->tx_size - strip_info->tx_left);
/* /*
...@@ -1519,7 +1519,7 @@ static void strip_send(struct strip *strip_info, struct sk_buff *skb) ...@@ -1519,7 +1519,7 @@ static void strip_send(struct strip *strip_info, struct sk_buff *skb)
} }
if (1) { if (1) {
struct in_device *in_dev = in_dev_get(&strip_info->dev); struct in_device *in_dev = in_dev_get(strip_info->dev);
brd = addr = 0; brd = addr = 0;
if (in_dev) { if (in_dev) {
read_lock(&in_dev->lock); read_lock(&in_dev->lock);
...@@ -1549,11 +1549,11 @@ static void strip_send(struct strip *strip_info, struct sk_buff *skb) ...@@ -1549,11 +1549,11 @@ static void strip_send(struct strip *strip_info, struct sk_buff *skb)
*/ */
if (strip_info->working if (strip_info->working
&& (long) jiffies - strip_info->gratuitous_arp >= 0 && (long) jiffies - strip_info->gratuitous_arp >= 0
&& memcmp(strip_info->dev.dev_addr, zero_address.c, && memcmp(strip_info->dev->dev_addr, zero_address.c,
sizeof(zero_address)) sizeof(zero_address))
&& arp_query(haddr.c, brd, &strip_info->dev)) { && arp_query(haddr.c, brd, strip_info->dev)) {
/*printk(KERN_INFO "%s: Sending gratuitous ARP with interval %ld\n", /*printk(KERN_INFO "%s: Sending gratuitous ARP with interval %ld\n",
strip_info->dev.name, strip_info->arp_interval / HZ); */ strip_info->dev->name, strip_info->arp_interval / HZ); */
strip_info->gratuitous_arp = strip_info->gratuitous_arp =
jiffies + strip_info->arp_interval; jiffies + strip_info->arp_interval;
strip_info->arp_interval *= 2; strip_info->arp_interval *= 2;
...@@ -1561,11 +1561,11 @@ static void strip_send(struct strip *strip_info, struct sk_buff *skb) ...@@ -1561,11 +1561,11 @@ static void strip_send(struct strip *strip_info, struct sk_buff *skb)
strip_info->arp_interval = MaxARPInterval; strip_info->arp_interval = MaxARPInterval;
if (addr) if (addr)
arp_send(ARPOP_REPLY, ETH_P_ARP, addr, /* Target address of ARP packet is our address */ arp_send(ARPOP_REPLY, ETH_P_ARP, addr, /* Target address of ARP packet is our address */
&strip_info->dev, /* Device to send packet on */ strip_info->dev, /* Device to send packet on */
addr, /* Source IP address this ARP packet comes from */ addr, /* Source IP address this ARP packet comes from */
NULL, /* Destination HW address is NULL (broadcast it) */ NULL, /* Destination HW address is NULL (broadcast it) */
strip_info->dev.dev_addr, /* Source HW address is our HW address */ strip_info->dev->dev_addr, /* Source HW address is our HW address */
strip_info->dev.dev_addr); /* Target HW address is our HW address (redundant) */ strip_info->dev->dev_addr); /* Target HW address is our HW address (redundant) */
} }
/* /*
...@@ -1608,18 +1608,18 @@ static int strip_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1608,18 +1608,18 @@ static int strip_xmit(struct sk_buff *skb, struct net_device *dev)
if (rx_pps_count / 8 >= 10) if (rx_pps_count / 8 >= 10)
printk(KERN_INFO "%s: WARNING: Receiving %ld packets per second.\n", printk(KERN_INFO "%s: WARNING: Receiving %ld packets per second.\n",
strip_info->dev.name, rx_pps_count / 8); strip_info->dev->name, rx_pps_count / 8);
if (tx_pps_count / 8 >= 10) if (tx_pps_count / 8 >= 10)
printk(KERN_INFO "%s: WARNING: Tx %ld packets per second.\n", printk(KERN_INFO "%s: WARNING: Tx %ld packets per second.\n",
strip_info->dev.name, tx_pps_count / 8); strip_info->dev->name, tx_pps_count / 8);
if (sx_pps_count / 8 >= 10) if (sx_pps_count / 8 >= 10)
printk(KERN_INFO "%s: WARNING: Sending %ld packets per second.\n", printk(KERN_INFO "%s: WARNING: Sending %ld packets per second.\n",
strip_info->dev.name, sx_pps_count / 8); strip_info->dev->name, sx_pps_count / 8);
} }
spin_lock_irqsave(&strip_lock, flags); spin_lock_irqsave(&strip_lock, flags);
/* See if someone has been ifconfigging */ /* See if someone has been ifconfigging */
if (strip_info->mtu != strip_info->dev.mtu) if (strip_info->mtu != strip_info->dev->mtu)
strip_changedmtu(strip_info); strip_changedmtu(strip_info);
strip_send(strip_info, skb); strip_send(strip_info, skb);
...@@ -1735,7 +1735,7 @@ static void get_radio_version(struct strip *strip_info, __u8 * ptr, __u8 * end) ...@@ -1735,7 +1735,7 @@ static void get_radio_version(struct strip *strip_info, __u8 * ptr, __u8 * end)
len = MIN(len, sizeof(FirmwareVersion) - 1); len = MIN(len, sizeof(FirmwareVersion) - 1);
if (strip_info->firmware_version.c[0] == 0) if (strip_info->firmware_version.c[0] == 0)
printk(KERN_INFO "%s: Radio Firmware: %.*s\n", printk(KERN_INFO "%s: Radio Firmware: %.*s\n",
strip_info->dev.name, len, value_begin); strip_info->dev->name, len, value_begin);
sprintf(strip_info->firmware_version.c, "%.*s", len, value_begin); sprintf(strip_info->firmware_version.c, "%.*s", len, value_begin);
/* Look for the first colon */ /* Look for the first colon */
...@@ -1806,10 +1806,10 @@ static int get_radio_address(struct strip *strip_info, __u8 * p) ...@@ -1806,10 +1806,10 @@ static int get_radio_address(struct strip *strip_info, __u8 * p)
MetricomAddressString addr_string; MetricomAddressString addr_string;
radio_address_to_string(&addr, &addr_string); radio_address_to_string(&addr, &addr_string);
printk(KERN_INFO "%s: Radio address = %s\n", printk(KERN_INFO "%s: Radio address = %s\n",
strip_info->dev.name, addr_string.c); strip_info->dev->name, addr_string.c);
strip_info->true_dev_addr = addr; strip_info->true_dev_addr = addr;
if (!strip_info->manual_dev_addr) if (!strip_info->manual_dev_addr)
*(MetricomAddress *) strip_info->dev.dev_addr = *(MetricomAddress *) strip_info->dev->dev_addr =
addr; addr;
/* Give the radio a few seconds to get its head straight, then send an arp */ /* Give the radio a few seconds to get its head straight, then send an arp */
strip_info->gratuitous_arp = jiffies + 15 * HZ; strip_info->gratuitous_arp = jiffies + 15 * HZ;
...@@ -1830,7 +1830,7 @@ static int verify_checksum(struct strip *strip_info) ...@@ -1830,7 +1830,7 @@ static int verify_checksum(struct strip *strip_info)
if (sum == 0 && strip_info->firmware_level == StructuredMessages) { if (sum == 0 && strip_info->firmware_level == StructuredMessages) {
strip_info->firmware_level = ChecksummedMessages; strip_info->firmware_level = ChecksummedMessages;
printk(KERN_INFO "%s: Radio provides message checksums\n", printk(KERN_INFO "%s: Radio provides message checksums\n",
strip_info->dev.name); strip_info->dev->name);
} }
return (sum == 0); return (sum == 0);
} }
...@@ -1849,7 +1849,7 @@ static void RecvErr_Message(struct strip *strip_info, __u8 * sendername, ...@@ -1849,7 +1849,7 @@ static void RecvErr_Message(struct strip *strip_info, __u8 * sendername,
if (has_prefix(msg, len, "001")) { /* Not in StarMode! */ if (has_prefix(msg, len, "001")) { /* Not in StarMode! */
RecvErr("Error Msg:", strip_info); RecvErr("Error Msg:", strip_info);
printk(KERN_INFO "%s: Radio %s is not in StarMode\n", printk(KERN_INFO "%s: Radio %s is not in StarMode\n",
strip_info->dev.name, sendername); strip_info->dev->name, sendername);
} }
else if (has_prefix(msg, len, "002")) { /* Remap handle */ else if (has_prefix(msg, len, "002")) { /* Remap handle */
...@@ -1859,7 +1859,7 @@ static void RecvErr_Message(struct strip *strip_info, __u8 * sendername, ...@@ -1859,7 +1859,7 @@ static void RecvErr_Message(struct strip *strip_info, __u8 * sendername,
else if (has_prefix(msg, len, "003")) { /* Can't resolve name */ else if (has_prefix(msg, len, "003")) { /* Can't resolve name */
RecvErr("Error Msg:", strip_info); RecvErr("Error Msg:", strip_info);
printk(KERN_INFO "%s: Destination radio name is unknown\n", printk(KERN_INFO "%s: Destination radio name is unknown\n",
strip_info->dev.name); strip_info->dev->name);
} }
else if (has_prefix(msg, len, "004")) { /* Name too small or missing */ else if (has_prefix(msg, len, "004")) { /* Name too small or missing */
...@@ -1876,7 +1876,7 @@ static void RecvErr_Message(struct strip *strip_info, __u8 * sendername, ...@@ -1876,7 +1876,7 @@ static void RecvErr_Message(struct strip *strip_info, __u8 * sendername,
if (!strip_info->working) { if (!strip_info->working) {
strip_info->working = TRUE; strip_info->working = TRUE;
printk(KERN_INFO "%s: Radio now in starmode\n", printk(KERN_INFO "%s: Radio now in starmode\n",
strip_info->dev.name); strip_info->dev->name);
/* /*
* If the radio has just entered a working state, we should do our first * If the radio has just entered a working state, we should do our first
* probe ASAP, so that we find out our radio address etc. without delay. * probe ASAP, so that we find out our radio address etc. without delay.
...@@ -1888,7 +1888,7 @@ static void RecvErr_Message(struct strip *strip_info, __u8 * sendername, ...@@ -1888,7 +1888,7 @@ static void RecvErr_Message(struct strip *strip_info, __u8 * sendername,
strip_info->next_command = 0; /* Try to enable checksums ASAP */ strip_info->next_command = 0; /* Try to enable checksums ASAP */
printk(KERN_INFO printk(KERN_INFO
"%s: Radio provides structured messages\n", "%s: Radio provides structured messages\n",
strip_info->dev.name); strip_info->dev->name);
} }
if (strip_info->firmware_level >= StructuredMessages) { if (strip_info->firmware_level >= StructuredMessages) {
/* /*
...@@ -1916,14 +1916,14 @@ static void RecvErr_Message(struct strip *strip_info, __u8 * sendername, ...@@ -1916,14 +1916,14 @@ static void RecvErr_Message(struct strip *strip_info, __u8 * sendername,
RecvErr("Error Msg:", strip_info); RecvErr("Error Msg:", strip_info);
printk(KERN_ERR printk(KERN_ERR
"%s: Error! Packet size too big for radio.\n", "%s: Error! Packet size too big for radio.\n",
strip_info->dev.name); strip_info->dev->name);
} }
else if (has_prefix(msg, len, "008")) { /* Bad character in name */ else if (has_prefix(msg, len, "008")) { /* Bad character in name */
RecvErr("Error Msg:", strip_info); RecvErr("Error Msg:", strip_info);
printk(KERN_ERR printk(KERN_ERR
"%s: Radio name contains illegal character\n", "%s: Radio name contains illegal character\n",
strip_info->dev.name); strip_info->dev->name);
} }
else if (has_prefix(msg, len, "009")) /* No count or line terminator */ else if (has_prefix(msg, len, "009")) /* No count or line terminator */
...@@ -1994,7 +1994,7 @@ static struct net_device *get_strip_dev(struct strip *strip_info) ...@@ -1994,7 +1994,7 @@ static struct net_device *get_strip_dev(struct strip *strip_info)
/* real radio hardware address, try to find another strip device that has been */ /* real radio hardware address, try to find another strip device that has been */
/* manually set to that address that we can 'transfer ownership' of this packet to */ /* manually set to that address that we can 'transfer ownership' of this packet to */
if (strip_info->manual_dev_addr && if (strip_info->manual_dev_addr &&
!memcmp(strip_info->dev.dev_addr, zero_address.c, !memcmp(strip_info->dev->dev_addr, zero_address.c,
sizeof(zero_address)) sizeof(zero_address))
&& memcmp(&strip_info->true_dev_addr, zero_address.c, && memcmp(&strip_info->true_dev_addr, zero_address.c,
sizeof(zero_address))) { sizeof(zero_address))) {
...@@ -2002,13 +2002,13 @@ static struct net_device *get_strip_dev(struct strip *strip_info) ...@@ -2002,13 +2002,13 @@ static struct net_device *get_strip_dev(struct strip *strip_info)
read_lock_bh(&dev_base_lock); read_lock_bh(&dev_base_lock);
dev = dev_base; dev = dev_base;
while (dev) { while (dev) {
if (dev->type == strip_info->dev.type && if (dev->type == strip_info->dev->type &&
!memcmp(dev->dev_addr, !memcmp(dev->dev_addr,
&strip_info->true_dev_addr, &strip_info->true_dev_addr,
sizeof(MetricomAddress))) { sizeof(MetricomAddress))) {
printk(KERN_INFO printk(KERN_INFO
"%s: Transferred packet ownership to %s.\n", "%s: Transferred packet ownership to %s.\n",
strip_info->dev.name, dev->name); strip_info->dev->name, dev->name);
read_unlock_bh(&dev_base_lock); read_unlock_bh(&dev_base_lock);
return (dev); return (dev);
} }
...@@ -2016,7 +2016,7 @@ static struct net_device *get_strip_dev(struct strip *strip_info) ...@@ -2016,7 +2016,7 @@ static struct net_device *get_strip_dev(struct strip *strip_info)
} }
read_unlock_bh(&dev_base_lock); read_unlock_bh(&dev_base_lock);
} }
return (&strip_info->dev); return (strip_info->dev);
} }
/* /*
...@@ -2029,7 +2029,7 @@ static void deliver_packet(struct strip *strip_info, STRIP_Header * header, ...@@ -2029,7 +2029,7 @@ static void deliver_packet(struct strip *strip_info, STRIP_Header * header,
struct sk_buff *skb = dev_alloc_skb(sizeof(STRIP_Header) + packetlen); struct sk_buff *skb = dev_alloc_skb(sizeof(STRIP_Header) + packetlen);
if (!skb) { if (!skb) {
printk(KERN_ERR "%s: memory squeeze, dropping packet.\n", printk(KERN_ERR "%s: memory squeeze, dropping packet.\n",
strip_info->dev.name); strip_info->dev->name);
strip_info->rx_dropped++; strip_info->rx_dropped++;
} else { } else {
memcpy(skb_put(skb, sizeof(STRIP_Header)), header, memcpy(skb_put(skb, sizeof(STRIP_Header)), header,
...@@ -2073,12 +2073,12 @@ static void process_IP_packet(struct strip *strip_info, ...@@ -2073,12 +2073,12 @@ static void process_IP_packet(struct strip *strip_info,
if (packetlen > MAX_RECV_MTU) { if (packetlen > MAX_RECV_MTU) {
printk(KERN_INFO "%s: Dropping oversized received IP packet: %d bytes\n", printk(KERN_INFO "%s: Dropping oversized received IP packet: %d bytes\n",
strip_info->dev.name, packetlen); strip_info->dev->name, packetlen);
strip_info->rx_dropped++; strip_info->rx_dropped++;
return; return;
} }
/*printk(KERN_INFO "%s: Got %d byte IP packet\n", strip_info->dev.name, packetlen); */ /*printk(KERN_INFO "%s: Got %d byte IP packet\n", strip_info->dev->name, packetlen); */
/* Decode remainder of the IP packet */ /* Decode remainder of the IP packet */
ptr = ptr =
...@@ -2117,13 +2117,13 @@ static void process_ARP_packet(struct strip *strip_info, ...@@ -2117,13 +2117,13 @@ static void process_ARP_packet(struct strip *strip_info,
if (packetlen > MAX_RECV_MTU) { if (packetlen > MAX_RECV_MTU) {
printk(KERN_INFO printk(KERN_INFO
"%s: Dropping oversized received ARP packet: %d bytes\n", "%s: Dropping oversized received ARP packet: %d bytes\n",
strip_info->dev.name, packetlen); strip_info->dev->name, packetlen);
strip_info->rx_dropped++; strip_info->rx_dropped++;
return; return;
} }
/*printk(KERN_INFO "%s: Got %d byte ARP %s\n", /*printk(KERN_INFO "%s: Got %d byte ARP %s\n",
strip_info->dev.name, packetlen, strip_info->dev->name, packetlen,
ntohs(arphdr->ar_op) == ARPOP_REQUEST ? "request" : "reply"); */ ntohs(arphdr->ar_op) == ARPOP_REQUEST ? "request" : "reply"); */
/* Decode remainder of the ARP packet */ /* Decode remainder of the ARP packet */
...@@ -2251,7 +2251,7 @@ static void process_message(struct strip *strip_info) ...@@ -2251,7 +2251,7 @@ static void process_message(struct strip *strip_info)
} }
} }
/*printk(KERN_INFO "%s: Got packet from \"%s\".\n", strip_info->dev.name, sendername); */ /*printk(KERN_INFO "%s: Got packet from \"%s\".\n", strip_info->dev->name, sendername); */
/* /*
* Fill in (pseudo) source and destination addresses in the packet. * Fill in (pseudo) source and destination addresses in the packet.
...@@ -2320,13 +2320,13 @@ static void strip_receive_buf(struct tty_struct *tty, const unsigned char *cp, ...@@ -2320,13 +2320,13 @@ static void strip_receive_buf(struct tty_struct *tty, const unsigned char *cp,
unsigned long flags; unsigned long flags;
if (!strip_info || strip_info->magic != STRIP_MAGIC if (!strip_info || strip_info->magic != STRIP_MAGIC
|| !netif_running(&strip_info->dev)) || !netif_running(strip_info->dev))
return; return;
spin_lock_irqsave(&strip_lock, flags); spin_lock_irqsave(&strip_lock, flags);
/* Argh! mtu change time! - costs us the packet part received at the change */ /* Argh! mtu change time! - costs us the packet part received at the change */
if (strip_info->mtu != strip_info->dev.mtu) if (strip_info->mtu != strip_info->dev->mtu)
strip_changedmtu(strip_info); strip_changedmtu(strip_info);
#if 0 #if 0
...@@ -2347,7 +2347,7 @@ static void strip_receive_buf(struct tty_struct *tty, const unsigned char *cp, ...@@ -2347,7 +2347,7 @@ static void strip_receive_buf(struct tty_struct *tty, const unsigned char *cp,
while (cp < end) { while (cp < end) {
if (fp && *fp) if (fp && *fp)
printk(KERN_INFO "%s: %s on serial port\n", printk(KERN_INFO "%s: %s on serial port\n",
strip_info->dev.name, TTYERROR(*fp)); strip_info->dev->name, TTYERROR(*fp));
if (fp && *fp++ && !strip_info->discard) { /* If there's a serial error, record it */ if (fp && *fp++ && !strip_info->discard) { /* If there's a serial error, record it */
/* If we have some characters in the buffer, discard them */ /* If we have some characters in the buffer, discard them */
strip_info->discard = strip_info->sx_count; strip_info->discard = strip_info->sx_count;
...@@ -2360,7 +2360,7 @@ static void strip_receive_buf(struct tty_struct *tty, const unsigned char *cp, ...@@ -2360,7 +2360,7 @@ static void strip_receive_buf(struct tty_struct *tty, const unsigned char *cp,
if (strip_info->sx_count > 3000) if (strip_info->sx_count > 3000)
printk(KERN_INFO printk(KERN_INFO
"%s: Cut a %d byte packet (%d bytes remaining)%s\n", "%s: Cut a %d byte packet (%d bytes remaining)%s\n",
strip_info->dev.name, strip_info->dev->name,
strip_info->sx_count, strip_info->sx_count,
end - cp - 1, end - cp - 1,
strip_info-> strip_info->
...@@ -2371,12 +2371,12 @@ static void strip_receive_buf(struct tty_struct *tty, const unsigned char *cp, ...@@ -2371,12 +2371,12 @@ static void strip_receive_buf(struct tty_struct *tty, const unsigned char *cp,
strip_info->rx_over_errors++; strip_info->rx_over_errors++;
printk(KERN_INFO printk(KERN_INFO
"%s: sx_buff overflow (%d bytes total)\n", "%s: sx_buff overflow (%d bytes total)\n",
strip_info->dev.name, strip_info->dev->name,
strip_info->sx_count); strip_info->sx_count);
} else if (strip_info->discard) } else if (strip_info->discard)
printk(KERN_INFO printk(KERN_INFO
"%s: Discarding bad packet (%d/%d)\n", "%s: Discarding bad packet (%d/%d)\n",
strip_info->dev.name, strip_info->dev->name,
strip_info->discard, strip_info->discard,
strip_info->sx_count); strip_info->sx_count);
else else
...@@ -2415,9 +2415,9 @@ static int set_mac_address(struct strip *strip_info, ...@@ -2415,9 +2415,9 @@ static int set_mac_address(struct strip *strip_info,
memcmp(addr->c, broadcast_address.c, memcmp(addr->c, broadcast_address.c,
sizeof(broadcast_address)); sizeof(broadcast_address));
if (strip_info->manual_dev_addr) if (strip_info->manual_dev_addr)
*(MetricomAddress *) strip_info->dev.dev_addr = *addr; *(MetricomAddress *) strip_info->dev->dev_addr = *addr;
else else
*(MetricomAddress *) strip_info->dev.dev_addr = *(MetricomAddress *) strip_info->dev->dev_addr =
strip_info->true_dev_addr; strip_info->true_dev_addr;
return 0; return 0;
} }
...@@ -2496,7 +2496,7 @@ static int strip_open_low(struct net_device *dev) ...@@ -2496,7 +2496,7 @@ static int strip_open_low(struct net_device *dev)
strip_info->user_baud = get_baud(strip_info->tty); strip_info->user_baud = get_baud(strip_info->tty);
printk(KERN_INFO "%s: Initializing Radio.\n", printk(KERN_INFO "%s: Initializing Radio.\n",
strip_info->dev.name); strip_info->dev->name);
ResetRadio(strip_info); ResetRadio(strip_info);
strip_info->idle_timer.expires = jiffies + 1 * HZ; strip_info->idle_timer.expires = jiffies + 1 * HZ;
add_timer(&strip_info->idle_timer); add_timer(&strip_info->idle_timer);
...@@ -2589,6 +2589,8 @@ static void strip_free(struct strip *strip_info) ...@@ -2589,6 +2589,8 @@ static void strip_free(struct strip *strip_info)
if (strip_info->next) if (strip_info->next)
strip_info->next->referrer = strip_info->referrer; strip_info->next->referrer = strip_info->referrer;
strip_info->magic = 0; strip_info->magic = 0;
if (strip_info->dev)
kfree(strip_info->dev);
kfree(strip_info); kfree(strip_info);
} }
...@@ -2600,6 +2602,7 @@ static struct strip *strip_alloc(void) ...@@ -2600,6 +2602,7 @@ static struct strip *strip_alloc(void)
{ {
int channel_id = 0; int channel_id = 0;
struct strip **s = &struct_strip_list; struct strip **s = &struct_strip_list;
struct net_device *dev;
struct strip *strip_info = (struct strip *) struct strip *strip_info = (struct strip *)
kmalloc(sizeof(struct strip), GFP_KERNEL); kmalloc(sizeof(struct strip), GFP_KERNEL);
...@@ -2612,13 +2615,22 @@ static struct strip *strip_alloc(void) ...@@ -2612,13 +2615,22 @@ static struct strip *strip_alloc(void)
memset(strip_info, 0, sizeof(struct strip)); memset(strip_info, 0, sizeof(struct strip));
/* allocate the net_device */
dev = kmalloc(sizeof(struct net_device), GFP_KERNEL);
if (!dev) {
kfree(strip_info);
return NULL;
}
strip_info->dev = dev;
SET_MODULE_OWNER(dev);
/* /*
* Search the list to find where to put our new entry * Search the list to find where to put our new entry
* (and in the process decide what channel number it is * (and in the process decide what channel number it is
* going to be) * going to be)
*/ */
while (*s && (*s)->dev.base_addr == channel_id) { while (*s && (*s)->dev->base_addr == channel_id) {
channel_id++; channel_id++;
s = &(*s)->next; s = &(*s)->next;
} }
...@@ -2639,15 +2651,15 @@ static struct strip *strip_alloc(void) ...@@ -2639,15 +2651,15 @@ static struct strip *strip_alloc(void)
strip_info->gratuitous_arp = jiffies + LongTime; strip_info->gratuitous_arp = jiffies + LongTime;
strip_info->arp_interval = 0; strip_info->arp_interval = 0;
init_timer(&strip_info->idle_timer); init_timer(&strip_info->idle_timer);
strip_info->idle_timer.data = (long) &strip_info->dev; strip_info->idle_timer.data = (long) dev;
strip_info->idle_timer.function = strip_IdleTask; strip_info->idle_timer.function = strip_IdleTask;
/* Note: strip_info->if_name is currently 8 characters long */ /* Note: strip_info->if_name is currently 8 characters long */
sprintf(strip_info->dev.name, "st%d", channel_id); sprintf(dev->name, "st%d", channel_id);
strip_info->dev.base_addr = channel_id; dev->base_addr = channel_id;
strip_info->dev.priv = (void *) strip_info; dev->priv = (void *) strip_info;
strip_info->dev.next = NULL; dev->next = NULL;
strip_info->dev.init = strip_dev_init; dev->init = strip_dev_init;
return strip_info; return strip_info;
} }
...@@ -2682,7 +2694,7 @@ static int strip_open(struct tty_struct *tty) ...@@ -2682,7 +2694,7 @@ static int strip_open(struct tty_struct *tty)
* strip_dev_init() will be called as a side-effect * strip_dev_init() will be called as a side-effect
*/ */
if (register_netdev(&strip_info->dev) != 0) { if (register_netdev(strip_info->dev) != 0) {
printk(KERN_ERR "strip: register_netdev() failed.\n"); printk(KERN_ERR "strip: register_netdev() failed.\n");
strip_free(strip_info); strip_free(strip_info);
return -ENFILE; return -ENFILE;
...@@ -2699,7 +2711,7 @@ static int strip_open(struct tty_struct *tty) ...@@ -2699,7 +2711,7 @@ static int strip_open(struct tty_struct *tty)
* Restore default settings * Restore default settings
*/ */
strip_info->dev.type = ARPHRD_METRICOM; /* dtang */ strip_info->dev->type = ARPHRD_METRICOM; /* dtang */
/* /*
* Set tty options * Set tty options
...@@ -2709,15 +2721,13 @@ static int strip_open(struct tty_struct *tty) ...@@ -2709,15 +2721,13 @@ static int strip_open(struct tty_struct *tty)
tty->termios->c_cflag |= CLOCAL; /* Ignore modem control signals. */ tty->termios->c_cflag |= CLOCAL; /* Ignore modem control signals. */
tty->termios->c_cflag &= ~HUPCL; /* Don't close on hup */ tty->termios->c_cflag &= ~HUPCL; /* Don't close on hup */
MOD_INC_USE_COUNT;
printk(KERN_INFO "STRIP: device \"%s\" activated\n", printk(KERN_INFO "STRIP: device \"%s\" activated\n",
strip_info->dev.name); strip_info->dev->name);
/* /*
* Done. We have linked the TTY line to a channel. * Done. We have linked the TTY line to a channel.
*/ */
return (strip_info->dev.base_addr); return (strip_info->dev->base_addr);
} }
/* /*
...@@ -2738,15 +2748,14 @@ static void strip_close(struct tty_struct *tty) ...@@ -2738,15 +2748,14 @@ static void strip_close(struct tty_struct *tty)
if (!strip_info || strip_info->magic != STRIP_MAGIC) if (!strip_info || strip_info->magic != STRIP_MAGIC)
return; return;
unregister_netdev(&strip_info->dev); unregister_netdev(strip_info->dev);
tty->disc_data = 0; tty->disc_data = 0;
strip_info->tty = NULL; strip_info->tty = NULL;
printk(KERN_INFO "STRIP: device \"%s\" closed down\n", printk(KERN_INFO "STRIP: device \"%s\" closed down\n",
strip_info->dev.name); strip_info->dev->name);
strip_free(strip_info); strip_free(strip_info);
tty->disc_data = NULL; tty->disc_data = NULL;
MOD_DEC_USE_COUNT;
} }
...@@ -2767,13 +2776,13 @@ static int strip_ioctl(struct tty_struct *tty, struct file *file, ...@@ -2767,13 +2776,13 @@ static int strip_ioctl(struct tty_struct *tty, struct file *file,
switch (cmd) { switch (cmd) {
case SIOCGIFNAME: case SIOCGIFNAME:
if(copy_to_user((void *) arg, strip_info->dev.name, strlen(strip_info->dev.name) + 1)) if(copy_to_user((void *) arg, strip_info->dev->name, strlen(strip_info->dev->name) + 1))
return -EFAULT; return -EFAULT;
break; break;
case SIOCSIFHWADDR: case SIOCSIFHWADDR:
{ {
MetricomAddress addr; MetricomAddress addr;
//printk(KERN_INFO "%s: SIOCSIFHWADDR\n", strip_info->dev.name); //printk(KERN_INFO "%s: SIOCSIFHWADDR\n", strip_info->dev->name);
if(copy_from_user(&addr, (void *) arg, sizeof(MetricomAddress))) if(copy_from_user(&addr, (void *) arg, sizeof(MetricomAddress)))
return -EFAULT; return -EFAULT;
return set_mac_address(strip_info, &addr); return set_mac_address(strip_info, &addr);
......
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