Discussion:
kern/50187: iwn0: frequency and channel mismatch
(too old to reply)
Ottavio Caruso
2015-09-22 13:41:17 UTC
Permalink
As per bug below,

is anybody going to try this? I've never recompiled in Netbsd-land.
Can anybody give me a lead? Do I have to start from -current?

My original message was:
https://groups.google.com/forum/#!topic/fa.netbsd.tech.net/iUfcaqQQIxE


---------- Forwarded message ----------
From: NONAKA Kimihiro <***@gmail.com>
Date: 22 September 2015 at 12:10
Subject: Re: kern/50187: iwn0: frequency and channel mismatch
To: kern-bug-***@netbsd.org, gnats-***@netbsd.org,
netbsd-***@netbsd.org, ottavio2006-***@yahoo.com


The following reply was made to PR kern/50187; it has been noted by GNATS.

From: NONAKA Kimihiro <***@gmail.com>
To: "gnats-***@netbsd.org" <gnats-***@netbsd.org>
Cc: kern-bug-***@netbsd.org,
"gnats-***@netbsd.org" <gnats-***@netbsd.org>,
"netbsd-***@netbsd.org" <netbsd-***@netbsd.org>
Subject: Re: kern/50187: iwn0: frequency and channel mismatch
Date: Tue, 22 Sep 2015 20:05:47 +0900

Hi,

iwn(4) can handle 5GHz channel by this patch.
However, channel probably needs to be set manually.

