build fix: ath_beacon_setup works only with ath_tx_buf
[open-ath9k-htc-firmware.git] / target_firmware / wlan / if_ath.c
index 789725baa21d98239856f0aacbe6bbf16886288d..e3ee4511516a9e779ed61397cd9cb27484e894fb 100755 (executable)
@@ -1,3 +1,38 @@
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *  * Neither the name of Qualcomm Atheros nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #include <adf_os_types.h>
 #include <adf_os_pci.h>
 #include <adf_os_dma.h>
@@ -35,10 +70,8 @@ uint32_t *init_htc_handle = 0;
 #define UAPSDQ_NUM   9
 #define CABQ_NUM     8
 
-void wmi_event(wmi_handle_t handle, WMI_EVENT_ID evt_id, A_UINT8 *buffer, a_int32_t Length);
 void owl_tgt_tx_tasklet(TQUEUE_ARG data);
 static void ath_tgt_send_beacon(struct ath_softc_tgt *sc,adf_nbuf_t bc_hdr,adf_nbuf_t nbuf,HTC_ENDPOINT_ID EndPt);
-void wmi_cmd_rsp(void *pContext, WMI_COMMAND_ID cmd_id, A_UINT16 SeqNo, A_UINT8 *buffer, a_int32_t Length);
 static void ath_hal_reg_write_tgt(void *Context, A_UINT16 Command, A_UINT16 SeqNo, A_UINT8 *data, a_int32_t datalen);
 extern struct ath_buf * ath_tgt_tx_prepare(struct ath_softc_tgt *sc, adf_nbuf_t skb, ath_data_hdr_t *dh);
 extern void  ath_tgt_send_mgt(struct ath_softc_tgt *sc,adf_nbuf_t mgt_hdr, adf_nbuf_t skb,HTC_ENDPOINT_ID EndPt);
@@ -125,7 +158,7 @@ static void ath_setcurmode(struct ath_softc_tgt *sc,
 }
 
 void wmi_event(wmi_handle_t handle, WMI_EVENT_ID evt_id,
-              A_UINT8 *buffer, a_int32_t Length)
+              void *buffer, a_int32_t Length)
 {
        adf_nbuf_t netbuf = ADF_NBUF_NULL;
        a_uint8_t *pData;
@@ -147,7 +180,7 @@ void wmi_event(wmi_handle_t handle, WMI_EVENT_ID evt_id,
 }
 
 void wmi_cmd_rsp(void *pContext, WMI_COMMAND_ID cmd_id, A_UINT16 SeqNo,
-                A_UINT8 *buffer, a_int32_t Length)
+                void *buffer, a_int32_t Length)
 {
        adf_nbuf_t netbuf = ADF_NBUF_NULL;
        A_UINT8 *pData;
@@ -345,7 +378,7 @@ static void ath_uapsd_processtriggers(struct ath_softc_tgt *sc)
                        break;
                }
 
-               if (ds->ds_link == NULL) {
+               if (ds->ds_link == 0) {
                        break;
                }
 
@@ -411,7 +444,7 @@ static void ath_uapsd_processtriggers(struct ath_softc_tgt *sc)
 
                        bf->bf_status |= ATH_BUFSTATUS_DONE;
 
-                       bf = asf_tailq_next(bf, bf_list);
+                       bf = (struct ath_rx_buf *)asf_tailq_next(bf, bf_list);
                }
                else {
                        ds = asf_tailq_next(ds, ds_list);
@@ -450,7 +483,6 @@ static void ath_tgt_rx_tasklet(TQUEUE_ARG data)
        struct ath_rx_buf *bf = NULL;
        struct ath_hal *ah = sc->sc_ah;
        struct rx_frame_header *rxhdr;
-       struct ieee80211_frame *wh;
        struct ath_rx_status *rxstats;
        adf_nbuf_t skb = ADF_NBUF_NULL;
 
@@ -484,7 +516,6 @@ static void ath_tgt_rx_tasklet(TQUEUE_ARG data)
                HTC_SendMsg(sc->tgt_htc_handle, RX_ENDPOINT_ID, skb);
                sc->sc_rx_stats.ast_rx_send++;
 
-       next_buf:
                bf->bf_status &= ~ATH_BUFSTATUS_DONE;
                asf_tailq_insert_tail(&sc->sc_rxbuf, bf, bf_list);
 
@@ -503,13 +534,13 @@ static void ath_tgt_rx_tasklet(TQUEUE_ARG data)
  * FIXME: Short Preamble.
  */
 static void ath_beacon_setup(struct ath_softc_tgt *sc,
-                            struct ath_buf *bf,
+                            struct ath_tx_buf *bf,
                             struct ath_vap_target *avp)
 {
        adf_nbuf_t skb = bf->bf_skb;
        struct ath_hal *ah = sc->sc_ah;
        struct ath_desc *ds;
-       a_int32_t flags, antenna;
+       a_int32_t flags;
        const HAL_RATE_TABLE *rt;
        a_uint8_t rix, rate;
        HAL_11N_RATE_SERIES series[4] = {{ 0 }};
@@ -985,7 +1016,6 @@ adf_os_irq_resp_t ath_intr(adf_drv_handle_t hdl)
 {
        struct ath_softc_tgt *sc = (struct ath_softc_tgt *)hdl;
        struct ath_hal *ah = sc->sc_ah;
-       struct ieee80211com_target *ic = &sc->sc_ic;
        HAL_INT status;
 
        if (sc->sc_invalid)
@@ -1607,7 +1637,6 @@ static void ath_setcurmode_tgt(void *Context, A_UINT16 Command,
 {
        struct ath_softc_tgt *sc = (struct ath_softc_tgt *)Context;
        a_uint16_t mode;
-       struct ath_hal *ah = sc->sc_ah;
 
        mode= *((a_uint16_t *)data);
        mode = adf_os_ntohs(mode);
@@ -1617,7 +1646,7 @@ static void ath_setcurmode_tgt(void *Context, A_UINT16 Command,
        wmi_cmd_rsp(sc->tgt_wmi_handle, Command, SeqNo, NULL, 0);
 }
 
-static a_uint32_t ath_detach_tgt(void *Context, A_UINT16 Command, A_UINT16 SeqNo,
+static void ath_detach_tgt(void *Context, A_UINT16 Command, A_UINT16 SeqNo,
                                 A_UINT8 *data, a_int32_t datalen)
 {
        struct ath_softc_tgt *sc = (struct ath_softc_tgt *)Context;