From owner-freebsd-wireless@FreeBSD.ORG Tue Jul 31 07:24:26 2012 Return-Path: Delivered-To: freebsd-wireless@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 28842106566C for ; Tue, 31 Jul 2012 07:24:26 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id EDE088FC08 for ; Tue, 31 Jul 2012 07:24:25 +0000 (UTC) Received: by pbbro2 with SMTP id ro2so11740717pbb.13 for ; Tue, 31 Jul 2012 00:24:25 -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=jRzfGB45hOWbR6aBSwPwKKXqe3c6AdD6rRIXc/U4GyU=; b=xQ9Il7xZMLXaPFEjGUNrqJDar3jMCLHnNH4MPkCpw8fu9zO2GCTuO4Hoxcdis0lJz8 S56CAimCV+Toaz0aqkMT8gR7G+8hTHcVL0sagc7RC7V009NThSYf+UNh2qbgUkBSsUx1 ECNQWIBN9rfn4h8M6OLALetfFhPpbQZVhS/1K/dca1inN9shoxksgkdCB3c+b4WOsN70 OF04khL4hA7uuKCMKUHEdRzGHqTAyx3tttYPXWTSVL0OAZ+KbMpimWE4uaotOuoJnD2d 1kImxMpQ14q8bAI+Yg1zJzgA6yYgn17mEk11T/iFnvM6/v0EyikWSbs3traai9P3c6G5 BXGA== MIME-Version: 1.0 Received: by 10.68.212.138 with SMTP id nk10mr41781191pbc.93.1343719465702; Tue, 31 Jul 2012 00:24:25 -0700 (PDT) Received: by 10.68.66.136 with HTTP; Tue, 31 Jul 2012 00:24:25 -0700 (PDT) In-Reply-To: References: Date: Tue, 31 Jul 2012 00:24:25 -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 07:24:26 -0000 Hm, don't do that - do all of the node table and scan generation counter stuff in the loop that populates the list of nodes. Then once you have that list, just call each and unlock. Adrian On 30 July 2012 22:33, PseudoCylon 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); > }