iwlwifi: mvm: Sync FW API time event notification change
authorIlan Peer <ilan.peer@intel.com>
Tue, 19 Mar 2013 14:28:56 +0000 (16:28 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 3 Apr 2013 20:49:52 +0000 (22:49 +0200)
The firmware API changed to differentiate between event and
fragment start/end. Change the time-event handling accordingly.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/iwlwifi/mvm/fw-api.h
drivers/net/wireless/iwlwifi/mvm/time-event.c

index 1073f2682221d86dcd10d0f9557680258be53fcf..191dcae8ba476573e2da094ab8f2a8a262ad89ce 100644 (file)
@@ -480,15 +480,34 @@ enum {
        TE_DEP_TSF              = 2,
        TE_EVENT_SOCIOPATHIC    = 4,
 }; /* MAC_EVENT_DEPENDENCY_POLICY_API_E_VER_2 */
-
-/* When to send Time Event notifications and to whom (internal = FW) */
+/*
+ * Supported Time event notifications configuration.
+ * A notification (both event and fragment) includes a status indicating weather
+ * the FW was able to schedule the event or not. For fragment start/end
+ * notification the status is always success. There is no start/end fragment
+ * notification for monolithic events.
+ *
+ * @TE_NOTIF_NONE: no notifications
+ * @TE_NOTIF_HOST_EVENT_START: request/receive notification on event start
+ * @TE_NOTIF_HOST_EVENT_END:request/receive notification on event end
+ * @TE_NOTIF_INTERNAL_EVENT_START: internal FW use
+ * @TE_NOTIF_INTERNAL_EVENT_END: internal FW use.
+ * @TE_NOTIF_HOST_FRAG_START: request/receive notification on frag start
+ * @TE_NOTIF_HOST_FRAG_END:request/receive notification on frag end
+ * @TE_NOTIF_INTERNAL_FRAG_START: internal FW use.
+ * @TE_NOTIF_INTERNAL_FRAG_END: internal FW use.
+ */
 enum {
        TE_NOTIF_NONE = 0,
-       TE_NOTIF_HOST_START = 0x1,
-       TE_NOTIF_HOST_END = 0x2,
-       TE_NOTIF_INTERNAL_START = 0x4,
-       TE_NOTIF_INTERNAL_END = 0x8
-}; /* MAC_EVENT_ACTION_API_E_VER_1 */
+       TE_NOTIF_HOST_EVENT_START = 0x1,
+       TE_NOTIF_HOST_EVENT_END = 0x2,
+       TE_NOTIF_INTERNAL_EVENT_START = 0x4,
+       TE_NOTIF_INTERNAL_EVENT_END = 0x8,
+       TE_NOTIF_HOST_FRAG_START = 0x10,
+       TE_NOTIF_HOST_FRAG_END = 0x20,
+       TE_NOTIF_INTERNAL_FRAG_START = 0x40,
+       TE_NOTIF_INTERNAL_FRAG_END = 0x80
+}; /* MAC_EVENT_ACTION_API_E_VER_2 */
 
 /*
  * @TE_FRAG_NONE: fragmentation of the time event is NOT allowed.
index 4dc934bed055131c275d1cc4992f5bd7200723ca..ad9bbca992133cc096ff0b90c5048ae248b635c9 100644 (file)
@@ -166,7 +166,7 @@ static void iwl_mvm_te_handle_notif(struct iwl_mvm *mvm,
        WARN_ONCE(!le32_to_cpu(notif->status),
                  "Failed to schedule time event\n");
 
-       if (le32_to_cpu(notif->action) == TE_NOTIF_HOST_END) {
+       if (le32_to_cpu(notif->action) & TE_NOTIF_HOST_EVENT_END) {
                IWL_DEBUG_TE(mvm,
                             "TE ended - current time %lu, estimated end %lu\n",
                             jiffies, te_data->end_jiffies);
@@ -189,7 +189,7 @@ static void iwl_mvm_te_handle_notif(struct iwl_mvm *mvm,
                }
 
                iwl_mvm_te_clear_data(mvm, te_data);
-       } else if (le32_to_cpu(notif->action) == TE_NOTIF_HOST_START) {
+       } else if (le32_to_cpu(notif->action) & TE_NOTIF_HOST_EVENT_START) {
                te_data->running = true;
                te_data->end_jiffies = jiffies +
                        TU_TO_JIFFIES(te_data->duration);
@@ -368,7 +368,8 @@ void iwl_mvm_protect_session(struct iwl_mvm *mvm,
        time_cmd.interval_reciprocal = cpu_to_le32(iwl_mvm_reciprocal(1));
        time_cmd.duration = cpu_to_le32(duration);
        time_cmd.repeat = cpu_to_le32(1);
-       time_cmd.notify = cpu_to_le32(TE_NOTIF_HOST_START | TE_NOTIF_HOST_END);
+       time_cmd.notify = cpu_to_le32(TE_NOTIF_HOST_EVENT_START |
+                                     TE_NOTIF_HOST_EVENT_END);
 
        iwl_mvm_time_event_send_add(mvm, vif, te_data, &time_cmd);
 }
@@ -485,7 +486,8 @@ int iwl_mvm_start_p2p_roc(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
        time_cmd.max_delay = cpu_to_le32(MSEC_TO_TU(duration/2));
        time_cmd.duration = cpu_to_le32(MSEC_TO_TU(duration));
        time_cmd.repeat = cpu_to_le32(1);
-       time_cmd.notify = cpu_to_le32(TE_NOTIF_HOST_START | TE_NOTIF_HOST_END);
+       time_cmd.notify = cpu_to_le32(TE_NOTIF_HOST_EVENT_START |
+                                     TE_NOTIF_HOST_EVENT_END);
 
        return iwl_mvm_time_event_send_add(mvm, vif, te_data, &time_cmd);
 }