aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/wlags49_h2/wl_sysfs.c
diff options
context:
space:
mode:
authorHenk de Groot <henk.de.groot@hetnet.nl>2009-09-27 11:12:52 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2009-12-11 12:23:10 -0800
commit68c0bdff7ac903421f224e080499c51cd5287f97 (patch)
tree5f5f46e0a2d077c4d039a67d128a15a388dac91f /drivers/staging/wlags49_h2/wl_sysfs.c
parentStaging: rtl8187su: remove unused #include <linux/version.h> (diff)
downloadlinux-dev-68c0bdff7ac903421f224e080499c51cd5287f97.tar.xz
linux-dev-68c0bdff7ac903421f224e080499c51cd5287f97.zip
Staging: wlags49_h2: add Agere driver for HERMES II and HERMES II.5 chipsets
WLAN driver for cards using the HERMES II and HERMES II.5 chipset Based on Agere Systems Linux LKM Wireless Driver Source Code, Version 7.22; complies with Open Source BSD License. The software is a modified version of wl_lkm_722_abg.tar.gz from the Agere Systems website, addapted for Ubuntu 9.04 and modified to fit in the current Linux kernel (2.6.31). Modified for kernel 2.6 by Henk de Groot <pe1dnn@amsat.org> Based on 7.18 version by Andrey Borzenkov <arvidjaar@mail.ru> $Revision: 39 $ Signed-off-by: Henk de Groot <pe1dnn@amsat.org> Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/wlags49_h2/wl_sysfs.c')
-rw-r--r--drivers/staging/wlags49_h2/wl_sysfs.c135
1 files changed, 135 insertions, 0 deletions
diff --git a/drivers/staging/wlags49_h2/wl_sysfs.c b/drivers/staging/wlags49_h2/wl_sysfs.c
new file mode 100644
index 000000000000..864e01a736c8
--- /dev/null
+++ b/drivers/staging/wlags49_h2/wl_sysfs.c
@@ -0,0 +1,135 @@
+/*
+ * ex: sw=4
+ */
+
+#include <linux/kernel.h>
+#include <linux/netdevice.h>
+#include <linux/if_arp.h>
+#include <net/sock.h>
+#include <linux/rtnetlink.h>
+#include <linux/wireless.h>
+#include <net/iw_handler.h>
+#include <linux/sysfs.h>
+
+#include <debug.h>
+#include <hcf.h>
+#include <hcfdef.h>
+
+#include <wl_if.h>
+#include <wl_internal.h>
+#include <wl_util.h>
+#include <wl_main.h>
+#include <wl_wext.h>
+#include <wl_priv.h>
+
+static inline int dev_isalive(const struct net_device *dev)
+{
+ return dev->reg_state == NETREG_REGISTERED;
+}
+
+/*
+ * empirically even if tallies are defined as 32 bits entities, only
+ * high 16 bits are relevant; low half is always zero. It means tallies
+ * are pretty much useless for traffic counting but at least give overview
+ * about where error come from
+ */
+static ssize_t show_tallies(struct device *d, struct device_attribute *attr,
+ char *buf)
+{
+ struct net_device *dev = to_net_dev(d);
+ struct wl_private *lp = wl_priv(dev);
+ unsigned long flags;
+ CFG_HERMES_TALLIES_STRCT tallies;
+ ssize_t ret = -EINVAL;
+
+ read_lock(&dev_base_lock);
+ if (dev_isalive(dev)) {
+ wl_lock(lp, &flags);
+
+ if ((ret = wl_get_tallies(lp, &tallies)) == 0) {
+ wl_unlock(lp, &flags);
+ ret = snprintf(buf, PAGE_SIZE,
+ "TxUnicastFrames: %u\n"
+ "TxMulticastFrames: %u\n"
+ "TxFragments: %u\n"
+ "TxUnicastOctets: %u\n"
+ "TxMulticastOctets: %u\n"
+ "TxDeferredTransmissions: %u\n"
+ "TxSingleRetryFrames: %u\n"
+ "TxMultipleRetryFrames: %u\n"
+ "TxRetryLimitExceeded: %u\n"
+ "TxDiscards: %u\n"
+ "RxUnicastFrames: %u\n"
+ "RxMulticastFrames: %u\n"
+ "RxFragments: %u\n"
+ "RxUnicastOctets: %u\n"
+ "RxMulticastOctets: %u\n"
+ "RxFCSErrors: %u\n"
+ "RxDiscardsNoBuffer: %u\n"
+ "TxDiscardsWrongSA: %u\n"
+ "RxWEPUndecryptable: %u\n"
+ "RxMsgInMsgFragments: %u\n"
+ "RxMsgInBadMsgFragments: %u\n"
+ "RxDiscardsWEPICVError: %u\n"
+ "RxDiscardsWEPExcluded: %u\n"
+ ,
+ (unsigned int)tallies.TxUnicastFrames,
+ (unsigned int)tallies.TxMulticastFrames,
+ (unsigned int)tallies.TxFragments,
+ (unsigned int)tallies.TxUnicastOctets,
+ (unsigned int)tallies.TxMulticastOctets,
+ (unsigned int)tallies.TxDeferredTransmissions,
+ (unsigned int)tallies.TxSingleRetryFrames,
+ (unsigned int)tallies.TxMultipleRetryFrames,
+ (unsigned int)tallies.TxRetryLimitExceeded,
+ (unsigned int)tallies.TxDiscards,
+ (unsigned int)tallies.RxUnicastFrames,
+ (unsigned int)tallies.RxMulticastFrames,
+ (unsigned int)tallies.RxFragments,
+ (unsigned int)tallies.RxUnicastOctets,
+ (unsigned int)tallies.RxMulticastOctets,
+ (unsigned int)tallies.RxFCSErrors,
+ (unsigned int)tallies.RxDiscardsNoBuffer,
+ (unsigned int)tallies.TxDiscardsWrongSA,
+ (unsigned int)tallies.RxWEPUndecryptable,
+ (unsigned int)tallies.RxMsgInMsgFragments,
+ (unsigned int)tallies.RxMsgInBadMsgFragments,
+ (unsigned int)tallies.RxDiscardsWEPICVError,
+ (unsigned int)tallies.RxDiscardsWEPExcluded);
+ } else {
+ wl_unlock( lp, &flags );
+ }
+ }
+
+ read_unlock(&dev_base_lock);
+ return ret;
+}
+
+static DEVICE_ATTR(tallies, S_IRUGO, show_tallies, NULL);
+
+static struct attribute *wlags_attrs[] = {
+ &dev_attr_tallies.attr,
+ NULL
+};
+
+static struct attribute_group wlags_group = {
+ .name = "wlags",
+ .attrs = wlags_attrs,
+};
+
+void register_wlags_sysfs(struct net_device *net)
+{
+ struct device *dev = &(net->dev);
+ struct wl_private *lp = wl_priv(net);
+
+ lp->sysfsCreated = sysfs_create_group(&dev->kobj, &wlags_group);
+}
+
+void unregister_wlags_sysfs(struct net_device *net)
+{
+ struct device *dev = &(net->dev);
+ struct wl_private *lp = wl_priv(net);
+
+ if (lp->sysfsCreated)
+ sysfs_remove_group(&dev->kobj, &wlags_group);
+}