]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
ath9k_htc: Introduce new HTC API
authorSujith Manoharan <Sujith.Manoharan@atheros.com>
Wed, 13 Apr 2011 05:55:35 +0000 (11:25 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 13 Apr 2011 19:23:46 +0000 (15:23 -0400)
A new routine that takes an endpoint explicitly is
introduced. The normal htc_send() now retrieves the endpoint
from the packet's private data. This would be useful
in TX completion when the endpoint ID would be required.
While at it, use a helper function to map the queue to endpoint.

Data/mgmt/beacon packets use htc_send(), while WMI comamnds
pass the endpoint to HTC.

Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/htc.h
drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
drivers/net/wireless/ath/ath9k/htc_hst.c
drivers/net/wireless/ath/ath9k/htc_hst.h
drivers/net/wireless/ath/ath9k/wmi.c

index fc4c466e75638b9d3c8dbae5fcaff3bf091259c2..356f49c180b38c74def163c147aa850e77c33a3a 100644 (file)
@@ -276,6 +276,7 @@ struct ath9k_htc_tx {
 
 struct ath9k_htc_tx_ctl {
        u8 type; /* ATH9K_HTC_* */
+       u8 epid;
 };
 
 static inline struct ath9k_htc_tx_ctl *HTC_SKB_CB(struct sk_buff *skb)
index de37d46bb0d0b4ae6a7bd03d890f8ea1536423b5..97b116fb4e11d6ea7479c921a59e39fc59f2df64 100644 (file)
@@ -391,12 +391,13 @@ static void ath9k_htc_send_beacon(struct ath9k_htc_priv *priv,
        memset(tx_ctl, 0, sizeof(*tx_ctl));
 
        tx_ctl->type = ATH9K_HTC_BEACON;
+       tx_ctl->epid = priv->beacon_ep;
 
        beacon_hdr.vif_index = avp->index;
        tx_fhdr = skb_push(beacon, sizeof(beacon_hdr));
        memcpy(tx_fhdr, (u8 *) &beacon_hdr, sizeof(beacon_hdr));
 
-       ret = htc_send(priv->htc, beacon, priv->beacon_ep);
+       ret = htc_send(priv->htc, beacon);
        if (ret != 0) {
                if (ret == -ENOMEM) {
                        ath_dbg(common, ATH_DBG_BSTUCK,
index 1cbe194179ab5388da1dcedea14e43abee45ae42..d17662fa604a29f4b4e7d5daae7eb91845033e96 100644 (file)
@@ -76,6 +76,34 @@ void ath9k_htc_check_wake_queues(struct ath9k_htc_priv *priv)
        spin_unlock_bh(&priv->tx.tx_lock);
 }
 
+static enum htc_endpoint_id get_htc_epid(struct ath9k_htc_priv *priv,
+                                        u16 qnum)
+{
+       enum htc_endpoint_id epid;
+
+       switch (qnum) {
+       case 0:
+               TX_QSTAT_INC(WME_AC_VO);
+               epid = priv->data_vo_ep;
+               break;
+       case 1:
+               TX_QSTAT_INC(WME_AC_VI);
+               epid = priv->data_vi_ep;
+               break;
+       case 2:
+               TX_QSTAT_INC(WME_AC_BE);
+               epid = priv->data_be_ep;
+               break;
+       case 3:
+       default:
+               TX_QSTAT_INC(WME_AC_BK);
+               epid = priv->data_bk_ep;
+               break;
+       }
+
+       return epid;
+}
+
 int ath_htc_txq_update(struct ath9k_htc_priv *priv, int qnum,
                       struct ath9k_tx_queue_info *qinfo)
 {
@@ -113,7 +141,6 @@ int ath9k_htc_tx_start(struct ath9k_htc_priv *priv,
        struct ath9k_htc_sta *ista;
        struct ath9k_htc_vif *avp = NULL;
        struct ath9k_htc_tx_ctl *tx_ctl;
-       enum htc_endpoint_id epid;
        u16 qnum;
        __le16 fc;
        u8 *tx_fhdr;
@@ -197,31 +224,12 @@ int ath9k_htc_tx_start(struct ath9k_htc_priv *priv,
 
                if (is_cab) {
                        CAB_STAT_INC;
-                       epid = priv->cab_ep;
+                       tx_ctl->epid = priv->cab_ep;
                        goto send;
                }
 
                qnum = skb_get_queue_mapping(skb);
-
-               switch (qnum) {
-               case 0:
-                       TX_QSTAT_INC(WME_AC_VO);
-                       epid = priv->data_vo_ep;
-                       break;
-               case 1:
-                       TX_QSTAT_INC(WME_AC_VI);
-                       epid = priv->data_vi_ep;
-                       break;
-               case 2:
-                       TX_QSTAT_INC(WME_AC_BE);
-                       epid = priv->data_be_ep;
-                       break;
-               case 3:
-               default:
-                       TX_QSTAT_INC(WME_AC_BK);
-                       epid = priv->data_bk_ep;
-                       break;
-               }
+               tx_ctl->epid = get_htc_epid(priv, qnum);
        } else {
                struct tx_mgmt_hdr mgmt_hdr;
 
@@ -251,10 +259,10 @@ int ath9k_htc_tx_start(struct ath9k_htc_priv *priv,
 
                tx_fhdr = skb_push(skb, sizeof(mgmt_hdr));
                memcpy(tx_fhdr, (u8 *) &mgmt_hdr, sizeof(mgmt_hdr));
-               epid = priv->mgmt_ep;
+               tx_ctl->epid = priv->mgmt_ep;
        }
 send:
-       return htc_send(priv->htc, skb, epid);
+       return htc_send(priv->htc, skb);
 }
 
 static bool ath9k_htc_check_tx_aggr(struct ath9k_htc_priv *priv,
index 6ee53de45c6a3dbbf34ef44830c0509fc882e706..be87f4757bf53ccbd65ed203f2bad90515b1fba9 100644 (file)
@@ -286,8 +286,16 @@ err:
        return ret;
 }
 
-int htc_send(struct htc_target *target, struct sk_buff *skb,
-            enum htc_endpoint_id epid)
+int htc_send(struct htc_target *target, struct sk_buff *skb)
+{
+       struct ath9k_htc_tx_ctl *tx_ctl;
+
+       tx_ctl = HTC_SKB_CB(skb);
+       return htc_issue_send(target, skb, skb->len, 0, tx_ctl->epid);
+}
+
+int htc_send_epid(struct htc_target *target, struct sk_buff *skb,
+                 enum htc_endpoint_id epid)
 {
        return htc_issue_send(target, skb, skb->len, 0, epid);
 }
index 3531552672e0eb97f3f9872710f4ada0d2c8c686..064a324b5228d08e6a2975f17b0e4b5369a32cfd 100644 (file)
@@ -204,8 +204,9 @@ int htc_init(struct htc_target *target);
 int htc_connect_service(struct htc_target *target,
                          struct htc_service_connreq *service_connreq,
                          enum htc_endpoint_id *conn_rsp_eid);
-int htc_send(struct htc_target *target, struct sk_buff *skb,
-            enum htc_endpoint_id eid);
+int htc_send(struct htc_target *target, struct sk_buff *skb);
+int htc_send_epid(struct htc_target *target, struct sk_buff *skb,
+                 enum htc_endpoint_id epid);
 void htc_stop(struct htc_target *target);
 void htc_start(struct htc_target *target);
 
index 83d1e0e5dd8c3d25e53f80acc808468906c4b7d6..e66f6c33302817fe2ce4960efd7604707000dce1 100644 (file)
@@ -267,7 +267,7 @@ static int ath9k_wmi_cmd_issue(struct wmi *wmi,
        hdr->command_id = cpu_to_be16(cmd);
        hdr->seq_no = cpu_to_be16(++wmi->tx_seq_id);
 
-       return htc_send(wmi->htc, skb, wmi->ctrl_epid);
+       return htc_send_epid(wmi->htc, skb, wmi->ctrl_epid);
 }
 
 int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id,