Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Aug 2017 22:43:46 -0400
From:      Farhan Khan <khanzf@gmail.com>
To:        freebsd-wireless@freebsd.org
Subject:   Why is rtwn module detaching?
Message-ID:  <CAFd4kYAzzoOG4mrdnxZduFjBR5JsiPf=SGjqtkSqRCMz5qfiSQ@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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 that in
rtwn_parent() (sys/dev/rtwn/if_rtwn.c), it checks the ic->ic_nrunning (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 found 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 the
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



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