NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Fwd: kern/50187: iwn0: frequency and channel mismatch



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 <nonakap%gmail.com@localhost>
Date: 22 September 2015 at 12:10
Subject: Re: kern/50187: iwn0: frequency and channel mismatch
To: kern-bug-people%netbsd.org@localhost, gnats-admin%netbsd.org@localhost,
netbsd-bugs%netbsd.org@localhost, ottavio2006-netbsd%yahoo.com@localhost


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

From: NONAKA Kimihiro <nonakap%gmail.com@localhost>
To: "gnats-bugs%netbsd.org@localhost" <gnats-bugs%netbsd.org@localhost>
Cc: kern-bug-people%netbsd.org@localhost,
        "gnats-admin%netbsd.org@localhost" <gnats-admin%netbsd.org@localhost>,
"netbsd-bugs%netbsd.org@localhost" <netbsd-bugs%netbsd.org@localhost>
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


Home | Main Index | Thread Index | Old Index