All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] ath10k: add encapsulation offloading support
@ 2022-05-16  3:25 ` Sergey Ryazanov
  0 siblings, 0 replies; 22+ messages in thread
From: Sergey Ryazanov @ 2022-05-16  3:25 UTC (permalink / raw)
  To: Kalle Valo
  Cc: ath10k, linux-wireless, Edward Matijevic, John Crispin,
	Oldřich Jedlička, Tom Psyborg,
	Vasanthakumar Thiagarajan, Zhijun You

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 four patches, the first three 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 improves Ethernet encapsulated frames handling in the HTT
Tx layer. The third 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 fourth
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. It works well
and introduces a measurable performance increase on platforms with not
so fast CPU (e.g. QCA9563). Tests with MT7621+QCA6174 show no
regression. I was unable to observe any measurable throughput increase
in tests with QCA6174 due to the poor perfomance the SISO client and OTA
testing. Only slight downlink rate stability increase with slight
reducing of the SIRQ load on the AP side.

Tests with QCA9880, QCA9980, QCA9984, QCA9377 revealed no regression
[1]. No specific throughput tests have been performed. In OTA tests with
a regular load, there is a slight increase in througput stability.

In tests of the QCA9377 in Sta mode, Edward Matijevic noticed a possible
regression in the Ethernet tx mode compared to the Native WiFi tx
mode:
> There might be a regression in download bandwidth under ETHERNET mode
> but I didn't do enough tests to see if was my PC or the adapter as the
> upload bandwidth was similar to other tests.
> NATIVE_WIFI performs the same as without the patch.

Credits: thanks to OpenWrt folks Oldřich Jedlička
<oldium.pro@gmail.com> and Edward Matijevic <motolav@gmail.com> who
helped me a lot to perform extensive testing with various chips after a
RFC/RFT post in the OpenWrt development mailing list [1]. Thanks to
Zhijun You <hujy652@gmail.com> who helped with the testing, pointed me
to the previous work (see below) and the missed parts in the HTT Tx
layer [1].

Prior work: similar patches were independently developed by QCA and then
submitted for inclusion by John Crispin <john@phrozen.org> [2] and
latter by Zhijun You <hujy652@gmail.com> [3]. The work was not merged
due to the lack of a part for 64-bits descriptors [4]. The idea of HTT
Tx layer change from this work was adopted for the series in patch #2.

1. https://www.mail-archive.com/openwrt-devel@lists.openwrt.org/msg62013.html
2. https://lore.kernel.org/all/20191216092207.31032-1-john@phrozen.org/
3. https://lore.kernel.org/all/20210524103130.66693-1-hujy652@gmail.com/
4. https://patchwork.kernel.org/project/linux-wireless/patch/20191216092207.31032-1-john@phrozen.org/

CC: Edward Matijevic <motolav@gmail.com>
CC: John Crispin <john@phrozen.org>
CC: Oldřich Jedlička <oldium.pro@gmail.com>
CC: Tom Psyborg <pozega.tomislav@gmail.com>
CC: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
CC: Zhijun You <hujy652@gmail.com>

Changes since RFC:
 * new Tested-on and Tested-by tags
 * new patch #2 for better Ethernet encapsulation support in the HTT Tx
   layer
 * rebased on top of latest ath-next

Sergey Ryazanov (3):
  ath10k: improve tx status reporting
  ath10k: htt_tx: do not interpret Eth frames as WiFi
  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/htt_tx.c | 61 ++++++++++++---------
 drivers/net/wireless/ath/ath10k/mac.c    | 67 +++++++++++++++++++-----
 drivers/net/wireless/ath/ath10k/txrx.c   | 12 ++++-
 5 files changed, 108 insertions(+), 44 deletions(-)

-- 
2.35.1


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 0/4] ath10k: add encapsulation offloading support
@ 2022-05-16  3:25 ` Sergey Ryazanov
  0 siblings, 0 replies; 22+ messages in thread
From: Sergey Ryazanov @ 2022-05-16  3:25 UTC (permalink / raw)
  To: Kalle Valo
  Cc: ath10k, linux-wireless, Edward Matijevic, John Crispin,
	Oldřich Jedlička, Tom Psyborg,
	Vasanthakumar Thiagarajan, Zhijun You

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 four patches, the first three 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 improves Ethernet encapsulated frames handling in the HTT
Tx layer. The third 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 fourth
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. It works well
and introduces a measurable performance increase on platforms with not
so fast CPU (e.g. QCA9563). Tests with MT7621+QCA6174 show no
regression. I was unable to observe any measurable throughput increase
in tests with QCA6174 due to the poor perfomance the SISO client and OTA
testing. Only slight downlink rate stability increase with slight
reducing of the SIRQ load on the AP side.

Tests with QCA9880, QCA9980, QCA9984, QCA9377 revealed no regression
[1]. No specific throughput tests have been performed. In OTA tests with
a regular load, there is a slight increase in througput stability.

In tests of the QCA9377 in Sta mode, Edward Matijevic noticed a possible
regression in the Ethernet tx mode compared to the Native WiFi tx
mode:
> There might be a regression in download bandwidth under ETHERNET mode
> but I didn't do enough tests to see if was my PC or the adapter as the
> upload bandwidth was similar to other tests.
> NATIVE_WIFI performs the same as without the patch.

Credits: thanks to OpenWrt folks Oldřich Jedlička
<oldium.pro@gmail.com> and Edward Matijevic <motolav@gmail.com> who
helped me a lot to perform extensive testing with various chips after a
RFC/RFT post in the OpenWrt development mailing list [1]. Thanks to
Zhijun You <hujy652@gmail.com> who helped with the testing, pointed me
to the previous work (see below) and the missed parts in the HTT Tx
layer [1].

Prior work: similar patches were independently developed by QCA and then
submitted for inclusion by John Crispin <john@phrozen.org> [2] and
latter by Zhijun You <hujy652@gmail.com> [3]. The work was not merged
due to the lack of a part for 64-bits descriptors [4]. The idea of HTT
Tx layer change from this work was adopted for the series in patch #2.

1. https://www.mail-archive.com/openwrt-devel@lists.openwrt.org/msg62013.html
2. https://lore.kernel.org/all/20191216092207.31032-1-john@phrozen.org/
3. https://lore.kernel.org/all/20210524103130.66693-1-hujy652@gmail.com/
4. https://patchwork.kernel.org/project/linux-wireless/patch/20191216092207.31032-1-john@phrozen.org/

CC: Edward Matijevic <motolav@gmail.com>
CC: John Crispin <john@phrozen.org>
CC: Oldřich Jedlička <oldium.pro@gmail.com>
CC: Tom Psyborg <pozega.tomislav@gmail.com>
CC: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
CC: Zhijun You <hujy652@gmail.com>

Changes since RFC:
 * new Tested-on and Tested-by tags
 * new patch #2 for better Ethernet encapsulation support in the HTT Tx
   layer
 * rebased on top of latest ath-next

Sergey Ryazanov (3):
  ath10k: improve tx status reporting
  ath10k: htt_tx: do not interpret Eth frames as WiFi
  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/htt_tx.c | 61 ++++++++++++---------
 drivers/net/wireless/ath/ath10k/mac.c    | 67 +++++++++++++++++++-----
 drivers/net/wireless/ath/ath10k/txrx.c   | 12 ++++-
 5 files changed, 108 insertions(+), 44 deletions(-)

-- 
2.35.1


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 1/4] ath10k: improve tx status reporting
  2022-05-16  3:25 ` Sergey Ryazanov
@ 2022-05-16  3:25   ` Sergey Ryazanov
  -1 siblings, 0 replies; 22+ messages in thread
From: Sergey Ryazanov @ 2022-05-16  3:25 UTC (permalink / raw)
  To: Kalle Valo
  Cc: ath10k, linux-wireless, Edward Matijevic, John Crispin,
	Oldřich Jedlička, Tom Psyborg,
	Vasanthakumar Thiagarajan, Zhijun You

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
Tested-on: QCA6174 hw 3.2 PCI WLAN.RM.4.4.1-00157-QCARMSWPZ-1
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Tested-by: Oldřich Jedlička <oldium.pro@gmail.com> # TP-Link Archer C7 v4 & v5 (QCA9563 + QCA9880)
Tested-by: Edward Matijevic <motolav@gmail.com> # TP-Link Archer C2600 (IPQ8064 + QCA9980 10.4.1.00030-1)
Tested-by: Edward Matijevic <motolav@gmail.com> # QCA9377 PCI in Sta mode
Tested-by: Zhijun You <hujy652@gmail.com> # NETGEAR R7800 (QCA9984 10.4-3.9.0.2-00159)
---

Changes since RFC:
 * new Tested-on and Tested-by tags

 drivers/net/wireless/ath/ath10k/txrx.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c
