From: Michal Schmidt <mschmidt@redhat.com>
To: Matteo Croce <rootkit85@yahoo.it>
Cc: linux-wireless@vger.kernel.org
Subject: Re: airo
Date: Mon, 25 Jun 2007 16:38:26 +0200 [thread overview]
Message-ID: <467FD362.8000602@redhat.com> (raw)
In-Reply-To: <200706091816.47618.rootkit85@yahoo.it>
Matteo Croce wrote:
> after booting i have this situation:
>
> root@raver:~# lsmod |fgrep airo
> airo 80016 0
> root@raver:~# dmesg |fgrep airo
> airo(): Probing for PCI adapters
> airo(eth1): cmd:111 status:7f11 rsp0:2 rsp1:0 rsp2:0
> airo(eth1): Doing fast bap_reads
> airo(eth1): WPA is supported.
> airo(eth1): Couldn't register_netdev
> airo(): Finished probing for PCI adapters
> root@raver:~#
>
> I have to do this to connect:
>
> root@raver:~# rmmod airo
> root@raver:~# modprobe airo
> root@raver:~# dmesg |fgrep airo
> airo(): Probing for PCI adapters
> airo(eth1): cmd:111 status:7f11 rsp0:2 rsp1:0 rsp2:0
> airo(eth1): Doing fast bap_reads
> airo(eth1): WPA is supported.
> airo(eth1): Couldn't register_netdev
> airo(): Finished probing for PCI adapters
> airo(): Probing for PCI adapters
> airo(eth0): cmd:111 status:7f11 rsp0:2 rsp1:0 rsp2:0
> airo(eth0): Doing fast bap_reads
> airo(eth0): WPA is supported.
> airo(eth0): MAC enabled 0:d:29:4f:c:be
> airo(): Finished probing for PCI adapters
> root@raver:~#
>
Hi Matteo,
It looks like some other network interface gets renamed from "eth0" to
"eth1" at the same time the airo driver is initializing the card. Does
it happen always after booting? Do you have other network interfaces?
This patch should fix it. Can you test it?
Michal
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 2d3a180..1a350b3 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -41,6 +41,7 @@
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
+#include <linux/rtnetlink.h>
#include <linux/skbuff.h>
#include <linux/if_arp.h>
#include <linux/ioport.h>
@@ -2802,10 +2803,6 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
airo_print_err("", "Couldn't alloc_etherdev");
return NULL;
}
- if (dev_alloc_name(dev, dev->name) < 0) {
- airo_print_err("", "Couldn't get name!");
- goto err_out_free;
- }
ai = dev->priv;
ai->wifidev = NULL;
@@ -2813,7 +2810,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
ai->jobs = 0;
ai->dev = dev;
if (pci && (pci->device == 0x5000 || pci->device == 0xa504)) {
- airo_print_dbg(dev->name, "Found an MPI350 card");
+ airo_print_dbg("", "Found an MPI350 card");
set_bit(FLAG_MPI, &ai->flags);
}
spin_lock_init(&ai->aux_lock);
@@ -2821,14 +2818,11 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
ai->config.len = 0;
ai->pci = pci;
init_waitqueue_head (&ai->thr_wait);
- ai->airo_thread_task = kthread_run(airo_thread, dev, dev->name);
- if (IS_ERR(ai->airo_thread_task))
- goto err_out_free;
ai->tfm = NULL;
add_airo_dev(ai);
if (airo_networks_allocate (ai))
- goto err_out_thr;
+ goto err_out_free;
airo_networks_initialize (ai);
/* The Airo-specific entries in the device structure. */
@@ -2855,16 +2849,31 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
reset_card (dev, 1);
msleep(400);
+ rtnl_lock(); /* Makes sure no device registers our name. */
+ if (dev_alloc_name(dev, dev->name) < 0) {
+ airo_print_err("", "Couldn't get name!");
+ rtnl_unlock();
+ goto err_out_nets;
+ }
+
+ ai->airo_thread_task = kthread_run(airo_thread, dev, dev->name);
+ if (IS_ERR(ai->airo_thread_task)) {
+ rtnl_unlock();
+ goto err_out_nets;
+ }
+
rc = request_irq( dev->irq, airo_interrupt, IRQF_SHARED, dev->name, dev );
if (rc) {
airo_print_err(dev->name, "register interrupt %d failed, rc %d",
irq, rc);
- goto err_out_nets;
+ rtnl_unlock();
+ goto err_out_thr;
}
if (!is_pcmcia) {
if (!request_region( dev->base_addr, 64, dev->name )) {
rc = -EBUSY;
airo_print_err(dev->name, "Couldn't request region");
+ rtnl_unlock();
goto err_out_irq;
}
}
@@ -2872,6 +2881,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
if (test_bit(FLAG_MPI,&ai->flags)) {
if (mpi_map_card(ai, pci, dev->name)) {
airo_print_err(dev->name, "Could not map memory");
+ rtnl_unlock();
goto err_out_res;
}
}
@@ -2880,6 +2890,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
if ( setup_card( ai, dev->dev_addr, 1 ) != SUCCESS ) {
airo_print_err(dev->name, "MAC could not be enabled" );
rc = -EIO;
+ rtnl_unlock();
goto err_out_map;
}
} else if (!test_bit(FLAG_MPI,&ai->flags)) {
@@ -2899,9 +2910,10 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
ai->bssListRidLen = sizeof(BSSListRid) - sizeof(BSSListRidExtra);
}
- rc = register_netdev(dev);
+ rc = register_netdevice(dev);
+ rtnl_unlock();
if (rc) {
- airo_print_err(dev->name, "Couldn't register_netdev");
+ airo_print_err(dev->name, "Couldn't register_netdevice");
goto err_out_map;
}
ai->wifidev = init_wifidev(ai, dev);
@@ -2942,13 +2954,13 @@ err_out_res:
release_region( dev->base_addr, 64 );
err_out_irq:
free_irq(dev->irq, dev);
-err_out_nets:
- airo_networks_free(ai);
err_out_thr:
- del_airo_dev(ai);
set_bit(JOB_DIE, &ai->jobs);
kthread_stop(ai->airo_thread_task);
+err_out_nets:
+ airo_networks_free(ai);
err_out_free:
+ del_airo_dev(ai);
free_netdev(dev);
return NULL;
}
next prev parent reply other threads:[~2007-06-25 14:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200706061903.13228.rootkit85@yahoo.it>
[not found] ` <46693003.8090406@redhat.com>
[not found] ` <200706091519.29319.rootkit85@yahoo.it>
2007-06-09 16:16 ` airo Matteo Croce
2007-06-25 14:38 ` Michal Schmidt [this message]
2007-06-25 15:05 ` airo Dan Williams
2007-06-25 15:17 ` airo Michal Schmidt
2007-06-25 15:48 ` airo Michal Schmidt
2007-06-25 19:27 ` airo Matteo Croce
2007-06-25 19:50 ` airo Larry Finger
2007-06-25 21:10 ` airo Dan Williams
2007-06-27 1:58 ` airo Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=467FD362.8000602@redhat.com \
--to=mschmidt@redhat.com \
--cc=linux-wireless@vger.kernel.org \
--cc=rootkit85@yahoo.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).