Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Aug 2017 12:46:22 +0300
From:      "Andriy Voskoboinyk" <s3erios@gmail.com>
To:        "Adrian Chadd" <adrian.chadd@gmail.com>, "Farhan Khan" <khanzf@gmail.com>
Cc:        "freebsd-wireless@freebsd.org" <freebsd-wireless@freebsd.org>
Subject:   Re: Why is rtwn module detaching?
Message-ID:  <op.y4wlfkneiew4ia@thinkpad-x220>
In-Reply-To: <CAFd4kYDygU732QknZmDeq2BtEvd3Le2iX80uEh%2BZ0xQ7GrUWBA@mail.gmail.com>
References:  <CAFd4kYAzzoOG4mrdnxZduFjBR5JsiPf=SGjqtkSqRCMz5qfiSQ@mail.gmail.com> <CAJ-VmonkJWk0yqBvmCwoWFHynPxRWo9SSg7wS64YD1gNs-Jpig@mail.gmail.com> <CAFd4kYDygU732QknZmDeq2BtEvd3Le2iX80uEh%2BZ0xQ7GrUWBA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Sun, 13 Aug 2017 04:09:45 +0300 =D0=B1=D1=83=D0=BB=D0=BE =D0=BD=D0=B0=D0=
=BF=D0=B8=D1=81=D0=B0=D0=BD=D0=BE Farhan Khan  =

<khanzf@gmail.com>:

Sounds like rtwn_init() fails somewhere - I would try to 'ifdef' out
various routines from the end of it (e.g., everything but rtwn_power_on(=
),
then rtwn_load_firmware(), rtwn_mac_init() etc.) to see where is the  =

problem.

P.S. One thing that can be done without recompilation - try to move the
firmware away and load the driver without it (it should start normally,
rtl8188e* does not use it currently).

> Following up on this from earlier:
>
> I am trying to extend the sys/dev/rtwn/rtl8188e driver to support PCI.=

> Linux calls this rtl8188ee.
> Right now, my code loads, reads the ROM, and will create an interface =
 =

> with:
>
> ifconfig wlan0 create wlandev rtwn0
>
> But when I assign an IP address, it immediately detaches. I have not b=
een
> able to figure out why this is happening and I cannot continue develop=
ing
> this driver, despite a few weeks of tracing the code.
>
> Some clues:
>
> I found that rtwn_parent() will trigger rtwn_stop() if ic->ic_nrunning=
 is
> less than 0. That value is incremented in ieee80211_start_locked() and=

> decremented in ieee80211_stop_locked().
>
> I used stack_print(9), which show that ieee80211_stop_locked() is  =

> executed
> at least 4 times, but the trace's originate with a device_detach() in =
the
> first place. What is causing that in the first place?
>
> So, why is my driver unloading?
> Because ic->ic_nrunning is less than 0.
> Why is ic->ic_nrunning less than 0? Because something is calling
> ieee80211_stop_locked().
>
> I have no direction on what the issue may be and have been just search=
ing
> for an extended period now. Any assistance would be highly appreciated=
.
>
> Thank you,
>
> --
> Farhan Khan
> PGP Fingerprint: 782F 342B 5B08 0D2F F4E8 82C3 FFA1 CAE1 6536 51CA
>
> On Mon, Aug 7, 2017 at 7:15 PM, Adrian Chadd <adrian.chadd@gmail.com> =
 =

> wrote:
>
>> For reference, we chatted on IRC.
>>
>> I think it's the NIC disappearing because giving it an iP brings it
>> link 'up' and something in the 'up' path is causing the firmware to
>> crash and the NIC to disappear.
>>
>> which bus is it on btw? eg, you could try 'devctl rescan pcib3' if
>> it's on pcib3..
>>
>> -adrian
>>
>> On 5 August 2017 at 19:43, Farhan Khan <khanzf@gmail.com> wrote:
>> > Hi all,
>> >
>> > I am slowly struggling through writing my Wifi first driver, which =
is  =

>> an
>> > extension to the current rtwn driver. I have reached another hurdle=
  =

>> that
>> > I'm stuck on.
>> >
>> > I bring up my wifi driver as follows:
>> >
>> > # kldload rtwn && kldload rtwn_pci
>> > # sudo ifconfig wlan0 create wlandev rtwn0
>> > # sudo ifconfig wlan0 1.1.1.1
>> >
>> > The third line causes the rtwn0 device to detach (and pci0 device, =
 =

>> which
>> > requires a reboot and is quite frustrating).
>> >
>> > I traced through the code to find why it is detaching and found tha=
t  =

>> in
>> > rtwn_parent() (sys/dev/rtwn/if_rtwn.c), it checks the ic->ic_nrunni=
ng
>> (from
>> > struct ieee80211com). If that value is less than or equal to 0, it =
 =

>> will
>> > cause the rtwn driver to stop. This appears to be a common control
>> > structure used by other drivers as well.
>> >
>> > Unfortunately, I have not been able to determine where  =

>> ic->ic_nrunning is
>> > modified anywhere in the kernel. In fact, the only references I fou=
nd
>> from
>> > my searches was checking the ic_nrunning value, not setting it.
>> >
>> > Does anyone know where this is being set? Without determining this,=
 I
>> > cannot why my driver is unloading. I suspect that I failed to set t=
he
>> > appropriate 802.11 values in my own code, causing the base 802.11  =

>> code to
>> > mark it as "off" or malfunctioning but I am not certain.
>> >
>> > Please advise.
>> > Thank you,
>> > --
>> > Farhan Khan
>> > PGP Fingerprint: 782F 342B 5B08 0D2F F4E8 82C3 FFA1 CAE1 6536 51CA
>> > _______________________________________________
>> > freebsd-wireless@freebsd.org mailing list
>> > https://lists.freebsd.org/mailman/listinfo/freebsd-wireless
>> > To unsubscribe, send any mail to "freebsd-wireless-unsubscribe@
>> freebsd.org"
>>
> _______________________________________________
> freebsd-wireless@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-wireless
> To unsubscribe, send any mail to  =

> "freebsd-wireless-unsubscribe@freebsd.org"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?op.y4wlfkneiew4ia>