Skip to contentSkip to conversation

ath10k: add encapsulation offloading support

RFC PATCH In review Sergey Ryazanov 2 participants 6 messages Apr 2, 2022 – Apr 18, 2022 Qualcomm Atheros ATH10K wireless driver

lore
Share & tools
lore
#0 lore raw

cover ath10k: add encapsulation offloading support

Hello,

this series introduces driver support for hardware encapsulation offloading feature.

The main goal of the series is an overall improvement of system performance. On a QCA9563+QCA9888-based access point in bridged mode, encapsulation offloading increases TCP 16-streams DL throughput from 365 to 396 mbps (+8%) and UDP DL throughput from 436 to 483 mbps (+11%).

The series consist of three patches, the first two prepare the code, and the last one introduces the offloading support itself. The first patch reworks transmission status reporting to make it flexible enough to support 802.11 and Ethernet encapsulated frames reporting. The second patch reworks the module parameter that configures the main encapsulation format of frames that are passed from the driver to the hardware. It makes it possible to configure more encapsulation methods than just raw or not-raw. And, as stated before, the third patch actually introduces offloading support. It changes a couple of frame analysis places along the xmit path and starts reporting offloading support to mac80211 via the corresponding hw attribute.

The new feature has been extensively tested with QCA9888 and works well, but it may introduces some regression for other untested chips. So the series is just an RFC for now.

Sergey Ryazanov (3):
ath10k: improve tx status reporting
ath10k: turn rawmode into frame_mode
ath10k: add encapsulation offloading support

 drivers/net/wireless/ath/ath10k/core.c | 11 +++--
 drivers/net/wireless/ath/ath10k/core.h |  1 +
 drivers/net/wireless/ath/ath10k/mac.c  | 67 +++++++++++++++++++++-----
 drivers/net/wireless/ath/ath10k/txrx.c | 12 ++++-
 4 files changed, 73 insertions(+), 18 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

RFC PATCH 1/3 ath10k: improve tx status reporting

We use ieee80211_tx_status() to report each completed tx frame. Internally, this function calls sta_info_get_by_addrs(), what has a couple of drawbacks:
1. additional station lookup causes a performance degradation;
2. mac80211 can not properly account Ethernet encapsulated frames due to the inability to properly determine the destination (station) MAC address since ieee80211_tx_status() assumes the frame has a 802.11 header.

The latter is especially destructive if we want to use hardware frames encapsulation.

To fix both of these issues, replace ieee80211_tx_status() with ieee80211_tx_status_ext() call and feed it station pointer from the tx queue associated with the transmitted frame.

Tested-on: QCA9888 hw 2.0 10.4-3.9.0.2-00131

---
 drivers/net/wireless/ath/ath10k/txrx.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/txrx.c +11 -1
index 10123974c3da..72540434c75b 100644
@@ -43,6 +43,7 @@ static void ath10k_report_offchan_tx(struct ath10k *ar, struct sk_buff *skb)
 int ath10k_txrx_tx_unref(struct ath10k_htt *htt,
 			 const struct htt_tx_done *tx_done)
 {
+	struct ieee80211_tx_status status;
 	struct ath10k *ar = htt->ar;
 	struct device *dev = ar->dev;
 	struct ieee80211_tx_info *info;
@@ -128,7 +129,16 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt,
 		info->status.flags |= IEEE80211_TX_STATUS_ACK_SIGNAL_VALID;
 	}
 
-	ieee80211_tx_status(htt->ar->hw, msdu);
+	memset(&status, 0, sizeof(status));
+	status.skb = msdu;
+	status.info = info;
+
+	rcu_read_lock();
+	if (txq && txq->sta)
+		status.sta = txq->sta;
+	ieee80211_tx_status_ext(htt->ar->hw, &status);
+	rcu_read_unlock();
+
 	/* we do not own the msdu anymore */
 
 	return 0;
Signature · 1 line
2.34.1
#2 lore raw

RFC PATCH 2/3 ath10k: turn rawmode into frame_mode

In reply to Sergey Ryazanov

Turn boolean rawmode module param into integer frame_mode param that contains value from ath10k_hw_txrx_mode enum. As earlier the default param value is non-RAW (native Wi-Fi) encapsulation. The param name is selected to be consistent with the similar ath11k param.

This is a preparation step for upcoming encapsulation offloading support.

