Merge "qcacld-3.0: add ini config for PTP options" into wlan-cld3.driver.lnx.2.0-dev

This commit is contained in:
CNSS_WLAN Service 2017-10-12 20:02:00 -07:00 • committed by Gerrit - the friendly Code Review server
commit 2d44577572
12 changed files with 232 additions and 34 deletions

View file

@ -97,15 +97,6 @@ ol_usb_extra_initialization(struct ol_context *ol_ctx)
return status;
}
#if defined(WLAN_FEATURE_TSF_PLUS)
#define SDIO_HI_ACS_FLAGS (HI_ACS_FLAGS_SDIO_SWAP_MAILBOX_SET | \
HI_ACS_FLAGS_ALT_DATA_CREDIT_SIZE)
#else
#define SDIO_HI_ACS_FLAGS (HI_ACS_FLAGS_SDIO_SWAP_MAILBOX_SET | \
HI_ACS_FLAGS_SDIO_REDUCE_TX_COMPL_SET | \
HI_ACS_FLAGS_ALT_DATA_CREDIT_SIZE)
#endif
/*Setting SDIO block size, mbox ISR yield limit for SDIO based HIF*/
static
QDF_STATUS ol_sdio_extra_initialization(struct ol_context *ol_ctx)
@ -173,7 +164,11 @@ QDF_STATUS ol_sdio_extra_initialization(struct ol_context *ol_ctx)
goto exit;
}
param |= SDIO_HI_ACS_FLAGS;
param |= (HI_ACS_FLAGS_SDIO_SWAP_MAILBOX_SET |
HI_ACS_FLAGS_ALT_DATA_CREDIT_SIZE);
if (!cds_is_ptp_tx_opt_enabled())
param |= HI_ACS_FLAGS_SDIO_REDUCE_TX_COMPL_SET;
/* enable TX completion to collect tx_desc for pktlog */
if (cds_is_packet_log_enabled())

View file

@ -393,6 +393,22 @@ void cds_get_and_reset_log_completion(uint32_t *is_fatal,
bool *recovery_needed);
bool cds_is_log_report_in_progress(void);
bool cds_is_fatal_event_enabled(void);
#ifdef WLAN_FEATURE_TSF_PLUS
bool cds_is_ptp_rx_opt_enabled(void);
bool cds_is_ptp_tx_opt_enabled(void);
#else
static inline bool cds_is_ptp_rx_opt_enabled(void)
{
return false;
}
static inline bool cds_is_ptp_tx_opt_enabled(void)
{
return false;
}
#endif
uint32_t cds_get_log_indicator(void);
void cds_set_fatal_event(bool value);
void cds_wlan_flush_host_logs_for_fatal(void);

View file

