aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/mvm/time-event.c
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2014-03-30 01:40:46 -0400
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>2014-04-13 15:23:10 -0400
commita373f67cbef25f24af10a3e868bca1f363996eec (patch)
tree9f0290cdc44608ca1e4107a4c9e98b0c82021c94 /drivers/net/wireless/iwlwifi/mvm/time-event.c
parent3fe47dca049f3a684084fec08fabb88bece19a24 (diff)
iwlwifi: remove IWL_UCODE_TLV_FLAGS_TIME_EVENT_API_V2 flag
All the supported firmwares have this flag set. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm/time-event.c')
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/time-event.c71
1 files changed, 8 insertions, 63 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/time-event.c b/drivers/net/wireless/iwlwifi/mvm/time-event.c
index 61331245ad93..a9402937f767 100644
--- a/drivers/net/wireless/iwlwifi/mvm/time-event.c
+++ b/drivers/net/wireless/iwlwifi/mvm/time-event.c
@@ -273,67 +273,10 @@ static bool iwl_mvm_time_event_response(struct iwl_notif_wait_data *notif_wait,
273 return true; 273 return true;
274} 274}
275 275
276/* used to convert from time event API v2 to v1 */
277#define TE_V2_DEP_POLICY_MSK (TE_V2_DEP_OTHER | TE_V2_DEP_TSF |\
278 TE_V2_EVENT_SOCIOPATHIC)
279static inline u16 te_v2_get_notify(__le16 policy)
280{
281 return le16_to_cpu(policy) & TE_V2_NOTIF_MSK;
282}
283
284static inline u16 te_v2_get_dep_policy(__le16 policy)
285{
286 return (le16_to_cpu(policy) & TE_V2_DEP_POLICY_MSK) >>
287 TE_V2_PLACEMENT_POS;
288}
289
290static inline u16 te_v2_get_absence(__le16 policy)
291{
292 return (le16_to_cpu(policy) & TE_V2_ABSENCE) >> TE_V2_ABSENCE_POS;
293}
294
295static void iwl_mvm_te_v2_to_v1(const struct iwl_time_event_cmd_v2 *cmd_v2,
296 struct iwl_time_event_cmd_v1 *cmd_v1)
297{
298 cmd_v1->id_and_color = cmd_v2->id_and_color;
299 cmd_v1->action = cmd_v2->action;
300 cmd_v1->id = cmd_v2->id;
301 cmd_v1->apply_time = cmd_v2->apply_time;
302 cmd_v1->max_delay = cmd_v2->max_delay;
303 cmd_v1->depends_on = cmd_v2->depends_on;
304 cmd_v1->interval = cmd_v2->interval;
305 cmd_v1->duration = cmd_v2->duration;
306 if (cmd_v2->repeat == TE_V2_REPEAT_ENDLESS)
307 cmd_v1->repeat = cpu_to_le32(TE_V1_REPEAT_ENDLESS);
308 else
309 cmd_v1->repeat = cpu_to_le32(cmd_v2->repeat);
310 cmd_v1->max_frags = cpu_to_le32(cmd_v2->max_frags);
311 cmd_v1->interval_reciprocal = 0; /* unused */
312
313 cmd_v1->dep_policy = cpu_to_le32(te_v2_get_dep_policy(cmd_v2->policy));
314 cmd_v1->is_present = cpu_to_le32(!te_v2_get_absence(cmd_v2->policy));
315 cmd_v1->notify = cpu_to_le32(te_v2_get_notify(cmd_v2->policy));
316}
317
318static int iwl_mvm_send_time_event_cmd(struct iwl_mvm *mvm,
319 const struct iwl_time_event_cmd_v2 *cmd)
320{
321 struct iwl_time_event_cmd_v1 cmd_v1;
322
323 if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_TIME_EVENT_API_V2)
324 return iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, CMD_SYNC,
325 sizeof(*cmd), cmd);
326
327 iwl_mvm_te_v2_to_v1(cmd, &cmd_v1);
328 return iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, CMD_SYNC,
329 sizeof(cmd_v1), &cmd_v1);
330}
331
332
333static int iwl_mvm_time_event_send_add(struct iwl_mvm *mvm, 276static int iwl_mvm_time_event_send_add(struct iwl_mvm *mvm,
334 struct ieee80211_vif *vif, 277 struct ieee80211_vif *vif,
335 struct iwl_mvm_time_event_data *te_data, 278 struct iwl_mvm_time_event_data *te_data,
336 struct iwl_time_event_cmd_v2 *te_cmd) 279 struct iwl_time_event_cmd *te_cmd)
337{ 280{
338 static const u8 time_event_response[] = { TIME_EVENT_CMD }; 281 static const u8 time_event_response[] = { TIME_EVENT_CMD };
339 struct iwl_notification_wait wait_time_event; 282 struct iwl_notification_wait wait_time_event;
@@ -369,7 +312,8 @@ static int iwl_mvm_time_event_send_add(struct iwl_mvm *mvm,
369 ARRAY_SIZE(time_event_response), 312 ARRAY_SIZE(time_event_response),
370 iwl_mvm_time_event_response, te_data); 313 iwl_mvm_time_event_response, te_data);
371 314
372 ret = iwl_mvm_send_time_event_cmd(mvm, te_cmd); 315 ret = iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, CMD_SYNC,
316 sizeof(*te_cmd), te_cmd);
373 if (ret) { 317 if (ret) {
374 IWL_ERR(mvm, "Couldn't send TIME_EVENT_CMD: %d\n", ret); 318 IWL_ERR(mvm, "Couldn't send TIME_EVENT_CMD: %d\n", ret);
375 iwl_remove_notification(&mvm->notif_wait, &wait_time_event); 319 iwl_remove_notification(&mvm->notif_wait, &wait_time_event);
@@ -397,7 +341,7 @@ void iwl_mvm_protect_session(struct iwl_mvm *mvm,
397{ 341{
398 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 342 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
399 struct iwl_mvm_time_event_data *te_data = &mvmvif->time_event_data; 343 struct iwl_mvm_time_event_data *te_data = &mvmvif->time_event_data;
400 struct iwl_time_event_cmd_v2 time_cmd = {}; 344 struct iwl_time_event_cmd time_cmd = {};
401 345
402 lockdep_assert_held(&mvm->mutex); 346 lockdep_assert_held(&mvm->mutex);
403 347
@@ -453,7 +397,7 @@ void iwl_mvm_remove_time_event(struct iwl_mvm *mvm,
453 struct iwl_mvm_vif *mvmvif, 397 struct iwl_mvm_vif *mvmvif,
454 struct iwl_mvm_time_event_data *te_data) 398 struct iwl_mvm_time_event_data *te_data)
455{ 399{
456 struct iwl_time_event_cmd_v2 time_cmd = {}; 400 struct iwl_time_event_cmd time_cmd = {};
457 u32 id, uid; 401 u32 id, uid;
458 int ret; 402 int ret;
459 403
@@ -490,7 +434,8 @@ void iwl_mvm_remove_time_event(struct iwl_mvm *mvm,
490 cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, mvmvif->color)); 434 cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, mvmvif->color));
491 435
492 IWL_DEBUG_TE(mvm, "Removing TE 0x%x\n", le32_to_cpu(time_cmd.id)); 436 IWL_DEBUG_TE(mvm, "Removing TE 0x%x\n", le32_to_cpu(time_cmd.id));
493 ret = iwl_mvm_send_time_event_cmd(mvm, &time_cmd); 437 ret = iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, CMD_SYNC,
438 sizeof(time_cmd), &time_cmd);
494 if (WARN_ON(ret)) 439 if (WARN_ON(ret))
495 return; 440 return;
496} 441}
@@ -510,7 +455,7 @@ int iwl_mvm_start_p2p_roc(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
510{ 455{
511 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 456 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
512 struct iwl_mvm_time_event_data *te_data = &mvmvif->time_event_data; 457 struct iwl_mvm_time_event_data *te_data = &mvmvif->time_event_data;
513 struct iwl_time_event_cmd_v2 time_cmd = {}; 458 struct iwl_time_event_cmd time_cmd = {};
514 459
515 lockdep_assert_held(&mvm->mutex); 460 lockdep_assert_held(&mvm->mutex);
516 if (te_data->running) { 461 if (te_data->running) {