index 10123974c3da..72540434c75b 100644
--- a/drivers/net/wireless/ath/ath10k/txrx.c
+++ b/drivers/net/wireless/ath/ath10k/txrx.c
@@ -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;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 1/4] ath10k: improve tx status reporting
@ 2022-05-16  3:25   ` Sergey Ryazanov
  0 siblings, 0 replies; 22+ messages in thread
From: Sergey Ryazanov @ 2022-05-16  3:25 UTC (permalink / raw)
  To: Kalle Valo
  Cc: ath10k, linux-wireless, Edward Matijevic, John Crispin,
	Oldřich Jedlička, Tom Psyborg,
	Vasanthakumar Thiagarajan, Zhijun You

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
Tested-on: QCA6174 hw 3.2 PCI WLAN.RM.4.4.1-00157-QCARMSWPZ-1
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Tested-by: Oldřich Jedlička <oldium.pro@gmail.com> # TP-Link Archer C7 v4 & v5 (QCA9563 + QCA9880)
Tested-by: Edward Matijevic <motolav@gmail.com> # TP-Link Archer C2600 (IPQ8064 + QCA9980 10.4.1.00030-1)
Tested-by: Edward Matijevic <motolav@gmail.com> # QCA9377 PCI in Sta mode
Tested-by: Zhijun You <hujy652@gmail.com> # NETGEAR R7800 (QCA9984 10.4-3.9.0.2-00159)
---

Changes since RFC:
 * new Tested-on and Tested-by tags

 drivers/net/wireless/ath/ath10k/txrx.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c
index 10123974c3da..72540434c75b 100644
--- a/drivers/net/wireless/ath/ath10k/txrx.c
+++ b/drivers/net/wireless/ath/ath10k/txrx.c
@@ -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;
-- 
2.35.1


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 2/4] ath10k: htt_tx: do not interpret Eth frames as WiFi
  2022-05-16  3:25 ` Sergey Ryazanov
@ 2022-05-16  3:25   ` Sergey Ryazanov
  -1 siblings, 0 replies; 22+ messages in thread
From: Sergey Ryazanov @ 2022-05-16  3:25 UTC (permalink / raw)
  To: Kalle Valo
  Cc: ath10k, linux-wireless, Edward Matijevic, John Crispin,
	Oldřich Jedlička, Tom Psyborg,
	Vasanthakumar Thiagarajan, Zhijun You

The xmit path for the Ethernet encapsulated frames become more or less
usable since d740d8fd2439 ("ath10k: unify tx mode and dispatch"). This
change reorganize the xmit path in a manageable way to properly support
various tx modes, but misses that the Ethernet encapsulated frame is a
special case. We do not have an IEEE 802.11 header at the begining of
them. But the HTT Tx handler still interprets first bytes of each frame
as an IEEE 802.11 Frame Control field.

Than this code was copied by e62ee5c381c5 ("ath10k: Add support for
htt_data_tx_desc_64 descriptor") and a2097d6444c3 ("ath10k: htt: High
latency TX support") to another handlers. In fact the issue in the high
latency (HL) handler was introduced by 83ac260151e7 ("ath10k: add mic
bytes for pmf management packet").

Ethernet encapsulated frame tx mode stay unused until 75d85fd9993c
("ath10k: introduce basic tdls functionality") started using it for TDLS
frames to avoid key selection issue in some firmwares.

Trying to interpret the begining of an Ethernet encapsulated frame as an
IEEE 802.11 header was not hurt us noticeably since we need to meet two
conditions: (1) xmit should be performed towards a TDLS peer, and (2)
the TDLS peer should have a specific OUI part of its MAC address. Looks
like that the rareness in TDLS communications of OUIs that can be
interpreted as an 802.11 management frame saves users from facing this
issue earlier.

Improve Ethernet tx mode support in the HTT Tx handler by avoiding
interpreting its first bytes as an IEEE 802.11 header. While at it, make
the ieee80211_hdr variable local to the code block that is guarded by
!is_eth check. In this way, we clarify in which cases a frame can be
interpreted as IEEE 802.11, and saves us from similar issues in the
future.

Credits: this change as part of xmit encapsulation offloading support
was originally made by QCA and then submitted for inclusion by John
Crispin [1]. But the whole work was not accepted due to the lack of a
part for 64-bits descriptors [2]. Zhijun You then pointed this out to me
in a reply to my initial RFC patch series. And I made this slightly
reworked version that covered all the HTT Tx handler variants.

1. https://lore.kernel.org/all/20191216092207.31032-1-john@phrozen.org/
2. https://patchwork.kernel.org/project/linux-wireless/patch/20191216092207.31032-1-john@phrozen.org/

Reported-by: Zhijun You <hujy652@gmail.com>
Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
---

Changes since RFC:
 * new patch

 drivers/net/wireless/ath/ath10k/htt_tx.c | 61 ++++++++++++++----------
 1 file changed, 35 insertions(+), 26 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c
index 9842a4b2f78f..a19b0795c86d 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -1275,7 +1275,6 @@ static int ath10k_htt_tx_hl(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txm
 	struct ath10k *ar = htt->ar;
 	int res, data_len;
 	struct htt_cmd_hdr *cmd_hdr;
-	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)msdu->data;
 	struct htt_data_tx_desc *tx_desc;
 	struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(msdu);
 	struct sk_buff *tmp_skb;
@@ -1286,11 +1285,15 @@ static int ath10k_htt_tx_hl(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txm
 	u16 flags1 = 0;
 	u16 msdu_id = 0;
 
-	if ((ieee80211_is_action(hdr->frame_control) ||
-	     ieee80211_is_deauth(hdr->frame_control) ||
-	     ieee80211_is_disassoc(hdr->frame_control)) &&
-	     ieee80211_has_protected(hdr->frame_control)) {
-		skb_put(msdu, IEEE80211_CCMP_MIC_LEN);
+	if (!is_eth) {
+		struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)msdu->data;
+
+		if ((ieee80211_is_action(hdr->frame_control) ||
+		     ieee80211_is_deauth(hdr->frame_control) ||
+		     ieee80211_is_disassoc(hdr->frame_control)) &&
+		     ieee80211_has_protected(hdr->frame_control)) {
+			skb_put(msdu, IEEE80211_CCMP_MIC_LEN);
+		}
 	}
 
 	data_len = msdu->len;
@@ -1387,7 +1390,6 @@ static int ath10k_htt_tx_32(struct ath10k_htt *htt,
 {
 	struct ath10k *ar = htt->ar;
 	struct device *dev = ar->dev;
-	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)msdu->data;
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(msdu);
 	struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(msdu);
 	struct ath10k_hif_sg_item sg_items[2];
@@ -1419,15 +1421,19 @@ static int ath10k_htt_tx_32(struct ath10k_htt *htt,
 	txbuf_paddr = htt->txbuf.paddr +
 		      (sizeof(struct ath10k_htt_txbuf_32) * msdu_id);
 
-	if ((ieee80211_is_action(hdr->frame_control) ||
-	     ieee80211_is_deauth(hdr->frame_control) ||
-	     ieee80211_is_disassoc(hdr->frame_control)) &&
-	     ieee80211_has_protected(hdr->frame_control)) {
-		skb_put(msdu, IEEE80211_CCMP_MIC_LEN);
-	} else if (!(skb_cb->flags & ATH10K_SKB_F_NO_HWCRYPT) &&
-		   txmode == ATH10K_HW_TXRX_RAW &&
-		   ieee80211_has_protected(hdr->frame_control)) {
-		skb_put(msdu, IEEE80211_CCMP_MIC_LEN);
+	if (!is_eth) {
+		struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)msdu->data;
+
+		if ((ieee80211_is_action(hdr->frame_control) ||
+		     ieee80211_is_deauth(hdr->frame_control) ||
+		     ieee80211_is_disassoc(hdr->frame_control)) &&
+		     ieee80211_has_protected(hdr->frame_control)) {
+			skb_put(msdu, IEEE80211_CCMP_MIC_LEN);
+		} else if (!(skb_cb->flags & ATH10K_SKB_F_NO_HWCRYPT) &&
+			   txmode == ATH10K_HW_TXRX_RAW &&
+			   ieee80211_has_protected(hdr->frame_control)) {
+			skb_put(msdu, IEEE80211_CCMP_MIC_LEN);
+		}
 	}
 
 	skb_cb->paddr = dma_map_single(dev, msdu->data, msdu->len,
@@ -1589,7 +1595,6 @@ static int ath10k_htt_tx_64(struct ath10k_htt *htt,
 {
 	struct ath10k *ar = htt->ar;
 	struct device *dev = ar->dev;
-	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)msdu->data;
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(msdu);
 	struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(msdu);
 	struct ath10k_hif_sg_item sg_items[2];
@@ -1621,15 +1626,19 @@ static int ath10k_htt_tx_64(struct ath10k_htt *htt,
 	txbuf_paddr = htt->txbuf.paddr +
 		      (sizeof(struct ath10k_htt_txbuf_64) * msdu_id);
 
-	if ((ieee80211_is_action(hdr->frame_control) ||
-	     ieee80211_is_deauth(hdr->frame_control) ||
-	     ieee80211_is_disassoc(hdr->frame_control)) &&
-	     ieee80211_has_protected(hdr->frame_control)) {
-		skb_put(msdu, IEEE80211_CCMP_MIC_LEN);
-	} else if (!(skb_cb->flags & ATH10K_SKB_F_NO_HWCRYPT) &&
-		   txmode == ATH10K_HW_TXRX_RAW &&
-		   ieee80211_has_protected(hdr->frame_control)) {
-		skb_put(msdu, IEEE80211_CCMP_MIC_LEN);
+	if (!is_eth) {
+		struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)msdu->data;
+
+		if ((ieee80211_is_action(hdr->frame_control) ||
+		     ieee80211_is_deauth(hdr->frame_control) ||
+		     ieee80211_is_disassoc(hdr->frame_control)) &&
+		     ieee80211_has_protected(hdr->frame_control)) {
+			skb_put(msdu, IEEE80211_CCMP_MIC_LEN);
+		} else if (!(skb_cb->flags & ATH10K_SKB_F_NO_HWCRYPT) &&
+			   txmode == ATH10K_HW_TXRX_RAW &&
+			   ieee80211_has_protected(hdr->frame_control)) {
+			skb_put(msdu, IEEE80211_CCMP_MIC_LEN);
+		}
 	}
 
 	skb_cb->paddr = dma_map_single(dev, msdu->data, msdu->len,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 2/4] ath10k: htt_tx: do not interpret Eth frames as WiFi
@ 2022-05-16  3:25   ` Sergey Ryazanov
  0 siblings, 0 replies; 22+ messages in thread