@ -43,6 +43,7 @@
#include "cds_reg_service.h"
#include "wma_types.h"
#include "wlan_hdd_main.h"
#include "wlan_hdd_tsf.h"
#include <linux/vmalloc.h>
#include "pld_common.h"
@ -316,6 +317,10 @@ static void cds_cdp_cfg_attach(struct cds_config_info *cds_cfg)
*/
cdp_cfg_set_packet_log_enabled(soc, gp_cds_context->cfg_ctx,
(uint8_t)cds_is_packet_log_enabled());
/* adjust the ptp rx option default value based on CFG INI setting */
cdp_cfg_set_ptp_rx_opt_enabled(soc, gp_cds_context->cfg_ctx,
(uint8_t)cds_is_ptp_rx_opt_enabled());
}
static QDF_STATUS cds_register_all_modules(void)
{
@ -2217,6 +2222,52 @@ bool cds_is_fatal_event_enabled(void)
return p_cds_context->enable_fatal_event;
}
#ifdef WLAN_FEATURE_TSF_PLUS
bool cds_is_ptp_rx_opt_enabled(void)
{
struct hdd_context *hdd_ctx;
p_cds_contextType p_cds_context;
p_cds_context = cds_get_global_context();
if (!p_cds_context) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s: cds context is Invalid", __func__);
return false;
}
hdd_ctx = (struct hdd_context *)(p_cds_context->pHDDContext);
if ((NULL == hdd_ctx) || (NULL == hdd_ctx->config)) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s: Hdd Context is Null", __func__);
return false;
}
return HDD_TSF_IS_RX_SET(hdd_ctx);
}
bool cds_is_ptp_tx_opt_enabled(void)
{
struct hdd_context *hdd_ctx;
p_cds_contextType p_cds_context;
p_cds_context = cds_get_global_context();
if (!p_cds_context) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s: cds context is Invalid", __func__);
return false;
}
hdd_ctx = (struct hdd_context *)(p_cds_context->pHDDContext);
if ((NULL == hdd_ctx) || (NULL == hdd_ctx->config)) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s: Hdd Context is Null", __func__);
return false;
}
return HDD_TSF_IS_TX_SET(hdd_ctx);
}
#endif
/**
* cds_get_log_indicator() - Get the log flush indicator
*

View file

@ -86,6 +86,9 @@ struct txrx_pdev_cfg_t {
u8 rx_fwd_disabled;
u8 is_packet_log_enabled;
u8 is_full_reorder_offload;
#ifdef WLAN_FEATURE_TSF_PLUS
u8 is_ptp_rx_opt_enabled;
#endif
struct wlan_ipa_uc_rsc_t ipa_uc_rsc;
bool ip_tcp_udp_checksum_offload;
bool enable_rxthread;
@ -425,6 +428,22 @@ int ol_cfg_is_full_reorder_offload(struct cdp_cfg *cfg_pdev);
int ol_cfg_is_rx_thread_enabled(struct cdp_cfg *cfg_pdev);
#ifdef WLAN_FEATURE_TSF_PLUS
void ol_set_cfg_ptp_rx_opt_enabled(struct cdp_cfg *cfg_pdev, u_int8_t val);
u_int8_t ol_cfg_is_ptp_rx_opt_enabled(struct cdp_cfg *cfg_pdev);
#else
static inline void
ol_set_cfg_ptp_rx_opt_enabled(struct cdp_cfg *cfg_pdev, u_int8_t val)
{
}
static inline u_int8_t
ol_cfg_is_ptp_rx_opt_enabled(struct cdp_cfg *cfg_pdev)
{
return 0;
}
#endif
/**
* ol_cfg_is_ip_tcp_udp_checksum_offload_enabled() - return
* ip_tcp_udp_checksum_offload is enable/disable

View file

@ -133,6 +133,9 @@ struct cdp_cfg *ol_pdev_cfg_attach(qdf_device_t osdev, void *pcfg_param)
cfg_ctx->rx_fwd_disabled = 0;
cfg_ctx->is_packet_log_enabled = 0;
cfg_ctx->is_full_reorder_offload = cfg_param->is_full_reorder_offload;
#ifdef WLAN_FEATURE_TSF_PLUS
cfg_ctx->is_ptp_rx_opt_enabled = 0;
#endif
cfg_ctx->ipa_uc_rsc.uc_offload_enabled =
cfg_param->is_uc_offload_enabled;
cfg_ctx->ipa_uc_rsc.tx_max_buf_cnt = cfg_param->uc_tx_buffer_count;
@ -315,6 +318,22 @@ int ol_cfg_is_full_reorder_offload(struct cdp_cfg *cfg_pdev)
return cfg->is_full_reorder_offload;
}
#ifdef WLAN_FEATURE_TSF_PLUS
void ol_set_cfg_ptp_rx_opt_enabled(struct cdp_cfg *cfg_pdev, u_int8_t val)
{
struct txrx_pdev_cfg_t *cfg = (struct txrx_pdev_cfg_t *)cfg_pdev;
cfg->is_ptp_rx_opt_enabled = val;
}
u_int8_t ol_cfg_is_ptp_rx_opt_enabled(struct cdp_cfg *cfg_pdev)
{
struct txrx_pdev_cfg_t *cfg = (struct txrx_pdev_cfg_t *)cfg_pdev;
return cfg->is_ptp_rx_opt_enabled;
}
#endif
/**
* ol_cfg_is_rx_thread_enabled() - return rx_thread is enable/disable
* @pdev : handle to the physical device

View file

@ -1142,20 +1142,25 @@ ol_rx_filter(struct ol_txrx_vdev_t *vdev,
}
#ifdef WLAN_FEATURE_TSF_PLUS
static inline void ol_rx_timestamp(void *rx_desc, qdf_nbuf_t msdu)
static inline void ol_rx_timestamp(struct cdp_cfg *cfg_pdev,
void *rx_desc, qdf_nbuf_t msdu)
{
struct htt_rx_ppdu_desc_t *rx_ppdu_desc;
if (!ol_cfg_is_ptp_rx_opt_enabled(cfg_pdev))
return;
if (!rx_desc || !msdu)
return;
rx_ppdu_desc = (struct htt_rx_ppdu_desc_t *)((uint8_t *)(rx_desc) -
HTT_RX_IND_HL_BYTES + HTT_RX_IND_HDR_PREFIX_BYTES);
msdu->tstamp = ns_to_ktime((u_int64_t)rx_ppdu_desc->tsf32 *
NSEC_PER_USEC);
NSEC_PER_USEC);
}
#else
static inline void ol_rx_timestamp(void *rx_desc, qdf_nbuf_t msdu)
static inline void ol_rx_timestamp(struct cdp_cfg *cfg_pdev,
void *rx_desc, qdf_nbuf_t msdu)
{
}
#endif
@ -1341,7 +1346,7 @@ DONE:
OL_RX_ERR_NONE);
TXRX_STATS_MSDU_INCR(vdev->pdev, rx.delivered, msdu);
ol_rx_timestamp(rx_desc, msdu);
ol_rx_timestamp(pdev->ctrl_pdev, rx_desc, msdu);
OL_TXRX_LIST_APPEND(deliver_list_head,
deliver_list_tail, msdu);
}

View file

@ -5640,6 +5640,7 @@ static struct cdp_cfg_ops ol_ops_cfg = {
.set_flow_control_parameters =
ol_txrx_wrapper_set_flow_control_parameters,
.set_flow_steering = ol_set_cfg_flow_steering,
.set_ptp_rx_opt_enabled = ol_set_cfg_ptp_rx_opt_enabled,
};
static struct cdp_peer_ops ol_ops_peer = {

View file

@ -8920,6 +8920,18 @@ enum dot11p_mode {
#define TSF_GPIO_PIN_INVALID (255)
#define CFG_SET_TSF_GPIO_PIN_DEFAULT (TSF_GPIO_PIN_INVALID)
#ifdef WLAN_FEATURE_TSF_PLUS
/* PTP options */
#define CFG_SET_TSF_PTP_OPT_NAME "gtsf_ptp_options"
#define CFG_SET_TSF_PTP_OPT_MIN (0)
#define CFG_SET_TSF_PTP_OPT_MAX (0xff)
#define CFG_SET_TSF_PTP_OPT_RX (0x1)
#define CFG_SET_TSF_PTP_OPT_TX (0x2)
#define CFG_SET_TSF_PTP_OPT_RAW (0x4)
#define CFG_SET_TSF_DBG_FS (0x8)
#define CFG_SET_TSF_PTP_OPT_DEFAULT (0xf)
#endif
/*
* Dense traffic threshold
* traffic threshold required for dense roam scan
@ -12869,6 +12881,10 @@ struct hdd_config {
uint8_t inform_bss_rssi_raw;
#ifdef WLAN_FEATURE_TSF
uint32_t tsf_gpio_pin;
#ifdef WLAN_FEATURE_TSF_PLUS
uint8_t tsf_ptp_options;
#endif /* WLAN_FEATURE_TSF_PLUS */
#endif
uint32_t roam_dense_traffic_thresh;
uint32_t roam_dense_rssi_thresh_offset;