---
 drivers/net/wireless/ath/ath10k/core.c | 11 +++++++----
 drivers/net/wireless/ath/ath10k/core.h |  1 +
 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath10k/core.c +7 -4
index 2092bfd02cd1..b74b6f5a7178 100644
@@ -33,9 +33,11 @@ EXPORT_SYMBOL(ath10k_debug_mask);
 static unsigned int ath10k_cryptmode_param;
 static bool uart_print;
 static bool skip_otp;
-static bool rawmode;
 static bool fw_diag_log;
 
+/* frame mode values are mapped as per enum ath10k_hw_txrx_mode */
+unsigned int ath10k_frame_mode = ATH10K_HW_TXRX_NATIVE_WIFI;
+
 unsigned long ath10k_coredump_mask = BIT(ATH10K_FW_CRASH_DUMP_REGISTERS) |
 				     BIT(ATH10K_FW_CRASH_DUMP_CE_DATA);
 
@@ -44,15 +46,16 @@ module_param_named(debug_mask, ath10k_debug_mask, uint, 0644);
 module_param_named(cryptmode, ath10k_cryptmode_param, uint, 0644);
 module_param(uart_print, bool, 0644);
 module_param(skip_otp, bool, 0644);
-module_param(rawmode, bool, 0644);
 module_param(fw_diag_log, bool, 0644);
+module_param_named(frame_mode, ath10k_frame_mode, uint, 0644);
 module_param_named(coredump_mask, ath10k_coredump_mask, ulong, 0444);
 
 MODULE_PARM_DESC(debug_mask, "Debugging mask");
 MODULE_PARM_DESC(uart_print, "Uart target debugging");
 MODULE_PARM_DESC(skip_otp, "Skip otp failure for calibration in testmode");
 MODULE_PARM_DESC(cryptmode, "Crypto mode: 0-hardware, 1-software");
-MODULE_PARM_DESC(rawmode, "Use raw 802.11 frame datapath");
+MODULE_PARM_DESC(frame_mode,
+		 "Datapath frame mode (0: raw, 1: native wifi (default))");
 MODULE_PARM_DESC(coredump_mask, "Bitfield of what to include in firmware crash file");
 MODULE_PARM_DESC(fw_diag_log, "Diag based fw log debugging");
 
@@ -2588,7 +2591,7 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar)
 	ar->htt.max_num_amsdu = ATH10K_HTT_MAX_NUM_AMSDU_DEFAULT;
 	ar->htt.max_num_ampdu = ATH10K_HTT_MAX_NUM_AMPDU_DEFAULT;
 
