ieee80211 framework and ndis [patch]

From: Stephane E. Potvin <sepotvin_at_videotron.ca>
Date: Wed, 15 Dec 2004 14:00:37 -0500
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

While trying to get my Dell TrueMobile 1400 wireless card (Broadcom
BCM4309 based). I noticed that the ndis driver (if_ndis) does not check
the ic_mgtq queue for packets to transmit, which was causing the ndis
driver to reset itself via the watchdog. The following patch address
this issue (feel free to change as you wish, I'm not particularly
thrilled by the way I fixed it).

cvs diff: Diffing .
Index: if_ndis.c
===================================================================
RCS file: /home/FreeBSD/ncvs/src/sys/dev/if_ndis/if_ndis.c,v
retrieving revision 1.74
diff -u -r1.74 if_ndis.c
- --- if_ndis.c   12 Dec 2004 07:45:42 -0000      1.74
+++ if_ndis.c   15 Dec 2004 18:12:31 -0000
_at__at_ -1195,12 +1195,14 _at__at_
~        ndis_packet             **p0 = NULL, *p = NULL;
~        ndis_tcpip_csum         *csum;
~        int                     pcnt = 0;
+       struct ieee80211com     *ic;

~        sc = ifp->if_softc;
+       ic = &sc->ic;

~        NDIS_LOCK(sc);

- -       if (!sc->ndis_link || ifp->if_flags & IFF_OACTIVE) {
+       if (ifp->if_flags & IFF_OACTIVE) {
~                NDIS_UNLOCK(sc);
~                return;
~        }
_at__at_ -1208,11 +1210,26 _at__at_
~        p0 = &sc->ndis_txarray[sc->ndis_txidx];

~        while(sc->ndis_txpending) {
+               /*
+                * Poll the management queue for frames; they
+                * have priority over normal data frames.
+                */
+               IF_DEQUEUE(&ic->ic_mgtq, m);
+               if (m == NULL) {
+                       /*
+                        * No data frame go out unless we're associated.
+                        */
+                       if (!sc->ndis_link && pcnt == 0) {
+                               NDIS_UNLOCK(sc);
+                               return;
+                       }
+                       else
~ #if __FreeBSD_version < 502114
- -               IF_DEQUEUE(&ifp->if_snd, m);
+                               IF_DEQUEUE(&ifp->if_snd, m);
~ #else
- -               IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
+                               IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
~ #endif
+               }
~                if (m == NULL)
~                        break;

With this patch, when I start the wpa_supplicant program, the following
packet goes off the card

13:51:08.192277 ff:ff:ff:ff:00:90 > 40:00:00:00:ff:ff, ethertype Unknown
(0x4b78), length 36:
~        0x0000:  cbfc ffff ffff ffff 4000 0000 0108 0c12  ........_at_.......
~        0x0010:  1824 2f48 606c                           .$/H`l

which I guess is the probe_req packet as indicated by the wlan layer:

Initializing interface 'ndis0' conf '/usr/local/etc/wpa.conf' driver
'default'
Configuration file '/usr/local/etc/wpa.conf' -> '/usr/local/etc/wpa.conf'
Reading configuration file '/usr/local/etc/wpa.conf'
ctrl_interface='/var/run/wpa_supplicant'
ctrl_interface_group=0 (from group name 'wheel')
Priority group 0
~   id=0 ssid='TB_LINK_SYS_000'
Initializing interface (2) 'ndis0'
EAPOL: SUPP_PAE entering state DISCONNECTED
EAPOL: KEY_RX entering state NO_KEY_RECEIVE
EAPOL: SUPP_BE entering state INITIALIZE
EAP: EAP entering state DISABLED
EAPOL: External notification - portEnabled=0
EAPOL: External notification - portValid=0
Own MAC address: 00:90:4b:78:cb:fc
wpa_driver_bsd_set_wpa: enabled=1
wpa_driver_bsd_del_key: keyidx=0
wpa_driver_bsd_del_key: keyidx=1
wpa_driver_bsd_del_key: keyidx=2
wpa_driver_bsd_del_key: keyidx=3
wpa_driver_bsd_set_countermeasures: enabled=0
wpa_driver_bsd_set_drop_unencrypted: enabled=1
Setting scan request: 0 sec 100000 usec
Starting AP scan (broadcast SSID)
ieee80211_newstate: INIT -> SCAN
begin active scan, scangen 6
ieee80211_reset_scan: scan set: 10 start chan 10
ieee80211_free_allnodes_locked: free all nodes in scan table
ieee80211_next_scan: chan 10->10
ieee80211_newstate: SCAN -> SCAN
ieee80211_ref_node (ieee80211_send_mgmt:914) 00:90:4b:78:cb:fc refcnt 6
[ff:ff:ff:ff:ff:ff] send probe_req on channel 10

At this point, nothing more get transmitted or received by the ndis0
interface.

Here's the output of ifconfig ndis0:

ndis0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
~        inet6 fe80::290:4bff:fe78:cbfc%ndis0 prefixlen 64 scopeid 0x2
~        ether 00:90:4b:78:cb:fc
~        media: IEEE 802.11 Wireless Ethernet autoselect (OFDM/6Mbps)
~        status: no carrier
~        ssid "" channel 10
~        authmode WPA1+WPA2/802.11i privacy ON deftxkey UNDEF txpowmax 100
~        protmode CTS roaming MANUAL

Hope this helps.

Steph
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (FreeBSD)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBwInVmdOXtTCX/nsRAnhWAJ4tMzA8eUFxH92uGTZ179Jklg8qsACghKXC
HJmcqQcTSAT68mhR+a+UJ80=
=ztco
-----END PGP SIGNATURE-----
Received on Wed Dec 15 2004 - 18:02:22 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:24 UTC