Source-Changes-HG archive

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

[src/trunk]: src/sys Fix for FH infrastructure mode.



details:   https://anonhg.NetBSD.org/src/rev/62943cc87067
branches:  trunk
changeset: 515212:62943cc87067
user:      onoe <onoe%NetBSD.org@localhost>
date:      Wed Sep 19 04:09:54 2001 +0000

description:
Fix for FH infrastructure mode.
XXX: FH chanset should be calculated by FH hop pattern, but BayStack 650 AP
     always specify chanset to fixed value 1.  The previous code try to this
     hack into awi driver, but it is insufficient because the chanset value
     in awi driver may change while scan and it may be different from the
     value in receiving beacon/probe-response.  So we save encoded FH chanset
     into channel in 802.11 common bss information for now.

diffstat:

 sys/dev/ic/awi.c           |  56 ++++++++++++++++++++++++++++-----------------
 sys/dev/ic/awivar.h        |   3 +-
 sys/net/if_ieee80211.h     |  11 +++++++-
 sys/net/if_ieee80211subr.c |  17 ++++++++-----
 4 files changed, 55 insertions(+), 32 deletions(-)

diffs (202 lines):

diff -r 26a6c8346bd2 -r 62943cc87067 sys/dev/ic/awi.c
--- a/sys/dev/ic/awi.c  Wed Sep 19 03:41:46 2001 +0000
+++ b/sys/dev/ic/awi.c  Wed Sep 19 04:09:54 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: awi.c,v 1.38 2001/09/18 23:19:08 onoe Exp $    */
+/*     $NetBSD: awi.c,v 1.39 2001/09/19 04:09:54 onoe Exp $    */
 
 /*-
  * Copyright (c) 1999,2000,2001 The NetBSD Foundation, Inc.
@@ -1302,8 +1302,27 @@
                    cs->cs_region == sc->sc_mib_phy.aCurrent_Reg_Domain)
                        break;
        }
-       for (i = cs->cs_min; i <= cs->cs_max; i++)
-               setbit(sc->sc_ic.ic_chan_avail, i);
+       if (sc->sc_mib_phy.IEEE_PHY_Type == AWI_PHY_TYPE_FH) {
+               for (i = cs->cs_min; i <= cs->cs_max; i++) {
+                       setbit(sc->sc_ic.ic_chan_avail, 
+                           IEEE80211_FH_CHAN(i % 3 + 1, i));
+                       /*
+                        * According to the IEEE 802.11 specification,
+                        * hop pattern parameter for FH phy should be
+                        * incremented by 3 for given hop chanset, i.e.,
+                        * the chanset parameter is calculated for given
+                        * hop patter.  However, BayStack 650 Access Points
+                        * apparently use fixed hop chanset parameter value
+                        * 1 for any hop pattern.  So we also try this
+                        * combination of hop chanset and pattern.
+                        */
+                       setbit(sc->sc_ic.ic_chan_avail, 
+                           IEEE80211_FH_CHAN(1, i));
+               }
+       } else {
+               for (i = cs->cs_min; i <= cs->cs_max; i++)
+                       setbit(sc->sc_ic.ic_chan_avail, i);
+       }
        sc->sc_cur_chan = cs->cs_def;
 
        memset(&sc->sc_mib_mac.aDesired_ESS_ID, 0, AWI_ESS_ID_SIZE);
@@ -1719,8 +1738,10 @@
                                        bs->bs_rates[bs->bs_nrate++] =
                                            ic->ic_sup_rates[i];
                        }
-                       if (sc->sc_mib_phy.IEEE_PHY_Type == AWI_PHY_TYPE_FH)
-                               bs->bs_dwell = 200;             /* XXX */
+                       if (sc->sc_mib_phy.IEEE_PHY_Type == AWI_PHY_TYPE_FH) {
+                               bs->bs_fhdwell = 200;           /* XXX */
+                               bs->bs_fhindex = 1;
+                       }
                        memcpy(bs->bs_macaddr, ic->ic_myaddr,
                            IEEE80211_ADDR_LEN);
                        bs->bs_esslen = ic->ic_des_esslen;
