|
@@ -285,6 +285,42 @@ unsigned int ath5k_hw_get_clockrate(struct ath5k_hw *ah)
|
|
|
return clock;
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * ath5k_hw_get_default_slottime - Get the default slot time for current mode
|
|
|
+ *
|
|
|
+ * @ah: The &struct ath5k_hw
|
|
|
+ */
|
|
|
+unsigned int ath5k_hw_get_default_slottime(struct ath5k_hw *ah)
|
|
|
+{
|
|
|
+ struct ieee80211_channel *channel = ah->ah_current_channel;
|
|
|
+
|
|
|
+ if (channel->hw_value & CHANNEL_TURBO)
|
|
|
+ return 6; /* both turbo modes */
|
|
|
+
|
|
|
+ if (channel->hw_value & CHANNEL_CCK)
|
|
|
+ return 20; /* 802.11b */
|
|
|
+
|
|
|
+ return 9; /* 802.11 a/g */
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * ath5k_hw_get_default_sifs - Get the default SIFS for current mode
|
|
|
+ *
|
|
|
+ * @ah: The &struct ath5k_hw
|
|
|
+ */
|
|
|
+unsigned int ath5k_hw_get_default_sifs(struct ath5k_hw *ah)
|
|
|
+{
|
|
|
+ struct ieee80211_channel *channel = ah->ah_current_channel;
|
|
|
+
|
|
|
+ if (channel->hw_value & CHANNEL_TURBO)
|
|
|
+ return 8; /* both turbo modes */
|
|
|
+
|
|
|
+ if (channel->hw_value & CHANNEL_5GHZ)
|
|
|
+ return 16; /* 802.11a */
|
|
|
+
|
|
|
+ return 10; /* 802.11 b/g */
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* ath5k_hw_set_lladdr - Set station id
|
|
|
*
|
|
@@ -1094,3 +1130,24 @@ int ath5k_hw_set_key_lladdr(struct ath5k_hw *ah, u16 entry, const u8 *mac)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * ath5k_hw_set_coverage_class - Set IEEE 802.11 coverage class
|
|
|
+ *
|
|
|
+ * @ah: The &struct ath5k_hw
|
|
|
+ * @coverage_class: IEEE 802.11 coverage class number
|
|
|
+ *
|
|
|
+ * Sets slot time, ACK timeout and CTS timeout for given coverage class.
|
|
|
+ */
|
|
|
+void ath5k_hw_set_coverage_class(struct ath5k_hw *ah, u8 coverage_class)
|
|
|
+{
|
|
|
+ /* As defined by IEEE 802.11-2007 17.3.8.6 */
|
|
|
+ int slot_time = ath5k_hw_get_default_slottime(ah) + 3 * coverage_class;
|
|
|
+ int ack_timeout = ath5k_hw_get_default_sifs(ah) + slot_time;
|
|
|
+ int cts_timeout = ack_timeout;
|
|
|
+
|
|
|
+ ath5k_hw_set_slot_time(ah, slot_time);
|
|
|
+ ath5k_hw_set_ack_timeout(ah, ack_timeout);
|
|
|
+ ath5k_hw_set_cts_timeout(ah, cts_timeout);
|
|
|
+
|
|
|
+ ah->ah_coverage_class = coverage_class;
|
|
|
+}
|