From owner-freebsd-wireless@FreeBSD.ORG Tue Jul 31 01:17:11 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 9C868106566C for ; Tue, 31 Jul 2012 01:17:11 +0000 (UTC) (envelope-from moonlightakkiy@yahoo.ca) Received: from nm8.bullet.mail.bf1.yahoo.com (nm8.bullet.mail.bf1.yahoo.com [98.139.212.167]) by mx1.freebsd.org (Postfix) with ESMTP id 425E98FC14 for ; Tue, 31 Jul 2012 01:17:10 +0000 (UTC) Received: from [98.139.212.146] by nm8.bullet.mail.bf1.yahoo.com with NNFMP; 31 Jul 2012 01:17:04 -0000 Received: from [98.139.211.192] by tm3.bullet.mail.bf1.yahoo.com with NNFMP; 31 Jul 2012 01:17:04 -0000 Received: from [127.0.0.1] by smtp201.mail.bf1.yahoo.com with NNFMP; 31 Jul 2012 01:17:04 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.ca; s=s1024; t=1343697424; bh=pob/hpJhnHfgeuUFt4cgL2PPOm5f4xU9bcrKmS3aOVA=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Received:MIME-Version:Received:Received:In-Reply-To:References:Date:Message-ID:Subject:From:To:Cc:Content-Type; b=ducB6RZpJtzOYTlfNNcyp1ZzFFrQBSlXz6MavDVCVGTAPvfDs7vetGMS8fSPIJv6z/fsJ+rIVkvRABxMfHDjSn0OwqKLgRgSsyh8K+aa35Fm1vZCtxJVoM3x5XxfTe0iYBvCj2FSUFwV4GOhtOc6ZcIVh+gH442aw3mmnMc1Bmw= X-Yahoo-Newman-Id: 227370.10558.bm@smtp201.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: GvdWDVoVM1m48f_oEf5bounGmMw3aBsm6MObKHASH9sU0Yt zvW0EMTnlmQHZTjE0itrzK1i.sgKpP5xQ3dQNHAL7ZGF3GaFgl6PIMl2mj.f h9xXTELXCpKoeUAIPCDzvQx7pHAO1xKjuKWHmUymIIQowlpFXsvsIEUq4vSY b2.dDv.sRjYqrFRmzaz66ku7c9nG.4R_TM6LBQm0cqLnB2Y9mfV9CcM136lI BrMxECnmr6NEOpd0uGOOQnzRz4o0yCEGz1NzgBtFtJKAM7ytr94DUjIGDMbt iwm0n9MgqkB2QpH2JltofqK8tSPAvaG8RNxIUYeh7lCYWy6OVszE5xOM25aq 9D.65u6UjafmBDH3mQD5gXid2NY3c9C7moNVxlUV6Il0SLw2n.uRcqEIvm6h 7AaqGC_DlGjxczpO2KCzJcxMLtgy66Plq2vi0RMeAEosYhDSrGQPOnQt.42L eViQAtMp8aDWTkAhs0cQ- X-Yahoo-SMTP: Xr6qjFWswBAEmd20sAvB4Q3keqXvXsIH9TjJ Received: from mail-vc0-f182.google.com (moonlightakkiy@209.85.220.182 with plain) by smtp201.mail.bf1.yahoo.com with SMTP; 30 Jul 2012 18:17:04 -0700 PDT Received: by vcbgb22 with SMTP id gb22so6377474vcb.13 for ; Mon, 30 Jul 2012 18:17:03 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.97.196 with SMTP id ec4mr11265406vdb.96.1343697423259; Mon, 30 Jul 2012 18:17:03 -0700 (PDT) Received: by 10.59.10.194 with HTTP; Mon, 30 Jul 2012 18:17:03 -0700 (PDT) In-Reply-To: References: Date: Mon, 30 Jul 2012 19:17:03 -0600 Message-ID: From: PseudoCylon To: Adrian Chadd , Kim Culhan Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-wireless@freebsd.org 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:17:11 -0000 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); }