Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Jul 2012 23:33:21 -0600
From:      PseudoCylon <moonlightakkiy@yahoo.ca>
To:        Adrian Chadd <adrian.chadd@gmail.com>
Cc:        freebsd-wireless@freebsd.org, Kim Culhan <w8hdkim@gmail.com>
Subject:   Re: ath lor
Message-ID:  <CAFZ_MYJP97aO73zLpJF9%2B8MiQVqAHGNngmtOakYDcaikvyq7og@mail.gmail.com>
In-Reply-To: <CAJ-VmomGBvgLwFEcXbEuYkAj=g%2By8zVo8cT2nSSMdydCk=OhYQ@mail.gmail.com>
References:  <CAFZ_MYKgUkryy4parts3QahAyPA7FY9xUqC98_E7oFW%2BzarA8A@mail.gmail.com> <CAFZ_MYKeOKxT3k7JWHjdH83vbieZ6JpXe0kbXTJy4neEd5Aqew@mail.gmail.com> <CAJ-VmomGBvgLwFEcXbEuYkAj=g%2By8zVo8cT2nSSMdydCk=OhYQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jul 30, 2012 at 7:22 PM, Adrian Chadd <adrian.chadd@gmail.com> wrote:
> Yeah, That's what I had in mind.
>
> Trouble is, the AID isn't fixed at that value:
>
> vap->iv_max_aid = IEEE80211_AID_DEF;
>
> So likely we should malloc (M_NOWAIT | M_ZERO) a temporary array of
> size iv_max_aid.
>
> Have you seen the scan/node LORs? Are you able to verify that your
> change fixes that?
>

Not yet. Though, I think we still need to do something with
ieee80211_timeout_stations() and com lock. driver/iterate lock LOR
seems gone. Will post when I find more.


Quick update (I haven't run it, yet). I'll set up a repository soon.

void
ieee80211_iterate_nt(struct node_table *nt, struct ieee80211_node **ni_arr,
    u_int *gen)
{
        struct ieee80211_node *ni;
        int i = 0;

        IEEE80211_NODE_ITERATE_LOCK(nt);
        *gen = ++nt->nt_scangen;

        TAILQ_FOREACH(ni, &nt->nt_node, ni_list)
                (*(ni_arr + i++)) = ieee80211_ref_node(ni);

        IEEE80211_NODE_ITERATE_UNLOCK(nt);
}

/*
 * Just a wrapper, so we don't have to change every ieee80211_iterate_nodes()
 * reference in the source.
 *
 * A caller may directly call ieee80211_iterate_nt() and do customized stuff.
 * Only requirement is to decrement each node's ref count.
 */
void
ieee80211_iterate_nodes(struct ieee80211_node_table *nt,
    ieee80211_iter_func *f, void *arg)
{
        struct ieee80211_node **ni_arr;
        unsigned long size;
        u_int gen;
        int i;

        size = ni->ni_vap->iv_max_aid * sizeof(*ni_arr);
        ni_arr = (struct ieee80211_node **)malloc(size, M_80211_NODE,
            M_NOWAIT | M_ZERO);
        if (ni_arr == NULL)
                return;

        ieee80211_iterate_nt(nt, ni_arr, &gen);

        IEEE80211_NODE_LOCK(nt);

        for (i = 0; i < IEEE80211_AID_DEF; i++) {
                if (ni == NULL) /* end of the list */
                        break;
                if (ni->ni_scangen == gen)
                        continue;

                ni->ni_scangen = gen;

                IEEE80211_NODE_UNLOCK(nt);
                (*f)(arg, *(ni_arr + i));
                /* ieee80211_free_node() locks by itself */
                ieee80211_free_node(ni);
                IEEE80211_NODE_LOCK(nt);

                i = 0;
        }

        IEEE80211_NODE_UNLOCK(nt);

        free(ni_addr, M_80211_NODE);
}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFZ_MYJP97aO73zLpJF9%2B8MiQVqAHGNngmtOakYDcaikvyq7og>