From: Sergey Ryazanov @ 2022-05-16  3:25 UTC (permalink / raw)
  To: Kalle Valo
  Cc: ath10k, linux-wireless, Edward Matijevic, John Crispin,
	Oldřich Jedlička, Tom Psyborg,
	Vasanthakumar Thiagarajan, Zhijun You

The xmit path for the Ethernet encapsulated frames become more or less
usable since d740d8fd2439 ("ath10k: unify tx mode and dispatch"). This
change reorganize the xmit path in a manageable way to properly support
various tx modes, but misses that the Ethernet encapsulated frame is a
special case. We do not have an IEEE 802.11 header at the begining of
them. But the HTT Tx handler still interprets first bytes of each frame
as an IEEE 802.11 Frame Control field.

Than this code was copied by e62ee5c381c5 ("ath10k: Add support for
htt_data_tx_desc_64 descriptor") and a2097d6444c3 ("ath10k: htt: High
latency TX support") to another handlers. In fact the issue in the high
latency (HL) handler was introduced by 83ac260151e7 ("ath10k: add mic
bytes for pmf management packet").

Ethernet encapsulated frame tx mode stay unused until 75d85fd9993c
("ath10k: introduce basic tdls functionality") started using it for TDLS
frames to avoid key selection issue in some firmwares.

Trying to interpret the begining of an Ethernet encapsulated frame as an
IEEE 802.11 header was not hurt us noticeably since we need to meet two
conditions: (1) xmit should be performed towards a TDLS peer, and (2)
the TDLS peer should have a specific OUI part of its MAC address. Looks
like that the rareness in TDLS communications of OUIs that can be
interpreted as an 802.11 management frame saves users from facing this
issue earlier.

Improve Ethernet tx mode support in the HTT Tx handler by avoiding
interpreting its first bytes as an IEEE 802.11 header. While at it, make
the ieee80211_hdr variable local to the code block that is guarded by
!is_eth check. In this way, we clarify in which cases a frame can be
interpreted as IEEE 802.11, and saves us from similar issues in the
future.

Credits: this change as part of xmit encapsulation offloading support
was originally made by QCA and then submitted for inclusion by John
Crispin [1]. But the whole work was not accepted due to the lack of a
part for 64-bits descriptors [2]. Zhijun You then pointed this out to me
in a reply to my initial RFC patch series. And I made this slightly
reworked version that covered all the HTT Tx handler variants.

1. https://lore.kernel.org/all/20191216092207.31032-1-john@phrozen.org/
2. https://patchwork.kernel.org/project/linux-wireless/patch/20191216092207.31032-1-john@phrozen.org/

Reported-by: Zhijun You <hujy652@gmail.com>
Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
---

Changes since RFC:
 * new patch

 drivers/net/wireless/ath/ath10k/htt_tx.c | 61 ++++++++++++++----------
 1 file changed, 35 insertions(+), 26 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c
index 9842a4b2f78f..a19b0795c86d 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -1275,7 +1275,6 @@ static int ath10k_htt_tx_hl(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txm
 	struct ath10k *ar = htt->ar;
 	int res, data_len;
 	struct htt_cmd_hdr *cmd_hdr;
-	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)msdu->data;
 	struct htt_data_tx_desc *tx_desc;
 	struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(msdu);
 	struct sk_buff *tmp_skb;
@@ -1286,11 +1285,15 @@ static int ath10k_htt_tx_hl(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txm
 	u16 flags1 = 0;
 	u16 msdu_id = 0;
 
-	if ((ieee80211_is_action(hdr->frame_control) ||
-	     ieee80211_is_deauth(hdr->frame_control) ||
-	     ieee80211_is_disassoc(hdr->frame_control)) &&
-	     ieee80211_has_protected(hdr->frame_control)) {
-		skb_put(msdu, IEEE80211_CCMP_MIC_LEN);
+	if (!is_eth) {
+		struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)msdu->data;
+
+		if ((ieee80211_is_action(hdr->frame_control) ||
+		     ieee80211_is_deauth(hdr->frame_control) ||
+		     ieee80211_is_disassoc(hdr->frame_control)) &&
+		     ieee80211_has_protected(hdr->frame_control)) {
+			skb_put(msdu, IEEE80211_CCMP_MIC_LEN);
+		}
 	}
 
 	data_len = msdu->len;
@@ -1387,7 +1390,6 @@ static int ath10k_htt_tx_32(struct ath10k_htt *htt,
 {
 	struct ath10k *ar = htt->ar;
 	struct device *dev = ar->dev;
-	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)msdu->data;
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(msdu);
 	struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(msdu);
 	struct ath10k_hif_sg_item sg_items[2];
@@ -1419,15 +1421,19 @@ static int ath10k_htt_tx_32(struct ath10k_htt *htt,
 	txbuf_paddr = htt->txbuf.paddr +
 		      (sizeof(struct ath10k_htt_txbuf_32) * msdu_id);
 
-	if ((ieee80211_is_action(hdr->frame_control) ||
-	     ieee80211_is_deauth(hdr->frame_control) ||
-	     ieee80211_is_disassoc(hdr->frame_control)) &&
-	     ieee80211_has_protected(hdr->frame_control)) {
-		skb_put(msdu, IEEE80211_CCMP_MIC_LEN);
-	} else if (!(skb_cb->flags & ATH10K_SKB_F_NO_HWCRYPT) &&
-		   txmode == ATH10K_HW_TXRX_RAW &&
-		   ieee80211_has_protected(hdr->frame_control)) {
-		skb_put(msdu, IEEE80211_CCMP_MIC_LEN);
+	if (!is_eth) {
+		struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)msdu->data;
+
+		if ((ieee80211_is_action(hdr->frame_control) ||
+		     ieee80211_is_deauth(hdr->frame_control) ||
+		     ieee80211_is_disassoc(hdr->frame_control)) &&
+		     ieee80211_has_protected(hdr->frame_control)) {
+			skb_put(msdu, IEEE80211_CCMP_MIC_LEN);
+		} else if (!(skb_cb->flags & ATH10K_SKB_F_NO_HWCRYPT) &&
+			   txmode == ATH10K_HW_TXRX_RAW &&
+			   ieee80211_has_protected(hdr->frame_control)) {
+			skb_put(msdu, IEEE80211_CCMP_MIC_LEN);
+		}
 	}
 
 	skb_cb->paddr = dma_map_single(dev, msdu->data, msdu->len,
@@ -1589,7 +1595,6 @@ static int ath10k_htt_tx_64(struct ath10k_htt *htt,
 {
 	struct ath10k *ar = htt->ar;
 	struct device *dev = ar->dev;
-	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)msdu->data;
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(msdu);
 	struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(msdu);
 	struct ath10k_hif_sg_item sg_items[2];
@@ -1621,15 +1626,19 @@ static int ath10k_htt_tx_64(struct ath10k_htt *htt,
 	txbuf_paddr = htt->txbuf.paddr +
 		      (sizeof(struct ath10k_htt_txbuf_64) * msdu_id);
 
-	if ((ieee80211_is_action(hdr->frame_control) ||
-	     ieee80211_is_deauth(hdr->frame_control) ||
-	     ieee80211_is_disassoc(hdr->frame_control)) &&
-	     ieee80211_has_protected(hdr->frame_control)) {
-		skb_put(msdu, IEEE80211_CCMP_MIC_LEN);
-	} else if (!(skb_cb->flags & ATH10K_SKB_F_NO_HWCRYPT) &&
-		   txmode == ATH10K_HW_TXRX_RAW &&
-		   ieee80211_has_protected(hdr->frame_control)) {
-		skb_put(msdu, IEEE80211_CCMP_MIC_LEN);
+	if (!is_eth) {
+		struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)msdu->data;
+
+		if ((ieee80211_is_action(hdr->frame_control) ||
+		     ieee80211_is_deauth(hdr->frame_control) ||
+		     ieee80211_is_disassoc(hdr->frame_control)) &&
+		     ieee80211_has_protected(hdr->frame_control)) {
+			skb_put(msdu, IEEE80211_CCMP_MIC_LEN);
+		} else if (!(skb_cb->flags & ATH10K_SKB_F_NO_HWCRYPT) &&
+			   txmode == ATH10K_HW_TXRX_RAW &&
+			   ieee80211_has_protected(hdr->frame_control)) {
+			skb_put(msdu, IEEE80211_CCMP_MIC_LEN);
+		}
 	}
 
 	skb_cb->paddr = dma_map_single(dev, msdu->data, msdu->len,
-- 
2.35.1


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 3/4] ath10k: turn rawmode into frame_mode
  2022-05-16  3:25 ` Sergey Ryazanov
@ 2022-05-16  3:25   ` Sergey Ryazanov
  -1 siblings, 0 replies; 22+ messages in thread
From: Sergey Ryazanov @ 2022-05-16  3:25 UTC (permalink / raw)
  To: Kalle Valo
  Cc: ath10k, linux-wireless, Edward Matijevic, John Crispin,
	Oldřich Jedlička, Tom Psyborg,
	Vasanthakumar Thiagarajan, Zhijun You

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.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
---

Changes since RFC:
 * changed position in series: #2 -> #3
 * rebased on top of latest ath-next

 drivers/net/wireless/ath/ath10k/core.c | 11 +++++++----
 drivers/net/wireless/ath/ath10k/core.h |  1 +
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 688177453b07..5654387acb4b 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -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");
 
@@ -2599,7 +2602,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");
diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 8bfabbcfdb14..d70d7d088a2b 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -1314,6 +1314,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);
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 3/4] ath10k: turn rawmode into frame_mode
@ 2022-05-16  3:25   ` Sergey Ryazanov
  0 siblings, 0 replies; 22+ messages in thread
From: Sergey Ryazanov @ 2022-05-16  3:25 UTC (permalink / raw)
  To: Kalle Valo
  Cc: ath10k, linux-wireless, Edward Matijevic, John Crispin,
	Oldřich Jedlička, Tom Psyborg,
	Vasanthakumar Thiagarajan, Zhijun You

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.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
---

Changes since RFC:
 * changed position in series: #2 -> #3
 * rebased on top of latest ath-next

 drivers/net/wireless/ath/ath10k/core.c | 11 +++++++----
 drivers/net/wireless/ath/ath10k/core.h |  1 +
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 688177453b07..5654387acb4b 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -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");
 
@@ -2599,7 +2602,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");
diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 8bfabbcfdb14..d70d7d088a2b 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -1314,6 +1314,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);
-- 
2.35.1


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 4/4] ath10k: add encapsulation offloading support
  2022-05-16  3:25 ` Sergey Ryazanov
@ 2022-05-16  3:25   ` Sergey Ryazanov
  -1 siblings, 0 replies; 22+ messages in thread
From: Sergey Ryazanov @ 2022-05-16  3:25 UTC (permalink / raw)
  To: Kalle Valo
  Cc: ath10k, linux-wireless, Edward Matijevic, John Crispin,
	Oldřich Jedlička, Tom Psyborg,
	Vasanthakumar Thiagarajan, Zhijun You

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
Tested-on: QCA6174 hw 3.2 PCI WLAN.RM.4.4.1-00157-QCARMSWPZ-1
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Tested-by: Oldřich Jedlička <oldium.pro@gmail.com> # TP-Link Archer C7 v4 & v5 (QCA9563 + QCA9880)
Tested-by: Edward Matijevic <motolav@gmail.com> # TP-Link Archer C2600 (IPQ8064 + QCA9980 10.4.1.00030-1)
Tested-by: Edward Matijevic <motolav@gmail.com> # QCA9377 PCI in Sta mode
Tested-by: Zhijun You <hujy652@gmail.com> # NETGEAR R7800 (QCA9984 10.4-3.9.0.2-00159)
---

Changes since RFC:
 * new Tested-on and Tested-by tags
 * changed position in series: #3 -> #4
 * rebased on top of latest ath-next

 drivers/net/wireless/ath/ath10k/core.c |  2 +-
 drivers/net/wireless/ath/ath10k/mac.c  | 67 +++++++++++++++++++++-----
 2 files changed, 55 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 5654387acb4b..276954b70d63 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -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");
 
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 3570a5895ea8..ebd5b9a8943e 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -3713,6 +3713,9 @@ ath10k_mac_tx_h_get_txmode(struct ath10k *ar,
 	const struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb);
 	__le16 fc = hdr->frame_control;
 
+	if (IEEE80211_SKB_CB(skb)->flags & IEEE80211_TX_CTL_HW_80211_ENCAP)
+		return ATH10K_HW_TXRX_ETHERNET;
+
 	if (!vif || vif->type == NL80211_IFTYPE_MONITOR)
 		return ATH10K_HW_TXRX_RAW;
 
@@ -3873,6 +3876,12 @@ static void ath10k_mac_tx_h_fill_cb(struct ath10k *ar,
 	bool noack = false;
 
 	cb->flags = 0;
+
+	if (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) {
+		cb->flags |= ATH10K_SKB_F_QOS;	/* Assume data frames are QoS */
+		goto finish_cb_fill;
+	}
+
 	if (!ath10k_tx_h_use_hwcrypto(vif, skb))
 		cb->flags |= ATH10K_SKB_F_NO_HWCRYPT;
 
@@ -3911,6 +3920,7 @@ static void ath10k_mac_tx_h_fill_cb(struct ath10k *ar,
 		cb->flags |= ATH10K_SKB_F_RAW_TX;
 	}
 
+finish_cb_fill:
 	cb->vif = vif;
 	cb->txq = txq;
 	cb->airtime_est = airtime;
@@ -4034,7 +4044,11 @@ static int ath10k_mac_tx(struct ath10k *ar,
 		ath10k_tx_h_seq_no(vif, skb);
 		break;
 	case ATH10K_HW_TXRX_ETHERNET:
-		ath10k_tx_h_8023(skb);
+		/* Convert 802.11->802.3 header only if the frame was erlier
+		 * encapsulated to 802.11 by mac80211. Otherwise pass it as is.
+		 */
+		if (!(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP))
+			ath10k_tx_h_8023(skb);
 		break;
 	case ATH10K_HW_TXRX_RAW:
 		if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags) &&
@@ -4645,12 +4659,10 @@ static void ath10k_mac_op_tx(struct ieee80211_hw *hw,
 	struct ieee80211_vif *vif = info->control.vif;
 	struct ieee80211_sta *sta = control->sta;
 	struct ieee80211_txq *txq = NULL;
-	struct ieee80211_hdr *hdr = (void *)skb->data;
 	enum ath10k_hw_txrx_mode txmode;
 	enum ath10k_mac_tx_path txpath;
 	bool is_htt;
 	bool is_mgmt;
-	bool is_presp;
 	int ret;
 	u16 airtime;
 
@@ -4664,8 +4676,14 @@ static void ath10k_mac_op_tx(struct ieee80211_hw *hw,
 	is_mgmt = (txpath == ATH10K_MAC_TX_HTT_MGMT);
 
 	if (is_htt) {
+		bool is_presp = false;
+
 		spin_lock_bh(&ar->htt.tx_lock);
-		is_presp = ieee80211_is_probe_resp(hdr->frame_control);
+		if (!(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP)) {
+			struct ieee80211_hdr *hdr = (void *)skb->data;
+
+			is_presp = ieee80211_is_probe_resp(hdr->frame_control);
+		}
 
 		ret = ath10k_htt_tx_inc_pending(htt);
 		if (ret) {
@@ -5465,6 +5483,30 @@ static int ath10k_mac_set_txbf_conf(struct ath10k_vif *arvif)
 					 ar->wmi.vdev_param->txbf, value);
 }
 
+static void ath10k_update_vif_offload(struct ieee80211_hw *hw,
+				      struct ieee80211_vif *vif)
+{
+	struct ath10k_vif *arvif = (void *)vif->drv_priv;
+	struct ath10k *ar = hw->priv;
+	u32 vdev_param;
+	int ret;
+
+	if (ath10k_frame_mode != ATH10K_HW_TXRX_ETHERNET ||
+	    ar->wmi.vdev_param->tx_encap_type == WMI_VDEV_PARAM_UNSUPPORTED ||
+	     (vif->type != NL80211_IFTYPE_STATION &&
+	      vif->type != NL80211_IFTYPE_AP))
+		vif->offload_flags &= ~IEEE80211_OFFLOAD_ENCAP_ENABLED;
+
+	vdev_param = ar->wmi.vdev_param->tx_encap_type;
+	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
+					ATH10K_HW_TXRX_NATIVE_WIFI);
+	/* 10.X firmware does not support this VDEV parameter. Do not warn */
+	if (ret && ret != -EOPNOTSUPP) {
+		ath10k_warn(ar, "failed to set vdev %i TX encapsulation: %d\n",
+			    arvif->vdev_id, ret);
+	}
+}
+
 /*
  * TODO:
  * Figure out how to handle WMI_VDEV_SUBTYPE_P2P_DEVICE,
@@ -5674,15 +5716,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 
 	arvif->def_wep_key_idx = -1;
 
-	vdev_param = ar->wmi.vdev_param->tx_encap_type;
-	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
-					ATH10K_HW_TXRX_NATIVE_WIFI);
-	/* 10.X firmware does not support this VDEV parameter. Do not warn */
-	if (ret && ret != -EOPNOTSUPP) {
-		ath10k_warn(ar, "failed to set vdev %i TX encapsulation: %d\n",
-			    arvif->vdev_id, ret);
-		goto err_vdev_delete;
-	}
+	ath10k_update_vif_offload(hw, vif);
 
 	/* Configuring number of spatial stream for monitor interface is causing
 	 * target assert in qca9888 and qca6174.
@@ -9375,6 +9409,7 @@ static const struct ieee80211_ops ath10k_ops = {
 	.stop				= ath10k_stop,
 	.config				= ath10k_config,
 	.add_interface			= ath10k_add_interface,
+	.update_vif_offload		= ath10k_update_vif_offload,
 	.remove_interface		= ath10k_remove_interface,
 	.configure_filter		= ath10k_configure_filter,
 	.bss_info_changed		= ath10k_bss_info_changed,
@@ -10044,6 +10079,12 @@ int ath10k_mac_register(struct ath10k *ar)
 	if (test_bit(WMI_SERVICE_TDLS_UAPSD_BUFFER_STA, ar->wmi.svc_map))
 		ieee80211_hw_set(ar->hw, SUPPORTS_TDLS_BUFFER_STA);
 
+	if (ath10k_frame_mode == ATH10K_HW_TXRX_ETHERNET) {
+		if (ar->wmi.vdev_param->tx_encap_type !=
+		    WMI_VDEV_PARAM_UNSUPPORTED)
+			ieee80211_hw_set(ar->hw, SUPPORTS_TX_ENCAP_OFFLOAD);
+	}
+
 	ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
 	ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH;
 	ar->hw->wiphy->max_remain_on_channel_duration = 5000;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 4/4] ath10k: add encapsulation offloading support
@ 2022-05-16  3:25   ` Sergey Ryazanov
  0 siblings, 0 replies; 22+ messages in thread
From: Sergey Ryazanov @ 2022-05-16  3:25 UTC (permalink / raw)
  To: Kalle Valo
  Cc: ath10k, linux-wireless, Edward Matijevic, John Crispin,
	Oldřich Jedlička, Tom Psyborg,
	Vasanthakumar Thiagarajan, Zhijun You

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
Tested-on: QCA6174 hw 3.2 PCI WLAN.RM.4.4.1-00157-QCARMSWPZ-1
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Tested-by: Oldřich Jedlička <oldium.pro@gmail.com> # TP-Link Archer C7 v4 & v5 (QCA9563 + QCA9880)
Tested-by: Edward Matijevic <motolav@gmail.com> # TP-Link Archer C2600 (IPQ8064 + QCA9980 10.4.1.00030-1)
Tested-by: Edward Matijevic <motolav@gmail.com> # QCA9377 PCI in Sta mode
Tested-by: Zhijun You <hujy652@gmail.com> # NETGEAR R7800 (QCA9984 10.4-3.9.0.2-00159)
---

Changes since RFC:
 * new Tested-on and Tested-by tags
 * changed position in series: #3 -> #4
 * rebased on top of latest ath-next

 drivers/net/wireless/ath/ath10k/core.c |  2 +-
 drivers/net/wireless/ath/ath10k/mac.c  | 67 +++++++++++++++++++++-----
 2 files changed, 55 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 5654387acb4b..276954b70d63 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -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");
 
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 3570a5895ea8..ebd5b9a8943e 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -3713,6 +3713,9 @@ ath10k_mac_tx_h_get_txmode(struct ath10k *ar,
 	const struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb);
 	__le16 fc = hdr->frame_control;
 
+	if (IEEE80211_SKB_CB(skb)->flags & IEEE80211_TX_CTL_HW_80211_ENCAP)
+		return ATH10K_HW_TXRX_ETHERNET;
+
 	if (!vif || vif->type == NL80211_IFTYPE_MONITOR)
 		return ATH10K_HW_TXRX_RAW;
 
@@ -3873,6 +3876,12 @@ static void ath10k_mac_tx_h_fill_cb(struct ath10k *ar,
 	bool noack = false;
 
 	cb->flags = 0;
+
+	if (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) {
+		cb->flags |= ATH10K_SKB_F_QOS;	/* Assume data frames are QoS */
+		goto finish_cb_fill;
+	}
+
 	if (!ath10k_tx_h_use_hwcrypto(vif, skb))
 		cb->flags |= ATH10K_SKB_F_NO_HWCRYPT;
 
@@ -3911,6 +3920,7 @@ static void ath10k_mac_tx_h_fill_cb(struct ath10k *ar,
 		cb->flags |= ATH10K_SKB_F_RAW_TX;
 	}
 
+finish_cb_fill:
 	cb->vif = vif;
 	cb->txq = txq;
 	cb->airtime_est = airtime;
@@ -4034,7 +4044,11 @@ static int ath10k_mac_tx(struct ath10k *ar,
 		ath10k_tx_h_seq_no(vif, skb);
 		break;
 	case ATH10K_HW_TXRX_ETHERNET:
-		ath10k_tx_h_8023(skb);
+		/* Convert 802.11->802.3 header only if the frame was erlier
+		 * encapsulated to 802.11 by mac80211. Otherwise pass it as is.
+		 */
+		if (!(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP))
+			ath10k_tx_h_8023(skb);
 		break;
 	case ATH10K_HW_TXRX_RAW:
 		if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags) &&
@@ -4645,12 +4659,10 @@ static void ath10k_mac_op_tx(struct ieee80211_hw *hw,
 	struct ieee80211_vif *vif = info->control.vif;
 	struct ieee80211_sta *sta = control->sta;
 	struct ieee80211_txq *txq = NULL;
-	struct ieee80211_hdr *hdr = (void *)skb->data;
 	enum ath10k_hw_txrx_mode txmode;
 	enum ath10k_mac_tx_path txpath;
 	bool is_htt;
 	bool is_mgmt;
-	bool is_presp;
 	int ret;
 	u16 airtime;
 
@@ -4664,8 +4676,14 @@ static void ath10k_mac_op_tx(struct ieee80211_hw *hw,
 	is_mgmt = (txpath == ATH10K_MAC_TX_HTT_MGMT);
 
 	if (is_htt) {
+		bool is_presp = false;
+
 		spin_lock_bh(&ar->htt.tx_lock);
-		is_presp = ieee80211_is_probe_resp(hdr->frame_control);
+		if (!(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP)) {
+			struct ieee80211_hdr *hdr = (void *)skb->data;
+
+			is_presp = ieee80211_is_probe_resp(hdr->frame_control);
+		}
 
 		ret = ath10k_htt_tx_inc_pending(htt);
 		if (ret) {
@@ -5465,6 +5483,30 @@ static int ath10k_mac_set_txbf_conf(struct ath10k_vif *arvif)
 					 ar->wmi.vdev_param->txbf, value);
 }
 
+static void ath10k_update_vif_offload(struct ieee80211_hw *hw,
+				      struct ieee80211_vif *vif)
+{
+	struct ath10k_vif *arvif = (void *)vif->drv_priv;
+	struct ath10k *ar = hw->priv;
+	u32 vdev_param;
+	int ret;
+
+	if (ath10k_frame_mode != ATH10K_HW_TXRX_ETHERNET ||
+	    ar->wmi.vdev_param->tx_encap_type == WMI_VDEV_PARAM_UNSUPPORTED ||
+	     (vif->type != NL80211_IFTYPE_STATION &&
+	      vif->type != NL80211_IFTYPE_AP))
+		vif->offload_flags &= ~IEEE80211_OFFLOAD_ENCAP_ENABLED;
+
+	vdev_param = ar->wmi.vdev_param->tx_encap_type;
+	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
+					ATH10K_HW_TXRX_NATIVE_WIFI);
+	/* 10.X firmware does not support this VDEV parameter. Do not warn */
+	if (ret && ret != -EOPNOTSUPP) {
+		ath10k_warn(ar, "failed to set vdev %i TX encapsulation: %d\n",
+			    arvif->vdev_id, ret);
+	}
+}
+
 /*
  * TODO:
  * Figure out how to handle WMI_VDEV_SUBTYPE_P2P_DEVICE,
@@ -5674,15 +5716,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 
 	arvif->def_wep_key_idx = -1;
 
-	vdev_param = ar->wmi.vdev_param->tx_encap_type;
-	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
-					ATH10K_HW_TXRX_NATIVE_WIFI);
-	/* 10.X firmware does not support this VDEV parameter. Do not warn */
-	if (ret && ret != -EOPNOTSUPP) {
-		ath10k_warn(ar, "failed to set vdev %i TX encapsulation: %d\n",
-			    arvif->vdev_id, ret);
-		goto err_vdev_delete;
-	}
+	ath10k_update_vif_offload(hw, vif);
 
 	/* Configuring number of spatial stream for monitor interface is causing
 	 * target assert in qca9888 and qca6174.
@@ -9375,6 +9409,7 @@ static const struct ieee80211_ops ath10k_ops = {
 	.stop				= ath10k_stop,
 	.config				= ath10k_config,
 	.add_interface			= ath10k_add_interface,
+	.update_vif_offload		= ath10k_update_vif_offload,
 	.remove_interface		= ath10k_remove_interface,
 	.configure_filter		= ath10k_configure_filter,
 	.bss_info_changed		= ath10k_bss_info_changed,
@@ -10044,6 +10079,12 @@ int ath10k_mac_register(struct ath10k *ar)
 	if (test_bit(WMI_SERVICE_TDLS_UAPSD_BUFFER_STA, ar->wmi.svc_map))
 		ieee80211_hw_set(ar->hw, SUPPORTS_TDLS_BUFFER_STA);
 
+	if (ath10k_frame_mode == ATH10K_HW_TXRX_ETHERNET) {
+		if (ar->wmi.vdev_param->tx_encap_type !=
+		    WMI_VDEV_PARAM_UNSUPPORTED)
+			ieee80211_hw_set(ar->hw, SUPPORTS_TX_ENCAP_OFFLOAD);
+	}
+
 	ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
 	ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH;
 	ar->hw->wiphy->max_remain_on_channel_duration = 5000;
-- 
2.35.1


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH 1/4] ath10k: improve tx status reporting
  2022-05-16  3:25   ` Sergey Ryazanov
@ 2022-05-16 20:57     ` Sergey Ryazanov
  -1 siblings, 0 replies; 22+ messages in thread
From: Sergey Ryazanov @ 2022-05-16 20:57 UTC (permalink / raw)
  To: Kalle Valo
  Cc: ath10k, linux-wireless, Edward Matijevic, John Crispin,
	Oldřich Jedlička, Tom Psyborg,
	Vasanthakumar Thiagarajan, Zhijun You

On Mon, May 16, 2022 at 6:25 AM Sergey Ryazanov <ryazanov.s.a@gmail.com> wrote:
> 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
> Tested-on: QCA6174 hw 3.2 PCI WLAN.RM.4.4.1-00157-QCARMSWPZ-1
> Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
> Tested-by: Oldřich Jedlička <oldium.pro@gmail.com> # TP-Link Archer C7 v4 & v5 (QCA9563 + QCA9880)
> Tested-by: Edward Matijevic <motolav@gmail.com> # TP-Link Archer C2600 (IPQ8064 + QCA9980 10.4.1.00030-1)
> Tested-by: Edward Matijevic <motolav@gmail.com> # QCA9377 PCI in Sta mode
> Tested-by: Zhijun You <hujy652@gmail.com> # NETGEAR R7800 (QCA9984 10.4-3.9.0.2-00159)
> ---
>
> Changes since RFC:
>  * new Tested-on and Tested-by tags
>
>  drivers/net/wireless/ath/ath10k/txrx.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c
> index 10123974c3da..72540434c75b 100644
> --- a/drivers/net/wireless/ath/ath10k/txrx.c
> +++ b/drivers/net/wireless/ath/ath10k/txrx.c
> @@ -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;

Just noticed that since we do not dereference the txq->sta pointer
here, the above code can be simplified to:

if (txq)
        status.sta = txq->sta;

Kalle, should I send V2 or can you change this in your tree?

> +       ieee80211_tx_status_ext(htt->ar->hw, &status);
> +       rcu_read_unlock();
> +
>         /* we do not own the msdu anymore */
>
>         return 0;

-- 
Sergey

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 1/4] ath10k: improve tx status reporting
@ 2022-05-16 20:57     ` Sergey Ryazanov
  0 siblings, 0 replies; 22+ messages in thread
From: Sergey Ryazanov @ 2022-05-16 20:57 UTC (permalink / raw)
  To: Kalle Valo
  Cc: ath10k, linux-wireless, Edward Matijevic, John Crispin,
	Oldřich Jedlička, Tom Psyborg,
	Vasanthakumar Thiagarajan, Zhijun You

On Mon, May 16, 2022 at 6:25 AM Sergey Ryazanov <ryazanov.s.a@gmail.com> wrote:
> 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
> Tested-on: QCA6174 hw 3.2 PCI WLAN.RM.4.4.1-00157-QCARMSWPZ-1
> Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
> Tested-by: Oldřich Jedlička <oldium.pro@gmail.com> # TP-Link Archer C7 v4 & v5 (QCA9563 + QCA9880)
> Tested-by: Edward Matijevic <motolav@gmail.com> # TP-Link Archer C2600 (IPQ8064 + QCA9980 10.4.1.00030-1)
> Tested-by: Edward Matijevic <motolav@gmail.com> # QCA9377 PCI in Sta mode
> Tested-by: Zhijun You <hujy652@gmail.com> # NETGEAR R7800 (QCA9984 10.4-3.9.0.2-00159)
> ---
>
> Changes since RFC:
>  * new Tested-on and Tested-by tags
>
>  drivers/net/wireless/ath/ath10k/txrx.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c
> index 10123974c3da..72540434c75b 100644
> --- a/drivers/net/wireless/ath/ath10k/txrx.c
> +++ b/drivers/net/wireless/ath/ath10k/txrx.c
> @@ -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;

Just noticed that since we do not dereference the txq->sta pointer
here, the above code can be simplified to:

if (txq)
        status.sta = txq->sta;

Kalle, should I send V2 or can you change this in your tree?

> +       ieee80211_tx_status_ext(htt->ar->hw, &status);
> +       rcu_read_unlock();
> +
>         /* we do not own the msdu anymore */
>
>         return 0;

-- 
Sergey

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 0/4] ath10k: add encapsulation offloading support
  2022-05-16  3:25 ` Sergey Ryazanov
@ 2022-05-17  2:37   ` Edward Matijevic
  -1 siblings, 0 replies; 22+ messages in thread
From: Edward Matijevic @ 2022-05-17  2:37 UTC (permalink / raw)
  To: Sergey Ryazanov; +Cc: Kalle Valo, ath10k, linux-wireless

Hello,
I confirm now my QCA9377 pci module has no regressions in either modes
with these patches
I was able to test it as an AP and it worked under ETHERNET mode
without any obvious regressions but I'm unable to check maximum
throughput

My hardware info from dmesg and tested on kernel 5.17.7
qca9377 hw1.0 target 0x05020000 chip_id 0x003820ff sub 11ad:0806
firmware ver WLAN.TF.2.1-00021-QCARMSWP-1 api 6 features
wowlan,ignore-otp crc32 42e41877

My quoted statement of a possible regression seems to have been my old
CPU acting up and is ok to remove



On Sun, May 15, 2022 at 10:25 PM Sergey Ryazanov <ryazanov.s.a@gmail.com> wrote:
>
> 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 four patches, the first three 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 improves Ethernet encapsulated frames handling in the HTT
> Tx layer. The third 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 fourth
> 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. It works well
> and introduces a measurable performance increase on platforms with not
> so fast CPU (e.g. QCA9563). Tests with MT7621+QCA6174 show no
> regression. I was unable to observe any measurable throughput increase
> in tests with QCA6174 due to the poor perfomance the SISO client and OTA
> testing. Only slight downlink rate stability increase with slight
> reducing of the SIRQ load on the AP side.
>
> Tests with QCA9880, QCA9980, QCA9984, QCA9377 revealed no regression
> [1]. No specific throughput tests have been performed. In OTA tests with
> a regular load, there is a slight increase in througput stability.
>
> In tests of the QCA9377 in Sta mode, Edward Matijevic noticed a possible
> regression in the Ethernet tx mode compared to the Native WiFi tx
> mode:
> > There might be a regression in download bandwidth under ETHERNET mode
> > but I didn't do enough tests to see if was my PC or the adapter as the
> > upload bandwidth was similar to other tests.
> > NATIVE_WIFI performs the same as without the patch.
>
> Credits: thanks to OpenWrt folks Oldřich Jedlička
> <oldium.pro@gmail.com> and Edward Matijevic <motolav@gmail.com> who
> helped me a lot to perform extensive testing with various chips after a
> RFC/RFT post in the OpenWrt development mailing list [1]. Thanks to
> Zhijun You <hujy652@gmail.com> who helped with the testing, pointed me
> to the previous work (see below) and the missed parts in the HTT Tx
> layer [1].
>
> Prior work: similar patches were independently developed by QCA and then
> submitted for inclusion by John Crispin <john@phrozen.org> [2] and
> latter by Zhijun You <hujy652@gmail.com> [3]. The work was not merged
> due to the lack of a part for 64-bits descriptors [4]. The idea of HTT
> Tx layer change from this work was adopted for the series in patch #2.
>
> 1. https://www.mail-archive.com/openwrt-devel@lists.openwrt.org/msg62013.html
> 2. https://lore.kernel.org/all/20191216092207.31032-1-john@phrozen.org/
> 3. https://lore.kernel.org/all/20210524103130.66693-1-hujy652@gmail.com/
> 4. https://patchwork.kernel.org/project/linux-wireless/patch/20191216092207.31032-1-john@phrozen.org/
>
> CC: Edward Matijevic <motolav@gmail.com>
> CC: John Crispin <john@phrozen.org>
> CC: Oldřich Jedlička <oldium.pro@gmail.com>
> CC: Tom Psyborg <pozega.tomislav@gmail.com>
> CC: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
> CC: Zhijun You <hujy652@gmail.com>
>
> Changes since RFC:
>  * new Tested-on and Tested-by tags
>  * new patch #2 for better Ethernet encapsulation support in the HTT Tx
>    layer
>  * rebased on top of latest ath-next
>
> Sergey Ryazanov (3):
>   ath10k: improve tx status reporting
>   ath10k: htt_tx: do not interpret Eth frames as WiFi
>   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/htt_tx.c | 61 ++++++++++++---------
>  drivers/net/wireless/ath/ath10k/mac.c    | 67 +++++++++++++++++++-----
>  drivers/net/wireless/ath/ath10k/txrx.c   | 12 ++++-
>  5 files changed, 108 insertions(+), 44 deletions(-)
>
> --
> 2.35.1
>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 0/4] ath10k: add encapsulation offloading support
@ 2022-05-17  2:37   ` Edward Matijevic
  0 siblings, 0 replies; 22+ messages in thread
From: Edward Matijevic @ 2022-05-17  2:37 UTC (permalink / raw)
  To: Sergey Ryazanov; +Cc: Kalle Valo, ath10k, linux-wireless

Hello,
I confirm now my QCA9377 pci module has no regressions in either modes
with these patches
I was able to test it as an AP and it worked under ETHERNET mode
without any obvious regressions but I'm unable to check maximum
throughput

My hardware info from dmesg and tested on kernel 5.17.7
qca9377 hw1.0 target 0x05020000 chip_id 0x003820ff sub 11ad:0806
firmware ver WLAN.TF.2.1-00021-QCARMSWP-1 api 6 features
wowlan,ignore-otp crc32 42e41877

My quoted statement of a possible regression seems to have been my old
CPU acting up and is ok to remove



On Sun, May 15, 2022 at 10:25 PM Sergey Ryazanov <ryazanov.s.a@gmail.com> wrote:
>
> 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 four patches, the first three 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 improves Ethernet encapsulated frames handling in the HTT
> Tx layer. The third 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 fourth
> 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. It works well
> and introduces a measurable performance increase on platforms with not
> so fast CPU (e.g. QCA9563). Tests with MT7621+QCA6174 show no
> regression. I was unable to observe any measurable throughput increase
> in tests with QCA6174 due to the poor perfomance the SISO client and OTA
> testing. Only slight downlink rate stability increase with slight
> reducing of the SIRQ load on the AP side.
>
> Tests with QCA9880, QCA9980, QCA9984, QCA9377 revealed no regression
> [1]. No specific throughput tests have been performed. In OTA tests with
> a regular load, there is a slight increase in througput stability.
>
> In tests of the QCA9377 in Sta mode, Edward Matijevic noticed a possible
> regression in the Ethernet tx mode compared to the Native WiFi tx
> mode:
> > There might be a regression in download bandwidth under ETHERNET mode
> > but I didn't do enough tests to see if was my PC or the adapter as the
> > upload bandwidth was similar to other tests.
> > NATIVE_WIFI performs the same as without the patch.
>
> Credits: thanks to OpenWrt folks Oldřich Jedlička
> <oldium.pro@gmail.com> and Edward Matijevic <motolav@gmail.com> who
> helped me a lot to perform extensive testing with various chips after a
> RFC/RFT post in the OpenWrt development mailing list [1]. Thanks to
> Zhijun You <hujy652@gmail.com> who helped with the testing, pointed me
> to the previous work (see below) and the missed parts in the HTT Tx
> layer [1].
>
> Prior work: similar patches were independently developed by QCA and then
> submitted for inclusion by John Crispin <john@phrozen.org> [2] and
> latter by Zhijun You <hujy652@gmail.com> [3]. The work was not merged
> due to the lack of a part for 64-bits descriptors [4]. The idea of HTT
> Tx layer change from this work was adopted for the series in patch #2.
>
> 1. https://www.mail-archive.com/openwrt-devel@lists.openwrt.org/msg62013.html
> 2. https://lore.kernel.org/all/20191216092207.31032-1-john@phrozen.org/
> 3. https://lore.kernel.org/all/20210524103130.66693-1-hujy652@gmail.com/
> 4. https://patchwork.kernel.org/project/linux-wireless/patch/20191216092207.31032-1-john@phrozen.org/
>
> CC: Edward Matijevic <motolav@gmail.com>
> CC: John Crispin <john@phrozen.org>
> CC: Oldřich Jedlička <oldium.pro@gmail.com>
> CC: Tom Psyborg <pozega.tomislav@gmail.com>
> CC: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
> CC: Zhijun You <hujy652@gmail.com>
>
> Changes since RFC:
>  * new Tested-on and Tested-by tags
>  * new patch #2 for better Ethernet encapsulation support in the HTT Tx
>    layer
>  * rebased on top of latest ath-next
>
> Sergey Ryazanov (3):
>   ath10k: improve tx status reporting
>   ath10k: htt_tx: do not interpret Eth frames as WiFi
>   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/htt_tx.c | 61 ++++++++++++---------
>  drivers/net/wireless/ath/ath10k/mac.c    | 67 +++++++++++++++++++-----
>  drivers/net/wireless/ath/ath10k/txrx.c   | 12 ++++-
>  5 files changed, 108 insertions(+), 44 deletions(-)
>
> --
> 2.35.1
>

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 0/4] ath10k: add encapsulation offloading support
  2022-05-17  2:37   ` Edward Matijevic
@ 2022-05-17  8:37     ` Sergey Ryazanov
  -1 siblings, 0 replies; 22+ messages in thread
From: Sergey Ryazanov @ 2022-05-17  8:37 UTC (permalink / raw)
  To: Edward Matijevic; +Cc: Kalle Valo, ath10k, linux-wireless

Hello Edward,

On Tue, May 17, 2022 at 5:37 AM Edward Matijevic <motolav@gmail.com> wrote:
> Hello,
> I confirm now my QCA9377 pci module has no regressions in either modes
> with these patches
> I was able to test it as an AP and it worked under ETHERNET mode
> without any obvious regressions but I'm unable to check maximum
> throughput
>
> My hardware info from dmesg and tested on kernel 5.17.7
> qca9377 hw1.0 target 0x05020000 chip_id 0x003820ff sub 11ad:0806
> firmware ver WLAN.TF.2.1-00021-QCARMSWP-1 api 6 features
> wowlan,ignore-otp crc32 42e41877
>
> My quoted statement of a possible regression seems to have been my old
> CPU acting up and is ok to remove

Thank you for the update.

-- 
Sergey

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 0/4] ath10k: add encapsulation offloading support
@ 2022-05-17  8:37     ` Sergey Ryazanov
  0 siblings, 0 replies; 22+ messages in thread
From: Sergey Ryazanov @ 2022-05-17  8:37 UTC (permalink / raw)
  To: Edward Matijevic; +Cc: Kalle Valo, ath10k, linux-wireless

Hello Edward,

On Tue, May 17, 2022 at 5:37 AM Edward Matijevic <motolav@gmail.com> wrote:
> Hello,
> I confirm now my QCA9377 pci module has no regressions in either modes
> with these patches
> I was able to test it as an AP and it worked under ETHERNET mode
> without any obvious regressions but I'm unable to check maximum
> throughput
>
> My hardware info from dmesg and tested on kernel 5.17.7
> qca9377 hw1.0 target 0x05020000 chip_id 0x003820ff sub 11ad:0806
> firmware ver WLAN.TF.2.1-00021-QCARMSWP-1 api 6 features
> wowlan,ignore-otp crc32 42e41877
>
> My quoted statement of a possible regression seems to have been my old
> CPU acting up and is ok to remove

Thank you for the update.

-- 
Sergey

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 1/4] ath10k: improve tx status reporting
  2022-05-16 20:57     ` Sergey Ryazanov
@ 2022-05-18  7:30       ` Kalle Valo
  -1 siblings, 0 replies; 22+ messages in thread
From: Kalle Valo @ 2022-05-18  7:30 UTC (permalink / raw)
  To: Sergey Ryazanov
  Cc: ath10k, linux-wireless, Edward Matijevic, John Crispin,
	Oldřich Jedlička, Tom Psyborg,
	Vasanthakumar Thiagarajan, Zhijun You

Sergey Ryazanov <ryazanov.s.a@gmail.com> writes:
> On Mon, May 16, 2022 at 6:25 AM Sergey Ryazanov <ryazanov.s.a@gmail.com> wrote:
>
>> --- a/drivers/net/wireless/ath/ath10k/txrx.c
>> +++ b/drivers/net/wireless/ath/ath10k/txrx.c
>> @@ -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;
>
> Just noticed that since we do not dereference the txq->sta pointer
> here, the above code can be simplified to:
>
> if (txq)
>         status.sta = txq->sta;
>
> Kalle, should I send V2 or can you change this in your tree?

I changed this in the pending branch, please check my changes:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=1bd0c16e10229683fab1dd8adf8c4339992688b7

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 1/4] ath10k: improve tx status reporting
@ 2022-05-18  7:30       ` Kalle Valo
  0 siblings, 0 replies; 22+ messages in thread
From: Kalle Valo @ 2022-05-18  7:30 UTC (permalink / raw)
  To: Sergey Ryazanov
  Cc: ath10k, linux-wireless, Edward Matijevic, John Crispin,
	Oldřich Jedlička, Tom Psyborg,
	Vasanthakumar Thiagarajan, Zhijun You

Sergey Ryazanov <ryazanov.s.a@gmail.com> writes:
> On Mon, May 16, 2022 at 6:25 AM Sergey Ryazanov <ryazanov.s.a@gmail.com> wrote:
>
>> --- a/drivers/net/wireless/ath/ath10k/txrx.c
>> +++ b/drivers/net/wireless/ath/ath10k/txrx.c
>> @@ -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;
>
> Just noticed that since we do not dereference the txq->sta pointer
> here, the above code can be simplified to:
>
> if (txq)
>         status.sta = txq->sta;
>
> Kalle, should I send V2 or can you change this in your tree?

I changed this in the pending branch, please check my changes:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=1bd0c16e10229683fab1dd8adf8c4339992688b7

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 1/4] ath10k: improve tx status reporting
  2022-05-18  7:30       ` Kalle Valo
@ 2022-05-18 10:57         ` Sergey Ryazanov
  -1 siblings, 0 replies; 22+ messages in thread
From: Sergey Ryazanov @ 2022-05-18 10:57 UTC (permalink / raw)
  To: Kalle Valo
  Cc: ath10k, linux-wireless, Edward Matijevic, John Crispin,
	Oldřich Jedlička, Tom Psyborg,
	Vasanthakumar Thiagarajan, Zhijun You

On Wed, May 18, 2022 at 10:30 AM Kalle Valo <kvalo@kernel.org> wrote:
> Sergey Ryazanov <ryazanov.s.a@gmail.com> writes:
>> On Mon, May 16, 2022 at 6:25 AM Sergey Ryazanov <ryazanov.s.a@gmail.com> wrote:
>>> --- a/drivers/net/wireless/ath/ath10k/txrx.c
>>> +++ b/drivers/net/wireless/ath/ath10k/txrx.c
>>> @@ -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;
>>
>> Just noticed that since we do not dereference the txq->sta pointer
>> here, the above code can be simplified to:
>>
>> if (txq)
>>         status.sta = txq->sta;
>>
>> Kalle, should I send V2 or can you change this in your tree?
>
> I changed this in the pending branch, please check my changes:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=1bd0c16e10229683fab1dd8adf8c4339992688b7

Exactly what I meant. Thank you!

--
Sergey

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 1/4] ath10k: improve tx status reporting
@ 2022-05-18 10:57         ` Sergey Ryazanov
  0 siblings, 0 replies; 22+ messages in thread
From: Sergey Ryazanov @ 2022-05-18 10:57 UTC (permalink / raw)
  To: Kalle Valo
  Cc: ath10k, linux-wireless, Edward Matijevic, John Crispin,
	Oldřich Jedlička, Tom Psyborg,
	Vasanthakumar Thiagarajan, Zhijun You

On Wed, May 18, 2022 at 10:30 AM Kalle Valo <kvalo@kernel.org> wrote:
> Sergey Ryazanov <ryazanov.s.a@gmail.com> writes:
>> On Mon, May 16, 2022 at 6:25 AM Sergey Ryazanov <ryazanov.s.a@gmail.com> wrote:
>>> --- a/drivers/net/wireless/ath/ath10k/txrx.c
>>> +++ b/drivers/net/wireless/ath/ath10k/txrx.c
>>> @@ -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;
>>
>> Just noticed that since we do not dereference the txq->sta pointer
>> here, the above code can be simplified to:
>>
>> if (txq)
>>         status.sta = txq->sta;
>>
>> Kalle, should I send V2 or can you change this in your tree?
>
> I changed this in the pending branch, please check my changes:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=1bd0c16e10229683fab1dd8adf8c4339992688b7

Exactly what I meant. Thank you!

--
Sergey

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 1/4] ath10k: improve tx status reporting
  2022-05-16  3:25   ` Sergey Ryazanov
@ 2022-05-22 12:28     ` Kalle Valo
  -1 siblings, 0 replies; 22+ messages in thread
From: Kalle Valo @ 2022-05-22 12:28 UTC (permalink / raw)
  To: Sergey Ryazanov
  Cc: ath10k, linux-wireless, Edward Matijevic, John Crispin,
	Oldřich Jedlička, Tom Psyborg,
	Vasanthakumar Thiagarajan, Zhijun You

Sergey Ryazanov <ryazanov.s.a@gmail.com> wrote:

> 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 hw2.0 PCI 10.4-3.9.0.2-00131
> Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00157-QCARMSWPZ-1
> 
> Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
> Tested-by: Oldřich Jedlička <oldium.pro@gmail.com> # TP-Link Archer C7 v4 & v5 (QCA9563 + QCA9880)
> Tested-by: Edward Matijevic <motolav@gmail.com> # TP-Link Archer C2600 (IPQ8064 + QCA9980 10.4.1.00030-1)
> Tested-by: Edward Matijevic <motolav@gmail.com> # QCA9377 PCI in Sta mode
> Tested-by: Zhijun You <hujy652@gmail.com> # NETGEAR R7800 (QCA9984 10.4-3.9.0.2-00159)
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>

4 patches applied to ath-next branch of ath.git, thanks.

2587d5198aa5 ath10k: improve tx status reporting
70f119fb82af ath10k: htt_tx: do not interpret Eth frames as WiFi
a09740548275 ath10k: turn rawmode into frame_mode
af6d8265c47e ath10k: add encapsulation offloading support

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20220516032519.29831-2-ryazanov.s.a@gmail.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 1/4] ath10k: improve tx status reporting
@ 2022-05-22 12:28     ` Kalle Valo
  0 siblings, 0 replies; 22+ messages in thread
From: Kalle Valo @ 2022-05-22 12:28 UTC (permalink / raw)
  To: Sergey Ryazanov
  Cc: ath10k, linux-wireless, Edward Matijevic, John Crispin,
	Oldřich Jedlička, Tom Psyborg,
	Vasanthakumar Thiagarajan, Zhijun You

Sergey Ryazanov <ryazanov.s.a@gmail.com> wrote:

> 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 hw2.0 PCI 10.4-3.9.0.2-00131
> Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00157-QCARMSWPZ-1
> 
> Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
> Tested-by: Oldřich Jedlička <oldium.pro@gmail.com> # TP-Link Archer C7 v4 & v5 (QCA9563 + QCA9880)
> Tested-by: Edward Matijevic <motolav@gmail.com> # TP-Link Archer C2600 (IPQ8064 + QCA9980 10.4.1.00030-1)
> Tested-by: Edward Matijevic <motolav@gmail.com> # QCA9377 PCI in Sta mode
> Tested-by: Zhijun You <hujy652@gmail.com> # NETGEAR R7800 (QCA9984 10.4-3.9.0.2-00159)
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>

4 patches applied to ath-next branch of ath.git, thanks.

2587d5198aa5 ath10k: improve tx status reporting
70f119fb82af ath10k: htt_tx: do not interpret Eth frames as WiFi
a09740548275 ath10k: turn rawmode into frame_mode
af6d8265c47e ath10k: add encapsulation offloading support

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20220516032519.29831-2-ryazanov.s.a@gmail.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2022-05-22 12:28 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-16  3:25 [PATCH 0/4] ath10k: add encapsulation offloading support Sergey Ryazanov
2022-05-16  3:25 ` Sergey Ryazanov
2022-05-16  3:25 ` [PATCH 1/4] ath10k: improve tx status reporting Sergey Ryazanov
2022-05-16  3:25   ` Sergey Ryazanov
2022-05-16 20:57   ` Sergey Ryazanov
2022-05-16 20:57     ` Sergey Ryazanov
2022-05-18  7:30     ` Kalle Valo
2022-05-18  7:30       ` Kalle Valo
2022-05-18 10:57       ` Sergey Ryazanov
2022-05-18 10:57         ` Sergey Ryazanov
2022-05-22 12:28   ` Kalle Valo
2022-05-22 12:28     ` Kalle Valo
2022-05-16  3:25 ` [PATCH 2/4] ath10k: htt_tx: do not interpret Eth frames as WiFi Sergey Ryazanov
2022-05-16  3:25   ` Sergey Ryazanov
2022-05-16  3:25 ` [PATCH 3/4] ath10k: turn rawmode into frame_mode Sergey Ryazanov
2022-05-16  3:25   ` Sergey Ryazanov
2022-05-16  3:25 ` [PATCH 4/4] ath10k: add encapsulation offloading support Sergey Ryazanov
2022-05-16  3:25   ` Sergey Ryazanov
2022-05-17  2:37 ` [PATCH 0/4] " Edward Matijevic
2022-05-17  2:37   ` Edward Matijevic
2022-05-17  8:37   ` Sergey Ryazanov
2022-05-17  8:37     ` Sergey Ryazanov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.