-	if (rawmode) {
+	if (ath10k_frame_mode == ATH10K_HW_TXRX_RAW) {
 		if (!test_bit(ATH10K_FW_FEATURE_RAW_MODE_SUPPORT,
 			      fw_file->fw_features)) {
 			ath10k_err(ar, "rawmode = 1 requires support from firmware");
drivers/net/wireless/ath/ath10k/core.h +1 -0
index 9f6680b3be0a..a27d450bbeb8 100644
@@ -1317,6 +1317,7 @@ static inline bool ath10k_peer_stats_enabled(struct ath10k *ar)
 	return false;
 }
 
+extern unsigned int ath10k_frame_mode;
 extern unsigned long ath10k_coredump_mask;
 
 void ath10k_core_napi_sync_disable(struct ath10k *ar);
Signature · 1 line
2.34.1
#3 lore raw

RFC PATCH 3/3 ath10k: add encapsulation offloading support

In reply to Sergey Ryazanov

Frame encapsulation from Ethernet into the IEEE 802.11 frame format takes a considerable host CPU time on the xmit path. The firmware is able to do this operation for us, so enable encapsulation offloading for AP and Sta interface types to improve overall system performance.

The driver is almost ready for encapsulation offloading support. There are only a few places where the driver assumes the frame format is IEEE 802.11 that need to be fixed.

Encapsulation offloading is currently disabled by default and the driver utilizes mac80211 encapsulation support. To activate offloading, the frame_mode=2 parameter should be passed during module loading.

On a QCA9563+QCA9888-based access point in bridged mode, encapsulation offloading increases TCP 16-streams DL throughput from 365 to 396 mbps (+8%) and UDP DL throughput from 436 to 483 mbps (+11%).

Tested-on: QCA9888 hw 2.0 10.4-3.9.0.2-00131

---
 drivers/net/wireless/ath/ath10k/core.c |  2 +-
 drivers/net/wireless/ath/ath10k/mac.c  | 67 +++++++++++++++++++++-----
 2 files changed, 55 insertions(+), 14 deletions(-)
drivers/net/wireless/ath/ath10k/core.c +1 -1
index b74b6f5a7178..f8f28682c431 100644
@@ -55,7 +55,7 @@ MODULE_PARM_DESC(uart_print, "Uart target debugging");
 MODULE_PARM_DESC(skip_otp, "Skip otp failure for calibration in testmode");
 MODULE_PARM_DESC(cryptmode, "Crypto mode: 0-hardware, 1-software");
 MODULE_PARM_DESC(frame_mode,
-		 "Datapath frame mode (0: raw, 1: native wifi (default))");
+		 "Datapath frame mode (0: raw, 1: native wifi (default), 2: ethernet)");
 MODULE_PARM_DESC(coredump_mask, "Bitfield of what to include in firmware crash file");
 MODULE_PARM_DESC(fw_diag_log, "Diag based fw log debugging");
 
drivers/net/wireless/ath/ath10k/mac.c +54 -13

132 lines not on this page · raw message

Signature · 1 line
2.34.1
#4 lore raw
In reply to Sergey Ryazanov
Quoted 22 lines · Sergey Ryazanov

Hello,

this series introduces driver support for hardware encapsulation offloading feature.

The main goal of the series is an overall improvement of system performance. On a QCA9563+QCA9888-based access point in bridged mode, encapsulation offloading increases TCP 16-streams DL throughput from 365 to 396 mbps (+8%) and UDP DL throughput from 436 to 483 mbps (+11%).

The series consist of three patches, the first two prepare the code, and the last one introduces the offloading support itself. The first patch reworks transmission status reporting to make it flexible enough to support 802.11 and Ethernet encapsulated frames reporting. The second patch reworks the module parameter that configures the main encapsulation format of frames that are passed from the driver to the hardware. It makes it possible to configure more encapsulation methods than just raw or not-raw. And, as stated before, the third patch actually introduces offloading support. It changes a couple of frame analysis places along the xmit path and starts reporting offloading support to mac80211 via the corresponding hw attribute.

Quoted 3 lines

The new feature has been extensively tested with QCA9888 and works well, but it may introduces some regression for other untested chips. So the series is just an RFC for now.

This looks very good to me. But the testing part concerns me as well, it would be good to have some quick testing at least with QCA6174/QCA9377 PCI devices to make sure we don't break those. Preferably also QCA6174/QCA9377 SDIO devices should be tested, they work somewhat differently. Can anyone help?

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#5 lore raw
Quoted 27 lines · Kalle Valo
Quoted 22 lines · Sergey Ryazanov

Hello,

this series introduces driver support for hardware encapsulation offloading feature.

The main goal of the series is an overall improvement of system performance. On a QCA9563+QCA9888-based access point in bridged mode, encapsulation offloading increases TCP 16-streams DL throughput from 365 to 396 mbps (+8%) and UDP DL throughput from 436 to 483 mbps (+11%).

The series consist of three patches, the first two prepare the code, and the last one introduces the offloading support itself. The first patch reworks transmission status reporting to make it flexible enough to support 802.11 and Ethernet encapsulated frames reporting. The second patch reworks the module parameter that configures the main encapsulation format of frames that are passed from the driver to the hardware. It makes it possible to configure more encapsulation methods than just raw or not-raw. And, as stated before, the third patch actually introduces offloading support. It changes a couple of frame analysis places along the xmit path and starts reporting offloading support to mac80211 via the corresponding hw attribute.

Quoted 3 lines

The new feature has been extensively tested with QCA9888 and works well, but it may introduces some regression for other untested chips. So the series is just an RFC for now.

Quoted 5 lines

This looks very good to me. But the testing part concerns me as well, it would be good to have some quick testing at least with QCA6174/QCA9377 PCI devices to make sure we don't break those. Preferably also QCA6174/QCA9377 SDIO devices should be tested, they work somewhat differently. Can anyone help?

Is any brave tester trying to improve the performance of their system with this change? Can I resend it as a regular patch?

Signature · 6 lines
Sergey

_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k