ATH11K DFS Support
cover ATH11K DFS Support
This patchset enables dfs support in ath11k driver. Firmware provides support for offloading certain modules required for dfs implementation such as radar detection and NOL implementation.
Sriram R (3):
ath11k: Process radar detected event
ath11k: Initialize and enable dfs radar detection
ath11k: Add dfs debug and test interface
drivers/net/wireless/ath/ath11k/core.h | 1 + drivers/net/wireless/ath/ath11k/debug.c | 28 ++++++ drivers/net/wireless/ath/ath11k/dp_rx.c | 20 +++- drivers/net/wireless/ath/ath11k/mac.c | 54 +++++++++-- drivers/net/wireless/ath/ath11k/wmi.c | 164 +++++++++++++++++++++++++++++++- drivers/net/wireless/ath/ath11k/wmi.h | 42 ++++++++ 6 files changed, 295 insertions(+), 14 deletions(-)
Signature · 7 lines
2.7.4 _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
PATCH 1/3 ath11k: Process radar detected event
Add support for processing radar detected event
coming from the firmware. The detected radar
is indicated to mac80211 after checking the
validity of detection.
--- drivers/net/wireless/ath/ath11k/wmi.c | 56 +++++++++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath11k/wmi.h | 13 ++++++++ 2 files changed, 69 insertions(+)
drivers/net/wireless/ath/ath11k/wmi.c +56 -0
@@ -5770,6 +5770,59 @@ ath11k_wmi_pdev_csa_switch_count_status_event(struct ath11k_base *ab,kfree (tb); } +static void +ath11k_wmi_pdev_dfs_radar_detected_event (struct ath11k_base *ab, +u8 *evt_buf, +u32 len) +{ +const void **tb; +const struct wmi_pdev_radar_ev *ev; +struct ath11k *ar; +int ret; + + tb =ath11k_wmi_tlv_parse_alloc (ab, evt_buf, len,GFP_ATOMIC ); +if (IS_ERR (tb)) { + ret =PTR_ERR (tb); +ath11k_warn (ab,"failed to parse tlv: %d\n" , ret); +return ; + } + + ev = tb[WMI_TAG_PDEV_DFS_RADAR_DETECTION_EVENT ]; + +if (!ev) { +ath11k_warn (ab,"failed to fetch pdev dfs radar detected ev" ); +kfree (tb); +return ; + } + +ath11k_dbg (ab,ATH11K_DBG_WMI , +"pdev dfs radar detected on pdev %d, detection mode %d, chan freq %d, chan_width %d, detector id %d, seg id %d, timestamp %d, chirp %d, freq offset %d, sidx %d" , + ev->pdev_id, ev->detection_mode, ev->chan_freq, ev->chan_width, + ev->detector_id, ev->segment_id, ev->timestamp, ev->is_chirp, + ev->freq_offset, ev->sidx); + + ar =ath11k_get_ar_by_pdev_id (ab, ev->pdev_id); + +if (!ar) { +ath11k_warn (ab,"radar detected in invalid pdev %d\n" , + ev->pdev_id); + goto exit; + } + +if (ar->rx_channel && ar->rx_channel->center_freq != (ev->chan_freq + - ev->freq_offset)) { +ath11k_warn (ab,"Radar detected in non-operating channel" ); + goto exit; + } + +ath11k_dbg (ar->ab,ATH11K_DBG_REG ,"Radar Detected in pdev %d\n" , + ev->pdev_id); + +ieee80211_radar_detected (ar->hw); + +exit: +kfree (tb); +}static void ath11k_wmi_tlv_op_rx (struct ath11k_base *ab,struct sk_buff *skb) {struct wmi_cmd_hdr *cmd_hdr;
@@ -5858,6 +5911,9 @@ static void ath11k_wmi_tlv_op_rx(struct ath11k_base *ab, struct sk_buff *skb)ath11k_dbg (ab,ATH11K_DBG_WMI ,"ignoring unsupported event 0x%x\n" , id);break ; +case WMI_PDEV_DFS_RADAR_DETECTION_EVENTID : +ath11k_wmi_pdev_dfs_radar_detected_event (ab, data, len); +break ;/* TODO: Add remaining events */ default :ath11k_warn (ab,"Unknown eventid: 0x%x\n" , id);
drivers/net/wireless/ath/ath11k/wmi.h +13 -0
@@ -4557,6 +4557,19 @@ struct wmi_pdev_csa_switch_ev {u32 num_vdevs; } __packed; +struct wmi_pdev_radar_ev { +u32 pdev_id; +u32 detection_mode; +u32 chan_freq; +u32 chan_width; +u32 detector_id; +u32 segment_id; +u32 timestamp; +u32 is_chirp; +s32 freq_offset; +s32 sidx; +} __packed; +enum wlan_phymode {WLAN_PHYMODE_AUTO =0 ,WLAN_PHYMODE_11A =1 ,
Signature · 7 lines
2.7.4 _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
Re: [PATCH 1/3] ath11k: Process radar detected event
Quoted 6 lines · Sriram R
Add support for processing radar detected event
coming from the firmware. The detected radar
is indicated to mac80211 after checking the
validity of detection.Signed-off-by Sriram R <[email protected]>
3 patches applied to ath.git, thanks.
844193a286b5 ath11k: Process radar detected event 1256bb1040d9 ath11k: Initialize and enable dfs radar detection 83c457124fa5 ath11k: Add dfs debug and test interface
Signature · 9 lines
https://patchwork.kernel.org/patch/10942009/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
PATCH 2/3 ath11k: Initialize and enable dfs radar detection
In reply to Sriram RIPQ8074 firmware supports radar detection offload, which enables complete radar detection algorithm to be offloaded to firmware. Initialize dfs support by adding supported radar detect widths and introduce the CAC_RUNNING flag to be used
when mac80211 triggers cac for the dfs channel.
This flag is used to check and drop any
rx packets if received during the CAC period.
--- drivers/net/wireless/ath/ath11k/core.h | 1 + drivers/net/wireless/ath/ath11k/dp_rx.c | 20 +++++++++--- drivers/net/wireless/ath/ath11k/mac.c | 54 +++++++++++++++++++++++++++++---- drivers/net/wireless/ath/ath11k/wmi.c | 8 ++--- drivers/net/wireless/ath/ath11k/wmi.h | 1 + 5 files changed, 70 insertions(+), 14 deletions(-)
drivers/net/wireless/ath/ath11k/core.h +1 -0
@@ -438,6 +438,7 @@ struct ath11k {struct {struct ieee80211_supported_band sbands[NUM_NL80211_BANDS ]; } mac; +unsigned long dev_flags;unsigned int filter_flags;unsigned long monitor_flags;u32 min_tx_power;
drivers/net/wireless/ath/ath11k/dp_rx.c +16 -4
@@ -1779,10 +1779,6 @@ static void ath11k_dp_rx_process_amsdu(struct ath11k *ar,if (first_mpdu)ath11k_dp_rx_h_ppdu (ar, rx_desc, rx_status); -/* TODO: Check if we need to drop frames in certain cases something -* like while in the middle of CAC. -*/ -ath11k_dp_rx_h_mpdu (ar, amsdu_list, rx_desc, rx_status); }
@@ -2039,6 +2035,11 @@ int ath11k_dp_process_rx(struct ath11k_base *ab, int mac_id, goto rcu_unlock; } +if (test_bit (ATH11K_CAC_RUNNING , &ar->dev_flags)) { +__skb_queue_purge (&msdu_list); + goto rcu_unlock; + } +while (!skb_queue_empty (&msdu_list)) {__skb_queue_head_init (&amsdu_list); ret =ath11k_dp_rx_retrieve_amsdu (ar, &msdu_list, &amsdu_list);
@@ -2536,6 +2537,11 @@ ath11k_dp_process_rx_err_buf(struct ath11k *ar, struct napi_struct *napi, goto exit; } +if (test_bit (ATH11K_CAC_RUNNING , &ar->dev_flags)) { +dev_kfree_skb_any (msdu); + goto exit; + } + rx_desc = msdu->data; msdu_len =ath11k_dp_rx_h_msdu_start_msdu_len (rx_desc);skb_put (msdu,HAL_RX_DESC_SIZE + msdu_len);
@@ -2956,6 +2962,12 @@ int ath11k_dp_rx_process_wbm_err(struct ath11k_base *ab, } ar = ab->pdevs[i].ar; + +if (test_bit (ATH11K_CAC_RUNNING , &ar->dev_flags)) { +__skb_queue_purge (&msdu_list[i]); +continue ; + } +while ((msdu =__skb_dequeue (&msdu_list[i])) !=NULL )ath11k_dp_rx_wbm_err (ar, napi, msdu, &msdu_list[i]); }
drivers/net/wireless/ath/ath11k/mac.c +48 -6
105 lines not on this page · raw message
drivers/net/wireless/ath/ath11k/wmi.c +4 -4
@@ -788,6 +788,7 @@ int ath11k_wmi_vdev_start(struct ath11k *ar, struct wmi_vdev_start_req_arg *arg, cmd->preferred_rx_streams = arg->pref_rx_streams; cmd->preferred_tx_streams = arg->pref_tx_streams; cmd->cac_duration_ms = arg->cac_duration_ms; + cmd->regdomain = arg->regdomain; cmd->he_ops = arg->he_ops;if (!restart) {
@@ -5151,10 +5152,9 @@ void ath11k_mgmt_rx_event(struct ath11k_base *ab, struct sk_buff *skb) goto exit; } -/* TODO: Check CAC running state */ - -if (rx_ev.status & (WMI_RX_STATUS_ERR_DECRYPT | -WMI_RX_STATUS_ERR_KEY_CACHE_MISS |WMI_RX_STATUS_ERR_CRC )) { +if ((test_bit (ATH11K_CAC_RUNNING , &ar->dev_flags)) || + (rx_ev.status & (WMI_RX_STATUS_ERR_DECRYPT | +WMI_RX_STATUS_ERR_KEY_CACHE_MISS |WMI_RX_STATUS_ERR_CRC ))) {dev_kfree_skb (skb); goto exit; }
drivers/net/wireless/ath/ath11k/wmi.h +1 -0
@@ -3134,6 +3134,7 @@ struct wmi_vdev_start_req_arg {bool pmf_enabled;u32 he_ops;u32 cac_duration_ms; +u32 regdomain;u32 pref_rx_streams;u32 pref_tx_streams;u32 num_noa_descriptors;
Signature · 7 lines
2.7.4 _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
PATCH 3/3 ath11k: Add dfs debug and test interface
In reply to Sriram RAdd support to simulate radar to validate DFS implementation of NOL, NOP in firmware, host and CSA offload. This is done with the help of FW Unit test commands. Also block_radar_events is used to validate the firmware/host DFS implementation and behavior when the detected radar is not indicated to mac80211.
--- drivers/net/wireless/ath/ath11k/core.h | 1 + drivers/net/wireless/ath/ath11k/debug.c | 28 +++++++++ drivers/net/wireless/ath/ath11k/wmi.c | 104 +++++++++++++++++++++++++++++++- drivers/net/wireless/ath/ath11k/wmi.h | 28 +++++++++ 4 files changed, 159 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath11k/core.h +1 -0
@@ -515,6 +515,7 @@ struct ath11k {#ifdef CONFIG_ATH11K_DEBUGFS struct ath11k_debug debug;#endif +bool dfs_block_radar_events; };struct ath11k_band_cap {
drivers/net/wireless/ath/ath11k/debug.c +28 -0
@@ -1099,12 +1099,31 @@ static ssize_t ath11k_read_pktlog_filter(struct file *file,return simple_read_from_buffer (ubuf, count, ppos, buf, len); } +static ssize_t ath11k_write_simulate_radar (struct file *file, +const char __user *user_buf, +size_t count,loff_t *ppos) +{ +struct ath11k *ar = file->private_data; +int ret; + + ret =ath11k_wmi_simulate_radar (ar); +if (ret) +return ret; + +return count; +} +static const struct file_operations fops_pktlog_filter = { .read = ath11k_read_pktlog_filter, .write = ath11k_write_pktlog_filter, .open = simple_open }; +static const struct file_operations fops_simulate_radar = { + .write = ath11k_write_simulate_radar, + .open = simple_open +}; +int ath11k_debug_register (struct ath11k *ar) {struct ath11k_base *ab = ar->ab;
@@ -1140,6 +1159,15 @@ int ath11k_debug_register(struct ath11k *ar) ar->debug.debugfs_pdev, ar, &fops_pktlog_filter); +if (ar->hw->wiphy->bands[NL80211_BAND_5GHZ ]) { +debugfs_create_file ("dfs_simulate_radar" ,0200 , + ar->debug.debugfs_pdev, ar, + &fops_simulate_radar); +debugfs_create_bool ("dfs_block_radar_events" ,0200 , + ar->debug.debugfs_pdev, + &ar->dfs_block_radar_events); + } +return 0 ; }
drivers/net/wireless/ath/ath11k/wmi.c +102 -2
118 lines not on this page · raw message
drivers/net/wireless/ath/ath11k/wmi.h +28 -0
@@ -4113,6 +4113,32 @@ struct wmi_pktlog_disable_cmd {u32 pdev_id; } __packed; +#define DFS_PHYERR_UNIT_TEST_CMD 0 +#define DFS_UNIT_TEST_MODULE 0x2b +#define DFS_UNIT_TEST_TOKEN 0xAA + +enum dfs_test_args_idx { +DFS_TEST_CMDID =0 , +DFS_TEST_PDEV_ID , +DFS_TEST_RADAR_PARAM , +DFS_MAX_TEST_ARGS , +}; + +struct wmi_dfs_unit_test_arg { +u32 cmd_id; +u32 pdev_id; +u32 radar_param; +}; + +struct wmi_unit_test_cmd { +u32 tlv_header; +u32 vdev_id; +u32 module_id; +u32 num_args; +u32 diag_token; +/* Followed by test args*/ +} __packed; +#define MAX_SUPPORTED_RATES 128#define WMI_PEER_AUTH 0x00000001
@@ -4199,6 +4225,7 @@ enum wmi_vdev_start_resp_status_code { WMI_VDEV_START_RESPONSE_DFS_VIOLATION = 3, }; +;enum cc_setting_code {REG_SET_CC_STATUS_PASS =0 ,REG_CURRENT_ALPHA2_NOT_FOUND =1 ,
@@ -5204,4 +5231,5 @@ size_t ath11k_wmi_fw_stats_num_vdevs(struct list_head *head);void ath11k_wmi_fw_stats_fill (struct ath11k *ar,struct ath11k_fw_stats *fw_stats,u32 stats_id,char *buf); +int ath11k_wmi_simulate_radar (struct ath11k *ar);#endif
Signature · 7 lines
2.7.4 _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k