Commit f3fe4e93 authored by Sara Sharon's avatar Sara Sharon Committed by Johannes Berg

mac80211: add a HW flag for supporting HW TX fragmentation

Currently mac80211 determines whether HW does fragmentation
by checking whether the set_frag_threshold callback is set
or not.
However, some drivers may want to set the HW fragmentation
capability depending on HW generation.
Allow this by checking a HW flag instead of checking the
callback.
Signed-off-by: default avatarSara Sharon <sara.sharon@intel.com>
[added the flag to ath10k and wlcore]
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 0aa419ec
...@@ -7881,6 +7881,7 @@ int ath10k_mac_register(struct ath10k *ar) ...@@ -7881,6 +7881,7 @@ int ath10k_mac_register(struct ath10k *ar)
ieee80211_hw_set(ar->hw, WANT_MONITOR_VIF); ieee80211_hw_set(ar->hw, WANT_MONITOR_VIF);
ieee80211_hw_set(ar->hw, CHANCTX_STA_CSA); ieee80211_hw_set(ar->hw, CHANCTX_STA_CSA);
ieee80211_hw_set(ar->hw, QUEUE_CONTROL); ieee80211_hw_set(ar->hw, QUEUE_CONTROL);
ieee80211_hw_set(ar->hw, SUPPORTS_TX_FRAG);
if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags))
ieee80211_hw_set(ar->hw, SW_CRYPTO_CONTROL); ieee80211_hw_set(ar->hw, SW_CRYPTO_CONTROL);
......
...@@ -6086,6 +6086,7 @@ static int wl1271_init_ieee80211(struct wl1271 *wl) ...@@ -6086,6 +6086,7 @@ static int wl1271_init_ieee80211(struct wl1271 *wl)
ieee80211_hw_set(wl->hw, SUPPORTS_DYNAMIC_PS); ieee80211_hw_set(wl->hw, SUPPORTS_DYNAMIC_PS);
ieee80211_hw_set(wl->hw, SIGNAL_DBM); ieee80211_hw_set(wl->hw, SIGNAL_DBM);
ieee80211_hw_set(wl->hw, SUPPORTS_PS); ieee80211_hw_set(wl->hw, SUPPORTS_PS);
ieee80211_hw_set(wl->hw, SUPPORTS_TX_FRAG);
wl->hw->wiphy->cipher_suites = cipher_suites; wl->hw->wiphy->cipher_suites = cipher_suites;
wl->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); wl->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
......
...@@ -2025,6 +2025,10 @@ struct ieee80211_txq { ...@@ -2025,6 +2025,10 @@ struct ieee80211_txq {
* drivers, mac80211 packet loss mechanism will not be triggered and driver * drivers, mac80211 packet loss mechanism will not be triggered and driver
* is completely depending on firmware event for station kickout. * is completely depending on firmware event for station kickout.
* *
* @IEEE80211_HW_SUPPORTS_TX_FRAG: Hardware does fragmentation by itself.
* The stack will not do fragmentation.
* The callback for @set_frag_threshold should be set as well.
*
* @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
*/ */
enum ieee80211_hw_flags { enum ieee80211_hw_flags {
...@@ -2066,6 +2070,7 @@ enum ieee80211_hw_flags { ...@@ -2066,6 +2070,7 @@ enum ieee80211_hw_flags {
IEEE80211_HW_TX_AMSDU, IEEE80211_HW_TX_AMSDU,
IEEE80211_HW_TX_FRAG_LIST, IEEE80211_HW_TX_FRAG_LIST,
IEEE80211_HW_REPORTS_LOW_ACK, IEEE80211_HW_REPORTS_LOW_ACK,
IEEE80211_HW_SUPPORTS_TX_FRAG,
/* keep last, obviously */ /* keep last, obviously */
NUM_IEEE80211_HW_FLAGS NUM_IEEE80211_HW_FLAGS
...@@ -3093,8 +3098,9 @@ enum ieee80211_reconfig_type { ...@@ -3093,8 +3098,9 @@ enum ieee80211_reconfig_type {
* The callback must be atomic. * The callback must be atomic.
* *
* @set_frag_threshold: Configuration of fragmentation threshold. Assign this * @set_frag_threshold: Configuration of fragmentation threshold. Assign this
* if the device does fragmentation by itself; if this callback is * if the device does fragmentation by itself. Note that to prevent the
* implemented then the stack will not do fragmentation. * stack from doing fragmentation IEEE80211_HW_SUPPORTS_TX_FRAG
* should be set as well.
* The callback can sleep. * The callback can sleep.
* *
* @set_rts_threshold: Configuration of RTS threshold (if device needs it) * @set_rts_threshold: Configuration of RTS threshold (if device needs it)
......
...@@ -210,6 +210,7 @@ static const char *hw_flag_names[] = { ...@@ -210,6 +210,7 @@ static const char *hw_flag_names[] = {
FLAG(TX_AMSDU), FLAG(TX_AMSDU),
FLAG(TX_FRAG_LIST), FLAG(TX_FRAG_LIST),
FLAG(REPORTS_LOW_ACK), FLAG(REPORTS_LOW_ACK),
FLAG(SUPPORTS_TX_FRAG),
#undef FLAG #undef FLAG
}; };
......
...@@ -821,6 +821,10 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) ...@@ -821,6 +821,10 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
!local->ops->tdls_recv_channel_switch)) !local->ops->tdls_recv_channel_switch))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (WARN_ON(ieee80211_hw_check(hw, SUPPORTS_TX_FRAG) &&
!local->ops->set_frag_threshold))
return -EINVAL;
if (WARN_ON(local->hw.wiphy->interface_modes & if (WARN_ON(local->hw.wiphy->interface_modes &
BIT(NL80211_IFTYPE_NAN) && BIT(NL80211_IFTYPE_NAN) &&
(!local->ops->start_nan || !local->ops->stop_nan))) (!local->ops->start_nan || !local->ops->stop_nan)))
......
...@@ -934,7 +934,7 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx) ...@@ -934,7 +934,7 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx)
if (info->flags & IEEE80211_TX_CTL_DONTFRAG) if (info->flags & IEEE80211_TX_CTL_DONTFRAG)
return TX_CONTINUE; return TX_CONTINUE;
if (tx->local->ops->set_frag_threshold) if (ieee80211_hw_check(&tx->local->hw, SUPPORTS_TX_FRAG))
return TX_CONTINUE; return TX_CONTINUE;
/* /*
...@@ -2800,7 +2800,7 @@ void ieee80211_check_fast_xmit(struct sta_info *sta) ...@@ -2800,7 +2800,7 @@ void ieee80211_check_fast_xmit(struct sta_info *sta)
/* fast-xmit doesn't handle fragmentation at all */ /* fast-xmit doesn't handle fragmentation at all */
if (local->hw.wiphy->frag_threshold != (u32)-1 && if (local->hw.wiphy->frag_threshold != (u32)-1 &&
!local->ops->set_frag_threshold) !ieee80211_hw_check(&local->hw, SUPPORTS_TX_FRAG))
goto out; goto out;
rcu_read_lock(); rcu_read_lock();
......
...@@ -57,7 +57,7 @@ ieee80211_tx_h_michael_mic_add(struct ieee80211_tx_data *tx) ...@@ -57,7 +57,7 @@ ieee80211_tx_h_michael_mic_add(struct ieee80211_tx_data *tx)
if (info->control.hw_key && if (info->control.hw_key &&
(info->flags & IEEE80211_TX_CTL_DONTFRAG || (info->flags & IEEE80211_TX_CTL_DONTFRAG ||
tx->local->ops->set_frag_threshold) && ieee80211_hw_check(&tx->local->hw, SUPPORTS_TX_FRAG)) &&
!(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) { !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) {
/* hwaccel - with no need for SW-generated MMIC */ /* hwaccel - with no need for SW-generated MMIC */
return TX_CONTINUE; return TX_CONTINUE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment