Browse Source

mac80211: Store sk_pacing_shift in ieee80211_hw

Make it possibly for drivers to adjust the default skb_pacing_shift
by storing it in the hardware struct.

Signed-off-by: Wen Gong <wgong@codeaurora.org>
[adjust commit log, move & adjust comment]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Wen Gong 7 years ago
parent
commit
70e53669c4
3 changed files with 18 additions and 7 deletions
  1. 5 0
      include/net/mac80211.h
  2. 12 0
      net/mac80211/main.c
  3. 1 7
      net/mac80211/tx.c

+ 5 - 0
include/net/mac80211.h

@@ -2308,6 +2308,10 @@ enum ieee80211_hw_flags {
  *	supported by HW.
  *	supported by HW.
  * @max_nan_de_entries: maximum number of NAN DE functions supported by the
  * @max_nan_de_entries: maximum number of NAN DE functions supported by the
  *	device.
  *	device.
+ *
+ * @tx_sk_pacing_shift: Pacing shift to set on TCP sockets when frames from
+ *	them are encountered. The default should typically not be changed,
+ *	unless the driver has good reasons for needing more buffers.
  */
  */
 struct ieee80211_hw {
 struct ieee80211_hw {
 	struct ieee80211_conf conf;
 	struct ieee80211_conf conf;
@@ -2343,6 +2347,7 @@ struct ieee80211_hw {
 	u8 n_cipher_schemes;
 	u8 n_cipher_schemes;
 	const struct ieee80211_cipher_scheme *cipher_schemes;
 	const struct ieee80211_cipher_scheme *cipher_schemes;
 	u8 max_nan_de_entries;
 	u8 max_nan_de_entries;
+	u8 tx_sk_pacing_shift;
 };
 };
 
 
 static inline bool _ieee80211_hw_check(struct ieee80211_hw *hw,
 static inline bool _ieee80211_hw_check(struct ieee80211_hw *hw,

+ 12 - 0
net/mac80211/main.c

@@ -611,6 +611,18 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
 	local->ops = ops;
 	local->ops = ops;
 	local->use_chanctx = use_chanctx;
 	local->use_chanctx = use_chanctx;
 
 
+	/*
+	 * We need a bit of data queued to build aggregates properly, so
+	 * instruct the TCP stack to allow more than a single ms of data
+	 * to be queued in the stack. The value is a bit-shift of 1
+	 * second, so 8 is ~4ms of queued data. Only affects local TCP
+	 * sockets.
+	 * This is the default, anyhow - drivers may need to override it
+	 * for local reasons (longer buffers, longer completion time, or
+	 * similar).
+	 */
+	local->hw.tx_sk_pacing_shift = 8;
+
 	/* set up some defaults */
 	/* set up some defaults */
 	local->hw.queues = 1;
 	local->hw.queues = 1;
 	local->hw.max_rates = 1;
 	local->hw.max_rates = 1;

+ 1 - 7
net/mac80211/tx.c

@@ -3625,13 +3625,7 @@ void __ieee80211_subif_start_xmit(struct sk_buff *skb,
 	if (!IS_ERR_OR_NULL(sta)) {
 	if (!IS_ERR_OR_NULL(sta)) {
 		struct ieee80211_fast_tx *fast_tx;
 		struct ieee80211_fast_tx *fast_tx;
 
 
-		/* We need a bit of data queued to build aggregates properly, so
-		 * instruct the TCP stack to allow more than a single ms of data
-		 * to be queued in the stack. The value is a bit-shift of 1
-		 * second, so 8 is ~4ms of queued data. Only affects local TCP
-		 * sockets.
-		 */
-		sk_pacing_shift_update(skb->sk, 8);
+		sk_pacing_shift_update(skb->sk, sdata->local->hw.tx_sk_pacing_shift);
 
 
 		fast_tx = rcu_dereference(sta->fast_tx);
 		fast_tx = rcu_dereference(sta->fast_tx);