Changeset 2357

Show
Ignore:
Timestamp:
05/21/07 17:53:39 (2 years ago)
Author:
mentor
Message:

Merge ng-refcount to trunk - r2061:r2356

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ath/if_ath.c

    r2344 r2357  
    162162static void ath_desc_free(struct ath_softc *); 
    163163static void ath_desc_swap(struct ath_desc *); 
    164 static struct ieee80211_node *ath_node_alloc(struct ieee80211_node_table *, 
    165         struct ieee80211vap *); 
     164static struct ieee80211_node *ath_node_alloc(struct ieee80211vap *); 
    166165static void ath_node_cleanup(struct ieee80211_node *); 
    167166static void ath_node_free(struct ieee80211_node *); 
     
    24422441                        continue; 
    24432442        bad: 
    2444                 ieee80211_free_node(ni); 
     2443                ieee80211_unref_node(&ni); 
    24452444                if (bf_ff->bf_skb != NULL) { 
    24462445                        dev_kfree_skb(bf_ff->bf_skb); 
     
    25822581                        ATH_FF_MAGIC_PUT(skb); 
    25832582 
     2583#if 0 
    25842584                        /* decrement extra node reference made when an_tx_ffbuf[] was set */ 
    2585                         //ieee80211_free_node(ni); /* XXX where was it set ? */ 
     2585                        ieee80211_unref_node(&ni); /* XXX where was it set ? */ 
     2586#endif 
    25862587 
    25872588                        DPRINTF(sc, ATH_DEBUG_XMIT | ATH_DEBUG_FF, 
     
    26422643                        DPRINTF(sc, ATH_DEBUG_XMIT | ATH_DEBUG_FF, 
    26432644                                "%s: ff stageq flush failure\n", __func__); 
    2644                         ieee80211_free_node(ni); 
     2645                        ieee80211_unref_node(&ni); 
    26452646                        if (bf_ff->bf_skb) { 
    26462647                                dev_kfree_skb(bf_ff->bf_skb); 
     
    27642765                         
    27652766                        if (ni != NULL)  
    2766                                 ieee80211_free_node(ni); 
     2767                                ieee80211_unref_node(&ni); 
    27672768 
    27682769                        STAILQ_INSERT_TAIL(&sc->sc_txbuf, tbf, bf_list); 
     
    28462847bad: 
    28472848        if (ni != NULL) 
    2848                 ieee80211_free_node(ni); 
     2849                ieee80211_unref_node(&ni); 
    28492850        if (bf != NULL) { 
    28502851                bf->bf_skb = NULL; 
     
    32353236        ni = sc->sc_keyixmap[keyix]; 
    32363237        if (ni != NULL) { 
    3237                 ieee80211_free_node(ni); 
     3238                ieee80211_unref_node(&ni); 
    32383239                sc->sc_keyixmap[keyix] = NULL; 
    32393240        } 
     
    32463247                ni = sc->sc_keyixmap[keyix + 32]; 
    32473248                if (ni != NULL) {                       /* as above... */ 
    3248                         ieee80211_free_node(ni); 
     3249                        ieee80211_unref_node(&ni); 
    32493250                        sc->sc_keyixmap[keyix + 32] = NULL; 
    32503251                } 
     
    32593260                        ni = sc->sc_keyixmap[keyix + rxkeyoff]; 
    32603261                        if (ni != NULL) {       /* as above... */ 
    3261                                 ieee80211_free_node(ni); 
     3262                                ieee80211_unref_node(&ni); 
    32623263                                sc->sc_keyixmap[keyix + rxkeyoff] = NULL; 
    32633264                        } 
     
    38153816                bf->bf_skb = NULL; 
    38163817        } 
    3817         if (bf->bf_node != NULL) { 
    3818                 ieee80211_free_node(bf->bf_node); 
    3819                 bf->bf_node = NULL; 
    3820         } 
     3818        if (bf->bf_node != NULL) 
     3819                ieee80211_unref_node(&bf->bf_node); 
    38213820 
    38223821        /* 
     
    43604359                bf->bf_skb = NULL; 
    43614360        } 
    4362         if (bf->bf_node != NULL) { 
    4363                 ieee80211_free_node(bf->bf_node); 
    4364                 bf->bf_node = NULL; 
    4365         } 
     4361        if (bf->bf_node != NULL)  
     4362                ieee80211_unref_node(&bf->bf_node); 
    43664363        STAILQ_INSERT_TAIL(&sc->sc_bbuf, bf, bf_list); 
    43674364} 
     
    43824379                        bf->bf_skb = NULL; 
    43834380                } 
    4384                 if (bf->bf_node != NULL) { 
    4385                         ieee80211_free_node(bf->bf_node); 
    4386                         bf->bf_node = NULL; 
    4387                 } 
     4381                if (bf->bf_node != NULL) 
     4382                        ieee80211_unref_node(&bf->bf_node); 
    43884383        } 
    43894384} 
     
    46714666                         * Reclaim node reference. 
    46724667                         */ 
    4673                         ieee80211_free_node(ni); 
     4668                        ieee80211_unref_node(&ni); 
    46744669                } 
    46754670        } 
     
    47304725 
    47314726static struct ieee80211_node * 
    4732 ath_node_alloc(struct ieee80211_node_table *nt,struct ieee80211vap *vap) 
    4733 { 
    4734         struct ath_softc *sc = nt->nt_ic->ic_dev->priv; 
     4727ath_node_alloc(struct ieee80211vap *vap) 
     4728{ 
     4729        struct ath_softc *sc = vap->iv_ic->ic_dev->priv; 
    47354730        const size_t space = sizeof(struct ath_node) + sc->sc_rc->arc_space; 
    47364731        struct ath_node *an; 
    47374732 
    47384733        an = kmalloc(space, GFP_ATOMIC); 
    4739         if (an == NULL) 
     4734        if (an != NULL) { 
     4735                memset(an, 0, space); 
     4736                an->an_decomp_index = INVALID_DECOMP_INDEX; 
     4737                an->an_avgrssi = ATH_RSSI_DUMMY_MARKER; 
     4738                an->an_halstats.ns_avgbrssi = ATH_RSSI_DUMMY_MARKER; 
     4739                an->an_halstats.ns_avgrssi = ATH_RSSI_DUMMY_MARKER; 
     4740                an->an_halstats.ns_avgtxrssi = ATH_RSSI_DUMMY_MARKER; 
     4741                /* 
     4742                 * ath_rate_node_init needs a vap pointer in node 
     4743                 * to decide which mgt rate to use 
     4744                 */ 
     4745                an->an_node.ni_vap = vap; 
     4746                sc->sc_rc->ops->node_init(sc, an); 
     4747 
     4748                /* U-APSD init */ 
     4749                STAILQ_INIT(&an->an_uapsd_q); 
     4750                an->an_uapsd_qdepth = 0; 
     4751                STAILQ_INIT(&an->an_uapsd_overflowq); 
     4752                an->an_uapsd_overflowqdepth = 0; 
     4753                ATH_NODE_UAPSD_LOCK_INIT(an); 
     4754                 
     4755                DPRINTF(sc, ATH_DEBUG_NODE, "%s: an %p\n", __func__, an); 
     4756                return &an->an_node; 
     4757        } else { 
    47404758                return NULL; 
    4741         memset(an, 0, space); 
    4742         an->an_decomp_index = INVALID_DECOMP_INDEX; 
    4743         an->an_avgrssi = ATH_RSSI_DUMMY_MARKER; 
    4744         an->an_halstats.ns_avgbrssi = ATH_RSSI_DUMMY_MARKER; 
    4745         an->an_halstats.ns_avgrssi = ATH_RSSI_DUMMY_MARKER; 
    4746         an->an_halstats.ns_avgtxrssi = ATH_RSSI_DUMMY_MARKER; 
    4747         /* 
    4748          * ath_rate_node_init needs a VAP pointer in node 
    4749          * to decide which mgt rate to use 
    4750          */ 
    4751         an->an_node.ni_vap = vap; 
    4752         sc->sc_rc->ops->node_init(sc, an); 
    4753  
    4754         /* U-APSD init */ 
    4755         STAILQ_INIT(&an->an_uapsd_q); 
    4756         an->an_uapsd_qdepth = 0; 
    4757         STAILQ_INIT(&an->an_uapsd_overflowq); 
    4758         an->an_uapsd_overflowqdepth = 0; 
    4759         ATH_NODE_UAPSD_LOCK_INIT(an); 
    4760  
    4761         DPRINTF(sc, ATH_DEBUG_NODE, "%s: an %p\n", __func__, an); 
    4762         return &an->an_node; 
     4759        } 
    47634760} 
    47644761 
     
    47704767        struct ath_node *an = ATH_NODE(ni); 
    47714768        struct ath_buf *bf; 
     4769        struct ieee80211_cb *cb = NULL; 
    47724770         
    47734771        /* 
     
    47844782                bf = STAILQ_FIRST(&an->an_uapsd_q); 
    47854783                STAILQ_REMOVE_HEAD(&an->an_uapsd_q, bf_list); 
     4784 
     4785                cb = (struct ieee80211_cb *) bf->bf_skb->cb; 
     4786                ieee80211_unref_node(&cb->ni); 
     4787                dev_kfree_skb_any(bf->bf_skb); 
     4788 
    47864789                bf->bf_desc->ds_link = 0; 
    4787  
    4788                 dev_kfree_skb_any(bf->bf_skb); 
    47894790                bf->bf_skb = NULL; 
    47904791                bf->bf_node = NULL; 
     4792 
    47914793                ATH_TXBUF_LOCK_IRQ(sc); 
    47924794                STAILQ_INSERT_TAIL(&sc->sc_txbuf, bf, bf_list); 
    47934795                ATH_TXBUF_UNLOCK_IRQ(sc); 
    4794                 ieee80211_free_node(ni); 
    47954796 
    47964797                an->an_uapsd_qdepth--; 
     
    48004801                bf = STAILQ_FIRST(&an->an_uapsd_overflowq); 
    48014802                STAILQ_REMOVE_HEAD(&an->an_uapsd_overflowq, bf_list); 
    4802                 bf->bf_desc->ds_link = 0; 
    4803  
     4803 
     4804                cb = (struct ieee80211_cb *) bf->bf_skb->cb; 
     4805                ieee80211_unref_node(&cb->ni); 
    48044806                dev_kfree_skb_any(bf->bf_skb); 
     4807 
    48054808                bf->bf_skb = NULL; 
    48064809                bf->bf_node = NULL; 
     4810                bf->bf_desc->ds_link = 0; 
     4811                 
    48074812                ATH_TXBUF_LOCK_IRQ(sc); 
    48084813                STAILQ_INSERT_TAIL(&sc->sc_txbuf, bf, bf_list); 
    48094814                ATH_TXBUF_UNLOCK_IRQ(sc); 
    4810                 ieee80211_free_node(ni); 
    48114815 
    48124816                an->an_uapsd_overflowqdepth--; 
    48134817        } 
     4818 
     4819        /* Clean up node-specific rate things - this currently appears to always be a no-op */ 
     4820        sc->sc_rc->ops->node_cleanup(sc, ATH_NODE(ni)); 
    48144821 
    48154822        ATH_NODE_UAPSD_LOCK_IRQ(an); 
     
    48234830        struct ath_softc *sc = ni->ni_ic->ic_dev->priv; 
    48244831 
    4825         sc->sc_rc->ops->node_cleanup(sc, ATH_NODE(ni)); 
    48264832        sc->sc_node_free(ni); 
    48274833#ifdef ATH_SUPERG_XR 
     
    57045710                        type = ieee80211_input(ni, skb, 
    57055711                                ds->ds_rxstat.rs_rssi, ds->ds_rxstat.rs_tstamp); 
    5706                         ieee80211_free_node(ni); 
     5712                        ieee80211_unref_node(&ni); 
    57075713                } else { 
    57085714                        /* 
     
    57295735                                    sc->sc_keyixmap[keyix] == NULL) 
    57305736                                        sc->sc_keyixmap[keyix] = ieee80211_ref_node(ni); 
    5731                                 ieee80211_free_node(ni);  
     5737                                ieee80211_unref_node(&ni);  
    57325738                        } else 
    57335739                                type = ieee80211_input_all(ic, skb, 
     
    65306536                dev_kfree_skb(lastbuf->bf_skb); 
    65316537                lastbuf->bf_skb = NULL; 
    6532                 ieee80211_free_node(lastbuf->bf_node); 
    6533                 lastbuf->bf_node = NULL; 
     6538                ieee80211_unref_node(&lastbuf->bf_node); 
    65346539                ATH_TXBUF_LOCK_IRQ(sc); 
    65356540                STAILQ_INSERT_TAIL(&sc->sc_txbuf, lastbuf, bf_list); 
     
    72807285                         *     node was timed out due to inactivity. 
    72817286                         */ 
    7282                          ieee80211_free_node(ni);  
     7287                         ieee80211_unref_node(&ni);  
    72837288                } 
    72847289 
     
    75257530#endif /* ATH_SUPERG_FF */ 
    75267531                if (bf->bf_node) 
    7527                         ieee80211_free_node(bf->bf_node); 
     7532                        ieee80211_unref_node(&bf->bf_node); 
    75287533 
    75297534                bf->bf_skb = NULL; 
  • trunk/ath_rate/minstrel/minstrel.c

    r2349 r2357  
    343343 
    344344                        /* Don't look for slowest rate (i.e. slowest 
    345                          * base rate) We must presume that the slowest 
     345                         * base rate). We must presume that the slowest 
    346346                         * rate works fine, or else other management 
    347347                         * frames will also be failing - therefore the 
     
    350350                         * link in the first place. */ 
    351351                        ndx = sn->rs_sampleTable[sn->rs_sampleIndex][sn->rs_sampleColumn]; 
    352                         if (ndx >= sn->num_rates) 
    353                             ndx = 1; 
     352                         
    354353                        sn->rs_sampleIndex++; 
    355354                        if (sn->rs_sampleIndex > (sn->num_rates - 2)) { 
    356355                                sn->rs_sampleIndex = 0; 
     356                                 
    357357                                sn->rs_sampleColumn++; 
    358                                 if (sn->rs_sampleColumn == MINSTREL_COLUMNS) 
     358                                if (sn->rs_sampleColumn >= MINSTREL_COLUMNS) 
    359359                                        sn->rs_sampleColumn = 0; 
    360360                        } 
     
    479479 
    480480        if (!mrr) { 
    481                 if (ndx >= 0 && ndx < sn->num_rates) { 
     481                if ((0 <= ndx) && (ndx < sn->num_rates)) { 
    482482                        sn->rs_rateattempts[ndx]++; /* only one rate was used */ 
    483483                } 
     
    540540ath_fill_sample_table(struct minstrel_node *sn) 
    541541{ 
    542         unsigned int num_sample_rates = sn->num_rates; 
    543         unsigned int i, column_index; 
    544         int newIndex; 
    545         u_int8_t random_bytes[12]; 
    546  
    547         for(column_index = 0; column_index < MINSTREL_COLUMNS; column_index++) { 
    548                 for (i = 0; i <= IEEE80211_RATE_MAXSIZE; i++) 
    549                         sn->rs_sampleTable[i][column_index] = 0; 
    550  
    551                 for (i = 0; i < num_sample_rates; i++) { 
    552                         get_random_bytes(random_bytes, 8); 
    553                         newIndex = (i + (int)(random_bytes[i & 7])) % num_sample_rates; 
    554                         if (newIndex < 0) 
    555                                 newIndex = 2; 
    556  
    557                         while (sn->rs_sampleTable[newIndex][column_index] != 0) { 
    558                                 newIndex = ((int)(newIndex + 1)) % num_sample_rates; 
    559                                 if (newIndex < 0) 
    560                                         newIndex = 2; 
    561                         } 
    562  
    563                         sn->rs_sampleTable[newIndex][column_index] = i + 1; 
    564                 } 
    565         } 
     542        unsigned int num_sample_rates = (sn->num_rates - 1); 
     543        /* newIndex varies as 0 .. (num_rates - 2)  
     544         * The highest index rate is the slowest and is ignored */ 
     545        unsigned int i, column_index, newIndex; 
     546        u_int8_t random_bytes[8]; 
     547 
     548        /* This should be unnecessary if we are assuming storage is provided 
     549         * as zeroed */ 
     550        memset(sn->rs_sampleTable, 0, sizeof(sn->rs_sampleTable)); 
    566551 
    567552        sn->rs_sampleColumn = 0; 
    568553        sn->rs_sampleIndex = 0; 
    569554 
    570         /* Seed value to random number geenrator, which determines when we 
    571          * send a sample packet at some non-optimal rate */ 
     555        /* Seed value to random number generator, which determines when we 
     556         * send a sample packet at some non-optimal rate 
     557         * FIXME: randomise? */ 
    572558        sn->random_n = 1; 
    573559        sn->a = 1664525; 
    574560        sn->b = 1013904223; 
     561 
     562        if (sn->num_rates > 1) { 
     563                for(column_index = 0; column_index < MINSTREL_COLUMNS; column_index++) { 
     564                        for (i = 0; i < num_sample_rates; i++) { 
     565                                get_random_bytes(random_bytes, 8); 
     566                                newIndex = (i + random_bytes[i & 7]) % num_sample_rates; 
     567 
     568                                while (sn->rs_sampleTable[newIndex][column_index] != 0) 
     569                                        newIndex = (newIndex + 1) % num_sample_rates; 
     570 
     571                                sn->rs_sampleTable[newIndex][column_index] = i + 1; 
     572                        } 
     573                } 
     574        } 
     575 
    575576#if 0 
    576577        char rates[200]; 
     
    579580                p = rates + sprintf(rates, "rates :: %d ", column_index); 
    580581                for (i = 0; i < num_sample_rates; i++) 
    581                         p += sprintf(p, "%2d ", (int)sn->rs_sampleTable[i][column_index]) 
    582 
     582                        p += sprintf(p, "%2u ", sn->rs_sampleTable[i][column_index]); 
    583583                DPRINTF(sc, "%s\n", rates); 
    584584        }; 
     
    641641         
    642642        ni->ni_txrate = 0; 
    643         sn->num_rates = ni->ni_rates.rs_nrates; 
    644643 
    645644        if (sn->num_rates <= 0) { 
     
    660659                 * rate set is checked when the station associates. */ 
    661660                /* NB: the rate set is assumed sorted */ 
    662                 for (; srate >= 0 && (ni->ni_rates.rs_rates[srate] & IEEE80211_RATE_VAL) != vap->iv_fixed_rate; srate--); 
     661                for (; (srate >= 0) && (ni->ni_rates.rs_rates[srate] & IEEE80211_RATE_VAL) != vap->iv_fixed_rate; srate--); 
    663662 
    664663                KASSERT(srate >= 0, 
     
    670669                        dev_info, __func__, ether_sprintf(ni->ni_macaddr),  
    671670                        sn->rates[srate].rate / 2, 
    672                         (sn->rates[srate].rate % 0x1) ? ".5" : " "); 
     671                        (sn->rates[srate].rate % 2) ? ".5 " : " "); 
    673672                return; 
    674673        } 
     
    692691                for (retry_index = 2; retry_index < ATH_TXMAXTRY; retry_index++) { 
    693692                        tx_time = calc_usecs_unicast_packet(sc, 1200, sn->rates[x].rix, 0, retry_index); 
    694                         if (tx_time > ath_segment_size)  
     693                        if (tx_time > ath_segment_size)  
    695694                                break; 
    696695                        sn->retry_count[x] = retry_index; 
     
    918917                struct ath_softc *sc = vap->iv_ic->ic_dev->priv;; 
    919918 
     919        IEEE80211_NODE_TABLE_LOCK_IRQ(nt); 
    920920        TAILQ_FOREACH(ni, &nt->nt_node, ni_list) { 
    921921                /* Assume each node needs 1500 bytes */ 
     
    966966                p += sprintf(p, "Total packet count::    ideal %d      lookaround %d\n\n", odst->packet_count, odst->sample_count); 
    967967        } 
     968        IEEE80211_NODE_TABLE_UNLOCK_IRQ(nt); 
    968969 
    969970        return (p - buf); 
  • trunk/ath_rate/sample/sample.c

    r2261 r2357  
    947947        unsigned int size_bin; 
    948948 
     949        IEEE80211_NODE_TABLE_LOCK_IRQ(nt); 
    949950        TAILQ_FOREACH(ni, &nt->nt_node, ni_list) { 
    950951                /* Assume each node needs 500 bytes */ 
     
    997998                printk("\n"); 
    998999        } 
     1000        IEEE80211_NODE_TABLE_UNLOCK_IRQ(nt); 
    9991001 
    10001002        return (p - buf); 
  • trunk/net80211/ieee80211_input.c

    r2350 r2357  
    490490                                        ni_wds = ieee80211_find_wds_node(nt, wh->i_addr3); 
    491491                                        if (ni_wds) { 
    492                                                 ieee80211_free_node(ni_wds); /* Decr ref count */ 
     492                                                ieee80211_unref_node(&ni_wds); /* Decr ref count */ 
    493493                                                IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT, 
    494494                                                        wh, NULL, "%s", 
     
    544544                         * If not, add one. 
    545545                         */ 
     546                        /* XXX: Useless node mgmt API; make better */ 
    546547                        if (dir == IEEE80211_FC1_DIR_DSTODS) { 
    547548                                struct ieee80211_node_table *nt; 
    548549                                struct ieee80211_frame_addr4 *wh4; 
    549550                                struct ieee80211_node *ni_wds; 
     551 
    550552                                if (!(vap->iv_flags_ext & IEEE80211_FEXT_WDS)) { 
    551553                                        IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT, 
     
    570572                                        ieee80211_add_wds_addr(nt, ni, wh4->i_addr4, 0); 
    571573                                else 
    572                                         ieee80211_free_node(ni_wds); /* Decr ref count */ 
     574                                        ieee80211_unref_node(&ni_wds); /* Decr. ref count */ 
    573575                        } 
    574576                         
     
    937939                ni = ieee80211_ref_node(vap->iv_bss); 
    938940                type = ieee80211_input(ni, skb1, rssi, rstamp); 
    939                 ieee80211_free_node(ni); 
     941                ieee80211_unref_node(&ni); 
    940942        } 
    941943        if (skb != NULL)                /* no vaps, reclaim skb */ 
     
    987989 
    988990        /* 
    989          * Use this lock to make sure ni->ni_rxfrag is 
    990          * not freed by the timer process while we use it. 
    991          * XXX bogus 
    992          */ 
    993         IEEE80211_NODE_LOCK_IRQ(ni->ni_table); 
    994  
    995         /* 
    996991         * Update the time stamp.  As a side effect, it 
    997992         * also makes sure that the timer will not change 
    998993         * ni->ni_rxfrag for at least 1 second, or in 
    999994         * other words, for the remaining of this function. 
     995         * XXX HUGE HORRIFIC HACK 
    1000996         */ 
    1001997        ni->ni_rxfragstamp = jiffies; 
    1002  
    1003         IEEE80211_NODE_UNLOCK_IRQ(ni->ni_table); 
    1004998 
    1005999        /* 
     
    11311125                                } 
    11321126                                /* XXX statistic? */ 
    1133                                 ieee80211_free_node(ni1); 
     1127                                ieee80211_unref_node(&ni1); 
    11341128                        } 
    11351129                } 
     
    12661260{ 
    12671261        struct ieee80211vap *vap = ni->ni_vap; 
     1262        unsigned int tmpnode = 0; 
    12681263 
    12691264        if (ni->ni_authmode == IEEE80211_AUTH_SHARED) { 
     
    12731268                vap->iv_stats.is_rx_bad_auth++; /* XXX maybe a unique error? */ 
    12741269                if (vap->iv_opmode == IEEE80211_M_HOSTAP) { 
    1275                         /* XXX hack to workaround calling convention */ 
    1276  
    1277                         /* XXX To send the frame to the requesting STA, we have to 
    1278                          * create a node for the station that we're going to reject. 
    1279                          * The node will be freed automatically */ 
    12801270                        if (ni == vap->iv_bss) { 
    1281                                 ni = ieee80211_dup_bss(vap, wh->i_addr2); 
     1271                                ni = ieee80211_dup_bss(vap, wh->i_addr2, 0); 
    12821272                                if (ni == NULL) 
    12831273                                        return; 
     
    12861276                                "%s: %p<%s> refcnt %d\n", __func__, ni, ether_sprintf(ni->ni_macaddr),  
    12871277                                ieee80211_node_refcnt(ni)); 
     1278                                tmpnode = 1; 
    12881279                        } 
    12891280                        IEEE80211_SEND_MGMT(ni, IEEE80211_FC0_SUBTYPE_AUTH, 
    12901281                                (seq + 1) | (IEEE80211_STATUS_ALG << 16)); 
     1282                         
     1283                        if (tmpnode) 
     1284                                ieee80211_unref_node(&ni); 
    12911285                        return; 
    12921286                } 
     
    13161310                /* always accept open authentication requests */ 
    13171311                if (ni == vap->iv_bss) { 
    1318                         ni = ieee80211_dup_bss(vap, wh->i_addr2);  
     1312                        ni = ieee80211_dup_bss(vap, wh->i_addr2, 0);  
    13191313                        if (ni == NULL) 
    13201314                                return; 
     
    13231317                        "%s: %p<%s> refcnt %d\n", __func__, ni, ether_sprintf(ni->ni_macaddr),  
    13241318                        ieee80211_node_refcnt(ni)); 
    1325  
    1326                 } else if ((ni->ni_flags & IEEE80211_NODE_AREF) == 0) 
    1327                         (void) ieee80211_ref_node(ni); 
    1328                 /* 
    1329                  * Mark the node as referenced to reflect that it's 
    1330                  * reference count has been bumped to ensure it remains 
    1331                  * after the transaction completes. 
    1332                  */ 
    1333                 ni->ni_flags |= IEEE80211_NODE_AREF; 
    1334  
     1319                        tmpnode = 1; 
     1320                } 
     1321                 
    13351322                IEEE80211_SEND_MGMT(ni, IEEE80211_FC0_SUBTYPE_AUTH, seq + 1); 
    13361323                IEEE80211_NOTE(vap, IEEE80211_MSG_DEBUG | IEEE80211_MSG_AUTH, 
     
    13421329                if (ni->ni_authmode != IEEE80211_AUTH_8021X) 
    13431330                        ieee80211_node_authorize(ni); 
     1331                if (tmpnode) 
     1332                        ieee80211_unref_node(&ni); 
    13441333                break; 
    13451334 
     
    13801369 
    13811370        if (ni == vap->iv_bss) { 
    1382                 ni = ieee80211_tmp_node(vap, mac); 
     1371                ni = ieee80211_dup_bss(vap, mac, 1); 
    13831372                if (ni == NULL) { 
    13841373                        /* XXX msg */ 
     
    13901379        IEEE80211_SEND_MGMT(ni, subtype, arg); 
    13911380        if (istmp) 
    1392                 ieee80211_free_node(ni); 
     1381                ieee80211_unref_node(&ni); 
    13931382} 
    13941383 
     
    14161405        struct ieee80211vap *vap = ni->ni_vap; 
    14171406        u_int8_t *challenge; 
    1418         int allocbs, estatus
     1407        int allocbs = 0, estatus = 0
    14191408 
    14201409        /* 
     
    14261415         * for sanity/consistency. 
    14271416         */ 
    1428         estatus = 0;                    /* NB: silence compiler */ 
    14291417        if ((vap->iv_flags & IEEE80211_F_PRIVACY) == 0) { 
    14301418                IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_AUTH, 
     
    15061494                case IEEE80211_AUTH_SHARED_REQUEST: 
    15071495                        if (ni == vap->iv_bss) { 
    1508                                 ni = ieee80211_dup_bss(vap, wh->i_addr2); 
     1496                                ni = ieee80211_dup_bss(vap, wh->i_addr2, 0); 
    15091497                                if (ni == NULL) { 
    15101498                                        /* NB: no way to return an error */ 
     
    15171505 
    15181506                                allocbs = 1; 
    1519                         } else { 
    1520                                 if ((ni->ni_flags & IEEE80211_NODE_AREF) == 0) 
    1521                                         (void) ieee80211_ref_node(ni); 
    1522                                 allocbs = 0; 
    1523                         } 
    1524                         /* 
    1525                          * Mark the node as referenced to reflect that it's 
    1526                          * reference count has been bumped to ensure it remains 
    1527                          * after the transaction completes. 
    1528                          */ 
    1529                         ni->ni_flags |= IEEE80211_NODE_AREF; 
     1507                        } 
     1508 
    15301509                        ni->ni_rssi = rssi; 
    15311510                        ni->ni_rstamp = rstamp; 
     
    16211600        return; 
    16221601bad: 
    1623         /* 
    1624          * Send an error response; but only when operating as an AP. 
    1625          */ 
     1602        /* Send an error response; but only when operating as an AP. */ 
    16261603        if (vap->iv_opmode == IEEE80211_M_HOSTAP) { 
    16271604                /* XXX hack to workaround calling convention */ 
     
    16291606                        IEEE80211_FC0_SUBTYPE_AUTH, 
    16301607                        (seq + 1) | (estatus<<16)); 
     1608                ieee80211_node_leave(ni); 
    16311609        } else if (vap->iv_opmode == IEEE80211_M_STA) { 
    16321610                /* 
     
    20922070        if (len > 2) 
    20932071                rsn_parm->rsn_caps = LE_READ_2(frm); 
    2094         /* XXXPMKID */ 
     2072        /* XXX PMKID */ 
    20952073 
    20962074        return 0; 
     
    26012579        u_int8_t *ssid, *rates, *xrates, *wpa, *rsn, *wme, *ath; 
    26022580        u_int8_t rate; 
    2603         int reassoc, resp, allocbs
     2581        int reassoc, resp, allocbs = 0
    26042582        u_int8_t qosinfo; 
    26052583 
     
    30092987                                        wh->i_addr2); 
    30102988                        } else { 
    3011                                 ni = ieee80211_tmp_node(vap, wh->i_addr2); 
     2989                                ni = ieee80211_dup_bss(vap, wh->i_addr2, 1); 
    30122990                        } 
    30132991                        if (ni == NULL) 
    30142992                                return; 
    30152993                        allocbs = 1; 
    3016                 } else 
    3017                         allocbs = 0; 
     2994                } 
     2995 
    30182996                IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_INPUT, wh->i_addr2, 
    30192997                        "%s", "recv probe req"); 
     
    30383016                         * response, reclaim immediately 
    30393017                         */ 
    3040                         ieee80211_free_node(ni); 
     3018                        ieee80211_unref_node(&ni); 
    30413019                } else if (ath != NULL) 
    30423020                        ieee80211_saveath(ni, ath); 
     
    30683046                                else { 
    30693047                                        ieee80211_node_leave(ni); 
     3048                                        /* This would be a stupid place to add a node to the table 
     3049                                         * XR stuff needs work anyway 
     3050                                         */ 
    30703051                                        ieee80211_node_reset(ni, vap->iv_xrvap); 
    30713052                                } 
     
    30803061                IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_AUTH, wh->i_addr2, 
    30813062                        "recv auth frame with algorithm %d seq %d", algo, seq); 
    3082                 /* 
    3083                  * Consult the ACL policy module if setup. 
    3084                  */ 
     3063                /* Consult the ACL policy module if setup. */ 
    30853064                if (vap->iv_acl != NULL && 
    30863065                    !vap->iv_acl->iac_check(vap, wh->i_addr2)) { 
     
    31153094                                ieee80211_send_error(ni, wh->i_addr2, 
    31163095                                        IEEE80211_FC0_SUBTYPE_AUTH, 
    3117                                         (seq+1) | (IEEE80211_STATUS_ALG << 16)); 
     3096                                        (seq + 1) | (IEEE80211_STATUS_ALG << 16)); 
    31183097                        } 
    31193098                        return; 
  • trunk/net80211/ieee80211_linux.c

    r2344 r2357  
    359359        struct ieee80211_node_table *nt = (struct ieee80211_node_table *) &vap->iv_ic->ic_sta; 
    360360 
    361         //IEEE80211_NODE_LOCK(nt);                                                                                
     361        IEEE80211_NODE_TABLE_LOCK_IRQ(nt); 
    362362        TAILQ_FOREACH(ni, &nt->nt_node, ni_list) { 
    363363                /* Assume each node needs 500 bytes */ 
     
    377377                } 
    378378        } 
    379         //IEEE80211_NODE_UNLOCK(nt);                                                                              
     379        IEEE80211_NODE_TABLE_UNLOCK_IRQ(nt); 
    380380        return (p - buf); 
    381381} 
  • trunk/net80211/ieee80211_linux.h

    r2300 r2357  
    6464#define IEEE80211_RESCHEDULE    schedule 
    6565 
     66/* Locking */ 
     67/* NB: beware, spin_is_locked() is not usefully defined for !(DEBUG || SMP) 
     68 * because spinlocks do not exist in this configuration. Instead IRQs  
     69 * or pre-emption are simply disabled, as this is all that is needed. 
     70 */ 
     71 
    6672/* 
    6773 * Beacon handler locking definitions. 
     
    8692#define IEEE80211_UNLOCK(_ic)   spin_unlock(&(_ic)->ic_comlock) 
    8793 
    88 /* NB: beware, spin_is_locked() is unusable for !SMP */ 
    89 #if defined(CONFIG_SMP) 
     94#if (defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)) && defined(spin_is_locked) 
    9095#define IEEE80211_LOCK_ASSERT(_ic) \ 
    9196        KASSERT(spin_is_locked(&(_ic)->ic_comlock),("ieee80211com not locked!")) 
     
    9398#define IEEE80211_LOCK_ASSERT(_ic) 
    9499#endif 
     100 
    95101 
    96102#define IEEE80211_VAPS_LOCK_INIT(_ic, _name)            \