add 802.11 decapsulation offload support
Subsystems (2)
v2 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.
This change was tested on IPQ8074 platform (ath11k driver). In tests where CPUs are fully loaded, this change has improved average CPU usage by nearly 8-10%.
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"
v2:
- Cover letter is updated with performance improvement numbers
- Disabled tid stats update for decap offload case
Manikanta Pubbisetty (1):
ath11k: add 802.11 decapsulation offloading support
Vasanthakumar Thiagarajan (1):
mac80211: add receive path for ethernet frame format
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 | 217 ++++++++++++++++++++++++++++- 7 files changed, 371 insertions(+), 80 deletions(-)
Signature · 6 lines
2.7.4 _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
RFC v2 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 | 217 +++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 231 insertions(+), 6 deletions(-)
include/net/mac80211.h +20 -0
@@ -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 +211 -6
248 lines not on this page · raw message
Signature · 1 line
2.7.4
Johannes Berg
maintainerRe: [RFCv2 1/2] mac80211: add receive path for ethernet frame format
Hi,
Quoted 11 lines · Manikanta Pubbisetty
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.
I guess generally this seems fine...
net/mac80211/rx.c __ieee80211_data_to_8023(struct ieee80211_rx_data *rx, bool *port_control) · line 2414
Quoted 2 lines
net/mac80211/rx.c +2
-0+static const u8 pae_group_addr[ETH_ALEN ]__aligned(2) = {0x01 ,0x80 ,0xC2 ,0x00 , +0x00 ,0x03 };
The coding style here is a bit weird ...
Quoted 6 lines
net/mac80211/rx.c +6
-0+static void +ieee80211_rx_handle_decap_offl (struct ieee80211_sub_if_data *sdata, +struct sta_info *sta,struct sk_buff *skb, +struct napi_struct *napi) +{ +struct ieee80211_local *local = sdata->local;
net/mac80211/rx.c void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) · line 4684
Quoted 10 lines
net/mac80211/rx.c +10
-0+struct ieee80211_vif *vif = &sdata->vif; +struct net_device *dev = sdata->dev; +struct ieee80211_rx_status *status; +struct ieee80211_key *key =NULL ; +struct ieee80211_rx_data rx; +int i; +struct ethhdr *ehdr; +struct ieee80211_sta_rx_stats *stats = &sta->rx_stats; + + ehdr = (struct ethhdr *)skb->data;
You need to ensure that this is actually accessible in the skb head.
net/mac80211/rx.c void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) · line 4697
Quoted 13 lines
net/mac80211/rx.c +13
-0+ status =IEEE80211_SKB_RXCB (skb); + +if (ieee80211_hw_check (&local->hw,USES_RSS )) + stats =this_cpu_ptr (sta->pcpu_rx_stats); + +/* TODO: Extend ieee80211_rx_decap_offl() with bssid so that Ethernet +* encap/decap can be supported in Adhoc interface type as well. +* Adhoc interface depends on bssid to update last_rx. +*/ +if (vif->type !=NL80211_IFTYPE_STATION && + vif->type !=NL80211_IFTYPE_AP_VLAN && + vif->type !=NL80211_IFTYPE_AP ) + goto drop;
Is there any value in this TODO? Probably should even WARN_ON() here.
net/mac80211/rx.c void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) · line 4748
Quoted 1 line
net/mac80211/rx.c +1
-0+ stats->bytes += skb->len;
There's a bit of a mismatch here now between frames with 802.11 header and frames with just ethernet - I don't know if we really need to consider that, but it's there still?
net/mac80211/rx.c void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) · line 4798
Quoted 4 lines
net/mac80211/rx.c +4
-0+/* Forcing seqno index to -1 so that tid specific stats are +* not updated in ieee80211_deliver_skb(). +*/ + rx.seqno_idx =-1 ;
I guess that means you should also not advertise them to userspace ... unless you're assuming that the driver would? But that seems far from certain, so I guess if the driver intends to use ethernet RX then we should remove a bunch of things in sta_set_tidstats()?
So I guess my biggest concern is about statistics - not that they need to be there, but that we shouldn't show missing ones as (close to) zero, but rather just not have them at all in this case.
johannes
RFC v2 2/2 ath11k: add 802.11 decapsulation offloading support
In reply to Manikanta PubbisettyAdding 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
@@ -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
@@ -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
@@ -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
@@ -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 · 1 line
2.7.4