Date: Mon, 30 Jul 2012 19:17:03 -0600 From: PseudoCylon <moonlightakkiy@yahoo.ca> To: Adrian Chadd <adrian.chadd@gmail.com>, Kim Culhan <w8hdkim@gmail.com> Cc: freebsd-wireless@freebsd.org Subject: Re: ath lor Message-ID: <CAFZ_MYKeOKxT3k7JWHjdH83vbieZ6JpXe0kbXTJy4neEd5Aqew@mail.gmail.com> In-Reply-To: <CAFZ_MYKgUkryy4parts3QahAyPA7FY9xUqC98_E7oFW%2BzarA8A@mail.gmail.com> References: <CAFZ_MYKgUkryy4parts3QahAyPA7FY9xUqC98_E7oFW%2BzarA8A@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jul 30, 2012 at 3:16 AM, PseudoCylon <moonlightakkiy@yahoo.ca> wrote: >> ------------------------------ >> >> Message: 3 >> Date: Sat, 28 Jul 2012 19:36:38 -0700 >> From: Adrian Chadd <adrian.chadd@gmail.com> >> Subject: Re: ath lor >> To: Kim Culhan <w8hdkim@gmail.com> >> Cc: freebsd-wireless@freebsd.org >> Message-ID: >> <CAJ-VmonVdu8QEETKeBF6HOY5DTzxT4OH6z8xJecUGZgmQ58grw@mail.gmail.com> >> Content-Type: text/plain; charset=ISO-8859-1 >> >> Hm, if someone's up for a bit of coding, here's my suggestIon: >> >> * create an iterator struct which just contains an array of >> ieee80211_node entries; >> * write an iterator function that _just_ populates that iterator >> struct with ieee80211 node entries, but after having locked them; >> * then, once the call to ieee80211_iterate_node() is done, the >> iterator struct will have a list of nodes to iterate over; >> * then just call the original callback over each member of that >> iterator struct node array, derefing nodes as you go along. >> > [RFC] I guess this what you want. ieee80211_timeout_stations() needs a special attention, though. 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. */ ieee80211_iterate_nodes(struct ieee80211_node_table *nt, ieee80211_iter_func *f, void *arg) { /* * Any driver should allocate array with own max aid * when directly calling ieee80211_iterate_nt(). */ struct ieee80211_node *ni_arr[IEEE80211_AID_DEF]; u_int gen; int i; memset(ni_arr, 0, sizeof(ni_arr)); 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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFZ_MYKeOKxT3k7JWHjdH83vbieZ6JpXe0kbXTJy4neEd5Aqew>