Skip to contentSkip to conversation

add 802.11 decapsulation offload support

RFC Superseded Manikanta Pubbisetty 3 participants 6 messages Feb 17, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover add 802.11 decapsulation offload support

Adding support for offloading 802.11 decapsulation to the HW. This reduces the CPU cycles spent on host CPU for doing the conversion from 802.11 format to ethernet format and thereby improving the performance of the device.

Note:
Ath11k patch in this patchset depends on PN offload series and the multi reo patchset with the following name. "Support hash based reo destination ring selection"

Manikanta Pubbisetty (2):
mac80211: add receive path for ethernet frame format
ath11k: add rx hw 802.11 decapsulation offloading support

 drivers/net/wireless/ath/ath11k/core.c     |   4 +
 drivers/net/wireless/ath/ath11k/core.h     |   3 +
 drivers/net/wireless/ath/ath11k/dp_rx.c    | 184 ++++++++++++++----------
 drivers/net/wireless/ath/ath11k/hal_desc.h |   2 +
 drivers/net/wireless/ath/ath11k/mac.c      |  21 +++
 include/net/mac80211.h                     |  20 +++
 net/mac80211/rx.c                          | 215 ++++++++++++++++++++++++++++-
 7 files changed, 370 insertions(+), 79 deletions(-)
Signature · 6 lines
2.7.4

_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#1 lore raw

RFC 1/2 mac80211: add receive path for ethernet frame format

From: Vasanthakumar Thiagarajan <[email protected]>

Implement rx path which does fewer processing on the received data frame which has already gone through 802.11 header decapsulation and other functionalities which require 802.11 header in the low level driver or hardware. Currently this rx path is restricted to AP and STA mode, but can be extended for Adhoc mode as well.

It is upto to the low level driver to invoke the correct API and make sure if the frame that it passes is in ethernet format and the sta pointer is valid.

---
 include/net/mac80211.h |  20 +++++
 net/mac80211/rx.c      | 215 +++++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 230 insertions(+), 5 deletions(-)
include/net/mac80211.h +20 -0
index ce80773..5959058 100644
@@ -1251,6 +1251,9 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
  *	the "0-length PSDU" field included there.  The value for it is
  *	in &struct ieee80211_rx_status.  Note that if this value isn't
  *	known the frame shouldn't be reported.
