Linux wireless drivers development
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@qca.qualcomm.com>
To: gregkh@suse.de
Cc: devel@linuxdriverproject.org, linux-wireless@vger.kernel.org
Subject: [PATCH 2/5] ath6kl: testmode support
Date: Wed, 08 Jun 2011 14:54:30 +0300	[thread overview]
Message-ID: <20110608115430.32208.81891.stgit@localhost6.localdomain6> (raw)
In-Reply-To: <20110608114240.32208.31805.stgit@localhost6.localdomain6>

Add testmode support for running low level hardware tests. The testmode
is enabled by setting testmode module parameter to 1.

For now only a simple command passing is supported. More advanced
support will be implemented later.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
 drivers/staging/ath6kl/os/linux/cfg80211.c |   58 ++++++++++++++++++++++++++++
 1 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/ath6kl/os/linux/cfg80211.c b/drivers/staging/ath6kl/os/linux/cfg80211.c
index 77dfb40..a0c0819 100644
--- a/drivers/staging/ath6kl/os/linux/cfg80211.c
+++ b/drivers/staging/ath6kl/os/linux/cfg80211.c
@@ -24,6 +24,7 @@
 #include <linux/wireless.h>
 #include <linux/ieee80211.h>
 #include <net/cfg80211.h>
+#include <net/netlink.h>
 
 #include "ar6000_drv.h"
 
@@ -1452,6 +1453,62 @@ ar6k_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
     return 0;
 }
 
+#ifdef CONFIG_NL80211_TESTMODE
+enum ar6k_testmode_attr {
+	__AR6K_TM_ATTR_INVALID	= 0,
+	AR6K_TM_ATTR_CMD	= 1,
+	AR6K_TM_ATTR_DATA	= 2,
+
+	/* keep last */
+	__AR6K_TM_ATTR_AFTER_LAST,
+	AR6K_TM_ATTR_MAX	= __AR6K_TM_ATTR_AFTER_LAST - 1
+};
+
+enum ar6k_testmode_cmd {
+	AR6K_TM_CMD_TCMD		= 0,
+};
+
+#define AR6K_TM_DATA_MAX_LEN 5000
+
+static const struct nla_policy ar6k_testmode_policy[AR6K_TM_ATTR_MAX + 1] = {
+	[AR6K_TM_ATTR_CMD] = { .type = NLA_U32 },
+	[AR6K_TM_ATTR_DATA] = { .type = NLA_BINARY,
+				.len = AR6K_TM_DATA_MAX_LEN },
+};
+
+static int ar6k_testmode_cmd(struct wiphy *wiphy, void *data, int len)
+{
+	struct ar6_softc *ar = wiphy_priv(wiphy);
+	struct nlattr *tb[AR6K_TM_ATTR_MAX + 1];
+	int err, buf_len;
+	void *buf;
+
+	err = nla_parse(tb, AR6K_TM_ATTR_MAX, data, len,
+			ar6k_testmode_policy);
+	if (err)
+		return err;
+
+	if (!tb[AR6K_TM_ATTR_CMD])
+		return -EINVAL;
+
+	switch (nla_get_u32(tb[AR6K_TM_ATTR_CMD])) {
+	case AR6K_TM_CMD_TCMD:
+		if (!tb[AR6K_TM_ATTR_DATA])
+			return -EINVAL;
+
+		buf = nla_data(tb[AR6K_TM_ATTR_DATA]);
+		buf_len = nla_len(tb[AR6K_TM_ATTR_DATA]);
+
+		wmi_test_cmd(ar->arWmi, buf, buf_len);
+
+		return 0;
+
+		break;
+	default:
+		return -EOPNOTSUPP;
+	}
+}
+#endif
 
 static const
 u32 cipher_suites[] = {
@@ -1627,6 +1684,7 @@ cfg80211_ops ar6k_cfg80211_ops = {
     .join_ibss = ar6k_cfg80211_join_ibss,
     .leave_ibss = ar6k_cfg80211_leave_ibss,
     .get_station = ar6k_get_station,
+    CFG80211_TESTMODE_CMD(ar6k_testmode_cmd)
 };
 
 struct wireless_dev *


  parent reply	other threads:[~2011-06-08 11:54 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-08 11:54 [PATCH 0/5] ath6kl: staging fixes Kalle Valo
2011-06-08 11:54 ` [PATCH 1/5] ath6kl: export firmware version to user space Kalle Valo
2011-06-08 11:54 ` Kalle Valo [this message]
2011-06-08 19:46   ` [PATCH 2/5] ath6kl: testmode support Dan Carpenter
2011-06-09 13:02     ` Kalle Valo
2011-06-08 11:54 ` [PATCH 3/5] ath6kl: cache firmware Kalle Valo
2011-06-08 19:44   ` Dan Carpenter
2011-06-09 13:14     ` Kalle Valo
2011-06-09 15:42       ` Dan Carpenter
2011-06-09 20:46         ` Dan Carpenter
2011-06-13  7:49         ` Kalle Valo
2011-06-08 11:54 ` [PATCH 4/5] ath6kl: Fix a kernel panic furing suspend/resume Kalle Valo
2011-06-08 11:55 ` [PATCH 5/5] ath6kl: fix crash when interface is closed but scan is ongoing Kalle Valo
2011-06-08 20:03   ` Dan Carpenter
2011-06-08 20:14     ` Dan Carpenter
2011-06-09 13:23       ` Kalle Valo
2011-06-09 15:24         ` Dan Carpenter
2011-06-13  7:52           ` Kalle Valo
2011-06-13  7:55             ` Dan Carpenter
2011-06-13  8:03               ` Kalle Valo
2011-06-13  8:18                 ` Dan Carpenter
2011-06-13  8:21                   ` Kalle Valo
2011-06-09 13:19     ` Kalle Valo

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=20110608115430.32208.81891.stgit@localhost6.localdomain6 \
    --to=kvalo@qca.qualcomm.com \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@suse.de \
    --cc=linux-wireless@vger.kernel.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