qcacmn: Fix epping mode for QCN7605

Epping mode is currently borken in qcacld-3.2 codebase.
Fix epping mode for QCN7605 for USB and PCIe interface.

Change-Id: I5ae5ff70b77836cdd6c3d002cf98d4949838b624
CRs-Fixed: 2400180
Šī revīzija ir iekļauta:
Nirav Shah
2018-07-20 12:00:34 +05:30
revīziju iesūtīja nshrivas
vecāks d1a2dfcdda
revīzija 3e6e04bc0c
6 mainīti faili ar 162 papildinājumiem un 107 dzēšanām

Parādīt failu

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2014-2019 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
@@ -177,7 +177,8 @@ void epping_refill(void *ctx, HTC_ENDPOINT_ID Endpoint);
/* epping_txrx signatures */
epping_adapter_t *epping_add_adapter(epping_context_t *pEpping_ctx,
tSirMacAddr macAddr,
enum QDF_OPMODE device_mode);
enum QDF_OPMODE device_mode,
bool rtnl_held);
void epping_destroy_adapter(epping_adapter_t *adapter);
int epping_connect_service(epping_context_t *pEpping_ctx);
#ifdef HIF_PCI

Parādīt failu

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2014-2019 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
@@ -37,19 +37,21 @@
int epping_open(void);
void epping_close(void);
void epping_disable(void);
int epping_enable(struct device *parent_dev);
int epping_enable(struct device *parent_dev, bool rtnl_held);
void epping_enable_adapter(void);
#else
static inline int epping_open(void)
{
return QDF_STATUS_E_INVAL;
}
static inline int epping_enable(struct device *parent_dev)
static inline int epping_enable(struct device *parent_dev, bool rtnl_held)
{
return QDF_STATUS_E_INVAL;
}
static inline void epping_close(void) {}
static inline void epping_disable(void) {}
static inline void epping_enable_adapter(void) {}
#endif
#endif /* end #ifndef EPPING_MAIN_H */

Parādīt failu