+ * @RX_FLAG_80211_MCAST: If the receiver address (addr1) in the frame is
+ *	multicast. This is used with the data frames by the drivers
+ *	supporting 802.11 hdr decap offload.
  */
 enum mac80211_rx_flags {
 	RX_FLAG_MMIC_ERROR		= BIT(0),
@@ -1283,6 +1286,7 @@ enum mac80211_rx_flags {
 	RX_FLAG_RADIOTAP_HE_MU		= BIT(27),
 	RX_FLAG_RADIOTAP_LSIG		= BIT(28),
 	RX_FLAG_NO_PSDU			= BIT(29),
+	RX_FLAG_80211_MCAST		= BIT(30),
 };
 
 /**
@@ -4402,6 +4406,22 @@ static inline void ieee80211_rx_ni(struct ieee80211_hw *hw,
 }
 
 /**
+ * ieee80211_rx_decap_offl - Receive frames in 802.11 decapsulated format
+ *
+ * Low level driver capable of 802.11 header decap uses this function. The frame
+ * will be in ethernet format.
+ * This function may not be called in IRQ context. Calls to this function
+ * for a single hardware must be synchronized against each other.
+ *
+ * @hw: the hardware this frame came in on
+ * @sta : the station the frame was received from, must not be %NULL
+ * @skb: the buffer to receive, owned by mac80211 after this call
+ * @napi: the NAPI context
+ */
+void ieee80211_rx_decap_offl(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
+			     struct sk_buff *skb, struct napi_struct *napi);
+
+/**
  * ieee80211_sta_ps_transition - PS transition for connected sta
  *
  * When operating in AP mode with the %IEEE80211_HW_AP_LINK_PS
net/mac80211/rx.c +210 -5

241 lines not on this page · raw message

Signature · 1 line
2.7.4
maintainer
#2 lore raw

Re: [RFC 1/2] mac80211: add receive path for ethernet frame format

net/mac80211/rx.c void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) · line 4809

Quoted 7 lines · Manikanta Pubbisetty
net/mac80211/rx.c +5 -0
+	/* FIXME: Since rx.seqno_idx is not available for decap offloaded frames
+	 * rx msdu stats update at the seqno_idx in ieee80211_deliver_skb()
+	 * will always be updated at index 0 and will not be very useful.
+	 * Should we disable these statistics in the case of decap offload?
+	 */

I think the answer is yes.

johannes

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

#3 lore raw

RFC 2/2 ath11k: add 802.11 decapsulation offloading support

In reply to Manikanta Pubbisetty

Adding 802.11 decapsulation offloading support to the driver. Since the packets delivered to the driver are in 802.3 format, these can be sent to the network core with minimal processing in mac80211. This helps in releasing some CPU cycles in the host processor and thereby improving the performance.

Ethernet decap can be enabled by using a modparam as shown below:
insmod ath11k ethernet_mode=1

---
 drivers/net/wireless/ath/ath11k/core.c     |   4 +
 drivers/net/wireless/ath/ath11k/core.h     |   3 +
 drivers/net/wireless/ath/ath11k/dp_rx.c    | 184 +++++++++++++++++------------
 drivers/net/wireless/ath/ath11k/hal_desc.h |   2 +
 drivers/net/wireless/ath/ath11k/mac.c      |  21 ++++
 5 files changed, 140 insertions(+), 74 deletions(-)
drivers/net/wireless/ath/ath11k/core.c +4 -0
index 6a30601..c9f784a 100644
@@ -17,6 +17,10 @@ unsigned int ath11k_debug_mask;
 module_param_named(debug_mask, ath11k_debug_mask, uint, 0644);
 MODULE_PARM_DESC(debug_mask, "Debugging mask");
 
+unsigned int ath11k_ethernet_mode;
+module_param_named(ethernet_mode, ath11k_ethernet_mode, uint, 0644);
+MODULE_PARM_DESC(ethernet_mode, "Use ethernet frame datapath 0: disable, 1: enable");
+
 static const struct ath11k_hw_params ath11k_hw_params = {
 	.name = "ipq8074",
 	.fw = {
drivers/net/wireless/ath/ath11k/core.h +3 -0
index ce8f7fe..d3d9590 100644
@@ -71,6 +71,7 @@ struct ath11k_skb_rxcb {
 	bool is_first_msdu;
 	bool is_last_msdu;
 	bool is_continuation;
+	bool is_mcbc;
 	struct hal_rx_desc *rx_desc;
 	u8 err_rel_src;
 	u8 err_code;
@@ -78,6 +79,8 @@ struct ath11k_skb_rxcb {
 	u8 unmapped;
 	u8 is_frag;
 	u8 tid;
+	u16 peer_id;
+	u16 seq_no;
 };
 
 enum ath11k_hw_rev {
drivers/net/wireless/ath/ath11k/dp_rx.c +110 -74

325 lines not on this page · raw message

drivers/net/wireless/ath/ath11k/hal_desc.h +2 -0
index 5e20038..99ca4a3 100644
@@ -494,6 +494,8 @@ struct hal_tlv_hdr {
 #define RX_MPDU_DESC_INFO0_DA_IDX_TIMEOUT	BIT(29)
 #define RX_MPDU_DESC_INFO0_RAW_MPDU		BIT(30)
 
+#define RX_MPDU_DESC_META_DATA_PEER_ID		GENMASK(15, 0)
+
 struct rx_mpdu_desc {
 	u32 info0; /* %RX_MPDU_DESC_INFO */
 	u32 meta_data;
drivers/net/wireless/ath/ath11k/mac.c +21 -0
index 7f29b4d..3c7e4a9 100644
@@ -15,6 +15,8 @@
 #include "testmode.h"
 #include "peer.h"
 
+extern unsigned int ath11k_ethernet_mode;
+
 #define CHAN2G(_channel, _freq, _flags) { \
 	.band                   = NL80211_BAND_2GHZ, \
 	.hw_value               = (_channel), \
@@ -4202,6 +4204,25 @@ static int ath11k_mac_op_add_interface(struct ieee80211_hw *hw,
 		goto err_vdev_del;
 	}
 
+	/* Do not enable ethernet mode for mesh vifs, packets in mesh network
+	 * can be forwarded to other mesh nodes and mac80211 expects the packet
+	 * in 802.11 format. Also, please note that ethernet mode shall not be
+	 * used on interface where 4addr mode is enabled as we might not have
+	 * 4addr related config during add_interface().
+	 */
+	if (ath11k_ethernet_mode && vif->type != NL80211_IFTYPE_MESH_POINT) {
+		param_id = WMI_VDEV_PARAM_RX_DECAP_TYPE;
+		param_value = ATH11K_HW_TXRX_ETHERNET;
+
+		ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
+						    param_id, param_value);
+		if (ret) {
+			ath11k_warn(ab, "failed to set vdev %d tx encap mode: %d\n",
+				    arvif->vdev_id, ret);
+			goto err_vdev_del;
+		}
+	}
+
 	nss = get_num_chains(ar->cfg_tx_chainmask) ? : 1;
 	ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
 					    WMI_VDEV_PARAM_NSS, nss);
Signature · 6 lines
2.7.4

_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#4 lore raw
In reply to Manikanta Pubbisetty
Quoted 10 lines · Manikanta Pubbisetty

Adding support for offloading 802.11 decapsulation to the HW. This reduces the CPU cycles spent on host CPU for doing the conversion from 802.11 format to ethernet format and thereby improving the performance of the device.

Note:
Ath11k patch in this patchset depends on PN offload series and the multi reo patchset with the following name. "Support hash based reo destination ring selection"

Hi,
you need to also Cc: this to linux-wireless
John

Quoted 13 lines

Manikanta Pubbisetty (2):
mac80211: add receive path for ethernet frame format
ath11k: add rx hw 802.11 decapsulation offloading support

  drivers/net/wireless/ath/ath11k/core.c     |   4 +
  drivers/net/wireless/ath/ath11k/core.h     |   3 +
  drivers/net/wireless/ath/ath11k/dp_rx.c    | 184 ++++++++++++++----------
  drivers/net/wireless/ath/ath11k/hal_desc.h |   2 +
  drivers/net/wireless/ath/ath11k/mac.c      |  21 +++
  include/net/mac80211.h                     |  20 +++
  net/mac80211/rx.c                          | 215 ++++++++++++++++++++++++++++-
  7 files changed, 370 insertions(+), 79 deletions(-)
maintainer
#5 lore raw
In reply to Manikanta Pubbisetty
Quoted 4 lines · Manikanta Pubbisetty

Adding support for offloading 802.11 decapsulation to the HW. This reduces the CPU cycles spent on host CPU for doing the conversion from 802.11 format to ethernet format and thereby improving the performance of the device.

Would be nice to quantify that :)

johannes

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