mac80211: add 802.11 encapsulation offloading
Subsystems (2)
v4 cover mac80211: add 802.11 encapsulation offloading
This series picks up prior work from QCA. The patch is currently shipped inside QSDK as part of the wlan-open package.
The series tries to address all feedback from the V2 -> https://patchwork.kernel.org/patch/9602585/
Changes in V3
* rebase on latest kernel
* various code style clean ups
* give so eof the variables and functions more obvious names
* move the code that disables support for non linear frames to the core
* disable monitor and tkip support
Changes in V4
* disable encap when TKIP is used instead of refusing TKIP
* use a flag inside fx_info instead of an extra element
* move 4addr detection into ieee80211_set_hw_80211_encap()
* ieee80211_tx_dequeue() was dropping out to early
Vasanthakumar Thiagarajan (2):
mac80211: add hw 80211 encapsulation offloading support
ath10k: add tx hw 802.11 encapusaltion offloading support
drivers/net/wireless/ath/ath10k/core.c | 11 ++ drivers/net/wireless/ath/ath10k/core.h | 3 + drivers/net/wireless/ath/ath10k/htt_tx.c | 24 ++-- drivers/net/wireless/ath/ath10k/mac.c | 70 +++++++++--- drivers/net/wireless/ath/ath10k/txrx.c | 11 +- include/net/mac80211.h | 25 ++++ net/mac80211/cfg.c | 3 + net/mac80211/debugfs.c | 1 + net/mac80211/ieee80211_i.h | 10 ++ net/mac80211/iface.c | 72 ++++++++++++ net/mac80211/key.c | 7 ++ net/mac80211/main.c | 10 +- net/mac80211/status.c | 79 +++++++++++++ net/mac80211/tx.c | 189 ++++++++++++++++++++++++++++++- 14 files changed, 481 insertions(+), 34 deletions(-)
Signature · 1 line
2.11.0
RFC v4 1/2 mac80211: add hw 80211 encapsulation offloading support
From: Vasanthakumar Thiagarajan <[email protected]>
This patch adds a new transmit path for hardware that supports 802.11 encapsulation offloading. In those cases 802.3a frames get passed directly to the driver allowing to hardware to handle the encapsulation.
Certain features wont work and the patch masks these out.
* monitor interfaces are not supported if any of the vif is in encap mode.
* amsdu/non-linear frames wont work in encap offloading mode.
* TKIP countermeasures cannot be triggered and hence those keys are not accepted.
The patch defines a secondary netdev_ops struct that the device is assigned to the device if 802.11 encap support is available and enabled. The driver needs to enable the support on a per vif basis if it finds that all pre-reqs are meet.
--- include/net/mac80211.h | 25 ++++++ net/mac80211/cfg.c | 3 + net/mac80211/debugfs.c | 1 + net/mac80211/ieee80211_i.h | 10 +++ net/mac80211/iface.c | 72 +++++++++++++++++ net/mac80211/key.c | 7 ++ net/mac80211/main.c | 10 ++- net/mac80211/status.c | 79 +++++++++++++++++++ net/mac80211/tx.c | 189 +++++++++++++++++++++++++++++++++++++++++++-- 9 files changed, 387 insertions(+), 9 deletions(-)
include/net/mac80211.h +25 -0
@@ -816,6 +816,7 @@ enum mac80211_tx_control_flags {IEEE80211_TX_CTRL_RATE_INJECT =BIT (2 ),IEEE80211_TX_CTRL_AMSDU =BIT (3 ),IEEE80211_TX_CTRL_FAST_XMIT =BIT (4 ), + IEEE80211_TX_CTRL_HW_80211_ENCAP = BIT(5), };/*
@@ -2243,6 +2244,9 @@ struct ieee80211_txq {* @IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID: Hardware supports multi BSSID * only for HE APs. Applies if @IEEE80211_HW_SUPPORTS_MULTI_BSSID is set. * +* @IEEE80211_HW_SUPPORTS_80211_ENCAP: Hardware/driver supports 802.11 +* encap for data frames. +* * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays */ enum ieee80211_hw_flags {
@@ -2294,6 +2298,7 @@ enum ieee80211_hw_flags {IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN ,IEEE80211_HW_SUPPORTS_MULTI_BSSID ,IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID , +IEEE80211_HW_SUPPORTS_80211_ENCAP ,/* keep last, obviously */ NUM_IEEE80211_HW_FLAGS
@@ -4587,6 +4592,25 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb);/** +* ieee80211_tx_status_8023 - transmit status callback for 802.3 frame format +* +* Call this function for all transmitted data frames after their transmit +* completion. This callback should only be called for data frames which +* are are using driver's (or hardware's) offload capability of encap/decap +* 802.11 frames. +* +* 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 the frame was transmitted by +* @vif: the interface for which the frame was transmitted +* @skb: the frame that was transmitted, owned by mac80211 after this call +*/ +void ieee80211_tx_status_8023 (struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +struct sk_buff *skb); + +/** * ieee80211_report_low_ack - report non-responding station * * When operating in AP-mode, call this function to report a non-responding
@@ -6359,4 +6383,5 @@ void ieee80211_nan_func_match(struct ieee80211_vif *vif,struct cfg80211_nan_match_params *match, gfp_t gfp); +int ieee80211_set_hw_80211_encap (struct ieee80211_vif *vif,bool enable);#endif /* MAC80211_H */
net/mac80211/cfg.c +3 -0
@@ -2379,6 +2379,9 @@ static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)if (changed &WIPHY_PARAM_FRAG_THRESHOLD ) {ieee80211_check_fast_xmit_all (local); +if (ieee80211_is_hw_80211_encap (local)) +return -EINVAL ; + err =drv_set_frag_threshold (local, wiphy->frag_threshold);if (err) {
net/mac80211/debugfs.c +1 -0
@@ -221,6 +221,7 @@ static const char *hw_flag_names[] = {FLAG (TX_STATUS_NO_AMPDU_LEN ),FLAG (SUPPORTS_MULTI_BSSID ),FLAG (SUPPORTS_ONLY_HE_MULTI_BSSID ), +FLAG (SUPPORTS_80211_ENCAP ), #undef FLAG };
net/mac80211/ieee80211_i.h +10 -0
@@ -987,6 +987,8 @@ struct ieee80211_sub_if_data { } debugfs;#endif +bool hw_80211_encap; +/* must be last, dynamically sized area in this! */ struct ieee80211_vif vif; };
@@ -1733,6 +1735,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, struct vif_params *params);int ieee80211_if_change_type (struct ieee80211_sub_if_data *sdata,enum nl80211_iftype type); +bool ieee80211_is_hw_80211_encap (struct ieee80211_local *local);void ieee80211_if_remove (struct ieee80211_sub_if_data *sdata);void ieee80211_remove_interfaces (struct ieee80211_local *local);u32 ieee80211_idle_off (struct ieee80211_local *local);
@@ -1760,6 +1763,8 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb, struct net_device *dev);netdev_tx_t ieee80211_subif_start_xmit (struct sk_buff *skb,struct net_device *dev); +netdev_tx_t ieee80211_subif_start_xmit_8023 (struct sk_buff *skb, +struct net_device *dev);void __ieee80211_subif_start_xmit (struct sk_buff *skb,struct net_device *dev,u32 info_flags);
@@ -1935,6 +1940,11 @@ void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, int tid, enum nl80211_band band, u32 txdata_flags); +/* sta_out needs to be checked for ERR_PTR() before using */ +int ieee80211_lookup_ra_sta (struct ieee80211_sub_if_data *sdata, +struct sk_buff *skb, +struct sta_info **sta_out); + static inline void ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, int tid,
net/mac80211/iface.c +72 -0
84 lines not on this page · raw message
net/mac80211/key.c +7 -0
@@ -171,6 +171,10 @@ static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key) goto out_unsupported; } +/* TKIP countermeasures wont work on encap offload mode */ +if (key->conf.cipher ==WLAN_CIPHER_SUITE_TKIP ) +ieee80211_set_hw_80211_encap (&sdata->vif,0 ); + ret =drv_set_key (key->local,SET_KEY , sdata, sta ? &sta->sta :NULL , &key->conf);
@@ -197,6 +201,9 @@ static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key) key->conf.keyidx, sta ? sta->sta.addr : bcast_addr, ret); +if (sdata->hw_80211_encap) +return -EINVAL ; + out_unsupported:switch (key->conf.cipher) {case WLAN_CIPHER_SUITE_WEP40 :
net/mac80211/main.c +7 -3
@@ -1000,9 +1000,13 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) hw->wiphy->software_iftypes |=BIT (NL80211_IFTYPE_AP_VLAN ); } -/* mac80211 always supports monitor */ - hw->wiphy->interface_modes |=BIT (NL80211_IFTYPE_MONITOR ); - hw->wiphy->software_iftypes |=BIT (NL80211_IFTYPE_MONITOR ); +if (ieee80211_hw_check (hw,SUPPORTS_80211_ENCAP )) { +/* mac80211 always supports monitor unless we do 802.11 +* encapsulation offloading. +*/ + hw->wiphy->interface_modes |=BIT (NL80211_IFTYPE_MONITOR ); + hw->wiphy->software_iftypes |=BIT (NL80211_IFTYPE_MONITOR ); + }/* mac80211 doesn't support more than one IBSS interface right now */ for (i =0 ; i < hw->wiphy->n_iface_combinations; i++) {
net/mac80211/status.c +79 -0
85 lines not on this page · raw message
net/mac80211/tx.c +183 -6
232 lines not on this page · raw message
Signature · 1 line
2.11.0
RFC v4 2/2 ath10k: add tx hw 802.11 encapusaltion offloading support
In reply to John CrispinFrom: Vasanthakumar Thiagarajan <[email protected]>
This patch adds support for ethernet rxtx mode to the driver. The feature is enabled via a new module parameter. If enabled to driver will enable the feature on a per vif basis if all other requirements were met.
Testing on a IPQ4019 based hardware shows a increase in TCP throughput of ~20% when the feature is enabled.
--- drivers/net/wireless/ath/ath10k/core.c | 11 +++++ drivers/net/wireless/ath/ath10k/core.h | 3 ++ drivers/net/wireless/ath/ath10k/htt_tx.c | 24 +++++++---- drivers/net/wireless/ath/ath10k/mac.c | 70 +++++++++++++++++++++++++------- drivers/net/wireless/ath/ath10k/txrx.c | 11 ++++- 5 files changed, 94 insertions(+), 25 deletions(-)
drivers/net/wireless/ath/ath10k/core.c +11 -0
@@ -30,6 +30,7 @@ static unsigned int ath10k_cryptmode_param;static bool uart_print;static bool skip_otp;static bool rawmode; +static bool ethernetmode;unsigned long ath10k_coredump_mask =BIT (ATH10K_FW_CRASH_DUMP_REGISTERS ) |BIT (ATH10K_FW_CRASH_DUMP_CE_DATA );
@@ -41,6 +42,7 @@ module_param(uart_print, bool, 0644);module_param (skip_otp, bool,0644 );module_param (rawmode, bool,0644 );module_param_named (coredump_mask, ath10k_coredump_mask, ulong,0444 ); +module_param (ethernetmode, bool,0644 );MODULE_PARM_DESC (debug_mask,"Debugging mask" );MODULE_PARM_DESC (uart_print,"Uart target debugging" );
@@ -48,6 +50,7 @@ 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 (coredump_mask,"Bitfield of what to include in firmware crash file" ); +MODULE_PARM_DESC (ethernetmode,"Use ethernet frame datapath" );static const struct ath10k_hw_params ath10k_hw_params_list[] = { {
@@ -2926,6 +2929,14 @@ static void ath10k_core_register_work(struct work_struct *work)/* peer stats are enabled by default */ set_bit (ATH10K_FLAG_PEER_STATS , &ar->dev_flags); +if (ethernetmode && rawmode) { +ath10k_err (ar,"ethernet and raw mode cannot co-exist\n" ); + status = -EINVAL ; + goto err; + } + + ar->ethernetmode = ethernetmode; + status =ath10k_core_probe_fw (ar);if (status) {ath10k_err (ar,"could not probe fw (%d)\n" , status);
drivers/net/wireless/ath/ath10k/core.h +3 -0
@@ -109,6 +109,7 @@ enum ath10k_skb_flags {ATH10K_SKB_F_MGMT =BIT (3 ),ATH10K_SKB_F_QOS =BIT (4 ),ATH10K_SKB_F_RAW_TX =BIT (5 ), + ATH10K_SKB_F_HW_80211_ENCAP = BIT(6), }; struct ath10k_skb_cb {
@@ -1187,6 +1188,8 @@ struct ath10k {struct work_struct radar_confirmation_work;struct ath10k_bus_params bus_param; +bool ethernetmode; +/* must be last */ u8 drv_priv[0 ]__aligned(sizeof(void *)) ; };
drivers/net/wireless/ath/ath10k/htt_tx.c +15 -9
@@ -1143,6 +1143,10 @@ static u8 ath10k_htt_tx_get_tid(struct sk_buff *skb, bool is_eth)struct ieee80211_hdr *hdr = (void *)skb->data;struct ath10k_skb_cb *cb =ATH10K_SKB_CB (skb); +/* Firmware takes care of tid classification for ethernet format */ +if (cb->flags &ATH10K_SKB_F_HW_80211_ENCAP ) +return skb->priority %IEEE80211_QOS_CTL_TID_MASK ; +if (!is_eth &&ieee80211_is_mgmt (hdr->frame_control))return HTT_DATA_TX_EXT_TID_MGMT ;else if (cb->flags &ATH10K_SKB_F_QOS )
@@ -1351,15 +1355,17 @@ 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 (!(info->control.flags &IEEE80211_TX_CTRL_HW_80211_ENCAP )) { +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,
drivers/net/wireless/ath/ath10k/mac.c +55 -15
148 lines not on this page · raw message
drivers/net/wireless/ath/ath10k/txrx.c +10 -1
@@ -50,6 +50,8 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt,struct ath10k_skb_cb *skb_cb;struct ath10k_txq *artxq;struct sk_buff *msdu; +struct ieee80211_vif *vif; +u8 flags; ath10k_dbg(ar, ATH10K_DBG_HTT, "htt tx completion msdu_id %u status %d\n",
@@ -78,6 +80,9 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt, artxq->num_fw_queued--; } + flags = skb_cb->flags; + vif = skb_cb->vif; +ath10k_htt_tx_free_msdu_id (htt, tx_done->msdu_id);ath10k_htt_tx_dec_pending (htt);if (htt->num_pending_tx ==0 )
@@ -121,7 +126,11 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt, info->status.is_valid_ack_signal = true; } -ieee80211_tx_status (htt->ar->hw, msdu); +if (flags &ATH10K_SKB_F_HW_80211_ENCAP ) +ieee80211_tx_status_8023 (htt->ar->hw, vif, msdu); +else +ieee80211_tx_status (htt->ar->hw, msdu); +/* we do not own the msdu anymore */ return 0 ;
Signature · 1 line
2.11.0
Re: [RFC V4 2/2] ath10k: add tx hw 802.11 encapusaltion offloading support
Quoted 11 lines · John Crispin
From: Vasanthakumar Thiagarajan <[email protected]>
This patch adds support for ethernet rxtx mode to the driver. The feature is enabled via a new module parameter. If enabled to driver will enable the feature on a per vif basis if all other requirements were met.
Testing on a IPQ4019 based hardware shows a increase in TCP throughput of ~20% when the feature is enabled.
Signed-off-by Vasanthakumar Thiagarajan <[email protected]>Signed-off-by John Crispin <[email protected]>
Looks good to me.
BTW, for ath10k patches (patchsets including ath10k patches) please try to CC also the ath10k list. Easier to find ath10k patches that way.
Signature · 1 line
Kalle Valo
Re: [RFC V4 2/2] ath10k: add tx hw 802.11 encapusaltion offloading support
Quoted 11 lines · Kalle Valo
Quoted 9 lines · John Crispin
From: Vasanthakumar Thiagarajan <[email protected]>
This patch adds support for ethernet rxtx mode to the driver. The feature is enabled via a new module parameter. If enabled to driver will enable the feature on a per vif basis if all other requirements were met.
Testing on a IPQ4019 based hardware shows a increase in TCP throughput of ~20% when the feature is enabled.
Quoted 7 lines
Quoted 2 lines
Signed-off-by Vasanthakumar Thiagarajan <[email protected]>Signed-off-by John Crispin <[email protected]>Looks good to me.
BTW, for ath10k patches (patchsets including ath10k patches) please try to CC also the ath10k list. Easier to find ath10k patches that way.
Hi,
Thanks Kalle, I'll be sending a V5 tomorrow with a small improvement on the hw crypto part, that unbreaks wpa3. can I add your Acked-by on the ath10k part ?
John
Re: [RFC V4 2/2] ath10k: add tx hw 802.11 encapusaltion offloading support
Quoted 16 lines · John Crispin
Quoted 15 lines · Kalle Valo
Quoted 11 lines · John Crispin
From: Vasanthakumar Thiagarajan <[email protected]>
This patch adds support for ethernet rxtx mode to the driver. The feature is enabled via a new module parameter. If enabled to driver will enable the feature on a per vif basis if all other requirements were met.
Testing on a IPQ4019 based hardware shows a increase in TCP throughput of ~20% when the feature is enabled.
Signed-off-by Vasanthakumar Thiagarajan <[email protected]>Signed-off-by John Crispin <[email protected]>Looks good to me.
Quoted 8 lines
Quoted 3 lines
BTW, for ath10k patches (patchsets including ath10k patches) please try to CC also the ath10k list. Easier to find ath10k patches that way.
Hi,
Thanks Kalle, I'll be sending a V5 tomorrow with a small improvement on the hw crypto part, that unbreaks wpa3. can I add your Acked-by on the ath10k part ?
Adding my Acked-by is not necessary as I will be applying the ath10k patch anyway. In these cases we usually do so that Johannes applies the mac80211 part, he then assigns the driver patches to me in patchwork, and once mac80211 commits are in my tree, I'll apply the driver part.
Signature · 1 line
Kalle Valo
Johannes Berg
maintainerRe: [RFC V4 1/2] mac80211: add hw 80211 encapsulation offloading support
In reply to John CrispinQuoted 6 lines · John Crispin
The driver
needs to enable the support on a per vif basis if it finds that all pre-reqs are meet.+ * @IEEE80211_HW_SUPPORTS_80211_ENCAP: Hardware/driver supports 802.11
+ * encap for data frames.
I'm still not sure I can reconcile these ... why do you need the latter if the driver has to enable per vif anyway?
Quoted 1 line
+int
ieee80211_set_hw_80211_encap(struct ieee80211_vif *vif, bool enable);
Add documentation please. Would be better to return bool too, to be symmetric.
net/mac80211/cfg.c static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) · line 2383
Quoted 7 lines
+++
b/net/mac80211/cfg.cnet/mac80211/cfg.c +2
-0@@ -2379,6 +2379,9 @@ static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)if (changed &WIPHY_PARAM_FRAG_THRESHOLD ) {ieee80211_check_fast_xmit_all (local); +if (ieee80211_is_hw_80211_encap (local)) +return -EINVAL ;
Why not do this like TKIP and disable encap?
net/mac80211/iface.c static const struct net_device_ops ieee80211_dataif_ops = { · line 1197
Quoted 7 lines
net/mac80211/iface.c +7
-0+int ieee80211_set_hw_80211_encap (struct ieee80211_vif *vif,bool enable) +{ +struct ieee80211_sub_if_data *sdata =vif_to_sdata (vif); +struct ieee80211_local *local = sdata->local; + +if (enable == sdata->hw_80211_encap) +return enable;
It feels like this is missing some locking? Or at least a lock assertion, if it's always called with a certain lock held already.
Quoted 12 lines
net/mac80211/iface.c +12
-0+if (!sdata->dev) +return 0 ; + +if (!ieee80211_hw_check (&local->hw,SUPPORTS_80211_ENCAP )) + enable =0 ; + +switch (vif->type) { +case NL80211_IFTYPE_STATION : +if (sdata->u.mgd.use_4addr) + enable =0 ; +break ; +case NL80211_IFTYPE_AP_VLAN :
net/mac80211/iface.c static const struct net_device_ops ieee80211_dataif_ops = { · line 1220
Quoted 10 lines
net/mac80211/iface.c +10
-0+if (sdata->wdev.use_4addr) + enable =0 ; +break ; +default : +break ; + } + +if (!ieee80211_hw_check (&local->hw,SUPPORTS_TX_FRAG ) && + (local->hw.wiphy->frag_threshold != (u32)-1 )) + enable =0 ;
Shouldn't there be some kind of TKIP check here?
net/mac80211/iface.c static const struct net_device_ops ieee80211_dataif_ops = { · line 1246
Quoted 13 lines
net/mac80211/iface.c +13
-0+bool ieee80211_is_hw_80211_encap (struct ieee80211_local *local) +{ +struct ieee80211_sub_if_data *sdata; +bool offloaded = false; + +mutex_lock (&local->iflist_mtx); +list_for_each_entry (sdata, &local->interfaces, list) { +if (sdata->hw_80211_encap) { + offloaded = true; +break ; + } + } +mutex_unlock (&local->iflist_mtx);
This might be better with RCU, though for proper usage you'd actually have to call it with the mutex held, otherwise it can change while you're iterating ...
net/mac80211/key.c static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key) · line 176
Quoted 3 lines
net/mac80211/key.c +3
-0+/* TKIP countermeasures wont work on encap offload mode */ +if (key->conf.cipher ==WLAN_CIPHER_SUITE_TKIP ) +ieee80211_set_hw_80211_encap (&sdata->vif,0 );
false.
net/mac80211/key.c static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key) · line 205
Quoted 6 lines
net/mac80211/key.c +2
-0@@ -197,6 +201,9 @@ static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key) key->conf.keyidx, sta ? sta->sta.addr : bcast_addr, ret); +if (sdata->hw_80211_encap) +return -EINVAL ;
Yeah, and this means you're also missing a "do we have a SW crypto key right now" check above in ieee80211_set_hw_80211_encap().
net/mac80211/main.c int ieee80211_register_hw(struct ieee80211_hw *hw) · line 1009
Quoted 7 lines
net/mac80211/main.c +7
-0+if (ieee80211_hw_check (hw,SUPPORTS_80211_ENCAP )) { +/* mac80211 always supports monitor unless we do 802.11 +* encapsulation offloading. +*/ + hw->wiphy->interface_modes |=BIT (NL80211_IFTYPE_MONITOR ); + hw->wiphy->software_iftypes |=BIT (NL80211_IFTYPE_MONITOR ); + }
Ok, maybe this addresses my question above about why we need both - though it's not really clear what happens if the driver actually does want to still enable monitor mode - which certainly we (iwlwifi) would.
Quoted 8 lines
net/mac80211/status.c +8
-0+void ieee80211_tx_status_8023 (struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +struct sk_buff *skb) +{ +struct ieee80211_local *local =hw_to_local (hw); +struct ieee80211_sub_if_data *sdata; +struct ieee80211_tx_info *info =IEEE80211_SKB_CB (skb); +struct sta_info *sta;
net/mac80211/status.c void ieee80211_tx_rate_update(struct ieee80211_hw *hw, · line 1039
Quoted 10 lines
net/mac80211/status.c +10
-0+int retry_count; +int rates_idx; +bool acked; + +if (WARN_ON (!ieee80211_hw_check (hw,SUPPORTS_80211_ENCAP ))) + goto skip_stats_update; + + sdata =vif_to_sdata (vif); + + acked = !!(info->flags &IEEE80211_TX_STAT_ACK );
no need for !! with bool :-)
net/mac80211/tx.c void ieee80211_check_fast_xmit(struct sta_info *sta) · line 2862
Quoted 4 lines
net/mac80211/tx.c +3
-0+/* check for driver support and ieee80211 encap offload */ +if (!ieee80211_hw_check (&local->hw,SUPPORT_FAST_XMIT ) || + sdata->hw_80211_encap)return ;
That comment isn't very useful? :-)
net/mac80211/tx.c struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw, · line 3583
Quoted 9 lines
net/mac80211/tx.c +3
-0@@ -3573,6 +3576,9 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw, goto begin; } +if (info->control.flags &IEEE80211_TX_CTRL_HW_80211_ENCAP ) + goto encap_out; +if (test_bit (IEEE80211_TXQ_AMPDU , &txqi->flags)) info->flags |=IEEE80211_TX_CTL_AMPDU ;
Wouldn't you still want this flag, perhaps?
Not with ath10k I guess, which offloads aggregation sessions, but still? That's not necessarily a requirement for encap offload, is it?
net/mac80211/tx.c netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, · line 4118
Quoted 6 lines
net/mac80211/tx.c +6
-0+ieee80211_tx_stats (dev, skb->len); + +if (sta) { + sta->tx_stats.bytes[skb_get_queue_mapping (skb)] += skb->len; + sta->tx_stats.packets[skb_get_queue_mapping (skb)]++; + }
This is something to think about, aren't we usually doing that after encapsulation? So the counters will be off a bit now?
net/mac80211/tx.c netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, · line 4141
Quoted 1 line
net/mac80211/tx.c +1
-0+if (WARN_ON (unlikely (!sdata->hw_80211_encap))) {
I feel I'm repeating myself - WARN_ON() includes unlikely().
johannes