From owner-freebsd-wireless@FreeBSD.ORG Tue Jul 31 01:22:44 2012 Return-Path: Delivered-To: freebsd-wireless@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 638381065672 for ; Tue, 31 Jul 2012 01:22:44 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-gg0-f182.google.com (mail-gg0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id 1CBB38FC14 for ; Tue, 31 Jul 2012 01:22:44 +0000 (UTC) Received: by ggnm2 with SMTP id m2so6451291ggn.13 for ; Mon, 30 Jul 2012 18:22:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Jbwiz/ktPxhqpQVAijDvMBfLZdbNo+yNfjNnv8O0X6Y=; b=uoyjoh/yvyTYTsz1mwTSmjj7oQZfylceuH2ZLRXpIhqECN+RO5+LCZ9ZxP15Pbox4R WHdZRpAqjvIaA0ox5Q045BLQ2aMZorkhP1a7wYB8f+k6w+cRu8Wbd2LG0ytwcgapnSw2 WOklv1j+P81VRt/hgad7adsuM2isM2SRSg8kmuFjr6J2oM/iHhfnm5LSZS10+XbRh2Ze i2FB81XOnWJ/Ci/tnyUGWrRI7fN/103kc6wPioAKUYNVLuS5KHxbdoBgUf5/1GB8DtES KTW5C3CK03hSL/jDz8H4Fp4DA93KqesEbOf3utKukk3Szr/XBvulSkxElUFbF5ONjtVE XFig== MIME-Version: 1.0 Received: by 10.66.75.201 with SMTP id e9mr28465100paw.54.1343697763073; Mon, 30 Jul 2012 18:22:43 -0700 (PDT) Received: by 10.68.66.136 with HTTP; Mon, 30 Jul 2012 18:22:43 -0700 (PDT) In-Reply-To: References: Date: Mon, 30 Jul 2012 18:22:43 -0700 Message-ID: From: Adrian Chadd To: PseudoCylon Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-wireless@freebsd.org, Kim Culhan Subject: Re: ath lor X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussions of 802.11 stack, tools device driver development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jul 2012 01:22:44 -0000 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? Adrian On 30 July 2012 18:17, PseudoCylon wrote: > On Mon, Jul 30, 2012 at 3:16 AM, PseudoCylon wrote: >>> ------------------------------ >>> >>> Message: 3 >>> Date: Sat, 28 Jul 2012 19:36:38 -0700 >>> From: Adrian Chadd >>> Subject: Re: ath lor >>> To: Kim Culhan >>> Cc: freebsd-wireless@freebsd.org >>> Message-ID: >>> >>> 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); > }