linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhu Yi <yi.zhu@intel.com>
To: Dan Williams <dcbw@redhat.com>
Cc: linux-wireless@vger.kernel.org,
	ipw2100-devel@lists.sourceforge.net,
	"John W. Linville" <linville@tuxdriver.com>
Subject: Re: [PATCH] ipw2200: expire and use oldest BSS on adhoc create
Date: Fri, 30 May 2008 08:56:05 +0800	[thread overview]
Message-ID: <1212108965.7814.316.camel@debian.sh.intel.com> (raw)
In-Reply-To: <1212086308.25805.25.camel@localhost.localdomain>

On Thu, 2008-05-29 at 14:38 -0400, Dan Williams wrote:
> If there are no networks on the free list, expire the oldest one when
> creating a new adhoc network.  Because ipw2200 and the ieee80211 stack
> don't actually cull old networks and place them back on the free list
> unless they are needed for new probe responses, over time the free list
> would become empty and creating an adhoc network would fail due to the !
> list_empty(...) check.
> 
> Signed-off-by: Dan Williams <dcbw@redhat.com>

ACK. Looks like you are doing stress testing to create/delete ad-hoc
networks (> 128) ;-)

Thanks,
-yi

> diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
> index d74c061..db2bf46 100644
> --- a/drivers/net/wireless/ipw2200.c
> +++ b/drivers/net/wireless/ipw2200.c
> @@ -7558,8 +7558,31 @@ static int ipw_associate(void *data)
>  	    priv->ieee->iw_mode == IW_MODE_ADHOC &&
>  	    priv->config & CFG_ADHOC_CREATE &&
>  	    priv->config & CFG_STATIC_ESSID &&
> -	    priv->config & CFG_STATIC_CHANNEL &&
> -	    !list_empty(&priv->ieee->network_free_list)) {
> +	    priv->config & CFG_STATIC_CHANNEL) {
> +		/* Use oldest network if the free list is empty */
> +		if (list_empty(&priv->ieee->network_free_list)) {
> +			struct ieee80211_network *oldest = NULL;
> +			struct ieee80211_network *target;
> +			DECLARE_MAC_BUF(mac);
> +
> +			list_for_each_entry(target, &priv->ieee->network_list, list) {
> +				if ((oldest == NULL) ||
> +				    (target->last_scanned < oldest->last_scanned))
> +					oldest = target;
> +			}
> +
> +			/* If there are no more slots, expire the oldest */
> +			list_del(&oldest->list);
> +			target = oldest;
> +			IPW_DEBUG_ASSOC("Expired '%s' (%s) from "
> +					"network list.\n",
> +					escape_essid(target->ssid,
> +						     target->ssid_len),
> +					print_mac(mac, target->bssid));
> +			list_add_tail(&target->list,
> +				      &priv->ieee->network_free_list);
> +		}
> +
>  		element = priv->ieee->network_free_list.next;
>  		network = list_entry(element, struct ieee80211_network, list);
>  		ipw_adhoc_create(priv, network);


  reply	other threads:[~2008-05-30  0:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-29 18:38 [PATCH] ipw2200: expire and use oldest BSS on adhoc create Dan Williams
2008-05-30  0:56 ` Zhu Yi [this message]
2008-05-30 17:42   ` Dan Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1212108965.7814.316.camel@debian.sh.intel.com \
    --to=yi.zhu@intel.com \
    --cc=dcbw@redhat.com \
    --cc=ipw2100-devel@lists.sourceforge.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).