ath11k: add tx hw 802.11 encapusaltion offloading support
PATCH v2 1/1 ath11k: add tx hw 802.11 encapusaltion offloading support
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.
---
Changes in V2
* use an enum for datapath mode
* minor fixes as suggested by Julian
drivers/net/wireless/ath/ath11k/core.h | 5 +++ drivers/net/wireless/ath/ath11k/dp_tx.c | 17 +++++++-- drivers/net/wireless/ath/ath11k/mac.c | 46 ++++++++++++++++++++----- 3 files changed, 56 insertions(+), 12 deletions(-)
drivers/net/wireless/ath/ath11k/core.h +5 -0
@@ -60,9 +60,14 @@ static inline enum wme_ac ath11k_tid_to_ac(u32 tid) WME_AC_VO); } +enum ath11k_skb_flags { +ATH11K_SKB_HW_80211_ENCAP =BIT (0 ), +}; +struct ath11k_skb_cb {dma_addr_t paddr;u8 eid; +u8 flags;struct ath11k *ar;struct ieee80211_vif *vif; } __packed;
drivers/net/wireless/ath/ath11k/dp_tx.c +14 -3
@@ -16,7 +16,11 @@ ath11k_txq_tcl_ring_map[ATH11K_HW_MAX_QUEUES] = { 0x0, 0x1, 0x2, 0x2 };static enum hal_tcl_encap_type ath11k_dp_tx_get_encap_type (struct ath11k_vif *arvif,struct sk_buff *skb) { -/* TODO: Determine encap type based on vif_type and configuration */ +struct ieee80211_tx_info *tx_info =IEEE80211_SKB_CB (skb); + +if (tx_info->control.flags &IEEE80211_TX_CTRL_HW_80211_ENCAP ) +return HAL_TCL_ENCAP_TYPE_ETHERNET ; +return HAL_TCL_ENCAP_TYPE_NATIVE_WIFI ; }
@@ -40,8 +44,11 @@ static void ath11k_dp_tx_encap_nwifi(struct sk_buff *skb)static u8 ath11k_dp_tx_get_tid (struct sk_buff *skb) {struct ieee80211_hdr *hdr = (void *)skb->data; +struct ath11k_skb_cb *cb =ATH11K_SKB_CB (skb); -if (!ieee80211_is_data_qos (hdr->frame_control)) +if (cb->flags &ATH11K_SKB_HW_80211_ENCAP ) +return skb->priority &IEEE80211_QOS_CTL_TID_MASK ; +else if (!ieee80211_is_data_qos (hdr->frame_control))return HAL_DESC_REO_NON_QOS_TID ;else return skb->priority &IEEE80211_QOS_CTL_TID_MASK ;
@@ -88,7 +95,8 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif,if (test_bit (ATH11K_FLAG_CRASH_FLUSH , &ar->ab->dev_flags))return -ESHUTDOWN ; -if (!ieee80211_is_data (hdr->frame_control)) +if (!(info->control.flags &IEEE80211_TX_CTRL_HW_80211_ENCAP ) && + !ieee80211_is_data (hdr->frame_control))return -ENOTSUPP ; pool_id =skb_get_queue_mapping (skb) & (ATH11K_HW_MAX_QUEUES -1 );
@@ -149,7 +157,10 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif,* skb_checksum_help() is needed */ case HAL_TCL_ENCAP_TYPE_ETHERNET : +/* no need to encap */ +break ;case HAL_TCL_ENCAP_TYPE_802_3 : +default :/* TODO: Take care of other encap modes as well */ ret = -EINVAL ; goto fail_remove_idr;
drivers/net/wireless/ath/ath11k/mac.c +37 -9
96 lines not on this page · raw message
Signature · 1 line
2.20.1
Quoted 6 lines · John Crispin
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.
Signed-off-by Shashidhar Lakkavalli <[email protected]>Signed-off-by John Crispin <[email protected]>
[...]
drivers/net/wireless/ath/ath11k/mac.c line 39
Quoted 10 lines
drivers/net/wireless/ath/ath11k/mac.c +4
-0@@ -33,6 +33,11 @@ .max_power = 30, \ } +/* frame mode values are mapped as per enum ath11k_hw_txrx_mode */ +static unsigned int ath11k_ath11k_frame_mode =ATH11K_HW_TXRX_NATIVE_WIFI ; +module_param_named (ath11k_frame_mode, ath11k_ath11k_frame_mode, uint,0644 ); +MODULE_PARM_DESC (ath11k_frame_mode,"Datapath frame mode" );
I don't think we should add ath11k_ prefix to module names, right? So I changed that and documented the values:
/* frame mode values are mapped as per enum ath11k_hw_txrx_mode */ static unsigned int ath11k_frame_mode = ATH11K_HW_TXRX_NATIVE_WIFI; module_param_named(frame_mode, ath11k_frame_mode, uint, 0644); MODULE_PARM_DESC(frame_mode,
"Datapath frame mode (0: raw, 1: native wifi (default), 2: ethernet)");
Also I added a comment to enum ath11k_hw_txrx_mode so that we don't accidentally change the values. This is now in pending branch:
Please check my changes.
Signature · 6 lines
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
Quoted 29 lines · Kalle Valo
Quoted 6 lines · John Crispin
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.
Signed-off-by Shashidhar Lakkavalli <[email protected]>Signed-off-by John Crispin <[email protected]>[...]
drivers/net/wireless/ath/ath11k/mac.c line 39
Quoted 10 lines
drivers/net/wireless/ath/ath11k/mac.c +4
-0@@ -33,6 +33,11 @@ .max_power = 30, \ } +/* frame mode values are mapped as per enum ath11k_hw_txrx_mode */ +static unsigned int ath11k_ath11k_frame_mode =ATH11K_HW_TXRX_NATIVE_WIFI ; +module_param_named (ath11k_frame_mode, ath11k_ath11k_frame_mode, uint,0644 ); +MODULE_PARM_DESC (ath11k_frame_mode,"Datapath frame mode" );I don't think we should add
ath11k_prefix to module names, right? So I changed that and documented the values:/* frame mode values are mapped as per enum
ath11k_hw_txrx_mode*/ static unsigned intath11k_frame_mode=ATH11K_HW_TXRX_NATIVE_WIFI;module_param_named(frame_mode, ath11k_frame_mode, uint, 0644); MODULE_PARM_DESC(frame_mode,
Quoted 9 lines
"Datapath frame mode (0: raw, 1: native wifi (default), 2: ethernet)");Also I added a comment to enum
ath11k_hw_txrx_modeso that we don't accidentally change the values. This is now in pending branch:Please check my changes.
Thanks, looks good.
John
Quoted 7 lines · John Crispin
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.
Signed-off-by Shashidhar Lakkavalli <[email protected]>Signed-off-by John Crispin <[email protected]>Signed-off-by Kalle Valo <[email protected]>
Patch applied to ath-next branch of ath.git, thanks.
e7f33e0c52c0 ath11k: add tx hw 802.11 encapsulation offloading support
Signature · 3 lines
https://patchwork.kernel.org/patch/11520703/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Quoted 7 lines · John Crispin
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.
Signed-off-by Shashidhar Lakkavalli <[email protected]>Signed-off-by John Crispin <[email protected]>Signed-off-by Kalle Valo <[email protected]>
Patch applied to ath-next branch of ath.git, thanks.
e7f33e0c52c0 ath11k: add tx hw 802.11 encapsulation offloading support
Signature · 8 lines
https://patchwork.kernel.org/patch/11520703/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
Quoted 4 lines · John Crispin
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.
[...]
Quoted 8 lines
drivers/net/wireless/ath/ath11k/mac.c +2
-1@@ -4339,7 +4352,22 @@ static int ath11k_mac_op_add_interface(struct ieee80211_hw *hw,spin_unlock_bh (&ar->data_lock); param_id =WMI_VDEV_PARAM_TX_ENCAP_TYPE ; - param_value =ATH11K_HW_TXRX_NATIVE_WIFI ; +if (ath11k_ath11k_frame_mode ==ATH11K_HW_TXRX_ETHERNET ) +switch (vif->type) {
drivers/net/wireless/ath/ath11k/mac.c static int ath11k_mac_op_add_interface(struct · line 4367
Quoted 10 lines
drivers/net/wireless/ath/ath11k/mac.c +10
-0+case NL80211_IFTYPE_STATION : +case NL80211_IFTYPE_AP_VLAN : +case NL80211_IFTYPE_AP : + hw_encap =1 ; +break ; +default : +break ; + } + +if (ieee80211_set_hw_80211_encap (vif, hw_encap))
I see ieee80211_set_hw_80211_encap have check like this:
if (key->conf.cipher == WLAN_CIPHER_SUITE_TKIP)
enable = false;
so is it beeter to call it after associated/install key?
Quoted 7 lines
drivers/net/wireless/ath/ath11k/mac.c +4
-0+ param_value =ATH11K_HW_TXRX_ETHERNET ; + else + param_value =ATH11K_HW_TXRX_NATIVE_WIFI ; + ret =ath11k_wmi_vdev_set_param_cmd (ar, arvif->vdev_id, param_id, param_value);if (ret) {
Signature · 3 lines
ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k