@@ -1784,15 +1805,10 @@
                            (ic->ic_flags & IEEE80211_F_ASCAN) ?
                            AWI_ASCAN_DURATION : AWI_PSCAN_DURATION);
                        if (sc->sc_mib_phy.IEEE_PHY_Type == AWI_PHY_TYPE_FH) {
-                               if (bs->bs_chan < sc->sc_cur_chan)
-                                       sc->sc_fhset_one = ~sc->sc_fhset_one;
-                               if (sc->sc_fhset_one)
-                                       awi_write_1(sc, AWI_CA_SCAN_SET, 1);
-                               else
-                                       awi_write_1(sc, AWI_CA_SCAN_SET,
-                                           bs->bs_chan % 3 + 1);
+                               awi_write_1(sc, AWI_CA_SCAN_SET,
+                                   IEEE80211_FH_CHANSET(bs->bs_chan));
                                awi_write_1(sc, AWI_CA_SCAN_PATTERN,
-                                   bs->bs_chan);
+                                   IEEE80211_FH_CHANPAT(bs->bs_chan));
                                awi_write_1(sc, AWI_CA_SCAN_IDX, 1);
                        } else {
                                awi_write_1(sc, AWI_CA_SCAN_SET, bs->bs_chan);
@@ -1859,23 +1875,21 @@
                        }
                        sc->sc_cmd_inprog = AWI_CMD_SYNC;
                        if (sc->sc_mib_phy.IEEE_PHY_Type == AWI_PHY_TYPE_FH) {
-                               if (sc->sc_fhset_one)
-                                       awi_write_1(sc, AWI_CA_SYNC_SET, 1);
-                               else
-                                       awi_write_1(sc, AWI_CA_SYNC_SET,
-                                           bs->bs_chan % 3 + 1);
-                               awi_write_1(sc, AWI_CA_SYNC_IDX, 1);
+                               awi_write_1(sc, AWI_CA_SYNC_SET,
+                                   IEEE80211_FH_CHANSET(bs->bs_chan));
+                               awi_write_1(sc, AWI_CA_SYNC_PATTERN,
+                                   IEEE80211_FH_CHANPAT(bs->bs_chan));
                        } else {
                                awi_write_1(sc, AWI_CA_SYNC_SET, bs->bs_chan);
                                awi_write_1(sc, AWI_CA_SYNC_PATTERN, 0);
-                               awi_write_1(sc, AWI_CA_SYNC_IDX, 0);
                        }
+                       awi_write_1(sc, AWI_CA_SYNC_IDX, bs->bs_fhindex);
                        if ((ic->ic_flags & IEEE80211_F_SIBSS) &&
                            !sc->sc_no_bssid)
                                awi_write_1(sc, AWI_CA_SYNC_STARTBSS, 1);
                        else
                                awi_write_1(sc, AWI_CA_SYNC_STARTBSS, 0);
-                       awi_write_2(sc, AWI_CA_SYNC_DWELL, bs->bs_dwell);
+                       awi_write_2(sc, AWI_CA_SYNC_DWELL, bs->bs_fhdwell);
                        awi_write_2(sc, AWI_CA_SYNC_MBZ, 0);
                        awi_write_bytes(sc, AWI_CA_SYNC_TIMESTAMP,
                            bs->bs_tstamp, 8);
diff -r 26a6c8346bd2 -r 62943cc87067 sys/dev/ic/awivar.h
--- a/sys/dev/ic/awivar.h       Wed Sep 19 03:41:46 2001 +0000
+++ b/sys/dev/ic/awivar.h       Wed Sep 19 04:09:54 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: awivar.h,v 1.15 2001/09/18 09:09:59 onoe Exp $ */
+/*     $NetBSD: awivar.h,v 1.16 2001/09/19 04:09:55 onoe Exp $ */
 
 /*-
  * Copyright (c) 1999,2000,2001 The NetBSD Foundation, Inc.
@@ -89,7 +89,6 @@
                                sc_enab_intr:1,
                                sc_no_bssid:1,
                                sc_adhoc_ap:1,
-                               sc_fhset_one:1,
                                sc_invalid:1;
        struct ifmedia          sc_media;
        enum ieee80211_state    sc_nstate;
diff -r 26a6c8346bd2 -r 62943cc87067 sys/net/if_ieee80211.h
--- a/sys/net/if_ieee80211.h    Wed Sep 19 03:41:46 2001 +0000
+++ b/sys/net/if_ieee80211.h    Wed Sep 19 04:09:54 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ieee80211.h,v 1.11 2001/09/18 09:10:00 onoe Exp $   */
+/*     $NetBSD: if_ieee80211.h,v 1.12 2001/09/19 04:09:56 onoe Exp $   */
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -253,7 +253,8 @@
        u_int8_t                bs_tstamp[8];
        u_int16_t               bs_intval;
        u_int16_t               bs_capinfo;
