diff --git a/dp/inc/cdp_txrx_cmn.h b/dp/inc/cdp_txrx_cmn.h index 594b07901d..f9184f72c1 100644 --- a/dp/inc/cdp_txrx_cmn.h +++ b/dp/inc/cdp_txrx_cmn.h @@ -1019,7 +1019,6 @@ static inline void cdp_flush_cache_rx_queue(ol_txrx_soc_handle soc) if (!soc->ops->cmn_drv_ops || !soc->ops->cmn_drv_ops->flush_cache_rx_queue) return; - soc->ops->cmn_drv_ops->flush_cache_rx_queue(); } @@ -1241,7 +1240,7 @@ cdp_pdev_set_dp_txrx_handle(ol_txrx_soc_handle soc, void *pdev, void *dp_hdl) soc->ops->cmn_drv_ops->set_dp_txrx_handle(pdev, dp_hdl); } -/** +/* * cdp_soc_get_dp_txrx_handle() - get extended dp handle from soc * @soc: opaque soc handle * @@ -1316,4 +1315,170 @@ cdp_tx_send(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, qdf_nbuf_t nbuf) soc->ops->cmn_drv_ops->tx_send(vdev, nbuf); } + +/* + * cdp_get_pdev_id_frm_pdev() - return pdev_id from pdev + * @soc: opaque soc handle + * @pdev: data path pdev handle + * + * Return: pdev_id + */ +static inline +uint8_t cdp_get_pdev_id_frm_pdev(ol_txrx_soc_handle soc, + struct cdp_pdev *pdev) +{ + if (soc->ops->cmn_drv_ops->txrx_get_pdev_id_frm_pdev) + return soc->ops->cmn_drv_ops->txrx_get_pdev_id_frm_pdev(pdev); + return 0; +} + +/** + * cdp_set_nac() - set nac + * @soc: opaque soc handle + * @peer: data path peer handle + * + */ +static inline +void cdp_set_nac(ol_txrx_soc_handle soc, + struct cdp_peer *peer) +{ + if (soc->ops->cmn_drv_ops->txrx_set_nac) + soc->ops->cmn_drv_ops->txrx_set_nac(peer); +} + +/** + * cdp_set_pdev_tx_capture() - set pdev tx_capture + * @soc: opaque soc handle + * @pdev: data path pdev handle + * @val: value of pdev_tx_capture + * + * Return: void + */ +static inline +void cdp_set_pdev_tx_capture(ol_txrx_soc_handle soc, + struct cdp_pdev *pdev, int val) +{ + if (soc->ops->cmn_drv_ops->txrx_set_pdev_tx_capture) + return soc->ops->cmn_drv_ops->txrx_set_pdev_tx_capture(pdev, + val); + +} + +/** + * cdp_get_peer_mac_from_peer_id() - get peer mac addr from peer id + * @soc: opaque soc handle + * @pdev: data path pdev handle + * @peer_id: data path peer id + * @peer_mac: peer_mac + * + * Return: void + */ +static inline +void cdp_get_peer_mac_from_peer_id(ol_txrx_soc_handle soc, + struct cdp_pdev *pdev_handle, + uint32_t peer_id, uint8_t *peer_mac) +{ + if (soc->ops->cmn_drv_ops->txrx_get_peer_mac_from_peer_id) + soc->ops->cmn_drv_ops->txrx_get_peer_mac_from_peer_id( + pdev_handle, peer_id, peer_mac); +} + +/** + * cdp_vdev_tx_lock() - acquire lock + * @soc: opaque soc handle + * @vdev: data path vdev handle + * + * Return: void + */ +static inline +void cdp_vdev_tx_lock(ol_txrx_soc_handle soc, + struct cdp_vdev *vdev) +{ + if (soc->ops->cmn_drv_ops->txrx_vdev_tx_lock) + soc->ops->cmn_drv_ops->txrx_vdev_tx_lock(vdev); +} + +/** + * cdp_vdev_tx_unlock() - release lock + * @soc: opaque soc handle + * @vdev: data path vdev handle + * + * Return: void + */ +static inline +void cdp_vdev_tx_unlock(ol_txrx_soc_handle soc, + struct cdp_vdev *vdev) +{ + if (soc->ops->cmn_drv_ops->txrx_vdev_tx_unlock) + soc->ops->cmn_drv_ops->txrx_vdev_tx_unlock(vdev); +} + +/** + * cdp_ath_getstats() - get updated athstats + * @soc: opaque soc handle + * @pdev: data path pdev handle + * @net_device_stats: interface stats + * @rtnl_link_stats64: device statistics structure + * + * Return: void + */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36) +static inline void cdp_ath_getstats(ol_txrx_soc_handle soc, + struct cdp_pdev *pdev, struct net_device_stats *stats) +#else +static inline void cdp_ath_getstats(ol_txrx_soc_handle soc, + struct cdp_pdev *pdev, struct rtnl_link_stats64 *stats) +#endif +{ + if (soc && soc->ops && soc->ops->cmn_drv_ops->txrx_ath_getstats) + soc->ops->cmn_drv_ops->txrx_ath_getstats(pdev, stats); +} + +/** + * cdp_set_gid_flag() - set groupid flag + * @soc: opaque soc handle + * @pdev: data path pdev handle + * @mem_status: member status from grp management frame + * @user_position: user position from grp management frame + * + * Return: void + */ +static inline +void cdp_set_gid_flag(ol_txrx_soc_handle soc, + struct cdp_pdev *pdev, u_int8_t *mem_status, + u_int8_t *user_position) +{ + if (soc->ops->cmn_drv_ops->txrx_set_gid_flag) + soc->ops->cmn_drv_ops->txrx_set_gid_flag(pdev, mem_status, user_position); +} + +/** + * cdp_fw_supported_enh_stats_version() - returns the fw enhanced stats version + * @soc: opaque soc handle + * @pdev: data path pdev handle + * + */ +static inline +uint32_t cdp_fw_supported_enh_stats_version(ol_txrx_soc_handle soc, + struct cdp_pdev *pdev) +{ + if (soc->ops->cmn_drv_ops->txrx_fw_supported_enh_stats_version) + return soc->ops->cmn_drv_ops->txrx_fw_supported_enh_stats_version(pdev); + return 0; +} + +/** + * cdp_get_pdev_id_frm_pdev() - return pdev_id from pdev + * @soc: opaque soc handle + * @ni: associated node + * @force: number of frame in SW queue + * Return: void + */ +static inline +void cdp_if_mgmt_drain(ol_txrx_soc_handle soc, + void *ni, int force) +{ + if (soc->ops->cmn_drv_ops->txrx_if_mgmt_drain) + soc->ops->cmn_drv_ops->txrx_if_mgmt_drain(ni, force); +} #endif /* _CDP_TXRX_CMN_H_ */ diff --git a/dp/inc/cdp_txrx_cmn_struct.h b/dp/inc/cdp_txrx_cmn_struct.h index e30ddb4e07..8af78a3a77 100644 --- a/dp/inc/cdp_txrx_cmn_struct.h +++ b/dp/inc/cdp_txrx_cmn_struct.h @@ -82,6 +82,7 @@ #define CDP_MU_MAX_USERS 8 #define CDP_MU_MAX_USER_INDEX (CDP_MU_MAX_USERS - 1) +#define CDP_INVALID_PEER 0xffff #define CDP_DATA_TID_MAX 8 /* @@ -215,12 +216,33 @@ enum cdp_ppdu_ftype { * translation is a simple shift operation. */ enum htt_cmn_pkt_type { - htt_cmn_pkt_type_raw = 0, - htt_cmn_pkt_type_native_wifi = 1, - htt_cmn_pkt_type_ethernet = 2, + htt_cmn_pkt_type_raw = 0, + htt_cmn_pkt_type_native_wifi = 1, + htt_cmn_pkt_type_ethernet = 2, + htt_cmn_pkt_type_mgmt = 3, + htt_cmn_pkt_type_eth2 = 4, - /* keep this last */ - htt_cmn_pkt_num_types + /* keep this last */ + htt_cmn_pkt_num_types +}; + +/** + * @General description of HTT received packets status + * It is similar to htt_rx_status enum + * but is added as a cdp enum can be freely used in OL_IF layer + */ +enum htt_cmn_rx_status { + htt_cmn_rx_status_unknown = 0x0, + htt_cmn_rx_status_ok, + htt_cmn_rx_status_err_fcs, + htt_cmn_rx_status_err_dup, + htt_cmn_rx_status_err_replay, + htt_cmn_rx_status_inv_peer, + htt_cmn_rx_status_ctrl_mgmt_null = 0x08, + htt_cmn_rx_status_tkip_mic_err = 0x09, + htt_cmn_rx_status_decrypt_err = 0x0A, + htt_cmn_rx_status_mpdu_length_err = 0x0B, + htt_cmn_rx_status_err_misc = 0xFF }; diff --git a/dp/inc/cdp_txrx_ctrl_def.h b/dp/inc/cdp_txrx_ctrl_def.h index 93d86763fb..d91e7cce06 100644 --- a/dp/inc/cdp_txrx_ctrl_def.h +++ b/dp/inc/cdp_txrx_ctrl_def.h @@ -60,8 +60,8 @@ void ol_ll_pdev_tx_unlock(void *); #define OL_TX_DESC_LOCK(_x) qdf_spin_lock_bh(_x) #define OL_TX_DESC_UNLOCK(_x) qdf_spin_unlock_bh(_x) -#define OSIF_VAP_TX_LOCK(_x) spin_lock(&((_x)->tx_lock)) -#define OSIF_VAP_TX_UNLOCK(_x) spin_unlock(&((_x)->tx_lock)) +#define OSIF_VAP_TX_LOCK(_y, _x) spin_lock(&((_x)->tx_lock)) +#define OSIF_VAP_TX_UNLOCK(_y, _x) spin_unlock(&((_x)->tx_lock)) #define OL_TX_PEER_LOCK(_x, _id) qdf_spin_lock_bh(&((_x)->peer_lock[_id])) #define OL_TX_PEER_UNLOCK(_x, _id) qdf_spin_unlock_bh(&((_x)->peer_lock[_id])) @@ -72,10 +72,10 @@ void ol_ll_pdev_tx_unlock(void *); qdf_spin_unlock_bh(&((_x)->peer_lock[_id])) #else -#define OSIF_VAP_TX_LOCK(_x) ol_ll_pdev_tx_lock( \ - wlan_vdev_get_dp_handle((_x)->os_if_vdev)) -#define OSIF_VAP_TX_UNLOCK(_x) ol_ll_pdev_tx_unlock( \ - wlan_vdev_get_dp_handle((_x)->os_if_vdev)) +#define OSIF_VAP_TX_LOCK(_y, _x) cdp_vdev_tx_lock( \ + _y, wlan_vdev_get_dp_handle((_x)->os_if_vdev)) +#define OSIF_VAP_TX_UNLOCK(_y, _x) cdp_vdev_tx_unlock( \ + _y, wlan_vdev_get_dp_handle((_x)->os_if_vdev)) #define OL_TX_FLOW_CTRL_LOCK(_x) #define OL_TX_FLOW_CTRL_UNLOCK(_x) diff --git a/dp/inc/cdp_txrx_host_stats.h b/dp/inc/cdp_txrx_host_stats.h index 67165dbc10..6ac24b7246 100644 --- a/dp/inc/cdp_txrx_host_stats.h +++ b/dp/inc/cdp_txrx_host_stats.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -423,7 +423,7 @@ static inline void cdp_get_dp_htt_stats(ol_txrx_soc_handle soc, */ #if defined(QCA_SUPPORT_SON) || defined(ENHANCED_STATS) -uint32_t *ol_txrx_get_en_stats_base(ol_txrx_pdev_handle txrx_pdev, uint32_t *msg_word, +uint32_t *ol_txrx_get_en_stats_base(struct cdp_pdev *pdev, uint32_t *msg_word, uint32_t msg_len, enum htt_cmn_t2h_en_stats_type *type, enum htt_cmn_t2h_en_stats_status *status); #endif #endif /* _CDP_TXRX_HOST_STATS_H_ */ diff --git a/dp/inc/cdp_txrx_ops.h b/dp/inc/cdp_txrx_ops.h index 9b8ea41a38..3e14c49e93 100644 --- a/dp/inc/cdp_txrx_ops.h +++ b/dp/inc/cdp_txrx_ops.h @@ -123,6 +123,34 @@ struct cdp_cmn_ops { int (*txrx_set_monitor_mode)(struct cdp_vdev *vdev, uint8_t smart_monitor); + uint8_t (*txrx_get_pdev_id_frm_pdev)(struct cdp_pdev *pdev); + + void (*txrx_set_nac)(struct cdp_peer *peer); + + void (*txrx_set_pdev_tx_capture)(struct cdp_pdev *pdev, int val); + + void (*txrx_get_peer_mac_from_peer_id) + (struct cdp_pdev *pdev_handle, + uint32_t peer_id, uint8_t *peer_mac); + + void (*txrx_vdev_tx_lock)(struct cdp_vdev *vdev); + + void (*txrx_vdev_tx_unlock)(struct cdp_vdev *vdev); + + void (*txrx_ath_getstats)(struct cdp_pdev *pdev, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) + struct rtnl_link_stats64 *stats); +#else + struct net_device_stats *stats); +#endif + + void (*txrx_set_gid_flag)(struct cdp_pdev *pdev, u_int8_t *mem_status, + u_int8_t *user_position); + + uint32_t (*txrx_fw_supported_enh_stats_version)(struct cdp_pdev *pdev); + + void (*txrx_if_mgmt_drain)(void *ni, int force); + void (*txrx_set_curchan)(struct cdp_pdev *pdev, uint32_t chan_mhz); void (*txrx_set_privacy_filters) diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index e1fbf6a37d..66c81b8299 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -4014,6 +4014,7 @@ static struct cdp_cfg *dp_get_ctrl_pdev_from_vdev_wifi3(struct cdp_vdev *pvdev) return (struct cdp_cfg *)pdev->wlan_cfg_ctx; } + /** * dp_reset_monitor_mode() - Disable monitor mode * @pdev_handle: Datapath PDEV handle @@ -4043,6 +4044,56 @@ static int dp_reset_monitor_mode(struct cdp_pdev *pdev_handle) return 0; } + +/** + * dp_set_nac() - set peer_nac + * @peer_handle: Datapath PEER handle + * + * Return: void + */ +static void dp_set_nac(struct cdp_peer *peer_handle) +{ + struct dp_peer *peer = (struct dp_peer *)peer_handle; + + peer->nac = 1; +} + +/** + * dp_get_tx_pending() - read pending tx + * @pdev_handle: Datapath PDEV handle + * + * Return: outstanding tx + */ +static int dp_get_tx_pending(struct cdp_pdev *pdev_handle) +{ + struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; + + return qdf_atomic_read(&pdev->num_tx_outstanding); +} + +/** + * dp_get_peer_mac_from_peer_id() - get peer mac + * @pdev_handle: Datapath PDEV handle + * @peer_id: Peer ID + * @peer_mac: MAC addr of PEER + * + * Return: void + */ +static void dp_get_peer_mac_from_peer_id(struct cdp_pdev *pdev_handle, + uint32_t peer_id, uint8_t *peer_mac) +{ + struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; + struct dp_peer *peer; + + if (pdev && peer_mac) { + peer = dp_peer_find_by_id(pdev->soc, (uint16_t)peer_id); + if (peer && peer->mac_addr.raw) { + qdf_mem_copy(peer_mac, peer->mac_addr.raw, + DP_MAC_ADDR_LEN); + } + } +} + /** * dp_vdev_set_monitor_mode() - Set DP VDEV to monitor mode * @vdev_handle: Datapath VDEV handle @@ -4272,6 +4323,20 @@ static int dp_pdev_set_advance_monitor_filter(struct cdp_pdev *pdev_handle, return QDF_STATUS_SUCCESS; } +/** + * dp_get_pdev_id_frm_pdev() - get pdev_id + * @pdev_handle: Datapath PDEV handle + * + * Return: pdev_id + */ +static +uint8_t dp_get_pdev_id_frm_pdev(struct cdp_pdev *pdev_handle) +{ + struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; + + return pdev->pdev_id; +} + /** * dp_vdev_get_filter_ucast_data() - get DP VDEV monitor ucast filter * @vdev_handle: Datapath VDEV handle @@ -6384,6 +6449,11 @@ static struct cdp_cmn_ops dp_ops_cmn = { .txrx_stats = dp_txrx_stats, .txrx_stats_request = dp_txrx_stats_request, .txrx_set_monitor_mode = dp_vdev_set_monitor_mode, + .txrx_get_pdev_id_frm_pdev = dp_get_pdev_id_frm_pdev, + .txrx_set_nac = dp_set_nac, + .txrx_get_tx_pending = dp_get_tx_pending, + .txrx_set_pdev_tx_capture = dp_config_debug_sniffer, + .txrx_get_peer_mac_from_peer_id = dp_get_peer_mac_from_peer_id, .display_stats = dp_txrx_dump_stats, .txrx_soc_set_nss_cfg = dp_soc_set_nss_cfg_wifi3, .txrx_soc_get_nss_cfg = dp_soc_get_nss_cfg_wifi3, diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index 7144dbdf54..dbd6a13b0e 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -1343,6 +1343,8 @@ struct dp_peer { /* set when node is authorized */ uint8_t authorize:1; + u_int8_t nac; + /* Band steering: Set when node is inactive */ uint8_t peer_bs_inact_flag:1; u_int16_t peer_bs_inact; /* inactivity mark count */