@@ -98,22 +98,17 @@ int epping_open(void)
*/
void epping_disable(void)
{
epping_context_t *pEpping_ctx;
epping_context_t *epping_ctx;
struct hif_opaque_softc *hif_ctx;
HTC_HANDLE htc_handle;
pEpping_ctx = g_epping_ctx;
if (pEpping_ctx == NULL) {
epping_ctx = g_epping_ctx;
if (!epping_ctx) {
EPPING_LOG(QDF_TRACE_LEVEL_FATAL,
"%s: error: pEpping_ctx = NULL", __func__);
"%s: error: epping_ctx = NULL", __func__);
return;
}
if (pEpping_ctx->epping_adapter) {
epping_destroy_adapter(pEpping_ctx->epping_adapter);
pEpping_ctx->epping_adapter = NULL;
}
hif_ctx = cds_get_context(QDF_MODULE_ID_HIF);
if (hif_ctx == NULL) {
EPPING_LOG(QDF_TRACE_LEVEL_FATAL,
@@ -130,8 +125,13 @@ void epping_disable(void)
return;
}
htc_stop(htc_handle);
epping_cookie_cleanup(pEpping_ctx);
epping_cookie_cleanup(epping_ctx);
htc_destroy(htc_handle);
if (epping_ctx->epping_adapter) {
epping_destroy_adapter(epping_ctx->epping_adapter);
epping_ctx->epping_adapter = NULL;
}
}
/**
@@ -145,7 +145,6 @@ void epping_close(void)
{
epping_context_t *to_free;
if (g_epping_ctx == NULL) {
EPPING_LOG(QDF_TRACE_LEVEL_FATAL,
"%s: error: g_epping_ctx = NULL", __func__);
@@ -173,6 +172,7 @@ static void epping_target_suspend_acknowledge(void *context, bool wow_nack)
g_epping_ctx->wow_nack = wow_nack;
}
#ifdef WLAN_FEATURE_BMI
/**
* epping_update_ol_config - API to update ol configuration parameters
*
@@ -194,6 +194,39 @@ static void epping_update_ol_config(void)
ol_init_ini_config(ol_ctx, &cfg);
}
static
QDF_STATUS epping_bmi_download_fw(struct ol_context *ol_ctx)
{
ol_ctx = cds_get_context(QDF_MODULE_ID_BMI);
if (!ol_ctx) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
"%s: ol_ctx is NULL", __func__);
return QDF_STATUS_E_INVAL;
}
epping_update_ol_config();
/* Initialize BMI and Download firmware */
if (bmi_download_firmware(ol_ctx)) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
"%s: BMI failed to download target", __func__);
bmi_cleanup(ol_ctx);
return QDF_STATUS_E_INVAL;
}
EPPING_LOG(QDF_TRACE_LEVEL_INFO_HIGH,
"%s: bmi_download_firmware done", __func__);
return QDF_STATUS_SUCCESS;
}
#else
static
QDF_STATUS epping_bmi_download_fw(struct ol_context *ol_ctx)
{
return QDF_STATUS_SUCCESS;
}
#endif
/**
* epping_enable(): End point ping driver enable Function
*
@@ -202,17 +235,17 @@ static void epping_update_ol_config(void)
*
* return - 0 : success, negative: error
*/
int epping_enable(struct device *parent_dev)
int epping_enable(struct device *parent_dev, bool rtnl_held)
{
int ret = 0;
epping_context_t *pEpping_ctx = NULL;
epping_context_t *epping_ctx = NULL;
struct cds_context *p_cds_context = NULL;
qdf_device_t qdf_ctx;
struct htc_init_info htcInfo;
struct htc_init_info htc_info;
struct hif_opaque_softc *scn;
tSirMacAddr adapter_macAddr;
struct ol_context *ol_ctx = NULL;
struct hif_target_info *tgt_info;
struct ol_context *ol_ctx;
EPPING_LOG(QDF_TRACE_LEVEL_INFO_HIGH, "%s: Enter", __func__);
@@ -225,14 +258,14 @@ int epping_enable(struct device *parent_dev)
return ret;
}
pEpping_ctx = g_epping_ctx;
if (pEpping_ctx == NULL) {
epping_ctx = g_epping_ctx;
if (!epping_ctx) {
EPPING_LOG(QDF_TRACE_LEVEL_FATAL,
"%s: Failed to get pEpping_ctx", __func__);
"%s: Failed to get epping_ctx", __func__);
ret = -1;
return ret;
}
pEpping_ctx->parent_dev = (void *)parent_dev;
epping_ctx->parent_dev = (void *)parent_dev;
epping_get_dummy_mac_addr(adapter_macAddr);
/* Initialize the timer module */
@@ -247,36 +280,19 @@ int epping_enable(struct device *parent_dev)
tgt_info = hif_get_target_info_handle(scn);
if (epping_bmi_download_fw(ol_ctx) != QDF_STATUS_SUCCESS)
return A_ERROR;
/* store target type and target version info in hdd ctx */
pEpping_ctx->target_type = tgt_info->target_type;
epping_ctx->target_type = tgt_info->target_type;
ol_ctx = cds_get_context(QDF_MODULE_ID_BMI);
if (!ol_ctx) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
"%s: ol_ctx is NULL", __func__);
return A_ERROR;
}
epping_update_ol_config();
#ifndef FEATURE_BMI_2
/* Initialize BMI and Download firmware */
if (bmi_download_firmware(ol_ctx)) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
"%s: BMI failed to download target", __func__);
bmi_cleanup(ol_ctx);
return A_ERROR;
}
#endif
EPPING_LOG(QDF_TRACE_LEVEL_INFO_HIGH,
"%s: bmi_download_firmware done", __func__);
htcInfo.pContext = ol_ctx;
htcInfo.TargetFailure = ol_target_failure;
htcInfo.TargetSendSuspendComplete = epping_target_suspend_acknowledge;
htc_info.pContext = NULL;
htc_info.TargetFailure = ol_target_failure;
htc_info.TargetSendSuspendComplete = epping_target_suspend_acknowledge;
qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
/* Create HTC */
p_cds_context->htc_ctx = htc_create(scn, &htcInfo, qdf_ctx,
p_cds_context->htc_ctx = htc_create(scn, &htc_info, qdf_ctx,
cds_get_conparam());
if (!p_cds_context->htc_ctx) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
@@ -284,9 +300,9 @@ int epping_enable(struct device *parent_dev)
bmi_cleanup(ol_ctx);
return A_ERROR;
}
pEpping_ctx->HTCHandle =
epping_ctx->HTCHandle =
cds_get_context(QDF_MODULE_ID_HTC);
if (pEpping_ctx->HTCHandle == NULL) {
if (!epping_ctx->HTCHandle) {
EPPING_LOG(QDF_TRACE_LEVEL_FATAL,
"%s: HTCHandle is NULL", __func__);
return A_ERROR;
@@ -299,36 +315,31 @@ int epping_enable(struct device *parent_dev)
}
/* start HIF */
if (htc_wait_target(pEpping_ctx->HTCHandle) != QDF_STATUS_SUCCESS) {
if (htc_wait_target(epping_ctx->HTCHandle) != QDF_STATUS_SUCCESS) {
EPPING_LOG(QDF_TRACE_LEVEL_FATAL,
"%s: htc_wait_target error", __func__);
goto error_end;
}
EPPING_LOG(QDF_TRACE_LEVEL_INFO_HIGH, "%s: HTC ready", __func__);
ret = epping_connect_service(pEpping_ctx);
ret = epping_connect_service(epping_ctx);
if (ret != 0) {
EPPING_LOG(QDF_TRACE_LEVEL_FATAL,
"%s: htc_wait_targetdone", __func__);
goto error_end;
}
if (htc_start(pEpping_ctx->HTCHandle) != QDF_STATUS_SUCCESS) {
if (htc_start(epping_ctx->HTCHandle) != QDF_STATUS_SUCCESS)
goto error_end;
}
EPPING_LOG(QDF_TRACE_LEVEL_INFO_HIGH, "%s: HTC started", __func__);
/* init the tx cookie resource */
ret = epping_cookie_init(pEpping_ctx);
if (ret == 0) {
pEpping_ctx->epping_adapter = epping_add_adapter(pEpping_ctx,
adapter_macAddr,
QDF_STA_MODE);
}
if (ret < 0 || pEpping_ctx->epping_adapter == NULL) {
ret = epping_cookie_init(epping_ctx);
if (ret < 0) {
EPPING_LOG(QDF_TRACE_LEVEL_FATAL,
"%s: epping_add_adaptererror error", __func__);
htc_stop(pEpping_ctx->HTCHandle);
epping_cookie_cleanup(pEpping_ctx);
"%s: cookie init failed", __func__);
htc_stop(epping_ctx->HTCHandle);
epping_cookie_cleanup(epping_ctx);
goto error_end;
}
@@ -341,4 +352,22 @@ error_end:
bmi_cleanup(ol_ctx);
return A_ERROR;
}
void epping_enable_adapter(void)
{
epping_context_t *epping_ctx = g_epping_ctx;
tSirMacAddr adapter_macaddr;
if (!epping_ctx) {
EPPING_LOG(QDF_TRACE_LEVEL_FATAL, "epping context is NULL");
return;
}
epping_get_dummy_mac_addr(adapter_macaddr);
epping_ctx->epping_adapter = epping_add_adapter(epping_ctx,
adapter_macaddr,
QDF_STA_MODE, true);
if (!epping_ctx->epping_adapter)
EPPING_LOG(QDF_TRACE_LEVEL_FATAL, "epping add adapter failed");
}
#endif

Parādīt failu

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2014-2019 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
@@ -149,6 +149,7 @@ static netdev_tx_t epping_hard_start_xmit(struct sk_buff *skb,
ret = -ENODEV;
goto end;
}
qdf_net_buf_debug_acquire_skb(skb, __FILE__, __LINE__);
ret = epping_tx_send(skb, adapter);
end:
return NETDEV_TX_OK;
@@ -268,11 +269,14 @@ static int epping_start_adapter(epping_adapter_t *adapter)
return 0;
}
static int epping_register_adapter(epping_adapter_t *adapter)
static int epping_register_adapter(epping_adapter_t *adapter, bool rtnl_held)
{
int ret = 0;
ret = register_netdev(adapter->dev);
if (!rtnl_held)
ret = register_netdev(adapter->dev);
else
ret = register_netdevice(adapter->dev);
if (ret != 0) {
EPPING_LOG(QDF_TRACE_LEVEL_FATAL,
"%s: unable to register device\n",
@@ -348,7 +352,8 @@ static struct net_device_ops epping_drv_ops = {
epping_adapter_t *epping_add_adapter(epping_context_t *pEpping_ctx,
tSirMacAddr macAddr,
enum QDF_OPMODE device_mode)
enum QDF_OPMODE device_mode,
bool rtnl_held)
{
struct net_device *dev;
epping_adapter_t *adapter;
@@ -378,10 +383,11 @@ epping_adapter_t *epping_add_adapter(epping_context_t *pEpping_ctx,
qdf_timer_init(epping_get_qdf_ctx(), &adapter->epping_timer,
epping_timer_expire, dev, QDF_TIMER_TYPE_SW);
dev->type = ARPHRD_IEEE80211;
dev->needed_headroom += 24;
dev->netdev_ops = &epping_drv_ops;
dev->watchdog_timeo = 5 * HZ; /* XXX */
dev->tx_queue_len = EPPING_TXBUF - 1; /* 1 for mgmt frame */
if (epping_register_adapter(adapter) == 0) {
if (epping_register_adapter(adapter, rtnl_held) == 0) {
EPPING_LOG(LOG1, FL("Disabling queues"));
netif_tx_disable(dev);
netif_carrier_off(dev);
@@ -413,7 +419,7 @@ int epping_connect_service(epping_context_t *pEpping_ctx)
connect.EpCallbacks.EpRecvRefill = epping_refill;
connect.EpCallbacks.EpSendFull =
epping_tx_queue_full /* ar6000_tx_queue_full */;
#elif defined(HIF_USB) || defined(HIF_PCI)
#elif defined(HIF_USB) || defined(HIF_PCI) || defined(HIF_SNOC)
connect.EpCallbacks.EpRecvRefill = NULL /* provided by HIF */;
connect.EpCallbacks.EpSendFull = NULL /* provided by HIF */;
/* disable flow control for hw flow control */
@@ -434,7 +440,7 @@ int epping_connect_service(epping_context_t *pEpping_ctx)
}
pEpping_ctx->EppingEndpoint[0] = response.Endpoint;
#if defined(HIF_PCI) || defined(HIF_USB)
#if defined(HIF_PCI) || defined(HIF_USB) || defined(HIF_SNOC)
connect.service_id = WMI_DATA_BK_SVC;
status = htc_connect_service(pEpping_ctx->HTCHandle, &connect, &response);
if (status != EOK) {