Skip to content

Commit f3fe4e9

Browse files
sara-sjmberg-intel
authored andcommitted
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: Sara Sharon <[email protected]> [added the flag to ath10k and wlcore] Signed-off-by: Luca Coelho <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
1 parent 0aa419e commit f3fe4e9

File tree

7 files changed

+18
-5
lines changed

7 files changed

+18
-5
lines changed

drivers/net/wireless/ath/ath10k/mac.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7881,6 +7881,7 @@ int ath10k_mac_register(struct ath10k *ar)
78817881
ieee80211_hw_set(ar->hw, WANT_MONITOR_VIF);
78827882
ieee80211_hw_set(ar->hw, CHANCTX_STA_CSA);
78837883
ieee80211_hw_set(ar->hw, QUEUE_CONTROL);
7884+
ieee80211_hw_set(ar->hw, SUPPORTS_TX_FRAG);
78847885

78857886
if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags))
78867887
ieee80211_hw_set(ar->hw, SW_CRYPTO_CONTROL);

drivers/net/wireless/ti/wlcore/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6086,6 +6086,7 @@ static int wl1271_init_ieee80211(struct wl1271 *wl)
60866086
ieee80211_hw_set(wl->hw, SUPPORTS_DYNAMIC_PS);
60876087
ieee80211_hw_set(wl->hw, SIGNAL_DBM);
60886088
ieee80211_hw_set(wl->hw, SUPPORTS_PS);
6089+
ieee80211_hw_set(wl->hw, SUPPORTS_TX_FRAG);
60896090

60906091
wl->hw->wiphy->cipher_suites = cipher_suites;
60916092
wl->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);

include/net/mac80211.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2025,6 +2025,10 @@ struct ieee80211_txq {
20252025
* drivers, mac80211 packet loss mechanism will not be triggered and driver
20262026
* is completely depending on firmware event for station kickout.
20272027
*
2028+
* @IEEE80211_HW_SUPPORTS_TX_FRAG: Hardware does fragmentation by itself.
2029+
* The stack will not do fragmentation.
2030+
* The callback for @set_frag_threshold should be set as well.
2031+
*
20282032
* @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
20292033
*/
20302034
enum ieee80211_hw_flags {
@@ -2066,6 +2070,7 @@ enum ieee80211_hw_flags {
20662070
IEEE80211_HW_TX_AMSDU,
20672071
IEEE80211_HW_TX_FRAG_LIST,
20682072
IEEE80211_HW_REPORTS_LOW_ACK,
2073+
IEEE80211_HW_SUPPORTS_TX_FRAG,
20692074

20702075
/* keep last, obviously */
20712076
NUM_IEEE80211_HW_FLAGS
@@ -3093,8 +3098,9 @@ enum ieee80211_reconfig_type {
30933098
* The callback must be atomic.
30943099
*
30953100
* @set_frag_threshold: Configuration of fragmentation threshold. Assign this
3096-
* if the device does fragmentation by itself; if this callback is
3097-
* implemented then the stack will not do fragmentation.
3101+
* if the device does fragmentation by itself. Note that to prevent the
3102+
* stack from doing fragmentation IEEE80211_HW_SUPPORTS_TX_FRAG
3103+
* should be set as well.
30983104
* The callback can sleep.
30993105
*
31003106
* @set_rts_threshold: Configuration of RTS threshold (if device needs it)

net/mac80211/debugfs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ static const char *hw_flag_names[] = {
210210
FLAG(TX_AMSDU),
211211
FLAG(TX_FRAG_LIST),
212212
FLAG(REPORTS_LOW_ACK),
213+
FLAG(SUPPORTS_TX_FRAG),
213214
#undef FLAG
214215
};
215216

net/mac80211/main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,10 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
821821
!local->ops->tdls_recv_channel_switch))
822822
return -EOPNOTSUPP;
823823

824+
if (WARN_ON(ieee80211_hw_check(hw, SUPPORTS_TX_FRAG) &&
825+
!local->ops->set_frag_threshold))
826+
return -EINVAL;
827+
824828
if (WARN_ON(local->hw.wiphy->interface_modes &
825829
BIT(NL80211_IFTYPE_NAN) &&
826830
(!local->ops->start_nan || !local->ops->stop_nan)))

net/mac80211/tx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx)
934934
if (info->flags & IEEE80211_TX_CTL_DONTFRAG)
935935
return TX_CONTINUE;
936936

937-
if (tx->local->ops->set_frag_threshold)
937+
if (ieee80211_hw_check(&tx->local->hw, SUPPORTS_TX_FRAG))
938938
return TX_CONTINUE;
939939

940940
/*
@@ -2800,7 +2800,7 @@ void ieee80211_check_fast_xmit(struct sta_info *sta)
28002800

28012801
/* fast-xmit doesn't handle fragmentation at all */
28022802
if (local->hw.wiphy->frag_threshold != (u32)-1 &&
2803-
!local->ops->set_frag_threshold)
2803+
!ieee80211_hw_check(&local->hw, SUPPORTS_TX_FRAG))
28042804
goto out;
28052805

28062806
rcu_read_lock();

net/mac80211/wpa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ ieee80211_tx_h_michael_mic_add(struct ieee80211_tx_data *tx)
5757

5858
if (info->control.hw_key &&
5959
(info->flags & IEEE80211_TX_CTL_DONTFRAG ||
60-
tx->local->ops->set_frag_threshold) &&
60+
ieee80211_hw_check(&tx->local->hw, SUPPORTS_TX_FRAG)) &&
6161
!(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) {
6262
/* hwaccel - with no need for SW-generated MMIC */
6363
return TX_CONTINUE;

0 commit comments

Comments
 (0)