mwifiex: refactor device dump code to make it generic for usb interface
This patch refactor current device dump code to make it generic for subsequent implementation on usb interface. Signed-off-by: Xinming Hu <huxm@marvell.com> Signed-off-by: Cathy Luo <cluo@marvell.com> Signed-off-by: Ganapathi Bhat <gbhat@marvell.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
@@ -314,6 +314,7 @@ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter)
|
|||||||
adapter->iface_limit.p2p_intf = MWIFIEX_MAX_P2P_NUM;
|
adapter->iface_limit.p2p_intf = MWIFIEX_MAX_P2P_NUM;
|
||||||
adapter->active_scan_triggered = false;
|
adapter->active_scan_triggered = false;
|
||||||
timer_setup(&adapter->wakeup_timer, wakeup_timer_fn, 0);
|
timer_setup(&adapter->wakeup_timer, wakeup_timer_fn, 0);
|
||||||
|
adapter->devdump_len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -1051,9 +1051,30 @@ void mwifiex_multi_chan_resync(struct mwifiex_adapter *adapter)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(mwifiex_multi_chan_resync);
|
EXPORT_SYMBOL_GPL(mwifiex_multi_chan_resync);
|
||||||
|
|
||||||
int mwifiex_drv_info_dump(struct mwifiex_adapter *adapter, void **drv_info)
|
void mwifiex_upload_device_dump(struct mwifiex_adapter *adapter)
|
||||||
{
|
{
|
||||||
void *p;
|
/* Dump all the memory data into single file, a userspace script will
|
||||||
|
* be used to split all the memory data to multiple files
|
||||||
|
*/
|
||||||
|
mwifiex_dbg(adapter, MSG,
|
||||||
|
"== mwifiex dump information to /sys/class/devcoredump start\n");
|
||||||
|
dev_coredumpv(adapter->dev, adapter->devdump_data, adapter->devdump_len,
|
||||||
|
GFP_KERNEL);
|
||||||
|
mwifiex_dbg(adapter, MSG,
|
||||||
|
"== mwifiex dump information to /sys/class/devcoredump end\n");
|
||||||
|
|
||||||
|
/* Device dump data will be freed in device coredump release function
|
||||||
|
* after 5 min. Here reset adapter->devdump_data and ->devdump_len
|
||||||
|
* to avoid it been accidentally reused.
|
||||||
|
*/
|
||||||
|
adapter->devdump_data = NULL;
|
||||||
|
adapter->devdump_len = 0;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(mwifiex_upload_device_dump);
|
||||||
|
|
||||||
|
void mwifiex_drv_info_dump(struct mwifiex_adapter *adapter)
|
||||||
|
{
|
||||||
|
char *p;
|
||||||
char drv_version[64];
|
char drv_version[64];
|
||||||
struct usb_card_rec *cardp;
|
struct usb_card_rec *cardp;
|
||||||
struct sdio_mmc_card *sdio_card;
|
struct sdio_mmc_card *sdio_card;
|
||||||
@@ -1061,17 +1082,12 @@ int mwifiex_drv_info_dump(struct mwifiex_adapter *adapter, void **drv_info)
|
|||||||
int i, idx;
|
int i, idx;
|
||||||
struct netdev_queue *txq;
|
struct netdev_queue *txq;
|
||||||
struct mwifiex_debug_info *debug_info;
|
struct mwifiex_debug_info *debug_info;
|
||||||
void *drv_info_dump;
|
|
||||||
|
|
||||||
mwifiex_dbg(adapter, MSG, "===mwifiex driverinfo dump start===\n");
|
mwifiex_dbg(adapter, MSG, "===mwifiex driverinfo dump start===\n");
|
||||||
|
|
||||||
/* memory allocate here should be free in mwifiex_upload_device_dump*/
|
p = adapter->devdump_data;
|
||||||
drv_info_dump = vzalloc(MWIFIEX_DRV_INFO_SIZE_MAX);
|
strcpy(p, "========Start dump driverinfo========\n");
|
||||||
|
p += strlen("========Start dump driverinfo========\n");
|
||||||
if (!drv_info_dump)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
p = (char *)(drv_info_dump);
|
|
||||||
p += sprintf(p, "driver_name = " "\"mwifiex\"\n");
|
p += sprintf(p, "driver_name = " "\"mwifiex\"\n");
|
||||||
|
|
||||||
mwifiex_drv_get_driver_version(adapter, drv_version,
|
mwifiex_drv_get_driver_version(adapter, drv_version,
|
||||||
@@ -1155,21 +1171,18 @@ int mwifiex_drv_info_dump(struct mwifiex_adapter *adapter, void **drv_info)
|
|||||||
kfree(debug_info);
|
kfree(debug_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
strcpy(p, "\n========End dump========\n");
|
||||||
|
p += strlen("\n========End dump========\n");
|
||||||
mwifiex_dbg(adapter, MSG, "===mwifiex driverinfo dump end===\n");
|
mwifiex_dbg(adapter, MSG, "===mwifiex driverinfo dump end===\n");
|
||||||
*drv_info = drv_info_dump;
|
adapter->devdump_len = p - (char *)adapter->devdump_data;
|
||||||
return p - drv_info_dump;
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(mwifiex_drv_info_dump);
|
EXPORT_SYMBOL_GPL(mwifiex_drv_info_dump);
|
||||||
|
|
||||||
void mwifiex_upload_device_dump(struct mwifiex_adapter *adapter, void *drv_info,
|
void mwifiex_prepare_fw_dump_info(struct mwifiex_adapter *adapter)
|
||||||
int drv_info_size)
|
|
||||||
{
|
{
|
||||||
u8 idx, *dump_data, *fw_dump_ptr;
|
u8 idx;
|
||||||
u32 dump_len;
|
char *fw_dump_ptr;
|
||||||
|
u32 dump_len = 0;
|
||||||
dump_len = (strlen("========Start dump driverinfo========\n") +
|
|
||||||
drv_info_size +
|
|
||||||
strlen("\n========End dump========\n"));
|
|
||||||
|
|
||||||
for (idx = 0; idx < adapter->num_mem_types; idx++) {
|
for (idx = 0; idx < adapter->num_mem_types; idx++) {
|
||||||
struct memory_type_mapping *entry =
|
struct memory_type_mapping *entry =
|
||||||
@@ -1184,24 +1197,24 @@ void mwifiex_upload_device_dump(struct mwifiex_adapter *adapter, void *drv_info,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dump_data = vzalloc(dump_len + 1);
|
if (dump_len + 1 + adapter->devdump_len > MWIFIEX_FW_DUMP_SIZE) {
|
||||||
if (!dump_data)
|
/* Realloc in case buffer overflow */
|
||||||
goto done;
|
fw_dump_ptr = vzalloc(dump_len + 1 + adapter->devdump_len);
|
||||||
|
mwifiex_dbg(adapter, MSG, "Realloc device dump data.\n");
|
||||||
|
if (!fw_dump_ptr) {
|
||||||
|
vfree(adapter->devdump_data);
|
||||||
|
mwifiex_dbg(adapter, ERROR,
|
||||||
|
"vzalloc devdump data failure!\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
fw_dump_ptr = dump_data;
|
memmove(fw_dump_ptr, adapter->devdump_data,
|
||||||
|
adapter->devdump_len);
|
||||||
|
vfree(adapter->devdump_data);
|
||||||
|
adapter->devdump_data = fw_dump_ptr;
|
||||||
|
}
|
||||||
|
|
||||||
/* Dump all the memory data into single file, a userspace script will
|
fw_dump_ptr = (char *)adapter->devdump_data + adapter->devdump_len;
|
||||||
* be used to split all the memory data to multiple files
|
|
||||||
*/
|
|
||||||
mwifiex_dbg(adapter, MSG,
|
|
||||||
"== mwifiex dump information to /sys/class/devcoredump start");
|
|
||||||
|
|
||||||
strcpy(fw_dump_ptr, "========Start dump driverinfo========\n");
|
|
||||||
fw_dump_ptr += strlen("========Start dump driverinfo========\n");
|
|
||||||
memcpy(fw_dump_ptr, drv_info, drv_info_size);
|
|
||||||
fw_dump_ptr += drv_info_size;
|
|
||||||
strcpy(fw_dump_ptr, "\n========End dump========\n");
|
|
||||||
fw_dump_ptr += strlen("\n========End dump========\n");
|
|
||||||
|
|
||||||
for (idx = 0; idx < adapter->num_mem_types; idx++) {
|
for (idx = 0; idx < adapter->num_mem_types; idx++) {
|
||||||
struct memory_type_mapping *entry =
|
struct memory_type_mapping *entry =
|
||||||
@@ -1225,14 +1238,8 @@ void mwifiex_upload_device_dump(struct mwifiex_adapter *adapter, void *drv_info,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* device dump data will be free in device coredump release function
|
adapter->devdump_len = fw_dump_ptr - (char *)adapter->devdump_data;
|
||||||
* after 5 min
|
|
||||||
*/
|
|
||||||
dev_coredumpv(adapter->dev, dump_data, dump_len, GFP_KERNEL);
|
|
||||||
mwifiex_dbg(adapter, MSG,
|
|
||||||
"== mwifiex dump information to /sys/class/devcoredump end");
|
|
||||||
|
|
||||||
done:
|
|
||||||
for (idx = 0; idx < adapter->num_mem_types; idx++) {
|
for (idx = 0; idx < adapter->num_mem_types; idx++) {
|
||||||
struct memory_type_mapping *entry =
|
struct memory_type_mapping *entry =
|
||||||
&adapter->mem_type_mapping_tbl[idx];
|
&adapter->mem_type_mapping_tbl[idx];
|
||||||
@@ -1241,10 +1248,8 @@ done:
|
|||||||
entry->mem_ptr = NULL;
|
entry->mem_ptr = NULL;
|
||||||
entry->mem_size = 0;
|
entry->mem_size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
vfree(drv_info);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(mwifiex_upload_device_dump);
|
EXPORT_SYMBOL_GPL(mwifiex_prepare_fw_dump_info);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CFG802.11 network device handler for statistics retrieval.
|
* CFG802.11 network device handler for statistics retrieval.
|
||||||
|
@@ -94,6 +94,8 @@ enum {
|
|||||||
|
|
||||||
#define MAX_EVENT_SIZE 2048
|
#define MAX_EVENT_SIZE 2048
|
||||||
|
|
||||||
|
#define MWIFIEX_FW_DUMP_SIZE (2 * 1024 * 1024)
|
||||||
|
|
||||||
#define ARP_FILTER_MAX_BUF_SIZE 68
|
#define ARP_FILTER_MAX_BUF_SIZE 68
|
||||||
|
|
||||||
#define MWIFIEX_KEY_BUFFER_SIZE 16
|
#define MWIFIEX_KEY_BUFFER_SIZE 16
|
||||||
@@ -1032,6 +1034,9 @@ struct mwifiex_adapter {
|
|||||||
bool wake_by_wifi;
|
bool wake_by_wifi;
|
||||||
/* Aggregation parameters*/
|
/* Aggregation parameters*/
|
||||||
struct bus_aggr_params bus_aggr;
|
struct bus_aggr_params bus_aggr;
|
||||||
|
/* Device dump data/length */
|
||||||
|
void *devdump_data;
|
||||||
|
int devdump_len;
|
||||||
};
|
};
|
||||||
|
|
||||||
void mwifiex_process_tx_queue(struct mwifiex_adapter *adapter);
|
void mwifiex_process_tx_queue(struct mwifiex_adapter *adapter);
|
||||||
@@ -1656,9 +1661,9 @@ void mwifiex_hist_data_add(struct mwifiex_private *priv,
|
|||||||
u8 mwifiex_adjust_data_rate(struct mwifiex_private *priv,
|
u8 mwifiex_adjust_data_rate(struct mwifiex_private *priv,
|
||||||
u8 rx_rate, u8 ht_info);
|
u8 rx_rate, u8 ht_info);
|
||||||
|
|
||||||
int mwifiex_drv_info_dump(struct mwifiex_adapter *adapter, void **drv_info);
|
void mwifiex_drv_info_dump(struct mwifiex_adapter *adapter);
|
||||||
void mwifiex_upload_device_dump(struct mwifiex_adapter *adapter, void *drv_info,
|
void mwifiex_prepare_fw_dump_info(struct mwifiex_adapter *adapter);
|
||||||
int drv_info_size);
|
void mwifiex_upload_device_dump(struct mwifiex_adapter *adapter);
|
||||||
void *mwifiex_alloc_dma_align_buf(int rx_len, gfp_t flags);
|
void *mwifiex_alloc_dma_align_buf(int rx_len, gfp_t flags);
|
||||||
void mwifiex_queue_main_work(struct mwifiex_adapter *adapter);
|
void mwifiex_queue_main_work(struct mwifiex_adapter *adapter);
|
||||||
int mwifiex_get_wakeup_reason(struct mwifiex_private *priv, u16 action,
|
int mwifiex_get_wakeup_reason(struct mwifiex_private *priv, u16 action,
|
||||||
|
@@ -2769,12 +2769,17 @@ static void mwifiex_pcie_fw_dump(struct mwifiex_adapter *adapter)
|
|||||||
|
|
||||||
static void mwifiex_pcie_device_dump_work(struct mwifiex_adapter *adapter)
|
static void mwifiex_pcie_device_dump_work(struct mwifiex_adapter *adapter)
|
||||||
{
|
{
|
||||||
int drv_info_size;
|
adapter->devdump_data = vzalloc(MWIFIEX_FW_DUMP_SIZE);
|
||||||
void *drv_info;
|
if (!adapter->devdump_data) {
|
||||||
|
mwifiex_dbg(adapter, ERROR,
|
||||||
|
"vzalloc devdump data failure!\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
drv_info_size = mwifiex_drv_info_dump(adapter, &drv_info);
|
mwifiex_drv_info_dump(adapter);
|
||||||
mwifiex_pcie_fw_dump(adapter);
|
mwifiex_pcie_fw_dump(adapter);
|
||||||
mwifiex_upload_device_dump(adapter, drv_info, drv_info_size);
|
mwifiex_prepare_fw_dump_info(adapter);
|
||||||
|
mwifiex_upload_device_dump(adapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mwifiex_pcie_card_reset_work(struct mwifiex_adapter *adapter)
|
static void mwifiex_pcie_card_reset_work(struct mwifiex_adapter *adapter)
|
||||||
|
@@ -2505,15 +2505,21 @@ done:
|
|||||||
static void mwifiex_sdio_device_dump_work(struct mwifiex_adapter *adapter)
|
static void mwifiex_sdio_device_dump_work(struct mwifiex_adapter *adapter)
|
||||||
{
|
{
|
||||||
struct sdio_mmc_card *card = adapter->card;
|
struct sdio_mmc_card *card = adapter->card;
|
||||||
int drv_info_size;
|
|
||||||
void *drv_info;
|
|
||||||
|
|
||||||
drv_info_size = mwifiex_drv_info_dump(adapter, &drv_info);
|
adapter->devdump_data = vzalloc(MWIFIEX_FW_DUMP_SIZE);
|
||||||
|
if (!adapter->devdump_data) {
|
||||||
|
mwifiex_dbg(adapter, ERROR,
|
||||||
|
"vzalloc devdump data failure!\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mwifiex_drv_info_dump(adapter);
|
||||||
if (card->fw_dump_enh)
|
if (card->fw_dump_enh)
|
||||||
mwifiex_sdio_generic_fw_dump(adapter);
|
mwifiex_sdio_generic_fw_dump(adapter);
|
||||||
else
|
else
|
||||||
mwifiex_sdio_fw_dump(adapter);
|
mwifiex_sdio_fw_dump(adapter);
|
||||||
mwifiex_upload_device_dump(adapter, drv_info, drv_info_size);
|
mwifiex_prepare_fw_dump_info(adapter);
|
||||||
|
mwifiex_upload_device_dump(adapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mwifiex_sdio_work(struct work_struct *work)
|
static void mwifiex_sdio_work(struct work_struct *work)
|
||||||
|
Reference in New Issue
Block a user