From owner-freebsd-net@FreeBSD.ORG Fri Feb 4 11:40:25 2011 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 908521065674; Fri, 4 Feb 2011 11:40:25 +0000 (UTC) (envelope-from alex@zagrebin.ru) Received: from mail.zagrebin.ru (gw.zagrebin.ru [91.215.205.128]) by mx1.freebsd.org (Postfix) with ESMTP id 3452E8FC12; Fri, 4 Feb 2011 11:40:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zagrebin.ru; s=mail; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=XBfKrxT8oDazwxH2snajU5Zg4BExf2soMmTsmhH1WFs=; b=2wwyxb6HAflusBalc2237xWEnRmLVBfACDbFOBGWlvURQ+fVK/p6QmDhHk3ipP/qG54zijVfY7q0jyH5DEwSc4/KM+kfWsf5CapGGwyP6BUK8RagXutn0WCt84LS6Mhsp/QvJo3KFJIkTECwUll6WzYJmUt5ULLU4NH8dOsJXpM=; Received: from alex by mail.zagrebin.ru with local (Exim 4.74 (FreeBSD)) (envelope-from ) id 1PlK1W-0000tj-DG; Fri, 04 Feb 2011 14:40:22 +0300 Date: Fri, 4 Feb 2011 14:40:21 +0300 From: Alexander Zagrebin To: Bernhard Schmidt Message-ID: <20110204114021.GA237@gw.zagrebin.ru> References: <20110204060808.GA97298@gw.zagrebin.ru> <201102040951.34201.bschmidt@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201102040951.34201.bschmidt@freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-net@freebsd.org Subject: Re: if_run in hostap mode: issue with stations in the power save mode X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Feb 2011 11:40:25 -0000 Hi! On 04.02.2011 09:51:34 +0100, Bernhard Schmidt wrote: > On Friday 04 February 2011 07:08:08 Alexander Zagrebin wrote: > > I'm using an Ralink RT2870 based adapter (run(4) driver) in the > > hostap mode. and I've noticed that if_run doesn't support stations > > working in the power save mode (PSM). The reason is in lack of the > > TIM in beacons. The attached patch adds this functionality and > > completely fixes this issue. Despite the fact that patch is working, > > it seems that it needs an additional work. For example, now the > > result of ieee80211_beacon_update is ignored with a corresponding > > message, but may be necessary to process it... > > > > Can somebody review it? > > That looks about right, good catch! > > Handling ieee80211_beacon_update()'s return value doesn't seem to be > necessary, the mbuf's length is handled in the next few lines of code > anyways, doesn't matter if it changed or not. > > Though, I have a some doubts about just restoring bo_flags is enough > (Can't prove that with some obvious code, still..). It feels saner to me > if we just reuse the whole mbuf, similar to what ath(4) does. Can you > look at attached patch? Completely untested, so I'm not sure what does > happen on e.g. changing the SSID. I've thought about such solution, and it looks more right, but I've decided just to add ieee80211_beacon_update() to make the patch clear. I'll try your patch a bit later, but I already have a question: on the first invocation of the run_update_beacon_cb() only ieee80211_beacon_alloc() will be called. So dynamic beacon contents will not updated. Is it a problem? Also I have to note, that it seems that other wlan drivers can has this problem too: only ral's and ath's code uses ieee80211_beacon_update(). Also, I've found a kern/124753. One of replies contains a log's fragment with many records, like following: kernel: ath0: [00:18:41:c0:06:54] power save mode on, 1 sta's in ps mode kernel: ath0: [00:18:41:c0:06:54] save frame with age 0, 1 now queued kernel: ath0: [00:18:41:c0:06:54] save frame with age 0, 2 now queued kernel: ath0: [00:18:41:c0:06:54] power save mode off, 0 sta's in ps mode kernel: ath0: [00:18:41:c0:06:54] flush ps queue, 2 packets queue But there are no records, which have to be for a PSM enabled stations: When a beacon is properly updated, then we have to see records about 1. TIM updating, like ieee80211_beacon_update: TIM updated, pending 1, off 0, len 1 2. poll messages from a stations, like wlan0: [18:86:ac:10:4b:88] recv ps-poll, send packet, queue empty Thanks for your cooperation! -- Alexander Zagrebin