-       u_int16_t               bs_dwell;
+       u_int16_t               bs_fhdwell;
+       u_int8_t                bs_fhindex;
        u_int16_t               bs_associd;
        u_int32_t               bs_timoff;
        u_int8_t                bs_chan;
@@ -266,6 +267,12 @@
        int                     bs_txrate;
 };
 
+/* bs_chan encoding for FH phy */
+#define        IEEE80211_FH_CHANMOD    80
+#define        IEEE80211_FH_CHAN(set,pat)      (((set)-1)*IEEE80211_FH_CHANMOD+(pat))
+#define        IEEE80211_FH_CHANSET(chan)      ((chan)/IEEE80211_FH_CHANMOD+1)
+#define        IEEE80211_FH_CHANPAT(chan)      ((chan)%IEEE80211_FH_CHANMOD)
+
 struct ieee80211_wepkey {
        int                     wk_len;
        u_int8_t                wk_key[IEEE80211_KEYBUF_SIZE];
diff -r 26a6c8346bd2 -r 62943cc87067 sys/net/if_ieee80211subr.c
--- a/sys/net/if_ieee80211subr.c        Wed Sep 19 03:41:46 2001 +0000
+++ b/sys/net/if_ieee80211subr.c        Wed Sep 19 04:09:54 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ieee80211subr.c,v 1.1 2001/09/18 09:10:00 onoe Exp $        */
+/*     $NetBSD: if_ieee80211subr.c,v 1.2 2001/09/19 04:09:56 onoe Exp $        */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -1098,8 +1098,8 @@
        struct ieee80211_frame *wh;
        struct ieee80211_bss *bs;
        u_int8_t *frm, *efrm, *tstamp, *bintval, *capinfo, *ssid, *rates;
-       u_int8_t chan;
-       u_int16_t dwell;
+       u_int8_t chan, fhindex;
+       u_int16_t fhdwell;
 
        if ((ic->ic_flags & IEEE80211_F_ADHOC) == 0 &&
            ic->ic_state != IEEE80211_S_SCAN) {
@@ -1124,7 +1124,8 @@
        capinfo = frm;  frm += 2;
        ssid = rates = NULL;
        chan = ic->ic_bss.bs_chan;
-       dwell = 0;
+       fhdwell = 0;
+       fhindex = 0;
        while (frm < efrm) {
                switch (*frm) {
                case IEEE80211_ELEMID_SSID:
@@ -1134,8 +1135,9 @@
                        rates = frm;
                        break;
                case IEEE80211_ELEMID_FHPARMS:
-                       dwell = frm[2];
-                       chan = frm[5];
+                       fhdwell = (frm[3] << 8) | frm[2];
+                       chan = IEEE80211_FH_CHAN(frm[4], frm[5]);
+                       fhindex = frm[6];
                        break;
                case IEEE80211_ELEMID_DSPARMS:
                        chan = frm[2];
@@ -1195,7 +1197,8 @@
        bs->bs_intval = le16toh(*(u_int16_t *)bintval);
        bs->bs_capinfo = le16toh(*(u_int16_t *)capinfo);
        bs->bs_chan = chan;
-       bs->bs_dwell = dwell;
+       bs->bs_fhdwell = fhdwell;
+       bs->bs_fhindex = fhindex;
        if (ic->ic_state == IEEE80211_S_SCAN && ic->ic_scan_timer == 0)
                ieee80211_end_scan(&ic->ic_if);
 }



Home | Main Index | Thread Index | Old Index