View file

@ -27,6 +27,7 @@
#if !defined WLAN_HDD_TSF_H
#define WLAN_HDD_TSF_H
#include "wlan_hdd_cfg.h"
struct hdd_context;
@ -169,6 +170,39 @@ static inline int hdd_get_tsf_cb(void *pcb_cxt, struct stsf *ptsf)
#endif
#if defined(WLAN_FEATURE_TSF_PLUS) && defined(WLAN_FEATURE_TSF)
#define HDD_TSF_IS_PTP_ENABLED(hdd) \
({ \
struct hdd_context *hdd_ctx = (hdd); \
hdd_ctx && hdd_ctx->config && hdd_ctx->config->tsf_ptp_options; \
})
#define HDD_TSF_IS_TX_SET(hdd) \
({ \
struct hdd_context *hdd_ctx = (hdd); \
hdd_ctx && hdd_ctx->config && \
(hdd_ctx->config->tsf_ptp_options & CFG_SET_TSF_PTP_OPT_TX); \
})
#define HDD_TSF_IS_RX_SET(hdd) \
({ \
struct hdd_context *hdd_ctx = (hdd); \
hdd_ctx && hdd_ctx->config && \
(hdd_ctx->config->tsf_ptp_options & CFG_SET_TSF_PTP_OPT_RX); \
})
#define HDD_TSF_IS_RAW_SET(hdd) \
({ \
struct hdd_context *hdd_ctx = (hdd); \
hdd_ctx && hdd_ctx->config && \
(hdd_ctx->config->tsf_ptp_options & CFG_SET_TSF_PTP_OPT_RAW); \
})
#define HDD_TSF_IS_DBG_FS_SET(hdd) \
({ \
struct hdd_context *hdd_ctx = (hdd); \
hdd_ctx && hdd_ctx->config && \
(hdd_ctx->config->tsf_ptp_options & CFG_SET_TSF_DBG_FS); \
})
/**
* hdd_start_tsf_sync() - start tsf sync

View file

@ -3939,6 +3939,15 @@ struct reg_table_entry g_registry_table[] = {
CFG_SET_TSF_GPIO_PIN_DEFAULT,
CFG_SET_TSF_GPIO_PIN_MIN,
CFG_SET_TSF_GPIO_PIN_MAX),
#ifdef WLAN_FEATURE_TSF_PLUS
REG_VARIABLE(CFG_SET_TSF_PTP_OPT_NAME, WLAN_PARAM_HexInteger,
struct hdd_config, tsf_ptp_options,
VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
CFG_SET_TSF_PTP_OPT_DEFAULT,
CFG_SET_TSF_PTP_OPT_MIN,
CFG_SET_TSF_PTP_OPT_MAX),
#endif /* WLAN_FEATURE_TSF_PLUS */
#endif
REG_VARIABLE(CFG_ROAM_DENSE_TRAFFIC_THRESHOLD, WLAN_PARAM_Integer,

View file

@ -603,12 +603,11 @@ static inline int32_t hdd_get_targettime_from_hosttime(
return ret;
}
static inline uint64_t hdd_get_monotonic_host_time(void)
static inline
uint64_t hdd_get_monotonic_host_time(struct hdd_context *hdd_ctx)
{
struct timespec ts;
getrawmonotonic(&ts);
return timespec_to_ns(&ts);
return HDD_TSF_IS_RAW_SET(hdd_ctx) ?
ktime_get_ns() : ktime_get_real_ns();
}
static ssize_t __hdd_wlan_tsf_show(struct device *dev,
@ -616,6 +615,7 @@ static ssize_t __hdd_wlan_tsf_show(struct device *dev,
{
struct hdd_station_ctx *hdd_sta_ctx;
struct hdd_adapter *adapter;
struct hdd_context *hdd_ctx;
ssize_t size;
uint64_t host_time, target_time;
@ -633,7 +633,11 @@ static ssize_t __hdd_wlan_tsf_show(struct device *dev,
if (eConnectionState_Associated != hdd_sta_ctx->conn_info.connState)
return scnprintf(buf, PAGE_SIZE, "NOT connected\n");
host_time = hdd_get_monotonic_host_time();
hdd_ctx = WLAN_HDD_GET_CTX(adapter);
if (!hdd_ctx)
return scnprintf(buf, PAGE_SIZE, "Invalid HDD context\n");
host_time = hdd_get_monotonic_host_time(hdd_ctx);
if (hdd_get_targettime_from_hosttime(adapter, host_time,
&target_time))
size = scnprintf(buf, PAGE_SIZE, "Invalid timestamp\n");
@ -680,9 +684,8 @@ static irqreturn_t hdd_tsf_captured_irq_handler(int irq, void *arg)
if (!arg)
return IRQ_NONE;
host_time = hdd_get_monotonic_host_time();
hdd_ctx = (struct hdd_context *)arg;
host_time = hdd_get_monotonic_host_time(hdd_ctx);
adapter = hdd_ctx->cap_tsf_context;
if (!adapter)
@ -742,8 +745,8 @@ static enum hdd_tsf_op_result hdd_tsf_sync_init(struct hdd_adapter *adapter)
}
net_dev = adapter->dev;
if (net_dev)
device_create_file(&net_dev->dev, &dev_attr_tsf);
if (net_dev && HDD_TSF_IS_DBG_FS_SET(hddctx))
device_create_file(&net_dev->dev, &dev_attr_tsf);
hdd_set_th_sync_status(adapter, true);
return HDD_TSF_OP_SUCC;
@ -768,13 +771,6 @@ static enum hdd_tsf_op_result hdd_tsf_sync_deinit(struct hdd_adapter *adapter)
hdd_set_th_sync_status(adapter, false);
net_dev = adapter->dev;
if (net_dev) {
struct device *dev = &net_dev->dev;
device_remove_file(dev, &dev_attr_tsf);
}
ret = qdf_mc_timer_destroy(&adapter->host_target_sync_timer);
if (ret != QDF_STATUS_SUCCESS)
hdd_err("Failed to destroy timer, ret: %d", ret);
@ -794,6 +790,13 @@ static enum hdd_tsf_op_result hdd_tsf_sync_deinit(struct hdd_adapter *adapter)
}
hdd_reset_timestamps(adapter);
net_dev = adapter->dev;
if (net_dev && HDD_TSF_IS_DBG_FS_SET(hddctx)) {
struct device *dev = &net_dev->dev;
device_remove_file(dev, &dev_attr_tsf);
}
return HDD_TSF_OP_SUCC;
}
@ -953,6 +956,11 @@ enum hdd_tsf_op_result wlan_hdd_tsf_plus_init(struct hdd_context *hdd_ctx)
{
int ret;
if (!HDD_TSF_IS_PTP_ENABLED(hdd_ctx)) {
hdd_info("To enable TSF_PLUS, set gtsf_ptp_options in ini");
return HDD_TSF_OP_FAIL;
}
ret = cnss_common_register_tsf_captured_handler(
hdd_ctx->parent_dev,
hdd_tsf_captured_irq_handler,
@ -962,7 +970,8 @@ enum hdd_tsf_op_result wlan_hdd_tsf_plus_init(struct hdd_context *hdd_ctx)
return HDD_TSF_OP_FAIL;
}
ol_register_timestamp_callback(hdd_tx_timestamp);
if (HDD_TSF_IS_TX_SET(hdd_ctx))
ol_register_timestamp_callback(hdd_tx_timestamp);
return HDD_TSF_OP_SUCC;
}
@ -971,7 +980,12 @@ enum hdd_tsf_op_result wlan_hdd_tsf_plus_deinit(struct hdd_context *hdd_ctx)
{
int ret;
ol_deregister_timestamp_callback();
if (!HDD_TSF_IS_PTP_ENABLED(hdd_ctx))
return HDD_TSF_OP_SUCC;
if (HDD_TSF_IS_TX_SET(hdd_ctx))
ol_deregister_timestamp_callback();
ret = cnss_common_unregister_tsf_captured_handler(
hdd_ctx->parent_dev,
(void *)hdd_ctx);

View file

@ -1148,6 +1148,24 @@ static bool hdd_is_rx_wake_lock_needed(struct sk_buff *skb)
return false;
}
#ifdef WLAN_FEATURE_TSF_PLUS
static inline void hdd_tsf_timestamp_rx(struct hdd_context *hdd_ctx,
qdf_nbuf_t netbuf,
uint64_t target_time)
{
if (!HDD_TSF_IS_RX_SET(hdd_ctx))
return;
hdd_rx_timestamp(netbuf, target_time);
}
#else
static inline void hdd_tsf_timestamp_rx(struct hdd_context *hdd_ctx,
qdf_nbuf_t netbuf,
uint64_t target_time)
{
}
#endif
/**
* hdd_rx_packet_cbk() - Receive packet handler
* @context: pointer to HDD context
@ -1295,7 +1313,8 @@ QDF_STATUS hdd_rx_packet_cbk(void *context, qdf_nbuf_t rxBuf)
*/
qdf_net_buf_debug_release_skb(skb);
hdd_rx_timestamp(skb, ktime_to_us(skb->tstamp));
hdd_tsf_timestamp_rx(hdd_ctx, skb, ktime_to_us(skb->tstamp));
if (HDD_LRO_NO_RX ==
hdd_lro_rx(hdd_ctx, adapter, skb)) {
if (hdd_napi_enabled(HDD_NAPI_ANY) &&