Example #1
0
void ath9k_wmi_tasklet(unsigned long data)
{
	struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *)data;
	struct ath_common *common = ath9k_hw_common(priv->ah);
	struct wmi_cmd_hdr *hdr;
	struct wmi_swba *swba_hdr;
	enum wmi_event_id event;
	struct sk_buff *skb;
	void *wmi_event;
	unsigned long flags;
#ifdef CONFIG_ATH9K_HTC_DEBUGFS
	__be32 txrate;
#endif

	spin_lock_irqsave(&priv->wmi->wmi_lock, flags);
	skb = priv->wmi->wmi_skb;
	spin_unlock_irqrestore(&priv->wmi->wmi_lock, flags);

	hdr = (struct wmi_cmd_hdr *) skb->data;
	event = be16_to_cpu(hdr->command_id);
	wmi_event = skb_pull(skb, sizeof(struct wmi_cmd_hdr));

	ath_print(common, ATH_DBG_WMI,
		  "WMI Event: 0x%x\n", event);

	switch (event) {
	case WMI_TGT_RDY_EVENTID:
		break;
	case WMI_SWBA_EVENTID:
		swba_hdr = (struct wmi_swba *) wmi_event;
		ath9k_htc_swba(priv, swba_hdr->beacon_pending);
		break;
	case WMI_FATAL_EVENTID:
		break;
	case WMI_TXTO_EVENTID:
		break;
	case WMI_BMISS_EVENTID:
		break;
	case WMI_WLAN_TXCOMP_EVENTID:
		break;
	case WMI_DELBA_EVENTID:
		break;
	case WMI_TXRATE_EVENTID:
#ifdef CONFIG_ATH9K_HTC_DEBUGFS
		txrate = ((struct wmi_event_txrate *)wmi_event)->txrate;
		priv->debug.txrate = be32_to_cpu(txrate);
#endif
		break;
	default:
		break;
	}

	kfree_skb(skb);
}
void ath9k_wmi_event_tasklet(unsigned long data)
{
	struct wmi *wmi = (struct wmi *)data;
	struct ath9k_htc_priv *priv = wmi->drv_priv;
	struct wmi_cmd_hdr *hdr;
	void *wmi_event;
	struct wmi_event_swba *swba;
	struct sk_buff *skb = NULL;
	unsigned long flags;
	u16 cmd_id;

	do {
		spin_lock_irqsave(&wmi->wmi_lock, flags);
		skb = __skb_dequeue(&wmi->wmi_event_queue);
		if (!skb) {
			spin_unlock_irqrestore(&wmi->wmi_lock, flags);
			return;
		}
		spin_unlock_irqrestore(&wmi->wmi_lock, flags);

		hdr = (struct wmi_cmd_hdr *) skb->data;
		cmd_id = be16_to_cpu(hdr->command_id);
		wmi_event = skb_pull(skb, sizeof(struct wmi_cmd_hdr));

		switch (cmd_id) {
		case WMI_SWBA_EVENTID:
			swba = (struct wmi_event_swba *) wmi_event;
			ath9k_htc_swba(priv, swba);
			break;
		case WMI_FATAL_EVENTID:
			ieee80211_queue_work(wmi->drv_priv->hw,
					     &wmi->drv_priv->fatal_work);
			break;
		case WMI_TXSTATUS_EVENTID:
			spin_lock_bh(&priv->tx.tx_lock);
			if (priv->tx.flags & ATH9K_HTC_OP_TX_DRAIN) {
				spin_unlock_bh(&priv->tx.tx_lock);
				break;
			}
			spin_unlock_bh(&priv->tx.tx_lock);

			ath9k_htc_txstatus(priv, wmi_event);
			break;
		default:
			break;
		}

		kfree_skb(skb);
	} while (1);
}