ath6kl: add pointer to the skb in htc_packet
[cascardo/linux.git] / drivers / net / wireless / ath / ath6kl / txrx.c
index 6754441..53d0334 100644 (file)
@@ -159,8 +159,8 @@ static bool ath6kl_process_uapsdq(struct ath6kl_sta *conn,
         */
        if (is_apsdq_empty) {
                ath6kl_wmi_set_apsd_bfrd_traf(ar->wmi,
-                               vif->fw_vif_idx,
-                               conn->aid, 1, 0);
+                                             vif->fw_vif_idx,
+                                             conn->aid, 1, 0);
        }
        *flags |= WMI_DATA_HDR_FLAGS_UAPSD;
 
@@ -285,6 +285,9 @@ int ath6kl_control_tx(void *devt, struct sk_buff *skb,
        int status = 0;
        struct ath6kl_cookie *cookie = NULL;
 
+       if (WARN_ON_ONCE(ar->state == ATH6KL_STATE_WOW))
+               return -EACCES;
+
        spin_lock_bh(&ar->lock);
 
        ath6kl_dbg(ATH6KL_DBG_WLAN_TX,
@@ -319,6 +322,7 @@ int ath6kl_control_tx(void *devt, struct sk_buff *skb,
        cookie->map_no = 0;
        set_htc_pkt_info(&cookie->htc_pkt, cookie, skb->data, skb->len,
                         eid, ATH6KL_CONTROL_PKT_TAG);
+       cookie->htc_pkt.skb = skb;
 
        /*
         * This interface is asynchronous, if there is an error, cleanup
@@ -360,6 +364,11 @@ int ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev)
                return 0;
        }
 
+       if (WARN_ON_ONCE(ar->state != ATH6KL_STATE_ON)) {
+               dev_kfree_skb(skb);
+               return 0;
+       }
+
        if (!test_bit(WMI_READY, &ar->flag))
                goto fail_tx;
 
@@ -371,7 +380,7 @@ int ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev)
 
        if (test_bit(WMI_ENABLED, &ar->flag)) {
                if ((dev->features & NETIF_F_IP_CSUM) &&
-                               (csum == CHECKSUM_PARTIAL)) {
+                   (csum == CHECKSUM_PARTIAL)) {
                        csum_start = skb->csum_start -
                                        (skb_network_header(skb) - skb->head) +
                                        sizeof(struct ath6kl_llc_snap_hdr);
@@ -395,7 +404,7 @@ int ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev)
                }
 
                if ((dev->features & NETIF_F_IP_CSUM) &&
-                               (csum == CHECKSUM_PARTIAL)) {
+                   (csum == CHECKSUM_PARTIAL)) {
                        meta_v2.csum_start = csum_start;
                        meta_v2.csum_dest = csum_dest;
 
@@ -420,7 +429,7 @@ int ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev)
                }
 
                if ((vif->nw_type == ADHOC_NETWORK) &&
-                    ar->ibss_ps_enable && test_bit(CONNECTED, &vif->flags))
+                   ar->ibss_ps_enable && test_bit(CONNECTED, &vif->flags))
                        chk_adhoc_ps_mapping = true;
                else {
                        /* get the stream mapping */
@@ -482,6 +491,7 @@ int ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev)
        cookie->map_no = map_no;
        set_htc_pkt_info(&cookie->htc_pkt, cookie, skb->data, skb->len,
                         eid, htc_tag);
+       cookie->htc_pkt.skb = skb;
 
        ath6kl_dbg_dump(ATH6KL_DBG_RAW_BYTES, __func__, "tx ",
                        skb->data, skb->len);
@@ -658,9 +668,10 @@ static void ath6kl_tx_clear_node_map(struct ath6kl_vif *vif,
        }
 }
 
-void ath6kl_tx_complete(void *context, struct list_head *packet_queue)
+void ath6kl_tx_complete(struct htc_target *target,
+                       struct list_head *packet_queue)
 {
-       struct ath6kl *ar = context;
+       struct ath6kl *ar = target->dev->ar;
        struct sk_buff_head skb_queue;
        struct htc_packet *packet;
        struct sk_buff *skb;
@@ -878,7 +889,8 @@ void ath6kl_rx_refill(struct htc_target *target, enum htc_endpoint_id endpoint)
                if (!IS_ALIGNED((unsigned long) skb->data, 4))
                        skb->data = PTR_ALIGN(skb->data - 4, 4);
                set_htc_rxpkt_info(packet, skb, skb->data,
-                               ATH6KL_BUFFER_SIZE, endpoint);
+                                  ATH6KL_BUFFER_SIZE, endpoint);
+               packet->skb = skb;
                list_add_tail(&packet->list, &queue);
        }
 
@@ -901,6 +913,8 @@ void ath6kl_refill_amsdu_rxbufs(struct ath6kl *ar, int count)
                        skb->data = PTR_ALIGN(skb->data - 4, 4);
                set_htc_rxpkt_info(packet, skb, skb->data,
                                   ATH6KL_AMSDU_BUFFER_SIZE, 0);
+               packet->skb = skb;
+
                spin_lock_bh(&ar->lock);
                list_add_tail(&packet->list, &ar->amsdu_rx_buffer_queue);
                spin_unlock_bh(&ar->lock);
@@ -1258,8 +1272,8 @@ static void ath6kl_uapsd_trigger_frame_rx(struct ath6kl_vif *vif,
                        flags = 0;
 
                ath6kl_wmi_set_apsd_bfrd_traf(ar->wmi,
-                               vif->fw_vif_idx,
-                               conn->aid, 0, flags);
+                                             vif->fw_vif_idx,
+                                             conn->aid, 0, flags);
        }
 
        return;
@@ -1567,7 +1581,7 @@ void ath6kl_rx(struct htc_target *target, struct htc_packet *packet)
                        aggr_conn = vif->aggr_cntxt->aggr_conn;
 
                if (aggr_process_recv_frm(aggr_conn, tid, seq_no,
-                   is_amsdu, skb)) {
+                                         is_amsdu, skb)) {
                        /* aggregation code will handle the skb */
                        return;
                }