Source-Changes-HG archive

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

[src/trunk]: src/sys Move IBSS creation stuff from awi to ieee80211.



details:   https://anonhg.NetBSD.org/src/rev/3aa6e5fdcaa8
branches:  trunk
changeset: 515246:3aa6e5fdcaa8
user:      onoe <onoe%NetBSD.org@localhost>
date:      Thu Sep 20 13:54:43 2001 +0000

description:
Move IBSS creation stuff from awi to ieee80211.

diffstat:

 sys/dev/ic/awi.c           |  46 ++++++++--------------------------------------
 sys/net/if_ieee80211subr.c |  39 +++++++++++++++++++++++++++++++++++++--
 2 files changed, 45 insertions(+), 40 deletions(-)

diffs (169 lines):

diff -r 68b4050bdbd7 -r 3aa6e5fdcaa8 sys/dev/ic/awi.c
--- a/sys/dev/ic/awi.c  Thu Sep 20 12:34:28 2001 +0000
+++ b/sys/dev/ic/awi.c  Thu Sep 20 13:54:43 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: awi.c,v 1.39 2001/09/19 04:09:54 onoe Exp $    */
+/*     $NetBSD: awi.c,v 1.40 2001/09/20 13:54:44 onoe Exp $    */
 
 /*-
  * Copyright (c) 1999,2000,2001 The NetBSD Foundation, Inc.
@@ -1672,7 +1672,7 @@
        struct ieee80211com *ic = &sc->sc_ic;
        struct ieee80211_bss *bs = &ic->ic_bss;
        struct ifnet *ifp = &ic->ic_if;
-       int i, error;
+       int error;
        u_int8_t newmode;
        enum ieee80211_state ostate;
 #ifdef AWI_DEBUG
@@ -1720,39 +1720,6 @@
 
        /* state transition */
        if (nstate == IEEE80211_S_SCAN) {
-               if (ostate == IEEE80211_S_SCAN &&
-                   (ic->ic_flags & IEEE80211_F_ASCAN) == 0 &&
-                   (ic->ic_flags & IEEE80211_F_ADHOC) != 0 &&
-                   (ic->ic_flags & IEEE80211_F_IBSSON) != 0 &&
-                   sc->sc_adhoc_ap == 0 &&
-                   ic->ic_des_esslen != 0) {
-                       /* create IBSS */
-                       if (ifp->if_flags & IFF_DEBUG)
-                               printf("%s: creating ibss\n", ifp->if_xname);
-                       ic->ic_flags |= IEEE80211_F_SIBSS;
-                       bs->bs_chan = ic->ic_ibss_chan;
-                       bs->bs_intval = ic->ic_lintval;
-                       bs->bs_nrate = 0;
-                       for (i = 0; i < IEEE80211_RATE_SIZE; i++) {
-                               if (ic->ic_sup_rates[i])
-                                       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_fhdwell = 200;           /* XXX */
-                               bs->bs_fhindex = 1;
-                       }
-                       memcpy(bs->bs_macaddr, ic->ic_myaddr,
-                           IEEE80211_ADDR_LEN);
-                       bs->bs_esslen = ic->ic_des_esslen;
-                       memcpy(bs->bs_essid, ic->ic_des_essid, bs->bs_esslen);
-                       nstate = IEEE80211_S_RUN;
-                       sc->sc_substate = AWI_ST_NONE;
-                       /* TODO */
-                       goto set_ssid;
-               }
-               ic->ic_flags &= ~IEEE80211_F_SIBSS;
-
                /* SCAN substate */
                if (sc->sc_substate == AWI_ST_NONE) {
                        sc->sc_nstate = nstate; /* next state in transition */
@@ -1843,7 +1810,6 @@
 
        if (ostate == IEEE80211_S_SCAN) {
                /* set SSID and channel */
-  set_ssid:
                /* substate */
                if (sc->sc_substate == AWI_ST_NONE) {
                        sc->sc_nstate = nstate; /* next state in transition */
@@ -1879,17 +1845,21 @@
                                    IEEE80211_FH_CHANSET(bs->bs_chan));
                                awi_write_1(sc, AWI_CA_SYNC_PATTERN,
                                    IEEE80211_FH_CHANPAT(bs->bs_chan));
+                               awi_write_1(sc, AWI_CA_SYNC_IDX,
+                                   bs->bs_fhindex);
+                               awi_write_2(sc, AWI_CA_SYNC_DWELL,
+                                   bs->bs_fhdwell);
                        } 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_2(sc, AWI_CA_SYNC_DWELL, 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_fhdwell);
                        awi_write_2(sc, AWI_CA_SYNC_MBZ, 0);
                        awi_write_bytes(sc, AWI_CA_SYNC_TIMESTAMP,
                            bs->bs_tstamp, 8);
diff -r 68b4050bdbd7 -r 3aa6e5fdcaa8 sys/net/if_ieee80211subr.c
--- a/sys/net/if_ieee80211subr.c        Thu Sep 20 12:34:28 2001 +0000
+++ b/sys/net/if_ieee80211subr.c        Thu Sep 20 13:54:43 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ieee80211subr.c,v 1.2 2001/09/19 04:09:56 onoe Exp $        */
+/*     $NetBSD: if_ieee80211subr.c,v 1.3 2001/09/20 13:54:43 onoe Exp $        */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -770,12 +770,44 @@
        struct ieee80211com *ic = (void *)ifp;
        struct ieee80211_bss *bs, *nextbs, *selbs;
        u_int8_t rate;
-       int fail;
+       int i, fail;
 
        bs = TAILQ_FIRST(&ic->ic_scan);
        if (bs == NULL) {
                DPRINTF(("ieee80211_end_scan: no scan candidate\n"));
   notfound:
+               if ((ic->ic_flags & IEEE80211_F_ADHOC) &&
+                   (ic->ic_flags & IEEE80211_F_IBSSON) &&
+                   ic->ic_des_esslen != 0) {
+                       bs = &ic->ic_bss;
+                       if (ifp->if_flags & IFF_DEBUG)
+                               printf("%s: creating ibss\n", ifp->if_xname);
+                       ic->ic_flags |= IEEE80211_F_SIBSS;
+                       bs->bs_nrate = 0;
+                       for (i = 0; i < IEEE80211_RATE_SIZE; i++) {
+                               if (ic->ic_sup_rates[i])
+                                       bs->bs_rates[bs->bs_nrate++] =
+                                           ic->ic_sup_rates[i];
+                       }
+                       memcpy(bs->bs_macaddr, ic->ic_myaddr,
+                           IEEE80211_ADDR_LEN);
+                       memcpy(bs->bs_bssid, ic->ic_myaddr, IEEE80211_ADDR_LEN);
+                       bs->bs_bssid[0] |= 0x02;        /* local bit for IBSS */
+                       bs->bs_esslen = ic->ic_des_esslen;
+                       memcpy(bs->bs_essid, ic->ic_des_essid, bs->bs_esslen);
+                       bs->bs_rssi = 0;
+                       bs->bs_timoff = 0;
+                       memset(bs->bs_tstamp, 0, sizeof(bs->bs_tstamp));
+                       bs->bs_intval = ic->ic_lintval;
+                       bs->bs_capinfo = IEEE80211_CAPINFO_IBSS;
+                       if (ic->ic_flags & IEEE80211_F_WEPON)
+                               bs->bs_capinfo |= IEEE80211_CAPINFO_PRIVACY;
+                       bs->bs_chan = ic->ic_ibss_chan;
+                       bs->bs_fhdwell = 200;   /* XXX */
+                       bs->bs_fhindex = 1;
+                       ieee80211_new_state(ifp, IEEE80211_S_RUN, -1);
+                       return;
+               }
                if (ic->ic_flags & IEEE80211_F_ASCAN) {
                        if (ifp->if_flags & IFF_DEBUG)
                                printf("%s: entering passive scan mode\n",
@@ -1395,6 +1427,7 @@
                switch (ostate) {
                case IEEE80211_S_INIT:
                        ic->ic_flags |= IEEE80211_F_ASCAN;
+                       ic->ic_flags &= ~IEEE80211_F_SIBSS;
                        ic->ic_scan_timer = IEEE80211_ASCAN_WAIT;
                        /* use lowest rate */
                        ic->ic_bss.bs_txrate = 0;
@@ -1402,6 +1435,7 @@
                        break;
                case IEEE80211_S_SCAN:
                        /* scan next */
+                       ic->ic_flags &= ~IEEE80211_F_SIBSS;
                        if (ic->ic_flags & IEEE80211_F_ASCAN) {
                                if (ic->ic_scan_timer == 0)
                                        ic->ic_scan_timer =
@@ -1435,6 +1469,7 @@
                        }
                        ic->ic_flags |= IEEE80211_F_ASCAN;
                        ic->ic_scan_timer = IEEE80211_ASCAN_WAIT;
+                       ic->ic_flags &= ~IEEE80211_F_SIBSS;
                        ieee80211_send_prreq(ic);
                        break;
                }



Home | Main Index | Thread Index | Old Index