Skip to contentSkip to conversation

wl1271 testmode support

RFC PATCH New Kalle Valo 3 participants 5 messages Dec 21, 2009 – Dec 22, 2009

Subsystems (2)
lore
Share & tools
lore

Kalle Valo

author
#0 lore raw

RFC PATCH 1/1 wl1271 testmode support

Hello,

I implemented testmode support for wl1271. I would appreciate any comments about this before we start to use this.

---

Kalle Valo (1):
wl1271: add testmode support

 drivers/net/wireless/wl12xx/Makefile          |    1 
 drivers/net/wireless/wl12xx/wl1271.h          |    2 
 drivers/net/wireless/wl12xx/wl1271_main.c     |    2 
 drivers/net/wireless/wl12xx/wl1271_testmode.c |  305 +++++++++++++++++++++++++
 drivers/net/wireless/wl12xx/wl1271_testmode.h |   31 +++
 5 files changed, 340 insertions(+), 1 deletions(-)
 create mode 100644 drivers/net/wireless/wl12xx/wl1271_testmode.c
 create mode 100644 drivers/net/wireless/wl12xx/wl1271_testmode.h
author
#1 lore raw

RFC PATCH 1/1 wl1271: add testmode support

Testmode will be used to send PLT (Production Line Testing) commands from user space.

---
 drivers/net/wireless/wl12xx/Makefile          |    1 
 drivers/net/wireless/wl12xx/wl1271.h          |    2 
 drivers/net/wireless/wl12xx/wl1271_main.c     |    2 
 drivers/net/wireless/wl12xx/wl1271_testmode.c |  305 +++++++++++++++++++++++++
 drivers/net/wireless/wl12xx/wl1271_testmode.h |   31 +++
 5 files changed, 340 insertions(+), 1 deletions(-)
 create mode 100644 drivers/net/wireless/wl12xx/wl1271_testmode.c
 create mode 100644 drivers/net/wireless/wl12xx/wl1271_testmode.h
drivers/net/wireless/wl12xx/Makefile +1 -0
index 62e37ad..d089b5d 100644
@@ -11,4 +11,5 @@ wl1271-objs		= wl1271_main.o  wl1271_spi.o wl1271_cmd.o  \
 			  wl1271_event.o wl1271_tx.o  wl1271_rx.o   \
 			  wl1271_ps.o    wl1271_acx.o wl1271_boot.o \
 			  wl1271_init.o  wl1271_debugfs.o
+wl1271-$(CONFIG_NL80211_TESTMODE)	+= wl1271_testmode.o
 obj-$(CONFIG_WL1271)	+= wl1271.o
drivers/net/wireless/wl12xx/wl1271.h +1 -1
index d0938db..5f2f9f6 100644
@@ -43,7 +43,7 @@ enum {
 	DEBUG_SPI	= BIT(1),
 	DEBUG_BOOT	= BIT(2),
 	DEBUG_MAILBOX	= BIT(3),
-	DEBUG_NETLINK	= BIT(4),
+	DEBUG_TESTMODE	= BIT(4),
 	DEBUG_EVENT	= BIT(5),
 	DEBUG_TX	= BIT(6),
 	DEBUG_RX	= BIT(7),
drivers/net/wireless/wl12xx/wl1271_main.c +2 -0
index bc882c9..b33188a 100644
@@ -46,6 +46,7 @@
 #include "wl1271_debugfs.h"
 #include "wl1271_cmd.h"
 #include "wl1271_boot.h"
+#include "wl1271_testmode.h"
 
 #define WL1271_BOOT_RETRIES 3
 
@@ -1877,6 +1878,7 @@ static const struct ieee80211_ops wl1271_ops = {
 	.hw_scan = wl1271_op_hw_scan,
 	.bss_info_changed = wl1271_op_bss_info_changed,
 	.set_rts_threshold = wl1271_op_set_rts_threshold,
+	CFG80211_TESTMODE_CMD(wl1271_tm_cmd)
 };
 
 static int wl1271_register_hw(struct wl1271 *wl)
drivers/net/wireless/wl12xx/wl1271_testmode.c new file +305 -0

305 lines not on this page · raw message

drivers/net/wireless/wl12xx/wl1271_testmode.h new file +31 -0
new file mode 100644
index 0000000..f3ce4b8
@@ -0,0 +1,31 @@
+/*
+ * This file is part of wl1271
+ *
+ * Copyright (C) 2009 Nokia Corporation
+ *
+ * Contact: Luciano Coelho <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef __WL1271_TESTMODE_H__
+#define __WL1271_TESTMODE_H__
+
+#include <net/mac80211.h>
+
+int wl1271_tm_cmd(struct ieee80211_hw *hw, void *data, int len);
+
+#endif /* __WL1271_TESTMODE_H__ */
maintainer
#2 lore raw

Re: [RFC PATCH] wl1271: add testmode support

drivers/net/wireless/wl12xx/wl1271_testmode.c line 94

Quoted 6 lines · Kalle Valo
drivers/net/wireless/wl12xx/wl1271_testmode.c new file +6 -0
+	cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
+	if (!cmd)
+		return -ENOMEM;
+
+	/* copy the buffer to make it work with dma */
+	memcpy(cmd, buf, buf_len);

kmemdup() (more than once in the patch)

drivers/net/wireless/wl12xx/wl1271_testmode.h line 31

Quoted 8 lines
drivers/net/wireless/wl12xx/wl1271_testmode.h new file +8 -0
+#ifndef __WL1271_TESTMODE_H__
+#define __WL1271_TESTMODE_H__
+
+#include <net/mac80211.h>
+
+int wl1271_tm_cmd(struct ieee80211_hw *hw, void *data, int len);
+
+#endif /* __WL1271_TESTMODE_H__ */

probably wouldn't bother with a file for one line ;)

johannes

#3 lore raw

Re: [RFC PATCH] wl1271: add testmode support

Quoted 10 lines · Johannes Berg

drivers/net/wireless/wl12xx/wl1271_testmode.c line 94

Quoted 6 lines · Kalle Valo
drivers/net/wireless/wl12xx/wl1271_testmode.c new file +6 -0
+	cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
+	if (!cmd)
+		return -ENOMEM;
+
+	/* copy the buffer to make it work with dma */
+	memcpy(cmd, buf, buf_len);

kmemdup() (more than once in the patch)

Oh, of course I should have used that :) I'll change this.

Quoted 10 lines

drivers/net/wireless/wl12xx/wl1271_testmode.h line 31

Quoted 8 lines
drivers/net/wireless/wl12xx/wl1271_testmode.h new file +8 -0
+#ifndef __WL1271_TESTMODE_H__
+#define __WL1271_TESTMODE_H__
+
+#include <net/mac80211.h>
+
+int wl1271_tm_cmd(struct ieee80211_hw *hw, void *data, int len);
+
+#endif /* __WL1271_TESTMODE_H__ */

probably wouldn't bother with a file for one line ;)

Yeah, you have a point. I added just for consistency.

Thanks for the review.

Signature · 1 line
Kalle Valo
#4 lore raw

Re: [RFC PATCH] wl1271: add testmode support

In reply to Kalle Valo

drivers/net/wireless/wl12xx/wl1271_testmode.c line 151

Quoted 1 line · Kalle Valo
drivers/net/wireless/wl12xx/wl1271_testmode.c new file +1 -0
+	skb = cfg80211_testmode_alloc_reply_skb(wl->hw->wiphy, sizeof(*cmd));

I believe this should use nla_total_size().

Signature · 1 line
Kalle Valo