From: David Gibson <david@gibson.dropbear.id.au>
To: Jeff Garzik <jgarzik@pobox.com>, Pavel Roskin <proski@gnu.org>,
Orinoco Development List <orinoco-devel@lists.sourceforge.net>,
netdev@oss.sgi.com, linux-kernel@vger.kernel.org
Subject: [1/5] Orinoco merge updates, part the fourth: wireless stats updates
Date: Wed, 30 Mar 2005 13:43:16 +1000 [thread overview]
Message-ID: <20050330034316.GG6478@localhost.localdomain> (raw)
In-Reply-To: <20050330034238.GF6478@localhost.localdomain>
Minor updates/bugfixes to the handling of wireless statistics.
Signed-off-by: David Gibson <hermes@gibson.dropbear.id.au>
Index: working-2.6/drivers/net/wireless/orinoco.c
===================================================================
--- working-2.6.orig/drivers/net/wireless/orinoco.c 2005-02-25 15:47:53.314373136 +1100
+++ working-2.6/drivers/net/wireless/orinoco.c 2005-02-25 16:20:13.951351472 +1100
@@ -686,7 +686,7 @@
struct orinoco_private *priv = netdev_priv(dev);
hermes_t *hw = &priv->hw;
struct iw_statistics *wstats = &priv->wstats;
- int err = 0;
+ int err;
unsigned long flags;
if (! netif_device_present(dev)) {
@@ -695,9 +695,21 @@
return NULL; /* FIXME: Can we do better than this? */
}
+ /* If busy, return the old stats. Returning NULL may cause
+ * the interface to disappear from /proc/net/wireless */
if (orinoco_lock(priv, &flags) != 0)
- return NULL; /* FIXME: Erg, we've been signalled, how
- * do we propagate this back up? */
+ return wstats;
+
+ /* We can't really wait for the tallies inquiry command to
+ * complete, so we just use the previous results and trigger
+ * a new tallies inquiry command for next time - Jean II */
+ /* FIXME: Really we should wait for the inquiry to come back -
+ * as it is the stats we give don't make a whole lot of sense.
+ * Unfortunately, it's not clear how to do that within the
+ * wireless extensions framework: I think we're in user
+ * context, but a lock seems to be held by the time we get in
+ * here so we're not safe to sleep here. */
+ hermes_inquire(hw, HERMES_INQ_TALLIES);
if (priv->iw_mode == IW_MODE_ADHOC) {
memset(&wstats->qual, 0, sizeof(wstats->qual));
@@ -716,25 +728,16 @@
err = HERMES_READ_RECORD(hw, USER_BAP,
HERMES_RID_COMMSQUALITY, &cq);
-
- wstats->qual.qual = (int)le16_to_cpu(cq.qual);
- wstats->qual.level = (int)le16_to_cpu(cq.signal) - 0x95;
- wstats->qual.noise = (int)le16_to_cpu(cq.noise) - 0x95;
- wstats->qual.updated = 7;
+
+ if (!err) {
+ wstats->qual.qual = (int)le16_to_cpu(cq.qual);
+ wstats->qual.level = (int)le16_to_cpu(cq.signal) - 0x95;
+ wstats->qual.noise = (int)le16_to_cpu(cq.noise) - 0x95;
+ wstats->qual.updated = 7;
+ }
}
- /* We can't really wait for the tallies inquiry command to
- * complete, so we just use the previous results and trigger
- * a new tallies inquiry command for next time - Jean II */
- /* FIXME: We're in user context (I think?), so we should just
- wait for the tallies to come through */
- err = hermes_inquire(hw, HERMES_INQ_TALLIES);
-
orinoco_unlock(priv, &flags);
-
- if (err)
- return NULL;
-
return wstats;
}
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/people/dgibson
next prev parent reply other threads:[~2005-03-30 3:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-30 3:42 [0/5] Orinoco merge updates, part the fourth David Gibson
2005-03-30 3:43 ` David Gibson [this message]
2005-03-30 3:44 ` [2/5] Orinoco merge updates, part the fourth: ignore_disconnect flag David Gibson
2005-03-30 3:44 ` [3/5] Orinoco merge updates, part the fourth: kill dump_recs David Gibson
2005-03-30 3:44 ` [4/5] Orinoco merge updates, part the fourth: don't set channel in managed mode David Gibson
2005-03-30 3:45 ` [5/5] Orinoco merge updates, part the fourth: consolidate allocation code David Gibson
2005-03-31 0:48 ` [1/5] Orinoco merge updates, part the fourth: wireless stats updates Jeff Garzik
2005-03-30 7:56 ` [Orinoco-devel] [0/5] Orinoco merge updates, part the fourth abuas_z
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=20050330034316.GG6478@localhost.localdomain \
--to=david@gibson.dropbear.id.au \
--cc=jgarzik@pobox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@oss.sgi.com \
--cc=orinoco-devel@lists.sourceforge.net \
--cc=proski@gnu.org \
/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).