linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
To: linux-wireless@vger.kernel.org
Cc: Daniel Drake <dsd@gentoo.org>,
	zd1211-devs@lists.sourceforge.net,
	Ulrich Kunitz <kune@deine-taler.de>
Subject: [RFC PATCH 1/6] zd1211rw: fix beacon interval setup
Date: Sun, 26 Dec 2010 13:24:14 +0200	[thread overview]
Message-ID: <20101226112414.31775.62053.stgit@fate.lan> (raw)
In-Reply-To: <20101226112404.31775.77854.stgit@fate.lan>

Vendor driver uses CR_BNC_INTERVAL at various places, one is HW_EnableBeacon()
that combinies beacon interval with BSS-type flag and DTIM value in upper
16bit of u32. The other one is HW_UpdateBcnInterval() that set_aw_pt_bi()
appears to be based on. HW_UpdateBcnInterval() takes interval argument as u16
and uses that for calculations, set_aw_pt_bi() uses u32 value that has flags
and dtim in upper part. This clearly seems wrong. Also HW_UpdateBcnInterval()
updates only lower 16bit part of CR_BNC_INTERVAL.

So make set_aw_pt_bi() do calculations on only lower u16 part of
s->beacon_interval.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
---
 drivers/net/wireless/zd1211rw/zd_chip.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c
index 30f8d40..f21cd7e 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.c
+++ b/drivers/net/wireless/zd1211rw/zd_chip.c
@@ -849,10 +849,12 @@ static int set_aw_pt_bi(struct zd_chip *chip, struct aw_pt_bi *s)
 {
 	struct zd_ioreq32 reqs[3];
 
-	if (s->beacon_interval <= 5)
-		s->beacon_interval = 5;
+	if ((s->beacon_interval & 0xffff) <= 5) {
+		s->beacon_interval &= ~0xffff;
+		s->beacon_interval |= 5;
+	}
 	if (s->pre_tbtt < 4 || s->pre_tbtt >= s->beacon_interval)
-		s->pre_tbtt = s->beacon_interval - 1;
+		s->pre_tbtt = (s->beacon_interval & 0xffff) - 1;
 	if (s->atim_wnd_period >= s->pre_tbtt)
 		s->atim_wnd_period = s->pre_tbtt - 1;
 


  reply	other threads:[~2010-12-26 11:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-26 11:24 [RFC PATCH 0/6] zd1211rw: add support for AP mode Jussi Kivilinna
2010-12-26 11:24 ` Jussi Kivilinna [this message]
2010-12-26 11:56   ` [RFC PATCH 1/6] zd1211rw: fix beacon interval setup Rafał Miłecki
2010-12-26 11:24 ` [RFC PATCH 2/6] zd1211rw: support setting BSSID for AP mode Jussi Kivilinna
2010-12-26 11:24 ` [RFC PATCH 3/6] zd1211rw: let zd_set_beacon_interval() set dtim_period and add AP-beacon flag Jussi Kivilinna
2010-12-26 12:14   ` Rafał Miłecki
2010-12-26 14:50     ` Jussi Kivilinna
2010-12-26 11:24 ` [RFC PATCH 4/6] zd1211rw: implement seq_num for IEEE80211_TX_CTL_ASSIGN_SEQ Jussi Kivilinna
2010-12-26 11:24 ` [RFC PATCH 5/6] zd1211rw: implement beacon fetching and handling ieee80211_get_buffered_bc() Jussi Kivilinna
2010-12-26 12:22   ` Rafał Miłecki
2010-12-26 14:51     ` Jussi Kivilinna
2010-12-26 11:25 ` [RFC PATCH 6/6] zd1211rw: enable NL80211_IFTYPE_AP Jussi Kivilinna
2010-12-26 12:24 ` [RFC PATCH 0/6] zd1211rw: add support for AP mode Johannes Berg
2010-12-26 12:37   ` Rafał Miłecki
2010-12-26 14:53     ` Jussi Kivilinna
2010-12-27 14:28 ` Jussi Kivilinna
2010-12-27 20:03   ` Jussi Kivilinna

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=20101226112414.31775.62053.stgit@fate.lan \
    --to=jussi.kivilinna@mbnet.fi \
    --cc=dsd@gentoo.org \
    --cc=kune@deine-taler.de \
    --cc=linux-wireless@vger.kernel.org \
    --cc=zd1211-devs@lists.sourceforge.net \
    /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).