aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-test.h
diff options
context:
space:
mode:
authorIlan Peer <ilan.peer@intel.com>2012-06-04 12:39:30 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-06-11 05:41:18 -0400
commitc76fe6d19b8beffe792c390c0bd215d193512f1e (patch)
tree97457f8ad76187a4422757194d0a34bb977b24f3 /drivers/net/wireless/iwlwifi/iwl-test.h
parent3a6490c0840c0ae67cc3a51e1b724bd7e460041e (diff)
iwlwifi: decouple testmode and iwl-test
The iwl-test flows were based on the cfg80211 testmode APIs. To remove this coupling, the op mode (during the initialization of the iwl_test object) is responsible to set the callbacks that should be used by iwl-test to allocate skbs for events and replies and to send events and replies. The current op modes implement these callbacks based on the cfg80211 testmode APIs. Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Ilan Peer <ilan.peer@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-test.h')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-test.h44
1 files changed, 40 insertions, 4 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-test.h b/drivers/net/wireless/iwlwifi/iwl-test.h
index 99461534495..e13ffa8acc0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-test.h
+++ b/drivers/net/wireless/iwlwifi/iwl-test.h
@@ -84,11 +84,49 @@ struct iwl_test_mem {
84 bool in_read; 84 bool in_read;
85}; 85};
86 86
87/*
88 * struct iwl_test_ops: callback to the op mode
89 *
90 * The structure defines the callbacks that the op_mode should handle,
91 * inorder to handle logic that is out of the scope of iwl_test. The
92 * op_mode must set all the callbacks.
93
94 * @send_cmd: handler that is used by the test object to request the
95 * op_mode to send a command to the fw.
96 *
97 * @valid_hw_addr: handler that is used by the test object to request the
98 * op_mode to check if the given address is a valid address.
99 *
100 * @get_fw_ver: handler used to get the FW version.
101 *
102 * @alloc_reply: handler used by the test object to request the op_mode
103 * to allocate an skb for sending a reply to the user, and initialize
104 * the skb. It is assumed that the test object only fills the required
105 * attributes.
106 *
107 * @reply: handler used by the test object to request the op_mode to reply
108 * to a request. The skb is an skb previously allocated by the the
109 * alloc_reply callback.
110 I
111 * @alloc_event: handler used by the test object to request the op_mode
112 * to allocate an skb for sending an event, and initialize
113 * the skb. It is assumed that the test object only fills the required
114 * attributes.
115 *
116 * @reply: handler used by the test object to request the op_mode to send
117 * an event. The skb is an skb previously allocated by the the
118 * alloc_event callback.
119 */
87struct iwl_test_ops { 120struct iwl_test_ops {
88 int (*send_cmd)(struct iwl_op_mode *op_modes, 121 int (*send_cmd)(struct iwl_op_mode *op_modes,
89 struct iwl_host_cmd *cmd); 122 struct iwl_host_cmd *cmd);
90 bool (*valid_hw_addr)(u32 addr); 123 bool (*valid_hw_addr)(u32 addr);
91 u32 (*get_fw_ver)(struct iwl_op_mode *op_mode); 124 u32 (*get_fw_ver)(struct iwl_op_mode *op_mode);
125
126 struct sk_buff *(*alloc_reply)(struct iwl_op_mode *op_mode, int len);
127 int (*reply)(struct iwl_op_mode *op_mode, struct sk_buff *skb);
128 struct sk_buff* (*alloc_event)(struct iwl_op_mode *op_mode, int len);
129 void (*event)(struct iwl_op_mode *op_mode, struct sk_buff *skb);
92}; 130};
93 131
94struct iwl_test { 132struct iwl_test {
@@ -107,14 +145,12 @@ void iwl_test_free(struct iwl_test *tst);
107int iwl_test_parse(struct iwl_test *tst, struct nlattr **tb, 145int iwl_test_parse(struct iwl_test *tst, struct nlattr **tb,
108 void *data, int len); 146 void *data, int len);
109 147
110int iwl_test_handle_cmd(struct iwl_test *tst, struct ieee80211_hw *hw, 148int iwl_test_handle_cmd(struct iwl_test *tst, struct nlattr **tb);
111 struct nlattr **tb);
112 149
113int iwl_test_dump(struct iwl_test *tst, u32 cmd, struct sk_buff *skb, 150int iwl_test_dump(struct iwl_test *tst, u32 cmd, struct sk_buff *skb,
114 struct netlink_callback *cb); 151 struct netlink_callback *cb);
115 152
116void iwl_test_rx(struct iwl_test *tst, struct ieee80211_hw *hw, 153void iwl_test_rx(struct iwl_test *tst, struct iwl_rx_cmd_buffer *rxb);
117 struct iwl_rx_cmd_buffer *rxb);
118 154
119static inline void iwl_test_enable_notifications(struct iwl_test *tst, 155static inline void iwl_test_enable_notifications(struct iwl_test *tst,
120 bool enable) 156 bool enable)