Please try it.
probably
diff --git a/sys/dev/pci/if_iwn.c b/sys/dev/pci/if_iwn.c
index 7f5ca3d..04a4b06 100644
--- a/sys/dev/pci/if_iwn.c
+++ b/sys/dev/pci/if_iwn.cprobably
@@ -330,7 +330,8 @@ static u_int8_t *ieee80211_add_rates(u_int8_t *,
static u_int8_t *ieee80211_add_xrates(u_int8_t *,
const struct ieee80211_rateset *);

-static void iwn_fix_channel(struct ieee80211com *, struct mbuf *);
+static void iwn_fix_channel(struct ieee80211com *, struct mbuf *,
+ struct iwn_rx_stat *);

#ifdef IWN_DEBUG
#define DPRINTF(x) do { if (iwn_debug > 0) printf x; } while (0)
@@ -1866,7 +1867,7 @@ iwn_newstate(struct ieee80211com *ic, enum
ieee80211_state nstate, int arg)
/* XXX Not sure if call and flags are needed. */
ieee80211_node_table_reset(&ic->ic_scan);
ic->ic_flags |= IEEE80211_F_SCAN | IEEE80211_F_ASCAN;
- sc->sc_flags |= IWN_FLAG_SCANNING;
+ sc->sc_flags |= IWN_FLAG_SCANNING_2GHZ;

/* Make the link LED blink while we're scanning. */
iwn_set_led(sc, IWN_LED_LINK, 10, 10);
@@ -2089,7 +2090,7 @@ iwn_rx_done(struct iwn_softc *sc, struct
iwn_rx_desc *desc,

/* XXX Added for NetBSD: scans never stop without it */
if (ic->ic_state == IEEE80211_S_SCAN)
- iwn_fix_channel(ic, m);
+ iwn_fix_channel(ic, m, stat);

if (sc->sc_drvbpf != NULL) {
struct iwn_rx_radiotap_header *tap = &sc->sc_rxtap;
@@ -2520,6 +2521,8 @@ iwn_notif_intr(struct iwn_softc *sc)
* We just finished scanning 2GHz channels,
* start scanning 5GHz ones.
*/
+ sc->sc_flags &= ~IWN_FLAG_SCANNING_2GHZ;
+ sc->sc_flags |= IWN_FLAG_SCANNING_5GHZ;
if (iwn_scan(sc, IEEE80211_CHAN_5GHZ) == 0)
break;
}
@@ -6506,8 +6512,10 @@ ieee80211_add_xrates(u_int8_t *frm, const
struct ieee80211_rateset *rs)
* XXX: Duplicated from if_iwi.c
*/
static void
-iwn_fix_channel(struct ieee80211com *ic, struct mbuf *m)
+iwn_fix_channel(struct ieee80211com *ic, struct mbuf *m,
+ struct iwn_rx_stat *stat)
{
+ struct iwn_softc *sc = ic->ic_ifp->if_softc;
struct ieee80211_frame *wh;
uint8_t subtype;
uint8_t *frm, *efrm;
@@ -6523,6 +6531,13 @@ iwn_fix_channel(struct ieee80211com *ic, struct mbuf *m)
subtype != IEEE80211_FC0_SUBTYPE_PROBE_RESP)
return;

+ if (sc->sc_flags & IWN_FLAG_SCANNING_5GHZ) {
+ int chan = le16toh(stat->chan);
+ if (chan < __arraycount(ic->ic_channels))
+ ic->ic_curchan = &ic->ic_channels[chan];
+ return;
+ }
+
frm = (uint8_t *)(wh + 1);
efrm = mtod(m, uint8_t *) + m->m_len;

diff --git a/sys/dev/pci/if_iwnvar.h b/sys/dev/pci/if_iwnvar.h
index d104c62..05989bb 100644
--- a/sys/dev/pci/if_iwnvar.h
+++ b/sys/dev/pci/if_iwnvar.h
@@ -221,8 +221,10 @@ struct iwn_softc {
#define IWN_FLAG_HAS_11N (1 << 6)
#define IWN_FLAG_ENH_SENS (1 << 7)probably
/* Added for NetBSD */
-#define IWN_FLAG_SCANNING (1 << 8)
-#define IWN_FLAG_HW_INITED (1 << 9)
+#define IWN_FLAG_HW_INITED (1 << 8)
+#define IWN_FLAG_SCANNING_2GHZ (1 << 9)
+#define IWN_FLAG_SCANNING_5GHZ (1 << 10)
+#define IWN_FLAG_SCANNING (IWN_FLAG_SCANNING_2GHZ|IWN_FLAG_SCANNING_5GHZ)

uint8_t hw_type;
--
Ottavio

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
NONAKA Kimihiro
2015-09-22 14:32:43 UTC
Permalink
Hi,
Post by Ottavio Caruso
is anybody going to try this? I've never recompiled in Netbsd-land.
Can anybody give me a lead? Do I have to start from -current?
I put a patch and compiled kernel binary at following URL.

patch:
http://ftp.netbsd.org/pub/NetBSD/misc/nonaka/tmp/20150921-nbsd-pci-extconf-support.diff

kernel binary (netbsd-7):
http://ftp.netbsd.org/pub/NetBSD/misc/nonaka/tmp/20150922-iwn-netbsd-GENERIC-nb7.xz


Regards,
--
NONAKA Kimihiro

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Brad Spencer
2015-09-23 01:05:51 UTC
Permalink
Hi,

iwn(4) can handle 5GHz channel by this patch.
However, channel probably needs to be set manually.

Please try it.
probably

[snip]

I tried iwn patch on a NetBSD 6.1.5 build from source pulled on September
9th, 2015 and was able to get 5ghz channels working. Initially
wpa_supplicant would not associate with the AP, but as part of the test I
set the channel and sometimes the media and was able to get wpa_supplicant
to associate with a 802.11a AP. Plain old ifconfig by itself without any
encryption also worked with 802.11a. After that I was able to unset the
channel settings and the media type and wpa_supplicant still associated.
I will know tomorrow what happens on a cold boot. I did not try 802.11n
as 'ifconfig -m' claims that it isn't supported, however "wpa_cli
scan_results" shows off the 802.11n SSIDs and I am pretty sure that the
hardware I have can do 802.11n too.

I noticed that a pull up request for NetBSD 7 was made, I would also
request it for NetBSD 6, if possible.



Thanks for the patch,
--
Brad Spencer - ***@anduin.eldar.org - KC8VKS
http://anduin.eldar.org - & - http://anduin.ipv6.eldar.org [IPv6 only]

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Loading...