ath10k: handle pdev_chan_info wmi event
authorRajkumar Manoharan <rmanohar@qti.qualcomm.com>
Wed, 27 Apr 2016 10:53:21 +0000 (16:23 +0530)
committerKalle Valo <kvalo@qca.qualcomm.com>
Fri, 6 May 2016 15:55:37 +0000 (18:55 +0300)
Add handler to process bss channel information wmi event that
will be received upon sending pdev_chan_info_request wmi command.

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath10k/wmi.c
drivers/net/wireless/ath/ath10k/wmi.h

index 5471f242b3089f84689ed892d32824a9b4ce7b6e..af97759f5ca3fc74231e04ed4b013fd8da3796c4 100644 (file)
@@ -4794,6 +4794,32 @@ static int ath10k_wmi_event_temperature(struct ath10k *ar, struct sk_buff *skb)
        return 0;
 }
 
+static int ath10k_wmi_event_pdev_bss_chan_info(struct ath10k *ar,
+                                              struct sk_buff *skb)
+{
+       struct wmi_pdev_bss_chan_info_event *ev;
+       u64 busy, total, tx, rx, rx_bss;
+       u32 freq, noise_floor;
+
+       ev = (struct wmi_pdev_bss_chan_info_event *)skb->data;
+       if (WARN_ON(skb->len < sizeof(*ev)))
+               return -EPROTO;
+
+       freq        = __le32_to_cpu(ev->freq);
+       noise_floor = __le32_to_cpu(ev->noise_floor);
+       busy        = __le64_to_cpu(ev->cycle_busy);
+       total       = __le64_to_cpu(ev->cycle_total);
+       tx          = __le64_to_cpu(ev->cycle_tx);
+       rx          = __le64_to_cpu(ev->cycle_rx);
+       rx_bss      = __le64_to_cpu(ev->cycle_rx_bss);
+
+       ath10k_dbg(ar, ATH10K_DBG_WMI,
+                  "wmi event pdev bss chan info:\n freq: %d noise: %d cycle: busy %llu total %llu tx %llu rx %llu rx_bss %llu\n",
+                  freq, noise_floor, busy, total, tx, rx, rx_bss);
+
+       return 0;
+}
+
 static void ath10k_wmi_op_rx(struct ath10k *ar, struct sk_buff *skb)
 {
        struct wmi_cmd_hdr *cmd_hdr;
@@ -5137,6 +5163,9 @@ static void ath10k_wmi_10_2_op_rx(struct ath10k *ar, struct sk_buff *skb)
        case WMI_10_2_PDEV_TEMPERATURE_EVENTID:
                ath10k_wmi_event_temperature(ar, skb);
                break;
+       case WMI_10_2_PDEV_BSS_CHAN_INFO_EVENTID:
+               ath10k_wmi_event_pdev_bss_chan_info(ar, skb);
+               break;
        case WMI_10_2_RTT_KEEPALIVE_EVENTID:
        case WMI_10_2_GPIO_INPUT_EVENTID:
        case WMI_10_2_PEER_RATECODE_LIST_EVENTID:
@@ -5223,6 +5252,9 @@ static void ath10k_wmi_10_4_op_rx(struct ath10k *ar, struct sk_buff *skb)
        case WMI_10_4_PDEV_TEMPERATURE_EVENTID:
                ath10k_wmi_event_temperature(ar, skb);
                break;
+       case WMI_10_4_PDEV_BSS_CHAN_INFO_EVENTID:
+               ath10k_wmi_event_pdev_bss_chan_info(ar, skb);
+               break;
        default:
                ath10k_warn(ar, "Unknown eventid: %d\n", id);
                break;
index 30c6a8304ea88dde45830b7e1e03476f2f03d092..9fdf47ea27d08663c9924239e5fe008d505eba8f 100644 (file)
@@ -6285,6 +6285,17 @@ struct wmi_pdev_temperature_event {
        __le32 temperature;
 } __packed;
 
+struct wmi_pdev_bss_chan_info_event {
+       __le32 freq;
+       __le32 noise_floor;
+       __le64 cycle_busy;
+       __le64 cycle_total;
+       __le64 cycle_tx;
+       __le64 cycle_rx;
+       __le64 cycle_rx_bss;
+       __le32 reserved;
+} __packed;
+
 /* WOW structures */
 enum wmi_wow_wakeup_event {
        WOW_BMISS_EVENT = 0,