summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2017-04-24 05:39:33 -0600
committerLinux Build Service Account <lnxbuild@localhost>2017-04-24 05:39:33 -0600
commitb0156ea6246a81affbe744704fd67c1069a2f617 (patch)
tree352ddc1d2403c7f5ac7481e7703a436d72352462
parent7df99620b7d5a635122a0849f1a5e7db3c1e6298 (diff)
parent5d01acdc6e4fba4a4a2a5bdfa6312461dd473b59 (diff)
Promotion of wlan-cmn.driver.lnx.1.0-00145.
CRs Change ID Subject -------------------------------------------------------------------------------------------------------------- 2033001 Id3bedc47c3b39666240a9aa0717d0f931f77ee63 qcacmn: Fix kernel module check patch warnings in HIF PC 2034502 I512d0d98886c887a242a834763b46b2ec0cd4751 qcacmn: Resolve compilation errors in lower version kern 2029962 Idddcfaa2ec4c5689c997559551230bc8f59df032 qcacmn: Add changes to support crypto API 2033001 Ia9a76aedcef83bb582e44fc76a486137bd22362b qcacmn: Fix kernel module check patch warnings in HIF US 2034738 I6e0760c9e6778087f8de6e5329bcaf110c7b264b qcacmn: Fix core_ctl_set_boost "off" ref count 2033691 Icdfc49379878ddefdaf21154e5a6a8e0d1eaa39e qcacmn: Fix Datapath kernel checkpatch warnings in cdp_t 2033691 I332add8c63898c868b29e783aea70460397bc4a4 qcacmn: Fix Datapath kernel checkpatch warnings in cdp_t 2033691 I1b0adc1da156a0b75dded82f0e2e20e2f0475917 qcacmn: Fix Datapath kernel checkpatch warnings in cdp_t 2033001 I151f597142d93a26e5e037cf7fce944f86fba72a qcacmn: Fix kernel module check patch warnings 2033001 I076a9634077dbabd6979f1b79778a89b222e1afd qcacmn: Fix kernel module check patch warnings in PLD fi 2033001 Ice22f299c075f99eacc20c7acc10fe8040139f97 qcacmn: Fix kernel module check patch warnings in HIF Di 2033691 Ie651fcc26eac71349779fcfa5316a6c469c22853 qcacmn: Fix Datapath kernel checkpatch warnings in cdp_t 2033691 I51d31046a7c75c05886c28b17191961e65cf9f98 qcacmn: Fix Datapath kernel checkpatch warnings in cdp_t 2033691 I5b80583da04ade9c9ed7c9cc993dd3f61d7c40c8 qcacmn: Fix Datapath kernel checkpatch warnings in cdp_t 2029402 I147855690f09af03a43f85f2e57626d7f73998de qcacmn: Add support to send DBS Scan command to firmware 2033691 I5d938601fa176f3fb547e8db17b5b6c6410183e9 qcacmn: Fix Datapath kernel checkpatch warnings in cdp_t 2025670 I6a2c9890e0af1fd51c4e2dfcded68f0075a3a4ef qcacmn: Add support to add memory tracking in tx path 2033691 I1061a37c94d09243fc4896afa072d6892e57342c qcacmn: Fix Datapath kernel checkpatch warnings in cdp_t 2033691 If8a1d2e5dcb60c17f7a1218b92a5e0dff1042739 qcacmn: Fix Datapath kernel checkpatch warnings in cdp_t 2032674 Ief0d7dd6c25cf45912820f0e237fd1179a57a5c7 qcacmn: Do not LRO aggregate if peer is not connected 2033001 I3ddc76399004f15f325b56709e4f2e96bf4cda96 qcacmn: Fix kernel module check patch warnings in HIF fi 2033691 I67c975b7d7f15b3145de41146d03c007d6dfb85b qcacmn: Fix Datapath kernel checkpatch warnings in cdp_t 2035618 I3d24f3b7e06c05ba43f631daaeb75af419ed13a5 qcacmn: Wakeup target when configuring PCI-E legacy ISR 2033001 I20f14f711ca00dfd9d59ee5edd0b3e2e32c90a11 qcacmn: Fix kernel module check patch warnings in HIF SN 2028762 Ie89a9cb3b54c373ac2610d62003e940da17696d8 qcacmn: Implement WMI/Credit History log print APIs 2034991 I563ba5bccb94ea4084ecfd5d31045a5715bbfef4 qcacmn: Do netif_rx_ni() for frames received before peer 2033001 I5a0d22f8b139e76c33580fe9ef5b01736b2b5735 qcacmn: Fix kernel module check patch warnings in HIF CE 2027472 I65fca58168f1c8413eef4790c0f428e64a58f3a7 qcacmn: Remove QDF_BUG from htc_wait_recv_ctrl_message 2033691 I4c738b201637981ddefaf4719730440299870643 qcacmn: Fix Datapath kernel checkpatch warnings in cdp_t 2033691 I8e4723388f56ebf034ef84763ebdf7b2905d8514 qcacmn: Fix Datapath kernel checkpatch warnings in cdp_t 2034020 I93b17d7bc3c2202bc46f3e486700ad25c8c07ad8 qcacmn: Reduce complexity in hif_ce_bus_late_resume 2033691 I39e704ca820ef893f3fbcaefb25af6fc342b5396 qcacmn: Fix Datapath kernel checkpatch warnings in cdp_t 2033691 I9ffc337637d27ee3447889ec7f31d5f49b72fa1f qcacmn: Fix Datapath kernel checkpatch warnings in cdp_t 2028808 I5d6e16f48f29c98cfb2191cf497f4203ea56a78f qcacmn: Add boundary check on TSO segments 2033691 Idcc988ee328cc43a15b5c0faa80592e8e4a462cf qcacmn: Fix Datapath kernel checkpatch warnings in cdp_t 2033001 Ieb1bac5061969538095fad8f0311029b3d3161f0 qcacmn: Fix kernel module check patch warnings in hif sd Change-Id: I86d7a18f8afcfc9bc22e1a45cd5897847fa66b76 CRs-Fixed: 2034020, 2033001, 2034738, 2034991, 2029402, 2025670, 2028762, 2034502, 2033691, 2035618, 2027472, 2032674, 2028808, 2029962
-rw-r--r--dp/inc/cdp_txrx_bus.h4
-rw-r--r--dp/inc/cdp_txrx_cmn.h12
-rw-r--r--dp/inc/cdp_txrx_flow_ctrl_legacy.h6
-rw-r--r--dp/inc/cdp_txrx_flow_ctrl_v2.h5
-rw-r--r--dp/inc/cdp_txrx_host_stats.h9
-rw-r--r--dp/inc/cdp_txrx_ipa.h12
-rw-r--r--dp/inc/cdp_txrx_lro.h2
-rw-r--r--dp/inc/cdp_txrx_misc.h19
-rw-r--r--dp/inc/cdp_txrx_mon.h13
-rw-r--r--dp/inc/cdp_txrx_peer_ops.h4
-rw-r--r--dp/inc/cdp_txrx_raw.h4
-rw-r--r--dp/inc/cdp_txrx_stats.h6
-rw-r--r--dp/inc/cdp_txrx_stats_struct.h116
-rw-r--r--dp/inc/cdp_txrx_tx_delay.h8
-rw-r--r--dp/inc/cdp_txrx_wds.h4
-rw-r--r--hif/inc/hif.h181
-rw-r--r--hif/inc/hif_napi.h9
-rw-r--r--hif/inc/regtable_pcie.h16
-rw-r--r--hif/inc/target_reg_init.h4
-rw-r--r--hif/src/ar6320def.h10
-rw-r--r--hif/src/ar6320v2def.h10
-rw-r--r--hif/src/ar900Bdef.c12
-rw-r--r--hif/src/ath_procfs.c24
-rw-r--r--hif/src/ce/ce_api.h35
-rw-r--r--hif/src/ce/ce_assignment.h136
-rw-r--r--hif/src/ce/ce_bmi.c23
-rw-r--r--hif/src/ce/ce_diag.c6
-rw-r--r--hif/src/ce/ce_internal.h12
-rw-r--r--hif/src/ce/ce_main.c210
-rw-r--r--hif/src/ce/ce_main.h3
-rw-r--r--hif/src/ce/ce_reg.h132
-rw-r--r--hif/src/ce/ce_service.c59
-rw-r--r--hif/src/ce/ce_tasklet.c7
-rw-r--r--hif/src/dispatcher/ahb_api.h4
-rw-r--r--hif/src/dispatcher/dummy.c5
-rw-r--r--hif/src/dispatcher/multibus.c24
-rw-r--r--hif/src/dispatcher/multibus.h12
-rw-r--r--hif/src/dispatcher/pci_api.h4
-rw-r--r--hif/src/dispatcher/sdio_api.h5
-rw-r--r--hif/src/dispatcher/snoc_api.h4
-rw-r--r--hif/src/dispatcher/usb_api.h4
-rw-r--r--hif/src/hif_main.c25
-rw-r--r--hif/src/hif_main.h7
-rw-r--r--hif/src/hif_napi.c54
-rw-r--r--hif/src/mp_dev.c5
-rw-r--r--hif/src/pcie/if_pci.c98
-rw-r--r--hif/src/sdio/hif_bmi_reg_access.c26
-rw-r--r--hif/src/sdio/hif_diag_reg_access.c21
-rw-r--r--hif/src/sdio/hif_sdio.c4
-rw-r--r--hif/src/sdio/hif_sdio_common.h5
-rw-r--r--hif/src/sdio/hif_sdio_dev.c64
-rw-r--r--hif/src/sdio/hif_sdio_internal.h14
-rw-r--r--hif/src/sdio/hif_sdio_recv.c248
-rw-r--r--hif/src/sdio/hif_sdio_send.c6
-rw-r--r--hif/src/sdio/if_sdio.c21
-rw-r--r--hif/src/sdio/if_sdio.h3
-rw-r--r--hif/src/sdio/native_sdio/include/hif_internal.h39
-rw-r--r--hif/src/sdio/native_sdio/src/hif.c371
-rw-r--r--hif/src/sdio/native_sdio/src/hif_scatter.c17
-rw-r--r--hif/src/sdio/regtable_sdio.h16
-rw-r--r--hif/src/snoc/hif_io32_snoc.h2
-rw-r--r--hif/src/snoc/if_ahb.c9
-rw-r--r--hif/src/snoc/if_ahb_reset.c8
-rw-r--r--hif/src/snoc/if_snoc.c9
-rw-r--r--hif/src/usb/hif_usb.c10
-rw-r--r--hif/src/usb/hif_usb_internal.h50
-rw-r--r--hif/src/usb/if_usb.c22
-rw-r--r--hif/src/usb/if_usb.h17
-rw-r--r--hif/src/usb/regtable_usb.h25
-rw-r--r--hif/src/usb/usbdrv.c157
-rw-r--r--htc/dl_list.h64
-rw-r--r--htc/htc.c116
-rw-r--r--htc/htc_api.h1047
-rw-r--r--htc/htc_internal.h138
-rw-r--r--htc/htc_packet.h144
-rw-r--r--htc/htc_recv.c114
-rw-r--r--htc/htc_send.c490
-rw-r--r--htc/htc_services.c60
-rw-r--r--pld_stub/inc/pld_common.h6
-rw-r--r--qdf/inc/qdf_crypto.h139
-rw-r--r--qdf/inc/qdf_nbuf.h109
-rw-r--r--qdf/inc/qdf_trace.h2
-rw-r--r--qdf/linux/src/i_qdf_nbuf.h32
-rw-r--r--qdf/linux/src/qdf_crypto.c329
-rw-r--r--qdf/linux/src/qdf_nbuf.c32
-rw-r--r--wmi/inc/wmi_unified_api.h26
-rw-r--r--wmi/inc/wmi_unified_param.h19
-rw-r--r--wmi/inc/wmi_unified_priv.h5
-rw-r--r--wmi/src/wmi_unified.c190
-rw-r--r--wmi/src/wmi_unified_api.c21
-rw-r--r--wmi/src/wmi_unified_tlv.c73
91 files changed, 3402 insertions, 2282 deletions
diff --git a/dp/inc/cdp_txrx_bus.h b/dp/inc/cdp_txrx_bus.h
index 575d6c4147cc..b110bd749e1d 100644
--- a/dp/inc/cdp_txrx_bus.h
+++ b/dp/inc/cdp_txrx_bus.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -24,7 +24,7 @@
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
- /**
+/**
* @file cdp_txrx_bus.h
* @brief Define the host data path bus related functions
*/
diff --git a/dp/inc/cdp_txrx_cmn.h b/dp/inc/cdp_txrx_cmn.h
index 96ab2f7e5926..5512f2a60b3f 100644
--- a/dp/inc/cdp_txrx_cmn.h
+++ b/dp/inc/cdp_txrx_cmn.h
@@ -24,7 +24,7 @@
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
- /**
+/**
* @file cdp_txrx_api_common.h
* @brief Define the host data path converged API functions
* called by the host control SW and the OS interface module
@@ -50,9 +50,9 @@
*****************************************************************************/
/**
- * ol_txrx_pdev_handle - opaque handle for txrx physical device
- * object
- */
+ * ol_txrx_pdev_handle - opaque handle for txrx physical device
+ * object
+ */
struct ol_txrx_pdev_t;
typedef struct ol_txrx_pdev_t *ol_txrx_pdev_handle;
@@ -153,7 +153,7 @@ typedef QDF_STATUS (*ol_txrx_rx_fp)(void *osif_dev, qdf_nbuf_t msdu_list);
/**
* ol_txrx_rx_check_wai_fp - OSIF WAPI receive function
-*/
+ */
typedef bool (*ol_txrx_rx_check_wai_fp)(ol_osif_vdev_handle vdev,
qdf_nbuf_t mpdu_head,
qdf_nbuf_t mpdu_tail);
@@ -167,7 +167,7 @@ typedef void (*ol_txrx_rx_mon_fp)(ol_osif_vdev_handle vdev,
/**
* ol_txrx_proxy_arp_fp - proxy arp function pointer
-*/
+ */
typedef int (*ol_txrx_proxy_arp_fp)(ol_osif_vdev_handle vdev,
qdf_nbuf_t netbuf);
diff --git a/dp/inc/cdp_txrx_flow_ctrl_legacy.h b/dp/inc/cdp_txrx_flow_ctrl_legacy.h
index b53a397ff9a5..6cd6ef9e39a7 100644
--- a/dp/inc/cdp_txrx_flow_ctrl_legacy.h
+++ b/dp/inc/cdp_txrx_flow_ctrl_legacy.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -24,7 +24,7 @@
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
- /**
+/**
* @file cdp_txrx_flow_ctrl_legacy.h
* @brief Define the host data path legacy flow control API
* functions
@@ -111,7 +111,6 @@ void ol_txrx_vdev_flush(ol_txrx_vdev_handle data_vdev);
#ifdef CONFIG_ICNSS
static inline void ol_txrx_vdev_pause(ol_txrx_vdev_handle vdev, uint32_t reason)
{
- return;
}
#else
void ol_txrx_vdev_pause(ol_txrx_vdev_handle vdev, uint32_t reason);
@@ -121,7 +120,6 @@ void ol_txrx_vdev_pause(ol_txrx_vdev_handle vdev, uint32_t reason);
static inline void ol_txrx_vdev_unpause(ol_txrx_vdev_handle data_vdev,
uint32_t reason)
{
- return;
}
#else
void ol_txrx_vdev_unpause(ol_txrx_vdev_handle data_vdev, uint32_t reason);
diff --git a/dp/inc/cdp_txrx_flow_ctrl_v2.h b/dp/inc/cdp_txrx_flow_ctrl_v2.h
index 53948c39c524..21ed98ab0137 100644
--- a/dp/inc/cdp_txrx_flow_ctrl_v2.h
+++ b/dp/inc/cdp_txrx_flow_ctrl_v2.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -24,7 +24,7 @@
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
- /**
+/**
* @file cdp_txrx_flow_ctrl_v2.h
* @brief Define the host data path flow control version 2 API
* functions
@@ -56,7 +56,6 @@ QDF_STATUS ol_txrx_register_pause_cb(ol_tx_pause_callback_fp pause_cb)
static inline void ol_tx_set_desc_global_pool_size(uint32_t num_msdu_desc)
{
- return;
}
#endif
diff --git a/dp/inc/cdp_txrx_host_stats.h b/dp/inc/cdp_txrx_host_stats.h
index e87ca3b1e074..fd065803c7a9 100644
--- a/dp/inc/cdp_txrx_host_stats.h
+++ b/dp/inc/cdp_txrx_host_stats.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -24,7 +24,7 @@
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
- /**
+/**
* @file cdp_txrx_host_stats.h
* @brief Define the host data path stats API functions
* called by the host control SW and the OS interface module
@@ -35,9 +35,10 @@
#include <cdp_txrx_stats_struct.h>
/* WIN */
/* Need to remove the "req" parameter */
-/* Need to rename the function to reflect the functionality "show" / "display"
+/**
+ * Need to rename the function to reflect the functionality "show" / "display"
* WIN -- to figure out whether to change OSIF to converge (not an immediate AI)
- * */
+ */
#if WLAN_FEATURE_FASTPATH
int ol_txrx_host_stats_get(
ol_txrx_vdev_handle vdev,
diff --git a/dp/inc/cdp_txrx_ipa.h b/dp/inc/cdp_txrx_ipa.h
index 3f166e38f670..3ad9e96a3347 100644
--- a/dp/inc/cdp_txrx_ipa.h
+++ b/dp/inc/cdp_txrx_ipa.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -24,7 +24,7 @@
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
- /**
+/**
* @file cdp_txrx_ipa.h
* @brief Define the host data path IP Acceleraor API functions
*/
@@ -91,7 +91,6 @@ static inline void
ol_txrx_ipa_uc_get_resource(ol_txrx_pdev_handle pdev,
struct ol_txrx_ipa_resources *ipa_res)
{
- return;
}
static inline void
@@ -99,20 +98,17 @@ ol_txrx_ipa_uc_set_doorbell_paddr(ol_txrx_pdev_handle pdev,
qdf_dma_addr_t ipa_tx_uc_doorbell_paddr,
qdf_dma_addr_t ipa_rx_uc_doorbell_paddr)
{
- return;
}
static inline void
ol_txrx_ipa_uc_set_active(ol_txrx_pdev_handle pdev,
bool uc_active, bool is_tx)
{
- return;
}
static inline void
ol_txrx_ipa_uc_op_response(ol_txrx_pdev_handle pdev, uint8_t *op_msg)
{
- return;
}
static inline void
@@ -121,24 +117,20 @@ ol_txrx_ipa_uc_register_op_cb(ol_txrx_pdev_handle pdev,
void *osif_ctxt),
void *osif_dev)
{
- return;
}
static inline void ol_txrx_ipa_uc_get_share_stats(ol_txrx_pdev_handle pdev,
uint8_t reset_stats)
{
- return;
}
static inline void ol_txrx_ipa_uc_set_quota(ol_txrx_pdev_handle pdev,
uint64_t quota_bytes)
{
- return;
}
static inline void ol_txrx_ipa_uc_get_stat(ol_txrx_pdev_handle pdev)
{
- return;
}
#endif /* IPA_OFFLOAD */
diff --git a/dp/inc/cdp_txrx_lro.h b/dp/inc/cdp_txrx_lro.h
index 3eeac0b8765a..8a35d147682e 100644
--- a/dp/inc/cdp_txrx_lro.h
+++ b/dp/inc/cdp_txrx_lro.h
@@ -24,7 +24,7 @@
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
- /**
+/**
* @file cdp_txrx_lro.h
* @brief Define the host data path Large Receive Offload API
* functions
diff --git a/dp/inc/cdp_txrx_misc.h b/dp/inc/cdp_txrx_misc.h
index e7461a3f4045..2da7c2755416 100644
--- a/dp/inc/cdp_txrx_misc.h
+++ b/dp/inc/cdp_txrx_misc.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -24,7 +24,7 @@
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
- /**
+/**
* @file cdp_txrx_misc.h
* @brief Define the host data path miscelleneous API functions
* called by the host control SW and the OS interface module
@@ -97,18 +97,3 @@ qdf_nbuf_t ol_tx_non_std(ol_txrx_vdev_handle vdev,
uint16_t ol_txrx_set_ibss_vdev_heart_beat_timer(ol_txrx_vdev_handle vdev,
uint16_t timer_value_sec);
#endif /* _CDP_TXRX_MISC_H_ */
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/dp/inc/cdp_txrx_mon.h b/dp/inc/cdp_txrx_mon.h
index 5597bcc9a4fc..83349c309672 100644
--- a/dp/inc/cdp_txrx_mon.h
+++ b/dp/inc/cdp_txrx_mon.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -24,7 +24,7 @@
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
- /**
+/**
* @file cdp_txrx_mon.h
* @brief Define the monitor mode API functions
* called by the host control SW and the OS interface module
@@ -32,9 +32,12 @@
#ifndef _CDP_TXRX_MON_H_
#define _CDP_TXRX_MON_H_
-void ol_txrx_monitor_set_filter_ucast_data(ol_txrx_pdev_handle, u_int8_t val);
-void ol_txrx_monitor_set_filter_mcast_data(ol_txrx_pdev_handle, u_int8_t val);
-void ol_txrx_monitor_set_filter_non_data(ol_txrx_pdev_handle, u_int8_t val);
+void ol_txrx_monitor_set_filter_ucast_data(ol_txrx_pdev_handle pdev,
+ u_int8_t val);
+void ol_txrx_monitor_set_filter_mcast_data(ol_txrx_pdev_handle pdev,
+ u_int8_t val);
+void ol_txrx_monitor_set_filter_non_data(ol_txrx_pdev_handle pdev,
+ u_int8_t val);
u_int8_t ol_txrx_monitor_get_filter_ucast_data(
ol_txrx_vdev_handle vdev_txrx_handle);
diff --git a/dp/inc/cdp_txrx_peer_ops.h b/dp/inc/cdp_txrx_peer_ops.h
index c349f31bc4a1..675a4cb9b20e 100644
--- a/dp/inc/cdp_txrx_peer_ops.h
+++ b/dp/inc/cdp_txrx_peer_ops.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -24,7 +24,7 @@
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
- /**
+/**
* @file cdp_txrx_peer.h
* @brief Define the host data path peer API functions
* called by the host control SW and the OS interface module
diff --git a/dp/inc/cdp_txrx_raw.h b/dp/inc/cdp_txrx_raw.h
index 0891480242db..3fd6e71863b2 100644
--- a/dp/inc/cdp_txrx_raw.h
+++ b/dp/inc/cdp_txrx_raw.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -24,7 +24,7 @@
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
- /**
+/**
* @file cdp_txrx_raw.h
* @brief Define the host data path raw mode API functions
* called by the host control SW and the OS interface module
diff --git a/dp/inc/cdp_txrx_stats.h b/dp/inc/cdp_txrx_stats.h
index 68bdad74ad1b..d559e11ec63c 100644
--- a/dp/inc/cdp_txrx_stats.h
+++ b/dp/inc/cdp_txrx_stats.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -24,7 +24,7 @@
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
- /**
+/**
* @file cdp_txrx_stats.h
* @brief Define the host data path statistics API functions
* called by the host control SW and the OS interface module
@@ -35,6 +35,6 @@
QDF_STATUS ol_txrx_display_stats(uint16_t bitmap);
QDF_STATUS ol_txrx_clear_stats(uint16_t bitmap);
-int ol_txrx_stats(uint8_t vdev_id, char *buffer, unsigned buf_len);
+int ol_txrx_stats(uint8_t vdev_id, char *buffer, unsigned int buf_len);
#endif /* _CDP_TXRX_STATS_H_ */
diff --git a/dp/inc/cdp_txrx_stats_struct.h b/dp/inc/cdp_txrx_stats_struct.h
index 32091e1e7680..ec26960105ed 100644
--- a/dp/inc/cdp_txrx_stats_struct.h
+++ b/dp/inc/cdp_txrx_stats_struct.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -24,7 +24,7 @@
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
- /**
+/**
* @file cdp_txrx_stats_struct.h
* @brief Define the host data path stats API functions
* called by the host control SW and the OS interface module
@@ -66,14 +66,17 @@ struct ol_txrx_stats {
struct {
/* MSDUs that the host did not accept */
ol_txrx_stats_elem host_reject;
- /* MSDUs which could not be downloaded to the
- target */
+ /* MSDUs which could not be downloaded to the target */
ol_txrx_stats_elem download_fail;
- /* MSDUs which the target discarded
- (lack of mem or old age) */
+ /*
+ * MSDUs which the target discarded
+ * (lack of mem or old age)
+ */
ol_txrx_stats_elem target_discard;
- /* MSDUs which the target sent but couldn't get
- an ack for */
+ /*
+ * MSDUs which the target sent but couldn't get
+ * an ack for
+ */
ol_txrx_stats_elem no_ack;
/* MSDUs dropped in NSS-FW */
ol_txrx_stats_elem nss_ol_dropped;
@@ -143,8 +146,10 @@ struct ol_txrx_stats {
u_int32_t num_me_ucast;
/* Number of multicast frames dropped due to dma_map failure */
u_int32_t num_me_dropped_m;
- /* Number of multicast frames dropped due to allocation
- failure */
+ /*
+ * Number of multicast frames dropped due to allocation
+ * failure
+ */
u_int32_t num_me_dropped_a;
/* Number of multicast frames dropped due to internal failure */
u_int32_t num_me_dropped_i;
@@ -213,9 +218,9 @@ struct ol_ath_radiostats {
};
/*
-** structure to hold all stats information
-** for offload device interface
-*/
+ * structure to hold all stats information
+ * for offload device interface
+ */
struct ol_stats {
int txrx_stats_level;
struct ol_txrx_stats txrx_stats;
@@ -225,9 +230,9 @@ struct ol_stats {
};
/*
-** Enumeration of PDEV Configuration parameter
-*/
-typedef enum _ol_ath_param_t {
+ * Enumeration of PDEV Configuration parameter
+ */
+enum _ol_ath_param_t {
OL_ATH_PARAM_TXCHAINMASK = 1,
OL_ATH_PARAM_RXCHAINMASK = 2,
OL_ATH_PARAM_AMPDU = 6,
@@ -252,27 +257,28 @@ typedef enum _ol_ath_param_t {
#endif
/* UMAC_SUPPORT_PERIODIC_PERFSTATS */
OL_ATH_PARAM_TOTAL_PER = 89,
- /*set manual rate for rts frame */
+ /* set manual rate for rts frame */
OL_ATH_PARAM_RTS_CTS_RATE = 92,
- /** co channel interference threshold level */
+ /* co channel interference threshold level */
OL_ATH_PARAM_DCS_COCH_THR = 93,
- /** transmit error threshold */
+ /* transmit error threshold */
OL_ATH_PARAM_DCS_TXERR_THR = 94,
- /** phy error threshold */
+ /* phy error threshold */
OL_ATH_PARAM_DCS_PHYERR_THR = 95,
- /* The IOCTL number is 114, it is made 114, inorder to make the IOCTL
- number same as Direct-attach IOCTL.
- Please, don't change number. This IOCTL gets the Interface code path
- it should be either DIRECT-ATTACH or OFF-LOAD.
- */
+ /*
+ * The IOCTL number is 114, it is made 114, inorder to make the IOCTL
+ * number same as Direct-attach IOCTL.
+ * Please, don't change number. This IOCTL gets the Interface code path
+ * it should be either DIRECT-ATTACH or OFF-LOAD.
+ */
OL_ATH_PARAM_GET_IF_ID = 114,
- /*Enable Acs back Ground Channel selection Scan timer in AP mode*/
+ /* Enable Acs back Ground Channel selection Scan timer in AP mode*/
OL_ATH_PARAM_ACS_ENABLE_BK_SCANTIMEREN = 118,
/* ACS scan timer value in Seconds */
OL_ATH_PARAM_ACS_SCANTIME = 119,
- /*Negligence Delta RSSI between two channel */
+ /* Negligence Delta RSSI between two channel */
OL_ATH_PARAM_ACS_RSSIVAR = 120,
- /*Negligence Delta Channel load between two channel*/
+ /* Negligence Delta Channel load between two channel*/
OL_ATH_PARAM_ACS_CHLOADVAR = 121,
/* Enable Limited OBSS check */
OL_ATH_PARAM_ACS_LIMITEDOBSS = 122,
@@ -306,15 +312,15 @@ typedef enum _ol_ath_param_t {
OL_ATH_PARAM_LTR_RX_OVERRIDE,
OL_ATH_PARAM_L1SS_ENABLE,
OL_ATH_PARAM_DSLEEP_ENABLE,
- /** radar error threshold */
+ /* radar error threshold */
OL_ATH_PARAM_DCS_RADAR_ERR_THR = 160,
- /** Tx channel utilization due to AP's tx and rx */
+ /* Tx channel utilization due to AP's tx and rx */
OL_ATH_PARAM_DCS_USERMAX_CU_THR,
- /** interference detection threshold */
+ /* interference detection threshold */
OL_ATH_PARAM_DCS_INTR_DETECT_THR,
- /** sampling window, default 10secs */
+ /* sampling window, default 10secs */
OL_ATH_PARAM_DCS_SAMPLE_WINDOW,
- /** debug logs enable/disable */
+ /* debug logs enable/disable */
OL_ATH_PARAM_DCS_DEBUG,
OL_ATH_PARAM_ANI_ENABLE = 165,
OL_ATH_PARAM_ANI_POLL_PERIOD,
@@ -323,14 +329,14 @@ typedef enum _ol_ath_param_t {
OL_ATH_PARAM_ANI_CCK_LEVEL,
OL_ATH_PARAM_DSCP_TID_MAP = 170,
OL_ATH_PARAM_TXPOWER_SCALE,
- /** Phy error penalty */
+ /* Phy error penalty */
OL_ATH_PARAM_DCS_PHYERR_PENALTY,
#if ATH_SUPPORT_DSCP_OVERRIDE
- /** set/get TID for sending HMMC packets */
+ /* set/get TID for sending HMMC packets */
OL_ATH_PARAM_HMMC_DSCP_TID_MAP,
- /** set/get DSCP mapping override */
+ /* set/get DSCP mapping override */
OL_ATH_PARAM_DSCP_OVERRIDE,
- /** set/get HMMC-DSCP mapping override */
+ /* set/get HMMC-DSCP mapping override */
OL_ATH_PARAM_HMMC_DSCP_OVERRIDE = 175,
#endif
#if ATH_RX_LOOPLIMIT_TIMER
@@ -353,7 +359,7 @@ typedef enum _ol_ath_param_t {
/* Number of deauth sent in consecutive rx_peer_invalid */
OL_ATH_PARAM_DEAUTH_COUNT,
OL_ATH_PARAM_BLOCK_INTERBSS = 190,
- /* Firmware reset control for Bmiss / timeout / reset */
+ /* Firmware reset control for Bmiss / timeout / reset */
OL_ATH_PARAM_FW_DISABLE_RESET,
OL_ATH_PARAM_MSDU_TTL,
OL_ATH_PARAM_PPDU_DURATION,
@@ -363,26 +369,28 @@ typedef enum _ol_ath_param_t {
OL_ATH_PARAM_DYN_GROUPING,
OL_ATH_PARAM_DPD_ENABLE,
OL_ATH_PARAM_DBGLOG_RATELIM,
- /* firmware should intimate us about ps state change for node */
+ /* firmware should intimate us about ps state change for node */
OL_ATH_PARAM_PS_STATE_CHANGE = 200,
OL_ATH_PARAM_MCAST_BCAST_ECHO,
- /* OBSS RSSI threshold for 20/40 coexistance */
+ /* OBSS RSSI threshold for 20/40 coexistance */
OL_ATH_PARAM_OBSS_RSSI_THRESHOLD,
- /* Link/node RX RSSI threshold for 20/40 coexistance */
+ /* Link/node RX RSSI threshold for 20/40 coexistance */
OL_ATH_PARAM_OBSS_RX_RSSI_THRESHOLD,
#if ATH_CHANNEL_BLOCKING
OL_ATH_PARAM_ACS_BLOCK_MODE = 205,
#endif
OL_ATH_PARAM_ACS_TX_POWER_OPTION,
- /* Default Antenna Polarization MSB 8 bits (24:31) specifying
- enable/disable ; LSB 24 bits (0:23) antenna mask value */
+ /*
+ * Default Antenna Polarization MSB 8 bits (24:31) specifying
+ * enable/disable ; LSB 24 bits (0:23) antenna mask value
+ */
OL_ATH_PARAM_ANT_POLARIZATION,
/* rate limit mute type error prints */
OL_ATH_PARAM_PRINT_RATE_LIMIT,
OL_ATH_PARAM_PDEV_RESET, /* Reset FW PDEV*/
- /*Do not crash host when target assert happened*/
+ /* Do not crash host when target assert happened*/
OL_ATH_PARAM_FW_DUMP_NO_HOST_CRASH = 210,
- /*Consider OBSS non-erp to change to long slot*/
+ /* Consider OBSS non-erp to change to long slot*/
OL_ATH_PARAM_CONSIDER_OBSS_NON_ERP_LONG_SLOT = 211,
#if PEER_FLOW_CONTROL
OL_ATH_PARAM_STATS_FC,
@@ -440,7 +448,7 @@ typedef enum _ol_ath_param_t {
OL_ATH_PARAM_VAP_QOS = 318,
#endif
OL_ATH_PARAM_CHAN_STATS_TH = 319,
- /* Passive scan is enabled or disabled */
+ /* Passive scan is enabled or disabled */
OL_ATH_PARAM_PASSIVE_SCAN_ENABLE = 320,
OL_ATH_MIN_RSSI_ENABLE = 321,
OL_ATH_MIN_RSSI = 322,
@@ -448,23 +456,23 @@ typedef enum _ol_ath_param_t {
#if DBDC_REPEATER_SUPPORT
OL_ATH_PARAM_DELAY_STAVAP_UP = 324,
#endif
- OL_ATH_PARAM_TXPOW_MGMT = 326, /* Can be used to configure transmit power for management frames */
- OL_ATH_PARAM_CHANSWITCH_OPTIONS = 327, /* It is used to set the channel switch options */
+ /* Can be used to configure transmit power for management frames */
+ OL_ATH_PARAM_TXPOW_MGMT = 326,
+ /* It is used to set the channel switch options */
+ OL_ATH_PARAM_CHANSWITCH_OPTIONS = 327,
OL_ATH_BTCOEX_ENABLE = 328,
OL_ATH_BTCOEX_WL_PRIORITY = 329,
OL_ATH_PARAM_TID_OVERRIDE_QUEUE_MAPPING = 330,
OL_ATH_PARAM_CAL_VER_CHECK = 331,
OL_ATH_PARAM_NO_VLAN = 332,
OL_ATH_PARAM_CCA_THRESHOLD = 333,
-} ol_ath_param_t;
+};
-/*
-** Enumeration of PDEV Configuration parameter
-*/
+/* Enumeration of PDEV Configuration parameter */
-typedef enum _ol_hal_param_t {
+enum _ol_hal_param_t {
OL_HAL_CONFIG_DMA_BEACON_RESPONSE_TIME = 0
-} ol_hal_param_t;
+};
/* Bitmasks for stats that can block */
diff --git a/dp/inc/cdp_txrx_tx_delay.h b/dp/inc/cdp_txrx_tx_delay.h
index 16c749c0cd43..559fb46e1644 100644
--- a/dp/inc/cdp_txrx_tx_delay.h
+++ b/dp/inc/cdp_txrx_tx_delay.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -24,7 +24,7 @@
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
- /**
+/**
* @file cdp_txrx_tx_delay.h
* @brief Define the host data path histogram API functions
* called by the host control SW and the OS interface module
@@ -52,14 +52,12 @@ ol_tx_delay(ol_txrx_pdev_handle pdev,
uint32_t *queue_delay_microsec,
uint32_t *tx_delay_microsec, int category)
{
- return;
}
static inline void
ol_tx_delay_hist(ol_txrx_pdev_handle pdev,
uint16_t *bin_values, int category)
{
- return;
}
static inline void
@@ -67,14 +65,12 @@ ol_tx_packet_count(ol_txrx_pdev_handle pdev,
uint16_t *out_packet_count,
uint16_t *out_packet_loss_count, int category)
{
- return;
}
static inline void
ol_tx_set_compute_interval(ol_txrx_pdev_handle pdev,
uint32_t interval)
{
- return;
}
#endif
diff --git a/dp/inc/cdp_txrx_wds.h b/dp/inc/cdp_txrx_wds.h
index f5249502625a..17c8b2711f64 100644
--- a/dp/inc/cdp_txrx_wds.h
+++ b/dp/inc/cdp_txrx_wds.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -24,7 +24,7 @@
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
- /**
+/**
* @file cdp_txrx_wds.h
* @brief Define the host data path WDS API functions
* called by the host control SW and the OS interface module
diff --git a/hif/inc/hif.h b/hif/inc/hif.h
index 0cf307b9d40d..6f9c170ddfaf 100644
--- a/hif/inc/hif.h
+++ b/hif/inc/hif.h
@@ -48,7 +48,6 @@ extern "C" {
#endif
#define ENABLE_MBOX_DUMMY_SPACE_FEATURE 1
-typedef struct htc_callbacks HTC_CALLBACKS;
typedef void __iomem *A_target_id_t;
typedef void *hif_handle_t;
@@ -115,7 +114,8 @@ struct CE_state;
#define HIF_NAPI_MAX_RECEIVES (QCA_NAPI_BUDGET * QCA_NAPI_DEF_SCALE)
/* NOTE: "napi->scale" can be changed,
- but this does not change the number of buckets */
+ * but this does not change the number of buckets
+ */
#define QCA_NAPI_NUM_BUCKETS 4
struct qca_napi_stat {
uint32_t napi_schedules;
@@ -137,7 +137,7 @@ struct qca_napi_stat {
*/
struct qca_napi_info {
struct net_device netdev; /* dummy net_dev */
- void *hif_ctx;
+ void *hif_ctx;
struct napi_struct napi;
uint8_t scale; /* currently same on all instances */
uint8_t id;
@@ -145,7 +145,7 @@ struct qca_napi_info {
int irq;
struct qca_napi_stat stats[NR_CPUS];
/* will only be present for data rx CE's */
- void (*lro_flush_cb)(void *);
+ void (*lro_flush_cb)(void *arg);
void *lro_ctx;
};
@@ -196,9 +196,10 @@ struct qca_napi_data {
qdf_spinlock_t lock;
uint32_t state;
uint32_t ce_map; /* bitmap of created/registered NAPI
- instances, indexed by pipe_id,
- not used by clients (clients use an
- id returned by create) */
+ * instances, indexed by pipe_id,
+ * not used by clients (clients use an
+ * id returned by create)
+ */
struct qca_napi_info *napis[CE_COUNT_MAX];
struct qca_napi_cpu napi_cpu[NR_CPUS];
int lilcl_head, bigcl_head;
@@ -241,17 +242,22 @@ struct hif_target_info {
struct hif_opaque_softc {
};
-typedef enum {
- HIF_DEVICE_POWER_UP, /* HIF layer should power up interface
- * and/or module */
- HIF_DEVICE_POWER_DOWN, /* HIF layer should initiate bus-specific
- * measures to minimize power */
- HIF_DEVICE_POWER_CUT /* HIF layer should initiate bus-specific
- * AND/OR platform-specific measures
- * to completely power-off the module and
- * associated hardware (i.e. cut power
- * supplies) */
-} HIF_DEVICE_POWER_CHANGE_TYPE;
+/**
+ * enum HIF_DEVICE_POWER_CHANGE_TYPE: Device Power change type
+ *
+ * @HIF_DEVICE_POWER_UP: HIF layer should power up interface and/or module
+ * @HIF_DEVICE_POWER_DOWN: HIF layer should initiate bus-specific measures to
+ * minimize power
+ * @HIF_DEVICE_POWER_CUT: HIF layer should initiate bus-specific AND/OR
+ * platform-specific measures to completely power-off
+ * the module and associated hardware (i.e. cut power
+ * supplies)
+ */
+enum HIF_DEVICE_POWER_CHANGE_TYPE {
+ HIF_DEVICE_POWER_UP,
+ HIF_DEVICE_POWER_DOWN,
+ HIF_DEVICE_POWER_CUT
+};
/**
* enum hif_enable_type: what triggered the enabling of hif
@@ -269,8 +275,7 @@ enum hif_enable_type {
* enum hif_disable_type: what triggered the disabling of hif
*
* @HIF_DISABLE_TYPE_PROBE_ERROR: probe error triggered disable
- * @HIF_DISABLE_TYPE_REINIT_ERROR: reinit error triggered
- * disable
+ * @HIF_DISABLE_TYPE_REINIT_ERROR: reinit error triggered disable
* @HIF_DISABLE_TYPE_REMOVE: remove triggered disable
* @HIF_DISABLE_TYPE_SHUTDOWN: shutdown triggered disable
*/
@@ -319,12 +324,12 @@ enum hif_device_config_opcode {
};
#ifdef CONFIG_ATH_PCIE_ACCESS_DEBUG
-typedef struct _HID_ACCESS_LOG {
+struct HID_ACCESS_LOG {
uint32_t seqnum;
bool is_write;
void *addr;
uint32_t value;
-} HIF_ACCESS_LOG;
+};
#endif
void hif_reg_write(struct hif_opaque_softc *hif_ctx, uint32_t offset,
@@ -332,11 +337,16 @@ void hif_reg_write(struct hif_opaque_softc *hif_ctx, uint32_t offset,
uint32_t hif_reg_read(struct hif_opaque_softc *hif_ctx, uint32_t offset);
#define HIF_MAX_DEVICES 1
-
+/**
+ * struct htc_callbacks - Structure for HTC Callbacks methods
+ * @context: context to pass to the dsrhandler
+ * note : rwCompletionHandler is provided the context
+ * passed to hif_read_write
+ * @rwCompletionHandler: Read / write completion handler
+ * @dsrHandler: DSR Handler
+ */
struct htc_callbacks {
- void *context; /* context to pass to the dsrhandler
- * note : rwCompletionHandler is provided
- * the context passed to hif_read_write */
+ void *context;
QDF_STATUS(*rwCompletionHandler)(void *rwContext, QDF_STATUS status);
QDF_STATUS(*dsrHandler)(void *context);
};
@@ -361,7 +371,7 @@ struct hif_driver_state_callbacks {
};
/* This API detaches the HTC layer from the HIF device */
-void hif_detach_htc(struct hif_opaque_softc *scn);
+void hif_detach_htc(struct hif_opaque_softc *hif_ctx);
/****************************************************************/
/* BMI and Diag window abstraction */
@@ -371,12 +381,14 @@ void hif_detach_htc(struct hif_opaque_softc *scn);
#define DIAG_TRANSFER_LIMIT 2048U /* maximum number of bytes that can be
* handled atomically by
- * DiagRead/DiagWrite */
+ * DiagRead/DiagWrite
+ */
/*
* API to handle HIF-specific BMI message exchanges, this API is synchronous
- * and only allowed to be called from a context that can block (sleep) */
-QDF_STATUS hif_exchange_bmi_msg(struct hif_opaque_softc *scn,
+ * and only allowed to be called from a context that can block (sleep)
+ */
+QDF_STATUS hif_exchange_bmi_msg(struct hif_opaque_softc *hif_ctx,
qdf_dma_addr_t cmd, qdf_dma_addr_t rsp,
uint8_t *pSendMessage, uint32_t Length,
uint8_t *pResponseMessage,
@@ -392,12 +404,12 @@ QDF_STATUS hif_exchange_bmi_msg(struct hif_opaque_softc *scn,
*
* hif_diag_read_mem reads an arbitrary length of arbitrarily aligned memory.
*/
-QDF_STATUS hif_diag_read_access(struct hif_opaque_softc *scn, uint32_t address,
- uint32_t *data);
-QDF_STATUS hif_diag_read_mem(struct hif_opaque_softc *scn, uint32_t address,
+QDF_STATUS hif_diag_read_access(struct hif_opaque_softc *hif_ctx,
+ uint32_t address, uint32_t *data);
+QDF_STATUS hif_diag_read_mem(struct hif_opaque_softc *hif_ctx, uint32_t address,
uint8_t *data, int nbytes);
-void hif_dump_target_memory(struct hif_opaque_softc *scn, void *ramdump_base,
- uint32_t address, uint32_t size);
+void hif_dump_target_memory(struct hif_opaque_softc *hif_ctx,
+ void *ramdump_base, uint32_t address, uint32_t size);
/*
* APIs to handle HIF specific diagnostic write accesses. These APIs are
* synchronous and only allowed to be called from a context that
@@ -409,10 +421,10 @@ void hif_dump_target_memory(struct hif_opaque_softc *scn, void *ramdump_base,
*
* hif_diag_write_mem writes an arbitrary length of arbitrarily aligned memory.
*/
-QDF_STATUS hif_diag_write_access(struct hif_opaque_softc *scn, uint32_t address,
- uint32_t data);
-QDF_STATUS hif_diag_write_mem(struct hif_opaque_softc *scn, uint32_t address,
- uint8_t *data, int nbytes);
+QDF_STATUS hif_diag_write_access(struct hif_opaque_softc *hif_ctx,
+ uint32_t address, uint32_t data);
+QDF_STATUS hif_diag_write_mem(struct hif_opaque_softc *hif_ctx,
+ uint32_t address, uint8_t *data, int nbytes);
typedef void (*fastpath_msg_handler)(void *, qdf_nbuf_t *, uint32_t);
@@ -446,7 +458,7 @@ static inline void *hif_get_ce_handle(struct hif_opaque_softc *hif_ctx, int ret)
*/
#define CONFIG_DISABLE_CDC_MAX_PERF_WAR 0
-void hif_ipa_get_ce_resource(struct hif_opaque_softc *scn,
+void hif_ipa_get_ce_resource(struct hif_opaque_softc *hif_ctx,
qdf_dma_addr_t *ce_sr_base_paddr,
uint32_t *ce_sr_ring_size,
qdf_dma_addr_t *ce_reg_paddr);
@@ -516,52 +528,51 @@ struct hif_pipe_addl_info {
};
struct hif_bus_id;
-typedef struct hif_bus_id hif_bus_id;
void hif_claim_device(struct hif_opaque_softc *hif_ctx);
QDF_STATUS hif_get_config_item(struct hif_opaque_softc *hif_ctx,
int opcode, void *config, uint32_t config_len);
void hif_set_mailbox_swap(struct hif_opaque_softc *hif_ctx);
-void hif_mask_interrupt_call(struct hif_opaque_softc *scn);
-void hif_post_init(struct hif_opaque_softc *scn, void *hHTC,
+void hif_mask_interrupt_call(struct hif_opaque_softc *hif_ctx);
+void hif_post_init(struct hif_opaque_softc *hif_ctx, void *hHTC,
struct hif_msg_callbacks *callbacks);
-QDF_STATUS hif_start(struct hif_opaque_softc *scn);
-void hif_stop(struct hif_opaque_softc *scn);
-void hif_flush_surprise_remove(struct hif_opaque_softc *scn);
-void hif_dump(struct hif_opaque_softc *scn, uint8_t CmdId, bool start);
+QDF_STATUS hif_start(struct hif_opaque_softc *hif_ctx);
+void hif_stop(struct hif_opaque_softc *hif_ctx);
+void hif_flush_surprise_remove(struct hif_opaque_softc *hif_ctx);
+void hif_dump(struct hif_opaque_softc *hif_ctx, uint8_t CmdId, bool start);
void hif_trigger_dump(struct hif_opaque_softc *hif_ctx,
uint8_t cmd_id, bool start);
-QDF_STATUS hif_send_head(struct hif_opaque_softc *scn, uint8_t PipeID,
+QDF_STATUS hif_send_head(struct hif_opaque_softc *hif_ctx, uint8_t PipeID,
uint32_t transferID, uint32_t nbytes,
qdf_nbuf_t wbuf, uint32_t data_attr);
-void hif_send_complete_check(struct hif_opaque_softc *scn, uint8_t PipeID,
+void hif_send_complete_check(struct hif_opaque_softc *hif_ctx, uint8_t PipeID,
int force);
-void hif_shut_down_device(struct hif_opaque_softc *scn);
-void hif_get_default_pipe(struct hif_opaque_softc *scn, uint8_t *ULPipe,
+void hif_shut_down_device(struct hif_opaque_softc *hif_ctx);
+void hif_get_default_pipe(struct hif_opaque_softc *hif_ctx, uint8_t *ULPipe,
uint8_t *DLPipe);
-int hif_map_service_to_pipe(struct hif_opaque_softc *scn, uint16_t svc_id,
+int hif_map_service_to_pipe(struct hif_opaque_softc *hif_ctx, uint16_t svc_id,
uint8_t *ul_pipe, uint8_t *dl_pipe, int *ul_is_polled,
int *dl_is_polled);
uint16_t
-hif_get_free_queue_number(struct hif_opaque_softc *scn, uint8_t PipeID);
-void *hif_get_targetdef(struct hif_opaque_softc *scn);
+hif_get_free_queue_number(struct hif_opaque_softc *hif_ctx, uint8_t PipeID);
+void *hif_get_targetdef(struct hif_opaque_softc *hif_ctx);
uint32_t hif_hia_item_address(uint32_t target_type, uint32_t item_offset);
-void hif_set_target_sleep(struct hif_opaque_softc *scn, bool sleep_ok,
+void hif_set_target_sleep(struct hif_opaque_softc *hif_ctx, bool sleep_ok,
bool wait_for_it);
-int hif_check_fw_reg(struct hif_opaque_softc *scn);
+int hif_check_fw_reg(struct hif_opaque_softc *hif_ctx);
#ifndef HIF_PCI
-static inline int hif_check_soc_status(struct hif_opaque_softc *scn)
+static inline int hif_check_soc_status(struct hif_opaque_softc *hif_ctx)
{
return 0;
}
#else
-int hif_check_soc_status(struct hif_opaque_softc *scn);
+int hif_check_soc_status(struct hif_opaque_softc *hif_ctx);
#endif
-void hif_get_hw_info(struct hif_opaque_softc *scn, u32 *version, u32 *revision,
- const char **target_name);
-void hif_disable_isr(struct hif_opaque_softc *scn);
-void hif_reset_soc(struct hif_opaque_softc *scn);
+void hif_get_hw_info(struct hif_opaque_softc *hif_ctx, u32 *version,
+ u32 *revision, const char **target_name);
+void hif_disable_isr(struct hif_opaque_softc *hif_ctx);
+void hif_reset_soc(struct hif_opaque_softc *hif_ctx);
void hif_save_htc_htt_config_endpoint(struct hif_opaque_softc *hif_ctx,
int htc_htt_tx_endpoint);
struct hif_opaque_softc *hif_open(qdf_device_t qdf_ctx, uint32_t mode,
@@ -569,7 +580,7 @@ struct hif_opaque_softc *hif_open(qdf_device_t qdf_ctx, uint32_t mode,
struct hif_driver_state_callbacks *cbk);
void hif_close(struct hif_opaque_softc *hif_ctx);
QDF_STATUS hif_enable(struct hif_opaque_softc *hif_ctx, struct device *dev,
- void *bdev, const hif_bus_id *bid,
+ void *bdev, const struct hif_bus_id *bid,
enum qdf_bus_type bus_type,
enum hif_enable_type type);
void hif_disable(struct hif_opaque_softc *hif_ctx, enum hif_disable_type type);
@@ -624,9 +635,9 @@ void hif_enable_power_management(struct hif_opaque_softc *hif_ctx,
bool is_packet_log_enabled);
void hif_disable_power_management(struct hif_opaque_softc *hif_ctx);
-void hif_vote_link_down(struct hif_opaque_softc *);
-void hif_vote_link_up(struct hif_opaque_softc *);
-bool hif_can_suspend_link(struct hif_opaque_softc *);
+void hif_vote_link_down(struct hif_opaque_softc *hif_ctx);
+void hif_vote_link_up(struct hif_opaque_softc *hif_ctx);
+bool hif_can_suspend_link(struct hif_opaque_softc *hif_ctx);
#ifdef IPA_OFFLOAD
/**
@@ -642,7 +653,7 @@ enum ipa_hw_type hif_get_ipa_hw_type(void)
return ipa_get_hw_type();
}
#endif
-int hif_bus_resume(struct hif_opaque_softc *);
+int hif_bus_resume(struct hif_opaque_softc *hif_ctx);
/**
* hif_bus_ealry_suspend() - stop non wmi tx traffic
* @context: hif context
@@ -654,35 +665,35 @@ int hif_bus_early_suspend(struct hif_opaque_softc *hif_ctx);
* @context: hif context
*/
int hif_bus_late_resume(struct hif_opaque_softc *hif_ctx);
-int hif_bus_suspend(struct hif_opaque_softc *);
-int hif_bus_resume_noirq(struct hif_opaque_softc *);
-int hif_bus_suspend_noirq(struct hif_opaque_softc *);
+int hif_bus_suspend(struct hif_opaque_softc *hif_ctx);
+int hif_bus_resume_noirq(struct hif_opaque_softc *hif_ctx);
+int hif_bus_suspend_noirq(struct hif_opaque_softc *hif_ctx);
#ifdef FEATURE_RUNTIME_PM
int hif_pre_runtime_suspend(struct hif_opaque_softc *hif_ctx);
void hif_pre_runtime_resume(struct hif_opaque_softc *hif_ctx);
int hif_runtime_suspend(struct hif_opaque_softc *hif_ctx);
int hif_runtime_resume(struct hif_opaque_softc *hif_ctx);
-void hif_process_runtime_suspend_success(struct hif_opaque_softc *);
-void hif_process_runtime_suspend_failure(struct hif_opaque_softc *);
-void hif_process_runtime_resume_success(struct hif_opaque_softc *);
+void hif_process_runtime_suspend_success(struct hif_opaque_softc *hif_ctx);
+void hif_process_runtime_suspend_failure(struct hif_opaque_softc *hif_ctx);
+void hif_process_runtime_resume_success(struct hif_opaque_softc *hif_ctx);
#endif
-int hif_dump_registers(struct hif_opaque_softc *scn);
-int ol_copy_ramdump(struct hif_opaque_softc *scn);
+int hif_dump_registers(struct hif_opaque_softc *hif_ctx);
+int ol_copy_ramdump(struct hif_opaque_softc *hif_ctx);
void hif_crash_shutdown(struct hif_opaque_softc *hif_ctx);
-void hif_get_hw_info(struct hif_opaque_softc *scn, u32 *version, u32 *revision,
- const char **target_name);
-void hif_lro_flush_cb_register(struct hif_opaque_softc *scn,
- void (lro_flush_handler)(void *),
+void hif_get_hw_info(struct hif_opaque_softc *hif_ctx, u32 *version,
+ u32 *revision, const char **target_name);
+void hif_lro_flush_cb_register(struct hif_opaque_softc *hif_ctx,
+ void (lro_flush_handler)(void *arg),
void *(lro_init_handler)(void));
-void hif_lro_flush_cb_deregister(struct hif_opaque_softc *scn,
- void (lro_deinit_cb)(void *));
-bool hif_needs_bmi(struct hif_opaque_softc *scn);
+void hif_lro_flush_cb_deregister(struct hif_opaque_softc *hif_ctx,
+ void (lro_deinit_cb)(void *arg));
+bool hif_needs_bmi(struct hif_opaque_softc *hif_ctx);
enum qdf_bus_type hif_get_bus_type(struct hif_opaque_softc *hif_hdl);
struct hif_target_info *hif_get_target_info_handle(struct hif_opaque_softc *
scn);
-struct hif_config_info *hif_get_ini_handle(struct hif_opaque_softc *scn);
+struct hif_config_info *hif_get_ini_handle(struct hif_opaque_softc *hif_ctx);
struct ramdump_info *hif_get_ramdump_ctx(struct hif_opaque_softc *hif_ctx);
enum hif_target_status hif_get_target_status(struct hif_opaque_softc *hif_ctx);
void hif_set_target_status(struct hif_opaque_softc *hif_ctx, enum
@@ -708,9 +719,9 @@ uint32_t hif_set_nss_wifiol_mode(struct hif_opaque_softc *osc,
int32_t hif_get_nss_wifiol_bypass_nw_process(struct hif_opaque_softc *osc);
#endif /* QCA_NSS_WIFI_OFFLOAD_SUPPORT */
-void hif_set_bundle_mode(struct hif_opaque_softc *scn, bool enabled,
+void hif_set_bundle_mode(struct hif_opaque_softc *hif_ctx, bool enabled,
int rx_bundle_cnt);
-int hif_bus_reset_resume(struct hif_opaque_softc *scn);
+int hif_bus_reset_resume(struct hif_opaque_softc *hif_ctx);
void *hif_get_lro_info(int ctx_id, struct hif_opaque_softc *hif_hdl);
#ifdef WLAN_SUSPEND_RESUME_TEST
diff --git a/hif/inc/hif_napi.h b/hif/inc/hif_napi.h
index 3ff8a3c2e02f..f682ca0c6c8e 100644
--- a/hif/inc/hif_napi.h
+++ b/hif/inc/hif_napi.h
@@ -97,11 +97,11 @@ enum qca_napi_event {
#define NAPI_PIPE2ID(p) ((p)+1)
int hif_napi_lro_flush_cb_register(struct hif_opaque_softc *hif_hdl,
- void (lro_flush_handler)(void *),
+ void (lro_flush_handler)(void *arg),
void *(lro_init_handler)(void));
void hif_napi_lro_flush_cb_deregister(struct hif_opaque_softc *hif_hdl,
- void (lro_deinit_cb)(void *));
+ void (lro_deinit_cb)(void *arg));
void *hif_napi_get_lro_info(struct hif_opaque_softc *hif_hdl, int napi_id);
#ifdef FEATURE_NAPI
@@ -157,7 +157,7 @@ static inline void hif_napi_update_yield_stats(struct CE_state *ce_state,
#ifdef FEATURE_NAPI_DEBUG
#define NAPI_DEBUG(fmt, ...) \
- qdf_print("wlan: NAPI: %s:%d "fmt, __func__, __LINE__, ##__VA_ARGS__);
+ qdf_print("wlan: NAPI: %s:%d "fmt, __func__, __LINE__, ##__VA_ARGS__)
#else
#define NAPI_DEBUG(fmt, ...) /* NO-OP */
#endif /* FEATURE NAPI_DEBUG */
@@ -173,7 +173,8 @@ enum qca_blacklist_op {
BLACKLIST_ON
};
-int hif_napi_cpu_blacklist(struct qca_napi_data *napid, enum qca_blacklist_op op);
+int hif_napi_cpu_blacklist(struct qca_napi_data *napid,
+ enum qca_blacklist_op op);
/**
* Local interface to HIF implemented functions of NAPI CPU affinity management.
* Note:
diff --git a/hif/inc/regtable_pcie.h b/hif/inc/regtable_pcie.h
index db4f580fd11e..8d02bba90882 100644
--- a/hif/inc/regtable_pcie.h
+++ b/hif/inc/regtable_pcie.h
@@ -688,7 +688,7 @@
#define AR6320V3_CPU_PLL_INIT_DONE_ADDR 0x404020
#define AR6320V3_CPU_SPEED_ADDR 0x404024
-typedef enum {
+enum a_refclk_speed_t {
SOC_REFCLK_UNKNOWN = -1, /* Unsupported ref clock -- use PLL Bypass */
SOC_REFCLK_48_MHZ = 0,
SOC_REFCLK_19_2_MHZ = 1,
@@ -698,7 +698,7 @@ typedef enum {
SOC_REFCLK_38_4_MHZ = 5,
SOC_REFCLK_40_MHZ = 6,
SOC_REFCLK_52_MHZ = 7,
-} A_refclk_speed_t;
+};
#define A_REFCLK_UNKNOWN SOC_REFCLK_UNKNOWN
#define A_REFCLK_48_MHZ SOC_REFCLK_48_MHZ
@@ -720,21 +720,21 @@ struct wlan_pll_s {
};
struct cmnos_clock_s {
- A_refclk_speed_t refclk_speed;
+ enum a_refclk_speed_t refclk_speed;
uint32_t refclk_hz;
uint32_t pll_settling_time; /* 50us */
struct wlan_pll_s wlan_pll;
};
-typedef struct TGT_REG_SECTION {
+struct tgt_reg_section {
uint32_t start_addr;
uint32_t end_addr;
-} tgt_reg_section;
+};
-typedef struct TGT_REG_TABLE {
- const tgt_reg_section *section;
+struct tgt_reg_table {
+ const struct tgt_reg_section *section;
uint32_t section_size;
-} tgt_reg_table;
+};
struct hif_softc;
void hif_target_register_tbl_attach(struct hif_softc *scn, u32 target_type);
diff --git a/hif/inc/target_reg_init.h b/hif/inc/target_reg_init.h
index a776678d9038..effc05e04109 100644
--- a/hif/inc/target_reg_init.h
+++ b/hif/inc/target_reg_init.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -21,7 +21,7 @@
#include "reg_struct.h"
#include "targaddrs.h"
/*** WARNING : Add to the end of the TABLE! do not change the order ****/
-typedef struct targetdef_s TARGET_REGISTER_TABLE;
+struct targetdef_s;
diff --git a/hif/src/ar6320def.h b/hif/src/ar6320def.h
index f03a07caa097..168333f8eaf1 100644
--- a/hif/src/ar6320def.h
+++ b/hif/src/ar6320def.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -471,15 +471,15 @@ struct targetdef_s ar6320_targetdef = {
.d_RX_MSDU_END_4_FIRST_MSDU_MASK =
AR6320_RX_MSDU_END_4_FIRST_MSDU_MASK,
.d_RX_MSDU_END_4_FIRST_MSDU_LSB = AR6320_RX_MSDU_END_4_FIRST_MSDU_LSB,
- .d_RX_MPDU_START_0_RETRY_LSB = AR6320_RX_MPDU_START_0_RETRY_LSB,
- .d_RX_MPDU_START_0_RETRY_MASK = AR6320_RX_MPDU_START_0_RETRY_MASK,
+ .d_RX_MPDU_START_0_RETRY_LSB = AR6320_RX_MPDU_START_0_RETRY_LSB,
+ .d_RX_MPDU_START_0_RETRY_MASK = AR6320_RX_MPDU_START_0_RETRY_MASK,
.d_RX_MPDU_START_0_SEQ_NUM_MASK = AR6320_RX_MPDU_START_0_SEQ_NUM_MASK,
.d_RX_MPDU_START_0_SEQ_NUM_LSB = AR6320_RX_MPDU_START_0_SEQ_NUM_LSB,
.d_RX_MPDU_START_2_PN_47_32_LSB = AR6320_RX_MPDU_START_2_PN_47_32_LSB,
.d_RX_MPDU_START_2_PN_47_32_MASK =
AR6320_RX_MPDU_START_2_PN_47_32_MASK,
- .d_RX_MPDU_START_2_TID_LSB = AR6320_RX_MPDU_START_2_TID_LSB,
- .d_RX_MPDU_START_2_TID_MASK = AR6320_RX_MPDU_START_2_TID_MASK,
+ .d_RX_MPDU_START_2_TID_LSB = AR6320_RX_MPDU_START_2_TID_LSB,
+ .d_RX_MPDU_START_2_TID_MASK = AR6320_RX_MPDU_START_2_TID_MASK,
.d_RX_MSDU_END_1_KEY_ID_OCT_MASK =
AR6320_RX_MSDU_END_1_KEY_ID_OCT_MASK,
.d_RX_MSDU_END_1_KEY_ID_OCT_LSB = AR6320_RX_MSDU_END_1_KEY_ID_OCT_LSB,
diff --git a/hif/src/ar6320v2def.h b/hif/src/ar6320v2def.h
index 7a27909cf68e..99e81bfc0f26 100644
--- a/hif/src/ar6320v2def.h
+++ b/hif/src/ar6320v2def.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -476,9 +476,9 @@ struct targetdef_s ar6320v2_targetdef = {
AR6320V2_RX_MSDU_END_4_FIRST_MSDU_MASK,
.d_RX_MSDU_END_4_FIRST_MSDU_LSB =
AR6320V2_RX_MSDU_END_4_FIRST_MSDU_LSB,
- .d_RX_MPDU_START_0_RETRY_MASK =
+ .d_RX_MPDU_START_0_RETRY_MASK =
AR6320V2_RX_MPDU_START_0_RETRY_MASK,
- .d_RX_MPDU_START_0_SEQ_NUM_MASK =
+ .d_RX_MPDU_START_0_SEQ_NUM_MASK =
AR6320V2_RX_MPDU_START_0_SEQ_NUM_MASK,
.d_RX_MPDU_START_0_SEQ_NUM_MASK =
AR6320V2_RX_MPDU_START_0_SEQ_NUM_MASK,
@@ -487,9 +487,9 @@ struct targetdef_s ar6320v2_targetdef = {
AR6320V2_RX_MPDU_START_2_PN_47_32_LSB,
.d_RX_MPDU_START_2_PN_47_32_MASK =
AR6320V2_RX_MPDU_START_2_PN_47_32_MASK,
- .d_RX_MPDU_START_2_TID_LSB =
+ .d_RX_MPDU_START_2_TID_LSB =
AR6320V2_RX_MPDU_START_2_TID_LSB,
- .d_RX_MPDU_START_2_TID_MASK =
+ .d_RX_MPDU_START_2_TID_MASK =
AR6320V2_RX_MPDU_START_2_TID_MASK,
.d_RX_MSDU_END_1_EXT_WAPI_PN_63_48_MASK =
AR6320V2_RX_MSDU_END_1_EXT_WAPI_PN_63_48_MASK,
diff --git a/hif/src/ar900Bdef.c b/hif/src/ar900Bdef.c
index b5b65f7da94b..fca5ebe89bce 100644
--- a/hif/src/ar900Bdef.c
+++ b/hif/src/ar900Bdef.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010,2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2010, 2016-2017 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -31,11 +31,11 @@
#include "AR900B/hw/si_reg.h"
#include "AR900B/extra/hw/pcie_local_reg.h"
#include "AR900B/hw/ce_wrapper_reg_csr.h"
-#if 0
-#include "hw/soc_core_reg.h"
-#include "hw/soc_pcie_reg.h"
-#include "hw/ce_reg_csr.h"
-#endif
+/* TODO
+ * #include "hw/soc_core_reg.h"
+ * #include "hw/soc_pcie_reg.h"
+ * #include "hw/ce_reg_csr.h"
+ */
#include "AR900B/extra/hw/soc_core_reg.h"
#include "AR900B/hw/soc_pcie_reg.h"
diff --git a/hif/src/ath_procfs.c b/hif/src/ath_procfs.c
index f1cb6f06fd31..2ab31972f82e 100644
--- a/hif/src/ath_procfs.c
+++ b/hif/src/ath_procfs.c
@@ -30,7 +30,7 @@
#include <linux/kernel.h> /* We're doing kernel work */
#include <linux/version.h> /* We're doing kernel work */
#include <linux/proc_fs.h> /* Necessary because we use the proc fs */
-#include <asm/uaccess.h> /* for copy_from_user */
+#include <linux/uaccess.h> /* for copy_from_user */
#include "hif.h"
#include "hif_main.h"
#if defined(HIF_USB)
@@ -112,9 +112,8 @@ out:
HIF_ERROR("%s: copy_to_user error in /proc/%s",
__func__, PROCFS_NAME);
return -EFAULT;
- } else
- qdf_mem_free(read_buffer);
-
+ }
+ qdf_mem_free(read_buffer);
return count;
}
@@ -160,6 +159,7 @@ static ssize_t ath_procfs_diag_write(struct file *file,
if ((count == 4) && ((((uint32_t) (*pos)) & 3) == 0)) {
/* reading a word? */
uint32_t value = *((uint32_t *)write_buffer);
+
rv = hif_diag_write_access(hif_hdl, (uint32_t)(*pos), value);
} else {
rv = hif_diag_write_mem(hif_hdl, (uint32_t)(*pos),
@@ -169,11 +169,10 @@ static ssize_t ath_procfs_diag_write(struct file *file,
out:
qdf_mem_free(write_buffer);
- if (rv == 0) {
+ if (rv == 0)
return count;
- } else {
+ else
return -EIO;
- }
}
static const struct file_operations athdiag_fops = {
@@ -181,8 +180,8 @@ static const struct file_operations athdiag_fops = {
.write = ath_procfs_diag_write,
};
-/**
- *This function is called when the module is loaded
+/*
+ * This function is called when the module is loaded
*
*/
int athdiag_procfs_init(void *scn)
@@ -195,8 +194,7 @@ int athdiag_procfs_init(void *scn)
return -ENOMEM;
}
- proc_file = proc_create_data(PROCFS_NAME,
- S_IRUSR | S_IWUSR, proc_dir,
+ proc_file = proc_create_data(PROCFS_NAME, 0600, proc_dir,
&athdiag_fops, (void *)scn);
if (proc_file == NULL) {
remove_proc_entry(PROCFS_NAME, proc_dir);
@@ -209,8 +207,8 @@ int athdiag_procfs_init(void *scn)
return 0; /* everything is ok */
}
-/**
- *This function is called when the module is unloaded
+/*
+ * This function is called when the module is unloaded
*
*/
void athdiag_procfs_remove(void)
diff --git a/hif/src/ce/ce_api.h b/hif/src/ce/ce_api.h
index 12e038a0a7c4..eb429e73010c 100644
--- a/hif/src/ce/ce_api.h
+++ b/hif/src/ce/ce_api.h
@@ -190,7 +190,8 @@ void ce_sendlist_init(struct ce_sendlist *sendlist);
int ce_sendlist_buf_add(struct ce_sendlist *sendlist,
qdf_dma_addr_t buffer,
unsigned int nbytes,
- uint32_t flags, /* OR-ed with internal flags */
+ /* OR-ed with internal flags */
+ uint32_t flags,
uint32_t user_flags);
/*
@@ -399,18 +400,23 @@ bool ce_get_rx_pending(struct hif_softc *scn);
#define CE_ATTR_DISABLE_INTR 0x08 /* no interrupt on copy completion */
#define CE_ATTR_ENABLE_POLL 0x10 /* poll for residue descriptors */
-/* Attributes of an instance of a Copy Engine */
+/**
+ * stuct CE_attr - Attributes of an instance of a Copy Engine
+ * @flags: CE_ATTR_* values
+ * @priority: TBD
+ * @src_nentries: #entries in source ring - Must be a power of 2
+ * @src_sz_max: Max source send size for this CE. This is also the minimum
+ * size of a destination buffer
+ * @dest_nentries: #entries in destination ring - Must be a power of 2
+ * @reserved: Future Use
+ */
struct CE_attr {
- unsigned int flags; /* CE_ATTR_* values */
- unsigned int priority; /* TBD */
- unsigned int src_nentries; /* #entries in source ring -
- * Must be a power of 2 */
- unsigned int src_sz_max; /* Max source send size for this CE.
- * This is also the minimum size of
- * a destination buffer. */
- unsigned int dest_nentries; /* #entries in destination ring -
- * Must be a power of 2 */
- void *reserved; /* Future use */
+ unsigned int flags;
+ unsigned int priority;
+ unsigned int src_nentries;
+ unsigned int src_sz_max;
+ unsigned int dest_nentries;
+ void *reserved;
};
/*
@@ -463,7 +469,6 @@ static inline void ce_ipa_get_resource(struct CE_handle *ce,
uint32_t *ce_sr_ring_size,
qdf_dma_addr_t *ce_reg_paddr)
{
- return;
}
#endif /* IPA_OFFLOAD */
@@ -482,10 +487,10 @@ bool ce_check_rx_pending(struct CE_state *CE_state);
void *hif_ce_get_lro_ctx(struct hif_opaque_softc *hif_hdl, int ctx_id);
#if defined(FEATURE_LRO)
int ce_lro_flush_cb_register(struct hif_opaque_softc *scn,
- void (handler)(void *),
+ void (handler)(void *arg),
void *(lro_init_handler)(void));
int ce_lro_flush_cb_deregister(struct hif_opaque_softc *hif_hdl,
- void (lro_deinit_cb)(void *));
+ void (lro_deinit_cb)(void *arg));
#endif
int hif_ce_bus_early_suspend(struct hif_softc *scn);
diff --git a/hif/src/ce/ce_assignment.h b/hif/src/ce/ce_assignment.h
index b7225d297905..06269f8182d8 100644
--- a/hif/src/ce/ce_assignment.h
+++ b/hif/src/ce/ce_assignment.h
@@ -58,7 +58,7 @@ ATH_DEBUG_INSTANTIATE_MODULE_VAR(hif, "hif", "PCIe Host Interface",
/* globals are initialized to 0 by the compiler */;
spinlock_t pcie_access_log_lock;
unsigned int pcie_access_log_seqnum;
-HIF_ACCESS_LOG pcie_access_log[PCIE_ACCESS_LOG_NUM];
+struct HIF_ACCESS_LOG pcie_access_log[PCIE_ACCESS_LOG_NUM];
static void hif_target_dump_access_log(void);
#endif
@@ -326,79 +326,121 @@ static struct CE_pipe_config target_ce_config_wlan_epping[] = {
#endif
static struct CE_attr host_ce_config_wlan_ar9888[] = {
- { /* CE0 */ CE_ATTR_FLAGS, 0, 16, 256, 0, NULL, }, /* host->target HTC control and raw streams */
+ /* host->target HTC control and raw streams */
+ { /* CE0 */ CE_ATTR_FLAGS, 0, 16, 256, 0, NULL, },
/* could be moved to share CE3 */
- { /* CE1 */ CE_ATTR_FLAGS, 0, 0, 512, 512, NULL, },/* target->host BMI + HTC control */
- { /* CE2 */ CE_ATTR_FLAGS, 0, 0, 2048, 128, NULL, },/* target->host WMI */
- { /* CE3 */ CE_ATTR_FLAGS, 0, 32, 2048, 0, NULL, },/* host->target WMI */
+ /* target->host BMI + HTC control */
+ { /* CE1 */ CE_ATTR_FLAGS, 0, 0, 512, 512, NULL, },
+ /* target->host WMI */
+ { /* CE2 */ CE_ATTR_FLAGS, 0, 0, 2048, 128, NULL, },
+ /* host->target WMI */
+ { /* CE3 */ CE_ATTR_FLAGS, 0, 32, 2048, 0, NULL, },
+ /* host->target HTT */
{ /* CE4 */ CE_ATTR_FLAGS | CE_ATTR_DISABLE_INTR, 0,
- CE_HTT_H2T_MSG_SRC_NENTRIES_AR900B, 256, 0, NULL, }, /* host->target HTT */
+ CE_HTT_H2T_MSG_SRC_NENTRIES_AR900B, 256, 0, NULL, },
#if WLAN_FEATURE_FASTPATH
- { /* CE5 */ CE_ATTR_FLAGS, 0, 0, 512, 512, NULL, }, /* target->host HTT messages */
-#else /* WLAN_FEATURE_FASTPATH */
- { /* CE5 */ CE_ATTR_FLAGS, 0, 0, 0, 0, NULL, }, /* unused */
-#endif /* WLAN_FEATURE_FASTPATH */
- { /* CE6 */ CE_ATTR_FLAGS, 0, 0, 0, 0, NULL, }, /* Target autonomous HIF_memcpy */
- { /* CE7 */ CE_ATTR_FLAGS, 0, 2, DIAG_TRANSFER_LIMIT, 2, NULL, }, /* ce_diag, the Diagnostic Window */
- { /* CE8 */ CE_ATTR_FLAGS, 0, 0, 0, 0, NULL, }, /* Target autonomous HIF_memcpy */
+ /* target->host HTT messages */
+ { /* CE5 */ CE_ATTR_FLAGS, 0, 0, 512, 512, NULL, },
+#else
+ /* unused */
+ { /* CE5 */ CE_ATTR_FLAGS, 0, 0, 0, 0, NULL, },
+#endif
+ /* Target autonomous HIF_memcpy */
+ { /* CE6 */ CE_ATTR_FLAGS, 0, 0, 0, 0, NULL, },
+ /* ce_diag, the Diagnostic Window */
+ { /* CE7 */ CE_ATTR_FLAGS, 0, 2, DIAG_TRANSFER_LIMIT, 2, NULL, },
+ /* Target autonomous HIF_memcpy */
+ { /* CE8 */ CE_ATTR_FLAGS, 0, 0, 0, 0, NULL, },
};
static struct CE_attr host_ce_config_wlan_ar900b[] = {
- { /* CE0 */ CE_ATTR_FLAGS, 0, 16, 256, 0, NULL, }, /* host->target HTC control and raw streams */
+ /* host->target HTC control and raw streams */
+ { /* CE0 */ CE_ATTR_FLAGS, 0, 16, 256, 0, NULL, },
/* could be moved to share CE3 */
- { /* CE1 */ CE_ATTR_FLAGS, 0, 0, 512, 512, NULL, },/* target->host BMI + HTC control */
- { /* CE2 */ CE_ATTR_FLAGS, 0, 0, 2048, 128, NULL, },/* target->host WMI */
- { /* CE3 */ CE_ATTR_FLAGS, 0, 32, 2048, 0, NULL, },/* host->target WMI */
+ /* target->host BMI + HTC control */
+ { /* CE1 */ CE_ATTR_FLAGS, 0, 0, 512, 512, NULL, },
+ /* target->host WMI */
+ { /* CE2 */ CE_ATTR_FLAGS, 0, 0, 2048, 128, NULL, },
+ /* host->target WMI */
+ { /* CE3 */ CE_ATTR_FLAGS, 0, 32, 2048, 0, NULL, },
+ /* host->target HTT */
{ /* CE4 */ CE_ATTR_FLAGS | CE_ATTR_DISABLE_INTR, 0,
- CE_HTT_H2T_MSG_SRC_NENTRIES_AR900B, 256, 0, NULL, }, /* host->target HTT */
+ CE_HTT_H2T_MSG_SRC_NENTRIES_AR900B, 256, 0, NULL, },
#if WLAN_FEATURE_FASTPATH
- { /* CE5 */ CE_ATTR_FLAGS, 0, 0, 512, 512, NULL, }, /* target->host HTT messages */
-#else /* WLAN_FEATURE_FASTPATH */
- { /* CE5 */ CE_ATTR_FLAGS, 0, 0, 0, 0, NULL, }, /* unused */
-#endif /* WLAN_FEATURE_FASTPATH */
- { /* CE6 */ CE_ATTR_FLAGS, 0, 0, 0, 0, NULL, }, /* Target autonomous HIF_memcpy */
- { /* CE7 */ CE_ATTR_FLAGS, 0, 2, DIAG_TRANSFER_LIMIT, 2, NULL, }, /* ce_diag, the Diagnostic Window */
- { /* CE8 */ CE_ATTR_FLAGS, 0, 0, 2048, 128, NULL, },/* target->host pktlog */
- { /* CE9 */ CE_ATTR_FLAGS, 0, 0, 0, 0, NULL, }, /* Target autonomous HIF_memcpy */
- { /* CE10 */ CE_ATTR_FLAGS, 0, 0, 0, 0, NULL, }, /* Target autonomous HIF_memcpy */
- { /* CE11 */ CE_ATTR_FLAGS, 0, 0, 0, 0, NULL, }, /* Target autonomous HIF_memcpy */
+ /* target->host HTT messages */
+ { /* CE5 */ CE_ATTR_FLAGS, 0, 0, 512, 512, NULL, },
+#else
+ /* Unused */
+ { /* CE5 */ CE_ATTR_FLAGS, 0, 0, 0, 0, NULL, },
+#endif
+ /* Target autonomous HIF_memcpy */
+ { /* CE6 */ CE_ATTR_FLAGS, 0, 0, 0, 0, NULL, },
+ /* ce_diag, the Diagnostic Window */
+ { /* CE7 */ CE_ATTR_FLAGS, 0, 2, DIAG_TRANSFER_LIMIT, 2, NULL, },
+ /* target->host pktlog */
+ { /* CE8 */ CE_ATTR_FLAGS, 0, 0, 2048, 128, NULL, },
+ /* Target autonomous HIF_memcpy */
+ { /* CE9 */ CE_ATTR_FLAGS, 0, 0, 0, 0, NULL, },
+ /* Target autonomous HIF_memcpy */
+ { /* CE10 */ CE_ATTR_FLAGS, 0, 0, 0, 0, NULL, },
+ /* Target autonomous HIF_memcpy */
+ { /* CE11 */ CE_ATTR_FLAGS, 0, 0, 0, 0, NULL, },
};
static struct CE_pipe_config target_ce_config_wlan_ar9888[] = {
- { /* CE0 */ 0, PIPEDIR_OUT, 32, 256, CE_ATTR_FLAGS, 0, }, /* host->target HTC control and raw streams */
- { /* CE1 */ 1, PIPEDIR_IN, 32, 512, CE_ATTR_FLAGS, 0, }, /* target->host HTC control */
- { /* CE2 */ 2, PIPEDIR_IN, 64, 2048, CE_ATTR_FLAGS, 0, }, /* target->host WMI */
- { /* CE3 */ 3, PIPEDIR_OUT, 32, 2048, CE_ATTR_FLAGS, 0, }, /* host->target WMI */
- { /* CE4 */ 4, PIPEDIR_OUT, 256, 256, CE_ATTR_FLAGS, 0, }, /* host->target HTT */
+ /* host->target HTC control and raw streams */
+ { /* CE0 */ 0, PIPEDIR_OUT, 32, 256, CE_ATTR_FLAGS, 0, },
+ /* target->host HTC control */
+ { /* CE1 */ 1, PIPEDIR_IN, 32, 512, CE_ATTR_FLAGS, 0, },
+ /* target->host WMI */
+ { /* CE2 */ 2, PIPEDIR_IN, 64, 2048, CE_ATTR_FLAGS, 0, },
+ /* host->target WMI */
+ { /* CE3 */ 3, PIPEDIR_OUT, 32, 2048, CE_ATTR_FLAGS, 0, },
+ /* host->target HTT */
+ { /* CE4 */ 4, PIPEDIR_OUT, 256, 256, CE_ATTR_FLAGS, 0, },
/* NB: 50% of src nentries, since tx has 2 frags */
#if WLAN_FEATURE_FASTPATH
- { /* CE5 */ 5, PIPEDIR_IN, 32, 512, CE_ATTR_FLAGS, 0, }, /* target->host HTT */
+ /* target->host HTT */
+ { /* CE5 */ 5, PIPEDIR_IN, 32, 512, CE_ATTR_FLAGS, 0, },
#else
- { /* CE5 */ 5, PIPEDIR_OUT, 32, 2048, CE_ATTR_FLAGS, 0, }, /* unused */
+ /* unused */
+ { /* CE5 */ 5, PIPEDIR_OUT, 32, 2048, CE_ATTR_FLAGS, 0, },
#endif
- { /* CE6 */ 6, PIPEDIR_INOUT, 32, 4096, CE_ATTR_FLAGS, 0, },/* Reserved for target autonomous HIF_memcpy */
+ /* Reserved for target autonomous HIF_memcpy */
+ { /* CE6 */ 6, PIPEDIR_INOUT, 32, 4096, CE_ATTR_FLAGS, 0, },
/* CE7 used only by Host */
};
static struct CE_pipe_config target_ce_config_wlan_ar900b[] = {
- { /* CE0 */ 0, PIPEDIR_OUT, 32, 256, CE_ATTR_FLAGS, 0, }, /* host->target HTC control and raw streams */
- { /* CE1 */ 1, PIPEDIR_IN, 32, 512, CE_ATTR_FLAGS, 0, }, /* target->host HTC control */
- { /* CE2 */ 2, PIPEDIR_IN, 64, 2048, CE_ATTR_FLAGS, 0, }, /* target->host WMI */
- { /* CE3 */ 3, PIPEDIR_OUT, 32, 2048, CE_ATTR_FLAGS, 0, }, /* host->target WMI */
- { /* CE4 */ 4, PIPEDIR_OUT, 256, 256, CE_ATTR_FLAGS, 0, }, /* host->target HTT */
+ /* host->target HTC control and raw streams */
+ { /* CE0 */ 0, PIPEDIR_OUT, 32, 256, CE_ATTR_FLAGS, 0, },
+ /* target->host HTC control */
+ { /* CE1 */ 1, PIPEDIR_IN, 32, 512, CE_ATTR_FLAGS, 0, },
+ /* target->host WMI */
+ { /* CE2 */ 2, PIPEDIR_IN, 64, 2048, CE_ATTR_FLAGS, 0, },
+ /* host->target WMI */
+ { /* CE3 */ 3, PIPEDIR_OUT, 32, 2048, CE_ATTR_FLAGS, 0, },
+ /* host->target HTT */
+ { /* CE4 */ 4, PIPEDIR_OUT, 256, 256, CE_ATTR_FLAGS, 0, },
/* NB: 50% of src nentries, since tx has 2 frags */
#if WLAN_FEATURE_FASTPATH
- { /* CE5 */ 5, PIPEDIR_IN, 32, 512, CE_ATTR_FLAGS, 0, }, /* target->host HTT */
+ /* target->host HTT */
+ { /* CE5 */ 5, PIPEDIR_IN, 32, 512, CE_ATTR_FLAGS, 0, },
#else
- { /* CE5 */ 5, PIPEDIR_OUT, 32, 2048, CE_ATTR_FLAGS, 0, }, /* unused */
+ /* unused */
+ { /* CE5 */ 5, PIPEDIR_OUT, 32, 2048, CE_ATTR_FLAGS, 0, },
#endif
- { /* CE6 */ 6, PIPEDIR_INOUT, 32, 4096, CE_ATTR_FLAGS, 0, },/* Reserved for target autonomous HIF_memcpy */
- { /* CE7 */ 7, PIPEDIR_INOUT, 0, 0, 0, 0, }, /* CE7 used only by Host */
+ /* Reserved for target autonomous HIF_memcpy */
+ { /* CE6 */ 6, PIPEDIR_INOUT, 32, 4096, CE_ATTR_FLAGS, 0, },
+ /* CE7 used only by Host */
+ { /* CE7 */ 7, PIPEDIR_INOUT, 0, 0, 0, 0, },
+ /* target->host packtlog */
{ /* CE8 */ 8, PIPEDIR_IN, 64, 2048, CE_ATTR_FLAGS
- | CE_ATTR_DISABLE_INTR, 0, }, /* target->host packtlog */
+ | CE_ATTR_DISABLE_INTR, 0, },
#if PEER_CACHEING_HOST_ENABLE
+ /* target autonomous qcache memcpy */
{ /* CE9 */ 9, PIPEDIR_INOUT, 32, 2048, CE_ATTR_FLAGS |
- CE_ATTR_DISABLE_INTR, 0, }, /* target autonomous qcache memcpy */
+ CE_ATTR_DISABLE_INTR, 0, },
#endif
};
diff --git a/hif/src/ce/ce_bmi.c b/hif/src/ce/ce_bmi.c
index 15fcdcbf5aa2..e5124da8702e 100644
--- a/hif/src/ce/ce_bmi.c
+++ b/hif/src/ce/ce_bmi.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -95,7 +95,8 @@ void hif_bmi_send_done(struct CE_handle *copyeng, void *ce_context,
transaction->bmi_transaction_flags |= BMI_REQ_SEND_DONE;
/* resp is't needed or has already been received,
- * never assume resp comes later then this */
+ * never assume resp comes later then this
+ */
if (!transaction->bmi_response_CE ||
(transaction->bmi_transaction_flags & BMI_RESP_RECV_DONE)) {
qdf_semaphore_release(&transaction->bmi_transaction_sem);
@@ -116,9 +117,8 @@ void hif_bmi_recv_data(struct CE_handle *copyeng, void *ce_context,
transaction->bmi_transaction_flags |= BMI_RESP_RECV_DONE;
/* when both send/recv are done, the sem can be released */
- if (transaction->bmi_transaction_flags & BMI_REQ_SEND_DONE) {
+ if (transaction->bmi_transaction_flags & BMI_REQ_SEND_DONE)
qdf_semaphore_release(&transaction->bmi_transaction_sem);
- }
}
#endif
@@ -192,7 +192,8 @@ QDF_STATUS hif_exchange_bmi_msg(struct hif_opaque_softc *hif_ctx,
transaction->bmi_response_host = bmi_response;
transaction->bmi_response_CE = CE_response;
/* dma_cache_sync(dev, bmi_response,
- BMI_DATASZ_MAX, DMA_FROM_DEVICE); */
+ * BMI_DATASZ_MAX, DMA_FROM_DEVICE);
+ */
qdf_mem_dma_sync_single_for_device(scn->qdf_dev,
CE_response,
BMI_DATASZ_MAX,
@@ -220,7 +221,8 @@ QDF_STATUS hif_exchange_bmi_msg(struct hif_opaque_softc *hif_ctx,
/* Wait for BMI request/response transaction to complete */
/* Always just wait for BMI request here if
- * BMI_RSP_POLLING is defined */
+ * BMI_RSP_POLLING is defined
+ */
while (qdf_semaphore_acquire
(&transaction->bmi_transaction_sem)) {
/*need some break out condition(time out?) */
@@ -258,10 +260,11 @@ QDF_STATUS hif_exchange_bmi_msg(struct hif_opaque_softc *hif_ctx,
}
/* dma_unmap_single(dev, transaction->bmi_request_CE,
- request_length, DMA_TO_DEVICE); */
- /* bus_unmap_single(scn->sc_osdev,
- transaction->bmi_request_CE,
- request_length, BUS_DMA_TODEVICE); */
+ * request_length, DMA_TO_DEVICE);
+ * bus_unmap_single(scn->sc_osdev,
+ * transaction->bmi_request_CE,
+ * request_length, BUS_DMA_TODEVICE);
+ */
if (status != QDF_STATUS_SUCCESS) {
qdf_dma_addr_t unused_buffer;
diff --git a/hif/src/ce/ce_diag.c b/hif/src/ce/ce_diag.c
index dd6fdf3e1828..42eb76c0829a 100644
--- a/hif/src/ce/ce_diag.c
+++ b/hif/src/ce/ce_diag.c
@@ -251,7 +251,8 @@ QDF_STATUS hif_diag_read_mem(struct hif_opaque_softc *hif_ctx,
}
/* Request CE to send from Target(!)
- * address to Host buffer */
+ * address to Host buffer
+ */
status = ce_send(ce_diag, NULL, ce_phy_addr, nbytes,
transaction_id, 0, user_flags);
if (status != QDF_STATUS_SUCCESS)
@@ -365,6 +366,7 @@ QDF_STATUS hif_diag_write_mem(struct hif_opaque_softc *hif_ctx,
unsigned int toeplitz_hash_result;
unsigned int user_flags = 0;
unsigned int target_type = 0;
+
ce_diag = hif_state->ce_diag;
transaction_id = (mux_id & MUX_ID_MASK) |
(transaction_id & TRANSACTION_ID_MASK);
@@ -487,7 +489,7 @@ done:
}
if (status != QDF_STATUS_SUCCESS) {
- HIF_ERROR("%s failure (0x%llu)", __func__,
+ HIF_ERROR("%s failure (0x%llx)", __func__,
(uint64_t)ce_phy_addr);
}
diff --git a/hif/src/ce/ce_internal.h b/hif/src/ce/ce_internal.h
index b0e2f38d4359..4a9592e6481d 100644
--- a/hif/src/ce/ce_internal.h
+++ b/hif/src/ce/ce_internal.h
@@ -134,14 +134,13 @@ struct CE_state {
atomic_t rx_pending;
qdf_spinlock_t ce_index_lock;
- bool force_break; /* Flag to indicate whether to
- * break out the DPC context */
+ /* Flag to indicate whether to break out the DPC context */
+ bool force_break;
/* time in nanoseconds to yield control of napi poll */
unsigned long long ce_service_yield_time;
- unsigned int receive_count; /* count Num Of Receive Buffers
- * handled for one interrupt
- * DPC routine */
+ /* Num Of Receive Buffers handled for one interrupt DPC routine */
+ unsigned int receive_count;
/* epping */
bool timer_inited;
qdf_timer_t poll_timer;
@@ -395,7 +394,8 @@ struct ce_sendlist_s {
unsigned int ndesc; /* Rx descriptor list */
} u;
/* flags: externally-specified flags;
- * OR-ed with internal flags */
+ * OR-ed with internal flags
+ */
uint32_t flags;
uint32_t user_flags;
} item[CE_SENDLIST_ITEMS_MAX];
diff --git a/hif/src/ce/ce_main.c b/hif/src/ce/ce_main.c
index f7ba7991b4f8..daad5de69a08 100644
--- a/hif/src/ce/ce_main.c
+++ b/hif/src/ce/ce_main.c
@@ -135,6 +135,7 @@ void hif_trigger_dump(struct hif_opaque_softc *hif_ctx,
static void ce_poll_timeout(void *arg)
{
struct CE_state *CE_state = (struct CE_state *)arg;
+
if (CE_state->timer_inited) {
ce_per_engine_service(CE_state->scn, CE_state->id);
qdf_timer_mod(&CE_state->poll_timer, CE_POLL_TIMEOUT);
@@ -591,6 +592,7 @@ int hif_ce_bus_early_suspend(struct hif_softc *scn)
uint8_t ul_pipe, dl_pipe;
int ce_id, status, ul_is_polled, dl_is_polled;
struct CE_state *ce_state;
+
status = hif_map_service_to_pipe(&scn->osc, WMI_CONTROL_SVC,
&ul_pipe, &dl_pipe,
&ul_is_polled, &dl_is_polled);
@@ -620,7 +622,6 @@ int hif_ce_bus_late_resume(struct hif_softc *scn)
int ce_id;
struct CE_state *ce_state;
int write_index;
- bool index_updated;
for (ce_id = 0; ce_id < scn->ce_count; ce_id++) {
ce_state = scn->ce_id_to_state[ce_id];
@@ -630,19 +631,14 @@ int hif_ce_bus_late_resume(struct hif_softc *scn)
CE_SRC_RING_WRITE_IDX_SET(scn, ce_state->ctrl_addr,
write_index);
ce_state->state = CE_RUNNING;
- index_updated = true;
- } else {
- index_updated = false;
+ hif_record_ce_desc_event(scn, ce_id,
+ RESUME_WRITE_INDEX_UPDATE,
+ NULL, NULL, write_index);
}
if (ce_state->state == CE_PAUSED)
ce_state->state = CE_RUNNING;
qdf_spin_unlock_bh(&ce_state->ce_index_lock);
-
- if (index_updated)
- hif_record_ce_desc_event(scn, ce_id,
- RESUME_WRITE_INDEX_UPDATE,
- NULL, NULL, write_index);
}
return 0;
@@ -727,9 +723,10 @@ struct CE_handle *ce_init(struct hif_softc *scn,
nentries = attr->src_nentries;
if (nentries) {
struct CE_ring_state *src_ring;
- unsigned CE_nbytes;
+ unsigned int CE_nbytes;
char *ptr;
uint64_t dma_addr;
+
nentries = roundup_pwr2(nentries);
if (CE_state->src_ring) {
QDF_ASSERT(CE_state->src_ring->nentries == nentries);
@@ -749,13 +746,11 @@ struct CE_handle *ce_init(struct hif_softc *scn,
malloc_CE_state = false;
}
return NULL;
- } else {
- /* we can allocate src ring.
- * Mark that the src ring is
- * allocated locally
- */
- malloc_src_ring = true;
}
+ /* we can allocate src ring. Mark that the src ring is
+ * allocated locally
+ */
+ malloc_src_ring = true;
src_ring = CE_state->src_ring =
(struct CE_ring_state *)ptr;
@@ -848,6 +843,7 @@ struct CE_handle *ce_init(struct hif_softc *scn,
/* if SR_BA_ADDRESS_HIGH register exists */
if (is_register_supported(SR_BA_ADDRESS_HIGH)) {
uint32_t tmp;
+
tmp = CE_SRC_RING_BASE_ADDR_HIGH_GET(
scn, ctrl_addr);
tmp &= ~0x1F;
@@ -872,7 +868,7 @@ struct CE_handle *ce_init(struct hif_softc *scn,
nentries = attr->dest_nentries;
if (nentries) {
struct CE_ring_state *dest_ring;
- unsigned CE_nbytes;
+ unsigned int CE_nbytes;
char *ptr;
uint64_t dma_addr;
@@ -918,7 +914,8 @@ struct CE_handle *ce_init(struct hif_softc *scn,
dest_ring->per_transfer_context = (void **)ptr;
/* Legacy platforms that do not support cache
- * coherent DMA are unsupported */
+ * coherent DMA are unsupported
+ */
dest_ring->base_addr_owner_space_unaligned =
qdf_mem_alloc_consistent(scn->qdf_dev,
scn->qdf_dev->dev,
@@ -975,6 +972,7 @@ struct CE_handle *ce_init(struct hif_softc *scn,
/* if DR_BA_ADDRESS_HIGH exists */
if (is_register_supported(DR_BA_ADDRESS_HIGH)) {
uint32_t tmp;
+
tmp = CE_DEST_RING_BASE_ADDR_HIGH_GET(scn,
ctrl_addr);
tmp &= ~0x1F;
@@ -1091,13 +1089,13 @@ void *hif_get_ce_handle(struct hif_opaque_softc *hif_ctx, int id)
*
* Return: none
*/
-void
-ce_h2t_tx_ce_cleanup(struct CE_handle *ce_hdl)
+void ce_h2t_tx_ce_cleanup(struct CE_handle *ce_hdl)
{
struct CE_state *ce_state = (struct CE_state *)ce_hdl;
struct CE_ring_state *src_ring = ce_state->src_ring;
struct hif_softc *sc = ce_state->scn;
uint32_t sw_index, write_index;
+
if (hif_is_nss_wifi_enabled(sc))
return;
@@ -1378,9 +1376,8 @@ void hif_send_complete_check(struct hif_opaque_softc *hif_ctx, uint8_t pipe,
* If at least 50% of the total resources are still available,
* don't bother checking again yet.
*/
- if (resources > (host_ce_config[pipe].src_nentries >> 1)) {
+ if (resources > (host_ce_config[pipe].src_nentries >> 1))
return;
- }
}
#if ATH_11AC_TXCOMPACT
ce_per_engine_servicereap(scn, pipe);
@@ -1510,7 +1507,8 @@ hif_pci_ce_recv_data(struct CE_handle *copyeng, void *ce_context,
nbytes, pipe_info);
/* Set up force_break flag if num of receices reaches
- * MAX_NUM_OF_RECEIVES */
+ * MAX_NUM_OF_RECEIVES
+ */
ce_state->receive_count++;
if (qdf_unlikely(hif_ce_service_should_yield(scn, ce_state))) {
ce_state->force_break = 1;
@@ -1567,9 +1565,9 @@ static int hif_completion_thread_startup(struct HIF_CE_state *hif_state)
struct HIF_CE_pipe_info *pipe_info;
pipe_info = &hif_state->pipe_info[pipe_num];
- if (pipe_info->ce_hdl == ce_diag) {
+ if (pipe_info->ce_hdl == ce_diag)
continue; /* Handle Diagnostic CE specially */
- }
+
attr = host_ce_config[pipe_num];
if (attr.src_nentries) {
/* pipe used to send to target */
@@ -1788,13 +1786,13 @@ static int hif_post_recv_buffers(struct hif_softc *scn)
A_TARGET_ACCESS_LIKELY(scn);
for (pipe_num = 0; pipe_num < scn->ce_count; pipe_num++) {
struct HIF_CE_pipe_info *pipe_info;
+
ce_state = scn->ce_id_to_state[pipe_num];
pipe_info = &hif_state->pipe_info[pipe_num];
if (hif_is_nss_wifi_enabled(scn) &&
- ce_state && (ce_state->htt_rx_data)) {
+ ce_state && (ce_state->htt_rx_data))
continue;
- }
hif_post_recv_buffers_for_pipe(pipe_info);
}
@@ -1840,22 +1838,20 @@ static void hif_recv_buffer_cleanup_on_pipe(struct HIF_CE_pipe_info *pipe_info)
void *per_CE_context;
buf_sz = pipe_info->buf_sz;
- if (buf_sz == 0) {
- /* Unused Copy Engine */
+ /* Unused Copy Engine */
+ if (buf_sz == 0)
return;
- }
+
hif_state = pipe_info->HIF_CE_state;
- if (!hif_state->started) {
+ if (!hif_state->started)
return;
- }
scn = HIF_GET_SOFTC(hif_state);
ce_hdl = pipe_info->ce_hdl;
- if (scn->qdf_dev == NULL) {
+ if (scn->qdf_dev == NULL)
return;
- }
while (ce_revoke_recv_next
(ce_hdl, &per_CE_context, (void **)&netbuf,
&CE_data) == QDF_STATUS_SUCCESS) {
@@ -1909,7 +1905,8 @@ static void hif_send_buffer_cleanup_on_pipe(struct HIF_CE_pipe_info *pipe_info)
if (id == scn->htc_htt_tx_endpoint)
return;
/* Indicate the completion to higher
- * layer to free the buffer */
+ * layer to free the buffer
+ */
if (hif_state->msg_callbacks_current.
txCompletionHandler)
hif_state->msg_callbacks_current.
@@ -2233,7 +2230,6 @@ static void hif_post_static_buf_to_target(struct hif_softc *scn)
#else
static inline void hif_post_static_buf_to_target(struct hif_softc *scn)
{
- return;
}
#endif
@@ -2282,6 +2278,7 @@ int hif_config_ce(struct hif_softc *scn)
scn->ce_count = HOST_CE_COUNT;
for (pipe_num = 0; pipe_num < scn->ce_count; pipe_num++) {
struct CE_attr *attr;
+
pipe_info = &hif_state->pipe_info[pipe_num];
pipe_info->pipe_num = pipe_num;
pipe_info->HIF_CE_state = hif_state;
@@ -2298,7 +2295,8 @@ int hif_config_ce(struct hif_softc *scn)
if (pipe_num == DIAG_CE_ID) {
/* Reserve the ultimate CE for
- * Diagnostic Window support */
+ * Diagnostic Window support
+ */
hif_state->ce_diag = pipe_info->ce_hdl;
continue;
}
@@ -2415,7 +2413,6 @@ void hif_ce_ipa_get_ce_resource(struct hif_softc *scn,
ce_ipa_get_resource(ce_hdl, ce_sr_base_paddr, ce_sr_ring_size,
ce_reg_paddr);
- return;
}
#endif /* IPA_OFFLOAD */
@@ -2423,71 +2420,71 @@ void hif_ce_ipa_get_ce_resource(struct hif_softc *scn,
#ifdef ADRASTEA_SHADOW_REGISTERS
/*
- Current shadow register config
-
- -----------------------------------------------------------
- Shadow Register | CE | src/dst write index
- -----------------------------------------------------------
- 0 | 0 | src
- 1 No Config - Doesn't point to anything
- 2 No Config - Doesn't point to anything
- 3 | 3 | src
- 4 | 4 | src
- 5 | 5 | src
- 6 No Config - Doesn't point to anything
- 7 | 7 | src
- 8 No Config - Doesn't point to anything
- 9 No Config - Doesn't point to anything
- 10 No Config - Doesn't point to anything
- 11 No Config - Doesn't point to anything
- -----------------------------------------------------------
- 12 No Config - Doesn't point to anything
- 13 | 1 | dst
- 14 | 2 | dst
- 15 No Config - Doesn't point to anything
- 16 No Config - Doesn't point to anything
- 17 No Config - Doesn't point to anything
- 18 No Config - Doesn't point to anything
- 19 | 7 | dst
- 20 | 8 | dst
- 21 No Config - Doesn't point to anything
- 22 No Config - Doesn't point to anything
- 23 No Config - Doesn't point to anything
- -----------------------------------------------------------
-
-
- ToDo - Move shadow register config to following in the future
- This helps free up a block of shadow registers towards the end.
- Can be used for other purposes
-
- -----------------------------------------------------------
- Shadow Register | CE | src/dst write index
- -----------------------------------------------------------
- 0 | 0 | src
- 1 | 3 | src
- 2 | 4 | src
- 3 | 5 | src
- 4 | 7 | src
- -----------------------------------------------------------
- 5 | 1 | dst
- 6 | 2 | dst
- 7 | 7 | dst
- 8 | 8 | dst
- -----------------------------------------------------------
- 9 No Config - Doesn't point to anything
- 12 No Config - Doesn't point to anything
- 13 No Config - Doesn't point to anything
- 14 No Config - Doesn't point to anything
- 15 No Config - Doesn't point to anything
- 16 No Config - Doesn't point to anything
- 17 No Config - Doesn't point to anything
- 18 No Config - Doesn't point to anything
- 19 No Config - Doesn't point to anything
- 20 No Config - Doesn't point to anything
- 21 No Config - Doesn't point to anything
- 22 No Config - Doesn't point to anything
- 23 No Config - Doesn't point to anything
- -----------------------------------------------------------
+ * Current shadow register config
+ *
+ * -----------------------------------------------------------
+ * Shadow Register | CE | src/dst write index
+ * -----------------------------------------------------------
+ * 0 | 0 | src
+ * 1 No Config - Doesn't point to anything
+ * 2 No Config - Doesn't point to anything
+ * 3 | 3 | src
+ * 4 | 4 | src
+ * 5 | 5 | src
+ * 6 No Config - Doesn't point to anything
+ * 7 | 7 | src
+ * 8 No Config - Doesn't point to anything
+ * 9 No Config - Doesn't point to anything
+ * 10 No Config - Doesn't point to anything
+ * 11 No Config - Doesn't point to anything
+ * -----------------------------------------------------------
+ * 12 No Config - Doesn't point to anything
+ * 13 | 1 | dst
+ * 14 | 2 | dst
+ * 15 No Config - Doesn't point to anything
+ * 16 No Config - Doesn't point to anything
+ * 17 No Config - Doesn't point to anything
+ * 18 No Config - Doesn't point to anything
+ * 19 | 7 | dst
+ * 20 | 8 | dst
+ * 21 No Config - Doesn't point to anything
+ * 22 No Config - Doesn't point to anything
+ * 23 No Config - Doesn't point to anything
+ * -----------------------------------------------------------
+ *
+ *
+ * ToDo - Move shadow register config to following in the future
+ * This helps free up a block of shadow registers towards the end.
+ * Can be used for other purposes
+ *
+ * -----------------------------------------------------------
+ * Shadow Register | CE | src/dst write index
+ * -----------------------------------------------------------
+ * 0 | 0 | src
+ * 1 | 3 | src
+ * 2 | 4 | src
+ * 3 | 5 | src
+ * 4 | 7 | src
+ * -----------------------------------------------------------
+ * 5 | 1 | dst
+ * 6 | 2 | dst
+ * 7 | 7 | dst
+ * 8 | 8 | dst
+ * -----------------------------------------------------------
+ * 9 No Config - Doesn't point to anything
+ * 12 No Config - Doesn't point to anything
+ * 13 No Config - Doesn't point to anything
+ * 14 No Config - Doesn't point to anything
+ * 15 No Config - Doesn't point to anything
+ * 16 No Config - Doesn't point to anything
+ * 17 No Config - Doesn't point to anything
+ * 18 No Config - Doesn't point to anything
+ * 19 No Config - Doesn't point to anything
+ * 20 No Config - Doesn't point to anything
+ * 21 No Config - Doesn't point to anything
+ * 22 No Config - Doesn't point to anything
+ * 23 No Config - Doesn't point to anything
+ * -----------------------------------------------------------
*/
u32 shadow_sr_wr_ind_addr(struct hif_softc *scn, u32 ctrl_addr)
@@ -2842,6 +2839,7 @@ static inline void hif_config_rri_on_ddr(struct hif_softc *scn)
unsigned int i;
qdf_dma_addr_t paddr_rri_on_ddr;
uint32_t high_paddr, low_paddr;
+
scn->vaddr_rri_on_ddr =
(uint32_t *)qdf_mem_alloc_consistent(scn->qdf_dev,
scn->qdf_dev->dev, (CE_COUNT*sizeof(uint32_t)),
@@ -2861,7 +2859,6 @@ static inline void hif_config_rri_on_ddr(struct hif_softc *scn)
qdf_mem_zero(scn->vaddr_rri_on_ddr, CE_COUNT*sizeof(uint32_t));
- return;
}
static inline void hif_clear_rri_on_ddr(struct hif_softc *scn)
@@ -2889,7 +2886,6 @@ static inline void hif_clear_rri_on_ddr(struct hif_softc *scn)
*/
static inline void hif_config_rri_on_ddr(struct hif_softc *scn)
{
- return;
}
static inline void hif_clear_rri_on_ddr(struct hif_softc *scn)
@@ -2926,8 +2922,8 @@ int hif_dump_ce_registers(struct hif_softc *scn)
ce_reg_word_size * sizeof(uint32_t));
if (status != QDF_STATUS_SUCCESS) {
- HIF_ERROR("Dumping CE register failed!");
- return -EACCES;
+ HIF_ERROR("Dumping CE register failed!");
+ return -EACCES;
}
HIF_ERROR("CE%d Registers:", i);
qdf_trace_hex_dump(QDF_MODULE_ID_HIF, QDF_TRACE_LEVEL_DEBUG,
diff --git a/hif/src/ce/ce_main.h b/hif/src/ce/ce_main.h
index 4a68618bd1bc..317e610be95a 100644
--- a/hif/src/ce/ce_main.h
+++ b/hif/src/ce/ce_main.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -181,7 +181,6 @@ void hif_ce_ipa_get_ce_resource(struct hif_softc *scn,
uint32_t *ce_sr_ring_size,
qdf_dma_addr_t *ce_reg_paddr)
{
- return;
}
#endif
diff --git a/hif/src/ce/ce_reg.h b/hif/src/ce/ce_reg.h
index 297e88f7c25b..ceaeea0acfb5 100644
--- a/hif/src/ce/ce_reg.h
+++ b/hif/src/ce/ce_reg.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -40,56 +40,71 @@
#define CURRENT_SRRI_ADDRESS (scn->target_ce_def->d_CURRENT_SRRI_ADDRESS)
#define CURRENT_DRRI_ADDRESS (scn->target_ce_def->d_CURRENT_DRRI_ADDRESS)
-#define SHADOW_VALUE0 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_0)
-#define SHADOW_VALUE1 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_1)
-#define SHADOW_VALUE2 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_2)
-#define SHADOW_VALUE3 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_3)
-#define SHADOW_VALUE4 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_4)
-#define SHADOW_VALUE5 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_5)
-#define SHADOW_VALUE6 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_6)
-#define SHADOW_VALUE7 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_7)
-#define SHADOW_VALUE8 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_8)
-#define SHADOW_VALUE9 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_9)
-#define SHADOW_VALUE10 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_10)
-#define SHADOW_VALUE11 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_11)
-#define SHADOW_VALUE12 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_12)
-#define SHADOW_VALUE13 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_13)
-#define SHADOW_VALUE14 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_14)
-#define SHADOW_VALUE15 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_15)
-#define SHADOW_VALUE16 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_16)
-#define SHADOW_VALUE17 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_17)
-#define SHADOW_VALUE18 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_18)
-#define SHADOW_VALUE19 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_19)
-#define SHADOW_VALUE20 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_20)
-#define SHADOW_VALUE21 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_21)
-#define SHADOW_VALUE22 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_22)
-#define SHADOW_VALUE23 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_23)
-#define SHADOW_ADDRESS0 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_0)
-#define SHADOW_ADDRESS1 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_1)
-#define SHADOW_ADDRESS2 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_2)
-#define SHADOW_ADDRESS3 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_3)
-#define SHADOW_ADDRESS4 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_4)
-#define SHADOW_ADDRESS5 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_5)
-#define SHADOW_ADDRESS6 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_6)
-#define SHADOW_ADDRESS7 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_7)
-#define SHADOW_ADDRESS8 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_8)
-#define SHADOW_ADDRESS9 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_9)
-#define SHADOW_ADDRESS10 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_10)
-#define SHADOW_ADDRESS11 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_11)
-#define SHADOW_ADDRESS12 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_12)
-#define SHADOW_ADDRESS13 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_13)
-#define SHADOW_ADDRESS14 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_14)
-#define SHADOW_ADDRESS15 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_15)
-#define SHADOW_ADDRESS16 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_16)
-#define SHADOW_ADDRESS17 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_17)
-#define SHADOW_ADDRESS18 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_18)
-#define SHADOW_ADDRESS19 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_19)
-#define SHADOW_ADDRESS20 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_20)
-#define SHADOW_ADDRESS21 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_21)
-#define SHADOW_ADDRESS22 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_22)
-#define SHADOW_ADDRESS23 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_23)
-
-#define SHADOW_ADDRESS(i) (SHADOW_ADDRESS0 + i*(SHADOW_ADDRESS1-SHADOW_ADDRESS0))
+#define SHADOW_VALUE0 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_0)
+#define SHADOW_VALUE1 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_1)
+#define SHADOW_VALUE2 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_2)
+#define SHADOW_VALUE3 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_3)
+#define SHADOW_VALUE4 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_4)
+#define SHADOW_VALUE5 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_5)
+#define SHADOW_VALUE6 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_6)
+#define SHADOW_VALUE7 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_7)
+#define SHADOW_VALUE8 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_8)
+#define SHADOW_VALUE9 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_9)
+#define SHADOW_VALUE10 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_10)
+#define SHADOW_VALUE11 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_11)
+#define SHADOW_VALUE12 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_12)
+#define SHADOW_VALUE13 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_13)
+#define SHADOW_VALUE14 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_14)
+#define SHADOW_VALUE15 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_15)
+#define SHADOW_VALUE16 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_16)
+#define SHADOW_VALUE17 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_17)
+#define SHADOW_VALUE18 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_18)
+#define SHADOW_VALUE19 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_19)
+#define SHADOW_VALUE20 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_20)
+#define SHADOW_VALUE21 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_21)
+#define SHADOW_VALUE22 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_22)
+#define SHADOW_VALUE23 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_VALUE_23)
+#define SHADOW_ADDRESS0 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_0)
+#define SHADOW_ADDRESS1 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_1)
+#define SHADOW_ADDRESS2 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_2)
+#define SHADOW_ADDRESS3 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_3)
+#define SHADOW_ADDRESS4 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_4)
+#define SHADOW_ADDRESS5 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_5)
+#define SHADOW_ADDRESS6 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_6)
+#define SHADOW_ADDRESS7 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_7)
+#define SHADOW_ADDRESS8 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_8)
+#define SHADOW_ADDRESS9 (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_9)
+#define SHADOW_ADDRESS10 \
+ (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_10)
+#define SHADOW_ADDRESS11 \
+ (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_11)
+#define SHADOW_ADDRESS12 \
+ (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_12)
+#define SHADOW_ADDRESS13 \
+ (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_13)
+#define SHADOW_ADDRESS14 \
+ (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_14)
+#define SHADOW_ADDRESS15 \
+ (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_15)
+#define SHADOW_ADDRESS16 \
+ (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_16)
+#define SHADOW_ADDRESS17 \
+ (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_17)
+#define SHADOW_ADDRESS18 \
+ (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_18)
+#define SHADOW_ADDRESS19 \
+ (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_19)
+#define SHADOW_ADDRESS20 \
+ (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_20)
+#define SHADOW_ADDRESS21 \
+ (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_21)
+#define SHADOW_ADDRESS22 \
+ (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_22)
+#define SHADOW_ADDRESS23 \
+ (scn->host_shadow_regs->d_A_LOCAL_SHADOW_REG_ADDRESS_23)
+
+#define SHADOW_ADDRESS(i) \
+ (SHADOW_ADDRESS0 + i*(SHADOW_ADDRESS1-SHADOW_ADDRESS0))
#define HOST_IS_SRC_RING_HIGH_WATERMARK_MASK \
(scn->target_ce_def->d_HOST_IS_SRC_RING_HIGH_WATERMARK_MASK)
@@ -145,7 +160,8 @@
(scn->target_ce_def->d_CE_WRAPPER_INTERRUPT_SUMMARY_HOST_MSI_MASK)
#define CE_WRAPPER_INTERRUPT_SUMMARY_HOST_MSI_LSB \
(scn->target_ce_def->d_CE_WRAPPER_INTERRUPT_SUMMARY_HOST_MSI_LSB)
-#define CE_CTRL1_DMAX_LENGTH_LSB (scn->target_ce_def->d_CE_CTRL1_DMAX_LENGTH_LSB)
+#define CE_CTRL1_DMAX_LENGTH_LSB \
+ (scn->target_ce_def->d_CE_CTRL1_DMAX_LENGTH_LSB)
#define CE_CTRL1_IDX_UPD_EN (scn->target_ce_def->d_CE_CTRL1_IDX_UPD_EN_MASK)
#define CE_CTRL1_SRC_RING_BYTE_SWAP_EN_MASK \
(scn->target_ce_def->d_CE_CTRL1_SRC_RING_BYTE_SWAP_EN_MASK)
@@ -184,10 +200,14 @@
#define AMBA_DEBUG_BUS_SEL_MSB (scn->targetdef->d_AMBA_DEBUG_BUS_SEL_MSB)
#define AMBA_DEBUG_BUS_SEL_LSB (scn->targetdef->d_AMBA_DEBUG_BUS_SEL_LSB)
#define AMBA_DEBUG_BUS_SEL_MASK (scn->targetdef->d_AMBA_DEBUG_BUS_SEL_MASK)
-#define CE_WRAPPER_DEBUG_OFFSET (scn->target_ce_def->d_CE_WRAPPER_DEBUG_OFFSET)
-#define CE_WRAPPER_DEBUG_SEL_MSB (scn->target_ce_def->d_CE_WRAPPER_DEBUG_SEL_MSB)
-#define CE_WRAPPER_DEBUG_SEL_LSB (scn->target_ce_def->d_CE_WRAPPER_DEBUG_SEL_LSB)
-#define CE_WRAPPER_DEBUG_SEL_MASK (scn->target_ce_def->d_CE_WRAPPER_DEBUG_SEL_MASK)
+#define CE_WRAPPER_DEBUG_OFFSET \
+ (scn->target_ce_def->d_CE_WRAPPER_DEBUG_OFFSET)
+#define CE_WRAPPER_DEBUG_SEL_MSB \
+ (scn->target_ce_def->d_CE_WRAPPER_DEBUG_SEL_MSB)
+#define CE_WRAPPER_DEBUG_SEL_LSB \
+ (scn->target_ce_def->d_CE_WRAPPER_DEBUG_SEL_LSB)
+#define CE_WRAPPER_DEBUG_SEL_MASK \
+ (scn->target_ce_def->d_CE_WRAPPER_DEBUG_SEL_MASK)
#define CE_DEBUG_OFFSET (scn->target_ce_def->d_CE_DEBUG_OFFSET)
#define CE_DEBUG_SEL_MSB (scn->target_ce_def->d_CE_DEBUG_SEL_MSB)
#define CE_DEBUG_SEL_LSB (scn->target_ce_def->d_CE_DEBUG_SEL_LSB)
diff --git a/hif/src/ce/ce_service.c b/hif/src/ce/ce_service.c
index 036398dbdbfd..979ac2692b15 100644
--- a/hif/src/ce/ce_service.c
+++ b/hif/src/ce/ce_service.c
@@ -128,6 +128,7 @@ struct hif_ce_desc_event hif_ce_desc_history[CE_COUNT_MAX][HIF_CE_HISTORY_MAX];
static int get_next_record_index(qdf_atomic_t *table_index, int array_size)
{
int record_index = qdf_atomic_inc_return(table_index);
+
if (record_index == array_size)
qdf_atomic_sub(array_size, table_index);
@@ -287,6 +288,7 @@ void war_ce_src_ring_write_idx_set(struct hif_softc *scn,
(CDC_WAR_MAGIC_STR | write_index));
} else {
unsigned long irq_flags;
+
local_irq_save(irq_flags);
hif_write32_mb(indicator_addr, 1);
@@ -457,6 +459,7 @@ unsigned int ce_sendlist_sizeof(void)
void ce_sendlist_init(struct ce_sendlist *sendlist)
{
struct ce_sendlist_s *sl = (struct ce_sendlist_s *)sendlist;
+
sl->num_items = 0;
}
@@ -1223,9 +1226,8 @@ ce_completed_recv_next_nolock(struct CE_state *CE_state,
*transfer_idp = dest_desc_info.meta_data;
*flagsp = (dest_desc_info.byte_swap) ? CE_RECV_FLAG_SWAPPED : 0;
- if (per_CE_contextp) {
+ if (per_CE_contextp)
*per_CE_contextp = CE_state->recv_context;
- }
if (per_transfer_contextp) {
*per_transfer_contextp =
@@ -1279,9 +1281,8 @@ ce_revoke_recv_next(struct CE_handle *copyeng,
CE_state = (struct CE_state *)copyeng;
dest_ring = CE_state->dest_ring;
- if (!dest_ring) {
+ if (!dest_ring)
return QDF_STATUS_E_FAILURE;
- }
scn = CE_state->scn;
qdf_spin_lock(&CE_state->ce_index_lock);
@@ -1298,9 +1299,8 @@ ce_revoke_recv_next(struct CE_handle *copyeng,
/* Return data from completed destination descriptor */
*bufferp = HIF_CE_DESC_ADDR_TO_DMA(dest_desc);
- if (per_CE_contextp) {
+ if (per_CE_contextp)
*per_CE_contextp = CE_state->recv_context;
- }
if (per_transfer_contextp) {
*per_transfer_contextp =
@@ -1392,9 +1392,8 @@ ce_completed_send_next_nolock(struct CE_state *CE_state,
#else
*toeplitz_hash_result = 0;
#endif
- if (per_CE_contextp) {
+ if (per_CE_contextp)
*per_CE_contextp = CE_state->send_context;
- }
if (per_transfer_contextp) {
*per_transfer_contextp =
@@ -1431,9 +1430,8 @@ ce_cancel_send_next(struct CE_handle *copyeng,
CE_state = (struct CE_state *)copyeng;
src_ring = CE_state->src_ring;
- if (!src_ring) {
+ if (!src_ring)
return QDF_STATUS_E_FAILURE;
- }
scn = CE_state->scn;
qdf_spin_lock(&CE_state->ce_index_lock);
@@ -1457,9 +1455,8 @@ ce_cancel_send_next(struct CE_handle *copyeng,
*toeplitz_hash_result = 0;
#endif
- if (per_CE_contextp) {
+ if (per_CE_contextp)
*per_CE_contextp = CE_state->send_context;
- }
if (per_transfer_contextp) {
*per_transfer_contextp =
@@ -1642,7 +1639,7 @@ static void ce_fastpath_rx_handle(struct CE_state *ce_state,
#define MSG_FLUSH_NUM 32
/**
- * ce_per_engine_service_fast() - CE handler routine to service fastpath messages
+ * ce_per_engine_service_fast() - CE handler routine to service fastpath msgs
* @scn: hif_context
* @ce_id: Copy engine ID
* 1) Go through the CE ring, and find the completions
@@ -2024,9 +2021,8 @@ more_watermarks:
if (CE_state->misc_cbs) {
CE_int_status = CE_ENGINE_INT_STATUS_GET(scn, ctrl_addr);
if (CE_int_status & CE_WATERMARK_MASK) {
- if (CE_state->watermark_cb) {
+ if (CE_state->watermark_cb)
goto more_watermarks;
- }
}
}
@@ -2057,6 +2053,7 @@ void ce_per_engine_service_any(int irq, struct hif_softc *scn)
if (!qdf_atomic_read(&scn->tasklet_from_intr)) {
for (CE_id = 0; CE_id < scn->ce_count; CE_id++) {
struct CE_state *CE_state = scn->ce_id_to_state[CE_id];
+
if (qdf_atomic_read(&CE_state->rx_pending)) {
qdf_atomic_set(&CE_state->rx_pending, 0);
ce_per_engine_service(scn, CE_id);
@@ -2070,11 +2067,10 @@ void ce_per_engine_service_any(int irq, struct hif_softc *scn)
intr_summary = CE_INTERRUPT_SUMMARY(scn);
for (CE_id = 0; intr_summary && (CE_id < scn->ce_count); CE_id++) {
- if (intr_summary & (1 << CE_id)) {
+ if (intr_summary & (1 << CE_id))
intr_summary &= ~(1 << CE_id);
- } else {
+ else
continue; /* no intr pending on this CE */
- }
ce_per_engine_service(scn, CE_id);
}
@@ -2102,17 +2098,15 @@ ce_per_engine_handler_adjust(struct CE_state *CE_state,
return;
if ((!disable_copy_compl_intr) &&
- (CE_state->send_cb || CE_state->recv_cb)) {
+ (CE_state->send_cb || CE_state->recv_cb))
CE_COPY_COMPLETE_INTR_ENABLE(scn, ctrl_addr);
- } else {
+ else
CE_COPY_COMPLETE_INTR_DISABLE(scn, ctrl_addr);
- }
- if (CE_state->watermark_cb) {
+ if (CE_state->watermark_cb)
CE_WATERMARK_INTR_ENABLE(scn, ctrl_addr);
- } else {
+ else
CE_WATERMARK_INTR_DISABLE(scn, ctrl_addr);
- }
Q_TARGET_ACCESS_END(scn);
}
@@ -2132,13 +2126,11 @@ void ce_disable_any_copy_compl_intr_nolock(struct hif_softc *scn)
/* if the interrupt is currently enabled, disable it */
if (!CE_state->disable_copy_compl_intr
- && (CE_state->send_cb || CE_state->recv_cb)) {
+ && (CE_state->send_cb || CE_state->recv_cb))
CE_COPY_COMPLETE_INTR_DISABLE(scn, ctrl_addr);
- }
- if (CE_state->watermark_cb) {
+ if (CE_state->watermark_cb)
CE_WATERMARK_INTR_DISABLE(scn, ctrl_addr);
- }
}
Q_TARGET_ACCESS_END(scn);
}
@@ -2160,13 +2152,11 @@ void ce_enable_any_copy_compl_intr_nolock(struct hif_softc *scn)
* "disable" flag is not set), then re-enable the interrupt.
*/
if (!CE_state->disable_copy_compl_intr
- && (CE_state->send_cb || CE_state->recv_cb)) {
+ && (CE_state->send_cb || CE_state->recv_cb))
CE_COPY_COMPLETE_INTR_ENABLE(scn, ctrl_addr);
- }
- if (CE_state->watermark_cb) {
+ if (CE_state->watermark_cb)
CE_WATERMARK_INTR_ENABLE(scn, ctrl_addr);
- }
}
Q_TARGET_ACCESS_END(scn);
}
@@ -2246,9 +2236,8 @@ ce_watermark_cb_register(struct CE_handle *copyeng,
CE_state->watermark_cb = fn_ptr;
CE_state->wm_context = CE_wm_context;
ce_per_engine_handler_adjust(CE_state, 0);
- if (fn_ptr) {
+ if (fn_ptr)
CE_state->misc_cbs = 1;
- }
}
bool ce_get_rx_pending(struct hif_softc *scn)
@@ -2257,6 +2246,7 @@ bool ce_get_rx_pending(struct hif_softc *scn)
for (CE_id = 0; CE_id < scn->ce_count; CE_id++) {
struct CE_state *CE_state = scn->ce_id_to_state[CE_id];
+
if (qdf_atomic_read(&CE_state->rx_pending))
return true;
}
@@ -2329,7 +2319,6 @@ void ce_ipa_get_resource(struct CE_handle *ce,
sizeof(struct CE_src_desc));
*ce_reg_paddr = phy_mem_base + CE_BASE_ADDRESS(CE_state->id) +
SR_WR_INDEX_ADDRESS;
- return;
}
#endif /* IPA_OFFLOAD */
diff --git a/hif/src/ce/ce_tasklet.c b/hif/src/ce/ce_tasklet.c
index 910d90c53088..8a618937a8f8 100644
--- a/hif/src/ce/ce_tasklet.c
+++ b/hif/src/ce/ce_tasklet.c
@@ -83,7 +83,6 @@ static void reschedule_ce_tasklet_work_handler(struct work_struct *work)
return;
}
tasklet_schedule(&hif_ce_state->tasklets[ce_work->id].intr_tq);
- return;
}
static struct tasklet_work tasklet_workers[CE_ID_MAX];
@@ -174,9 +173,8 @@ static void ce_tasklet(unsigned long data)
ce_per_engine_service(scn, tasklet_entry->ce_id);
- if (CE_state->lro_flush_cb != NULL) {
+ if (CE_state->lro_flush_cb != NULL)
CE_state->lro_flush_cb(CE_state->lro_data);
- }
if (ce_check_rx_pending(CE_state)) {
/*
@@ -599,9 +597,8 @@ QDF_STATUS ce_register_irq(struct HIF_CE_state *hif_ce_state, uint32_t mask)
__func__, id, ret);
ce_unregister_irq(hif_ce_state, done_mask);
return QDF_STATUS_E_FAULT;
- } else {
- done_mask |= 1 << id;
}
+ done_mask |= 1 << id;
}
}
diff --git a/hif/src/dispatcher/ahb_api.h b/hif/src/dispatcher/ahb_api.h
index 2bba2ff92d8e..c33c777852a6 100644
--- a/hif/src/dispatcher/ahb_api.h
+++ b/hif/src/dispatcher/ahb_api.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -29,7 +29,7 @@ void hif_ahb_nointrs(struct hif_softc *scn);
void hif_ahb_reset_soc(struct hif_softc *hif_ctx);
QDF_STATUS hif_ahb_enable_bus(struct hif_softc *ol_sc,
struct device *dev, void *bdev,
- const hif_bus_id *bid,
+ const struct hif_bus_id *bid,
enum hif_enable_type type);
void hif_ahb_disable_bus(struct hif_softc *scn);
int hif_ahb_bus_configure(struct hif_softc *scn);
diff --git a/hif/src/dispatcher/dummy.c b/hif/src/dispatcher/dummy.c
index 53fe656d86f5..ac40d8c971aa 100644
--- a/hif/src/dispatcher/dummy.c
+++ b/hif/src/dispatcher/dummy.c
@@ -195,7 +195,6 @@ hif_dummy_get_config_item(struct hif_softc *hif_sc,
void
hif_dummy_set_mailbox_swap(struct hif_softc *hif_sc)
{
- return;
}
/**
@@ -207,7 +206,6 @@ hif_dummy_set_mailbox_swap(struct hif_softc *hif_sc)
void
hif_dummy_claim_device(struct hif_softc *hif_sc)
{
- return;
}
/**
@@ -219,7 +217,6 @@ hif_dummy_claim_device(struct hif_softc *hif_sc)
void
hif_dummy_cancel_deferred_target_sleep(struct hif_softc *hif_sc)
{
- return;
}
/**
@@ -292,7 +289,6 @@ void hif_dummy_ipa_get_ce_resource(struct hif_softc *hif_sc,
void
hif_dummy_mask_interrupt_call(struct hif_softc *hif_sc)
{
- return;
}
/**
@@ -323,7 +319,6 @@ void hif_dummy_clear_stats(struct hif_softc *hif_ctx)
void hif_dummy_set_bundle_mode(struct hif_softc *hif_ctx,
bool enabled, int rx_bundle_cnt)
{
- return;
}
/**
diff --git a/hif/src/dispatcher/multibus.c b/hif/src/dispatcher/multibus.c
index 0862fcdd6d63..92110562ff26 100644
--- a/hif/src/dispatcher/multibus.c
+++ b/hif/src/dispatcher/multibus.c
@@ -186,42 +186,49 @@ void hif_bus_prevent_linkdown(struct hif_softc *hif_sc, bool flag)
void hif_reset_soc(struct hif_opaque_softc *hif_ctx)
{
struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_ctx);
+
hif_sc->bus_ops.hif_reset_soc(hif_sc);
}
int hif_bus_early_suspend(struct hif_opaque_softc *hif_ctx)
{
struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_ctx);
+
return hif_sc->bus_ops.hif_bus_early_suspend(hif_sc);
}
int hif_bus_late_resume(struct hif_opaque_softc *hif_ctx)
{
struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_ctx);
+
return hif_sc->bus_ops.hif_bus_late_resume(hif_sc);
}
int hif_bus_suspend(struct hif_opaque_softc *hif_ctx)
{
struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_ctx);
+
return hif_sc->bus_ops.hif_bus_suspend(hif_sc);
}
int hif_bus_resume(struct hif_opaque_softc *hif_ctx)
{
struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_ctx);
+
return hif_sc->bus_ops.hif_bus_resume(hif_sc);
}
int hif_bus_suspend_noirq(struct hif_opaque_softc *hif_ctx)
{
struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_ctx);
+
return hif_sc->bus_ops.hif_bus_suspend_noirq(hif_sc);
}
int hif_bus_resume_noirq(struct hif_opaque_softc *hif_ctx)
{
struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_ctx);
+
return hif_sc->bus_ops.hif_bus_resume_noirq(hif_sc);
}
@@ -235,6 +242,7 @@ int hif_target_sleep_state_adjust(struct hif_softc *hif_sc,
void hif_disable_isr(struct hif_opaque_softc *hif_hdl)
{
struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_hdl);
+
hif_sc->bus_ops.hif_disable_isr(hif_sc);
}
@@ -244,7 +252,7 @@ void hif_nointrs(struct hif_softc *hif_sc)
}
QDF_STATUS hif_enable_bus(struct hif_softc *hif_sc, struct device *dev,
- void *bdev, const hif_bus_id *bid,
+ void *bdev, const struct hif_bus_id *bid,
enum hif_enable_type type)
{
return hif_sc->bus_ops.hif_enable_bus(hif_sc, dev, bdev, bid, type);
@@ -264,6 +272,7 @@ QDF_STATUS hif_get_config_item(struct hif_opaque_softc *hif_ctx,
int opcode, void *config, uint32_t config_len)
{
struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_ctx);
+
return hif_sc->bus_ops.hif_get_config_item(hif_sc, opcode, config,
config_len);
}
@@ -271,24 +280,28 @@ QDF_STATUS hif_get_config_item(struct hif_opaque_softc *hif_ctx,
void hif_set_mailbox_swap(struct hif_opaque_softc *hif_ctx)
{
struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_ctx);
+
hif_sc->bus_ops.hif_set_mailbox_swap(hif_sc);
}
void hif_claim_device(struct hif_opaque_softc *hif_ctx)
{
struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_ctx);
+
hif_sc->bus_ops.hif_claim_device(hif_sc);
}
void hif_shutdown_device(struct hif_opaque_softc *hif_ctx)
{
struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_ctx);
+
hif_sc->bus_ops.hif_shutdown_device(hif_sc);
}
void hif_stop(struct hif_opaque_softc *hif_ctx)
{
struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_ctx);
+
hif_sc->bus_ops.hif_stop(hif_sc);
}
@@ -310,6 +323,7 @@ void hif_irq_disable(struct hif_softc *hif_sc, int irq_id)
int hif_dump_registers(struct hif_opaque_softc *hif_hdl)
{
struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_hdl);
+
return hif_sc->bus_ops.hif_dump_registers(hif_sc);
}
@@ -318,6 +332,7 @@ void hif_dump_target_memory(struct hif_opaque_softc *hif_hdl,
uint32_t address, uint32_t size)
{
struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_hdl);
+
hif_sc->bus_ops.hif_dump_target_memory(hif_sc, ramdump_base,
address, size);
}
@@ -328,6 +343,7 @@ void hif_ipa_get_ce_resource(struct hif_opaque_softc *hif_hdl,
qdf_dma_addr_t *ce_reg_paddr)
{
struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_hdl);
+
hif_sc->bus_ops.hif_ipa_get_ce_resource(hif_sc, ce_sr_base_paddr,
ce_sr_ring_size, ce_reg_paddr);
}
@@ -335,6 +351,7 @@ void hif_ipa_get_ce_resource(struct hif_opaque_softc *hif_hdl,
void hif_mask_interrupt_call(struct hif_opaque_softc *hif_hdl)
{
struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_hdl);
+
hif_sc->bus_ops.hif_mask_interrupt_call(hif_sc);
}
@@ -365,6 +382,7 @@ void hif_enable_power_management(struct hif_opaque_softc *hif_hdl,
bool is_packet_log_enabled)
{
struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_hdl);
+
hif_sc->bus_ops.hif_enable_power_management(hif_sc,
is_packet_log_enabled);
}
@@ -380,6 +398,7 @@ void hif_enable_power_management(struct hif_opaque_softc *hif_hdl,
void hif_disable_power_management(struct hif_opaque_softc *hif_hdl)
{
struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_hdl);
+
hif_sc->bus_ops.hif_disable_power_management(hif_sc);
}
@@ -395,6 +414,7 @@ void hif_set_bundle_mode(struct hif_opaque_softc *scn, bool enabled,
int rx_bundle_cnt)
{
struct hif_softc *hif_sc = HIF_GET_SOFTC(scn);
+
hif_sc->bus_ops.hif_set_bundle_mode(hif_sc, enabled, rx_bundle_cnt);
}
@@ -412,5 +432,7 @@ int hif_bus_reset_resume(struct hif_opaque_softc *scn)
{
struct hif_softc *hif_sc = HIF_GET_SOFTC(scn);
+
return hif_sc->bus_ops.hif_bus_reset_resume(hif_sc);
}
+
diff --git a/hif/src/dispatcher/multibus.h b/hif/src/dispatcher/multibus.h
index 5fdd9ca4f308..02dd01cd5004 100644
--- a/hif/src/dispatcher/multibus.h
+++ b/hif/src/dispatcher/multibus.h
@@ -36,7 +36,7 @@ struct hif_softc;
struct hif_bus_ops {
QDF_STATUS (*hif_bus_open)(struct hif_softc *hif_sc,
- enum qdf_bus_type bus_type);
+ enum qdf_bus_type bus_type);
void (*hif_bus_close)(struct hif_softc *hif_sc);
void (*hif_bus_prevent_linkdown)(struct hif_softc *hif_sc, bool flag);
void (*hif_reset_soc)(struct hif_softc *hif_sc);
@@ -51,12 +51,14 @@ struct hif_bus_ops {
void (*hif_disable_isr)(struct hif_softc *hif_sc);
void (*hif_nointrs)(struct hif_softc *hif_sc);
QDF_STATUS (*hif_enable_bus)(struct hif_softc *hif_sc,
- struct device *dev, void *bdev, const hif_bus_id *bid,
- enum hif_enable_type type);
+ struct device *dev,
+ void *bdev,
+ const struct hif_bus_id *bid,
+ enum hif_enable_type type);
void (*hif_disable_bus)(struct hif_softc *hif_sc);
int (*hif_bus_configure)(struct hif_softc *hif_sc);
QDF_STATUS (*hif_get_config_item)(struct hif_softc *hif_sc,
- int opcode, void *config, uint32_t config_len);
+ int opcode, void *config, uint32_t config_len);
void (*hif_set_mailbox_swap)(struct hif_softc *hif_sc);
void (*hif_claim_device)(struct hif_softc *hif_sc);
void (*hif_shutdown_device)(struct hif_softc *hif_sc);
@@ -78,7 +80,7 @@ struct hif_bus_ops {
void (*hif_disable_power_management)(struct hif_softc *hif_ctx);
void (*hif_display_stats)(struct hif_softc *hif_ctx);
void (*hif_clear_stats)(struct hif_softc *hif_ctx);
- void (*hif_set_bundle_mode) (struct hif_softc *hif_ctx, bool enabled,
+ void (*hif_set_bundle_mode)(struct hif_softc *hif_ctx, bool enabled,
int rx_bundle_cnt);
int (*hif_bus_reset_resume)(struct hif_softc *hif_ctx);
};
diff --git a/hif/src/dispatcher/pci_api.h b/hif/src/dispatcher/pci_api.h
index 6395cf484c12..57c4e66a35c9 100644
--- a/hif/src/dispatcher/pci_api.h
+++ b/hif/src/dispatcher/pci_api.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -40,7 +40,7 @@ void hif_pci_disable_isr(struct hif_softc *scn);
void hif_pci_nointrs(struct hif_softc *scn);
QDF_STATUS hif_pci_enable_bus(struct hif_softc *scn,
struct device *dev, void *bdev,
- const hif_bus_id *bid,
+ const struct hif_bus_id *bid,
enum hif_enable_type type);
void hif_pci_disable_bus(struct hif_softc *scn);
int hif_pci_bus_configure(struct hif_softc *scn);
diff --git a/hif/src/dispatcher/sdio_api.h b/hif/src/dispatcher/sdio_api.h
index 61f0a25a331e..77106da9c5b7 100644
--- a/hif/src/dispatcher/sdio_api.h
+++ b/hif/src/dispatcher/sdio_api.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -22,7 +22,8 @@ void hif_sdio_close(struct hif_softc *hif_sc);
int hif_sdio_bus_suspend(struct hif_softc *hif_ctx);
int hif_sdio_bus_resume(struct hif_softc *hif_ctx);
QDF_STATUS hif_sdio_enable_bus(struct hif_softc *hif_sc,
- struct device *dev, void *bdev, const hif_bus_id *bid,
+ struct device *dev, void *bdev,
+ const struct hif_bus_id *bid,
enum hif_enable_type type);
void hif_sdio_disable_bus(struct hif_softc *hif_sc);
QDF_STATUS
diff --git a/hif/src/dispatcher/snoc_api.h b/hif/src/dispatcher/snoc_api.h
index 06fc43d5aefd..1d2c54e308a1 100644
--- a/hif/src/dispatcher/snoc_api.h
+++ b/hif/src/dispatcher/snoc_api.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -37,7 +37,7 @@ void hif_snoc_disable_isr(struct hif_softc *hif_ctx);
void hif_snoc_nointrs(struct hif_softc *scn);
QDF_STATUS hif_snoc_enable_bus(struct hif_softc *ol_sc,
struct device *dev, void *bdev,
- const hif_bus_id *bid,
+ const struct hif_bus_id *bid,
enum hif_enable_type type);
void hif_snoc_disable_bus(struct hif_softc *scn);
int hif_snoc_bus_configure(struct hif_softc *scn);
diff --git a/hif/src/dispatcher/usb_api.h b/hif/src/dispatcher/usb_api.h
index db8f2fdc841a..1c48791ae1d9 100644
--- a/hif/src/dispatcher/usb_api.h
+++ b/hif/src/dispatcher/usb_api.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -27,7 +27,7 @@ void hif_usb_disable_isr(struct hif_softc *hif_ctx);
void hif_usb_nointrs(struct hif_softc *scn);
QDF_STATUS hif_usb_enable_bus(struct hif_softc *ol_sc,
struct device *dev, void *bdev,
- const hif_bus_id *bid,
+ const struct hif_bus_id *bid,
enum hif_enable_type type);
void hif_usb_disable_bus(struct hif_softc *scn);
int hif_usb_bus_configure(struct hif_softc *scn);
diff --git a/hif/src/hif_main.c b/hif/src/hif_main.c
index 9f32a69251f5..e70f50e1cfbc 100644
--- a/hif/src/hif_main.c
+++ b/hif/src/hif_main.c
@@ -97,8 +97,8 @@ void *hif_get_targetdef(struct hif_opaque_softc *hif_ctx)
void hif_vote_link_down(struct hif_opaque_softc *hif_ctx)
{
struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx);
- QDF_BUG(scn);
+ QDF_BUG(scn);
scn->linkstate_vote--;
if (scn->linkstate_vote == 0)
hif_bus_prevent_linkdown(scn, false);
@@ -118,8 +118,8 @@ void hif_vote_link_down(struct hif_opaque_softc *hif_ctx)
void hif_vote_link_up(struct hif_opaque_softc *hif_ctx)
{
struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx);
- QDF_BUG(scn);
+ QDF_BUG(scn);
scn->linkstate_vote++;
if (scn->linkstate_vote == 1)
hif_bus_prevent_linkdown(scn, true);
@@ -140,8 +140,8 @@ void hif_vote_link_up(struct hif_opaque_softc *hif_ctx)
bool hif_can_suspend_link(struct hif_opaque_softc *hif_ctx)
{
struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx);
- QDF_BUG(scn);
+ QDF_BUG(scn);
return scn->linkstate_vote == 0;
}
@@ -408,7 +408,8 @@ struct hif_opaque_softc *hif_open(qdf_device_t qdf_ctx, uint32_t mode,
qdf_atomic_init(&scn->active_tasklet_cnt);
qdf_atomic_init(&scn->link_suspended);
qdf_atomic_init(&scn->tasklet_from_intr);
- qdf_mem_copy(&scn->callbacks, cbk, sizeof(struct hif_driver_state_callbacks));
+ qdf_mem_copy(&scn->callbacks, cbk,
+ sizeof(struct hif_driver_state_callbacks));
scn->bus_type = bus_type;
status = hif_bus_open(scn, bus_type);
if (status != QDF_STATUS_SUCCESS) {
@@ -443,6 +444,7 @@ void hif_close(struct hif_opaque_softc *hif_ctx)
if (scn->target_info.hw_name) {
char *hw_name = scn->target_info.hw_name;
+
scn->target_info.hw_name = "ErrUnloading";
qdf_mem_free(hw_name);
}
@@ -462,7 +464,8 @@ void hif_close(struct hif_opaque_softc *hif_ctx)
* Return: QDF_STATUS
*/
QDF_STATUS hif_enable(struct hif_opaque_softc *hif_ctx, struct device *dev,
- void *bdev, const hif_bus_id *bid,
+ void *bdev,
+ const struct hif_bus_id *bid,
enum qdf_bus_type bus_type,
enum hif_enable_type type)
{
@@ -603,7 +606,6 @@ void hif_crash_shutdown(struct hif_opaque_softc *hif_ctx)
{
HIF_INFO_MED("%s: Collecting target RAM dump disabled",
__func__);
- return;
}
#endif /* TARGET_RAMDUMP_AFTER_KERNEL_PANIC */
@@ -734,6 +736,7 @@ end:
bool hif_needs_bmi(struct hif_opaque_softc *hif_ctx)
{
struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_ctx);
+
return hif_sc->bus_type != QDF_BUS_TYPE_SNOC;
}
@@ -745,6 +748,7 @@ bool hif_needs_bmi(struct hif_opaque_softc *hif_ctx)
enum qdf_bus_type hif_get_bus_type(struct hif_opaque_softc *hif_hdl)
{
struct hif_softc *scn = HIF_GET_SOFTC(hif_hdl);
+
return scn->bus_type;
}
@@ -922,7 +926,8 @@ uint32_t hif_get_conparam(struct hif_softc *scn)
*
* Return: pointer to HIF Callbacks
*/
-struct hif_driver_state_callbacks *hif_get_callbacks_handle(struct hif_softc *scn)
+struct hif_driver_state_callbacks *hif_get_callbacks_handle(
+ struct hif_softc *scn)
{
return &scn->callbacks;
}
@@ -991,6 +996,7 @@ qdf_nbuf_t hif_batch_send(struct hif_opaque_softc *osc, qdf_nbuf_t msdu,
uint32_t transfer_id, u_int32_t len, uint32_t sendhead)
{
void *ce_tx_hdl = hif_get_ce_handle(osc, CE_HTT_TX_CE);
+
return ce_batch_send((struct CE_handle *)ce_tx_hdl, msdu, transfer_id,
len, sendhead);
}
@@ -1006,6 +1012,7 @@ qdf_nbuf_t hif_batch_send(struct hif_opaque_softc *osc, qdf_nbuf_t msdu,
void hif_update_tx_ring(struct hif_opaque_softc *osc, u_int32_t num_htt_cmpls)
{
void *ce_tx_hdl = hif_get_ce_handle(osc, CE_HTT_TX_CE);
+
ce_update_tx_ring(ce_tx_hdl, num_htt_cmpls);
}
@@ -1024,6 +1031,7 @@ int hif_send_single(struct hif_opaque_softc *osc, qdf_nbuf_t msdu, uint32_t
transfer_id, u_int32_t len)
{
void *ce_tx_hdl = hif_get_ce_handle(osc, CE_HTT_TX_CE);
+
return ce_send_single((struct CE_handle *)ce_tx_hdl, msdu, transfer_id,
len);
}
@@ -1043,6 +1051,7 @@ int hif_send_fast(struct hif_opaque_softc *osc, qdf_nbuf_t nbuf,
uint32_t transfer_id, uint32_t download_len)
{
void *ce_tx_hdl = hif_get_ce_handle(osc, CE_HTT_TX_CE);
+
return ce_send_fast((struct CE_handle *)ce_tx_hdl, nbuf,
transfer_id, download_len);
}
@@ -1061,6 +1070,7 @@ void hif_reg_write(struct hif_opaque_softc *hif_ctx, uint32_t offset,
uint32_t value)
{
struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx);
+
hif_write32_mb(scn->mem + offset, value);
}
@@ -1077,6 +1087,7 @@ uint32_t hif_reg_read(struct hif_opaque_softc *hif_ctx, uint32_t offset)
{
struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx);
+
return hif_read32_mb(scn->mem + offset);
}
diff --git a/hif/src/hif_main.h b/hif/src/hif_main.h
index aa5cdaad8e98..b4c0a288712d 100644
--- a/hif/src/hif_main.h
+++ b/hif/src/hif_main.h
@@ -96,7 +96,7 @@
#define HIF_GET_CE_STATE(scn) ((struct HIF_CE_state *)scn)
#define HIF_GET_SDIO_SOFTC(scn) ((struct hif_sdio_softc *)scn)
#define HIF_GET_USB_SOFTC(scn) ((struct hif_usb_softc *)scn)
-#define HIF_GET_USB_DEVICE(scn) ((HIF_DEVICE_USB *)scn)
+#define HIF_GET_USB_DEVICE(scn) ((struct HIF_DEVICE_USB *)scn)
#define HIF_GET_SOFTC(scn) ((struct hif_softc *)scn)
#define GET_HIF_OPAQUE_HDL(scn) ((struct hif_opaque_softc *)scn)
@@ -209,13 +209,14 @@ void hif_bus_close(struct hif_softc *ol_sc);
QDF_STATUS hif_bus_open(struct hif_softc *ol_sc,
enum qdf_bus_type bus_type);
QDF_STATUS hif_enable_bus(struct hif_softc *ol_sc, struct device *dev,
- void *bdev, const hif_bus_id *bid, enum hif_enable_type type);
+ void *bdev, const struct hif_bus_id *bid, enum hif_enable_type type);
void hif_disable_bus(struct hif_softc *scn);
void hif_bus_prevent_linkdown(struct hif_softc *scn, bool flag);
int hif_bus_get_context_size(enum qdf_bus_type bus_type);
void hif_read_phy_mem_base(struct hif_softc *scn, qdf_dma_addr_t *bar_value);
uint32_t hif_get_conparam(struct hif_softc *scn);
-struct hif_driver_state_callbacks *hif_get_callbacks_handle(struct hif_softc *scn);
+struct hif_driver_state_callbacks *hif_get_callbacks_handle(
+ struct hif_softc *scn);
bool hif_is_driver_unloading(struct hif_softc *scn);
bool hif_is_load_or_unload_in_progress(struct hif_softc *scn);
bool hif_is_recovery_in_progress(struct hif_softc *scn);
diff --git a/hif/src/hif_napi.c b/hif/src/hif_napi.c
index 47336e5d7214..03699b625715 100644
--- a/hif/src/hif_napi.c
+++ b/hif/src/hif_napi.c
@@ -577,7 +577,7 @@ int hif_napi_event(struct hif_opaque_softc *hif_ctx, enum qca_napi_event event,
__func__);
blacklist_pending = BLACKLIST_OFF_PENDING;
/*
- .*.Ideally we should "collapse" interrupts here, since
+ * Ideally we should "collapse" interrupts here, since
* we are "dispersing" interrupts in the "else" case.
* This allows the possibility that our interrupts may
* still be on the perf cluster the next time we enter
@@ -650,6 +650,7 @@ int hif_napi_event(struct hif_opaque_softc *hif_ctx, enum qca_napi_event event,
rc = 1;
for (i = 0; i < CE_COUNT_MAX; i++) {
struct qca_napi_info *napii = napid->napis[i];
+
if (napii) {
napi = &(napii->napi);
NAPI_DEBUG("%s: enabling NAPI %d",
@@ -661,6 +662,7 @@ int hif_napi_event(struct hif_opaque_softc *hif_ctx, enum qca_napi_event event,
rc = 0;
for (i = 0; i < CE_COUNT_MAX; i++) {
struct qca_napi_info *napii = napid->napis[i];
+
if (napii) {
napi = &(napii->napi);
NAPI_DEBUG("%s: disabling NAPI %d",
@@ -761,7 +763,7 @@ bool hif_napi_correct_cpu(struct qca_napi_info *napi_info)
bool right_cpu = true;
int rc = 0;
cpumask_t cpumask;
- int cpu ;
+ int cpu;
struct qca_napi_data *napid;
napid = hif_napi_get_all(GET_HIF_OPAQUE_HDL(napi_info->hif_ctx));
@@ -783,7 +785,8 @@ bool hif_napi_correct_cpu(struct qca_napi_info *napi_info)
irq_modify_status(napi_info->irq, 0, IRQ_NO_BALANCING);
if (rc)
- HIF_ERROR("error setting irq affinity hint: %d", rc);
+ HIF_ERROR("error setting irq affinity hint: %d",
+ rc);
else
napi_info->stats[cpu].cpu_corrected++;
}
@@ -882,7 +885,7 @@ int hif_napi_poll(struct hif_opaque_softc *hif_ctx,
if ((ce_state) &&
(!ce_check_rx_pending(ce_state) || (0 == rc) ||
!poll_on_right_cpu)) {
- napi_info->stats[cpu].napi_completes++;
+ napi_info->stats[cpu].napi_completes++;
hif_record_ce_desc_event(hif, ce_state->id, NAPI_COMPLETE,
NULL, NULL, 0);
@@ -944,12 +947,11 @@ void hif_napi_update_yield_stats(struct CE_state *ce_state,
if (unlikely(NULL == hif)) {
QDF_ASSERT(NULL != hif);
return;
- } else {
- napi_data = &(hif->napi_data);
- if (unlikely(NULL == napi_data)) {
- QDF_ASSERT(NULL != napi_data);
- return;
- }
+ }
+ napi_data = &(hif->napi_data);
+ if (unlikely(NULL == napi_data)) {
+ QDF_ASSERT(NULL != napi_data);
+ return;
}
if (unlikely(NULL == napi_data->napis[ce_id]))
@@ -990,9 +992,7 @@ void hif_napi_stats(struct qca_napi_data *napid)
qdf_print("lilclhead=%d, bigclhead=%d",
napid->lilcl_head, napid->bigcl_head);
for (i = 0; i < NR_CPUS; i++) {
- qdf_print("CPU[%02d]: state:%d crid=%02d clid=%02d "
- "crmk:0x%0lx thmk:0x%0lx frq:%d "
- "napi = 0x%08x lnk:%d",
+ qdf_print("CPU[%02d]: state:%d crid=%02d clid=%02d crmk:0x%0lx thmk:0x%0lx frq:%d napi = 0x%08x lnk:%d",
i,
cpu[i].state, cpu[i].core_id, cpu[i].cluster_id,
cpu[i].core_mask.bits[0],
@@ -1071,8 +1071,7 @@ static int hnc_link_clusters(struct qca_napi_data *napid)
continue;
}
if (cl_done & (0x01 << cl)) {
- NAPI_DEBUG("Cluster already processed. "
- "SKIPPED\n");
+ NAPI_DEBUG("Cluster already processed. SKIPPED\n");
continue;
} else {
if (more == 0) {
@@ -1083,8 +1082,7 @@ static int hnc_link_clusters(struct qca_napi_data *napid)
prev = -1;
};
if ((curcl >= 0) && (curcl != cl)) {
- NAPI_DEBUG("Entry cl(%d) != curcl(%d). "
- "SKIPPED\n",
+ NAPI_DEBUG("Entry cl(%d) != curcl(%d). SKIPPED\n",
cl, curcl);
continue;
}
@@ -1424,9 +1422,8 @@ retry_collapse:
if (napid->napi_cpu[i].state == QCA_NAPI_CPU_UP) {
destidx = i;
break;
- } else {
- i = napid->napi_cpu[i].cluster_nxt;
}
+ i = napid->napi_cpu[i].cluster_nxt;
}
if ((destidx < 0) && (head == napid->lilcl_head)) {
NAPI_DEBUG("%s: COLLAPSE: no lilcl dest, try bigcl",
@@ -1549,6 +1546,7 @@ static inline void hif_napi_bl_irq(struct qca_napi_data *napid, bool bl_flag)
{
int i;
struct qca_napi_info *napii;
+
for (i = 0; i < CE_COUNT_MAX; i++) {
/* check if NAPI is enabled on the CE */
if (!(napid->ce_map & (0x01 << i)))
@@ -1597,7 +1595,8 @@ static inline int hif_napi_core_ctl_set_boost(bool boost)
* for BLACKLIST_ON op - return value from core_ctl_set_boost API
* for BLACKLIST_OFF op - return value from core_ctl_set_boost API
*/
-int hif_napi_cpu_blacklist(struct qca_napi_data *napid, enum qca_blacklist_op op)
+int hif_napi_cpu_blacklist(struct qca_napi_data *napid,
+ enum qca_blacklist_op op)
{
int rc = 0;
static int ref_count; /* = 0 by the compiler */
@@ -1627,14 +1626,15 @@ int hif_napi_cpu_blacklist(struct qca_napi_data *napid, enum qca_blacklist_op op
}
break;
case BLACKLIST_OFF:
- if (ref_count)
+ if (ref_count) {
ref_count--;
- rc = 0;
- if (ref_count == 0) {
- rc = hif_napi_core_ctl_set_boost(false);
- NAPI_DEBUG("boost_off() returns %d - refcnt=%d",
- rc, ref_count);
- hif_napi_bl_irq(napid, false);
+ rc = 0;
+ if (ref_count == 0) {
+ rc = hif_napi_core_ctl_set_boost(false);
+ NAPI_DEBUG("boost_off() returns %d - refcnt=%d",
+ rc, ref_count);
+ hif_napi_bl_irq(napid, false);
+ }
}
break;
default:
diff --git a/hif/src/mp_dev.c b/hif/src/mp_dev.c
index 94ba0b13223a..4c9c7f95802d 100644
--- a/hif/src/mp_dev.c
+++ b/hif/src/mp_dev.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2014, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2014, 2016-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -83,6 +83,7 @@ static inline void set_target_reg_bits(void __iomem *mem, uint32_t reg,
{
uint32_t value = hif_read32_mb(mem + (reg));
uint32_t shift = 0;
+
value &= ~(bitmask);
while (!((bitmask >> shift) & 0x01))
shift++;
@@ -96,6 +97,7 @@ static inline uint32_t get_target_reg_bits(void __iomem *mem,
{
uint32_t value = hif_read32_mb(mem + (reg));
uint32_t shift = 0;
+
while (!((bitmask >> shift) & 0x01))
shift++;
@@ -309,7 +311,6 @@ void priv_dump_agc(struct hif_softc *scn)
Q_TARGET_ACCESS_END(scn);
- return;
}
void priv_dump_bbwatchdog(struct hif_softc *scn)
diff --git a/hif/src/pcie/if_pci.c b/hif/src/pcie/if_pci.c
index df657a185a9c..d61d313da219 100644
--- a/hif/src/pcie/if_pci.c
+++ b/hif/src/pcie/if_pci.c
@@ -86,7 +86,6 @@ struct ce_irq_reg_table {
#ifndef QCA_WIFI_3_0_ADRASTEA
static inline void hif_pci_route_adrastea_interrupt(struct hif_pci_softc *sc)
{
- return;
}
#else
void hif_pci_route_adrastea_interrupt(struct hif_pci_softc *sc)
@@ -146,9 +145,8 @@ static void pci_dispatch_interrupt(struct hif_softc *scn)
}
Q_TARGET_ACCESS_END(scn);
return;
- } else {
- Q_TARGET_ACCESS_END(scn);
}
+ Q_TARGET_ACCESS_END(scn);
scn->ce_irq_summary = intr_summary;
for (id = 0; intr_summary && (id < scn->ce_count); id++) {
@@ -164,6 +162,7 @@ irqreturn_t hif_pci_interrupt_handler(int irq, void *arg)
struct hif_pci_softc *sc = (struct hif_pci_softc *)arg;
struct hif_softc *scn = HIF_GET_SOFTC(sc);
struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(arg);
+
volatile int tmp;
uint16_t val;
uint32_t bar0;
@@ -189,7 +188,8 @@ irqreturn_t hif_pci_interrupt_handler(int irq, void *arg)
/* Clear Legacy PCI line interrupts
* IMPORTANT: INTR_CLR regiser has to be set
* after INTR_ENABLE is set to 0,
- * otherwise interrupt can not be really cleared */
+ * otherwise interrupt can not be really cleared
+ */
hif_write32_mb(sc->mem +
(SOC_CORE_BASE_ADDRESS |
PCIE_INTR_ENABLE_ADDRESS), 0);
@@ -201,10 +201,11 @@ irqreturn_t hif_pci_interrupt_handler(int irq, void *arg)
HOST_GROUP0_MASK);
if (ADRASTEA_BU)
- hif_write32_mb(sc->mem + 0x2f100c , (host_cause >> 1));
+ hif_write32_mb(sc->mem + 0x2f100c, (host_cause >> 1));
/* IMPORTANT: this extra read transaction is required to
- * flush the posted write buffer */
+ * flush the posted write buffer
+ */
if (!ADRASTEA_BU) {
tmp =
hif_read32_mb(sc->mem +
@@ -335,7 +336,6 @@ void hif_pci_cancel_deferred_target_sleep(struct hif_softc *scn)
#else
inline void hif_pci_cancel_deferred_target_sleep(struct hif_softc *scn)
{
- return;
}
#endif
@@ -391,15 +391,14 @@ static void hif_pci_device_reset(struct hif_pci_softc *sc)
return;
/* NB: Don't check resetok here. This form of reset
- * is integral to correct operation. */
+ * is integral to correct operation.
+ */
- if (!SOC_GLOBAL_RESET_ADDRESS) {
+ if (!SOC_GLOBAL_RESET_ADDRESS)
return;
- }
- if (!mem) {
+ if (!mem)
return;
- }
HIF_ERROR("%s: Reset Device", __func__);
@@ -461,11 +460,11 @@ static void hif_pci_device_warm_reset(struct hif_pci_softc *sc)
struct hif_softc *scn = HIF_GET_SOFTC(sc);
/* NB: Don't check resetok here. This form of reset is
- * integral to correct operation. */
+ * integral to correct operation.
+ */
- if (!mem) {
+ if (!mem)
return;
- }
HIF_INFO_MED("%s: Target Warm Reset", __func__);
@@ -734,7 +733,8 @@ static void __hif_pci_dump_registers(struct hif_softc *scn)
val);
/* read (@gpio_athr_wlan_reg)
- * WLAN_DEBUG_OUT_DATA */
+ * WLAN_DEBUG_OUT_DATA
+ */
val = hif_read32_mb(mem + GPIO_BASE_ADDRESS +
WLAN_DEBUG_OUT_OFFSET);
val = WLAN_DEBUG_OUT_DATA_GET(val);
@@ -855,7 +855,6 @@ static void reschedule_tasklet_work_handler(void *arg)
}
tasklet_schedule(&sc->intr_tq);
- return;
}
/**
@@ -1075,7 +1074,7 @@ static const struct file_operations hif_pci_runtime_pm_fops = {
static void hif_runtime_pm_debugfs_create(struct hif_pci_softc *sc)
{
sc->pm_dentry = debugfs_create_file("cnss_runtime_pm",
- S_IRUSR, NULL, sc,
+ 0400, NULL, sc,
&hif_pci_runtime_pm_fops);
}
@@ -1242,7 +1241,7 @@ static void hif_pm_runtime_sanitize_on_ssr_exit(struct hif_pci_softc *sc)
spin_lock_bh(&sc->runtime_lock);
list_for_each_entry_safe(ctx, tmp, &sc->prevent_suspend_list, list) {
- __hif_pm_runtime_allow_suspend(sc, ctx);
+ __hif_pm_runtime_allow_suspend(sc, ctx);
}
spin_unlock_bh(&sc->runtime_lock);
}
@@ -1539,7 +1538,8 @@ static void hif_set_hia_extnd(struct hif_softc *scn)
target_type == TARGET_TYPE_QCA9984 ||
target_type == TARGET_TYPE_QCA9888) {
/* CHIP revision is 8-11 bits of the CHIP_ID register 0xec
- in RTC space */
+ * in RTC space
+ */
tgt_info->target_revision
= CHIP_ID_REVISION_GET(hif_read32_mb(scn->mem
+ CHIP_ID_ADDRESS));
@@ -1578,7 +1578,8 @@ static void hif_set_hia_extnd(struct hif_softc *scn)
* Assume 1.0 clock can't be tuned, reset to defaults
*/
- qdf_print(KERN_INFO"%s: setting the target pll frac %x intval %x\n",
+ qdf_print(KERN_INFO
+ "%s: setting the target pll frac %x intval %x\n",
__func__, frac, intval);
/* do not touch frac, and int val, let them be default -1,
@@ -1602,7 +1603,8 @@ static void hif_set_hia_extnd(struct hif_softc *scn)
hif_diag_write_access(hif_hdl,
flag2_value + 4, intval);
} else {
- qdf_print(KERN_INFO"%s: no frac provided, skipping pre-configuring PLL\n",
+ qdf_print(KERN_INFO
+ "%s: no frac provided, skipping pre-configuring PLL\n",
__func__);
}
@@ -1619,7 +1621,7 @@ static void hif_set_hia_extnd(struct hif_softc *scn)
hi_desired_cpu_speed_hz));
hif_diag_read_access(hif_hdl, flag2_targ_addr,
&flag2_value);
- qdf_print("\n ====> hi_desired_cpu_speed_hz Address %x\n",
+ qdf_print("\n ==> hi_desired_cpu_speed_hz Address %x\n",
flag2_value);
hif_diag_write_access(hif_hdl, flag2_value,
ar900b_20_targ_clk/*300000000u*/);
@@ -2044,6 +2046,7 @@ timer_free:
void hif_pci_close(struct hif_softc *hif_sc)
{
struct hif_pci_softc *hif_pci_sc = HIF_GET_PCI_SOFTC(hif_sc);
+
hif_pm_runtime_close(hif_pci_sc);
hif_ce_close(hif_sc);
}
@@ -2092,7 +2095,8 @@ static int hif_enable_pci(struct hif_pci_softc *sc,
}
#ifdef CONFIG_ARM_LPAE
/* if CONFIG_ARM_LPAE is enabled, we have to set 64 bits mask
- * for 32 bits device also. */
+ * for 32 bits device also.
+ */
ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
if (ret) {
HIF_ERROR("%s: Cannot enable 64-bit pci DMA", __func__);
@@ -2202,17 +2206,18 @@ static int hif_pci_probe_tgt_wakeup(struct hif_pci_softc *sc)
while (wait_limit-- &&
!(hif_read32_mb(sc->mem +
PCIE_LOCAL_BASE_ADDRESS +
- PCIE_SOC_RDY_STATUS_ADDRESS) \
+ PCIE_SOC_RDY_STATUS_ADDRESS)
& PCIE_SOC_RDY_STATUS_BAR_MASK)) {
qdf_mdelay(10);
}
if (wait_limit < 0) {
- /* AR6320v1 doesn't support checking of BAR0 configuration,
- takes one sec to wait BAR0 ready */
+ /* AR6320v1 doesn't support checking of BAR0
+ * configuration, takes one sec to wait BAR0 ready
+ */
HIF_INFO_MED("%s: AR6320v1 waits two sec for BAR0",
__func__);
}
- }
+ }
#endif
#ifndef QCA_WIFI_3_0
@@ -2379,7 +2384,7 @@ static int hif_configure_msi(struct hif_pci_softc *sc)
return ret;
err_intr:
-if (sc->num_msi_intrs >= 1)
+ if (sc->num_msi_intrs >= 1)
pci_disable_msi(sc->pdev);
return ret;
}
@@ -2402,7 +2407,8 @@ static int hif_pci_configure_legacy_irq(struct hif_pci_softc *sc)
goto end;
}
/* Use sc->irq instead of sc->pdev-irq
- platform_device pdev doesn't have an irq field */
+ * platform_device pdev doesn't have an irq field
+ */
sc->irq = sc->pdev->irq;
/* Use Legacy PCI Interrupts */
hif_write32_mb(sc->mem+(SOC_CORE_BASE_ADDRESS |
@@ -2417,7 +2423,10 @@ static int hif_pci_configure_legacy_irq(struct hif_pci_softc *sc)
(target_type == TARGET_TYPE_AR900B) ||
(target_type == TARGET_TYPE_QCA9984) ||
(target_type == TARGET_TYPE_AR9888) ||
- (target_type == TARGET_TYPE_QCA9888)) {
+ (target_type == TARGET_TYPE_QCA9888) ||
+ (target_type == TARGET_TYPE_AR6320V1) ||
+ (target_type == TARGET_TYPE_AR6320V2) ||
+ (target_type == TARGET_TYPE_AR6320V3)) {
hif_write32_mb(scn->mem + PCIE_LOCAL_BASE_ADDRESS +
PCIE_SOC_WAKE_ADDRESS, PCIE_SOC_WAKE_V_MASK);
}
@@ -2446,14 +2455,14 @@ void hif_pci_nointrs(struct hif_softc *scn)
return;
if (sc->num_msi_intrs > 0) {
/* MSI interrupt(s) */
- for (i = 0; i < sc->num_msi_intrs; i++) {
+ for (i = 0; i < sc->num_msi_intrs; i++)
free_irq(sc->irq + i, sc);
- }
sc->num_msi_intrs = 0;
} else {
/* Legacy PCI line interrupt
- Use sc->irq instead of sc->pdev-irq
- platform_device pdev doesn't have an irq field */
+ * Use sc->irq instead of sc->pdev-irq
+ * platform_device pdev doesn't have an irq field
+ */
free_irq(sc->irq, sc);
}
ce_unregister_irq(hif_state, 0xfff);
@@ -2496,7 +2505,8 @@ void hif_pci_disable_bus(struct hif_softc *scn)
* Need to enable for AR9888_REV1 once CPU warm reset sequence is
* verified for AR9888_REV1
*/
- if ((tgt_info->target_version == AR9888_REV2_VERSION) || (tgt_info->target_version == AR9887_REV1_VERSION))
+ if ((tgt_info->target_version == AR9888_REV2_VERSION) ||
+ (tgt_info->target_version == AR9887_REV1_VERSION))
hif_pci_device_warm_reset(sc);
else
hif_pci_device_reset(sc);
@@ -2829,6 +2839,7 @@ static void hif_runtime_pm_set_state_suspended(struct hif_softc *scn)
static void hif_log_runtime_suspend_success(struct hif_softc *hif_ctx)
{
struct hif_pci_softc *sc = HIF_GET_PCI_SOFTC(hif_ctx);
+
if (sc == NULL)
return;
@@ -2845,6 +2856,7 @@ static void hif_log_runtime_suspend_success(struct hif_softc *hif_ctx)
static void hif_log_runtime_suspend_failure(void *hif_ctx)
{
struct hif_pci_softc *sc = HIF_GET_PCI_SOFTC(hif_ctx);
+
if (sc == NULL)
return;
@@ -2860,6 +2872,7 @@ static void hif_log_runtime_suspend_failure(void *hif_ctx)
static void hif_log_runtime_resume_success(void *hif_ctx)
{
struct hif_pci_softc *sc = HIF_GET_PCI_SOFTC(hif_ctx);
+
if (sc == NULL)
return;
@@ -3243,12 +3256,9 @@ int hif_pci_target_sleep_state_adjust(struct hif_softc *scn,
if (hif_targ_is_awake(scn, pci_addr)) {
hif_state->verified_awake = true;
break;
- } else
- if (!hif_pci_targ_is_present
- (scn, pci_addr)) {
- break;
}
-
+ if (!hif_pci_targ_is_present(scn, pci_addr))
+ break;
if (tot_delay > PCIE_SLEEP_ADJUST_TIMEOUT)
return hif_log_soc_wakeup_timeout(sc);
@@ -3448,6 +3458,7 @@ static void hif_target_sync(struct hif_softc *scn)
if (HAS_FW_INDICATOR) {
int wait_limit = 500;
int fw_ind = 0;
+
HIF_TRACE("%s: Loop checking FW signal", __func__);
while (1) {
fw_ind = hif_read32_mb(scn->mem +
@@ -3487,7 +3498,7 @@ static void hif_target_sync(struct hif_softc *scn)
*/
QDF_STATUS hif_pci_enable_bus(struct hif_softc *ol_sc,
struct device *dev, void *bdev,
- const hif_bus_id *bid,
+ const struct hif_bus_id *bid,
enum hif_enable_type type)
{
int ret = 0;
@@ -3760,7 +3771,8 @@ int hif_pm_runtime_put(struct hif_opaque_softc *hif_ctx)
/**
- * __hif_pm_runtime_prevent_suspend() - prevent runtime suspend for a protocol reason
+ * __hif_pm_runtime_prevent_suspend() - prevent runtime suspend for a protocol
+ * reason
* @hif_sc: pci context
* @lock: runtime_pm lock being acquired
*
diff --git a/hif/src/sdio/hif_bmi_reg_access.c b/hif/src/sdio/hif_bmi_reg_access.c
index 5fbdcd9ee620..1abf31e787d0 100644
--- a/hif/src/sdio/hif_bmi_reg_access.c
+++ b/hif/src/sdio/hif_bmi_reg_access.c
@@ -72,7 +72,8 @@ hif_bmi_buffer_send(struct hif_sdio_dev *device, char *buffer, uint32_t length)
* byte read will hit the counter and cause
* a decrement, while the remaining 3 bytes has no effect.
* The rationale behind this is to make all HIF accesses
- * 4-byte aligned */
+ * 4-byte aligned
+ */
status =
hif_read_write(device, address,
(uint8_t *) p_bmi_cmd_credits, 4,
@@ -84,7 +85,8 @@ hif_bmi_buffer_send(struct hif_sdio_dev *device, char *buffer, uint32_t length)
return QDF_STATUS_E_FAILURE;
}
/* the counter is only 8=bits, ignore anything in the
- *upper 3 bytes */
+ * upper 3 bytes
+ */
(*p_bmi_cmd_credits) &= 0xFF;
}
@@ -135,6 +137,7 @@ hif_bmi_read_write(struct hif_sdio_dev *device,
char *buffer, uint32_t length)
{
QDF_STATUS status;
+
status = hif_read_write(device, RX_LOOKAHEAD_VALID_ADDRESS,
buffer, length,
HIF_RD_SYNC_BYTE_INC, NULL);
@@ -166,12 +169,14 @@ hif_bmi_buffer_receive(struct hif_sdio_dev *device,
uint32_t address;
uint32_t mbox_address[HTC_MAILBOX_NUM_MAX];
struct _HIF_PENDING_EVENTS_INFO hif_pending_events;
+
static HIF_PENDING_EVENTS_FUNC get_pending_events_func;
if (!pending_events_func_check) {
/* see if the HIF layer implements an alternative
* function to get pending events
- * do this only once! */
+ * do this only once!
+ */
hif_configure_device(device,
HIF_DEVICE_GET_PENDING_EVENTS_FUNC,
&get_pending_events_func,
@@ -339,7 +344,8 @@ QDF_STATUS hif_reg_based_get_target_info(struct hif_opaque_softc *hif_ctx,
/*
* The Target's targ_info doesn't match the Host's targ_info.
* We need to do some backwards compatibility work to make this
- * OK.*/
+ * OK.
+ */
QDF_ASSERT(targ_info->target_info_byte_count ==
sizeof(*targ_info));
/* Read the remainder of the targ_info */
@@ -455,11 +461,9 @@ QDF_STATUS hif_bmi_write_scratch_register(struct hif_sdio_dev *device,
("%s: Unable to write to 0x%x\n",
__func__, SDIO_SCRATCH_1_ADDRESS));
return QDF_STATUS_E_FAILURE;
- } else {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("%s: wrote 0x%x to 0x%x\n", __func__,
- buffer, SDIO_SCRATCH_1_ADDRESS));
}
+ AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: wrote 0x%x to 0x%x\n", __func__,
+ buffer, SDIO_SCRATCH_1_ADDRESS));
return status;
}
@@ -483,11 +487,9 @@ QDF_STATUS hif_bmi_read_scratch_register(struct hif_sdio_dev *device)
("%s: Unable to read from 0x%x\n",
__func__, SDIO_SCRATCH_1_ADDRESS));
return QDF_STATUS_E_FAILURE;
- } else {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("%s: read 0x%x from 0x%x\n", __func__,
- buffer, SDIO_SCRATCH_1_ADDRESS));
}
+ AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: read 0x%x from 0x%x\n", __func__,
+ buffer, SDIO_SCRATCH_1_ADDRESS));
return status;
}
diff --git a/hif/src/sdio/hif_diag_reg_access.c b/hif/src/sdio/hif_diag_reg_access.c
index e3cdf157dc3b..3d1ea21747d6 100644
--- a/hif/src/sdio/hif_diag_reg_access.c
+++ b/hif/src/sdio/hif_diag_reg_access.c
@@ -41,7 +41,8 @@
#define WORD_NON_ALIGNMENT_MASK 0x03
/**
- * hif_ar6000_set_address_window_register - set the window address register (using 4-byte register access ).
+ * hif_ar6000_set_address_window_register - set the window address register
+ * (using 4-byte register access).
* @hif_device: hif context
* @register_addr: register address
* @addr: addr
@@ -174,7 +175,8 @@ QDF_STATUS hif_diag_write_access(struct hif_opaque_softc *hif_ctx,
}
/**
- * hif_diag_write_mem - Write a block data to the AR6000 through its diagnostic window.
+ * hif_diag_write_mem - Write a block data to the AR6000 through its diagnostic
+ * window.
* @scn: hif context
* @address: address
* @data: data
@@ -195,8 +197,7 @@ QDF_STATUS hif_diag_write_mem(struct hif_opaque_softc *scn, uint32_t address,
if ((address & WORD_NON_ALIGNMENT_MASK) ||
(nbytes & WORD_NON_ALIGNMENT_MASK)) {
AR_DEBUG_PRINTF(ATH_LOG_ERR,
- ("[%s]addr or length is not 4 bytes"
- " align.addr[0x%08x] len[0x%08x]\n",
+ ("[%s]addr or length is not 4 bytes align.addr[0x%08x] len[0x%08x]\n",
__func__, address, nbytes));
return QDF_STATUS_E_FAILURE;
}
@@ -208,8 +209,7 @@ QDF_STATUS hif_diag_write_mem(struct hif_opaque_softc *scn, uint32_t address,
status = hif_diag_write_access(scn, address + i, tmp_data);
if (status != QDF_STATUS_SUCCESS) {
AR_DEBUG_PRINTF(ATH_LOG_ERR,
- ("Diag Write mem failed.addr[0x%08x]"
- " value[0x%08x]\n",
+ ("Diag Write mem failed.addr[0x%08x] value[0x%08x]\n",
address + i, tmp_data));
return status;
}
@@ -219,7 +219,8 @@ QDF_STATUS hif_diag_write_mem(struct hif_opaque_softc *scn, uint32_t address,
}
/**
- * hif_diag_read_mem - Read a block data to the AR6000 through its diagnostic window.
+ * hif_diag_read_mem - Read a block data to the AR6000 through its diagnostic
+ * window.
* @scn: hif context
* @data: data
* @nbytes: nbytes
@@ -240,8 +241,7 @@ QDF_STATUS hif_diag_read_mem(struct hif_opaque_softc *scn,
if ((address & WORD_NON_ALIGNMENT_MASK) ||
(nbytes & WORD_NON_ALIGNMENT_MASK)) {
AR_DEBUG_PRINTF(ATH_LOG_ERR,
- ("[%s]addr or length is not 4 bytes"
- " align.addr[0x%08x] len[0x%08x]\n",
+ ("[%s]addr or length is not 4 bytes align.addr[0x%08x] len[0x%08x]\n",
__func__, address, nbytes));
return QDF_STATUS_E_FAILURE;
}
@@ -250,8 +250,7 @@ QDF_STATUS hif_diag_read_mem(struct hif_opaque_softc *scn,
status = hif_diag_read_access(scn, address + i, &tmp_data);
if (status != QDF_STATUS_SUCCESS) {
AR_DEBUG_PRINTF(ATH_LOG_ERR,
- ("Diag Write mem failed.addr[0x%08x]"
- " value[0x%08x]\n",
+ ("Diag Write mem failed.addr[0x%08x] value[0x%08x]\n",
address + i, tmp_data));
return status;
}
diff --git a/hif/src/sdio/hif_sdio.c b/hif/src/sdio/hif_sdio.c
index 77b699336efa..dbacbd8a8218 100644
--- a/hif/src/sdio/hif_sdio.c
+++ b/hif/src/sdio/hif_sdio.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -188,8 +188,6 @@ void hif_post_init(struct hif_opaque_softc *hif_ctx, void *target,
if (htc_sdio_device)
hif_dev_setup(htc_sdio_device);
-
- return;
}
/**
diff --git a/hif/src/sdio/hif_sdio_common.h b/hif/src/sdio/hif_sdio_common.h
index 94e06aa9aa83..81022910fff7 100644
--- a/hif/src/sdio/hif_sdio_common.h
+++ b/hif/src/sdio/hif_sdio_common.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -107,7 +107,8 @@
* requirement, but AR6003 support it, so the register
* is placed in vendor specific field 0xF0(bit0)
* In SDIO 3.0, the register is defined in SPEC, and its
- * address is 0x16(bit1) */
+ * address is 0x16(bit1)
+ */
/* interrupt mode register of AR6003 */
#define CCCR_SDIO_IRQ_MODE_REG_AR6003 0xF0
/* mode to enable special 4-bit interrupt assertion without clock */
diff --git a/hif/src/sdio/hif_sdio_dev.c b/hif/src/sdio/hif_sdio_dev.c
index b427148be85b..3662e4182aaa 100644
--- a/hif/src/sdio/hif_sdio_dev.c
+++ b/hif/src/sdio/hif_sdio_dev.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -75,18 +75,16 @@ uint8_t hif_dev_map_pipe_to_mail_box(struct hif_sdio_device *pdev,
uint8_t pipeid)
{
/* TODO: temp version, should not hardcoded here, will be
- * updated after HIF design */
+ * updated after HIF design
+ */
if (2 == pipeid || 3 == pipeid)
return 1;
else if (0 == pipeid || 1 == pipeid)
return 0;
- else {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("%s: pipeid=%d,should not happen\n",
- __func__, pipeid));
- qdf_assert(0);
- return INVALID_MAILBOX_NUMBER;
- }
+ AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: pipeid=%d,should not happen\n",
+ __func__, pipeid));
+ qdf_assert(0);
+ return INVALID_MAILBOX_NUMBER;
}
/**
@@ -104,19 +102,17 @@ uint8_t hif_dev_map_mail_box_to_pipe(struct hif_sdio_device *pdev,
bool upload)
{
/* TODO: temp version, should not hardcoded here, will be
- * updated after HIF design */
- if (mbox_index == 0) {
+ * updated after HIF design
+ */
+ if (mbox_index == 0)
return upload ? 1 : 0;
- } else if (mbox_index == 1) {
+ else if (mbox_index == 1)
return upload ? 3 : 2;
- } else {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("%s:--------------------mboxIndex=%d,upload=%d,"
- " should not happen\n",
+ AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
+ ("%s:-----mboxIndex=%d,upload=%d, should not happen\n",
__func__, mbox_index, upload));
- qdf_assert(0);
- return 0xff;
- }
+ qdf_assert(0);
+ return 0xff;
}
/**
@@ -135,6 +131,7 @@ QDF_STATUS hif_dev_map_service_to_pipe(struct hif_sdio_device *pdev,
bool swap_mapping)
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
+
switch (service_id) {
case HTT_DATA_MSG_SVC:
if (swap_mapping) {
@@ -284,6 +281,7 @@ struct hif_sdio_device *hif_dev_from_hif(struct hif_sdio_dev *hif_device)
{
struct hif_sdio_device *pdev = NULL;
QDF_STATUS status;
+
status = hif_configure_device(hif_device,
HIF_DEVICE_GET_HTC_CONTEXT,
(void **)&pdev, sizeof(struct hif_sdio_device));
@@ -306,6 +304,7 @@ QDF_STATUS hif_dev_disable_interrupts(struct hif_sdio_device *pdev)
{
struct MBOX_IRQ_ENABLE_REGISTERS regs;
QDF_STATUS status = QDF_STATUS_SUCCESS;
+
HIF_ENTER();
LOCK_HIF_DEV(pdev);
@@ -351,6 +350,7 @@ QDF_STATUS hif_dev_enable_interrupts(struct hif_sdio_device *pdev)
{
QDF_STATUS status;
struct MBOX_IRQ_ENABLE_REGISTERS regs;
+
HIF_ENTER();
/* for good measure, make sure interrupt are disabled
@@ -360,7 +360,8 @@ QDF_STATUS hif_dev_enable_interrupts(struct hif_sdio_device *pdev)
* and when HTC is finally ready to handle interrupts,
* other software can perform target "soft" resets.
* The AR6K interrupt enables reset back to an "enabled"
- * state when this happens. */
+ * state when this happens.
+ */
hif_dev_disable_interrupts(pdev);
/* Unmask the host controller interrupts */
@@ -369,7 +370,8 @@ QDF_STATUS hif_dev_enable_interrupts(struct hif_sdio_device *pdev)
LOCK_HIF_DEV(pdev);
/* Enable all the interrupts except for the internal
- * AR6000 CPU interrupt */
+ * AR6000 CPU interrupt
+ */
pdev->IrqEnableRegisters.int_status_enable =
INT_STATUS_ENABLE_ERROR_SET(0x01) |
INT_STATUS_ENABLE_CPU_SET(0x01)
@@ -384,7 +386,7 @@ QDF_STATUS hif_dev_enable_interrupts(struct hif_sdio_device *pdev)
* CPU sourced interrupt #0, #1.
* #0 is used for report assertion from target
* #1 is used for inform host that credit arrived
- * */
+ */
pdev->IrqEnableRegisters.cpu_int_status_enable = 0x03;
/* Set up the Error Interrupt Status Register */
@@ -393,7 +395,8 @@ QDF_STATUS hif_dev_enable_interrupts(struct hif_sdio_device *pdev)
| ERROR_STATUS_ENABLE_TX_OVERFLOW_SET(0x01)) >> 16;
/* Set up the Counter Interrupt Status Register
- * (only for debug interrupt to catch fatal errors) */
+ * (only for debug interrupt to catch fatal errors)
+ */
pdev->IrqEnableRegisters.counter_int_status_enable =
(COUNTER_INT_STATUS_ENABLE_BIT_SET(AR6K_TARGET_DEBUG_INTR_MASK)) >>
24;
@@ -434,7 +437,7 @@ QDF_STATUS hif_dev_setup(struct hif_sdio_device *pdev)
{
QDF_STATUS status;
uint32_t blocksizes[MAILBOX_COUNT];
- HTC_CALLBACKS htc_callbacks;
+ struct htc_callbacks htc_cbs;
struct hif_sdio_dev *hif_device = pdev->HIFDevice;
HIF_ENTER();
@@ -504,7 +507,8 @@ QDF_STATUS hif_dev_setup(struct hif_sdio_device *pdev)
pdev->HifMaskUmaskRecvEvent = NULL;
/* see if the HIF layer implements the mask/unmask recv
- * events function */
+ * events function
+ */
hif_configure_device(hif_device,
HIF_DEVICE_GET_RECV_EVENT_MASK_UNMASK_FUNC,
&pdev->HifMaskUmaskRecvEvent,
@@ -512,12 +516,12 @@ QDF_STATUS hif_dev_setup(struct hif_sdio_device *pdev)
status = hif_dev_disable_interrupts(pdev);
- qdf_mem_zero(&htc_callbacks, sizeof(HTC_CALLBACKS));
+ qdf_mem_zero(&htc_cbs, sizeof(struct htc_callbacks));
/* the device layer handles these */
- htc_callbacks.rwCompletionHandler = hif_dev_rw_completion_handler;
- htc_callbacks.dsrHandler = hif_dev_dsr_handler;
- htc_callbacks.context = pdev;
- status = hif_attach_htc(pdev->HIFDevice, &htc_callbacks);
+ htc_cbs.rwCompletionHandler = hif_dev_rw_completion_handler;
+ htc_cbs.dsrHandler = hif_dev_dsr_handler;
+ htc_cbs.context = pdev;
+ status = hif_attach_htc(pdev->HIFDevice, &htc_cbs);
HIF_EXIT();
return status;
diff --git a/hif/src/sdio/hif_sdio_internal.h b/hif/src/sdio/hif_sdio_internal.h
index 60d14d101ea4..4aa3684440e5 100644
--- a/hif/src/sdio/hif_sdio_internal.h
+++ b/hif/src/sdio/hif_sdio_internal.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2014, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2014, 2016-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -114,12 +114,12 @@ struct hif_sdio_device {
void *pTarget;
};
-#define LOCK_HIF_DEV(device) qdf_spin_lock(&(device)->Lock);
-#define UNLOCK_HIF_DEV(device) qdf_spin_unlock(&(device)->Lock);
-#define LOCK_HIF_DEV_RX(t) qdf_spin_lock(&(t)->RxLock);
-#define UNLOCK_HIF_DEV_RX(t) qdf_spin_unlock(&(t)->RxLock);
-#define LOCK_HIF_DEV_TX(t) qdf_spin_lock(&(t)->TxLock);
-#define UNLOCK_HIF_DEV_TX(t) qdf_spin_unlock(&(t)->TxLock);
+#define LOCK_HIF_DEV(device) qdf_spin_lock(&(device)->Lock)
+#define UNLOCK_HIF_DEV(device) qdf_spin_unlock(&(device)->Lock)
+#define LOCK_HIF_DEV_RX(t) qdf_spin_lock(&(t)->RxLock)
+#define UNLOCK_HIF_DEV_RX(t) qdf_spin_unlock(&(t)->RxLock)
+#define LOCK_HIF_DEV_TX(t) qdf_spin_lock(&(t)->TxLock)
+#define UNLOCK_HIF_DEV_TX(t) qdf_spin_unlock(&(t)->TxLock)
#define DEV_CALC_RECV_PADDED_LEN(pDev, length) \
(((length) + (pDev)->BlockMask) & (~((pDev)->BlockMask)))
diff --git a/hif/src/sdio/hif_sdio_recv.c b/hif/src/sdio/hif_sdio_recv.c
index cfcb88996f18..46ed882bcab2 100644
--- a/hif/src/sdio/hif_sdio_recv.c
+++ b/hif/src/sdio/hif_sdio_recv.c
@@ -100,7 +100,8 @@ static void hif_dev_dump_registers(struct hif_sdio_device *pdev,
if (pdev->MailBoxInfo.gmbox_address != 0) {
/* if the target supports GMBOX hardware,
- * dump some additional state */
+ * dump some additional state
+ */
AR_DEBUG_PRINTF(ATH_DEBUG_ANY,
("GMBOX-HostIntStatus2: 0x%x ",
irq_proc_regs->host_int_status2));
@@ -121,6 +122,7 @@ static void hif_dev_dump_registers(struct hif_sdio_device *pdev,
if (mailbox_counter_registers != NULL) {
int i;
+
for (i = 0; i < 4; i++) {
AR_DEBUG_PRINTF(ATH_DEBUG_ANY,
("Counter[%d]: 0x%x\n", i,
@@ -176,17 +178,18 @@ QDF_STATUS hif_dev_alloc_and_prepare_rx_packets(struct hif_sdio_device *pdev,
} else {
/* HTC header indicates that every packet to follow
* has the same padded length so that it can
- * be optimally fetched as a full bundle */
+ * be optimally fetched as a full bundle
+ */
num_messages =
(hdr->Flags & HTC_FLAGS_RECV_BUNDLE_CNT_MASK)
>> HTC_FLAGS_RECV_BUNDLE_CNT_SHIFT;
/* the count doesn't include the starter frame, just
- * a count of frames to follow */
+ * a count of frames to follow
+ */
num_messages++;
/* A_ASSERT(numMessages <= target->MaxMsgPerBundle); */
AR_DEBUG_PRINTF(ATH_DEBUG_RECV,
- ("HTC header indicates :%d messages can be"
- " fetched as a bundle\n",
+ ("HTC header indicates :%d messages can be fetched as a bundle\n",
num_messages));
}
@@ -197,25 +200,28 @@ QDF_STATUS hif_dev_alloc_and_prepare_rx_packets(struct hif_sdio_device *pdev,
/* get packet buffers for each message, if there was a
* bundle detected in the header,
- * use pHdr as a template to fetch all packets in the bundle */
+ * use pHdr as a template to fetch all packets in the bundle
+ */
for (j = 0; j < num_messages; j++) {
/* reset flag, any packets allocated using the
* RecvAlloc() API cannot be recycled on cleanup,
- * they must be explicitly returned */
+ * they must be explicitly returned
+ */
no_recycle = false;
packet = hif_dev_alloc_rx_buffer(pdev);
if (packet == NULL) {
/* No error, simply need to mark that
- * we are waiting for buffers. */
+ * we are waiting for buffers.
+ */
pdev->RecvStateFlags |= HTC_RECV_WAIT_BUFFERS;
/* pDev->EpWaitingForBuffers = pEndpoint->Id; */
status = QDF_STATUS_E_RESOURCES;
break;
}
- /* AR_DEBUG_ASSERT(pPacket->Endpoint ==
- pEndpoint->Id); */
+ /* AR_DEBUG_ASSERT(pPacket->Endpoint == pEndpoint->Id);
+ */
/* clear flags */
packet->PktInfo.AsRx.HTCRxFlags = 0;
packet->PktInfo.AsRx.IndicationFlags = 0;
@@ -223,25 +229,25 @@ QDF_STATUS hif_dev_alloc_and_prepare_rx_packets(struct hif_sdio_device *pdev,
if (no_recycle)
/* flag that these packets cannot be recycled,
- * they have to be returned to the user */
+ * they have to be returned to the user
+ */
packet->PktInfo.AsRx.HTCRxFlags |=
HTC_RX_PKT_NO_RECYCLE;
/* add packet to queue (also incase we need to
- * cleanup down below) */
+ * cleanup down below)
+ */
HTC_PACKET_ENQUEUE(queue, packet);
- /*
- if (HTC_STOPPING(target)) {
- status = QDF_STATUS_E_CANCELED;
- break;
- }
+ /* if (HTC_STOPPING(target)) {
+ * status = QDF_STATUS_E_CANCELED;
+ * break;
+ * }
*/
/* make sure message can fit in the endpoint buffer */
if ((uint32_t) full_length > packet->BufferLength) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("Payload Length Error : header reports payload"
- " of: %d (%d) endpoint buffer size: %d\n",
+ ("Payload Length Error : header reports payload of: %d (%d) endpoint buffer size: %d\n",
hdr->PayloadLen, full_length,
packet->BufferLength));
status = QDF_STATUS_E_PROTO;
@@ -252,7 +258,8 @@ QDF_STATUS hif_dev_alloc_and_prepare_rx_packets(struct hif_sdio_device *pdev,
/* for messages fetched in a bundle the expected
* lookahead is unknown as we are only using the
* lookahead of the first packet as a template
- * of what to expect for lengths */
+ * of what to expect for lengths
+ */
packet->PktInfo.AsRx.HTCRxFlags |=
HTC_RX_PKT_REFRESH_HDR;
/* set it to something invalid */
@@ -301,8 +308,7 @@ static inline QDF_STATUS hif_dev_recv_packet(struct hif_sdio_device *pdev,
if (padded_length > packet->BufferLength) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("DevRecvPacket, Not enough space for"
- " padlen:%d recvlen:%d bufferlen:%d\n",
+ ("DevRecvPacket, Not enough space for padlen:%d recvlen:%d bufferlen:%d\n",
padded_length, recv_length,
packet->BufferLength));
if (packet->Completion != NULL) {
@@ -314,8 +320,7 @@ static inline QDF_STATUS hif_dev_recv_packet(struct hif_sdio_device *pdev,
/* mailbox index is saved in Endpoint member */
AR_DEBUG_PRINTF(ATH_DEBUG_RECV,
- ("hif_dev_recv_packet (0x%lX : hdr:0x%X) Len:%d,"
- " Padded Length: %d Mbox:0x%X\n",
+ ("hif_dev_recv_packet (0x%lX : hdr:0x%X) Len:%d, Padded Length: %d Mbox:0x%X\n",
(unsigned long)packet,
packet->PktInfo.AsRx.ExpectedHdr, recv_length,
padded_length,
@@ -343,8 +348,7 @@ static inline QDF_STATUS hif_dev_recv_packet(struct hif_sdio_device *pdev,
HTC_FRAME_HDR *hdr =
(HTC_FRAME_HDR *) packet->pBuffer;
AR_DEBUG_PRINTF(ATH_DEBUG_RECV,
- ("hif_dev_recv_packet "
- "EP:%d,Len:%d,Flag:%d,CB:0x%02X,0x%02X\n",
+ ("hif_dev_recv_packet EP:%d,Len:%d,Flag:%d,CB:0x%02X,0x%02X\n",
hdr->EndpointID, hdr->PayloadLen,
hdr->Flags, hdr->ControlBytes0,
hdr->ControlBytes1));
@@ -391,8 +395,7 @@ static inline QDF_STATUS hif_dev_process_trailer(struct hif_sdio_device *pdev,
if (record->Length > length) {
/* no room left in buffer for record */
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- (" invalid record len: %d (id:%d) buffer has:"
- "%d bytes left\n",
+ (" invalid record len: %d (id:%d) buffer has:%d bytes left\n",
record->Length, record->RecordID,
length));
status = QDF_STATUS_E_PROTO;
@@ -414,8 +417,7 @@ static inline QDF_STATUS hif_dev_process_trailer(struct hif_sdio_device *pdev,
&& (next_look_aheads != NULL)) {
AR_DEBUG_PRINTF(ATH_DEBUG_RECV,
- (" look_ahead Report (pre valid:0x%X,"
- " post valid:0x%X) %d %d\n",
+ (" look_ahead Report (pre valid:0x%X, post valid:0x%X) %d %d\n",
look_ahead->PreValid,
look_ahead->PostValid,
from_endpoint,
@@ -464,7 +466,8 @@ static inline QDF_STATUS hif_dev_process_trailer(struct hif_sdio_device *pdev,
> HTC_MAX_MSG_PER_BUNDLE) {
/* this should never happen, the target
* restricts the number of messages per
- * bundle configured by the host */
+ * bundle configured by the host
+ */
A_ASSERT(false);
status = QDF_STATUS_E_PROTO;
break;
@@ -515,7 +518,8 @@ static inline QDF_STATUS hif_dev_process_trailer(struct hif_sdio_device *pdev,
/* process a received message (i.e. strip off header,
* process any trailer data).
- * note : locks must be released when this function is called */
+ * note : locks must be released when this function is called
+ */
static QDF_STATUS hif_dev_process_recv_header(struct hif_sdio_device *pdev,
HTC_PACKET *packet,
uint32_t *next_look_aheads,
@@ -541,7 +545,8 @@ static QDF_STATUS hif_dev_process_recv_header(struct hif_sdio_device *pdev,
do {
/* note, we cannot assume the alignment of pBuffer,
* so we use the safe macros to
- * retrieve 16 bit fields */
+ * retrieve 16 bit fields
+ */
payloadLen = HTC_GET_FIELD(buf, HTC_FRAME_HDR,
PAYLOADLEN);
@@ -553,20 +558,22 @@ static QDF_STATUS hif_dev_process_recv_header(struct hif_sdio_device *pdev,
if (packet->PktInfo.AsRx.HTCRxFlags & HTC_RX_PKT_REFRESH_HDR) {
/* refresh expected hdr, since this was unknown
* at the time we grabbed the packets
- * as part of a bundle */
+ * as part of a bundle
+ */
packet->PktInfo.AsRx.ExpectedHdr = look_ahead;
/* refresh actual length since we now have the
- * real header */
+ * real header
+ */
packet->ActualLength = payloadLen + HTC_HDR_LENGTH;
/* validate the actual header that was refreshed */
if (packet->ActualLength > packet->BufferLength) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("Invalid HDR payload length (%d)"
- " in bundled RECV (hdr: 0x%X)\n",
+ ("Invalid HDR payload length (%d) in bundled RECV (hdr: 0x%X)\n",
payloadLen, look_ahead));
/* limit this to max buffer just to print out
- * some of the buffer */
+ * some of the buffer
+ */
packet->ActualLength =
min(packet->ActualLength,
packet->BufferLength);
@@ -577,8 +584,7 @@ static QDF_STATUS hif_dev_process_recv_header(struct hif_sdio_device *pdev,
if (packet->Endpoint
!= HTC_GET_FIELD(buf, HTC_FRAME_HDR, ENDPOINTID)) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("Refreshed HDR endpoint (%d) does not "
- " match expected endpoint (%d)\n",
+ ("Refreshed HDR endpoint (%d) does not match expected endpoint (%d)\n",
HTC_GET_FIELD(buf,
HTC_FRAME_HDR,
ENDPOINTID),
@@ -591,10 +597,10 @@ static QDF_STATUS hif_dev_process_recv_header(struct hif_sdio_device *pdev,
if (look_ahead != packet->PktInfo.AsRx.ExpectedHdr) {
/* somehow the lookahead that gave us the full read
* length did not reflect the actual header
- * in the pending message */
+ * in the pending message
+ */
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("hif_dev_process_recv_header, lookahead mismatch!"
- " (pPkt:0x%lX flags:0x%X), 0x%08X != 0x%08X\n",
+ ("hif_dev_process_recv_header, lookahead mismatch! (pPkt:0x%lX flags:0x%X), 0x%08X != 0x%08X\n",
(unsigned long)packet,
packet->PktInfo.AsRx.HTCRxFlags,
look_ahead,
@@ -633,8 +639,7 @@ static QDF_STATUS hif_dev_process_recv_header(struct hif_sdio_device *pdev,
if ((temp < sizeof(HTC_RECORD_HDR))
|| (temp > payloadLen)) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("hif_dev_process_recv_header, invalid header"
- "(payloadlength should be :%d, CB[0] is:%d)\n",
+ ("hif_dev_process_recv_header, invalid header(payloadlength should be :%d, CB[0] is:%d)\n",
payloadLen, temp));
status = QDF_STATUS_E_PROTO;
break;
@@ -645,13 +650,15 @@ static QDF_STATUS hif_dev_process_recv_header(struct hif_sdio_device *pdev,
/* this packet was fetched as part of an HTC
* bundle as the lookahead is not valid.
* Next packet may have already been fetched as
- * part of the bundle */
+ * part of the bundle
+ */
next_look_aheads = NULL;
num_look_aheads = NULL;
}
/* process trailer data that follows HDR and
- * application payload */
+ * application payload
+ */
status = hif_dev_process_trailer(pdev,
(buf + HTC_HDR_LENGTH +
payloadLen - temp), temp,
@@ -696,8 +703,8 @@ static QDF_STATUS hif_dev_issue_recv_packet_bundle(struct hif_sdio_device *pdev,
HTC_PACKET *packet, *packet_rx_bundle;
HTC_TARGET *target = NULL;
uint32_t padded_length;
-
int bundleSpaceRemaining = 0;
+
target = (HTC_TARGET *) pdev->pTarget;
if ((HTC_PACKET_QUEUE_DEPTH(recv_pkt_queue) - HTC_MAX_MSG_PER_BUNDLE) >
@@ -779,6 +786,23 @@ static QDF_STATUS hif_dev_issue_recv_packet_bundle(struct hif_sdio_device *pdev,
return status;
}
+static inline void hif_dev_free_recv_pkt_queue(HTC_PACKET_QUEUE *recv_pkt_queue)
+{
+ HTC_PACKET *packet;
+ qdf_nbuf_t netbuf;
+
+ while (!HTC_QUEUE_EMPTY(recv_pkt_queue)) {
+
+ packet = htc_packet_dequeue(recv_pkt_queue);
+ if (packet == NULL)
+ break;
+ netbuf = (qdf_nbuf_t) packet->
+ pNetBufContext;
+ if (netbuf)
+ qdf_nbuf_free(netbuf);
+ }
+}
+
static
QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
uint8_t mail_box_index,
@@ -808,7 +832,8 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
/* We use async mode to get the packets if the
* device layer supports it. The device layer
* interfaces with HIF in which HIF may have
- * restrictions on how interrupts are processed */
+ * restrictions on how interrupts are processed
+ */
asyncProc = true;
}
@@ -833,7 +858,8 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
}
/* first lookahead sets the expected endpoint IDs for
- * all packets in a bundle */
+ * all packets in a bundle
+ */
id = ((HTC_FRAME_HDR *) &look_aheads[0])->EndpointID;
if (id >= ENDPOINT_MAX) {
@@ -845,7 +871,8 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
}
/* try to allocate as many HTC RX packets indicated
* by the lookaheads these packets are stored
- * in the recvPkt queue */
+ * in the recvPkt queue
+ */
status = hif_dev_alloc_and_prepare_rx_packets(pdev,
look_aheads,
num_look_aheads,
@@ -855,7 +882,8 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
total_fetched += HTC_PACKET_QUEUE_DEPTH(&recv_pkt_queue);
/* we've got packet buffers for all we can currently fetch,
- * this count is not valid anymore */
+ * this count is not valid anymore
+ */
num_look_aheads = 0;
partial_bundle = false;
@@ -865,7 +893,8 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
pkts_fetched = 0;
if ((HTC_PACKET_QUEUE_DEPTH(&recv_pkt_queue) > 1)) {
/* there are enough packets to attempt a bundle
- * transfer and recv bundling is allowed */
+ * transfer and recv bundling is allowed
+ */
status = hif_dev_issue_recv_packet_bundle(pdev,
&recv_pkt_queue,
asyncProc ?
@@ -875,19 +904,8 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
&pkts_fetched,
partial_bundle);
if (QDF_IS_STATUS_ERROR(status)) {
- while (!HTC_QUEUE_EMPTY(
- &recv_pkt_queue)) {
- qdf_nbuf_t netbuf;
-
- packet = htc_packet_dequeue(
- &recv_pkt_queue);
- if (packet == NULL)
- break;
- netbuf = (qdf_nbuf_t) packet->
- pNetBufContext;
- if (netbuf)
- qdf_nbuf_free(netbuf);
- }
+ hif_dev_free_recv_pkt_queue(
+ &recv_pkt_queue);
break;
}
@@ -895,13 +913,15 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
0) {
/* we couldn't fetch all packets at one,
* time this creates a broken
- * bundle */
+ * bundle
+ */
partial_bundle = true;
}
}
/* see if the previous operation fetched any
- * packets using bundling */
+ * packets using bundling
+ */
if (0 == pkts_fetched) {
/* dequeue one packet */
packet = htc_packet_dequeue(&recv_pkt_queue);
@@ -911,7 +931,8 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
if (HTC_PACKET_QUEUE_DEPTH(&recv_pkt_queue) >
0) {
/* lookaheads in all packets except the
- * last one in must be ignored */
+ * last one in must be ignored
+ */
packet->PktInfo.AsRx.HTCRxFlags |=
HTC_RX_PKT_IGNORE_LOOKAHEAD;
}
@@ -924,7 +945,8 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
if (QDF_IS_STATUS_ERROR(status))
break;
/* sent synchronously, queue this packet for
- * synchronous completion */
+ * synchronous completion
+ */
HTC_PACKET_ENQUEUE(&sync_completed_pkts_queue,
packet);
}
@@ -933,12 +955,14 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
/* synchronous handling */
if (pdev->DSRCanYield) {
/* for the SYNC case, increment count that tracks
- * when the DSR should yield */
+ * when the DSR should yield
+ */
pdev->CurrentDSRRecvCount++;
}
/* in the sync case, all packet buffers are now filled,
- * we can process each packet, check lookahead , then repeat */
+ * we can process each packet, check lookahead , then repeat
+ */
/* unload sync completion queue */
while (!HTC_QUEUE_EMPTY(&sync_completed_pkts_queue)) {
@@ -981,7 +1005,8 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
}
/* check whether other OS contexts have queued any WMI
* command/data for WLAN. This check is needed only if WLAN
- * Tx and Rx happens in same thread context */
+ * Tx and Rx happens in same thread context
+ */
/* A_CHECK_DRV_TX(); */
}
if (num_pkts_fetched != NULL)
@@ -1021,7 +1046,8 @@ static QDF_STATUS hif_dev_service_cpu_interrupt(struct hif_sdio_device *pdev)
* to mitigate issues with host bus interconnects that
* restrict bus transfer lengths to be a multiple of 4-bytes
* set W1C value to clear the interrupt, this hits the register
- * first */
+ * first
+ */
reg_buffer[0] = cpu_int_status;
/* the remaining 4 values are set to zero which have no-effect */
reg_buffer[1] = 0;
@@ -1035,17 +1061,18 @@ static QDF_STATUS hif_dev_service_cpu_interrupt(struct hif_sdio_device *pdev)
A_ASSERT(status == QDF_STATUS_SUCCESS);
/* The Interrupt sent to the Host is generated via bit0
- * of CPU INT register */
+ * of CPU INT register
+ */
if (cpu_int_status & 0x1) {
if (pdev && pdev->hif_callbacks.fwEventHandler)
/* It calls into HTC which propagates this
- * to ol_target_failure() */
+ * to ol_target_failure()
+ */
pdev->hif_callbacks.fwEventHandler(pdev->hif_callbacks.
Context, QDF_STATUS_E_FAILURE);
} else
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
- ("%s: Unable to call fwEventHandler,"
- " invalid input arguments\n",
+ ("%s: Unable to call fwEventHandler, invalid input arguments\n",
__func__));
return status;
@@ -1093,7 +1120,8 @@ static QDF_STATUS hif_dev_service_error_interrupt(struct hif_sdio_device *pdev)
/* set up the register transfer buffer to hit the register
* 4 times , this is done to make the access 4-byte
* aligned to mitigate issues with host bus interconnects that
- * restrict bus transfer lengths to be a multiple of 4-bytes */
+ * restrict bus transfer lengths to be a multiple of 4-bytes
+ */
/* set W1C value to clear the interrupt */
reg_buffer[0] = error_int_status;
@@ -1126,9 +1154,9 @@ static QDF_STATUS hif_dev_service_debug_interrupt(struct hif_sdio_device *pdev)
/* Send a target failure event to the application */
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Target debug interrupt\n"));
- /* clear the interrupt , the debug error interrupt is
- * counter 0 */
- /* read counter to clear interrupt */
+ /* clear the interrupt , the debug error interrupt is counter 0
+ * read counter to clear interrupt
+ */
status = hif_read_write(pdev->HIFDevice,
COUNT_DEC_ADDRESS,
(uint8_t *) &dummy,
@@ -1163,7 +1191,8 @@ QDF_STATUS hif_dev_service_counter_interrupt(struct hif_sdio_device *pdev)
/* Check if the debug interrupt is pending
* NOTE: other modules like GMBOX may use the counter interrupt
* for credit flow control on other counters, we only need to
- * check for the debug assertion counter interrupt */
+ * check for the debug assertion counter interrupt
+ */
if (counter_int_status & AR6K_TARGET_DEBUG_INTR_MASK)
return hif_dev_service_debug_interrupt(pdev);
@@ -1197,14 +1226,16 @@ static QDF_STATUS hif_dev_process_pending_irqs(struct hif_sdio_device *pdev,
* of this call allows us to perform SYNCHRONOUS I/O,
* that is we can block, sleep or call any API that
* can block or switch thread/task ontexts.
- * This is a fully schedulable context. */
+ * This is a fully schedulable context.
+ */
do {
if (pdev->IrqEnableRegisters.int_status_enable == 0) {
/* interrupt enables have been cleared, do not try
* to process any pending interrupts that
* may result in more bus transactions.
- * The target may be unresponsive at this point. */
+ * The target may be unresponsive at this point.
+ */
break;
}
status = hif_read_write(pdev->HIFDevice,
@@ -1229,18 +1260,21 @@ static QDF_STATUS hif_dev_process_pending_irqs(struct hif_sdio_device *pdev,
/* only look at mailbox status if the HIF layer did not
* provide this function, on some HIF interfaces reading
- * the RX lookahead is not valid to do */
+ * the RX lookahead is not valid to do
+ */
for (i = 0; i < MAILBOX_USED_COUNT; i++) {
look_ahead[i] = 0;
if (host_int_status & (1 << i)) {
/* mask out pending mailbox value, we use
* "lookAhead" as the real flag for
- * mailbox processing below */
+ * mailbox processing below
+ */
host_int_status &= ~(1 << i);
if (pdev->IrqProcRegisters.
rx_lookahead_valid & (1 << i)) {
/* mailbox has a message and the
- * look ahead is valid */
+ * look ahead is valid
+ */
look_ahead[i] =
pdev->
IrqProcRegisters.rx_lookahead[
@@ -1266,7 +1300,8 @@ static QDF_STATUS hif_dev_process_pending_irqs(struct hif_sdio_device *pdev,
if ((0 == host_int_status) && !bLookAheadValid) {
/* nothing to process, the caller can use this
- * to break out of a loop */
+ * to break out of a loop
+ */
*done = true;
break;
}
@@ -1274,6 +1309,7 @@ static QDF_STATUS hif_dev_process_pending_irqs(struct hif_sdio_device *pdev,
if (bLookAheadValid) {
for (i = 0; i < MAILBOX_USED_COUNT; i++) {
int fetched = 0;
+
if (look_ahead[i] == 0)
continue;
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,
@@ -1286,7 +1322,8 @@ static QDF_STATUS hif_dev_process_pending_irqs(struct hif_sdio_device *pdev,
* routine of the callers read request.
* This can improve performance by reducing
* the context switching when we rapidly
- * pull packets */
+ * pull packets
+ */
status = hif_dev_recv_message_pending_handler(
pdev, i,
&look_ahead
@@ -1299,7 +1336,8 @@ static QDF_STATUS hif_dev_process_pending_irqs(struct hif_sdio_device *pdev,
if (!fetched) {
/* HTC could not pull any messages out
* due to lack of resources force DSR
- * handle to ack the interrupt */
+ * handle to ack the interrupt
+ */
*async_processing = false;
pdev->RecheckIRQStatusCnt = 0;
}
@@ -1344,7 +1382,8 @@ static QDF_STATUS hif_dev_process_pending_irqs(struct hif_sdio_device *pdev,
* GetPendingEventsFunc, this optimization cannot be used due to
* possible side-effects. For example, SPI requires the host
* to drain all messages from the mailbox before exiting
- * the ISR routine. */
+ * the ISR routine.
+ */
if (!(*async_processing) && (pdev->RecheckIRQStatusCnt == 0)) {
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,
("Bypassing IRQ Status re-check, forcing done\n"));
@@ -1381,10 +1420,12 @@ QDF_STATUS hif_dev_dsr_handler(void *context)
(unsigned long)pdev));
/* reset the recv counter that tracks when we need
- * to yield from the DSR */
+ * to yield from the DSR
+ */
pdev->CurrentDSRRecvCount = 0;
/* reset counter used to flag a re-scan of IRQ
- * status registers on the target */
+ * status registers on the target
+ */
pdev->RecheckIRQStatusCnt = 0;
while (!done) {
@@ -1394,19 +1435,22 @@ QDF_STATUS hif_dev_dsr_handler(void *context)
if (HIF_DEVICE_IRQ_SYNC_ONLY == pdev->HifIRQProcessingMode) {
/* the HIF layer does not allow async IRQ processing,
- * override the asyncProc flag */
+ * override the asyncProc flag
+ */
async_proc = false;
/* this will cause us to re-enter ProcessPendingIRQ()
* and re-read interrupt status registers.
* This has a nice side effect of blocking us until all
* async read requests are completed. This behavior is
* required as we do not allow ASYNC processing
- * in interrupt handlers (like Windows CE) */
+ * in interrupt handlers (like Windows CE)
+ */
if (pdev->DSRCanYield && DEV_CHECK_RECV_YIELD(pdev))
/* ProcessPendingIRQs() pulled enough recv
* messages to satisfy the yield count, stop
- * checking for more messages and return */
+ * checking for more messages and return
+ */
break;
}
@@ -1414,7 +1458,8 @@ QDF_STATUS hif_dev_dsr_handler(void *context)
/* the function does some async I/O for performance,
* we need to exit the ISR immediately, the check below
* will prevent the interrupt from being
- * Ack'd while we handle it asynchronously */
+ * Ack'd while we handle it asynchronously
+ */
break;
}
@@ -1423,11 +1468,13 @@ QDF_STATUS hif_dev_dsr_handler(void *context)
if (QDF_IS_STATUS_SUCCESS(status) && !async_proc) {
/* Ack the interrupt only if :
* 1. we did not get any errors in processing interrupts
- * 2. there are no outstanding async processing requests */
+ * 2. there are no outstanding async processing requests
+ */
if (pdev->DSRCanYield) {
/* if the DSR can yield do not ACK the interrupt, there
* could be more pending messages. The HIF layer
- * must ACK the interrupt on behalf of HTC */
+ * must ACK the interrupt on behalf of HTC
+ */
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,
(" Yield in effect (cur RX count: %d)\n",
pdev->CurrentDSRRecvCount));
@@ -1441,3 +1488,4 @@ QDF_STATUS hif_dev_dsr_handler(void *context)
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ, ("-DevDsrHandler\n"));
return status;
}
+
diff --git a/hif/src/sdio/hif_sdio_send.c b/hif/src/sdio/hif_sdio_send.c
index 524fd76d0677..d3e2dc669710 100644
--- a/hif/src/sdio/hif_sdio_send.c
+++ b/hif/src/sdio/hif_sdio_send.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -122,7 +122,8 @@ QDF_STATUS hif_dev_send_buffer(struct hif_sdio_device *pdev,
if (frag_count > 1) {
/* header data length should be total sending length substract
- * internal data length of netbuf */
+ * internal data length of netbuf
+ */
head_data_len = sizeof(struct hif_sendContext) +
(nbytes - qdf_nbuf_get_frag_len(buf, frag_count - 1));
} else {
@@ -162,6 +163,7 @@ QDF_STATUS hif_dev_send_buffer(struct hif_sdio_device *pdev,
i++) {
int frag_len = qdf_nbuf_get_frag_len(buf, i);
unsigned char *frag_addr = qdf_nbuf_get_frag_vaddr(buf, i);
+
if (frag_len > nbytes)
frag_len = nbytes;
memcpy(pData, frag_addr, frag_len);
diff --git a/hif/src/sdio/if_sdio.c b/hif/src/sdio/if_sdio.c
index e0d95f263f01..beacc380af0e 100644
--- a/hif/src/sdio/if_sdio.c
+++ b/hif/src/sdio/if_sdio.c
@@ -63,11 +63,11 @@
#endif /* ATH_BUS_PM */
#ifndef REMOVE_PKT_LOG
-struct ol_pl_os_dep_funcs *g_ol_pl_os_dep_funcs = NULL;
+struct ol_pl_os_dep_funcs *g_ol_pl_os_dep_funcs;
#endif
#define HIF_SDIO_LOAD_TIMEOUT 1000
-struct hif_sdio_softc *scn = NULL;
+struct hif_sdio_softc *scn;
struct hif_softc *ol_sc;
static atomic_t hif_sdio_load_state;
/* Wait queue for MC thread */
@@ -87,8 +87,8 @@ static A_STATUS hif_sdio_probe(void *context, void *hif_handle)
struct sdio_func *func = NULL;
const struct sdio_device_id *id;
uint32_t target_type;
- HIF_ENTER();
+ HIF_ENTER();
scn = (struct hif_sdio_softc *)qdf_mem_malloc(sizeof(*scn));
if (!scn) {
ret = -ENOMEM;
@@ -142,6 +142,7 @@ static A_STATUS hif_sdio_probe(void *context, void *hif_handle)
} else if ((id->device & MANUFACTURER_ID_AR6K_BASE_MASK) ==
MANUFACTURER_ID_AR6320_BASE) {
int ar6kid = id->device & MANUFACTURER_ID_AR6K_REV_MASK;
+
if (ar6kid >= 1) {
/* v2 or higher silicon */
hif_register_tbl_attach(ol_sc,
@@ -284,8 +285,8 @@ static int init_ath_hif_sdio(void)
static int probed;
QDF_STATUS status;
struct osdrv_callbacks osdrv_callbacks;
- HIF_ENTER();
+ HIF_ENTER();
qdf_mem_zero(&osdrv_callbacks, sizeof(osdrv_callbacks));
osdrv_callbacks.device_inserted_handler = hif_sdio_probe;
osdrv_callbacks.device_removed_handler = hif_sdio_remove;
@@ -403,7 +404,8 @@ void hif_get_target_revision(struct hif_softc *ol_sc)
* Return: QDF_STATUS
*/
QDF_STATUS hif_sdio_enable_bus(struct hif_softc *hif_sc,
- struct device *dev, void *bdev, const hif_bus_id *bid,
+ struct device *dev, void *bdev,
+ const struct hif_bus_id *bid,
enum hif_enable_type type)
{
int ret = 0;
@@ -412,8 +414,7 @@ QDF_STATUS hif_sdio_enable_bus(struct hif_softc *hif_sc,
init_waitqueue_head(&sync_wait_queue);
if (hif_sdio_device_inserted(dev, id)) {
- HIF_ERROR("wlan: %s hif_sdio_device_inserted"
- "failed", __func__);
+ HIF_ERROR("wlan: %s hif_sdio_device_inserted failed", __func__);
return QDF_STATUS_E_NOMEM;
}
@@ -482,8 +483,8 @@ void hif_sdio_set_mailbox_swap(struct hif_softc *hif_sc)
{
struct hif_sdio_softc *scn = HIF_GET_SDIO_SOFTC(hif_sc);
struct hif_sdio_dev *hif_device = scn->hif_handle;
+
hif_device->swap_mailbox = true;
- return;
}
/**
@@ -496,8 +497,8 @@ void hif_sdio_claim_device(struct hif_softc *hif_sc)
{
struct hif_sdio_softc *scn = HIF_GET_SDIO_SOFTC(hif_sc);
struct hif_sdio_dev *hif_device = scn->hif_handle;
+
hif_device->claimed_ctx = hif_sc;
- return;
}
/**
@@ -510,8 +511,8 @@ void hif_sdio_mask_interrupt_call(struct hif_softc *scn)
{
struct hif_sdio_softc *hif_ctx = HIF_GET_SDIO_SOFTC(scn);
struct hif_sdio_dev *hif_device = hif_ctx->hif_handle;
+
hif_mask_interrupt(hif_device);
- return;
}
/**
diff --git a/hif/src/sdio/if_sdio.h b/hif/src/sdio/if_sdio.h
index 12c65a9983cd..08ee7e3a7fbd 100644
--- a/hif/src/sdio/if_sdio.h
+++ b/hif/src/sdio/if_sdio.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -76,7 +76,6 @@ static inline int athdiag_procfs_init(void *scn)
static inline void athdiag_procfs_remove(void)
{
- return;
}
#endif
diff --git a/hif/src/sdio/native_sdio/include/hif_internal.h b/hif/src/sdio/native_sdio/include/hif_internal.h
index c7ad3a92ca51..82db3a0dc774 100644
--- a/hif/src/sdio/native_sdio/include/hif_internal.h
+++ b/hif/src/sdio/native_sdio/include/hif_internal.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -214,7 +214,7 @@ struct hif_sdio_dev {
bool is_suspend;
bool is_disabled;
atomic_t irq_handling;
- HIF_DEVICE_POWER_CHANGE_TYPE power_config;
+ enum HIF_DEVICE_POWER_CHANGE_TYPE power_config;
enum hif_sdio_device_state device_state;
const struct sdio_device_id *id;
struct mmc_host *host;
@@ -232,30 +232,35 @@ struct hif_mailbox_properties {
};
struct hif_device_irq_yield_params {
- int recv_packet_yield_count; /* max number of packets to force DSR
- to return */
+ int recv_packet_yield_count;
+ /* max number of packets to force DSR to return */
};
struct hif_device_mbox_info {
- u_int32_t mbox_addresses[4]; /*first element for legacy HIFs and
- return the address and ARRAY of 32bit words */
+ u_int32_t mbox_addresses[4];
+ /* first element for legacy HIFs and return the address and ARRAY of
+ * 32bit words
+ */
struct hif_mailbox_properties mbox_prop[4];
u_int32_t gmbox_address;
u_int32_t gmbox_size;
- u_int32_t flags; /* flags to describe mbox behavior or usage */
+ u_int32_t flags;
+ /* flags to describe mbox behavior or usage */
};
enum hif_device_irq_mode {
- HIF_DEVICE_IRQ_SYNC_ONLY, /* DSR to process all
- * interrupts before returning */
+ HIF_DEVICE_IRQ_SYNC_ONLY,
+ /* DSR to process all interrupts before returning */
HIF_DEVICE_IRQ_ASYNC_SYNC, /* DSR to process interrupts */
};
struct osdrv_callbacks {
- void *context; /* context to pass for all callbacks
- * except device_removed_handler
- * the device_removed_handler is only
- * called if the device is claimed */
+ void *context;
+ /* context to pass for all callbacks
+ * except device_removed_handler
+ * the device_removed_handler is only
+ * called if the device is claimed
+ */
int (*device_inserted_handler)(void *context, void *hif_handle);
int (*device_removed_handler)(void *claimed_ctx,
void *hif_handle);
@@ -263,7 +268,7 @@ struct osdrv_callbacks {
int (*device_resume_handler)(void *context);
int (*device_wakeup_handler)(void *context);
int (*device_power_change_handler)(void *context,
- HIF_DEVICE_POWER_CHANGE_TYPE
+ enum HIF_DEVICE_POWER_CHANGE_TYPE
config);
};
@@ -301,7 +306,7 @@ QDF_STATUS hif_configure_device(struct hif_sdio_dev *device,
QDF_STATUS hif_init(struct osdrv_callbacks *callbacks);
QDF_STATUS hif_attach_htc(struct hif_sdio_dev *device,
- HTC_CALLBACKS *callbacks);
+ struct htc_callbacks *callbacks);
QDF_STATUS hif_read_write(struct hif_sdio_dev *device,
uint32_t address,
@@ -349,8 +354,8 @@ struct _HIF_SCATTER_REQ {
struct _HIF_SCATTER_ITEM scatter_list[1]; /* start of scatter list */
};
-typedef struct
-_HIF_SCATTER_REQ * (*HIF_ALLOCATE_SCATTER_REQUEST)(struct hif_sdio_dev *device);
+typedef struct HIF_SCATTER_REQ * (*HIF_ALLOCATE_SCATTER_REQUEST)(
+ struct hif_sdio_dev *device);
typedef void (*HIF_FREE_SCATTER_REQUEST)(struct hif_sdio_dev *device,
struct _HIF_SCATTER_REQ *request);
typedef QDF_STATUS (*HIF_READWRITE_SCATTER)(struct hif_sdio_dev *device,
diff --git a/hif/src/sdio/native_sdio/src/hif.c b/hif/src/sdio/native_sdio/src/hif.c
index d627236383e7..a5d18711cb45 100644
--- a/hif/src/sdio/native_sdio/src/hif.c
+++ b/hif/src/sdio/native_sdio/src/hif.c
@@ -49,7 +49,8 @@
/* by default setup a bounce buffer for the data packets,
* if the underlying host controller driver
* does not use DMA you may be able to skip this step
- * and save the memory allocation and transfer time */
+ * and save the memory allocation and transfer time
+ */
#define HIF_USE_DMA_BOUNCE_BUFFER 1
#define ATH_MODULE_NAME hif
#include "a_debug.h"
@@ -75,74 +76,70 @@
request->address < 0x1FFFF))
#endif
-extern struct hif_sdio_softc *sc;
-
-unsigned int mmcbuswidth = 0;
-module_param(mmcbuswidth, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+unsigned int mmcbuswidth;
+/* PERM:S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH */
+module_param(mmcbuswidth, uint, 0644);
MODULE_PARM_DESC(mmcbuswidth,
"Set MMC driver Bus Width: 1-1Bit, 4-4Bit, 8-8Bit");
-unsigned int mmcclock = 0;
-module_param(mmcclock, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+unsigned int mmcclock;
+module_param(mmcclock, uint, 0644);
MODULE_PARM_DESC(mmcclock, "Set MMC driver Clock value");
-unsigned int brokenirq = 0;
-module_param(brokenirq, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+unsigned int brokenirq;
+module_param(brokenirq, uint, 0644);
MODULE_PARM_DESC(brokenirq,
"Set as 1 to use polling method instead of interrupt mode");
-unsigned int forcesleepmode = 0;
-module_param(forcesleepmode, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+unsigned int forcesleepmode;
+module_param(forcesleepmode, uint, 0644);
MODULE_PARM_DESC(forcesleepmode,
- "Set sleep mode: 0-host capbility, "
- "1-force WOW, 2-force DeepSleep, 3-force CutPower");
+ "Set sleep mode: 0-host capbility, 1-force WOW, 2-force DeepSleep, 3-force CutPower");
#ifdef CONFIG_X86
unsigned int asyncintdelay = 2;
-module_param(asyncintdelay, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+module_param(asyncintdelay, uint, 0644);
MODULE_PARM_DESC(asyncintdelay,
- "Delay clock count for aysnc interrupt, "
- "2 is default, vaild values are 1 and 2");
+ "Delay clock count for async interrupt, 2 is default, valid values are 1 and 2");
#else
-unsigned int asyncintdelay = 0;
-module_param(asyncintdelay, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+unsigned int asyncintdelay;
+module_param(asyncintdelay, uint, 0644);
MODULE_PARM_DESC(asyncintdelay,
- "Delay clock count for aysnc interrupt, "
- "0 is default, vaild values are 1 and 2");
+ "Delay clock count for async interrupt, 0 is default, valid values are 1 and 2");
#endif
-unsigned int forcecard = 0;
-module_param(forcecard, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+unsigned int forcecard;
+module_param(forcecard, uint, 0644);
MODULE_PARM_DESC(forcecard,
"Ignore card capabilities information to switch bus mode");
unsigned int debugcccr = 1;
-module_param(debugcccr, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+module_param(debugcccr, uint, 0644);
MODULE_PARM_DESC(debugcccr, "Output this cccr values");
-unsigned int writecccr1 = 0;
-module_param(writecccr1, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
-unsigned int writecccr1value = 0;
-module_param(writecccr1value, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+unsigned int writecccr1;
+module_param(writecccr1, uint, 0644);
+unsigned int writecccr1value;
+module_param(writecccr1value, uint, 0644);
-unsigned int writecccr2 = 0;
-module_param(writecccr2, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
-unsigned int writecccr2value = 0;
-module_param(writecccr2value, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+unsigned int writecccr2;
+module_param(writecccr2, uint, 0644);
+unsigned int writecccr2value;
+module_param(writecccr2value, uint, 0644);
-unsigned int writecccr3 = 0;
-module_param(writecccr3, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
-unsigned int writecccr3value = 0;
-module_param(writecccr3value, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+unsigned int writecccr3;
+module_param(writecccr3, uint, 0644);
+unsigned int writecccr3value;
+module_param(writecccr3value, uint, 0644);
-unsigned int writecccr4 = 0;
-module_param(writecccr4, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+unsigned int writecccr4;
+module_param(writecccr4, uint, 0644);
-unsigned int writecccr4value = 0;
-module_param(writecccr4value, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+unsigned int writecccr4value;
+module_param(writecccr4value, uint, 0644);
-unsigned int modstrength = 0;
-module_param(modstrength, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+unsigned int modstrength;
+module_param(modstrength, uint, 0644);
MODULE_PARM_DESC(modstrength, "Adjust internal driver strength");
#define dev_to_sdio_func(d) container_of(d, struct sdio_func, dev)
@@ -158,7 +155,7 @@ static int func0_cmd52_write_byte(struct mmc_card *card, unsigned int address,
static int func0_cmd52_read_byte(struct mmc_card *card, unsigned int address,
unsigned char *byte);
-int reset_sdio_on_unload = 0;
+int reset_sdio_on_unload;
module_param(reset_sdio_on_unload, int, 0644);
uint32_t nohifscattersupport = 1;
@@ -315,10 +312,9 @@ QDF_STATUS hif_init(struct osdrv_callbacks *callbacks)
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
("%s sdio_register_driver failed!", __func__));
return QDF_STATUS_E_FAILURE;
- } else {
- AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
- ("%s sdio_register_driver successful", __func__));
}
+ AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
+ ("%s sdio_register_driver successful", __func__));
return QDF_STATUS_SUCCESS;
@@ -389,6 +385,7 @@ __hif_read_write(struct hif_sdio_dev *device,
if (request & HIF_SDIO_WRITE) {
struct hif_device_mbox_info MailBoxInfo;
unsigned int mboxLength = 0;
+
hif_configure_device(device,
HIF_DEVICE_GET_MBOX_ADDR,
&MailBoxInfo, sizeof(MailBoxInfo));
@@ -416,8 +413,7 @@ __hif_read_write(struct hif_sdio_dev *device,
break;
}
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
- ("address:%08X, Length:0x%08X, Dummy:0x%04X, "
- "Final:0x%08X\n",
+ ("address:%08X, Length:0x%08X, Dummy:0x%04X, Final:0x%08X\n",
address, length,
(request & HIF_DUMMY_SPACE_MASK) >> 16,
mboxLength ==
@@ -426,8 +422,7 @@ __hif_read_write(struct hif_sdio_dev *device,
if (mboxLength != 0) {
if (length > mboxLength) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
- ("%s: written length(0x%08X) "
- "larger than mbox len(0x%08x)\n",
+ ("%s: written length(0x%08X) larger than mbox len(0x%08x)\n",
__func__, length, mboxLength));
break;
}
@@ -467,8 +462,8 @@ __hif_read_write(struct hif_sdio_dev *device,
AR_DEBUG_ASSERT(length <= HIF_DMA_BUFFER_SIZE);
if (length > HIF_DMA_BUFFER_SIZE) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
- ("%s: Invalid write length:"
- "%d\n", __func__, length));
+ ("%s: Invalid write length: %d\n",
+ __func__, length));
status = QDF_STATUS_E_INVAL;
break;
}
@@ -486,8 +481,7 @@ __hif_read_write(struct hif_sdio_dev *device,
tbuffer,
length);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
- ("%s: writesb ret=%d address:"
- " 0x%X, len: %d, 0x%X\n",
+ ("%s: writesb ret=%d address: 0x%X, len: %d, 0x%X\n",
__func__, ret, address, length,
*(int *)tbuffer));
} else {
@@ -495,8 +489,7 @@ __hif_read_write(struct hif_sdio_dev *device,
sdio_memcpy_toio(device->func, address,
tbuffer, length);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
- ("%s: writeio ret=%d address: "
- " 0x%X, len: %d, 0x%X\n",
+ ("%s: writeio ret=%d address: 0x%X, len: %d, 0x%X\n",
__func__, ret, address, length,
*(int *)tbuffer));
}
@@ -526,8 +519,7 @@ __hif_read_write(struct hif_sdio_dev *device,
address,
length);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
- ("%s: readsb ret=%d address:"
- " 0x%X, len: %d, 0x%X\n",
+ ("%s: readsb ret=%d address: 0x%X, len: %d, 0x%X\n",
__func__, ret, address, length,
*(int *)tbuffer));
} else {
@@ -536,8 +528,7 @@ __hif_read_write(struct hif_sdio_dev *device,
tbuffer,
address, length);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
- ("%s: readio ret=%d address: 0x%X,"
- " len: %d, 0x%X\n",
+ ("%s: readio ret=%d address: 0x%X, len: %d, 0x%X\n",
__func__, ret, address, length,
*(int *)tbuffer));
}
@@ -555,12 +546,10 @@ __hif_read_write(struct hif_sdio_dev *device,
if (ret) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
- ("%s: SDIO bus operation failed! "
- "MMC stack returned : %d\n",
+ ("%s: SDIO bus operation failed! MMC stack returned : %d\n",
__func__, ret));
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
- ("__hif_read_write, addr:0X%06X, "
- "len:%08d, %s, %s\n",
+ ("__hif_read_write, addr:0X%06X, len:%08d, %s, %s\n",
address, length,
request & HIF_SDIO_READ ? "Read " : "Write",
request & HIF_ASYNCHRONOUS ? "Async" :
@@ -624,8 +613,7 @@ hif_read_write(struct hif_sdio_dev *device,
AR_DEBUG_ASSERT(device != NULL);
AR_DEBUG_ASSERT(device->func != NULL);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
- ("%s: device 0x%p addr 0x%X buffer 0x%p "
- "len %d req 0x%X context 0x%p",
+ ("%s: device 0x%p addr 0x%X buffer 0x%p len %d req 0x%X context 0x%p",
__func__, device, address, buffer,
length, request, context));
@@ -646,8 +634,7 @@ hif_read_write(struct hif_sdio_dev *device,
busrequest = hif_allocate_bus_request(device);
if (busrequest == NULL) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
- ("no async bus requests "
- "available (%s, addr:0x%X, len:%d)\n",
+ ("no async bus requests available (%s, addr:0x%X, len:%d)\n",
request & HIF_SDIO_READ ? "READ" :
"WRITE", address, length));
return QDF_STATUS_E_FAILURE;
@@ -673,6 +660,7 @@ hif_read_write(struct hif_sdio_dev *device,
return QDF_STATUS_E_FAILURE;
} else {
QDF_STATUS status = busrequest->status;
+
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
("%s: sync return freeing 0x%lX: 0x%X\n",
__func__,
@@ -741,7 +729,8 @@ static int async_task(void *param)
}
/* we want to hold the host over multiple cmds
* if possible, but holding the host blocks
- * card interrupts */
+ * card interrupts
+ */
sdio_claim_host(device->func);
qdf_spin_lock_irqsave(&device->asynclock);
/* pull the request to work on */
@@ -761,7 +750,8 @@ static int async_task(void *param)
/* pass the request to scatter routine which
* executes it synchronously, note, no need
* to free the request since scatter requests
- * are maintained on a separate list */
+ * are maintained on a separate list
+ */
status = do_hif_read_write_scatter(device,
request);
} else {
@@ -777,6 +767,7 @@ static int async_task(void *param)
NULL);
if (request->request & HIF_ASYNCHRONOUS) {
void *context = request->context;
+
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
("%s: freeing req: 0x%lX\n",
__func__, (unsigned long)
@@ -892,8 +883,7 @@ static QDF_STATUS reinit_sdio(struct hif_sdio_dev *device)
&cmd52_resp);
if (err) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("%s: CMD52 read to CCCR speed "
- "register failed : %d\n",
+ ("%s: CMD52 read to CCCR speed register failed : %d\n",
__func__, err));
sdio_card_state(card);
/* no need to break */
@@ -903,8 +893,7 @@ static QDF_STATUS reinit_sdio(struct hif_sdio_dev *device)
(cmd52_resp | SDIO_SPEED_EHS));
if (err) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("%s: CMD52 write to CCCR speed"
- " register failed : %d\n",
+ ("%s: CMD52 write to CCCR speed register failed : %d\n",
__func__, err));
break;
}
@@ -940,8 +929,7 @@ static QDF_STATUS reinit_sdio(struct hif_sdio_dev *device)
SDIO_BUS_CD_DISABLE | SDIO_BUS_WIDTH_4BIT);
if (err) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("%s: CMD52 to set bus mode "
- "failed : %d\n",
+ ("%s: CMD52 to set bus mode failed : %d\n",
__func__, err));
break;
}
@@ -982,7 +970,8 @@ static int sdio_enable4bits(struct hif_sdio_dev *device, int enable)
device->id->device & MANUFACTURER_ID_AR6K_BASE_MASK;
/* Re-enable 4-bit ASYNC interrupt on AR6003x
- * after system resume for some host controller */
+ * after system resume for some host controller
+ */
if (manufacturer_id == MANUFACTURER_ID_AR6003_BASE) {
setAsyncIRQ = 1;
ret =
@@ -994,6 +983,7 @@ static int sdio_enable4bits(struct hif_sdio_dev *device, int enable)
} else if (manufacturer_id == MANUFACTURER_ID_AR6320_BASE
|| manufacturer_id == MANUFACTURER_ID_QCA9377_BASE) {
unsigned char data = 0;
+
setAsyncIRQ = 1;
ret =
func0_cmd52_read_byte(func->card,
@@ -1001,8 +991,7 @@ static int sdio_enable4bits(struct hif_sdio_dev *device, int enable)
&data);
if (ret) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("%s: failed to read interrupt "
- "extension register %d\n",
+ ("%s: failed to read interrupt extension register %d\n",
__func__, ret));
sdio_release_host(func);
return ret;
@@ -1019,13 +1008,11 @@ static int sdio_enable4bits(struct hif_sdio_dev *device, int enable)
if (setAsyncIRQ) {
if (ret) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("%s: failed to setup 4-bit "
- "ASYNC IRQ mode into %d err %d\n",
+ ("%s: failed to setup 4-bit ASYNC IRQ mode into %d err %d\n",
__func__, enable, ret));
} else {
AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
- ("%s: Setup 4-bit ASYNC "
- "IRQ mode into %d successfully\n",
+ ("%s: Setup 4-bit ASYNC IRQ mode into %d successfully\n",
__func__, enable));
}
}
@@ -1044,7 +1031,7 @@ static int sdio_enable4bits(struct hif_sdio_dev *device, int enable)
*/
static QDF_STATUS
power_state_change_notify(struct hif_sdio_dev *device,
- HIF_DEVICE_POWER_CHANGE_TYPE config)
+ enum HIF_DEVICE_POWER_CHANGE_TYPE config)
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
struct sdio_func *func = device->func;
@@ -1056,7 +1043,8 @@ power_state_change_notify(struct hif_sdio_dev *device,
switch (config) {
case HIF_DEVICE_POWER_DOWN:
/* Disable 4bits to allow SDIO bus to detect
- * DAT1 as interrupt source */
+ * DAT1 as interrupt source
+ */
sdio_enable4bits(device, 0);
break;
case HIF_DEVICE_POWER_CUT:
@@ -1075,7 +1063,8 @@ power_state_change_notify(struct hif_sdio_dev *device,
status = reinit_sdio(device);
/* set power_config before EnableFunc to
* passthrough sdio r/w action when resuming
- * from cut power */
+ * from cut power
+ */
device->power_config = config;
if (status == QDF_STATUS_SUCCESS)
status = hif_enable_func(device, func);
@@ -1086,6 +1075,7 @@ power_state_change_notify(struct hif_sdio_dev *device,
}
} else if (device->power_config == HIF_DEVICE_POWER_DOWN) {
int ret = sdio_enable4bits(device, 1);
+
status = (ret == 0) ? QDF_STATUS_SUCCESS :
QDF_STATUS_E_FAILURE;
}
@@ -1298,7 +1288,7 @@ hif_configure_device(struct hif_sdio_dev *device,
case HIF_DEVICE_POWER_STATE_CHANGE:
status =
power_state_change_notify(device,
- *(HIF_DEVICE_POWER_CHANGE_TYPE *)
+ *(enum HIF_DEVICE_POWER_CHANGE_TYPE *)
config);
break;
case HIF_DEVICE_GET_IRQ_YIELD_PARAMS:
@@ -1358,7 +1348,8 @@ void hif_sdio_shutdown(struct hif_softc *hif_ctx)
* externally powered and we are unloading the SDIO
* stack. This avoids the problem when the SDIO stack
* is reloaded and attempts are made to re-enumerate
- * a card that is already enumerated */
+ * a card that is already enumerated
+ */
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
("%s: hif_shut_down_device, resetting\n",
__func__));
@@ -1400,13 +1391,15 @@ static void hif_irq_handler(struct sdio_func *func)
{
QDF_STATUS status;
struct hif_sdio_dev *device;
+
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
("%s: Enter\n", __func__));
device = get_hif_device(func);
atomic_set(&device->irq_handling, 1);
/* release the host during intr so we can use
- * it when we process cmds */
+ * it when we process cmds
+ */
sdio_release_host(device->func);
status = device->htc_callbacks.dsrHandler(device->htc_callbacks
.context);
@@ -1446,6 +1439,7 @@ static int startup_task(void *param)
static int enable_task(void *param)
{
struct hif_sdio_dev *device;
+
device = (struct hif_sdio_dev *) param;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
("%s: call from resume_task\n",
@@ -1511,10 +1505,11 @@ static void foce_drive_strength(struct sdio_func *func)
(unsigned int) err));
} else {
value = (value &
- (~CCCR_SDIO_DRIVER_STRENGTH_ENABLE_MASK))
- | CCCR_SDIO_DRIVER_STRENGTH_ENABLE_A
- | CCCR_SDIO_DRIVER_STRENGTH_ENABLE_C
- | CCCR_SDIO_DRIVER_STRENGTH_ENABLE_D;
+ (~CCCR_SDIO_DRIVER_STRENGTH_ENABLE_MASK)
+ ) |
+ CCCR_SDIO_DRIVER_STRENGTH_ENABLE_A |
+ CCCR_SDIO_DRIVER_STRENGTH_ENABLE_C |
+ CCCR_SDIO_DRIVER_STRENGTH_ENABLE_D;
err = func0_cmd52_write_byte(func->card,
addr, value);
if (err) {
@@ -1623,21 +1618,20 @@ static int hif_device_inserted(struct sdio_func *func,
uint32_t clock, clock_set = 12500000;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
- ("%s: Function: "
- "0x%X, Vendor ID: 0x%X, Device ID: 0x%X, "
- "block size: 0x%X/0x%X\n",
- __func__,
- func->num, func->vendor, id->device,
- func->max_blksize,
- func->cur_blksize));
+ ("%s: Function: 0x%X, Vendor ID: 0x%X, Device ID: 0x%X, block size: 0x%X/0x%X\n",
+ __func__, func->num, func->vendor, id->device,
+ func->max_blksize, func->cur_blksize));
/* dma_mask should not be NULL, otherwise dma_map_single
- * will crash. TODO: check why dma_mask is NULL here */
+ * will crash. TODO: check why dma_mask is NULL here
+ */
if (func->dev.dma_mask == NULL) {
static u64 dma_mask = 0xFFFFFFFF;
+
func->dev.dma_mask = &dma_mask;
}
for (i = 0; i < MAX_HIF_DEVICES; ++i) {
struct hif_sdio_dev *hifdevice = hif_devices[i];
+
if (hifdevice && hifdevice->power_config == HIF_DEVICE_POWER_CUT
&& hifdevice->host == func->card->host) {
hifdevice->func = func;
@@ -1668,15 +1662,16 @@ static int hif_device_inserted(struct sdio_func *func,
}
if (i == MAX_HIF_DEVICES) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
- ("%s: No more hif_devices[] slot for %p",
- __func__, device));
+ ("%s: No more hif_devices[] slot for %p",
+ __func__, device));
}
device->id = id;
device->host = func->card->host;
device->is_disabled = true;
-/* TODO: MMC SDIO3.0 Setting should also be modified in ReInit()
- * function when Power Manage work. */
+ /* TODO: MMC SDIO3.0 Setting should also be modified in ReInit()
+ * function when Power Manage work.
+ */
sdio_claim_host(func);
/* force driver strength to type D */
if (forcedriverstrength == 1)
@@ -1723,8 +1718,7 @@ static int hif_device_inserted(struct sdio_func *func,
if (ret) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("%s: CMD52 to set bus width failed: %d\n",
- __func__,
- ret));
+ __func__, ret));
return ret;
}
device->host->ios.bus_width =
@@ -1799,7 +1793,8 @@ static int hif_device_inserted(struct sdio_func *func,
if (!nohifscattersupport) {
/* try to allow scatter operation on all instances,
- * unless globally overridden */
+ * unless globally overridden
+ */
device->scatter_enabled = true;
} else
device->scatter_enabled = false;
@@ -1855,7 +1850,8 @@ void hif_un_mask_interrupt(struct hif_sdio_dev *device)
/*
* On HP Elitebook 8460P, interrupt mode is not stable
* in high throughput, so polling method should be used
- * instead of interrupt mode. */
+ * instead of interrupt mode.
+ */
if (brokenirq) {
AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
("%s: Using broken IRQ mode\n",
@@ -1881,6 +1877,7 @@ void hif_un_mask_interrupt(struct hif_sdio_dev *device)
void hif_mask_interrupt(struct hif_sdio_dev *device)
{
int ret;
+
AR_DEBUG_ASSERT(device != NULL);
AR_DEBUG_ASSERT(device->func != NULL);
@@ -1986,13 +1983,15 @@ static QDF_STATUS hif_disable_func(struct hif_sdio_dev *device,
* where the card does not need to be removed at the end
* of the test. It is expected that the user will also
* un/reload the host controller driver to force the bus
- * driver to re-enumerate the slot */
+ * driver to re-enumerate the slot
+ */
AR_DEBUG_PRINTF(ATH_DEBUG_WARN,
("%s: reseting SDIO card",
__func__));
/* sdio_f0_writeb() cannot be used here, this allows access
- * to undefined registers in the range of: 0xF0-0xFF */
+ * to undefined registers in the range of: 0xF0-0xFF
+ */
ret =
func0_cmd52_write_byte(device->func->card,
@@ -2050,6 +2049,7 @@ static QDF_STATUS hif_enable_func(struct hif_sdio_dev *device,
} else if (manufacturer_id == MANUFACTURER_ID_AR6320_BASE
|| manufacturer_id == MANUFACTURER_ID_QCA9377_BASE) {
unsigned char data = 0;
+
setAsyncIRQ = 1;
ret =
func0_cmd52_read_byte(func->card,
@@ -2082,13 +2082,14 @@ static QDF_STATUS hif_enable_func(struct hif_sdio_dev *device,
}
/* set CCCR 0xF0[7:6] to increase async interrupt delay clock to
- * fix interrupt missing issue on dell 8460p */
+ * fix interrupt missing issue on dell 8460p
+ */
if (asyncintdelay != 0) {
unsigned char data = 0;
- ret =
- func0_cmd52_read_byte(func->card,
+
+ ret = func0_cmd52_read_byte(func->card,
CCCR_SDIO_ASYNC_INT_DELAY_ADDRESS,
- &data);
+ &data);
if (ret) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("%s: failed to read CCCR %d, val is %d\n",
@@ -2135,8 +2136,8 @@ static QDF_STATUS hif_enable_func(struct hif_sdio_dev *device,
if (modstrength) {
unsigned int address = WINDOW_DATA_ADDRESS;
unsigned int value = 0x0FFF;
- ret =
- sdio_memcpy_toio(device->func, address,
+
+ ret = sdio_memcpy_toio(device->func, address,
&value, 4);
if (ret) {
AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
@@ -2221,7 +2222,7 @@ int hif_device_suspend(struct device *dev)
int ret = QDF_STATUS_SUCCESS;
#if defined(MMC_PM_KEEP_POWER)
mmc_pm_flag_t pm_flag = 0;
- HIF_DEVICE_POWER_CHANGE_TYPE config;
+ enum HIF_DEVICE_POWER_CHANGE_TYPE config;
struct mmc_host *host = NULL;
#endif
@@ -2236,9 +2237,8 @@ int hif_device_suspend(struct device *dev)
if (device && device->claimed_ctx
&& osdrv_callbacks.device_suspend_handler) {
device->is_suspend = true;
- status =
- osdrv_callbacks.device_suspend_handler(device->claimed_ctx);
-
+ status = osdrv_callbacks.device_suspend_handler(
+ device->claimed_ctx);
#if defined(MMC_PM_KEEP_POWER)
switch (forcesleepmode) {
case 0: /* depend on sdio host pm capbility */
@@ -2259,7 +2259,8 @@ int hif_device_suspend(struct device *dev)
if (!(pm_flag & MMC_PM_KEEP_POWER)) {
/* cut power support */
/* setting power_config before hif_configure_device to
- * skip sdio r/w when suspending with cut power */
+ * skip sdio r/w when suspending with cut power
+ */
AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
("hif_device_suspend: cut power enter\n"));
config = HIF_DEVICE_POWER_CUT;
@@ -2275,7 +2276,7 @@ int hif_device_suspend(struct device *dev)
HIF_DEVICE_POWER_STATE_CHANGE,
&config,
sizeof
- (HIF_DEVICE_POWER_CHANGE_TYPE));
+ (enum HIF_DEVICE_POWER_CHANGE_TYPE));
if (ret) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
("%s: hif config device failed: %d\n",
@@ -2288,70 +2289,64 @@ int hif_device_suspend(struct device *dev)
AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
("hif_device_suspend: cut power success\n"));
return ret;
- } else {
- ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
+ }
+ ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
+ if (ret) {
+ AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
+ ("%s: set sdio pm flags failed %d\n",
+ __func__, ret));
+ return ret;
+ }
+
+ /* TODO:WOW support */
+ if (pm_flag & MMC_PM_WAKE_SDIO_IRQ) {
+ AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
+ ("hif_device_suspend: wow enter\n"));
+ config = HIF_DEVICE_POWER_DOWN;
+ ret = hif_configure_device(device,
+ HIF_DEVICE_POWER_STATE_CHANGE,
+ &config,
+ sizeof
+ (enum HIF_DEVICE_POWER_CHANGE_TYPE));
+
if (ret) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
- ("%s: set sdio pm flags failed %d\n",
+ ("%s: hif config dev failed: %d\n",
__func__, ret));
return ret;
}
-
- /* TODO:WOW support */
- if (pm_flag & MMC_PM_WAKE_SDIO_IRQ) {
- AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
- ("hif_device_suspend: wow enter\n"));
- config = HIF_DEVICE_POWER_DOWN;
- ret = hif_configure_device(device,
- HIF_DEVICE_POWER_STATE_CHANGE,
- &config,
- sizeof
- (HIF_DEVICE_POWER_CHANGE_TYPE));
-
- if (ret) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
- ("%s: hif config dev failed: %d\n",
+ ret = sdio_set_host_pm_flags(func,
+ MMC_PM_WAKE_SDIO_IRQ);
+ if (ret) {
+ AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
+ ("%s: set sdio pm flags %d\n",
__func__, ret));
- return ret;
- }
- ret =
- sdio_set_host_pm_flags(func,
- MMC_PM_WAKE_SDIO_IRQ);
- if (ret) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
- ("%s: set sdio pm flags %d\n",
- __func__, ret));
- return ret;
- }
- hif_mask_interrupt(device);
- device->device_state = HIF_DEVICE_STATE_WOW;
- AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
- ("hif_device_suspend: wow success\n"));
- return ret;
- } else {
- /* deep sleep support */
- AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
- ("%s: deep sleep enter\n",
- __func__));
-
- /*
- * Wait for some async clean handler finished.
- * These handlers are part of vdev disconnect.
- * As handlers are async,sleep is not suggested,
- * some blocking method may be a good choice.
- * But before adding callback function to these
- * handler, sleep wait is a simple method.
- */
- msleep(100);
- hif_mask_interrupt(device);
- device->device_state =
- HIF_DEVICE_STATE_DEEPSLEEP;
- AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
- ("%s: deep sleep done\n",
- __func__));
return ret;
}
+ hif_mask_interrupt(device);
+ device->device_state = HIF_DEVICE_STATE_WOW;
+ AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
+ ("hif_device_suspend: wow success\n"));
+ return ret;
}
+ /* deep sleep support */
+ AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: deep sleep enter\n",
+ __func__));
+
+ /*
+ * Wait for some async clean handler finished.
+ * These handlers are part of vdev disconnect.
+ * As handlers are async,sleep is not suggested,
+ * some blocking method may be a good choice.
+ * But before adding callback function to these
+ * handler, sleep wait is a simple method.
+ */
+ msleep(100);
+ hif_mask_interrupt(device);
+ device->device_state = HIF_DEVICE_STATE_DEEPSLEEP;
+ AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: deep sleep done\n",
+ __func__));
+ return ret;
#endif
}
@@ -2389,7 +2384,7 @@ int hif_device_resume(struct device *dev)
{
struct sdio_func *func = dev_to_sdio_func(dev);
QDF_STATUS status = QDF_STATUS_SUCCESS;
- HIF_DEVICE_POWER_CHANGE_TYPE config;
+ enum HIF_DEVICE_POWER_CHANGE_TYPE config;
struct hif_sdio_dev *device;
device = get_hif_device(func);
@@ -2399,8 +2394,8 @@ int hif_device_resume(struct device *dev)
status = hif_configure_device(device,
HIF_DEVICE_POWER_STATE_CHANGE,
&config,
- sizeof
- (HIF_DEVICE_POWER_CHANGE_TYPE));
+ sizeof(enum
+ HIF_DEVICE_POWER_CHANGE_TYPE));
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
("%s: hif_configure_device failed\n",
@@ -2442,21 +2437,19 @@ static void hif_device_removed(struct sdio_func *func)
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
struct hif_sdio_dev *device;
- AR_DEBUG_ASSERT(func != NULL);
+ int i;
+ AR_DEBUG_ASSERT(func != NULL);
HIF_ENTER();
-
device = get_hif_device(func);
if (device->power_config == HIF_DEVICE_POWER_CUT) {
device->func = NULL; /* func will be free by mmc stack */
return; /* Just return for cut-off mode */
- } else {
- int i;
- for (i = 0; i < MAX_HIF_DEVICES; ++i) {
- if (hif_devices[i] == device)
- hif_devices[i] = NULL;
- }
+ }
+ for (i = 0; i < MAX_HIF_DEVICES; ++i) {
+ if (hif_devices[i] == device)
+ hif_devices[i] = NULL;
}
if (device->claimed_ctx != NULL)
@@ -2587,7 +2580,7 @@ static void reset_all_cards(void)
}
QDF_STATUS hif_attach_htc(struct hif_sdio_dev *device,
- HTC_CALLBACKS *callbacks)
+ struct htc_callbacks *callbacks)
{
if (device->htc_callbacks.context != NULL)
/* already in use! */
diff --git a/hif/src/sdio/native_sdio/src/hif_scatter.c b/hif/src/sdio/native_sdio/src/hif_scatter.c
index 71d042ff0d21..50ce7ecc695c 100644
--- a/hif/src/sdio/native_sdio/src/hif_scatter.c
+++ b/hif/src/sdio/native_sdio/src/hif_scatter.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -160,7 +160,8 @@ QDF_STATUS do_hif_read_write_scatter(struct hif_sdio_dev *device,
/* setup each sg entry */
if ((unsigned long)req->scatter_list[i].buffer & 0x3) {
/* note some scatter engines can handle unaligned
- * buffers, print this as informational only */
+ * buffers, print this as informational only
+ */
AR_DEBUG_PRINTF(ATH_DEBUG_SCATTER,
("HIF: (%s) Scatter Buf is unaligned 0x%lx\n",
req->
@@ -297,7 +298,8 @@ static QDF_STATUS hif_read_write_scatter(struct hif_sdio_dev *device,
}
/* add bus request to the async list for the async
- * I/O thread to process */
+ * I/O thread to process
+ */
add_to_async_list(device, req_priv->busrequest);
if (request & HIF_SYNCHRONOUS) {
@@ -313,15 +315,15 @@ static QDF_STATUS hif_read_write_scatter(struct hif_sdio_dev *device,
/* interrupted, exit */
status = QDF_STATUS_E_FAILURE;
break;
- } else {
- status = req->completion_status;
}
+ status = req->completion_status;
} else {
AR_DEBUG_PRINTF(ATH_DEBUG_SCATTER,
("HIF-SCATTER: queued async req: 0x%lX\n",
(unsigned long)req_priv->busrequest));
/* wake thread, it will process and then take
- * care of the async callback */
+ * care of the async callback
+ */
up(&device->sem_async);
status = QDF_STATUS_SUCCESS;
}
@@ -356,8 +358,7 @@ QDF_STATUS setup_hif_scatter_support(struct hif_sdio_dev *device,
if (device->func->card->host->max_segs <
MAX_SCATTER_ENTRIES_PER_REQ) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("host only supports scatter of : %d entries,"
- "need: %d\n",
+ ("host only supports scatter of : %d entries, need: %d\n",
device->func->card->host->max_segs,
MAX_SCATTER_ENTRIES_PER_REQ));
status = QDF_STATUS_E_NOSUPPORT;
diff --git a/hif/src/sdio/regtable_sdio.h b/hif/src/sdio/regtable_sdio.h
index 1f282c7a7fa7..d6b30fb16058 100644
--- a/hif/src/sdio/regtable_sdio.h
+++ b/hif/src/sdio/regtable_sdio.h
@@ -834,7 +834,7 @@ struct hostdef_s {
#define AR6320V3_CPU_PLL_INIT_DONE_ADDR 0x404020
#define AR6320V3_CPU_SPEED_ADDR 0x404024
-typedef enum {
+enum a_refclk_speed_t {
SOC_REFCLK_UNKNOWN = -1, /* Unsupported ref clock -- use PLL Bypass */
SOC_REFCLK_48_MHZ = 0,
SOC_REFCLK_19_2_MHZ = 1,
@@ -844,7 +844,7 @@ typedef enum {
SOC_REFCLK_38_4_MHZ = 5,
SOC_REFCLK_40_MHZ = 6,
SOC_REFCLK_52_MHZ = 7,
-} A_refclk_speed_t;
+};
#define A_REFCLK_UNKNOWN SOC_REFCLK_UNKNOWN
#define A_REFCLK_48_MHZ SOC_REFCLK_48_MHZ
@@ -866,20 +866,20 @@ struct wlan_pll_s {
};
struct cmnos_clock_s {
- A_refclk_speed_t refclk_speed;
+ enum a_refclk_speed_t refclk_speed;
uint32_t refclk_hz;
uint32_t pll_settling_time; /* 50us */
struct wlan_pll_s wlan_pll;
};
-typedef struct TGT_REG_SECTION {
+struct tgt_reg_section {
uint32_t start_addr;
uint32_t end_addr;
-} tgt_reg_section;
+};
-typedef struct TGT_REG_TABLE {
- const tgt_reg_section *section;
+struct tgt_reg_table {
+ const struct tgt_reg_section *section;
uint32_t section_size;
-} tgt_reg_table;
+};
#endif /* _REGTABLE_SDIO_H_ */
diff --git a/hif/src/snoc/hif_io32_snoc.h b/hif/src/snoc/hif_io32_snoc.h
index 417e01eb2176..f2a181698ca2 100644
--- a/hif/src/snoc/hif_io32_snoc.h
+++ b/hif/src/snoc/hif_io32_snoc.h
@@ -45,6 +45,7 @@ static inline void ce_enable_irq_in_individual_register(struct hif_softc *scn,
int ce_id)
{
uint32_t offset;
+
offset = HOST_IE_ADDRESS + CE_BASE_ADDRESS(ce_id);
hif_write32_mb(scn->mem + offset, 1);
}
@@ -53,6 +54,7 @@ static inline void ce_disable_irq_in_individual_register(struct hif_softc *scn,
int ce_id)
{
uint32_t offset;
+
offset = HOST_IE_ADDRESS + CE_BASE_ADDRESS(ce_id);
hif_write32_mb(scn->mem + offset, 0);
hif_read32_mb(scn->mem + offset);
diff --git a/hif/src/snoc/if_ahb.c b/hif/src/snoc/if_ahb.c
index 6f986fd14bbe..13909574d9d9 100644
--- a/hif/src/snoc/if_ahb.c
+++ b/hif/src/snoc/if_ahb.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -211,10 +211,9 @@ int hif_target_sync_ahb(struct hif_softc *scn)
if (wait_limit < 0) {
HIF_TRACE("%s: FW signal timed out", __func__);
return -EIO;
- } else {
- HIF_TRACE("%s: Got FW signal, retries = %x", __func__,
- 500-wait_limit);
}
+ HIF_TRACE("%s: Got FW signal, retries = %x", __func__,
+ 500-wait_limit);
}
return 0;
@@ -274,7 +273,7 @@ void hif_ahb_disable_bus(struct hif_softc *scn)
*/
QDF_STATUS hif_ahb_enable_bus(struct hif_softc *ol_sc,
struct device *dev, void *bdev,
- const hif_bus_id *bid,
+ const struct hif_bus_id *bid,
enum hif_enable_type type)
{
int ret = 0;
diff --git a/hif/src/snoc/if_ahb_reset.c b/hif/src/snoc/if_ahb_reset.c
index 6901f4251fee..8a45cc53e76c 100644
--- a/hif/src/snoc/if_ahb_reset.c
+++ b/hif/src/snoc/if_ahb_reset.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -155,7 +155,8 @@ int hif_ahb_enable_radio(struct hif_pci_softc *sc,
}
/* TBD: Temporary changes. Frequency should be
- retrieved through clk_xxx once kernel GCC driver is available */
+ * retrieved through clk_xxx once kernel GCC driver is available
+ */
{
void __iomem *mem_gcc;
uint32_t clk_sel;
@@ -318,7 +319,8 @@ void hif_ahb_device_reset(struct hif_softc *scn)
reset_control_assert(core_resetctl);
/* TBD: Check if we should also assert other bits (radio_cold, radio_
- warm, radio_srif, cpu_ini) */
+ * warm, radio_srif, cpu_ini)
+ */
qdf_mdelay(1); /* TBD: Get reqd delay from HW team */
/* Assert radio cold reset */
diff --git a/hif/src/snoc/if_snoc.c b/hif/src/snoc/if_snoc.c
index b7d5153d5451..dfc78ad19314 100644
--- a/hif/src/snoc/if_snoc.c
+++ b/hif/src/snoc/if_snoc.c
@@ -63,10 +63,10 @@ void hif_snoc_disable_isr(struct hif_softc *scn)
/**
* hif_dump_registers(): dump bus debug registers
- * @scn: struct hif_opaque_softc
+ * @hif_ctx: struct hif_opaque_softc
*
* This function dumps hif bus debug registers
- *
+ *
* Return: 0 for success or error code
*/
int hif_snoc_dump_registers(struct hif_softc *hif_ctx)
@@ -199,7 +199,7 @@ int hif_snoc_bus_configure(struct hif_softc *scn)
* Return: 0 for success
*/
static inline int hif_snoc_get_target_type(struct hif_softc *ol_sc,
- struct device *dev, void *bdev, const hif_bus_id *bid,
+ struct device *dev, void *bdev, const struct hif_bus_id *bid,
uint32_t *hif_type, uint32_t *target_type)
{
/* TODO: need to use HW version. Hard code for now */
@@ -243,7 +243,7 @@ static int hif_set_dma_coherent_mask(struct device *dev)
*/
QDF_STATUS hif_snoc_enable_bus(struct hif_softc *ol_sc,
struct device *dev, void *bdev,
- const hif_bus_id *bid,
+ const struct hif_bus_id *bid,
enum hif_enable_type type)
{
int ret;
@@ -325,6 +325,7 @@ void hif_snoc_disable_bus(struct hif_softc *scn)
void hif_snoc_nointrs(struct hif_softc *scn)
{
struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(scn);
+
if (scn->request_irq_done) {
ce_unregister_irq(hif_state, 0xfff);
scn->request_irq_done = false;
diff --git a/hif/src/usb/hif_usb.c b/hif/src/usb/hif_usb.c
index c4035a12eef1..e184da824229 100644
--- a/hif/src/usb/hif_usb.c
+++ b/hif/src/usb/hif_usb.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -191,6 +191,7 @@ static QDF_STATUS hif_send_internal(HIF_DEVICE_USB *hif_usb_device,
i < (send_context->new_alloc ? frag_count : frag_count - 1); i++) {
int frag_len = qdf_nbuf_get_frag_len(buf, i);
unsigned char *frag_addr = qdf_nbuf_get_frag_vaddr(buf, i);
+
qdf_mem_copy(data_ptr, frag_addr, frag_len);
data_ptr += frag_len;
}
@@ -275,6 +276,7 @@ QDF_STATUS hif_send_head(struct hif_opaque_softc *scn, uint8_t pipe_id,
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
HIF_DEVICE_USB *device = HIF_GET_USB_DEVICE(scn);
+
HIF_TRACE("+%s", __func__);
status = hif_send_internal(device, pipe_id, NULL, wbuf, nbytes);
HIF_TRACE("-%s", __func__);
@@ -288,7 +290,8 @@ QDF_STATUS hif_send_head(struct hif_opaque_softc *scn, uint8_t pipe_id,
*
* Return: # of free resources in pipe_id
*/
-uint16_t hif_get_free_queue_number(struct hif_opaque_softc *scn, uint8_t pipe_id)
+uint16_t hif_get_free_queue_number(struct hif_opaque_softc *scn,
+ uint8_t pipe_id)
{
HIF_DEVICE_USB *device = HIF_GET_USB_DEVICE(scn);
@@ -321,6 +324,7 @@ void hif_post_init(struct hif_opaque_softc *scn, void *target,
void hif_detach_htc(struct hif_opaque_softc *scn)
{
HIF_DEVICE_USB *device = HIF_GET_USB_DEVICE(scn);
+
usb_hif_flush_all(device);
qdf_mem_zero(&device->htc_callbacks, sizeof(device->htc_callbacks));
}
@@ -856,8 +860,8 @@ QDF_STATUS hif_diag_write_mem(struct hif_opaque_softc *scn,
uint8_t *data, int nbytes)
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
- HIF_TRACE("+%s", __func__);
+ HIF_TRACE("+%s", __func__);
if ((address & 0x3) || ((uintptr_t)data & 0x3))
return QDF_STATUS_E_IO;
diff --git a/hif/src/usb/hif_usb_internal.h b/hif/src/usb/hif_usb_internal.h
index 217d2950e242..40ee48db3d81 100644
--- a/hif/src/usb/hif_usb_internal.h
+++ b/hif/src/usb/hif_usb_internal.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -45,19 +45,19 @@
#ifdef HIF_USB_TASKLET
#define HIF_USB_SCHEDULE_WORK(pipe)\
- tasklet_schedule(&pipe->io_complete_tasklet);
+ tasklet_schedule(&pipe->io_complete_tasklet)
#define HIF_USB_INIT_WORK(pipe)\
tasklet_init(&pipe->io_complete_tasklet,\
usb_hif_io_comp_tasklet,\
- (long unsigned int)pipe);
+ (unsigned long)pipe)
-#define HIF_USB_FLUSH_WORK(pipe) flush_work(&pipe->io_complete_work);
+#define HIF_USB_FLUSH_WORK(pipe) flush_work(&pipe->io_complete_work)
#else
-#define HIF_USB_SCHEDULE_WORK(pipe) schedule_work(&pipe->io_complete_work);
+#define HIF_USB_SCHEDULE_WORK(pipe) schedule_work(&pipe->io_complete_work)
#define HIF_USB_INIT_WORK(pipe)\
INIT_WORK(&pipe->io_complete_work,\
- usb_hif_io_comp_work);
+ usb_hif_io_comp_work)
#define HIF_USB_FLUSH_WORK(pipe)
#endif
@@ -70,15 +70,15 @@
#define USB_HIF_SUSPEND ATH_DEBUG_MAKE_MODULE_MASK(5)
#define USB_HIF_ISOC_SUPPORT ATH_DEBUG_MAKE_MODULE_MASK(6)
-struct _HIF_USB_PIPE;
+struct HIF_USB_PIPE;
-typedef struct _HIF_URB_CONTEXT {
+struct HIF_URB_CONTEXT {
DL_LIST link;
- struct _HIF_USB_PIPE *pipe;
+ struct HIF_USB_PIPE *pipe;
qdf_nbuf_t buf;
struct urb *urb;
struct hif_usb_send_context *send_context;
-} HIF_URB_CONTEXT;
+};
#define HIF_USB_PIPE_FLAG_TX (1 << 0)
@@ -87,7 +87,7 @@ typedef struct _HIF_URB_CONTEXT {
*/
struct hif_usb_send_context {
A_BOOL new_alloc;
- HIF_DEVICE_USB *hif_usb_device;
+ struct HIF_DEVICE_USB *hif_usb_device;
qdf_nbuf_t netbuf;
unsigned int transfer_id;
unsigned int head_data_len;
@@ -95,30 +95,32 @@ struct hif_usb_send_context {
extern unsigned int hif_usb_disable_rxdata2;
-extern QDF_STATUS usb_hif_submit_ctrl_in(HIF_DEVICE_USB *macp,
+extern QDF_STATUS usb_hif_submit_ctrl_in(struct HIF_DEVICE_USB *macp,
uint8_t req,
uint16_t value,
uint16_t index,
void *data, uint32_t size);
-extern QDF_STATUS usb_hif_submit_ctrl_out(HIF_DEVICE_USB *macp,
+extern QDF_STATUS usb_hif_submit_ctrl_out(struct HIF_DEVICE_USB *macp,
uint8_t req,
uint16_t value,
uint16_t index,
void *data, uint32_t size);
-QDF_STATUS usb_hif_setup_pipe_resources(HIF_DEVICE_USB *device);
-void usb_hif_cleanup_pipe_resources(HIF_DEVICE_USB *device);
-void usb_hif_prestart_recv_pipes(HIF_DEVICE_USB *device);
-void usb_hif_start_recv_pipes(HIF_DEVICE_USB *device);
-void usb_hif_flush_all(HIF_DEVICE_USB *device);
-void usb_hif_cleanup_transmit_urb(HIF_URB_CONTEXT *urb_context);
-void usb_hif_enqueue_pending_transfer(HIF_USB_PIPE *pipe,
- HIF_URB_CONTEXT *urb_context);
-void usb_hif_remove_pending_transfer(HIF_URB_CONTEXT *urb_context);
-HIF_URB_CONTEXT *usb_hif_alloc_urb_from_pipe(HIF_USB_PIPE *pipe);
+QDF_STATUS usb_hif_setup_pipe_resources(struct HIF_DEVICE_USB *device);
+void usb_hif_cleanup_pipe_resources(struct HIF_DEVICE_USB *device);
+void usb_hif_prestart_recv_pipes(struct HIF_DEVICE_USB *device);
+void usb_hif_start_recv_pipes(struct HIF_DEVICE_USB *device);
+void usb_hif_flush_all(struct HIF_DEVICE_USB *device);
+void usb_hif_cleanup_transmit_urb(struct HIF_URB_CONTEXT *urb_context);
+void usb_hif_enqueue_pending_transfer(struct HIF_USB_PIPE *pipe,
+ struct HIF_URB_CONTEXT *urb_context);
+void usb_hif_remove_pending_transfer(struct HIF_URB_CONTEXT *urb_context);
+struct HIF_URB_CONTEXT *usb_hif_alloc_urb_from_pipe(struct HIF_USB_PIPE *pipe);
+void hif_usb_device_deinit(struct hif_usb_softc *sc);
+QDF_STATUS hif_usb_device_init(struct hif_usb_softc *sc);
#ifdef HIF_USB_TASKLET
-void usb_hif_io_comp_tasklet(long unsigned int context);
+void usb_hif_io_comp_tasklet(unsigned long context);
#else
void usb_hif_io_comp_work(struct work_struct *work);
#endif
diff --git a/hif/src/usb/if_usb.c b/hif/src/usb/if_usb.c
index d66eefb9b8e7..0a1761dd8185 100644
--- a/hif/src/usb/if_usb.c
+++ b/hif/src/usb/if_usb.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -48,10 +48,7 @@ void *fw_ram_seg_addr[FW_RAM_SEG_CNT];
static int hif_usb_unload_dev_num = -1;
-struct hif_usb_softc *g_usb_sc = NULL;
-
-void hif_usb_device_deinit(struct hif_usb_softc *sc);
-QDF_STATUS hif_usb_device_init(struct hif_usb_softc *sc);
+struct hif_usb_softc *g_usb_sc;
/**
* hif_usb_diag_write_cold_reset() - reset SOC by sending a diag command
@@ -187,7 +184,7 @@ exit:
*/
QDF_STATUS hif_usb_enable_bus(struct hif_softc *scn,
struct device *dev, void *bdev,
- const hif_bus_id *bid,
+ const struct hif_bus_id *bid,
enum hif_enable_type type)
{
@@ -234,10 +231,11 @@ QDF_STATUS hif_usb_enable_bus(struct hif_softc *scn,
/* disable lpm to avoid usb2.0 probe timeout */
hif_usb_disable_lpm(usbdev);
- /* params need to be added - TO DO
- scn->enableuartprint = 1;
- scn->enablefwlog = 0;
- scn->max_no_of_peers = 1; */
+ /* params need to be added - TODO
+ * scn->enableuartprint = 1;
+ * scn->enablefwlog = 0;
+ * scn->max_no_of_peers = 1;
+ */
sc->interface = interface;
sc->reboot_notifier.notifier_call = hif_usb_reboot;
@@ -373,6 +371,7 @@ int hif_usb_bus_resume(struct hif_softc *hif_ctx)
int hif_usb_bus_reset_resume(struct hif_softc *hif_ctx)
{
int ret = 0;
+
HIF_ENTER();
if (hif_usb_diag_write_cold_reset(hif_ctx) != QDF_STATUS_SUCCESS)
ret = 1;
@@ -454,7 +453,8 @@ void hif_usb_reg_tbl_attach(struct hif_softc *scn)
return;
/* assign target register table if we find
- corresponding type */
+ * corresponding type
+ */
hif_register_tbl_attach(scn, hif_type);
target_register_tbl_attach(scn, target_type);
/* read the chip revision*/
diff --git a/hif/src/usb/if_usb.h b/hif/src/usb/if_usb.h
index 1232602d4542..7d05c567dfa4 100644
--- a/hif/src/usb/if_usb.h
+++ b/hif/src/usb/if_usb.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -84,7 +84,7 @@ struct fw_ramdump {
};
/* USB Endpoint definition */
-typedef enum {
+enum HIF_USB_PIPE_ID {
HIF_TX_CTRL_PIPE = 0,
HIF_TX_DATA_LP_PIPE,
HIF_TX_DATA_MP_PIPE,
@@ -94,11 +94,11 @@ typedef enum {
HIF_RX_DATA2_PIPE,
HIF_RX_INT_PIPE,
HIF_USB_PIPE_MAX
-} HIF_USB_PIPE_ID;
+};
#define HIF_USB_PIPE_INVALID HIF_USB_PIPE_MAX
-typedef struct _HIF_USB_PIPE {
+struct HIF_USB_PIPE {
DL_LIST urb_list_head;
DL_LIST urb_pending_list;
int32_t urb_alloc;
@@ -118,9 +118,9 @@ typedef struct _HIF_USB_PIPE {
struct sk_buff_head io_comp_queue;
struct usb_endpoint_descriptor *ep_desc;
int32_t urb_prestart_cnt;
-} HIF_USB_PIPE;
+};
-typedef struct _HIF_DEVICE_USB {
+struct HIF_DEVICE_USB {
struct hif_softc ol_sc;
qdf_spinlock_t cs_lock;
qdf_spinlock_t tx_lock;
@@ -128,15 +128,14 @@ typedef struct _HIF_DEVICE_USB {
struct hif_msg_callbacks htc_callbacks;
struct usb_device *udev;
struct usb_interface *interface;
- HIF_USB_PIPE pipes[HIF_USB_PIPE_MAX];
+ struct HIF_USB_PIPE pipes[HIF_USB_PIPE_MAX];
uint8_t *diag_cmd_buffer;
uint8_t *diag_resp_buffer;
void *claimed_context;
A_BOOL is_bundle_enabled;
uint16_t rx_bundle_cnt;
uint32_t rx_bundle_buf_len;
-} HIF_DEVICE_USB;
-
+};
struct hif_usb_softc {
struct _HIF_DEVICE_USB hif_hdl;
diff --git a/hif/src/usb/regtable_usb.h b/hif/src/usb/regtable_usb.h
index d53369880946..4d17bcc0d5e0 100644
--- a/hif/src/usb/regtable_usb.h
+++ b/hif/src/usb/regtable_usb.h
@@ -30,7 +30,7 @@
#define MISSING 0
-typedef struct targetdef_s {
+struct targetdef_s {
u_int32_t d_RTC_SOC_BASE_ADDRESS;
u_int32_t d_RTC_WMAC_BASE_ADDRESS;
u_int32_t d_SYSTEM_SLEEP_OFFSET;
@@ -293,7 +293,7 @@ typedef struct targetdef_s {
u_int32_t d_SOC_CHIP_ID_REVISION_MASK;
u_int32_t d_SOC_CHIP_ID_REVISION_LSB;
/* chip id end */
-} TARGET_REGISTER_TABLE;
+};
#define RTC_SOC_BASE_ADDRESS \
(scn->targetdef->d_RTC_SOC_BASE_ADDRESS)
@@ -987,7 +987,7 @@ typedef struct targetdef_s {
SOC_CPU_CLOCK_STANDARD_MASK)
/* PLL end */
-typedef struct hostdef_s {
+struct hostdef_s {
uint32_t d_INT_STATUS_ENABLE_ERROR_LSB;
uint32_t d_INT_STATUS_ENABLE_ERROR_MASK;
uint32_t d_INT_STATUS_ENABLE_CPU_LSB;
@@ -1046,7 +1046,7 @@ typedef struct hostdef_s {
uint32_t d_SOC_PCIE_BASE_ADDRESS;
uint32_t d_MSI_MAGIC_ADR_ADDRESS;
uint32_t d_MSI_MAGIC_ADDRESS;
-} HOST_REGISTER_TABLE;
+};
#define INT_STATUS_ENABLE_ERROR_LSB \
(scn->hostdef->d_INT_STATUS_ENABLE_ERROR_LSB)
@@ -1240,7 +1240,7 @@ typedef struct hostdef_s {
#define AR6320V3_CPU_PLL_INIT_DONE_ADDR 0x404020
#define AR6320V3_CPU_SPEED_ADDR 0x404024
-typedef enum {
+enum a_refclk_speed_t {
/* Unsupported ref clock -- use PLL Bypass */
SOC_REFCLK_UNKNOWN = -1,
SOC_REFCLK_48_MHZ = 0,
@@ -1251,7 +1251,7 @@ typedef enum {
SOC_REFCLK_38_4_MHZ = 5,
SOC_REFCLK_40_MHZ = 6,
SOC_REFCLK_52_MHZ = 7,
-} A_refclk_speed_t;
+};
#define A_REFCLK_UNKNOWN SOC_REFCLK_UNKNOWN
#define A_REFCLK_48_MHZ SOC_REFCLK_48_MHZ
@@ -1273,21 +1273,22 @@ struct wlan_pll_s {
};
struct cmnos_clock_s {
- A_refclk_speed_t refclk_speed;
+ enum a_refclk_speed_t refclk_speed;
u_int32_t refclk_hz;
u_int32_t pll_settling_time; /* 50us */
struct wlan_pll_s wlan_pll;
};
-typedef struct TGT_REG_SECTION {
+struct tgt_reg_section {
u_int32_t start_addr;
u_int32_t end_addr;
-} tgt_reg_section;
+};
-typedef struct TGT_REG_TABLE {
- const tgt_reg_section *section;
+struct tgt_reg_table {
+ const struct tgt_reg_section *section;
u_int32_t section_size;
-} tgt_reg_table;
+};
+
void target_register_tbl_attach(struct hif_softc *scn,
uint32_t target_type);
void hif_register_tbl_attach(struct hif_softc *scn,
diff --git a/hif/src/usb/usbdrv.c b/hif/src/usb/usbdrv.c
index 1cb1d4430156..8385e2773361 100644
--- a/hif/src/usb/usbdrv.c
+++ b/hif/src/usb/usbdrv.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -42,23 +42,23 @@
((x & FW_RAMDUMP_PATTERN_MASK) == \
FW_RAMDUMP_PATTERN)) ? 1 : 0)
-static void usb_hif_post_recv_transfers(HIF_USB_PIPE *recv_pipe,
+static void usb_hif_post_recv_transfers(struct HIF_USB_PIPE *recv_pipe,
int buffer_length);
static void usb_hif_post_recv_bundle_transfers
- (HIF_USB_PIPE *recv_pipe,
+ (struct HIF_USB_PIPE *recv_pipe,
int buffer_length);
-static void usb_hif_cleanup_recv_urb(HIF_URB_CONTEXT *urb_context);
+static void usb_hif_cleanup_recv_urb(struct HIF_URB_CONTEXT *urb_context);
/**
* usb_hif_free_urb_to_pipe() - add urb back to urb list of a pipe
- * @pipe: pointer to HIF_USB_PIPE
- * @urb_context: pointer to HIF_URB_CONTEXT
+ * @pipe: pointer to struct HIF_USB_PIPE
+ * @urb_context: pointer to struct HIF_URB_CONTEXT
*
* Return: none
*/
-static void usb_hif_free_urb_to_pipe(HIF_USB_PIPE *pipe,
- HIF_URB_CONTEXT *urb_context)
+static void usb_hif_free_urb_to_pipe(struct HIF_USB_PIPE *pipe,
+ struct HIF_URB_CONTEXT *urb_context)
{
qdf_spin_lock_irqsave(&pipe->device->cs_lock);
pipe->urb_cnt++;
@@ -68,19 +68,20 @@ static void usb_hif_free_urb_to_pipe(HIF_USB_PIPE *pipe,
/**
* usb_hif_alloc_urb_from_pipe() - remove urb back from urb list of a pipe
- * @pipe: pointer to HIF_USB_PIPE
+ * @pipe: pointer to struct HIF_USB_PIPE
*
- * Return: HIF_URB_CONTEXT urb context removed from the urb list
+ * Return: struct HIF_URB_CONTEXT urb context removed from the urb list
*/
-HIF_URB_CONTEXT *usb_hif_alloc_urb_from_pipe(HIF_USB_PIPE *pipe)
+struct HIF_URB_CONTEXT *usb_hif_alloc_urb_from_pipe(struct HIF_USB_PIPE *pipe)
{
- HIF_URB_CONTEXT *urb_context = NULL;
+ struct HIF_URB_CONTEXT *urb_context = NULL;
DL_LIST *item;
qdf_spin_lock_irqsave(&pipe->device->cs_lock);
item = dl_list_remove_item_from_head(&pipe->urb_list_head);
if (item != NULL) {
- urb_context = A_CONTAINING_STRUCT(item, HIF_URB_CONTEXT, link);
+ urb_context = A_CONTAINING_STRUCT(item, struct HIF_URB_CONTEXT,
+ link);
pipe->urb_cnt--;
}
qdf_spin_unlock_irqrestore(&pipe->device->cs_lock);
@@ -90,20 +91,21 @@ HIF_URB_CONTEXT *usb_hif_alloc_urb_from_pipe(HIF_USB_PIPE *pipe)
/**
* usb_hif_dequeue_pending_transfer() - remove urb from pending xfer list
- * @pipe: pointer to HIF_USB_PIPE
+ * @pipe: pointer to struct HIF_USB_PIPE
*
- * Return: HIF_URB_CONTEXT urb context removed from the pending xfer list
+ * Return: struct HIF_URB_CONTEXT urb context removed from the pending xfer list
*/
-static HIF_URB_CONTEXT *usb_hif_dequeue_pending_transfer
- (HIF_USB_PIPE *pipe)
+static struct HIF_URB_CONTEXT *usb_hif_dequeue_pending_transfer
+ (struct HIF_USB_PIPE *pipe)
{
- HIF_URB_CONTEXT *urb_context = NULL;
+ struct HIF_URB_CONTEXT *urb_context = NULL;
DL_LIST *item;
qdf_spin_lock_irqsave(&pipe->device->cs_lock);
item = dl_list_remove_item_from_head(&pipe->urb_pending_list);
if (item != NULL)
- urb_context = A_CONTAINING_STRUCT(item, HIF_URB_CONTEXT, link);
+ urb_context = A_CONTAINING_STRUCT(item, struct HIF_URB_CONTEXT,
+ link);
qdf_spin_unlock_irqrestore(&pipe->device->cs_lock);
return urb_context;
@@ -111,13 +113,13 @@ static HIF_URB_CONTEXT *usb_hif_dequeue_pending_transfer
/**
* usb_hif_enqueue_pending_transfer() - add urb to pending xfer list
- * @pipe: pointer to HIF_USB_PIPE
- * @urb_context: pointer to HIF_URB_CONTEXT to be added to the xfer list
+ * @pipe: pointer to struct HIF_USB_PIPE
+ * @urb_context: pointer to struct HIF_URB_CONTEXT to be added to the xfer list
*
* Return: none
*/
-void usb_hif_enqueue_pending_transfer(HIF_USB_PIPE *pipe,
- HIF_URB_CONTEXT *urb_context)
+void usb_hif_enqueue_pending_transfer(struct HIF_USB_PIPE *pipe,
+ struct HIF_URB_CONTEXT *urb_context)
{
qdf_spin_lock_irqsave(&pipe->device->cs_lock);
dl_list_insert_tail(&pipe->urb_pending_list, &urb_context->link);
@@ -127,12 +129,12 @@ void usb_hif_enqueue_pending_transfer(HIF_USB_PIPE *pipe,
/**
* usb_hif_remove_pending_transfer() - remove urb from its own list
- * @urb_context: pointer to HIF_URB_CONTEXT to be removed
+ * @urb_context: pointer to struct HIF_URB_CONTEXT to be removed
*
* Return: none
*/
void
-usb_hif_remove_pending_transfer(HIF_URB_CONTEXT *urb_context)
+usb_hif_remove_pending_transfer(struct HIF_URB_CONTEXT *urb_context)
{
qdf_spin_lock_irqsave(&urb_context->pipe->device->cs_lock);
dl_list_remove(&urb_context->link);
@@ -141,17 +143,17 @@ usb_hif_remove_pending_transfer(HIF_URB_CONTEXT *urb_context)
/**
* usb_hif_alloc_pipe_resources() - allocate urb_cnt urbs to a HIF pipe
- * @pipe: pointer to HIF_USB_PIPE to which resources will be allocated
+ * @pipe: pointer to struct HIF_USB_PIPE to which resources will be allocated
* @urb_cnt: number of urbs to be added to the HIF pipe
*
* Return: QDF_STATUS_SUCCESS if success else an appropriate QDF_STATUS error
*/
static QDF_STATUS usb_hif_alloc_pipe_resources
- (HIF_USB_PIPE *pipe, int urb_cnt)
+ (struct HIF_USB_PIPE *pipe, int urb_cnt)
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
int i;
- HIF_URB_CONTEXT *urb_context;
+ struct HIF_URB_CONTEXT *urb_context;
DL_LIST_INIT(&pipe->urb_list_head);
DL_LIST_INIT(&pipe->urb_pending_list);
@@ -191,13 +193,13 @@ static QDF_STATUS usb_hif_alloc_pipe_resources
/**
* usb_hif_free_pipe_resources() - free urb resources allocated to a HIF pipe
- * @pipe: pointer to HIF_USB_PIPE
+ * @pipe: pointer to struct HIF_USB_PIPE
*
* Return: none
*/
-static void usb_hif_free_pipe_resources(HIF_USB_PIPE *pipe)
+static void usb_hif_free_pipe_resources(struct HIF_USB_PIPE *pipe)
{
- HIF_URB_CONTEXT *urb_context;
+ struct HIF_URB_CONTEXT *urb_context;
if (NULL == pipe->device) {
/* nothing allocated for this pipe */
@@ -304,7 +306,7 @@ QDF_STATUS usb_hif_setup_pipe_resources(HIF_DEVICE_USB *device)
int i;
int urbcount;
QDF_STATUS status = QDF_STATUS_SUCCESS;
- HIF_USB_PIPE *pipe;
+ struct HIF_USB_PIPE *pipe;
uint8_t pipe_num;
/* walk decriptors and setup pipes */
@@ -312,7 +314,7 @@ QDF_STATUS usb_hif_setup_pipe_resources(HIF_DEVICE_USB *device)
endpoint = &iface_desc->endpoint[i].desc;
if (IS_BULK_EP(endpoint->bmAttributes)) {
- HIF_DBG("%s Bulk Ep:0x%2.2X " "maxpktsz:%d",
+ HIF_DBG("%s Bulk Ep:0x%2.2X maxpktsz:%d",
IS_DIR_IN(endpoint->bEndpointAddress) ?
"RX" : "TX",
endpoint->bEndpointAddress,
@@ -417,13 +419,13 @@ void usb_hif_cleanup_pipe_resources(HIF_DEVICE_USB *device)
/**
* usb_hif_flush_pending_transfers() - kill pending urbs for a pipe
- * @pipe: pointer to HIF_USB_PIPE structure
+ * @pipe: pointer to struct HIF_USB_PIPE structure
*
* Return: none
*/
-static void usb_hif_flush_pending_transfers(HIF_USB_PIPE *pipe)
+static void usb_hif_flush_pending_transfers(struct HIF_USB_PIPE *pipe)
{
- HIF_URB_CONTEXT *urb_context;
+ struct HIF_URB_CONTEXT *urb_context;
HIF_TRACE("+%s pipe : %d", __func__, pipe->logical_pipe_num);
@@ -454,7 +456,8 @@ static void usb_hif_flush_pending_transfers(HIF_USB_PIPE *pipe)
void usb_hif_flush_all(HIF_DEVICE_USB *device)
{
int i;
- HIF_USB_PIPE *pipe;
+ struct HIF_USB_PIPE *pipe;
+
HIF_TRACE("+%s", __func__);
for (i = 0; i < HIF_USB_PIPE_MAX; i++) {
@@ -471,11 +474,11 @@ void usb_hif_flush_all(HIF_DEVICE_USB *device)
/**
* usb_hif_cleanup_recv_urb() - cleanup recv urb
- * @urb_context: pointer to HIF_URB_CONTEXT structure
+ * @urb_context: pointer to struct HIF_URB_CONTEXT structure
*
* Return: none
*/
-static void usb_hif_cleanup_recv_urb(HIF_URB_CONTEXT *urb_context)
+static void usb_hif_cleanup_recv_urb(struct HIF_URB_CONTEXT *urb_context)
{
HIF_TRACE("+%s", __func__);
@@ -490,11 +493,11 @@ static void usb_hif_cleanup_recv_urb(HIF_URB_CONTEXT *urb_context)
/**
* usb_hif_cleanup_transmit_urb() - cleanup transmit urb
- * @urb_context: pointer to HIF_URB_CONTEXT structure
+ * @urb_context: pointer to struct HIF_URB_CONTEXT structure
*
* Return: none
*/
-void usb_hif_cleanup_transmit_urb(HIF_URB_CONTEXT *urb_context)
+void usb_hif_cleanup_transmit_urb(struct HIF_URB_CONTEXT *urb_context)
{
usb_hif_free_urb_to_pipe(urb_context->pipe, urb_context);
}
@@ -508,10 +511,11 @@ void usb_hif_cleanup_transmit_urb(HIF_URB_CONTEXT *urb_context)
static void usb_hif_usb_recv_prestart_complete
(struct urb *urb)
{
- HIF_URB_CONTEXT *urb_context = (HIF_URB_CONTEXT *) urb->context;
+ struct HIF_URB_CONTEXT *urb_context =
+ (struct HIF_URB_CONTEXT *) urb->context;
QDF_STATUS status = QDF_STATUS_SUCCESS;
qdf_nbuf_t buf = NULL;
- HIF_USB_PIPE *pipe = urb_context->pipe;
+ struct HIF_USB_PIPE *pipe = urb_context->pipe;
HIF_DBG("+%s: recv pipe: %d, stat:%d,len:%d urb:0x%p",
__func__,
@@ -521,7 +525,6 @@ static void usb_hif_usb_recv_prestart_complete
/* this urb is not pending anymore */
usb_hif_remove_pending_transfer(urb_context);
-
do {
if (urb->status != 0) {
status = A_ECOMM;
@@ -545,10 +548,8 @@ static void usb_hif_usb_recv_prestart_complete
}
break;
}
-
if (urb->actual_length == 0)
break;
-
buf = urb_context->buf;
/* we are going to pass it up */
urb_context->buf = NULL;
@@ -557,6 +558,7 @@ static void usb_hif_usb_recv_prestart_complete
if (AR_DEBUG_LVL_CHECK(USB_HIF_DEBUG_DUMP_DATA)) {
uint8_t *data;
uint32_t len;
+
qdf_nbuf_peek_header(buf, &data, &len);
debug_dump_bytes(data, len, "hif recv data");
}
@@ -583,10 +585,11 @@ static void usb_hif_usb_recv_prestart_complete
*/
static void usb_hif_usb_recv_complete(struct urb *urb)
{
- HIF_URB_CONTEXT *urb_context = (HIF_URB_CONTEXT *) urb->context;
+ struct HIF_URB_CONTEXT *urb_context =
+ (struct HIF_URB_CONTEXT *) urb->context;
QDF_STATUS status = QDF_STATUS_SUCCESS;
qdf_nbuf_t buf = NULL;
- HIF_USB_PIPE *pipe = urb_context->pipe;
+ struct HIF_USB_PIPE *pipe = urb_context->pipe;
struct hif_usb_softc *sc = HIF_GET_USB_SOFTC(pipe->device);
HIF_DBG("+%s: recv pipe: %d, stat:%d,len:%d urb:0x%p",
@@ -628,10 +631,8 @@ static void usb_hif_usb_recv_complete(struct urb *urb)
}
break;
}
-
if (urb->actual_length == 0)
break;
-
buf = urb_context->buf;
/* we are going to pass it up */
urb_context->buf = NULL;
@@ -639,10 +640,10 @@ static void usb_hif_usb_recv_complete(struct urb *urb)
if (AR_DEBUG_LVL_CHECK(USB_HIF_DEBUG_DUMP_DATA)) {
uint8_t *data;
uint32_t len;
+
qdf_nbuf_peek_header(buf, &data, &len);
debug_dump_bytes(data, len, "hif recv data");
}
-
/* note: queue implements a lock */
skb_queue_tail(&pipe->io_comp_queue, buf);
HIF_USB_SCHEDULE_WORK(pipe);
@@ -651,7 +652,7 @@ static void usb_hif_usb_recv_complete(struct urb *urb)
usb_hif_cleanup_recv_urb(urb_context);
/* Only re-submit URB when STATUS is success and HIF is not at the
- suspend state.
+ * suspend state.
*/
if (QDF_IS_STATUS_SUCCESS(status) && !sc->suspend_state) {
if (pipe->urb_cnt >= pipe->urb_cnt_thresh) {
@@ -678,10 +679,11 @@ static void usb_hif_usb_recv_complete(struct urb *urb)
*/
static void usb_hif_usb_recv_bundle_complete(struct urb *urb)
{
- HIF_URB_CONTEXT *urb_context = (HIF_URB_CONTEXT *) urb->context;
+ struct HIF_URB_CONTEXT *urb_context =
+ (struct HIF_URB_CONTEXT *) urb->context;
QDF_STATUS status = QDF_STATUS_SUCCESS;
qdf_nbuf_t buf = NULL;
- HIF_USB_PIPE *pipe = urb_context->pipe;
+ struct HIF_USB_PIPE *pipe = urb_context->pipe;
uint8_t *netdata, *netdata_new;
uint32_t netlen, netlen_new;
HTC_FRAME_HDR *HtcHdr;
@@ -721,15 +723,13 @@ static void usb_hif_usb_recv_bundle_complete(struct urb *urb)
}
break;
}
-
if (urb->actual_length == 0)
break;
-
buf = urb_context->buf;
-
if (AR_DEBUG_LVL_CHECK(USB_HIF_DEBUG_DUMP_DATA)) {
uint8_t *data;
uint32_t len;
+
qdf_nbuf_peek_header(buf, &data, &len);
debug_dump_bytes(data, len, "hif recv data");
}
@@ -813,11 +813,10 @@ static void usb_hif_usb_recv_bundle_complete(struct urb *urb)
*
* Return: none
*/
-static void usb_hif_post_recv_prestart_transfers
- (HIF_USB_PIPE *recv_pipe,
+static void usb_hif_post_recv_prestart_transfers(struct HIF_USB_PIPE *recv_pipe,
int prestart_urb)
{
- HIF_URB_CONTEXT *urb_context;
+ struct HIF_URB_CONTEXT *urb_context;
uint8_t *data;
uint32_t len;
struct urb *urb;
@@ -865,9 +864,8 @@ static void usb_hif_post_recv_prestart_transfers
usb_hif_remove_pending_transfer(urb_context);
usb_hif_cleanup_recv_urb(urb_context);
break;
- } else
- recv_pipe->urb_prestart_cnt++;
-
+ }
+ recv_pipe->urb_prestart_cnt++;
}
HIF_TRACE("-%s", __func__);
@@ -880,10 +878,10 @@ static void usb_hif_post_recv_prestart_transfers
*
* Return: none
*/
-static void usb_hif_post_recv_transfers(HIF_USB_PIPE *recv_pipe,
+static void usb_hif_post_recv_transfers(struct HIF_USB_PIPE *recv_pipe,
int buffer_length)
{
- HIF_URB_CONTEXT *urb_context;
+ struct HIF_URB_CONTEXT *urb_context;
uint8_t *data;
uint32_t len;
struct urb *urb;
@@ -945,11 +943,10 @@ static void usb_hif_post_recv_transfers(HIF_USB_PIPE *recv_pipe,
*
* Return: none
*/
-static void usb_hif_post_recv_bundle_transfers
- (HIF_USB_PIPE *recv_pipe,
+static void usb_hif_post_recv_bundle_transfers(struct HIF_USB_PIPE *recv_pipe,
int buffer_length)
{
- HIF_URB_CONTEXT *urb_context;
+ struct HIF_URB_CONTEXT *urb_context;
uint8_t *data;
uint32_t len;
struct urb *urb;
@@ -1016,7 +1013,7 @@ static void usb_hif_post_recv_bundle_transfers
*/
void usb_hif_prestart_recv_pipes(HIF_DEVICE_USB *device)
{
- HIF_USB_PIPE *pipe = &device->pipes[HIF_RX_DATA_PIPE];
+ struct HIF_USB_PIPE *pipe = &device->pipes[HIF_RX_DATA_PIPE];
/*
* USB driver learn to support bundle or not until the firmware
@@ -1037,7 +1034,7 @@ void usb_hif_prestart_recv_pipes(HIF_DEVICE_USB *device)
*/
void usb_hif_start_recv_pipes(HIF_DEVICE_USB *device)
{
- HIF_USB_PIPE *pipe;
+ struct HIF_USB_PIPE *pipe;
uint32_t buf_len;
HIF_ENTER();
@@ -1184,11 +1181,11 @@ QDF_STATUS usb_hif_submit_ctrl_in(HIF_DEVICE_USB *device,
/**
* usb_hif_io_complete() - transmit call back for tx urb
- * @pipe: pointer to HIF_USB_PIPE
+ * @pipe: pointer to struct HIF_USB_PIPE
*
* Return: none
*/
-void usb_hif_io_complete(HIF_USB_PIPE *pipe)
+void usb_hif_io_complete(struct HIF_USB_PIPE *pipe)
{
qdf_nbuf_t buf;
HIF_DEVICE_USB *device;
@@ -1196,13 +1193,12 @@ void usb_hif_io_complete(HIF_USB_PIPE *pipe)
uint8_t *data;
uint32_t len;
struct hif_usb_softc *sc = HIF_GET_USB_SOFTC(pipe->device);
- device = pipe->device;
+ device = pipe->device;
HIF_ENTER();
-
while ((buf = skb_dequeue(&pipe->io_comp_queue))) {
if (pipe->flags & HIF_USB_PIPE_FLAG_TX) {
- HIF_DBG("+athusb xmit callback " "buf:0x%p", buf);
+ HIF_DBG("+athusb xmit callback buf:0x%p", buf);
HtcHdr = (HTC_FRAME_HDR *)
qdf_nbuf_get_frag_vaddr(buf, 0);
@@ -1217,7 +1213,7 @@ void usb_hif_io_complete(HIF_USB_PIPE *pipe)
#endif
HIF_DBG("-athusb xmit callback");
} else {
- HIF_DBG("+athusb recv callback buf:" "0x%p", buf);
+ HIF_DBG("+athusb recv callback buf: 0x%p", buf);
qdf_nbuf_peek_header(buf, &data, &len);
if (IS_FW_CRASH_DUMP(*((uint32_t *) data))) {
@@ -1246,9 +1242,10 @@ void usb_hif_io_complete(HIF_USB_PIPE *pipe)
*
* Return: none
*/
-void usb_hif_io_comp_tasklet(long unsigned int context)
+void usb_hif_io_comp_tasklet(unsigned long context)
{
- HIF_USB_PIPE *pipe = (HIF_USB_PIPE *) context;
+ struct HIF_USB_PIPE *pipe = (struct HIF_USB_PIPE *) context;
+
usb_hif_io_complete(pipe);
}
@@ -1261,7 +1258,9 @@ void usb_hif_io_comp_tasklet(long unsigned int context)
*/
void usb_hif_io_comp_work(struct work_struct *work)
{
- HIF_USB_PIPE *pipe = container_of(work, HIF_USB_PIPE, io_complete_work);
+ struct HIF_USB_PIPE *pipe = container_of(work, struct HIF_USB_PIPE,
+ io_complete_work);
+
usb_hif_io_complete(pipe);
}
#endif
diff --git a/htc/dl_list.h b/htc/dl_list.h
index 1b5d72f780e2..be9970cf0a29 100644
--- a/htc/dl_list.h
+++ b/htc/dl_list.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2014 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2014, 2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -25,17 +25,18 @@
* to the Linux Foundation.
*/
-/* ============================================================================== */
+/*=========================================================================== */
/* Double-link list definitions (adapted from Atheros SDIO stack) */
/* */
/* Author(s): ="Atheros" */
-/* ============================================================================== */
+/*=========================================================================== */
#ifndef __DL_LIST_H___
#define __DL_LIST_H___
#define A_CONTAINING_STRUCT(address, struct_type, field_name) \
- ((struct_type *)((char *)(address) - (char *)(&((struct_type *)0)->field_name)))
+ ((struct_type *)((char *)(address) - \
+ (char *)(&((struct_type *)0)->field_name)))
/* list functions */
/* pointers for the list */
@@ -50,14 +51,15 @@ typedef struct _DL_LIST {
{(pList)->pPrev = pList; (pList)->pNext = pList; }
/* faster macro to init list and add a single item */
-#define DL_LIST_INIT_AND_ADD(pList,pItem) \
+#define DL_LIST_INIT_AND_ADD(pList, pItem) \
{ (pList)->pPrev = (pItem); \
(pList)->pNext = (pItem); \
(pItem)->pNext = (pList); \
(pItem)->pPrev = (pList); \
}
-#define DL_LIST_IS_EMPTY(pList) (((pList)->pPrev == (pList)) && ((pList)->pNext == (pList)))
+#define DL_LIST_IS_EMPTY(pList) (((pList)->pPrev == (pList)) && \
+ ((pList)->pNext == (pList)))
#define DL_LIST_GET_ITEM_AT_HEAD(pList) (pList)->pNext
#define DL_LIST_GET_ITEM_AT_TAIL(pList) (pList)->pPrev
/*
@@ -66,9 +68,10 @@ typedef struct _DL_LIST {
* iteration loop
*/
#define ITERATE_OVER_LIST(pStart, pTemp) \
- for((pTemp) =(pStart)->pNext; pTemp != (pStart); (pTemp) = (pTemp)->pNext)
+ for ((pTemp) = (pStart)->pNext; pTemp != (pStart); \
+ (pTemp) = (pTemp)->pNext)
-static __inline bool dl_list_is_entry_in_list(const DL_LIST *pList,
+static inline bool dl_list_is_entry_in_list(const DL_LIST *pList,
const DL_LIST *pEntry)
{
const DL_LIST *pTmp;
@@ -77,9 +80,8 @@ static __inline bool dl_list_is_entry_in_list(const DL_LIST *pList,
return true;
ITERATE_OVER_LIST(pList, pTmp) {
- if (pTmp == pEntry) {
+ if (pTmp == pEntry)
return true;
- }
}
return false;
@@ -88,30 +90,29 @@ static __inline bool dl_list_is_entry_in_list(const DL_LIST *pList,
/* safe iterate macro that allows the item to be removed from the list
* the iteration continues to the next item in the list
*/
-#define ITERATE_OVER_LIST_ALLOW_REMOVE(pStart,pItem,st,offset) \
+#define ITERATE_OVER_LIST_ALLOW_REMOVE(pStart, pItem, st, offset) \
{ \
PDL_LIST pTemp; \
- pTemp = (pStart)->pNext; \
+ { pTemp = (pStart)->pNext; } \
while (pTemp != (pStart)) { \
- (pItem) = A_CONTAINING_STRUCT(pTemp,st,offset); \
- pTemp = pTemp->pNext; \
+ { (pItem) = A_CONTAINING_STRUCT(pTemp, st, offset); } \
+ { pTemp = pTemp->pNext; } \
#define ITERATE_IS_VALID(pStart) dl_list_is_entry_in_list(pStart, pTemp)
-#define ITERATE_RESET(pStart) pTemp=(pStart)->pNext
+#define ITERATE_RESET(pStart) { pTemp = (pStart)->pNext; }
#define ITERATE_END }}
/*
* dl_list_insert_tail - insert pAdd to the end of the list
*/
-static __inline PDL_LIST dl_list_insert_tail(PDL_LIST pList, PDL_LIST pAdd)
+static inline PDL_LIST dl_list_insert_tail(PDL_LIST pList, PDL_LIST pAdd)
{
/* insert at tail */
pAdd->pPrev = pList->pPrev;
pAdd->pNext = pList;
- if (pList->pPrev) {
+ if (pList->pPrev)
pList->pPrev->pNext = pAdd;
- }
pList->pPrev = pAdd;
return pAdd;
}
@@ -119,7 +120,7 @@ static __inline PDL_LIST dl_list_insert_tail(PDL_LIST pList, PDL_LIST pAdd)
/*
* dl_list_insert_head - insert pAdd into the head of the list
*/
-static __inline PDL_LIST dl_list_insert_head(PDL_LIST pList, PDL_LIST pAdd)
+static inline PDL_LIST dl_list_insert_head(PDL_LIST pList, PDL_LIST pAdd)
{
/* insert at head */
pAdd->pPrev = pList;
@@ -129,20 +130,17 @@ static __inline PDL_LIST dl_list_insert_head(PDL_LIST pList, PDL_LIST pAdd)
return pAdd;
}
-#define DL_ListAdd(pList,pItem) dl_list_insert_head((pList),(pItem))
+#define DL_ListAdd(pList, pItem) dl_list_insert_head((pList), (pItem))
/*
* dl_list_remove - remove pDel from list
*/
-static __inline PDL_LIST dl_list_remove(PDL_LIST pDel)
+static inline PDL_LIST dl_list_remove(PDL_LIST pDel)
{
- if (pDel->pNext != NULL) {
+ if (pDel->pNext != NULL)
pDel->pNext->pPrev = pDel->pPrev;
- }
- if (pDel->pPrev != NULL) {
+ if (pDel->pPrev != NULL)
pDel->pPrev->pNext = pDel->pNext;
- }
-
- /* point back to itself just to be safe, incase remove is called again */
+ /* point back to itself just to be safe, if remove is called again */
pDel->pNext = pDel;
pDel->pPrev = pDel;
return pDel;
@@ -151,9 +149,10 @@ static __inline PDL_LIST dl_list_remove(PDL_LIST pDel)
/*
* dl_list_remove_item_from_head - get a list item from the head
*/
-static __inline PDL_LIST dl_list_remove_item_from_head(PDL_LIST pList)
+static inline PDL_LIST dl_list_remove_item_from_head(PDL_LIST pList)
{
PDL_LIST pItem = NULL;
+
if (pList->pNext != pList) {
pItem = pList->pNext;
/* remove the first item from head */
@@ -162,9 +161,10 @@ static __inline PDL_LIST dl_list_remove_item_from_head(PDL_LIST pList)
return pItem;
}
-static __inline PDL_LIST dl_list_remove_item_from_tail(PDL_LIST pList)
+static inline PDL_LIST dl_list_remove_item_from_tail(PDL_LIST pList)
{
PDL_LIST pItem = NULL;
+
if (pList->pPrev != pList) {
pItem = pList->pPrev;
/* remove the item from tail */
@@ -174,7 +174,7 @@ static __inline PDL_LIST dl_list_remove_item_from_tail(PDL_LIST pList)
}
/* transfer src list items to the tail of the destination list */
-static __inline void dl_list_transfer_items_to_tail(PDL_LIST pDest, PDL_LIST pSrc)
+static inline void dl_list_transfer_items_to_tail(PDL_LIST pDest, PDL_LIST pSrc)
{
/* only concatenate if src is not empty */
if (!DL_LIST_IS_EMPTY(pSrc)) {
@@ -190,11 +190,11 @@ static __inline void dl_list_transfer_items_to_tail(PDL_LIST pDest, PDL_LIST pSr
}
/* transfer src list items to the head of the destination list */
-static __inline void dl_list_transfer_items_to_head(PDL_LIST pDest, PDL_LIST pSrc)
+static inline void dl_list_transfer_items_to_head(PDL_LIST pDest, PDL_LIST pSrc)
{
/* only concatenate if src is not empty */
if (!DL_LIST_IS_EMPTY(pSrc)) {
- /* cut out circular list in src and re-attach to start of dest */
+ /* cut out circular list in src and reattach to start of dest */
pSrc->pNext->pPrev = pDest;
pDest->pNext->pPrev = pSrc->pPrev;
pSrc->pPrev->pNext = pDest->pNext;
diff --git a/htc/htc.c b/htc/htc.c
index 0f9c3e4a486d..2077840a2b97 100644
--- a/htc/htc.c
+++ b/htc/htc.c
@@ -60,12 +60,11 @@ static void reset_endpoint_states(HTC_TARGET *target);
static void destroy_htc_tx_ctrl_packet(HTC_PACKET *pPacket)
{
qdf_nbuf_t netbuf;
+
netbuf = (qdf_nbuf_t) GET_HTC_PACKET_NET_BUF_CONTEXT(pPacket);
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("free ctrl netbuf :0x%p\n", netbuf));
- if (netbuf != NULL) {
+ if (netbuf != NULL)
qdf_nbuf_free(netbuf);
- }
-
qdf_mem_free(pPacket);
}
@@ -76,9 +75,8 @@ static HTC_PACKET *build_htc_tx_ctrl_packet(qdf_device_t osdev)
do {
pPacket = (HTC_PACKET *) qdf_mem_malloc(sizeof(HTC_PACKET));
- if (NULL == pPacket) {
+ if (pPacket == NULL)
break;
- }
netbuf = qdf_nbuf_alloc(osdev, HTC_CONTROL_BUFFER_SIZE,
20, 4, true);
if (NULL == netbuf) {
@@ -88,7 +86,7 @@ static HTC_PACKET *build_htc_tx_ctrl_packet(qdf_device_t osdev)
break;
}
AR_DEBUG_PRINTF(ATH_DEBUG_TRC,
- ("alloc ctrl netbuf :0x%p \n", netbuf));
+ ("alloc ctrl netbuf :0x%p\n", netbuf));
SET_HTC_PACKET_NET_BUF_CONTEXT(pPacket, netbuf);
} while (false);
@@ -129,12 +127,14 @@ void htc_set_target_failure_callback(HTC_HANDLE HTCHandle,
HTC_TARGET_FAILURE Callback)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+
target->HTCInitInfo.TargetFailure = Callback;
}
void htc_dump(HTC_HANDLE HTCHandle, uint8_t CmdId, bool start)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+
hif_dump(target->hif_dev, CmdId, start);
}
@@ -152,29 +152,26 @@ static void htc_cleanup(HTC_TARGET *target)
while (true) {
pPacket = allocate_htc_packet_container(target);
- if (NULL == pPacket) {
+ if (pPacket == NULL)
break;
- }
qdf_mem_free(pPacket);
}
pPacket = target->pBundleFreeList;
while (pPacket) {
HTC_PACKET *pPacketTmp = (HTC_PACKET *) pPacket->ListLink.pNext;
+
qdf_mem_free(pPacket);
pPacket = pPacketTmp;
}
#ifdef TODO_FIXME
while (true) {
pPacket = htc_alloc_control_tx_packet(target);
- if (NULL == pPacket) {
+ if (pPacket == NULL)
break;
- }
netbuf = (qdf_nbuf_t) GET_HTC_PACKET_NET_BUF_CONTEXT(pPacket);
- if (netbuf != NULL) {
+ if (netbuf != NULL)
qdf_nbuf_free(netbuf);
- }
-
qdf_mem_free(pPacket);
}
#endif
@@ -238,8 +235,8 @@ static inline void htc_runtime_pm_init(HTC_TARGET *target) { }
#endif
/* registered target arrival callback from the HIF layer */
-HTC_HANDLE htc_create(void *ol_sc, HTC_INIT_INFO *pInfo, qdf_device_t osdev,
- uint32_t con_mode)
+HTC_HANDLE htc_create(void *ol_sc, struct htc_init_info *pInfo,
+ qdf_device_t osdev, uint32_t con_mode)
{
struct hif_msg_callbacks htcCallbacks;
HTC_ENDPOINT *pEndpoint = NULL;
@@ -269,7 +266,7 @@ HTC_HANDLE htc_create(void *ol_sc, HTC_INIT_INFO *pInfo, qdf_device_t osdev,
do {
qdf_mem_copy(&target->HTCInitInfo, pInfo,
- sizeof(HTC_INIT_INFO));
+ sizeof(struct htc_init_info));
target->host_handle = pInfo->pContext;
target->osdev = osdev;
target->con_mode = con_mode;
@@ -279,19 +276,17 @@ HTC_HANDLE htc_create(void *ol_sc, HTC_INIT_INFO *pInfo, qdf_device_t osdev,
INIT_HTC_PACKET_QUEUE(&target->ControlBufferTXFreeList);
for (i = 0; i < HTC_PACKET_CONTAINER_ALLOCATION; i++) {
- HTC_PACKET *pPacket =
- (HTC_PACKET *) qdf_mem_malloc(sizeof(HTC_PACKET));
- if (pPacket != NULL) {
+ HTC_PACKET *pPacket = (HTC_PACKET *)
+ qdf_mem_malloc(sizeof(HTC_PACKET));
+ if (pPacket != NULL)
free_htc_packet_container(target, pPacket);
- }
}
#ifdef TODO_FIXME
for (i = 0; i < NUM_CONTROL_TX_BUFFERS; i++) {
pPacket = build_htc_tx_ctrl_packet();
- if (NULL == pPacket) {
+ if (pPacket == NULL)
break;
- }
htc_free_control_tx_packet(target, pPacket);
}
#endif
@@ -301,7 +296,8 @@ HTC_HANDLE htc_create(void *ol_sc, HTC_INIT_INFO *pInfo, qdf_device_t osdev,
htcCallbacks.Context = target;
htcCallbacks.rxCompletionHandler = htc_rx_completion_handler;
htcCallbacks.txCompletionHandler = htc_tx_completion_handler;
- htcCallbacks.txResourceAvailHandler = htc_tx_resource_avail_handler;
+ htcCallbacks.txResourceAvailHandler =
+ htc_tx_resource_avail_handler;
htcCallbacks.fwEventHandler = htc_fw_event_handler;
target->hif_dev = ol_sc;
@@ -324,6 +320,7 @@ HTC_HANDLE htc_create(void *ol_sc, HTC_INIT_INFO *pInfo, qdf_device_t osdev,
void htc_destroy(HTC_HANDLE HTCHandle)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+
AR_DEBUG_PRINTF(ATH_DEBUG_TRC,
("+htc_destroy .. Destroying :0x%p\n", target));
hif_stop(htc_get_hif_device(HTCHandle));
@@ -332,19 +329,22 @@ void htc_destroy(HTC_HANDLE HTCHandle)
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("-htc_destroy\n"));
}
-/* get the low level HIF device for the caller , the caller may wish to do low level
- * HIF requests */
+/* get the low level HIF device for the caller , the caller may wish to do low
+ * level HIF requests
+ */
void *htc_get_hif_device(HTC_HANDLE HTCHandle)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+
return target->hif_dev;
}
static void htc_control_tx_complete(void *Context, HTC_PACKET *pPacket)
{
HTC_TARGET *target = (HTC_TARGET *) Context;
+
AR_DEBUG_PRINTF(ATH_DEBUG_TRC,
- ("+-htc_control_tx_complete 0x%p (l:%d) \n", pPacket,
+ ("+-htc_control_tx_complete 0x%p (l:%d)\n", pPacket,
pPacket->ActualLength));
htc_free_control_tx_packet(target, pPacket);
}
@@ -362,8 +362,8 @@ static void htc_control_tx_complete(void *Context, HTC_PACKET *pPacket)
*/
static void
htc_setup_epping_credit_allocation(struct hif_opaque_softc *scn,
- HTC_SERVICE_TX_CREDIT_ALLOCATION *pEntry,
- int credits)
+ struct htc_service_tx_credit_allocation *pEntry,
+ int credits)
{
switch (hif_get_bus_type(scn)) {
case QDF_BUS_TYPE_PCI:
@@ -383,7 +383,6 @@ htc_setup_epping_credit_allocation(struct hif_opaque_softc *scn,
default:
break;
}
- return;
}
/**
@@ -395,15 +394,14 @@ htc_setup_epping_credit_allocation(struct hif_opaque_softc *scn,
static
A_STATUS htc_setup_target_buffer_assignments(HTC_TARGET *target)
{
- HTC_SERVICE_TX_CREDIT_ALLOCATION *pEntry;
+ struct htc_service_tx_credit_allocation *pEntry;
A_STATUS status;
int credits;
int creditsPerMaxMsg;
creditsPerMaxMsg = MAX_MESSAGE_SIZE / target->TargetCreditSize;
- if (MAX_MESSAGE_SIZE % target->TargetCreditSize) {
+ if (MAX_MESSAGE_SIZE % target->TargetCreditSize)
creditsPerMaxMsg++;
- }
/* TODO, this should be configured by the caller! */
@@ -423,7 +421,7 @@ A_STATUS htc_setup_target_buffer_assignments(HTC_TARGET *target)
if (HTC_IS_EPPING_ENABLED(target->con_mode)) {
/* endpoint ping is a testing tool directly on top of HTC in
* both target and host sides.
- * In target side, the endppint ping fw has no wlan stack and the
+ * In target side, the endppint ping fw has no wlan stack and
* FW mboxping app directly sits on HTC and it simply drops
* or loops back TX packets. For rx perf, FW mboxping app
* generates packets and passes packets to HTC to send to host.
@@ -440,9 +438,9 @@ A_STATUS htc_setup_target_buffer_assignments(HTC_TARGET *target)
* space through the Ethernet interface.
* For credit allocation, in SDIO bus case, only BE service is
* used for tx/rx perf testing so that all credits are given
- * to BE service. In PCIe and USB bus case, endpoint ping uses both
- * BE and BK services to stress the bus so that the total credits
- * are equally distributed to BE and BK services.
+ * to BE service. In PCIe and USB bus case, endpoint ping uses
+ * both BE and BK services to stress the bus so that the total
+ * credits are equally distributed to BE and BK services.
*/
htc_setup_epping_credit_allocation(target->hif_dev,
@@ -451,6 +449,7 @@ A_STATUS htc_setup_target_buffer_assignments(HTC_TARGET *target)
if (A_SUCCESS(status)) {
int i;
+
for (i = 0; i < HTC_MAX_SERVICE_ALLOC_ENTRIES; i++) {
if (target->ServiceTxAllocTable[i].service_id != 0) {
AR_DEBUG_PRINTF(ATH_DEBUG_INIT,
@@ -493,8 +492,8 @@ A_STATUS htc_wait_target(HTC_HANDLE HTCHandle)
A_STATUS status = A_OK;
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
HTC_READY_EX_MSG *pReadyMsg;
- HTC_SERVICE_CONNECT_REQ connect;
- HTC_SERVICE_CONNECT_RESP resp;
+ struct htc_service_connect_req connect;
+ struct htc_service_connect_resp resp;
HTC_READY_MSG *rdy_msg;
uint16_t htc_rdy_msg_id;
uint8_t i = 0;
@@ -508,19 +507,19 @@ A_STATUS htc_wait_target(HTC_HANDLE HTCHandle)
status = hif_start(target->hif_dev);
if (A_FAILED(status)) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("hif_start failed\n"));
+ AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
+ ("hif_start failed\n"));
break;
}
status = htc_wait_recv_ctrl_message(target);
- if (A_FAILED(status)) {
+ if (A_FAILED(status))
break;
- }
if (target->CtrlResponseLength < (sizeof(HTC_READY_EX_MSG))) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("Invalid HTC Ready Msg Len:%d! \n",
+ ("Invalid HTC Ready Msg Len:%d!\n",
target->CtrlResponseLength));
status = A_ECOMM;
break;
@@ -533,7 +532,7 @@ A_STATUS htc_wait_target(HTC_HANDLE HTCHandle)
HTC_GET_FIELD(rdy_msg, HTC_READY_MSG, MESSAGEID);
if (htc_rdy_msg_id != HTC_MSG_READY_ID) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("Invalid HTC Ready Msg : 0x%X ! \n",
+ ("Invalid HTC Ready Msg : 0x%X!\n",
htc_rdy_msg_id));
status = A_ECOMM;
break;
@@ -545,8 +544,9 @@ A_STATUS htc_wait_target(HTC_HANDLE HTCHandle)
(int)HTC_GET_FIELD(rdy_msg, HTC_READY_MSG, CREDITSIZE);
target->MaxMsgsPerHTCBundle =
(uint8_t) pReadyMsg->MaxMsgsPerHTCBundle;
- /* for old fw this value is set to 0. But the minimum value should be 1,
- * i.e., no bundling */
+ /* for old fw this value is set to 0. But the minimum value
+ * should be 1, i.e., no bundling
+ */
if (target->MaxMsgsPerHTCBundle < 1)
target->MaxMsgsPerHTCBundle = 1;
@@ -599,7 +599,8 @@ A_STATUS htc_wait_target(HTC_HANDLE HTCHandle)
} while (false);
- AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("htc_wait_target - Exit (%d)\n", status));
+ AR_DEBUG_PRINTF(ATH_DEBUG_TRC,
+ ("htc_wait_target - Exit (%d)\n", status));
AR_DEBUG_PRINTF(ATH_DEBUG_RSVD1, ("-HWT\n"));
return status;
}
@@ -683,7 +684,8 @@ A_STATUS htc_start(HTC_HANDLE HTCHandle)
}
if ((hif_get_bus_type(target->hif_dev) == QDF_BUS_TYPE_SDIO) ||
- (hif_get_bus_type(target->hif_dev) == QDF_BUS_TYPE_USB)) {
+ (hif_get_bus_type(target->hif_dev) ==
+ QDF_BUS_TYPE_USB)) {
if (HTC_RX_BUNDLE_ENABLED(target))
pSetupComp->SetupFlags |=
HTC_SETUP_COMPLETE_FLAGS_ENABLE_BUNDLE_RECV;
@@ -698,10 +700,8 @@ A_STATUS htc_start(HTC_HANDLE HTCHandle)
ENDPOINT_0, HTC_SERVICE_TX_PACKET_TAG);
status = htc_send_pkt((HTC_HANDLE) target, pSendPacket);
- if (A_FAILED(status)) {
+ if (A_FAILED(status))
break;
- }
-
} while (false);
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("htc_start Exit\n"));
@@ -740,10 +740,12 @@ void htc_flush_surprise_remove(HTC_HANDLE HTCHandle)
reset_endpoint_states(target);
- AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("-htc_flush_surprise_remove \n"));
+ AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("-htc_flush_surprise_remove\n"));
}
-/* stop HTC communications, i.e. stop interrupt reception, and flush all queued buffers */
+/* stop HTC communications, i.e. stop interrupt reception, and flush all queued
+ * buffers
+ */
void htc_stop(HTC_HANDLE HTCHandle)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
@@ -816,14 +818,14 @@ void htc_dump_credit_states(HTC_HANDLE HTCHandle)
(" TxQueueDepth : %d\n",
HTC_PACKET_QUEUE_DEPTH(&pEndpoint->TxQueue)));
AR_DEBUG_PRINTF(ATH_DEBUG_ANY,
- ("----------------------------------------------------\n"));
+ ("----------------------------------------\n"));
}
}
bool htc_get_endpoint_statistics(HTC_HANDLE HTCHandle,
HTC_ENDPOINT_ID Endpoint,
- HTC_ENDPOINT_STAT_ACTION Action,
- HTC_ENDPOINT_STATS *pStats)
+ enum htc_endpoint_stat_action Action,
+ struct htc_endpoint_stats *pStats)
{
#ifdef HTC_EP_STAT_PROFILING
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
@@ -855,13 +857,13 @@ bool htc_get_endpoint_statistics(HTC_HANDLE HTCHandle,
A_ASSERT(pStats != NULL);
/* return the stats to the caller */
qdf_mem_copy(pStats, &target->endpoint[Endpoint].endpoint_stats,
- sizeof(HTC_ENDPOINT_STATS));
+ sizeof(struct htc_endpoint_stats));
}
if (clearStats) {
/* reset stats */
qdf_mem_zero(&target->endpoint[Endpoint].endpoint_stats,
- sizeof(HTC_ENDPOINT_STATS));
+ sizeof(struct htc_endpoint_stats));
}
UNLOCK_HTC_RX(target);
diff --git a/htc/htc_api.h b/htc/htc_api.h
index 3a517e3c9325..eaffb0329107 100644
--- a/htc/htc_api.h
+++ b/htc/htc_api.h
@@ -53,12 +53,12 @@ typedef uint16_t HTC_SERVICE_ID;
typedef void (*HTC_TARGET_FAILURE)(void *Instance, QDF_STATUS Status);
-typedef struct _HTC_INIT_INFO {
+struct htc_init_info {
void *pContext; /* context for target notifications */
void (*TargetFailure)(void *Instance, QDF_STATUS Status);
void (*TargetSendSuspendComplete)(void *ctx, bool is_nack);
void (*target_initial_wakeup_cb)(void);
-} HTC_INIT_INFO;
+};
/* Struct for HTC layer packet stats*/
struct ol_ath_htc_stats {
@@ -73,157 +73,216 @@ typedef void (*HTC_EP_RESUME_TX_QUEUE)(void *);
/* per service connection send completion */
typedef void (*HTC_EP_SEND_PKT_COMPLETE)(void *, HTC_PACKET *);
/* per service connection callback when a plurality of packets have been sent
- * The HTC_PACKET_QUEUE is a temporary queue object (e.g. freed on return from the callback)
- * to hold a list of completed send packets.
- * If the handler cannot fully traverse the packet queue before returning, it should
- * transfer the items of the queue into the caller's private queue using:
- * HTC_PACKET_ENQUEUE() */
+ * The HTC_PACKET_QUEUE is a temporary queue object (e.g. freed on return from
+ * the callback) to hold a list of completed send packets.
+ * If the handler cannot fully traverse the packet queue before returning, it
+ * should transfer the items of the queue into the caller's private queue using:
+ * HTC_PACKET_ENQUEUE()
+ */
typedef void (*HTC_EP_SEND_PKT_COMP_MULTIPLE)(void *,
HTC_PACKET_QUEUE *);
/* per service connection pkt received */
typedef void (*HTC_EP_RECV_PKT)(void *, HTC_PACKET *);
/* per service connection callback when a plurality of packets are received
- * The HTC_PACKET_QUEUE is a temporary queue object (e.g. freed on return from the callback)
- * to hold a list of recv packets.
- * If the handler cannot fully traverse the packet queue before returning, it should
- * transfer the items of the queue into the caller's private queue using:
- * HTC_PACKET_ENQUEUE() */
+ * The HTC_PACKET_QUEUE is a temporary queue object (e.g. freed on return from
+ * the callback) to hold a list of recv packets.
+ * If the handler cannot fully traverse the packet queue before returning, it
+ * should transfer the items of the queue into the caller's private queue using:
+ * HTC_PACKET_ENQUEUE()
+ */
typedef void (*HTC_EP_RECV_PKT_MULTIPLE)(void *, HTC_PACKET_QUEUE *);
/* Optional per service connection receive buffer re-fill callback,
- * On some OSes (like Linux) packets are allocated from a global pool and indicated up
- * to the network stack. The driver never gets the packets back from the OS. For these OSes
- * a refill callback can be used to allocate and re-queue buffers into HTC.
+ * On some OSes (like Linux) packets are allocated from a global pool and
+ * indicated up to the network stack. The driver never gets the packets back
+ * from the OS. For these OSes a refill callback can be used to allocate and
+ * re-queue buffers into HTC.
*
- * On other OSes, the network stack can call into the driver's OS-specifc "return_packet" handler and
- * the driver can re-queue these buffers into HTC. In this regard a refill callback is
- * unnecessary */
+ * On other OSes, the network stack can call into the driver's OS-specific
+ * "return_packet" handler and the driver can re-queue these buffers into HTC.
+ * In this regard a refill callback is unnecessary
+ */
typedef void (*HTC_EP_RECV_REFILL)(void *, HTC_ENDPOINT_ID Endpoint);
/* Optional per service connection receive buffer allocation callback.
- * On some systems packet buffers are an extremely limited resource. Rather than
+ * On some systems packet buffers are an extremely limited resource. Rather than
* queue largest-possible-sized buffers to HTC, some systems would rather
* allocate a specific size as the packet is received. The trade off is
* slightly more processing (callback invoked for each RX packet)
* for the benefit of committing fewer buffer resources into HTC.
*
- * The callback is provided the length of the pending packet to fetch. This includes the
- * HTC header length plus the length of payload. The callback can return a pointer to
- * the allocated HTC packet for immediate use.
+ * The callback is provided the length of the pending packet to fetch. This
+ * includes the HTC header length plus the length of payload. The callback can
+ * return a pointer to the allocated HTC packet for immediate use.
*
- * Alternatively a variant of this handler can be used to allocate large receive packets as needed.
- * For example an application can use the refill mechanism for normal packets and the recv-alloc mechanism to
- * handle the case where a large packet buffer is required. This can significantly reduce the
+ * Alternatively a variant of this handler can be used to allocate large receive
+ * packets as needed. For example an application can use the refill mechanism
+ * for normal packets and the recv-alloc mechanism to handle the case where a
+ * large packet buffer is required. This can significantly reduce the
* amount of "committed" memory used to receive packets.
- *
- * */
+ */
typedef HTC_PACKET *(*HTC_EP_RECV_ALLOC)(void *,
HTC_ENDPOINT_ID Endpoint,
int Length);
-typedef enum _HTC_SEND_FULL_ACTION {
- HTC_SEND_FULL_KEEP = 0, /* packet that overflowed should be kept in the queue */
- HTC_SEND_FULL_DROP = 1, /* packet that overflowed should be dropped */
-} HTC_SEND_FULL_ACTION;
+enum htc_send_full_action {
+ /* packet that overflowed should be kept in the queue */
+ HTC_SEND_FULL_KEEP = 0,
+ /* packet that overflowed should be dropped */
+ HTC_SEND_FULL_DROP = 1,
+};
-/* Optional per service connection callback when a send queue is full. This can occur if the
- * host continues queueing up TX packets faster than credits can arrive
- * To prevent the host (on some Oses like Linux) from continuously queueing packets
+/* Optional per service connection callback when a send queue is full. This can
+ * occur if host continues queueing up TX packets faster than credits can arrive
+ * To prevent the host (on some Oses like Linux) from continuously queueing pkts
* and consuming resources, this callback is provided so that that the host
* can disable TX in the subsystem (i.e. network stack).
- * This callback is invoked for each packet that "overflows" the HTC queue. The callback can
- * determine whether the new packet that overflowed the queue can be kept (HTC_SEND_FULL_KEEP) or
- * dropped (HTC_SEND_FULL_DROP). If a packet is dropped, the EpTxComplete handler will be called
- * and the packet's status field will be set to A_NO_RESOURCE.
- * Other OSes require a "per-packet" indication for each completed TX packet, this
- * closed loop mechanism will prevent the network stack from overunning the NIC
- * The packet to keep or drop is passed for inspection to the registered handler the handler
- * must ONLY inspect the packet, it may not free or reclaim the packet. */
-typedef HTC_SEND_FULL_ACTION (*HTC_EP_SEND_QUEUE_FULL)(void *,
- HTC_PACKET *
- pPacket);
-
-typedef struct _HTC_EP_CALLBACKS {
- void *pContext; /* context for each callback */
- HTC_EP_SEND_PKT_COMPLETE EpTxComplete; /* tx completion callback for connected endpoint */
- HTC_EP_RECV_PKT EpRecv; /* receive callback for connected endpoint */
- HTC_EP_RECV_REFILL EpRecvRefill; /* OPTIONAL receive re-fill callback for connected endpoint */
- HTC_EP_SEND_QUEUE_FULL EpSendFull; /* OPTIONAL send full callback */
- HTC_EP_RECV_ALLOC EpRecvAlloc; /* OPTIONAL recv allocation callback */
- HTC_EP_RECV_ALLOC EpRecvAllocThresh; /* OPTIONAL recv allocation callback based on a threshold */
- HTC_EP_SEND_PKT_COMP_MULTIPLE EpTxCompleteMultiple; /* OPTIONAL completion handler for multiple complete
- indications (EpTxComplete must be NULL) */
- HTC_EP_RECV_PKT_MULTIPLE EpRecvPktMultiple; /* OPTIONAL completion handler for multiple
- recv packet indications (EpRecv must be NULL) */
+ * This callback is invoked for each packet that "overflows" the HTC queue. The
+ * callback can determine whether the new packet that overflowed the queue can
+ * be kept (HTC_SEND_FULL_KEEP) or dropped (HTC_SEND_FULL_DROP). If a packet is
+ * dropped, the EpTxComplete handler will be called and the packet's status
+ * field will be set to A_NO_RESOURCE.
+ * Other OSes require a "per-packet" indication for each completed TX packet,
+ * this closed loop mechanism will prevent the network stack from overunning the
+ * NIC. The packet to keep or drop is passed for inspection to the registered
+ * handler the handler must ONLY inspect the packet, it may not free or reclaim
+ * the packet.
+ */
+typedef enum htc_send_full_action (*HTC_EP_SEND_QUEUE_FULL)(void *,
+ HTC_PACKET *pPacket);
+
+struct htc_ep_callbacks {
+ /* context for each callback */
+ void *pContext;
+ /* tx completion callback for connected endpoint */
+ HTC_EP_SEND_PKT_COMPLETE EpTxComplete;
+ /* receive callback for connected endpoint */
+ HTC_EP_RECV_PKT EpRecv;
+ /* OPTIONAL receive re-fill callback for connected endpoint */
+ HTC_EP_RECV_REFILL EpRecvRefill;
+ /* OPTIONAL send full callback */
+ HTC_EP_SEND_QUEUE_FULL EpSendFull;
+ /* OPTIONAL recv allocation callback */
+ HTC_EP_RECV_ALLOC EpRecvAlloc;
+ /* OPTIONAL recv allocation callback based on a threshold */
+ HTC_EP_RECV_ALLOC EpRecvAllocThresh;
+ /* OPTIONAL completion handler for multiple complete
+ * indications (EpTxComplete must be NULL)
+ */
+ HTC_EP_SEND_PKT_COMP_MULTIPLE EpTxCompleteMultiple;
+ /* OPTIONAL completion handler for multiple
+ * recv packet indications (EpRecv must be NULL)
+ */
+ HTC_EP_RECV_PKT_MULTIPLE EpRecvPktMultiple;
HTC_EP_RESUME_TX_QUEUE ep_resume_tx_queue;
- int RecvAllocThreshold; /* if EpRecvAllocThresh is non-NULL, HTC will compare the
- threshold value to the current recv packet length and invoke
- the EpRecvAllocThresh callback to acquire a packet buffer */
- int RecvRefillWaterMark; /* if a EpRecvRefill handler is provided, this value
- can be used to set a trigger refill callback
- when the recv queue drops below this value
- if set to 0, the refill is only called when packets
- are empty */
-} HTC_EP_CALLBACKS;
+ /* if EpRecvAllocThresh is non-NULL, HTC will compare the
+ * threshold value to the current recv packet length and invoke
+ * the EpRecvAllocThresh callback to acquire a packet buffer
+ */
+ int RecvAllocThreshold;
+ /* if a EpRecvRefill handler is provided, this value
+ * can be used to set a trigger refill callback
+ * when the recv queue drops below this value
+ * if set to 0, the refill is only called when packets
+ * are empty
+ */
+ int RecvRefillWaterMark;
+
+};
/* service connection information */
-typedef struct _HTC_SERVICE_CONNECT_REQ {
- HTC_SERVICE_ID service_id; /* service ID to connect to */
- uint16_t ConnectionFlags; /* connection flags, see htc protocol definition */
- uint8_t *pMetaData; /* ptr to optional service-specific meta-data */
- uint8_t MetaDataLength; /* optional meta data length */
- HTC_EP_CALLBACKS EpCallbacks; /* endpoint callbacks */
- int MaxSendQueueDepth; /* maximum depth of any send queue */
- uint32_t LocalConnectionFlags; /* HTC flags for the host-side (local) connection */
- unsigned int MaxSendMsgSize; /* override max message size in send direction */
-} HTC_SERVICE_CONNECT_REQ;
-
-#define HTC_LOCAL_CONN_FLAGS_ENABLE_SEND_BUNDLE_PADDING (1 << 0) /* enable send bundle padding for this endpoint */
+struct htc_service_connect_req {
+ /* service ID to connect to */
+ HTC_SERVICE_ID service_id;
+ /* connection flags, see htc protocol definition */
+ uint16_t ConnectionFlags;
+ /* ptr to optional service-specific meta-data */
+ uint8_t *pMetaData;
+ /* optional meta data length */
+ uint8_t MetaDataLength;
+ /* endpoint callbacks */
+ struct htc_ep_callbacks EpCallbacks;
+ /* maximum depth of any send queue */
+ int MaxSendQueueDepth;
+ /* HTC flags for the host-side (local) connection */
+ uint32_t LocalConnectionFlags;
+ /* override max message size in send direction */
+ unsigned int MaxSendMsgSize;
+};
+
+/* enable send bundle padding for this endpoint */
+#define HTC_LOCAL_CONN_FLAGS_ENABLE_SEND_BUNDLE_PADDING (1 << 0)
/* service connection response information */
-typedef struct _HTC_SERVICE_CONNECT_RESP {
- uint8_t *pMetaData; /* caller supplied buffer to optional meta-data */
- uint8_t BufferLength; /* length of caller supplied buffer */
- uint8_t ActualLength; /* actual length of meta data */
- HTC_ENDPOINT_ID Endpoint; /* endpoint to communicate over */
- unsigned int MaxMsgLength; /* max length of all messages over this endpoint */
- uint8_t ConnectRespCode; /* connect response code from target */
-} HTC_SERVICE_CONNECT_RESP;
+struct htc_service_connect_resp {
+ /* caller supplied buffer to optional meta-data */
+ uint8_t *pMetaData;
+ /* length of caller supplied buffer */
+ uint8_t BufferLength;
+ /* actual length of meta data */
+ uint8_t ActualLength;
+ /* endpoint to communicate over */
+ HTC_ENDPOINT_ID Endpoint;
+ /* max length of all messages over this endpoint */
+ unsigned int MaxMsgLength;
+ /* connect response code from target */
+ uint8_t ConnectRespCode;
+};
/* endpoint distribution structure */
-typedef struct _HTC_ENDPOINT_CREDIT_DIST {
- struct _HTC_ENDPOINT_CREDIT_DIST *pNext;
- struct _HTC_ENDPOINT_CREDIT_DIST *pPrev;
- HTC_SERVICE_ID service_id; /* Service ID (set by HTC) */
- HTC_ENDPOINT_ID Endpoint; /* endpoint for this distribution struct (set by HTC) */
- uint32_t DistFlags; /* distribution flags, distribution function can
- set default activity using SET_EP_ACTIVE() macro */
- int TxCreditsNorm; /* credits for normal operation, anything above this
- indicates the endpoint is over-subscribed, this field
- is only relevant to the credit distribution function */
- int TxCreditsMin; /* floor for credit distribution, this field is
- only relevant to the credit distribution function */
- int TxCreditsAssigned; /* number of credits assigned to this EP, this field
- is only relevant to the credit dist function */
- int TxCredits; /* current credits available, this field is used by
- HTC to determine whether a message can be sent or
- must be queued */
- int TxCreditsToDist; /* pending credits to distribute on this endpoint, this
- is set by HTC when credit reports arrive.
- The credit distribution functions sets this to zero
- when it distributes the credits */
- int TxCreditsSeek; /* this is the number of credits that the current pending TX
- packet needs to transmit. This is set by HTC when
- and endpoint needs credits in order to transmit */
- int TxCreditSize; /* size in bytes of each credit (set by HTC) */
- int TxCreditsPerMaxMsg; /* credits required for a maximum sized messages (set by HTC) */
- void *pHTCReserved; /* reserved for HTC use */
- int TxQueueDepth; /* current depth of TX queue , i.e. messages waiting for credits
- This field is valid only when HTC_CREDIT_DIST_ACTIVITY_CHANGE
- or HTC_CREDIT_DIST_SEND_COMPLETE is indicated on an endpoint
- that has non-zero credits to recover
- */
-} HTC_ENDPOINT_CREDIT_DIST;
+struct htc_endpoint_credit_dist {
+ struct _htc_endpoint_credit_dist *pNext;
+ struct _htc_endpoint_credit_dist *pPrev;
+ /* Service ID (set by HTC) */
+ HTC_SERVICE_ID service_id;
+ /* endpoint for this distribution struct (set by HTC) */
+ HTC_ENDPOINT_ID Endpoint;
+ /* distribution flags, distribution function can
+ * set default activity using SET_EP_ACTIVE() macro
+ */
+ uint32_t DistFlags;
+ /* credits for normal operation, anything above this
+ * indicates the endpoint is over-subscribed, this field
+ * is only relevant to the credit distribution function
+ */
+ int TxCreditsNorm;
+ /* floor for credit distribution, this field is
+ * only relevant to the credit distribution function
+ */
+ int TxCreditsMin;
+ /* number of credits assigned to this EP, this field
+ * is only relevant to the credit dist function
+ */
+ int TxCreditsAssigned;
+ /* current credits available, this field is used by
+ * HTC to determine whether a message can be sent or
+ * must be queued
+ */
+ int TxCredits;
+ /* pending credits to distribute on this endpoint, this
+ * is set by HTC when credit reports arrive.
+ * The credit distribution functions sets this to zero
+ * when it distributes the credits
+ */
+ int TxCreditsToDist;
+ /* this is the number of credits that the current pending TX
+ * packet needs to transmit. This is set by HTC when
+ * and endpoint needs credits in order to transmit
+ */
+ int TxCreditsSeek;
+ /* size in bytes of each credit (set by HTC) */
+ int TxCreditSize;
+ /* credits required for a maximum sized messages (set by HTC) */
+ int TxCreditsPerMaxMsg;
+ /* reserved for HTC use */
+ void *pHTCReserved;
+ /* current depth of TX queue , i.e. messages waiting for credits
+ * This field is valid only when HTC_CREDIT_DIST_ACTIVITY_CHANGE
+ * or HTC_CREDIT_DIST_SEND_COMPLETE is indicated on an endpoint
+ * that has non-zero credits to recover
+ */
+ int TxQueueDepth;
+};
#define HTC_EP_ACTIVE ((uint32_t) (1u << 31))
@@ -233,218 +292,227 @@ typedef struct _HTC_ENDPOINT_CREDIT_DIST {
#define SET_EP_ACTIVE(epDist) (epDist)->DistFlags |= HTC_EP_ACTIVE
/* credit distibution code that is passed into the distrbution function,
- * there are mandatory and optional codes that must be handled */
-typedef enum _HTC_CREDIT_DIST_REASON {
- HTC_CREDIT_DIST_SEND_COMPLETE = 0, /* credits available as a result of completed
- send operations (MANDATORY) resulting in credit reports */
- HTC_CREDIT_DIST_ACTIVITY_CHANGE = 1, /* a change in endpoint activity occured (OPTIONAL) */
- HTC_CREDIT_DIST_SEEK_CREDITS, /* an endpoint needs to "seek" credits (OPTIONAL) */
- HTC_DUMP_CREDIT_STATE /* for debugging, dump any state information that is kept by
- the distribution function */
-} HTC_CREDIT_DIST_REASON;
+ * there are mandatory and optional codes that must be handled
+ */
+enum htc_credit_dist_reason {
+ /* credits available as a result of completed
+ * send operations (MANDATORY) resulting in credit reports
+ */
+ HTC_CREDIT_DIST_SEND_COMPLETE = 0,
+ /* a change in endpoint activity occurred (OPTIONAL) */
+ HTC_CREDIT_DIST_ACTIVITY_CHANGE = 1,
+ /* an endpoint needs to "seek" credits (OPTIONAL) */
+ HTC_CREDIT_DIST_SEEK_CREDITS,
+ /* for debugging, dump any state information that is kept by
+ * the distribution function
+ */
+ HTC_DUMP_CREDIT_STATE
+};
typedef void (*HTC_CREDIT_DIST_CALLBACK)(void *Context,
- HTC_ENDPOINT_CREDIT_DIST *
+ struct htc_endpoint_credit_dist *
pEPList,
- HTC_CREDIT_DIST_REASON
+ enum htc_credit_dist_reason
Reason);
typedef void (*HTC_CREDIT_INIT_CALLBACK)(void *Context,
- HTC_ENDPOINT_CREDIT_DIST *
+ struct htc_endpoint_credit_dist *
pEPList, int TotalCredits);
/* endpoint statistics action */
-typedef enum _HTC_ENDPOINT_STAT_ACTION {
- HTC_EP_STAT_SAMPLE = 0, /* only read statistics */
- HTC_EP_STAT_SAMPLE_AND_CLEAR = 1, /* sample and immediately clear statistics */
- HTC_EP_STAT_CLEAR /* clear only */
-} HTC_ENDPOINT_STAT_ACTION;
+enum htc_endpoint_stat_action {
+ /* only read statistics */
+ HTC_EP_STAT_SAMPLE = 0,
+ /* sample and immediately clear statistics */
+ HTC_EP_STAT_SAMPLE_AND_CLEAR = 1,
+ /* clear only */
+ HTC_EP_STAT_CLEAR
+};
/* endpoint statistics */
-typedef struct _HTC_ENDPOINT_STATS {
- uint32_t TxPosted; /* number of TX packets posted to the endpoint */
- uint32_t TxCreditLowIndications; /* number of times the host set the credit-low flag in a send message on
- this endpoint */
- uint32_t TxIssued; /* running count of total TX packets issued */
- uint32_t TxPacketsBundled; /* running count of TX packets that were issued in bundles */
- uint32_t TxBundles; /* running count of TX bundles that were issued */
- uint32_t TxDropped; /* tx packets that were dropped */
- uint32_t TxCreditRpts; /* running count of total credit reports received for this endpoint */
- uint32_t TxCreditRptsFromRx; /* credit reports received from this endpoint's RX packets */
- uint32_t TxCreditRptsFromOther; /* credit reports received from RX packets of other endpoints */
- uint32_t TxCreditRptsFromEp0; /* credit reports received from endpoint 0 RX packets */
- uint32_t TxCreditsFromRx; /* count of credits received via Rx packets on this endpoint */
- uint32_t TxCreditsFromOther; /* count of credits received via another endpoint */
- uint32_t TxCreditsFromEp0; /* count of credits received via another endpoint */
- uint32_t TxCreditsConsummed; /* count of consummed credits */
- uint32_t TxCreditsReturned; /* count of credits returned */
- uint32_t RxReceived; /* count of RX packets received */
- uint32_t RxLookAheads; /* count of lookahead records
- found in messages received on this endpoint */
- uint32_t RxPacketsBundled; /* count of recv packets received in a bundle */
- uint32_t RxBundleLookAheads; /* count of number of bundled lookaheads */
- uint32_t RxBundleIndFromHdr; /* count of the number of bundle indications from the HTC header */
- uint32_t RxAllocThreshHit; /* count of the number of times the recv allocation threshhold was hit */
- uint32_t RxAllocThreshBytes; /* total number of bytes */
-} HTC_ENDPOINT_STATS;
+struct htc_endpoint_stats {
+ /* number of TX packets posted to the endpoint */
+ uint32_t TxPosted;
+ /* number of times the host set the credit-low flag in a send message on
+ * this endpoint
+ */
+ uint32_t TxCreditLowIndications;
+ /* running count of total TX packets issued */
+ uint32_t TxIssued;
+ /* running count of TX packets that were issued in bundles */
+ uint32_t TxPacketsBundled;
+ /* running count of TX bundles that were issued */
+ uint32_t TxBundles;
+ /* tx packets that were dropped */
+ uint32_t TxDropped;
+ /* running count of total credit reports received for this endpoint */
+ uint32_t TxCreditRpts;
+ /* credit reports received from this endpoint's RX packets */
+ uint32_t TxCreditRptsFromRx;
+ /* credit reports received from RX packets of other endpoints */
+ uint32_t TxCreditRptsFromOther;
+ /* credit reports received from endpoint 0 RX packets */
+ uint32_t TxCreditRptsFromEp0;
+ /* count of credits received via Rx packets on this endpoint */
+ uint32_t TxCreditsFromRx;
+ /* count of credits received via another endpoint */
+ uint32_t TxCreditsFromOther;
+ /* count of credits received via another endpoint */
+ uint32_t TxCreditsFromEp0;
+ /* count of consummed credits */
+ uint32_t TxCreditsConsummed;
+ /* count of credits returned */
+ uint32_t TxCreditsReturned;
+ /* count of RX packets received */
+ uint32_t RxReceived;
+ /* count of lookahead records
+ * found in messages received on this endpoint
+ */
+ uint32_t RxLookAheads;
+ /* count of recv packets received in a bundle */
+ uint32_t RxPacketsBundled;
+ /* count of number of bundled lookaheads */
+ uint32_t RxBundleLookAheads;
+ /* count of the number of bundle indications from the HTC header */
+ uint32_t RxBundleIndFromHdr;
+ /* number of times the recv allocation threshold was hit */
+ uint32_t RxAllocThreshHit;
+ /* total number of bytes */
+ uint32_t RxAllocThreshBytes;
+};
/* ------ Function Prototypes ------ */
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Create an instance of HTC over the underlying HIF device
- @function name: htc_create
- @input: HifDevice - hif device handle,
- pInfo - initialization information
- osdev - QDF device structure
- con_mode - driver connection mode
- @output:
- @return: HTC_HANDLE on success, NULL on failure
- @notes:
- @example:
- @see also: htc_destroy
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-HTC_HANDLE htc_create(void *HifDevice, HTC_INIT_INFO *pInfo, qdf_device_t osdev,
- uint32_t con_mode);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Get the underlying HIF device handle
- @function name: htc_get_hif_device
- @input: HTCHandle - handle passed into the AddInstance callback
- @output:
- @return: opaque HIF device handle usable in HIF API calls.
- @notes:
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+/**
+ * htc_create - Create an instance of HTC over the underlying HIF device
+ * @HifDevice: hif device handle,
+ * @pInfo: initialization information
+ * @osdev: QDF device structure
+ * @con_mode: driver connection mode
+ *
+ * Return: HTC_HANDLE on success, NULL on failure
+ */
+HTC_HANDLE htc_create(void *HifDevice, struct htc_init_info *pInfo,
+ qdf_device_t osdev, uint32_t con_mode);
+
+/**
+ * htc_get_hif_device - Get the underlying HIF device handle
+ * @HTCHandle: handle passed into the AddInstance callback
+ *
+ * Return: opaque HIF device handle usable in HIF API calls.
+ */
void *htc_get_hif_device(HTC_HANDLE HTCHandle);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Set credit distribution parameters
- @function name: htc_set_credit_distribution
- @input: HTCHandle - HTC handle
- pCreditDistCont - caller supplied context to pass into distribution functions
- CreditDistFunc - Distribution function callback
- CreditDistInit - Credit Distribution initialization callback
- ServicePriorityOrder - Array containing list of service IDs, lowest index
- is highestpriority
- ListLength - number of elements in ServicePriorityOrder
- @output:
- @return:
- @notes : The user can set a custom credit distribution function to handle
- special requirementsfor each endpoint. A default credit distribution
- routine can be used by setting CreditInitFunc to NULL. The default
- credit distribution is only provided for simple "fair" credit distribution
- without regard to any prioritization.
-
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+
+/**
+ * htc_set_credit_distribution - Set credit distribution parameters
+ * @HTCHandle: HTC handle
+ * @pCreditDistCont: caller supplied context to pass into distribution functions
+ * @CreditDistFunc: Distribution function callback
+ * @CreditDistInit: Credit Distribution initialization callback
+ * @ServicePriorityOrder: Array containing list of service IDs, lowest index
+ * @is highestpriority: ListLength - number of elements in ServicePriorityOrder
+ *
+ * The user can set a custom credit distribution function to handle
+ * special requirementsfor each endpoint. A default credit distribution
+ * routine can be used by setting CreditInitFunc to NULL. The default
+ * credit distribution is only provided for simple "fair" credit distribution
+ * without regard to any prioritization.
+ * Return: None
+ */
void htc_set_credit_distribution(HTC_HANDLE HTCHandle,
void *pCreditDistContext,
HTC_CREDIT_DIST_CALLBACK CreditDistFunc,
HTC_CREDIT_INIT_CALLBACK CreditInitFunc,
HTC_SERVICE_ID ServicePriorityOrder[],
int ListLength);
+
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Wait for the target to indicate the HTC layer is ready
- @function name: htc_wait_target
- @input: HTCHandle - HTC handle
- @output:
- @return:
- @notes: This API blocks until the target responds with an HTC ready message.
- The caller should not connect services until the target has indicated it is
- ready.
- @example:
- @see also: htc_connect_service
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+ * Wait for the target to indicate the HTC layer is ready
+ * htc_wait_target
+ * @HTCHandle - HTC handle
+ *
+ * This API blocks until the target responds with an HTC ready message.
+ * The caller should not connect services until the target has indicated it is
+ * ready.
+ * Return: None
+ */
A_STATUS htc_wait_target(HTC_HANDLE HTCHandle);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Start target service communications
- @function name: htc_start
- @input: HTCHandle - HTC handle
- @output:
- @return:
- @notes: This API indicates to the target that the service connection phase
- is completeand the target can freely start all connected services. This
- API should only be called AFTER all service connections have been made.
- TCStart will issue a SETUP_COMPLETE message to the target to indicate that
- all service connections have been made and the target can start
- communicating over the endpoints.
- @example:
- @see also: htc_connect_service
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+
+/**
+ * htc_start - Start target service communications
+ * @HTCHandle - HTC handle
+ *
+ * This API indicates to the target that the service connection phase
+ * is completeand the target can freely start all connected services. This
+ * API should only be called AFTER all service connections have been made.
+ * TCStart will issue a SETUP_COMPLETE message to the target to indicate that
+ * all service connections have been made and the target can start
+ * communicating over the endpoints.
+ * Return: None
+ */
A_STATUS htc_start(HTC_HANDLE HTCHandle);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Add receive packet to HTC
- @function name: htc_add_receive_pkt
- @input: HTCHandle - HTC handle
- pPacket - HTC receive packet to add
- @output:
- @return: A_OK on success
- @notes: user must supply HTC packets for capturing incomming HTC frames.
- The caller must initialize each HTC packet using the
- SET_HTC_PACKET_INFO_RX_REFILL() macro.
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+
+/**
+ * htc_add_receive_pkt - Add receive packet to HTC
+ * @HTCHandle - HTC handle
+ * @pPacket - HTC receive packet to add
+ *
+ * User must supply HTC packets for capturing incoming HTC frames.
+ * The caller must initialize each HTC packet using the
+ * SET_HTC_PACKET_INFO_RX_REFILL() macro.
+ * Return: A_OK on success
+ */
A_STATUS htc_add_receive_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Connect to an HTC service
- @function name: htc_connect_service
- @input: HTCHandle - HTC handle
- pReq - connection details
- @output: pResp - connection response
- @return:
- @notes: Service connections must be performed before htc_start.
- User provides callback handlersfor various endpoint events.
- @example:
- @see also: htc_start
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+
+/**
+ * htc_connect_service - Connect to an HTC service
+ * @HTCHandle - HTC handle
+ * @pReq - connection details
+ * @pResp - connection response
+ *
+ * Service connections must be performed before htc_start.
+ * User provides callback handlersfor various endpoint events.
+ * Return: None
+ */
A_STATUS htc_connect_service(HTC_HANDLE HTCHandle,
- HTC_SERVICE_CONNECT_REQ *pReq,
- HTC_SERVICE_CONNECT_RESP *pResp);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: HTC register log dump
- @function name: htc_dump
- @input: HTCHandle - HTC handle
- CmdId - Log command
- start - start/print logs
- @output:
- @return:
- @notes: Register logs will be started/printed.
- be flushed.
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+ struct htc_service_connect_req *pReq,
+ struct htc_service_connect_resp *pResp);
+/**
+ * htc_dump - HTC register log dump
+ * @HTCHandle - HTC handle
+ * @CmdId - Log command
+ * @start - start/print logs
+ *
+ * Register logs will be started/printed/ be flushed.
+ * Return: None
+ */
void htc_dump(HTC_HANDLE HTCHandle, uint8_t CmdId, bool start);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Send an HTC packet
- @function name: htc_send_pkt
- @input: HTCHandle - HTC handle
- pPacket - packet to send
- @output:
- @return: A_OK
- @notes: Caller must initialize packet using SET_HTC_PACKET_INFO_TX() macro.
- This interface is fully asynchronous. On error, HTC SendPkt will
- call the registered Endpoint callback to cleanup the packet.
- @example:
- @see also: htc_flush_endpoint
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+
+/**
+ * htc_send_pkt - Send an HTC packet
+ * @HTCHandle - HTC handle
+ * @pPacket - packet to send
+ *
+ * Caller must initialize packet using SET_HTC_PACKET_INFO_TX() macro.
+ * This interface is fully asynchronous. On error, HTC SendPkt will
+ * call the registered Endpoint callback to cleanup the packet.
+ * Return: A_OK
+ */
A_STATUS htc_send_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Send an HTC packet containing a tx descriptor and data
- @function name: htc_send_data_pkt
- @input: HTCHandle - HTC handle
- pPacket - packet to send
- @output:
- @return: A_OK
- @notes: Caller must initialize packet using SET_HTC_PACKET_INFO_TX() macro.
- Caller must provide headroom in an initial fragment added to the
- network buffer to store a HTC_FRAME_HDR.
- This interface is fully asynchronous. On error, htc_send_data_pkt will
- call the registered Endpoint EpDataTxComplete callback to cleanup
- the packet.
- @example:
- @see also: htc_send_pkt
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+
+/**
+ * htc_send_data_pkt - Send an HTC packet containing a tx descriptor and data
+ * @HTCHandle - HTC handle
+ * @pPacket - packet to send
+ *
+ * Caller must initialize packet using SET_HTC_PACKET_INFO_TX() macro.
+ * Caller must provide headroom in an initial fragment added to the
+ * network buffer to store a HTC_FRAME_HDR.
+ * This interface is fully asynchronous. On error, htc_send_data_pkt will
+ * call the registered Endpoint EpDataTxComplete callback to cleanup
+ * the packet.
+ * Return: A_OK
+ */
#ifdef ATH_11AC_TXCOMPACT
A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, qdf_nbuf_t netbuf,
int Epid, int ActualLength);
@@ -452,229 +520,188 @@ A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, qdf_nbuf_t netbuf,
A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket,
uint8_t more_data);
#endif /*ATH_11AC_TXCOMPACT */
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Flush HTC when target is removed surprisely service communications
- @function name: htc_flush_surprise_remove
- @input: HTCHandle - HTC handle
- @output:
- @return:
- @notes: All receive and pending TX packets will
- be flushed.
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+
+/**
+ * htc_flush_surprise_remove - Flush HTC when target is removed surprisely
+ * service communications
+ * @HTCHandle - HTC handle
+ *
+ * All receive and pending TX packets will be flushed.
+ * Return: None
+ */
void htc_flush_surprise_remove(HTC_HANDLE HTCHandle);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Stop HTC service communications
- @function name: htc_stop
- @input: HTCHandle - HTC handle
- @output:
- @return:
- @notes: HTC communications is halted. All receive and pending TX packets will
- be flushed.
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+
+/**
+ * htc_stop - Stop HTC service communications
+ * @HTCHandle - HTC handle
+ *
+ * HTC communications is halted. All receive and pending TX packets
+ * will be flushed.
+ * Return: None
+ */
void htc_stop(HTC_HANDLE HTCHandle);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Destory HTC service
- @function name: htc_destroy
- @input: HTCHandle
- @output:
- @return:
- @notes: This cleans up all resources allocated by htc_create().
- @example:
- @see also: htc_create
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+
+/**
+ * htc_destroy - Destroy HTC service
+ * @HTCHandle - HTC handle
+ *
+ * This cleans up all resources allocated by htc_create().
+ * Return: None
+ */
void htc_destroy(HTC_HANDLE HTCHandle);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Flush pending TX packets
- @function name: htc_flush_endpoint
- @input: HTCHandle - HTC handle
- Endpoint - Endpoint to flush
- Tag - flush tag
- @output:
- @return:
- @notes: The Tag parameter is used to selectively flush packets with matching tags.
- The value of 0 forces all packets to be flush regardless of tag.
- @example:
- @see also: htc_send_pkt
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+
+/**
+ * htc_flush_endpoint - Flush pending TX packets
+ * @HTCHandle - HTC handle
+ * @Endpoint - Endpoint to flush
+ * @Tag - flush tag
+ *
+ * The Tag parameter is used to selectively flush packets with matching
+ * tags. The value of 0 forces all packets to be flush regardless of tag
+ * Return: None
+ */
void htc_flush_endpoint(HTC_HANDLE HTCHandle, HTC_ENDPOINT_ID Endpoint,
HTC_TX_TAG Tag);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Dump credit distribution state
- @function name: htc_dump_credit_states
- @input: HTCHandle - HTC handle
- @output:
- @return:
- @notes: This dumps all credit distribution information to the debugger
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+/**
+ * htc_dump_credit_states - Dump credit distribution state
+ * @HTCHandle - HTC handle
+ *
+ * This dumps all credit distribution information to the debugger
+ * Return: None
+ */
void htc_dump_credit_states(HTC_HANDLE HTCHandle);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Indicate a traffic activity change on an endpoint
- @function name: htc_indicate_activity_change
- @input: HTCHandle - HTC handle
- Endpoint - endpoint in which activity has changed
- Active - true if active, false if it has become inactive
- @output:
- @return:
- @notes: This triggers the registered credit distribution function to
- re-adjust credits for active/inactive endpoints.
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+
+/**
+ * htc_indicate_activity_change - Indicate a traffic activity change on an
+ * endpoint
+ * @HTCHandle - HTC handle
+ * @Endpoint - endpoint in which activity has changed
+ * @Active - true if active, false if it has become inactive
+ *
+ * This triggers the registered credit distribution function to
+ * re-adjust credits for active/inactive endpoints.
+ * Return: None
+ */
void htc_indicate_activity_change(HTC_HANDLE HTCHandle,
HTC_ENDPOINT_ID Endpoint, bool Active);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Get endpoint statistics
- @function name: htc_get_endpoint_statistics
- @input: HTCHandle - HTC handle
- Endpoint - Endpoint identifier
- Action - action to take with statistics
- @output:
- pStats - statistics that were sampled (can be NULL if Action is HTC_EP_STAT_CLEAR)
-
- @return: true if statistics profiling is enabled, otherwise false.
-
- @notes : Statistics is a compile-time option and this function may return
- false if HTC is not compiled with profiling.
-
- The caller can specify the statistic "action" to take when sampling
- the statistics. This includes :
-
- HTC_EP_STAT_SAMPLE : The pStats structure is filled with the current
- values.
- HTC_EP_STAT_SAMPLE_AND_CLEAR : The structure is filled and the current
- statisticsare cleared.
-
- HTC_EP_STAT_CLEA : the statistics are cleared, the called can pass a NULL
- value forpStats
-
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+/**
+ * htc_get_endpoint_statistics - Get endpoint statistics
+ * @HTCHandle - HTC handle
+ * @Endpoint - Endpoint identifier
+ * @Action - action to take with statistics
+ * @pStats - statistics that were sampled (can be NULL if Action is
+ * HTC_EP_STAT_CLEAR)
+ *
+ * Statistics is a compile-time option and this function may return
+ * false if HTC is not compiled with profiling.
+ * The caller can specify the statistic "action" to take when sampling
+ * the statistics. This includes :
+ * HTC_EP_STAT_SAMPLE : The pStats structure is filled with the current
+ * values.
+ * HTC_EP_STAT_SAMPLE_AND_CLEAR : The structure is filled and the current
+ * statisticsare cleared.
+ * HTC_EP_STAT_CLEA : the statistics are cleared, the called can pass
+ * a NULL value for pStats
+ * Return: true if statistics profiling is enabled, otherwise false.
+ */
bool htc_get_endpoint_statistics(HTC_HANDLE HTCHandle,
HTC_ENDPOINT_ID Endpoint,
- HTC_ENDPOINT_STAT_ACTION Action,
- HTC_ENDPOINT_STATS *pStats);
+ enum htc_endpoint_stat_action Action,
+ struct htc_endpoint_stats *pStats);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Unblock HTC message reception
- @function name: htc_unblock_recv
- @input: HTCHandle - HTC handle
- @output:
- @return:
- @notes:
- HTC will block the receiver if the EpRecvAlloc callback fails to provide a
- packet. The caller can use this API to indicate to HTC when resources
- (buffers) are available such that the receiver can be unblocked and HTC
- may re-attempt fetching the pending message.
-
- This API is not required if the user uses the EpRecvRefill callback or uses
- the HTCAddReceivePacket()API to recycle or provide receive packets to HTC.
-
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+/**
+ * htc_unblock_recv - Unblock HTC message reception
+ * @HTCHandle - HTC handle
+ *
+ * HTC will block the receiver if the EpRecvAlloc callback fails to provide a
+ * packet. The caller can use this API to indicate to HTC when resources
+ * (buffers) are available such that the receiver can be unblocked and HTC
+ * may re-attempt fetching the pending message.
+ * This API is not required if the user uses the EpRecvRefill callback or uses
+ * the HTCAddReceivePacket()API to recycle or provide receive packets to HTC.
+ * Return: None
+ */
void htc_unblock_recv(HTC_HANDLE HTCHandle);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: send a series of HTC packets
- @function name: htc_send_pkts_multiple
- @input: HTCHandle - HTC handle
- pPktQueue - local queue holding packets to send
- @output:
- @return: A_OK
- @notes: Caller must initialize each packet using SET_HTC_PACKET_INFO_TX() macro.
- The queue must only contain packets directed at the same endpoint.
- Caller supplies a pointer to an HTC_PACKET_QUEUE structure holding the TX packets in FIFO order.
- This API will remove the packets from the pkt queue and place them into the HTC Tx Queue
- and bundle messages where possible.
- The caller may allocate the pkt queue on the stack to hold the packets.
- This interface is fully asynchronous. On error, htc_send_pkts will
- call the registered Endpoint callback to cleanup the packet.
- @example:
- @see also: htc_flush_endpoint
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+/**
+ * htc_send_pkts_multiple - Send a series of HTC packets
+ * @HTCHandle - HTC handle
+ * @pPktQueue - local queue holding packets to send
+ *
+ * Caller must initialize each packet using SET_HTC_PACKET_INFO_TX()
+ * macro. The queue must only contain packets directed at the same
+ * endpoint. Caller supplies a pointer to an HTC_PACKET_QUEUE structure
+ * holding the TX packets in FIFO order. This API will remove the
+ * packets from the pkt queue and place them into the HTC Tx Queue
+ * and bundle messages where possible.
+ * The caller may allocate the pkt queue on the stack to hold the pkts.
+ * This interface is fully asynchronous. On error, htc_send_pkts will
+ * call the registered Endpoint callback to cleanup the packet.
+ * Return: A_OK
+ */
A_STATUS htc_send_pkts_multiple(HTC_HANDLE HTCHandle,
HTC_PACKET_QUEUE *pPktQueue);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Add multiple receive packets to HTC
- @function name: htc_add_receive_pkt_multiple
- @input: HTCHandle - HTC handle
- pPktQueue - HTC receive packet queue holding packets to add
- @output:
- @return: A_OK on success
- @notes: user must supply HTC packets for capturing incomming HTC frames. The caller
- must initialize each HTC packet using the SET_HTC_PACKET_INFO_RX_REFILL()
- macro. The queue must only contain recv packets for the same endpoint.
- Caller supplies a pointer to an HTC_PACKET_QUEUE structure holding the recv packet.
- This API will remove the packets from the pkt queue and place them into internal
- recv packet list.
- The caller may allocate the pkt queue on the stack to hold the packets.
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+/**
+ * htc_add_receive_pkt_multiple - Add multiple receive packets to HTC
+ * @HTCHandle - HTC handle
+ * @pPktQueue - HTC receive packet queue holding packets to add
+ *
+ * User must supply HTC packets for capturing incoming HTC frames.
+ * The caller mmust initialize each HTC packet using the
+ * SET_HTC_PACKET_INFO_RX_REFILL() macro. The queue must only contain
+ * recv packets for the same endpoint. Caller supplies a pointer to an
+ * HTC_PACKET_QUEUE structure holding the recv packet. This API will
+ * remove the packets from the pkt queue and place them into internal
+ * recv packet list.
+ * The caller may allocate the pkt queue on the stack to hold the pkts.
+ * Return: A_OK on success
+ */
A_STATUS htc_add_receive_pkt_multiple(HTC_HANDLE HTCHandle,
HTC_PACKET_QUEUE *pPktQueue);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Check if an endpoint is marked active
- @function name: htc_is_endpoint_active
- @input: HTCHandle - HTC handle
- Endpoint - endpoint to check for active state
- @output:
- @return: returns true if Endpoint is Active
- @notes:
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+/**
+ * htc_is_endpoint_active - Check if an endpoint is marked active
+ * @HTCHandle - HTC handle
+ * @Endpoint - endpoint to check for active state
+ *
+ * Return: returns true if Endpoint is Active
+ */
bool htc_is_endpoint_active(HTC_HANDLE HTCHandle,
HTC_ENDPOINT_ID Endpoint);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Set up nodrop pkt flag for mboxping nodrop pkt
- @function name: htc_set_nodrop_pkt
- @input: HTCHandle - HTC handle
- isNodropPkt - indicates whether it is nodrop pkt
- @output:
- @return:
- @notes:
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+/**
+ * htc_set_nodrop_pkt - Set up nodrop pkt flag for mboxping nodrop pkt
+ * @HTCHandle - HTC handle
+ * @isNodropPkt - indicates whether it is nodrop pkt
+ *
+ * Return: None
+ * Return:
+ *
+ */
void htc_set_nodrop_pkt(HTC_HANDLE HTCHandle, A_BOOL isNodropPkt);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Get the number of recv buffers currently queued into an HTC endpoint
- @function name: htc_get_num_recv_buffers
- @input: HTCHandle - HTC handle
- Endpoint - endpoint to check
- @output:
- @return: returns number of buffers in queue
- @notes:
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+/**
+ * htc_get_num_recv_buffers - Get the number of recv buffers currently queued
+ * into an HTC endpoint
+ * @HTCHandle - HTC handle
+ * @Endpoint - endpoint to check
+ *
+ * Return: returns number of buffers in queue
+ *
+ */
int htc_get_num_recv_buffers(HTC_HANDLE HTCHandle,
HTC_ENDPOINT_ID Endpoint);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Set the target failure handling callback in HTC layer
- @function name: htc_set_target_failure_callback
- @input: HTCHandle - HTC handle
- Callback - target failure handling callback
- @output:
- @return:
- @notes:
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+/**
+ * htc_set_target_failure_callback - Set the target failure handling callback
+ * in HTC layer
+ * @HTCHandle - HTC handle
+ * @Callback - target failure handling callback
+ *
+ * Return: None
+ */
void htc_set_target_failure_callback(HTC_HANDLE HTCHandle,
HTC_TARGET_FAILURE Callback);
@@ -713,20 +740,20 @@ int htc_get_tx_queue_depth(HTC_HANDLE *htc_handle, HTC_ENDPOINT_ID endpoint_id);
void htc_ctrl_msg_cmpl(HTC_HANDLE htc_pdev, HTC_ENDPOINT_ID htc_ep_id);
#define HTC_TX_DESC_FILL(_htc_tx_desc, _download_len, _ep_id, _seq_no) \
-do { \
- HTC_WRITE32((_htc_tx_desc), \
- SM((_download_len), HTC_FRAME_HDR_PAYLOADLEN) | \
- SM((_ep_id), HTC_FRAME_HDR_ENDPOINTID)); \
- \
- HTC_WRITE32((uint32_t *)(_htc_tx_desc) + 1, \
- SM((_seq_no), HTC_FRAME_HDR_CONTROLBYTES1));\
+do { \
+ HTC_WRITE32((_htc_tx_desc), \
+ SM((_download_len), HTC_FRAME_HDR_PAYLOADLEN) | \
+ SM((_ep_id), HTC_FRAME_HDR_ENDPOINTID)); \
+ HTC_WRITE32((uint32_t *)(_htc_tx_desc) + 1, \
+ SM((_seq_no), HTC_FRAME_HDR_CONTROLBYTES1)); \
} while (0)
#endif /* WLAN_FEATURE_FASTPATH */
#ifdef __cplusplus
}
#endif
-void htc_get_control_endpoint_tx_host_credits(HTC_HANDLE HTCHandle, int *credit);
+void htc_get_control_endpoint_tx_host_credits(HTC_HANDLE HTCHandle,
+ int *credit);
void htc_dump_counter_info(HTC_HANDLE HTCHandle);
void *htc_get_targetdef(HTC_HANDLE htc_handle);
#ifdef FEATURE_RUNTIME_PM
@@ -778,4 +805,10 @@ int htc_pm_runtime_put(HTC_HANDLE htc_handle);
static inline int htc_pm_runtime_get(HTC_HANDLE htc_handle) { return 0; }
static inline int htc_pm_runtime_put(HTC_HANDLE htc_handle) { return 0; }
#endif
+
+#ifdef WMI_INTERFACE_EVENT_LOGGING
+void htc_print_credit_history(HTC_HANDLE htc, uint32_t count,
+ qdf_abstract_print * print, void *print_priv);
+#endif
+
#endif /* _HTC_API_H_ */
diff --git a/htc/htc_internal.h b/htc/htc_internal.h
index 596628cead6a..1a914b2a7aaa 100644
--- a/htc/htc_internal.h
+++ b/htc/htc_internal.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -69,7 +69,8 @@ extern "C" {
#define HTC_PACKET_CONTAINER_ALLOCATION 32
#define NUM_CONTROL_TX_BUFFERS 2
-#define HTC_CONTROL_BUFFER_SIZE (HTC_MAX_CONTROL_MESSAGE_LENGTH + HTC_HDR_LENGTH)
+#define HTC_CONTROL_BUFFER_SIZE (HTC_MAX_CONTROL_MESSAGE_LENGTH + \
+ HTC_HDR_LENGTH)
#define HTC_CONTROL_BUFFER_ALIGN 32
#define HTC_TARGET_RESPONSE_POLL_MS 10
#if !defined(A_SIMOS_DEVHOST)
@@ -84,20 +85,39 @@ extern "C" {
#define HTC_IS_EPPING_ENABLED(_x) ((_x) == QDF_GLOBAL_EPPING_MODE)
-typedef enum {
+enum htc_credit_exchange_type {
HTC_REQUEST_CREDIT,
HTC_PROCESS_CREDIT_REPORT,
HTC_SUSPEND_ACK,
HTC_SUSPEND_NACK,
HTC_INITIAL_WAKE_UP,
-} htc_credit_exchange_type;
+};
+
+static inline const char*
+htc_credit_exchange_type_str(enum htc_credit_exchange_type type)
+{
+ switch (type) {
+ case HTC_REQUEST_CREDIT:
+ return "HTC_REQUEST_CREDIT";
+ case HTC_PROCESS_CREDIT_REPORT:
+ return "HTC_PROCESS_CREDIT_REPORT";
+ case HTC_SUSPEND_ACK:
+ return "HTC_SUSPEND_ACK";
+ case HTC_SUSPEND_NACK:
+ return "HTC_SUSPEND_NACK";
+ case HTC_INITIAL_WAKE_UP:
+ return "HTC_INITIAL_WAKE_UP";
+ default:
+ return "Unknown htc_credit_exchange_type";
+ }
+}
-typedef struct {
- htc_credit_exchange_type type;
+struct HTC_CREDIT_HISTORY {
+ enum htc_credit_exchange_type type;
uint64_t time;
uint32_t tx_credit;
uint32_t htc_tx_queue_depth;
-} HTC_CREDIT_HISTORY;
+};
typedef struct _HTC_ENDPOINT {
HTC_ENDPOINT_ID Id;
@@ -107,32 +127,44 @@ typedef struct _HTC_ENDPOINT {
*/
HTC_SERVICE_ID service_id;
- HTC_EP_CALLBACKS EpCallBacks; /* callbacks associated with this endpoint */
- HTC_PACKET_QUEUE TxQueue; /* HTC frame buffer TX queue */
- int MaxTxQueueDepth; /* max depth of the TX queue before we need to
- call driver's full handler */
- int MaxMsgLength; /* max length of endpoint message */
+ /* callbacks associated with this endpoint */
+ struct htc_ep_callbacks EpCallBacks;
+ /* HTC frame buffer TX queue */
+ HTC_PACKET_QUEUE TxQueue;
+ /* max depth of the TX queue before calling driver's full handler */
+ int MaxTxQueueDepth;
+ /* max length of endpoint message */
+ int MaxMsgLength;
uint8_t UL_PipeID;
uint8_t DL_PipeID;
- int ul_is_polled; /* Need to call HIF to get tx completion callbacks? */
+ /* Need to call HIF to get tx completion callbacks? */
+ int ul_is_polled;
qdf_timer_t ul_poll_timer;
int ul_poll_timer_active;
int ul_outstanding_cnt;
- int dl_is_polled; /* Need to call HIF to fetch rx? (Not currently supported.) */
-#if 0 /* not currently supported */
- qdf_timer_t dl_poll_timer;
-#endif
-
- HTC_PACKET_QUEUE TxLookupQueue; /* lookup queue to match netbufs to htc packets */
- HTC_PACKET_QUEUE RxBufferHoldQueue; /* temporary hold queue for back compatibility */
- uint8_t SeqNo; /* TX seq no (helpful) for debugging */
- qdf_atomic_t TxProcessCount; /* serialization */
+ /* Need to call HIF to fetch rx? (Not currently supported.) */
+ int dl_is_polled;
+ /* not currently supported */
+ /* qdf_timer_t dl_poll_timer; */
+
+ /* lookup queue to match netbufs to htc packets */
+ HTC_PACKET_QUEUE TxLookupQueue;
+ /* temporary hold queue for back compatibility */
+ HTC_PACKET_QUEUE RxBufferHoldQueue;
+ /* TX seq no (helpful) for debugging */
+ uint8_t SeqNo;
+ /* serialization */
+ qdf_atomic_t TxProcessCount;
struct _HTC_TARGET *target;
- int TxCredits; /* TX credits available on this endpoint */
- int TxCreditSize; /* size in bytes of each credit (set by HTC) */
- int TxCreditsPerMaxMsg; /* credits required per max message (precalculated) */
+ /* TX credits available on this endpoint */
+ int TxCredits;
+ /* size in bytes of each credit (set by HTC) */
+ int TxCreditSize;
+ /* credits required per max message (precalculated) */
+ int TxCreditsPerMaxMsg;
#ifdef HTC_EP_STAT_PROFILING
- HTC_ENDPOINT_STATS endpoint_stats; /* endpoint statistics */
+ /* endpoint statistics */
+ struct htc_endpoint_stats endpoint_stats;
#endif
bool TxCreditFlowEnabled;
} HTC_ENDPOINT;
@@ -143,16 +175,17 @@ typedef struct _HTC_ENDPOINT {
#define INC_HTC_EP_STAT(p, stat, count)
#endif
-typedef struct {
+struct htc_service_tx_credit_allocation {
uint16_t service_id;
uint8_t CreditAllocation;
-} HTC_SERVICE_TX_CREDIT_ALLOCATION;
+};
#define HTC_MAX_SERVICE_ALLOC_ENTRIES 8
/* Error codes for HTC layer packet stats*/
enum ol_ath_htc_pkt_ecodes {
- GET_HTC_PKT_Q_FAIL = 0, /* error- get packet at head of HTC_PACKET_Q */
+ /* error- get packet at head of HTC_PACKET_Q */
+ GET_HTC_PKT_Q_FAIL = 0,
HTC_PKT_Q_EMPTY,
HTC_SEND_Q_EMPTY
};
@@ -166,15 +199,15 @@ typedef struct _HTC_TARGET {
qdf_spinlock_t HTCCreditLock;
uint32_t HTCStateFlags;
void *host_handle;
- HTC_INIT_INFO HTCInitInfo;
- HTC_PACKET *pHTCPacketStructPool; /* pool of HTC packets */
+ struct htc_init_info HTCInitInfo;
+ HTC_PACKET *pHTCPacketStructPool; /* pool of HTC packets */
HTC_PACKET_QUEUE ControlBufferTXFreeList;
uint8_t CtrlResponseBuffer[HTC_MAX_CONTROL_MESSAGE_LENGTH];
int CtrlResponseLength;
qdf_event_t ctrl_response_valid;
bool CtrlResponseProcessing;
int TotalTransmitCredits;
- HTC_SERVICE_TX_CREDIT_ALLOCATION
+ struct htc_service_tx_credit_allocation
ServiceTxAllocTable[HTC_MAX_SERVICE_ALLOC_ENTRIES];
int TargetCreditSize;
#ifdef RX_SG_SUPPORT
@@ -225,21 +258,23 @@ typedef struct _HTC_TARGET {
#ifdef RX_SG_SUPPORT
#define RESET_RX_SG_CONFIG(_target) \
+do { \
_target->ExpRxSgTotalLen = 0; \
_target->CurRxSgTotalLen = 0; \
- _target->IsRxSgInprogress = false;
+ _target->IsRxSgInprogress = false; \
+} while (0)
#endif
#define HTC_STATE_STOPPING (1 << 0)
#define HTC_STOPPING(t) ((t)->HTCStateFlags & HTC_STATE_STOPPING)
-#define LOCK_HTC(t) qdf_spin_lock_bh(&(t)->HTCLock);
-#define UNLOCK_HTC(t) qdf_spin_unlock_bh(&(t)->HTCLock);
-#define LOCK_HTC_RX(t) qdf_spin_lock_bh(&(t)->HTCRxLock);
-#define UNLOCK_HTC_RX(t) qdf_spin_unlock_bh(&(t)->HTCRxLock);
-#define LOCK_HTC_TX(t) qdf_spin_lock_bh(&(t)->HTCTxLock);
-#define UNLOCK_HTC_TX(t) qdf_spin_unlock_bh(&(t)->HTCTxLock);
-#define LOCK_HTC_CREDIT(t) qdf_spin_lock_bh(&(t)->HTCCreditLock);
-#define UNLOCK_HTC_CREDIT(t) qdf_spin_unlock_bh(&(t)->HTCCreditLock);
+#define LOCK_HTC(t) qdf_spin_lock_bh(&(t)->HTCLock)
+#define UNLOCK_HTC(t) qdf_spin_unlock_bh(&(t)->HTCLock)
+#define LOCK_HTC_RX(t) qdf_spin_lock_bh(&(t)->HTCRxLock)
+#define UNLOCK_HTC_RX(t) qdf_spin_unlock_bh(&(t)->HTCRxLock)
+#define LOCK_HTC_TX(t) qdf_spin_lock_bh(&(t)->HTCTxLock)
+#define UNLOCK_HTC_TX(t) qdf_spin_unlock_bh(&(t)->HTCTxLock)
+#define LOCK_HTC_CREDIT(t) qdf_spin_lock_bh(&(t)->HTCCreditLock)
+#define UNLOCK_HTC_CREDIT(t) qdf_spin_unlock_bh(&(t)->HTCCreditLock)
#define GET_HTC_TARGET_FROM_HANDLE(hnd) ((HTC_TARGET *)(hnd))
@@ -251,21 +286,19 @@ typedef struct _HTC_TARGET {
#define OL_ATH_HTC_PKT_ERROR_COUNT_INCR(_target, _ecode) \
do { \
if (_ecode == GET_HTC_PKT_Q_FAIL) \
- (_target->htc_pkt_stats.htc_get_pkt_q_fail_count) += 1 \
- ; \
+ (_target->htc_pkt_stats.htc_get_pkt_q_fail_count) += 1; \
if (_ecode == HTC_PKT_Q_EMPTY) \
- (_target->htc_pkt_stats.htc_pkt_q_empty_count) += 1 \
- ; \
+ (_target->htc_pkt_stats.htc_pkt_q_empty_count) += 1; \
if (_ecode == HTC_SEND_Q_EMPTY) \
- (_target->htc_pkt_stats.htc_send_q_empty_count) += 1 \
- ; \
- } while (0);
+ (_target->htc_pkt_stats.htc_send_q_empty_count) += 1; \
+ } while (0)
/* internal HTC functions */
QDF_STATUS htc_rx_completion_handler(void *Context, qdf_nbuf_t netbuf,
uint8_t pipeID);
QDF_STATUS htc_tx_completion_handler(void *Context, qdf_nbuf_t netbuf,
- unsigned int transferID, uint32_t toeplitz_hash_result);
+ unsigned int transferID,
+ uint32_t toeplitz_hash_result);
HTC_PACKET *allocate_htc_bundle_packet(HTC_TARGET *target);
void free_htc_bundle_packet(HTC_TARGET *target, HTC_PACKET *pPacket);
@@ -291,7 +324,7 @@ void htc_send_complete_check_cleanup(void *context);
void htc_kick_queues(void *context);
#endif
-void htc_credit_record(htc_credit_exchange_type type, uint32_t tx_credit,
+void htc_credit_record(enum htc_credit_exchange_type type, uint32_t tx_credit,
uint32_t htc_tx_queue_depth);
static inline void htc_send_complete_poll_timer_stop(HTC_ENDPOINT *
@@ -309,9 +342,8 @@ static inline void htc_send_complete_poll_timer_start(HTC_ENDPOINT *
LOCK_HTC_TX(pEndpoint->target);
if (pEndpoint->ul_outstanding_cnt
&& !pEndpoint->ul_poll_timer_active) {
- /*
- qdf_timer_start(
- &pEndpoint->ul_poll_timer, HTC_POLL_CLEANUP_PERIOD_MS);
+ /* qdf_timer_start(
+ * &pEndpoint->ul_poll_timer, HTC_POLL_CLEANUP_PERIOD_MS);
*/
pEndpoint->ul_poll_timer_active = 1;
}
diff --git a/htc/htc_packet.h b/htc/htc_packet.h
index bb23dcbf3cc0..5356e4f62d47 100644
--- a/htc/htc_packet.h
+++ b/htc/htc_packet.h
@@ -52,13 +52,21 @@ typedef void (*HTC_PACKET_COMPLETION)(void *, struct _HTC_PACKET *);
typedef uint16_t HTC_TX_TAG;
-typedef struct _HTC_TX_PACKET_INFO {
- HTC_TX_TAG Tag; /* tag used to selective flush packets */
- int CreditsUsed; /* number of credits used for this TX packet (HTC internal) */
- uint8_t SendFlags; /* send flags (HTC internal) */
- int SeqNo; /* internal seq no for debugging (HTC internal) */
- uint32_t Flags; /* internal use */
-} HTC_TX_PACKET_INFO;
+/**
+ * struct htc_tx_packet_info - HTC TX packet information
+ * @Tag: tag used to selective flush packets
+ * @CreditsUsed: number of credits used for this TX packet (HTC internal)
+ * @SendFlags: send flags (HTC internal)
+ * @SeqNo: internal seq no for debugging (HTC internal)
+ * @Flags: Internal use
+ */
+struct htc_tx_packet_info {
+ HTC_TX_TAG Tag;
+ int CreditsUsed;
+ uint8_t SendFlags;
+ int SeqNo;
+ uint32_t Flags;
+};
/**
* HTC_TX_PACKET_TAG_XXX - #defines for tagging packets for special handling
@@ -80,26 +88,51 @@ typedef struct _HTC_TX_PACKET_INFO {
#define HTC_TX_PACKET_FLAG_FIXUP_NETBUF (1 << 0)
-typedef struct _HTC_RX_PACKET_INFO {
- uint32_t ExpectedHdr; /* HTC internal use */
- uint32_t HTCRxFlags; /* HTC internal use */
- uint32_t IndicationFlags; /* indication flags set on each RX packet indication */
-} HTC_RX_PACKET_INFO;
-
-#define HTC_RX_FLAGS_INDICATE_MORE_PKTS (1 << 0) /* more packets on this endpoint are being fetched */
+/**
+ * struct htc_rx_packet_info - HTC RX Packet information
+ * @ExpectedHdr: HTC Internal use
+ * @HTCRxFlags: HTC Internal use
+ * @IndicationFlags: indication flags set on each RX packet indication
+ */
+struct htc_rx_packet_info {
+ uint32_t ExpectedHdr;
+ uint32_t HTCRxFlags;
+ uint32_t IndicationFlags;
+};
+
+/* more packets on this endpoint are being fetched */
+#define HTC_RX_FLAGS_INDICATE_MORE_PKTS (1 << 0)
#define HTC_PACKET_MAGIC_COOKIE 0xdeadbeef
/* wrapper around endpoint-specific packets */
+/**
+ * struct _HTC_PACKET - HTC Packet data structure
+ * @ListLink: double link
+ * @pPktContext: caller's per packet specific context
+ * @pBufferStart: The true buffer start, the caller can store the real buffer
+ * start here. In receive callbacks, the HTC layer sets pBuffer
+ * to the start of the payload past the header. This field allows
+ * the caller to reset pBuffer when it recycles receive packets
+ * back to HTC
+ * @pBuffer: payload start (RX/TX)
+ * @BufferLength: length of buffer
+ * @ActualLength: actual length of payload
+ * @Endpoint: endpoint that this packet was sent/recv'd from
+ * @Status: completion status
+ * @PktInfo: Packet specific info
+ * @netbufOrigHeadRoom: Original head room of skb
+ * @Completion: completion
+ * @pContext: HTC private completion context
+ * @pNetBufContext: optimization for network-oriented data, the HTC packet can
+ * pass the network buffer corresponding to the HTC packet
+ * lower layers may optimized the transfer knowing this is a
+ * network buffer
+ * @magic_cookie: HTC Magic cookie
+ */
typedef struct _HTC_PACKET {
- DL_LIST ListLink; /* double link */
- void *pPktContext; /* caller's per packet specific context */
-
- uint8_t *pBufferStart; /* the true buffer start , the caller can
- store the real buffer start here. In
- receive callbacks, the HTC layer sets pBuffer
- to the start of the payload past the header. This
- field allows the caller to reset pBuffer when it
- recycles receive packets back to HTC */
+ DL_LIST ListLink;
+ void *pPktContext;
+ uint8_t *pBufferStart;
/*
* Pointer to the start of the buffer. In the transmit
* direction this points to the start of the payload. In the
@@ -107,24 +140,20 @@ typedef struct _HTC_PACKET {
* points to the start of the HTC header but when returned
* to the caller points to the start of the payload
*/
- uint8_t *pBuffer; /* payload start (RX/TX) */
- uint32_t BufferLength; /* length of buffer */
- uint32_t ActualLength; /* actual length of payload */
- HTC_ENDPOINT_ID Endpoint; /* endpoint that this packet was sent/recv'd from */
- A_STATUS Status; /* completion status */
+ uint8_t *pBuffer;
+ uint32_t BufferLength;
+ uint32_t ActualLength;
+ HTC_ENDPOINT_ID Endpoint;
+ A_STATUS Status;
union {
- HTC_TX_PACKET_INFO AsTx; /* Tx Packet specific info */
- HTC_RX_PACKET_INFO AsRx; /* Rx Packet specific info */
+ struct htc_tx_packet_info AsTx;
+ struct htc_rx_packet_info AsRx;
} PktInfo;
-
/* the following fields are for internal HTC use */
uint32_t netbufOrigHeadRoom;
- HTC_PACKET_COMPLETION Completion; /* completion */
- void *pContext; /* HTC private completion context */
- void *pNetBufContext; /* optimization for network-oriented data, the HTC packet
- can pass the network buffer corresponding to the HTC packet
- lower layers may optimized the transfer knowing this is
- a network buffer */
+ HTC_PACKET_COMPLETION Completion;
+ void *pContext;
+ void *pNetBufContext;
uint32_t magic_cookie;
} HTC_PACKET;
@@ -167,9 +196,9 @@ typedef struct _HTC_PACKET {
} while (0)
#define SET_HTC_PACKET_NET_BUF_CONTEXT(p, nb) \
- do { \
- (p)->pNetBufContext = (nb); \
- } while (0)
+ { \
+ (p)->pNetBufContext = (nb); \
+ }
#define GET_HTC_PACKET_NET_BUF_CONTEXT(p) (p)->pNetBufContext
@@ -202,11 +231,11 @@ typedef struct _HTC_PACKET_QUEUE {
/* get packet at head without removing it */
static inline HTC_PACKET *htc_get_pkt_at_head(HTC_PACKET_QUEUE *queue)
{
- if (queue->Depth == 0) {
+ if (queue->Depth == 0)
return NULL;
- }
- return
- A_CONTAINING_STRUCT((DL_LIST_GET_ITEM_AT_HEAD(&queue->QueueHead)),
+
+ return A_CONTAINING_STRUCT((DL_LIST_GET_ITEM_AT_HEAD(
+ &queue->QueueHead)),
HTC_PACKET, ListLink);
}
@@ -221,6 +250,7 @@ static inline HTC_PACKET *htc_get_pkt_at_head(HTC_PACKET_QUEUE *queue)
static inline HTC_PACKET *htc_packet_dequeue(HTC_PACKET_QUEUE *queue)
{
DL_LIST *pItem = dl_list_remove_item_from_head(&queue->QueueHead);
+
if (pItem != NULL) {
queue->Depth--;
return A_CONTAINING_STRUCT(pItem, HTC_PACKET, ListLink);
@@ -232,6 +262,7 @@ static inline HTC_PACKET *htc_packet_dequeue(HTC_PACKET_QUEUE *queue)
static inline HTC_PACKET *htc_packet_dequeue_tail(HTC_PACKET_QUEUE *queue)
{
DL_LIST *pItem = dl_list_remove_item_from_tail(&queue->QueueHead);
+
if (pItem != NULL) {
queue->Depth--;
return A_CONTAINING_STRUCT(pItem, HTC_PACKET, ListLink);
@@ -245,11 +276,12 @@ static inline HTC_PACKET *htc_packet_dequeue_tail(HTC_PACKET_QUEUE *queue)
#define HTC_GET_TAG_FROM_PKT(p) (p)->PktInfo.AsTx.Tag
/* transfer the packets from one queue to the tail of another queue */
-#define HTC_PACKET_QUEUE_TRANSFER_TO_TAIL(pQDest, pQSrc) \
- { \
- dl_list_transfer_items_to_tail(&(pQDest)->QueueHead, &(pQSrc)->QueueHead); \
- (pQDest)->Depth += (pQSrc)->Depth; \
- (pQSrc)->Depth = 0; \
+#define HTC_PACKET_QUEUE_TRANSFER_TO_TAIL(pQDest, pQSrc) \
+ { \
+ dl_list_transfer_items_to_tail(&(pQDest)->QueueHead, \
+ &(pQSrc)->QueueHead); \
+ (pQDest)->Depth += (pQSrc)->Depth; \
+ (pQSrc)->Depth = 0; \
}
/*
@@ -259,10 +291,11 @@ static inline HTC_PACKET *htc_packet_dequeue_tail(HTC_PACKET_QUEUE *queue)
* to the concatenated queue.
*/
#define HTC_PACKET_QUEUE_TRANSFER_TO_HEAD(pQDest, pQSrc) \
- { \
- dl_list_transfer_items_to_head(&(pQDest)->QueueHead, &(pQSrc)->QueueHead); \
- (pQDest)->Depth += (pQSrc)->Depth; \
- (pQSrc)->Depth = 0; \
+ { \
+ dl_list_transfer_items_to_head(&(pQDest)->QueueHead, \
+ &(pQSrc)->QueueHead); \
+ (pQDest)->Depth += (pQSrc)->Depth; \
+ (pQSrc)->Depth = 0; \
}
/* fast version to init and add a single packet to a queue */
@@ -273,9 +306,10 @@ static inline HTC_PACKET *htc_packet_dequeue_tail(HTC_PACKET_QUEUE *queue)
}
#define HTC_PACKET_QUEUE_ITERATE_ALLOW_REMOVE(pQ, pPTemp) \
- ITERATE_OVER_LIST_ALLOW_REMOVE(&(pQ)->QueueHead, (pPTemp), HTC_PACKET, ListLink)
+ ITERATE_OVER_LIST_ALLOW_REMOVE(&(pQ)->QueueHead, \
+ (pPTemp), HTC_PACKET, ListLink)
-#define HTC_PACKET_QUEUE_ITERATE_IS_VALID(pQ) ITERATE_IS_VALID(&(pQ)->QueueHead)
+#define HTC_PACKET_QUEUE_ITERATE_IS_VALID(pQ) ITERATE_IS_VALID(&(pQ)->QueueHead)
#define HTC_PACKET_QUEUE_ITERATE_RESET(pQ) ITERATE_RESET(&(pQ)->QueueHead)
#define HTC_PACKET_QUEUE_ITERATE_END ITERATE_END
diff --git a/htc/htc_recv.c b/htc/htc_recv.c
index 2538d965b922..2ebbc35de68e 100644
--- a/htc/htc_recv.c
+++ b/htc/htc_recv.c
@@ -94,15 +94,16 @@ static void do_recv_completion(HTC_ENDPOINT *pEndpoint,
if (pEndpoint->EpCallBacks.EpRecvPktMultiple != NULL) {
AR_DEBUG_PRINTF(ATH_DEBUG_RECV,
- (" HTC calling ep %d, recv multiple callback (%d pkts) \n",
+ ("HTC calling ep %d, recv multiple callback (%d pkts)\n",
pEndpoint->Id,
HTC_PACKET_QUEUE_DEPTH
(pQueueToIndicate)));
- /* a recv multiple handler is being used, pass the queue to the handler */
- pEndpoint->EpCallBacks.EpRecvPktMultiple(pEndpoint->
- EpCallBacks.
- pContext,
- pQueueToIndicate);
+ /* a recv multiple handler is being used, pass the queue
+ * to the handler
+ */
+ pEndpoint->EpCallBacks.EpRecvPktMultiple(
+ pEndpoint->EpCallBacks.pContext,
+ pQueueToIndicate);
INIT_HTC_PACKET_QUEUE(pQueueToIndicate);
} else {
HTC_PACKET *pPacket;
@@ -137,6 +138,7 @@ static void recv_packet_completion(HTC_TARGET *target, HTC_ENDPOINT *pEndpoint,
HTC_PACKET *pPacket)
{
HTC_PACKET_QUEUE container;
+
INIT_HTC_PACKET_QUEUE_AND_ADD(&container, pPacket);
/* do completion */
do_recv_completion(pEndpoint, &container);
@@ -169,6 +171,7 @@ void htc_disable_recv(HTC_HANDLE HTCHandle)
int htc_get_num_recv_buffers(HTC_HANDLE HTCHandle, HTC_ENDPOINT_ID Endpoint)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+
HTC_ENDPOINT *pEndpoint = &target->endpoint[Endpoint];
return HTC_PACKET_QUEUE_DEPTH(&pEndpoint->RxBufferHoldQueue);
}
@@ -313,7 +316,8 @@ QDF_STATUS htc_rx_completion_handler(void *Context, qdf_nbuf_t netbuf,
("HTC Rx: invalid EndpointID=%d\n",
htc_ep_id));
debug_dump_bytes((uint8_t *) HtcHdr,
- sizeof(HTC_FRAME_HDR), "BAD HTC Header");
+ sizeof(HTC_FRAME_HDR),
+ "BAD HTC Header");
status = QDF_STATUS_E_FAILURE;
QDF_BUG(0);
break;
@@ -324,12 +328,11 @@ QDF_STATUS htc_rx_completion_handler(void *Context, qdf_nbuf_t netbuf,
/*
* If this endpoint that received a message from the target has
* a to-target HIF pipe whose send completions are polled rather
- * than interrupt-driven, this is a good point to ask HIF to check
- * whether it has any completed sends to handle.
+ * than interrupt driven, this is a good point to ask HIF to
+ * check whether it has any completed sends to handle.
*/
- if (pEndpoint->ul_is_polled) {
+ if (pEndpoint->ul_is_polled)
htc_send_complete_check(pEndpoint, 1);
- }
payloadLen = HTC_GET_FIELD(HtcHdr, HTC_FRAME_HDR, PAYLOADLEN);
@@ -383,12 +386,14 @@ QDF_STATUS htc_rx_completion_handler(void *Context, qdf_nbuf_t netbuf,
}
trailerlen = temp;
- /* process trailer data that follows HDR + application payload */
+ /* process trailer data that follows HDR +
+ * application payload
+ */
temp_status = htc_process_trailer(target,
- ((uint8_t *) HtcHdr +
- HTC_HDR_LENGTH +
- payloadLen - temp),
- temp, htc_ep_id);
+ ((uint8_t *) HtcHdr +
+ HTC_HDR_LENGTH +
+ payloadLen - temp),
+ temp, htc_ep_id);
if (A_FAILED(temp_status)) {
status = QDF_STATUS_E_FAILURE;
break;
@@ -398,7 +403,7 @@ QDF_STATUS htc_rx_completion_handler(void *Context, qdf_nbuf_t netbuf,
}
if (((int)payloadLen - (int)trailerlen) <= 0) {
- /* zero length packet with trailer data, just drop these */
+ /* 0 length packet with trailer data, just drop these */
break;
}
@@ -413,15 +418,17 @@ QDF_STATUS htc_rx_completion_handler(void *Context, qdf_nbuf_t netbuf,
netlen = qdf_nbuf_len(netbuf);
htc_msg = (HTC_UNKNOWN_MSG *) netdata;
- message_id =
- HTC_GET_FIELD(htc_msg, HTC_UNKNOWN_MSG, MESSAGEID);
+ message_id = HTC_GET_FIELD(htc_msg, HTC_UNKNOWN_MSG,
+ MESSAGEID);
switch (message_id) {
default:
/* handle HTC control message */
if (target->CtrlResponseProcessing) {
- /* this is a fatal error, target should not be sending unsolicited messages
- * on the endpoint 0 */
+ /* this is a fatal error, target should
+ * not be sending unsolicited messages
+ * on the endpoint 0
+ */
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("HTC Rx Ctrl still processing\n"));
status = QDF_STATUS_E_FAILURE;
@@ -453,8 +460,10 @@ QDF_STATUS htc_rx_completion_handler(void *Context, qdf_nbuf_t netbuf,
HTC_PACKET_QUEUE_DEPTH(
&pEndpoint->TxQueue));
UNLOCK_HTC_CREDIT(target);
- if (target->HTCInitInfo.target_initial_wakeup_cb)
- target->HTCInitInfo.target_initial_wakeup_cb();
+ if (target->HTCInitInfo.
+ target_initial_wakeup_cb)
+ target->HTCInitInfo.
+ target_initial_wakeup_cb();
else
AR_DEBUG_PRINTF(ATH_DEBUG_ANY,
("No initial wake up cb"));
@@ -493,10 +502,11 @@ QDF_STATUS htc_rx_completion_handler(void *Context, qdf_nbuf_t netbuf,
break;
}
- /* the current message based HIF architecture allocates net bufs for recv packets
- * since this layer bridges that HIF to upper layers , which expects HTC packets,
- * we form the packets here
- * TODO_FIXME */
+ /* the current message based HIF architecture allocates net bufs
+ * for recv packets since this layer bridges that HIF to upper
+ * layers , which expects HTC packets, we form the packets here
+ * TODO_FIXME
+ */
pPacket = allocate_htc_packet_container(target);
if (NULL == pPacket) {
status = QDF_STATUS_E_RESOURCES;
@@ -522,9 +532,8 @@ QDF_STATUS htc_rx_completion_handler(void *Context, qdf_nbuf_t netbuf,
_out:
#endif
- if (netbuf != NULL) {
+ if (netbuf != NULL)
qdf_nbuf_free(netbuf);
- }
return status;
@@ -589,6 +598,7 @@ A_STATUS htc_add_receive_pkt_multiple(HTC_HANDLE HTCHandle,
A_STATUS htc_add_receive_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket)
{
HTC_PACKET_QUEUE queue;
+
INIT_HTC_PACKET_QUEUE_AND_ADD(&queue, pPacket);
return htc_add_receive_pkt_multiple(HTCHandle, &queue);
}
@@ -602,14 +612,13 @@ void htc_flush_rx_hold_queue(HTC_TARGET *target, HTC_ENDPOINT *pEndpoint)
while (1) {
pPacket = htc_packet_dequeue(&pEndpoint->RxBufferHoldQueue);
- if (NULL == pPacket) {
+ if (pPacket == NULL)
break;
- }
UNLOCK_HTC_RX(target);
pPacket->Status = A_ECANCELED;
pPacket->ActualLength = 0;
AR_DEBUG_PRINTF(ATH_DEBUG_RECV,
- (" Flushing RX packet:%p, length:%d, ep:%d \n",
+ ("Flushing RX packet:%p, length:%d, ep:%d\n",
pPacket, pPacket->BufferLength,
pPacket->Endpoint));
INIT_HTC_PACKET_QUEUE_AND_ADD(&container, pPacket);
@@ -637,7 +646,6 @@ A_STATUS htc_wait_recv_ctrl_message(HTC_TARGET *target)
/* Wait for BMI request/response transaction to complete */
if (qdf_wait_single_event(&target->ctrl_response_valid,
HTC_CONTROL_RX_TIMEOUT)) {
- QDF_BUG(0);
return A_ERROR;
}
@@ -647,32 +655,6 @@ A_STATUS htc_wait_recv_ctrl_message(HTC_TARGET *target)
UNLOCK_HTC_RX(target);
-#if 0
- while (count > 0) {
-
- LOCK_HTC_RX(target);
-
- if (target->CtrlResponseValid) {
- target->CtrlResponseValid = false;
- /* caller will clear this flag */
- target->CtrlResponseProcessing = true;
- UNLOCK_HTC_RX(target);
- break;
- }
-
- UNLOCK_HTC_RX(target);
-
- count--;
- A_MSLEEP(HTC_TARGET_RESPONSE_POLL_MS);
- }
-
- if (count <= 0) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("-HTCWaitCtrlMessageRecv: Timeout!\n"));
- return A_ECOMM;
- }
-#endif
-
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("-HTCWaitCtrlMessageRecv success\n"));
return A_OK;
}
@@ -690,11 +672,10 @@ static A_STATUS htc_process_trailer(HTC_TARGET *target,
A_STATUS status;
AR_DEBUG_PRINTF(ATH_DEBUG_RECV,
- ("+htc_process_trailer (length:%d) \n", Length));
+ ("+htc_process_trailer (length:%d)\n", Length));
- if (AR_DEBUG_LVL_CHECK(ATH_DEBUG_RECV)) {
+ if (AR_DEBUG_LVL_CHECK(ATH_DEBUG_RECV))
AR_DEBUG_PRINTBUF(pBuffer, Length, "Recv Trailer");
- }
pOrigBuffer = pBuffer;
origLength = Length;
@@ -717,7 +698,7 @@ static A_STATUS htc_process_trailer(HTC_TARGET *target,
if (htc_rec_len > Length) {
/* no room left in buffer for record */
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- (" invalid record length: %d (id:%d) buffer has: %d bytes left \n",
+ ("invalid record length: %d (id:%d) buffer has: %d bytes left\n",
htc_rec_len, htc_rec_id, Length));
status = A_EPROTO;
break;
@@ -748,7 +729,7 @@ static A_STATUS htc_process_trailer(HTC_TARGET *target,
default:
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- (" HTC unhandled record: id:%d length:%d \n",
+ ("HTC unhandled record: id:%d length:%d\n",
htc_rec_id, htc_rec_len));
break;
}
@@ -762,11 +743,10 @@ static A_STATUS htc_process_trailer(HTC_TARGET *target,
Length -= htc_rec_len;
}
- if (A_FAILED(status)) {
+ if (A_FAILED(status))
debug_dump_bytes(pOrigBuffer, origLength, "BAD Recv Trailer");
- }
- AR_DEBUG_PRINTF(ATH_DEBUG_RECV, ("-htc_process_trailer \n"));
+ AR_DEBUG_PRINTF(ATH_DEBUG_RECV, ("-htc_process_trailer\n"));
return status;
}
diff --git a/htc/htc_send.c b/htc/htc_send.c
index 09fd9ed69a92..3eff8cd2d656 100644
--- a/htc/htc_send.c
+++ b/htc/htc_send.c
@@ -38,10 +38,10 @@
#define HTC_DATA_RESOURCE_THRS 256
#define HTC_DATA_MINDESC_PERPACKET 2
-typedef enum _HTC_SEND_QUEUE_RESULT {
+enum HTC_SEND_QUEUE_RESULT {
HTC_SEND_QUEUE_OK = 0, /* packet was queued */
- HTC_SEND_QUEUE_DROP = 1, /* this packet should be dropped */
-} HTC_SEND_QUEUE_RESULT;
+ HTC_SEND_QUEUE_DROP = 1, /* this packet should be dropped */
+};
#ifndef DEBUG_CREDIT
#define DEBUG_CREDIT 0
@@ -49,13 +49,14 @@ typedef enum _HTC_SEND_QUEUE_RESULT {
#if DEBUG_CREDIT
/* bit mask to enable debug certain endpoint */
-static unsigned ep_debug_mask =
+static unsigned int ep_debug_mask =
(1 << ENDPOINT_0) | (1 << ENDPOINT_1) | (1 << ENDPOINT_2);
#endif
/* HTC Control Path Credit History */
-uint32_t g_htc_credit_history_idx = 0;
-HTC_CREDIT_HISTORY htc_credit_history_buffer[HTC_CREDIT_HISTORY_MAX];
+uint32_t g_htc_credit_history_idx;
+uint32_t g_htc_credit_history_length;
+struct HTC_CREDIT_HISTORY htc_credit_history_buffer[HTC_CREDIT_HISTORY_MAX];
/**
* htc_credit_record() - records tx que state & credit transactions
@@ -71,9 +72,9 @@ HTC_CREDIT_HISTORY htc_credit_history_buffer[HTC_CREDIT_HISTORY_MAX];
* Consider making this function accept an HTC_ENDPOINT and find the current
* credits and queue depth itself.
*
- * Consider moving the LOCK_HTC_CREDIT(target); logic into this function as well.
+ * Consider moving the LOCK_HTC_CREDIT(target); logic into this func as well
*/
-void htc_credit_record(htc_credit_exchange_type type, uint32_t tx_credit,
+void htc_credit_record(enum htc_credit_exchange_type type, uint32_t tx_credit,
uint32_t htc_tx_queue_depth) {
if (HTC_CREDIT_HISTORY_MAX <= g_htc_credit_history_idx)
g_htc_credit_history_idx = 0;
@@ -85,8 +86,53 @@ void htc_credit_record(htc_credit_exchange_type type, uint32_t tx_credit,
tx_credit;
htc_credit_history_buffer[g_htc_credit_history_idx].htc_tx_queue_depth =
htc_tx_queue_depth;
+
g_htc_credit_history_idx++;
+ g_htc_credit_history_length++;
+}
+
+#ifdef WMI_INTERFACE_EVENT_LOGGING
+void htc_print_credit_history(HTC_HANDLE htc, uint32_t count,
+ qdf_abstract_print *print, void *print_priv)
+{
+ uint32_t idx;
+ HTC_TARGET *target;
+
+ target = GET_HTC_TARGET_FROM_HANDLE(htc);
+ LOCK_HTC_CREDIT(target);
+
+ if (count > HTC_CREDIT_HISTORY_MAX)
+ count = HTC_CREDIT_HISTORY_MAX;
+ if (count > g_htc_credit_history_length)
+ count = g_htc_credit_history_length;
+
+ /* subtract count from index, and wrap if necessary */
+ idx = HTC_CREDIT_HISTORY_MAX + g_htc_credit_history_idx - count;
+ idx %= HTC_CREDIT_HISTORY_MAX;
+
+ print(print_priv,
+ "Time (seconds) Type Credits Queue Depth");
+ while (count) {
+ struct HTC_CREDIT_HISTORY *hist =
+ &htc_credit_history_buffer[idx];
+ long long us = qdf_log_timestamp_to_usecs(hist->time);
+
+ print(print_priv, "% 8lld.%06lld %-25s %-7.d %d",
+ us / 1000000,
+ us % 1000000,
+ htc_credit_exchange_type_str(hist->type),
+ hist->tx_credit,
+ hist->htc_tx_queue_depth);
+
+ --count;
+ ++idx;
+ if (idx >= HTC_CREDIT_HISTORY_MAX)
+ idx = 0;
+ }
+
+ UNLOCK_HTC_CREDIT(target);
}
+#endif /* WMI_INTERFACE_EVENT_LOGGING */
void htc_dump_counter_info(HTC_HANDLE HTCHandle)
{
@@ -105,7 +151,8 @@ int htc_get_tx_queue_depth(HTC_HANDLE *htc_handle, HTC_ENDPOINT_ID endpoint_id)
return HTC_PACKET_QUEUE_DEPTH(&endpoint->TxQueue);
}
-void htc_get_control_endpoint_tx_host_credits(HTC_HANDLE HTCHandle, int *credits)
+void htc_get_control_endpoint_tx_host_credits(HTC_HANDLE HTCHandle,
+ int *credits)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
HTC_ENDPOINT *pEndpoint;
@@ -132,6 +179,7 @@ static inline void restore_tx_packet(HTC_TARGET *target, HTC_PACKET *pPacket)
{
if (pPacket->PktInfo.AsTx.Flags & HTC_TX_PACKET_FLAG_FIXUP_NETBUF) {
qdf_nbuf_t netbuf = GET_HTC_PACKET_NET_BUF_CONTEXT(pPacket);
+
qdf_nbuf_unmap(target->osdev, netbuf, QDF_DMA_TO_DEVICE);
qdf_nbuf_pull_head(netbuf, sizeof(HTC_FRAME_HDR));
pPacket->PktInfo.AsTx.Flags &= ~HTC_TX_PACKET_FLAG_FIXUP_NETBUF;
@@ -151,16 +199,19 @@ static void do_send_completion(HTC_ENDPOINT *pEndpoint,
if (pEndpoint->EpCallBacks.EpTxCompleteMultiple != NULL) {
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
- (" HTC calling ep %d, send complete multiple callback (%d pkts) \n",
+ ("HTC calling ep %d, send complete multiple callback (%d pkts)\n",
pEndpoint->Id,
HTC_PACKET_QUEUE_DEPTH
(pQueueToIndicate)));
- /* a multiple send complete handler is being used, pass the queue to the handler */
- pEndpoint->EpCallBacks.EpTxCompleteMultiple(pEndpoint->
- EpCallBacks.
- pContext,
- pQueueToIndicate);
- /* all packets are now owned by the callback, reset queue to be safe */
+ /* a multiple send complete handler is being used, pass
+ * the queue to the handler
+ */
+ pEndpoint->EpCallBacks.EpTxCompleteMultiple(
+ pEndpoint->EpCallBacks.pContext,
+ pQueueToIndicate);
+ /* all packets are now owned by the callback, reset
+ * queue to be safe
+ */
INIT_HTC_PACKET_QUEUE(pQueueToIndicate);
} else {
HTC_PACKET *pPacket;
@@ -168,7 +219,7 @@ static void do_send_completion(HTC_ENDPOINT *pEndpoint,
do {
pPacket = htc_packet_dequeue(pQueueToIndicate);
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
- (" HTC calling ep %d send complete callback on packet %p \n",
+ ("HTC calling ep %d send complete callback on packet %p\n",
pEndpoint->Id, pPacket));
pEndpoint->EpCallBacks.EpTxComplete(pEndpoint->
EpCallBacks.
@@ -196,6 +247,7 @@ static void send_packet_completion(HTC_TARGET *target, HTC_PACKET *pPacket)
void htc_send_complete_check_cleanup(void *context)
{
HTC_ENDPOINT *pEndpoint = (HTC_ENDPOINT *) context;
+
htc_send_complete_check(pEndpoint, 1);
}
@@ -204,6 +256,7 @@ HTC_PACKET *allocate_htc_bundle_packet(HTC_TARGET *target)
HTC_PACKET *pPacket;
HTC_PACKET_QUEUE *pQueueSave;
qdf_nbuf_t netbuf;
+
LOCK_HTC_TX(target);
if (NULL == target->pBundleFreeList) {
UNLOCK_HTC_TX(target);
@@ -211,9 +264,8 @@ HTC_PACKET *allocate_htc_bundle_packet(HTC_TARGET *target)
target->MaxMsgsPerHTCBundle *
target->TargetCreditSize, 0, 4, false);
AR_DEBUG_ASSERT(netbuf);
- if (!netbuf) {
+ if (!netbuf)
return NULL;
- }
pPacket = qdf_mem_malloc(sizeof(HTC_PACKET));
AR_DEBUG_ASSERT(pPacket);
if (!pPacket) {
@@ -233,8 +285,10 @@ HTC_PACKET *allocate_htc_bundle_packet(HTC_TARGET *target)
pPacket->pBuffer = qdf_nbuf_data(netbuf);
pPacket->BufferLength = qdf_nbuf_len(netbuf);
- /* store the original head room so that we can restore this when we "free" the packet */
- /* free packet puts the packet back on the free list */
+ /* store the original head room so that we can restore this
+ * when we "free" the packet.
+ * free packet puts the packet back on the free list
+ */
pPacket->netbufOrigHeadRoom = qdf_nbuf_headroom(netbuf);
return pPacket;
}
@@ -261,14 +315,16 @@ void free_htc_bundle_packet(HTC_TARGET *target, HTC_PACKET *pPacket)
netbuf = GET_HTC_PACKET_NET_BUF_CONTEXT(pPacket);
AR_DEBUG_ASSERT(netbuf);
if (!netbuf) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("\n%s: Invalid netbuf in HTC "
- "Packet\n", __func__));
+ AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
+ ("\n%s: Invalid netbuf in HTC Packet\n",
+ __func__));
return;
}
- /* HIF adds data to the headroom section of the nbuf, restore the original */
- /* size. If this is not done, headroom keeps shrinking with every HIF send */
- /* and eventually HIF ends up doing another malloc big enough to store the */
- /* data + its header */
+ /* HIF adds data to the headroom section of the nbuf, restore thei
+ * original size. If this is not done, headroom keeps shrinking with
+ * every HIF send and eventually HIF ends up doing another malloc big
+ * enough to store the data + its header
+ */
curentHeadRoom = qdf_nbuf_headroom(netbuf);
qdf_nbuf_pull_head(netbuf,
@@ -314,8 +370,6 @@ htc_send_update_tx_bundle_stats(HTC_TARGET *target,
{
if ((data_len / TxCreditSize) <= HTC_MAX_MSG_PER_BUNDLE_TX)
target->tx_bundle_stats[(data_len / TxCreditSize) - 1]++;
-
- return;
}
/**
@@ -337,13 +391,11 @@ htc_send_update_tx_bundle_stats(HTC_TARGET *target,
qdf_size_t data_len,
int TxCreditSize)
{
- return;
}
static inline void
htc_issue_tx_bundle_stats_inc(HTC_TARGET *target)
{
- return;
}
#endif
@@ -419,7 +471,7 @@ static void htc_issue_packets_bundle(HTC_TARGET *target,
if (!pPacketTx) {
/* good time to panic */
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("allocate_htc_bundle_packet failed \n"));
+ ("allocate_htc_bundle_packet failed\n"));
AR_DEBUG_ASSERT(false);
return;
}
@@ -428,16 +480,15 @@ static void htc_issue_packets_bundle(HTC_TARGET *target,
pQueueSave = (HTC_PACKET_QUEUE *) pPacketTx->pContext;
while (1) {
pPacket = htc_packet_dequeue(pPktQueue);
- if (pPacket == NULL) {
+ if (pPacket == NULL)
break;
- }
creditPad = 0;
transferLength = pPacket->ActualLength + HTC_HDR_LENGTH;
creditRemainder = transferLength % pEndpoint->TxCreditSize;
if (creditRemainder != 0) {
if (transferLength < pEndpoint->TxCreditSize) {
- creditPad =
- pEndpoint->TxCreditSize - transferLength;
+ creditPad = pEndpoint->TxCreditSize -
+ transferLength;
} else {
creditPad = creditRemainder;
}
@@ -460,7 +511,7 @@ static void htc_issue_packets_bundle(HTC_TARGET *target,
if (!pPacketTx) {
/* good time to panic */
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("allocate_htc_bundle_packet failed \n"));
+ ("allocate_htc_bundle_packet failed\n"));
AR_DEBUG_ASSERT(false);
return;
}
@@ -473,9 +524,8 @@ static void htc_issue_packets_bundle(HTC_TARGET *target,
netbuf = GET_HTC_PACKET_NET_BUF_CONTEXT(pPacket);
if (hif_get_bus_type(target->hif_dev) != QDF_BUS_TYPE_USB) {
- pHtcHdr =
- (HTC_FRAME_HDR *)
- qdf_nbuf_get_frag_vaddr(netbuf, 0);
+ pHtcHdr = (HTC_FRAME_HDR *)qdf_nbuf_get_frag_vaddr(
+ netbuf, 0);
HTC_WRITE32(pHtcHdr,
SM(pPacket->ActualLength,
HTC_FRAME_HDR_PAYLOADLEN) |
@@ -496,9 +546,8 @@ static void htc_issue_packets_bundle(HTC_TARGET *target,
int frag_len = qdf_nbuf_get_frag_len(netbuf, i);
unsigned char *frag_addr =
qdf_nbuf_get_frag_vaddr(netbuf, i);
- if (frag_len > nbytes) {
+ if (frag_len > nbytes)
frag_len = nbytes;
- }
qdf_mem_copy(pBundleBuffer, frag_addr, frag_len);
nbytes -= frag_len;
pBundleBuffer += frag_len;
@@ -506,20 +555,17 @@ static void htc_issue_packets_bundle(HTC_TARGET *target,
HTC_PACKET_ENQUEUE(pQueueSave, pPacket);
pBundleBuffer += creditPad;
- if (hif_get_bus_type(target->hif_dev) == QDF_BUS_TYPE_USB) {
- /* last one can't be packed. */
+ /* last one can't be packed. */
+ if (hif_get_bus_type(target->hif_dev) == QDF_BUS_TYPE_USB)
last_credit_pad = creditPad;
- }
-
}
- if (pBundleBuffer != qdf_nbuf_data(bundleBuf)) {
- /* send out remaining buffer */
+ /* send out remaining buffer */
+ if (pBundleBuffer != qdf_nbuf_data(bundleBuf))
htc_send_bundled_netbuf(target, pEndpoint,
pBundleBuffer - last_credit_pad,
pPacketTx);
- } else {
+ else
free_htc_bundle_packet(target, pPacketTx);
- }
}
#endif /* ENABLE_BUNDLE_TX */
#else
@@ -554,7 +600,7 @@ static A_STATUS htc_issue_packets(HTC_TARGET *target,
bus_type = hif_get_bus_type(target->hif_dev);
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
- ("+htc_issue_packets: Queue: %p, Pkts %d \n", pPktQueue,
+ ("+htc_issue_packets: Queue: %p, Pkts %d\n", pPktQueue,
HTC_PACKET_QUEUE_DEPTH(pPktQueue)));
while (true) {
if (HTC_TX_BUNDLE_ENABLED(target) &&
@@ -573,8 +619,8 @@ static A_STATUS htc_issue_packets(HTC_TARGET *target,
break;
}
}
- /* if not bundling or there was a packet that could not be placed in a bundle,
- * and send it by normal way
+ /* if not bundling or there was a packet that could not be
+ * placed in a bundle, and send it by normal way
*/
pPacket = htc_packet_dequeue(pPktQueue);
if (NULL == pPacket) {
@@ -584,8 +630,8 @@ static A_STATUS htc_issue_packets(HTC_TARGET *target,
netbuf = GET_HTC_PACKET_NET_BUF_CONTEXT(pPacket);
AR_DEBUG_ASSERT(netbuf);
- /* Non-credit enabled endpoints have been mapped and setup by now,
- * so no need to revisit the HTC headers
+ /* Non-credit enabled endpoints have been mapped and setup by
+ * now, so no need to revisit the HTC headers
*/
if (IS_TX_CREDIT_FLOW_ENABLED(pEndpoint)) {
@@ -597,24 +643,23 @@ static A_STATUS htc_issue_packets(HTC_TARGET *target,
AR_DEBUG_ASSERT(pHtcHdr);
HTC_WRITE32(pHtcHdr,
- SM(payloadLen,
- HTC_FRAME_HDR_PAYLOADLEN) | SM(pPacket->
- PktInfo.
- AsTx.
- SendFlags,
- HTC_FRAME_HDR_FLAGS)
- | SM(pPacket->Endpoint,
- HTC_FRAME_HDR_ENDPOINTID));
+ SM(payloadLen,
+ HTC_FRAME_HDR_PAYLOADLEN) |
+ SM(pPacket->PktInfo.AsTx.SendFlags,
+ HTC_FRAME_HDR_FLAGS) |
+ SM(pPacket->Endpoint,
+ HTC_FRAME_HDR_ENDPOINTID));
HTC_WRITE32(((uint32_t *) pHtcHdr) + 1,
SM(pPacket->PktInfo.AsTx.SeqNo,
HTC_FRAME_HDR_CONTROLBYTES1));
/*
- * Now that the HTC frame header has been added, the netbuf can be
- * mapped. This only applies to non-data frames, since data frames
- * were already mapped as they entered into the driver.
- * Check the "FIXUP_NETBUF" flag to see whether this is a data netbuf
- * that is already mapped, or a non-data netbuf that needs to be
+ * Now that the HTC frame header has been added, the
+ * netbuf can be mapped. This only applies to non-data
+ * frames, since data frames were already mapped as they
+ * entered into the driver. Check the "FIXUP_NETBUF"
+ * flag to see whether this is a data netbuf that is
+ * already mapped, or a non-data netbuf that needs to be
* mapped.
*/
if (pPacket->PktInfo.AsTx.
@@ -624,8 +669,8 @@ static A_STATUS htc_issue_packets(HTC_TARGET *target,
(pPacket), QDF_DMA_TO_DEVICE);
if (ret != QDF_STATUS_SUCCESS) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("%s: nbuf map failed, endpoint %p\n",
- __func__, pEndpoint));
+ ("%s nbuf Map Fail Endpnt %p\n",
+ __func__, pEndpoint));
status = A_ERROR;
break;
}
@@ -638,7 +683,8 @@ static A_STATUS htc_issue_packets(HTC_TARGET *target,
pEndpoint->ul_outstanding_cnt++;
UNLOCK_HTC_TX(target);
- hif_send_complete_check(target->hif_dev, pEndpoint->UL_PipeID, false);
+ hif_send_complete_check(target->hif_dev, pEndpoint->UL_PipeID,
+ false);
htc_packet_set_magic_cookie(pPacket, HTC_PACKET_MAGIC_COOKIE);
status = hif_send_head(target->hif_dev,
pEndpoint->UL_PipeID, pEndpoint->Id,
@@ -657,10 +703,13 @@ static A_STATUS htc_issue_packets(HTC_TARGET *target,
if (qdf_unlikely(A_FAILED(status))) {
if (status != A_NO_RESOURCE) {
- /* TODO : if more than 1 endpoint maps to the same PipeID it is possible
- * to run out of resources in the HIF layer. Don't emit the error */
+ /* TODO : if more than 1 endpoint maps to the
+ * same PipeID it is possible to run out of
+ * resources in the HIF layer. Don't emit the
+ * error
+ */
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("hif_send Failed status:%d \n",
+ ("hif_send Failed status:%d\n",
status));
}
LOCK_HTC_TX(target);
@@ -691,7 +740,7 @@ static A_STATUS htc_issue_packets(HTC_TARGET *target,
pPacket, status));
}
- AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-htc_issue_packets \n"));
+ AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-htc_issue_packets\n"));
return status;
}
@@ -773,8 +822,9 @@ static void get_htc_send_packets_credit_based(HTC_TARGET *target,
HTC_PACKET_QUEUE pm_queue;
bool do_pm_get = false;
- /****** NOTE : the TX lock is held when this function is called *****************/
- AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("+get_htc_send_packets_credit_based\n"));
+ /*** NOTE : the TX lock is held when this function is called ***/
+ AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
+ ("+get_htc_send_packets_credit_based\n"));
INIT_HTC_PACKET_QUEUE(&pm_queue);
extract_htc_pm_packets(pEndpoint, &pm_queue);
@@ -817,9 +867,8 @@ static void get_htc_send_packets_credit_based(HTC_TARGET *target,
transferLength / pEndpoint->TxCreditSize;
remainder = transferLength % pEndpoint->TxCreditSize;
- if (remainder) {
+ if (remainder)
creditsRequired++;
- }
}
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
@@ -837,7 +886,7 @@ static void get_htc_send_packets_credit_based(HTC_TARGET *target,
if (pEndpoint->TxCredits < creditsRequired) {
#if DEBUG_CREDIT
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- (" EP%d, No Credit now. %d < %d\n",
+ ("EP%d,No Credit now.%d < %d\n",
pEndpoint->Id,
pEndpoint->TxCredits,
creditsRequired));
@@ -907,7 +956,7 @@ static void get_htc_send_packets(HTC_TARGET *target,
HTC_PACKET_QUEUE pm_queue;
bool do_pm_get;
- /****** NOTE : the TX lock is held when this function is called *****************/
+ /*** NOTE : the TX lock is held when this function is called ***/
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
("+get_htc_send_packets %d resources\n", Resources));
@@ -943,10 +992,6 @@ static void get_htc_send_packets(HTC_TARGET *target,
/* For non-credit path the sequence number is already embedded
* in the constructed HTC header
*/
-#if 0
- pPacket->PktInfo.AsTx.SeqNo = pEndpoint->SeqNo;
- pEndpoint->SeqNo++;
-#endif
pPacket->PktInfo.AsTx.SendFlags = 0;
pPacket->PktInfo.AsTx.CreditsUsed = 0;
/* queue this packet into the caller's queue */
@@ -958,13 +1003,13 @@ static void get_htc_send_packets(HTC_TARGET *target,
* qdf_nbuf_map, because the MacOS version of qdf_nbuf_t doesn't
* support qdf_nbuf_get_num_frags until after qdf_nbuf_map has
* been done.
- * Assume that the non-data netbufs, i.e. the WMI message netbufs,
+ * Assume that the non-data netbufs, i.e. WMI message netbufs,
* consist of a single fragment.
*/
+ /* WMI messages are in a single-fragment network buf */
num_frags =
(pPacket->PktInfo.AsTx.
- Flags & HTC_TX_PACKET_FLAG_FIXUP_NETBUF) ? 1
- /* WMI messages are in a single-fragment network buffer */ :
+ Flags & HTC_TX_PACKET_FLAG_FIXUP_NETBUF) ? 1 :
qdf_nbuf_get_num_frags(GET_HTC_PACKET_NET_BUF_CONTEXT
(pPacket));
Resources -= num_frags;
@@ -983,18 +1028,19 @@ static void get_htc_send_packets(HTC_TARGET *target,
* @pEndpoint: logical endpoint on which packets needs to be sent
* @pCallersSendQueue: packet queue containing the list of packets to be sent
*
- * Return: HTC_SEND_QUEUE_RESULT indicates whether the packet was queued to be
- * sent or the packet should be dropped by the upper layer
+ * Return: enum HTC_SEND_QUEUE_RESULT indicates whether the packet was queued to
+ * be sent or the packet should be dropped by the upper layer
*/
-static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
+static enum HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
HTC_ENDPOINT *pEndpoint,
HTC_PACKET_QUEUE *pCallersSendQueue)
{
- HTC_PACKET_QUEUE sendQueue; /* temp queue to hold packets at various stages */
+ /* temp queue to hold packets at various stages */
+ HTC_PACKET_QUEUE sendQueue;
HTC_PACKET *pPacket;
int tx_resources;
int overflow;
- HTC_SEND_QUEUE_RESULT result = HTC_SEND_QUEUE_OK;
+ enum HTC_SEND_QUEUE_RESULT result = HTC_SEND_QUEUE_OK;
AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("+htc_try_send (Queue:%p Depth:%d)\n",
pCallersSendQueue,
@@ -1008,10 +1054,11 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
do {
- if (NULL == pCallersSendQueue) {
- /* caller didn't provide a queue, just wants us to check queues and send */
+ /* caller didn't provide a queue, just wants us to check
+ * queues and send
+ */
+ if (pCallersSendQueue == NULL)
break;
- }
if (HTC_QUEUE_EMPTY(pCallersSendQueue)) {
/* empty queue */
@@ -1029,14 +1076,14 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
/* figure out how much we will overflow by */
overflow = HTC_PACKET_QUEUE_DEPTH(&pEndpoint->TxQueue);
overflow += HTC_PACKET_QUEUE_DEPTH(pCallersSendQueue);
- /* figure out how much we will overflow the TX queue by */
+ /* get how much we will overflow the TX queue by */
overflow -= pEndpoint->MaxTxQueueDepth;
}
/* if overflow is negative or zero, we are okay */
if (overflow > 0) {
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
- (" Endpoint %d, TX queue will overflow :%d , Tx Depth:%d, Max:%d \n",
+ ("Endpoint %d, TX queue will overflow :%d , Tx Depth:%d, Max:%d\n",
pEndpoint->Id, overflow,
HTC_PACKET_QUEUE_DEPTH(&pEndpoint->
TxQueue),
@@ -1044,8 +1091,10 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
}
if ((overflow <= 0)
|| (pEndpoint->EpCallBacks.EpSendFull == NULL)) {
- /* all packets will fit or caller did not provide send full indication handler
- * -- just move all of them to the local sendQueue object */
+ /* all packets will fit or caller did not provide send
+ * full indication handler
+ * just move all of them to local sendQueue object
+ */
HTC_PACKET_QUEUE_TRANSFER_TO_TAIL(&sendQueue,
pCallersSendQueue);
} else {
@@ -1055,8 +1104,9 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
overflow;
A_ASSERT(goodPkts >= 0);
- /* we have overflowed, and a callback is provided */
- /* dequeue all non-overflow packets into the sendqueue */
+ /* we have overflowed and callback is provided. Dequeue
+ * all non-overflow packets into the sendqueue
+ */
for (i = 0; i < goodPkts; i++) {
/* pop off caller's queue */
pPacket = htc_packet_dequeue(pCallersSendQueue);
@@ -1065,18 +1115,21 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
HTC_PACKET_ENQUEUE(&sendQueue, pPacket);
}
- /* the caller's queue has all the packets that won't fit */
- /* walk through the caller's queue and indicate each one to the send full handler */
+ /* the caller's queue has all the packets that won't fit
+ * walk through the caller's queue and indicate each one
+ * to the send full handler
+ */
ITERATE_OVER_LIST_ALLOW_REMOVE(&pCallersSendQueue->
QueueHead, pPacket,
HTC_PACKET, ListLink) {
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
- (" Indicating overflowed TX packet: %p \n",
+ ("Indicating overflowed TX packet: %p\n",
pPacket));
/*
- * Remove headroom reserved for HTC_FRAME_HDR before giving
- * the packet back to the user via the EpSendFull callback.
+ * Remove headroom reserved for HTC_FRAME_HDR
+ * before giving the packet back to the user via
+ * the EpSendFull callback.
*/
restore_tx_packet(target, pPacket);
@@ -1086,16 +1139,23 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
/* callback wants the packet dropped */
INC_HTC_EP_STAT(pEndpoint, TxDropped,
1);
- /* leave this one in the caller's queue for cleanup */
+ /* leave this one in the caller's queue
+ * for cleanup
+ */
} else {
- /* callback wants to keep this packet, remove from caller's queue */
+ /* callback wants to keep this packet,
+ * remove from caller's queue
+ */
HTC_PACKET_REMOVE(pCallersSendQueue,
pPacket);
- /* put it in the send queue */
- /* add HTC_FRAME_HDR space reservation again */
+ /* put it in the send queue
+ * add HTC_FRAME_HDR space reservation
+ * again
+ */
qdf_nbuf_push_head
(GET_HTC_PACKET_NET_BUF_CONTEXT
- (pPacket), sizeof(HTC_FRAME_HDR));
+ (pPacket),
+ sizeof(HTC_FRAME_HDR));
HTC_PACKET_ENQUEUE(&sendQueue, pPacket);
}
@@ -1106,7 +1166,7 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
if (HTC_QUEUE_EMPTY(&sendQueue)) {
/* no packets made it in, caller will cleanup */
OL_ATH_HTC_PKT_ERROR_COUNT_INCR(target,
- HTC_SEND_Q_EMPTY);
+ HTC_SEND_Q_EMPTY);
result = HTC_SEND_QUEUE_DROP;
break;
}
@@ -1151,37 +1211,42 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
/* increment tx processing count on entry */
if (qdf_atomic_inc_return(&pEndpoint->TxProcessCount) > 1) {
- /* another thread or task is draining the TX queues on this endpoint
- * that thread will reset the tx processing count when the queue is drained */
+ /* another thread or task is draining the TX queues on this
+ * endpoint that thread will reset the tx processing count when
+ * the queue is drained
+ */
qdf_atomic_dec(&pEndpoint->TxProcessCount);
UNLOCK_HTC_TX(target);
- AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-htc_try_send (busy) \n"));
+ AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-htc_try_send (busy)\n"));
return HTC_SEND_QUEUE_OK;
}
/***** beyond this point only 1 thread may enter ******/
- /* now drain the endpoint TX queue for transmission as long as we have enough
- * transmit resources */
+ /* now drain the endpoint TX queue for transmission as long as we have
+ * enough transmit resources
+ */
while (true) {
- if (HTC_PACKET_QUEUE_DEPTH(&pEndpoint->TxQueue) == 0) {
+ if (HTC_PACKET_QUEUE_DEPTH(&pEndpoint->TxQueue) == 0)
break;
- }
if (IS_TX_CREDIT_FLOW_ENABLED(pEndpoint)) {
#if DEBUG_CREDIT
int cred = pEndpoint->TxCredits;
#endif
- /* credit based mechanism provides flow control based on target transmit resource availability, we
- * assume that the HIF layer will always have bus resources greater than target transmit resources */
+ /* credit based mechanism provides flow control based on
+ * target transmit resource availability, we assume that
+ * the HIF layer will always have bus resources greater
+ * than target transmit resources
+ */
get_htc_send_packets_credit_based(target, pEndpoint,
&sendQueue);
#if DEBUG_CREDIT
if (ep_debug_mask & (1 << pEndpoint->Id)) {
if (cred - pEndpoint->TxCredits > 0) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- (" <HTC> Decrease EP%d %d - %d = %d credits.\n",
+ (" <HTC> Decrease EP%d %d - %d = %d credits.\n",
pEndpoint->Id, cred,
cred -
pEndpoint->TxCredits,
@@ -1207,13 +1272,17 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
tx_resources =
(HTC_MAX_MSG_PER_BUNDLE_TX * 2);
}
- /* get all the packets for this endpoint that we can for this pass */
+ /* get all the packets for this endpoint that we can for
+ * this pass
+ */
get_htc_send_packets(target, pEndpoint, &sendQueue,
tx_resources);
}
if (HTC_PACKET_QUEUE_DEPTH(&sendQueue) == 0) {
- /* didn't get any packets due to a lack of resources or TX queue was drained */
+ /* didn't get any packets due to a lack of resources or
+ * TX queue was drained
+ */
break;
}
@@ -1223,6 +1292,7 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
result = htc_issue_packets(target, pEndpoint, &sendQueue);
if (result) {
int i;
+
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("htc_issue_packets, failed status:%d put it back to head of callersSendQueue",
result));
@@ -1250,13 +1320,14 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
UNLOCK_HTC_TX(target);
- AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-htc_try_send: \n"));
+ AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-htc_try_send:\n"));
return HTC_SEND_QUEUE_OK;
}
#ifdef USB_HIF_SINGLE_PIPE_DATA_SCHED
-static uint16_t htc_send_pkts_sched_check(HTC_HANDLE HTCHandle, HTC_ENDPOINT_ID id)
+static uint16_t htc_send_pkts_sched_check(HTC_HANDLE HTCHandle,
+ HTC_ENDPOINT_ID id)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
HTC_ENDPOINT *pEndpoint;
@@ -1265,17 +1336,15 @@ static uint16_t htc_send_pkts_sched_check(HTC_HANDLE HTCHandle, HTC_ENDPOINT_ID
uint16_t resources;
uint16_t acQueueStatus[DATA_EP_SIZE] = { 0, 0, 0, 0 };
- if (id < ENDPOINT_2 || id > ENDPOINT_5) {
+ if (id < ENDPOINT_2 || id > ENDPOINT_5)
return 1;
- }
for (eid = ENDPOINT_2; eid <= ENDPOINT_5; eid++) {
pEndpoint = &target->endpoint[eid];
pTxQueue = &pEndpoint->TxQueue;
- if (HTC_QUEUE_EMPTY(pTxQueue)) {
+ if (HTC_QUEUE_EMPTY(pTxQueue))
acQueueStatus[eid - 2] = 1;
- }
}
switch (id) {
@@ -1319,9 +1388,8 @@ static A_STATUS htc_send_pkts_sched_queue(HTC_TARGET *target,
HTC_PACKET_ENQUEUE(pTxQueue, pPacket);
goodPkts--;
- if (goodPkts <= 0) {
+ if (goodPkts <= 0)
break;
- }
}
}
@@ -1348,7 +1416,8 @@ static A_STATUS htc_send_pkts_sched_queue(HTC_TARGET *target,
#endif
-A_STATUS htc_send_pkts_multiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQueue)
+A_STATUS htc_send_pkts_multiple(HTC_HANDLE HTCHandle,
+ HTC_PACKET_QUEUE *pPktQueue)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
HTC_ENDPOINT *pEndpoint;
@@ -1358,14 +1427,16 @@ A_STATUS htc_send_pkts_multiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQueu
QDF_STATUS status;
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
- ("+htc_send_pkts_multiple: Queue: %p, Pkts %d \n",
+ ("+htc_send_pkts_multiple: Queue: %p, Pkts %d\n",
pPktQueue, HTC_PACKET_QUEUE_DEPTH(pPktQueue)));
- /* get packet at head to figure out which endpoint these packets will go into */
+ /* get packet at head to figure out which endpoint these packets will
+ * go into
+ */
pPacket = htc_get_pkt_at_head(pPktQueue);
if (NULL == pPacket) {
OL_ATH_HTC_PKT_ERROR_COUNT_INCR(target, GET_HTC_PKT_Q_FAIL);
- AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-htc_send_pkts_multiple \n"));
+ AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-htc_send_pkts_multiple\n"));
return A_EINVAL;
}
@@ -1394,10 +1465,10 @@ A_STATUS htc_send_pkts_multiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQueu
pHtcHdr = (HTC_FRAME_HDR *) qdf_nbuf_get_frag_vaddr(netbuf, 0);
AR_DEBUG_ASSERT(pHtcHdr);
HTC_WRITE32(pHtcHdr,
- SM(pPacket->ActualLength,
- HTC_FRAME_HDR_PAYLOADLEN) | SM(pPacket->Endpoint,
- HTC_FRAME_HDR_ENDPOINTID));
-
+ SM(pPacket->ActualLength,
+ HTC_FRAME_HDR_PAYLOADLEN) |
+ SM(pPacket->Endpoint,
+ HTC_FRAME_HDR_ENDPOINTID));
LOCK_HTC_TX(target);
pPacket->PktInfo.AsTx.SeqNo = pEndpoint->SeqNo;
@@ -1409,9 +1480,9 @@ A_STATUS htc_send_pkts_multiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQueu
UNLOCK_HTC_TX(target);
/*
- * Now that the HTC frame header has been added, the netbuf can be
- * mapped. This only applies to non-data frames, since data frames
- * were already mapped as they entered into the driver.
+ * Now that the HTC frame header has been added, the netbuf can
+ * be mapped. This only applies to non-data frames, since data
+ * frames were already mapped as they entered into the driver.
*/
status = qdf_nbuf_map(target->osdev,
GET_HTC_PACKET_NET_BUF_CONTEXT(pPacket),
@@ -1428,11 +1499,10 @@ A_STATUS htc_send_pkts_multiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQueu
HTC_PACKET_QUEUE_ITERATE_END;
#ifdef USB_HIF_SINGLE_PIPE_DATA_SCHED
- if (!htc_send_pkts_sched_check(HTCHandle, pEndpoint->Id)) {
+ if (!htc_send_pkts_sched_check(HTCHandle, pEndpoint->Id))
htc_send_pkts_sched_queue(HTCHandle, pPktQueue, pEndpoint->Id);
- } else {
+ else
htc_try_send(target, pEndpoint, pPktQueue);
- }
#else
htc_try_send(target, pEndpoint, pPktQueue);
#endif
@@ -1444,18 +1514,17 @@ A_STATUS htc_send_pkts_multiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQueu
/* remove the headroom reserved for HTC_FRAME_HDR */
restore_tx_packet(target, pPacket);
- if (HTC_STOPPING(target)) {
+ if (HTC_STOPPING(target))
pPacket->Status = A_ECANCELED;
- } else {
+ else
pPacket->Status = A_NO_RESOURCE;
- }
}
HTC_PACKET_QUEUE_ITERATE_END;
do_send_completion(pEndpoint, pPktQueue);
}
- AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-htc_send_pkts_multiple \n"));
+ AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-htc_send_pkts_multiple\n"));
return A_OK;
}
@@ -1465,12 +1534,11 @@ A_STATUS htc_send_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket)
{
HTC_PACKET_QUEUE queue;
- if (HTCHandle == NULL || pPacket == NULL) {
+ if (HTCHandle == NULL || pPacket == NULL)
return A_ERROR;
- }
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
- ("+-htc_send_pkt: Enter endPointId: %d, buffer: %p, length: %d \n",
+ ("+-htc_send_pkt: Enter endPointId: %d, buffer: %p, length: %d\n",
pPacket->Endpoint, pPacket->pBuffer,
pPacket->ActualLength));
INIT_HTC_PACKET_QUEUE_AND_ADD(&queue, pPacket);
@@ -1498,8 +1566,8 @@ A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, qdf_nbuf_t netbuf, int Epid,
pEndpoint = &target->endpoint[Epid];
- tx_resources =
- hif_get_free_queue_number(target->hif_dev, pEndpoint->UL_PipeID);
+ tx_resources = hif_get_free_queue_number(target->hif_dev,
+ pEndpoint->UL_PipeID);
if (tx_resources < HTC_DATA_RESOURCE_THRS) {
if (pEndpoint->ul_is_polled) {
@@ -1509,9 +1577,8 @@ A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, qdf_nbuf_t netbuf, int Epid,
hif_get_free_queue_number(target->hif_dev,
pEndpoint->UL_PipeID);
}
- if (tx_resources < HTC_DATA_MINDESC_PERPACKET) {
+ if (tx_resources < HTC_DATA_MINDESC_PERPACKET)
return A_ERROR;
- }
}
if (hif_pm_runtime_get(target->hif_dev))
@@ -1589,24 +1656,26 @@ A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket,
AR_DEBUG_ASSERT(pHtcHdr);
HTC_WRITE32(pHtcHdr,
- SM(pPacket->ActualLength,
- HTC_FRAME_HDR_PAYLOADLEN) | SM(pPacket->PktInfo.
- AsTx.SendFlags,
- HTC_FRAME_HDR_FLAGS)
- | SM(pPacket->Endpoint, HTC_FRAME_HDR_ENDPOINTID));
+ SM(pPacket->ActualLength,
+ HTC_FRAME_HDR_PAYLOADLEN) |
+ SM(pPacket->PktInfo.AsTx.SendFlags,
+ HTC_FRAME_HDR_FLAGS) |
+ SM(pPacket->Endpoint,
+ HTC_FRAME_HDR_ENDPOINTID));
/*
* If the HIF pipe for the data endpoint is polled rather than
* interrupt-driven, this is a good point to check whether any
* data previously sent through the HIF pipe have finished being
- * sent.
- * Since this may result in callbacks to htc_tx_completion_handler,
- * which can take the HTC tx lock, make the hif_send_complete_check
- * call before acquiring the HTC tx lock.
+ * sent. Since this may result in callbacks to
+ * htc_tx_completion_handler, which can take the HTC tx lock,
+ * make the hif_send_complete_check call before acquiring the
+ * HTC tx lock.
* Call hif_send_complete_check directly, rather than calling
- * htc_send_complete_check, and call the PollTimerStart separately
- * after calling hif_send_head, so the timer will be started to
- * check for completion of the new outstanding download (in the
- * unexpected event that other polling calls don't catch it).
+ * htc_send_complete_check, and call the PollTimerStart
+ * separately after calling hif_send_head, so the timer will be
+ * started to check for completion of the new outstanding
+ * download (in the unexpected event that other polling calls
+ * don't catch it).
*/
if (pEndpoint->ul_is_polled) {
htc_send_complete_poll_timer_stop(pEndpoint);
@@ -1638,9 +1707,9 @@ A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket,
qdf_atomic_inc(&pEndpoint->TxProcessCount);
if (qdf_atomic_read(&pEndpoint->TxProcessCount) > 1) {
/*
- * Another thread or task is draining the TX queues on this endpoint.
- * That thread will reset the tx processing count when the queue is
- * drained.
+ * Another thread or task is draining the TX queues on this
+ * endpoint. That thread will reset the tx processing count when
+ * the queue is drained.
*/
qdf_atomic_dec(&pEndpoint->TxProcessCount);
UNLOCK_HTC_TX(target);
@@ -1654,7 +1723,8 @@ A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket,
#if DEBUG_CREDIT
int cred = pEndpoint->TxCredits;
#endif
- get_htc_send_packets_credit_based(target, pEndpoint, &sendQueue);
+ get_htc_send_packets_credit_based(target, pEndpoint,
+ &sendQueue);
#if DEBUG_CREDIT
if (ep_debug_mask & (1 << pEndpoint->Id)) {
if (cred - pEndpoint->TxCredits > 0) {
@@ -1675,10 +1745,10 @@ A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket,
hif_get_free_queue_number(target->hif_dev,
pEndpoint->UL_PipeID)) {
/*
- * Header and payload belongs to the different fragments
- * and consume 2 resource for one HTC package but USB
- * combine into one transfer.
- */
+ * Header and payload belongs to the different fragments
+ * and consume 2 resource for one HTC package but USB
+ * combine into one transfer.
+ */
get_htc_send_packets(target, pEndpoint, &sendQueue,
(HTC_MAX_MSG_PER_BUNDLE_TX * 2));
} else {
@@ -1688,16 +1758,16 @@ A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket,
}
UNLOCK_HTC_TX(target);
- }
- else {
+ } else {
/*
- * Now drain the endpoint TX queue for transmission as long as we have
- * enough transmit resources
+ * Now drain the endpoint TX queue for transmission as long as
+ * we have enough transmit resources
*/
tx_resources =
hif_get_free_queue_number(target->hif_dev,
pEndpoint->UL_PipeID);
- get_htc_send_packets(target, pEndpoint, &sendQueue, tx_resources);
+ get_htc_send_packets(target, pEndpoint, &sendQueue,
+ tx_resources);
UNLOCK_HTC_TX(target);
}
QDF_NBUF_UPDATE_TX_PKT_COUNT(netbuf, QDF_NBUF_TX_PKT_HTC);
@@ -1715,9 +1785,8 @@ A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket,
htc_issue_packets_bundle(target, pEndpoint, &sendQueue);
}
pPacket = htc_packet_dequeue(&sendQueue);
- if (pPacket == NULL) {
+ if (pPacket == NULL)
break;
- }
netbuf = GET_HTC_PACKET_NET_BUF_CONTEXT(pPacket);
LOCK_HTC_TX(target);
@@ -1755,12 +1824,16 @@ A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket,
* In HL systems, the txrx SW explicitly performs the
* tx flow control.
*/
- /* pEndpoint->TxCredits += pPacket->PktInfo.AsTx.CreditsUsed; */
+ /* pEndpoint->TxCredits +=
+ * pPacket->PktInfo.AsTx.CreditsUsed;
+ */
/* put this frame back at the front of the sendQueue */
HTC_PACKET_ENQUEUE_TO_HEAD(&sendQueue, pPacket);
- /* put the sendQueue back at the front of pEndpoint->TxQueue */
+ /* put the sendQueue back at the front of
+ * pEndpoint->TxQueue
+ */
HTC_PACKET_QUEUE_TRANSFER_TO_HEAD(&pEndpoint->TxQueue,
&sendQueue);
UNLOCK_HTC_TX(target);
@@ -1815,13 +1888,12 @@ static HTC_PACKET *htc_lookup_tx_packet(HTC_TARGET *target,
if (netbuf == (qdf_nbuf_t) GET_HTC_PACKET_NET_BUF_CONTEXT(pPacket)) {
UNLOCK_HTC_TX(target);
return pPacket;
- } else {
- HTC_PACKET_ENQUEUE(&lookupQueue, pPacket);
}
+ HTC_PACKET_ENQUEUE(&lookupQueue, pPacket);
/*
- * Move TX lookup queue to temp queue because most of packets that are not index 0
- * are not top 10 packets.
+ * Move TX lookup queue to temp queue because most of packets that are
+ * not index 0 are not top 10 packets.
*/
HTC_PACKET_QUEUE_TRANSFER_TO_TAIL(&lookupQueue,
&pEndpoint->TxLookupQueue);
@@ -1906,7 +1978,8 @@ QDF_STATUS htc_tx_completion_handler(void *Context,
HTC_PACKET_QUEUE_ITERATE_END;
free_htc_bundle_packet(target, pPacket);
- if (hif_get_bus_type(target->hif_dev) == QDF_BUS_TYPE_USB) {
+ if (hif_get_bus_type(target->hif_dev) ==
+ QDF_BUS_TYPE_USB) {
if (!IS_TX_CREDIT_FLOW_ENABLED(pEndpoint))
htc_try_send(target, pEndpoint, NULL);
}
@@ -1921,9 +1994,10 @@ QDF_STATUS htc_tx_completion_handler(void *Context,
} while (false);
if (!IS_TX_CREDIT_FLOW_ENABLED(pEndpoint)) {
- /* note: when using TX credit flow, the re-checking of queues happens
- * when credits flow back from the target.
- * in the non-TX credit case, we recheck after the packet completes */
+ /* note: when using TX credit flow, the re-checking of queues
+ * happens when credits flow back from the target. In the non-TX
+ * credit case, we recheck after the packet completes
+ */
htc_try_send(target, pEndpoint, NULL);
}
@@ -1959,9 +2033,8 @@ void htc_tx_resource_avail_handler(void *context, uint8_t pipeID)
for (i = 0; i < ENDPOINT_MAX; i++) {
pEndpoint = &target->endpoint[i];
if (pEndpoint->service_id != 0) {
- if (pEndpoint->UL_PipeID == pipeID) {
+ if (pEndpoint->UL_PipeID == pipeID)
break;
- }
}
}
@@ -1973,7 +2046,7 @@ void htc_tx_resource_avail_handler(void *context, uint8_t pipeID)
}
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
- ("HIF indicated more resources for pipe:%d \n",
+ ("HIF indicated more resources for pipe:%d\n",
pipeID));
htc_try_send(target, pEndpoint, NULL);
@@ -2060,6 +2133,7 @@ bool htc_is_endpoint_active(HTC_HANDLE HTCHandle, HTC_ENDPOINT_ID Endpoint)
void htc_set_nodrop_pkt(HTC_HANDLE HTCHandle, A_BOOL isNodropPkt)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+
target->is_nodrop_pkt = isNodropPkt;
}
@@ -2081,7 +2155,7 @@ void htc_process_credit_rpt(HTC_TARGET *target, HTC_CREDIT_REPORT *pRpt,
uint8_t rpt_credits, rpt_ep_id;
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
- ("+htc_process_credit_rpt, Credit Report Entries:%d \n",
+ ("+htc_process_credit_rpt, Credit Report Entries:%d\n",
NumEntries));
/* lock out TX while we update credits */
@@ -2115,13 +2189,14 @@ void htc_process_credit_rpt(HTC_TARGET *target, HTC_CREDIT_REPORT *pRpt,
INC_HTC_EP_STAT(pEndpoint, TxCreditsReturned, rpt_credits);
if (FromEndpoint == rpt_ep_id) {
- /* this credit report arrived on the same endpoint indicating it arrived in an RX
- * packet */
+ /* this credit report arrived on the same endpoint
+ * indicating it arrived in an RX packet
+ */
INC_HTC_EP_STAT(pEndpoint, TxCreditsFromRx,
rpt_credits);
INC_HTC_EP_STAT(pEndpoint, TxCreditRptsFromRx, 1);
} else if (FromEndpoint == ENDPOINT_0) {
- /* this credit arrived on endpoint 0 as a NULL message */
+ /* this credit arrived on endpoint 0 as a NULL msg */
INC_HTC_EP_STAT(pEndpoint, TxCreditsFromEp0,
rpt_credits);
INC_HTC_EP_STAT(pEndpoint, TxCreditRptsFromEp0, 1);
@@ -2151,11 +2226,10 @@ void htc_process_credit_rpt(HTC_TARGET *target, HTC_CREDIT_REPORT *pRpt,
#ifdef ATH_11AC_TXCOMPACT
htc_try_send(target, pEndpoint, NULL);
#else
- if (pEndpoint->service_id == HTT_DATA_MSG_SVC) {
+ if (pEndpoint->service_id == HTT_DATA_MSG_SVC)
htc_send_data_pkt(target, NULL, 0);
- } else {
+ else
htc_try_send(target, pEndpoint, NULL);
- }
#endif
LOCK_HTC_TX(target);
}
@@ -2163,12 +2237,12 @@ void htc_process_credit_rpt(HTC_TARGET *target, HTC_CREDIT_REPORT *pRpt,
}
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
- (" Report indicated %d credits to distribute \n",
+ (" Report indicated %d credits to distribute\n",
totalCredits));
UNLOCK_HTC_TX(target);
- AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-htc_process_credit_rpt \n"));
+ AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-htc_process_credit_rpt\n"));
}
/* function to fetch stats from htc layer*/
diff --git a/htc/htc_services.c b/htc/htc_services.c
index 3bf0efa7adfb..c8910d86d2dc 100644
--- a/htc/htc_services.c
+++ b/htc/htc_services.c
@@ -83,7 +83,6 @@ htc_alt_data_credit_size_update(HTC_TARGET *target,
(*ul_pipe == 1) && (*dl_pipe == 0))
*txCreditSize = target->AltDataCreditSize;
- return;
}
#else
@@ -93,13 +92,12 @@ htc_alt_data_credit_size_update(HTC_TARGET *target,
uint8_t *dl_pipe,
int *txCreditSize)
{
- return;
}
#endif
A_STATUS htc_connect_service(HTC_HANDLE HTCHandle,
- HTC_SERVICE_CONNECT_REQ *pConnectReq,
- HTC_SERVICE_CONNECT_RESP *pConnectResp)
+ struct htc_service_connect_req *pConnectReq,
+ struct htc_service_connect_resp *pConnectResp)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
A_STATUS status = A_OK;
@@ -189,15 +187,14 @@ A_STATUS htc_connect_service(HTC_HANDLE HTCHandle,
disableCreditFlowCtrl = true;
}
- if (!htc_credit_flow) {
+ if (!htc_credit_flow)
disableCreditFlowCtrl = true;
- }
/* check caller if it wants to transfer meta data */
if ((pConnectReq->pMetaData != NULL) &&
(pConnectReq->MetaDataLength <=
HTC_SERVICE_META_DATA_MAX_LENGTH)) {
- /* copy meta data into message buffer (after header ) */
+ /* copy meta data into msg buffer (after hdr) */
qdf_mem_copy((uint8_t *) pConnectMsg +
sizeof(HTC_CONNECT_SERVICE_MSG),
pConnectReq->pMetaData,
@@ -219,23 +216,23 @@ A_STATUS htc_connect_service(HTC_HANDLE HTCHandle,
status = htc_send_pkt((HTC_HANDLE) target, pSendPacket);
/* we don't own it anymore */
pSendPacket = NULL;
- if (A_FAILED(status)) {
+ if (A_FAILED(status))
break;
- }
/* wait for response */
status = htc_wait_recv_ctrl_message(target);
- if (A_FAILED(status)) {
+ if (A_FAILED(status))
break;
- }
- /* we controlled the buffer creation so it has to be properly aligned */
+ /* we controlled the buffer creation so it has to be
+ * properly aligned
+ */
pResponseMsg =
(HTC_CONNECT_SERVICE_RESPONSE_MSG *) target->
CtrlResponseBuffer;
rsp_msg_id = HTC_GET_FIELD(pResponseMsg,
- HTC_CONNECT_SERVICE_RESPONSE_MSG,
- MESSAGEID);
+ HTC_CONNECT_SERVICE_RESPONSE_MSG,
+ MESSAGEID);
rsp_msg_serv_id =
HTC_GET_FIELD(pResponseMsg,
HTC_CONNECT_SERVICE_RESPONSE_MSG,
@@ -280,12 +277,13 @@ A_STATUS htc_connect_service(HTC_HANDLE HTCHandle,
rsp_msg_serv_id,
rsp_msg_status));
status = A_EPROTO;
-/* TODO: restore the ifdef when FW supports services 301 and 302 (HTT_MSG_DATA[23]_MSG_SVC)
-#ifdef QCA_TX_HTT2_SUPPORT
-*/
- /* Keep work and not to block the control message. */
+/* TODO: restore the ifdef when FW supports services 301 and 302
+ * (HTT_MSG_DATA[23]_MSG_SVC)
+ */
+/* #ifdef QCA_TX_HTT2_SUPPORT */
+ /* Keep work and not to block the control msg */
target->CtrlResponseProcessing = false;
-/*#endif */ /* QCA_TX_HTT2_SUPPORT */
+/* #endif */ /* QCA_TX_HTT2_SUPPORT */
break;
}
@@ -296,7 +294,9 @@ A_STATUS htc_connect_service(HTC_HANDLE HTCHandle,
(rsp_msg_serv_meta_len > 0) &&
(rsp_msg_serv_meta_len <=
HTC_SERVICE_META_DATA_MAX_LENGTH)) {
- /* caller supplied a buffer and the target responded with data */
+ /* caller supplied a buffer and the target
+ * responded with data
+ */
int copyLength =
min((int)pConnectResp->BufferLength,
(int)rsp_msg_serv_meta_len);
@@ -312,7 +312,7 @@ A_STATUS htc_connect_service(HTC_HANDLE HTCHandle,
target->CtrlResponseProcessing = false;
}
- /* the rest of these are parameter checks so set the error status */
+ /* rest of these are parameter checks so set the error status */
status = A_EPROTO;
if (assignedEndpoint >= ENDPOINT_MAX) {
@@ -346,9 +346,8 @@ A_STATUS htc_connect_service(HTC_HANDLE HTCHandle,
pEndpoint->TxCreditSize = target->TargetCreditSize;
pEndpoint->TxCreditsPerMaxMsg =
maxMsgSize / target->TargetCreditSize;
- if (maxMsgSize % target->TargetCreditSize) {
+ if (maxMsgSize % target->TargetCreditSize)
pEndpoint->TxCreditsPerMaxMsg++;
- }
#if DEBUG_CREDIT
qdf_print(" Endpoint%d initial credit:%d, size:%d.\n",
pEndpoint->Id, pEndpoint->TxCredits,
@@ -364,16 +363,16 @@ A_STATUS htc_connect_service(HTC_HANDLE HTCHandle,
&pEndpoint->DL_PipeID,
&pEndpoint->ul_is_polled,
&pEndpoint->dl_is_polled);
- if (A_FAILED(status)) {
+ if (A_FAILED(status))
break;
- }
htc_alt_data_credit_size_update(target,
&pEndpoint->UL_PipeID,
&pEndpoint->DL_PipeID,
&pEndpoint->TxCreditSize);
- qdf_assert(!pEndpoint->dl_is_polled); /* not currently supported */
+ /* not currently supported */
+ qdf_assert(!pEndpoint->dl_is_polled);
if (pEndpoint->ul_is_polled) {
qdf_timer_init(target->osdev,
@@ -410,17 +409,18 @@ void htc_set_credit_distribution(HTC_HANDLE HTCHandle,
HTC_SERVICE_ID ServicePriorityOrder[],
int ListLength)
{
- /* NOT Supported, this transport does not use a credit based flow control mechanism */
+ /* NOT Supported, this transport does not use a credit based flow
+ * control mechanism
+ */
}
void htc_fw_event_handler(void *context, QDF_STATUS status)
{
HTC_TARGET *target = (HTC_TARGET *) context;
- HTC_INIT_INFO *initInfo = &target->HTCInitInfo;
+ struct htc_init_info *initInfo = &target->HTCInitInfo;
/* check if target failure handler exists and pass error code to it. */
- if (target->HTCInitInfo.TargetFailure != NULL) {
+ if (target->HTCInitInfo.TargetFailure != NULL)
initInfo->TargetFailure(initInfo->pContext, status);
- }
}
diff --git a/pld_stub/inc/pld_common.h b/pld_stub/inc/pld_common.h
index 83ed961f4e3f..e6c60511c32e 100644
--- a/pld_stub/inc/pld_common.h
+++ b/pld_stub/inc/pld_common.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -166,7 +166,6 @@ static inline int pld_wlan_disable(struct device *dev,
}
static inline void pld_is_pci_link_down(struct device *dev)
{
- return;
}
static inline int pld_wlan_pm_control(struct device *dev, bool vote)
{
@@ -174,7 +173,6 @@ static inline int pld_wlan_pm_control(struct device *dev, bool vote)
}
static inline void pld_intr_notify_q6(struct device *dev)
{
- return;
}
static inline int pld_ce_request_irq(struct device *dev, unsigned int ce_id,
irqreturn_t (*handler)(int, void *),
@@ -204,11 +202,9 @@ static inline int pld_pm_runtime_request(struct device *dev,
}
static inline void pld_runtime_init(struct device *dev, int auto_delay)
{
- return;
}
static inline void pld_runtime_exit(struct device *dev)
{
- return;
}
static inline int pld_athdiag_read(struct device *dev,
uint32_t offset, uint32_t memtype,
diff --git a/qdf/inc/qdf_crypto.h b/qdf/inc/qdf_crypto.h
new file mode 100644
index 000000000000..1cd3394245ca
--- /dev/null
+++ b/qdf/inc/qdf_crypto.h
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: qdf_crypto.h
+ * This file provides OS abstraction for crypto APIs.
+ */
+
+#if !defined(__QDF_CRYPTO_H)
+#define __QDF_CRYPTO_H
+
+/* Include Files */
+#include "qdf_status.h"
+#include <qdf_types.h>
+#include <qdf_trace.h>
+
+/* Preprocessor definitions and constants */
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define AES_BLOCK_SIZE 16
+#define HMAC_SHA256_CRYPTO_TYPE "hmac(sha256)"
+#define HMAC_SHA386_CRYPTO_TYPE "hmac(sha384)"
+
+#define SHA256_CRYPTO_TYPE "sha256"
+#define SHA386_CRYPTO_TYPE "sha384"
+
+#define SHA256_DIGEST_SIZE 32
+#define SHA384_DIGEST_SIZE 48
+
+#define FIXED_PARAM_OFFSET_ASSOC_REQ 4
+#define FIXED_PARAM_OFFSET_ASSOC_RSP 6
+
+/* Function declarations and documenation */
+
+/**
+ * qdf_get_hash: API to get hash using specific crypto and scatterlist
+ * @type: crypto type
+ * @element_cnt: scatterlist element count
+ * @addr: scatterlist element array
+ * @addr_len: element length array
+ * @hash: new hash
+ *
+ * Return: 0 if success else error code
+ */
+int qdf_get_hash(uint8_t *type, uint8_t element_cnt,
+ uint8_t *addr[], uint32_t *addr_len,
+ int8_t *hash);
+
+/**
+ * qdf_get_hmac_hash: API to get hmac hash using specific crypto and
+ * scatterlist elements.
+ * @type: crypto type
+ * @key: key needs to be used for hmac api
+ * @keylen: length of key
+ * @element_cnt: scatterlist element count
+ * @addr: scatterlist element array
+ * @addr_len: element length array
+ * @hash: new hash
+ *
+ * Return: 0 if success else error code
+ */
+int qdf_get_hmac_hash(uint8_t *type, uint8_t *key,
+ uint32_t keylen, uint8_t element_cnt,
+ uint8_t *addr[], uint32_t *addr_len, int8_t *hash);
+
+/**
+ * qdf_get_keyed_hash: API to get hash using specific crypto and
+ * scatterlist elements.
+ * @type: crypto type
+ * @key: key needs to be used for hmac api
+ * @keylen: length of key
+ * @element_cnt: scatterlist element count
+ * @addr: scatterlist element array
+ * @addr_len: element length array
+ * @hash: new hash
+ *
+ * Return: 0 if success else error code
+ */
+int qdf_get_keyed_hash(const char *alg, const uint8_t *key,
+ unsigned int key_len, const uint8_t *src[],
+ size_t *src_len, size_t num_elements, uint8_t *out);
+/**
+ * qdf_update_dbl: This API does the doubling operation as defined in RFC5297
+ * @d: input for doubling
+ *
+ * Return: None
+ */
+void qdf_update_dbl(uint8_t *d);
+
+/**
+ * qdf_aes_s2v: This API gets vector from AES string as defined in RFC5297
+ * output length will be AES_BLOCK_SIZE.
+ * @key: key used for operation
+ * @key_len: key len
+ * @s: addresses of elements to be used
+ * @s_len: array of element length
+ * @num_s: number of elements
+ * @out: pointer to output vector
+ *
+ * Return: 0 if success else Error number
+ */
+int qdf_aes_s2v(const uint8_t *key, unsigned int key_len, const uint8_t *s[],
+ size_t s_len[], size_t num_s, uint8_t *out);
+
+/**
+ * qdf_aes_ctr: This API defines AES Counter Mode
+ * @key: key used for operation
+ * @key_len: key len
+ * @siv: Initialization vector
+ * @src: input
+ * @src_len: input len
+ * @dest: output
+ * @enc: if encryption needs to be done or decryption
+ *
+ * Return: 0 if success else Error number
+ */
+int qdf_aes_ctr(const uint8_t *key, unsigned int key_len, uint8_t *siv,
+ const uint8_t *src, size_t src_len, uint8_t *dest, bool enc);
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* __QDF_CRYPTO_H */
diff --git a/qdf/inc/qdf_nbuf.h b/qdf/inc/qdf_nbuf.h
index 7d54fdda8dbf..632f1f584907 100644
--- a/qdf/inc/qdf_nbuf.h
+++ b/qdf/inc/qdf_nbuf.h
@@ -602,12 +602,66 @@ qdf_nbuf_dma_map_info(qdf_dma_map_t bmap, qdf_dmamap_info_t *sg)
__qdf_nbuf_dma_map_info(bmap, sg);
}
+/**
+ * qdf_nbuf_is_tso() - is the network buffer a jumbo packet?
+ * @buf: Network buffer
+ *
+ * Return: 1 - this is a jumbo packet 0 - not a jumbo packet
+ */
+static inline uint8_t qdf_nbuf_is_tso(qdf_nbuf_t nbuf)
+{
+ return __qdf_nbuf_is_tso(nbuf);
+}
+
+/**
+ * qdf_nbuf_get_users() - function to get the number of users referencing this
+ * network buffer
+ *
+ * @nbuf: network buffer
+ *
+ * Return: number of user references to nbuf.
+ */
+static inline int qdf_nbuf_get_users(qdf_nbuf_t nbuf)
+{
+ return __qdf_nbuf_get_users(nbuf);
+}
+
+/**
+ * qdf_nbuf_next() - get the next packet in the linked list
+ * @buf: Network buffer
+ *
+ * This function can be used when nbufs are directly linked into a list,
+ * rather than using a separate network buffer queue object.
+ *
+ * Return: next network buffer in the linked list
+ */
+static inline qdf_nbuf_t qdf_nbuf_next(qdf_nbuf_t buf)
+{
+ return __qdf_nbuf_next(buf);
+}
+
#ifdef MEMORY_DEBUG
void qdf_net_buf_debug_init(void);
void qdf_net_buf_debug_exit(void);
void qdf_net_buf_debug_clean(void);
void qdf_net_buf_debug_add_node(qdf_nbuf_t net_buf, size_t size,
uint8_t *file_name, uint32_t line_num);
+void qdf_net_buf_debug_delete_node(qdf_nbuf_t net_buf);
+
+/**
+ * qdf_net_buf_debug_acquire_skb() - acquire skb to avoid memory leak
+ * @net_buf: Network buf holding head segment (single)
+ * @file_name: pointer to file name
+ * @line_num: line number
+ *
+ * WLAN driver module's SKB which are allocated by network stack are
+ * suppose to call this API before freeing it such that the SKB
+ * is not reported as memory leak.
+ *
+ * Return: none
+ */
+void qdf_net_buf_debug_acquire_skb(qdf_nbuf_t net_buf,
+ uint8_t *file_name, uint32_t line_num);
void qdf_net_buf_debug_release_skb(qdf_nbuf_t net_buf);
/* nbuf allocation rouines */
@@ -632,10 +686,15 @@ qdf_nbuf_alloc_debug(qdf_device_t osdev, qdf_size_t size, int reserve,
static inline void qdf_nbuf_free(qdf_nbuf_t net_buf)
{
+ if (qdf_nbuf_is_tso(net_buf) &&
+ qdf_nbuf_get_users(net_buf) > 1)
+ goto free_buf;
+
/* Remove SKB from internal QDF tracking table */
if (qdf_likely(net_buf))
qdf_net_buf_debug_delete_node(net_buf);
+free_buf:
__qdf_nbuf_free(net_buf);
}
@@ -700,6 +759,11 @@ qdf_nbuf_copy_debug(qdf_nbuf_t buf, uint8_t *file_name,
#else
+static inline void qdf_net_buf_debug_acquire_skb(qdf_nbuf_t net_buf,
+ uint8_t *file_name, uint32_t line_num)
+{
+}
+
static inline void qdf_net_buf_debug_release_skb(qdf_nbuf_t net_buf)
{
}
@@ -767,7 +831,12 @@ static inline void qdf_nbuf_init_fast(qdf_nbuf_t nbuf)
static inline void qdf_nbuf_tx_free(qdf_nbuf_t buf_list, int tx_err)
{
- __qdf_nbuf_tx_free(buf_list, tx_err);
+ while (buf_list) {
+ qdf_nbuf_t next = qdf_nbuf_next(buf_list);
+
+ qdf_nbuf_free(buf_list);
+ buf_list = next;
+ }
}
static inline void qdf_nbuf_ref(qdf_nbuf_t buf)
@@ -1060,20 +1129,6 @@ qdf_nbuf_queue_first(qdf_nbuf_queue_t *head)
}
/**
- * qdf_nbuf_next() - get the next packet in the linked list
- * @buf: Network buffer
- *
- * This function can be used when nbufs are directly linked into a list,
- * rather than using a separate network buffer queue object.
- *
- * Return: next network buffer in the linked list
- */
-static inline qdf_nbuf_t qdf_nbuf_next(qdf_nbuf_t buf)
-{
- return __qdf_nbuf_next(buf);
-}
-
-/**
* qdf_nbuf_get_protocol() - return the protocol value of the skb
* @skb: Pointer to network buffer
*
@@ -1954,17 +2009,6 @@ static inline void qdf_dmaaddr_to_32s(qdf_dma_addr_t dmaaddr,
}
/**
- * qdf_nbuf_is_tso() - is the network buffer a jumbo packet?
- * @buf: Network buffer
- *
- * Return: 1 - this is a jumbo packet 0 - not a jumbo packet
- */
-static inline uint8_t qdf_nbuf_is_tso(qdf_nbuf_t nbuf)
-{
- return __qdf_nbuf_is_tso(nbuf);
-}
-
-/**
* qdf_nbuf_get_tso_info() - function to divide a jumbo TSO
* network buffer into segments
* @nbuf: network buffer to be segmented
@@ -2031,19 +2075,6 @@ static inline qdf_nbuf_t qdf_nbuf_inc_users(qdf_nbuf_t nbuf)
}
/**
- * qdf_nbuf_get_users() - function to get the number of users referencing this
- * network buffer
- *
- * @nbuf: network buffer
- *
- * Return: number of user references to nbuf.
- */
-static inline int qdf_nbuf_get_users(qdf_nbuf_t nbuf)
-{
- return __qdf_nbuf_get_users(nbuf);
-}
-
-/**
* qdf_nbuf_data_attr_get() - Get data_attr field from cvg_nbuf_cb
*
* @nbuf: Network buffer (skb on linux)
diff --git a/qdf/inc/qdf_trace.h b/qdf/inc/qdf_trace.h
index 6081dfc40045..ad7723b3f786 100644
--- a/qdf/inc/qdf_trace.h
+++ b/qdf/inc/qdf_trace.h
@@ -45,6 +45,8 @@
#define FL(x) "%s: %d: " x, __func__, __LINE__
+typedef int (qdf_abstract_print)(void *priv, const char *fmt, ...);
+
/*
* Log levels
*/
diff --git a/qdf/linux/src/i_qdf_nbuf.h b/qdf/linux/src/i_qdf_nbuf.h
index d72db353677b..306dd0b5efd9 100644
--- a/qdf/linux/src/i_qdf_nbuf.h
+++ b/qdf/linux/src/i_qdf_nbuf.h
@@ -116,7 +116,6 @@ typedef union {
* @tx.trace : combined structure for DP and protocol trace
* @tx.trace.packet_state: {NBUF_TX_PKT_[(HDD)|(TXRX_ENQUEUE)|(TXRX_DEQUEUE)|
* + (TXRX)|(HTT)|(HTC)|(HIF)|(CE)|(FREE)]
- * @tx.trace.is_packet_priv: flag, pkt generated internally or come from NS
* @tx.trace.packet_track: {NBUF_TX_PKT_[(DATA)|(MGMT)]_TRACK}
* @tx.trace.proto_type : bitmap of NBUF_PKT_TRAC_TYPE[(EAPOL)|(DHCP)|
* + (MGMT_ACTION)] - 4 bits
@@ -135,6 +134,7 @@ struct qdf_nbuf_cb {
/* Note: MAX: 40 bytes */
struct {
uint32_t lro_eligible:1,
+ peer_cached_buf_frm:1,
tcp_proto:1,
tcp_pure_ack:1,
ipv6_proto:1,
@@ -183,8 +183,7 @@ struct qdf_nbuf_cb {
struct {
uint32_t data_attr; /* 4 bytes */
struct{
- uint8_t packet_state:7,
- is_packet_priv:1;
+ uint8_t packet_state;
uint8_t packet_track:4,
proto_type:4;
uint8_t dp_trace:1,
@@ -219,6 +218,8 @@ struct qdf_nbuf_cb {
#define QDF_NBUF_CB_RX_LRO_ELIGIBLE(skb) \
(((struct qdf_nbuf_cb *)((skb)->cb))->u.rx.lro_eligible)
+#define QDF_NBUF_CB_RX_PEER_CACHED_FRM(skb) \
+ (((struct qdf_nbuf_cb *)((skb)->cb))->u.rx.peer_cached_buf_frm)
#define QDF_NBUF_CB_RX_CTX_ID(skb) \
(((struct qdf_nbuf_cb *)((skb)->cb))->u.rx.rx_ctx_id)
#define QDF_NBUF_CB_RX_TCP_PROTO(skb) \
@@ -276,9 +277,6 @@ struct qdf_nbuf_cb {
#define QDF_NBUF_CB_TX_PACKET_STATE(skb) \
(((struct qdf_nbuf_cb *) \
((skb)->cb))->u.tx.dev.mcl.trace.packet_state)
-#define QDF_NBUF_CB_TX_IS_PACKET_PRIV(skb) \
- (((struct qdf_nbuf_cb *) \
- ((skb)->cb))->u.tx.dev.mcl.trace.is_packet_priv)
#define QDF_NBUF_CB_TX_PACKET_TRACK(skb) \
(((struct qdf_nbuf_cb *) \
((skb)->cb))->u.tx.dev.mcl.trace.packet_track)
@@ -488,7 +486,6 @@ void __qdf_nbuf_unmap_nbytes_single(
void __qdf_nbuf_dma_map_info(__qdf_dma_map_t bmap, qdf_dmamap_info_t *sg);
uint32_t __qdf_nbuf_get_frag_size(__qdf_nbuf_t nbuf, uint32_t cur_frag);
void __qdf_nbuf_frag_info(struct sk_buff *skb, qdf_sglist_t *sg);
-void qdf_net_buf_debug_delete_node(struct sk_buff *net_buf);
QDF_STATUS __qdf_nbuf_frag_map(
qdf_device_t osdev, __qdf_nbuf_t nbuf,
int offset, qdf_dma_dir_t dir, int cur_frag);
@@ -919,27 +916,6 @@ static inline struct sk_buff *__qdf_nbuf_get_ext_list(struct sk_buff *head_buf)
}
/**
- * __qdf_nbuf_tx_free() - free skb list
- * @skb: Pointer to network buffer
- * @tx_err: TX error
- *
- * Return: none
- */
-static inline void __qdf_nbuf_tx_free(struct sk_buff *bufs, int tx_err)
-{
- while (bufs) {
- struct sk_buff *next = __qdf_nbuf_next(bufs);
-
- if (QDF_NBUF_CB_TX_IS_PACKET_PRIV(bufs)) {
- if (qdf_likely(bufs))
- qdf_net_buf_debug_delete_node(bufs);
- }
- __qdf_nbuf_free(bufs);
- bufs = next;
- }
-}
-
-/**
* __qdf_nbuf_get_age() - return the checksum value of the skb
* @skb: Pointer to network buffer
*
diff --git a/qdf/linux/src/qdf_crypto.c b/qdf/linux/src/qdf_crypto.c
new file mode 100644
index 000000000000..98f2c25ca110
--- /dev/null
+++ b/qdf/linux/src/qdf_crypto.c
@@ -0,0 +1,329 @@
+/*
+ * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: qdf_crypto.c
+ *
+ * This source file contains linux specific definitions for QDF crypto APIs
+ */
+
+/* Include Files */
+#include "qdf_crypto.h"
+#include <linux/export.h>
+#include <crypto/hash.h>
+#include <crypto/aes.h>
+#include <crypto/skcipher.h>
+
+/* Function Definitions and Documentation */
+
+/*
+ * xor: API to calculate xor
+ * @a: first variable
+ * @b: second variable
+ * @len: length of variables
+ */
+static void xor(uint8_t *a, const uint8_t *b, size_t len)
+{
+ unsigned int i;
+
+ for (i = 0; i < len; i++)
+ a[i] ^= b[i];
+}
+
+int qdf_get_hash(uint8_t *type,
+ uint8_t element_cnt, uint8_t *addr[], uint32_t *addr_len,
+ int8_t *hash)
+{
+ int i, ret;
+ struct hash_desc desc;
+ struct scatterlist sg;
+
+ /* allocate crypto hash type */
+ desc.tfm = crypto_alloc_hash(type, 0, CRYPTO_ALG_ASYNC);
+
+ if (IS_ERR(desc.tfm)) {
+ ret = PTR_ERR(desc.tfm);
+ return -EINVAL;
+ }
+ desc.flags = 0;
+ ret = crypto_hash_init(&desc);
+
+ if (ret)
+ return ret;
+
+ for (i = 0; i < element_cnt ; i++) {
+ sg_init_one(&sg, addr[i], addr_len[i]);
+ crypto_hash_update(&desc, &sg, addr_len[i]);
+ }
+
+ crypto_hash_final(&desc, hash);
+ crypto_free_hash(desc.tfm);
+ return 0;
+}
+
+int qdf_get_hmac_hash(uint8_t *type, uint8_t *key,
+ uint32_t keylen,
+ uint8_t element_cnt, uint8_t *addr[], uint32_t *addr_len,
+ int8_t *hash)
+{
+ int i, ret;
+ struct hash_desc desc;
+ struct scatterlist sg;
+
+ /* allocate crypto hash type */
+ desc.tfm = crypto_alloc_hash(type, 0, CRYPTO_ALG_ASYNC);
+
+ if (IS_ERR(desc.tfm)) {
+ ret = PTR_ERR(desc.tfm);
+ return -EINVAL;
+ }
+ desc.flags = 0;
+ ret = crypto_hash_setkey(desc.tfm, key, keylen);
+
+ crypto_hash_init(&desc);
+
+ if (ret)
+ return ret;
+
+ for (i = 0; i < element_cnt ; i++) {
+ sg_init_one(&sg, addr[i], addr_len[i]);
+ crypto_hash_update(&desc, &sg, addr_len[i]);
+ }
+
+ crypto_hash_final(&desc, hash);
+ crypto_free_hash(desc.tfm);
+ return 0;
+}
+
+/* qdf_update_dbl from RFC 5297. Length of d is AES_BLOCK_SIZE (128 bits) */
+void qdf_update_dbl(uint8_t *d)
+{
+ int i;
+ uint8_t msb, msb_prev = 0;
+
+ /* left shift by 1 */
+ for (i = AES_BLOCK_SIZE - 1; i >= 0; i--) {
+ msb = d[i] & 0x80;
+ d[i] = d[i] << 1;
+ d[i] += msb_prev ? 1 : 0;
+ msb_prev = msb;
+ }
+
+ if (msb)
+ d[AES_BLOCK_SIZE - 1] ^= 0x87;
+}
+
+int qdf_get_keyed_hash(const char *alg, const uint8_t *key,
+ unsigned int key_len, const uint8_t *src[],
+ size_t *src_len, size_t num_elements, uint8_t *out)
+{
+ struct crypto_shash *tfm;
+ int ret;
+ size_t i;
+
+ tfm = crypto_alloc_shash(alg, 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(tfm)) {
+ QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
+ FL("Failed to allocate transformation for %s: %ld"),
+ alg, PTR_ERR(tfm));
+ return -EINVAL;
+ }
+
+ if (key && key_len) {
+ ret = crypto_shash_setkey(tfm, key, key_len);
+ if (ret) {
+ QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
+ FL("Set key failed for %s, ret:%d"),
+ alg, -ret);
+ goto error;
+ }
+ }
+
+ do {
+ SHASH_DESC_ON_STACK(desc, tfm);
+ desc->tfm = tfm;
+ desc->flags = crypto_shash_get_flags(tfm);
+
+ ret = crypto_shash_init(desc);
+ if (ret) {
+ QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
+ FL("Failed to init hash for %s, ret:%d"),
+ alg, -ret);
+ goto error;
+ }
+
+ for (i = 0; i < num_elements; i++) {
+ ret = crypto_shash_update(desc, src[i], src_len[i]);
+ if (ret) {
+ QDF_TRACE(QDF_MODULE_ID_QDF,
+ QDF_TRACE_LEVEL_ERROR,
+ FL("Failed to update hash for %s, ret:%d"),
+ alg, -ret);
+ goto error;
+ }
+ }
+
+ ret = crypto_shash_final(desc, out);
+ if (ret)
+ QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
+ FL("Failed to get digest for %s, ret:%d"),
+ alg, -ret);
+ } while (0);
+
+error:
+ crypto_free_shash(tfm);
+ return ret;
+}
+
+/* AES String to Vector from RFC 5297, 'out' should be of length AES_BLOCK_SIZE
+ */
+int qdf_aes_s2v(const uint8_t *key, unsigned int key_len, const uint8_t *s[],
+ size_t s_len[], size_t num_s, uint8_t *out)
+{
+ const char *alg = "cmac(aes)";
+ uint8_t d[AES_BLOCK_SIZE];
+ uint8_t buf[AES_BLOCK_SIZE] = { 0 };
+ size_t buf_len = AES_BLOCK_SIZE;
+ const uint8_t *a[1];
+ unsigned int i;
+ uint8_t *t = NULL;
+ size_t t_len;
+ int ret;
+
+ if (num_s == 0) {
+ /* V = AES-CMAC(K, <one>) */
+ buf[0] = 0x01;
+ a[0] = buf;
+ ret = qdf_get_keyed_hash(alg, key, key_len, a, &buf_len, 1,
+ out);
+ return ret;
+ }
+
+ /* D = AES-CMAC(K, <zero>) */
+ a[0] = buf;
+ ret = qdf_get_keyed_hash(alg, key, key_len, a, &buf_len, 1, d);
+ if (ret)
+ goto error;
+
+ for (i = 0; i < num_s - 1; i++) {
+ /* D = qdf_update_dbl(D) xor AES-CMAC(K, Si) */
+ qdf_update_dbl(d);
+ ret = qdf_get_keyed_hash(alg, key, key_len, &s[i], &s_len[i], 1,
+ buf);
+ if (ret)
+ goto error;
+ xor(d, buf, AES_BLOCK_SIZE);
+ }
+
+ if (s_len[i] >= AES_BLOCK_SIZE) {
+ /* len(Sn) >= 128 */
+ /* T = Sn xorend D */
+ t = qdf_mem_malloc(s_len[i]);
+ if (!t)
+ return -EINVAL;
+ qdf_mem_copy(t, s[i], s_len[i]);
+ xor(t + s_len[i] - AES_BLOCK_SIZE, d, AES_BLOCK_SIZE);
+ t_len = s_len[i];
+ } else {
+ /* len(Sn) < 128 */
+ /* T = qdf_update_dbl(D) xor pad(Sn) */
+ qdf_update_dbl(d);
+ qdf_mem_set(buf, 0, AES_BLOCK_SIZE);
+ qdf_mem_copy(buf, s[i], s_len[i]);
+ buf[s_len[i]] = 0x80;
+ xor(d, s[i], AES_BLOCK_SIZE);
+ t = d;
+ t_len = AES_BLOCK_SIZE;
+ }
+
+ /* V = AES-CMAC(K, T) */
+ a[0] = t;
+ ret = qdf_get_keyed_hash(alg, key, key_len, a, &t_len, 1, out);
+
+error:
+ if (t != NULL && t != d)
+ qdf_mem_free(t);
+ return ret;
+}
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0))
+int qdf_aes_ctr(const uint8_t *key, unsigned int key_len, uint8_t *siv,
+ const uint8_t *src, size_t src_len, uint8_t *dest, bool enc)
+{
+ struct crypto_skcipher *tfm;
+ struct skcipher_request *req = NULL;
+ struct scatterlist sg_in, sg_out;
+ int ret;
+
+ if (key_len != 16 && key_len != 24 && key_len != 32) {
+ QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
+ FL("Invalid key length: %u"), key_len);
+ return -EINVAL;
+ }
+
+ tfm = crypto_alloc_skcipher("ctr(aes)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(tfm)) {
+ QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
+ FL("Failed to alloc transformation for ctr(aes):%ld"),
+ PTR_ERR(tfm));
+ return -EAGAIN;
+ }
+
+ req = skcipher_request_alloc(tfm, GFP_KERNEL);
+ if (!req) {
+ QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
+ FL("Failed to allocate request for ctr(aes)"));
+ crypto_free_skcipher(tfm);
+ return -EAGAIN;
+ }
+
+ ret = crypto_skcipher_setkey(tfm, key, key_len);
+ if (ret) {
+ QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
+ FL("Set key failed for ctr(aes), ret:%d"), -ret);
+ skcipher_request_free(req);
+ crypto_free_skcipher(tfm);
+ return ret;
+ }
+
+ sg_init_one(&sg_in, src, src_len);
+ sg_init_one(&sg_out, dest, src_len);
+ skcipher_request_set_crypt(req, &sg_in, &sg_out, src_len, siv);
+
+ if (enc)
+ ret = crypto_skcipher_encrypt(req);
+ else
+ ret = crypto_skcipher_decrypt(req);
+
+ if (ret) {
+ QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
+ FL("%s failed for ctr(aes), ret:%d"),
+ enc ? "Encryption" : "Decryption", -ret);
+ }
+
+ skcipher_request_free(req);
+ crypto_free_skcipher(tfm);
+ return ret;
+}
+#else
+int qdf_aes_ctr(const uint8_t *key, unsigned int key_len, uint8_t *siv,
+ const uint8_t *src, size_t src_len, uint8_t *dest, bool enc)
+{
+ return -EINVAL;
+}
+#endif
diff --git a/qdf/linux/src/qdf_nbuf.c b/qdf/linux/src/qdf_nbuf.c
index cd9cfea6ca9d..ac711d5ef59f 100644
--- a/qdf/linux/src/qdf_nbuf.c
+++ b/qdf/linux/src/qdf_nbuf.c
@@ -1539,6 +1539,7 @@ void qdf_net_buf_debug_add_node(qdf_nbuf_t net_buf, size_t size,
"Mem alloc failed ! Could not track skb from %s %d of size %zu",
file_name, line_num, size);
}
+
spin_unlock_irqrestore(&g_qdf_net_buf_track_lock[i], irq_flag);
}
qdf_export_symbol(qdf_net_buf_debug_add_node);
@@ -1598,6 +1599,26 @@ done:
}
qdf_export_symbol(qdf_net_buf_debug_delete_node);
+void qdf_net_buf_debug_acquire_skb(qdf_nbuf_t net_buf,
+ uint8_t *file_name, uint32_t line_num)
+{
+ qdf_nbuf_t ext_list = qdf_nbuf_get_ext_list(net_buf);
+
+ while (ext_list) {
+ /*
+ * Take care to add if it is Jumbo packet connected using
+ * frag_list
+ */
+ qdf_nbuf_t next;
+
+ next = qdf_nbuf_queue_next(ext_list);
+ qdf_net_buf_debug_add_node(ext_list, 0, file_name, line_num);
+ ext_list = next;
+ }
+ qdf_net_buf_debug_add_node(net_buf, 0, file_name, line_num);
+}
+qdf_export_symbol(qdf_net_buf_debug_acquire_skb);
+
/**
* qdf_net_buf_debug_release_skb() - release skb to avoid memory leak
* @net_buf: Network buf holding head segment (single)
@@ -1627,13 +1648,7 @@ void qdf_net_buf_debug_release_skb(qdf_nbuf_t net_buf)
}
qdf_export_symbol(qdf_net_buf_debug_release_skb);
-#else
-void qdf_net_buf_debug_delete_node(qdf_nbuf_t net_buf)
-{
-}
-qdf_export_symbol(qdf_net_buf_debug_delete_node);
#endif /*MEMORY_DEBUG */
-
#if defined(FEATURE_TSO)
/**
@@ -1992,7 +2007,10 @@ void __qdf_nbuf_unmap_tso_segment(qdf_device_t osdev,
struct qdf_tso_seg_elem_t *tso_seg,
bool is_last_seg)
{
- uint32_t num_frags = tso_seg->seg.num_frags - 1;
+ uint32_t num_frags = 0;
+
+ if (tso_seg->seg.num_frags > 0)
+ num_frags = tso_seg->seg.num_frags - 1;
/*Num of frags in a tso seg cannot be less than 2 */
if (num_frags < 1) {
diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h
index 3c032c9d4d8b..e6d8e05dacea 100644
--- a/wmi/inc/wmi_unified_api.h
+++ b/wmi/inc/wmi_unified_api.h
@@ -1362,4 +1362,30 @@ QDF_STATUS wmi_unified_set_arp_stats_req(void *wmi_hdl,
struct set_arp_stats *req_buf);
QDF_STATUS wmi_unified_get_arp_stats_req(void *wmi_hdl,
struct get_arp_stats *req_buf);
+
+#ifdef WMI_INTERFACE_EVENT_LOGGING
+void wmi_print_cmd_log(wmi_unified_t wmi, uint32_t count,
+ qdf_abstract_print *print, void *print_priv);
+
+void wmi_print_cmd_tx_cmp_log(wmi_unified_t wmi, uint32_t count,
+ qdf_abstract_print *print, void *print_priv);
+
+void wmi_print_mgmt_cmd_log(wmi_unified_t wmi, uint32_t count,
+ qdf_abstract_print *print, void *print_priv);
+
+void wmi_print_mgmt_cmd_tx_cmp_log(wmi_unified_t wmi, uint32_t count,
+ qdf_abstract_print *print, void *print_priv);
+
+void wmi_print_event_log(wmi_unified_t wmi, uint32_t count,
+ qdf_abstract_print *print, void *print_priv);
+
+void wmi_print_rx_event_log(wmi_unified_t wmi, uint32_t count,
+ qdf_abstract_print *print, void *print_priv);
+
+void wmi_print_mgmt_event_log(wmi_unified_t wmi, uint32_t count,
+ qdf_abstract_print *print, void *print_priv);
+#endif /* WMI_INTERFACE_EVENT_LOGGING */
+
+QDF_STATUS wmi_unified_send_dbs_scan_sel_params_cmd(void *wmi_hdl,
+ struct wmi_dbs_scan_sel_params *wmi_param);
#endif /* _WMI_UNIFIED_API_H_ */
diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h
index afd865ceadcf..834d24f337ea 100644
--- a/wmi/inc/wmi_unified_param.h
+++ b/wmi/inc/wmi_unified_param.h
@@ -1087,6 +1087,7 @@ struct scan_start_params {
uint32_t num_vendor_oui;
uint32_t oui_field_len;
uint8_t *voui;
+ uint32_t scan_ctrl_flags_ext;
};
/**
@@ -6895,5 +6896,23 @@ struct get_arp_stats {
uint32_t vdev_id;
};
+#define WMI_SCAN_CLIENT_MAX 7
+
+/**
+ * struct wmi_dbs_scan_sel_params - DBS scan selection params
+ * @num_clients: Number of scan clients dutycycle
+ * @pdev_id: pdev_id for identifying the MAC
+ * @module_id: scan client module id
+ * @num_dbs_scans: number of DBS scans
+ * @num_non_dbs_scans: number of non-DBS scans
+ */
+struct wmi_dbs_scan_sel_params {
+ uint32_t num_clients;
+ uint32_t pdev_id;
+ uint32_t module_id[WMI_SCAN_CLIENT_MAX];
+ uint32_t num_dbs_scans[WMI_SCAN_CLIENT_MAX];
+ uint32_t num_non_dbs_scans[WMI_SCAN_CLIENT_MAX];
+};
+
#endif /* _WMI_UNIFIED_PARAM_H_ */
diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h
index 7ded40c2c3b3..e54330e4114e 100644
--- a/wmi/inc/wmi_unified_priv.h
+++ b/wmi/inc/wmi_unified_priv.h
@@ -110,12 +110,14 @@ struct wmi_command_header {
* @ buf_tail_idx - Tail index of buffer
* @ p_buf_tail_idx - refernce to buffer tail index. It is added to accommodate
* unified design since MCL uses global variable for buffer tail index
+ * @ size - the size of the buffer in number of entries
*/
struct wmi_log_buf_t {
void *buf;
uint32_t length;
uint32_t buf_tail_idx;
uint32_t *p_buf_tail_idx;
+ uint32_t size;
};
/**
@@ -1154,6 +1156,9 @@ QDF_STATUS (*send_power_dbg_cmd)(wmi_unified_t wmi_handle,
QDF_STATUS (*send_adapt_dwelltime_params_cmd)(wmi_unified_t wmi_handle,
struct wmi_adaptive_dwelltime_params *dwelltime_params);
+QDF_STATUS (*send_dbs_scan_sel_params_cmd)(wmi_unified_t wmi_handle,
+ struct wmi_dbs_scan_sel_params *dbs_scan_params);
+
QDF_STATUS (*send_fw_test_cmd)(wmi_unified_t wmi_handle,
struct set_fwtest_params *wmi_fwtest);
diff --git a/wmi/src/wmi_unified.c b/wmi/src/wmi_unified.c
index 9e4b2365181b..a7cb1cc1468f 100644
--- a/wmi/src/wmi_unified.c
+++ b/wmi/src/wmi_unified.c
@@ -314,30 +314,35 @@ static QDF_STATUS wmi_log_init(struct wmi_unified *wmi_handle)
cmd_log_buf->buf_tail_idx = 0;
cmd_log_buf->buf = wmi_command_log_buffer;
cmd_log_buf->p_buf_tail_idx = &g_wmi_command_buf_idx;
+ cmd_log_buf->size = WMI_EVENT_DEBUG_MAX_ENTRY;
/* WMI commands TX completed */
cmd_tx_cmpl_log_buf->length = 0;
cmd_tx_cmpl_log_buf->buf_tail_idx = 0;
cmd_tx_cmpl_log_buf->buf = wmi_command_tx_cmp_log_buffer;
cmd_tx_cmpl_log_buf->p_buf_tail_idx = &g_wmi_command_tx_cmp_buf_idx;
+ cmd_tx_cmpl_log_buf->size = WMI_EVENT_DEBUG_MAX_ENTRY;
/* WMI events when processed */
event_log_buf->length = 0;
event_log_buf->buf_tail_idx = 0;
event_log_buf->buf = wmi_event_log_buffer;
event_log_buf->p_buf_tail_idx = &g_wmi_event_buf_idx;
+ event_log_buf->size = WMI_EVENT_DEBUG_MAX_ENTRY;
/* WMI events when queued */
rx_event_log_buf->length = 0;
rx_event_log_buf->buf_tail_idx = 0;
rx_event_log_buf->buf = wmi_rx_event_log_buffer;
rx_event_log_buf->p_buf_tail_idx = &g_wmi_rx_event_buf_idx;
+ rx_event_log_buf->size = WMI_EVENT_DEBUG_MAX_ENTRY;
/* WMI Management commands */
mgmt_cmd_log_buf->length = 0;
mgmt_cmd_log_buf->buf_tail_idx = 0;
mgmt_cmd_log_buf->buf = wmi_mgmt_command_log_buffer;
mgmt_cmd_log_buf->p_buf_tail_idx = &g_wmi_mgmt_command_buf_idx;
+ mgmt_cmd_log_buf->size = WMI_MGMT_EVENT_DEBUG_MAX_ENTRY;
/* WMI Management commands Tx completed*/
mgmt_cmd_tx_cmp_log_buf->length = 0;
@@ -345,12 +350,14 @@ static QDF_STATUS wmi_log_init(struct wmi_unified *wmi_handle)
mgmt_cmd_tx_cmp_log_buf->buf = wmi_mgmt_command_tx_cmp_log_buffer;
mgmt_cmd_tx_cmp_log_buf->p_buf_tail_idx =
&g_wmi_mgmt_command_tx_cmp_buf_idx;
+ mgmt_cmd_tx_cmp_log_buf->size = WMI_MGMT_EVENT_DEBUG_MAX_ENTRY;
/* WMI Management events when processed*/
mgmt_event_log_buf->length = 0;
mgmt_event_log_buf->buf_tail_idx = 0;
mgmt_event_log_buf->buf = wmi_mgmt_event_log_buffer;
mgmt_event_log_buf->p_buf_tail_idx = &g_wmi_mgmt_event_buf_idx;
+ mgmt_event_log_buf->size = WMI_MGMT_EVENT_DEBUG_MAX_ENTRY;
qdf_spinlock_create(&wmi_handle->log_info.wmi_record_lock);
wmi_handle->log_info.wmi_logging_enable = 1;
@@ -384,6 +391,7 @@ static QDF_STATUS wmi_log_init(struct wmi_unified *wmi_handle)
cmd_log_buf->buf_tail_idx = 0;
cmd_log_buf->buf = (struct wmi_command_debug *) qdf_mem_malloc(
wmi_log_max_entry * sizeof(struct wmi_command_debug));
+ cmd_log_buf->size = wmi_log_max_entry;
if (!cmd_log_buf->buf) {
qdf_print("no memory for WMI command log buffer..\n");
@@ -396,6 +404,7 @@ static QDF_STATUS wmi_log_init(struct wmi_unified *wmi_handle)
cmd_tx_cmpl_log_buf->buf_tail_idx = 0;
cmd_tx_cmpl_log_buf->buf = (struct wmi_command_debug *) qdf_mem_malloc(
wmi_log_max_entry * sizeof(struct wmi_command_debug));
+ cmd_tx_cmpl_log_buf->size = wmi_log_max_entry;
if (!cmd_tx_cmpl_log_buf->buf) {
qdf_print("no memory for WMI Command Tx Complete log buffer..\n");
@@ -409,6 +418,7 @@ static QDF_STATUS wmi_log_init(struct wmi_unified *wmi_handle)
event_log_buf->buf_tail_idx = 0;
event_log_buf->buf = (struct wmi_event_debug *) qdf_mem_malloc(
wmi_log_max_entry * sizeof(struct wmi_event_debug));
+ event_log_buf->size = wmi_log_max_entry;
if (!event_log_buf->buf) {
qdf_print("no memory for WMI Event log buffer..\n");
@@ -421,6 +431,7 @@ static QDF_STATUS wmi_log_init(struct wmi_unified *wmi_handle)
rx_event_log_buf->buf_tail_idx = 0;
rx_event_log_buf->buf = (struct wmi_event_debug *) qdf_mem_malloc(
wmi_log_max_entry * sizeof(struct wmi_event_debug));
+ rx_event_log_buf->size = wmi_log_max_entry;
if (!rx_event_log_buf->buf) {
qdf_print("no memory for WMI Event Rx log buffer..\n");
@@ -432,8 +443,8 @@ static QDF_STATUS wmi_log_init(struct wmi_unified *wmi_handle)
mgmt_cmd_log_buf->length = 0;
mgmt_cmd_log_buf->buf_tail_idx = 0;
mgmt_cmd_log_buf->buf = (struct wmi_command_debug *) qdf_mem_malloc(
- wmi_mgmt_log_max_entry *
- sizeof(struct wmi_command_debug));
+ wmi_mgmt_log_max_entry * sizeof(struct wmi_command_debug));
+ mgmt_cmd_log_buf->size = wmi_mgmt_log_max_entry;
if (!mgmt_cmd_log_buf->buf) {
qdf_print("no memory for WMI Management Command log buffer..\n");
@@ -448,6 +459,7 @@ static QDF_STATUS wmi_log_init(struct wmi_unified *wmi_handle)
qdf_mem_malloc(
wmi_mgmt_log_max_entry *
sizeof(struct wmi_command_debug));
+ mgmt_cmd_tx_cmp_log_buf->size = wmi_mgmt_log_max_entry;
if (!mgmt_cmd_tx_cmp_log_buf->buf) {
qdf_print("no memory for WMI Management Command Tx complete log buffer..\n");
@@ -463,6 +475,7 @@ static QDF_STATUS wmi_log_init(struct wmi_unified *wmi_handle)
mgmt_event_log_buf->buf = (struct wmi_event_debug *) qdf_mem_malloc(
wmi_mgmt_log_max_entry *
sizeof(struct wmi_event_debug));
+ mgmt_event_log_buf->size = wmi_mgmt_log_max_entry;
if (!mgmt_event_log_buf->buf) {
qdf_print("no memory for WMI Management Event log buffer..\n");
@@ -517,6 +530,175 @@ static inline void wmi_log_buffer_free(struct wmi_unified *wmi_handle)
}
#endif
+/**
+ * wmi_print_cmd_log_buffer() - an output agnostic wmi command log printer
+ * @log_buffer: the command log buffer metadata of the buffer to print
+ * @count: the maximum number of entries to print
+ * @print: an abstract print method, e.g. a qdf_print() or seq_printf() wrapper
+ * @print_priv: any data required by the print method, e.g. a file handle
+ *
+ * Return: None
+ */
+static void
+wmi_print_cmd_log_buffer(struct wmi_log_buf_t *log_buffer, uint32_t count,
+ qdf_abstract_print *print, void *print_priv)
+{
+ static const int data_len =
+ WMI_EVENT_DEBUG_ENTRY_MAX_LENGTH / sizeof(uint32_t);
+ char str[128];
+ uint32_t idx;
+
+ if (count > log_buffer->size)
+ count = log_buffer->size;
+ if (count > log_buffer->length)
+ count = log_buffer->length;
+
+ /* subtract count from index, and wrap if necessary */
+ idx = log_buffer->size + *log_buffer->p_buf_tail_idx - count;
+ idx %= log_buffer->size;
+
+ print(print_priv, "Time (seconds) Cmd Id Payload");
+ while (count) {
+ struct wmi_command_debug *cmd_log = (struct wmi_command_debug *)
+ &((struct wmi_command_debug *)log_buffer->buf)[idx];
+ long long us = qdf_log_timestamp_to_usecs(cmd_log->time);
+ int len = 0;
+ int i;
+
+ len += scnprintf(str + len, sizeof(str) - len,
+ "% 8lld.%06lld %6u (0x%06x) ",
+ us / 1000000, us % 1000000,
+ cmd_log->command, cmd_log->command);
+ for (i = 0; i < data_len; ++i) {
+ len += scnprintf(str + len, sizeof(str) - len,
+ "0x%08x ", cmd_log->data[i]);
+ }
+
+ print(print_priv, str);
+
+ --count;
+ ++idx;
+ if (idx >= log_buffer->size)
+ idx = 0;
+ }
+}
+
+/**
+ * wmi_print_event_log_buffer() - an output agnostic wmi event log printer
+ * @log_buffer: the event log buffer metadata of the buffer to print
+ * @count: the maximum number of entries to print
+ * @print: an abstract print method, e.g. a qdf_print() or seq_printf() wrapper
+ * @print_priv: any data required by the print method, e.g. a file handle
+ *
+ * Return: None
+ */
+static void
+wmi_print_event_log_buffer(struct wmi_log_buf_t *log_buffer, uint32_t count,
+ qdf_abstract_print *print, void *print_priv)
+{
+ static const int data_len =
+ WMI_EVENT_DEBUG_ENTRY_MAX_LENGTH / sizeof(uint32_t);
+ char str[128];
+ uint32_t idx;
+
+ if (count > log_buffer->size)
+ count = log_buffer->size;
+ if (count > log_buffer->length)
+ count = log_buffer->length;
+
+ /* subtract count from index, and wrap if necessary */
+ idx = log_buffer->size + *log_buffer->p_buf_tail_idx - count;
+ idx %= log_buffer->size;
+
+ print(print_priv, "Time (seconds) Event Id Payload");
+ while (count) {
+ struct wmi_event_debug *event_log = (struct wmi_event_debug *)
+ &((struct wmi_event_debug *)log_buffer->buf)[idx];
+ long long us = qdf_log_timestamp_to_usecs(event_log->time);
+ int len = 0;
+ int i;
+
+ len += scnprintf(str + len, sizeof(str) - len,
+ "% 8lld.%06lld %6u (0x%06x) ",
+ us / 1000000, us % 1000000,
+ event_log->event, event_log->event);
+ for (i = 0; i < data_len; ++i) {
+ len += scnprintf(str + len, sizeof(str) - len,
+ "0x%08x ", event_log->data[i]);
+ }
+
+ print(print_priv, str);
+
+ --count;
+ ++idx;
+ if (idx >= log_buffer->size)
+ idx = 0;
+ }
+}
+
+inline void
+wmi_print_cmd_log(wmi_unified_t wmi, uint32_t count,
+ qdf_abstract_print *print, void *print_priv)
+{
+ wmi_print_cmd_log_buffer(
+ &wmi->log_info.wmi_command_log_buf_info,
+ count, print, print_priv);
+}
+
+inline void
+wmi_print_cmd_tx_cmp_log(wmi_unified_t wmi, uint32_t count,
+ qdf_abstract_print *print, void *print_priv)
+{
+ wmi_print_cmd_log_buffer(
+ &wmi->log_info.wmi_command_tx_cmp_log_buf_info,
+ count, print, print_priv);
+}
+
+inline void
+wmi_print_mgmt_cmd_log(wmi_unified_t wmi, uint32_t count,
+ qdf_abstract_print *print, void *print_priv)
+{
+ wmi_print_cmd_log_buffer(
+ &wmi->log_info.wmi_mgmt_command_log_buf_info,
+ count, print, print_priv);
+}
+
+inline void
+wmi_print_mgmt_cmd_tx_cmp_log(wmi_unified_t wmi, uint32_t count,
+ qdf_abstract_print *print, void *print_priv)
+{
+ wmi_print_cmd_log_buffer(
+ &wmi->log_info.wmi_mgmt_command_tx_cmp_log_buf_info,
+ count, print, print_priv);
+}
+
+inline void
+wmi_print_event_log(wmi_unified_t wmi, uint32_t count,
+ qdf_abstract_print *print, void *print_priv)
+{
+ wmi_print_event_log_buffer(
+ &wmi->log_info.wmi_event_log_buf_info,
+ count, print, print_priv);
+}
+
+inline void
+wmi_print_rx_event_log(wmi_unified_t wmi, uint32_t count,
+ qdf_abstract_print *print, void *print_priv)
+{
+ wmi_print_event_log_buffer(
+ &wmi->log_info.wmi_rx_event_log_buf_info,
+ count, print, print_priv);
+}
+
+inline void
+wmi_print_mgmt_event_log(wmi_unified_t wmi, uint32_t count,
+ qdf_abstract_print *print, void *print_priv)
+{
+ wmi_print_event_log_buffer(
+ &wmi->log_info.wmi_mgmt_event_log_buf_info,
+ count, print, print_priv);
+}
+
#ifdef CONFIG_MCL
const int8_t * const debugfs_dir[] = {"WMI0", "WMI1", "WMI2"};
#else
@@ -1781,8 +1963,8 @@ wmi_unified_connect_htc_service(struct wmi_unified *wmi_handle,
{
int status;
- HTC_SERVICE_CONNECT_RESP response;
- HTC_SERVICE_CONNECT_REQ connect;
+ struct htc_service_connect_resp response;
+ struct htc_service_connect_req connect;
OS_MEMZERO(&connect, sizeof(connect));
OS_MEMZERO(&response, sizeof(response));
diff --git a/wmi/src/wmi_unified_api.c b/wmi/src/wmi_unified_api.c
index 232cb9becc7a..a81b0bc9ba6b 100644
--- a/wmi/src/wmi_unified_api.c
+++ b/wmi/src/wmi_unified_api.c
@@ -6261,3 +6261,24 @@ QDF_STATUS wmi_unified_get_rcpi_cmd(void *wmi_hdl,
return QDF_STATUS_E_FAILURE;
}
+
+/**
+ * wmi_unified_send_dbs_scan_sel_params_cmd() - send wmi cmd of
+ * DBS scan selection configuration params
+ * @wma_handle: wma handler
+ * @dbs_scan_params: pointer to wmi_dbs_scan_sel_params
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF failure reason code for failure
+ */
+QDF_STATUS wmi_unified_send_dbs_scan_sel_params_cmd(void *wmi_hdl,
+ struct wmi_dbs_scan_sel_params *dbs_scan_params)
+{
+ wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+ if (wmi_handle->ops->send_dbs_scan_sel_params_cmd)
+ return wmi_handle->ops->
+ send_dbs_scan_sel_params_cmd(wmi_handle,
+ dbs_scan_params);
+
+ return QDF_STATUS_E_FAILURE;
+}
diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c
index 51619a946e9b..329c930549e5 100644
--- a/wmi/src/wmi_unified_tlv.c
+++ b/wmi/src/wmi_unified_tlv.c
@@ -1534,6 +1534,7 @@ QDF_STATUS send_scan_start_cmd_tlv(wmi_unified_t wmi_handle,
cmd->num_ssids = params->num_ssids;
cmd->ie_len = params->ie_len;
cmd->n_probes = params->n_probes;
+ cmd->scan_ctrl_flags_ext = params->scan_ctrl_flags_ext;
/* mac randomization attributes */
if (params->enable_scan_randomization) {
@@ -1553,7 +1554,8 @@ QDF_STATUS send_scan_start_cmd_tlv(wmi_unified_t wmi_handle,
cmd->num_vendor_oui = params->num_vendor_oui;
}
- WMI_LOGD("scan_ctrl_flags = %x", cmd->scan_ctrl_flags);
+ WMI_LOGD("scan_ctrl_flags = %x, scan_ctrl_flags_ext = %x",
+ cmd->scan_ctrl_flags, cmd->scan_ctrl_flags_ext);
buf_ptr += sizeof(*cmd);
tmp_ptr = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE);
@@ -4869,6 +4871,72 @@ QDF_STATUS send_adapt_dwelltime_params_cmd_tlv(wmi_unified_t wmi_handle,
return QDF_STATUS_SUCCESS;
}
+/**
+ * send_dbs_scan_sel_params_cmd_tlv() - send wmi cmd of DBS scan selection
+ * configuration params
+ * @wmi_handle: wmi handler
+ * @dbs_scan_params: pointer to wmi_dbs_scan_sel_params
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF failure reason code for failure
+ */
+static
+QDF_STATUS send_dbs_scan_sel_params_cmd_tlv(wmi_unified_t wmi_handle,
+ struct wmi_dbs_scan_sel_params *dbs_scan_params)
+{
+ wmi_scan_dbs_duty_cycle_fixed_param *dbs_scan_param;
+ wmi_scan_dbs_duty_cycle_tlv_param *cmd;
+ wmi_buf_t buf;
+ uint8_t *buf_ptr;
+ QDF_STATUS err;
+ uint32_t i;
+ int len;
+
+ len = sizeof(*dbs_scan_param);
+ len += WMI_TLV_HDR_SIZE;
+ len += dbs_scan_params->num_clients * sizeof(*cmd);
+
+ buf = wmi_buf_alloc(wmi_handle, len);
+ if (!buf) {
+ WMI_LOGE("%s:Failed to allocate buffer to send cmd", __func__);
+ return QDF_STATUS_E_NOMEM;
+ }
+
+ buf_ptr = (uint8_t *) wmi_buf_data(buf);
+ dbs_scan_param = (wmi_scan_dbs_duty_cycle_fixed_param *) buf_ptr;
+ WMITLV_SET_HDR(&dbs_scan_param->tlv_header,
+ WMITLV_TAG_STRUC_wmi_scan_dbs_duty_cycle_fixed_param,
+ WMITLV_GET_STRUCT_TLVLEN
+ (wmi_scan_dbs_duty_cycle_fixed_param));
+
+ dbs_scan_param->num_clients = dbs_scan_params->num_clients;
+ dbs_scan_param->pdev_id = dbs_scan_params->pdev_id;
+ buf_ptr += sizeof(*dbs_scan_param);
+ WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
+ (sizeof(*cmd) * dbs_scan_params->num_clients));
+ buf_ptr = buf_ptr + (uint8_t) WMI_TLV_HDR_SIZE;
+
+ for (i = 0; i < dbs_scan_params->num_clients; i++) {
+ cmd = (wmi_scan_dbs_duty_cycle_tlv_param *) buf_ptr;
+ WMITLV_SET_HDR(&cmd->tlv_header,
+ WMITLV_TAG_STRUC_wmi_scan_dbs_duty_cycle_param_tlv,
+ WMITLV_GET_STRUCT_TLVLEN(
+ wmi_scan_dbs_duty_cycle_tlv_param));
+ cmd->module_id = dbs_scan_params->module_id[i];
+ cmd->num_dbs_scans = dbs_scan_params->num_dbs_scans[i];
+ cmd->num_non_dbs_scans = dbs_scan_params->num_non_dbs_scans[i];
+ buf_ptr = buf_ptr + (uint8_t) sizeof(*cmd);
+ }
+
+ err = wmi_unified_cmd_send(wmi_handle, buf,
+ len, WMI_SET_SCAN_DBS_DUTY_CYCLE_CMDID);
+ if (QDF_IS_STATUS_ERROR(err)) {
+ WMI_LOGE("Failed to send dbs scan selection cmd err=%d", err);
+ wmi_buf_free(buf);
+ return QDF_STATUS_E_FAILURE;
+ }
+
+ return QDF_STATUS_SUCCESS;
+}
/**
* send_roam_scan_filter_cmd_tlv() - Filter to be applied while roaming
@@ -9558,7 +9626,6 @@ void wmi_copy_resource_config(wmi_resource_config *resource_cfg,
tgt_res_cfg->num_ocb_channels;
resource_cfg->num_ocb_schedules =
tgt_res_cfg->num_ocb_schedules;
-
}
#ifdef CONFIG_MCL
/**
@@ -13114,6 +13181,8 @@ struct wmi_ops tlv_ops = {
.send_set_active_bpf_mode_cmd = send_set_active_bpf_mode_cmd_tlv,
.send_adapt_dwelltime_params_cmd =
send_adapt_dwelltime_params_cmd_tlv,
+ .send_dbs_scan_sel_params_cmd =
+ send_dbs_scan_sel_params_cmd_tlv,
.init_cmd_send = init_cmd_send_tlv,
.get_target_cap_from_service_ready = extract_service_ready_tlv,
.extract_hal_reg_cap = extract_hal_reg_cap_tlv,