diff options
140 files changed, 19092 insertions, 7243 deletions
diff --git a/drivers/bluetooth/sd8797/bt/bt_drv.h b/drivers/bluetooth/sd8797/bt/bt_drv.h index 8e6f21f501cb..2a8f8f5fbcf3 100644 --- a/drivers/bluetooth/sd8797/bt/bt_drv.h +++ b/drivers/bluetooth/sd8797/bt/bt_drv.h @@ -96,11 +96,14 @@ extern u32 mbt_drvdbg; #ifdef DEBUG_LEVEL2 /** Print informative message */ -#define PRINTM_INFO(msg...) do {if (mbt_drvdbg & DBG_INFO) printk(KERN_DEBUG msg); } while (0) +#define PRINTM_INFO(msg...) do {if (mbt_drvdbg & DBG_INFO) \ + printk(KERN_DEBUG msg); } while (0) /** Print warning message */ -#define PRINTM_WARN(msg...) do {if (mbt_drvdbg & DBG_WARN) printk(KERN_DEBUG msg); } while (0) +#define PRINTM_WARN(msg...) do {if (mbt_drvdbg & DBG_WARN) \ + printk(KERN_DEBUG msg); } while (0) /** Print entry message */ -#define PRINTM_ENTRY(msg...) do {if (mbt_drvdbg & DBG_ENTRY) printk(KERN_DEBUG msg); } while (0) +#define PRINTM_ENTRY(msg...) do {if (mbt_drvdbg & DBG_ENTRY) \ + printk(KERN_DEBUG msg); } while (0) #else /** Print informative message */ #define PRINTM_INFO(msg...) do {} while (0) @@ -111,24 +114,33 @@ extern u32 mbt_drvdbg; #endif /* DEBUG_LEVEL2 */ /** Print interrupt message */ -#define PRINTM_INTR(msg...) do {if (mbt_drvdbg & DBG_INTR) printk(KERN_DEBUG msg); } while (0) +#define PRINTM_INTR(msg...) do {if (mbt_drvdbg & DBG_INTR) \ + printk(KERN_DEBUG msg); } while (0) /** Print event message */ -#define PRINTM_EVENT(msg...) do {if (mbt_drvdbg & DBG_EVENT) printk(KERN_DEBUG msg); } while (0) +#define PRINTM_EVENT(msg...) do {if (mbt_drvdbg & DBG_EVENT) \ + printk(KERN_DEBUG msg); } while (0) /** Print command message */ -#define PRINTM_CMD(msg...) do {if (mbt_drvdbg & DBG_CMD) printk(KERN_DEBUG msg); } while (0) +#define PRINTM_CMD(msg...) do {if (mbt_drvdbg & DBG_CMD) \ + printk(KERN_DEBUG msg); } while (0) /** Print data message */ -#define PRINTM_DATA(msg...) do {if (mbt_drvdbg & DBG_DATA) printk(KERN_DEBUG msg); } while (0) +#define PRINTM_DATA(msg...) do {if (mbt_drvdbg & DBG_DATA) \ + printk(KERN_DEBUG msg); } while (0) /** Print error message */ -#define PRINTM_ERROR(msg...) do {if (mbt_drvdbg & DBG_ERROR) printk(KERN_ERR msg); } while (0) +#define PRINTM_ERROR(msg...) do {if (mbt_drvdbg & DBG_ERROR) \ + printk(KERN_ERR msg); } while (0) /** Print fatal message */ -#define PRINTM_FATAL(msg...) do {if (mbt_drvdbg & DBG_FATAL) printk(KERN_ERR msg); } while (0) +#define PRINTM_FATAL(msg...) do {if (mbt_drvdbg & DBG_FATAL) \ + printk(KERN_ERR msg); } while (0) /** Print message */ -#define PRINTM_MSG(msg...) do {if (mbt_drvdbg & DBG_MSG) printk(KERN_ALERT msg); } while (0) +#define PRINTM_MSG(msg...) do {if (mbt_drvdbg & DBG_MSG) \ + printk(KERN_ALERT msg); } while (0) /** Print data dump message */ -#define PRINTM_DAT_D(msg...) do {if (mbt_drvdbg & DBG_DAT_D) printk(KERN_DEBUG msg); } while (0) +#define PRINTM_DAT_D(msg...) do {if (mbt_drvdbg & DBG_DAT_D) \ + printk(KERN_DEBUG msg); } while (0) /** Print data dump message */ -#define PRINTM_CMD_D(msg...) do {if (mbt_drvdbg & DBG_CMD_D) printk(KERN_DEBUG msg); } while (0) +#define PRINTM_CMD_D(msg...) do {if (mbt_drvdbg & DBG_CMD_D) \ + printk(KERN_DEBUG msg); } while (0) /** Print message with required level */ #define PRINTM(level, msg...) PRINTM_##level(msg) @@ -164,28 +176,30 @@ hexdump(char *prompt, u8 * buf, int len) } /** Debug hexdump of debug data */ -#define DBG_HEXDUMP_DAT_D(x, y, z) do {if (mbt_drvdbg & DBG_DAT_D) hexdump(x, y, z); } while (0) +#define DBG_HEXDUMP_DAT_D(x, y, z) do {if (mbt_drvdbg & DBG_DAT_D) \ + hexdump(x, y, z); } while (0) /** Debug hexdump of debug command */ -#define DBG_HEXDUMP_CMD_D(x, y, z) do {if (mbt_drvdbg & DBG_CMD_D) hexdump(x, y, z); } while (0) +#define DBG_HEXDUMP_CMD_D(x, y, z) do {if (mbt_drvdbg & DBG_CMD_D) \ + hexdump(x, y, z); } while (0) /** Debug hexdump */ #define DBG_HEXDUMP(level, x, y, z) DBG_HEXDUMP_##level(x, y, z) /** Mark entry point */ -#define ENTER() PRINTM(ENTRY, "Enter: %s, %s:%i\n", __FUNCTION__, \ +#define ENTER() PRINTM(ENTRY, "Enter: %s, %s:%i\n", __func__, \ __FILE__, __LINE__) /** Mark exit point */ -#define LEAVE() PRINTM(ENTRY, "Leave: %s, %s:%i\n", __FUNCTION__, \ +#define LEAVE() PRINTM(ENTRY, "Leave: %s, %s:%i\n", __func__, \ __FILE__, __LINE__) #else /** Do nothing */ -#define PRINTM(level, msg...) do {} while (0); +#define PRINTM(level, msg...) do {} while (0) /** Do nothing */ -#define DBG_HEXDUMP(level, x, y, z) do {} while (0); +#define DBG_HEXDUMP(level, x, y, z) do {} while (0) /** Do nothing */ -#define ENTER() do {} while (0); +#define ENTER() do {} while (0) /** Do nothing */ -#define LEAVE() do {} while (0); +#define LEAVE() do {} while (0) #endif /* DEBUG_LEVEL1 */ /** Bluetooth upload size */ @@ -278,7 +292,7 @@ os_sched_timeout(u32 millisec) #endif #ifndef __ATTRIB_PACK__ -#define __ATTRIB_PACK__ __attribute__ ((packed)) +#define __ATTRIB_PACK__ __attribute__((packed)) #endif /** Data structure for the Marvell Bluetooth device */ @@ -453,9 +467,11 @@ typedef struct _bt_private { } bt_private, *pbt_private; /** Disable interrupt */ -#define OS_INT_DISABLE spin_lock_irqsave(&priv->driver_lock, priv->driver_flags) +#define OS_INT_DISABLE spin_lock_irqsave(&priv->driver_lock, \ + priv->driver_flags) /** Enable interrupt */ -#define OS_INT_RESTORE spin_unlock_irqrestore(&priv->driver_lock, priv->driver_flags) +#define OS_INT_RESTORE spin_unlock_irqrestore(&priv->driver_lock, \ + priv->driver_flags) #ifndef HCI_BT_AMP /** BT_AMP flag for device type */ @@ -586,7 +602,7 @@ typedef struct _BT_CMD { /** Length */ u8 length; /** Data */ - u8 data[32]; + u8 data[128]; } __ATTRIB_PACK__ BT_CMD; typedef struct _BT_EVENT { @@ -671,6 +687,8 @@ int sd_download_firmware_w_helper(bt_private * priv); #define BT_CMD_CSU_WRITE_REG 0x66 /** Bluetooth command : Load calibrate data */ #define BT_CMD_LOAD_CONFIG_DATA 0x61 +/** Bluetooth command : Load calibrate ext data */ +#define BT_CMD_LOAD_CONFIG_DATA_EXT 0x60 /** Bluetooth command : BLE deepsleep */ #define BT_CMD_BLE_DEEP_SLEEP 0x8b @@ -705,8 +723,12 @@ int bt_write_reg(bt_private * priv, u8 type, u32 offset, u16 value); int bt_init_config(bt_private * priv, char *cfg_file); /** This function load the calibrate data */ int bt_load_cal_data(bt_private * priv, u8 * config_data, u8 * mac); +/** This function load the calibrate ext data */ +int bt_load_cal_data_ext(bt_private * priv, u8 * config_data, u32 cfg_data_len); /** BT set user defined calibration data */ int bt_cal_config(bt_private * priv, char *cfg_file, char *mac); +/** BT set user defined calibration ext data */ +int bt_cal_config_ext(bt_private * priv, char *cfg_file); int bt_init_mac_address(bt_private * priv, char *mac); typedef struct _BT_HCI_CMD { diff --git a/drivers/bluetooth/sd8797/bt/bt_init.c b/drivers/bluetooth/sd8797/bt/bt_init.c index 55481d520a3d..13d7ed300974 100644 --- a/drivers/bluetooth/sd8797/bt/bt_init.c +++ b/drivers/bluetooth/sd8797/bt/bt_init.c @@ -200,10 +200,11 @@ bt_atoi(int *data, char *a) * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE */ static int -bt_parse_cal_cfg(const u8 * src, u32 len, u8 * dst, u32 dst_size) +bt_parse_cal_cfg(const u8 * src, u32 len, u8 * dst, u32 * dst_size) { const u8 *ptr; u8 *dptr; + u32 count = 0; int ret = BT_STATUS_FAILURE; ENTER(); @@ -217,12 +218,13 @@ bt_parse_cal_cfg(const u8 * src, u32 len, u8 * dst, u32 dst_size) } if (isxdigit(*ptr)) { - if ((dptr - dst) >= dst_size) { + if ((dptr - dst) >= *dst_size) { PRINTM(ERROR, "cal_file size too big!!!\n"); goto done; } *dptr++ = bt_atox(ptr); ptr += 2; + count++; } else { ptr++; } @@ -232,6 +234,7 @@ bt_parse_cal_cfg(const u8 * src, u32 len, u8 * dst, u32 dst_size) goto done; } + *dst_size = count; ret = BT_STATUS_SUCCESS; done: LEAVE(); @@ -497,11 +500,13 @@ bt_process_cal_cfg(bt_private * priv, u8 * data, u32 size, char *mac) u8 bt_mac[ETH_ALEN]; u8 cal_data[32]; u8 *mac_data = NULL; + u32 cal_data_len; int ret = BT_STATUS_FAILURE; memset(bt_mac, 0, sizeof(bt_mac)); + cal_data_len = sizeof(cal_data); if (BT_STATUS_SUCCESS != - bt_parse_cal_cfg(data, size, cal_data, sizeof(cal_data))) { + bt_parse_cal_cfg(data, size, cal_data, &cal_data_len)) { goto done; } if (mac != NULL) { @@ -523,6 +528,39 @@ done: } /** + * @brief BT process calibration EXT data + * + * @param priv a pointer to bt_private structure + * @param data a pointer to cal data + * @param size cal data size + * @param mac mac address buf + * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE + */ +int +bt_process_cal_cfg_ext(bt_private * priv, u8 * data, u32 size) +{ + u8 cal_data[128]; + u32 cal_data_len; + int ret = BT_STATUS_FAILURE; + + cal_data_len = sizeof(cal_data); + if (BT_STATUS_SUCCESS != + bt_parse_cal_cfg(data, size, cal_data, &cal_data_len)) { + goto done; + } + if (BT_STATUS_SUCCESS != + bt_load_cal_data_ext(priv, cal_data, cal_data_len)) { + PRINTM(FATAL, "BT: Fail to load calibrate data\n"); + goto done; + } + ret = BT_STATUS_SUCCESS; + +done: + LEAVE(); + return ret; +} + +/** * @brief BT process calibration file * * @param priv a pointer to bt_private structure @@ -555,6 +593,37 @@ done: } /** + * @brief BT process calibration EXT file + * + * @param priv a pointer to bt_private structure + * @param cal_file calibration file name + * @param mac mac address buf + * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE + */ +int +bt_cal_config_ext(bt_private * priv, char *cal_file) +{ + const struct firmware *cfg = NULL; + int ret = BT_STATUS_SUCCESS; + + ENTER(); + if ((request_firmware(&cfg, cal_file, priv->hotplug_device)) < 0) { + PRINTM(FATAL, "BT: request_firmware() %s failed\n", cal_file); + ret = BT_STATUS_FAILURE; + goto done; + } + if (cfg) + ret = bt_process_cal_cfg_ext(priv, (u8 *) cfg->data, cfg->size); + else + ret = BT_STATUS_FAILURE; +done: + if (cfg) + release_firmware(cfg); + LEAVE(); + return ret; +} + +/** * @brief BT init mac address from bt_mac parametre when insmod * * @param priv a pointer to bt_private structure diff --git a/drivers/bluetooth/sd8797/bt/bt_main.c b/drivers/bluetooth/sd8797/bt/bt_main.c index 9b5d808d837c..04ec9a69ae4f 100644 --- a/drivers/bluetooth/sd8797/bt/bt_main.c +++ b/drivers/bluetooth/sd8797/bt/bt_main.c @@ -37,6 +37,8 @@ #include <linux/platform_device.h> #include <linux/wlan_plat.h> +#include <linux/interrupt.h> + #include "bt_drv.h" #include "mbt_char.h" #include "bt_sdio.h" @@ -90,6 +92,8 @@ static int psmode = 1; static char *init_cfg; /** Calibration config file (MAC address, init powe etc.) */ static char *cal_cfg; +/** Calibration config file EXT */ +static char *cal_cfg_ext; /** Init MAC address */ static char *bt_mac; @@ -115,7 +119,13 @@ static int minicard_pwrup = 1; /** Pointer to struct with control hooks */ static struct wifi_platform_data *bt_control_data; +#define IORESOURCE_NAME "mrvl_bt_irq" +#define DRIVER_NAME "bt hostwake" + void mdev_poweroff(struct m_dev *m_dev); +static struct resource *bt_irqres; +static int irq_registered; +static void bt_register_hostwake_irq(void *handle); /** * @brief Alloc bt device @@ -258,6 +268,7 @@ check_evtpkt(bt_private * priv, struct sk_buff *skb) case BT_CMD_CONFIG_MAC_ADDR: case BT_CMD_CSU_WRITE_REG: case BT_CMD_LOAD_CONFIG_DATA: + case BT_CMD_LOAD_CONFIG_DATA_EXT: case BT_CMD_AUTO_SLEEP_MODE: case BT_CMD_HOST_SLEEP_CONFIG: case BT_CMD_SDIO_PULL_CFG_REQ: @@ -330,19 +341,19 @@ bt_process_event(bt_private * priv, struct sk_buff *skb) { u8 ret = BT_STATUS_SUCCESS; struct m_dev *m_dev = &(priv->bt_dev.m_dev[BT_SEQ]); - BT_EVENT *pEvent; + BT_EVENT *pevent; ENTER(); - pEvent = (BT_EVENT *) skb->data; - if (pEvent->EC != 0xff) { - PRINTM(CMD, "BT: Not Marvell Event=0x%x\n", pEvent->EC); + pevent = (BT_EVENT *) skb->data; + if (pevent->EC != 0xff) { + PRINTM(CMD, "BT: Not Marvell Event=0x%x\n", pevent->EC); ret = BT_STATUS_FAILURE; goto exit; } - switch (pEvent->data[0]) { + switch (pevent->data[0]) { case BT_CMD_AUTO_SLEEP_MODE: - if (pEvent->data[2] == BT_STATUS_SUCCESS) { - if (pEvent->data[1] == BT_PS_ENABLE) + if (pevent->data[2] == BT_STATUS_SUCCESS) { + if (pevent->data[1] == BT_PS_ENABLE) priv->adapter->psmode = 1; else priv->adapter->psmode = 0; @@ -355,16 +366,16 @@ bt_process_event(bt_private * priv, struct sk_buff *skb) } break; case BT_CMD_HOST_SLEEP_CONFIG: - if (pEvent->data[3] == BT_STATUS_SUCCESS) { + if (pevent->data[3] == BT_STATUS_SUCCESS) { PRINTM(CMD, "BT: %s: gpio=0x%x, gap=0x%x\n", - m_dev->name, pEvent->data[1], pEvent->data[2]); + m_dev->name, pevent->data[1], pevent->data[2]); } else { PRINTM(CMD, "BT: %s: HSCFG Command Fail\n", m_dev->name); } break; case BT_CMD_HOST_SLEEP_ENABLE: - if (pEvent->data[1] == BT_STATUS_SUCCESS) { + if (pevent->data[1] == BT_STATUS_SUCCESS) { priv->adapter->hs_state = HS_ACTIVATED; if (priv->adapter->suspend_fail == FALSE) { #ifdef SDIO_SUSPEND_RESUME @@ -388,45 +399,44 @@ bt_process_event(bt_private * priv, struct sk_buff *skb) break; case BT_CMD_MODULE_CFG_REQ: if ((priv->bt_dev.sendcmdflag == TRUE) && - ((pEvent->data[1] == MODULE_BRINGUP_REQ) - || (pEvent->data[1] == MODULE_SHUTDOWN_REQ))) { - if (pEvent->data[1] == MODULE_BRINGUP_REQ) { + ((pevent->data[1] == MODULE_BRINGUP_REQ) + || (pevent->data[1] == MODULE_SHUTDOWN_REQ))) { + if (pevent->data[1] == MODULE_BRINGUP_REQ) { PRINTM(CMD, "BT: EVENT %s:%s\n", m_dev->name, - (pEvent->data[2] && (pEvent->data[2] != + (pevent->data[2] && (pevent->data[2] != MODULE_CFG_RESP_ALREADY_UP)) ? "Bring up Fail" : "Bring up success"); - priv->bt_dev.devType = pEvent->data[3]; + priv->bt_dev.devType = pevent->data[3]; PRINTM(CMD, "devType:%s\n", - (pEvent->data[3] == + (pevent->data[3] == DEV_TYPE_AMP) ? "AMP controller" : "BR/EDR controller"); - priv->bt_dev.devFeature = pEvent->data[4]; + priv->bt_dev.devFeature = pevent->data[4]; PRINTM(CMD, "devFeature: %s, %s, %s, %s, %s\n", - ((pEvent-> + ((pevent-> data[4] & DEV_FEATURE_BT) ? "BT Feature" : "No BT Feature"), - ((pEvent-> + ((pevent-> data[4] & DEV_FEATURE_BTAMP) ? "BTAMP Feature" : "No BTAMP Feature"), - ((pEvent-> + ((pevent-> data[4] & DEV_FEATURE_BLE) ? "BLE Feature" : "No BLE Feature"), - ((pEvent-> + ((pevent-> data[4] & DEV_FEATURE_FM) ? "FM Feature" : "No FM Feature"), - ((pEvent-> + ((pevent-> data[4] & DEV_FEATURE_NFC) ? "NFC Feature" : "No NFC Feature")); } - if (pEvent->data[1] == MODULE_SHUTDOWN_REQ) { + if (pevent->data[1] == MODULE_SHUTDOWN_REQ) { PRINTM(CMD, "BT: EVENT %s:%s\n", m_dev->name, - (pEvent-> - data[2]) ? "Shut down Fail" : - "Shut down success"); + (pevent->data[2]) ? "Shut down Fail" + : "Shut down success"); } - if (pEvent->data[2]) { + if (pevent->data[2]) { priv->bt_dev.sendcmdflag = FALSE; priv->adapter->cmd_complete = TRUE; wake_up_interruptible(&priv->adapter-> @@ -438,14 +448,14 @@ bt_process_event(bt_private * priv, struct sk_buff *skb) } break; case BT_EVENT_POWER_STATE: - if (pEvent->data[1] == BT_PS_SLEEP) + if (pevent->data[1] == BT_PS_SLEEP) priv->adapter->ps_state = PS_SLEEP; PRINTM(CMD, "BT: EVENT %s:%s\n", m_dev->name, (priv->adapter->ps_state) ? "PS_SLEEP" : "PS_AWAKE"); break; case BT_CMD_SDIO_PULL_CFG_REQ: - if (pEvent->data[pEvent->length - 1] == BT_STATUS_SUCCESS) + if (pevent->data[pevent->length - 1] == BT_STATUS_SUCCESS) PRINTM(CMD, "BT: %s: SDIO pull configuration success\n", m_dev->name); @@ -456,7 +466,7 @@ bt_process_event(bt_private * priv, struct sk_buff *skb) } break; default: - PRINTM(CMD, "BT: Unknown Event=%d %s\n", pEvent->data[0], + PRINTM(CMD, "BT: Unknown Event=%d %s\n", pevent->data[0], m_dev->name); ret = BT_STATUS_FAILURE; break; @@ -509,14 +519,14 @@ bt_cmd_timeout_func(bt_adapter * adapter, u16 cmd) * * @param priv A pointer to bt_private structure * - * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE + * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE */ int bt_send_reset_command(bt_private * priv) { struct sk_buff *skb = NULL; u8 ret = BT_STATUS_SUCCESS; - BT_HCI_CMD *pCmd; + BT_HCI_CMD *pcmd; ENTER(); skb = bt_skb_alloc(sizeof(BT_HCI_CMD), GFP_ATOMIC); if (skb == NULL) { @@ -524,10 +534,10 @@ bt_send_reset_command(bt_private * priv) ret = BT_STATUS_FAILURE; goto exit; } - pCmd = (BT_HCI_CMD *) skb->data; - pCmd->ocf_ogf = (RESET_OGF << 10) | BT_CMD_RESET; - pCmd->length = 0x00; - pCmd->cmd_type = 0x00; + pcmd = (BT_HCI_CMD *) skb->data; + pcmd->ocf_ogf = (RESET_OGF << 10) | BT_CMD_RESET; + pcmd->length = 0x00; + pcmd->cmd_type = 0x00; bt_cb(skb)->pkt_type = HCI_COMMAND_PKT; skb_put(skb, 3); skb->dev = (void *)(&(priv->bt_dev.m_dev[BT_SEQ])); @@ -535,7 +545,7 @@ bt_send_reset_command(bt_private * priv) priv->bt_dev.sendcmdflag = TRUE; priv->bt_dev.send_cmd_ocf = BT_CMD_RESET; priv->adapter->cmd_complete = FALSE; - PRINTM(CMD, "Queue Reset Command(0x%x)\n", pCmd->ocf_ogf); + PRINTM(CMD, "Queue Reset Command(0x%x)\n", pcmd->ocf_ogf); wake_up_interruptible(&priv->MainThread.waitQ); if (!os_wait_interruptible_timeout (priv->adapter->cmd_wait_q, priv->adapter->cmd_complete, @@ -570,7 +580,7 @@ bt_send_module_cfg_cmd(bt_private * priv, int subcmd) { struct sk_buff *skb = NULL; u8 ret = BT_STATUS_SUCCESS; - BT_CMD *pCmd; + BT_CMD *pcmd; ENTER(); skb = bt_skb_alloc(sizeof(BT_CMD), GFP_ATOMIC); if (skb == NULL) { @@ -578,18 +588,18 @@ bt_send_module_cfg_cmd(bt_private * priv, int subcmd) ret = BT_STATUS_FAILURE; goto exit; } - pCmd = (BT_CMD *) skb->data; - pCmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_MODULE_CFG_REQ; - pCmd->length = 1; - pCmd->data[0] = subcmd; + pcmd = (BT_CMD *) skb->data; + pcmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_MODULE_CFG_REQ; + pcmd->length = 1; + pcmd->data[0] = subcmd; bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; - skb_put(skb, BT_CMD_HEADER_SIZE + pCmd->length); + skb_put(skb, BT_CMD_HEADER_SIZE + pcmd->length); skb->dev = (void *)(&(priv->bt_dev.m_dev[BT_SEQ])); skb_queue_head(&priv->adapter->tx_queue, skb); priv->bt_dev.sendcmdflag = TRUE; priv->bt_dev.send_cmd_ocf = BT_CMD_MODULE_CFG_REQ; priv->adapter->cmd_complete = FALSE; - PRINTM(CMD, "Queue module cfg Command(0x%x)\n", pCmd->ocf_ogf); + PRINTM(CMD, "Queue module cfg Command(0x%x)\n", pcmd->ocf_ogf); wake_up_interruptible(&priv->MainThread.waitQ); /* On some Android platforms certain delay is needed for HCI daemon to @@ -624,7 +634,7 @@ bt_enable_ps(bt_private * priv) { struct sk_buff *skb = NULL; u8 ret = BT_STATUS_SUCCESS; - BT_CMD *pCmd; + BT_CMD *pcmd; ENTER(); skb = bt_skb_alloc(sizeof(BT_CMD), GFP_ATOMIC); if (skb == NULL) { @@ -632,25 +642,25 @@ bt_enable_ps(bt_private * priv) ret = BT_STATUS_FAILURE; goto exit; } - pCmd = (BT_CMD *) skb->data; - pCmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_AUTO_SLEEP_MODE; + pcmd = (BT_CMD *) skb->data; + pcmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_AUTO_SLEEP_MODE; if (priv->bt_dev.psmode) - pCmd->data[0] = BT_PS_ENABLE; + pcmd->data[0] = BT_PS_ENABLE; else - pCmd->data[0] = BT_PS_DISABLE; + pcmd->data[0] = BT_PS_DISABLE; if (priv->bt_dev.idle_timeout) { - pCmd->length = 3; - pCmd->data[1] = (u8) (priv->bt_dev.idle_timeout & 0x00ff); - pCmd->data[2] = (priv->bt_dev.idle_timeout & 0xff00) >> 8; + pcmd->length = 3; + pcmd->data[1] = (u8) (priv->bt_dev.idle_timeout & 0x00ff); + pcmd->data[2] = (priv->bt_dev.idle_timeout & 0xff00) >> 8; } else { - pCmd->length = 1; + pcmd->length = 1; } bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; - skb_put(skb, BT_CMD_HEADER_SIZE + pCmd->length); + skb_put(skb, BT_CMD_HEADER_SIZE + pcmd->length); skb->dev = (void *)(&(priv->bt_dev.m_dev[BT_SEQ])); skb_queue_head(&priv->adapter->tx_queue, skb); - PRINTM(CMD, "Queue PSMODE Command(0x%x):%d\n", pCmd->ocf_ogf, - pCmd->data[0]); + PRINTM(CMD, "Queue PSMODE Command(0x%x):%d\n", pcmd->ocf_ogf, + pcmd->data[0]); priv->bt_dev.sendcmdflag = TRUE; priv->bt_dev.send_cmd_ocf = BT_CMD_AUTO_SLEEP_MODE; priv->adapter->cmd_complete = FALSE; @@ -678,7 +688,7 @@ bt_send_hscfg_cmd(bt_private * priv) { struct sk_buff *skb = NULL; u8 ret = BT_STATUS_SUCCESS; - BT_CMD *pCmd; + BT_CMD *pcmd; ENTER(); skb = bt_skb_alloc(sizeof(BT_CMD), GFP_ATOMIC); if (skb == NULL) { @@ -686,17 +696,17 @@ bt_send_hscfg_cmd(bt_private * priv) ret = BT_STATUS_FAILURE; goto exit; } - pCmd = (BT_CMD *) skb->data; - pCmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_HOST_SLEEP_CONFIG; - pCmd->length = 2; - pCmd->data[0] = (priv->bt_dev.gpio_gap & 0xff00) >> 8; - pCmd->data[1] = (u8) (priv->bt_dev.gpio_gap & 0x00ff); + pcmd = (BT_CMD *) skb->data; + pcmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_HOST_SLEEP_CONFIG; + pcmd->length = 2; + pcmd->data[0] = (priv->bt_dev.gpio_gap & 0xff00) >> 8; + pcmd->data[1] = (u8) (priv->bt_dev.gpio_gap & 0x00ff); bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; - skb_put(skb, BT_CMD_HEADER_SIZE + pCmd->length); + skb_put(skb, BT_CMD_HEADER_SIZE + pcmd->length); skb->dev = (void *)(&(priv->bt_dev.m_dev[BT_SEQ])); skb_queue_head(&priv->adapter->tx_queue, skb); PRINTM(CMD, "Queue HSCFG Command(0x%x),gpio=0x%x,gap=0x%x\n", - pCmd->ocf_ogf, pCmd->data[0], pCmd->data[1]); + pcmd->ocf_ogf, pcmd->data[0], pcmd->data[1]); priv->bt_dev.sendcmdflag = TRUE; priv->bt_dev.send_cmd_ocf = BT_CMD_HOST_SLEEP_CONFIG; priv->adapter->cmd_complete = FALSE; @@ -724,7 +734,7 @@ bt_send_sdio_pull_ctrl_cmd(bt_private * priv) { struct sk_buff *skb = NULL; u8 ret = BT_STATUS_SUCCESS; - BT_CMD *pCmd; + BT_CMD *pcmd; ENTER(); skb = bt_skb_alloc(sizeof(BT_CMD), GFP_ATOMIC); if (skb == NULL) { @@ -732,21 +742,21 @@ bt_send_sdio_pull_ctrl_cmd(bt_private * priv) ret = BT_STATUS_FAILURE; goto exit; } - pCmd = (BT_CMD *) skb->data; - pCmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_SDIO_PULL_CFG_REQ; - pCmd->length = 4; - pCmd->data[0] = (priv->bt_dev.sdio_pull_cfg & 0x000000ff); - pCmd->data[1] = (priv->bt_dev.sdio_pull_cfg & 0x0000ff00) >> 8; - pCmd->data[2] = (priv->bt_dev.sdio_pull_cfg & 0x00ff0000) >> 16; - pCmd->data[3] = (priv->bt_dev.sdio_pull_cfg & 0xff000000) >> 24; + pcmd = (BT_CMD *) skb->data; + pcmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_SDIO_PULL_CFG_REQ; + pcmd->length = 4; + pcmd->data[0] = (priv->bt_dev.sdio_pull_cfg & 0x000000ff); + pcmd->data[1] = (priv->bt_dev.sdio_pull_cfg & 0x0000ff00) >> 8; + pcmd->data[2] = (priv->bt_dev.sdio_pull_cfg & 0x00ff0000) >> 16; + pcmd->data[3] = (priv->bt_dev.sdio_pull_cfg & 0xff000000) >> 24; bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; - skb_put(skb, BT_CMD_HEADER_SIZE + pCmd->length); + skb_put(skb, BT_CMD_HEADER_SIZE + pcmd->length); skb->dev = (void *)(&(priv->bt_dev.m_dev[BT_SEQ])); skb_queue_head(&priv->adapter->tx_queue, skb); PRINTM(CMD, "Queue SDIO PULL CFG Command(0x%x), PullUp=0x%x%x,PullDown=0x%x%x\n", - pCmd->ocf_ogf, pCmd->data[1], pCmd->data[0], - pCmd->data[3], pCmd->data[2]); + pcmd->ocf_ogf, pcmd->data[1], pcmd->data[0], + pcmd->data[3], pcmd->data[2]); priv->bt_dev.sendcmdflag = TRUE; priv->bt_dev.send_cmd_ocf = BT_CMD_SDIO_PULL_CFG_REQ; priv->adapter->cmd_complete = FALSE; @@ -778,7 +788,7 @@ fm_set_intr_mask(bt_private * priv, u32 mask) { struct sk_buff *skb = NULL; u8 ret = BT_STATUS_SUCCESS; - BT_CMD *pCmd; + BT_CMD *pcmd; ENTER(); skb = bt_skb_alloc(sizeof(BT_CMD), GFP_ATOMIC); @@ -787,14 +797,14 @@ fm_set_intr_mask(bt_private * priv, u32 mask) ret = BT_STATUS_FAILURE; goto exit; } - pCmd = (BT_CMD *) skb->data; - pCmd->ocf_ogf = (VENDOR_OGF << 10) | FM_CMD; - pCmd->length = 0x05; - pCmd->data[0] = FM_SET_INTR_MASK; - memcpy(&pCmd->data[1], &mask, sizeof(mask)); + pcmd = (BT_CMD *) skb->data; + pcmd->ocf_ogf = (VENDOR_OGF << 10) | FM_CMD; + pcmd->length = 0x05; + pcmd->data[0] = FM_SET_INTR_MASK; + memcpy(&pcmd->data[1], &mask, sizeof(mask)); PRINTM(CMD, "FM set intr mask=0x%x\n", mask); bt_cb(skb)->pkt_type = HCI_COMMAND_PKT; - skb_put(skb, BT_CMD_HEADER_SIZE + pCmd->length); + skb_put(skb, BT_CMD_HEADER_SIZE + pcmd->length); skb->dev = (void *)(&(priv->bt_dev.m_dev[FM_SEQ])); skb_queue_head(&priv->adapter->tx_queue, skb); priv->bt_dev.sendcmdflag = TRUE; @@ -825,7 +835,7 @@ bt_enable_hs(bt_private * priv) { struct sk_buff *skb = NULL; u8 ret = BT_STATUS_SUCCESS; - BT_CMD *pCmd; + BT_CMD *pcmd; ENTER(); skb = bt_skb_alloc(sizeof(BT_CMD), GFP_ATOMIC); if (skb == NULL) { @@ -834,16 +844,16 @@ bt_enable_hs(bt_private * priv) goto exit; } priv->adapter->suspend_fail = FALSE; - pCmd = (BT_CMD *) skb->data; - pCmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_HOST_SLEEP_ENABLE; - pCmd->length = 0; + pcmd = (BT_CMD *) skb->data; + pcmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_HOST_SLEEP_ENABLE; + pcmd->length = 0; bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; - skb_put(skb, BT_CMD_HEADER_SIZE + pCmd->length); + skb_put(skb, BT_CMD_HEADER_SIZE + pcmd->length); skb->dev = (void *)(&(priv->bt_dev.m_dev[BT_SEQ])); skb_queue_head(&priv->adapter->tx_queue, skb); priv->bt_dev.sendcmdflag = TRUE; priv->bt_dev.send_cmd_ocf = BT_CMD_HOST_SLEEP_ENABLE; - PRINTM(CMD, "Queue hs enable Command(0x%x)\n", pCmd->ocf_ogf); + PRINTM(CMD, "Queue hs enable Command(0x%x)\n", pcmd->ocf_ogf); wake_up_interruptible(&priv->MainThread.waitQ); if (!os_wait_interruptible_timeout (priv->adapter->cmd_wait_q, priv->adapter->hs_state, @@ -886,7 +896,7 @@ bt_set_ble_deepsleep(bt_private * priv, int mode) { struct sk_buff *skb = NULL; u8 ret = BT_STATUS_SUCCESS; - BT_BLE_CMD *pCmd; + BT_BLE_CMD *pcmd; ENTER(); skb = bt_skb_alloc(sizeof(BT_BLE_CMD), GFP_ATOMIC); if (skb == NULL) { @@ -894,10 +904,10 @@ bt_set_ble_deepsleep(bt_private * priv, int mode) ret = BT_STATUS_FAILURE; goto exit; } - pCmd = (BT_BLE_CMD *) skb->data; - pCmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_BLE_DEEP_SLEEP; - pCmd->length = 1; - pCmd->deepsleep = mode; + pcmd = (BT_BLE_CMD *) skb->data; + pcmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_BLE_DEEP_SLEEP; + pcmd->length = 1; + pcmd->deepsleep = mode; bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; skb_put(skb, sizeof(BT_BLE_CMD)); skb->dev = (void *)(&(priv->bt_dev.m_dev[BT_SEQ])); @@ -905,7 +915,7 @@ bt_set_ble_deepsleep(bt_private * priv, int mode) priv->bt_dev.sendcmdflag = TRUE; priv->bt_dev.send_cmd_ocf = BT_CMD_BLE_DEEP_SLEEP; priv->adapter->cmd_complete = FALSE; - PRINTM(CMD, "BT: Set BLE deepsleep = %d (0x%x)\n", mode, pCmd->ocf_ogf); + PRINTM(CMD, "BT: Set BLE deepsleep = %d (0x%x)\n", mode, pcmd->ocf_ogf); wake_up_interruptible(&priv->MainThread.waitQ); if (!os_wait_interruptible_timeout (priv->adapter->cmd_wait_q, priv->adapter->cmd_complete, @@ -931,7 +941,7 @@ bt_get_fw_version(bt_private * priv) { struct sk_buff *skb = NULL; u8 ret = BT_STATUS_SUCCESS; - BT_HCI_CMD *pCmd; + BT_HCI_CMD *pcmd; ENTER(); skb = bt_skb_alloc(sizeof(BT_HCI_CMD), GFP_ATOMIC); if (skb == NULL) { @@ -939,10 +949,10 @@ bt_get_fw_version(bt_private * priv) ret = BT_STATUS_FAILURE; goto exit; } - pCmd = (BT_HCI_CMD *) skb->data; - pCmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_GET_FW_VERSION; - pCmd->length = 0x01; - pCmd->cmd_type = 0x00; + pcmd = (BT_HCI_CMD *) skb->data; + pcmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_GET_FW_VERSION; + pcmd->length = 0x01; + pcmd->cmd_type = 0x00; bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; skb_put(skb, 4); skb->dev = (void *)(&(priv->bt_dev.m_dev[BT_SEQ])); @@ -976,7 +986,7 @@ bt_set_mac_address(bt_private * priv, u8 * mac) { struct sk_buff *skb = NULL; u8 ret = BT_STATUS_SUCCESS; - BT_HCI_CMD *pCmd; + BT_HCI_CMD *pcmd; int i = 0; ENTER(); skb = bt_skb_alloc(sizeof(BT_HCI_CMD), GFP_ATOMIC); @@ -985,13 +995,13 @@ bt_set_mac_address(bt_private * priv, u8 * mac) ret = BT_STATUS_FAILURE; goto exit; } - pCmd = (BT_HCI_CMD *) skb->data; - pCmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_CONFIG_MAC_ADDR; - pCmd->length = 8; - pCmd->cmd_type = MRVL_VENDOR_PKT; - pCmd->cmd_len = 6; + pcmd = (BT_HCI_CMD *) skb->data; + pcmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_CONFIG_MAC_ADDR; + pcmd->length = 8; + pcmd->cmd_type = MRVL_VENDOR_PKT; + pcmd->cmd_len = 6; for (i = 0; i < 6; i++) - pCmd->data[i] = mac[5 - i]; + pcmd->data[i] = mac[5 - i]; bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; skb_put(skb, sizeof(BT_HCI_CMD)); skb->dev = (void *)(&(priv->bt_dev.m_dev[BT_SEQ])); @@ -1000,7 +1010,7 @@ bt_set_mac_address(bt_private * priv, u8 * mac) priv->bt_dev.send_cmd_ocf = BT_CMD_CONFIG_MAC_ADDR; priv->adapter->cmd_complete = FALSE; PRINTM(CMD, "BT: Set mac addr " MACSTR " (0x%x)\n", MAC2STR(mac), - pCmd->ocf_ogf); + pcmd->ocf_ogf); wake_up_interruptible(&priv->MainThread.waitQ); if (!os_wait_interruptible_timeout (priv->adapter->cmd_wait_q, priv->adapter->cmd_complete, @@ -1028,7 +1038,7 @@ bt_load_cal_data(bt_private * priv, u8 * config_data, u8 * mac) { struct sk_buff *skb = NULL; u8 ret = BT_STATUS_SUCCESS; - BT_CMD *pCmd; + BT_CMD *pcmd; int i = 0; /* u8 config_data[28] = {0x37 0x01 0x1c 0x00 0xFF 0xFF 0xFF 0xFF 0x01 0x7f 0x04 0x02 0x00 0x00 0xBA 0xCE 0xC0 0xC6 0x2D 0x00 0x00 0x00 @@ -1041,31 +1051,30 @@ bt_load_cal_data(bt_private * priv, u8 * config_data, u8 * mac) ret = BT_STATUS_FAILURE; goto exit; } - pCmd = (BT_CMD *) skb->data; - pCmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_LOAD_CONFIG_DATA; - pCmd->length = 0x20; - pCmd->data[0] = 0x00; - pCmd->data[1] = 0x00; - pCmd->data[2] = 0x00; - pCmd->data[3] = 0x1C; + pcmd = (BT_CMD *) skb->data; + pcmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_LOAD_CONFIG_DATA; + pcmd->length = 0x20; + pcmd->data[0] = 0x00; + pcmd->data[1] = 0x00; + pcmd->data[2] = 0x00; + pcmd->data[3] = 0x1C; /* swip cal-data byte */ - for (i = 4; i < 32; i++) { - pCmd->data[i] = config_data[(i / 4) * 8 - 1 - i]; - } + for (i = 4; i < 32; i++) + pcmd->data[i] = config_data[(i / 4) * 8 - 1 - i]; if (mac != NULL) { - pCmd->data[2] = 0x01; /* skip checksum */ + pcmd->data[2] = 0x01; /* skip checksum */ for (i = 24; i < 30; i++) - pCmd->data[i] = mac[29 - i]; + pcmd->data[i] = mac[29 - i]; } bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; - skb_put(skb, BT_CMD_HEADER_SIZE + pCmd->length); + skb_put(skb, BT_CMD_HEADER_SIZE + pcmd->length); skb->dev = (void *)(&(priv->bt_dev.m_dev[BT_SEQ])); skb_queue_head(&priv->adapter->tx_queue, skb); priv->bt_dev.sendcmdflag = TRUE; priv->bt_dev.send_cmd_ocf = BT_CMD_LOAD_CONFIG_DATA; priv->adapter->cmd_complete = FALSE; - DBG_HEXDUMP(DAT_D, "calirate data: ", pCmd->data, 32); + DBG_HEXDUMP(DAT_D, "calirate data: ", pcmd->data, 32); wake_up_interruptible(&priv->MainThread.waitQ); if (!os_wait_interruptible_timeout (priv->adapter->cmd_wait_q, priv->adapter->cmd_complete, @@ -1080,6 +1089,56 @@ exit: } /** + * @brief This function load the calibrate EXT data + * + * @param priv A pointer to bt_private structure + * @param config_data A pointer to calibrate data + * @param mac A pointer to mac address + * + * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE + */ +int +bt_load_cal_data_ext(bt_private * priv, u8 * config_data, u32 cfg_data_len) +{ + struct sk_buff *skb = NULL; + u8 ret = BT_STATUS_SUCCESS; + BT_CMD *pcmd; + + ENTER(); + skb = bt_skb_alloc(sizeof(BT_CMD), GFP_ATOMIC); + if (skb == NULL) { + PRINTM(WARN, "No free skb\n"); + ret = BT_STATUS_FAILURE; + goto exit; + } + pcmd = (BT_CMD *) skb->data; + pcmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_LOAD_CONFIG_DATA_EXT; + pcmd->length = cfg_data_len; + + memcpy(pcmd->data, config_data, cfg_data_len); + bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; + skb_put(skb, BT_CMD_HEADER_SIZE + pcmd->length); + skb->dev = (void *)(&(priv->bt_dev.m_dev[BT_SEQ])); + skb_queue_head(&priv->adapter->tx_queue, skb); + priv->bt_dev.sendcmdflag = TRUE; + priv->bt_dev.send_cmd_ocf = BT_CMD_LOAD_CONFIG_DATA_EXT; + priv->adapter->cmd_complete = FALSE; + + DBG_HEXDUMP(DAT_D, "calirate ext data", pcmd->data, pcmd->length); + wake_up_interruptible(&priv->MainThread.waitQ); + if (!os_wait_interruptible_timeout + (priv->adapter->cmd_wait_q, priv->adapter->cmd_complete, + WAIT_UNTIL_CMD_RESP)) { + ret = BT_STATUS_FAILURE; + PRINTM(ERROR, "BT: Load calibrate ext data: timeout:\n"); + bt_cmd_timeout_func(priv->adapter, BT_CMD_LOAD_CONFIG_DATA_EXT); + } +exit: + LEAVE(); + return ret; +} + +/** * @brief This function writes value to CSU registers * * @param priv A pointer to bt_private structure @@ -1093,7 +1152,7 @@ bt_write_reg(bt_private * priv, u8 type, u32 offset, u16 value) { struct sk_buff *skb = NULL; u8 ret = BT_STATUS_SUCCESS; - BT_CSU_CMD *pCmd; + BT_CSU_CMD *pcmd; ENTER(); skb = bt_skb_alloc(sizeof(BT_CSU_CMD), GFP_ATOMIC); if (skb == NULL) { @@ -1101,16 +1160,16 @@ bt_write_reg(bt_private * priv, u8 type, u32 offset, u16 value) ret = BT_STATUS_FAILURE; goto exit; } - pCmd = (BT_CSU_CMD *) skb->data; - pCmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_CSU_WRITE_REG; - pCmd->length = 7; - pCmd->type = type; - pCmd->offset[0] = (offset & 0x000000ff); - pCmd->offset[1] = (offset & 0x0000ff00) >> 8; - pCmd->offset[2] = (offset & 0x00ff0000) >> 16; - pCmd->offset[3] = (offset & 0xff000000) >> 24; - pCmd->value[0] = (value & 0x00ff); - pCmd->value[1] = (value & 0xff00) >> 8; + pcmd = (BT_CSU_CMD *) skb->data; + pcmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_CSU_WRITE_REG; + pcmd->length = 7; + pcmd->type = type; + pcmd->offset[0] = (offset & 0x000000ff); + pcmd->offset[1] = (offset & 0x0000ff00) >> 8; + pcmd->offset[2] = (offset & 0x00ff0000) >> 16; + pcmd->offset[3] = (offset & 0xff000000) >> 24; + pcmd->value[0] = (value & 0x00ff); + pcmd->value[1] = (value & 0xff00) >> 8; bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; skb_put(skb, sizeof(BT_CSU_CMD)); skb->dev = (void *)(&(priv->bt_dev.m_dev[BT_SEQ])); @@ -1201,7 +1260,7 @@ bt_prepare_command(bt_private * priv) * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE */ static int -SendSinglePacket(bt_private * priv, struct sk_buff *skb) +send_single_packet(bt_private * priv, struct sk_buff *skb) { int ret; ENTER(); @@ -1301,11 +1360,11 @@ done: void bt_free_adapter(bt_private * priv) { - bt_adapter *Adapter = priv->adapter; + bt_adapter *adapter = priv->adapter; ENTER(); skb_queue_purge(&priv->adapter->tx_queue); /* Free the adapter object itself */ - kfree(Adapter); + kfree(adapter); priv->adapter = NULL; LEAVE(); @@ -1385,7 +1444,7 @@ mdev_send_frame(struct m_dev *m_dev, struct sk_buff *skb) priv->debug_device_pending = 1; priv->debug_ocf_ogf[0] = skb->data[0]; priv->debug_ocf_ogf[1] = skb->data[1]; - PRINTM(CMD, "debug_ocf_ogf[0]=0x%x debug_ocf_ogf[1]=0x%x \n", + PRINTM(CMD, "debug_ocf_ogf[0]=0x%x debug_ocf_ogf[1]=0x%x\n", priv->debug_ocf_ogf[0], priv->debug_ocf_ogf[1]); } @@ -1542,7 +1601,7 @@ bt_service_main_thread(void *data) { bt_thread *thread = data; bt_private *priv = thread->priv; - bt_adapter *Adapter = priv->adapter; + bt_adapter *adapter = priv->adapter; wait_queue_t wait; struct sk_buff *skb; ENTER(); @@ -1562,17 +1621,17 @@ bt_service_main_thread(void *data) } OS_SET_THREAD_STATE(TASK_RUNNING); remove_wait_queue(&thread->waitQ, &wait); - if (kthread_should_stop() || Adapter->SurpriseRemoved) { + if (kthread_should_stop() || adapter->SurpriseRemoved) { PRINTM(INFO, "main-thread: break from main thread: " "SurpriseRemoved=0x%x\n", - Adapter->SurpriseRemoved); + adapter->SurpriseRemoved); break; } PRINTM(INFO, "Main: Thread waking up...\n"); if (priv->adapter->IntCounter) { OS_INT_DISABLE; - Adapter->IntCounter = 0; + adapter->IntCounter = 0; OS_INT_RESTORE; sbi_get_int_status(priv); } else if ((priv->adapter->ps_state == PS_SLEEP) && @@ -1587,7 +1646,7 @@ bt_service_main_thread(void *data) if (!skb_queue_empty(&priv->adapter->tx_queue)) { skb = skb_dequeue(&priv->adapter->tx_queue); if (skb) { - if (SendSinglePacket(priv, skb)) + if (send_single_packet(priv, skb)) ((struct m_dev *)skb->dev)-> stat.err_tx++; else @@ -1766,7 +1825,8 @@ sbi_register_conf_dpc(bt_private * priv) } } #ifdef SDIO_SUSPEND_RESUME - priv->bt_dev.gpio_gap = 0xffff; + + priv->bt_dev.gpio_gap = 0x0464; ret = bt_send_hscfg_cmd(priv); if (ret < 0) { PRINTM(FATAL, "Send HSCFG failed!\n"); @@ -1781,7 +1841,7 @@ sbi_register_conf_dpc(bt_private * priv) priv->bt_dev.m_dev[BT_SEQ].dev_type = BT_AMP_TYPE; } /* block all the packet from bluez */ - if (init_cfg || cal_cfg || bt_mac) + if (init_cfg || cal_cfg || bt_mac || cal_cfg_ext) priv->adapter->tx_lock = TRUE; if (mbt_dev) { @@ -2052,11 +2112,30 @@ sbi_register_conf_dpc(bt_private * priv) goto done; } } - if (init_cfg || cal_cfg || bt_mac) { + if (cal_cfg_ext) { + if (BT_STATUS_SUCCESS != bt_cal_config_ext(priv, cal_cfg_ext)) { + PRINTM(FATAL, "BT: Set cal ext data failed\n"); + if (mbt_dev) { + m_dev = &(priv->bt_dev.m_dev[BT_SEQ]); + /** unregister m_dev to char_dev */ + m_dev->close(m_dev); + for (i = 0; i < 3; i++) + kfree_skb(mbt_dev->reassembly[i]); + /** unregister m_dev to char_dev */ + chardev_cleanup_one(m_dev, chardev_class); + free_m_dev(m_dev); + } + ret = BT_STATUS_FAILURE; + goto done; + } + } + if (init_cfg || cal_cfg || bt_mac || cal_cfg_ext) { priv->adapter->tx_lock = FALSE; bt_restore_tx_queue(priv); } + bt_register_hostwake_irq(NULL); + /* Get FW version */ bt_get_fw_version(priv); snprintf(priv->adapter->drv_ver, MAX_VER_STR_LEN, @@ -2255,7 +2334,7 @@ bt_remove_card(void *card) static int bt_set_carddetect(int on) { - PRINTM(MSG, "%s = %d\n", __FUNCTION__, on); + PRINTM(MSG, "%s = %d\n", __func__, on); if (bt_control_data && bt_control_data->set_carddetect) bt_control_data->set_carddetect(on); @@ -2271,7 +2350,7 @@ bt_set_carddetect(int on) static int bt_set_power(int on, unsigned long msec) { - PRINTM(MSG, "%s = %d\n", __FUNCTION__, on); + PRINTM(MSG, "%s = %d\n", __func__, on); if (bt_control_data && bt_control_data->set_power) bt_control_data->set_power(on); @@ -2280,6 +2359,45 @@ bt_set_power(int on, unsigned long msec) return 0; } +static irqreturn_t +bt_hostwake_isr(int irq, void *dev_id) +{ + PRINTM(INTR, "Recv hostwake isr\n"); + return IRQ_HANDLED; +} + +void +bt_enable_hostwake_irq(int flag) +{ + if (bt_irqres && irq_registered) { + PRINTM(INTR, "enable_hostwake_irq=%d\n", flag); + if (flag) { + enable_irq(bt_irqres->start); + enable_irq_wake(bt_irqres->start); + } else { + disable_irq_wake(bt_irqres->start); + disable_irq(bt_irqres->start); + } + } +} + +static void +bt_register_hostwake_irq(void *handle) +{ + if (bt_irqres && !irq_registered) { + irq_registered = + request_irq(bt_irqres->start, bt_hostwake_isr, + bt_irqres->flags, DRIVER_NAME, handle); + if (irq_registered < 0) + PRINTM(ERROR, "Couldn't acquire BT_HOST_WAKE IRQ\n"); + else { + irq_registered = 1; + enable_irq_wake(bt_irqres->start); + bt_enable_hostwake_irq(FALSE); + } + } +} + void mdev_poweroff(struct m_dev *m_dev) { @@ -2307,9 +2425,14 @@ bt_probe(struct platform_device *pdev) ENTER(); - bt_control_data = bt_ctrl; - bt_set_power(1, 0); /* Power On */ - bt_set_carddetect(1); /* CardDetect (0->1) */ + bt_irqres = platform_get_resource_byname(pdev, + IORESOURCE_IRQ, + IORESOURCE_NAME); + if (minicard_pwrup) { + bt_control_data = bt_ctrl; + bt_set_power(1, 0); /* Power On */ + bt_set_carddetect(1); /* CardDetect (0->1) */ + } LEAVE(); return 0; @@ -2329,9 +2452,16 @@ bt_remove(struct platform_device *pdev) ENTER(); - bt_control_data = bt_ctrl; - bt_set_power(0, 0); /* Power Off */ - bt_set_carddetect(0); /* CardDetect (1->0) */ + if (bt_irqres && irq_registered) { + PRINTM(MSG, "Free hostwake IRQ wakeup\n"); + free_irq(bt_irqres->start, NULL); + irq_registered = 0; + } + if (minicard_pwrup) { + bt_control_data = bt_ctrl; + bt_set_power(0, 0); /* Power Off */ + bt_set_carddetect(0); /* CardDetect (1->0) */ + } LEAVE(); return 0; @@ -2357,8 +2487,7 @@ bt_add_dev(void) ENTER(); - if (minicard_pwrup) - ret = platform_driver_register(&bt_device); + ret = platform_driver_register(&bt_device); LEAVE(); return ret; @@ -2374,8 +2503,7 @@ bt_del_dev(void) { ENTER(); - if (minicard_pwrup) - platform_driver_unregister(&bt_device); + platform_driver_unregister(&bt_device); LEAVE(); } @@ -2461,6 +2589,8 @@ module_param(init_cfg, charp, 0); MODULE_PARM_DESC(init_cfg, "BT init config file name"); module_param(cal_cfg, charp, 0); MODULE_PARM_DESC(cal_cfg, "BT calibrate file name"); +module_param(cal_cfg_ext, charp, 0); +MODULE_PARM_DESC(cal_cfg_ext, "BT calibrate ext file name"); module_param(bt_mac, charp, 0); MODULE_PARM_DESC(bt_mac, "BT init mac address"); module_param(minicard_pwrup, int, 0); diff --git a/drivers/bluetooth/sd8797/bt/bt_proc.c b/drivers/bluetooth/sd8797/bt/bt_proc.c index 74007eb7bd1f..ad9a6e9cd23d 100644 --- a/drivers/bluetooth/sd8797/bt/bt_proc.c +++ b/drivers/bluetooth/sd8797/bt/bt_proc.c @@ -71,12 +71,12 @@ struct proc_data { /** Device size */ #define item_dev_size(n) (sizeof((bt_dev_t *)0)->n) /** Device address */ -#define item_dev_addr(n) ((t_ptr) & ((bt_dev_t *)0)->n) +#define item_dev_addr(n) ((t_ptr) &((bt_dev_t *)0)->n) /** Adapter size */ #define item_adapter_size(n) (sizeof((bt_adapter *)0)->n) /** Adapter address */ -#define item_adapter_addr(n) ((t_ptr) & ((bt_adapter *)0)->n) +#define item_adapter_addr(n) ((t_ptr) &((bt_adapter *)0)->n) static struct item_data config_items[] = { #ifdef DEBUG_LEVEL1 @@ -233,23 +233,19 @@ parse_cmd52_string(const char __user * buffer, size_t len, /* Get func */ pos = strsep(&string, " \t"); - if (pos) { + if (pos) *func = string_to_number(pos); - } /* Get reg */ pos = strsep(&string, " \t"); - if (pos) { + if (pos) *reg = string_to_number(pos); - } /* Get val (optional) */ pos = strsep(&string, " \t"); - if (pos) { + if (pos) *val = string_to_number(pos); - } - if (string) - kfree(string); + kfree(string); LEAVE(); return ret; } diff --git a/drivers/bluetooth/sd8797/bt/bt_sdio.h b/drivers/bluetooth/sd8797/bt/bt_sdio.h index 2c542d58b49f..541d5f4b81e4 100644 --- a/drivers/bluetooth/sd8797/bt/bt_sdio.h +++ b/drivers/bluetooth/sd8797/bt/bt_sdio.h @@ -27,7 +27,7 @@ /** IRQ return type */ typedef irqreturn_t IRQ_RET_TYPE; /** IRQ return */ -#define IRQ_RET return IRQ_HANDLED +#define IRQ_RET (return IRQ_HANDLED) /** ISR notifier function */ typedef IRQ_RET_TYPE(*isr_notifier_fn_t) (s32 irq, void *dev_id, struct pt_regs * reg); @@ -60,7 +60,7 @@ typedef IRQ_RET_TYPE(*isr_notifier_fn_t) (s32 irq, void *dev_id, /** Host Control Registers : Configuration */ #define CONFIGURATION_REG 0x00 /** Host Control Registers : Host without Command 53 finish host*/ -#define HOST_TO_CARD_EVENT (0x1U << 3) +#define HOST_TO_CARD_EVENT (0x1U << 3) /** Host Control Registers : Host without Command 53 finish host */ #define HOST_WO_CMD53_FINISH_HOST (0x1U << 2) /** Host Control Registers : Host power up */ @@ -97,80 +97,80 @@ typedef IRQ_RET_TYPE(*isr_notifier_fn_t) (s32 irq, void *dev_id, /** Host Control Registers : Upload CRC error */ #define UP_LD_CRC_ERR (0x1U << 2) /** Host Control Registers : Upload restart */ -#define UP_LD_RESTART (0x1U << 1) +#define UP_LD_RESTART (0x1U << 1) /** Host Control Registers : Download restart */ -#define DN_LD_RESTART (0x1U << 0) +#define DN_LD_RESTART (0x1U << 0) /* Card Control Registers */ /** Card Control Registers : Read SQ base address A0 register */ -#define SQ_READ_BASE_ADDRESS_A0_REG 0x40 +#define SQ_READ_BASE_ADDRESS_A0_REG 0x40 /** Card Control Registers : Read SQ base address A1 register */ -#define SQ_READ_BASE_ADDRESS_A1_REG 0x41 +#define SQ_READ_BASE_ADDRESS_A1_REG 0x41 /** Card Control Registers : Read SQ base address A2 register */ -#define SQ_READ_BASE_ADDRESS_A2_REG 0x42 +#define SQ_READ_BASE_ADDRESS_A2_REG 0x42 /** Card Control Registers : Read SQ base address A3 register */ -#define SQ_READ_BASE_ADDRESS_A3_REG 0x43 +#define SQ_READ_BASE_ADDRESS_A3_REG 0x43 /** Card Control Registers : Read SQ base address B0 register */ -#define SQ_READ_BASE_ADDRESS_B0_REG 0x44 +#define SQ_READ_BASE_ADDRESS_B0_REG 0x44 /** Card Control Registers : Read SQ base address B1 register */ -#define SQ_READ_BASE_ADDRESS_B1_REG 0x45 +#define SQ_READ_BASE_ADDRESS_B1_REG 0x45 /** Card Control Registers : Read SQ base address B2 register */ -#define SQ_READ_BASE_ADDRESS_B2_REG 0x46 +#define SQ_READ_BASE_ADDRESS_B2_REG 0x46 /** Card Control Registers : Read SQ base address B3 register */ -#define SQ_READ_BASE_ADDRESS_B3_REG 0x47 +#define SQ_READ_BASE_ADDRESS_B3_REG 0x47 /** Card Control Registers : Card status register */ -#define CARD_STATUS_REG 0x30 +#define CARD_STATUS_REG 0x30 /** Card Control Registers : Card I/O ready */ -#define CARD_IO_READY (0x1U << 3) +#define CARD_IO_READY (0x1U << 3) /** Card Control Registers : CIS card ready */ -#define CIS_CARD_RDY (0x1U << 2) +#define CIS_CARD_RDY (0x1U << 2) /** Card Control Registers : Upload card ready */ -#define UP_LD_CARD_RDY (0x1U << 1) +#define UP_LD_CARD_RDY (0x1U << 1) /** Card Control Registers : Download card ready */ -#define DN_LD_CARD_RDY (0x1U << 0) +#define DN_LD_CARD_RDY (0x1U << 0) /** Card Control Registers : Host interrupt mask register */ -#define HOST_INTERRUPT_MASK_REG 0x34 +#define HOST_INTERRUPT_MASK_REG 0x34 /** Card Control Registers : Host power interrupt mask */ -#define HOST_POWER_INT_MASK (0x1U << 3) +#define HOST_POWER_INT_MASK (0x1U << 3) /** Card Control Registers : Abort card interrupt mask */ -#define ABORT_CARD_INT_MASK (0x1U << 2) +#define ABORT_CARD_INT_MASK (0x1U << 2) /** Card Control Registers : Upload card interrupt mask */ -#define UP_LD_CARD_INT_MASK (0x1U << 1) +#define UP_LD_CARD_INT_MASK (0x1U << 1) /** Card Control Registers : Download card interrupt mask */ -#define DN_LD_CARD_INT_MASK (0x1U << 0) +#define DN_LD_CARD_INT_MASK (0x1U << 0) /** Card Control Registers : Card interrupt status register */ -#define CARD_INTERRUPT_STATUS_REG 0x38 +#define CARD_INTERRUPT_STATUS_REG 0x38 /** Card Control Registers : Power up interrupt */ -#define POWER_UP_INT (0x1U << 4) +#define POWER_UP_INT (0x1U << 4) /** Card Control Registers : Power down interrupt */ -#define POWER_DOWN_INT (0x1U << 3) +#define POWER_DOWN_INT (0x1U << 3) /** Card Control Registers : Card interrupt RSR register */ -#define CARD_INTERRUPT_RSR_REG 0x3c +#define CARD_INTERRUPT_RSR_REG 0x3c /** Card Control Registers : Power up RSR */ -#define POWER_UP_RSR (0x1U << 4) +#define POWER_UP_RSR (0x1U << 4) /** Card Control Registers : Power down RSR */ -#define POWER_DOWN_RSR (0x1U << 3) +#define POWER_DOWN_RSR (0x1U << 3) /** Card Control Registers : Debug 0 register */ -#define DEBUG_0_REG 0x70 +#define DEBUG_0_REG 0x70 /** Card Control Registers : SD test BUS 0 */ -#define SD_TESTBUS0 (0x1U) +#define SD_TESTBUS0 (0x1U) /** Card Control Registers : Debug 1 register */ -#define DEBUG_1_REG 0x71 +#define DEBUG_1_REG 0x71 /** Card Control Registers : SD test BUS 1 */ -#define SD_TESTBUS1 (0x1U) +#define SD_TESTBUS1 (0x1U) /** Card Control Registers : Debug 2 register */ -#define DEBUG_2_REG 0x72 +#define DEBUG_2_REG 0x72 /** Card Control Registers : SD test BUS 2 */ -#define SD_TESTBUS2 (0x1U) +#define SD_TESTBUS2 (0x1U) /** Card Control Registers : Debug 3 register */ -#define DEBUG_3_REG 0x73 +#define DEBUG_3_REG 0x73 /** Card Control Registers : SD test BUS 3 */ -#define SD_TESTBUS3 (0x1U) +#define SD_TESTBUS3 (0x1U) /** Host Control Registers : I/O port 0 */ #define IO_PORT_0_REG 0x78 @@ -188,24 +188,24 @@ typedef IRQ_RET_TYPE(*isr_notifier_fn_t) (s32 irq, void *dev_id, /** Rx unit register */ #define CARD_RX_UNIT_REG 0x63 /** Card Control Registers : Miscellaneous Configuration Register */ -#define CARD_MISC_CFG_REG 0x6C +#define CARD_MISC_CFG_REG 0x6C /** Misc. Config Register : Auto Re-enable interrupts */ #define AUTO_RE_ENABLE_INT (0x1U << 4) /** Card Control Registers : Card OCR 0 register */ -#define CARD_OCR_0_REG 0x68 +#define CARD_OCR_0_REG 0x68 /** Card Control Registers : Card OCR 1 register */ -#define CARD_OCR_1_REG 0x69 +#define CARD_OCR_1_REG 0x69 /** Card Control Registers : Card OCR 3 register */ -#define CARD_OCR_3_REG 0x6A +#define CARD_OCR_3_REG 0x6A /** Card Control Registers : Card config register */ -#define CARD_CONFIG_REG 0x6B +#define CARD_CONFIG_REG 0x6B /** Card Control Registers : Card revision register */ -#define CARD_REVISION_REG 0x5c +#define CARD_REVISION_REG 0x5c /** Card Control Registers : Command 53 finish G BUS */ -#define CMD53_FINISH_GBUS (0x1U << 1) +#define CMD53_FINISH_GBUS (0x1U << 1) /** Card Control Registers : SD negative edge */ -#define SD_NEG_EDGE (0x1U << 0) +#define SD_NEG_EDGE (0x1U << 0) /* Special registers in function 0 of the SDxx card */ /** Special register in function 0 of the SDxxx card : Scratch 0 */ @@ -244,6 +244,7 @@ struct sdio_mmc_card { int sd_read_cmd52_val(bt_private * priv); /** This function updates card reg based on the Cmd52 value in dev structure */ int sd_write_cmd52_val(bt_private * priv, int func, int reg, int val); +void bt_enable_hostwake_irq(int flag); #ifdef SDIO_SUSPEND_RESUME #ifdef MMC_PM_KEEP_POWER diff --git a/drivers/bluetooth/sd8797/bt/bt_sdiommc.c b/drivers/bluetooth/sd8797/bt/bt_sdiommc.c index 10bda897c177..3fdd23a6486c 100644 --- a/drivers/bluetooth/sd8797/bt/bt_sdiommc.c +++ b/drivers/bluetooth/sd8797/bt/bt_sdiommc.c @@ -71,7 +71,7 @@ extern int mbt_pm_keep_power; * @brief This function gets rx_unit value * * @param priv A pointer to bt_private structure - * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE + * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE */ int sd_get_rx_unit(bt_private * priv) @@ -95,7 +95,7 @@ sd_get_rx_unit(bt_private * priv) * * @param priv A pointer to bt_private structure * @param dat A pointer to keep returned data - * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE + * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE */ static int sd_read_firmware_status(bt_private * priv, u16 * dat) @@ -130,7 +130,7 @@ sd_read_firmware_status(bt_private * priv, u16 * dat) * * @param priv A pointer to bt_private structure * @param dat A pointer to keep returned data - * @return BT_STATUS_SUCCESS or other error no. + * @return BT_STATUS_SUCCESS or other error no. */ static int sd_read_rx_len(bt_private * priv, u16 * dat) @@ -154,7 +154,7 @@ sd_read_rx_len(bt_private * priv, u16 * dat) * * @param priv A pointer to bt_private structure * @param mask the interrupt mask - * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE + * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE */ static int sd_enable_host_int_mask(bt_private * priv, u8 mask) @@ -178,7 +178,7 @@ sd_enable_host_int_mask(bt_private * priv, u8 mask) * * @param priv A pointer to bt_private structure * @param mask the interrupt mask - * @return BT_STATUS_SUCCESS or other error no. + * @return BT_STATUS_SUCCESS or other error no. */ static int sd_disable_host_int_mask(bt_private * priv, u8 mask) @@ -210,9 +210,9 @@ done: /** * @brief This function polls the card status register * - * @param priv A pointer to bt_private structure - * @param bits the bit mask - * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE + * @param priv A pointer to bt_private structure + * @param bits the bit mask + * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE */ static int sd_poll_card_status(bt_private * priv, u8 bits) @@ -245,8 +245,8 @@ sd_poll_card_status(bt_private * priv, u8 bits) /** * @brief This function reads updates the Cmd52 value in dev structure * - * @param priv A pointer to bt_private structure - * @return BT_STATUS_SUCCESS or other error no. + * @param priv A pointer to bt_private structure + * @return BT_STATUS_SUCCESS or other error no. */ int sd_read_cmd52_val(bt_private * priv) @@ -279,11 +279,11 @@ sd_read_cmd52_val(bt_private * priv) /** * @brief This function updates card reg based on the Cmd52 value in dev structure * - * @param priv A pointer to bt_private structure - * @param func Stores func variable - * @param reg Stores reg variable - * @param val Stores val variable - * @return BT_STATUS_SUCCESS or other error no. + * @param priv A pointer to bt_private structure + * @param func Stores func variable + * @param reg Stores reg variable + * @param val Stores val variable + * @return BT_STATUS_SUCCESS or other error no. */ int sd_write_cmd52_val(bt_private * priv, int func, int reg, int val) @@ -323,8 +323,8 @@ done: * @brief This function probes the card * * @param func A pointer to sdio_func structure. - * @param id A pointer to structure sdio_device_id - * @return BT_STATUS_SUCCESS/BT_STATUS_FAILURE or other error no. + * @param id A pointer to structure sdio_device_id + * @return BT_STATUS_SUCCESS/BT_STATUS_FAILURE or other error no. */ static int sd_probe_card(struct sdio_func *func, const struct sdio_device_id *id) @@ -412,7 +412,7 @@ sd_verify_fw_download(bt_private * priv, int pollnum) * @brief Transfers firmware to card * * @param priv A Pointer to bt_private structure - * @return BT_STATUS_SUCCESS/BT_STATUS_FAILURE or other error no. + * @return BT_STATUS_SUCCESS/BT_STATUS_FAILURE or other error no. */ static int sd_init_fw_dpc(bt_private * priv) @@ -432,9 +432,6 @@ sd_init_fw_dpc(bt_private * priv) int tx_blocks = 0; int i = 0; int tries = 0; -#ifdef FW_DOWNLOAD_SPEED - u32 tv1, tv2; -#endif ENTER(); firmware = (u8 *) priv->firmware->data; @@ -442,10 +439,6 @@ sd_init_fw_dpc(bt_private * priv) PRINTM(INFO, "BT: Downloading FW image (%d bytes)\n", firmwarelen); -#ifdef FW_DOWNLOAD_SPEED - tv1 = get_utimeofday(); -#endif - tmpfwbufsz = BT_UPLD_SIZE + DMA_ALIGNMENT; tmpfwbuf = kmalloc(tmpfwbufsz, GFP_KERNEL); if (!tmpfwbuf) { @@ -566,18 +559,7 @@ sd_init_fw_dpc(bt_private * priv) ret = BT_STATUS_SUCCESS; done: -#ifdef FW_DOWNLOAD_SPEED - tv2 = get_utimeofday(); - PRINTM(INFO, "FW: %d.%03d.%03d ", tv1 / 1000000, - (tv1 % 1000000) / 1000, tv1 % 1000); - PRINTM(INFO, " -> %d.%03d.%03d ", tv2 / 1000000, - (tv2 % 1000000) / 1000, tv2 % 1000); - tv2 -= tv1; - PRINTM(INFO, " == %d.%03d.%03d\n", tv2 / 1000000, - (tv2 % 1000000) / 1000, tv2 % 1000); -#endif - if (tmpfwbuf) - kfree(tmpfwbuf); + kfree(tmpfwbuf); LEAVE(); return ret; } @@ -682,9 +664,8 @@ done: /* Stop the thread servicing the interrupts */ priv->adapter->SurpriseRemoved = TRUE; wake_up_interruptible(&priv->MainThread.waitQ); - while (priv->MainThread.pid) { + while (priv->MainThread.pid) os_sched_timeout(1); - } if (m_dev_bt->dev_pointer) { if (m_dev_bt->spec_type == IANYWHERE_SPEC) free_m_dev(m_dev_bt); @@ -720,8 +701,8 @@ sd_request_fw_callback(const struct firmware *firmware, void *context) /** * @brief This function downloads firmware image to the card. * - * @param priv A pointer to bt_private structure - * @return BT_STATUS_SUCCESS/BT_STATUS_FAILURE or other error no. + * @param priv A pointer to bt_private structure + * @return BT_STATUS_SUCCESS/BT_STATUS_FAILURE or other error no. */ int sd_download_firmware_w_helper(bt_private * priv) @@ -769,7 +750,7 @@ sd_download_firmware_w_helper(bt_private * priv) * @brief This function reads data from the card. * * @param priv A pointer to bt_private structure - * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE + * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE */ static int sd_card_to_host(bt_private * priv) @@ -1073,7 +1054,7 @@ sd_interrupt(struct sdio_func *func) if (!card || !card->priv) { PRINTM(INFO, "BT: %s: sbi_interrupt(%p) card or priv is NULL, card=%p\n", - __FUNCTION__, func, card); + __func__, func, card); LEAVE(); return; } @@ -1152,7 +1133,7 @@ bt_is_suspended(bt_private * priv) /** @brief This function handles client driver suspend * * @param dev A pointer to device structure - * @return BT_STATUS_SUCCESS or other error no. + * @return BT_STATUS_SUCCESS or other error no. */ int bt_sdio_suspend(struct device *dev) @@ -1206,6 +1187,9 @@ bt_sdio_suspend(struct device *dev) skb_queue_purge(&priv->adapter->tx_queue); priv->adapter->is_suspended = TRUE; + + bt_enable_hostwake_irq(TRUE); + LEAVE(); /* We will keep the power when hs enabled successfully */ if ((mbt_pm_keep_power) && (priv->adapter->hs_state == HS_ACTIVATED)) { @@ -1228,7 +1212,7 @@ bt_sdio_suspend(struct device *dev) /** @brief This function handles client driver resume * * @param dev A pointer to device structure - * @return BT_STATUS_SUCCESS + * @return BT_STATUS_SUCCESS */ int bt_sdio_resume(struct device *dev) @@ -1241,6 +1225,7 @@ bt_sdio_resume(struct device *dev) ENTER(); if (func) { + bt_enable_hostwake_irq(FALSE); pm_flags = sdio_get_host_pm_caps(func); PRINTM(CMD, "BT: %s: resume: PM flags = 0x%x\n", sdio_func_id(func), pm_flags); @@ -1312,7 +1297,7 @@ sbi_register(void) ENTER(); if (sdio_register_driver(&sdio_bt) != 0) { - PRINTM(FATAL, "BT: SD Driver Registration Failed \n"); + PRINTM(FATAL, "BT: SD Driver Registration Failed\n"); LEAVE(); return NULL; } else @@ -1325,7 +1310,7 @@ sbi_register(void) /** * @brief This function de-registers the bt module in bus driver. * - * @return N/A + * @return N/A */ void sbi_unregister(void) @@ -1340,7 +1325,7 @@ sbi_unregister(void) * @brief This function registers the device. * * @param priv A pointer to bt_private structure - * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE + * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE */ int sbi_register_dev(bt_private * priv) @@ -1375,8 +1360,7 @@ sbi_register_dev(bt_private * priv) } ret = sdio_set_block_size(card->func, SD_BLOCK_SIZE); if (ret) { - PRINTM(FATAL, ": %s: cannot set SDIO block size\n", - __FUNCTION__); + PRINTM(FATAL, ": %s: cannot set SDIO block size\n", __func__); goto release_irq; } @@ -1454,7 +1438,7 @@ failed: * @brief This function de-registers the device. * * @param priv A pointer to bt_private structure - * @return BT_STATUS_SUCCESS + * @return BT_STATUS_SUCCESS */ int sbi_unregister_dev(bt_private * priv) @@ -1479,7 +1463,7 @@ sbi_unregister_dev(bt_private * priv) * @brief This function enables the host interrupts. * * @param priv A pointer to bt_private structure - * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE + * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE */ int sd_enable_host_int(bt_private * priv) @@ -1506,7 +1490,7 @@ sd_enable_host_int(bt_private * priv) * @brief This function disables the host interrupts. * * @param priv A pointer to bt_private structure - * @return BT_STATUS_SUCCESS/BT_STATUS_FAILURE or other error no. + * @return BT_STATUS_SUCCESS/BT_STATUS_FAILURE or other error no. */ int sd_disable_host_int(bt_private * priv) @@ -1533,8 +1517,8 @@ sd_disable_host_int(bt_private * priv) * * @param priv A pointer to bt_private structure * @param payload A pointer to the data/cmd buffer - * @param nb Length of data/cmd - * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE + * @param nb Length of data/cmd + * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE */ int sbi_host_to_card(bt_private * priv, u8 * payload, u16 nb) @@ -1609,7 +1593,7 @@ exit: * @brief This function downloads firmware * * @param priv A pointer to bt_private structure - * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE + * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE */ int sbi_download_fw(bt_private * priv) @@ -1699,7 +1683,7 @@ err_register: * @brief This function checks the interrupt status and handle it accordingly. * * @param priv A pointer to bt_private structure - * @return BT_STATUS_SUCCESS + * @return BT_STATUS_SUCCESS */ int sbi_get_int_status(bt_private * priv) @@ -1738,7 +1722,7 @@ sbi_get_int_status(bt_private * priv) * @brief This function wakeup firmware * * @param priv A pointer to bt_private structure - * @return BT_STATUS_SUCCESS/BT_STATUS_FAILURE or other error no. + * @return BT_STATUS_SUCCESS/BT_STATUS_FAILURE or other error no. */ int sbi_wakeup_firmware(bt_private * priv) diff --git a/drivers/bluetooth/sd8897/bt/bt_drv.h b/drivers/bluetooth/sd8897/bt/bt_drv.h index 8e6f21f501cb..2a8f8f5fbcf3 100644 --- a/drivers/bluetooth/sd8897/bt/bt_drv.h +++ b/drivers/bluetooth/sd8897/bt/bt_drv.h @@ -96,11 +96,14 @@ extern u32 mbt_drvdbg; #ifdef DEBUG_LEVEL2 /** Print informative message */ -#define PRINTM_INFO(msg...) do {if (mbt_drvdbg & DBG_INFO) printk(KERN_DEBUG msg); } while (0) +#define PRINTM_INFO(msg...) do {if (mbt_drvdbg & DBG_INFO) \ + printk(KERN_DEBUG msg); } while (0) /** Print warning message */ -#define PRINTM_WARN(msg...) do {if (mbt_drvdbg & DBG_WARN) printk(KERN_DEBUG msg); } while (0) +#define PRINTM_WARN(msg...) do {if (mbt_drvdbg & DBG_WARN) \ + printk(KERN_DEBUG msg); } while (0) /** Print entry message */ -#define PRINTM_ENTRY(msg...) do {if (mbt_drvdbg & DBG_ENTRY) printk(KERN_DEBUG msg); } while (0) +#define PRINTM_ENTRY(msg...) do {if (mbt_drvdbg & DBG_ENTRY) \ + printk(KERN_DEBUG msg); } while (0) #else /** Print informative message */ #define PRINTM_INFO(msg...) do {} while (0) @@ -111,24 +114,33 @@ extern u32 mbt_drvdbg; #endif /* DEBUG_LEVEL2 */ /** Print interrupt message */ -#define PRINTM_INTR(msg...) do {if (mbt_drvdbg & DBG_INTR) printk(KERN_DEBUG msg); } while (0) +#define PRINTM_INTR(msg...) do {if (mbt_drvdbg & DBG_INTR) \ + printk(KERN_DEBUG msg); } while (0) /** Print event message */ -#define PRINTM_EVENT(msg...) do {if (mbt_drvdbg & DBG_EVENT) printk(KERN_DEBUG msg); } while (0) +#define PRINTM_EVENT(msg...) do {if (mbt_drvdbg & DBG_EVENT) \ + printk(KERN_DEBUG msg); } while (0) /** Print command message */ -#define PRINTM_CMD(msg...) do {if (mbt_drvdbg & DBG_CMD) printk(KERN_DEBUG msg); } while (0) +#define PRINTM_CMD(msg...) do {if (mbt_drvdbg & DBG_CMD) \ + printk(KERN_DEBUG msg); } while (0) /** Print data message */ -#define PRINTM_DATA(msg...) do {if (mbt_drvdbg & DBG_DATA) printk(KERN_DEBUG msg); } while (0) +#define PRINTM_DATA(msg...) do {if (mbt_drvdbg & DBG_DATA) \ + printk(KERN_DEBUG msg); } while (0) /** Print error message */ -#define PRINTM_ERROR(msg...) do {if (mbt_drvdbg & DBG_ERROR) printk(KERN_ERR msg); } while (0) +#define PRINTM_ERROR(msg...) do {if (mbt_drvdbg & DBG_ERROR) \ + printk(KERN_ERR msg); } while (0) /** Print fatal message */ -#define PRINTM_FATAL(msg...) do {if (mbt_drvdbg & DBG_FATAL) printk(KERN_ERR msg); } while (0) +#define PRINTM_FATAL(msg...) do {if (mbt_drvdbg & DBG_FATAL) \ + printk(KERN_ERR msg); } while (0) /** Print message */ -#define PRINTM_MSG(msg...) do {if (mbt_drvdbg & DBG_MSG) printk(KERN_ALERT msg); } while (0) +#define PRINTM_MSG(msg...) do {if (mbt_drvdbg & DBG_MSG) \ + printk(KERN_ALERT msg); } while (0) /** Print data dump message */ -#define PRINTM_DAT_D(msg...) do {if (mbt_drvdbg & DBG_DAT_D) printk(KERN_DEBUG msg); } while (0) +#define PRINTM_DAT_D(msg...) do {if (mbt_drvdbg & DBG_DAT_D) \ + printk(KERN_DEBUG msg); } while (0) /** Print data dump message */ -#define PRINTM_CMD_D(msg...) do {if (mbt_drvdbg & DBG_CMD_D) printk(KERN_DEBUG msg); } while (0) +#define PRINTM_CMD_D(msg...) do {if (mbt_drvdbg & DBG_CMD_D) \ + printk(KERN_DEBUG msg); } while (0) /** Print message with required level */ #define PRINTM(level, msg...) PRINTM_##level(msg) @@ -164,28 +176,30 @@ hexdump(char *prompt, u8 * buf, int len) } /** Debug hexdump of debug data */ -#define DBG_HEXDUMP_DAT_D(x, y, z) do {if (mbt_drvdbg & DBG_DAT_D) hexdump(x, y, z); } while (0) +#define DBG_HEXDUMP_DAT_D(x, y, z) do {if (mbt_drvdbg & DBG_DAT_D) \ + hexdump(x, y, z); } while (0) /** Debug hexdump of debug command */ -#define DBG_HEXDUMP_CMD_D(x, y, z) do {if (mbt_drvdbg & DBG_CMD_D) hexdump(x, y, z); } while (0) +#define DBG_HEXDUMP_CMD_D(x, y, z) do {if (mbt_drvdbg & DBG_CMD_D) \ + hexdump(x, y, z); } while (0) /** Debug hexdump */ #define DBG_HEXDUMP(level, x, y, z) DBG_HEXDUMP_##level(x, y, z) /** Mark entry point */ -#define ENTER() PRINTM(ENTRY, "Enter: %s, %s:%i\n", __FUNCTION__, \ +#define ENTER() PRINTM(ENTRY, "Enter: %s, %s:%i\n", __func__, \ __FILE__, __LINE__) /** Mark exit point */ -#define LEAVE() PRINTM(ENTRY, "Leave: %s, %s:%i\n", __FUNCTION__, \ +#define LEAVE() PRINTM(ENTRY, "Leave: %s, %s:%i\n", __func__, \ __FILE__, __LINE__) #else /** Do nothing */ -#define PRINTM(level, msg...) do {} while (0); +#define PRINTM(level, msg...) do {} while (0) /** Do nothing */ -#define DBG_HEXDUMP(level, x, y, z) do {} while (0); +#define DBG_HEXDUMP(level, x, y, z) do {} while (0) /** Do nothing */ -#define ENTER() do {} while (0); +#define ENTER() do {} while (0) /** Do nothing */ -#define LEAVE() do {} while (0); +#define LEAVE() do {} while (0) #endif /* DEBUG_LEVEL1 */ /** Bluetooth upload size */ @@ -278,7 +292,7 @@ os_sched_timeout(u32 millisec) #endif #ifndef __ATTRIB_PACK__ -#define __ATTRIB_PACK__ __attribute__ ((packed)) +#define __ATTRIB_PACK__ __attribute__((packed)) #endif /** Data structure for the Marvell Bluetooth device */ @@ -453,9 +467,11 @@ typedef struct _bt_private { } bt_private, *pbt_private; /** Disable interrupt */ -#define OS_INT_DISABLE spin_lock_irqsave(&priv->driver_lock, priv->driver_flags) +#define OS_INT_DISABLE spin_lock_irqsave(&priv->driver_lock, \ + priv->driver_flags) /** Enable interrupt */ -#define OS_INT_RESTORE spin_unlock_irqrestore(&priv->driver_lock, priv->driver_flags) +#define OS_INT_RESTORE spin_unlock_irqrestore(&priv->driver_lock, \ + priv->driver_flags) #ifndef HCI_BT_AMP /** BT_AMP flag for device type */ @@ -586,7 +602,7 @@ typedef struct _BT_CMD { /** Length */ u8 length; /** Data */ - u8 data[32]; + u8 data[128]; } __ATTRIB_PACK__ BT_CMD; typedef struct _BT_EVENT { @@ -671,6 +687,8 @@ int sd_download_firmware_w_helper(bt_private * priv); #define BT_CMD_CSU_WRITE_REG 0x66 /** Bluetooth command : Load calibrate data */ #define BT_CMD_LOAD_CONFIG_DATA 0x61 +/** Bluetooth command : Load calibrate ext data */ +#define BT_CMD_LOAD_CONFIG_DATA_EXT 0x60 /** Bluetooth command : BLE deepsleep */ #define BT_CMD_BLE_DEEP_SLEEP 0x8b @@ -705,8 +723,12 @@ int bt_write_reg(bt_private * priv, u8 type, u32 offset, u16 value); int bt_init_config(bt_private * priv, char *cfg_file); /** This function load the calibrate data */ int bt_load_cal_data(bt_private * priv, u8 * config_data, u8 * mac); +/** This function load the calibrate ext data */ +int bt_load_cal_data_ext(bt_private * priv, u8 * config_data, u32 cfg_data_len); /** BT set user defined calibration data */ int bt_cal_config(bt_private * priv, char *cfg_file, char *mac); +/** BT set user defined calibration ext data */ +int bt_cal_config_ext(bt_private * priv, char *cfg_file); int bt_init_mac_address(bt_private * priv, char *mac); typedef struct _BT_HCI_CMD { diff --git a/drivers/bluetooth/sd8897/bt/bt_init.c b/drivers/bluetooth/sd8897/bt/bt_init.c index 55481d520a3d..13d7ed300974 100644 --- a/drivers/bluetooth/sd8897/bt/bt_init.c +++ b/drivers/bluetooth/sd8897/bt/bt_init.c @@ -200,10 +200,11 @@ bt_atoi(int *data, char *a) * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE */ static int -bt_parse_cal_cfg(const u8 * src, u32 len, u8 * dst, u32 dst_size) +bt_parse_cal_cfg(const u8 * src, u32 len, u8 * dst, u32 * dst_size) { const u8 *ptr; u8 *dptr; + u32 count = 0; int ret = BT_STATUS_FAILURE; ENTER(); @@ -217,12 +218,13 @@ bt_parse_cal_cfg(const u8 * src, u32 len, u8 * dst, u32 dst_size) } if (isxdigit(*ptr)) { - if ((dptr - dst) >= dst_size) { + if ((dptr - dst) >= *dst_size) { PRINTM(ERROR, "cal_file size too big!!!\n"); goto done; } *dptr++ = bt_atox(ptr); ptr += 2; + count++; } else { ptr++; } @@ -232,6 +234,7 @@ bt_parse_cal_cfg(const u8 * src, u32 len, u8 * dst, u32 dst_size) goto done; } + *dst_size = count; ret = BT_STATUS_SUCCESS; done: LEAVE(); @@ -497,11 +500,13 @@ bt_process_cal_cfg(bt_private * priv, u8 * data, u32 size, char *mac) u8 bt_mac[ETH_ALEN]; u8 cal_data[32]; u8 *mac_data = NULL; + u32 cal_data_len; int ret = BT_STATUS_FAILURE; memset(bt_mac, 0, sizeof(bt_mac)); + cal_data_len = sizeof(cal_data); if (BT_STATUS_SUCCESS != - bt_parse_cal_cfg(data, size, cal_data, sizeof(cal_data))) { + bt_parse_cal_cfg(data, size, cal_data, &cal_data_len)) { goto done; } if (mac != NULL) { @@ -523,6 +528,39 @@ done: } /** + * @brief BT process calibration EXT data + * + * @param priv a pointer to bt_private structure + * @param data a pointer to cal data + * @param size cal data size + * @param mac mac address buf + * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE + */ +int +bt_process_cal_cfg_ext(bt_private * priv, u8 * data, u32 size) +{ + u8 cal_data[128]; + u32 cal_data_len; + int ret = BT_STATUS_FAILURE; + + cal_data_len = sizeof(cal_data); + if (BT_STATUS_SUCCESS != + bt_parse_cal_cfg(data, size, cal_data, &cal_data_len)) { + goto done; + } + if (BT_STATUS_SUCCESS != + bt_load_cal_data_ext(priv, cal_data, cal_data_len)) { + PRINTM(FATAL, "BT: Fail to load calibrate data\n"); + goto done; + } + ret = BT_STATUS_SUCCESS; + +done: + LEAVE(); + return ret; +} + +/** * @brief BT process calibration file * * @param priv a pointer to bt_private structure @@ -555,6 +593,37 @@ done: } /** + * @brief BT process calibration EXT file + * + * @param priv a pointer to bt_private structure + * @param cal_file calibration file name + * @param mac mac address buf + * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE + */ +int +bt_cal_config_ext(bt_private * priv, char *cal_file) +{ + const struct firmware *cfg = NULL; + int ret = BT_STATUS_SUCCESS; + + ENTER(); + if ((request_firmware(&cfg, cal_file, priv->hotplug_device)) < 0) { + PRINTM(FATAL, "BT: request_firmware() %s failed\n", cal_file); + ret = BT_STATUS_FAILURE; + goto done; + } + if (cfg) + ret = bt_process_cal_cfg_ext(priv, (u8 *) cfg->data, cfg->size); + else + ret = BT_STATUS_FAILURE; +done: + if (cfg) + release_firmware(cfg); + LEAVE(); + return ret; +} + +/** * @brief BT init mac address from bt_mac parametre when insmod * * @param priv a pointer to bt_private structure diff --git a/drivers/bluetooth/sd8897/bt/bt_main.c b/drivers/bluetooth/sd8897/bt/bt_main.c index 3707d8d86b41..7e79962de61a 100644 --- a/drivers/bluetooth/sd8897/bt/bt_main.c +++ b/drivers/bluetooth/sd8897/bt/bt_main.c @@ -37,6 +37,8 @@ #include <linux/platform_device.h> #include <linux/wlan_plat.h> +#include <linux/interrupt.h> + #include "bt_drv.h" #include "mbt_char.h" #include "bt_sdio.h" @@ -90,6 +92,8 @@ static int psmode = 1; static char *init_cfg; /** Calibration config file (MAC address, init powe etc.) */ static char *cal_cfg; +/** Calibration config file EXT */ +static char *cal_cfg_ext; /** Init MAC address */ static char *bt_mac; @@ -115,7 +119,13 @@ static int minicard_pwrup = 1; /** Pointer to struct with control hooks */ static struct wifi_platform_data *bt_control_data; +#define IORESOURCE_NAME "mrvl_bt_irq" +#define DRIVER_NAME "bt hostwake" + void mdev_poweroff(struct m_dev *m_dev); +static struct resource *bt_irqres; +static int irq_registered; +static void bt_register_hostwake_irq(void *handle); /** * @brief Alloc bt device @@ -258,6 +268,7 @@ check_evtpkt(bt_private * priv, struct sk_buff *skb) case BT_CMD_CONFIG_MAC_ADDR: case BT_CMD_CSU_WRITE_REG: case BT_CMD_LOAD_CONFIG_DATA: + case BT_CMD_LOAD_CONFIG_DATA_EXT: case BT_CMD_AUTO_SLEEP_MODE: case BT_CMD_HOST_SLEEP_CONFIG: case BT_CMD_SDIO_PULL_CFG_REQ: @@ -330,19 +341,19 @@ bt_process_event(bt_private * priv, struct sk_buff *skb) { u8 ret = BT_STATUS_SUCCESS; struct m_dev *m_dev = &(priv->bt_dev.m_dev[BT_SEQ]); - BT_EVENT *pEvent; + BT_EVENT *pevent; ENTER(); - pEvent = (BT_EVENT *) skb->data; - if (pEvent->EC != 0xff) { - PRINTM(CMD, "BT: Not Marvell Event=0x%x\n", pEvent->EC); + pevent = (BT_EVENT *) skb->data; + if (pevent->EC != 0xff) { + PRINTM(CMD, "BT: Not Marvell Event=0x%x\n", pevent->EC); ret = BT_STATUS_FAILURE; goto exit; } - switch (pEvent->data[0]) { + switch (pevent->data[0]) { case BT_CMD_AUTO_SLEEP_MODE: - if (pEvent->data[2] == BT_STATUS_SUCCESS) { - if (pEvent->data[1] == BT_PS_ENABLE) + if (pevent->data[2] == BT_STATUS_SUCCESS) { + if (pevent->data[1] == BT_PS_ENABLE) priv->adapter->psmode = 1; else priv->adapter->psmode = 0; @@ -355,16 +366,16 @@ bt_process_event(bt_private * priv, struct sk_buff *skb) } break; case BT_CMD_HOST_SLEEP_CONFIG: - if (pEvent->data[3] == BT_STATUS_SUCCESS) { + if (pevent->data[3] == BT_STATUS_SUCCESS) { PRINTM(CMD, "BT: %s: gpio=0x%x, gap=0x%x\n", - m_dev->name, pEvent->data[1], pEvent->data[2]); + m_dev->name, pevent->data[1], pevent->data[2]); } else { PRINTM(CMD, "BT: %s: HSCFG Command Fail\n", m_dev->name); } break; case BT_CMD_HOST_SLEEP_ENABLE: - if (pEvent->data[1] == BT_STATUS_SUCCESS) { + if (pevent->data[1] == BT_STATUS_SUCCESS) { priv->adapter->hs_state = HS_ACTIVATED; if (priv->adapter->suspend_fail == FALSE) { #ifdef SDIO_SUSPEND_RESUME @@ -388,45 +399,44 @@ bt_process_event(bt_private * priv, struct sk_buff *skb) break; case BT_CMD_MODULE_CFG_REQ: if ((priv->bt_dev.sendcmdflag == TRUE) && - ((pEvent->data[1] == MODULE_BRINGUP_REQ) - || (pEvent->data[1] == MODULE_SHUTDOWN_REQ))) { - if (pEvent->data[1] == MODULE_BRINGUP_REQ) { + ((pevent->data[1] == MODULE_BRINGUP_REQ) + || (pevent->data[1] == MODULE_SHUTDOWN_REQ))) { + if (pevent->data[1] == MODULE_BRINGUP_REQ) { PRINTM(CMD, "BT: EVENT %s:%s\n", m_dev->name, - (pEvent->data[2] && (pEvent->data[2] != + (pevent->data[2] && (pevent->data[2] != MODULE_CFG_RESP_ALREADY_UP)) ? "Bring up Fail" : "Bring up success"); - priv->bt_dev.devType = pEvent->data[3]; + priv->bt_dev.devType = pevent->data[3]; PRINTM(CMD, "devType:%s\n", - (pEvent->data[3] == + (pevent->data[3] == DEV_TYPE_AMP) ? "AMP controller" : "BR/EDR controller"); - priv->bt_dev.devFeature = pEvent->data[4]; + priv->bt_dev.devFeature = pevent->data[4]; PRINTM(CMD, "devFeature: %s, %s, %s, %s, %s\n", - ((pEvent-> + ((pevent-> data[4] & DEV_FEATURE_BT) ? "BT Feature" : "No BT Feature"), - ((pEvent-> + ((pevent-> data[4] & DEV_FEATURE_BTAMP) ? "BTAMP Feature" : "No BTAMP Feature"), - ((pEvent-> + ((pevent-> data[4] & DEV_FEATURE_BLE) ? "BLE Feature" : "No BLE Feature"), - ((pEvent-> + ((pevent-> data[4] & DEV_FEATURE_FM) ? "FM Feature" : "No FM Feature"), - ((pEvent-> + ((pevent-> data[4] & DEV_FEATURE_NFC) ? "NFC Feature" : "No NFC Feature")); } - if (pEvent->data[1] == MODULE_SHUTDOWN_REQ) { + if (pevent->data[1] == MODULE_SHUTDOWN_REQ) { PRINTM(CMD, "BT: EVENT %s:%s\n", m_dev->name, - (pEvent-> - data[2]) ? "Shut down Fail" : - "Shut down success"); + (pevent->data[2]) ? "Shut down Fail" + : "Shut down success"); } - if (pEvent->data[2]) { + if (pevent->data[2]) { priv->bt_dev.sendcmdflag = FALSE; priv->adapter->cmd_complete = TRUE; wake_up_interruptible(&priv->adapter-> @@ -438,14 +448,14 @@ bt_process_event(bt_private * priv, struct sk_buff *skb) } break; case BT_EVENT_POWER_STATE: - if (pEvent->data[1] == BT_PS_SLEEP) + if (pevent->data[1] == BT_PS_SLEEP) priv->adapter->ps_state = PS_SLEEP; PRINTM(CMD, "BT: EVENT %s:%s\n", m_dev->name, (priv->adapter->ps_state) ? "PS_SLEEP" : "PS_AWAKE"); break; case BT_CMD_SDIO_PULL_CFG_REQ: - if (pEvent->data[pEvent->length - 1] == BT_STATUS_SUCCESS) + if (pevent->data[pevent->length - 1] == BT_STATUS_SUCCESS) PRINTM(CMD, "BT: %s: SDIO pull configuration success\n", m_dev->name); @@ -456,7 +466,7 @@ bt_process_event(bt_private * priv, struct sk_buff *skb) } break; default: - PRINTM(CMD, "BT: Unknown Event=%d %s\n", pEvent->data[0], + PRINTM(CMD, "BT: Unknown Event=%d %s\n", pevent->data[0], m_dev->name); ret = BT_STATUS_FAILURE; break; @@ -509,14 +519,14 @@ bt_cmd_timeout_func(bt_adapter * adapter, u16 cmd) * * @param priv A pointer to bt_private structure * - * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE + * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE */ int bt_send_reset_command(bt_private * priv) { struct sk_buff *skb = NULL; u8 ret = BT_STATUS_SUCCESS; - BT_HCI_CMD *pCmd; + BT_HCI_CMD *pcmd; ENTER(); skb = bt_skb_alloc(sizeof(BT_HCI_CMD), GFP_ATOMIC); if (skb == NULL) { @@ -524,10 +534,10 @@ bt_send_reset_command(bt_private * priv) ret = BT_STATUS_FAILURE; goto exit; } - pCmd = (BT_HCI_CMD *) skb->data; - pCmd->ocf_ogf = (RESET_OGF << 10) | BT_CMD_RESET; - pCmd->length = 0x00; - pCmd->cmd_type = 0x00; + pcmd = (BT_HCI_CMD *) skb->data; + pcmd->ocf_ogf = (RESET_OGF << 10) | BT_CMD_RESET; + pcmd->length = 0x00; + pcmd->cmd_type = 0x00; bt_cb(skb)->pkt_type = HCI_COMMAND_PKT; skb_put(skb, 3); skb->dev = (void *)(&(priv->bt_dev.m_dev[BT_SEQ])); @@ -535,7 +545,7 @@ bt_send_reset_command(bt_private * priv) priv->bt_dev.sendcmdflag = TRUE; priv->bt_dev.send_cmd_ocf = BT_CMD_RESET; priv->adapter->cmd_complete = FALSE; - PRINTM(CMD, "Queue Reset Command(0x%x)\n", pCmd->ocf_ogf); + PRINTM(CMD, "Queue Reset Command(0x%x)\n", pcmd->ocf_ogf); wake_up_interruptible(&priv->MainThread.waitQ); if (!os_wait_interruptible_timeout (priv->adapter->cmd_wait_q, priv->adapter->cmd_complete, @@ -570,7 +580,7 @@ bt_send_module_cfg_cmd(bt_private * priv, int subcmd) { struct sk_buff *skb = NULL; u8 ret = BT_STATUS_SUCCESS; - BT_CMD *pCmd; + BT_CMD *pcmd; ENTER(); skb = bt_skb_alloc(sizeof(BT_CMD), GFP_ATOMIC); if (skb == NULL) { @@ -578,18 +588,18 @@ bt_send_module_cfg_cmd(bt_private * priv, int subcmd) ret = BT_STATUS_FAILURE; goto exit; } - pCmd = (BT_CMD *) skb->data; - pCmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_MODULE_CFG_REQ; - pCmd->length = 1; - pCmd->data[0] = subcmd; + pcmd = (BT_CMD *) skb->data; + pcmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_MODULE_CFG_REQ; + pcmd->length = 1; + pcmd->data[0] = subcmd; bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; - skb_put(skb, BT_CMD_HEADER_SIZE + pCmd->length); + skb_put(skb, BT_CMD_HEADER_SIZE + pcmd->length); skb->dev = (void *)(&(priv->bt_dev.m_dev[BT_SEQ])); skb_queue_head(&priv->adapter->tx_queue, skb); priv->bt_dev.sendcmdflag = TRUE; priv->bt_dev.send_cmd_ocf = BT_CMD_MODULE_CFG_REQ; priv->adapter->cmd_complete = FALSE; - PRINTM(CMD, "Queue module cfg Command(0x%x)\n", pCmd->ocf_ogf); + PRINTM(CMD, "Queue module cfg Command(0x%x)\n", pcmd->ocf_ogf); wake_up_interruptible(&priv->MainThread.waitQ); /* On some Android platforms certain delay is needed for HCI daemon to @@ -624,7 +634,7 @@ bt_enable_ps(bt_private * priv) { struct sk_buff *skb = NULL; u8 ret = BT_STATUS_SUCCESS; - BT_CMD *pCmd; + BT_CMD *pcmd; ENTER(); skb = bt_skb_alloc(sizeof(BT_CMD), GFP_ATOMIC); if (skb == NULL) { @@ -632,25 +642,25 @@ bt_enable_ps(bt_private * priv) ret = BT_STATUS_FAILURE; goto exit; } - pCmd = (BT_CMD *) skb->data; - pCmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_AUTO_SLEEP_MODE; + pcmd = (BT_CMD *) skb->data; + pcmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_AUTO_SLEEP_MODE; if (priv->bt_dev.psmode) - pCmd->data[0] = BT_PS_ENABLE; + pcmd->data[0] = BT_PS_ENABLE; else - pCmd->data[0] = BT_PS_DISABLE; + pcmd->data[0] = BT_PS_DISABLE; if (priv->bt_dev.idle_timeout) { - pCmd->length = 3; - pCmd->data[1] = (u8) (priv->bt_dev.idle_timeout & 0x00ff); - pCmd->data[2] = (priv->bt_dev.idle_timeout & 0xff00) >> 8; + pcmd->length = 3; + pcmd->data[1] = (u8) (priv->bt_dev.idle_timeout & 0x00ff); + pcmd->data[2] = (priv->bt_dev.idle_timeout & 0xff00) >> 8; } else { - pCmd->length = 1; + pcmd->length = 1; } bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; - skb_put(skb, BT_CMD_HEADER_SIZE + pCmd->length); + skb_put(skb, BT_CMD_HEADER_SIZE + pcmd->length); skb->dev = (void *)(&(priv->bt_dev.m_dev[BT_SEQ])); skb_queue_head(&priv->adapter->tx_queue, skb); - PRINTM(CMD, "Queue PSMODE Command(0x%x):%d\n", pCmd->ocf_ogf, - pCmd->data[0]); + PRINTM(CMD, "Queue PSMODE Command(0x%x):%d\n", pcmd->ocf_ogf, + pcmd->data[0]); priv->bt_dev.sendcmdflag = TRUE; priv->bt_dev.send_cmd_ocf = BT_CMD_AUTO_SLEEP_MODE; priv->adapter->cmd_complete = FALSE; @@ -678,7 +688,7 @@ bt_send_hscfg_cmd(bt_private * priv) { struct sk_buff *skb = NULL; u8 ret = BT_STATUS_SUCCESS; - BT_CMD *pCmd; + BT_CMD *pcmd; ENTER(); skb = bt_skb_alloc(sizeof(BT_CMD), GFP_ATOMIC); if (skb == NULL) { @@ -686,17 +696,17 @@ bt_send_hscfg_cmd(bt_private * priv) ret = BT_STATUS_FAILURE; goto exit; } - pCmd = (BT_CMD *) skb->data; - pCmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_HOST_SLEEP_CONFIG; - pCmd->length = 2; - pCmd->data[0] = (priv->bt_dev.gpio_gap & 0xff00) >> 8; - pCmd->data[1] = (u8) (priv->bt_dev.gpio_gap & 0x00ff); + pcmd = (BT_CMD *) skb->data; + pcmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_HOST_SLEEP_CONFIG; + pcmd->length = 2; + pcmd->data[0] = (priv->bt_dev.gpio_gap & 0xff00) >> 8; + pcmd->data[1] = (u8) (priv->bt_dev.gpio_gap & 0x00ff); bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; - skb_put(skb, BT_CMD_HEADER_SIZE + pCmd->length); + skb_put(skb, BT_CMD_HEADER_SIZE + pcmd->length); skb->dev = (void *)(&(priv->bt_dev.m_dev[BT_SEQ])); skb_queue_head(&priv->adapter->tx_queue, skb); PRINTM(CMD, "Queue HSCFG Command(0x%x),gpio=0x%x,gap=0x%x\n", - pCmd->ocf_ogf, pCmd->data[0], pCmd->data[1]); + pcmd->ocf_ogf, pcmd->data[0], pcmd->data[1]); priv->bt_dev.sendcmdflag = TRUE; priv->bt_dev.send_cmd_ocf = BT_CMD_HOST_SLEEP_CONFIG; priv->adapter->cmd_complete = FALSE; @@ -724,7 +734,7 @@ bt_send_sdio_pull_ctrl_cmd(bt_private * priv) { struct sk_buff *skb = NULL; u8 ret = BT_STATUS_SUCCESS; - BT_CMD *pCmd; + BT_CMD *pcmd; ENTER(); skb = bt_skb_alloc(sizeof(BT_CMD), GFP_ATOMIC); if (skb == NULL) { @@ -732,21 +742,21 @@ bt_send_sdio_pull_ctrl_cmd(bt_private * priv) ret = BT_STATUS_FAILURE; goto exit; } - pCmd = (BT_CMD *) skb->data; - pCmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_SDIO_PULL_CFG_REQ; - pCmd->length = 4; - pCmd->data[0] = (priv->bt_dev.sdio_pull_cfg & 0x000000ff); - pCmd->data[1] = (priv->bt_dev.sdio_pull_cfg & 0x0000ff00) >> 8; - pCmd->data[2] = (priv->bt_dev.sdio_pull_cfg & 0x00ff0000) >> 16; - pCmd->data[3] = (priv->bt_dev.sdio_pull_cfg & 0xff000000) >> 24; + pcmd = (BT_CMD *) skb->data; + pcmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_SDIO_PULL_CFG_REQ; + pcmd->length = 4; + pcmd->data[0] = (priv->bt_dev.sdio_pull_cfg & 0x000000ff); + pcmd->data[1] = (priv->bt_dev.sdio_pull_cfg & 0x0000ff00) >> 8; + pcmd->data[2] = (priv->bt_dev.sdio_pull_cfg & 0x00ff0000) >> 16; + pcmd->data[3] = (priv->bt_dev.sdio_pull_cfg & 0xff000000) >> 24; bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; - skb_put(skb, BT_CMD_HEADER_SIZE + pCmd->length); + skb_put(skb, BT_CMD_HEADER_SIZE + pcmd->length); skb->dev = (void *)(&(priv->bt_dev.m_dev[BT_SEQ])); skb_queue_head(&priv->adapter->tx_queue, skb); PRINTM(CMD, "Queue SDIO PULL CFG Command(0x%x), PullUp=0x%x%x,PullDown=0x%x%x\n", - pCmd->ocf_ogf, pCmd->data[1], pCmd->data[0], - pCmd->data[3], pCmd->data[2]); + pcmd->ocf_ogf, pcmd->data[1], pcmd->data[0], + pcmd->data[3], pcmd->data[2]); priv->bt_dev.sendcmdflag = TRUE; priv->bt_dev.send_cmd_ocf = BT_CMD_SDIO_PULL_CFG_REQ; priv->adapter->cmd_complete = FALSE; @@ -778,7 +788,7 @@ fm_set_intr_mask(bt_private * priv, u32 mask) { struct sk_buff *skb = NULL; u8 ret = BT_STATUS_SUCCESS; - BT_CMD *pCmd; + BT_CMD *pcmd; ENTER(); skb = bt_skb_alloc(sizeof(BT_CMD), GFP_ATOMIC); @@ -787,14 +797,14 @@ fm_set_intr_mask(bt_private * priv, u32 mask) ret = BT_STATUS_FAILURE; goto exit; } - pCmd = (BT_CMD *) skb->data; - pCmd->ocf_ogf = (VENDOR_OGF << 10) | FM_CMD; - pCmd->length = 0x05; - pCmd->data[0] = FM_SET_INTR_MASK; - memcpy(&pCmd->data[1], &mask, sizeof(mask)); + pcmd = (BT_CMD *) skb->data; + pcmd->ocf_ogf = (VENDOR_OGF << 10) | FM_CMD; + pcmd->length = 0x05; + pcmd->data[0] = FM_SET_INTR_MASK; + memcpy(&pcmd->data[1], &mask, sizeof(mask)); PRINTM(CMD, "FM set intr mask=0x%x\n", mask); bt_cb(skb)->pkt_type = HCI_COMMAND_PKT; - skb_put(skb, BT_CMD_HEADER_SIZE + pCmd->length); + skb_put(skb, BT_CMD_HEADER_SIZE + pcmd->length); skb->dev = (void *)(&(priv->bt_dev.m_dev[FM_SEQ])); skb_queue_head(&priv->adapter->tx_queue, skb); priv->bt_dev.sendcmdflag = TRUE; @@ -825,7 +835,7 @@ bt_enable_hs(bt_private * priv) { struct sk_buff *skb = NULL; u8 ret = BT_STATUS_SUCCESS; - BT_CMD *pCmd; + BT_CMD *pcmd; ENTER(); skb = bt_skb_alloc(sizeof(BT_CMD), GFP_ATOMIC); if (skb == NULL) { @@ -834,16 +844,16 @@ bt_enable_hs(bt_private * priv) goto exit; } priv->adapter->suspend_fail = FALSE; - pCmd = (BT_CMD *) skb->data; - pCmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_HOST_SLEEP_ENABLE; - pCmd->length = 0; + pcmd = (BT_CMD *) skb->data; + pcmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_HOST_SLEEP_ENABLE; + pcmd->length = 0; bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; - skb_put(skb, BT_CMD_HEADER_SIZE + pCmd->length); + skb_put(skb, BT_CMD_HEADER_SIZE + pcmd->length); skb->dev = (void *)(&(priv->bt_dev.m_dev[BT_SEQ])); skb_queue_head(&priv->adapter->tx_queue, skb); priv->bt_dev.sendcmdflag = TRUE; priv->bt_dev.send_cmd_ocf = BT_CMD_HOST_SLEEP_ENABLE; - PRINTM(CMD, "Queue hs enable Command(0x%x)\n", pCmd->ocf_ogf); + PRINTM(CMD, "Queue hs enable Command(0x%x)\n", pcmd->ocf_ogf); wake_up_interruptible(&priv->MainThread.waitQ); if (!os_wait_interruptible_timeout (priv->adapter->cmd_wait_q, priv->adapter->hs_state, @@ -886,7 +896,7 @@ bt_set_ble_deepsleep(bt_private * priv, int mode) { struct sk_buff *skb = NULL; u8 ret = BT_STATUS_SUCCESS; - BT_BLE_CMD *pCmd; + BT_BLE_CMD *pcmd; ENTER(); skb = bt_skb_alloc(sizeof(BT_BLE_CMD), GFP_ATOMIC); if (skb == NULL) { @@ -894,10 +904,10 @@ bt_set_ble_deepsleep(bt_private * priv, int mode) ret = BT_STATUS_FAILURE; goto exit; } - pCmd = (BT_BLE_CMD *) skb->data; - pCmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_BLE_DEEP_SLEEP; - pCmd->length = 1; - pCmd->deepsleep = mode; + pcmd = (BT_BLE_CMD *) skb->data; + pcmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_BLE_DEEP_SLEEP; + pcmd->length = 1; + pcmd->deepsleep = mode; bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; skb_put(skb, sizeof(BT_BLE_CMD)); skb->dev = (void *)(&(priv->bt_dev.m_dev[BT_SEQ])); @@ -905,7 +915,7 @@ bt_set_ble_deepsleep(bt_private * priv, int mode) priv->bt_dev.sendcmdflag = TRUE; priv->bt_dev.send_cmd_ocf = BT_CMD_BLE_DEEP_SLEEP; priv->adapter->cmd_complete = FALSE; - PRINTM(CMD, "BT: Set BLE deepsleep = %d (0x%x)\n", mode, pCmd->ocf_ogf); + PRINTM(CMD, "BT: Set BLE deepsleep = %d (0x%x)\n", mode, pcmd->ocf_ogf); wake_up_interruptible(&priv->MainThread.waitQ); if (!os_wait_interruptible_timeout (priv->adapter->cmd_wait_q, priv->adapter->cmd_complete, @@ -931,7 +941,7 @@ bt_get_fw_version(bt_private * priv) { struct sk_buff *skb = NULL; u8 ret = BT_STATUS_SUCCESS; - BT_HCI_CMD *pCmd; + BT_HCI_CMD *pcmd; ENTER(); skb = bt_skb_alloc(sizeof(BT_HCI_CMD), GFP_ATOMIC); if (skb == NULL) { @@ -939,10 +949,10 @@ bt_get_fw_version(bt_private * priv) ret = BT_STATUS_FAILURE; goto exit; } - pCmd = (BT_HCI_CMD *) skb->data; - pCmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_GET_FW_VERSION; - pCmd->length = 0x01; - pCmd->cmd_type = 0x00; + pcmd = (BT_HCI_CMD *) skb->data; + pcmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_GET_FW_VERSION; + pcmd->length = 0x01; + pcmd->cmd_type = 0x00; bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; skb_put(skb, 4); skb->dev = (void *)(&(priv->bt_dev.m_dev[BT_SEQ])); @@ -976,7 +986,7 @@ bt_set_mac_address(bt_private * priv, u8 * mac) { struct sk_buff *skb = NULL; u8 ret = BT_STATUS_SUCCESS; - BT_HCI_CMD *pCmd; + BT_HCI_CMD *pcmd; int i = 0; ENTER(); skb = bt_skb_alloc(sizeof(BT_HCI_CMD), GFP_ATOMIC); @@ -985,13 +995,13 @@ bt_set_mac_address(bt_private * priv, u8 * mac) ret = BT_STATUS_FAILURE; goto exit; } - pCmd = (BT_HCI_CMD *) skb->data; - pCmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_CONFIG_MAC_ADDR; - pCmd->length = 8; - pCmd->cmd_type = MRVL_VENDOR_PKT; - pCmd->cmd_len = 6; + pcmd = (BT_HCI_CMD *) skb->data; + pcmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_CONFIG_MAC_ADDR; + pcmd->length = 8; + pcmd->cmd_type = MRVL_VENDOR_PKT; + pcmd->cmd_len = 6; for (i = 0; i < 6; i++) - pCmd->data[i] = mac[5 - i]; + pcmd->data[i] = mac[5 - i]; bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; skb_put(skb, sizeof(BT_HCI_CMD)); skb->dev = (void *)(&(priv->bt_dev.m_dev[BT_SEQ])); @@ -1000,7 +1010,7 @@ bt_set_mac_address(bt_private * priv, u8 * mac) priv->bt_dev.send_cmd_ocf = BT_CMD_CONFIG_MAC_ADDR; priv->adapter->cmd_complete = FALSE; PRINTM(CMD, "BT: Set mac addr " MACSTR " (0x%x)\n", MAC2STR(mac), - pCmd->ocf_ogf); + pcmd->ocf_ogf); wake_up_interruptible(&priv->MainThread.waitQ); if (!os_wait_interruptible_timeout (priv->adapter->cmd_wait_q, priv->adapter->cmd_complete, @@ -1028,7 +1038,7 @@ bt_load_cal_data(bt_private * priv, u8 * config_data, u8 * mac) { struct sk_buff *skb = NULL; u8 ret = BT_STATUS_SUCCESS; - BT_CMD *pCmd; + BT_CMD *pcmd; int i = 0; /* u8 config_data[28] = {0x37 0x01 0x1c 0x00 0xFF 0xFF 0xFF 0xFF 0x01 0x7f 0x04 0x02 0x00 0x00 0xBA 0xCE 0xC0 0xC6 0x2D 0x00 0x00 0x00 @@ -1041,31 +1051,30 @@ bt_load_cal_data(bt_private * priv, u8 * config_data, u8 * mac) ret = BT_STATUS_FAILURE; goto exit; } - pCmd = (BT_CMD *) skb->data; - pCmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_LOAD_CONFIG_DATA; - pCmd->length = 0x20; - pCmd->data[0] = 0x00; - pCmd->data[1] = 0x00; - pCmd->data[2] = 0x00; - pCmd->data[3] = 0x1C; + pcmd = (BT_CMD *) skb->data; + pcmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_LOAD_CONFIG_DATA; + pcmd->length = 0x20; + pcmd->data[0] = 0x00; + pcmd->data[1] = 0x00; + pcmd->data[2] = 0x00; + pcmd->data[3] = 0x1C; /* swip cal-data byte */ - for (i = 4; i < 32; i++) { - pCmd->data[i] = config_data[(i / 4) * 8 - 1 - i]; - } + for (i = 4; i < 32; i++) + pcmd->data[i] = config_data[(i / 4) * 8 - 1 - i]; if (mac != NULL) { - pCmd->data[2] = 0x01; /* skip checksum */ + pcmd->data[2] = 0x01; /* skip checksum */ for (i = 24; i < 30; i++) - pCmd->data[i] = mac[29 - i]; + pcmd->data[i] = mac[29 - i]; } bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; - skb_put(skb, BT_CMD_HEADER_SIZE + pCmd->length); + skb_put(skb, BT_CMD_HEADER_SIZE + pcmd->length); skb->dev = (void *)(&(priv->bt_dev.m_dev[BT_SEQ])); skb_queue_head(&priv->adapter->tx_queue, skb); priv->bt_dev.sendcmdflag = TRUE; priv->bt_dev.send_cmd_ocf = BT_CMD_LOAD_CONFIG_DATA; priv->adapter->cmd_complete = FALSE; - DBG_HEXDUMP(DAT_D, "calirate data: ", pCmd->data, 32); + DBG_HEXDUMP(DAT_D, "calirate data: ", pcmd->data, 32); wake_up_interruptible(&priv->MainThread.waitQ); if (!os_wait_interruptible_timeout (priv->adapter->cmd_wait_q, priv->adapter->cmd_complete, @@ -1080,6 +1089,56 @@ exit: } /** + * @brief This function load the calibrate EXT data + * + * @param priv A pointer to bt_private structure + * @param config_data A pointer to calibrate data + * @param mac A pointer to mac address + * + * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE + */ +int +bt_load_cal_data_ext(bt_private * priv, u8 * config_data, u32 cfg_data_len) +{ + struct sk_buff *skb = NULL; + u8 ret = BT_STATUS_SUCCESS; + BT_CMD *pcmd; + + ENTER(); + skb = bt_skb_alloc(sizeof(BT_CMD), GFP_ATOMIC); + if (skb == NULL) { + PRINTM(WARN, "No free skb\n"); + ret = BT_STATUS_FAILURE; + goto exit; + } + pcmd = (BT_CMD *) skb->data; + pcmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_LOAD_CONFIG_DATA_EXT; + pcmd->length = cfg_data_len; + + memcpy(pcmd->data, config_data, cfg_data_len); + bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; + skb_put(skb, BT_CMD_HEADER_SIZE + pcmd->length); + skb->dev = (void *)(&(priv->bt_dev.m_dev[BT_SEQ])); + skb_queue_head(&priv->adapter->tx_queue, skb); + priv->bt_dev.sendcmdflag = TRUE; + priv->bt_dev.send_cmd_ocf = BT_CMD_LOAD_CONFIG_DATA_EXT; + priv->adapter->cmd_complete = FALSE; + + DBG_HEXDUMP(DAT_D, "calirate ext data", pcmd->data, pcmd->length); + wake_up_interruptible(&priv->MainThread.waitQ); + if (!os_wait_interruptible_timeout + (priv->adapter->cmd_wait_q, priv->adapter->cmd_complete, + WAIT_UNTIL_CMD_RESP)) { + ret = BT_STATUS_FAILURE; + PRINTM(ERROR, "BT: Load calibrate ext data: timeout:\n"); + bt_cmd_timeout_func(priv->adapter, BT_CMD_LOAD_CONFIG_DATA_EXT); + } +exit: + LEAVE(); + return ret; +} + +/** * @brief This function writes value to CSU registers * * @param priv A pointer to bt_private structure @@ -1093,7 +1152,7 @@ bt_write_reg(bt_private * priv, u8 type, u32 offset, u16 value) { struct sk_buff *skb = NULL; u8 ret = BT_STATUS_SUCCESS; - BT_CSU_CMD *pCmd; + BT_CSU_CMD *pcmd; ENTER(); skb = bt_skb_alloc(sizeof(BT_CSU_CMD), GFP_ATOMIC); if (skb == NULL) { @@ -1101,16 +1160,16 @@ bt_write_reg(bt_private * priv, u8 type, u32 offset, u16 value) ret = BT_STATUS_FAILURE; goto exit; } - pCmd = (BT_CSU_CMD *) skb->data; - pCmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_CSU_WRITE_REG; - pCmd->length = 7; - pCmd->type = type; - pCmd->offset[0] = (offset & 0x000000ff); - pCmd->offset[1] = (offset & 0x0000ff00) >> 8; - pCmd->offset[2] = (offset & 0x00ff0000) >> 16; - pCmd->offset[3] = (offset & 0xff000000) >> 24; - pCmd->value[0] = (value & 0x00ff); - pCmd->value[1] = (value & 0xff00) >> 8; + pcmd = (BT_CSU_CMD *) skb->data; + pcmd->ocf_ogf = (VENDOR_OGF << 10) | BT_CMD_CSU_WRITE_REG; + pcmd->length = 7; + pcmd->type = type; + pcmd->offset[0] = (offset & 0x000000ff); + pcmd->offset[1] = (offset & 0x0000ff00) >> 8; + pcmd->offset[2] = (offset & 0x00ff0000) >> 16; + pcmd->offset[3] = (offset & 0xff000000) >> 24; + pcmd->value[0] = (value & 0x00ff); + pcmd->value[1] = (value & 0xff00) >> 8; bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; skb_put(skb, sizeof(BT_CSU_CMD)); skb->dev = (void *)(&(priv->bt_dev.m_dev[BT_SEQ])); @@ -1201,7 +1260,7 @@ bt_prepare_command(bt_private * priv) * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE */ static int -SendSinglePacket(bt_private * priv, struct sk_buff *skb) +send_single_packet(bt_private * priv, struct sk_buff *skb) { int ret; ENTER(); @@ -1301,11 +1360,11 @@ done: void bt_free_adapter(bt_private * priv) { - bt_adapter *Adapter = priv->adapter; + bt_adapter *adapter = priv->adapter; ENTER(); skb_queue_purge(&priv->adapter->tx_queue); /* Free the adapter object itself */ - kfree(Adapter); + kfree(adapter); priv->adapter = NULL; LEAVE(); @@ -1385,7 +1444,7 @@ mdev_send_frame(struct m_dev *m_dev, struct sk_buff *skb) priv->debug_device_pending = 1; priv->debug_ocf_ogf[0] = skb->data[0]; priv->debug_ocf_ogf[1] = skb->data[1]; - PRINTM(CMD, "debug_ocf_ogf[0]=0x%x debug_ocf_ogf[1]=0x%x \n", + PRINTM(CMD, "debug_ocf_ogf[0]=0x%x debug_ocf_ogf[1]=0x%x\n", priv->debug_ocf_ogf[0], priv->debug_ocf_ogf[1]); } @@ -1542,7 +1601,7 @@ bt_service_main_thread(void *data) { bt_thread *thread = data; bt_private *priv = thread->priv; - bt_adapter *Adapter = priv->adapter; + bt_adapter *adapter = priv->adapter; wait_queue_t wait; struct sk_buff *skb; ENTER(); @@ -1562,17 +1621,17 @@ bt_service_main_thread(void *data) } OS_SET_THREAD_STATE(TASK_RUNNING); remove_wait_queue(&thread->waitQ, &wait); - if (kthread_should_stop() || Adapter->SurpriseRemoved) { + if (kthread_should_stop() || adapter->SurpriseRemoved) { PRINTM(INFO, "main-thread: break from main thread: " "SurpriseRemoved=0x%x\n", - Adapter->SurpriseRemoved); + adapter->SurpriseRemoved); break; } PRINTM(INFO, "Main: Thread waking up...\n"); if (priv->adapter->IntCounter) { OS_INT_DISABLE; - Adapter->IntCounter = 0; + adapter->IntCounter = 0; OS_INT_RESTORE; sbi_get_int_status(priv); } else if ((priv->adapter->ps_state == PS_SLEEP) && @@ -1587,7 +1646,7 @@ bt_service_main_thread(void *data) if (!skb_queue_empty(&priv->adapter->tx_queue)) { skb = skb_dequeue(&priv->adapter->tx_queue); if (skb) { - if (SendSinglePacket(priv, skb)) + if (send_single_packet(priv, skb)) ((struct m_dev *)skb->dev)-> stat.err_tx++; else @@ -1766,7 +1825,8 @@ sbi_register_conf_dpc(bt_private * priv) } } #ifdef SDIO_SUSPEND_RESUME - priv->bt_dev.gpio_gap = 0xffff; + + priv->bt_dev.gpio_gap = 0x0464; ret = bt_send_hscfg_cmd(priv); if (ret < 0) { PRINTM(FATAL, "Send HSCFG failed!\n"); @@ -1781,7 +1841,7 @@ sbi_register_conf_dpc(bt_private * priv) priv->bt_dev.m_dev[BT_SEQ].dev_type = BT_AMP_TYPE; } /* block all the packet from bluez */ - if (init_cfg || cal_cfg || bt_mac) + if (init_cfg || cal_cfg || bt_mac || cal_cfg_ext) priv->adapter->tx_lock = TRUE; if (mbt_dev) { @@ -2052,11 +2112,30 @@ sbi_register_conf_dpc(bt_private * priv) goto done; } } - if (init_cfg || cal_cfg || bt_mac) { + if (cal_cfg_ext) { + if (BT_STATUS_SUCCESS != bt_cal_config_ext(priv, cal_cfg_ext)) { + PRINTM(FATAL, "BT: Set cal ext data failed\n"); + if (mbt_dev) { + m_dev = &(priv->bt_dev.m_dev[BT_SEQ]); + /** unregister m_dev to char_dev */ + m_dev->close(m_dev); + for (i = 0; i < 3; i++) + kfree_skb(mbt_dev->reassembly[i]); + /** unregister m_dev to char_dev */ + chardev_cleanup_one(m_dev, chardev_class); + free_m_dev(m_dev); + } + ret = BT_STATUS_FAILURE; + goto done; + } + } + if (init_cfg || cal_cfg || bt_mac || cal_cfg_ext) { priv->adapter->tx_lock = FALSE; bt_restore_tx_queue(priv); } + bt_register_hostwake_irq(NULL); + /* Get FW version */ bt_get_fw_version(priv); snprintf(priv->adapter->drv_ver, MAX_VER_STR_LEN, @@ -2255,7 +2334,7 @@ bt_remove_card(void *card) static int bt_set_carddetect(int on) { - PRINTM(MSG, "%s = %d\n", __FUNCTION__, on); + PRINTM(MSG, "%s = %d\n", __func__, on); if (bt_control_data && bt_control_data->set_carddetect) bt_control_data->set_carddetect(on); @@ -2271,7 +2350,7 @@ bt_set_carddetect(int on) static int bt_set_power(int on, unsigned long msec) { - PRINTM(MSG, "%s = %d\n", __FUNCTION__, on); + PRINTM(MSG, "%s = %d\n", __func__, on); if (bt_control_data && bt_control_data->set_power) bt_control_data->set_power(on); @@ -2280,6 +2359,45 @@ bt_set_power(int on, unsigned long msec) return 0; } +static irqreturn_t +bt_hostwake_isr(int irq, void *dev_id) +{ + PRINTM(INTR, "Recv hostwake isr\n"); + return IRQ_HANDLED; +} + +void +bt_enable_hostwake_irq(int flag) +{ + if (bt_irqres && irq_registered) { + PRINTM(INTR, "enable_hostwake_irq=%d\n", flag); + if (flag) { + enable_irq(bt_irqres->start); + enable_irq_wake(bt_irqres->start); + } else { + disable_irq_wake(bt_irqres->start); + disable_irq(bt_irqres->start); + } + } +} + +static void +bt_register_hostwake_irq(void *handle) +{ + if (bt_irqres && !irq_registered) { + irq_registered = + request_irq(bt_irqres->start, bt_hostwake_isr, + bt_irqres->flags, DRIVER_NAME, handle); + if (irq_registered < 0) + PRINTM(ERROR, "Couldn't acquire BT_HOST_WAKE IRQ\n"); + else { + irq_registered = 1; + enable_irq_wake(bt_irqres->start); + bt_enable_hostwake_irq(FALSE); + } + } +} + void mdev_poweroff(struct m_dev *m_dev) { @@ -2307,9 +2425,14 @@ bt_probe(struct platform_device *pdev) ENTER(); - bt_control_data = bt_ctrl; - bt_set_power(1, 0); /* Power On */ - bt_set_carddetect(1); /* CardDetect (0->1) */ + bt_irqres = platform_get_resource_byname(pdev, + IORESOURCE_IRQ, + IORESOURCE_NAME); + if (minicard_pwrup) { + bt_control_data = bt_ctrl; + bt_set_power(1, 0); /* Power On */ + bt_set_carddetect(1); /* CardDetect (0->1) */ + } LEAVE(); return 0; @@ -2329,9 +2452,16 @@ bt_remove(struct platform_device *pdev) ENTER(); - bt_control_data = bt_ctrl; - bt_set_power(0, 0); /* Power Off */ - bt_set_carddetect(0); /* CardDetect (1->0) */ + if (bt_irqres && irq_registered) { + PRINTM(MSG, "Free hostwake IRQ wakeup\n"); + free_irq(bt_irqres->start, NULL); + irq_registered = 0; + } + if (minicard_pwrup) { + bt_control_data = bt_ctrl; + bt_set_power(0, 0); /* Power Off */ + bt_set_carddetect(0); /* CardDetect (1->0) */ + } LEAVE(); return 0; @@ -2357,8 +2487,7 @@ bt_add_dev(void) ENTER(); - if (minicard_pwrup) - ret = platform_driver_register(&bt_device); + ret = platform_driver_register(&bt_device); LEAVE(); return ret; @@ -2374,8 +2503,7 @@ bt_del_dev(void) { ENTER(); - if (minicard_pwrup) - platform_driver_unregister(&bt_device); + platform_driver_unregister(&bt_device); LEAVE(); } @@ -2461,6 +2589,8 @@ module_param(init_cfg, charp, 0); MODULE_PARM_DESC(init_cfg, "BT init config file name"); module_param(cal_cfg, charp, 0); MODULE_PARM_DESC(cal_cfg, "BT calibrate file name"); +module_param(cal_cfg_ext, charp, 0); +MODULE_PARM_DESC(cal_cfg_ext, "BT calibrate ext file name"); module_param(bt_mac, charp, 0); MODULE_PARM_DESC(bt_mac, "BT init mac address"); module_param(minicard_pwrup, int, 0); diff --git a/drivers/bluetooth/sd8897/bt/bt_proc.c b/drivers/bluetooth/sd8897/bt/bt_proc.c index 74007eb7bd1f..ad9a6e9cd23d 100644 --- a/drivers/bluetooth/sd8897/bt/bt_proc.c +++ b/drivers/bluetooth/sd8897/bt/bt_proc.c @@ -71,12 +71,12 @@ struct proc_data { /** Device size */ #define item_dev_size(n) (sizeof((bt_dev_t *)0)->n) /** Device address */ -#define item_dev_addr(n) ((t_ptr) & ((bt_dev_t *)0)->n) +#define item_dev_addr(n) ((t_ptr) &((bt_dev_t *)0)->n) /** Adapter size */ #define item_adapter_size(n) (sizeof((bt_adapter *)0)->n) /** Adapter address */ -#define item_adapter_addr(n) ((t_ptr) & ((bt_adapter *)0)->n) +#define item_adapter_addr(n) ((t_ptr) &((bt_adapter *)0)->n) static struct item_data config_items[] = { #ifdef DEBUG_LEVEL1 @@ -233,23 +233,19 @@ parse_cmd52_string(const char __user * buffer, size_t len, /* Get func */ pos = strsep(&string, " \t"); - if (pos) { + if (pos) *func = string_to_number(pos); - } /* Get reg */ pos = strsep(&string, " \t"); - if (pos) { + if (pos) *reg = string_to_number(pos); - } /* Get val (optional) */ pos = strsep(&string, " \t"); - if (pos) { + if (pos) *val = string_to_number(pos); - } - if (string) - kfree(string); + kfree(string); LEAVE(); return ret; } diff --git a/drivers/bluetooth/sd8897/bt/bt_sdio.h b/drivers/bluetooth/sd8897/bt/bt_sdio.h index c2dca34809b1..e2227794e087 100644 --- a/drivers/bluetooth/sd8897/bt/bt_sdio.h +++ b/drivers/bluetooth/sd8897/bt/bt_sdio.h @@ -27,7 +27,7 @@ /** IRQ return type */ typedef irqreturn_t IRQ_RET_TYPE; /** IRQ return */ -#define IRQ_RET return IRQ_HANDLED +#define IRQ_RET (return IRQ_HANDLED) /** ISR notifier function */ typedef IRQ_RET_TYPE(*isr_notifier_fn_t) (s32 irq, void *dev_id, struct pt_regs * reg); @@ -60,7 +60,7 @@ typedef IRQ_RET_TYPE(*isr_notifier_fn_t) (s32 irq, void *dev_id, /** Host Control Registers : Configuration */ #define CONFIGURATION_REG 0x00 /** Host Control Registers : Host without Command 53 finish host*/ -#define HOST_TO_CARD_EVENT (0x1U << 3) +#define HOST_TO_CARD_EVENT (0x1U << 3) /** Host Control Registers : Host without Command 53 finish host */ #define HOST_WO_CMD53_FINISH_HOST (0x1U << 2) /** Host Control Registers : Host power up */ @@ -113,50 +113,50 @@ typedef IRQ_RET_TYPE(*isr_notifier_fn_t) (s32 irq, void *dev_id, #define DN_LD_CARD_RDY (0x1U << 0) /** Card Control Registers : Host interrupt mask register */ -#define HOST_INTERRUPT_MASK_REG 0x54 +#define HOST_INTERRUPT_MASK_REG 0x54 /** Card Control Registers : Host power interrupt mask */ #define HOST_POWER_INT_MASK (0x1U << 3) /** Card Control Registers : Abort card interrupt mask */ #define ABORT_CARD_INT_MASK (0x1U << 2) /** Card Control Registers : Upload card interrupt mask */ -#define UP_LD_CARD_INT_MASK (0x1U << 1) +#define UP_LD_CARD_INT_MASK (0x1U << 1) /** Card Control Registers : Download card interrupt mask */ -#define DN_LD_CARD_INT_MASK (0x1U << 0) +#define DN_LD_CARD_INT_MASK (0x1U << 0) /** Card Control Registers : Card interrupt status register */ -#define CARD_INTERRUPT_STATUS_REG 0x58 +#define CARD_INTERRUPT_STATUS_REG 0x58 /** Card Control Registers : Power up interrupt */ -#define POWER_UP_INT (0x1U << 4) +#define POWER_UP_INT (0x1U << 4) /** Card Control Registers : Power down interrupt */ -#define POWER_DOWN_INT (0x1U << 3) +#define POWER_DOWN_INT (0x1U << 3) /** Card Control Registers : Card interrupt RSR register */ -#define CARD_INTERRUPT_RSR_REG 0x5c +#define CARD_INTERRUPT_RSR_REG 0x5c /** Card Control Registers : Power up RSR */ -#define POWER_UP_RSR (0x1U << 4) +#define POWER_UP_RSR (0x1U << 4) /** Card Control Registers : Power down RSR */ -#define POWER_DOWN_RSR (0x1U << 3) +#define POWER_DOWN_RSR (0x1U << 3) /* Card Control Registers */ /** Card Control Registers : Read SQ base address A0 register */ -#define SQ_READ_BASE_ADDRESS_A0_REG 0x60 +#define SQ_READ_BASE_ADDRESS_A0_REG 0x60 /** Card Control Registers : Read SQ base address A1 register */ -#define SQ_READ_BASE_ADDRESS_A1_REG 0x61 +#define SQ_READ_BASE_ADDRESS_A1_REG 0x61 /** Card Control Registers : Read SQ base address A2 register */ -#define SQ_READ_BASE_ADDRESS_A2_REG 0x62 +#define SQ_READ_BASE_ADDRESS_A2_REG 0x62 /** Card Control Registers : Read SQ base address A3 register */ -#define SQ_READ_BASE_ADDRESS_A3_REG 0x63 +#define SQ_READ_BASE_ADDRESS_A3_REG 0x63 /** Card Control Registers : Write SQ base address A0 register */ -#define SQ_WRITE_BASE_ADDRESS_A0_REG 0x64 +#define SQ_WRITE_BASE_ADDRESS_A0_REG 0x64 /** Card Control Registers : Write SQ base address A1 register */ -#define SQ_WRITE_BASE_ADDRESS_A1_REG 0x65 +#define SQ_WRITE_BASE_ADDRESS_A1_REG 0x65 /** Card Control Registers : Write SQ base address A2 register */ -#define SQ_WRITE_BASE_ADDRESS_A2_REG 0x66 +#define SQ_WRITE_BASE_ADDRESS_A2_REG 0x66 /** Card Control Registers : Write SQ base address A3 register */ -#define SQ_WRITE_BASE_ADDRESS_A3_REG 0x67 +#define SQ_WRITE_BASE_ADDRESS_A3_REG 0x67 /** Card Control Registers : Card revision register */ -#define CARD_REVISION_REG 0xBC +#define CARD_REVISION_REG 0xBC /** Firmware status 0 register (SCRATCH0_0) */ #define CARD_FW_STATUS0_REG 0xC0 @@ -224,6 +224,7 @@ struct sdio_mmc_card { int sd_read_cmd52_val(bt_private * priv); /** This function updates card reg based on the Cmd52 value in dev structure */ int sd_write_cmd52_val(bt_private * priv, int func, int reg, int val); +void bt_enable_hostwake_irq(int flag); #ifdef SDIO_SUSPEND_RESUME #ifdef MMC_PM_KEEP_POWER diff --git a/drivers/bluetooth/sd8897/bt/bt_sdiommc.c b/drivers/bluetooth/sd8897/bt/bt_sdiommc.c index 44c7f253b957..0d9f82eb3db2 100644 --- a/drivers/bluetooth/sd8897/bt/bt_sdiommc.c +++ b/drivers/bluetooth/sd8897/bt/bt_sdiommc.c @@ -70,7 +70,7 @@ extern int mbt_pm_keep_power; * @brief This function gets rx_unit value * * @param priv A pointer to bt_private structure - * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE + * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE */ int sd_get_rx_unit(bt_private * priv) @@ -94,7 +94,7 @@ sd_get_rx_unit(bt_private * priv) * * @param priv A pointer to bt_private structure * @param dat A pointer to keep returned data - * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE + * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE */ static int sd_read_firmware_status(bt_private * priv, u16 * dat) @@ -129,7 +129,7 @@ sd_read_firmware_status(bt_private * priv, u16 * dat) * * @param priv A pointer to bt_private structure * @param dat A pointer to keep returned data - * @return BT_STATUS_SUCCESS or other error no. + * @return BT_STATUS_SUCCESS or other error no. */ static int sd_read_rx_len(bt_private * priv, u16 * dat) @@ -153,7 +153,7 @@ sd_read_rx_len(bt_private * priv, u16 * dat) * * @param priv A pointer to bt_private structure * @param mask the interrupt mask - * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE + * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE */ static int sd_enable_host_int_mask(bt_private * priv, u8 mask) @@ -177,7 +177,7 @@ sd_enable_host_int_mask(bt_private * priv, u8 mask) * * @param priv A pointer to bt_private structure * @param mask the interrupt mask - * @return BT_STATUS_SUCCESS or other error no. + * @return BT_STATUS_SUCCESS or other error no. */ static int sd_disable_host_int_mask(bt_private * priv, u8 mask) @@ -209,9 +209,9 @@ done: /** * @brief This function polls the card status register * - * @param priv A pointer to bt_private structure - * @param bits the bit mask - * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE + * @param priv A pointer to bt_private structure + * @param bits the bit mask + * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE */ static int sd_poll_card_status(bt_private * priv, u8 bits) @@ -244,8 +244,8 @@ sd_poll_card_status(bt_private * priv, u8 bits) /** * @brief This function reads updates the Cmd52 value in dev structure * - * @param priv A pointer to bt_private structure - * @return BT_STATUS_SUCCESS or other error no. + * @param priv A pointer to bt_private structure + * @return BT_STATUS_SUCCESS or other error no. */ int sd_read_cmd52_val(bt_private * priv) @@ -278,11 +278,11 @@ sd_read_cmd52_val(bt_private * priv) /** * @brief This function updates card reg based on the Cmd52 value in dev structure * - * @param priv A pointer to bt_private structure - * @param func Stores func variable - * @param reg Stores reg variable - * @param val Stores val variable - * @return BT_STATUS_SUCCESS or other error no. + * @param priv A pointer to bt_private structure + * @param func Stores func variable + * @param reg Stores reg variable + * @param val Stores val variable + * @return BT_STATUS_SUCCESS or other error no. */ int sd_write_cmd52_val(bt_private * priv, int func, int reg, int val) @@ -322,8 +322,8 @@ done: * @brief This function probes the card * * @param func A pointer to sdio_func structure. - * @param id A pointer to structure sdio_device_id - * @return BT_STATUS_SUCCESS/BT_STATUS_FAILURE or other error no. + * @param id A pointer to structure sdio_device_id + * @return BT_STATUS_SUCCESS/BT_STATUS_FAILURE or other error no. */ static int sd_probe_card(struct sdio_func *func, const struct sdio_device_id *id) @@ -411,7 +411,7 @@ sd_verify_fw_download(bt_private * priv, int pollnum) * @brief Transfers firmware to card * * @param priv A Pointer to bt_private structure - * @return BT_STATUS_SUCCESS/BT_STATUS_FAILURE or other error no. + * @return BT_STATUS_SUCCESS/BT_STATUS_FAILURE or other error no. */ static int sd_init_fw_dpc(bt_private * priv) @@ -431,9 +431,6 @@ sd_init_fw_dpc(bt_private * priv) int tx_blocks = 0; int i = 0; int tries = 0; -#ifdef FW_DOWNLOAD_SPEED - u32 tv1, tv2; -#endif ENTER(); firmware = (u8 *) priv->firmware->data; @@ -441,10 +438,6 @@ sd_init_fw_dpc(bt_private * priv) PRINTM(INFO, "BT: Downloading FW image (%d bytes)\n", firmwarelen); -#ifdef FW_DOWNLOAD_SPEED - tv1 = get_utimeofday(); -#endif - tmpfwbufsz = BT_UPLD_SIZE + DMA_ALIGNMENT; tmpfwbuf = kmalloc(tmpfwbufsz, GFP_KERNEL); if (!tmpfwbuf) { @@ -565,18 +558,7 @@ sd_init_fw_dpc(bt_private * priv) ret = BT_STATUS_SUCCESS; done: -#ifdef FW_DOWNLOAD_SPEED - tv2 = get_utimeofday(); - PRINTM(INFO, "FW: %d.%03d.%03d ", tv1 / 1000000, - (tv1 % 1000000) / 1000, tv1 % 1000); - PRINTM(INFO, " -> %d.%03d.%03d ", tv2 / 1000000, - (tv2 % 1000000) / 1000, tv2 % 1000); - tv2 -= tv1; - PRINTM(INFO, " == %d.%03d.%03d\n", tv2 / 1000000, - (tv2 % 1000000) / 1000, tv2 % 1000); -#endif - if (tmpfwbuf) - kfree(tmpfwbuf); + kfree(tmpfwbuf); LEAVE(); return ret; } @@ -681,9 +663,8 @@ done: /* Stop the thread servicing the interrupts */ priv->adapter->SurpriseRemoved = TRUE; wake_up_interruptible(&priv->MainThread.waitQ); - while (priv->MainThread.pid) { + while (priv->MainThread.pid) os_sched_timeout(1); - } if (m_dev_bt->dev_pointer) { if (m_dev_bt->spec_type == IANYWHERE_SPEC) free_m_dev(m_dev_bt); @@ -719,8 +700,8 @@ sd_request_fw_callback(const struct firmware *firmware, void *context) /** * @brief This function downloads firmware image to the card. * - * @param priv A pointer to bt_private structure - * @return BT_STATUS_SUCCESS/BT_STATUS_FAILURE or other error no. + * @param priv A pointer to bt_private structure + * @return BT_STATUS_SUCCESS/BT_STATUS_FAILURE or other error no. */ int sd_download_firmware_w_helper(bt_private * priv) @@ -768,7 +749,7 @@ sd_download_firmware_w_helper(bt_private * priv) * @brief This function reads data from the card. * * @param priv A pointer to bt_private structure - * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE + * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE */ static int sd_card_to_host(bt_private * priv) @@ -1072,7 +1053,7 @@ sd_interrupt(struct sdio_func *func) if (!card || !card->priv) { PRINTM(INFO, "BT: %s: sbi_interrupt(%p) card or priv is NULL, card=%p\n", - __FUNCTION__, func, card); + __func__, func, card); LEAVE(); return; } @@ -1160,7 +1141,7 @@ bt_is_suspended(bt_private * priv) /** @brief This function handles client driver suspend * * @param dev A pointer to device structure - * @return BT_STATUS_SUCCESS or other error no. + * @return BT_STATUS_SUCCESS or other error no. */ int bt_sdio_suspend(struct device *dev) @@ -1214,6 +1195,9 @@ bt_sdio_suspend(struct device *dev) skb_queue_purge(&priv->adapter->tx_queue); priv->adapter->is_suspended = TRUE; + + bt_enable_hostwake_irq(TRUE); + LEAVE(); /* We will keep the power when hs enabled successfully */ if ((mbt_pm_keep_power) && (priv->adapter->hs_state == HS_ACTIVATED)) { @@ -1236,7 +1220,7 @@ bt_sdio_suspend(struct device *dev) /** @brief This function handles client driver resume * * @param dev A pointer to device structure - * @return BT_STATUS_SUCCESS + * @return BT_STATUS_SUCCESS */ int bt_sdio_resume(struct device *dev) @@ -1249,6 +1233,7 @@ bt_sdio_resume(struct device *dev) ENTER(); if (func) { + bt_enable_hostwake_irq(FALSE); pm_flags = sdio_get_host_pm_caps(func); PRINTM(CMD, "BT: %s: resume: PM flags = 0x%x\n", sdio_func_id(func), pm_flags); @@ -1320,7 +1305,7 @@ sbi_register(void) ENTER(); if (sdio_register_driver(&sdio_bt) != 0) { - PRINTM(FATAL, "BT: SD Driver Registration Failed \n"); + PRINTM(FATAL, "BT: SD Driver Registration Failed\n"); LEAVE(); return NULL; } else @@ -1333,7 +1318,7 @@ sbi_register(void) /** * @brief This function de-registers the bt module in bus driver. * - * @return N/A + * @return N/A */ void sbi_unregister(void) @@ -1348,7 +1333,7 @@ sbi_unregister(void) * @brief This function registers the device. * * @param priv A pointer to bt_private structure - * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE + * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE */ int sbi_register_dev(bt_private * priv) @@ -1383,8 +1368,7 @@ sbi_register_dev(bt_private * priv) } ret = sdio_set_block_size(card->func, SD_BLOCK_SIZE); if (ret) { - PRINTM(FATAL, ": %s: cannot set SDIO block size\n", - __FUNCTION__); + PRINTM(FATAL, ": %s: cannot set SDIO block size\n", __func__); goto release_irq; } @@ -1462,7 +1446,7 @@ failed: * @brief This function de-registers the device. * * @param priv A pointer to bt_private structure - * @return BT_STATUS_SUCCESS + * @return BT_STATUS_SUCCESS */ int sbi_unregister_dev(bt_private * priv) @@ -1487,7 +1471,7 @@ sbi_unregister_dev(bt_private * priv) * @brief This function enables the host interrupts. * * @param priv A pointer to bt_private structure - * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE + * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE */ int sd_enable_host_int(bt_private * priv) @@ -1514,7 +1498,7 @@ sd_enable_host_int(bt_private * priv) * @brief This function disables the host interrupts. * * @param priv A pointer to bt_private structure - * @return BT_STATUS_SUCCESS/BT_STATUS_FAILURE or other error no. + * @return BT_STATUS_SUCCESS/BT_STATUS_FAILURE or other error no. */ int sd_disable_host_int(bt_private * priv) @@ -1541,8 +1525,8 @@ sd_disable_host_int(bt_private * priv) * * @param priv A pointer to bt_private structure * @param payload A pointer to the data/cmd buffer - * @param nb Length of data/cmd - * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE + * @param nb Length of data/cmd + * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE */ int sbi_host_to_card(bt_private * priv, u8 * payload, u16 nb) @@ -1617,7 +1601,7 @@ exit: * @brief This function downloads firmware * * @param priv A pointer to bt_private structure - * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE + * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE */ int sbi_download_fw(bt_private * priv) @@ -1707,7 +1691,7 @@ err_register: * @brief This function checks the interrupt status and handle it accordingly. * * @param priv A pointer to bt_private structure - * @return BT_STATUS_SUCCESS + * @return BT_STATUS_SUCCESS */ int sbi_get_int_status(bt_private * priv) @@ -1746,7 +1730,7 @@ sbi_get_int_status(bt_private * priv) * @brief This function wakeup firmware * * @param priv A pointer to bt_private structure - * @return BT_STATUS_SUCCESS/BT_STATUS_FAILURE or other error no. + * @return BT_STATUS_SUCCESS/BT_STATUS_FAILURE or other error no. */ int sbi_wakeup_firmware(bt_private * priv) diff --git a/drivers/net/wireless/sd8797/mlan/mlan.h b/drivers/net/wireless/sd8797/mlan/mlan.h index d0db9016ce63..27743d457e0c 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan.h +++ b/drivers/net/wireless/sd8797/mlan/mlan.h @@ -3,20 +3,25 @@ * @brief This file declares all APIs that will be called from MOAL module. * It also defines the data structures used for APIs between MLAN and MOAL. * - * Copyright (C) 2008-2011, Marvell International Ltd. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. */ /****************************************************** diff --git a/drivers/net/wireless/sd8797/mlan/mlan_11d.c b/drivers/net/wireless/sd8797/mlan/mlan_11d.c index 0c54df7f424b..ead95a67ea7b 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_11d.c +++ b/drivers/net/wireless/sd8797/mlan/mlan_11d.c @@ -2,20 +2,24 @@ * * @brief This file contains functions for 802.11D. * - * Copyright (C) 2008-2012, Marvell International Ltd. + * (C) Copyright 2008-2012 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * */ /******************************************************** diff --git a/drivers/net/wireless/sd8797/mlan/mlan_11h.c b/drivers/net/wireless/sd8797/mlan/mlan_11h.c index cf5a2958742e..e41ce9bc72f6 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_11h.c +++ b/drivers/net/wireless/sd8797/mlan/mlan_11h.c @@ -2,20 +2,24 @@ * * @brief This file contains functions for 802.11H. * - * Copyright (C) 2008-2012, Marvell International Ltd. + * (C) Copyright 2008-2012 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * */ @@ -627,7 +631,7 @@ wlan_11h_set_local_power_constraint_tlv(t_u8 ** ppbuffer, { MrvlIEtypes_PowerCapability_t *pcap; MrvlIEtypes_LocalPowerConstraint_t *pconstraint; - t_u8 *startPtr = MNULL; + t_u8 *start_ptr = MNULL; ENTER(); @@ -637,7 +641,7 @@ wlan_11h_set_local_power_constraint_tlv(t_u8 ** ppbuffer, return 0; } - startPtr = (t_u8 *) (*ppbuffer); + start_ptr = (t_u8 *) (*ppbuffer); PRINTM(MINFO, "11h: Set local power constraint = %d channel=%d min_tx_pwr=%d max_tx_pwr=%d\n", @@ -659,7 +663,7 @@ wlan_11h_set_local_power_constraint_tlv(t_u8 ** ppbuffer, *ppbuffer += sizeof(MrvlIEtypesHeader_t) + 2; LEAVE(); - return (t_u32) (*ppbuffer - startPtr); + return (t_u32) (*ppbuffer - start_ptr); } /** @@ -786,9 +790,9 @@ wlan_11h_process_adhoc(mlan_private * priv, } /* Append the dfs element to the TLV buffer */ - size_appended = - wlan_11h_convert_ieee_to_mrvl_ie(adapter, (t_u8 *) * ppbuffer, - (t_u8 *) & dfs_elem); + size_appended = wlan_11h_convert_ieee_to_mrvl_ie(adapter, + (t_u8 *) * ppbuffer, + (t_u8 *) & dfs_elem); HEXDUMP("11h: IBSS-DFS", (t_u8 *) * ppbuffer, size_appended); *ppbuffer += size_appended; @@ -844,16 +848,16 @@ wlan_11h_process_adhoc(mlan_private * priv, PRINTM(MINFO, "WEILIE 1: ppbuffer = %p\n", *ppbuffer); - ret_len += - wlan_11h_set_local_power_constraint_tlv(ppbuffer, - (t_u8) channel, - (t_u8) local_constraint, - (t_u8) priv->adapter-> - state_11h. - min_tx_power_capability, - (t_u8) priv->adapter-> - state_11h. - max_tx_power_capability); + ret_len += wlan_11h_set_local_power_constraint_tlv(ppbuffer, + (t_u8) channel, + (t_u8) + local_constraint, + (t_u8) priv-> + adapter->state_11h. + min_tx_power_capability, + (t_u8) priv-> + adapter->state_11h. + max_tx_power_capability); PRINTM(MINFO, "WEILIE 2: ppbuffer = %p\n", *ppbuffer); LEAVE(); @@ -976,16 +980,16 @@ wlan_11h_is_dfs_master(mlan_private * priv) ENTER(); /* UAP: all are master */ - if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) { + if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) ret = MTRUE; - } + /* STA: only ad-hoc creator is master */ else if ((GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA) && (priv->bss_mode == MLAN_BSS_MODE_IBSS) && (priv->adhoc_state == ADHOC_STARTED || - priv->adhoc_state == ADHOC_STARTING)) { + priv->adhoc_state == ADHOC_STARTING)) ret = MTRUE; - } + /* all other cases = slave interface */ LEAVE(); return ret; @@ -1057,7 +1061,7 @@ wlan_11h_get_current_radar_detect_flags(mlan_adapter * pmadapter) radar_det_flags |= SLAVE_RADAR_DET_MASK; PRINTM(MINFO, "%s: radar_det_state_curr=0x%x\n", - __FUNCTION__, radar_det_flags); + __func__, radar_det_flags); LEAVE(); return radar_det_flags; @@ -1079,7 +1083,7 @@ wlan_11h_check_radar_det_state(mlan_adapter * pmadapter, OUT t_u32 * pnew_state) ENTER(); PRINTM(MINFO, "%s: master_radar_det_pending=%d, " - " slave_radar_det_pending=%d\n", __FUNCTION__, + " slave_radar_det_pending=%d\n", __func__, pmadapter->state_11h.master_radar_det_enable_pending, pmadapter->state_11h.slave_radar_det_enable_pending); @@ -1096,7 +1100,7 @@ wlan_11h_check_radar_det_state(mlan_adapter * pmadapter, OUT t_u32 * pnew_state) radar_det_state_new |= SLAVE_RADAR_DET_MASK; PRINTM(MINFO, "%s: radar_det_state_new=0x%x\n", - __FUNCTION__, radar_det_state_new); + __func__, radar_det_state_new); /* now compare flags with current state */ ret = (wlan_11h_get_current_radar_detect_flags(pmadapter) @@ -1175,7 +1179,7 @@ wlan_11h_prepare_custom_ie_chansw(IN mlan_adapter * pmadapter, (t_u8 **) & pioctl_req); if ((ret != MLAN_STATUS_SUCCESS) || !pioctl_req) { PRINTM(MERROR, "%s(): Could not allocate ioctl req\n", - __FUNCTION__); + __func__); LEAVE(); return MLAN_STATUS_FAILURE; } @@ -1297,10 +1301,14 @@ wlan_11h_get_uap_start_channel(mlan_private * priv, t_u8 uap_band_cfg) (t_u8) chn_tbl-> pcfp[rand_entry]. channel; - } while (wlan_11h_is_channel_under_nop - (adapter, start_chn) && - (++rand_tries < - MAX_RANDOM_CHANNEL_RETRIES)); + } while ((wlan_11h_is_channel_under_nop + (adapter, start_chn) || + ((adapter->state_rdh.stage == + RDH_GET_INFO_CHANNEL) && + wlan_11h_radar_detect_required + (priv, start_chn))) + && (++rand_tries < + MAX_RANDOM_CHANNEL_RETRIES)); } } } @@ -1410,7 +1418,7 @@ wlan_11h_add_dfs_timestamp(mlan_adapter * pmadapter, t_u8 repr, t_u8 channel) (t_u8 **) & pdfs_ts); if ((ret != MLAN_STATUS_SUCCESS) || !pdfs_ts) { PRINTM(MERROR, "%s(): Could not allocate dfs_ts\n", - __FUNCTION__); + __func__); LEAVE(); return MLAN_STATUS_FAILURE; } @@ -1543,7 +1551,7 @@ wlan_11h_check_update_radar_det_state(mlan_private * pmpriv) if (wlan_11h_check_radar_det_state(pmpriv->adapter, &new_radar_det_state)) { PRINTM(MCMD_D, "%s: radar_det_state being updated.\n", - __FUNCTION__); + __func__); mib_11h |= new_radar_det_state; /* keep priv's existing 11h state */ @@ -2077,7 +2085,7 @@ wlan_11h_check_chan_report(mlan_private * priv, t_u8 chan) pmoal_handle, &sec, &usec); - PRINTM(MINFO, "11h: %s()\n", __FUNCTION__); + PRINTM(MINFO, "11h: %s()\n", __func__); PRINTM(MINFO, "- sec_now=%d, sec_report=%d.\n", sec, pstate_dfs->dfs_report_time_sec); PRINTM(MINFO, "- rpt_channel=%d, rpt_radar=%d.\n", @@ -2677,37 +2685,38 @@ mlan_status wlan_11h_handle_event_chanrpt_ready(mlan_private * priv, mlan_event * pevent) { mlan_status ret = MLAN_STATUS_SUCCESS; - HostCmd_DS_CHAN_RPT_RSP *pChanRptRsp; - MrvlIEtypes_Data_t *pTlv; - MeasRptBasicMap_t *pMeasRptBasic; - t_u8 *pBuffer; - t_s32 evtLen; - t_u16 tlvLen; - t_u32 sec, uSec; + HostCmd_DS_CHAN_RPT_RSP *pchan_rpt_rsp; + MrvlIEtypes_Data_t *ptlv; + MeasRptBasicMap_t *pmeas_rpt_basic; + t_u8 *pbuffer; + t_s32 evt_len; + t_u16 tlv_len; + t_u32 sec, usec; wlan_dfs_device_state_t *pstate_dfs = &priv->adapter->state_dfs; ENTER(); - pChanRptRsp = (HostCmd_DS_CHAN_RPT_RSP *) & pevent->event_buf; + pchan_rpt_rsp = (HostCmd_DS_CHAN_RPT_RSP *) & pevent->event_buf; DBG_HEXDUMP(MCMD_D, "11h: Event ChanRptReady (HostCmd_DS_CHAN_RPT_RSP)", - (t_u8 *) pChanRptRsp, wlan_le32_to_cpu(pevent->event_len)); + (t_u8 *) pchan_rpt_rsp, + wlan_le32_to_cpu(pevent->event_len)); - if (wlan_le32_to_cpu(pChanRptRsp->cmd_result) == + if (wlan_le32_to_cpu(pchan_rpt_rsp->cmd_result) == MLAN_CMD_RESULT_SUCCESS) { - pBuffer = (t_u8 *) & pChanRptRsp->tlv_buffer; - evtLen = wlan_le32_to_cpu(pevent->event_len); - evtLen -= + pbuffer = (t_u8 *) & pchan_rpt_rsp->tlv_buffer; + evt_len = wlan_le32_to_cpu(pevent->event_len); + evt_len -= sizeof(HostCmd_DS_CHAN_RPT_RSP) - - sizeof(pChanRptRsp->tlv_buffer); + sizeof(pchan_rpt_rsp->tlv_buffer); - while (evtLen >= sizeof(MrvlIEtypesHeader_t)) { - pTlv = (MrvlIEtypes_Data_t *) pBuffer; - tlvLen = wlan_le16_to_cpu(pTlv->header.len); + while (evt_len >= sizeof(MrvlIEtypesHeader_t)) { + ptlv = (MrvlIEtypes_Data_t *) pbuffer; + tlv_len = wlan_le16_to_cpu(ptlv->header.len); - switch (wlan_le16_to_cpu(pTlv->header.type)) { + switch (wlan_le16_to_cpu(ptlv->header.type)) { case TLV_TYPE_CHANRPT_11H_BASIC: - pMeasRptBasic = - (MeasRptBasicMap_t *) & pTlv->data; - if (pMeasRptBasic->radar) { + pmeas_rpt_basic = + (MeasRptBasicMap_t *) & ptlv->data; + if (pmeas_rpt_basic->radar) { pstate_dfs->dfs_radar_found = MTRUE; PRINTM(MMSG, "RADAR Detected on channel %d!\n", @@ -2725,9 +2734,9 @@ wlan_11h_handle_event_chanrpt_ready(mlan_private * priv, mlan_event * pevent) break; } - pBuffer += (tlvLen + sizeof(pTlv->header)); - evtLen -= (tlvLen + sizeof(pTlv->header)); - evtLen = (evtLen > 0) ? evtLen : 0; + pbuffer += (tlv_len + sizeof(ptlv->header)); + evt_len -= (tlv_len + sizeof(ptlv->header)); + evt_len = (evt_len > 0) ? evt_len : 0; } } else { ret = MLAN_STATUS_FAILURE; @@ -2736,7 +2745,7 @@ wlan_11h_handle_event_chanrpt_ready(mlan_private * priv, mlan_event * pevent) /* Update DFS structure. */ priv->adapter->callbacks.moal_get_system_time(priv->adapter-> pmoal_handle, &sec, - &uSec); + &usec); pstate_dfs->dfs_report_time_sec = sec; pstate_dfs->dfs_check_pending = MFALSE; @@ -2792,7 +2801,7 @@ mlan_status wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) { #ifdef DEBUG_LEVEL1 - const char *RDH_stage_str[] = { + const char *rdh_stage_str[] = { "RDH_OFF", "RDH_CHK_INTFS", "RDH_STOP_TRAFFIC", @@ -2817,8 +2826,8 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) switch (pstate_rdh->stage) { case RDH_CHK_INTFS: PRINTM(MCMD_D, "%s(): stage(%d)=%s\n", - __FUNCTION__, pstate_rdh->stage, - RDH_stage_str[pstate_rdh->stage]); + __func__, pstate_rdh->stage, + rdh_stage_str[pstate_rdh->stage]); /* get active interfaces */ memset(pmadapter, pstate_rdh->priv_list, 0x00, @@ -2827,11 +2836,11 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) wlan_is_intf_active, pstate_rdh-> priv_list); - PRINTM(MCMD_D, "%s(): priv_list_count = %d\n", __FUNCTION__, + PRINTM(MCMD_D, "%s(): priv_list_count = %d\n", __func__, pstate_rdh->priv_list_count); for (i = 0; i < pstate_rdh->priv_list_count; i++) PRINTM(MINFO, "%s(): priv_list[%d] = %p\n", - __FUNCTION__, i, pstate_rdh->priv_list[i]); + __func__, i, pstate_rdh->priv_list[i]); if (pstate_rdh->priv_list_count == 0) { /* no interfaces active... nothing to do */ @@ -2839,8 +2848,8 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) " skip event handling.\n"); pstate_rdh->stage = RDH_OFF; PRINTM(MCMD_D, "%s(): finished - stage(%d)=%s\n", - __FUNCTION__, pstate_rdh->stage, - RDH_stage_str[pstate_rdh->stage]); + __func__, pstate_rdh->stage, + rdh_stage_str[pstate_rdh->stage]); break; /* EXIT CASE */ } /* else: start handling */ @@ -2854,14 +2863,13 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) case RDH_STOP_TRAFFIC: PRINTM(MCMD_D, "%s(): stage(%d)=%s\n", - __FUNCTION__, pstate_rdh->stage, - RDH_stage_str[pstate_rdh->stage]); + __func__, pstate_rdh->stage, + rdh_stage_str[pstate_rdh->stage]); PRINTM(MMSG, "11h: Radar Detected - stopping host tx traffic.\n"); - for (i = 0; i < pstate_rdh->priv_list_count; i++) { + for (i = 0; i < pstate_rdh->priv_list_count; i++) wlan_11h_tx_disable(pstate_rdh->priv_list[i]); - } pstate_rdh->priv_curr_idx = RDH_STAGE_FIRST_ENTRY_PRIV_IDX; pstate_rdh->stage = RDH_GET_INFO_CHANNEL; @@ -2869,8 +2877,8 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) case RDH_GET_INFO_CHANNEL: PRINTM(MCMD_D, "%s(): stage(%d)=%s, priv_idx=%d\n", - __FUNCTION__, pstate_rdh->stage, - RDH_stage_str[pstate_rdh->stage], + __func__, pstate_rdh->stage, + rdh_stage_str[pstate_rdh->stage], pstate_rdh->priv_curr_idx); /* here, prefer STA info over UAP info - one less CMD to send */ @@ -2918,8 +2926,8 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) pmpriv->uap_state_chan_cb.channel; pstate_rdh->uap_band_cfg = pmpriv->uap_state_chan_cb.band_config; - PRINTM(MCMD_D, "%s(): uap_band_cfg=0x%02x\n", - __FUNCTION__, pstate_rdh->uap_band_cfg); + PRINTM(MCMD_D, "%s(): uap_band_cfg=0x%02x\n", __func__, + pstate_rdh->uap_band_cfg); } #endif @@ -2948,7 +2956,7 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) if (i >= MAX_RANDOM_CHANNEL_RETRIES) /* report error */ PRINTM(MERROR, "%s(): ERROR - could not choose new_chan" - " (!= curr_chan) !!\n", __FUNCTION__); + " (!= curr_chan) !!\n", __func__); #ifdef DFS_TESTING_SUPPORT if (pmadapter->dfs_test_params.fixed_new_channel_on_radar) { @@ -2961,7 +2969,7 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) } #endif PRINTM(MCMD_D, "%s(): curr_chan=%d, new_chan=%d\n", - __FUNCTION__, pstate_rdh->curr_channel, + __func__, pstate_rdh->curr_channel, pstate_rdh->new_channel); pstate_rdh->priv_curr_idx = RDH_STAGE_FIRST_ENTRY_PRIV_IDX; @@ -2970,8 +2978,8 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) case RDH_GET_INFO_BEACON_DTIM: PRINTM(MCMD_D, "%s(): stage(%d)=%s, priv_idx=%d\n", - __FUNCTION__, pstate_rdh->stage, - RDH_stage_str[pstate_rdh->stage], + __func__, pstate_rdh->stage, + rdh_stage_str[pstate_rdh->stage], pstate_rdh->priv_curr_idx); #ifdef UAP_SUPPORT @@ -2982,7 +2990,7 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) pmpriv = pstate_rdh->priv_list[pstate_rdh-> priv_curr_idx]; PRINTM(MCMD_D, "%s(): uap.bcn_pd=%d, uap.dtim_pd=%d\n", - __FUNCTION__, + __func__, pmpriv->uap_state_chan_cb.beacon_period, pmpriv->uap_state_chan_cb.dtim_period); bcn_dtim_msec = @@ -3029,7 +3037,7 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) } PRINTM(MCMD_D, "%s(): sta.bcn_pd=%d, sta.dtim_pd=%d\n", - __FUNCTION__, bcn_pd_msec, dtim_pd_msec); + __func__, bcn_pd_msec, dtim_pd_msec); bcn_dtim_msec = (bcn_pd_msec * dtim_pd_msec); if (bcn_dtim_msec > pstate_rdh->max_bcn_dtim_ms) pstate_rdh->max_bcn_dtim_ms = @@ -3046,8 +3054,8 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) case RDH_SET_CUSTOM_IE: PRINTM(MCMD_D, "%s(): stage(%d)=%s, priv_idx=%d\n", - __FUNCTION__, pstate_rdh->stage, - RDH_stage_str[pstate_rdh->stage], + __func__, pstate_rdh->stage, + rdh_stage_str[pstate_rdh->stage], pstate_rdh->priv_curr_idx); /* add CHAN_SW IE - firmware will accept on any interface, and @@ -3060,8 +3068,8 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) MTRUE); if ((ret != MLAN_STATUS_SUCCESS) || !pioctl_req) { PRINTM(MERROR, - "%s(): Error in preparng CHAN_SW IE.\n", - __FUNCTION__); + "%s(): Error in preparing CHAN_SW IE.\n", + __func__); break; /* EXIT CASE */ } @@ -3077,7 +3085,7 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) ret != MLAN_STATUS_PENDING) { PRINTM(MERROR, "%s(): Could not set IE for priv=%p [priv_bss_idx=%d]!\n", - __FUNCTION__, pmpriv, pmpriv->bss_index); + __func__, pmpriv, pmpriv->bss_index); /* TODO: how to handle this error case?? ignore & continue? */ } @@ -3093,8 +3101,8 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) case RDH_REM_CUSTOM_IE: PRINTM(MCMD_D, "%s(): stage(%d)=%s, priv_idx=%d\n", - __FUNCTION__, pstate_rdh->stage, - RDH_stage_str[pstate_rdh->stage], + __func__, pstate_rdh->stage, + rdh_stage_str[pstate_rdh->stage], pstate_rdh->priv_curr_idx); /* remove CHAN_SW IE - firmware will accept on any interface, @@ -3123,8 +3131,8 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) MFALSE); if ((ret != MLAN_STATUS_SUCCESS) || !pioctl_req) { PRINTM(MERROR, - "%s(): Error in preparng CHAN_SW IE.\n", - __FUNCTION__); + "%s(): Error in preparing CHAN_SW IE.\n", + __func__); break; /* EXIT CASE */ } @@ -3138,7 +3146,7 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) ret != MLAN_STATUS_PENDING) { PRINTM(MERROR, "%s(): Could not set IE for priv=%p [priv_bss_idx=%d]!\n", - __FUNCTION__, pmpriv, pmpriv->bss_index); + __func__, pmpriv, pmpriv->bss_index); /* TODO: hiow to handle this error case?? ignore & continue? */ } @@ -3150,25 +3158,12 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) /* else */ pstate_rdh->priv_curr_idx = RDH_STAGE_FIRST_ENTRY_PRIV_IDX; pstate_rdh->stage = RDH_STOP_INTFS; -#ifdef DFS_TESTING_SUPPORT - if (pmadapter->dfs_test_params.no_channel_change_on_radar) { - PRINTM(MCMD_D, - "dfs_testing - no channel change on radar." - " Also skip stop/restart interface stages.\n", - pmadapter->dfs_test_params. - no_channel_change_on_radar); - pstate_rdh->priv_curr_idx = - RDH_STAGE_FIRST_ENTRY_PRIV_IDX; - pstate_rdh->stage = RDH_RESTART_TRAFFIC; - goto rdh_restart_traffic; /* skip several stages */ - } -#endif /* FALL THROUGH TO NEXT STAGE */ case RDH_STOP_INTFS: PRINTM(MCMD_D, "%s(): stage(%d)=%s, priv_idx=%d\n", - __FUNCTION__, pstate_rdh->stage, - RDH_stage_str[pstate_rdh->stage], + __func__, pstate_rdh->stage, + rdh_stage_str[pstate_rdh->stage], pstate_rdh->priv_curr_idx); /* issues one cmd (DEAUTH/ADHOC_STOP/BSS_STOP) to each intf */ @@ -3207,12 +3202,24 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) /* else */ pstate_rdh->priv_curr_idx = RDH_STAGE_FIRST_ENTRY_PRIV_IDX; pstate_rdh->stage = RDH_SET_NEW_CHANNEL; +#ifdef DFS_TESTING_SUPPORT + if (pmadapter->dfs_test_params.no_channel_change_on_radar) { + PRINTM(MCMD_D, + "dfs_testing - no channel change on radar." + " Overwrite new_chan = curr_chan.\n"); + pstate_rdh->new_channel = pstate_rdh->curr_channel; + pstate_rdh->priv_curr_idx = + RDH_STAGE_FIRST_ENTRY_PRIV_IDX; + pstate_rdh->stage = RDH_RESTART_INTFS; + goto rdh_restart_intfs; /* skip next stage */ + } +#endif /* FALL THROUGH TO NEXT STAGE */ case RDH_SET_NEW_CHANNEL: PRINTM(MCMD_D, "%s(): stage(%d)=%s, priv_idx=%d\n", - __FUNCTION__, pstate_rdh->stage, - RDH_stage_str[pstate_rdh->stage], + __func__, pstate_rdh->stage, + rdh_stage_str[pstate_rdh->stage], pstate_rdh->priv_curr_idx); /* only set new channel for UAP intfs */ @@ -3250,9 +3257,12 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) /* FALL THROUGH TO NEXT STAGE */ case RDH_RESTART_INTFS: +#ifdef DFS_TESTING_SUPPORT +rdh_restart_intfs: +#endif PRINTM(MCMD_D, "%s(): stage(%d)=%s, priv_idx=%d\n", - __FUNCTION__, pstate_rdh->stage, - RDH_stage_str[pstate_rdh->stage], + __func__, pstate_rdh->stage, + rdh_stage_str[pstate_rdh->stage], pstate_rdh->priv_curr_idx); /* can only restart master intfs */ @@ -3341,24 +3351,20 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) /* FALL THROUGH TO NEXT STAGE */ case RDH_RESTART_TRAFFIC: -#ifdef DFS_TESTING_SUPPORT -rdh_restart_traffic: -#endif PRINTM(MCMD_D, "%s(): stage(%d)=%s\n", - __FUNCTION__, pstate_rdh->stage, - RDH_stage_str[pstate_rdh->stage]); + __func__, pstate_rdh->stage, + rdh_stage_str[pstate_rdh->stage]); /* continue traffic for reactivated interfaces */ PRINTM(MMSG, "11h: Radar Detected - restarting host tx traffic.\n"); - for (i = 0; i < pstate_rdh->priv_list_count; i++) { + for (i = 0; i < pstate_rdh->priv_list_count; i++) wlan_11h_tx_enable(pstate_rdh->priv_list[i]); - } pstate_rdh->stage = RDH_OFF; /* DONE! */ PRINTM(MCMD_D, "%s(): finished - stage(%d)=%s\n", - __FUNCTION__, pstate_rdh->stage, - RDH_stage_str[pstate_rdh->stage]); + __func__, pstate_rdh->stage, + rdh_stage_str[pstate_rdh->stage]); break; default: @@ -3401,14 +3407,14 @@ wlan_11h_dfs_event_preprocessing(mlan_adapter * pmadapter) MTRUE, priv_list)) { pmpriv = priv_list[0]; PRINTM(MINFO, "%s: found dfs_master priv=%p\n", - __FUNCTION__, pmpriv); + __func__, pmpriv); } else if (wlan_get_privs_by_two_cond(pmadapter, wlan_11h_is_slave_active_on_dfs_chan, wlan_11h_is_dfs_slave, MTRUE, priv_list)) { pmpriv = priv_list[0]; PRINTM(MINFO, "%s: found dfs_slave priv=%p\n", - __FUNCTION__, pmpriv); + __func__, pmpriv); } /* update event_cause if we found an appropriate priv */ @@ -3420,8 +3426,7 @@ wlan_11h_dfs_event_preprocessing(mlan_adapter * pmadapter) ((GET_BSS_NUM(pmpriv) & 0xff) << 16) | ((pmpriv->bss_type & 0xff) << 24); PRINTM(MINFO, "%s: priv - bss_num=%d, bss_type=%d\n", - __FUNCTION__, GET_BSS_NUM(pmpriv), - pmpriv->bss_type); + __func__, GET_BSS_NUM(pmpriv), pmpriv->bss_type); memcpy(pmadapter, pmevbuf->pbuf + pmevbuf->data_offset, &new_event_cause, sizeof(new_event_cause)); ret = MLAN_STATUS_SUCCESS; @@ -3464,9 +3469,8 @@ wlan_11h_switch_non_dfs_chan(mlan_private * priv, t_u8 * chan) } } - if (!chn_tbl || !chn_tbl->pcfp) { + if (!chn_tbl || !chn_tbl->pcfp) goto done; - } do { rand_entry = @@ -3489,9 +3493,8 @@ wlan_11h_switch_non_dfs_chan(mlan_private * priv, t_u8 * chan) break; } } - if (i == chn_tbl->num_cfp) { + if (i == chn_tbl->num_cfp) goto done; - } } *chan = def_chan; diff --git a/drivers/net/wireless/sd8797/mlan/mlan_11h.h b/drivers/net/wireless/sd8797/mlan/mlan_11h.h index 3e8a2f1647c7..03d6042dd407 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_11h.h +++ b/drivers/net/wireless/sd8797/mlan/mlan_11h.h @@ -3,20 +3,24 @@ * @brief This header file contains data structures and * function declarations of 802.11h * - * Copyright (C) 2008-2011, Marvell International Ltd. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * */ @@ -45,11 +49,15 @@ Change Log: /* Is master radar detection enabled in firmware? */ extern t_bool wlan_11h_is_master_radar_det_active(mlan_private * priv); -/** Configure master radar detection. Need call wlan_11h_check_update_radar_det_state() after. */ +/** Configure master radar detection. + * Need call wlan_11h_check_update_radar_det_state() after. + */ extern mlan_status wlan_11h_config_master_radar_det(mlan_private * priv, t_bool enable); -/** Configure slave radar detection. Need call wlan_11h_check_update_radar_det_state() after. */ +/** Configure slave radar detection. + * Need call wlan_11h_check_update_radar_det_state() after. + */ extern mlan_status wlan_11h_config_slave_radar_det(mlan_private * priv, t_bool enable); diff --git a/drivers/net/wireless/sd8797/mlan/mlan_11n.c b/drivers/net/wireless/sd8797/mlan/mlan_11n.c index 0dc4b9d4b4f3..f5fa88348ad7 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_11n.c +++ b/drivers/net/wireless/sd8797/mlan/mlan_11n.c @@ -2,20 +2,24 @@ * * @brief This file contains functions for 11n handling. * - * Copyright (C) 2008-2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved + * + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * */ @@ -381,7 +385,7 @@ wlan_11n_update_addba_request(mlan_private * priv) * @param pmadapter A pointer to mlan_adapter structure * @param pioctl_req A pointer to ioctl request buffer * - * @return MLAN_STATUS_SUCCESS --success + * @return MLAN_STATUS_SUCCESS --success */ static mlan_status wlan_11n_ioctl_addba_param(IN pmlan_adapter pmadapter, @@ -412,9 +416,8 @@ wlan_11n_ioctl_addba_param(IN pmlan_adapter pmadapter, cfg->param.addba_param.rxwinsize; pmpriv->add_ba_param.tx_amsdu = cfg->param.addba_param.txamsdu; pmpriv->add_ba_param.rx_amsdu = cfg->param.addba_param.rxamsdu; - if (timeout != pmpriv->add_ba_param.timeout) { + if (timeout != pmpriv->add_ba_param.timeout) wlan_11n_update_addba_request(pmpriv); - } } LEAVE(); @@ -1035,12 +1038,12 @@ wlan_is_txbastreamptr_valid(mlan_private * priv, TxBAStreamTbl * ptxtblptr) /** * @brief This function will return the pointer to a entry in BA Stream - * table which matches the ba_status requested + * table which matches the ba_status requested * * @param priv A pointer to mlan_private - * @param ba_status Current status of the BA stream + * @param ba_status Current status of the BA stream * - * @return A pointer to first entry matching status in BA stream + * @return A pointer to first entry matching status in BA stream * NULL if not found */ static TxBAStreamTbl * @@ -1311,30 +1314,22 @@ wlan_show_dot11ndevcap(pmlan_adapter pmadapter, t_u32 cap) PRINTM(MINFO, "GET_HW_SPEC: 10 Mhz channel width %s\n", (ISSUPP_CHANWIDTH10(cap) ? "supported" : "not supported")); - if (ISSUPP_RXANTENNAA(cap)) { + if (ISSUPP_RXANTENNAA(cap)) PRINTM(MINFO, "GET_HW_SPEC: Presence of Rx antenna A\n"); - } - if (ISSUPP_RXANTENNAB(cap)) { + if (ISSUPP_RXANTENNAB(cap)) PRINTM(MINFO, "GET_HW_SPEC: Presence of Rx antenna B\n"); - } - if (ISSUPP_RXANTENNAC(cap)) { + if (ISSUPP_RXANTENNAC(cap)) PRINTM(MINFO, "GET_HW_SPEC: Presence of Rx antenna C\n"); - } - if (ISSUPP_RXANTENNAD(cap)) { + if (ISSUPP_RXANTENNAD(cap)) PRINTM(MINFO, "GET_HW_SPEC: Presence of Rx antenna D\n"); - } - if (ISSUPP_TXANTENNAA(cap)) { + if (ISSUPP_TXANTENNAA(cap)) PRINTM(MINFO, "GET_HW_SPEC: Presence of Tx antenna A\n"); - } - if (ISSUPP_TXANTENNAB(cap)) { + if (ISSUPP_TXANTENNAB(cap)) PRINTM(MINFO, "GET_HW_SPEC: Presence of Tx antenna B\n"); - } - if (ISSUPP_TXANTENNAC(cap)) { + if (ISSUPP_TXANTENNAC(cap)) PRINTM(MINFO, "GET_HW_SPEC: Presence of Tx antenna C\n"); - } - if (ISSUPP_TXANTENNAD(cap)) { + if (ISSUPP_TXANTENNAD(cap)) PRINTM(MINFO, "GET_HW_SPEC: Presence of Tx antenna D\n"); - } LEAVE(); return; @@ -1391,9 +1386,8 @@ wlan_ret_11n_delba(mlan_private * priv, HostCmd_DS_COMMAND * resp) ptx_ba_tbl = wlan_11n_get_txbastream_status(priv, BA_STREAM_SETUP_INPROGRESS); - if (ptx_ba_tbl) { + if (ptx_ba_tbl) wlan_send_addba(priv, ptx_ba_tbl->tid, ptx_ba_tbl->ra); - } } else { /* * In case of failure, recreate the deleted stream in * case we initiated the ADDBA @@ -1622,11 +1616,11 @@ wlan_ret_amsdu_aggr_ctrl(IN pmlan_private pmpriv, /** * @brief This function prepares 11n cfg command * - * @param pmpriv A pointer to mlan_private structure - * @param cmd A pointer to HostCmd_DS_COMMAND structure - * @param cmd_action the action: GET or SET - * @param pdata_buf A pointer to data buffer - * @return MLAN_STATUS_SUCCESS + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param cmd_action the action: GET or SET + * @param pdata_buf A pointer to data buffer + * @return MLAN_STATUS_SUCCESS */ mlan_status wlan_cmd_11n_cfg(IN pmlan_private pmpriv, @@ -1680,18 +1674,18 @@ wlan_ret_11n_cfg(IN pmlan_private pmpriv, /** * @brief This function prepares reject addba req command * - * @param pmpriv A pointer to mlan_private structure - * @param cmd A pointer to HostCmd_DS_COMMAND structure - * @param cmd_action the action: GET or SET - * @param pdata_buf A pointer to data buffer - * @return MLAN_STATUS_SUCCESS + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param cmd_action the action: GET or SET + * @param pdata_buf A pointer to data buffer + * @return MLAN_STATUS_SUCCESS */ mlan_status wlan_cmd_reject_addba_req(IN pmlan_private pmpriv, IN HostCmd_DS_COMMAND * cmd, IN t_u16 cmd_action, IN t_void * pdata_buf) { - HostCmd_DS_REJECT_ADDBA_REQ *pRejectAddbaReq = + HostCmd_DS_REJECT_ADDBA_REQ *preject_addba_req = &cmd->params.rejectaddbareq; mlan_ds_reject_addba_req *prejaddbareq = (mlan_ds_reject_addba_req *) pdata_buf; @@ -1701,8 +1695,8 @@ wlan_cmd_reject_addba_req(IN pmlan_private pmpriv, cmd->size = wlan_cpu_to_le16(sizeof(HostCmd_DS_REJECT_ADDBA_REQ) + S_DS_GEN); - pRejectAddbaReq->action = wlan_cpu_to_le16(cmd_action); - pRejectAddbaReq->conditions = + preject_addba_req->action = wlan_cpu_to_le16(cmd_action); + preject_addba_req->conditions = wlan_cpu_to_le32(prejaddbareq->conditions); LEAVE(); return MLAN_STATUS_SUCCESS; @@ -1723,16 +1717,16 @@ wlan_ret_reject_addba_req(IN pmlan_private pmpriv, IN mlan_ioctl_req * pioctl_buf) { mlan_ds_11n_cfg *cfg = MNULL; - HostCmd_DS_REJECT_ADDBA_REQ *pRejectAddbaReq = + HostCmd_DS_REJECT_ADDBA_REQ *preject_addba_req = &resp->params.rejectaddbareq; ENTER(); if (pioctl_buf && - (wlan_le16_to_cpu(pRejectAddbaReq->action) == + (wlan_le16_to_cpu(preject_addba_req->action) == HostCmd_ACT_GEN_GET)) { cfg = (mlan_ds_11n_cfg *) pioctl_buf->pbuf; cfg->param.reject_addba_req.conditions = - wlan_le32_to_cpu(pRejectAddbaReq->conditions); + wlan_le32_to_cpu(preject_addba_req->conditions); } LEAVE(); return MLAN_STATUS_SUCCESS; @@ -1922,6 +1916,52 @@ wlan_ret_tx_bf_cfg(IN pmlan_private pmpriv, return MLAN_STATUS_SUCCESS; } +/** + * @brief Get second channel offset + * + * @param chan channel num + * @return second channel offset + */ +t_u8 +wlan_get_second_channel_offset(int chan) +{ + t_u8 chan2Offset = SEC_CHAN_NONE; + + switch (chan) { + case 36: + case 44: + case 52: + case 60: + case 100: + case 108: + case 116: + case 124: + case 132: + case 149: + case 157: + chan2Offset = SEC_CHAN_ABOVE; + break; + case 40: + case 48: + case 56: + case 64: + case 104: + case 112: + case 120: + case 128: + case 136: + case 153: + case 161: + chan2Offset = SEC_CHAN_BELOW; + break; + case 165: + /* Special Case: 20Mhz-only Channel */ + chan2Offset = SEC_CHAN_NONE; + break; + } + return chan2Offset; +} + #ifdef STA_SUPPORT /** @@ -2166,10 +2206,10 @@ wlan_11n_cfg_ioctl(IN pmlan_adapter pmadapter, IN pmlan_ioctl_req pioctl_req) /** * @brief This function will delete the given entry in Tx BA Stream table * - * @param priv Pointer to mlan_private - * @param ptx_tbl Pointer to tx ba stream entry to delete + * @param priv Pointer to mlan_private + * @param ptx_tbl Pointer to tx ba stream entry to delete * - * @return N/A + * @return N/A */ void wlan_11n_delete_txbastream_tbl_entry(mlan_private * priv, @@ -2182,9 +2222,8 @@ wlan_11n_delete_txbastream_tbl_entry(mlan_private * priv, pmadapter->callbacks.moal_spin_lock(pmadapter->pmoal_handle, priv->tx_ba_stream_tbl_ptr.plock); - if (!ptx_tbl || !wlan_is_txbastreamptr_valid(priv, ptx_tbl)) { + if (!ptx_tbl || !wlan_is_txbastreamptr_valid(priv, ptx_tbl)) goto exit; - } PRINTM(MINFO, "Delete BA stream table entry: %p\n", ptx_tbl); @@ -2235,13 +2274,13 @@ wlan_11n_deleteall_txbastream_tbl(mlan_private * priv) /** * @brief This function will return the pointer to an entry in BA Stream - * table which matches the give RA/TID pair + * table which matches the give RA/TID pair * * @param priv A pointer to mlan_private * @param tid TID to find in reordering table * @param ra RA to find in reordering table * - * @return A pointer to first entry matching RA/TID in BA stream + * @return A pointer to first entry matching RA/TID in BA stream * NULL if not found */ TxBAStreamTbl * @@ -2283,20 +2322,20 @@ wlan_11n_get_txbastream_tbl(mlan_private * priv, int tid, t_u8 * ra) /** * @brief This function will create a entry in tx ba stream table for the - * given RA/TID. + * given RA/TID. * * @param priv A pointer to mlan_private * @param ra RA to find in reordering table * @param tid TID to find in reordering table * @param ba_status BA stream status to create the stream with * - * @return N/A + * @return N/A */ void wlan_11n_create_txbastream_tbl(mlan_private * priv, t_u8 * ra, int tid, baStatus_e ba_status) { - TxBAStreamTbl *newNode = MNULL; + TxBAStreamTbl *new_node = MNULL; pmlan_adapter pmadapter = priv->adapter; ENTER(); @@ -2305,19 +2344,23 @@ wlan_11n_create_txbastream_tbl(mlan_private * priv, PRINTM(MDAT_D, "get_txbastream_tbl TID %d\n", tid); DBG_HEXDUMP(MDAT_D, "RA", ra, MLAN_MAC_ADDR_LENGTH); - pmadapter->callbacks.moal_malloc(pmadapter->pmoal_handle, - sizeof(TxBAStreamTbl), - MLAN_MEM_DEF, - (t_u8 **) & newNode); - util_init_list((pmlan_linked_list) newNode); + if (pmadapter->callbacks. + moal_malloc(pmadapter->pmoal_handle, sizeof(TxBAStreamTbl), + MLAN_MEM_DEF, (t_u8 **) & new_node)) { + PRINTM(MERROR, + "wlan_11n_create_txbastream_tbl Failed to allocate new_node\n"); + LEAVE(); + return; + } + util_init_list((pmlan_linked_list) new_node); - newNode->tid = tid; - newNode->ba_status = ba_status; - memcpy(pmadapter, newNode->ra, ra, MLAN_MAC_ADDR_LENGTH); + new_node->tid = tid; + new_node->ba_status = ba_status; + memcpy(pmadapter, new_node->ra, ra, MLAN_MAC_ADDR_LENGTH); util_enqueue_list_tail(pmadapter->pmoal_handle, &priv->tx_ba_stream_tbl_ptr, - (pmlan_linked_list) newNode, + (pmlan_linked_list) new_node, pmadapter->callbacks.moal_spin_lock, pmadapter->callbacks.moal_spin_unlock); } @@ -2332,7 +2375,7 @@ wlan_11n_create_txbastream_tbl(mlan_private * priv, * @param tid TID to send the ADDBA * @param peer_mac MAC address to send the ADDBA * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ int wlan_send_addba(mlan_private * priv, int tid, t_u8 * peer_mac) @@ -2377,13 +2420,13 @@ wlan_send_addba(mlan_private * priv, int tid, t_u8 * peer_mac) /** * @brief This function will delete a block ack to given tid/ra * - * @param priv A pointer to mlan_private - * @param pioctl_req A pointer to ioctl request buffer - * @param tid TID to send the ADDBA - * @param peer_mac MAC address to send the ADDBA - * @param initiator MTRUE if we have initiated ADDBA, MFALSE otherwise + * @param priv A pointer to mlan_private + * @param pioctl_req A pointer to ioctl request buffer + * @param tid TID to send the ADDBA + * @param peer_mac MAC address to send the ADDBA + * @param initiator MTRUE if we have initiated ADDBA, MFALSE otherwise * - * @return MLAN_STATUS_PENDING --success, otherwise fail + * @return MLAN_STATUS_PENDING --success, otherwise fail */ int wlan_send_delba(mlan_private * priv, pmlan_ioctl_req pioctl_req, int tid, @@ -2458,34 +2501,35 @@ wlan_get_rxreorder_tbl(mlan_private * priv, rx_reorder_tbl * buf) { int i; rx_reorder_tbl *ptbl = buf; - RxReorderTbl *rxReorderTblPtr; + RxReorderTbl *rx_reorder_tbl_ptr; int count = 0; ENTER(); - rxReorderTblPtr = + rx_reorder_tbl_ptr = (RxReorderTbl *) util_peek_list(priv->adapter->pmoal_handle, &priv->rx_reorder_tbl_ptr, priv->adapter->callbacks. moal_spin_lock, priv->adapter->callbacks. moal_spin_unlock); - if (!rxReorderTblPtr) { + if (!rx_reorder_tbl_ptr) { LEAVE(); return count; } - while (rxReorderTblPtr != (RxReorderTbl *) & priv->rx_reorder_tbl_ptr) { - ptbl->tid = (t_u16) rxReorderTblPtr->tid; - memcpy(priv->adapter, ptbl->ta, rxReorderTblPtr->ta, + while (rx_reorder_tbl_ptr != + (RxReorderTbl *) & priv->rx_reorder_tbl_ptr) { + ptbl->tid = (t_u16) rx_reorder_tbl_ptr->tid; + memcpy(priv->adapter, ptbl->ta, rx_reorder_tbl_ptr->ta, MLAN_MAC_ADDR_LENGTH); - ptbl->start_win = rxReorderTblPtr->start_win; - ptbl->win_size = rxReorderTblPtr->win_size; - ptbl->amsdu = rxReorderTblPtr->amsdu; - for (i = 0; i < rxReorderTblPtr->win_size; ++i) { - if (rxReorderTblPtr->rx_reorder_ptr[i]) + ptbl->start_win = rx_reorder_tbl_ptr->start_win; + ptbl->win_size = rx_reorder_tbl_ptr->win_size; + ptbl->amsdu = rx_reorder_tbl_ptr->amsdu; + for (i = 0; i < rx_reorder_tbl_ptr->win_size; ++i) { + if (rx_reorder_tbl_ptr->rx_reorder_ptr[i]) ptbl->buffer[i] = MTRUE; else ptbl->buffer[i] = MFALSE; } - rxReorderTblPtr = rxReorderTblPtr->pnext; + rx_reorder_tbl_ptr = rx_reorder_tbl_ptr->pnext; ptbl++; count++; if (count >= MLAN_MAX_RX_BASTREAM_SUPPORTED) @@ -2542,9 +2586,9 @@ wlan_get_txbastream_tbl(mlan_private * priv, tx_ba_stream_tbl * buf) /** * @brief This function cleans up txbastream_tbl for specific station * - * @param priv A pointer to mlan_private + * @param priv A pointer to mlan_private * @param ra RA to find in txbastream_tbl - * @return N/A + * @return N/A */ void wlan_11n_cleanup_txbastream_tbl(mlan_private * priv, t_u8 * ra) @@ -2554,9 +2598,8 @@ wlan_11n_cleanup_txbastream_tbl(mlan_private * priv, t_u8 * ra) ENTER(); for (i = 0; i < MAX_NUM_TID; ++i) { ptx_tbl = wlan_11n_get_txbastream_tbl(priv, i, ra); - if (ptx_tbl) { + if (ptx_tbl) wlan_11n_delete_txbastream_tbl_entry(priv, ptx_tbl); - } } LEAVE(); return; diff --git a/drivers/net/wireless/sd8797/mlan/mlan_11n.h b/drivers/net/wireless/sd8797/mlan/mlan_11n.h index 98de587acdab..207ba670b5bf 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_11n.h +++ b/drivers/net/wireless/sd8797/mlan/mlan_11n.h @@ -5,20 +5,24 @@ * Driver interface functions and type declarations for the 11n module * implemented in mlan_11n.c. * - * Copyright (C) 2008-2011, Marvell International Ltd. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * */ @@ -105,6 +109,8 @@ void wlan_11n_delete_bastream(mlan_private * priv, t_u8 * del_ba); int wlan_get_rxreorder_tbl(mlan_private * priv, rx_reorder_tbl * buf); /** get tx ba stream table */ int wlan_get_txbastream_tbl(mlan_private * priv, tx_ba_stream_tbl * buf); +/** send delba */ +void wlan_11n_delba(mlan_private * priv, int tid); /** Minimum number of AMSDU */ #define MIN_NUM_AMSDU 2 /** AMSDU Aggr control cmd resp */ @@ -120,6 +126,9 @@ mlan_status wlan_cmd_amsdu_aggr_ctrl(mlan_private * priv, HostCmd_DS_COMMAND * cmd, int cmd_action, void *pdata_buf); +/** get channel offset */ +t_u8 wlan_get_second_channel_offset(int chan); + /** clean up txbastream_tbl */ void wlan_11n_cleanup_txbastream_tbl(mlan_private * priv, t_u8 * ra); /** @@ -134,9 +143,8 @@ is_station_11n_enabled(mlan_private * priv, t_u8 * mac) { sta_node *sta_ptr = MNULL; sta_ptr = wlan_get_station_entry(priv, mac); - if (sta_ptr) { + if (sta_ptr) return (sta_ptr->is_11n_enabled) ? MTRUE : MFALSE; - } return MFALSE; } @@ -145,16 +153,15 @@ is_station_11n_enabled(mlan_private * priv, t_u8 * mac) * * @param priv A pointer to mlan_private * @param mac station mac address - * @return max amsdu size statio supported + * @return max amsdu size statio supported */ static INLINE t_u16 get_station_max_amsdu_size(mlan_private * priv, t_u8 * mac) { sta_node *sta_ptr = MNULL; sta_ptr = wlan_get_station_entry(priv, mac); - if (sta_ptr) { + if (sta_ptr) return sta_ptr->max_amsdu; - } return 0; } @@ -164,7 +171,7 @@ get_station_max_amsdu_size(mlan_private * priv, t_u8 * mac) * @param priv A pointer to mlan_private * @param ptr A pointer to RA list table * @param tid TID value for ptr - * @return MTRUE or MFALSE + * @return MTRUE or MFALSE */ static INLINE t_u8 is_station_ampdu_allowed(mlan_private * priv, raListTbl * ptr, int tid) @@ -189,16 +196,15 @@ is_station_ampdu_allowed(mlan_private * priv, raListTbl * ptr, int tid) * @param priv A pointer to mlan_private * @param tid tid index * @param ra station mac address - * @return N/A + * @return N/A */ static INLINE void disable_station_ampdu(mlan_private * priv, t_u8 tid, t_u8 * ra) { sta_node *sta_ptr = MNULL; sta_ptr = wlan_get_station_entry(priv, ra); - if (sta_ptr) { + if (sta_ptr) sta_ptr->ampdu_sta[tid] = BA_STREAM_NOT_ALLOWED; - } return; } @@ -208,7 +214,7 @@ disable_station_ampdu(mlan_private * priv, t_u8 tid, t_u8 * ra) * @param priv A pointer to mlan_private * @param tid TID * - * @return MTRUE or MFALSE + * @return MTRUE or MFALSE */ static INLINE t_u8 wlan_is_cur_bastream_high_prio(mlan_private * priv, int tid) @@ -247,7 +253,7 @@ wlan_is_cur_bastream_high_prio(mlan_private * priv, int tid) * @param ptr A pointer to RA list table * @param tid TID value for ptr * - * @return MTRUE or MFALSE + * @return MTRUE or MFALSE */ static INLINE t_u8 wlan_is_ampdu_allowed(mlan_private * priv, raListTbl * ptr, int tid) @@ -258,6 +264,8 @@ wlan_is_ampdu_allowed(mlan_private * priv, raListTbl * ptr, int tid) #endif /* UAP_SUPPORT */ if (priv->sec_info.wapi_enabled && !priv->sec_info.wapi_key_on) return MFALSE; + if (ptr->is_tdls_link) + return is_station_ampdu_allowed(priv, ptr, tid); return (priv->aggr_prio_tbl[tid].ampdu_ap != BA_STREAM_NOT_ALLOWED) ? MTRUE : MFALSE; @@ -270,7 +278,7 @@ wlan_is_ampdu_allowed(mlan_private * priv, raListTbl * ptr, int tid) * @param ptr A pointer to RA list table * @param tid TID value for ptr * - * @return MTRUE or MFALSE + * @return MTRUE or MFALSE */ static int INLINE wlan_is_amsdu_in_ampdu_allowed(mlan_private * priv, raListTbl * ptr, int tid) @@ -293,7 +301,7 @@ wlan_is_amsdu_in_ampdu_allowed(mlan_private * priv, raListTbl * ptr, int tid) * @param ptr A pointer to RA list table * @param tid TID value for ptr * - * @return MTRUE or MFALSE + * @return MTRUE or MFALSE */ static INLINE t_u8 wlan_is_amsdu_allowed(mlan_private * priv, raListTbl * ptr, int tid) @@ -321,7 +329,7 @@ wlan_is_amsdu_allowed(mlan_private * priv, raListTbl * ptr, int tid) * * @param priv A pointer to mlan_private * - * @return MTRUE or MFALSE + * @return MTRUE or MFALSE */ static INLINE t_u8 wlan_is_bastream_avail(mlan_private * priv) @@ -349,7 +357,7 @@ wlan_is_bastream_avail(mlan_private * priv) * @param ptid A pointer to TID of stream to delete, if return MTRUE * @param ra RA of stream to delete, if return MTRUE * - * @return MTRUE or MFALSE + * @return MTRUE or MFALSE */ static INLINE t_u8 wlan_find_stream_to_delete(mlan_private * priv, @@ -397,7 +405,7 @@ wlan_find_stream_to_delete(mlan_private * priv, * @param ptr A pointer to RA list table * @param tid TID value for ptr * - * @return MTRUE or MFALSE + * @return MTRUE or MFALSE */ static int INLINE wlan_is_bastream_setup(mlan_private * priv, raListTbl * ptr, int tid) @@ -422,7 +430,7 @@ wlan_is_bastream_setup(mlan_private * priv, raListTbl * ptr, int tid) * @param priv A pointer to mlan_private * @param ra Address of the receiver STA * - * @return MTRUE or MFALSE + * @return MTRUE or MFALSE */ static int INLINE wlan_is_11n_enabled(mlan_private * priv, t_u8 * ra) diff --git a/drivers/net/wireless/sd8797/mlan/mlan_11n_aggr.c b/drivers/net/wireless/sd8797/mlan/mlan_11n_aggr.c index ae7f24a781c6..9e993a4afc5b 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_11n_aggr.c +++ b/drivers/net/wireless/sd8797/mlan/mlan_11n_aggr.c @@ -2,20 +2,24 @@ * * @brief This file contains functions for 11n Aggregation. * - * Copyright (C) 2008-2011, Marvell International Ltd. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * */ @@ -146,9 +150,9 @@ wlan_11n_form_amsdu_txpd(mlan_private * priv, mlan_buffer * mbuf) * packet is formed * * @param priv A pointer to mlan_private structure - * @param mbuf TxPD buffer + * @param mbuf TxPD buffer * - * @return N/A + * @return N/A */ static INLINE void wlan_11n_update_pktlen_amsdu_txpd(mlan_private * priv, pmlan_buffer mbuf) @@ -331,9 +335,9 @@ done: * * @param priv A pointer to mlan_private structure * @param pra_list Pointer to the RA List table containing the pointers - * to packets. + * to packets. * @param headroom Any interface specific headroom that may be need. TxPD - * will be formed leaving this headroom. + * will be formed leaving this headroom. * @param ptrindex Pointer index * * @return Final packet size or MLAN_STATUS_FAILURE diff --git a/drivers/net/wireless/sd8797/mlan/mlan_11n_aggr.h b/drivers/net/wireless/sd8797/mlan/mlan_11n_aggr.h index 859ccef9d145..99e28f030d30 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_11n_aggr.h +++ b/drivers/net/wireless/sd8797/mlan/mlan_11n_aggr.h @@ -3,20 +3,24 @@ * @brief This file contains related macros, enum, and struct * of 11n aggregation functionalities * - * Copyright (C) 2008-2011, Marvell International Ltd. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * */ diff --git a/drivers/net/wireless/sd8797/mlan/mlan_11n_rxreorder.c b/drivers/net/wireless/sd8797/mlan/mlan_11n_rxreorder.c index 501ad54f0d81..863de4bec364 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_11n_rxreorder.c +++ b/drivers/net/wireless/sd8797/mlan/mlan_11n_rxreorder.c @@ -3,20 +3,25 @@ * @brief This file contains the handling of RxReordering in wlan * driver. * - * Copyright (C) 2008-2011, Marvell International Ltd. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. */ /******************************************************** @@ -46,12 +51,12 @@ Change log: ********************************************************/ /** * @brief This function will dispatch amsdu packet and - * forward it to kernel/upper layer + * forward it to kernel/upper layer * - * @param priv A pointer to mlan_private + * @param priv A pointer to mlan_private * @param pmbuf A pointer to the received buffer * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_11n_dispatch_amsdu_pkt(mlan_private * priv, pmlan_buffer pmbuf) @@ -73,12 +78,12 @@ wlan_11n_dispatch_amsdu_pkt(mlan_private * priv, pmlan_buffer pmbuf) /** * @brief This function will process the rx packet and - * forward it to kernel/upper layer + * forward it to kernel/upper layer * - * @param priv A pointer to mlan_private + * @param priv A pointer to mlan_private * @param payload A pointer to rx packet payload * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_11n_dispatch_pkt(t_void * priv, t_void * payload) @@ -122,7 +127,7 @@ wlan_11n_dispatch_pkt(t_void * priv, t_void * payload) /** * @brief This function restarts the reordering timeout timer * - * @param pmadapter A pointer to mlan_adapter + * @param pmadapter A pointer to mlan_adapter * @param rx_reor_tbl_ptr A pointer to structure RxReorderTbl * * @return N/A @@ -156,13 +161,13 @@ mlan_11n_rxreorder_timer_restart(pmlan_adapter pmadapter, /** * @brief This function dispatches all the packets in the buffer. - * There could be holes in the buffer. + * There could be holes in the buffer. * - * @param priv A pointer to mlan_private + * @param priv A pointer to mlan_private * @param rx_reor_tbl_ptr A pointer to structure RxReorderTbl * @param start_win Start window * - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ static mlan_status wlan_11n_dispatch_pkt_until_start_win(t_void * priv, @@ -225,7 +230,7 @@ wlan_11n_dispatch_pkt_until_start_win(t_void * priv, * @param pmadapter A pointer to mlan_adapter structure * @param rx_reor_tbl_ptr A pointer to structure RxReorderTbl * - * @return N/A + * @return N/A */ static t_void wlan_11n_display_tbl_ptr(pmlan_adapter pmadapter, @@ -241,13 +246,13 @@ wlan_11n_display_tbl_ptr(pmlan_adapter pmadapter, /** * @brief This function will dispatch all packets sequentially - * from start_win until a hole is found and adjust the - * start_win appropriately + * from start_win until a hole is found and adjust the + * start_win appropriately * - * @param priv A pointer to mlan_private + * @param priv A pointer to mlan_private * @param rx_reor_tbl_ptr A pointer to structure RxReorderTbl * - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ static mlan_status wlan_11n_scan_and_dispatch(t_void * priv, RxReorderTbl * rx_reor_tbl_ptr) @@ -307,12 +312,12 @@ wlan_11n_scan_and_dispatch(t_void * priv, RxReorderTbl * rx_reor_tbl_ptr) /** * @brief This function delete rxreorder table's entry - * and free the memory + * and free the memory * - * @param priv A pointer to mlan_private + * @param priv A pointer to mlan_private * @param rx_reor_tbl_ptr A pointer to structure RxReorderTbl * - * @return N/A + * @return N/A */ static t_void wlan_11n_delete_rxreorder_tbl_entry(mlan_private * priv, @@ -385,7 +390,7 @@ wlan_11n_delete_rxreorder_tbl_entry(mlan_private * priv, * * @param rx_reorder_tbl_ptr A pointer to structure RxReorderTbl * - * @return Last used sequence number + * @return Last used sequence number */ static int wlan_11n_find_last_seqnum(RxReorderTbl * rx_reorder_tbl_ptr) @@ -408,7 +413,7 @@ wlan_11n_find_last_seqnum(RxReorderTbl * rx_reorder_tbl_ptr) * * @param context Reorder context pointer * - * @return N/A + * @return N/A */ static t_void wlan_flush_data(t_void * context) @@ -439,15 +444,15 @@ wlan_flush_data(t_void * context) /** * @brief This function will create a entry in rx reordering table for the - * given ta/tid and will initialize it with seq_num, win_size + * given ta/tid and will initialize it with seq_num, win_size * * @param priv A pointer to mlan_private * @param ta ta to find in reordering table - * @param tid tid to find in reordering table + * @param tid tid to find in reordering table * @param win_size win_size for the give ta/tid pair. * @param seq_num Starting sequence number for current entry. * - * @return N/A + * @return N/A */ static t_void wlan_11n_create_rxreorder_tbl(mlan_private * priv, t_u8 * ta, int tid, @@ -471,7 +476,7 @@ wlan_11n_create_rxreorder_tbl(mlan_private * priv, t_u8 * ta, int tid, rx_reor_tbl_ptr, seq_num); } else { PRINTM(MDAT_D, "%s: seq_num %d, tid %d, ta " MACSTR - ", win_size %d\n", __FUNCTION__, + ", win_size %d\n", __func__, seq_num, tid, MAC2STR(ta), win_size); if (pmadapter->callbacks. moal_malloc(pmadapter->pmoal_handle, sizeof(RxReorderTbl), @@ -495,7 +500,11 @@ wlan_11n_create_rxreorder_tbl(mlan_private * priv, t_u8 * ta, int tid, PRINTM(MINFO, "UAP/ADHOC:last_seq=%d start_win=%d\n", last_seq, new_node->start_win); } else { - last_seq = priv->rx_seq[tid]; + sta_ptr = wlan_get_station_entry(priv, ta); + if (sta_ptr) + last_seq = sta_ptr->rx_seq[tid]; + else + last_seq = priv->rx_seq[tid]; } new_node->last_seq = last_seq; new_node->win_size = win_size; @@ -547,13 +556,13 @@ wlan_11n_create_rxreorder_tbl(mlan_private * priv, t_u8 * ta, int tid, /** * @brief This function will return the pointer to a entry in rx reordering - * table which matches the give TA/TID pair + * table which matches the give TA/TID pair * * @param priv A pointer to mlan_private * @param ta ta to find in reordering table * @param tid tid to find in reordering table * - * @return A pointer to structure RxReorderTbl + * @return A pointer to structure RxReorderTbl */ RxReorderTbl * wlan_11n_get_rxreorder_tbl(mlan_private * priv, int tid, t_u8 * ta) @@ -591,7 +600,7 @@ wlan_11n_get_rxreorder_tbl(mlan_private * priv, int tid, t_u8 * ta) /** * @brief This function prepares command for adding a block ack - * request. + * request. * * @param priv A pointer to mlan_private structure * @param cmd A pointer to HostCmd_DS_COMMAND structure @@ -626,7 +635,7 @@ wlan_cmd_11n_addba_req(mlan_private * priv, /** * @brief This function prepares command for adding a block ack - * response. + * response. * * @param priv A pointer to mlan_private structure * @param cmd A pointer to HostCmd_DS_COMMAND structure @@ -695,6 +704,7 @@ wlan_cmd_11n_addba_rspgen(mlan_private * priv, win_size = (padd_ba_rsp->block_ack_param_set & BLOCKACKPARAM_WINSIZE_MASK) >> BLOCKACKPARAM_WINSIZE_POS; + if (win_size == 0) padd_ba_rsp->status_code = wlan_cpu_to_le16(ADDBA_RSP_STATUS_DECLINED); @@ -714,7 +724,7 @@ wlan_cmd_11n_addba_rspgen(mlan_private * priv, /** * @brief This function prepares command for deleting a block ack - * request. + * request. * * @param priv A pointer to mlan_private structure * @param cmd A pointer to HostCmd_DS_COMMAND structure @@ -745,16 +755,16 @@ wlan_cmd_11n_delba(mlan_private * priv, /** * @brief This function will identify if RxReodering is needed for the packet - * and will do the reordering if required before sending it to kernel + * and will do the reordering if required before sending it to kernel * * @param priv A pointer to mlan_private * @param seq_num Seqence number of the current packet - * @param tid Tid of the current packet - * @param ta Transmiter address of the current packet + * @param tid Tid of the current packet + * @param ta Transmiter address of the current packet * @param pkt_type Packetype for the current packet (to identify if its a BAR) * @param payload Pointer to the payload * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status mlan_11n_rxreorder_pkt(void *priv, t_u16 seq_num, t_u16 tid, @@ -961,15 +971,15 @@ done: /** * @brief This function will delete an entry for a given tid/ta pair. tid/ta - * are taken from delba_event body + * are taken from delba_event body * - * @param priv A pointer to mlan_private - * @param tid tid to send delba - * @param peer_mac MAC address to send delba - * @param type TYPE_DELBA_SENT or TYPE_DELBA_RECEIVE + * @param priv A pointer to mlan_private + * @param tid tid to send delba + * @param peer_mac MAC address to send delba + * @param type TYPE_DELBA_SENT or TYPE_DELBA_RECEIVE * @param initiator MTRUE if we are initiator of ADDBA, MFALSE otherwise * - * @return N/A + * @return N/A */ void mlan_11n_delete_bastream_tbl(mlan_private * priv, int tid, @@ -1014,7 +1024,7 @@ mlan_11n_delete_bastream_tbl(mlan_private * priv, int tid, /** * @brief This function handles the command response of - * a block ack response + * a block ack response * * @param priv A pointer to mlan_private structure * @param resp A pointer to HostCmd_DS_COMMAND @@ -1087,10 +1097,10 @@ wlan_ret_11n_addba_resp(mlan_private * priv, HostCmd_DS_COMMAND * resp) /** * @brief This function handles ba_stream_timeout event * - * @param priv A pointer to mlan_private + * @param priv A pointer to mlan_private * @param event A pointer to structure HostCmd_DS_11N_BATIMEOUT * - * @return N/A + * @return N/A */ void wlan_11n_ba_stream_timeout(mlan_private * priv, @@ -1119,9 +1129,9 @@ wlan_11n_ba_stream_timeout(mlan_private * priv, /** * @brief This function cleans up reorder tbl * - * @param priv A pointer to mlan_private + * @param priv A pointer to mlan_private * - * @return N/A + * @return N/A */ void wlan_11n_cleanup_reorder_tbl(mlan_private * priv) @@ -1147,10 +1157,10 @@ wlan_11n_cleanup_reorder_tbl(mlan_private * priv) /** * @brief This function handle the rxba_sync event * - * @param priv A pointer to mlan_private + * @param priv A pointer to mlan_private * @param event_buf A pointer to event buf * @param len event_buf length - * @return N/A + * @return N/A */ void wlan_11n_rxba_sync_event(mlan_private * priv, t_u8 * event_buf, t_u16 len) @@ -1230,9 +1240,9 @@ done: /** * @brief This function cleans up reorder tbl for specific station * - * @param priv A pointer to mlan_private - * @param ta ta to find in reordering table - * @return N/A + * @param priv A pointer to mlan_private + * @param ta ta to find in reordering table + * @return N/A */ void wlan_cleanup_reorder_tbl(mlan_private * priv, t_u8 * ta) @@ -1256,7 +1266,7 @@ wlan_cleanup_reorder_tbl(mlan_private * priv, t_u8 * ta) * @param priv A pointer to mlan_private * @param flag MTRUE/MFALSE * - * @return N/A + * @return N/A */ void wlan_set_rxreorder_tbl_no_drop_flag(mlan_private * priv, t_u8 flag) @@ -1289,9 +1299,9 @@ wlan_set_rxreorder_tbl_no_drop_flag(mlan_private * priv, t_u8 flag) /** * @brief This function update all the rx_reorder_tbl's force_no_drop flag * - * @param pmadapter A pointer to mlan_adapter - * @param flag MTRUE/MFALSE - * @return N/A + * @param pmadapter A pointer to mlan_adapter + * @param flag MTRUE/MFALSE + * @return N/A */ void wlan_update_rxreorder_tbl(pmlan_adapter pmadapter, t_u8 flag) diff --git a/drivers/net/wireless/sd8797/mlan/mlan_11n_rxreorder.h b/drivers/net/wireless/sd8797/mlan/mlan_11n_rxreorder.h index 9e10d1bdd158..301511aa35ff 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_11n_rxreorder.h +++ b/drivers/net/wireless/sd8797/mlan/mlan_11n_rxreorder.h @@ -3,20 +3,25 @@ * @brief This file contains related macros, enum, and struct * of 11n RxReordering functionalities * - * Copyright (C) 2008-2011, Marvell International Ltd. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. */ /******************************************************** @@ -76,7 +81,7 @@ Change log: mlan_status mlan_11n_rxreorder_pkt(void *priv, t_u16 seqNum, t_u16 tid, t_u8 * ta, t_u8 pkttype, void *payload); -void mlan_11n_delete_bastream_tbl(mlan_private * priv, int Tid, +void mlan_11n_delete_bastream_tbl(mlan_private * priv, int tid, t_u8 * PeerMACAddr, t_u8 type, int initiator); void wlan_11n_ba_stream_timeout(mlan_private * priv, HostCmd_DS_11N_BATIMEOUT * event); diff --git a/drivers/net/wireless/sd8797/mlan/mlan_cfp.c b/drivers/net/wireless/sd8797/mlan/mlan_cfp.c index 9bb0a9cafc14..8320035c3fee 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_cfp.c +++ b/drivers/net/wireless/sd8797/mlan/mlan_cfp.c @@ -4,20 +4,25 @@ * @brief This file contains WLAN client mode channel, frequency and power * related code * - * Copyright (C) 2009-2012, Marvell International Ltd. + * (C) Copyright 2009-2012 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. */ /************************************************************* @@ -771,7 +776,7 @@ wlan_memchr(pmlan_adapter pmadapter, void *s, int c, int n) /** * @brief This function finds the CFP in - * cfp_table_BG/A based on region/code and band parameter. + * cfp_table_BG/A based on region/code and band parameter. * * @param pmadapter A pointer to mlan_adapter structure * @param region The region code diff --git a/drivers/net/wireless/sd8797/mlan/mlan_cmdevt.c b/drivers/net/wireless/sd8797/mlan/mlan_cmdevt.c index ebe5721811ef..db835d71e8ec 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_cmdevt.c +++ b/drivers/net/wireless/sd8797/mlan/mlan_cmdevt.c @@ -3,20 +3,25 @@ * * @brief This file contains the handling of CMD/EVENT in MLAN * - * Copyright (C) 2009-2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. + * (C) Copyright 2009-2011 Marvell International Ltd. All Rights Reserved + * + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. + * */ /************************************************************* @@ -83,7 +88,7 @@ wlan_check_scan_queue(IN pmlan_adapter pmadapter) * * @param pmadapter A pointer to mlan_adapter * - * @return N/A + * @return N/A */ static void wlan_dump_pending_commands(pmlan_adapter pmadapter) @@ -124,7 +129,7 @@ wlan_dump_pending_commands(pmlan_adapter pmadapter) /** * @brief This function dump debug info * - * @return N/A + * @return N/A */ t_void wlan_dump_info(mlan_adapter * pmadapter, t_u8 reason) @@ -167,7 +172,7 @@ wlan_dump_info(mlan_adapter * pmadapter, t_u8 reason) last_cmd_index]; PRINTM_GET_SYS_TIME(MERROR, &sec, &usec); PRINTM(MERROR, - "Current cmd id (%lu.%06lu) = 0x%x, act = 0x%x \n", + "Current cmd id (%lu.%06lu) = 0x%x, act = 0x%x\n", sec, usec, cmd_id, cmd_act); if (pcmd_node->cmdbuf) { t_u8 *pcmd_buf; @@ -175,48 +180,46 @@ wlan_dump_info(mlan_adapter * pmadapter, t_u8 reason) pcmd_node->cmdbuf->pbuf + pcmd_node->cmdbuf->data_offset + INTF_HEADER_LEN; - for (i = 0; i < 16; i++) { + for (i = 0; i < 16; i++) PRINTM(MERROR, "%02x ", *pcmd_buf++); - } PRINTM(MERROR, "\n"); } pmpriv = pcmd_node->priv; - if (pmpriv) { + if (pmpriv) PRINTM(MERROR, "BSS type = %d BSS role= %d\n", pmpriv->bss_type, pmpriv->bss_role); - } } } PRINTM(MERROR, "mlan_processing =%d\n", pmadapter->mlan_processing); PRINTM(MERROR, "mlan_rx_processing =%d\n", pmadapter->mlan_rx_processing); + PRINTM(MERROR, "rx_pkts_queued=%d\n", + util_scalar_read(pmadapter->pmoal_handle, + &pmadapter->rx_pkts_queued, MNULL, MNULL)); + PRINTM(MERROR, "more_task_flag = %d\n", pmadapter->more_task_flag); PRINTM(MERROR, "num_cmd_timeout = %d\n", pmadapter->dbg.num_cmd_timeout); PRINTM(MERROR, "last_cmd_index = %d\n", pmadapter->dbg.last_cmd_index); PRINTM(MERROR, "last_cmd_id = "); - for (i = 0; i < DBG_CMD_NUM; i++) { + for (i = 0; i < DBG_CMD_NUM; i++) PRINTM(MERROR, "0x%x ", pmadapter->dbg.last_cmd_id[i]); - } PRINTM(MERROR, "\n"); PRINTM(MERROR, "last_cmd_act = "); - for (i = 0; i < DBG_CMD_NUM; i++) { + for (i = 0; i < DBG_CMD_NUM; i++) PRINTM(MERROR, "0x%x ", pmadapter->dbg.last_cmd_act[i]); - } PRINTM(MERROR, "\n"); PRINTM(MERROR, "last_cmd_resp_index = %d\n", pmadapter->dbg.last_cmd_resp_index); PRINTM(MERROR, "last_cmd_resp_id = "); - for (i = 0; i < DBG_CMD_NUM; i++) { + for (i = 0; i < DBG_CMD_NUM; i++) PRINTM(MERROR, "0x%x ", pmadapter->dbg.last_cmd_resp_id[i]); - } PRINTM(MERROR, "\n"); PRINTM(MERROR, "last_event_index = %d\n", pmadapter->dbg.last_event_index); PRINTM(MERROR, "last_event = "); - for (i = 0; i < DBG_CMD_NUM; i++) { + for (i = 0; i < DBG_CMD_NUM; i++) PRINTM(MERROR, "0x%x ", pmadapter->dbg.last_event[i]); - } PRINTM(MERROR, "\n"); PRINTM(MERROR, "num_data_h2c_failure = %d\n", @@ -507,12 +510,12 @@ wlan_clean_cmd_node(pmlan_adapter pmadapter, cmd_ctrl_node * pcmd_node) #ifdef STA_SUPPORT /** * @brief This function will return the pointer to the first entry in - * pending cmd which matches the given req_id + * pending cmd which matches the given req_id * * @param pmadapter A pointer to mlan_adapter * @param req_id ioctl req_id. * - * @return A pointer to first entry match pioctl_req + * @return A pointer to first entry match pioctl_req */ static cmd_ctrl_node * wlan_get_pending_ioctl_by_id(pmlan_adapter pmadapter, t_u32 req_id) @@ -550,12 +553,12 @@ wlan_get_pending_ioctl_by_id(pmlan_adapter pmadapter, t_u32 req_id) /** * @brief This function will return the pointer to the first entry in - * pending cmd which matches the given pioctl_req + * pending cmd which matches the given pioctl_req * * @param pmadapter A pointer to mlan_adapter * @param pioctl_req A pointer to mlan_ioctl_req buf * - * @return A pointer to first entry match pioctl_req + * @return A pointer to first entry match pioctl_req */ static cmd_ctrl_node * wlan_get_pending_ioctl_cmd(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) @@ -589,12 +592,12 @@ wlan_get_pending_ioctl_cmd(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) /** * @brief This function will return the pointer to the first entry in - * pending cmd which matches the given bss_index + * pending cmd which matches the given bss_index * * @param pmadapter A pointer to mlan_adapter * @param bss_index bss_index * - * @return A pointer to first entry match pioctl_req + * @return A pointer to first entry match pioctl_req */ static cmd_ctrl_node * wlan_get_bss_pending_ioctl_cmd(pmlan_adapter pmadapter, t_u32 bss_index) @@ -662,10 +665,10 @@ wlan_ret_host_cmd(IN pmlan_private pmpriv, /** * @brief This function sends host command to firmware. * - * @param pmpriv A pointer to mlan_private structure - * @param cmd A pointer to HostCmd_DS_COMMAND structure - * @param pdata_buf A pointer to data buffer - * @return MLAN_STATUS_SUCCESS + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param pdata_buf A pointer to data buffer + * @return MLAN_STATUS_SUCCESS */ static mlan_status wlan_cmd_host_cmd(IN pmlan_private pmpriv, @@ -830,7 +833,7 @@ done: * * @param pmadapter A pointer to mlan_adapter structure * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_dnld_sleep_confirm_cmd(mlan_adapter * pmadapter) @@ -913,11 +916,11 @@ done: /** * @brief Event handler * - * @param priv A pointer to mlan_private structure - * @param event_id Event ID - * @param pmevent Event buffer + * @param priv A pointer to mlan_private structure + * @param event_id Event ID + * @param pmevent Event buffer * - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ mlan_status wlan_recv_event(pmlan_private priv, mlan_event_id event_id, t_void * pmevent) @@ -947,7 +950,7 @@ wlan_recv_event(pmlan_private priv, mlan_event_id event_id, t_void * pmevent) /** * @brief This function allocates the command buffer and links - * it to command free queue. + * it to command free queue. * * @param pmadapter A pointer to mlan_adapter structure * @@ -993,9 +996,8 @@ wlan_alloc_cmd_buffer(IN mlan_adapter * pmadapter) } } - for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) { + for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) wlan_insert_cmd_to_free_q(pmadapter, &pcmd_array[i]); - } ret = MLAN_STATUS_SUCCESS; done: LEAVE(); @@ -1054,9 +1056,9 @@ done: /** * @brief This function handles events generated by firmware * - * @param pmadapter A pointer to mlan_adapter structure + * @param pmadapter A pointer to mlan_adapter structure * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_process_event(pmlan_adapter pmadapter) @@ -1586,9 +1588,8 @@ wlan_process_cmdresp(mlan_adapter * pmadapter) if (!(orig_cmdresp_no & HostCmd_RET_BIT)) { PRINTM(MERROR, "CMD_RESP: Invalid response to command!\n"); - if (pioctl_buf) { + if (pioctl_buf) pioctl_buf->status_code = MLAN_ERROR_FW_CMDRESP; - } wlan_insert_cmd_to_free_q(pmadapter, pmadapter->curr_cmd); wlan_request_cmd_lock(pmadapter); pmadapter->curr_cmd = MNULL; @@ -1693,10 +1694,10 @@ done: /** * @brief This function handles the timeout of command sending. - * It will re-send the same command again. + * It will re-send the same command again. * * @param function_context A pointer to function_context - * @return N/A + * @return N/A */ t_void wlan_cmd_timeout_func(t_void * function_context) @@ -1730,7 +1731,7 @@ wlan_cmd_timeout_func(t_void * function_context) pmadapter->dbg.timeout_cmd_act = pmadapter->dbg.last_cmd_act[pmadapter->dbg.last_cmd_index]; PRINTM_GET_SYS_TIME(MERROR, &sec, &usec); - PRINTM(MERROR, "Timeout cmd id (%lu.%06lu) = 0x%x, act = 0x%x \n", sec, + PRINTM(MERROR, "Timeout cmd id (%lu.%06lu) = 0x%x, act = 0x%x\n", sec, usec, pmadapter->dbg.timeout_cmd_id, pmadapter->dbg.timeout_cmd_act); if (pcmd_node->cmdbuf) { @@ -1738,17 +1739,15 @@ wlan_cmd_timeout_func(t_void * function_context) pcmd_buf = pcmd_node->cmdbuf->pbuf + pcmd_node->cmdbuf->data_offset + INTF_HEADER_LEN; - for (i = 0; i < 16; i++) { + for (i = 0; i < 16; i++) PRINTM(MERROR, "%02x ", *pcmd_buf++); - } PRINTM(MERROR, "\n"); } pmpriv = pcmd_node->priv; - if (pmpriv) { + if (pmpriv) PRINTM(MERROR, "BSS type = %d BSS role= %d\n", pmpriv->bss_type, pmpriv->bss_role); - } wlan_dump_info(pmadapter, REASON_CODE_CMD_TIMEOUT); if (pmadapter->hw_status == WlanHardwareStatusInitializing) @@ -1808,9 +1807,9 @@ wlan_flush_scan_queue(IN pmlan_adapter pmadapter) /** * @brief Cancel pending SCAN ioctl cmd. * - * @param pmadapter A pointer to mlan_adapter + * @param pmadapter A pointer to mlan_adapter * - * @return N/A + * @return N/A */ t_void wlan_cancel_pending_scan_cmd(pmlan_adapter pmadapter) @@ -1875,9 +1874,9 @@ wlan_cancel_pending_scan_cmd(pmlan_adapter pmadapter) /** * @brief Cancel all pending cmd. * - * @param pmadapter A pointer to mlan_adapter + * @param pmadapter A pointer to mlan_adapter * - * @return N/A + * @return N/A */ t_void wlan_cancel_all_pending_cmd(pmlan_adapter pmadapter) @@ -1940,10 +1939,10 @@ wlan_cancel_all_pending_cmd(pmlan_adapter pmadapter) /** * @brief Cancel specific bss's pending ioctl cmd. * - * @param pmadapter A pointer to mlan_adapter - * @param bss_index BSS index + * @param pmadapter A pointer to mlan_adapter + * @param bss_index BSS index * - * @return N/A + * @return N/A */ t_void wlan_cancel_bss_pending_cmd(pmlan_adapter pmadapter, t_u32 bss_index) @@ -2022,10 +2021,10 @@ wlan_cancel_bss_pending_cmd(pmlan_adapter pmadapter, t_u32 bss_index) /** * @brief Cancel pending ioctl cmd. * - * @param pmadapter A pointer to mlan_adapter - * @param pioctl_req A pointer to mlan_ioctl_req buf + * @param pmadapter A pointer to mlan_adapter + * @param pioctl_req A pointer to mlan_ioctl_req buf * - * @return N/A + * @return N/A */ t_void wlan_cancel_pending_ioctl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) @@ -2210,11 +2209,10 @@ wlan_host_sleep_wakeup_event(pmlan_private priv) { ENTER(); - if (priv->adapter->is_hs_configured) { + if (priv->adapter->is_hs_configured) wlan_recv_event(priv, MLAN_EVENT_ID_FW_HS_WAKEUP, MNULL); - } else { + else PRINTM(MWARN, "hs_wakeup: Host Sleep not configured !!!\n"); - } LEAVE(); } @@ -2349,12 +2347,12 @@ wlan_process_sleep_confirm_resp(pmlan_adapter pmadapter, t_u8 * pbuf, /** * @brief This function prepares command of power mode * - * @param pmpriv A pointer to mlan_private structure - * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure * @param cmd_action the action: GET or SET * @param ps_bitmap PS bitmap * @param pdata_buf A pointer to data buffer - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ mlan_status wlan_cmd_enh_power_mode(pmlan_private pmpriv, @@ -3292,11 +3290,10 @@ wlan_ret_get_hw_spec(IN pmlan_private pmpriv, pmadapter->fw_cap_info = wlan_le32_to_cpu(hw_spec->fw_cap_info); #ifdef STA_SUPPORT - if (IS_SUPPORT_MULTI_BANDS(pmadapter)) { + if (IS_SUPPORT_MULTI_BANDS(pmadapter)) pmadapter->fw_bands = (t_u8) GET_FW_DEFAULT_BANDS(pmadapter); - } else { + else pmadapter->fw_bands = BAND_B; - } pmadapter->config_bands = pmadapter->fw_bands; for (i = 0; i < pmadapter->priv_num; i++) { @@ -3364,9 +3361,8 @@ wlan_ret_get_hw_spec(IN pmlan_private pmpriv, wlan_show_devmcssupport(pmadapter, pmadapter->hw_dev_mcs_support); pmadapter->mp_end_port = wlan_le16_to_cpu(hw_spec->mp_end_port); - for (i = 1; i <= (unsigned)(MAX_PORT - pmadapter->mp_end_port); i++) { + for (i = 1; i <= (unsigned)(MAX_PORT - pmadapter->mp_end_port); i++) pmadapter->mp_data_port_mask &= ~(1 << (MAX_PORT - i)); - } pmadapter->max_mgmt_ie_index = wlan_le16_to_cpu(hw_spec->mgmt_buf_count); @@ -3618,8 +3614,8 @@ wlan_cmd_p2p_params_config(IN pmlan_private pmpriv, &cmd->params.p2p_params_config; mlan_ds_wifi_direct_config *cfg = (mlan_ds_wifi_direct_config *) pdata_buf; - MrvlIEtypes_NoA_setting_t *pNoA_tlv = MNULL; - MrvlIEtypes_OPP_PS_setting_t *pOPP_PS_tlv = MNULL; + MrvlIEtypes_NoA_setting_t *pnoa_tlv = MNULL; + MrvlIEtypes_OPP_PS_setting_t *popp_ps_tlv = MNULL; t_u8 *tlv = MNULL; ENTER(); @@ -3630,19 +3626,19 @@ wlan_cmd_p2p_params_config(IN pmlan_private pmpriv, tlv = (t_u8 *) p2p_config + sizeof(HostCmd_DS_WIFI_DIRECT_PARAM_CONFIG); if (cfg->flags & WIFI_DIRECT_NOA) { - pNoA_tlv = (MrvlIEtypes_NoA_setting_t *) tlv; - pNoA_tlv->header.type = + pnoa_tlv = (MrvlIEtypes_NoA_setting_t *) tlv; + pnoa_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_WIFI_DIRECT_NOA); - pNoA_tlv->header.len = + pnoa_tlv->header.len = wlan_cpu_to_le16(sizeof (MrvlIEtypes_NoA_setting_t) - sizeof(MrvlIEtypesHeader_t)); - pNoA_tlv->enable = cfg->noa_enable; - pNoA_tlv->index = wlan_cpu_to_le16(cfg->index); - pNoA_tlv->noa_count = cfg->noa_count; - pNoA_tlv->noa_duration = + pnoa_tlv->enable = cfg->noa_enable; + pnoa_tlv->index = wlan_cpu_to_le16(cfg->index); + pnoa_tlv->noa_count = cfg->noa_count; + pnoa_tlv->noa_duration = wlan_cpu_to_le32(cfg->noa_duration); - pNoA_tlv->noa_interval = + pnoa_tlv->noa_interval = wlan_cpu_to_le32(cfg->noa_interval); cmd->size += sizeof(MrvlIEtypes_NoA_setting_t); tlv += sizeof(MrvlIEtypes_NoA_setting_t); @@ -3652,15 +3648,15 @@ wlan_cmd_p2p_params_config(IN pmlan_private pmpriv, (int)cfg->noa_duration, (int)cfg->noa_interval); } if (cfg->flags & WIFI_DIRECT_OPP_PS) { - pOPP_PS_tlv = (MrvlIEtypes_OPP_PS_setting_t *) tlv; - pOPP_PS_tlv->header.type = + popp_ps_tlv = (MrvlIEtypes_OPP_PS_setting_t *) tlv; + popp_ps_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_WIFI_DIRECT_OPP_PS); - pOPP_PS_tlv->header.len = + popp_ps_tlv->header.len = wlan_cpu_to_le16(sizeof (MrvlIEtypes_OPP_PS_setting_t) - sizeof(MrvlIEtypesHeader_t)); - pOPP_PS_tlv->enable = cfg->opp_ps_enable; - pOPP_PS_tlv->ct_window = cfg->ct_window; + popp_ps_tlv->enable = cfg->opp_ps_enable; + popp_ps_tlv->ct_window = cfg->ct_window; cmd->size += sizeof(MrvlIEtypes_OPP_PS_setting_t); PRINTM(MCMND, "Set OPP_PS: enable=%d ct_win=%d\n", cfg->opp_ps_enable, cfg->ct_window); @@ -3688,8 +3684,8 @@ wlan_ret_p2p_params_config(IN pmlan_private pmpriv, HostCmd_DS_WIFI_DIRECT_PARAM_CONFIG *p2p_config = &resp->params.p2p_params_config; mlan_ds_misc_cfg *cfg = MNULL; - MrvlIEtypes_NoA_setting_t *pNoA_tlv = MNULL; - MrvlIEtypes_OPP_PS_setting_t *pOPP_PS_tlv = MNULL; + MrvlIEtypes_NoA_setting_t *pnoa_tlv = MNULL; + MrvlIEtypes_OPP_PS_setting_t *popp_ps_tlv = MNULL; MrvlIEtypesHeader_t *tlv = MNULL; t_u16 tlv_buf_left = 0; t_u16 tlv_type = 0; @@ -3717,23 +3713,23 @@ wlan_ret_p2p_params_config(IN pmlan_private pmpriv, } switch (tlv_type) { case TLV_TYPE_WIFI_DIRECT_NOA: - pNoA_tlv = + pnoa_tlv = (MrvlIEtypes_NoA_setting_t *) tlv; cfg->param.p2p_config.flags |= WIFI_DIRECT_NOA; cfg->param.p2p_config.noa_enable = - pNoA_tlv->enable; + pnoa_tlv->enable; cfg->param.p2p_config.index = - wlan_le16_to_cpu(pNoA_tlv-> + wlan_le16_to_cpu(pnoa_tlv-> index); cfg->param.p2p_config.noa_count = - pNoA_tlv->noa_count; + pnoa_tlv->noa_count; cfg->param.p2p_config.noa_duration = - wlan_le32_to_cpu(pNoA_tlv-> + wlan_le32_to_cpu(pnoa_tlv-> noa_duration); cfg->param.p2p_config.noa_interval = - wlan_le32_to_cpu(pNoA_tlv-> + wlan_le32_to_cpu(pnoa_tlv-> noa_interval); PRINTM(MCMND, "Get NOA: enable=%d index=%d, count=%d, duration=%d interval=%d\n", @@ -3746,15 +3742,15 @@ wlan_ret_p2p_params_config(IN pmlan_private pmpriv, noa_interval); break; case TLV_TYPE_SSID: - pOPP_PS_tlv = + popp_ps_tlv = (MrvlIEtypes_OPP_PS_setting_t *) tlv; cfg->param.p2p_config.flags |= WIFI_DIRECT_OPP_PS; cfg->param.p2p_config.opp_ps_enable = - pOPP_PS_tlv->enable; + popp_ps_tlv->enable; cfg->param.p2p_config.ct_window = - pOPP_PS_tlv->ct_window; + popp_ps_tlv->ct_window; PRINTM(MCMND, "Get OPP_PS: enable=%d ct_win=%d\n", cfg->param.p2p_config. @@ -3783,7 +3779,7 @@ wlan_ret_p2p_params_config(IN pmlan_private pmpriv, /** * @brief This function prepares command of hs wakeup reason. * - * @param pmpriv A pointer to mlan_private structure + * @param pmpriv A pointer to mlan_private structure * @param cmd A pointer to HostCmd_DS_COMMAND structure * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS @@ -3805,7 +3801,7 @@ wlan_cmd_hs_wakeup_reason(IN pmlan_private pmpriv, /** * @brief This function handles the command response of - * hs wakeup reason + * hs wakeup reason * * @param pmpriv A pointer to mlan_private structure * @param resp A pointer to HostCmd_DS_COMMAND @@ -3850,53 +3846,23 @@ wlan_cmd_802_11_rf_antenna(IN pmlan_private pmpriv, { HostCmd_DS_802_11_RF_ANTENNA *pantenna = &cmd->params.antenna; mlan_ds_ant_cfg *ant_cfg = (mlan_ds_ant_cfg *) pdata_buf; - typedef struct _HostCmd_DS_802_11_RF_ANTENNA_1X1 { - /** Action */ - t_u16 action; - /** Antenna or 0xffff (diversity) */ - t_u16 antenna_mode; - } HostCmd_DS_802_11_RF_ANTENNA_1X1; - HostCmd_DS_802_11_RF_ANTENNA_1X1 *pantenna_1x1 = - (HostCmd_DS_802_11_RF_ANTENNA_1X1 *) & cmd->params.antenna; ENTER(); cmd->command = wlan_cpu_to_le16(HostCmd_CMD_802_11_RF_ANTENNA); - if (!IS_STREAM_2X2(pmpriv->adapter->feature_control)) - cmd->size = - wlan_cpu_to_le16(sizeof - (HostCmd_DS_802_11_RF_ANTENNA_1X1) + - S_DS_GEN); - else - cmd->size = - wlan_cpu_to_le16(sizeof(HostCmd_DS_802_11_RF_ANTENNA) + - S_DS_GEN); + cmd->size = + wlan_cpu_to_le16(sizeof(HostCmd_DS_802_11_RF_ANTENNA) + + S_DS_GEN); if (cmd_action == HostCmd_ACT_GEN_SET) { - if (IS_STREAM_2X2(pmpriv->adapter->feature_control)) { - pantenna->action_tx = - wlan_cpu_to_le16(HostCmd_ACT_SET_TX); - pantenna->tx_antenna_mode = - wlan_cpu_to_le16((t_u16) ant_cfg->tx_antenna); - pantenna->action_rx = - wlan_cpu_to_le16(HostCmd_ACT_SET_RX); - pantenna->rx_antenna_mode = - wlan_cpu_to_le16((t_u16) ant_cfg->rx_antenna); - } else { - pantenna_1x1->action = - wlan_cpu_to_le16(HostCmd_ACT_SET_BOTH); - pantenna_1x1->antenna_mode = - wlan_cpu_to_le16(*(t_u16 *) pdata_buf); - } + pantenna->action_tx = wlan_cpu_to_le16(HostCmd_ACT_SET_TX); + pantenna->tx_antenna_mode = + wlan_cpu_to_le16((t_u16) ant_cfg->tx_antenna); + pantenna->action_rx = wlan_cpu_to_le16(HostCmd_ACT_SET_RX); + pantenna->rx_antenna_mode = + wlan_cpu_to_le16((t_u16) ant_cfg->rx_antenna); } else { - if (IS_STREAM_2X2(pmpriv->adapter->feature_control)) { - pantenna->action_tx = - wlan_cpu_to_le16(HostCmd_ACT_GET_TX); - pantenna->action_rx = - wlan_cpu_to_le16(HostCmd_ACT_GET_RX); - } else { - pantenna_1x1->action = - wlan_cpu_to_le16(HostCmd_ACT_GET_BOTH); - } + pantenna->action_tx = wlan_cpu_to_le16(HostCmd_ACT_GET_TX); + pantenna->action_rx = wlan_cpu_to_le16(HostCmd_ACT_GET_RX); } LEAVE(); return MLAN_STATUS_SUCCESS; @@ -3919,36 +3885,19 @@ wlan_ret_802_11_rf_antenna(IN pmlan_private pmpriv, HostCmd_DS_802_11_RF_ANTENNA *pantenna = &resp->params.antenna; t_u16 tx_ant_mode = wlan_le16_to_cpu(pantenna->tx_antenna_mode); t_u16 rx_ant_mode = wlan_le16_to_cpu(pantenna->rx_antenna_mode); - typedef struct _HostCmd_DS_802_11_RF_ANTENNA_1X1 { - /** Action */ - t_u16 action; - /** Antenna or 0xffff (diversity) */ - t_u16 antenna_mode; - } HostCmd_DS_802_11_RF_ANTENNA_1X1; - HostCmd_DS_802_11_RF_ANTENNA_1X1 *pantenna_1x1 = - (HostCmd_DS_802_11_RF_ANTENNA_1X1 *) & resp->params.antenna; - t_u16 ant_mode = wlan_le16_to_cpu(pantenna_1x1->antenna_mode); mlan_ds_radio_cfg *radio = MNULL; ENTER(); - if (IS_STREAM_2X2(pmpriv->adapter->feature_control)) - PRINTM(MINFO, "RF_ANT_RESP: Tx action = 0x%x, Tx Mode = 0x%04x" - " Rx action = 0x%x, Rx Mode = 0x%04x\n", - wlan_le16_to_cpu(pantenna->action_tx), tx_ant_mode, - wlan_le16_to_cpu(pantenna->action_rx), rx_ant_mode); - else - PRINTM(MINFO, "RF_ANT_RESP: action = 0x%x, Mode = 0x%04x\n", - wlan_le16_to_cpu(pantenna_1x1->action), ant_mode); + PRINTM(MINFO, "RF_ANT_RESP: Tx action = 0x%x, Tx Mode = 0x%04x" + " Rx action = 0x%x, Rx Mode = 0x%04x\n", + wlan_le16_to_cpu(pantenna->action_tx), tx_ant_mode, + wlan_le16_to_cpu(pantenna->action_rx), rx_ant_mode); if (pioctl_buf) { radio = (mlan_ds_radio_cfg *) pioctl_buf->pbuf; - if (IS_STREAM_2X2(pmpriv->adapter->feature_control)) { - radio->param.ant_cfg.tx_antenna = tx_ant_mode; - radio->param.ant_cfg.rx_antenna = rx_ant_mode; - } else { - radio->param.antenna = ant_mode; - } + radio->param.ant_cfg.tx_antenna = tx_ant_mode; + radio->param.ant_cfg.rx_antenna = rx_ant_mode; } LEAVE(); diff --git a/drivers/net/wireless/sd8797/mlan/mlan_decl.h b/drivers/net/wireless/sd8797/mlan/mlan_decl.h index ea941f3dba38..2ee605f39015 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_decl.h +++ b/drivers/net/wireless/sd8797/mlan/mlan_decl.h @@ -2,20 +2,25 @@ * * @brief This file declares the generic data structures and APIs. * - * Copyright (C) 2008-2011, Marvell International Ltd. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. */ /****************************************************** @@ -27,7 +32,7 @@ Change log: #define _MLAN_DECL_H_ /** MLAN release version */ -#define MLAN_RELEASE_VERSION "434" +#define MLAN_RELEASE_VERSION "457" /** Re-define generic data types for MLAN/MOAL */ /** Signed char (1-byte) */ @@ -71,7 +76,7 @@ typedef t_s32 t_sval; /** Structure packing begins */ #define MLAN_PACK_START /** Structure packeing end */ -#define MLAN_PACK_END __attribute__ ((packed)) +#define MLAN_PACK_END __attribute__((packed)) #else /* !__GNUC__ */ #ifdef PRAGMA_PACK /** Structure packing begins */ @@ -117,7 +122,7 @@ typedef t_s32 t_sval; /** Macros for Data Alignment : address */ #define ALIGN_ADDR(p, a) \ - ((((t_ptr)(p)) + (((t_ptr)(a)) - 1)) & ~(((t_ptr)(a)) - 1)) + ((((t_ptr)(p)) + (((t_ptr)(a)) - 1)) & ~(((t_ptr)(a)) - 1)) /** Return the byte offset of a field in the given structure */ #define MLAN_FIELD_OFFSET(type, field) ((t_u32)(t_ptr)&(((type *)0)->field)) @@ -151,13 +156,24 @@ typedef t_s32 t_sval; #define MLAN_STA_AMPDU_DEF_TXWINSIZE 16 /** Default Win size attached during ADDBA response */ #define MLAN_STA_AMPDU_DEF_RXWINSIZE 32 +/** RX winsize for COEX */ +#define MLAN_STA_COEX_AMPDU_DEF_RXWINSIZE 16 #endif /* STA_SUPPORT */ #ifdef UAP_SUPPORT /** Default Win size attached during ADDBA request */ #define MLAN_UAP_AMPDU_DEF_TXWINSIZE 32 /** Default Win size attached during ADDBA response */ #define MLAN_UAP_AMPDU_DEF_RXWINSIZE 16 +/** RX winsize for COEX */ +#define MLAN_UAP_COEX_AMPDU_DEF_RXWINSIZE 16 #endif /* UAP_SUPPORT */ + +#ifdef WIFI_DIRECT_SUPPORT +/** WFD use the same window size for tx/rx */ +#define MLAN_WFD_AMPDU_DEF_TXRXWINSIZE 16 +/** RX winsize for COEX */ +#define MLAN_WFD_COEX_AMPDU_DEF_RXWINSIZE 16 +#endif /** Block ack timeout value */ #define MLAN_DEFAULT_BLOCK_ACK_TIMEOUT 0xffff /** Maximum Tx Win size configured for ADDBA request [10 bits] */ @@ -221,9 +237,9 @@ typedef t_u8 mlan_802_11_mac_addr[MLAN_MAC_ADDR_LENGTH]; #define MLAN_FRAG_MAX_VALUE (2346) /** Minimum tx retry count */ -#define MLAN_TX_RETRY_MIN (0) +#define MLAN_TX_RETRY_MIN (0) /** Maximum tx retry count */ -#define MLAN_TX_RETRY_MAX (14) +#define MLAN_TX_RETRY_MAX (14) /** define SDIO block size for data Tx/Rx */ /* We support up to 480-byte block size due to FW buffer limitation. */ @@ -263,6 +279,8 @@ typedef t_u8 mlan_802_11_mac_addr[MLAN_MAC_ADDR_LENGTH]; /** Buffer flag for bridge packet */ #define MLAN_BUF_FLAG_BRIDGE_BUF MBIT(3) +#define MLAN_BUF_FLAG_TDLS MBIT(8) + #define MLAN_BUF_FLAG_TCP_ACK MBIT(9) #ifdef DEBUG_LEVEL1 @@ -428,6 +446,7 @@ typedef enum _mlan_event_id { MLAN_EVENT_ID_DRV_BGSCAN_RESULT = 0x80000013, MLAN_EVENT_ID_DRV_FLUSH_RX_WORK = 0x80000015, MLAN_EVENT_ID_DRV_DEFER_RX_WORK = 0x80000016, + MLAN_EVENT_ID_DRV_TDLS_TEARDOWN_REQ = 0x80000017, } mlan_event_id; /** Data Structures */ @@ -675,6 +694,230 @@ typedef MLAN_PACK_START struct _tlvbuf_custom_ie { tlvbuf_max_mgmt_ie max_mgmt_ie; } MLAN_PACK_END mlan_ds_misc_custom_ie; +/** Max TDLS config data length */ +#define MAX_TDLS_DATA_LEN 1024 + +/** Action commands for TDLS enable/disable */ +#define WLAN_TDLS_CONFIG 0x00 +/** Action commands for TDLS configuration :Set */ +#define WLAN_TDLS_SET_INFO 0x01 +/** Action commands for TDLS configuration :Discovery Request */ +#define WLAN_TDLS_DISCOVERY_REQ 0x02 +/** Action commands for TDLS configuration :Setup Request */ +#define WLAN_TDLS_SETUP_REQ 0x03 +/** Action commands for TDLS configuration :Tear down Request */ +#define WLAN_TDLS_TEAR_DOWN_REQ 0x04 +/** Action ID for TDLS power mode */ +#define WLAN_TDLS_POWER_MODE 0x05 +/**Action ID for init TDLS Channel Switch*/ +#define WLAN_TDLS_INIT_CHAN_SWITCH 0x06 +/** Action ID for stop TDLS Channel Switch */ +#define WLAN_TDLS_STOP_CHAN_SWITCH 0x07 +/** Action ID for configure CS related parameters */ +#define WLAN_TDLS_CS_PARAMS 0x08 +/** Action ID for Disable CS */ +#define WLAN_TDLS_CS_DISABLE 0x09 +/** Action ID for TDLS link status */ +#define WLAN_TDLS_LINK_STATUS 0x0A +/** Action ID for TDLS CS immediate return */ +#define WLAN_TDLS_DEBUG_CS_RET_IM 0xFFF7 +/** Action ID for TDLS Stop RX */ +#define WLAN_TDLS_DEBUG_STOP_RX 0xFFF8 +/** Action ID for TDLS Allow weak security for links establish */ +#define WLAN_TDLS_DEBUG_ALLOW_WEAK_SECURITY 0xFFF9 +/** Action ID for TDLS Ignore key lifetime expiry */ +#define WLAN_TDLS_DEBUG_IGNORE_KEY_EXPIRY 0xFFFA +/** Action ID for TDLS Higher/Lower mac Test */ +#define WLAN_TDLS_DEBUG_HIGHER_LOWER_MAC 0xFFFB +/** Action ID for TDLS Prohibited Test */ +#define WLAN_TDLS_DEBUG_SETUP_PROHIBITED 0xFFFC +/** Action ID for TDLS Existing link Test */ +#define WLAN_TDLS_DEBUG_SETUP_SAME_LINK 0xFFFD +/** Action ID for TDLS Fail Setup Confirm */ +#define WLAN_TDLS_DEBUG_FAIL_SETUP_CONFIRM 0xFFFE +/** Action commands for TDLS debug: Wrong BSS Request */ +#define WLAN_TDLS_DEBUG_WRONG_BSS 0xFFFF + +/** tdls each link rate information */ +typedef MLAN_PACK_START struct _tdls_link_rate_info { + /** Tx Data Rate */ + t_u8 tx_data_rate; + /** Tx Rate HT info*/ + t_u8 tx_rate_htinfo; +} MLAN_PACK_END tdls_link_rate_info; + +/** tdls each link status */ +typedef MLAN_PACK_START struct _tdls_each_link_status { + /** peer mac Address */ + t_u8 peer_mac[MLAN_MAC_ADDR_LENGTH]; + /** Link Flags */ + t_u8 link_flags; + /** Traffic Status */ + t_u8 traffic_status; + /** Tx Failure Count */ + t_u8 tx_fail_count; + /** Channel Number */ + t_u32 active_channel; + /** Last Data RSSI in dBm */ + t_s16 data_rssi_last; + /** Last Data NF in dBm */ + t_s16 data_nf_last; + /** AVG DATA RSSI in dBm */ + t_s16 data_rssi_avg; + /** AVG DATA NF in dBm */ + t_s16 data_nf_avg; + union { + /** tdls rate info */ + tdls_link_rate_info rate_info; + /** tdls link final rate*/ + t_u16 final_data_rate; + } u; + /** Security Method */ + t_u8 security_method; + /** Key Lifetime in milliseconds */ + t_u32 key_lifetime; + /** Key Length */ + t_u8 key_length; + /** actual key */ + t_u8 key[0]; +} MLAN_PACK_END tdls_each_link_status; + +/** TDLS configuration data */ +typedef MLAN_PACK_START struct _tdls_all_config { + union { + /** TDLS state enable disable */ + MLAN_PACK_START struct _tdls_config { + /** enable or disable */ + t_u16 enable; + } MLAN_PACK_END tdls_config; + + /** TDLS set info */ + MLAN_PACK_START struct _tdls_set_data { + /** (tlv + capInfo) length */ + t_u16 tlv_length; + /** Cap Info */ + t_u16 cap_info; + /** TLV buffer */ + t_u8 tlv_buffer[0]; + } MLAN_PACK_END tdls_set; + + /** TDLS discovery and others having mac argument */ + MLAN_PACK_START struct _tdls_discovery_data { + /** peer mac Address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + } MLAN_PACK_END tdls_discovery, tdls_stop_chan_switch, + tdls_link_status_req; + + /** TDLS discovery Response */ + MLAN_PACK_START struct _tdls_discovery_resp { + /** payload length */ + t_u16 payload_len; + /** peer mac Address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** RSSI */ + t_s8 rssi; + /** Cap Info */ + t_u16 cap_info; + /** TLV buffer */ + t_u8 tlv_buffer[0]; + } MLAN_PACK_END tdls_discovery_resp; + + /** TDLS setup request */ + MLAN_PACK_START struct _tdls_setup_data { + /** peer mac Address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** timeout value in milliseconds */ + t_u32 setup_timeout; + /** key lifetime in milliseconds */ + t_u32 key_lifetime; + } MLAN_PACK_END tdls_setup; + + /** TDLS tear down info */ + MLAN_PACK_START struct _tdls_tear_down_data { + /** peer mac Address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** reason code */ + t_u16 reason_code; + } MLAN_PACK_END tdls_tear_down, tdls_cmd_resp; + + /** TDLS power mode info */ + MLAN_PACK_START struct _tdls_power_mode_data { + /** peer mac Address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** Power Mode */ + t_u16 power_mode; + } MLAN_PACK_END tdls_power_mode; + + /** TDLS channel switch info */ + MLAN_PACK_START struct _tdls_chan_switch { + /** peer mac Address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** Channel Switch primary channel no */ + t_u8 primary_channel; + /** Channel Switch secondary channel offset */ + t_u8 secondary_channel_offset; + /** Channel Switch Band */ + t_u8 band; + /** Channel Switch time in milliseconds */ + t_u16 switch_time; + /** Channel Switch timeout in milliseconds */ + t_u16 switch_timeout; + /** Channel Regulatory class*/ + t_u8 regulatory_class; + /** peridicity flag*/ + t_u8 periodicity; + } MLAN_PACK_END tdls_chan_switch; + + /** TDLS channel switch paramters */ + MLAN_PACK_START struct _tdls_cs_params { + /** unit time, multiples of 10ms */ + t_u8 unit_time; + /** threshold for other link */ + t_u8 threshold_otherlink; + /** threshold for direct link */ + t_u8 threshold_directlink; + } MLAN_PACK_END tdls_cs_params; + + /** tdls disable channel switch */ + MLAN_PACK_START struct _tdls_disable_cs { + /** Data*/ + t_u16 data; + } MLAN_PACK_END tdls_disable_cs; + /** TDLS debug data */ + MLAN_PACK_START struct _tdls_debug_data { + /** debug data */ + t_u16 debug_data; + } MLAN_PACK_END tdls_debug_data; + + /** TDLS link status Response */ + MLAN_PACK_START struct _tdls_link_status_resp { + /** payload length */ + t_u16 payload_len; + /** number of links */ + t_u8 active_links; + /** structure for link status */ + tdls_each_link_status link_stats[1]; + } MLAN_PACK_END tdls_link_status_resp; + + } u; +} MLAN_PACK_END tdls_all_config; + +/** TDLS configuration buffer */ +typedef MLAN_PACK_START struct _buf_tdls_config { + /** TDLS Action */ + t_u16 tdls_action; + /** TDLS data */ + t_u8 tdls_data[MAX_TDLS_DATA_LEN]; +} MLAN_PACK_END mlan_ds_misc_tdls_config; + +/** Event structure for tear down */ +typedef struct _tdls_tear_down_event { + /** Peer mac address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** Reason code */ + t_u16 reason_code; +} tdls_tear_down_event; + #ifdef PRAGMA_PACK #pragma pack(pop) #endif @@ -819,14 +1062,6 @@ typedef struct _mlan_callbacks { /** Parameter disabled, override MLAN default setting */ #define MLAN_INIT_PARA_DISABLED 2 -/** Control bit for stream 2X2 */ -#define FEATURE_CTRL_STREAM_2X2 MBIT(6) -/** Control bit for DFS support */ -#define FEATURE_CTRL_DFS_SUPPORT MBIT(7) - -/** Default feature control */ -#define FEATURE_CTRL_DEFAULT 0xffffffff - /** mlan_device data structure */ typedef struct _mlan_device { /** MOAL Handle */ @@ -865,8 +1100,6 @@ typedef struct _mlan_device { /** 802.11d configuration */ t_u32 cfg_11d; #endif - /** Feature control bitmask */ - t_u32 feature_control; /** enable/disable rx work */ t_u8 rx_work; diff --git a/drivers/net/wireless/sd8797/mlan/mlan_fw.h b/drivers/net/wireless/sd8797/mlan/mlan_fw.h index e2ca9d69137c..8714fc84ab20 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_fw.h +++ b/drivers/net/wireless/sd8797/mlan/mlan_fw.h @@ -4,20 +4,25 @@ * structures and declares global function prototypes used * in MLAN module. * - * Copyright (C) 2008-2011, Marvell International Ltd. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. */ /****************************************************** @@ -31,8 +36,12 @@ Change log: /** Interface header length */ #define INTF_HEADER_LEN 4 +#ifdef PRAGMA_PACK +#pragma pack(push, 1) +#endif + /** Ethernet header */ -typedef struct { +typedef MLAN_PACK_START struct { /** Ethernet header destination address */ t_u8 dest_addr[MLAN_MAC_ADDR_LENGTH]; /** Ethernet header source address */ @@ -40,10 +49,10 @@ typedef struct { /** Ethernet header length */ t_u16 h803_len; -} Eth803Hdr_t; +} MLAN_PACK_END Eth803Hdr_t; /** RFC 1042 header */ -typedef struct { +typedef MLAN_PACK_START struct { /** LLC DSAP */ t_u8 llc_dsap; /** LLC SSAP */ @@ -55,11 +64,7 @@ typedef struct { /** SNAP type */ t_u16 snap_type; -} Rfc1042Hdr_t; - -#ifdef PRAGMA_PACK -#pragma pack(push, 1) -#endif +} MLAN_PACK_END Rfc1042Hdr_t; /** Rx packet header */ typedef MLAN_PACK_START struct { @@ -404,6 +409,10 @@ typedef enum _WLAN_802_11_WEP_STATUS { #define TLV_TYPE_HS_WAKE_HOLDOFF (PROPRIETARY_TLV_BASE_ID + 0xB6) /* 0x01b6 */ +/** TLV type : TDLS IDLE TIMEOUT */ +#define TLV_TYPE_TDLS_IDLE_TIMEOUT (PROPRIETARY_TLV_BASE_ID + 0xC2) /* 0x01C2 + */ + /** TLV type : HT Capabilities */ #define TLV_TYPE_HT_CAP (PROPRIETARY_TLV_BASE_ID + 0x4a) /* 0x014a */ @@ -454,7 +463,7 @@ typedef enum _WLAN_802_11_WEP_STATUS { #define BA_STREAM_NOT_ALLOWED 0xff /** Test if 11n is enabled by checking the HTCap IE */ -#define IS_11N_ENABLED(priv) ((priv->config_bands & BAND_GN ||priv->config_bands & BAND_AN) \ +#define IS_11N_ENABLED(priv) ((priv->config_bands & BAND_GN || priv->config_bands & BAND_AN) \ && priv->curr_bss_params.bss_descriptor.pht_cap) /** Find out if we are the initiator or not */ #define INITIATOR_BIT(DelBAParamSet) (((DelBAParamSet) & \ @@ -685,6 +694,13 @@ typedef enum _WLAN_802_11_WEP_STATUS { /** ExtCap : Reset support QosMap */ #define RESET_EXTCAP_QOS_MAP(ext_cap) (ext_cap.Qos_Map = 0) +/** ExtCap : Support for TDLS wider bandwidth */ +#define ISSUPP_EXTCAP_TDLS_WIDER_BANDWIDTH(ext_cap) (ext_cap.TDLSWildBandwidth) +/** ExtCap : Set support TDLS wider bandwidth */ +#define SET_EXTCAP_TDLS_WIDER_BANDWIDTH(ext_cap) (ext_cap.TDLSWildBandwidth = 1) +/** ExtCap : Reset support TDLS wider bandwidth */ +#define RESET_EXTCAP_TDLS_WIDER_BANDWIDTH(ext_cap) (ext_cap.TDLSWildBandwidth = 0) + /** LLC/SNAP header len */ #define LLC_SNAP_LEN 8 @@ -763,6 +779,8 @@ typedef enum _WLAN_802_11_WEP_STATUS { /** Host Command ID : 802.11 deauthenticate */ #define HostCmd_CMD_802_11_DEAUTHENTICATE 0x0024 +/** Host Command ID: 802.11 disassoicate */ +#define HostCmd_CMD_802_11_DISASSOCIATE 0x0026 /** Host Command ID : MAC control */ #define HostCmd_CMD_MAC_CONTROL 0x0028 /** Host Command ID : 802.11 Ad-Hoc start */ @@ -914,6 +932,11 @@ typedef enum _WLAN_802_11_WEP_STATUS { /** Host Command ID : mgmt IE list */ #define HostCmd_CMD_MGMT_IE_LIST 0x00f2 +/** Host Command ID : TDLS configuration */ +#define HostCmd_CMD_TDLS_CONFIG 0x0100 +/** Host Command ID : TDLS operation */ +#define HostCmd_CMD_TDLS_OPERATION 0x0122 + /** Host Command ID : Extended scan support */ #define HostCmd_CMD_802_11_SCAN_EXT 0x0107 @@ -1198,6 +1221,9 @@ typedef enum _ENH_PS_MODES { #define EVENT_REMAIN_ON_CHANNEL_EXPIRED 0x0000005f #endif +/** TDLS generic event */ +#define EVENT_TDLS_GENERIC_EVENT 0x00000052 + /** Card Event definition: Channel switch pending announcment */ #define EVENT_CHANNEL_SWITCH_ANN 0x00000050 @@ -1250,6 +1276,76 @@ typedef enum _ENH_PS_MODES { #define EVENT_GET_BSS_TYPE(event_cause) \ (((event_cause) >> 24) & 0x00ff) +/** event type for tdls setup failure */ +#define TDLS_EVENT_TYPE_SETUP_FAILURE 1 +/** event type for tdls setup request received */ +#define TDLS_EVENT_TYPE_SETUP_REQ 2 +/** event type for tdls link torn down */ +#define TDLS_EVENT_TYPE_LINK_TORN_DOWN 3 +/** event type for tdls link established */ +#define TDLS_EVENT_TYPE_LINK_ESTABLISHED 4 +/** event type for tdls debug */ +#define TDLS_EVENT_TYPE_DEBUG 5 +/** event type for tdls packet */ +#define TDLS_EVENT_TYPE_PACKET 6 +/** event type for channel switch result */ +#define TDLS_EVENT_TYPE_CHAN_SWITCH_RESULT 7 +/** event type for start channel switch */ +#define TDLS_EVENT_TYPE_START_CHAN_SWITCH 8 +/** event type for stop channel switch */ +#define TDLS_EVENT_TYPE_CHAN_SWITCH_STOPPED 9 + +/** Packet received on direct link */ +#define RXPD_FLAG_PKT_DIRECT_LINK 1 +/** TDLS base channel */ +#define TDLS_BASE_CHANNEL 0 +/** TDLS off channel */ +#define TDLS_OFF_CHANNEL 1 + +/** structure for channel switch result from TDLS FW */ +typedef MLAN_PACK_START struct _chan_switch_result { + /** current channel, 0 - base channel, 1 - off channel*/ + t_u8 current_channel; + /** channel switch status*/ + t_u8 status; + /** channel switch fauilure reason code*/ + t_u8 reason; +} MLAN_PACK_END chan_switch_result; + +typedef MLAN_PACK_START struct _ie_data { + /** IE Length */ + t_u16 ie_length; + /** IE pointer */ + t_u8 ie_ptr[0]; +} MLAN_PACK_END tdls_ie_data; + +/** Event structure for generic events from TDLS FW */ +typedef MLAN_PACK_START struct _Event_tdls_generic { + /** Event Type */ + t_u16 event_type; + /** Peer mac address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + union { + /** channel switch result structure*/ + chan_switch_result switch_result; + /** channel switch stop reason*/ + t_u8 cs_stop_reason; + /** Reason code */ + t_u16 reason_code; + /** IE data */ + tdls_ie_data ie_data; + } u; +} MLAN_PACK_END Event_tdls_generic; + +typedef enum _tdls_error_code_e { + NO_ERROR = 0, + INTERNAL_ERROR, + MAX_TDLS_LINKS_EST, + TDLS_LINK_EXISTS, + TDLS_LINK_NONEXISTENT, + TDLS_PEER_STA_UNREACHABLE = 25, +} tdls_error_code_e; + /** Event_WEP_ICV_ERR structure */ typedef MLAN_PACK_START struct _Event_WEP_ICV_ERR { /** Reason code */ @@ -1301,6 +1397,15 @@ typedef MLAN_PACK_START struct _MrvlIEtypes_Data_t { t_u8 data[1]; } MLAN_PACK_END MrvlIEtypes_Data_t; +/*TDLS TIMEOUT VALUE (seconds)*/ +#define TDLS_IDLE_TIMEOUT 60 +/** MrvlIEtypes_Data_t */ +typedef MLAN_PACK_START struct _MrvlIEtypes_TDLS_Idle_Timeout_t { + /** Header */ + MrvlIEtypesHeader_t header; + /** value */ + t_u16 value; +} MLAN_PACK_END MrvlIEtypes_TDLS_Idle_Timeout_t; #if defined(STA_SUPPORT) /** Pairwise Cipher Suite length */ #define PAIRWISE_CIPHER_SUITE_LEN 4 @@ -1316,6 +1421,9 @@ typedef MLAN_PACK_START struct _MrvlIEtypes_Data_t { /** Bit mask for TxPD status field for last packet */ #define MRVDRV_TxPD_POWER_MGMT_LAST_PACKET 0x08 +/** Bit mask for TxPD status field for TDLS packet */ +#define MRVDRV_TxPD_FLAGS_TDLS_PACKET MBIT(4) + /** Packet type: 802.11 */ #define PKT_TYPE_802DOT11 0x05 #define PKT_TYPE_MGMT_FRAME 0xE5 @@ -1378,7 +1486,11 @@ typedef MLAN_PACK_START struct _RxPD { * [Bit 2] HT Guard Interval: LGI = 0, SGI = 1 */ t_u8 ht_info; /** Reserved */ - t_u8 reserved; + t_u8 reserved[3]; + /** TDLS flags, bit 0: 0=InfraLink, 1=DirectLink */ + t_u8 flags; + /** Reserved */ + t_u8 reserved_1; } MLAN_PACK_END RxPD, *PRxPD; #ifdef UAP_SUPPORT @@ -2106,7 +2218,9 @@ typedef MLAN_PACK_START struct __ps_param { t_u16 local_listen_interval; /** Adhoc awake period */ t_u16 adhoc_wake_period; - /** mode - (0x01 - firmware to automatically choose PS_POLL or NULL mode, 0x02 - PS_POLL, 0x03 - NULL mode ) */ + /** mode - (0x01 - firmware to automatically choose PS_POLL or NULL mode, + * 0x02 - PS_POLL, 0x03 - NULL mode ) + */ t_u16 mode; /** Delay to PS in milliseconds */ t_u16 delay_to_ps; @@ -2534,11 +2648,15 @@ typedef MLAN_PACK_START struct _hs_config_param { t_u32 conditions; /** GPIO pin or 0xff for interface */ t_u8 gpio; - /** gap in milliseconds or or 0xff for special setting when GPIO is used to wakeup host */ + /** gap in milliseconds or or 0xff for special setting when + * GPIO is used to wakeup host + */ t_u8 gap; } MLAN_PACK_END hs_config_param; -/** HS Action 0x0001 - Configure enhanced host sleep mode, 0x0002 - Activate enhanced host sleep mode */ +/** HS Action 0x0001 - Configure enhanced host sleep mode, + * 0x0002 - Activate enhanced host sleep mode + */ typedef enum _Host_Sleep_Action { HS_CONFIGURE = 0x0001, HS_ACTIVATE = 0x0002, @@ -2552,7 +2670,9 @@ typedef MLAN_PACK_START struct __hs_activate_param { /** HostCmd_DS_802_11_HS_CFG_ENH */ typedef MLAN_PACK_START struct _HostCmd_DS_802_11_HS_CFG_ENH { - /** Action 0x0001 - Configure enhanced host sleep mode, 0x0002 - Activate enhanced host sleep mode */ + /** Action 0x0001 - Configure enhanced host sleep mode, + * 0x0002 - Activate enhanced host sleep mode + */ t_u16 action; union { @@ -3626,6 +3746,28 @@ typedef MLAN_PACK_START struct _HostCmd_DS_MGMT_IE_LIST { mlan_ds_misc_custom_ie ds_mgmt_ie; } MLAN_PACK_END HostCmd_DS_MGMT_IE_LIST_CFG; +/** HostCmd_DS_TDLS_CONFIG */ +typedef MLAN_PACK_START struct _HostCmd_DS_TDLS_CONFIG { + /** Set TDLS configuration */ + mlan_ds_misc_tdls_config tdls_info; +} MLAN_PACK_END HostCmd_DS_TDLS_CONFIG; + +/**Action ID for TDLS delete link*/ +#define TDLS_DELETE 0x00 +/**Action ID for TDLS create link*/ +#define TDLS_CREATE 0x01 +/**Action ID for TDLS config link*/ +#define TDLS_CONFIG 0x02 +/** HostCmd_DS_TDLS_OPER */ +typedef MLAN_PACK_START struct _HostCmd_DS_TDLS_OPER { + /** Action */ + t_u16 tdls_action; + /**reason*/ + t_u16 reason; + /** peer mac */ + t_u8 peer_mac[MLAN_MAC_ADDR_LENGTH]; +} MLAN_PACK_END HostCmd_DS_TDLS_OPER; + /** HostCmd_CMD_MAC_REG_ACCESS */ typedef MLAN_PACK_START struct _HostCmd_DS_MAC_REG_ACCESS { /** Action */ @@ -3773,112 +3915,112 @@ typedef MLAN_PACK_START struct _MrvlIEtypes_MacAddr_t { #ifdef UAP_SUPPORT /** TLV type : AP Channel band Config */ -#define TLV_TYPE_UAP_CHAN_BAND_CONFIG (PROPRIETARY_TLV_BASE_ID + 0x2a) /* 0x012a - */ +#define TLV_TYPE_UAP_CHAN_BAND_CONFIG\ + (PROPRIETARY_TLV_BASE_ID + 0x2a) /* 0x012a */ /** TLV type : AP Mac address */ -#define TLV_TYPE_UAP_MAC_ADDRESS (PROPRIETARY_TLV_BASE_ID + 0x2b) /* 0x012b - */ +#define TLV_TYPE_UAP_MAC_ADDRESS\ + (PROPRIETARY_TLV_BASE_ID + 0x2b) /* 0x012b */ /** TLV type : AP Beacon period */ -#define TLV_TYPE_UAP_BEACON_PERIOD (PROPRIETARY_TLV_BASE_ID + 0x2c) /* 0x012c - */ +#define TLV_TYPE_UAP_BEACON_PERIOD\ + (PROPRIETARY_TLV_BASE_ID + 0x2c) /* 0x012c */ /** TLV type : AP DTIM period */ -#define TLV_TYPE_UAP_DTIM_PERIOD (PROPRIETARY_TLV_BASE_ID + 0x2d) /* 0x012d - */ +#define TLV_TYPE_UAP_DTIM_PERIOD\ + (PROPRIETARY_TLV_BASE_ID + 0x2d) /* 0x012d */ /** TLV type : AP Tx power */ -#define TLV_TYPE_UAP_TX_POWER (PROPRIETARY_TLV_BASE_ID + 0x2f) /* 0x012f - */ +#define TLV_TYPE_UAP_TX_POWER\ + (PROPRIETARY_TLV_BASE_ID + 0x2f) /* 0x012f */ /** TLV type : AP SSID broadcast control */ -#define TLV_TYPE_UAP_BCAST_SSID_CTL (PROPRIETARY_TLV_BASE_ID + 0x30) /* 0x0130 - */ +#define TLV_TYPE_UAP_BCAST_SSID_CTL\ + (PROPRIETARY_TLV_BASE_ID + 0x30) /* 0x0130 */ /** TLV type : AP Preamble control */ -#define TLV_TYPE_UAP_PREAMBLE_CTL (PROPRIETARY_TLV_BASE_ID + 0x31) /* 0x0131 - */ +#define TLV_TYPE_UAP_PREAMBLE_CTL\ + (PROPRIETARY_TLV_BASE_ID + 0x31) /* 0x0131 */ /** TLV type : AP Antenna control */ -#define TLV_TYPE_UAP_ANTENNA_CTL (PROPRIETARY_TLV_BASE_ID + 0x32) /* 0x0132 - */ +#define TLV_TYPE_UAP_ANTENNA_CTL\ + (PROPRIETARY_TLV_BASE_ID + 0x32) /* 0x0132 */ /** TLV type : AP RTS threshold */ -#define TLV_TYPE_UAP_RTS_THRESHOLD (PROPRIETARY_TLV_BASE_ID + 0x33) /* 0x0133 - */ +#define TLV_TYPE_UAP_RTS_THRESHOLD\ + (PROPRIETARY_TLV_BASE_ID + 0x33) /* 0x0133 */ /** TLV type : AP Tx data rate */ -#define TLV_TYPE_UAP_TX_DATA_RATE (PROPRIETARY_TLV_BASE_ID + 0x35) /* 0x0135 - */ +#define TLV_TYPE_UAP_TX_DATA_RATE\ + (PROPRIETARY_TLV_BASE_ID + 0x35) /* 0x0135 */ /** TLV type: AP Packet forwarding control */ -#define TLV_TYPE_UAP_PKT_FWD_CTL (PROPRIETARY_TLV_BASE_ID + 0x36) /* 0x0136 - */ +#define TLV_TYPE_UAP_PKT_FWD_CTL\ + (PROPRIETARY_TLV_BASE_ID + 0x36) /* 0x0136 */ /** TLV type: STA information */ -#define TLV_TYPE_UAP_STA_INFO (PROPRIETARY_TLV_BASE_ID + 0x37) /* 0x0137 - */ +#define TLV_TYPE_UAP_STA_INFO\ + (PROPRIETARY_TLV_BASE_ID + 0x37) /* 0x0137 */ /** TLV type: AP STA MAC address filter */ -#define TLV_TYPE_UAP_STA_MAC_ADDR_FILTER (PROPRIETARY_TLV_BASE_ID + 0x38) /* 0x0138 - */ +#define TLV_TYPE_UAP_STA_MAC_ADDR_FILTER\ + (PROPRIETARY_TLV_BASE_ID + 0x38) /* 0x0138 */ /** TLV type: AP STA ageout timer */ -#define TLV_TYPE_UAP_STA_AGEOUT_TIMER (PROPRIETARY_TLV_BASE_ID + 0x39) /* 0x0139 - */ +#define TLV_TYPE_UAP_STA_AGEOUT_TIMER\ + (PROPRIETARY_TLV_BASE_ID + 0x39) /* 0x0139 */ /** TLV type: AP WEP keys */ -#define TLV_TYPE_UAP_WEP_KEY (PROPRIETARY_TLV_BASE_ID + 0x3b) /* 0x013b - */ +#define TLV_TYPE_UAP_WEP_KEY\ + (PROPRIETARY_TLV_BASE_ID + 0x3b) /* 0x013b */ /** TLV type: AP WPA passphrase */ -#define TLV_TYPE_UAP_WPA_PASSPHRASE (PROPRIETARY_TLV_BASE_ID + 0x3c) /* 0x013c - */ +#define TLV_TYPE_UAP_WPA_PASSPHRASE\ + (PROPRIETARY_TLV_BASE_ID + 0x3c) /* 0x013c */ /** TLV type: AP protocol */ -#define TLV_TYPE_UAP_ENCRYPT_PROTOCOL (PROPRIETARY_TLV_BASE_ID + 0x40) /* 0x0140 - */ +#define TLV_TYPE_UAP_ENCRYPT_PROTOCOL\ + (PROPRIETARY_TLV_BASE_ID + 0x40) /* 0x0140 */ /** TLV type: AP AKMP */ -#define TLV_TYPE_UAP_AKMP (PROPRIETARY_TLV_BASE_ID + 0x41) /* 0x0141 - */ +#define TLV_TYPE_UAP_AKMP\ + (PROPRIETARY_TLV_BASE_ID + 0x41) /* 0x0141 */ /** TLV type: AP Fragment threshold */ -#define TLV_TYPE_UAP_FRAG_THRESHOLD (PROPRIETARY_TLV_BASE_ID + 0x46) /* 0x0146 - */ +#define TLV_TYPE_UAP_FRAG_THRESHOLD\ + (PROPRIETARY_TLV_BASE_ID + 0x46) /* 0x0146 */ /** TLV type: AP Group rekey timer */ -#define TLV_TYPE_UAP_GRP_REKEY_TIME (PROPRIETARY_TLV_BASE_ID + 0x47) /* 0x0147 - */ +#define TLV_TYPE_UAP_GRP_REKEY_TIME\ + (PROPRIETARY_TLV_BASE_ID + 0x47) /* 0x0147 */ /**TLV type : AP Max Station number */ -#define TLV_TYPE_UAP_MAX_STA_CNT (PROPRIETARY_TLV_BASE_ID + 0x55) /* 0x0155 - */ +#define TLV_TYPE_UAP_MAX_STA_CNT\ + (PROPRIETARY_TLV_BASE_ID + 0x55) /* 0x0155 */ /**TLV type : AP Retry limit */ -#define TLV_TYPE_UAP_RETRY_LIMIT (PROPRIETARY_TLV_BASE_ID + 0x5d) /* 0x015d - */ +#define TLV_TYPE_UAP_RETRY_LIMIT\ + (PROPRIETARY_TLV_BASE_ID + 0x5d) /* 0x015d */ /** TLV type : AP MCBC data rate */ -#define TLV_TYPE_UAP_MCBC_DATA_RATE (PROPRIETARY_TLV_BASE_ID + 0x62) /* 0x0162 - */ +#define TLV_TYPE_UAP_MCBC_DATA_RATE\ + (PROPRIETARY_TLV_BASE_ID + 0x62) /* 0x0162 */ /**TLV type: AP RSN replay protection */ -#define TLV_TYPE_UAP_RSN_REPLAY_PROTECT (PROPRIETARY_TLV_BASE_ID + 0x64) /* 0x0164 - */ +#define TLV_TYPE_UAP_RSN_REPLAY_PROTECT\ + (PROPRIETARY_TLV_BASE_ID + 0x64) /* 0x0164 */ /** TLV ID : Management Frame */ -#define TLV_TYPE_UAP_MGMT_FRAME (PROPRIETARY_TLV_BASE_ID + 0x68) /* 0x0168 - */ +#define TLV_TYPE_UAP_MGMT_FRAME\ + (PROPRIETARY_TLV_BASE_ID + 0x68) /* 0x0168 */ #ifdef UAP_SUPPORT /**TLV type: AP mgmt IE passthru mask */ -#define TLV_TYPE_UAP_MGMT_IE_PASSTHRU_MASK (PROPRIETARY_TLV_BASE_ID + 0x70) /* 0x0170 - */ +#define TLV_TYPE_UAP_MGMT_IE_PASSTHRU_MASK\ + (PROPRIETARY_TLV_BASE_ID + 0x70) /* 0x0170 */ #endif /** TLV : 20/40 coex config */ -#define TLV_TYPE_2040_BSS_COEX_CONTROL (PROPRIETARY_TLV_BASE_ID + 0x98) /* 0x0198 - */ +#define TLV_TYPE_2040_BSS_COEX_CONTROL\ + (PROPRIETARY_TLV_BASE_ID + 0x98) /* 0x0198 */ /**TLV type: AP pairwise handshake timeout */ -#define TLV_TYPE_UAP_EAPOL_PWK_HSK_TIMEOUT (PROPRIETARY_TLV_BASE_ID + 0x75) /* 0x0175 - */ +#define TLV_TYPE_UAP_EAPOL_PWK_HSK_TIMEOUT\ + (PROPRIETARY_TLV_BASE_ID + 0x75) /* 0x0175 */ /**TLV type: AP pairwise handshake retries */ -#define TLV_TYPE_UAP_EAPOL_PWK_HSK_RETRIES (PROPRIETARY_TLV_BASE_ID + 0x76) /* 0x0176 - */ +#define TLV_TYPE_UAP_EAPOL_PWK_HSK_RETRIES\ + (PROPRIETARY_TLV_BASE_ID + 0x76) /* 0x0176 */ /**TLV type: AP groupwise handshake timeout */ -#define TLV_TYPE_UAP_EAPOL_GWK_HSK_TIMEOUT (PROPRIETARY_TLV_BASE_ID + 0x77) /* 0x0177 - */ +#define TLV_TYPE_UAP_EAPOL_GWK_HSK_TIMEOUT\ + (PROPRIETARY_TLV_BASE_ID + 0x77) /* 0x0177 */ /**TLV type: AP groupwise handshake retries */ -#define TLV_TYPE_UAP_EAPOL_GWK_HSK_RETRIES (PROPRIETARY_TLV_BASE_ID + 0x78) /* 0x0178 - */ +#define TLV_TYPE_UAP_EAPOL_GWK_HSK_RETRIES\ + (PROPRIETARY_TLV_BASE_ID + 0x78) /* 0x0178 */ /** TLV type: AP PS STA ageout timer */ -#define TLV_TYPE_UAP_PS_STA_AGEOUT_TIMER (PROPRIETARY_TLV_BASE_ID + 0x7b) /* 0x017b - */ +#define TLV_TYPE_UAP_PS_STA_AGEOUT_TIMER\ + (PROPRIETARY_TLV_BASE_ID + 0x7b) /* 0x017b */ /** TLV type : Pairwise Cipher */ -#define TLV_TYPE_PWK_CIPHER (PROPRIETARY_TLV_BASE_ID + 0x91) /* 0x0191 - */ +#define TLV_TYPE_PWK_CIPHER\ + (PROPRIETARY_TLV_BASE_ID + 0x91) /* 0x0191 */ /** TLV type : Group Cipher */ -#define TLV_TYPE_GWK_CIPHER (PROPRIETARY_TLV_BASE_ID + 0x92) /* 0x0192 - */ +#define TLV_TYPE_GWK_CIPHER\ + (PROPRIETARY_TLV_BASE_ID + 0x92) /* 0x0192 */ /** TLV type : BSS Status */ -#define TLV_TYPE_BSS_STATUS (PROPRIETARY_TLV_BASE_ID + 0x93) /* 0x0193 - */ +#define TLV_TYPE_BSS_STATUS\ + (PROPRIETARY_TLV_BASE_ID + 0x93) /* 0x0193 */ #ifdef WIFI_DIRECT_SUPPORT /** TLV type : AP PSK */ @@ -4239,11 +4381,11 @@ typedef MLAN_PACK_START struct _HostCmd_DS_STA_DEAUTH { /** Host Command id: POWER_MGMT */ #define HOST_CMD_POWER_MGMT_EXT 0x00ef /** TLV type: AP Sleep param */ -#define TLV_TYPE_AP_SLEEP_PARAM (PROPRIETARY_TLV_BASE_ID + 0x6a) /* 0x016a - */ +#define TLV_TYPE_AP_SLEEP_PARAM\ + (PROPRIETARY_TLV_BASE_ID + 0x6a) /* 0x016a */ /** TLV type: AP Inactivity Sleep param */ -#define TLV_TYPE_AP_INACT_SLEEP_PARAM (PROPRIETARY_TLV_BASE_ID + 0x6b) /* 0x016b - */ +#define TLV_TYPE_AP_INACT_SLEEP_PARAM\ + (PROPRIETARY_TLV_BASE_ID + 0x6b) /* 0x016b */ /** MrvlIEtypes_sleep_param_t */ typedef MLAN_PACK_START struct _MrvlIEtypes_sleep_param_t { @@ -4326,7 +4468,9 @@ typedef MLAN_PACK_START struct { /**< Marvell TLV header: ID/Len */ t_u8 chan; /**< Channel local constraint applies to */ - /** Power constraint included in beacons and used by fw to offset 11d info */ + /** Power constraint included in beacons + * and used by fw to offset 11d info + */ t_u8 constraint; } MLAN_PACK_END MrvlIEtypes_LocalPowerConstraint_t; @@ -4340,29 +4484,39 @@ typedef MLAN_PACK_START struct { /** TPC Info structure sent in CMD_802_11_TPC_INFO command to firmware */ typedef MLAN_PACK_START struct { MrvlIEtypes_LocalPowerConstraint_t local_constraint; - /**< Local constraint */ - MrvlIEtypes_PowerCapability_t power_cap; /**< Power Capability */ + /**< Local + constraint */ + MrvlIEtypes_PowerCapability_t power_cap; /**< Power + Capability */ } MLAN_PACK_END HostCmd_DS_802_11_TPC_INFO; -/** TPC Request structure sent in CMD_802_11_TPC_ADAPT_REQ command to firmware */ +/** TPC Request structure sent in CMD_802_11_TPC_ADAPT_REQ + * command to firmware + */ typedef MLAN_PACK_START struct { - t_u8 dest_mac[MLAN_MAC_ADDR_LENGTH]; /**< Destination STA address */ - t_u16 timeout; /**< Response timeout in ms */ - t_u8 rate_index; /**< IEEE Rate index to send request */ + t_u8 dest_mac[MLAN_MAC_ADDR_LENGTH]; /**< Destination STA address */ + t_u16 timeout; /**< Response timeout in ms */ + t_u8 rate_index; /**< IEEE Rate index to send request */ } MLAN_PACK_END HostCmd_TpcRequest; -/** TPC Response structure received from the CMD_802_11_TPC_ADAPT_REQ command */ +/** TPC Response structure received from the + * CMD_802_11_TPC_ADAPT_REQ command + */ typedef MLAN_PACK_START struct { - t_u8 tpc_ret_code; /**< Firmware command result status code */ - t_s8 tx_power; /**< Reported TX Power from the TPC Report element */ - t_s8 link_margin; /**< Reported link margin from the TPC Report element */ - t_s8 rssi; /**< RSSI of the received TPC Report frame */ + t_u8 tpc_ret_code; + /**< Firmware command result status code */ + t_s8 tx_power; /**< Reported TX Power from the TPC Report element */ + t_s8 link_margin; + /**< Reported link margin from the TPC Report element */ + t_s8 rssi; /**< RSSI of the received TPC Report frame */ } MLAN_PACK_END HostCmd_TpcResponse; -/** CMD_802_11_TPC_ADAPT_REQ substruct. Union of the TPC request and response */ +/** CMD_802_11_TPC_ADAPT_REQ substruct. + * Union of the TPC request and response + */ typedef MLAN_PACK_START union { HostCmd_TpcRequest req; /**< Request struct sent to firmware */ @@ -4387,7 +4541,7 @@ typedef MLAN_PACK_START struct { typedef MLAN_PACK_START enum _MeasType_t { WLAN_MEAS_BASIC = 0, /**< 11h: Basic */ WLAN_MEAS_NUM_TYPES, /**< Number of enumerated measurements */ - WLAN_MEAS_11H_MAX_TYPE = WLAN_MEAS_BASIC, /**< Max 11h measurement */ + WLAN_MEAS_11H_MAX_TYPE = WLAN_MEAS_BASIC, /**< Max 11h measurement */ } MLAN_PACK_END MeasType_t; @@ -4396,19 +4550,31 @@ typedef MLAN_PACK_START enum _MeasType_t { */ typedef MLAN_PACK_START struct { #ifdef BIG_ENDIAN_SUPPORT - t_u8 rsvd5_7:3; /**< Reserved */ - t_u8 duration_mandatory:1;/**< 11k: duration spec. for meas. is mandatory */ - t_u8 report:1; /**< 11h: en/disable report rcpt. of spec. type */ - t_u8 request:1; /**< 11h: en/disable requests of specified type */ - t_u8 enable:1; /**< 11h: enable report/request bits */ - t_u8 parallel:1; /**< 11k: series or parallel with previous meas */ + /**< Reserved */ + t_u8 rsvd5_7:3; + /**< 11k: duration spec. for meas. is mandatory */ + t_u8 duration_mandatory:1; + /**< 11h: en/disable report rcpt. of spec. type */ + t_u8 report:1; + /**< 11h: en/disable requests of specified type */ + t_u8 request:1; + /**< 11h: enable report/request bits */ + t_u8 enable:1; + /**< 11k: series or parallel with previous meas */ + t_u8 parallel:1; #else - t_u8 parallel:1; /**< 11k: series or parallel with previous meas */ - t_u8 enable:1; /**< 11h: enable report/request bits */ - t_u8 request:1; /**< 11h: en/disable requests of specified type */ - t_u8 report:1; /**< 11h: en/disable report rcpt. of spec. type */ - t_u8 duration_mandatory:1;/**< 11k: duration spec. for meas. is mandatory */ - t_u8 rsvd5_7:3; /**< Reserved */ + /**< 11k: series or parallel with previous meas */ + t_u8 parallel:1; + /**< 11h: enable report/request bits */ + t_u8 enable:1; + /**< 11h: en/disable requests of specified type */ + t_u8 request:1; + /**< 11h: en/disable report rcpt. of spec. type */ + t_u8 report:1; + /**< 11k: duration spec. for meas. is mandatory */ + t_u8 duration_mandatory:1; + /**< Reserved */ + t_u8 rsvd5_7:3; #endif /* BIG_ENDIAN_SUPPORT */ } MLAN_PACK_END MeasReqMode_t; @@ -4484,10 +4650,10 @@ typedef MLAN_PACK_START struct { * @brief CCA measurement report (7.3.2.22.2) */ typedef MLAN_PACK_START struct { - t_u8 channel; /**< Channel to measured */ - t_u64 start_time; /**< Start time (TSF) of measurement */ - t_u16 duration; /**< Duration of measurement in TUs */ - t_u8 busy_fraction; /**< Fractional duration CCA indicated chan busy */ + t_u8 channel; /**< Channel to measured */ + t_u64 start_time; /**< Start time (TSF) of measurement */ + t_u16 duration; /**< Duration of measurement in TUs */ + t_u8 busy_fraction; /**< Fractional duration CCA indicated chan busy */ } MLAN_PACK_END MeasRptCCA_t; @@ -4731,6 +4897,10 @@ typedef struct MLAN_PACK_START _HostCmd_DS_COMMAND { HostCmd_DS_802_11_IBSS_STATUS ibss_coalescing; /** Mgmt IE list configuration */ HostCmd_DS_MGMT_IE_LIST_CFG mgmt_ie_list; + /** TDLS configuration command */ + HostCmd_DS_TDLS_CONFIG tdls_config_data; + /** TDLS operation command */ + HostCmd_DS_TDLS_OPER tdls_oper_data; /** System clock configuration */ HostCmd_DS_ECL_SYSTEM_CLOCK_CONFIG sys_clock_cfg; /** MAC register access */ @@ -4792,7 +4962,8 @@ typedef MLAN_PACK_START struct _OPT_Confirm_Sleep { typedef struct MLAN_PACK_START _opt_sleep_confirm_buffer { /** Header for interface */ t_u8 hdr[4]; - /** New power save command used to send sleep confirmation to the firmware */ + /** New power save command used to send + * sleep confirmation to the firmware */ OPT_Confirm_Sleep ps_cfm_sleep; } MLAN_PACK_END opt_sleep_confirm_buffer; diff --git a/drivers/net/wireless/sd8797/mlan/mlan_ieee.h b/drivers/net/wireless/sd8797/mlan/mlan_ieee.h index 61cdd5c70607..03c59ecf0f9b 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_ieee.h +++ b/drivers/net/wireless/sd8797/mlan/mlan_ieee.h @@ -3,20 +3,25 @@ * @brief This file contains IEEE information element related * definitions used in MLAN and MOAL module. * - * Copyright (C) 2008-2011, Marvell International Ltd. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. */ /****************************************************** @@ -28,7 +33,7 @@ Change log: #define _MLAN_IEEE_H_ /** FIX IES size in beacon buffer */ -#define WLAN_802_11_FIXED_IE_SIZE 12 +#define WLAN_802_11_FIXED_IE_SIZE 12 /** WLAN supported rates */ #define WLAN_SUPPORTED_RATES 14 @@ -1071,19 +1076,31 @@ typedef MLAN_PACK_START struct { **/ typedef MLAN_PACK_START struct { #ifdef BIG_ENDIAN_SUPPORT - t_u8 rsvd5_7:3; /**< Reserved */ - t_u8 unmeasured:1; /**< Channel is unmeasured */ - t_u8 radar:1; /**< Radar detected on channel */ - t_u8 unidentified_sig:1; /**< Unidentified signal found on channel */ - t_u8 ofdm_preamble:1; /**< OFDM preamble detected on channel */ - t_u8 bss:1; /**< At least one valid MPDU received on channel */ + /**< Reserved */ + t_u8 rsvd5_7:3; + /**< Channel is unmeasured */ + t_u8 unmeasured:1; + /**< Radar detected on channel */ + t_u8 radar:1; + /**< Unidentified signal found on channel */ + t_u8 unidentified_sig:1; + /**< OFDM preamble detected on channel */ + t_u8 ofdm_preamble:1; + /**< At least one valid MPDU received on channel */ + t_u8 bss:1; #else - t_u8 bss:1; /**< At least one valid MPDU received on channel */ - t_u8 ofdm_preamble:1; /**< OFDM preamble detected on channel */ - t_u8 unidentified_sig:1; /**< Unidentified signal found on channel */ - t_u8 radar:1; /**< Radar detected on channel */ - t_u8 unmeasured:1; /**< Channel is unmeasured */ - t_u8 rsvd5_7:3; /**< Reserved */ + /**< At least one valid MPDU received on channel */ + t_u8 bss:1; + /**< OFDM preamble detected on channel */ + t_u8 ofdm_preamble:1; + /**< Unidentified signal found on channel */ + t_u8 unidentified_sig:1; + /**< Radar detected on channel */ + t_u8 radar:1; + /**< Channel is unmeasured */ + t_u8 unmeasured:1; + /**< Reserved */ + t_u8 rsvd5_7:3; #endif /* BIG_ENDIAN_SUPPORT */ } MLAN_PACK_END MeasRptBasicMap_t; @@ -1139,6 +1156,48 @@ typedef struct { } wlan_11h_bss_info_t; +/** Ethernet packet type for TDLS */ +#define MLAN_ETHER_PKT_TYPE_TDLS_ACTION (0x890D) + +/*802.11z TDLS action frame type and strcuct */ +typedef MLAN_PACK_START struct { + /* link indentifier ie =101 */ + t_u8 element_id; + /* len = 18 */ + t_u8 len; + /** bssid */ + t_u8 bssid[MLAN_MAC_ADDR_LENGTH]; + /** init sta mac address */ + t_u8 init_sta[MLAN_MAC_ADDR_LENGTH]; + /** resp sta mac address */ + t_u8 resp_sta[MLAN_MAC_ADDR_LENGTH]; +} MLAN_PACK_END IEEEtypes_tdls_linkie; + +/** action code for tdls setup request */ +#define TDLS_SETUP_REQUEST 0 +/** action code for tdls setup response */ +#define TDLS_SETUP_RESPONSE 1 +/** action code for tdls setup confirm */ +#define TDLS_SETUP_CONFIRM 2 +/** action code for tdls tear down */ +#define TDLS_TEARDOWN 3 +/** action code for tdls traffic indication */ +#define TDLS_PEER_TRAFFIC_INDICATION 4 +/** action code for tdls channel switch request */ +#define TDLS_CHANNEL_SWITCH_REQUEST 5 +/** action code for tdls channel switch response */ +#define TDLS_CHANNEL_SWITCH_RESPONSE 6 +/** action code for tdls psm request */ +#define TDLS_PEER_PSM_REQUEST 7 +/** action code for tdls psm response */ +#define TDLS_PEER_PSM_RESPONSE 8 +/** action code for tdls traffic response */ +#define TDLS_PEER_TRAFFIC_RESPONSE 9 +/** action code for tdls discovery request */ +#define TDLS_DISCOVERY_REQUEST 10 +/** action code for TDLS discovery response */ +#define TDLS_DISCOVERY_RESPONSE 14 + #ifdef STA_SUPPORT /** Macro for maximum size of scan response buffer */ #define MAX_SCAN_RSP_BUF (16 * 1024) @@ -1283,6 +1342,8 @@ typedef MLAN_PACK_START struct { t_u8 snr_threshold; /** repeat count */ t_u16 repeat_count; + /** start later flag */ + t_u16 start_later; /** SSID filter list used in the to limit the scan results */ wlan_user_scan_ssid ssid_list[MRVDRV_MAX_SSID_LIST_LENGTH]; /** Variable number (fixed maximum) of channels to scan up */ diff --git a/drivers/net/wireless/sd8797/mlan/mlan_init.c b/drivers/net/wireless/sd8797/mlan/mlan_init.c index bd4110409e60..41621bc77c9b 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_init.c +++ b/drivers/net/wireless/sd8797/mlan/mlan_init.c @@ -3,20 +3,25 @@ * @brief This file contains the initialization for FW * and HW. * - * Copyright (C) 2008-2011, Marvell International Ltd. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. */ /******************************************************** @@ -49,9 +54,9 @@ Change log: /** * @brief This function adds a BSS priority table * - * @param priv A pointer to mlan_private structure + * @param priv A pointer to mlan_private structure * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_add_bsspriotbl(pmlan_private priv) @@ -81,9 +86,8 @@ wlan_add_bsspriotbl(pmlan_private priv) = pbssprio; util_enqueue_list_tail(pmadapter->pmoal_handle, - &pmadapter->bssprio_tbl[priv-> - bss_priority].bssprio_head, - (pmlan_linked_list) pbssprio, + &pmadapter->bssprio_tbl[priv->bss_priority]. + bssprio_head, (pmlan_linked_list) pbssprio, pmadapter->callbacks.moal_spin_lock, pmadapter->callbacks.moal_spin_unlock); @@ -94,9 +98,9 @@ wlan_add_bsspriotbl(pmlan_private priv) /** * @brief This function deletes the BSS priority table * - * @param priv A pointer to mlan_private structure + * @param priv A pointer to mlan_private structure * - * @return N/A + * @return N/A */ static t_void wlan_delete_bsspriotbl(pmlan_private priv) @@ -162,11 +166,11 @@ wlan_delete_bsspriotbl(pmlan_private priv) /** * @brief This function allocates buffer for the members of adapter - * structure like command buffer and BSSID list. + * structure like command buffer and BSSID list. * - * @param pmadapter A pointer to mlan_adapter structure + * @param pmadapter A pointer to mlan_adapter structure * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_allocate_adapter(pmlan_adapter pmadapter) @@ -262,11 +266,11 @@ wlan_allocate_adapter(pmlan_adapter pmadapter) /** * @brief This function initializes the private structure - * and sets default values to the members of mlan_private. + * and sets default values to the members of mlan_private. * - * @param priv A pointer to mlan_private structure + * @param priv A pointer to mlan_private structure * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_init_priv(pmlan_private priv) @@ -368,6 +372,7 @@ wlan_init_priv(pmlan_private priv) priv->wmm_required = MTRUE; priv->wmm_enabled = MFALSE; priv->wmm_qosinfo = 0; + priv->saved_wmm_qosinfo = 0; #ifdef STA_SUPPORT priv->pcurr_bcn_buf = MNULL; priv->curr_bcn_size = 0; @@ -380,11 +385,8 @@ wlan_init_priv(pmlan_private priv) priv->addba_reject[7] = ADDBA_RSP_STATUS_REJECT; priv->max_amsdu = 0; - if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA) { - priv->port_ctrl_mode = MTRUE; - } else { - priv->port_ctrl_mode = MFALSE; - } + priv->port_ctrl_mode = MTRUE; + priv->port_open = MFALSE; ret = wlan_add_bsspriotbl(priv); @@ -395,11 +397,11 @@ wlan_init_priv(pmlan_private priv) /** * @brief This function initializes the adapter structure - * and sets default values to the members of adapter. + * and sets default values to the members of adapter. * - * @param pmadapter A pointer to mlan_adapter structure + * @param pmadapter A pointer to mlan_adapter structure * - * @return N/A + * @return N/A */ t_void wlan_init_adapter(pmlan_adapter pmadapter) @@ -413,11 +415,10 @@ wlan_init_adapter(pmlan_adapter pmadapter) data_offset); #ifdef MFG_CMD_SUPPORT - if (pmadapter->init_para.mfg_mode == MLAN_INIT_PARA_DISABLED) { + if (pmadapter->init_para.mfg_mode == MLAN_INIT_PARA_DISABLED) pmadapter->mfg_mode = MFALSE; - } else { + else pmadapter->mfg_mode = pmadapter->init_para.mfg_mode; - } #endif pmadapter->int_mode = pmadapter->init_para.int_mode; @@ -439,13 +440,12 @@ wlan_init_adapter(pmlan_adapter pmadapter) pmadapter->mpa_tx.pkt_cnt = 0; pmadapter->mpa_tx.start_port = 0; - if (!pmadapter->init_para.mpa_tx_cfg) { + if (!pmadapter->init_para.mpa_tx_cfg) pmadapter->mpa_tx.enabled = MFALSE; - } else if (pmadapter->init_para.mpa_tx_cfg == MLAN_INIT_PARA_DISABLED) { + else if (pmadapter->init_para.mpa_tx_cfg == MLAN_INIT_PARA_DISABLED) pmadapter->mpa_tx.enabled = MFALSE; - } else { + else pmadapter->mpa_tx.enabled = MTRUE; - } pmadapter->mpa_tx.pkt_aggr_limit = SDIO_MP_AGGR_DEF_PKT_LIMIT; #endif /* SDIO_MULTI_PORT_TX_AGGR */ @@ -454,13 +454,12 @@ wlan_init_adapter(pmlan_adapter pmadapter) pmadapter->mpa_rx.pkt_cnt = 0; pmadapter->mpa_rx.start_port = 0; - if (!pmadapter->init_para.mpa_rx_cfg) { + if (!pmadapter->init_para.mpa_rx_cfg) pmadapter->mpa_rx.enabled = MFALSE; - } else if (pmadapter->init_para.mpa_rx_cfg == MLAN_INIT_PARA_DISABLED) { + else if (pmadapter->init_para.mpa_rx_cfg == MLAN_INIT_PARA_DISABLED) pmadapter->mpa_rx.enabled = MFALSE; - } else { + else pmadapter->mpa_rx.enabled = MTRUE; - } pmadapter->mpa_rx.pkt_aggr_limit = SDIO_MP_AGGR_DEF_PKT_LIMIT; #endif /* SDIO_MULTI_PORT_RX_AGGR */ @@ -561,6 +560,7 @@ wlan_init_adapter(pmlan_adapter pmadapter) #ifdef STA_SUPPORT pmadapter->chan_bandwidth = 0; pmadapter->adhoc_11n_enabled = MFALSE; + pmadapter->tdls_status = TDLS_NOT_SETUP; #endif /* STA_SUPPORT */ /* Initialize 802.11d */ @@ -589,6 +589,8 @@ wlan_init_adapter(pmlan_adapter pmadapter) sizeof(pmadapter->sleep_params)); memset(pmadapter, &pmadapter->sleep_period, 0, sizeof(pmadapter->sleep_period)); + memset(pmadapter, &pmadapter->saved_sleep_period, 0, + sizeof(pmadapter->saved_sleep_period)); pmadapter->tx_lock_flag = MFALSE; pmadapter->null_pkt_interval = 0; pmadapter->fw_bands = 0; @@ -755,6 +757,11 @@ wlan_init_lock_list(IN pmlan_adapter pmadapter) &priv->sta_list, MTRUE, pmadapter->callbacks. moal_init_lock); + /* Initialize tdls_pending_txq */ + util_init_list_head((t_void *) pmadapter->pmoal_handle, + &priv->tdls_pending_txq, MTRUE, + pmadapter->callbacks. + moal_init_lock); /* Initialize bypass_txq */ util_init_list_head((t_void *) pmadapter->pmoal_handle, &priv->bypass_txq, MTRUE, @@ -851,6 +858,10 @@ wlan_free_lock_list(IN pmlan_adapter pmadapter) priv->adapter->callbacks. moal_free_lock); util_free_list_head((t_void *) pmadapter->pmoal_handle, + &priv->tdls_pending_txq, + pmadapter->callbacks. + moal_free_lock); + util_free_list_head((t_void *) pmadapter->pmoal_handle, &priv->bypass_txq, pmadapter->callbacks. moal_free_lock); @@ -1002,7 +1013,7 @@ done: /** * @brief This function frees the structure of adapter * - * @param pmadapter A pointer to mlan_adapter structure + * @param pmadapter A pointer to mlan_adapter structure * * @return N/A */ @@ -1072,9 +1083,9 @@ wlan_free_adapter(pmlan_adapter pmadapter) /** * @brief This function frees the structure of priv * - * @param pmpriv A pointer to mlan_private structure + * @param pmpriv A pointer to mlan_private structure * - * @return N/A + * @return N/A */ t_void wlan_free_priv(mlan_private * pmpriv) @@ -1119,12 +1130,13 @@ wlan_init_fw_complete(IN pmlan_adapter pmadapter) } /** - * @brief The cmdresp handler calls this function for shutdown_fw_complete callback + * @brief The cmdresp handler calls this function + * for shutdown_fw_complete callback * - * @param pmadapter A pointer to mlan_adapter structure + * @param pmadapter A pointer to mlan_adapter structure * - * @return MLAN_STATUS_SUCCESS - * The firmware shutdown callback succeeded. + * @return MLAN_STATUS_SUCCESS + * The firmware shutdown callback succeeded. */ mlan_status wlan_shutdown_fw_complete(IN pmlan_adapter pmadapter) diff --git a/drivers/net/wireless/sd8797/mlan/mlan_init.h b/drivers/net/wireless/sd8797/mlan/mlan_init.h index c5e444be5d4b..b9831955699b 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_init.h +++ b/drivers/net/wireless/sd8797/mlan/mlan_init.h @@ -3,20 +3,25 @@ * @brief This file defines the FW initialization data * structures. * - * Copyright (C) 2008-2011, Marvell International Ltd. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. */ /****************************************************** @@ -32,7 +37,7 @@ Change log: /** Rx buffer size for firmware download*/ #define FW_DNLD_RX_BUF_SIZE 2048 /** Max firmware retry */ -#define MAX_FW_RETRY 3 +#define MAX_FW_RETRY 3 /** Firmware has last block */ #define FW_HAS_LAST_BLOCK 0x00000004 @@ -71,13 +76,17 @@ typedef struct _FWSyncHeader { } FWSyncHeader; #ifdef BIG_ENDIAN_SUPPORT -/** Convert sequence number and command fields of fwheader to correct endian format */ +/** Convert sequence number and command fields + * of fwheader to correct endian format + */ #define endian_convert_syncfwheader(x) { \ (x)->cmd = wlan_le32_to_cpu((x)->cmd); \ (x)->seq_num = wlan_le32_to_cpu((x)->seq_num); \ } #else -/** Convert sequence number and command fields of fwheader to correct endian format */ +/** Convert sequence number and command fields + * of fwheader to correct endian format + */ #define endian_convert_syncfwheader(x) #endif /* BIG_ENDIAN_SUPPORT */ diff --git a/drivers/net/wireless/sd8797/mlan/mlan_ioctl.h b/drivers/net/wireless/sd8797/mlan/mlan_ioctl.h index 31c65eebefcf..7c184e60ffb6 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_ioctl.h +++ b/drivers/net/wireless/sd8797/mlan/mlan_ioctl.h @@ -2,20 +2,25 @@ * * @brief This file declares the IOCTL data structures and APIs. * - * Copyright (C) 2008-2011, Marvell International Ltd. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. */ /****************************************************** @@ -208,6 +213,7 @@ enum _mlan_ioctl_req_id { MLAN_OID_MISC_ASSOC_RSP = 0x0020000C, MLAN_OID_MISC_INIT_SHUTDOWN = 0x0020000D, MLAN_OID_MISC_CUSTOM_IE = 0x0020000F, + MLAN_OID_MISC_TDLS_CONFIG = 0x00200010, MLAN_OID_MISC_TX_DATAPAUSE = 0x00200012, MLAN_OID_MISC_IP_ADDR = 0x00200013, MLAN_OID_MISC_MAC_CONTROL = 0x00200014, @@ -231,6 +237,8 @@ enum _mlan_ioctl_req_id { #ifdef WIFI_DIRECT_SUPPORT MLAN_OID_MISC_WIFI_DIRECT_CONFIG = 0x00200025, #endif + MLAN_OID_MISC_TDLS_OPER = 0x00200026, + MLAN_OID_MISC_GET_TDLS_IES = 0x00200027, }; /** Sub command size */ @@ -461,7 +469,7 @@ enum _mlan_bss_mode { #define MLAN_BEACON_INTERVAL 100 /** Receive all packets */ -#define MLAN_PROMISC_MODE 1 +#define MLAN_PROMISC_MODE 1 /** Receive multicast packets in multicast list */ #define MLAN_MULTICAST_MODE 2 /** Receive all multicast packets */ @@ -502,7 +510,9 @@ typedef struct _mlan_chan_list { chan_freq cf[MLAN_MAX_CHANNEL_NUM]; } mlan_chan_list; -/** mlan_ssid_bssid data structure for MLAN_OID_BSS_START and MLAN_OID_BSS_FIND_BSS */ +/** mlan_ssid_bssid data structure for + * MLAN_OID_BSS_START and MLAN_OID_BSS_FIND_BSS + */ typedef struct _mlan_ssid_bssid { /** SSID */ mlan_802_11_ssid ssid; @@ -1210,6 +1220,8 @@ typedef struct _mlan_fw_info { t_u32 fw_ver; /** MAC address */ mlan_802_11_mac_addr mac_addr; + /** 802.11n device capabilities */ + t_u32 hw_dot_11n_dev_cap; /** Device support for MIMO abstraction of MCSs */ t_u8 hw_dev_mcs_support; /** fw supported band */ @@ -1283,7 +1295,7 @@ typedef struct _mlan_bss_info { #define MAX_NUM_TID 8 /** Max RX Win size */ -#define MAX_RX_WINSIZE 64 +#define MAX_RX_WINSIZE 64 /** rx_reorder_tbl */ typedef struct { @@ -1319,6 +1331,25 @@ typedef struct { #define SDIO_MP_DBG_NUM 6 #endif +/** Maximum size of IEEE Information Elements */ +#define IEEE_MAX_IE_SIZE 256 + +/** support up to 8 TDLS peer */ +#define MLAN_MAX_TDLS_PEER_SUPPORTED 8 +/** TDLS peer info */ +typedef struct _tdls_peer_info { + /** station mac address */ + t_u8 mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** SNR */ + t_s8 snr; + /** Noise Floor */ + t_s8 nf; + /** Extended Capabilities IE */ + t_u8 ext_cap[IEEE_MAX_IE_SIZE]; + /** HT Capabilities IE */ + t_u8 ht_cap[IEEE_MAX_IE_SIZE]; +} tdls_peer_info; + /** mlan_debug_info data structure for MLAN_OID_GET_DEBUG_INFO */ typedef struct _mlan_debug_info { /* WMM AC_BK count */ @@ -1343,6 +1374,10 @@ typedef struct _mlan_debug_info { t_u32 rx_tbl_num; /** Rx reorder table*/ rx_reorder_tbl rx_tbl[MLAN_MAX_RX_BASTREAM_SUPPORTED]; + /** TDLS peer number */ + t_u32 tdls_peer_num; + /** TDLS peer list*/ + tdls_peer_info tdls_peer_list[MLAN_MAX_TDLS_PEER_SUPPORTED]; /** Corresponds to ps_mode member of mlan_adapter */ t_u16 ps_mode; /** Corresponds to ps_state member of mlan_adapter */ @@ -1483,6 +1518,8 @@ typedef struct _mlan_debug_info { t_u32 mlan_processing; /** mlan_rx_processing */ t_u32 mlan_rx_processing; + /** rx pkts queued */ + t_u32 rx_pkts_queued; /** mlan_adapter pointer */ t_void *mlan_adapter; /** mlan_adapter_size */ @@ -1611,11 +1648,17 @@ enum _mlan_psk_type { /** Type definition of mlan_ds_encrypt_key for MLAN_OID_SEC_CFG_ENCRYPT_KEY */ typedef struct _mlan_ds_encrypt_key { - /** Key disabled, all other fields will be ignore when this flag set to MTRUE */ + /** Key disabled, all other fields will be + * ignore when this flag set to MTRUE + */ t_u32 key_disable; - /** key removed flag, when this flag is set to MTRUE, only key_index will be check */ + /** key removed flag, when this flag is set + * to MTRUE, only key_index will be check + */ t_u32 key_remove; - /** Key index, used as current tx key index when is_current_wep_key is set to MTRUE */ + /** Key index, used as current tx key index + * when is_current_wep_key is set to MTRUE + */ t_u32 key_index; /** Current Tx key flag */ t_u32 is_current_wep_key; @@ -1712,7 +1755,9 @@ typedef struct _mlan_ds_sec_cfg { mlan_ds_encrypt_key encrypt_key; /** Passphrase for MLAN_OID_SEC_CFG_PASSPHRASE */ mlan_ds_passphrase passphrase; - /** Embedded supplicant WPA enabled flag for MLAN_OID_SEC_CFG_EWPA_ENABLED */ + /** Embedded supplicant WPA enabled flag for + * MLAN_OID_SEC_CFG_EWPA_ENABLED + */ t_u32 ewpa_enabled; /** Embedded supplicant mode for MLAN_OID_SEC_CFG_ESUPP_MODE */ mlan_ds_esupp_mode esupp_mode; @@ -1881,7 +1926,9 @@ typedef struct _mlan_ds_hs_cfg { t_u32 conditions; /** GPIO pin or 0xff for interface */ t_u32 gpio; - /** Gap in milliseconds or or 0xff for special setting when GPIO is used to wakeup host */ + /** Gap in milliseconds or or 0xff for special + * setting when GPIO is used to wakeup host + */ t_u32 gap; } mlan_ds_hs_cfg, *pmlan_ds_hs_cfg; @@ -1900,7 +1947,9 @@ typedef struct _mlan_ds_auto_ds { t_u16 idletime; } mlan_ds_auto_ds; -/** Type definition of mlan_ds_inactivity_to for MLAN_OID_PM_CFG_INACTIVITY_TO */ +/** Type definition of mlan_ds_inactivity_to + * for MLAN_OID_PM_CFG_INACTIVITY_TO + */ typedef struct _mlan_ds_inactivity_to { /** Timeout unit in microsecond, 0 means 1000us (1ms) */ t_u32 timeout_unit; @@ -2195,7 +2244,9 @@ typedef struct { */ t_u16 delay_histogram[MLAN_WMM_STATS_PKTS_HIST_BINS]; } wlan_ioctl_wmm_queue_stats_t, -/** Type definition of mlan_ds_wmm_queue_stats for MLAN_OID_WMM_CFG_QUEUE_STATS */ +/** Type definition of mlan_ds_wmm_queue_stats + * for MLAN_OID_WMM_CFG_QUEUE_STATS + */ mlan_ds_wmm_queue_stats, *pmlan_ds_wmm_queue_stats; /** @@ -2225,7 +2276,9 @@ typedef struct { /** WMM AC queue status */ wlan_ioctl_wmm_queue_status_ac_t ac_status[MLAN_WMM_MAX_AC_QUEUES]; } wlan_ioctl_wmm_queue_status_t, -/** Type definition of mlan_ds_wmm_queue_status for MLAN_OID_WMM_CFG_QUEUE_STATUS */ +/** Type definition of mlan_ds_wmm_queue_status + * for MLAN_OID_WMM_CFG_QUEUE_STATUS + */ mlan_ds_wmm_queue_status, *pmlan_ds_wmm_queue_status; /** Type definition of mlan_ds_wmm_addts for MLAN_OID_WMM_CFG_ADDTS */ @@ -2256,7 +2309,9 @@ typedef struct _mlan_ds_wmm_delts { t_u8 ie_data[MLAN_WMM_TSPEC_SIZE]; } mlan_ds_wmm_delts, *pmlan_ds_wmm_delts; -/** Type definition of mlan_ds_wmm_queue_config for MLAN_OID_WMM_CFG_QUEUE_CONFIG */ +/** Type definition of mlan_ds_wmm_queue_config + * for MLAN_OID_WMM_CFG_QUEUE_CONFIG + */ typedef struct _mlan_ds_wmm_queue_config { /** Action of Queue Config : Set, Get, or Default */ mlan_wmm_queue_config_action_e action; @@ -2340,7 +2395,9 @@ typedef struct _mlan_ds_11n_htcap_cfg { t_u32 hw_cap_req; } mlan_ds_11n_htcap_cfg, *pmlan_ds_11n_htcap_cfg; -/** Type definition of mlan_ds_11n_addba_param for MLAN_OID_11N_CFG_ADDBA_PARAM */ +/** Type definition of mlan_ds_11n_addba_param + * for MLAN_OID_11N_CFG_ADDBA_PARAM + */ typedef struct _mlan_ds_11n_addba_param { /** Timeout */ t_u32 timeout; @@ -2464,7 +2521,9 @@ typedef struct _mlan_ds_11n_amsdu_aggr_ctrl { t_u16 curr_buf_size; } mlan_ds_11n_amsdu_aggr_ctrl, *pmlan_ds_11n_amsdu_aggr_ctrl; -/** Type definition of mlan_ds_11n_aggr_prio_tbl for MLAN_OID_11N_CFG_AGGR_PRIO_TBL */ +/** Type definition of mlan_ds_11n_aggr_prio_tbl + * for MLAN_OID_11N_CFG_AGGR_PRIO_TBL + */ typedef struct _mlan_ds_11n_aggr_prio_tbl { /** ampdu priority table */ t_u8 ampdu[MAX_NUM_TID]; @@ -2536,9 +2595,6 @@ typedef struct _mlan_ds_11n_cfg { /** Country code length */ #define COUNTRY_CODE_LEN 3 -/** Maximum size of IEEE Information Elements */ -#define IEEE_MAX_IE_SIZE 256 - /*-----------------------------------------------------------------*/ /** 802.11d Configuration Group */ /*-----------------------------------------------------------------*/ @@ -2711,7 +2767,9 @@ typedef struct _mlan_ds_misc_gen_ie { } mlan_ds_misc_gen_ie; #if defined(SDIO_MULTI_PORT_TX_AGGR) || defined(SDIO_MULTI_PORT_RX_AGGR) -/** Type definition of mlan_ds_misc_sdio_mpa_ctrl for MLAN_OID_MISC_SDIO_MPA_CTRL */ +/** Type definition of mlan_ds_misc_sdio_mpa_ctrl + * for MLAN_OID_MISC_SDIO_MPA_CTRL + */ typedef struct _mlan_ds_misc_sdio_mpa_ctrl { /** SDIO MP-A TX enable/disable */ t_u16 tx_enable; @@ -2737,12 +2795,12 @@ typedef struct _mlan_ds_misc_cmd { } mlan_ds_misc_cmd; /** Maximum number of system clocks */ -#define MLAN_MAX_CLK_NUM 16 +#define MLAN_MAX_CLK_NUM 16 /** Clock type : Configurable */ -#define MLAN_CLK_CONFIGURABLE 0 +#define MLAN_CLK_CONFIGURABLE 0 /** Clock type : Supported */ -#define MLAN_CLK_SUPPORTED 1 +#define MLAN_CLK_SUPPORTED 1 /** Type definition of mlan_ds_misc_sys_clock for MLAN_OID_MISC_SYS_CLOCK */ typedef struct _mlan_ds_misc_sys_clock { @@ -2773,7 +2831,9 @@ enum _mlan_func_cmd { MLAN_FUNC_SHUTDOWN, }; -/** Type definition of mlan_ds_misc_tx_datapause for MLAN_OID_MISC_TX_DATAPAUSE */ +/** Type definition of mlan_ds_misc_tx_datapause + * for MLAN_OID_MISC_TX_DATAPAUSE + */ typedef struct _mlan_ds_misc_tx_datapause { /** Tx data pause flag */ t_u16 tx_pause; @@ -2836,7 +2896,9 @@ typedef struct _mlan_ds_misc_cfp_code { t_u32 cfp_code_a; } mlan_ds_misc_cfp_code; -/** Type definition of mlan_ds_misc_country_code for MLAN_OID_MISC_COUNTRY_CODE */ +/** Type definition of mlan_ds_misc_country_code + * for MLAN_OID_MISC_COUNTRY_CODE + */ typedef struct _mlan_ds_misc_country_code { /** Country Code */ t_u8 country_code[COUNTRY_CODE_LEN]; @@ -2881,43 +2943,63 @@ typedef struct _mlan_ds_subscribe_evt { t_u16 evt_bitmap; /** Absolute value of RSSI threshold value (dBm) */ t_u8 low_rssi; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 low_rssi_freq; /** SNR threshold value (dB) */ t_u8 low_snr; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 low_snr_freq; /** Failure count threshold */ t_u8 failure_count; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 failure_count_freq; /** num of missed beacons */ t_u8 beacon_miss; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 beacon_miss_freq; /** Absolute value of RSSI threshold value (dBm) */ t_u8 high_rssi; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 high_rssi_freq; /** SNR threshold value (dB) */ t_u8 high_snr; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 high_snr_freq; /** Absolute value of data RSSI threshold value (dBm) */ t_u8 data_low_rssi; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 data_low_rssi_freq; /** Absolute value of data SNR threshold value (dBm) */ t_u8 data_low_snr; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 data_low_snr_freq; /** Absolute value of data RSSI threshold value (dBm) */ t_u8 data_high_rssi; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 data_high_rssi_freq; /** Absolute value of data SNR threshold value (dBm) */ t_u8 data_high_snr; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 data_high_snr_freq; /* Link SNR threshold (dB) */ t_u16 link_snr; @@ -2938,7 +3020,9 @@ typedef struct _mlan_ds_subscribe_evt { /** Max OTP user data length */ #define MAX_OTP_USER_DATA_LEN 252 -/** Type definition of mlan_ds_misc_otp_user_data for MLAN_OID_MISC_OTP_USER_DATA */ +/** Type definition of mlan_ds_misc_otp_user_data + * for MLAN_OID_MISC_OTP_USER_DATA + */ typedef struct _mlan_ds_misc_otp_user_data { /** Reserved */ t_u16 reserved; @@ -2953,7 +3037,9 @@ typedef struct _mlan_ds_misc_otp_user_data { #define WIFI_DIRECT_NOA 1 /** flag for OPP_PS */ #define WIFI_DIRECT_OPP_PS 2 -/** Type definition of mlan_ds_wifi_direct_config for MLAN_OID_MISC_WIFI_DIRECT_CONFIG */ +/** Type definition of mlan_ds_wifi_direct_config + * for MLAN_OID_MISC_WIFI_DIRECT_CONFIG + */ typedef struct _mlan_ds_wifi_direct_config { /** flags for NOA/OPP_PS */ t_u8 flags; @@ -2983,6 +3069,59 @@ typedef struct _mlan_ds_misc_pmfcfg { } mlan_ds_misc_pmfcfg; #endif +/**Action ID for TDLS disable link*/ +#define WLAN_TDLS_DISABLE_LINK 0x00 +/**Action ID for TDLS enable link*/ +#define WLAN_TDLS_ENABLE_LINK 0x01 +/**Action ID for TDLS create link*/ +#define WLAN_TDLS_CREATE_LINK 0x02 +/**Action ID for TDLS config link*/ +#define WLAN_TDLS_CONFIG_LINK 0x03 +/*reason code*/ +#define WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED 26 +/** TDLS operation buffer */ +typedef struct _mlan_ds_misc_tdls_oper { + /** TDLS Action */ + t_u16 tdls_action; + /** TDLS peer address */ + t_u8 peer_mac[MLAN_MAC_ADDR_LENGTH]; + /** peer capability */ + t_u16 capability; + /** peer qos info */ + t_u8 qos_info; + /** peer extend capability */ + t_u8 *ext_capab; + /** extend capability len */ + t_u8 ext_capab_len; + /** support rates */ + t_u8 *supported_rates; + /** supported rates len */ + t_u8 supported_rates_len; + /** peer ht_cap */ + t_u8 *ht_capa; +} mlan_ds_misc_tdls_oper; + +/** flag for TDLS extcap */ +#define TDLS_IE_FLAGS_EXTCAP 0x0001 +/** flag for TDLS HTCAP */ +#define TDLS_IE_FLAGS_HTCAP 0x0002 +/** flag for TDLS HTINFO */ +#define TDLS_IE_FLAGS_HTINFO 0x0004 + +/** TDLS ie buffer */ +typedef struct _mlan_ds_misc_tdls_ies { + /** TDLS peer address */ + t_u8 peer_mac[MLAN_MAC_ADDR_LENGTH]; + /** flags for request IEs */ + t_u16 flags; + /** Extended Capabilities IE */ + t_u8 ext_cap[IEEE_MAX_IE_SIZE]; + /** HT Capabilities IE */ + t_u8 ht_cap[IEEE_MAX_IE_SIZE]; + /** HT Information IE */ + t_u8 ht_info[IEEE_MAX_IE_SIZE]; +} mlan_ds_misc_tdls_ies; + /** Type definition of mlan_ds_misc_cfg for MLAN_IOCTL_MISC_CFG */ typedef struct _mlan_ds_misc_cfg { /** Sub-command */ @@ -3009,6 +3148,12 @@ typedef struct _mlan_ds_misc_cfg { t_u32 func_init_shutdown; /** Custom IE for MLAN_OID_MISC_CUSTOM_IE */ mlan_ds_misc_custom_ie cust_ie; + /** TDLS configuration for MLAN_OID_MISC_TDLS_CONFIG */ + mlan_ds_misc_tdls_config tdls_config; + /** TDLS operation for MLAN_OID_MISC_TDLS_OPER */ + mlan_ds_misc_tdls_oper tdls_oper; + /** TDLS ies for MLAN_OID_MISC_GET_TDLS_IES */ + mlan_ds_misc_tdls_ies tdls_ies; /** Tx data pause for MLAN_OID_MISC_TX_DATAPAUSE */ mlan_ds_misc_tx_datapause tx_datapause; /** IP address configuration */ diff --git a/drivers/net/wireless/sd8797/mlan/mlan_join.c b/drivers/net/wireless/sd8797/mlan/mlan_join.c index 38055210d77d..55753598d343 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_join.c +++ b/drivers/net/wireless/sd8797/mlan/mlan_join.c @@ -6,20 +6,26 @@ * for sending adhoc start, adhoc join, and association commands * to the firmware. * - * Copyright (C) 2008-2011, Marvell International Ltd. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. + * + * @sa mlan_join.h */ /****************************************************** @@ -361,24 +367,24 @@ wlan_update_tsf_timestamps(IN mlan_private * pmpriv, * the buffer as a wapi TLV type to the request. * * @param priv A pointer to mlan_private structure - * @param ppBuffer pointer to command buffer pointer + * @param ppbuffer pointer to command buffer pointer * * @return bytes added to the buffer */ static int -wlan_cmd_append_wapi_ie(mlan_private * priv, t_u8 ** ppBuffer) +wlan_cmd_append_wapi_ie(mlan_private * priv, t_u8 ** ppbuffer) { - int retLen = 0; + int retlen = 0; MrvlIEtypesHeader_t ie_header; ENTER(); /* Null Checks */ - if (ppBuffer == MNULL) { + if (ppbuffer == MNULL) { LEAVE(); return 0; } - if (*ppBuffer == MNULL) { + if (*ppbuffer == MNULL) { LEAVE(); return 0; } @@ -389,32 +395,32 @@ wlan_cmd_append_wapi_ie(mlan_private * priv, t_u8 ** ppBuffer) */ if (priv->wapi_ie_len) { PRINTM(MCMND, "append wapi ie %d to %p\n", priv->wapi_ie_len, - *ppBuffer); + *ppbuffer); /* Wrap the generic IE buffer with a pass through TLV type */ ie_header.type = wlan_cpu_to_le16(TLV_TYPE_WAPI_IE); ie_header.len = wlan_cpu_to_le16(priv->wapi_ie_len); - memcpy(priv->adapter, *ppBuffer, &ie_header, sizeof(ie_header)); + memcpy(priv->adapter, *ppbuffer, &ie_header, sizeof(ie_header)); /* Increment the return size and the return buffer pointer param */ - *ppBuffer += sizeof(ie_header); - retLen += sizeof(ie_header); + *ppbuffer += sizeof(ie_header); + retlen += sizeof(ie_header); /* Copy the wapi IE buffer to the output buffer, advance pointer */ - memcpy(priv->adapter, *ppBuffer, priv->wapi_ie, + memcpy(priv->adapter, *ppbuffer, priv->wapi_ie, priv->wapi_ie_len); /* Increment the return size and the return buffer pointer param */ - *ppBuffer += priv->wapi_ie_len; - retLen += priv->wapi_ie_len; + *ppbuffer += priv->wapi_ie_len; + retlen += priv->wapi_ie_len; } /* return the length appended to the buffer */ LEAVE(); - return retLen; + return retlen; } /******************************************************** @@ -462,15 +468,9 @@ wlan_update_rsn_ie(mlan_private * pmpriv, /* Save pointer to akm_suite_count in RSN IE to update it later */ akm_suite_count_ptr = ptr; temp = ptlv_rsn_ie->rsn_ie + sizeof(t_u16) + 4 * sizeof(t_u8) - + sizeof(t_u16) + pairwise_cipher_count * PAIRWISE_CIPHER_SUITE_LEN + sizeof(t_u16); /* ptr - now - points - to - the - 1st - AKM - suite - */ + + sizeof(t_u16) + pairwise_cipher_count + * PAIRWISE_CIPHER_SUITE_LEN + sizeof(t_u16); + /* ptr now points to the 1st AKM suite */ if (temp_akm_suite_count > 1) { while (temp_akm_suite_count) { if (!memcmp @@ -683,10 +683,8 @@ wlan_cmd_802_11_associate(IN mlan_private * pmpriv, if ((pmpriv->sec_info.wpa_enabled || pmpriv->sec_info.wpa2_enabled)) { prsn_ie_tlv = (MrvlIEtypes_RsnParamSet_t *) pos; - prsn_ie_tlv->header.type = (t_u16) pmpriv->wpa_ie[0]; /* WPA_IE - or - RSN_IE - */ + /* WPA_IE or RSN_IE */ + prsn_ie_tlv->header.type = (t_u16) pmpriv->wpa_ie[0]; prsn_ie_tlv->header.type = prsn_ie_tlv->header.type & 0x00FF; prsn_ie_tlv->header.type = @@ -799,9 +797,8 @@ wlan_cmd_802_11_associate(IN mlan_private * pmpriv, wlan_wmm_process_association_req(pmpriv, &pos, &pbss_desc->wmm_ie, pbss_desc->pht_cap); - if (pmpriv->sec_info.wapi_enabled && pmpriv->wapi_ie_len) { + if (pmpriv->sec_info.wapi_enabled && pmpriv->wapi_ie_len) wlan_cmd_append_wapi_ie(pmpriv, &pos); - } wlan_cmd_append_generic_ie(pmpriv, &pos); @@ -834,9 +831,8 @@ wlan_cmd_802_11_associate(IN mlan_private * pmpriv, memcpy(pmadapter, &tmp_cap, &pbss_desc->cap_info, sizeof(passo->cap_info)); - if (pmpriv->config_bands == BAND_B) { + if (pmpriv->config_bands == BAND_B) SHORT_SLOT_TIME_DISABLED(tmp_cap); - } tmp_cap &= CAPINFO_MASK; PRINTM(MINFO, "ASSOC_CMD: tmp_cap=%4X CAPINFO_MASK=%4lX\n", @@ -1046,9 +1042,8 @@ wlan_ret_802_11_associate(IN mlan_private * pmpriv, */ wlan_wmm_setup_queues(pmpriv); - if (enable_data) { + if (enable_data) PRINTM(MINFO, "Post association, re-enabling data flow\n"); - } /* Reset SNR/NF/RSSI values */ pmpriv->data_rssi_last = 0; @@ -1348,7 +1343,7 @@ wlan_cmd_802_11_ad_hoc_start(IN mlan_private * pmpriv, memcpy(pmadapter, &pmpriv->curr_bss_params.data_rates, &padhoc_start->DataRate, pmpriv->curr_bss_params.num_of_rates); - PRINTM(MINFO, "ADHOC_S_CMD: Rates=%02x %02x %02x %02x \n", + PRINTM(MINFO, "ADHOC_S_CMD: Rates=%02x %02x %02x %02x\n", padhoc_start->DataRate[0], padhoc_start->DataRate[1], padhoc_start->DataRate[2], padhoc_start->DataRate[3]); @@ -1421,10 +1416,8 @@ wlan_cmd_802_11_ad_hoc_start(IN mlan_private * pmpriv, if (pmpriv->sec_info.wpa_enabled || pmpriv->sec_info.ewpa_enabled) { prsn_ie_tlv = (MrvlIEtypes_RsnParamSet_t *) pos; - prsn_ie_tlv->header.type = (t_u16) pmpriv->wpa_ie[0]; /* WPA_IE - or - RSN_IE - */ + prsn_ie_tlv->header.type = (t_u16) pmpriv->wpa_ie[0]; + /* WPA_IE or RSN_IE */ prsn_ie_tlv->header.type = prsn_ie_tlv->header.type & 0x00FF; prsn_ie_tlv->header.type = wlan_cpu_to_le16(prsn_ie_tlv->header.type); @@ -1503,11 +1496,10 @@ wlan_cmd_802_11_ad_hoc_start(IN mlan_private * pmpriv, memcpy(pmadapter, &tmp_cap, &padhoc_start->cap, sizeof(t_u16)); - if (pmadapter->adhoc_start_band == BAND_B) { + if (pmadapter->adhoc_start_band == BAND_B) SHORT_SLOT_TIME_DISABLED(tmp_cap); - } else { + else SHORT_SLOT_TIME_ENABLED(tmp_cap); - } tmp_cap = wlan_cpu_to_le16(tmp_cap); memcpy(pmadapter, &padhoc_start->cap, &tmp_cap, sizeof(t_u16)); @@ -1683,10 +1675,8 @@ wlan_cmd_802_11_ad_hoc_join(IN mlan_private * pmpriv, if (pmpriv->sec_info.wpa_enabled) { prsn_ie_tlv = (MrvlIEtypes_RsnParamSet_t *) pos; - prsn_ie_tlv->header.type = (t_u16) pmpriv->wpa_ie[0]; /* WPA_IE - or - RSN_IE - */ + /* WPA_IE or RSN_IE */ + prsn_ie_tlv->header.type = (t_u16) pmpriv->wpa_ie[0]; prsn_ie_tlv->header.type = prsn_ie_tlv->header.type & 0x00FF; prsn_ie_tlv->header.type = wlan_cpu_to_le16(prsn_ie_tlv->header.type); @@ -1800,7 +1790,7 @@ done: /** * @brief This function handles the command response of ad_hoc_start and - * ad_hoc_join + * ad_hoc_join * * @param pmpriv A pointer to mlan_private structure * @param resp A pointer to HostCmd_DS_COMMAND @@ -1896,11 +1886,10 @@ wlan_ret_802_11_ad_hoc(IN mlan_private * pmpriv, done: /* Need to indicate IOCTL complete */ if (pioctl_req != MNULL) { - if (ret != MLAN_STATUS_SUCCESS) { + if (ret != MLAN_STATUS_SUCCESS) pioctl_req->status_code = MLAN_ERROR_CMD_ASSOC_FAIL; - } else { + else pioctl_req->status_code = MLAN_ERROR_NO_ERROR; - } } LEAVE(); @@ -2108,13 +2097,22 @@ wlan_disconnect(IN mlan_private * pmpriv, bss_descriptor.mac_address, MLAN_MAC_ADDR_LENGTH); } - - ret = wlan_prepare_cmd(pmpriv, - HostCmd_CMD_802_11_DEAUTHENTICATE, - HostCmd_ACT_GEN_SET, - 0, - (t_void *) pioctl_req, - &mac_address); +#ifdef WIFI_DIRECT_SUPPORT + if (pmpriv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT) + ret = wlan_prepare_cmd(pmpriv, + HostCmd_CMD_802_11_DISASSOCIATE, + HostCmd_ACT_GEN_SET, + 0, + (t_void *) pioctl_req, + &mac_address); + else +#endif + ret = wlan_prepare_cmd(pmpriv, + HostCmd_CMD_802_11_DEAUTHENTICATE, + HostCmd_ACT_GEN_SET, + 0, + (t_void *) pioctl_req, + &mac_address); if (ret == MLAN_STATUS_SUCCESS && pioctl_req) ret = MLAN_STATUS_PENDING; @@ -2137,9 +2135,9 @@ wlan_disconnect(IN mlan_private * pmpriv, /** * @brief Convert band to radio type used in channel TLV * - * @param band Band enumeration to convert to a channel TLV radio type + * @param band Band enumeration to convert to a channel TLV radio type * - * @return Radio type designator for use in a channel TLV + * @return Radio type designator for use in a channel TLV */ t_u8 wlan_band_to_radio_type(IN t_u8 band) diff --git a/drivers/net/wireless/sd8797/mlan/mlan_join.h b/drivers/net/wireless/sd8797/mlan/mlan_join.h index 2464109fd393..8e7e4925a21b 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_join.h +++ b/drivers/net/wireless/sd8797/mlan/mlan_join.h @@ -7,20 +7,26 @@ * implemented in mlan_join.c. Process all start/join requests for * both adhoc and infrastructure networks * - * Copyright (C) 2008-2011, Marvell International Ltd. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. + * + * @sa mlan_join.c */ /****************************************************** diff --git a/drivers/net/wireless/sd8797/mlan/mlan_main.h b/drivers/net/wireless/sd8797/mlan/mlan_main.h index 853241f70952..daed556f7e8f 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_main.h +++ b/drivers/net/wireless/sd8797/mlan/mlan_main.h @@ -4,20 +4,25 @@ * structures and declares global function prototypes used * in MLAN module. * - * Copyright (C) 2008-2012, Marvell International Ltd. + * (C) Copyright 2008-2012 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. */ /****************************************************** @@ -146,13 +151,13 @@ do { \ /** Log entry point for debugging */ #define ENTER() \ do { \ - PRINTM(MENTRY, "Enter: %s\n", __FUNCTION__); \ + PRINTM(MENTRY, "Enter: %s\n", __func__); \ } while (0) /** Log exit point for debugging */ #define LEAVE() \ do { \ - PRINTM(MENTRY, "Leave: %s\n", __FUNCTION__); \ + PRINTM(MENTRY, "Leave: %s\n", __func__); \ } while (0) /** Find minimum */ @@ -228,7 +233,7 @@ do { \ (t_u64)(((t_u64)(x) & 0x000000ff00000000ULL) >> 8) | \ (t_u64)(((t_u64)(x) & 0x0000ff0000000000ULL) >> 24) | \ (t_u64)(((t_u64)(x) & 0x00ff000000000000ULL) >> 40) | \ - (t_u64)(((t_u64)(x) & 0xff00000000000000ULL) >> 56) )) + (t_u64)(((t_u64)(x) & 0xff00000000000000ULL) >> 56))) #ifdef BIG_ENDIAN_SUPPORT /** Convert ulong n/w to host */ @@ -304,7 +309,7 @@ extern t_void(*assert_callback) (IN t_void * pmoal_handle, IN t_u32 cond); #define MASSERT(cond) \ do { \ if (!(cond)) { \ - PRINTM(MFATAL, "ASSERT: %s: %i\n", __FUNCTION__, __LINE__); \ + PRINTM(MFATAL, "ASSERT: %s: %i\n", __func__, __LINE__); \ if (assert_callback) { \ assert_callback(MNULL, (t_ptr)(cond)); \ } else { \ @@ -321,7 +326,7 @@ do { \ #ifdef STA_SUPPORT /** Maximum buffer size for ARP filter */ -#define ARP_FILTER_MAX_BUF_SIZE 68 +#define ARP_FILTER_MAX_BUF_SIZE 68 #endif /* STA_SUPPORT */ /** 60 seconds */ @@ -408,13 +413,19 @@ do { \ */ #define SCAN_BEACON_ENTRY_PAD 6 -/** Scan time specified in the channel TLV for each channel for passive scans */ +/** Scan time specified in the channel TLV + * for each channel for passive scans + */ #define MRVDRV_PASSIVE_SCAN_CHAN_TIME 200 -/** Scan time specified in the channel TLV for each channel for active scans */ +/** Scan time specified in the channel TLV + * for each channel for active scans + */ #define MRVDRV_ACTIVE_SCAN_CHAN_TIME 200 -/** Scan time specified in the channel TLV for each channel for specific scans */ +/** Scan time specified in the channel TLV + * for each channel for specific scans + */ #define MRVDRV_SPECIFIC_SCAN_CHAN_TIME 110 /** @@ -604,6 +615,8 @@ struct _raListTbl { t_u8 is_11n_enabled; /** max amsdu size */ t_u16 max_amsdu; + /** tdls flag */ + t_u8 is_tdls_link; /** tx_pause flag */ t_u8 tx_pause; }; @@ -636,6 +649,8 @@ typedef struct _wmm_desc { t_u32 packets_out[MAX_NUM_TID]; /** Packets queued */ t_u32 pkts_queued[MAX_NUM_TID]; + /** Packets paused */ + t_u32 pkts_paused[MAX_NUM_TID]; /** Spin lock to protect ra_list */ t_void *ra_list_spinlock; @@ -1025,6 +1040,8 @@ typedef struct _mlan_private { t_u8 wapi_ie_len; /** Pointer to the station table */ mlan_list_head sta_list; + /** tdls pending queue */ + mlan_list_head tdls_pending_txq; /** MGMT IE */ custom_ie mgmt_ie[MAX_MGMT_IE_INDEX]; @@ -1038,6 +1055,8 @@ typedef struct _mlan_private { t_u8 wmm_enabled; /** WMM qos info */ t_u8 wmm_qosinfo; + /** saved WMM qos info */ + t_u8 saved_wmm_qosinfo; /** WMM related variable*/ wmm_desc_t wmm; @@ -1215,6 +1234,22 @@ struct _cmd_ctrl_node { mlan_buffer *pmbuf; }; +/** default tdls wmm qosinfo */ +#define DEFAULT_TDLS_WMM_QOS_INFO 15 +/** default tdls sleep period */ +#define DEFAULT_TDLS_SLEEP_PERIOD 30 + +/** TDLS status */ +typedef enum _tdlsStatus_e { + TDLS_NOT_SETUP = 0, + TDLS_SETUP_INPROGRESS, + TDLS_SETUP_COMPLETE, + TDLS_SETUP_FAILURE, + TDLS_TEAR_DOWN, + TDLS_SWITCHING_CHANNEL, + TDLS_IN_BASE_CHANNEL, + TDLS_IN_OFF_CHANNEL, +} tdlsStatus_e; /** station node */ typedef struct _sta_node sta_node; @@ -1236,6 +1271,32 @@ struct _sta_node { t_u16 rx_seq[MAX_NUM_TID]; /** max amsdu size */ t_u16 max_amsdu; + /** tdls status */ + tdlsStatus_e status; + /** SNR */ + t_s8 snr; + /** Noise Floor */ + t_s8 nf; + /** flag for host based tdls */ + t_u8 external_tdls; + /** peer capability */ + t_u16 capability; + /** peer support rates */ + t_u8 support_rate[32]; + /** rate size */ + t_u8 rate_len; + /* Qos capability info */ + t_u8 qos_info; + /** HT cap */ + IEEEtypes_HTCap_t HTcap; + /** HT info in TDLS setup confirm*/ + IEEEtypes_HTInfo_t HTInfo; + /** peer BSSCO_20_40*/ + IEEEtypes_2040BSSCo_t BSSCO_20_40; + /* Extended capability */ + IEEEtypes_ExtCap_t ExtCap; + /* RSN IE */ + IEEEtypes_Generic_t rsn_ie; /** wapi key on off flag */ t_u8 wapi_key_on; /** tx pause status */ @@ -1303,7 +1364,9 @@ typedef struct { t_bool dfs_radar_found; /** Channel radar is being checked on. BAND_A is assumed. */ t_u8 dfs_check_channel; - /** Timestamp when we got last report, to determine if data is old or not. */ + /** Timestamp when we got last report, + * to determine if data is old or not. + */ t_u32 dfs_report_time_sec; /** List for holding dfs_timestamps for NOP/CAC events */ mlan_list_head dfs_ts_head; @@ -1728,6 +1791,8 @@ typedef struct _mlan_adapter { sleep_params_t sleep_params; /** sleep_period_t (Enhanced Power Save) */ sleep_period_t sleep_period; + /** saved sleep_period_t (Enhanced Power Save) */ + sleep_period_t saved_sleep_period; /** Power Save mode */ /** @@ -1840,22 +1905,18 @@ typedef struct _mlan_adapter { t_u8 *pcal_data; /** Cal data length */ t_u32 cal_data_len; - /** Feature control bitmask */ - t_u32 feature_control; + /** tdls status */ + /* TDLS_NOT_SETUP|TDLS_SWITCHING_CHANNEL|TDLS_IN_BASE_CHANNEL|TDLS_IN_SWITCH_CHANNEL */ + tdlsStatus_e tdls_status; } mlan_adapter, *pmlan_adapter; -/** Check if stream 2X2 enabled */ -#define IS_STREAM_2X2(x) ((x) & FEATURE_CTRL_STREAM_2X2) -/** Check if DFS support enabled */ -#define IS_DFS_SUPPORT(x) ((x) & FEATURE_CTRL_DFS_SUPPORT) - /** Ethernet packet type for EAPOL */ #define MLAN_ETHER_PKT_TYPE_EAPOL (0x888E) /** Ethernet packet type for WAPI */ -#define MLAN_ETHER_PKT_TYPE_WAPI (0x88B4) +#define MLAN_ETHER_PKT_TYPE_WAPI (0x88B4) /** Ethernet packet type offset */ -#define MLAN_ETHER_PKT_TYPE_OFFSET (12) +#define MLAN_ETHER_PKT_TYPE_OFFSET (12) mlan_status wlan_init_lock_list(IN pmlan_adapter pmadapter); t_void wlan_free_lock_list(IN pmlan_adapter pmadapter); @@ -1896,7 +1957,7 @@ mlan_status wlan_prepare_cmd(IN pmlan_private priv, IN t_void * pioctl_buf, IN t_void * pdata_buf); /** cmd timeout handler */ -t_void wlan_cmd_timeout_func(t_void * FunctionContext); +t_void wlan_cmd_timeout_func(t_void * function_context); /** process host cmd */ mlan_status wlan_misc_ioctl_host_cmd(IN pmlan_adapter pmadapter, IN pmlan_ioctl_req pioctl_req); @@ -2432,12 +2493,86 @@ t_u8 wlan_is_wmm_ie_present(pmlan_adapter pmadapter, t_u8 * pbuf, t_u16 buf_len); /** + * @brief This function checks whether a station TDLS link is enabled or not + * + * @param priv A pointer to mlan_private + * @param mac station mac address + * @return TDLS_NOT_SETUP/TDLS_SETUP_INPROGRESS/TDLS_SETUP_COMPLETE/TDLS_SETUP_FAILURE/TDLS_TEAR_DOWN + */ +static INLINE tdlsStatus_e +wlan_get_tdls_link_status(mlan_private * priv, t_u8 * mac) +{ + sta_node *sta_ptr = MNULL; + sta_ptr = wlan_get_station_entry(priv, mac); + if (sta_ptr) { + return sta_ptr->status; + } + return TDLS_NOT_SETUP; +} + +/** + * @brief This function checks if TDLS link is in channel switching + * + * @param status tdls link status + * @return MTRUE/MFALSE + */ +static INLINE int +wlan_is_tdls_link_chan_switching(tdlsStatus_e status) +{ + return (status == TDLS_SWITCHING_CHANNEL) ? MTRUE : MFALSE; +} + +/** + * @brief This function checks if send command to firmware is allowed + * + * @param status tdls link status + * @return MTRUE/MFALSE + */ +static INLINE int +wlan_is_send_cmd_allowed(tdlsStatus_e status) +{ + int ret = MTRUE; + switch (status) { + case TDLS_SWITCHING_CHANNEL: + case TDLS_IN_OFF_CHANNEL: + ret = MFALSE; + break; + default: + break; + } + return ret; +} + +/** + * @brief This function checks if TDLS link is setup + * + * @param status tdls link status + * @return MTRUE/MFALSE + */ +static INLINE int +wlan_is_tdls_link_setup(tdlsStatus_e status) +{ + int ret = MFALSE; + switch (status) { + case TDLS_SWITCHING_CHANNEL: + case TDLS_IN_OFF_CHANNEL: + case TDLS_IN_BASE_CHANNEL: + case TDLS_SETUP_COMPLETE: + ret = MTRUE; + break; + default: + break; + } + return ret; +} + +/** * @brief This function checks tx_pause flag for peer * * @param priv A pointer to mlan_private * @param ra Address of the receiver STA * - * @return MTRUE or MFALSE + * @return MTRUE or MFALSE */ static int INLINE wlan_is_tx_pause(mlan_private * priv, t_u8 * ra) @@ -2517,6 +2652,20 @@ mlan_status wlan_cmd_reg_access(IN HostCmd_DS_COMMAND * cmd, mlan_status wlan_cmd_mem_access(IN HostCmd_DS_COMMAND * cmd, IN t_u16 cmd_action, IN t_void * pdata_buf); +int wlan_get_tdls_list(mlan_private * priv, tdls_peer_info * buf); +t_void wlan_hold_tdls_packets(pmlan_private priv, t_u8 * mac); +t_void wlan_restore_tdls_packets(pmlan_private priv, t_u8 * mac, + tdlsStatus_e status); +t_void wlan_update_non_tdls_ralist(mlan_private * priv, t_u8 * mac, + t_u8 tx_pause); +mlan_status wlan_misc_ioctl_tdls_config(IN pmlan_adapter pmadapter, + IN pmlan_ioctl_req pioctl_req); +mlan_status wlan_misc_ioctl_tdls_oper(IN pmlan_adapter pmadapter, + IN pmlan_ioctl_req pioctl_req); + +mlan_status +wlan_misc_ioctl_tdls_get_ies(IN pmlan_adapter pmadapter, + IN pmlan_ioctl_req pioctl_req); mlan_status wlan_get_info_ver_ext(IN pmlan_adapter pmadapter, IN pmlan_ioctl_req pioctl_req); @@ -2548,9 +2697,9 @@ mlan_status wlan_misc_ioctl_txcontrol(IN pmlan_adapter pmadapter, /** * @brief RA based queueing * - * @param priv A pointer to mlan_private structure + * @param priv A pointer to mlan_private structure * - * @return MTRUE or MFALSE + * @return MTRUE or MFALSE */ static INLINE t_u8 queuing_ra_based(pmlan_private priv) @@ -2569,12 +2718,12 @@ queuing_ra_based(pmlan_private priv) /** * @brief Copy Rates * - * @param dest A pointer to Dest Buf + * @param dest A pointer to Dest Buf * @param pos The position for copy * @param src A pointer to Src Buf - * @param len The len of Src Buf + * @param len The len of Src Buf * - * @return Number of Rates copied + * @return Number of Rates copied */ static INLINE t_u32 wlan_copy_rates(t_u8 * dest, t_u32 pos, t_u8 * src, int len) @@ -2595,7 +2744,7 @@ wlan_copy_rates(t_u8 * dest, t_u32 pos, t_u8 * src, int len) * * @param str A pointer to string * - * @return Length of string + * @return Length of string */ static INLINE t_u32 wlan_strlen(const char *str) @@ -2652,10 +2801,11 @@ t_void wlan_delay_func(mlan_adapter * pmadapter, t_u32 delay, t_delay_unit u); #define wlan_udelay(p, n) wlan_delay_func(p, n, USEC) /** Function to check if any command is pending in the queue */ -#define IS_COMMAND_PENDING(pmadapter) ((cmd_ctrl_node *)util_peek_list(pmadapter->pmoal_handle, \ - &pmadapter->cmd_pending_q,\ - pmadapter->callbacks.moal_spin_lock,\ - pmadapter->callbacks.moal_spin_unlock)) +#define IS_COMMAND_PENDING(pmadapter) \ + ((cmd_ctrl_node *)util_peek_list(pmadapter->pmoal_handle, \ + &pmadapter->cmd_pending_q,\ + pmadapter->callbacks.moal_spin_lock,\ + pmadapter->callbacks.moal_spin_unlock)) /** Get BSS number from priv */ #define GET_BSS_NUM(priv) ((priv)->bss_num) @@ -2814,9 +2964,8 @@ wlan_get_privs_by_cond(mlan_adapter * pmadapter, for (i = 0; i < pmadapter->priv_num; i++) { pmpriv = pmadapter->priv[i]; if (pmpriv) { - if (check_cond(pmpriv)) { + if (check_cond(pmpriv)) ppriv_list[count++] = pmpriv; - } } } @@ -2861,13 +3010,11 @@ wlan_get_privs_by_two_cond(mlan_adapter * pmadapter, pmpriv = pmadapter->priv[i]; if (pmpriv) { if (and_conditions) { - if (check_cond(pmpriv) && check_cond_2(pmpriv)) { + if (check_cond(pmpriv) && check_cond_2(pmpriv)) ppriv_list[count++] = pmpriv; - } } else { - if (check_cond(pmpriv) || check_cond_2(pmpriv)) { + if (check_cond(pmpriv) || check_cond_2(pmpriv)) ppriv_list[count++] = pmpriv; - } } } } diff --git a/drivers/net/wireless/sd8797/mlan/mlan_meas.c b/drivers/net/wireless/sd8797/mlan/mlan_meas.c index dd642bbcd281..019eea0941bc 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_meas.c +++ b/drivers/net/wireless/sd8797/mlan/mlan_meas.c @@ -11,20 +11,25 @@ * Requires use of the following preprocessor define: * - ENABLE_MEAS * - * Copyright (C) 2008-2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved + * + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. + * */ /************************************************************* diff --git a/drivers/net/wireless/sd8797/mlan/mlan_meas.h b/drivers/net/wireless/sd8797/mlan/mlan_meas.h index fea172cb374f..c39ccc37762e 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_meas.h +++ b/drivers/net/wireless/sd8797/mlan/mlan_meas.h @@ -8,20 +8,24 @@ * * @sa mlan_meas.c * - * Copyright (C) 2008-2011, Marvell International Ltd. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * */ diff --git a/drivers/net/wireless/sd8797/mlan/mlan_misc.c b/drivers/net/wireless/sd8797/mlan/mlan_misc.c index f3208576afea..45e5b1380126 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_misc.c +++ b/drivers/net/wireless/sd8797/mlan/mlan_misc.c @@ -1,22 +1,27 @@ /** * @file mlan_misc.c * - * @brief This file include miscellaneous functions for MLAN module - * - * Copyright (C) 2009-2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. + * @brief This file include Miscellaneous functions for MLAN module + * + * (C) Copyright 2009-2011 Marvell International Ltd. All Rights Reserved + * + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. + * */ /************************************************************* @@ -58,7 +63,7 @@ extern t_u8 ac_to_tid[4][2]; /** Custom IE mask for delete operation */ #define MLAN_CUSTOM_IE_DELETE_MASK 0 /** Custom IE mask for create new index */ -#define MLAN_CUSTOM_IE_NEW_MASK 0x8000 +#define MLAN_CUSTOM_IE_NEW_MASK 0x8000 /** Custom IE header size */ #define MLAN_CUSTOM_IE_HDR_SIZE (sizeof(custom_ie)-MAX_IE_SIZE) @@ -488,6 +493,8 @@ wlan_get_info_debug_info(IN pmlan_adapter pmadapter, wlan_get_rxreorder_tbl(pmpriv, debug_info->rx_tbl); debug_info->tx_tbl_num = wlan_get_txbastream_tbl(pmpriv, debug_info->tx_tbl); + debug_info->tdls_peer_num = + wlan_get_tdls_list(pmpriv, debug_info->tdls_peer_list); debug_info->ps_mode = pmadapter->ps_mode; debug_info->ps_state = pmadapter->ps_state; #ifdef STA_SUPPORT @@ -600,7 +607,10 @@ wlan_get_info_debug_info(IN pmlan_adapter pmadapter, #endif debug_info->mlan_processing = pmadapter->mlan_processing; debug_info->mlan_rx_processing = pmadapter->mlan_rx_processing; - + debug_info->rx_pkts_queued = + util_scalar_read(pmadapter->pmoal_handle, + &pmadapter->rx_pkts_queued, MNULL, + MNULL); debug_info->mlan_adapter = pmadapter; debug_info->mlan_adapter_size = sizeof(mlan_adapter); debug_info->mlan_priv_num = pmadapter->priv_num; @@ -914,11 +924,10 @@ wlan_delay_func(mlan_adapter * pmadapter, t_u32 delay, t_delay_unit u) ENTER(); if (pcb->moal_udelay) { - if (u == SEC) { + if (u == SEC) delay *= 1000000; - } else if (u == MSEC) { + else if (u == MSEC) delay *= 1000; - } pcb->moal_udelay(pmadapter->pmoal_handle, delay); } else { @@ -1150,9 +1159,8 @@ wlan_misc_ioctl_custom_ie_list(IN pmlan_adapter pmadapter, index); /* if IE to delete is not found, return error */ - if (ret == MLAN_STATUS_FAILURE) { + if (ret == MLAN_STATUS_FAILURE) goto done; - } index = ie_data->ie_index; memset(pmadapter, ie_data, 0, sizeof(custom_ie) * @@ -1267,9 +1275,8 @@ wlan_misc_ioctl_custom_ie_list(IN pmlan_adapter pmadapter, index); /* if IE to delete is not found, return error */ - if (ret == MLAN_STATUS_FAILURE) { + if (ret == MLAN_STATUS_FAILURE) goto done; - } memset(pmadapter, ie_data, 0, sizeof(custom_ie) * MAX_MGMT_IE_INDEX_TO_FW); @@ -1535,7 +1542,7 @@ wlan_is_station_list_empty(mlan_private * priv) /** * @brief This function will return the pointer to station entry in station list - * table which matches the give mac address + * table which matches the give mac address * * @param priv A pointer to mlan_private * @param mac mac address to find in station list table @@ -1578,7 +1585,7 @@ wlan_get_station_entry(mlan_private * priv, t_u8 * mac) /** * @brief This function will add a pointer to station entry in station list - * table with the give mac address, if it does not exist already + * table with the give mac address, if it does not exist already * * @param priv A pointer to mlan_private * @param mac mac address to find in station list table @@ -1678,6 +1685,385 @@ wlan_delete_station_list(pmlan_private priv) } /** + * @brief Get tdls peer list + * + * @param priv A pointer to mlan_private structure + * @param buf A pointer to tdls_peer_info buf + * @return number of tdls peer + */ +int +wlan_get_tdls_list(mlan_private * priv, tdls_peer_info * buf) +{ + tdls_peer_info *peer_info = buf; + sta_node *sta_ptr = MNULL; + int count = 0; + ENTER(); + if (priv->bss_type != MLAN_BSS_TYPE_STA) { + LEAVE(); + return count; + } + sta_ptr = (sta_node *) util_peek_list(priv->adapter->pmoal_handle, + &priv->sta_list, + priv->adapter->callbacks. + moal_spin_lock, + priv->adapter->callbacks. + moal_spin_unlock); + if (!sta_ptr) { + LEAVE(); + return count; + } + while (sta_ptr != (sta_node *) & priv->sta_list) { + peer_info->snr = sta_ptr->snr; + peer_info->nf = sta_ptr->nf; + memcpy(priv->adapter, peer_info->mac_addr, sta_ptr->mac_addr, + MLAN_MAC_ADDR_LENGTH); + memcpy(priv->adapter, peer_info->ht_cap, &sta_ptr->HTcap, + sizeof(IEEEtypes_HTCap_t)); + memcpy(priv->adapter, peer_info->ext_cap, &sta_ptr->ExtCap, + sizeof(IEEEtypes_ExtCap_t)); + sta_ptr = sta_ptr->pnext; + peer_info++; + count++; + if (count >= MLAN_MAX_TDLS_PEER_SUPPORTED) + break; + } + LEAVE(); + return count; +} + +/** + * @brief Set the TDLS configuration to FW. + * + * @param pmadapter A pointer to mlan_adapter structure + * @param pioctl_req A pointer to ioctl request buffer + * + * @return MLAN_STATUS_PENDING --success, otherwise fail + */ +mlan_status +wlan_misc_ioctl_tdls_config(IN pmlan_adapter pmadapter, + IN pmlan_ioctl_req pioctl_req) +{ + mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; + mlan_status ret = MLAN_STATUS_SUCCESS; + mlan_ds_misc_cfg *misc = (mlan_ds_misc_cfg *) pioctl_req->pbuf; + tdls_all_config *tdls_all_cfg = + (tdls_all_config *) misc->param.tdls_config.tdls_data; + t_u8 event_buf[100]; + mlan_event *pevent = (mlan_event *) event_buf; + tdls_tear_down_event *tdls_evt = + (tdls_tear_down_event *) pevent->event_buf; + sta_node *sta_ptr = MNULL; + + ENTER(); + + if (misc->param.tdls_config.tdls_action == WLAN_TDLS_TEAR_DOWN_REQ) { + sta_ptr = + wlan_get_station_entry(pmpriv, + tdls_all_cfg->u.tdls_tear_down. + peer_mac_addr); + if (sta_ptr && sta_ptr->external_tdls) { + pevent->bss_index = pmpriv->bss_index; + pevent->event_id = MLAN_EVENT_ID_DRV_TDLS_TEARDOWN_REQ; + pevent->event_len = sizeof(tdls_tear_down_event); + memcpy(pmpriv->adapter, + (t_u8 *) tdls_evt->peer_mac_addr, + tdls_all_cfg->u.tdls_tear_down.peer_mac_addr, + MLAN_MAC_ADDR_LENGTH); + tdls_evt->reason_code = + tdls_all_cfg->u.tdls_tear_down.reason_code; + wlan_recv_event(pmpriv, + MLAN_EVENT_ID_DRV_TDLS_TEARDOWN_REQ, + pevent); + LEAVE(); + return ret; + } + } + pioctl_req->action = MLAN_ACT_SET; + + /* Send command to firmware */ + ret = wlan_prepare_cmd(pmpriv, + HostCmd_CMD_TDLS_CONFIG, + HostCmd_ACT_GEN_SET, + 0, + (t_void *) pioctl_req, &misc->param.tdls_config); + + if (ret == MLAN_STATUS_SUCCESS) + ret = MLAN_STATUS_PENDING; + LEAVE(); + return ret; +} + +/** + * @brief Set the TDLS operation to FW. + * + * @param pmadapter A pointer to mlan_adapter structure + * @param pioctl_req A pointer to ioctl request buffer + * + * @return MLAN_STATUS_PENDING --success, otherwise fail + */ +mlan_status +wlan_misc_ioctl_tdls_oper(IN pmlan_adapter pmadapter, + IN pmlan_ioctl_req pioctl_req) +{ + mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; + mlan_status ret = MLAN_STATUS_SUCCESS; + mlan_ds_misc_cfg *misc = (mlan_ds_misc_cfg *) pioctl_req->pbuf; + mlan_ds_misc_tdls_oper *ptdls_oper = &misc->param.tdls_oper; + t_u8 event_buf[100]; + mlan_event *ptdls_event = (mlan_event *) event_buf; + tdls_tear_down_event *tdls_evt = + (tdls_tear_down_event *) ptdls_event->event_buf; + sta_node *sta_ptr = MNULL; + t_u8 i = 0; + + ENTER(); + sta_ptr = wlan_get_station_entry(pmpriv, ptdls_oper->peer_mac); + switch (ptdls_oper->tdls_action) { + case WLAN_TDLS_ENABLE_LINK: + if (sta_ptr && (sta_ptr->status != TDLS_SETUP_FAILURE)) { + PRINTM(MMSG, "TDLS: Enable link " MACSTR " success\n", + MAC2STR(ptdls_oper->peer_mac)); + sta_ptr->status = TDLS_SETUP_COMPLETE; + pmadapter->tdls_status = TDLS_IN_BASE_CHANNEL; + if (sta_ptr->HTcap.ieee_hdr.element_id == HT_CAPABILITY) { + sta_ptr->is_11n_enabled = MTRUE; + if (GETHT_MAXAMSDU + (sta_ptr->HTcap.ht_cap.ht_cap_info)) + sta_ptr->max_amsdu = + MLAN_TX_DATA_BUF_SIZE_8K; + else + sta_ptr->max_amsdu = + MLAN_TX_DATA_BUF_SIZE_4K; + for (i = 0; i < MAX_NUM_TID; i++) { + if (sta_ptr->is_11n_enabled) + sta_ptr->ampdu_sta[i] = + pmpriv-> + aggr_prio_tbl[i]. + ampdu_user; + else + sta_ptr->ampdu_sta[i] = + BA_STREAM_NOT_ALLOWED; + } + memset(pmpriv->adapter, sta_ptr->rx_seq, 0xff, + sizeof(sta_ptr->rx_seq)); + } + wlan_restore_tdls_packets(pmpriv, ptdls_oper->peer_mac, + TDLS_SETUP_COMPLETE); + } else { + PRINTM(MMSG, "TDLS: Enable link " MACSTR " fail\n", + MAC2STR(ptdls_oper->peer_mac)); + /* for supplicant 2.0, we need send event to request + teardown, **for latest supplicant, we only need + return fail, and supplicant will send teardown + packet and disable tdls link */ + if (sta_ptr) { + ptdls_event->bss_index = pmpriv->bss_index; + ptdls_event->event_id = + MLAN_EVENT_ID_DRV_TDLS_TEARDOWN_REQ; + ptdls_event->event_len = + sizeof(tdls_tear_down_event); + memcpy(pmpriv->adapter, + (t_u8 *) tdls_evt->peer_mac_addr, + ptdls_oper->peer_mac, + MLAN_MAC_ADDR_LENGTH); + tdls_evt->reason_code = + WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED; + wlan_recv_event(pmpriv, + MLAN_EVENT_ID_DRV_TDLS_TEARDOWN_REQ, + ptdls_event); + wlan_restore_tdls_packets(pmpriv, + ptdls_oper->peer_mac, + TDLS_TEAR_DOWN); + if (sta_ptr->is_11n_enabled) { + wlan_cleanup_reorder_tbl(pmpriv, + ptdls_oper-> + peer_mac); + pmadapter->callbacks. + moal_spin_lock(pmadapter-> + pmoal_handle, + pmpriv->wmm. + ra_list_spinlock); + wlan_11n_cleanup_txbastream_tbl(pmpriv, + ptdls_oper-> + peer_mac); + pmadapter->callbacks. + moal_spin_unlock(pmadapter-> + pmoal_handle, + pmpriv->wmm. + ra_list_spinlock); + } + wlan_delete_station_entry(pmpriv, + ptdls_oper->peer_mac); + if (MTRUE == wlan_is_station_list_empty(pmpriv)) + pmadapter->tdls_status = TDLS_NOT_SETUP; + else + pmadapter->tdls_status = + TDLS_IN_BASE_CHANNEL; + } + ret = MLAN_STATUS_FAILURE; + } + wlan_recv_event(pmpriv, MLAN_EVENT_ID_DRV_DEFER_HANDLING, + MNULL); + break; + case WLAN_TDLS_DISABLE_LINK: + if (sta_ptr) { + wlan_restore_tdls_packets(pmpriv, ptdls_oper->peer_mac, + TDLS_TEAR_DOWN); + if (sta_ptr->is_11n_enabled) { + wlan_cleanup_reorder_tbl(pmpriv, + ptdls_oper->peer_mac); + pmadapter->callbacks.moal_spin_lock(pmadapter-> + pmoal_handle, + pmpriv->wmm. + ra_list_spinlock); + wlan_11n_cleanup_txbastream_tbl(pmpriv, + ptdls_oper-> + peer_mac); + pmadapter->callbacks. + moal_spin_unlock(pmadapter-> + pmoal_handle, + pmpriv->wmm. + ra_list_spinlock); + } + if (sta_ptr->status >= TDLS_SETUP_INPROGRESS) + wlan_delete_station_entry(pmpriv, + ptdls_oper->peer_mac); + } + if (MTRUE == wlan_is_station_list_empty(pmpriv)) + pmadapter->tdls_status = TDLS_NOT_SETUP; + else + pmadapter->tdls_status = TDLS_IN_BASE_CHANNEL; + /* Send command to firmware to delete tdls link */ + ret = wlan_prepare_cmd(pmpriv, + HostCmd_CMD_TDLS_OPERATION, + HostCmd_ACT_GEN_SET, + 0, (t_void *) pioctl_req, ptdls_oper); + if (ret == MLAN_STATUS_SUCCESS) + ret = MLAN_STATUS_PENDING; + break; + case WLAN_TDLS_CREATE_LINK: + PRINTM(MIOCTL, "CREATE TDLS LINK\n"); + if (sta_ptr && sta_ptr->status == TDLS_SETUP_INPROGRESS) { + PRINTM(MIOCTL, "We already create the link\n"); + break; + } + if (!sta_ptr) + sta_ptr = + wlan_add_station_entry(pmpriv, + misc->param.tdls_oper. + peer_mac); + if (sta_ptr) { + sta_ptr->status = TDLS_SETUP_INPROGRESS; + sta_ptr->external_tdls = MTRUE; + wlan_hold_tdls_packets(pmpriv, + misc->param.tdls_oper.peer_mac); + } + ret = wlan_prepare_cmd(pmpriv, + HostCmd_CMD_TDLS_OPERATION, + HostCmd_ACT_GEN_SET, + 0, (t_void *) pioctl_req, ptdls_oper); + if (ret == MLAN_STATUS_SUCCESS) + ret = MLAN_STATUS_PENDING; + break; + case WLAN_TDLS_CONFIG_LINK: + if (!sta_ptr || sta_ptr->status == TDLS_SETUP_FAILURE) { + PRINTM(MERROR, "Can not CONFIG TDLS Link\n"); + ret = MLAN_STATUS_FAILURE; + break; + } + ret = wlan_prepare_cmd(pmpriv, + HostCmd_CMD_TDLS_OPERATION, + HostCmd_ACT_GEN_SET, + 0, (t_void *) pioctl_req, ptdls_oper); + if (ret == MLAN_STATUS_SUCCESS) + ret = MLAN_STATUS_PENDING; + break; + default: + break; + } + LEAVE(); + return ret; +} + +/** + * @brief Set the TDLS operation to FW. + * + * @param pmadapter A pointer to mlan_adapter structure + * @param pioctl_req A pointer to ioctl request buffer + * + * @return MLAN_STATUS_PENDING --success, otherwise fail + */ +mlan_status +wlan_misc_ioctl_tdls_get_ies(IN pmlan_adapter pmadapter, + IN pmlan_ioctl_req pioctl_req) +{ + mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; + mlan_ds_misc_cfg *misc = (mlan_ds_misc_cfg *) pioctl_req->pbuf; + mlan_ds_misc_tdls_ies *tdls_ies = &misc->param.tdls_ies; + mlan_status ret = MLAN_STATUS_SUCCESS; + BSSDescriptor_t *pbss_desc; + t_u32 usr_dot_11n_dev_cap; + IEEEtypes_ExtCap_t *ext_cap = MNULL; + IEEEtypes_HTCap_t *ht_cap = MNULL; + IEEEtypes_HTInfo_t *ht_info = MNULL; + sta_node *sta_ptr = MNULL; + ENTER(); + + sta_ptr = wlan_get_station_entry(pmpriv, tdls_ies->peer_mac); + pbss_desc = &pmpriv->curr_bss_params.bss_descriptor; + if (pbss_desc->bss_band & BAND_A) + usr_dot_11n_dev_cap = pmadapter->usr_dot_11n_dev_cap_a; + else + usr_dot_11n_dev_cap = pmadapter->usr_dot_11n_dev_cap_bg; + + /** fill the extcap */ + if (tdls_ies->flags & TDLS_IE_FLAGS_EXTCAP) { + ext_cap = (IEEEtypes_ExtCap_t *) tdls_ies->ext_cap; + ext_cap->ieee_hdr.element_id = EXT_CAPABILITY; + ext_cap->ieee_hdr.len = sizeof(ExtCap_t); + SET_EXTCAP_TDLS(ext_cap->ext_cap); + // TODO UAPSD need be enabled + RESET_EXTCAP_TDLS_UAPSD(ext_cap->ext_cap); + RESET_EXTCAP_TDLS_CHAN_SWITCH(ext_cap->ext_cap); + DBG_HEXDUMP(MCMD_D, "TDLS extcap", tdls_ies->ext_cap, + sizeof(IEEEtypes_ExtCap_t)); + } + + /** fill the htcap based on hwspec */ + if (tdls_ies->flags & TDLS_IE_FLAGS_HTCAP) { + ht_cap = (IEEEtypes_HTCap_t *) tdls_ies->ht_cap; + memset(pmadapter, ht_cap, 0, sizeof(IEEEtypes_HTCap_t)); + wlan_fill_ht_cap_ie(pmpriv, ht_cap, pbss_desc->bss_band); + DBG_HEXDUMP(MCMD_D, "TDLS htcap", tdls_ies->ht_cap, + sizeof(IEEEtypes_HTCap_t)); + } + /** fill the htinfo */ + if (tdls_ies->flags & TDLS_IE_FLAGS_HTINFO) { + ht_info = (IEEEtypes_HTInfo_t *) tdls_ies->ht_info; + pbss_desc = &pmpriv->curr_bss_params.bss_descriptor; + ht_info->ieee_hdr.element_id = HT_OPERATION; + ht_info->ieee_hdr.len = sizeof(HTInfo_t); + ht_info->ht_info.pri_chan = pbss_desc->channel; + /* follow AP's channel bandwidth */ + if (ISSUPP_CHANWIDTH40(usr_dot_11n_dev_cap) && + pbss_desc->pht_info && + ISALLOWED_CHANWIDTH40(pbss_desc->pht_info->ht_info. + field2)) { + ht_info->ht_info.field2 = + pbss_desc->pht_info->ht_info.field2; + } + if (sta_ptr) + memcpy(pmadapter, &sta_ptr->HTInfo, tdls_ies->ht_info, + sizeof(IEEEtypes_HTInfo_t)); + DBG_HEXDUMP(MCMD_D, "TDLS htinfo", tdls_ies->ht_info, + sizeof(IEEEtypes_HTInfo_t)); + } + + LEAVE(); + return ret; +} + +/** * @brief Get extended version information * * @param pmadapter A pointer to mlan_adapter structure @@ -2232,69 +2618,43 @@ wlan_radio_ioctl_ant_cfg(IN pmlan_adapter pmadapter, mlan_ds_radio_cfg *radio_cfg = MNULL; t_u16 cmd_action = 0; mlan_ds_ant_cfg *ant_cfg = MNULL; - t_u16 *ant_cfg_1x1 = MNULL; ENTER(); radio_cfg = (mlan_ds_radio_cfg *) pioctl_req->pbuf; - if (IS_STREAM_2X2(pmadapter->feature_control)) - ant_cfg = &radio_cfg->param.ant_cfg; + ant_cfg = &radio_cfg->param.ant_cfg; if (pioctl_req->action == MLAN_ACT_SET) { /* User input validation */ - if (IS_STREAM_2X2(pmadapter->feature_control)) { - if (!ant_cfg->tx_antenna || - ant_cfg->tx_antenna & ~RF_ANTENNA_MASK(pmadapter-> - number_of_antenna)) - { + if (!ant_cfg->tx_antenna || + ant_cfg->tx_antenna & ~RF_ANTENNA_MASK(pmadapter-> + number_of_antenna)) { + PRINTM(MERROR, "Invalid antenna setting\n"); + pioctl_req->status_code = MLAN_ERROR_INVALID_PARAMETER; + ret = MLAN_STATUS_FAILURE; + goto exit; + } + if (ant_cfg->rx_antenna) { + if (ant_cfg-> + rx_antenna & ~RF_ANTENNA_MASK(pmadapter-> + number_of_antenna)) { PRINTM(MERROR, "Invalid antenna setting\n"); pioctl_req->status_code = MLAN_ERROR_INVALID_PARAMETER; ret = MLAN_STATUS_FAILURE; goto exit; } - if (ant_cfg->rx_antenna) { - if (ant_cfg-> - rx_antenna & ~RF_ANTENNA_MASK(pmadapter-> - number_of_antenna)) - { - PRINTM(MERROR, - "Invalid antenna setting\n"); - pioctl_req->status_code = - MLAN_ERROR_INVALID_PARAMETER; - ret = MLAN_STATUS_FAILURE; - goto exit; - } - } else - ant_cfg->rx_antenna = ant_cfg->tx_antenna; - } else if ((!radio_cfg->param.antenna || - radio_cfg->param. - antenna & ~RF_ANTENNA_MASK(pmadapter-> - number_of_antenna)) && - (radio_cfg->param.antenna != RF_ANTENNA_AUTO || - pmadapter->number_of_antenna <= 1)) { - PRINTM(MERROR, "Invalid antenna setting\n"); - pioctl_req->status_code = MLAN_ERROR_INVALID_PARAMETER; - ret = MLAN_STATUS_FAILURE; - goto exit; - } + } else + ant_cfg->rx_antenna = ant_cfg->tx_antenna; cmd_action = HostCmd_ACT_GEN_SET; } else cmd_action = HostCmd_ACT_GEN_GET; - /* Cast it to t_u16, antenna mode for command - HostCmd_CMD_802_11_RF_ANTENNA requires 2 bytes */ - if (!IS_STREAM_2X2(pmadapter->feature_control)) - ant_cfg_1x1 = (t_u16 *) & radio_cfg->param.antenna; - /* Send request to firmware */ ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_802_11_RF_ANTENNA, cmd_action, - 0, - (t_void *) pioctl_req, - (IS_STREAM_2X2(pmadapter->feature_control)) ? - (t_void *) ant_cfg : (t_void *) ant_cfg_1x1); + 0, (t_void *) pioctl_req, (t_void *) ant_cfg); if (ret == MLAN_STATUS_SUCCESS) ret = MLAN_STATUS_PENDING; diff --git a/drivers/net/wireless/sd8797/mlan/mlan_module.c b/drivers/net/wireless/sd8797/mlan/mlan_module.c index c73d8d7c6a5d..cce1d026ca80 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_module.c +++ b/drivers/net/wireless/sd8797/mlan/mlan_module.c @@ -2,20 +2,25 @@ * * @brief This file declares the exported symbols from MLAN. * - * Copyright (C) 2008-2011, Marvell International Ltd. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. */ /****************************************************** @@ -44,5 +49,5 @@ EXPORT_SYMBOL(mlan_interrupt); MODULE_DESCRIPTION("M-WLAN MLAN Driver"); MODULE_AUTHOR("Marvell International Ltd."); MODULE_VERSION(MLAN_RELEASE_VERSION); -MODULE_LICENSE("GPL"); +MODULE_LICENSE("Marvell Proprietary"); #endif /* LINUX */ diff --git a/drivers/net/wireless/sd8797/mlan/mlan_scan.c b/drivers/net/wireless/sd8797/mlan/mlan_scan.c index b74bd01b3b01..ff1da1114006 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_scan.c +++ b/drivers/net/wireless/sd8797/mlan/mlan_scan.c @@ -5,20 +5,25 @@ * IOCTL handlers as well as command preparation and response routines * for sending scan commands to the firmware. * - * Copyright (C) 2008-2012, Marvell International Ltd. + * (C) Copyright 2008-2012 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. */ /****************************************************** @@ -153,7 +158,7 @@ search_oui_in_ie(mlan_adapter * pmadapter, IEBody * ie_body, t_u8 * oui) } } - PRINTM(MINFO, "The OUI %x:%x:%x:%x is not found in PTK \n", oui[0], + PRINTM(MINFO, "The OUI %x:%x:%x:%x is not found in PTK\n", oui[0], oui[1], oui[2], oui[3]); LEAVE(); return MLAN_OUI_NOT_PRESENT; @@ -863,13 +868,11 @@ wlan_scan_channel_list(IN mlan_private * pmpriv, LEAVE(); - if (ptlv_temp) { + if (ptlv_temp) pcb->moal_mfree(pmadapter->pmoal_handle, ptlv_temp); - } - if (ret) { + if (ret) return MLAN_STATUS_FAILURE; - } return MLAN_STATUS_SUCCESS; } @@ -1042,9 +1045,8 @@ wlan_scan_setup_scan_config(IN mlan_private * pmpriv, pwildcard_ssid_tlv->ssid, pwildcard_ssid_tlv->max_ssid_length); - if (ssid_len) { + if (ssid_len) ssid_filter = MTRUE; - } } /* @@ -1479,11 +1481,10 @@ wlan_interpret_bss_desc_with_ie(IN pmlan_adapter pmadapter, pbss_entry->privacy = Wlan802_11PrivFilterAcceptAll; } - if (pcap_info->ibss == 1) { + if (pcap_info->ibss == 1) pbss_entry->bss_mode = MLAN_BSS_MODE_IBSS; - } else { + else pbss_entry->bss_mode = MLAN_BSS_MODE_INFRA; - } if (pcap_info->spectrum_mgmt == 1) { PRINTM(MINFO, "InterpretIE: 11h- Spectrum Management " @@ -3105,9 +3106,8 @@ wlan_scan_networks(IN mlan_private * pmpriv, return MLAN_STATUS_FAILURE; } - if (puser_scan_in) { + if (puser_scan_in) keep_previous_scan = puser_scan_in->keep_previous_scan; - } if (keep_previous_scan == MFALSE) { memset(pmadapter, pmadapter->pscan_table, 0x00, @@ -3265,11 +3265,10 @@ wlan_ret_802_11_scan(IN mlan_private * pmpriv, pcb = (pmlan_callbacks) & pmadapter->callbacks; is_bgscan_resp = (resp->command == HostCmd_CMD_802_11_BG_SCAN_QUERY); - if (is_bgscan_resp) { + if (is_bgscan_resp) pscan_rsp = &resp->params.bg_scan_query_resp.scan_resp; - } else { + else pscan_rsp = &resp->params.scan_resp; - } if (pscan_rsp->number_of_sets > MRVDRV_MAX_BSSID_LIST) { PRINTM(MERROR, @@ -3445,11 +3444,10 @@ wlan_ret_802_11_scan(IN mlan_private * pmpriv, if (bss_idx == num_in_table) { /* Range check the bss_idx, keep it limited to the last entry */ - if (bss_idx == MRVDRV_MAX_BSSID_LIST) { + if (bss_idx == MRVDRV_MAX_BSSID_LIST) bss_idx--; - } else { + else num_in_table++; - } } /* @@ -3893,11 +3891,10 @@ wlan_parse_ext_scan_result(IN mlan_private * pmpriv, if (bss_idx == num_in_table) { /* Range check the bss_idx, keep it limited to the last entry */ - if (bss_idx == MRVDRV_MAX_BSSID_LIST) { + if (bss_idx == MRVDRV_MAX_BSSID_LIST) bss_idx--; - } else { + else num_in_table++; - } } /* @@ -4469,13 +4466,14 @@ wlan_cmd_bgscan_config(IN mlan_private * pmpriv, sizeof(MrvlIEtypesHeader_t) + sizeof(ChanScanParamSet_t) * chan_num; } + tlv_start_later = (MrvlIEtypes_StartLater_t *) tlv; tlv_start_later->header.type = wlan_cpu_to_le16(TLV_TYPE_STARTBGSCANLATER); tlv_start_later->header.len = wlan_cpu_to_le16(sizeof(MrvlIEtypes_StartLater_t) - sizeof(MrvlIEtypesHeader_t)); - tlv_start_later->value = 0; + tlv_start_later->value = wlan_cpu_to_le16(bg_scan_in->start_later); tlv += sizeof(MrvlIEtypes_StartLater_t); cmd_size += sizeof(MrvlIEtypes_StartLater_t); done: @@ -4617,9 +4615,8 @@ wlan_find_ssid_in_list(IN mlan_private * pmpriv, net = i; } } else { - if (net == -1) { + if (net == -1) net = j; - } } break; case MLAN_BSS_MODE_AUTO: diff --git a/drivers/net/wireless/sd8797/mlan/mlan_sdio.c b/drivers/net/wireless/sd8797/mlan/mlan_sdio.c index 5bd6bc1916eb..8d8fa6974e8b 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_sdio.c +++ b/drivers/net/wireless/sd8797/mlan/mlan_sdio.c @@ -2,20 +2,25 @@ * * @brief This file contains SDIO specific code * - * Copyright (C) 2008-2011, Marvell International Ltd. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. */ /******************************************************** @@ -50,8 +55,8 @@ Change log: /** * @brief This function initialize the SDIO port * - * @param pmadapter A pointer to mlan_adapter structure - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @param pmadapter A pointer to mlan_adapter structure + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_sdio_init_ioport(mlan_adapter * pmadapter) @@ -120,7 +125,7 @@ wlan_sdio_init_ioport(mlan_adapter * pmadapter) * @param pmadapter A pointer to mlan_adapter structure * @param pmbuf A pointer to mlan_buffer (pmbuf->data_len should include SDIO header) * @param port Port - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_write_data_sync(mlan_adapter * pmadapter, mlan_buffer * pmbuf, t_u32 port) @@ -162,7 +167,7 @@ exit: * * @param pmadapter A pointer to mlan_adapter structure * @param pport A pointer to port number - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_get_rd_port(mlan_adapter * pmadapter, t_u8 * pport) @@ -210,7 +215,7 @@ wlan_get_rd_port(mlan_adapter * pmadapter, t_u8 * pport) * * @param pmadapter A pointer to mlan_adapter structure * @param pport A pointer to port number - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_get_wr_port_data(mlan_adapter * pmadapter, t_u8 * pport) @@ -259,8 +264,8 @@ wlan_get_wr_port_data(mlan_adapter * pmadapter, t_u8 * pport) * @brief This function polls the card status register. * * @param pmadapter A pointer to mlan_adapter structure - * @param bits the bit mask - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @param bits the bit mask + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_sdio_poll_card_status(mlan_adapter * pmadapter, t_u8 bits) @@ -294,9 +299,9 @@ wlan_sdio_poll_card_status(mlan_adapter * pmadapter, t_u8 bits) /** * @brief This function reads firmware status registers * - * @param pmadapter A pointer to mlan_adapter structure - * @param dat A pointer to keep returned data - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @param pmadapter A pointer to mlan_adapter structure + * @param dat A pointer to keep returned data + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_sdio_read_fw_status(mlan_adapter * pmadapter, t_u16 * dat) @@ -327,8 +332,8 @@ wlan_sdio_read_fw_status(mlan_adapter * pmadapter, t_u16 * dat) /** @brief This function disables the host interrupts mask. * * @param pmadapter A pointer to mlan_adapter structure - * @param mask the interrupt mask - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @param mask the interrupt mask + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_sdio_disable_host_int_mask(pmlan_adapter pmadapter, t_u8 mask) @@ -366,7 +371,7 @@ wlan_sdio_disable_host_int_mask(pmlan_adapter pmadapter, t_u8 mask) * * @param pmadapter A pointer to mlan_adapter structure * @param mask the interrupt mask - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_sdio_enable_host_int_mask(pmlan_adapter pmadapter, t_u8 mask) @@ -392,12 +397,12 @@ wlan_sdio_enable_host_int_mask(pmlan_adapter pmadapter, t_u8 mask) * @brief This function reads data from the card. * * @param pmadapter A pointer to mlan_adapter structure - * @param type A pointer to keep type as data or command - * @param nb A pointer to keep the data/cmd length returned in buffer - * @param pmbuf A pointer to the SDIO data/cmd buffer - * @param npayload the length of data/cmd buffer - * @param ioport the SDIO ioport - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @param type A pointer to keep type as data or command + * @param nb A pointer to keep the data/cmd length returned in buffer + * @param pmbuf A pointer to the SDIO data/cmd buffer + * @param npayload the length of data/cmd buffer + * @param ioport the SDIO ioport + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_sdio_card_to_host(mlan_adapter * pmadapter, @@ -571,9 +576,8 @@ wlan_prog_fw_w_helper(IN pmlan_adapter pmadapter, IN pmlan_fw_image pmfw) i = 0; /* Set blocksize to transfer - checking for last block */ - if (firmwarelen && firmwarelen - offset < txlen) { + if (firmwarelen && firmwarelen - offset < txlen) txlen = firmwarelen - offset; - } PRINTM(MINFO, "."); tx_blocks = @@ -630,7 +634,7 @@ done: * @brief This function disables the host interrupts. * * @param pmadapter A pointer to mlan_adapter structure - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_disable_host_int(pmlan_adapter pmadapter) @@ -650,13 +654,13 @@ wlan_disable_host_int(pmlan_adapter pmadapter) * @param pmadapter A pointer to mlan_adapter structure * @param pmbuf A pointer to the SDIO data/cmd buffer * @param upld_typ Type of rx packet - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ static mlan_status wlan_decode_rx_packet(mlan_adapter * pmadapter, mlan_buffer * pmbuf, t_u32 upld_typ) { - t_u8 *cmdBuf; + t_u8 *cmd_buf; t_u32 event; ENTER(); @@ -690,7 +694,7 @@ wlan_decode_rx_packet(mlan_adapter * pmadapter, mlan_buffer * pmbuf, PRINTM(MINFO, "--- Rx: Cmd Response ---\n"); /* take care of curr_cmd = NULL case */ if (!pmadapter->curr_cmd) { - cmdBuf = pmadapter->upld_buf; + cmd_buf = pmadapter->upld_buf; if (pmadapter->ps_state == PS_STATE_SLEEP_CFM) { wlan_process_sleep_confirm_resp(pmadapter, pmbuf->pbuf + @@ -702,7 +706,7 @@ wlan_decode_rx_packet(mlan_adapter * pmadapter, mlan_buffer * pmbuf, INTF_HEADER_LEN); } pmadapter->upld_len -= INTF_HEADER_LEN; - memcpy(pmadapter, cmdBuf, + memcpy(pmadapter, cmd_buf, pmbuf->pbuf + pmbuf->data_offset + INTF_HEADER_LEN, MIN(MRVDRV_SIZE_OF_CMD_BUFFER, pmadapter->upld_len - @@ -756,7 +760,7 @@ wlan_decode_rx_packet(mlan_adapter * pmadapter, mlan_buffer * pmbuf, * @brief This function receives data from the card in aggregate mode. * * @param pmadapter A pointer to mlan_adapter structure - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_receive_mp_aggr_buf(mlan_adapter * pmadapter) @@ -834,7 +838,7 @@ done: * @param pmbuf A pointer to the SDIO data/cmd buffer * @param port Current port on which packet needs to be rxed * @param rx_len Length of received packet - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_sdio_card_to_host_mp_aggr(mlan_adapter * pmadapter, mlan_buffer @@ -981,7 +985,7 @@ done: * @brief This function sends aggr buf * * @param pmadapter A pointer to mlan_adapter structure - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_send_mp_aggr_buf(mlan_adapter * pmadapter) @@ -1036,7 +1040,7 @@ wlan_send_mp_aggr_buf(mlan_adapter * pmadapter) * @param mbuf A pointer to the SDIO data/cmd buffer * @param port current port for aggregation * @param next_pkt_len Length of next packet used for multiport aggregation - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_host_to_card_mp_aggr(mlan_adapter * pmadapter, mlan_buffer * mbuf, @@ -1279,7 +1283,7 @@ done: * @param pmadapter A pointer to mlan_adapter * @param pmfw A pointer to firmware image * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_dnld_fw(IN pmlan_adapter pmadapter, IN pmlan_fw_image pmfw) @@ -1303,7 +1307,7 @@ wlan_dnld_fw(IN pmlan_adapter pmadapter, IN pmlan_fw_image pmfw) * @brief This function probes the driver * * @param pmadapter A pointer to mlan_adapter structure - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_sdio_probe(pmlan_adapter pmadapter) @@ -1395,7 +1399,7 @@ done: * @brief This function enables the host interrupts. * * @param pmadapter A pointer to mlan_adapter structure - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_enable_host_int(pmlan_adapter pmadapter) @@ -1412,7 +1416,7 @@ wlan_enable_host_int(pmlan_adapter pmadapter) * @brief This function checks the interrupt status and handle it accordingly. * * @param pmadapter A pointer to mlan_adapter structure - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_process_int_status(mlan_adapter * pmadapter) @@ -1604,7 +1608,7 @@ done: * @param type data or command * @param pmbuf A pointer to mlan_buffer (pmbuf->data_len should include SDIO header) * @param tx_param A pointer to mlan_tx_param - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_sdio_host_to_card(mlan_adapter * pmadapter, t_u8 type, mlan_buffer * pmbuf, @@ -1628,7 +1632,8 @@ wlan_sdio_host_to_card(mlan_adapter * pmadapter, t_u8 type, mlan_buffer * pmbuf, /* * This is SDIO specific header * t_u16 length, - * t_u16 type (MLAN_TYPE_DATA = 0, MLAN_TYPE_CMD = 1, MLAN_TYPE_EVENT = 3) + * t_u16 type (MLAN_TYPE_DATA = 0, + * MLAN_TYPE_CMD = 1, MLAN_TYPE_EVENT = 3) */ if (type == MLAN_TYPE_DATA) { ret = wlan_get_wr_port_data(pmadapter, &port); @@ -1702,7 +1707,7 @@ exit: #if defined(SDIO_MULTI_PORT_TX_AGGR) || defined(SDIO_MULTI_PORT_RX_AGGR) /** * @brief This function allocates buffer for the SDIO aggregation buffer - * related members of adapter structure + * related members of adapter structure * * @param pmadapter A pointer to mlan_adapter structure * @param mpa_tx_buf_size Tx buffer size to allocate @@ -1751,9 +1756,8 @@ wlan_alloc_sdio_mpa_buffers(IN mlan_adapter * pmadapter, pmadapter->mpa_rx.buf_size = mpa_rx_buf_size; #endif /* SDIO_MULTI_PORT_RX_AGGR */ error: - if (ret != MLAN_STATUS_SUCCESS) { + if (ret != MLAN_STATUS_SUCCESS) wlan_free_sdio_mpa_buffers(pmadapter); - } LEAVE(); return ret; @@ -1801,9 +1805,9 @@ wlan_free_sdio_mpa_buffers(IN mlan_adapter * pmadapter) /** * @brief This function issues commands to initialize firmware * - * @param priv A pointer to mlan_private structure + * @param priv A pointer to mlan_private structure * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_set_sdio_gpio_int(IN pmlan_private priv) @@ -1840,8 +1844,8 @@ wlan_set_sdio_gpio_int(IN pmlan_private priv) /** * @brief This function prepares command of SDIO GPIO interrupt * - * @param pmpriv A pointer to mlan_private structure - * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure * @param cmd_action The action: GET or SET * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS diff --git a/drivers/net/wireless/sd8797/mlan/mlan_sdio.h b/drivers/net/wireless/sd8797/mlan/mlan_sdio.h index f4f464aa755d..3abdd7d964d6 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_sdio.h +++ b/drivers/net/wireless/sd8797/mlan/mlan_sdio.h @@ -1,24 +1,27 @@ /** @file mlan_sdio.h - * - * @brief This file contains definitions for SDIO interface. - * driver. - * - * Copyright (C) 2008-2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - * - */ + * + * @brief This file contains definitions for SDIO interface. + * + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved + * + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. + * + */ /**************************************************** Change log: ****************************************************/ @@ -213,11 +216,14 @@ Change log: #define MP_TX_AGGR_IN_PROGRESS(a) (a->mpa_tx.pkt_cnt > 0) /** SDIO Tx aggregation buffer room for next packet ? */ -#define MP_TX_AGGR_BUF_HAS_ROOM(a, mbuf, len) (((a->mpa_tx.buf_len) + len) <= (a->mpa_tx.buf_size)) +#define MP_TX_AGGR_BUF_HAS_ROOM(a, mbuf, len) \ + (((a->mpa_tx.buf_len) + len) <= (a->mpa_tx.buf_size)) /** Copy current packet (SDIO Tx aggregation buffer) to SDIO buffer */ #define MP_TX_AGGR_BUF_PUT(a, mbuf, port) do { \ - pmadapter->callbacks.moal_memmove(a->pmoal_handle, &a->mpa_tx.buf[a->mpa_tx.buf_len], mbuf->pbuf+mbuf->data_offset, mbuf->data_len);\ + pmadapter->callbacks.moal_memmove(a->pmoal_handle, \ + &a->mpa_tx.buf[a->mpa_tx.buf_len], \ + mbuf->pbuf+mbuf->data_offset, mbuf->data_len);\ a->mpa_tx.buf_len += mbuf->data_len; \ a->mpa_tx.mp_wr_info[a->mpa_tx.pkt_cnt] = *(t_u16 *)(mbuf->pbuf+mbuf->data_offset); \ if (!a->mpa_tx.pkt_cnt) { \ @@ -226,13 +232,15 @@ Change log: if (a->mpa_tx.start_port <= port) { \ a->mpa_tx.ports |= (1 << (a->mpa_tx.pkt_cnt)); \ } else { \ - a->mpa_tx.ports |= (1 << (a->mpa_tx.pkt_cnt + 1 + (MAX_PORT - a->mp_end_port))); \ + a->mpa_tx.ports |= (1 << (a->mpa_tx.pkt_cnt \ + + 1 + (MAX_PORT - a->mp_end_port))); \ } \ a->mpa_tx.pkt_cnt++; \ -} while (0); +} while (0) /** SDIO Tx aggregation limit ? */ -#define MP_TX_AGGR_PKT_LIMIT_REACHED(a) ((a->mpa_tx.pkt_cnt) == (a->mpa_tx.pkt_aggr_limit)) +#define MP_TX_AGGR_PKT_LIMIT_REACHED(a) ((a->mpa_tx.pkt_cnt) \ + == (a->mpa_tx.pkt_aggr_limit)) /** SDIO Tx aggregation port limit ? */ #define MP_TX_AGGR_PORT_LIMIT_REACHED(a) ((a->curr_wr_port < \ @@ -254,7 +262,8 @@ Change log: #ifdef SDIO_MULTI_PORT_RX_AGGR /** SDIO Rx aggregation limit ? */ -#define MP_RX_AGGR_PKT_LIMIT_REACHED(a) (a->mpa_rx.pkt_cnt == a->mpa_rx.pkt_aggr_limit) +#define MP_RX_AGGR_PKT_LIMIT_REACHED(a) (a->mpa_rx.pkt_cnt \ + == a->mpa_rx.pkt_aggr_limit) /** SDIO Rx aggregation port limit ? */ #define MP_RX_AGGR_PORT_LIMIT_REACHED(a) ((a->curr_rd_port < \ diff --git a/drivers/net/wireless/sd8797/mlan/mlan_shim.c b/drivers/net/wireless/sd8797/mlan/mlan_shim.c index 465cf00e47f2..80e599397afd 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_shim.c +++ b/drivers/net/wireless/sd8797/mlan/mlan_shim.c @@ -2,20 +2,56 @@ * * @brief This file contains APIs to MOAL module. * - * Copyright (C) 2008-2011, Marvell International Ltd. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. + * + */ + +/** + * @mainpage MLAN Driver + * + * @section overview_sec Overview + * + * The MLAN is an OS independent WLAN driver for Marvell 802.11 + * embedded chipset. + * + * @section copyright_sec Copyright + * + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved + * + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. */ /******************************************************** @@ -233,8 +269,6 @@ mlan_register(IN pmlan_device pmdevice, OUT t_void ** ppmlan_adapter) /* Save pmoal_handle */ pmadapter->pmoal_handle = pmdevice->pmoal_handle; - pmadapter->feature_control = pmdevice->feature_control; - if ((pmdevice->int_mode == INT_MODE_GPIO) && (pmdevice->gpio_pin == 0)) { PRINTM(MERROR, "SDIO_GPIO_INT_CONFIG: Invalid GPIO Pin\n"); ret = MLAN_STATUS_FAILURE; @@ -273,9 +307,8 @@ mlan_register(IN pmlan_device pmdevice, OUT t_void ** ppmlan_adapter) #else pmadapter->init_para.cfg_11d = 0; #endif - if (IS_DFS_SUPPORT(pmadapter->feature_control)) - pmadapter->init_para.dfs_master_radar_det_en = - DFS_MASTER_RADAR_DETECT_EN; + pmadapter->init_para.dfs_master_radar_det_en = + DFS_MASTER_RADAR_DETECT_EN; pmadapter->init_para.dfs_slave_radar_det_en = DFS_SLAVE_RADAR_DETECT_EN; pmadapter->rx_work_flag = pmdevice->rx_work; @@ -597,14 +630,14 @@ mlan_init_fw(IN t_void * pmlan_adapter) /** * @brief Shutdown firmware * - * @param pmlan_adapter A pointer to mlan_adapter structure + * @param pmlan_adapter A pointer to mlan_adapter structure * - * @return MLAN_STATUS_SUCCESS - * The firmware shutdown call succeeded. - * MLAN_STATUS_PENDING - * The firmware shutdown call is pending. - * MLAN_STATUS_FAILURE - * The firmware shutdown call failed. + * @return MLAN_STATUS_SUCCESS + * The firmware shutdown call succeeded. + * MLAN_STATUS_PENDING + * The firmware shutdown call is pending. + * MLAN_STATUS_FAILURE + * The firmware shutdown call failed. */ mlan_status mlan_shutdown_fw(IN t_void * pmlan_adapter) @@ -640,9 +673,8 @@ mlan_shutdown_fw(IN t_void * pmlan_adapter) /* Clean up priv structures */ for (i = 0; i < pmadapter->priv_num; i++) { - if (pmadapter->priv[i]) { + if (pmadapter->priv[i]) wlan_free_priv(pmadapter->priv[i]); - } } pcb = &pmadapter->callbacks; @@ -781,6 +813,11 @@ process_start: pmadapter->callbacks.moal_spin_unlock) > HIGH_RX_PENDING) { PRINTM(MEVENT, "Pause\n"); pmadapter->delay_task_flag = MTRUE; + if (!pmadapter->mlan_rx_processing) + wlan_recv_event(wlan_get_priv + (pmadapter, MLAN_BSS_ROLE_ANY), + MLAN_EVENT_ID_DRV_DEFER_RX_WORK, + MNULL); break; } /* Handle pending SDIO interrupts if any */ @@ -830,12 +867,15 @@ process_start: if (pmadapter->scan_processing || pmadapter->data_sent + || wlan_is_tdls_link_chan_switching(pmadapter-> + tdls_status) || (wlan_bypass_tx_list_empty(pmadapter) && wlan_wmm_lists_empty(pmadapter)) || wlan_11h_radar_detected_tx_blocked(pmadapter) ) { if (pmadapter->cmd_sent || pmadapter->curr_cmd - || + || !wlan_is_send_cmd_allowed(pmadapter-> + tdls_status) || (!util_peek_list (pmadapter->pmoal_handle, &pmadapter->cmd_pending_q, @@ -883,7 +923,9 @@ process_start: ) continue; - if (!pmadapter->cmd_sent && !pmadapter->curr_cmd) { + if (!pmadapter->cmd_sent && !pmadapter->curr_cmd + && wlan_is_send_cmd_allowed(pmadapter->tdls_status) + ) { if (wlan_exec_next_cmd(pmadapter) == MLAN_STATUS_FAILURE) { ret = MLAN_STATUS_FAILURE; @@ -894,6 +936,7 @@ process_start: if (!pmadapter->scan_processing && !pmadapter->data_sent && !wlan_11h_radar_detected_tx_blocked(pmadapter) && + !wlan_is_tdls_link_chan_switching(pmadapter->tdls_status) && !wlan_bypass_tx_list_empty(pmadapter)) { PRINTM(MINFO, "mlan_send_pkt(): deq(bybass_txq)\n"); wlan_process_bypass_tx(pmadapter); @@ -909,6 +952,7 @@ process_start: if (!pmadapter->scan_processing && !pmadapter->data_sent && !wlan_wmm_lists_empty(pmadapter) && !wlan_11h_radar_detected_tx_blocked(pmadapter) + && !wlan_is_tdls_link_chan_switching(pmadapter->tdls_status) ) { wlan_wmm_process_tx(pmadapter); if (pmadapter->hs_activated == MTRUE) { @@ -971,6 +1015,8 @@ mlan_send_packet(IN t_void * pmlan_adapter, IN pmlan_buffer pmbuf) mlan_adapter *pmadapter = (mlan_adapter *) pmlan_adapter; mlan_private *pmpriv; t_u16 eth_type = 0; + t_u8 ra[MLAN_MAC_ADDR_LENGTH]; + tdlsStatus_e tdls_status; ENTER(); MASSERT(pmlan_adapter && pmbuf); @@ -987,9 +1033,18 @@ mlan_send_packet(IN t_void * pmlan_adapter, IN pmlan_buffer pmbuf) ((eth_type == MLAN_ETHER_PKT_TYPE_EAPOL) || (eth_type == MLAN_ETHER_PKT_TYPE_WAPI) )) + || (eth_type == MLAN_ETHER_PKT_TYPE_TDLS_ACTION) || (pmbuf->buf_type == MLAN_BUF_TYPE_RAW_DATA) ) { + if (eth_type == MLAN_ETHER_PKT_TYPE_TDLS_ACTION) { + memcpy(pmadapter, ra, pmbuf->pbuf + pmbuf->data_offset, + MLAN_MAC_ADDR_LENGTH); + tdls_status = wlan_get_tdls_link_status(pmpriv, ra); + if (MTRUE == wlan_is_tdls_link_setup(tdls_status) || + !pmpriv->media_connected) + pmbuf->flags |= MLAN_BUF_FLAG_TDLS; + } PRINTM(MINFO, "mlan_send_pkt(): enq(bybass_txq)\n"); wlan_add_buf_bypass_txqueue(pmadapter, pmbuf); } else { diff --git a/drivers/net/wireless/sd8797/mlan/mlan_sta_cmd.c b/drivers/net/wireless/sd8797/mlan/mlan_sta_cmd.c index cd96fde24a6d..a3b8f181bbd3 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_sta_cmd.c +++ b/drivers/net/wireless/sd8797/mlan/mlan_sta_cmd.c @@ -4,20 +4,24 @@ * it prepares command and sends it to firmware when * it is ready. * - * Copyright (C) 2008-2011, Marvell International Ltd. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * */ @@ -611,9 +615,10 @@ wlan_cmd_mac_multicast_adr(IN pmlan_private pmpriv, } /** - * @brief This function prepares command of deauthenticate. + * @brief This function prepares command of deauthenticate/disassociate. * * @param pmpriv A pointer to mlan_private structure + * @param cmd_no Command number * @param cmd A pointer to HostCmd_DS_COMMAND structure * @param pdata_buf A pointer to data buffer * @@ -621,6 +626,7 @@ wlan_cmd_mac_multicast_adr(IN pmlan_private pmpriv, */ static mlan_status wlan_cmd_802_11_deauthenticate(IN pmlan_private pmpriv, + IN t_u16 cmd_no, IN HostCmd_DS_COMMAND * cmd, IN t_void * pdata_buf) { @@ -628,7 +634,7 @@ wlan_cmd_802_11_deauthenticate(IN pmlan_private pmpriv, ENTER(); - cmd->command = wlan_cpu_to_le16(HostCmd_CMD_802_11_DEAUTHENTICATE); + cmd->command = wlan_cpu_to_le16(cmd_no); cmd->size = wlan_cpu_to_le16(sizeof(HostCmd_DS_802_11_DEAUTHENTICATE) + S_DS_GEN); @@ -636,8 +642,12 @@ wlan_cmd_802_11_deauthenticate(IN pmlan_private pmpriv, /* Set AP MAC address */ memcpy(pmpriv->adapter, pdeauth->mac_addr, (t_u8 *) pdata_buf, MLAN_MAC_ADDR_LENGTH); - - PRINTM(MCMND, "Deauth: " MACSTR "\n", MAC2STR(pdeauth->mac_addr)); + if (cmd_no == HostCmd_CMD_802_11_DEAUTHENTICATE) + PRINTM(MCMND, "Deauth: " MACSTR "\n", + MAC2STR(pdeauth->mac_addr)); + else + PRINTM(MCMND, "Disassociate: " MACSTR "\n", + MAC2STR(pdeauth->mac_addr)); if (pmpriv->adapter->state_11h.recvd_chanswann_event) { /** Reason code 36 = Requested from peer station as it is leaving the BSS */ @@ -1296,13 +1306,442 @@ wlan_cmd_mgmt_ie_list(IN pmlan_private pmpriv, } /** + * @brief This function prepares command of TDLS configuration. + * + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param cmd_action The action: GET or SET + * @param pdata_buf A pointer to data buffer + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +static mlan_status +wlan_cmd_tdls_config(IN pmlan_private pmpriv, + IN HostCmd_DS_COMMAND * cmd, + IN t_u16 cmd_action, IN t_void * pdata_buf) +{ + t_u16 travel_len = 0; + mlan_ds_misc_tdls_config *tdls_config = MNULL; + tdls_all_config *tdls_all_cfg = MNULL; + HostCmd_DS_TDLS_CONFIG *ptdls_config_data = + &(cmd->params.tdls_config_data); + t_u8 zero_mac[] = { 0, 0, 0, 0, 0, 0 }; + + ENTER(); + + cmd->command = wlan_cpu_to_le16(HostCmd_CMD_TDLS_CONFIG); + cmd->size = sizeof(HostCmd_DS_TDLS_CONFIG) + S_DS_GEN; + cmd->result = 0; + + tdls_config = (mlan_ds_misc_tdls_config *) pdata_buf; + ptdls_config_data->tdls_info.tdls_action = + wlan_cpu_to_le16(tdls_config->tdls_action); + + tdls_all_cfg = (tdls_all_config *) tdls_config->tdls_data; + + switch (tdls_config->tdls_action) { + case WLAN_TDLS_CONFIG: + travel_len = sizeof(tdls_all_cfg->u.tdls_config); + tdls_all_cfg->u.tdls_config.enable = + wlan_cpu_to_le16(tdls_all_cfg->u.tdls_config.enable); + memcpy(pmpriv->adapter, ptdls_config_data->tdls_info.tdls_data, + &tdls_all_cfg->u.tdls_setup, travel_len); + break; + + case WLAN_TDLS_SET_INFO: + travel_len = tdls_all_cfg->u.tdls_set.tlv_length; + if ((travel_len + sizeof(t_u16)) > MAX_TDLS_DATA_LEN) { + PRINTM(MERROR, "TDLS configuration overflow\n"); + LEAVE(); + return MLAN_STATUS_FAILURE; + } + memcpy(pmpriv->adapter, ptdls_config_data->tdls_info.tdls_data, + (t_u8 *) & tdls_all_cfg->u.tdls_set.cap_info, + sizeof(t_u16)); + memcpy(pmpriv->adapter, + (t_u8 *) ptdls_config_data->tdls_info.tdls_data + + sizeof(t_u16), &tdls_all_cfg->u.tdls_set.tlv_buffer, + travel_len); + travel_len += sizeof(t_u16); + break; + case WLAN_TDLS_DISCOVERY_REQ: + travel_len = MLAN_MAC_ADDR_LENGTH; + memcpy(pmpriv->adapter, ptdls_config_data->tdls_info.tdls_data, + tdls_all_cfg->u.tdls_discovery.peer_mac_addr, + travel_len); + break; + + case WLAN_TDLS_SETUP_REQ: + travel_len = sizeof(tdls_all_cfg->u.tdls_setup); + tdls_all_cfg->u.tdls_setup.setup_timeout = + wlan_cpu_to_le32(tdls_all_cfg->u.tdls_setup. + setup_timeout); + tdls_all_cfg->u.tdls_setup.key_lifetime = + wlan_cpu_to_le32(tdls_all_cfg->u.tdls_setup. + key_lifetime); + memcpy(pmpriv->adapter, ptdls_config_data->tdls_info.tdls_data, + &tdls_all_cfg->u.tdls_setup, travel_len); + break; + + case WLAN_TDLS_TEAR_DOWN_REQ: + travel_len = sizeof(tdls_all_cfg->u.tdls_tear_down); + tdls_all_cfg->u.tdls_tear_down.reason_code = + wlan_cpu_to_le16(tdls_all_cfg->u.tdls_tear_down. + reason_code); + memcpy(pmpriv->adapter, ptdls_config_data->tdls_info.tdls_data, + &tdls_all_cfg->u.tdls_tear_down, travel_len); + break; + case WLAN_TDLS_STOP_CHAN_SWITCH: + travel_len = MLAN_MAC_ADDR_LENGTH; + memcpy(pmpriv->adapter, ptdls_config_data->tdls_info.tdls_data, + tdls_all_cfg->u.tdls_stop_chan_switch.peer_mac_addr, + travel_len); + break; + case WLAN_TDLS_INIT_CHAN_SWITCH: + travel_len = sizeof(tdls_all_cfg->u.tdls_chan_switch); + tdls_all_cfg->u.tdls_chan_switch.switch_time = + wlan_cpu_to_le16(tdls_all_cfg->u.tdls_chan_switch. + switch_time); + tdls_all_cfg->u.tdls_chan_switch.switch_timeout = + wlan_cpu_to_le16(tdls_all_cfg->u.tdls_chan_switch. + switch_timeout); + memcpy(pmpriv->adapter, ptdls_config_data->tdls_info.tdls_data, + &tdls_all_cfg->u.tdls_chan_switch, travel_len); + break; + case WLAN_TDLS_CS_PARAMS: + travel_len = sizeof(tdls_all_cfg->u.tdls_cs_params); + memcpy(pmpriv->adapter, ptdls_config_data->tdls_info.tdls_data, + &tdls_all_cfg->u.tdls_cs_params, travel_len); + break; + case WLAN_TDLS_CS_DISABLE: + travel_len = sizeof(tdls_all_cfg->u.tdls_disable_cs); + tdls_all_cfg->u.tdls_disable_cs.data = + wlan_cpu_to_le16(tdls_all_cfg->u.tdls_disable_cs.data); + memcpy(pmpriv->adapter, ptdls_config_data->tdls_info.tdls_data, + &tdls_all_cfg->u.tdls_disable_cs, travel_len); + break; + case WLAN_TDLS_POWER_MODE: + travel_len = sizeof(tdls_all_cfg->u.tdls_power_mode); + tdls_all_cfg->u.tdls_power_mode.power_mode = + wlan_cpu_to_le16(tdls_all_cfg->u.tdls_power_mode. + power_mode); + memcpy(pmpriv->adapter, ptdls_config_data->tdls_info.tdls_data, + &tdls_all_cfg->u.tdls_power_mode, travel_len); + break; + + case WLAN_TDLS_LINK_STATUS: + travel_len = 0; + if (memcmp + (pmpriv->adapter, + tdls_all_cfg->u.tdls_link_status_req.peer_mac_addr, + zero_mac, sizeof(zero_mac))) { + travel_len = + sizeof(tdls_all_cfg->u.tdls_link_status_req); + memcpy(pmpriv->adapter, + ptdls_config_data->tdls_info.tdls_data, + tdls_all_cfg->u.tdls_link_status_req. + peer_mac_addr, travel_len); + } + break; + + case WLAN_TDLS_DEBUG_ALLOW_WEAK_SECURITY: + case WLAN_TDLS_DEBUG_SETUP_SAME_LINK: + case WLAN_TDLS_DEBUG_FAIL_SETUP_CONFIRM: + case WLAN_TDLS_DEBUG_WRONG_BSS: + case WLAN_TDLS_DEBUG_SETUP_PROHIBITED: + case WLAN_TDLS_DEBUG_HIGHER_LOWER_MAC: + case WLAN_TDLS_DEBUG_IGNORE_KEY_EXPIRY: + case WLAN_TDLS_DEBUG_STOP_RX: + case WLAN_TDLS_DEBUG_CS_RET_IM: + travel_len = sizeof(tdls_all_cfg->u.tdls_debug_data); + tdls_all_cfg->u.tdls_debug_data.debug_data = + wlan_cpu_to_le16(tdls_all_cfg->u.tdls_debug_data. + debug_data); + memcpy(pmpriv->adapter, ptdls_config_data->tdls_info.tdls_data, + &tdls_all_cfg->u.tdls_debug_data, travel_len); + break; + + default: + LEAVE(); + return MLAN_STATUS_FAILURE; + } + + cmd->size += travel_len; + cmd->size -= MAX_TDLS_DATA_LEN; + cmd->size = wlan_cpu_to_le16(cmd->size); + + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + +/** + * @brief This function prepares command of TDLS create/config/delete + * + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param cmd_action The action: GET or SET + * @param pdata_buf A pointer to data buffer + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +static mlan_status +wlan_cmd_tdls_oper(IN pmlan_private pmpriv, + IN HostCmd_DS_COMMAND * cmd, + IN t_u16 cmd_action, IN t_void * pdata_buf) +{ + t_u16 travel_len = 0; + mlan_ds_misc_tdls_oper *tdls_oper = MNULL; + HostCmd_DS_TDLS_OPER *ptdls_oper = &(cmd->params.tdls_oper_data); + sta_node *sta_ptr; + t_u8 *pos; + MrvlIEtypes_RatesParamSet_t *Rate_tlv = MNULL; + MrvlIETypes_HTCap_t *HTcap_tlv = MNULL; + MrvlIETypes_HTInfo_t *HTInfo_tlv = MNULL; + MrvlIETypes_2040BSSCo_t *BSSCo = MNULL; + MrvlIETypes_ExtCap_t *ExCap = MNULL; + MrvlIEtypes_RsnParamSet_t *Rsn_ie = MNULL; + MrvlIETypes_qosinfo_t *qos_info = MNULL; + BSSDescriptor_t *pbss_desc = &pmpriv->curr_bss_params.bss_descriptor; + MrvlIEtypes_TDLS_Idle_Timeout_t *TdlsIdleTimeout = MNULL; + + ENTER(); + + cmd->command = wlan_cpu_to_le16(HostCmd_CMD_TDLS_OPERATION); + cmd->size = sizeof(HostCmd_DS_TDLS_OPER) + S_DS_GEN; + cmd->result = 0; + + tdls_oper = (mlan_ds_misc_tdls_oper *) pdata_buf; + ptdls_oper->reason = 0; + memcpy(pmpriv->adapter, ptdls_oper->peer_mac, tdls_oper->peer_mac, + MLAN_MAC_ADDR_LENGTH); + sta_ptr = wlan_get_station_entry(pmpriv, tdls_oper->peer_mac); + pos = (t_u8 *) ptdls_oper + sizeof(HostCmd_DS_TDLS_OPER); + switch (tdls_oper->tdls_action) { + case WLAN_TDLS_CREATE_LINK: + if (sta_ptr) + sta_ptr->status = TDLS_SETUP_INPROGRESS; + ptdls_oper->tdls_action = wlan_cpu_to_le16(TDLS_CREATE); + break; + case WLAN_TDLS_CONFIG_LINK: + if (sta_ptr) { + ptdls_oper->tdls_action = wlan_cpu_to_le16(TDLS_CONFIG); + /* capability */ + if (tdls_oper->capability) + *(t_u16 *) pos = + wlan_cpu_to_le16(tdls_oper->capability); + else + *(t_u16 *) pos = + wlan_cpu_to_le16(sta_ptr->capability); + travel_len += sizeof(sta_ptr->capability); + + /* qos_info */ + qos_info = (MrvlIETypes_qosinfo_t *) (pos + travel_len); + qos_info->header.type = wlan_cpu_to_le16(QOS_INFO); + qos_info->header.len = wlan_cpu_to_le16(sizeof(t_u8)); + if (tdls_oper->qos_info) + qos_info->qos_info = tdls_oper->qos_info; + else + qos_info->qos_info = sta_ptr->qos_info; + travel_len += sizeof(MrvlIETypes_qosinfo_t); + + /* supported rate */ + Rate_tlv = + (MrvlIEtypes_RatesParamSet_t *) (pos + + travel_len); + Rate_tlv->header.type = + wlan_cpu_to_le16(TLV_TYPE_RATES); + if (tdls_oper->supported_rates && + tdls_oper->supported_rates_len) { + Rate_tlv->header.len = + wlan_cpu_to_le16(tdls_oper-> + supported_rates_len); + memcpy(pmpriv->adapter, + pos + travel_len + + sizeof(MrvlIEtypesHeader_t), + tdls_oper->supported_rates, + tdls_oper->supported_rates_len); + travel_len += + sizeof(MrvlIEtypesHeader_t) + + tdls_oper->supported_rates_len; + } else { + Rate_tlv->header.len = + wlan_cpu_to_le16(sta_ptr->rate_len); + memcpy(pmpriv->adapter, + pos + travel_len + + sizeof(MrvlIEtypesHeader_t), + sta_ptr->support_rate, + Rate_tlv->header.len); + travel_len += + sizeof(MrvlIEtypesHeader_t) + + sta_ptr->rate_len; + } + + /* Extended capability */ + if (tdls_oper->ext_capab && tdls_oper->ext_capab_len) { + ExCap = (MrvlIETypes_ExtCap_t *) (pos + + travel_len); + ExCap->header.type = + wlan_cpu_to_le16(TLV_TYPE_EXTCAP); + ExCap->header.len = + wlan_cpu_to_le16(tdls_oper-> + ext_capab_len); + memcpy(pmpriv->adapter, + pos + travel_len + + sizeof(MrvlIEtypesHeader_t), + tdls_oper->ext_capab, + tdls_oper->ext_capab_len); + travel_len += + sizeof(MrvlIEtypesHeader_t) + + tdls_oper->ext_capab_len; + } else if (sta_ptr->ExtCap.ieee_hdr.element_id == + EXT_CAPABILITY) { + ExCap = (MrvlIETypes_ExtCap_t *) (pos + + travel_len); + ExCap->header.type = + wlan_cpu_to_le16(TLV_TYPE_EXTCAP); + ExCap->header.len = + wlan_cpu_to_le16(sta_ptr->ExtCap. + ieee_hdr.len); + memcpy(pmpriv->adapter, &ExCap->ext_cap, + &sta_ptr->ExtCap.ext_cap, + sta_ptr->ExtCap.ieee_hdr.len); + travel_len += + sta_ptr->ExtCap.ieee_hdr.len + + sizeof(MrvlIEtypesHeader_t); + } + + /* RSN ie */ + if (sta_ptr->rsn_ie.ieee_hdr.element_id == RSN_IE) { + Rsn_ie = (MrvlIEtypes_RsnParamSet_t *) (pos + + travel_len); + Rsn_ie->header.type = + wlan_cpu_to_le16(sta_ptr->rsn_ie. + ieee_hdr.element_id); + Rsn_ie->header.len = + wlan_cpu_to_le16(sta_ptr->rsn_ie. + ieee_hdr.len); + memcpy(pmpriv->adapter, Rsn_ie->rsn_ie, + sta_ptr->rsn_ie.data, + sta_ptr->rsn_ie.ieee_hdr.len); + travel_len += + sta_ptr->rsn_ie.ieee_hdr.len + + sizeof(MrvlIEtypesHeader_t); + } + + /* HT capability */ + if (tdls_oper->ht_capa) { + HTcap_tlv = + (MrvlIETypes_HTCap_t *) (pos + + travel_len); + HTcap_tlv->header.type = + wlan_cpu_to_le16(TLV_TYPE_HT_CAP); + HTcap_tlv->header.len = + wlan_cpu_to_le16(sizeof(HTCap_t)); + memcpy(pmpriv->adapter, &HTcap_tlv->ht_cap, + tdls_oper->ht_capa, sizeof(HTCap_t)); + travel_len += + sizeof(HTCap_t) + + sizeof(MrvlIEtypesHeader_t); + } else if (sta_ptr->HTcap.ieee_hdr.element_id == + HT_CAPABILITY) { + HTcap_tlv = + (MrvlIETypes_HTCap_t *) (pos + + travel_len); + HTcap_tlv->header.type = + wlan_cpu_to_le16(TLV_TYPE_HT_CAP); + HTcap_tlv->header.len = + wlan_cpu_to_le16(sta_ptr->HTcap. + ieee_hdr.len); + memcpy(pmpriv->adapter, &HTcap_tlv->ht_cap, + &sta_ptr->HTcap.ht_cap, + sta_ptr->HTcap.ieee_hdr.len); + travel_len += + sta_ptr->HTcap.ieee_hdr.len + + sizeof(MrvlIEtypesHeader_t); + } + if (HTcap_tlv) { + wlan_fill_ht_cap_tlv(pmpriv, HTcap_tlv, + pbss_desc->bss_band); + DBG_HEXDUMP(MCMD_D, "FW htcap", + (t_u8 *) HTcap_tlv, + sizeof(MrvlIETypes_HTCap_t)); + } + + /* HT info */ + if (sta_ptr->HTInfo.ieee_hdr.element_id == HT_OPERATION) { + HTInfo_tlv = + (MrvlIETypes_HTInfo_t *) (pos + + travel_len); + HTInfo_tlv->header.type = + wlan_cpu_to_le16(TLV_TYPE_HT_INFO); + HTInfo_tlv->header.len = + wlan_cpu_to_le16(sta_ptr->HTInfo. + ieee_hdr.len); + memcpy(pmpriv->adapter, &HTInfo_tlv->ht_info, + &sta_ptr->HTInfo.ht_info, + sta_ptr->HTInfo.ieee_hdr.len); + travel_len += + sta_ptr->HTInfo.ieee_hdr.len + + sizeof(MrvlIEtypesHeader_t); + DBG_HEXDUMP(MCMD_D, "HT Info", + (t_u8 *) HTInfo_tlv, + sizeof(MrvlIETypes_HTInfo_t)); + } + /* 20/40 BSS co-exist */ + if (sta_ptr->BSSCO_20_40.ieee_hdr.element_id == + BSSCO_2040) { + BSSCo = (MrvlIETypes_2040BSSCo_t *) (pos + + travel_len); + BSSCo->header.type = + wlan_cpu_to_le16 + (TLV_TYPE_2040BSS_COEXISTENCE); + BSSCo->header.len = + wlan_cpu_to_le16(sta_ptr->BSSCO_20_40. + ieee_hdr.len); + memcpy(pmpriv->adapter, &BSSCo->bss_co_2040, + &sta_ptr->BSSCO_20_40.bss_co_2040, + sta_ptr->BSSCO_20_40.ieee_hdr.len); + travel_len += + sta_ptr->BSSCO_20_40.ieee_hdr.len + + sizeof(MrvlIEtypesHeader_t); + } + TdlsIdleTimeout = + (MrvlIEtypes_TDLS_Idle_Timeout_t *) (pos + + travel_len); + TdlsIdleTimeout->header.type = + wlan_cpu_to_le16(TLV_TYPE_TDLS_IDLE_TIMEOUT); + TdlsIdleTimeout->header.len = + sizeof(TdlsIdleTimeout->value); + TdlsIdleTimeout->header.len = + wlan_cpu_to_le16(TdlsIdleTimeout->header.len); + TdlsIdleTimeout->value = + wlan_cpu_to_le16(TDLS_IDLE_TIMEOUT); + travel_len += sizeof(MrvlIEtypes_TDLS_Idle_Timeout_t); + } + break; + case WLAN_TDLS_DISABLE_LINK: + if (sta_ptr) + sta_ptr->status = TDLS_TEAR_DOWN; + ptdls_oper->tdls_action = wlan_cpu_to_le16(TDLS_DELETE); + break; + default: + break; + } + cmd->size += travel_len; + cmd->size = wlan_cpu_to_le16(cmd->size); + + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + +/** * @brief This function prepares system clock cfg command * - * @param pmpriv A pointer to mlan_private structure - * @param cmd A pointer to HostCmd_DS_COMMAND structure - * @param cmd_action The action: GET or SET - * @param pdata_buf A pointer to data buffer - * @return MLAN_STATUS_SUCCESS + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param cmd_action The action: GET or SET + * @param pdata_buf A pointer to data buffer + * @return MLAN_STATUS_SUCCESS */ static mlan_status wlan_cmd_sysclock_cfg(IN pmlan_private pmpriv, @@ -1335,7 +1774,7 @@ wlan_cmd_sysclock_cfg(IN pmlan_private pmpriv, /** * @brief This function prepares command of subscribe event. * - * @param pmpriv A pointer to mlan_private structure + * @param pmpriv A pointer to mlan_private structure * @param cmd A pointer to HostCmd_DS_COMMAND structure * @param cmd_action the action: GET or SET * @param pdata_buf A pointer to data buffer @@ -1538,7 +1977,7 @@ done: /** * @brief This function prepares command of OTP user data. * - * @param pmpriv A pointer to mlan_private structure + * @param pmpriv A pointer to mlan_private structure * @param cmd A pointer to HostCmd_DS_COMMAND structure * @param cmd_action the action: GET or SET * @param pdata_buf A pointer to data buffer @@ -1708,7 +2147,8 @@ wlan_ops_sta_prepare_cmd(IN t_void * priv, ret = wlan_cmd_802_11_associate(pmpriv, cmd_ptr, pdata_buf); break; case HostCmd_CMD_802_11_DEAUTHENTICATE: - ret = wlan_cmd_802_11_deauthenticate(pmpriv, cmd_ptr, + case HostCmd_CMD_802_11_DISASSOCIATE: + ret = wlan_cmd_802_11_deauthenticate(pmpriv, cmd_no, cmd_ptr, pdata_buf); break; case HostCmd_CMD_802_11_AD_HOC_START: @@ -1860,6 +2300,14 @@ wlan_ops_sta_prepare_cmd(IN t_void * priv, ret = wlan_cmd_mgmt_ie_list(pmpriv, cmd_ptr, cmd_action, pdata_buf); break; + case HostCmd_CMD_TDLS_CONFIG: + ret = wlan_cmd_tdls_config(pmpriv, cmd_ptr, cmd_action, + pdata_buf); + break; + case HostCmd_CMD_TDLS_OPERATION: + ret = wlan_cmd_tdls_oper(pmpriv, cmd_ptr, cmd_action, + pdata_buf); + break; case HostCmd_CMD_802_11_SCAN_EXT: ret = wlan_cmd_802_11_scan_ext(pmpriv, cmd_ptr, pdata_buf); break; diff --git a/drivers/net/wireless/sd8797/mlan/mlan_sta_cmdresp.c b/drivers/net/wireless/sd8797/mlan/mlan_sta_cmdresp.c index 5297530c05b2..34f1e62395d7 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_sta_cmdresp.c +++ b/drivers/net/wireless/sd8797/mlan/mlan_sta_cmdresp.c @@ -3,20 +3,25 @@ * @brief This file contains the handling of command * responses generated by firmware. * - * Copyright (C) 2008-2012, Marvell International Ltd. + * (C) Copyright 2008-2012 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. */ /****************************************************** @@ -46,6 +51,54 @@ Change log: /******************************************************** Local Functions ********************************************************/ +/** + * @brief This function handles the command response error for TDLS operation + * + * @param pmpriv A pointer to mlan_private structure + * @param resp A pointer to HostCmd_DS_COMMAND + * + * @return N/A + */ +static void +wlan_process_cmdreps_error_tdls_operation(mlan_private * pmpriv, + HostCmd_DS_COMMAND * resp) +{ + HostCmd_DS_TDLS_OPER *ptdls_oper_data = &(resp->params.tdls_oper_data); + sta_node *sta_ptr = MNULL; + t_u16 reason; + + ENTER(); + ptdls_oper_data->tdls_action = + wlan_le16_to_cpu(ptdls_oper_data->tdls_action); + reason = wlan_le16_to_cpu(ptdls_oper_data->reason); + sta_ptr = wlan_get_station_entry(pmpriv, ptdls_oper_data->peer_mac); + switch (ptdls_oper_data->tdls_action) { + case TDLS_CREATE: + /* TDLS create command error */ + PRINTM(MERROR, + "TDLS CREATE operation: command error, reason %d\n", + reason); + if (reason != TDLS_LINK_EXISTS && sta_ptr) + sta_ptr->status = TDLS_SETUP_FAILURE; + break; + case TDLS_CONFIG: + /* TDLS config command error */ + PRINTM(MERROR, + "TDLS CONFIG operation: command error, reason %d\n", + reason); + if (sta_ptr) + sta_ptr->status = TDLS_SETUP_FAILURE; + break; + case TDLS_DELETE: + /* TDLS delete command error */ + PRINTM(MERROR, + "TDLS DELETE operation: command error, reason %d\n", + reason); + break; + } + LEAVE(); + return; +} /** * @brief This function handles the command response error @@ -61,6 +114,9 @@ wlan_process_cmdresp_error(mlan_private * pmpriv, HostCmd_DS_COMMAND * resp, mlan_ioctl_req * pioctl_buf) { mlan_adapter *pmadapter = pmpriv->adapter; + tdls_all_config *tdls_all_cfg = MNULL; + HostCmd_DS_TDLS_CONFIG *ptdls_config_data = + &(resp->params.tdls_config_data); ENTER(); @@ -97,6 +153,38 @@ wlan_process_cmdresp_error(mlan_private * pmpriv, HostCmd_DS_COMMAND * resp, case HostCmd_CMD_MAC_CONTROL: break; + case HostCmd_CMD_TDLS_CONFIG: + ptdls_config_data->tdls_info.tdls_action = + wlan_le16_to_cpu(ptdls_config_data->tdls_info. + tdls_action); + switch (ptdls_config_data->tdls_info.tdls_action) { + case WLAN_TDLS_SETUP_REQ: + /* TDLS link setup error ;display error in logs */ + tdls_all_cfg = + (tdls_all_config *) ptdls_config_data-> + tdls_info.tdls_data; + PRINTM(MERROR, "TDLS Setup Failed, error %d\n", + wlan_le16_to_cpu(tdls_all_cfg->u.tdls_cmd_resp. + reason_code)); + break; + case WLAN_TDLS_INIT_CHAN_SWITCH: + tdls_all_cfg = + (tdls_all_config *) ptdls_config_data-> + tdls_info.tdls_data; + PRINTM(MERROR, + "TDLS init channel switch failed," MACSTR + ": reason=%d\n", + MAC2STR(tdls_all_cfg->u.tdls_cmd_resp. + peer_mac_addr), + wlan_le16_to_cpu(tdls_all_cfg->u.tdls_cmd_resp. + reason_code)); + break; + } + break; + case HostCmd_CMD_TDLS_OPERATION: + wlan_process_cmdreps_error_tdls_operation(pmpriv, resp); + break; + case HostCmd_CMD_802_11_ASSOCIATE: wlan_reset_connect_state(pmpriv, MTRUE); break; @@ -408,12 +496,10 @@ wlan_get_power_level(pmlan_private pmpriv, void *pdata_buf) } while (length) { pg++; - if (max_power < pg->power_max) { + if (max_power < pg->power_max) max_power = pg->power_max; - } - if (min_power > pg->power_min) { + if (min_power > pg->power_min) min_power = pg->power_min; - } length -= sizeof(Power_Group_t); } if (ppg_tlv->length > 0) { @@ -623,6 +709,7 @@ wlan_ret_802_11_sleep_period(IN pmlan_private pmpriv, + MLAN_SUB_COMMAND_SIZE; } pmpriv->adapter->sleep_period.period = sleep_pd; + pmpriv->adapter->saved_sleep_period.period = sleep_pd; pmpriv->adapter->pps_uapsd_mode = MFALSE; if ((pmpriv->adapter->sleep_period.period != 0) && @@ -1327,6 +1414,358 @@ wlan_ret_mgmt_ie_list(IN pmlan_private pmpriv, } /** + * @brief This function enable/disable tdls powermode + * + * @param pmpriv A pointer to mlan_private structure + * @param powermode 1--enable, 0--disable + * + * @return N/A + */ +static void +wlan_set_tdls_powermode(IN pmlan_private pmpriv, t_u8 powermode) +{ + ENTER(); + + if (powermode) { + pmpriv->wmm_qosinfo = DEFAULT_TDLS_WMM_QOS_INFO; + if (!pmpriv->adapter->sleep_period.period) + pmpriv->adapter->sleep_period.period = + DEFAULT_TDLS_SLEEP_PERIOD; + } else { + pmpriv->wmm_qosinfo = pmpriv->saved_wmm_qosinfo; + pmpriv->adapter->sleep_period.period = + pmpriv->adapter->saved_sleep_period.period; + } + pmpriv->adapter->pps_uapsd_mode = MFALSE; + if ((pmpriv->adapter->sleep_period.period != 0) && + (pmpriv->adapter->sleep_period.period != + SLEEP_PERIOD_RESERVED_FF)) { + pmpriv->adapter->gen_null_pkt = MTRUE; + } else { + pmpriv->adapter->delay_null_pkt = MFALSE; + pmpriv->adapter->gen_null_pkt = MFALSE; + } + LEAVE(); + return; +} + +/** + * @brief This function handles the command response of TDLS_CONFIG + * + * @param pmpriv A pointer to mlan_private structure + * @param resp A pointer to HostCmd_DS_COMMAND + * @param pioctl_buf A pointer to mlan_ioctl_req structure + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +static mlan_status +wlan_ret_tdls_config(IN pmlan_private pmpriv, + IN HostCmd_DS_COMMAND * resp, + OUT mlan_ioctl_req * pioctl_buf) +{ + t_u8 i = 0; + t_u16 link_length = 0, final_data_rate = 0; + mlan_ds_misc_cfg *misc = MNULL; + tdls_all_config *tdls_all_cfg = MNULL; + sta_node *sta_ptr = MNULL; + HostCmd_DS_TDLS_CONFIG *ptdls_config_data = + &(resp->params.tdls_config_data); + pmlan_adapter pmadapter = pmpriv->adapter; + tdls_each_link_status *link_ptr = MNULL; + + ENTER(); + + ptdls_config_data->tdls_info.tdls_action = + wlan_le16_to_cpu(ptdls_config_data->tdls_info.tdls_action); + switch (ptdls_config_data->tdls_info.tdls_action) { + case WLAN_TDLS_CONFIG: + misc = (mlan_ds_misc_cfg *) pioctl_buf->pbuf; + tdls_all_cfg = + (tdls_all_config *) ptdls_config_data->tdls_info. + tdls_data; + if (wlan_le16_to_cpu(tdls_all_cfg->u.tdls_config.enable) == 0) { + PRINTM(MINFO, "TDLS disable successful.\n"); + wlan_delete_station_list(pmpriv); + pmadapter->tdls_status = TDLS_NOT_SETUP; + if (pmpriv->saved_wmm_qosinfo) + pmpriv->wmm_qosinfo = pmpriv->saved_wmm_qosinfo; + if (pmadapter->saved_sleep_period.period) + pmadapter->sleep_period.period = + pmadapter->saved_sleep_period.period; + } + break; + + case WLAN_TDLS_SET_INFO: + break; + + case WLAN_TDLS_DISCOVERY_REQ: + misc = (mlan_ds_misc_cfg *) pioctl_buf->pbuf; + tdls_all_cfg = + (tdls_all_config *) ptdls_config_data->tdls_info. + tdls_data; + tdls_all_cfg->u.tdls_discovery_resp.payload_len = + wlan_le16_to_cpu(tdls_all_cfg->u.tdls_discovery_resp. + payload_len); + tdls_all_cfg->u.tdls_discovery_resp.cap_info = + wlan_le16_to_cpu(tdls_all_cfg->u.tdls_discovery_resp. + cap_info); + memcpy(pmpriv->adapter, &misc->param.tdls_config, + &ptdls_config_data->tdls_info, + MIN(sizeof(mlan_ds_misc_tdls_config), + (resp->size - S_DS_GEN))); + PRINTM(MCMND, "TDLS_DISCOVERY_REQ: " MACSTR "\n", + MAC2STR(tdls_all_cfg->u.tdls_discovery_resp. + peer_mac_addr)); + break; + + case WLAN_TDLS_SETUP_REQ: + /* + * TDLS link being setup, block all data for this Peer + */ + tdls_all_cfg = + (tdls_all_config *) ptdls_config_data->tdls_info. + tdls_data; + PRINTM(MCMND, "TDLS_SETUP_REQ: " MACSTR "\n", + MAC2STR(tdls_all_cfg->u.tdls_setup.peer_mac_addr)); + sta_ptr = + wlan_get_station_entry(pmpriv, + tdls_all_cfg->u.tdls_setup. + peer_mac_addr); + if (!sta_ptr) { + sta_ptr = + wlan_add_station_entry(pmpriv, + tdls_all_cfg->u. + tdls_setup. + peer_mac_addr); + if (sta_ptr) { + sta_ptr->status = TDLS_SETUP_INPROGRESS; + wlan_hold_tdls_packets(pmpriv, + tdls_all_cfg->u. + tdls_setup. + peer_mac_addr); + } + } + break; + + case WLAN_TDLS_TEAR_DOWN_REQ: + /* + * TDLS link torn down, open data ports if blocked + */ + tdls_all_cfg = + (tdls_all_config *) ptdls_config_data->tdls_info. + tdls_data; + wlan_restore_tdls_packets(pmpriv, + tdls_all_cfg->u.tdls_tear_down. + peer_mac_addr, TDLS_TEAR_DOWN); + PRINTM(MCMND, "TDLS_TEARDOWN_REQ: " MACSTR "\n", + MAC2STR(tdls_all_cfg->u.tdls_tear_down.peer_mac_addr)); + sta_ptr = + wlan_get_station_entry(pmpriv, + tdls_all_cfg->u.tdls_tear_down. + peer_mac_addr); + if (sta_ptr) { + + if (sta_ptr->is_11n_enabled) { + wlan_cleanup_reorder_tbl(pmpriv, + tdls_all_cfg->u. + tdls_tear_down. + peer_mac_addr); + pmadapter->callbacks.moal_spin_lock(pmadapter-> + pmoal_handle, + pmpriv->wmm. + ra_list_spinlock); + wlan_11n_cleanup_txbastream_tbl(pmpriv, + tdls_all_cfg->u. + tdls_tear_down. + peer_mac_addr); + pmadapter->callbacks. + moal_spin_unlock(pmadapter-> + pmoal_handle, + pmpriv->wmm. + ra_list_spinlock); + } + wlan_delete_station_entry(pmpriv, + tdls_all_cfg->u. + tdls_tear_down.peer_mac_addr); + if (MTRUE == wlan_is_station_list_empty(pmpriv)) + pmadapter->tdls_status = TDLS_NOT_SETUP; + else + pmadapter->tdls_status = TDLS_IN_BASE_CHANNEL; + } + break; + case WLAN_TDLS_INIT_CHAN_SWITCH: + tdls_all_cfg = + (tdls_all_config *) ptdls_config_data->tdls_info. + tdls_data; + PRINTM(MCMND, + "TDLS_INIT_CHANNEL_SWITCH: " MACSTR + " chan=%d periodicity=%d\n", + MAC2STR(tdls_all_cfg->u.tdls_chan_switch.peer_mac_addr), + (int)tdls_all_cfg->u.tdls_chan_switch.primary_channel, + (int)tdls_all_cfg->u.tdls_chan_switch.periodicity); + break; + + case WLAN_TDLS_LINK_STATUS: + misc = (mlan_ds_misc_cfg *) pioctl_buf->pbuf; + tdls_all_cfg = + (tdls_all_config *) ptdls_config_data->tdls_info. + tdls_data; + tdls_all_cfg->u.tdls_link_status_resp.payload_len = + wlan_le16_to_cpu(tdls_all_cfg->u.tdls_link_status_resp. + payload_len); + link_ptr = tdls_all_cfg->u.tdls_link_status_resp.link_stats; + for (i = 0; + i < tdls_all_cfg->u.tdls_link_status_resp.active_links; + i++) { + link_ptr->active_channel = + wlan_le32_to_cpu(link_ptr->active_channel); + link_ptr->data_rssi_last = + wlan_le16_to_cpu(link_ptr->data_rssi_last); + link_ptr->data_nf_last = + wlan_le16_to_cpu(link_ptr->data_nf_last); + link_ptr->data_rssi_avg = + wlan_le16_to_cpu(link_ptr->data_rssi_avg); + link_ptr->data_nf_avg = + wlan_le16_to_cpu(link_ptr->data_nf_avg); + link_length = sizeof(tdls_each_link_status); + /* adjust as per open or secure network */ + if (link_ptr->link_flags & 0x02) { + link_ptr->key_lifetime = + wlan_le32_to_cpu(link_ptr-> + key_lifetime); + link_length += link_ptr->key_length; + } else { + link_length -= + sizeof(link_ptr->security_method) + + sizeof(link_ptr->key_lifetime) + + sizeof(link_ptr->key_length); + } + final_data_rate = + (t_u16) wlan_index_to_data_rate(pmadapter, + link_ptr->u. + rate_info. + tx_data_rate, + link_ptr->u. + rate_info. + tx_rate_htinfo); + link_ptr->u.final_data_rate = final_data_rate / 2; + + link_ptr = + (tdls_each_link_status *) (((t_u8 *) link_ptr) + + link_length); + } + memcpy(pmpriv->adapter, &misc->param.tdls_config, + &ptdls_config_data->tdls_info, + MIN(sizeof(mlan_ds_misc_tdls_config), + (resp->size - S_DS_GEN))); + break; + case WLAN_TDLS_POWER_MODE: + misc = (mlan_ds_misc_cfg *) pioctl_buf->pbuf; + tdls_all_cfg = + (tdls_all_config *) ptdls_config_data->tdls_info. + tdls_data; + wlan_set_tdls_powermode(pmpriv, + (t_u8) tdls_all_cfg->u.tdls_power_mode. + power_mode); + break; + case WLAN_TDLS_STOP_CHAN_SWITCH: + tdls_all_cfg = + (tdls_all_config *) ptdls_config_data->tdls_info. + tdls_data; + PRINTM(MCMND, "TDLS_STOP_CHANNEL_SWITCH: " MACSTR "\n", + MAC2STR(tdls_all_cfg->u.tdls_stop_chan_switch. + peer_mac_addr)); + break; + case WLAN_TDLS_CS_PARAMS: + case WLAN_TDLS_CS_DISABLE: + case WLAN_TDLS_DEBUG_STOP_RX: + case WLAN_TDLS_DEBUG_ALLOW_WEAK_SECURITY: + case WLAN_TDLS_DEBUG_SETUP_SAME_LINK: + case WLAN_TDLS_DEBUG_FAIL_SETUP_CONFIRM: + case WLAN_TDLS_DEBUG_WRONG_BSS: + case WLAN_TDLS_DEBUG_SETUP_PROHIBITED: + case WLAN_TDLS_DEBUG_HIGHER_LOWER_MAC: + case WLAN_TDLS_DEBUG_IGNORE_KEY_EXPIRY: + case WLAN_TDLS_DEBUG_CS_RET_IM: + break; + default: + if (pioctl_buf) + pioctl_buf->status_code = MLAN_ERROR_CMD_RESP_FAIL; + LEAVE(); + return MLAN_STATUS_FAILURE; + } + + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + +/** + * @brief This function handles the command response of TDLS_OPERATION + * + * @param pmpriv A pointer to mlan_private structure + * @param resp A pointer to HostCmd_DS_COMMAND + * @param pioctl_buf A pointer to mlan_ioctl_req structure + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +static mlan_status +wlan_ret_tdls_oper(IN pmlan_private pmpriv, + IN HostCmd_DS_COMMAND * resp, + OUT mlan_ioctl_req * pioctl_buf) +{ + HostCmd_DS_TDLS_OPER *ptdls_oper = &(resp->params.tdls_oper_data); + sta_node *sta_ptr = MNULL; + t_u16 reason = 0; + + ENTER(); + + ptdls_oper->tdls_action = wlan_le16_to_cpu(ptdls_oper->tdls_action); + + sta_ptr = wlan_get_station_entry(pmpriv, ptdls_oper->peer_mac); + reason = wlan_le16_to_cpu(ptdls_oper->reason); + switch (ptdls_oper->tdls_action) { + case TDLS_CREATE: + if (reason) { + PRINTM(MMSG, + "TDLS: create link " MACSTR " fail, reason=%d\n", + MAC2STR(ptdls_oper->peer_mac), reason); + if (reason != TDLS_LINK_EXISTS && sta_ptr) + sta_ptr->status = TDLS_SETUP_FAILURE; + } else { + PRINTM(MMSG, "TDLS: create link " MACSTR " success\n", + MAC2STR(ptdls_oper->peer_mac), reason); + } + break; + case TDLS_CONFIG: + if (reason) { + PRINTM(MMSG, + "TDLS: Config link " MACSTR " fail, reason=%d\n", + MAC2STR(ptdls_oper->peer_mac), reason); + if (sta_ptr) + sta_ptr->status = TDLS_SETUP_FAILURE; + } else { + PRINTM(MMSG, "TDLS: Config link " MACSTR " success\n", + MAC2STR(ptdls_oper->peer_mac)); + } + break; + case TDLS_DELETE: + if (reason) + PRINTM(MMSG, + "TDLS: Delete link " MACSTR " fail, reason=%d\n", + MAC2STR(ptdls_oper->peer_mac), reason); + else + PRINTM(MMSG, "TDLS: Delete link " MACSTR " success\n", + MAC2STR(ptdls_oper->peer_mac)); + break; + default: + break; + } + + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + +/** * @brief This function handles the command response of sysclock * * @param pmpriv A pointer to mlan_private structure @@ -1570,6 +2009,7 @@ wlan_ops_sta_process_cmdresp(IN t_void * priv, ret = wlan_ret_802_11_associate(pmpriv, resp, pioctl_buf); break; case HostCmd_CMD_802_11_DEAUTHENTICATE: + case HostCmd_CMD_802_11_DISASSOCIATE: ret = wlan_ret_802_11_deauthenticate(pmpriv, resp, pioctl_buf); break; case HostCmd_CMD_802_11_AD_HOC_START: @@ -1690,6 +2130,12 @@ wlan_ops_sta_process_cmdresp(IN t_void * priv, case HostCmd_CMD_MGMT_IE_LIST: ret = wlan_ret_mgmt_ie_list(pmpriv, resp, pioctl_buf); break; + case HostCmd_CMD_TDLS_CONFIG: + ret = wlan_ret_tdls_config(pmpriv, resp, pioctl_buf); + break; + case HostCmd_CMD_TDLS_OPERATION: + ret = wlan_ret_tdls_oper(pmpriv, resp, pioctl_buf); + break; case HostCmd_CMD_11N_CFG: ret = wlan_ret_11n_cfg(pmpriv, resp, pioctl_buf); break; diff --git a/drivers/net/wireless/sd8797/mlan/mlan_sta_event.c b/drivers/net/wireless/sd8797/mlan/mlan_sta_event.c index 199a42bf27c5..363c5fa807ad 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_sta_event.c +++ b/drivers/net/wireless/sd8797/mlan/mlan_sta_event.c @@ -2,20 +2,25 @@ * * @brief This file contains MLAN event handling. * - * Copyright (C) 2008-2011, Marvell International Ltd. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. */ /******************************************************** @@ -42,36 +47,315 @@ Change log: /** * @brief This function handles link lost, deauth and - * disassoc events. + * disassoc events. * - * @param pmpriv A pointer to mlan_private structure - * @return N/A + * @param pmpriv A pointer to mlan_private structure + * @return N/A */ static t_void wlan_handle_disconnect_event(pmlan_private pmpriv) { ENTER(); - if (pmpriv->media_connected == MTRUE) { + if (pmpriv->media_connected == MTRUE) wlan_reset_connect_state(pmpriv, MTRUE); + + LEAVE(); +} + +/** + * @brief This function will parse the TDLS event for further wlan action + * + * @param priv A pointer to mlan_private + * @param pevent A pointer to event buf + * + * @return N/A + */ +static void +wlan_parse_tdls_event(pmlan_private priv, pmlan_buffer pevent) +{ + Event_tdls_generic *tdls_event = (Event_tdls_generic *) + (pevent->pbuf + pevent->data_offset + sizeof(mlan_event_id)); + sta_node *sta_ptr = MNULL; + pmlan_adapter pmadapter = priv->adapter; + t_u8 i = 0; + IEEEtypes_HTCap_t *pht_cap = MNULL; + t_u16 ie_len = 0; + mlan_ds_misc_tdls_oper tdls_oper; + t_u8 event_buf[100]; + mlan_event *ptdls_event = (mlan_event *) event_buf; + tdls_tear_down_event *tdls_evt = + (tdls_tear_down_event *) ptdls_event->event_buf; + ENTER(); + + /* reason code is not mandatory, hence less by sizeof(t_u16) */ + if (pevent->data_len < (sizeof(Event_tdls_generic) - + sizeof(t_u16) - sizeof(mlan_event_id))) { + PRINTM(MERROR, "Invalid length %d for TDLS event\n", + pevent->data_len); + LEAVE(); + return; } + sta_ptr = wlan_get_station_entry(priv, tdls_event->peer_mac_addr); + PRINTM(MEVENT, "TDLS_EVENT: %d " MACSTR "\n", + wlan_le16_to_cpu(tdls_event->event_type), + MAC2STR(tdls_event->peer_mac_addr)); + switch (wlan_le16_to_cpu(tdls_event->event_type)) { + case TDLS_EVENT_TYPE_SETUP_REQ: + if (sta_ptr == MNULL) { + sta_ptr = + wlan_add_station_entry(priv, + tdls_event-> + peer_mac_addr); + if (sta_ptr) { + sta_ptr->status = TDLS_SETUP_INPROGRESS; + wlan_hold_tdls_packets(priv, + tdls_event-> + peer_mac_addr); + } + } + break; + + case TDLS_EVENT_TYPE_LINK_ESTABLISHED: + if (sta_ptr) { + sta_ptr->status = TDLS_SETUP_COMPLETE; + /* parse the TLV for station's capability */ + ie_len = wlan_le16_to_cpu(tdls_event->u.ie_data. + ie_length); + if (ie_len) { + pht_cap = + (IEEEtypes_HTCap_t *) + wlan_get_specific_ie(priv, + tdls_event->u. + ie_data.ie_ptr, + ie_len, + HT_CAPABILITY); + if (pht_cap) { + sta_ptr->is_11n_enabled = MTRUE; + if (GETHT_MAXAMSDU + (pht_cap->ht_cap.ht_cap_info)) + sta_ptr->max_amsdu = + MLAN_TX_DATA_BUF_SIZE_8K; + else + sta_ptr->max_amsdu = + MLAN_TX_DATA_BUF_SIZE_4K; + } + } + for (i = 0; i < MAX_NUM_TID; i++) { + if (sta_ptr->is_11n_enabled) + sta_ptr->ampdu_sta[i] = + priv->aggr_prio_tbl[i]. + ampdu_user; + else + sta_ptr->ampdu_sta[i] = + BA_STREAM_NOT_ALLOWED; + } + memset(priv->adapter, sta_ptr->rx_seq, 0xff, + sizeof(sta_ptr->rx_seq)); + wlan_restore_tdls_packets(priv, + tdls_event->peer_mac_addr, + TDLS_SETUP_COMPLETE); + pmadapter->tdls_status = TDLS_IN_BASE_CHANNEL; + } + break; + case TDLS_EVENT_TYPE_SETUP_FAILURE: + wlan_restore_tdls_packets(priv, tdls_event->peer_mac_addr, + TDLS_SETUP_FAILURE); + if (sta_ptr) + wlan_delete_station_entry(priv, + tdls_event->peer_mac_addr); + if (MTRUE == wlan_is_station_list_empty(priv)) + pmadapter->tdls_status = TDLS_NOT_SETUP; + else + pmadapter->tdls_status = TDLS_IN_BASE_CHANNEL; + break; + case TDLS_EVENT_TYPE_LINK_TORN_DOWN: + if (sta_ptr) { + if (sta_ptr->external_tdls) { + PRINTM(MMSG, + "Receive TDLS TEAR DOWN event, Disable TDLS LINK\n"); + memset(pmadapter, &tdls_oper, 0, + sizeof(tdls_oper)); + tdls_oper.tdls_action = WLAN_TDLS_DISABLE_LINK; + memcpy(priv->adapter, tdls_oper.peer_mac, + tdls_event->peer_mac_addr, + MLAN_MAC_ADDR_LENGTH); + /* Send command to firmware to delete tdls link */ + wlan_prepare_cmd(priv, + HostCmd_CMD_TDLS_OPERATION, + HostCmd_ACT_GEN_SET, + 0, + (t_void *) MNULL, &tdls_oper); + ptdls_event->bss_index = priv->bss_index; + ptdls_event->event_id = + MLAN_EVENT_ID_DRV_TDLS_TEARDOWN_REQ; + ptdls_event->event_len = + sizeof(tdls_tear_down_event); + memcpy(priv->adapter, + (t_u8 *) tdls_evt->peer_mac_addr, + tdls_event->peer_mac_addr, + MLAN_MAC_ADDR_LENGTH); + tdls_evt->reason_code = + wlan_le16_to_cpu(tdls_event->u. + reason_code); + wlan_recv_event(priv, + MLAN_EVENT_ID_DRV_TDLS_TEARDOWN_REQ, + ptdls_event); + /* Signal MOAL to trigger mlan_main_process */ + wlan_recv_event(priv, + MLAN_EVENT_ID_DRV_DEFER_HANDLING, + MNULL); + } + wlan_restore_tdls_packets(priv, + tdls_event->peer_mac_addr, + TDLS_TEAR_DOWN); + if (sta_ptr->is_11n_enabled) { + wlan_cleanup_reorder_tbl(priv, + tdls_event-> + peer_mac_addr); + pmadapter->callbacks.moal_spin_lock(pmadapter-> + pmoal_handle, + priv->wmm. + ra_list_spinlock); + wlan_11n_cleanup_txbastream_tbl(priv, + tdls_event-> + peer_mac_addr); + pmadapter->callbacks. + moal_spin_unlock(pmadapter-> + pmoal_handle, + priv->wmm. + ra_list_spinlock); + } + wlan_delete_station_entry(priv, + tdls_event->peer_mac_addr); + if (MTRUE == wlan_is_station_list_empty(priv)) + pmadapter->tdls_status = TDLS_NOT_SETUP; + else + pmadapter->tdls_status = TDLS_IN_BASE_CHANNEL; + } + break; + case TDLS_EVENT_TYPE_CHAN_SWITCH_RESULT: + PRINTM(MEVENT, + "TDLS_CHAN_SWITCH_RESULT: status=0x%x, reason=0x%x current_channel=%d\n", + tdls_event->u.switch_result.status, + tdls_event->u.switch_result.reason, + (int)tdls_event->u.switch_result.current_channel); + if (tdls_event->u.switch_result.status == MLAN_STATUS_SUCCESS) { + if (tdls_event->u.switch_result.current_channel == + TDLS_BASE_CHANNEL) { + /* enable traffic to AP */ + if (pmadapter->tdls_status != + TDLS_IN_BASE_CHANNEL) { + wlan_update_non_tdls_ralist(priv, + tdls_event-> + peer_mac_addr, + MFALSE); + pmadapter->tdls_status = + TDLS_IN_BASE_CHANNEL; + } + } else if (tdls_event->u.switch_result. + current_channel == TDLS_OFF_CHANNEL) { + /* pause traffic to AP */ + if (pmadapter->tdls_status != + TDLS_IN_OFF_CHANNEL) { + wlan_update_non_tdls_ralist(priv, + tdls_event-> + peer_mac_addr, + MTRUE); + pmadapter->tdls_status = + TDLS_IN_OFF_CHANNEL; + } + } + } else { + if (tdls_event->u.switch_result.current_channel == + TDLS_BASE_CHANNEL) + pmadapter->tdls_status = TDLS_IN_BASE_CHANNEL; + else if (tdls_event->u.switch_result.current_channel == + TDLS_OFF_CHANNEL) + pmadapter->tdls_status = TDLS_IN_OFF_CHANNEL; + } + break; + case TDLS_EVENT_TYPE_START_CHAN_SWITCH: + PRINTM(MEVENT, "TDLS start channel switch....\n"); + pmadapter->tdls_status = TDLS_SWITCHING_CHANNEL; + break; + case TDLS_EVENT_TYPE_CHAN_SWITCH_STOPPED: + PRINTM(MEVENT, "TDLS channel switch stopped, reason=%d\n", + tdls_event->u.cs_stop_reason); + break; + case TDLS_EVENT_TYPE_DEBUG: + case TDLS_EVENT_TYPE_PACKET: + break; + default: + PRINTM(MERROR, "unknown event type %d\n", + wlan_le16_to_cpu(tdls_event->event_type)); + break; + } LEAVE(); } +/** + * @brief This function send the tdls teardown request event. + * + * @param priv A pointer to mlan_private + * + * @return N/A + */ +void +wlan_send_tdls_tear_down_request(pmlan_private priv) +{ + t_u8 event_buf[100]; + mlan_event *ptdls_event = (mlan_event *) event_buf; + tdls_tear_down_event *tdls_evt = + (tdls_tear_down_event *) ptdls_event->event_buf; + sta_node *sta_ptr = MNULL; + + ENTER(); + + sta_ptr = (sta_node *) util_peek_list(priv->adapter->pmoal_handle, + &priv->sta_list, + priv->adapter->callbacks. + moal_spin_lock, + priv->adapter->callbacks. + moal_spin_unlock); + if (!sta_ptr) { + LEAVE(); + return; + } + while (sta_ptr != (sta_node *) & priv->sta_list) { + if (sta_ptr->external_tdls) { + ptdls_event->bss_index = priv->bss_index; + ptdls_event->event_id = + MLAN_EVENT_ID_DRV_TDLS_TEARDOWN_REQ; + ptdls_event->event_len = sizeof(tdls_tear_down_event); + memcpy(priv->adapter, (t_u8 *) tdls_evt->peer_mac_addr, + sta_ptr->mac_addr, MLAN_MAC_ADDR_LENGTH); + tdls_evt->reason_code = + WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED; + wlan_recv_event(priv, + MLAN_EVENT_ID_DRV_TDLS_TEARDOWN_REQ, + ptdls_event); + } + sta_ptr = sta_ptr->pnext; + } + LEAVE(); + return; +} + /******************************************************** Global Functions ********************************************************/ /** * @brief This function handles disconnect event, reports disconnect - * to upper layer, cleans tx/rx packets, - * resets link state etc. + * to upper layer, cleans tx/rx packets, + * resets link state etc. * - * @param priv A pointer to mlan_private structure - * @param drv_disconnect Flag indicating the driver should disconnect - * and flush pending packets. + * @param priv A pointer to mlan_private structure + * @param drv_disconnect Flag indicating the driver should disconnect + * and flush pending packets. * - * @return N/A + * @return N/A */ t_void wlan_reset_connect_state(pmlan_private priv, t_u8 drv_disconnect) @@ -143,6 +427,11 @@ wlan_reset_connect_state(pmlan_private priv, t_u8 drv_disconnect) &priv->curr_bss_params, 0x00, sizeof(priv->curr_bss_params)); } + wlan_send_tdls_tear_down_request(priv); + wlan_delete_station_list(priv); + pmadapter->tdls_status = TDLS_NOT_SETUP; + priv->wmm_qosinfo = priv->saved_wmm_qosinfo; + pmadapter->sleep_period.period = pmadapter->saved_sleep_period.period; pmadapter->tx_lock_flag = MFALSE; pmadapter->pps_uapsd_mode = MFALSE; pmadapter->delay_null_pkt = MFALSE; @@ -209,11 +498,92 @@ wlan_2040_coex_event(pmlan_private pmpriv) } /** + * @brief This function will process tx pause event + * + * + * @param priv A pointer to mlan_private + * @param pevent A pointer to event buf + * + * @return N/A + */ +static void +wlan_process_sta_tx_pause_event(pmlan_private priv, pmlan_buffer pevent) +{ + t_u16 tlv_type, tlv_len; + int tlv_buf_left = pevent->data_len - sizeof(t_u32); + MrvlIEtypesHeader_t *tlv = + (MrvlIEtypesHeader_t *) (pevent->pbuf + pevent->data_offset + + sizeof(t_u32)); + MrvlIEtypes_tx_pause_t *tx_pause_tlv; + sta_node *sta_ptr = MNULL; + tdlsStatus_e status; + t_u8 *bssid = MNULL; + ENTER(); + if (priv->media_connected) + bssid = priv->curr_bss_params.bss_descriptor.mac_address; + while (tlv_buf_left >= (int)sizeof(MrvlIEtypesHeader_t)) { + tlv_type = wlan_le16_to_cpu(tlv->type); + tlv_len = wlan_le16_to_cpu(tlv->len); + if ((sizeof(MrvlIEtypesHeader_t) + tlv_len) > + (unsigned int)tlv_buf_left) { + PRINTM(MERROR, "wrong tlv: tlvLen=%d, tlvBufLeft=%d\n", + tlv_len, tlv_buf_left); + break; + } + if (tlv_type == TLV_TYPE_TX_PAUSE) { + tx_pause_tlv = (MrvlIEtypes_tx_pause_t *) tlv; + PRINTM(MCMND, + "TDLS TxPause: " MACSTR " pause=%d, pkts=%d\n", + MAC2STR(tx_pause_tlv->peermac), + tx_pause_tlv->tx_pause, tx_pause_tlv->pkt_cnt); + if (bssid && + !memcmp(priv->adapter, bssid, tx_pause_tlv->peermac, + MLAN_MAC_ADDR_LENGTH)) { + if (tx_pause_tlv->tx_pause) + priv->port_open = MFALSE; + else + priv->port_open = MTRUE; + } else { + status = wlan_get_tdls_link_status(priv, + tx_pause_tlv-> + peermac); + if (MTRUE == wlan_is_tdls_link_setup(status)) { + sta_ptr = + wlan_get_station_entry(priv, + tx_pause_tlv-> + peermac); + if (sta_ptr) { + if (sta_ptr->tx_pause != + tx_pause_tlv->tx_pause) { + sta_ptr->tx_pause = + tx_pause_tlv-> + tx_pause; + wlan_update_ralist_tx_pause + (priv, + tx_pause_tlv-> + peermac, + tx_pause_tlv-> + tx_pause); + } + } + } + } + } + tlv_buf_left -= (sizeof(MrvlIEtypesHeader_t) + tlv_len); + tlv = (MrvlIEtypesHeader_t *) ((t_u8 *) tlv + tlv_len + + sizeof(MrvlIEtypesHeader_t)); + } + + LEAVE(); + return; +} + +/** * @brief This function handles events generated by firmware * - * @param priv A pointer to mlan_private structure + * @param priv A pointer to mlan_private structure * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_ops_sta_process_event(IN t_void * priv) @@ -309,7 +679,7 @@ wlan_ops_sta_process_event(IN t_void * priv) break; case EVENT_PS_AWAKE: - PRINTM(MINFO, "EVENT: AWAKE \n"); + PRINTM(MINFO, "EVENT: AWAKE\n"); PRINTM(MEVENT, "|"); if (!pmadapter->pps_uapsd_mode && pmpriv->media_connected && @@ -683,15 +1053,39 @@ wlan_ops_sta_process_event(IN t_void * priv) break; #endif /* WIFI_DIRECT_SUPPORT */ + case EVENT_TDLS_GENERIC_EVENT: + PRINTM(MEVENT, "EVENT: TDLS event %d\n", eventcause); + wlan_parse_tdls_event(pmpriv, pmbuf); + /* Allocate memory for event buffer */ + ret = pcb->moal_malloc(pmadapter->pmoal_handle, MAX_EVENT_SIZE, + MLAN_MEM_DEF, &evt_buf); + if ((ret == MLAN_STATUS_SUCCESS) && evt_buf) { + pevent = (pmlan_event) evt_buf; + pevent->bss_index = pmpriv->bss_index; + pevent->event_id = MLAN_EVENT_ID_DRV_PASSTHRU; + pevent->event_len = pmbuf->data_len; + memcpy(pmadapter, (t_u8 *) pevent->event_buf, + pmbuf->pbuf + pmbuf->data_offset, + pevent->event_len); + wlan_recv_event(pmpriv, pevent->event_id, pevent); + pcb->moal_mfree(pmadapter->pmoal_handle, evt_buf); + } + break; + + case EVENT_TX_DATA_PAUSE: + PRINTM(MEVENT, "EVENT: TX_DATA_PAUSE\n"); + wlan_process_sta_tx_pause_event(priv, pmbuf); + break; + case EVENT_SAD_REPORT: { - t_u8 *pEvtDat = + t_u8 *pevt_dat = pmbuf->pbuf + pmbuf->data_offset + sizeof(t_u32); PRINTM(MEVENT, "EVENT: Antenna Diversity %d (%d, %d, %d, %d)\n", - eventcause, pEvtDat[0] + 1, pEvtDat[1] + 1, - pEvtDat[2], pEvtDat[3]); + eventcause, pevt_dat[0] + 1, pevt_dat[1] + 1, + pevt_dat[2], pevt_dat[3]); } break; diff --git a/drivers/net/wireless/sd8797/mlan/mlan_sta_ioctl.c b/drivers/net/wireless/sd8797/mlan/mlan_sta_ioctl.c index fbcd1768dd94..29e3266f47ff 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_sta_ioctl.c +++ b/drivers/net/wireless/sd8797/mlan/mlan_sta_ioctl.c @@ -2,20 +2,25 @@ * * @brief This file contains the functions for station ioctl. * - * Copyright (C) 2008-2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved + * + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. + * */ /****************************************************** @@ -47,9 +52,9 @@ Change log: /** * @brief enable adhoc aes key * - * @param pmpriv A pointer to mlan_private structure + * @param pmpriv A pointer to mlan_private structure * - * @return N/A + * @return N/A */ static void wlan_enable_aes_key(pmlan_private pmpriv) @@ -326,6 +331,8 @@ wlan_get_info_ioctl(IN pmlan_adapter pmadapter, IN pmlan_ioctl_req pioctl_req) pget_info->param.fw_info.region_code = pmadapter->region_code; pget_info->param.fw_info.hw_dev_mcs_support = pmadapter->hw_dev_mcs_support; + pget_info->param.fw_info.hw_dot_11n_dev_cap = + pmadapter->hw_dot_11n_dev_cap; break; case MLAN_OID_GET_BSS_INFO: status = wlan_get_info_bss_info(pmadapter, pioctl_req); @@ -506,8 +513,9 @@ wlan_radio_ioctl_band_cfg(IN pmlan_adapter pmadapter, DEFAULT_AD_HOC_CHANNEL_A; } } - } else { /* Return error if adhoc_band and adhoc_channel - combination is invalid */ + } else { + /* Return error if adhoc_band and adhoc_channel + combination is invalid */ if (!wlan_find_cfp_by_band_and_channel (pmadapter, pmadapter->adhoc_start_band, (t_u16) adhoc_channel)) { @@ -527,25 +535,20 @@ wlan_radio_ioctl_band_cfg(IN pmlan_adapter pmadapter, pmadapter->adhoc_11n_enabled = MFALSE; } } else { - radio_cfg->param.band_cfg.config_bands = pmpriv->config_bands; /* Infra - Bands - */ - radio_cfg->param.band_cfg.adhoc_start_band = pmadapter->adhoc_start_band; /* Adhoc - Band - */ - radio_cfg->param.band_cfg.adhoc_channel = pmpriv->adhoc_channel; /* Adhoc - Channel - */ - radio_cfg->param.band_cfg.fw_bands = pmadapter->fw_bands; /* FW - support - Bands - */ + /* Infra Bands */ + radio_cfg->param.band_cfg.config_bands = pmpriv->config_bands; + /* Adhoc Band */ + radio_cfg->param.band_cfg.adhoc_start_band = + pmadapter->adhoc_start_band; + /* Adhoc Channel */ + radio_cfg->param.band_cfg.adhoc_channel = pmpriv->adhoc_channel; + /* FW support Bands */ + radio_cfg->param.band_cfg.fw_bands = pmadapter->fw_bands; PRINTM(MINFO, "Global config band = %d\n", pmadapter->config_bands); - radio_cfg->param.band_cfg.sec_chan_offset = pmadapter->chan_bandwidth; /* adhoc - channel - bandwidth - */ + /* adhoc channel bandwidth */ + radio_cfg->param.band_cfg.sec_chan_offset = + pmadapter->chan_bandwidth; } @@ -2025,9 +2028,8 @@ wlan_pm_ioctl_inactivity_timeout(IN pmlan_adapter pmadapter, pmcfg = (mlan_ds_pm_cfg *) pioctl_req->pbuf; cmd_action = HostCmd_ACT_GEN_GET; - if (pioctl_req->action == MLAN_ACT_SET) { + if (pioctl_req->action == MLAN_ACT_SET) cmd_action = HostCmd_ACT_GEN_SET; - } /* Send request to firmware */ ret = wlan_prepare_cmd(pmpriv, @@ -2045,7 +2047,7 @@ wlan_pm_ioctl_inactivity_timeout(IN pmlan_adapter pmadapter, /** * @brief Enable/Disable Auto Deep Sleep * - * @param pmadapter A pointer to mlan_adapter structure + * @param pmadapter A pointer to mlan_adapter structure * @param pioctl_req A pointer to ioctl request buffer * * @return MLAN_STATUS_PENDING --success, otherwise fail @@ -2235,9 +2237,8 @@ wlan_set_get_sleep_params(IN pmlan_adapter pmadapter, pm_cfg = (mlan_ds_pm_cfg *) pioctl_req->pbuf; cmd_action = HostCmd_ACT_GEN_GET; - if (pioctl_req->action == MLAN_ACT_SET) { + if (pioctl_req->action == MLAN_ACT_SET) cmd_action = HostCmd_ACT_GEN_SET; - } /* Send command to firmware */ ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_802_11_SLEEP_PARAMS, @@ -2380,7 +2381,7 @@ wlan_set_wpa_ie_helper(mlan_private * priv, t_u8 * ie_data_ptr, t_u16 ie_len) if (ie_len) { if (ie_len > sizeof(priv->wpa_ie)) { - PRINTM(MERROR, "failed to copy, WPA IE is too big \n"); + PRINTM(MERROR, "failed to copy, WPA IE is too big\n"); LEAVE(); return MLAN_STATUS_FAILURE; } @@ -2425,7 +2426,7 @@ wlan_set_wapi_ie(mlan_private * priv, t_u8 * ie_data_ptr, t_u16 ie_len) ENTER(); if (ie_len) { if (ie_len > sizeof(priv->wapi_ie)) { - PRINTM(MWARN, "failed to copy, WAPI IE is too big \n"); + PRINTM(MWARN, "failed to copy, WAPI IE is too big\n"); LEAVE(); return MLAN_STATUS_FAILURE; } @@ -2471,9 +2472,8 @@ wlan_sec_ioctl_wapi_enable(IN pmlan_adapter pmadapter, else sec->param.wapi_enabled = MFALSE; } else { - if (sec->param.wapi_enabled == MFALSE) { + if (sec->param.wapi_enabled == MFALSE) wlan_set_wapi_ie(pmpriv, MNULL, 0); - } } pioctl_req->data_read_written = sizeof(t_u32) + MLAN_SUB_COMMAND_SIZE; LEAVE(); @@ -2654,9 +2654,8 @@ wlan_sec_ioctl_wpa_enable(IN pmlan_adapter pmadapter, else sec->param.wpa_enabled = MFALSE; } else { - if (sec->param.wpa_enabled == MFALSE) { + if (sec->param.wpa_enabled == MFALSE) wlan_set_wpa_ie_helper(pmpriv, MNULL, 0); - } /** clear adhoc aes flag, when WPA enabled */ pmpriv->adhoc_aes_enabled = MFALSE; pmpriv->aes_key.key_len = 0; @@ -3998,9 +3997,8 @@ wlan_misc_ioctl_warm_reset(IN pmlan_adapter pmadapter, ENTER(); /** Init all the head nodes and free all the locks here */ - for (i = 0; i < pmadapter->priv_num; i++) { + for (i = 0; i < pmadapter->priv_num; i++) wlan_free_priv(pmadapter->priv[i]); - } while ((pmbuf = (pmlan_buffer) util_dequeue_list(pmadapter->pmoal_handle, @@ -4018,9 +4016,8 @@ wlan_misc_ioctl_warm_reset(IN pmlan_adapter pmadapter, /* Initialize private structures */ for (i = 0; i < pmadapter->priv_num; i++) { - if (pmadapter->priv[i]) { + if (pmadapter->priv[i]) wlan_init_priv(pmadapter->priv[i]); - } } /* Restart the firmware */ @@ -4324,11 +4321,10 @@ wlan_misc_ioctl_subscribe_evt(IN pmlan_adapter pmadapter, ENTER(); misc = (mlan_ds_misc_cfg *) pioctl_req->pbuf; - if (pioctl_req->action == MLAN_ACT_SET) { + if (pioctl_req->action == MLAN_ACT_SET) cmd_action = HostCmd_ACT_GEN_SET; - } else { + else cmd_action = HostCmd_ACT_GEN_GET; - } /* Send command to firmware */ ret = wlan_prepare_cmd(pmpriv, @@ -4956,6 +4952,15 @@ wlan_misc_cfg_ioctl(IN pmlan_adapter pmadapter, IN pmlan_ioctl_req pioctl_req) status = wlan_misc_ioctl_custom_ie_list(pmadapter, pioctl_req, MTRUE); break; + case MLAN_OID_MISC_TDLS_CONFIG: + status = wlan_misc_ioctl_tdls_config(pmadapter, pioctl_req); + break; + case MLAN_OID_MISC_TDLS_OPER: + status = wlan_misc_ioctl_tdls_oper(pmadapter, pioctl_req); + break; + case MLAN_OID_MISC_GET_TDLS_IES: + status = wlan_misc_ioctl_tdls_get_ies(pmadapter, pioctl_req); + break; case MLAN_OID_MISC_MAC_CONTROL: status = wlan_misc_ioctl_mac_control(pmadapter, pioctl_req); @@ -5087,7 +5092,8 @@ wlan_scan_ioctl(IN pmlan_adapter pmadapter, IN pmlan_ioctl_req pioctl_req) ENTER(); pscan = (mlan_ds_scan *) pioctl_req->pbuf; - if (pscan->sub_command == MLAN_OID_SCAN_CONFIG) + if (pscan->sub_command == MLAN_OID_SCAN_CONFIG + || pscan->sub_command == MLAN_OID_SCAN_BGSCAN_CONFIG) goto start_config; if (pmadapter->scan_processing && pioctl_req->action == MLAN_ACT_SET && pscan->sub_command != MLAN_OID_SCAN_CANCEL) { diff --git a/drivers/net/wireless/sd8797/mlan/mlan_sta_rx.c b/drivers/net/wireless/sd8797/mlan/mlan_sta_rx.c index 5c50144e0e71..c12696962dec 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_sta_rx.c +++ b/drivers/net/wireless/sd8797/mlan/mlan_sta_rx.c @@ -3,20 +3,25 @@ * @brief This file contains the handling of RX in MLAN * module. * - * Copyright (C) 2008-2011, Marvell International Ltd. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. */ /******************************************************** @@ -60,13 +65,151 @@ typedef struct { ********************************************************/ /** + * @brief This function process tdls action frame + * + * @param priv A pointer to mlan_private structure + * @param pbuf A pointer to tdls action frame buffer + * @param len len of tdls action frame buffer + * @return N/A + */ +void +wlan_process_tdls_action_frame(pmlan_private priv, t_u8 * pbuf, t_u32 len) +{ + sta_node *sta_ptr = MNULL; + t_u8 *peer; + t_u8 *pos, *end; + t_u8 action; + int ie_len = 0; + t_u8 i; + +#define TDLS_PAYLOAD_TYPE 2 +#define TDLS_CATEGORY 0x0c +#define TDLS_REQ_FIX_LEN 6 +#define TDLS_RESP_FIX_LEN 8 +#define TDLS_CONFIRM_FIX_LEN 6 + if (len < (sizeof(EthII_Hdr_t) + 3)) + return; + if (*(t_u8 *) (pbuf + sizeof(EthII_Hdr_t)) != TDLS_PAYLOAD_TYPE) + /* TDLS payload type = 2 */ + return; + if (*(t_u8 *) (pbuf + sizeof(EthII_Hdr_t) + 1) != TDLS_CATEGORY) + /* TDLS category = 0xc */ + return; + peer = pbuf + MLAN_MAC_ADDR_LENGTH; + + action = *(t_u8 *) (pbuf + sizeof(EthII_Hdr_t) + 2); + /* 2= payload type + category */ + + if (action > TDLS_SETUP_CONFIRM) { + /* just handle TDLS setup request/response/confirm */ + PRINTM(MMSG, "Recv TDLS Action: peer=" MACSTR ", action=%d\n", + MAC2STR(peer), action); + return; + } + + sta_ptr = wlan_add_station_entry(priv, peer); + if (!sta_ptr) + return; + if (action == TDLS_SETUP_REQUEST) { /* setup request */ + sta_ptr->status = TDLS_NOT_SETUP; + PRINTM(MMSG, "Recv TDLS SETUP Request: peer=" MACSTR "\n", + MAC2STR(peer)); + wlan_hold_tdls_packets(priv, peer); + if (len < (sizeof(EthII_Hdr_t) + TDLS_REQ_FIX_LEN)) + return; + pos = pbuf + sizeof(EthII_Hdr_t) + 4; + /* payload 1+ category 1 + action 1 +dialog 1 */ + sta_ptr->capability = mlan_ntohs(*(t_u16 *) pos); + ie_len = len - sizeof(EthII_Hdr_t) - TDLS_REQ_FIX_LEN; + pos += 2; + } else if (action == 1) { /* setup respons */ + PRINTM(MMSG, "Recv TDLS SETUP Response: peer=" MACSTR "\n", + MAC2STR(peer)); + if (len < (sizeof(EthII_Hdr_t) + TDLS_RESP_FIX_LEN)) + return; + pos = pbuf + sizeof(EthII_Hdr_t) + 6; + /* payload 1+ category 1 + action 1 +dialog 1 +status 2 */ + sta_ptr->capability = mlan_ntohs(*(t_u16 *) pos); + ie_len = len - sizeof(EthII_Hdr_t) - TDLS_RESP_FIX_LEN; + pos += 2; + } else { /* setup confirm */ + PRINTM(MMSG, "Recv TDLS SETUP Confirm: peer=" MACSTR "\n", + MAC2STR(peer)); + if (len < (sizeof(EthII_Hdr_t) + TDLS_CONFIRM_FIX_LEN)) + return; + pos = pbuf + sizeof(EthII_Hdr_t) + TDLS_CONFIRM_FIX_LEN; + /* payload 1+ category 1 + action 1 +dialog 1 + status 2 */ + ie_len = len - sizeof(EthII_Hdr_t) - TDLS_CONFIRM_FIX_LEN; + } + for (end = pos + ie_len; pos + 1 < end; pos += 2 + pos[1]) { + if (pos + 2 + pos[1] > end) + break; + switch (*pos) { + case SUPPORTED_RATES: + sta_ptr->rate_len = pos[1]; + for (i = 0; i < pos[1]; i++) + sta_ptr->support_rate[i] = pos[2 + i]; + break; + case EXTENDED_SUPPORTED_RATES: + for (i = 0; i < pos[1]; i++) + sta_ptr->support_rate[sta_ptr->rate_len + i] = + pos[2 + i]; + sta_ptr->rate_len += pos[1]; + break; + case HT_CAPABILITY: + memcpy(priv->adapter, (t_u8 *) & sta_ptr->HTcap, pos, + sizeof(IEEEtypes_HTCap_t)); + sta_ptr->is_11n_enabled = 1; + DBG_HEXDUMP(MDAT_D, "TDLS HT capability", + (t_u8 *) (&sta_ptr->HTcap), + MIN(sizeof(IEEEtypes_HTCap_t), + MAX_DATA_DUMP_LEN)); + break; + case HT_OPERATION: + memcpy(priv->adapter, &sta_ptr->HTInfo, pos, + sizeof(IEEEtypes_HTInfo_t)); + DBG_HEXDUMP(MDAT_D, "TDLS HT info", + (t_u8 *) (&sta_ptr->HTInfo), + MIN(sizeof(IEEEtypes_HTInfo_t), + MAX_DATA_DUMP_LEN)); + break; + case BSSCO_2040: + memcpy(priv->adapter, (t_u8 *) & sta_ptr->BSSCO_20_40, + pos, sizeof(IEEEtypes_2040BSSCo_t)); + break; + case EXT_CAPABILITY: + memcpy(priv->adapter, (t_u8 *) & sta_ptr->ExtCap, pos, + pos[1] + sizeof(IEEEtypes_Header_t)); + DBG_HEXDUMP(MDAT_D, "TDLS Extended capability", + (t_u8 *) (&sta_ptr->ExtCap), + sta_ptr->ExtCap.ieee_hdr.len + 2); + break; + case RSN_IE: + memcpy(priv->adapter, (t_u8 *) & sta_ptr->rsn_ie, pos, + pos[1] + sizeof(IEEEtypes_Header_t)); + DBG_HEXDUMP(MDAT_D, "TDLS Rsn ie ", + (t_u8 *) (&sta_ptr->rsn_ie), + pos[1] + sizeof(IEEEtypes_Header_t)); + break; + case QOS_INFO: + sta_ptr->qos_info = pos[2]; + PRINTM(MDAT_D, "TDLS qos info %x\n", sta_ptr->qos_info); + break; + default: + break; + } + } + return; +} + +/** * @brief This function processes received packet and forwards it - * to kernel/upper layer + * to kernel/upper layer * * @param pmadapter A pointer to mlan_adapter - * @param pmbuf A pointer to mlan_buffer which includes the received packet + * @param pmbuf A pointer to mlan_buffer which includes the received packet * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_process_rx_packet(pmlan_adapter pmadapter, pmlan_buffer pmbuf) @@ -83,6 +226,7 @@ wlan_process_rx_packet(pmlan_adapter pmadapter, pmlan_buffer pmbuf) { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; t_u8 appletalk_aarp_type[2] = { 0x80, 0xf3 }; t_u8 ipx_snap_type[2] = { 0x81, 0x37 }; + t_u8 tdls_action_type[2] = { 0x89, 0x0d }; ENTER(); @@ -94,9 +238,9 @@ wlan_process_rx_packet(pmlan_adapter pmadapter, pmlan_buffer pmbuf) /** Size of debugging structure */ #define SIZE_OF_DBG_STRUCT 4 if (prx_pd->rx_pkt_type == PKT_TYPE_DEBUG) { - t_u8 dbgType; - dbgType = *(t_u8 *) & prx_pkt->eth803_hdr; - if (dbgType == DBG_TYPE_SMALL) { + t_u8 dbg_type; + dbg_type = *(t_u8 *) & prx_pkt->eth803_hdr; + if (dbg_type == DBG_TYPE_SMALL) { PRINTM(MFW_D, "\n"); DBG_HEXDUMP(MFW_D, "FWDBG", (char *)((t_u8 *) & prx_pkt->eth803_hdr + @@ -155,6 +299,14 @@ wlan_process_rx_packet(pmlan_adapter pmadapter, pmlan_buffer pmbuf) HEXDUMP("RX Data: LLC/SNAP", (t_u8 *) & prx_pkt->rfc1042_hdr, sizeof(prx_pkt->rfc1042_hdr)); + if (!memcmp + (pmadapter, &prx_pkt->eth803_hdr.h803_len, tdls_action_type, + sizeof(tdls_action_type))) { + wlan_process_tdls_action_frame(priv, + ((t_u8 *) prx_pd + + prx_pd->rx_pkt_offset), + prx_pd->rx_pkt_length); + } /* Chop off the RxPD */ hdr_chop = (t_u32) ((t_ptr) & prx_pkt->eth803_hdr - @@ -191,9 +343,8 @@ wlan_process_rx_packet(pmlan_adapter pmadapter, pmlan_buffer pmbuf) "STA Rx Error: moal_recv_packet returned error\n"); } done: - if (ret != MLAN_STATUS_PENDING) { + if (ret != MLAN_STATUS_PENDING) wlan_free_mlan_buffer(pmadapter, pmbuf); - } LEAVE(); return ret; @@ -218,6 +369,7 @@ wlan_ops_sta_process_rx_packet(IN t_void * adapter, IN pmlan_buffer pmbuf) t_u8 ta[MLAN_MAC_ADDR_LENGTH]; t_u16 rx_pkt_type = 0; wlan_mgmt_pkt *pmgmt_pkt_hdr = MNULL; + sta_node *sta_ptr = MNULL; ENTER(); prx_pd = (RxPD *) (pmbuf->pbuf + pmbuf->data_offset); @@ -269,16 +421,30 @@ wlan_ops_sta_process_rx_packet(IN t_void * adapter, IN pmlan_buffer pmbuf) * If the packet is not an unicast packet then send the packet * directly to os. Don't pass thru rx reordering */ - if (!IS_11N_ENABLED(priv) || + if ((!IS_11N_ENABLED(priv) && + !(prx_pd->flags & RXPD_FLAG_PKT_DIRECT_LINK)) || memcmp(priv->adapter, priv->curr_addr, prx_pkt->eth803_hdr.dest_addr, MLAN_MAC_ADDR_LENGTH)) { wlan_process_rx_packet(pmadapter, pmbuf); goto done; } - if (queuing_ra_based(priv)) { + if (queuing_ra_based(priv) || + (prx_pd->flags & RXPD_FLAG_PKT_DIRECT_LINK)) { memcpy(pmadapter, ta, prx_pkt->eth803_hdr.src_addr, MLAN_MAC_ADDR_LENGTH); + if ((prx_pd->flags & RXPD_FLAG_PKT_DIRECT_LINK) && + (prx_pd->priority < MAX_NUM_TID)) { + PRINTM(MDATA, "tdls packet %p " MACSTR "\n", pmbuf, + MAC2STR(ta)); + sta_ptr = wlan_get_station_entry(priv, ta); + if (sta_ptr) { + sta_ptr->rx_seq[prx_pd->priority] = + prx_pd->seq_num; + sta_ptr->snr = prx_pd->snr; + sta_ptr->nf = prx_pd->nf; + } + } } else { if ((rx_pkt_type != PKT_TYPE_BAR) && (prx_pd->priority < MAX_NUM_TID)) diff --git a/drivers/net/wireless/sd8797/mlan/mlan_sta_tx.c b/drivers/net/wireless/sd8797/mlan/mlan_sta_tx.c index 7c9e888732a6..5a1906c2690a 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_sta_tx.c +++ b/drivers/net/wireless/sd8797/mlan/mlan_sta_tx.c @@ -3,20 +3,25 @@ * @brief This file contains the handling of data packet * transmission in MLAN module. * - * Copyright (C) 2008-2011, Marvell International Ltd. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. */ /******************************************************** @@ -53,7 +58,7 @@ Change log: * @param priv A pointer to mlan_private structure * @param pmbuf A pointer to the mlan_buffer for process * - * @return headptr or MNULL + * @return headptr or MNULL */ t_void * wlan_ops_sta_process_txpd(IN t_void * priv, IN pmlan_buffer pmbuf) @@ -128,6 +133,8 @@ wlan_ops_sta_process_txpd(IN t_void * priv, IN pmlan_buffer pmbuf) MRVDRV_TxPD_POWER_MGMT_LAST_PACKET; } } + if (pmbuf->flags & MLAN_BUF_FLAG_TDLS) + plocal_tx_pd->flags |= MRVDRV_TxPD_FLAGS_TDLS_PACKET; /* Offset of actual data */ plocal_tx_pd->tx_pkt_offset = (t_u16) ((t_ptr) pmbuf->pbuf + pmbuf->data_offset - @@ -161,7 +168,7 @@ done: * @param priv A pointer to mlan_private structure * @param flags Transmit Pkt Flags * - * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, otherwise failure + * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, otherwise failure */ mlan_status wlan_send_null_packet(pmlan_private priv, t_u8 flags) @@ -258,7 +265,7 @@ done: * * @param priv A pointer to mlan_private structure * - * @return MTRUE or MFALSE + * @return MTRUE or MFALSE */ t_u8 wlan_check_last_packet_indication(pmlan_private priv) diff --git a/drivers/net/wireless/sd8797/mlan/mlan_txrx.c b/drivers/net/wireless/sd8797/mlan/mlan_txrx.c index 6569a0c8e79b..95c6fea18924 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_txrx.c +++ b/drivers/net/wireless/sd8797/mlan/mlan_txrx.c @@ -3,20 +3,25 @@ * * @brief This file contains the handling of TX/RX in MLAN * - * Copyright (C) 2009-2011, Marvell International Ltd. + * (C) Copyright 2009-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. */ /************************************************************* @@ -92,7 +97,7 @@ wlan_handle_rx_packet(pmlan_adapter pmadapter, pmlan_buffer pmbuf) * @param pmbuf A pointer to the mlan_buffer for process * @param tx_param A pointer to mlan_tx_param structure * - * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, otherwise failure + * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, otherwise failure */ mlan_status wlan_process_tx(pmlan_private priv, pmlan_buffer pmbuf, @@ -275,9 +280,8 @@ wlan_add_buf_bypass_txqueue(mlan_adapter * pmadapter, pmlan_buffer pmbuf) pmlan_private priv = pmadapter->priv[pmbuf->bss_index]; ENTER(); - if (pmbuf->buf_type != MLAN_BUF_TYPE_RAW_DATA) { + if (pmbuf->buf_type != MLAN_BUF_TYPE_RAW_DATA) pmbuf->buf_type = MLAN_BUF_TYPE_DATA; - } pmadapter->callbacks.moal_spin_lock(pmadapter->pmoal_handle, priv->bypass_txq.plock); pmadapter->bypass_pkt_count++; diff --git a/drivers/net/wireless/sd8797/mlan/mlan_uap.h b/drivers/net/wireless/sd8797/mlan/mlan_uap.h index 080ecd735a8c..bec39fa49382 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_uap.h +++ b/drivers/net/wireless/sd8797/mlan/mlan_uap.h @@ -3,20 +3,25 @@ * @brief This file contains related macros, enum, and struct * of uap functionalities * - * Copyright (C) 2009-2011, Marvell International Ltd. + * (C) Copyright 2009-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. */ /******************************************************** diff --git a/drivers/net/wireless/sd8797/mlan/mlan_uap_cmdevent.c b/drivers/net/wireless/sd8797/mlan/mlan_uap_cmdevent.c index 827f6a8c5fa0..2fdafa2659ea 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_uap_cmdevent.c +++ b/drivers/net/wireless/sd8797/mlan/mlan_uap_cmdevent.c @@ -2,20 +2,25 @@ * * @brief This file contains the handling of AP mode command and event * - * Copyright (C) 2009-2011, Marvell International Ltd. + * (C) Copyright 2009-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. */ /******************************************************** @@ -74,7 +79,7 @@ uap_process_cmdresp_error(mlan_private * pmpriv, HostCmd_DS_COMMAND * resp, /** * @brief This function will return the pointer to station entry in station list - * table which matches the give mac address + * table which matches the give mac address * * @param priv A pointer to mlan_private * @@ -267,6 +272,7 @@ wlan_process_tx_pause_event(pmlan_private priv, pmlan_buffer pevent) sizeof(t_u32)); MrvlIEtypes_tx_pause_t *tx_pause_tlv; sta_node *sta_ptr = MNULL; + t_u8 bc_mac[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; ENTER(); @@ -284,18 +290,38 @@ wlan_process_tx_pause_event(pmlan_private priv, pmlan_buffer pevent) PRINTM(MCMND, "TxPause: " MACSTR " pause=%d, pkts=%d\n", MAC2STR(tx_pause_tlv->peermac), tx_pause_tlv->tx_pause, tx_pause_tlv->pkt_cnt); - sta_ptr = - wlan_get_station_entry(priv, - tx_pause_tlv->peermac); - if (sta_ptr) { - if (sta_ptr->tx_pause != tx_pause_tlv->tx_pause) { - sta_ptr->tx_pause = - tx_pause_tlv->tx_pause; - wlan_update_ralist_tx_pause(priv, - tx_pause_tlv-> - peermac, - tx_pause_tlv-> - tx_pause); + if (!memcmp + (priv->adapter, bc_mac, tx_pause_tlv->peermac, + MLAN_MAC_ADDR_LENGTH)) { + wlan_update_ralist_tx_pause(priv, + tx_pause_tlv-> + peermac, + tx_pause_tlv-> + tx_pause); + } else if (!memcmp + (priv->adapter, priv->curr_addr, + tx_pause_tlv->peermac, + MLAN_MAC_ADDR_LENGTH)) { + if (tx_pause_tlv->tx_pause) + priv->port_open = MFALSE; + else + priv->port_open = MTRUE; + } else { + sta_ptr = + wlan_get_station_entry(priv, + tx_pause_tlv-> + peermac); + if (sta_ptr) { + if (sta_ptr->tx_pause != + tx_pause_tlv->tx_pause) { + sta_ptr->tx_pause = + tx_pause_tlv->tx_pause; + wlan_update_ralist_tx_pause + (priv, + tx_pause_tlv->peermac, + tx_pause_tlv-> + tx_pause); + } } } } @@ -311,8 +337,8 @@ wlan_process_tx_pause_event(pmlan_private priv, pmlan_buffer pevent) /** * @brief This function prepares command for config uap settings * - * @param pmpriv A pointer to mlan_private structure - * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure * @param cmd_action the action: GET or SET * @param pioctl_buf A pointer to mlan_ioctl_req structure * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE @@ -1055,8 +1081,8 @@ wlan_uap_cmd_ap_config(pmlan_private pmpriv, /** * @brief This function prepares command of sys_config * - * @param pmpriv A pointer to mlan_private structure - * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure * @param cmd_action the action: GET or SET * @param pioctl_buf A pointer to mlan_ioctl_req structure * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE @@ -2004,8 +2030,8 @@ wlan_uap_ret_sys_config(IN pmlan_private pmpriv, /** * @brief This function prepares command of snmp_mib * - * @param pmpriv A pointer to mlan_private structure - * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure * @param cmd_action the action: GET or SET * @param cmd_oid Cmd oid: treated as sub command * @param pioctl_buf A pointer to mlan_ioctl_req structure @@ -2243,8 +2269,8 @@ wlan_uap_ret_snmp_mib(IN pmlan_private pmpriv, /** * @brief This function prepares command of deauth station * - * @param pmpriv A pointer to mlan_private structure - * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ @@ -2357,11 +2383,10 @@ wlan_uap_cmd_key_material(IN pmlan_private pmpriv, PRINTM(MCMND, "Set WEP Key\n"); goto done; } - if (pkey->key_flags & KEY_FLAG_GROUP_KEY) { + if (pkey->key_flags & KEY_FLAG_GROUP_KEY) pkey_material->key_param_set.key_info |= KEY_INFO_MCAST_KEY; - } else { + else pkey_material->key_param_set.key_info |= KEY_INFO_UCAST_KEY; - } if (pkey->key_flags & KEY_FLAG_AES_MCAST_IGTK) pkey_material->key_param_set.key_info = KEY_INFO_CMAC_AES_KEY; if (pkey->key_flags & KEY_FLAG_SET_TX_KEY) @@ -2653,8 +2678,8 @@ wlan_check_uap_capability(pmlan_private priv, pmlan_buffer pevent) (MrvlIEtypesHeader_t *) (pevent->pbuf + pevent->data_offset + BSS_START_EVENT_FIX_SIZE); const t_u8 wmm_oui[4] = { 0x00, 0x50, 0xf2, 0x02 }; - IEEEtypes_WmmParameter_t WmmParamIe; - MrvlIEtypes_channel_band_t *pChanInfo; + IEEEtypes_WmmParameter_t wmm_param_ie; + MrvlIEtypes_channel_band_t *pchan_info; priv->wmm_enabled = MFALSE; priv->pkt_fwd = MFALSE; priv->is_11n_enabled = MFALSE; @@ -2686,13 +2711,13 @@ wlan_check_uap_capability(pmlan_private priv, pmlan_buffer pevent) priv->wmm_enabled = MFALSE; wlan_wmm_setup_ac_downgrade(priv); priv->wmm_enabled = MTRUE; - memcpy(priv->adapter, &WmmParamIe, + memcpy(priv->adapter, &wmm_param_ie, ((t_u8 *) tlv + 2), sizeof(IEEEtypes_WmmParameter_t)); - WmmParamIe.vend_hdr.len = (t_u8) tlv_len; - WmmParamIe.vend_hdr.element_id = WMM_IE; + wmm_param_ie.vend_hdr.len = (t_u8) tlv_len; + wmm_param_ie.vend_hdr.element_id = WMM_IE; wlan_wmm_setup_queue_priorities(priv, - &WmmParamIe); + &wmm_param_ie); } } if (tlv_type == TLV_TYPE_UAP_PKT_FWD_CTL) { @@ -2710,8 +2735,8 @@ wlan_check_uap_capability(pmlan_private priv, pmlan_buffer pevent) if (tlv_type == TLV_TYPE_UAP_CHAN_BAND_CONFIG) { DBG_HEXDUMP(MCMD_D, "chan_band_config tlv", tlv, tlv_len + sizeof(MrvlIEtypesHeader_t)); - pChanInfo = (MrvlIEtypes_channel_band_t *) tlv; - priv->uap_channel = pChanInfo->channel; + pchan_info = (MrvlIEtypes_channel_band_t *) tlv; + priv->uap_channel = pchan_info->channel; PRINTM(MCMND, "uap_channel FW: 0x%x\n", priv->uap_channel); } @@ -2785,7 +2810,7 @@ wlan_update_wapi_info_tlv(pmlan_private priv, pmlan_buffer pevent) /** * @brief This function send sta_assoc_event to moal - * payload with sta mac address and assoc ie. + * payload with sta mac address and assoc ie. * * @param priv A pointer to mlan_private * @param pevent A pointer to mlan_event buffer @@ -3134,6 +3159,7 @@ wlan_ops_uap_process_cmdresp(IN t_void * priv, if (pmpriv->adapter->state_rdh.stage == RDH_STOP_INTFS) wlan_11h_radar_detected_callback((t_void *) pmpriv); + break; case HOST_CMD_APCMD_BSS_START: if (pmpriv->adapter->state_rdh.stage == RDH_RESTART_INTFS) @@ -3350,6 +3376,7 @@ wlan_ops_uap_process_event(IN t_void * priv) case EVENT_MICRO_AP_BSS_ACTIVE: PRINTM(MEVENT, "EVENT: MICRO_AP_BSS_ACTIVE\n"); pmpriv->media_connected = MTRUE; + pmpriv->port_open = MTRUE; pevent->event_id = MLAN_EVENT_ID_UAP_FW_BSS_ACTIVE; break; case EVENT_MICRO_AP_BSS_IDLE: @@ -3359,9 +3386,10 @@ wlan_ops_uap_process_event(IN t_void * priv) wlan_clean_txrx(pmpriv); wlan_notify_station_deauth(pmpriv); wlan_delete_station_list(pmpriv); + pmpriv->port_open = MFALSE; break; case EVENT_PS_AWAKE: - PRINTM(MINFO, "EVENT: AWAKE \n"); + PRINTM(MINFO, "EVENT: AWAKE\n"); PRINTM(MEVENT, "||"); /* Handle unexpected PS AWAKE event */ if (pmadapter->ps_state == PS_STATE_SLEEP_CFM) @@ -3568,10 +3596,10 @@ done: /** * @brief This function issues commands to initialize firmware * - * @param priv A pointer to mlan_private structure - * @param first_bss flag for first BSS + * @param priv A pointer to mlan_private structure + * @param first_bss flag for first BSS * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_PENDING or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_PENDING or MLAN_STATUS_FAILURE */ mlan_status wlan_ops_uap_init_cmd(IN t_void * priv, IN t_u8 first_bss) diff --git a/drivers/net/wireless/sd8797/mlan/mlan_uap_ioctl.c b/drivers/net/wireless/sd8797/mlan/mlan_uap_ioctl.c index 071a7dc1cf5b..acbb40fbad61 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_uap_ioctl.c +++ b/drivers/net/wireless/sd8797/mlan/mlan_uap_ioctl.c @@ -2,20 +2,25 @@ * * @brief This file contains the handling of AP mode ioctls * - * Copyright (C) 2009-2011, Marvell International Ltd. + * (C) Copyright 2009-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. */ /******************************************************** @@ -239,9 +244,8 @@ wlan_uap_bss_ioctl_reset(IN pmlan_adapter pmadapter, /* * Reset any uap private parameters here */ - for (i = 0; i < pmadapter->max_mgmt_ie_index; i++) { + for (i = 0; i < pmadapter->max_mgmt_ie_index; i++) memset(pmadapter, &pmpriv->mgmt_ie[i], 0, sizeof(custom_ie)); - } pmpriv->add_ba_param.timeout = MLAN_DEFAULT_BLOCK_ACK_TIMEOUT; pmpriv->add_ba_param.tx_win_size = MLAN_UAP_AMPDU_DEF_TXWINSIZE; pmpriv->add_ba_param.rx_win_size = MLAN_UAP_AMPDU_DEF_RXWINSIZE; @@ -565,7 +569,7 @@ wlan_uap_set_wapi_ie(mlan_private * priv, pmlan_ioctl_req pioctl_req) misc = (mlan_ds_misc_cfg *) pioctl_req->pbuf; if (misc->param.gen_ie.len) { if (misc->param.gen_ie.len > sizeof(priv->wapi_ie)) { - PRINTM(MWARN, "failed to copy WAPI IE, too big \n"); + PRINTM(MWARN, "failed to copy WAPI IE, too big\n"); pioctl_req->status_code = MLAN_ERROR_INVALID_PARAMETER; LEAVE(); return MLAN_STATUS_FAILURE; @@ -1352,6 +1356,8 @@ wlan_ops_uap_ioctl(t_void * adapter, pmlan_ioctl_req pioctl_req) pget_info->param.fw_info.fw_bands = pmadapter->fw_bands; pget_info->param.fw_info.hw_dev_mcs_support = pmadapter->hw_dev_mcs_support; + pget_info->param.fw_info.hw_dot_11n_dev_cap = + pmadapter->hw_dot_11n_dev_cap; pget_info->param.fw_info.region_code = pmadapter->region_code; } @@ -1401,16 +1407,13 @@ wlan_ops_uap_ioctl(t_void * adapter, pmlan_ioctl_req pioctl_req) if (pm->sub_command == MLAN_OID_PM_CFG_DEEP_SLEEP) status = wlan_uap_pm_ioctl_deepsleep(pmadapter, pioctl_req); - if (pm->sub_command == MLAN_OID_PM_CFG_HS_CFG) { + if (pm->sub_command == MLAN_OID_PM_CFG_HS_CFG) status = wlan_pm_ioctl_hscfg(pmadapter, pioctl_req); - } - if (pm->sub_command == MLAN_OID_PM_HS_WAKEUP_REASON) { + if (pm->sub_command == MLAN_OID_PM_HS_WAKEUP_REASON) status = wlan_get_hs_wakeup_reason(pmadapter, pioctl_req); - } - if (pm->sub_command == MLAN_OID_PM_INFO) { + if (pm->sub_command == MLAN_OID_PM_INFO) status = wlan_get_pm_info(pmadapter, pioctl_req); - } break; case MLAN_IOCTL_SNMP_MIB: snmp = (mlan_ds_snmp_mib *) pioctl_req->pbuf; diff --git a/drivers/net/wireless/sd8797/mlan/mlan_uap_txrx.c b/drivers/net/wireless/sd8797/mlan/mlan_uap_txrx.c index f0d946a41f96..812b799a1f8d 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_uap_txrx.c +++ b/drivers/net/wireless/sd8797/mlan/mlan_uap_txrx.c @@ -2,20 +2,25 @@ * * @brief This file contains AP mode transmit and receive functions * - * Copyright (C) 2009-2011, Marvell International Ltd. + * (C) Copyright 2009-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. */ /******************************************************** @@ -42,12 +47,12 @@ Change log: /** * @brief This function processes received packet and forwards it - * to kernel/upper layer + * to kernel/upper layer * * @param pmadapter A pointer to mlan_adapter * @param pmbuf A pointer to mlan_buffer which includes the received packet * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_upload_uap_rx_packet(pmlan_adapter pmadapter, pmlan_buffer pmbuf) @@ -84,9 +89,8 @@ wlan_upload_uap_rx_packet(pmlan_adapter pmadapter, pmlan_buffer pmbuf) pmbuf->status_code = MLAN_ERROR_PKT_INVALID; } - if (ret != MLAN_STATUS_PENDING) { + if (ret != MLAN_STATUS_PENDING) wlan_free_mlan_buffer(pmadapter, pmbuf); - } LEAVE(); return ret; @@ -148,7 +152,7 @@ wlan_check_unicast_packet(mlan_private * priv, t_u8 * mac) * @param priv A pointer to mlan_private structure * @param pmbuf A pointer to the mlan_buffer for process * - * @return headptr or MNULL + * @return headptr or MNULL */ t_void * wlan_ops_uap_process_txpd(IN t_void * priv, IN pmlan_buffer pmbuf) @@ -245,12 +249,12 @@ done: /** * @brief This function processes received packet and forwards it - * to kernel/upper layer + * to kernel/upper layer * * @param adapter A pointer to mlan_adapter * @param pmbuf A pointer to mlan_buffer which includes the received packet * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_ops_uap_process_rx_packet(IN t_void * adapter, IN pmlan_buffer pmbuf) @@ -348,12 +352,12 @@ done: /** * @brief This function processes received packet and forwards it - * to kernel/upper layer or send back to firmware + * to kernel/upper layer or send back to firmware * * @param priv A pointer to mlan_private * @param pmbuf A pointer to mlan_buffer which includes the received packet * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_uap_recv_packet(IN mlan_private * priv, IN pmlan_buffer pmbuf) @@ -469,12 +473,12 @@ done: /** * @brief This function processes received packet and forwards it - * to kernel/upper layer or send back to firmware + * to kernel/upper layer or send back to firmware * * @param priv A pointer to mlan_private * @param pmbuf A pointer to mlan_buffer which includes the received packet * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_process_uap_rx_packet(IN mlan_private * priv, IN pmlan_buffer pmbuf) @@ -593,9 +597,8 @@ upload: pmbuf->status_code = MLAN_ERROR_PKT_INVALID; } - if (ret != MLAN_STATUS_PENDING) { + if (ret != MLAN_STATUS_PENDING) wlan_free_mlan_buffer(pmadapter, pmbuf); - } done: LEAVE(); return ret; diff --git a/drivers/net/wireless/sd8797/mlan/mlan_util.h b/drivers/net/wireless/sd8797/mlan/mlan_util.h index a97393cbbe59..caced4dc621b 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_util.h +++ b/drivers/net/wireless/sd8797/mlan/mlan_util.h @@ -3,20 +3,25 @@ * @brief This file contains wrappers for linked-list, * spinlock and timer defines. * - * Copyright (C) 2008-2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved + * + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. + * */ /****************************************************** @@ -121,9 +126,8 @@ util_peek_list(t_void * pmoal_handle, if (moal_spin_lock) moal_spin_lock(pmoal_handle, phead->plock); - if (phead->pnext != (pmlan_linked_list) phead) { + if (phead->pnext != (pmlan_linked_list) phead) pnode = phead->pnext; - } if (moal_spin_unlock) moal_spin_unlock(pmoal_handle, phead->plock); return pnode; @@ -248,11 +252,10 @@ util_dequeue_list(t_void * pmoal_handle, if (moal_spin_lock) moal_spin_lock(pmoal_handle, phead->plock); pnode = phead->pnext; - if (pnode && (pnode != (pmlan_linked_list) phead)) { + if (pnode && (pnode != (pmlan_linked_list) phead)) util_unlink_list(pmoal_handle, phead, pnode, 0, 0); - } else { + else pnode = 0; - } if (moal_spin_unlock) moal_spin_unlock(pmoal_handle, phead->plock); return pnode; @@ -463,15 +466,15 @@ util_scalar_offset(t_void * pmoal_handle, * @brief This function writes the value to the scalar * if existing value compared with other value is true. * - * @param pscalar Pointer to scalar - * @param condition Condition to check - * @param val_compare Value to compare against current value - * ((A X B), where B = val_compare) - * @param val_to_set Value to set if comparison is true - * @param moal_spin_lock A pointer to spin lock handler - * @param moal_spin_unlock A pointer to spin unlock handler + * @param pscalar Pointer to scalar + * @param condition Condition to check + * @param val_compare Value to compare against current value + * ((A X B), where B = val_compare) + * @param val_to_set Value to set if comparison is true + * @param moal_spin_lock A pointer to spin lock handler + * @param moal_spin_unlock A pointer to spin unlock handler * - * @return Comparison result (MTRUE or MFALSE) + * @return Comparison result (MTRUE or MFALSE) */ static INLINE t_u8 util_scalar_conditional_write(t_void * pmoal_handle, diff --git a/drivers/net/wireless/sd8797/mlan/mlan_wmm.c b/drivers/net/wireless/sd8797/mlan/mlan_wmm.c index cd3ab6fc4d9e..16a49d948967 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_wmm.c +++ b/drivers/net/wireless/sd8797/mlan/mlan_wmm.c @@ -2,20 +2,25 @@ * * @brief This file contains functions for WMM. * - * Copyright (C) 2008-2011, Marvell International Ltd. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. */ /******************************************************** @@ -210,6 +215,56 @@ done: } /** + * @brief Add packet to TDLS pending TX queue + * + * @param priv A pointer to mlan_private + * @param pmbuf Pointer to the mlan_buffer data struct + * + * @return N/A + */ +static t_void +wlan_add_buf_tdls_txqueue(pmlan_private priv, pmlan_buffer pmbuf) +{ + mlan_adapter *pmadapter = priv->adapter; + ENTER(); + util_enqueue_list_tail(pmadapter->pmoal_handle, &priv->tdls_pending_txq, + (pmlan_linked_list) pmbuf, + pmadapter->callbacks.moal_spin_lock, + pmadapter->callbacks.moal_spin_unlock); + LEAVE(); +} + +/** + * @brief Clean up the tdls pending TX queue + * + * @param priv A pointer to mlan_private + * + * @return N/A + */ +static t_void +wlan_cleanup_tdls_txq(pmlan_private priv) +{ + pmlan_buffer pmbuf; + mlan_adapter *pmadapter = priv->adapter; + ENTER(); + + pmadapter->callbacks.moal_spin_lock(pmadapter->pmoal_handle, + priv->tdls_pending_txq.plock); + while ((pmbuf = + (pmlan_buffer) util_peek_list(pmadapter->pmoal_handle, + &priv->tdls_pending_txq, MNULL, + MNULL))) { + util_unlink_list(pmadapter->pmoal_handle, + &priv->tdls_pending_txq, + (pmlan_linked_list) pmbuf, MNULL, MNULL); + wlan_write_data_complete(pmadapter, pmbuf, MLAN_STATUS_FAILURE); + } + pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle, + priv->tdls_pending_txq.plock); + LEAVE(); +} + +/** * @brief Map ACs to TID * * @param priv Pointer to the mlan_private driver data struct @@ -229,9 +284,8 @@ wlan_wmm_queue_priorities_tid(pmlan_private priv, t_u8 queue_priority[]) tos_to_tid[6 - (i * 2)] = ac_to_tid[queue_priority[i]][0]; } - for (i = 0; i < MAX_NUM_TID; i++) { + for (i = 0; i < MAX_NUM_TID; i++) tos_to_tid_inv[tos_to_tid[i]] = (t_u8) i; - } /* in case priorities have changed, force highest priority so next packet will check from top to re-establish the highest */ @@ -318,10 +372,10 @@ wlan_wmm_convert_tos_to_ac(pmlan_adapter pmadapter, t_u32 tos) * @brief Evaluate a given TID and downgrade it to a lower TID if the * WMM Parameter IE received from the AP indicates that the AP * is disabled (due to call admission control (ACM bit). Mapping - * of TID to AC is taken care internally + * of TID to AC is taken care internally * * @param priv Pointer to the mlan_private data struct - * @param tid tid to evaluate for downgrading + * @param tid tid to evaluate for downgrading * * @return Same tid as input if downgrading not required or * the tid the traffic for the given tid should be downgraded to @@ -353,10 +407,10 @@ wlan_wmm_downgrade_tid(pmlan_private priv, t_u32 tid) /** * @brief Delete packets in RA node * - * @param priv Pointer to the mlan_private driver data struct - * @param ra_list Pointer to raListTbl + * @param priv Pointer to the mlan_private driver data struct + * @param ra_list Pointer to raListTbl * - * @return N/A + * @return N/A */ static INLINE void wlan_wmm_del_pkts_in_ralist_node(pmlan_private priv, raListTbl * ra_list) @@ -426,6 +480,7 @@ wlan_wmm_cleanup_queues(pmlan_private priv) wlan_wmm_del_pkts_in_ralist(priv, &priv->wmm.tid_tbl_ptr[i].ra_list); priv->wmm.pkts_queued[i] = 0; + priv->wmm.pkts_paused[i] = 0; } util_scalar_write(priv->adapter->pmoal_handle, &priv->wmm.tx_pkts_queued, 0, MNULL, MNULL); @@ -518,25 +573,25 @@ wlan_wmm_get_queue_raptr(pmlan_private priv, t_u8 tid, t_u8 * ra_addr) #ifdef STA_SUPPORT /** - * @brief Sends wmmac host event + * @brief Sends wmmac host event * - * @param priv Pointer to the mlan_private driver data struct - * @param typeStr Type of host event - * @param srcAddr Pointer to the source Address - * @param tid TID - * @param up User priority - * @param status Status code or Reason code + * @param priv Pointer to the mlan_private driver data struct + * @param type_str Type of host event + * @param src_addr Pointer to the source Address + * @param tid TID + * @param up User priority + * @param status Status code or Reason code * - * @return N/A + * @return N/A */ static void wlan_send_wmmac_host_event(pmlan_private priv, - char *typeStr, - t_u8 * srcAddr, t_u8 tid, t_u8 up, t_u8 status) + char *type_str, + t_u8 * src_addr, t_u8 tid, t_u8 up, t_u8 status) { t_u8 event_buf[100]; mlan_event *pevent; - t_u8 *pOutBuf; + t_u8 *pout_buf; ENTER(); @@ -544,38 +599,39 @@ wlan_send_wmmac_host_event(pmlan_private priv, TSPEC:ADDTS_RSP:[<status code>]:TID=X:UP=Y ** - TSPEC:DELTS_RX:[<reason code>]:TID=X:UP=Y */ pevent = (mlan_event *) event_buf; - pOutBuf = pevent->event_buf; + pout_buf = pevent->event_buf; - memcpy(priv->adapter, pOutBuf, (t_u8 *) "TSPEC:", 6); - pOutBuf += 6; + memcpy(priv->adapter, pout_buf, (t_u8 *) "TSPEC:", 6); + pout_buf += 6; - memcpy(priv->adapter, pOutBuf, (t_u8 *) typeStr, wlan_strlen(typeStr)); - pOutBuf += wlan_strlen(typeStr); + memcpy(priv->adapter, pout_buf, (t_u8 *) type_str, + wlan_strlen(type_str)); + pout_buf += wlan_strlen(type_str); - *pOutBuf++ = ':'; - *pOutBuf++ = '['; + *pout_buf++ = ':'; + *pout_buf++ = '['; if (status >= 100) { - *pOutBuf++ = (status / 100) + '0'; + *pout_buf++ = (status / 100) + '0'; status = (status % 100); } if (status >= 10) { - *pOutBuf++ = (status / 10) + '0'; + *pout_buf++ = (status / 10) + '0'; status = (status % 10); } - *pOutBuf++ = status + '0'; + *pout_buf++ = status + '0'; - memcpy(priv->adapter, pOutBuf, (t_u8 *) "]:TID", 5); - pOutBuf += 5; - *pOutBuf++ = tid + '0'; + memcpy(priv->adapter, pout_buf, (t_u8 *) "]:TID", 5); + pout_buf += 5; + *pout_buf++ = tid + '0'; - memcpy(priv->adapter, pOutBuf, (t_u8 *) ":UP", 3); - pOutBuf += 3; - *pOutBuf++ = up + '0'; + memcpy(priv->adapter, pout_buf, (t_u8 *) ":UP", 3); + pout_buf += 3; + *pout_buf++ = up + '0'; - *pOutBuf = '\0'; + *pout_buf = '\0'; pevent->bss_index = priv->bss_index; pevent->event_id = MLAN_EVENT_ID_DRV_REPORT_STRING; @@ -685,7 +741,11 @@ wlan_wmm_get_highest_priolist_ptr(pmlan_adapter pmadapter, next_tid = tos_to_tid[next_prio]; if (priv_tmp->wmm. - pkts_queued[next_tid]) + pkts_queued[next_tid] && + (priv_tmp->wmm. + pkts_queued[next_tid] > + priv_tmp->wmm. + pkts_paused[next_tid])) util_scalar_write (pmadapter-> pmoal_handle, @@ -723,12 +783,24 @@ wlan_wmm_get_highest_priolist_ptr(pmlan_adapter pmadapter, } while (ptr != head); } - /* No packet at any TID for this priv. Mark as such to - skip checking TIDs for this priv (until pkt is - added). */ - util_scalar_write(pmadapter->pmoal_handle, - &priv_tmp->wmm.highest_queued_prio, - NO_PKT_PRIO_TID, MNULL, MNULL); + /* If priv still has packets queued, reset to + HIGH_PRIO_TID */ + if (util_scalar_read(pmadapter->pmoal_handle, + &priv_tmp->wmm.tx_pkts_queued, + MNULL, MNULL)) + util_scalar_write(pmadapter->pmoal_handle, + &priv_tmp->wmm. + highest_queued_prio, + HIGH_PRIO_TID, MNULL, MNULL); + else + /* No packet at any TID for this priv. Mark as + such to skip * checking TIDs for this priv + (until pkt is added). */ + util_scalar_write(pmadapter->pmoal_handle, + &priv_tmp->wmm. + highest_queued_prio, + NO_PKT_PRIO_TID, MNULL, + MNULL); pmadapter->callbacks.moal_spin_unlock(pmadapter-> pmoal_handle, @@ -751,14 +823,14 @@ next_intf: /** * @brief This function gets the number of packets in the Tx queue * - * @param priv A pointer to mlan_private - * @param ptr A pointer to RA list table - * @param maxBufSize Maximum buffer size + * @param priv A pointer to mlan_private + * @param ptr A pointer to RA list table + * @param max_buf_size Maximum buffer size * * @return Packet count */ static int -wlan_num_pkts_in_txq(mlan_private * priv, raListTbl * ptr, int maxBufSize) +wlan_num_pkts_in_txq(mlan_private * priv, raListTbl * ptr, int max_buf_size) { int count = 0, total_size = 0; pmlan_buffer pmbuf; @@ -769,7 +841,7 @@ wlan_num_pkts_in_txq(mlan_private * priv, raListTbl * ptr, int maxBufSize) pmbuf != (pmlan_buffer) (&ptr->buf_head); pmbuf = pmbuf->pnext) { total_size += pmbuf->data_len; - if (total_size < maxBufSize) + if (total_size < max_buf_size) ++count; else break; @@ -889,7 +961,7 @@ wlan_send_single_packet(pmlan_private priv, raListTbl * ptr, int ptrindex) * @param priv A pointer to mlan_private * @param ptr A pointer to RA list table * - * @return MTRUE or MFALSE + * @return MTRUE or MFALSE */ static int INLINE wlan_is_ptr_processed(mlan_private * priv, raListTbl * ptr) @@ -1022,7 +1094,7 @@ wlan_send_processed_packet(pmlan_private priv, raListTbl * ptr, int ptrindex) * * @param pmadapter A pointer to mlan_adapter * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static int wlan_dequeue_tx_packet(pmlan_adapter pmadapter) @@ -1142,9 +1214,14 @@ wlan_update_ralist_tx_pause(pmlan_private priv, t_u8 * mac, t_u8 tx_pause) priv->wmm.ra_list_spinlock); for (i = 0; i < MAX_NUM_TID; ++i) { ra_list = wlan_wmm_get_ralist_node(priv, i, mac); - if (ra_list) { + if (ra_list && ra_list->tx_pause != tx_pause) { pkt_cnt += ra_list->total_pkts; ra_list->tx_pause = tx_pause; + if (tx_pause) + priv->wmm.pkts_paused[i] += ra_list->total_pkts; + else + priv->wmm.pkts_paused[i] -= ra_list->total_pkts; + } } if (pkt_cnt) { @@ -1168,6 +1245,208 @@ wlan_update_ralist_tx_pause(pmlan_private priv, t_u8 * mac, t_u8 tx_pause) } #ifdef STA_SUPPORT +/** + * @brief update tx_pause flag in none tdls ra_list + * + * @param priv A pointer to mlan_private + * @param mac peer mac address + * @param tx_pause tx_pause flag (0/1) + * + * @return N/A + */ +t_void +wlan_update_non_tdls_ralist(mlan_private * priv, t_u8 * mac, t_u8 tx_pause) +{ + raListTbl *ra_list; + int i; + pmlan_adapter pmadapter = priv->adapter; + t_u32 pkt_cnt = 0; + t_u32 tx_pkts_queued = 0; + ENTER(); + + pmadapter->callbacks.moal_spin_lock(pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); + for (i = 0; i < MAX_NUM_TID; ++i) { + ra_list = + (raListTbl *) util_peek_list(priv->adapter-> + pmoal_handle, + &priv->wmm.tid_tbl_ptr[i]. + ra_list, MNULL, MNULL); + while (ra_list && + (ra_list != + (raListTbl *) & priv->wmm.tid_tbl_ptr[i].ra_list)) { + if (memcmp + (priv->adapter, ra_list->ra, mac, + MLAN_MAC_ADDR_LENGTH)) { + pkt_cnt += ra_list->total_pkts; + ra_list->tx_pause = tx_pause; + if (tx_pause) + priv->wmm.pkts_paused[i] += + ra_list->total_pkts; + else + priv->wmm.pkts_paused[i] -= + ra_list->total_pkts; + } + ra_list = ra_list->pnext; + } + } + if (pkt_cnt) { + tx_pkts_queued = util_scalar_read(pmadapter->pmoal_handle, + &priv->wmm.tx_pkts_queued, + MNULL, MNULL); + if (tx_pause) + tx_pkts_queued -= pkt_cnt; + else + tx_pkts_queued += pkt_cnt; + util_scalar_write(priv->adapter->pmoal_handle, + &priv->wmm.tx_pkts_queued, tx_pkts_queued, + MNULL, MNULL); + util_scalar_write(priv->adapter->pmoal_handle, + &priv->wmm.highest_queued_prio, HIGH_PRIO_TID, + MNULL, MNULL); + } + pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); + LEAVE(); + return; +} + +/** + * @brief find tdls buffer from ralist + * + * @param priv A pointer to mlan_private + * @param ralist A pointer to ralistTbl + * @param mac TDLS peer mac address + * + * @return pmlan_buffer or MNULL + */ +static pmlan_buffer +wlan_find_tdls_packets(mlan_private * priv, raListTbl * ra_list, t_u8 * mac) +{ + pmlan_buffer pmbuf = MNULL; + mlan_adapter *pmadapter = priv->adapter; + t_u8 ra[MLAN_MAC_ADDR_LENGTH]; + ENTER(); + pmbuf = (pmlan_buffer) util_peek_list(priv->adapter->pmoal_handle, + &ra_list->buf_head, MNULL, MNULL); + if (!pmbuf) { + LEAVE(); + return MNULL; + } + while (pmbuf != (pmlan_buffer) & ra_list->buf_head) { + memcpy(pmadapter, ra, pmbuf->pbuf + pmbuf->data_offset, + MLAN_MAC_ADDR_LENGTH); + if (!memcmp(priv->adapter, ra, mac, MLAN_MAC_ADDR_LENGTH)) { + LEAVE(); + return pmbuf; + } + pmbuf = pmbuf->pnext; + } + LEAVE(); + return MNULL; +} + +/** + * @brief find tdls buffer from tdls pending queue + * + * @param priv A pointer to mlan_private + * @param mac TDLS peer mac address + * + * @return pmlan_buffer or MNULL + */ +static pmlan_buffer +wlan_find_packets_tdls_txq(mlan_private * priv, t_u8 * mac) +{ + pmlan_buffer pmbuf = MNULL; + mlan_adapter *pmadapter = priv->adapter; + t_u8 ra[MLAN_MAC_ADDR_LENGTH]; + ENTER(); + pmbuf = (pmlan_buffer) util_peek_list(priv->adapter->pmoal_handle, + &priv->tdls_pending_txq, + MNULL, MNULL); + if (!pmbuf) { + LEAVE(); + return MNULL; + } + while (pmbuf != (pmlan_buffer) & priv->tdls_pending_txq) { + memcpy(pmadapter, ra, pmbuf->pbuf + pmbuf->data_offset, + MLAN_MAC_ADDR_LENGTH); + if (!memcmp(priv->adapter, ra, mac, MLAN_MAC_ADDR_LENGTH)) { + LEAVE(); + return pmbuf; + } + pmbuf = pmbuf->pnext; + } + LEAVE(); + return MNULL; +} + +/** + * @brief Remove TDLS ralist and move packets to AP's ralist + * + * @param priv A pointer to mlan_private + * @param mac TDLS peer mac address + * + * @return N/A + */ +static t_void +wlan_wmm_delete_tdls_ralist(pmlan_private priv, t_u8 * mac) +{ + raListTbl *ra_list; + raListTbl *ra_list_ap = MNULL; + int i; + pmlan_adapter pmadapter = priv->adapter; + pmlan_buffer pmbuf; + ENTER(); + + for (i = 0; i < MAX_NUM_TID; ++i) { + ra_list = wlan_wmm_get_ralist_node(priv, i, mac); + if (ra_list) { + PRINTM(MDATA, "delete TDLS ralist %p\n", ra_list); + ra_list_ap = + (raListTbl *) util_peek_list(pmadapter-> + pmoal_handle, + &priv->wmm. + tid_tbl_ptr[i]. + ra_list, MNULL, + MNULL); + while ((pmbuf = + (pmlan_buffer) util_peek_list(pmadapter-> + pmoal_handle, + &ra_list-> + buf_head, MNULL, + MNULL))) { + util_unlink_list(pmadapter->pmoal_handle, + &ra_list->buf_head, + (pmlan_linked_list) pmbuf, + MNULL, MNULL); + util_enqueue_list_tail(pmadapter->pmoal_handle, + &ra_list_ap->buf_head, + (pmlan_linked_list) + pmbuf, MNULL, MNULL); + ra_list_ap->total_pkts++; + ra_list_ap->packet_count++; + } + util_free_list_head((t_void *) pmadapter->pmoal_handle, + &ra_list->buf_head, + pmadapter->callbacks. + moal_free_lock); + + util_unlink_list(pmadapter->pmoal_handle, + &priv->wmm.tid_tbl_ptr[i].ra_list, + (pmlan_linked_list) ra_list, MNULL, + MNULL); + pmadapter->callbacks.moal_mfree(pmadapter->pmoal_handle, + (t_u8 *) ra_list); + if (priv->wmm.tid_tbl_ptr[i].ra_list_curr == ra_list) + priv->wmm.tid_tbl_ptr[i].ra_list_curr = + ra_list_ap; + } + } + + LEAVE(); + +} #endif /* STA_SUPPORT */ /******************************************************** Global Functions @@ -1226,6 +1505,9 @@ wlan_clean_txrx(pmlan_private priv) wlan_cleanup_bypass_txq(priv); + if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA) { + wlan_cleanup_tdls_txq(priv); + } wlan_11n_cleanup_reorder_tbl(priv); pmadapter->callbacks.moal_spin_lock(pmadapter->pmoal_handle, @@ -1236,11 +1518,12 @@ wlan_clean_txrx(pmlan_private priv) #ifdef SDIO_MULTI_PORT_TX_AGGR /** * Before reset the TX aggregation buffer, check for any pre-copied data. - * & If any data was pre-copied, restore the current write port and write bitmap, - * to the values that they would have if those data buffers were not copied. - * This is required as FW expects the driver to use the write bitmap sequentially. - * If write bitmap is not re-stored, few bits get skipped for next write and - * fw doesn't issue tx-done interrupt in this condition. + * & If any data was pre-copied, restore the current write port and write + * bitmap, to the values that they would have if those data buffers were + * not copied. This is required as FW expects the driver to use the write + * bitmap sequentially. If write bitmap is not re-stored, few bits get + * skipped for next write and fw doesn't issue tx-done interrupt in this + * condition. */ while (pmadapter->mpa_tx.pkt_cnt) { @@ -1259,9 +1542,8 @@ wlan_clean_txrx(pmlan_private priv) #endif wlan_wmm_delete_all_ralist(priv); memcpy(pmadapter, tos_to_tid, ac_to_tid, sizeof(tos_to_tid)); - for (i = 0; i < MAX_NUM_TID; i++) { + for (i = 0; i < MAX_NUM_TID; i++) tos_to_tid_inv[tos_to_tid[i]] = (t_u8) i; - } #if defined(UAP_SUPPORT) priv->num_drop_pkts = 0; #endif @@ -1326,6 +1608,7 @@ wlan_wmm_setup_queue_priorities(pmlan_private priv, LEAVE(); return; } + memset(priv->adapter, tmp, 0, sizeof(tmp)); HEXDUMP("WMM: setup_queue_priorities: param IE", (t_u8 *) pwmm_ie, sizeof(IEEEtypes_WmmParameter_t)); @@ -1432,6 +1715,7 @@ wlan_ralist_add(mlan_private * priv, t_u8 * ra) int i; raListTbl *ra_list; pmlan_adapter pmadapter = priv->adapter; + tdlsStatus_e status; ENTER(); @@ -1448,9 +1732,22 @@ wlan_ralist_add(mlan_private * priv, t_u8 * ra) get_station_max_amsdu_size(priv, ra); ra_list->tx_pause = wlan_is_tx_pause(priv, ra); } else { - ra_list->is_11n_enabled = IS_11N_ENABLED(priv); - if (ra_list->is_11n_enabled) - ra_list->max_amsdu = priv->max_amsdu; + ra_list->is_tdls_link = MFALSE; + ra_list->tx_pause = MFALSE; + status = wlan_get_tdls_link_status(priv, ra); + if (MTRUE == wlan_is_tdls_link_setup(status)) { + ra_list->is_11n_enabled = + is_station_11n_enabled(priv, ra); + if (ra_list->is_11n_enabled) + ra_list->max_amsdu = + get_station_max_amsdu_size(priv, + ra); + ra_list->is_tdls_link = MTRUE; + } else { + ra_list->is_11n_enabled = IS_11N_ENABLED(priv); + if (ra_list->is_11n_enabled) + ra_list->max_amsdu = priv->max_amsdu; + } } PRINTM_NETINTF(MDATA, priv); @@ -1500,6 +1797,7 @@ wlan_wmm_init(pmlan_adapter pmadapter) priv->aggr_prio_tbl[i].ampdu_user = tos_to_tid_inv[i]; priv->wmm.pkts_queued[i] = 0; + priv->wmm.pkts_paused[i] = 0; priv->wmm.tid_tbl_ptr[i].ra_list_curr = MNULL; } priv->wmm.drv_pkt_delay_max = WMM_DRV_DELAY_MAX; @@ -1522,12 +1820,16 @@ wlan_wmm_init(pmlan_adapter pmadapter) MLAN_STA_AMPDU_DEF_RXWINSIZE; } #endif -#ifdef UAP_SUPPORT - if (priv->bss_type == MLAN_BSS_TYPE_UAP #ifdef WIFI_DIRECT_SUPPORT - || priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT + if (priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT) { + priv->add_ba_param.tx_win_size = + MLAN_WFD_AMPDU_DEF_TXRXWINSIZE; + priv->add_ba_param.rx_win_size = + MLAN_WFD_AMPDU_DEF_TXRXWINSIZE; + } #endif - ) { +#ifdef UAP_SUPPORT + if (priv->bss_type == MLAN_BSS_TYPE_UAP) { priv->add_ba_param.tx_win_size = MLAN_UAP_AMPDU_DEF_TXWINSIZE; priv->add_ba_param.rx_win_size = @@ -1756,6 +2058,7 @@ wlan_wmm_add_buf_txqueue(pmlan_adapter pmadapter, pmlan_buffer pmbuf) t_u32 tid; raListTbl *ra_list; t_u8 ra[MLAN_MAC_ADDR_LENGTH], tid_down; + tdlsStatus_e status; #if defined(UAP_SUPPORT) sta_node *sta_ptr = MNULL; #endif @@ -1779,10 +2082,28 @@ wlan_wmm_add_buf_txqueue(pmlan_adapter pmadapter, pmlan_buffer pmbuf) association we just don't have to call get_queue_raptr, we will have only 1 raptr for a tid in case of infra */ if (!queuing_ra_based(priv)) { - ra_list = (raListTbl *) util_peek_list(pmadapter->pmoal_handle, - &priv->wmm. - tid_tbl_ptr[tid_down]. - ra_list, MNULL, MNULL); + memcpy(pmadapter, ra, pmbuf->pbuf + pmbuf->data_offset, + MLAN_MAC_ADDR_LENGTH); + status = wlan_get_tdls_link_status(priv, ra); + if (MTRUE == wlan_is_tdls_link_setup(status)) { + ra_list = wlan_wmm_get_queue_raptr(priv, tid_down, ra); + pmbuf->flags |= MLAN_BUF_FLAG_TDLS; + } else if (status == TDLS_SETUP_INPROGRESS) { + wlan_add_buf_tdls_txqueue(priv, pmbuf); + pmadapter->callbacks.moal_spin_unlock(pmadapter-> + pmoal_handle, + priv->wmm. + ra_list_spinlock); + LEAVE(); + return; + } else + ra_list = + (raListTbl *) util_peek_list(pmadapter-> + pmoal_handle, + &priv->wmm. + tid_tbl_ptr + [tid_down].ra_list, + MNULL, MNULL); } else { memcpy(pmadapter, ra, pmbuf->pbuf + pmbuf->data_offset, MLAN_MAC_ADDR_LENGTH); @@ -1828,7 +2149,9 @@ wlan_wmm_add_buf_txqueue(pmlan_adapter pmadapter, pmlan_buffer pmbuf) ra_list->packet_count++; priv->wmm.pkts_queued[tid_down]++; - if (!ra_list->tx_pause) { + if (ra_list->tx_pause) { + priv->wmm.pkts_paused[tid_down]++; + } else { util_scalar_increment(pmadapter->pmoal_handle, &priv->wmm.tx_pkts_queued, MNULL, MNULL); /* if highest_queued_prio < prio(tid_down), set it to @@ -1877,47 +2200,48 @@ wlan_ret_wmm_get_status(pmlan_private priv, t_u8 * ptlv, int resp_len) { t_u8 *pcurrent = ptlv; t_u32 tlv_len; - t_u8 sendWmmEvent; - MrvlIEtypes_Data_t *pTlvHdr; - MrvlIEtypes_WmmQueueStatus_t *pTlvWmmQStatus; - IEEEtypes_WmmParameter_t *pWmmParamIe = MNULL; + t_u8 send_wmm_event; + MrvlIEtypes_Data_t *ptlv_hdr; + MrvlIEtypes_WmmQueueStatus_t *ptlv_wmm_q_status; + IEEEtypes_WmmParameter_t *pwmm_param_ie = MNULL; WmmAcStatus_t *pac_status; - MrvlIETypes_ActionFrame_t *pTlvAction; - IEEEtypes_Action_WMM_AddTsRsp_t *pAddTsRsp; - IEEEtypes_Action_WMM_DelTs_t *pDelTs; + MrvlIETypes_ActionFrame_t *ptlv_action; + IEEEtypes_Action_WMM_AddTsRsp_t *padd_ts_rsp; + IEEEtypes_Action_WMM_DelTs_t *pdel_ts; ENTER(); - sendWmmEvent = MFALSE; + send_wmm_event = MFALSE; PRINTM(MINFO, "WMM: WMM_GET_STATUS cmdresp received: %d\n", resp_len); HEXDUMP("CMD_RESP: WMM_GET_STATUS", pcurrent, resp_len); - while (resp_len >= sizeof(pTlvHdr->header)) { - pTlvHdr = (MrvlIEtypes_Data_t *) pcurrent; - tlv_len = wlan_le16_to_cpu(pTlvHdr->header.len); + while (resp_len >= sizeof(ptlv_hdr->header)) { + ptlv_hdr = (MrvlIEtypes_Data_t *) pcurrent; + tlv_len = wlan_le16_to_cpu(ptlv_hdr->header.len); - switch (wlan_le16_to_cpu(pTlvHdr->header.type)) { + switch (wlan_le16_to_cpu(ptlv_hdr->header.type)) { case TLV_TYPE_WMMQSTATUS: - pTlvWmmQStatus = - (MrvlIEtypes_WmmQueueStatus_t *) pTlvHdr; + ptlv_wmm_q_status = + (MrvlIEtypes_WmmQueueStatus_t *) ptlv_hdr; PRINTM(MEVENT, "WMM_STATUS: QSTATUS TLV: %d\n", - pTlvWmmQStatus->queue_index); + ptlv_wmm_q_status->queue_index); PRINTM(MINFO, "CMD_RESP: WMM_GET_STATUS: QSTATUS TLV: %d, %d, %d\n", - pTlvWmmQStatus->queue_index, - pTlvWmmQStatus->flow_required, - pTlvWmmQStatus->disabled); + ptlv_wmm_q_status->queue_index, + ptlv_wmm_q_status->flow_required, + ptlv_wmm_q_status->disabled); pac_status = - &priv->wmm.ac_status[pTlvWmmQStatus-> + &priv->wmm.ac_status[ptlv_wmm_q_status-> queue_index]; - pac_status->disabled = pTlvWmmQStatus->disabled; + pac_status->disabled = ptlv_wmm_q_status->disabled; pac_status->flow_required = - pTlvWmmQStatus->flow_required; - pac_status->flow_created = pTlvWmmQStatus->flow_created; + ptlv_wmm_q_status->flow_required; + pac_status->flow_created = + ptlv_wmm_q_status->flow_created; break; case WMM_IE: @@ -1928,72 +2252,74 @@ wlan_ret_wmm_get_status(pmlan_private priv, t_u8 * ptlv, int resp_len) PRINTM(MEVENT, "WMM STATUS: WMM IE\n"); - HEXDUMP("WMM: WMM TLV:", (t_u8 *) pTlvHdr, tlv_len + 4); + HEXDUMP("WMM: WMM TLV:", (t_u8 *) ptlv_hdr, + tlv_len + 4); - pWmmParamIe = + pwmm_param_ie = (IEEEtypes_WmmParameter_t *) (pcurrent + 2); - pWmmParamIe->vend_hdr.len = (t_u8) tlv_len; - pWmmParamIe->vend_hdr.element_id = WMM_IE; + pwmm_param_ie->vend_hdr.len = (t_u8) tlv_len; + pwmm_param_ie->vend_hdr.element_id = WMM_IE; PRINTM(MINFO, "CMD_RESP: WMM_GET_STATUS: WMM Parameter Set: %d\n", - pWmmParamIe->qos_info.para_set_count); + pwmm_param_ie->qos_info.para_set_count); memcpy(priv->adapter, (t_u8 *) & priv->curr_bss_params.bss_descriptor. - wmm_ie, pWmmParamIe, + wmm_ie, pwmm_param_ie, MIN(sizeof(IEEEtypes_WmmParameter_t), - (pWmmParamIe->vend_hdr.len + 2))); - sendWmmEvent = MTRUE; + (pwmm_param_ie->vend_hdr.len + 2))); + send_wmm_event = MTRUE; break; case TLV_TYPE_IEEE_ACTION_FRAME: PRINTM(MEVENT, "WMM_STATUS: IEEE Action Frame\n"); - pTlvAction = (MrvlIETypes_ActionFrame_t *) pcurrent; + ptlv_action = (MrvlIETypes_ActionFrame_t *) pcurrent; - if (pTlvAction->actionFrame.wmmAc.tspecAct.category + if (ptlv_action->actionFrame.wmmAc.tspecAct.category == IEEE_MGMT_ACTION_CATEGORY_WMM_TSPEC) { - switch (pTlvAction->actionFrame.wmmAc.tspecAct. + switch (ptlv_action->actionFrame.wmmAc.tspecAct. action) { case TSPEC_ACTION_CODE_ADDTS_RSP: - pAddTsRsp = - &pTlvAction->actionFrame.wmmAc. + padd_ts_rsp = + &ptlv_action->actionFrame.wmmAc. addTsRsp; wlan_send_wmmac_host_event(priv, "ADDTS_RSP", - pTlvAction-> + ptlv_action-> srcAddr, - pAddTsRsp-> + padd_ts_rsp-> tspecIE. TspecBody. TSInfo.TID, - pAddTsRsp-> + padd_ts_rsp-> tspecIE. TspecBody. TSInfo. UserPri, - pAddTsRsp-> + padd_ts_rsp-> statusCode); break; case TSPEC_ACTION_CODE_DELTS: - pDelTs = &pTlvAction->actionFrame.wmmAc. + pdel_ts = + &ptlv_action->actionFrame.wmmAc. delTs; wlan_send_wmmac_host_event(priv, "DELTS_RX", - pTlvAction-> + ptlv_action-> srcAddr, - pDelTs-> + pdel_ts-> tspecIE. TspecBody. TSInfo.TID, - pDelTs-> + pdel_ts-> tspecIE. TspecBody. TSInfo. UserPri, - pDelTs-> + pdel_ts-> reasonCode); break; @@ -2008,14 +2334,14 @@ wlan_ret_wmm_get_status(pmlan_private priv, t_u8 * ptlv, int resp_len) break; } - pcurrent += (tlv_len + sizeof(pTlvHdr->header)); - resp_len -= (tlv_len + sizeof(pTlvHdr->header)); + pcurrent += (tlv_len + sizeof(ptlv_hdr->header)); + resp_len -= (tlv_len + sizeof(ptlv_hdr->header)); } - wlan_wmm_setup_queue_priorities(priv, pWmmParamIe); + wlan_wmm_setup_queue_priorities(priv, pwmm_param_ie); wlan_wmm_setup_ac_downgrade(priv); - if (sendWmmEvent) { + if (send_wmm_event) { wlan_recv_event(priv, MLAN_EVENT_ID_FW_WMM_CONFIG_CHANGE, MNULL); } @@ -2031,19 +2357,19 @@ wlan_ret_wmm_get_status(pmlan_private priv, t_u8 * ptlv, int resp_len) * Information IE to the association request command buffer in the form * of a Marvell extended IEEE IE. * - * @param priv Pointer to the mlan_private driver data struct - * @param ppAssocBuf Output parameter: Pointer to the TLV output buffer, - * modified on return to point after the appended WMM TLV - * @param pWmmIE Pointer to the WMM IE for the BSS we are joining - * @param pHTCap Pointer to the HT IE for the BSS we are joining + * @param priv Pointer to the mlan_private driver data struct + * @param ppassoc_buf Output parameter: Pointer to the TLV output buffer, + * modified on return to point after the appended WMM TLV + * @param pwmm_ie Pointer to the WMM IE for the BSS we are joining + * @param pht_cap Pointer to the HT IE for the BSS we are joining * * @return Length of data appended to the association tlv buffer */ t_u32 wlan_wmm_process_association_req(pmlan_private priv, - t_u8 ** ppAssocBuf, - IEEEtypes_WmmParameter_t * pWmmIE, - IEEEtypes_HTCap_t * pHTCap) + t_u8 ** ppassoc_buf, + IEEEtypes_WmmParameter_t * pwmm_ie, + IEEEtypes_HTCap_t * pht_cap) { MrvlIEtypes_WmmParamSet_t *pwmm_tlv; t_u32 ret_len = 0; @@ -2051,36 +2377,36 @@ wlan_wmm_process_association_req(pmlan_private priv, ENTER(); /* Null checks */ - if (!ppAssocBuf) { + if (!ppassoc_buf) { LEAVE(); return 0; } - if (!(*ppAssocBuf)) { + if (!(*ppassoc_buf)) { LEAVE(); return 0; } - if (!pWmmIE) { + if (!pwmm_ie) { LEAVE(); return 0; } PRINTM(MINFO, "WMM: process assoc req: bss->wmmIe=0x%x\n", - pWmmIE->vend_hdr.element_id); + pwmm_ie->vend_hdr.element_id); if ((priv->wmm_required - || (pHTCap && (pHTCap->ieee_hdr.element_id == HT_CAPABILITY) + || (pht_cap && (pht_cap->ieee_hdr.element_id == HT_CAPABILITY) && (priv->config_bands & BAND_GN || priv->config_bands & BAND_AN)) ) - && pWmmIE->vend_hdr.element_id == WMM_IE) { - pwmm_tlv = (MrvlIEtypes_WmmParamSet_t *) * ppAssocBuf; + && pwmm_ie->vend_hdr.element_id == WMM_IE) { + pwmm_tlv = (MrvlIEtypes_WmmParamSet_t *) * ppassoc_buf; pwmm_tlv->header.type = (t_u16) wmm_info_ie[0]; pwmm_tlv->header.type = wlan_cpu_to_le16(pwmm_tlv->header.type); pwmm_tlv->header.len = (t_u16) wmm_info_ie[1]; memcpy(priv->adapter, pwmm_tlv->wmm_ie, &wmm_info_ie[2], pwmm_tlv->header.len); - if (pWmmIE->qos_info.qos_uapsd) + if (pwmm_ie->qos_info.qos_uapsd) memcpy(priv->adapter, (t_u8 *) (pwmm_tlv->wmm_ie + pwmm_tlv->header.len - @@ -2091,7 +2417,7 @@ wlan_wmm_process_association_req(pmlan_private priv, pwmm_tlv->header.len = wlan_cpu_to_le16(pwmm_tlv->header.len); HEXDUMP("ASSOC_CMD: WMM IE", (t_u8 *) pwmm_tlv, ret_len); - *ppAssocBuf += ret_len; + *ppassoc_buf += ret_len; } LEAVE(); @@ -2239,7 +2565,9 @@ wlan_del_tx_pkts_in_ralist(pmlan_private priv, priv->wmm.pkts_queued[tid]--; priv->num_drop_pkts++; ra_list->total_pkts--; - if (!ra_list->tx_pause) + if (ra_list->tx_pause) + priv->wmm.pkts_paused[tid]--; + else util_scalar_decrement(pmadapter-> pmoal_handle, &priv->wmm. @@ -2309,7 +2637,10 @@ wlan_wmm_delete_peer_ralist(pmlan_private priv, t_u8 * mac) ra_list = wlan_wmm_get_ralist_node(priv, i, mac); if (ra_list) { PRINTM(MINFO, "delete sta ralist %p\n", ra_list); - if (!ra_list->tx_pause) + priv->wmm.pkts_queued[i] -= ra_list->total_pkts; + if (ra_list->tx_pause) + priv->wmm.pkts_paused[i] -= ra_list->total_pkts; + else pkt_cnt += ra_list->total_pkts; wlan_wmm_del_pkts_in_ralist_node(priv, ra_list); @@ -2344,6 +2675,132 @@ wlan_wmm_delete_peer_ralist(pmlan_private priv, t_u8 * mac) #endif #ifdef STA_SUPPORT +/** + * @brief Hold TDLS packets to tdls pending queue + * + * @param priv A pointer to mlan_private + * @param mac station mac address + * + * @return N/A + */ +t_void +wlan_hold_tdls_packets(pmlan_private priv, t_u8 * mac) +{ + pmlan_buffer pmbuf; + mlan_adapter *pmadapter = priv->adapter; + raListTbl *ra_list = MNULL; + t_u8 i; + + ENTER(); + pmadapter->callbacks.moal_spin_lock(pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); + PRINTM(MDATA, "wlan_hold_tdls_packets: " MACSTR "\n", MAC2STR(mac)); + for (i = 0; i < MAX_NUM_TID; ++i) { + ra_list = (raListTbl *) util_peek_list(pmadapter->pmoal_handle, + &priv->wmm. + tid_tbl_ptr[i].ra_list, + MNULL, MNULL); + if (ra_list) { + while ((pmbuf = + wlan_find_tdls_packets(priv, ra_list, mac))) { + util_unlink_list(pmadapter->pmoal_handle, + &ra_list->buf_head, + (pmlan_linked_list) pmbuf, + MNULL, MNULL); + ra_list->total_pkts--; + priv->wmm.pkts_queued[i]--; + util_scalar_decrement(pmadapter->pmoal_handle, + &priv->wmm.tx_pkts_queued, + MNULL, MNULL); + ra_list->packet_count--; + wlan_add_buf_tdls_txqueue(priv, pmbuf); + PRINTM(MDATA, "hold tdls packet=%p\n", pmbuf); + } + } + } + pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); + LEAVE(); +} + +/** + * @brief move TDLS packets back to ralist + * + * @param priv A pointer to mlan_private + * @param mac TDLS peer mac address + * @param status tdlsStatus + * + * @return pmlan_buffer or MNULL + */ +t_void +wlan_restore_tdls_packets(pmlan_private priv, t_u8 * mac, tdlsStatus_e status) +{ + pmlan_buffer pmbuf; + mlan_adapter *pmadapter = priv->adapter; + raListTbl *ra_list = MNULL; + t_u32 tid; + t_u32 tid_down; + + ENTER(); + PRINTM(MDATA, "wlan_restore_tdls_packets: " MACSTR " status=%d\n", + MAC2STR(mac), status); + + pmadapter->callbacks.moal_spin_lock(pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); + + while ((pmbuf = wlan_find_packets_tdls_txq(priv, mac))) { + util_unlink_list(pmadapter->pmoal_handle, + &priv->tdls_pending_txq, + (pmlan_linked_list) pmbuf, MNULL, MNULL); + tid = pmbuf->priority; + tid_down = wlan_wmm_downgrade_tid(priv, tid); + if (status == TDLS_SETUP_COMPLETE) { + ra_list = wlan_wmm_get_queue_raptr(priv, tid_down, mac); + pmbuf->flags |= MLAN_BUF_FLAG_TDLS; + } else { + ra_list = + (raListTbl *) util_peek_list(pmadapter-> + pmoal_handle, + &priv->wmm. + tid_tbl_ptr + [tid_down].ra_list, + MNULL, MNULL); + pmbuf->flags &= ~MLAN_BUF_FLAG_TDLS; + } + if (!ra_list) { + PRINTM_NETINTF(MWARN, priv); + PRINTM(MWARN, + "Drop packet %p, ra_list=%p media_connected=%d\n", + pmbuf, ra_list, priv->media_connected); + wlan_write_data_complete(pmadapter, pmbuf, + MLAN_STATUS_FAILURE); + continue; + } + PRINTM_NETINTF(MDATA, priv); + PRINTM(MDATA, + "ADD TDLS pkt %p (priority=%d) back to ra_list %p\n", + pmbuf, pmbuf->priority, ra_list); + util_enqueue_list_tail(pmadapter->pmoal_handle, + &ra_list->buf_head, + (pmlan_linked_list) pmbuf, MNULL, MNULL); + ra_list->total_pkts++; + ra_list->packet_count++; + priv->wmm.pkts_queued[tid_down]++; + util_scalar_increment(pmadapter->pmoal_handle, + &priv->wmm.tx_pkts_queued, MNULL, MNULL); + util_scalar_conditional_write(pmadapter->pmoal_handle, + &priv->wmm.highest_queued_prio, + MLAN_SCALAR_COND_LESS_THAN, + tos_to_tid_inv[tid_down], + tos_to_tid_inv[tid_down], MNULL, + MNULL); + } + if (status != TDLS_SETUP_COMPLETE) + wlan_wmm_delete_tdls_ralist(priv, mac); + pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); + LEAVE(); +} /** * @brief This function prepares the command of ADDTS @@ -2490,7 +2947,7 @@ wlan_ret_wmm_delts_req(IN pmlan_private pmpriv, OUT mlan_ioctl_req * pioctl_buf) { mlan_ds_wmm_cfg *pwmm; - IEEEtypes_WMM_TSPEC_t *pTspecIE; + IEEEtypes_WMM_TSPEC_t *ptspec_ie; const HostCmd_DS_WMM_DELTS_REQ *presp_delts = &resp->params.del_ts; ENTER(); @@ -2503,13 +2960,13 @@ wlan_ret_wmm_delts_req(IN pmlan_private pmpriv, presp_delts->command_result); if (presp_delts->command_result == 0) { - pTspecIE = + ptspec_ie = (IEEEtypes_WMM_TSPEC_t *) presp_delts-> tspec_data; wlan_send_wmmac_host_event(pmpriv, "DELTS_TX", MNULL, - pTspecIE->TspecBody.TSInfo. + ptspec_ie->TspecBody.TSInfo. TID, - pTspecIE->TspecBody.TSInfo. + ptspec_ie->TspecBody.TSInfo. UserPri, presp_delts-> ieee_reason_code); @@ -2722,6 +3179,7 @@ wlan_wmm_ioctl_qos(IN pmlan_adapter pmadapter, IN pmlan_ioctl_req pioctl_req) wmm->param.qos_cfg = pmpriv->wmm_qosinfo; else { pmpriv->wmm_qosinfo = wmm->param.qos_cfg; + pmpriv->saved_wmm_qosinfo = wmm->param.qos_cfg; } pioctl_req->data_read_written = sizeof(t_u8) + MLAN_SUB_COMMAND_SIZE; diff --git a/drivers/net/wireless/sd8797/mlan/mlan_wmm.h b/drivers/net/wireless/sd8797/mlan/mlan_wmm.h index c60dd4d1cfde..a30f26e3f043 100644 --- a/drivers/net/wireless/sd8797/mlan/mlan_wmm.h +++ b/drivers/net/wireless/sd8797/mlan/mlan_wmm.h @@ -3,20 +3,25 @@ * @brief This file contains related macros, enum, and struct * of wmm functionalities * - * Copyright (C) 2008-2011, Marvell International Ltd. + * (C) Copyright 2008-2011 Marvell International Ltd. All Rights Reserved * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * MARVELL CONFIDENTIAL + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Marvell International Ltd or its + * suppliers or licensors. Title to the Material remains with Marvell International Ltd + * or its suppliers and licensors. The Material contains trade secrets and + * proprietary and confidential information of Marvell or its suppliers and + * licensors. The Material is protected by worldwide copyright and trade secret + * laws and treaty provisions. No part of the Material may be used, copied, + * reproduced, modified, published, uploaded, posted, transmitted, distributed, + * or disclosed in any way without Marvell's prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Marvell in writing. * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. */ /**************************************************** @@ -33,7 +38,7 @@ Change log: * @param pmadapter A pointer to mlan_adapter structure * @param ptr A pointer to RA list table * - * @return TID + * @return TID */ static INLINE int wlan_get_tid(pmlan_adapter pmadapter, raListTbl * ptr) @@ -54,7 +59,7 @@ wlan_get_tid(pmlan_adapter pmadapter, raListTbl * ptr) * @param pmadapter A pointer to mlan_adapter structure * @param head A pointer to mlan_list_head * - * @return Length of list + * @return Length of list */ static INLINE int wlan_wmm_list_len(pmlan_adapter pmadapter, pmlan_list_head head) diff --git a/drivers/net/wireless/sd8797/mlinux/mlan_decl.h b/drivers/net/wireless/sd8797/mlinux/mlan_decl.h index ea941f3dba38..aa210cddb9af 100644 --- a/drivers/net/wireless/sd8797/mlinux/mlan_decl.h +++ b/drivers/net/wireless/sd8797/mlinux/mlan_decl.h @@ -27,7 +27,7 @@ Change log: #define _MLAN_DECL_H_ /** MLAN release version */ -#define MLAN_RELEASE_VERSION "434" +#define MLAN_RELEASE_VERSION "457" /** Re-define generic data types for MLAN/MOAL */ /** Signed char (1-byte) */ @@ -71,7 +71,7 @@ typedef t_s32 t_sval; /** Structure packing begins */ #define MLAN_PACK_START /** Structure packeing end */ -#define MLAN_PACK_END __attribute__ ((packed)) +#define MLAN_PACK_END __attribute__((packed)) #else /* !__GNUC__ */ #ifdef PRAGMA_PACK /** Structure packing begins */ @@ -117,7 +117,7 @@ typedef t_s32 t_sval; /** Macros for Data Alignment : address */ #define ALIGN_ADDR(p, a) \ - ((((t_ptr)(p)) + (((t_ptr)(a)) - 1)) & ~(((t_ptr)(a)) - 1)) + ((((t_ptr)(p)) + (((t_ptr)(a)) - 1)) & ~(((t_ptr)(a)) - 1)) /** Return the byte offset of a field in the given structure */ #define MLAN_FIELD_OFFSET(type, field) ((t_u32)(t_ptr)&(((type *)0)->field)) @@ -151,13 +151,24 @@ typedef t_s32 t_sval; #define MLAN_STA_AMPDU_DEF_TXWINSIZE 16 /** Default Win size attached during ADDBA response */ #define MLAN_STA_AMPDU_DEF_RXWINSIZE 32 +/** RX winsize for COEX */ +#define MLAN_STA_COEX_AMPDU_DEF_RXWINSIZE 16 #endif /* STA_SUPPORT */ #ifdef UAP_SUPPORT /** Default Win size attached during ADDBA request */ #define MLAN_UAP_AMPDU_DEF_TXWINSIZE 32 /** Default Win size attached during ADDBA response */ #define MLAN_UAP_AMPDU_DEF_RXWINSIZE 16 +/** RX winsize for COEX */ +#define MLAN_UAP_COEX_AMPDU_DEF_RXWINSIZE 16 #endif /* UAP_SUPPORT */ + +#ifdef WIFI_DIRECT_SUPPORT +/** WFD use the same window size for tx/rx */ +#define MLAN_WFD_AMPDU_DEF_TXRXWINSIZE 16 +/** RX winsize for COEX */ +#define MLAN_WFD_COEX_AMPDU_DEF_RXWINSIZE 16 +#endif /** Block ack timeout value */ #define MLAN_DEFAULT_BLOCK_ACK_TIMEOUT 0xffff /** Maximum Tx Win size configured for ADDBA request [10 bits] */ @@ -221,9 +232,9 @@ typedef t_u8 mlan_802_11_mac_addr[MLAN_MAC_ADDR_LENGTH]; #define MLAN_FRAG_MAX_VALUE (2346) /** Minimum tx retry count */ -#define MLAN_TX_RETRY_MIN (0) +#define MLAN_TX_RETRY_MIN (0) /** Maximum tx retry count */ -#define MLAN_TX_RETRY_MAX (14) +#define MLAN_TX_RETRY_MAX (14) /** define SDIO block size for data Tx/Rx */ /* We support up to 480-byte block size due to FW buffer limitation. */ @@ -263,6 +274,8 @@ typedef t_u8 mlan_802_11_mac_addr[MLAN_MAC_ADDR_LENGTH]; /** Buffer flag for bridge packet */ #define MLAN_BUF_FLAG_BRIDGE_BUF MBIT(3) +#define MLAN_BUF_FLAG_TDLS MBIT(8) + #define MLAN_BUF_FLAG_TCP_ACK MBIT(9) #ifdef DEBUG_LEVEL1 @@ -428,6 +441,7 @@ typedef enum _mlan_event_id { MLAN_EVENT_ID_DRV_BGSCAN_RESULT = 0x80000013, MLAN_EVENT_ID_DRV_FLUSH_RX_WORK = 0x80000015, MLAN_EVENT_ID_DRV_DEFER_RX_WORK = 0x80000016, + MLAN_EVENT_ID_DRV_TDLS_TEARDOWN_REQ = 0x80000017, } mlan_event_id; /** Data Structures */ @@ -675,6 +689,230 @@ typedef MLAN_PACK_START struct _tlvbuf_custom_ie { tlvbuf_max_mgmt_ie max_mgmt_ie; } MLAN_PACK_END mlan_ds_misc_custom_ie; +/** Max TDLS config data length */ +#define MAX_TDLS_DATA_LEN 1024 + +/** Action commands for TDLS enable/disable */ +#define WLAN_TDLS_CONFIG 0x00 +/** Action commands for TDLS configuration :Set */ +#define WLAN_TDLS_SET_INFO 0x01 +/** Action commands for TDLS configuration :Discovery Request */ +#define WLAN_TDLS_DISCOVERY_REQ 0x02 +/** Action commands for TDLS configuration :Setup Request */ +#define WLAN_TDLS_SETUP_REQ 0x03 +/** Action commands for TDLS configuration :Tear down Request */ +#define WLAN_TDLS_TEAR_DOWN_REQ 0x04 +/** Action ID for TDLS power mode */ +#define WLAN_TDLS_POWER_MODE 0x05 +/**Action ID for init TDLS Channel Switch*/ +#define WLAN_TDLS_INIT_CHAN_SWITCH 0x06 +/** Action ID for stop TDLS Channel Switch */ +#define WLAN_TDLS_STOP_CHAN_SWITCH 0x07 +/** Action ID for configure CS related parameters */ +#define WLAN_TDLS_CS_PARAMS 0x08 +/** Action ID for Disable CS */ +#define WLAN_TDLS_CS_DISABLE 0x09 +/** Action ID for TDLS link status */ +#define WLAN_TDLS_LINK_STATUS 0x0A +/** Action ID for TDLS CS immediate return */ +#define WLAN_TDLS_DEBUG_CS_RET_IM 0xFFF7 +/** Action ID for TDLS Stop RX */ +#define WLAN_TDLS_DEBUG_STOP_RX 0xFFF8 +/** Action ID for TDLS Allow weak security for links establish */ +#define WLAN_TDLS_DEBUG_ALLOW_WEAK_SECURITY 0xFFF9 +/** Action ID for TDLS Ignore key lifetime expiry */ +#define WLAN_TDLS_DEBUG_IGNORE_KEY_EXPIRY 0xFFFA +/** Action ID for TDLS Higher/Lower mac Test */ +#define WLAN_TDLS_DEBUG_HIGHER_LOWER_MAC 0xFFFB +/** Action ID for TDLS Prohibited Test */ +#define WLAN_TDLS_DEBUG_SETUP_PROHIBITED 0xFFFC +/** Action ID for TDLS Existing link Test */ +#define WLAN_TDLS_DEBUG_SETUP_SAME_LINK 0xFFFD +/** Action ID for TDLS Fail Setup Confirm */ +#define WLAN_TDLS_DEBUG_FAIL_SETUP_CONFIRM 0xFFFE +/** Action commands for TDLS debug: Wrong BSS Request */ +#define WLAN_TDLS_DEBUG_WRONG_BSS 0xFFFF + +/** tdls each link rate information */ +typedef MLAN_PACK_START struct _tdls_link_rate_info { + /** Tx Data Rate */ + t_u8 tx_data_rate; + /** Tx Rate HT info*/ + t_u8 tx_rate_htinfo; +} MLAN_PACK_END tdls_link_rate_info; + +/** tdls each link status */ +typedef MLAN_PACK_START struct _tdls_each_link_status { + /** peer mac Address */ + t_u8 peer_mac[MLAN_MAC_ADDR_LENGTH]; + /** Link Flags */ + t_u8 link_flags; + /** Traffic Status */ + t_u8 traffic_status; + /** Tx Failure Count */ + t_u8 tx_fail_count; + /** Channel Number */ + t_u32 active_channel; + /** Last Data RSSI in dBm */ + t_s16 data_rssi_last; + /** Last Data NF in dBm */ + t_s16 data_nf_last; + /** AVG DATA RSSI in dBm */ + t_s16 data_rssi_avg; + /** AVG DATA NF in dBm */ + t_s16 data_nf_avg; + union { + /** tdls rate info */ + tdls_link_rate_info rate_info; + /** tdls link final rate*/ + t_u16 final_data_rate; + } u; + /** Security Method */ + t_u8 security_method; + /** Key Lifetime in milliseconds */ + t_u32 key_lifetime; + /** Key Length */ + t_u8 key_length; + /** actual key */ + t_u8 key[0]; +} MLAN_PACK_END tdls_each_link_status; + +/** TDLS configuration data */ +typedef MLAN_PACK_START struct _tdls_all_config { + union { + /** TDLS state enable disable */ + MLAN_PACK_START struct _tdls_config { + /** enable or disable */ + t_u16 enable; + } MLAN_PACK_END tdls_config; + + /** TDLS set info */ + MLAN_PACK_START struct _tdls_set_data { + /** (tlv + capInfo) length */ + t_u16 tlv_length; + /** Cap Info */ + t_u16 cap_info; + /** TLV buffer */ + t_u8 tlv_buffer[0]; + } MLAN_PACK_END tdls_set; + + /** TDLS discovery and others having mac argument */ + MLAN_PACK_START struct _tdls_discovery_data { + /** peer mac Address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + } MLAN_PACK_END tdls_discovery, tdls_stop_chan_switch, + tdls_link_status_req; + + /** TDLS discovery Response */ + MLAN_PACK_START struct _tdls_discovery_resp { + /** payload length */ + t_u16 payload_len; + /** peer mac Address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** RSSI */ + t_s8 rssi; + /** Cap Info */ + t_u16 cap_info; + /** TLV buffer */ + t_u8 tlv_buffer[0]; + } MLAN_PACK_END tdls_discovery_resp; + + /** TDLS setup request */ + MLAN_PACK_START struct _tdls_setup_data { + /** peer mac Address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** timeout value in milliseconds */ + t_u32 setup_timeout; + /** key lifetime in milliseconds */ + t_u32 key_lifetime; + } MLAN_PACK_END tdls_setup; + + /** TDLS tear down info */ + MLAN_PACK_START struct _tdls_tear_down_data { + /** peer mac Address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** reason code */ + t_u16 reason_code; + } MLAN_PACK_END tdls_tear_down, tdls_cmd_resp; + + /** TDLS power mode info */ + MLAN_PACK_START struct _tdls_power_mode_data { + /** peer mac Address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** Power Mode */ + t_u16 power_mode; + } MLAN_PACK_END tdls_power_mode; + + /** TDLS channel switch info */ + MLAN_PACK_START struct _tdls_chan_switch { + /** peer mac Address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** Channel Switch primary channel no */ + t_u8 primary_channel; + /** Channel Switch secondary channel offset */ + t_u8 secondary_channel_offset; + /** Channel Switch Band */ + t_u8 band; + /** Channel Switch time in milliseconds */ + t_u16 switch_time; + /** Channel Switch timeout in milliseconds */ + t_u16 switch_timeout; + /** Channel Regulatory class*/ + t_u8 regulatory_class; + /** peridicity flag*/ + t_u8 periodicity; + } MLAN_PACK_END tdls_chan_switch; + + /** TDLS channel switch paramters */ + MLAN_PACK_START struct _tdls_cs_params { + /** unit time, multiples of 10ms */ + t_u8 unit_time; + /** threshold for other link */ + t_u8 threshold_otherlink; + /** threshold for direct link */ + t_u8 threshold_directlink; + } MLAN_PACK_END tdls_cs_params; + + /** tdls disable channel switch */ + MLAN_PACK_START struct _tdls_disable_cs { + /** Data*/ + t_u16 data; + } MLAN_PACK_END tdls_disable_cs; + /** TDLS debug data */ + MLAN_PACK_START struct _tdls_debug_data { + /** debug data */ + t_u16 debug_data; + } MLAN_PACK_END tdls_debug_data; + + /** TDLS link status Response */ + MLAN_PACK_START struct _tdls_link_status_resp { + /** payload length */ + t_u16 payload_len; + /** number of links */ + t_u8 active_links; + /** structure for link status */ + tdls_each_link_status link_stats[1]; + } MLAN_PACK_END tdls_link_status_resp; + + } u; +} MLAN_PACK_END tdls_all_config; + +/** TDLS configuration buffer */ +typedef MLAN_PACK_START struct _buf_tdls_config { + /** TDLS Action */ + t_u16 tdls_action; + /** TDLS data */ + t_u8 tdls_data[MAX_TDLS_DATA_LEN]; +} MLAN_PACK_END mlan_ds_misc_tdls_config; + +/** Event structure for tear down */ +typedef struct _tdls_tear_down_event { + /** Peer mac address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** Reason code */ + t_u16 reason_code; +} tdls_tear_down_event; + #ifdef PRAGMA_PACK #pragma pack(pop) #endif @@ -819,14 +1057,6 @@ typedef struct _mlan_callbacks { /** Parameter disabled, override MLAN default setting */ #define MLAN_INIT_PARA_DISABLED 2 -/** Control bit for stream 2X2 */ -#define FEATURE_CTRL_STREAM_2X2 MBIT(6) -/** Control bit for DFS support */ -#define FEATURE_CTRL_DFS_SUPPORT MBIT(7) - -/** Default feature control */ -#define FEATURE_CTRL_DEFAULT 0xffffffff - /** mlan_device data structure */ typedef struct _mlan_device { /** MOAL Handle */ @@ -865,8 +1095,6 @@ typedef struct _mlan_device { /** 802.11d configuration */ t_u32 cfg_11d; #endif - /** Feature control bitmask */ - t_u32 feature_control; /** enable/disable rx work */ t_u8 rx_work; diff --git a/drivers/net/wireless/sd8797/mlinux/mlan_ieee.h b/drivers/net/wireless/sd8797/mlinux/mlan_ieee.h index 61cdd5c70607..50eaece85672 100644 --- a/drivers/net/wireless/sd8797/mlinux/mlan_ieee.h +++ b/drivers/net/wireless/sd8797/mlinux/mlan_ieee.h @@ -28,7 +28,7 @@ Change log: #define _MLAN_IEEE_H_ /** FIX IES size in beacon buffer */ -#define WLAN_802_11_FIXED_IE_SIZE 12 +#define WLAN_802_11_FIXED_IE_SIZE 12 /** WLAN supported rates */ #define WLAN_SUPPORTED_RATES 14 @@ -1071,19 +1071,31 @@ typedef MLAN_PACK_START struct { **/ typedef MLAN_PACK_START struct { #ifdef BIG_ENDIAN_SUPPORT - t_u8 rsvd5_7:3; /**< Reserved */ - t_u8 unmeasured:1; /**< Channel is unmeasured */ - t_u8 radar:1; /**< Radar detected on channel */ - t_u8 unidentified_sig:1; /**< Unidentified signal found on channel */ - t_u8 ofdm_preamble:1; /**< OFDM preamble detected on channel */ - t_u8 bss:1; /**< At least one valid MPDU received on channel */ + /**< Reserved */ + t_u8 rsvd5_7:3; + /**< Channel is unmeasured */ + t_u8 unmeasured:1; + /**< Radar detected on channel */ + t_u8 radar:1; + /**< Unidentified signal found on channel */ + t_u8 unidentified_sig:1; + /**< OFDM preamble detected on channel */ + t_u8 ofdm_preamble:1; + /**< At least one valid MPDU received on channel */ + t_u8 bss:1; #else - t_u8 bss:1; /**< At least one valid MPDU received on channel */ - t_u8 ofdm_preamble:1; /**< OFDM preamble detected on channel */ - t_u8 unidentified_sig:1; /**< Unidentified signal found on channel */ - t_u8 radar:1; /**< Radar detected on channel */ - t_u8 unmeasured:1; /**< Channel is unmeasured */ - t_u8 rsvd5_7:3; /**< Reserved */ + /**< At least one valid MPDU received on channel */ + t_u8 bss:1; + /**< OFDM preamble detected on channel */ + t_u8 ofdm_preamble:1; + /**< Unidentified signal found on channel */ + t_u8 unidentified_sig:1; + /**< Radar detected on channel */ + t_u8 radar:1; + /**< Channel is unmeasured */ + t_u8 unmeasured:1; + /**< Reserved */ + t_u8 rsvd5_7:3; #endif /* BIG_ENDIAN_SUPPORT */ } MLAN_PACK_END MeasRptBasicMap_t; @@ -1139,6 +1151,48 @@ typedef struct { } wlan_11h_bss_info_t; +/** Ethernet packet type for TDLS */ +#define MLAN_ETHER_PKT_TYPE_TDLS_ACTION (0x890D) + +/*802.11z TDLS action frame type and strcuct */ +typedef MLAN_PACK_START struct { + /* link indentifier ie =101 */ + t_u8 element_id; + /* len = 18 */ + t_u8 len; + /** bssid */ + t_u8 bssid[MLAN_MAC_ADDR_LENGTH]; + /** init sta mac address */ + t_u8 init_sta[MLAN_MAC_ADDR_LENGTH]; + /** resp sta mac address */ + t_u8 resp_sta[MLAN_MAC_ADDR_LENGTH]; +} MLAN_PACK_END IEEEtypes_tdls_linkie; + +/** action code for tdls setup request */ +#define TDLS_SETUP_REQUEST 0 +/** action code for tdls setup response */ +#define TDLS_SETUP_RESPONSE 1 +/** action code for tdls setup confirm */ +#define TDLS_SETUP_CONFIRM 2 +/** action code for tdls tear down */ +#define TDLS_TEARDOWN 3 +/** action code for tdls traffic indication */ +#define TDLS_PEER_TRAFFIC_INDICATION 4 +/** action code for tdls channel switch request */ +#define TDLS_CHANNEL_SWITCH_REQUEST 5 +/** action code for tdls channel switch response */ +#define TDLS_CHANNEL_SWITCH_RESPONSE 6 +/** action code for tdls psm request */ +#define TDLS_PEER_PSM_REQUEST 7 +/** action code for tdls psm response */ +#define TDLS_PEER_PSM_RESPONSE 8 +/** action code for tdls traffic response */ +#define TDLS_PEER_TRAFFIC_RESPONSE 9 +/** action code for tdls discovery request */ +#define TDLS_DISCOVERY_REQUEST 10 +/** action code for TDLS discovery response */ +#define TDLS_DISCOVERY_RESPONSE 14 + #ifdef STA_SUPPORT /** Macro for maximum size of scan response buffer */ #define MAX_SCAN_RSP_BUF (16 * 1024) @@ -1283,6 +1337,8 @@ typedef MLAN_PACK_START struct { t_u8 snr_threshold; /** repeat count */ t_u16 repeat_count; + /** start later flag */ + t_u16 start_later; /** SSID filter list used in the to limit the scan results */ wlan_user_scan_ssid ssid_list[MRVDRV_MAX_SSID_LIST_LENGTH]; /** Variable number (fixed maximum) of channels to scan up */ diff --git a/drivers/net/wireless/sd8797/mlinux/mlan_ioctl.h b/drivers/net/wireless/sd8797/mlinux/mlan_ioctl.h index 31c65eebefcf..b6a8409abfa6 100644 --- a/drivers/net/wireless/sd8797/mlinux/mlan_ioctl.h +++ b/drivers/net/wireless/sd8797/mlinux/mlan_ioctl.h @@ -208,6 +208,7 @@ enum _mlan_ioctl_req_id { MLAN_OID_MISC_ASSOC_RSP = 0x0020000C, MLAN_OID_MISC_INIT_SHUTDOWN = 0x0020000D, MLAN_OID_MISC_CUSTOM_IE = 0x0020000F, + MLAN_OID_MISC_TDLS_CONFIG = 0x00200010, MLAN_OID_MISC_TX_DATAPAUSE = 0x00200012, MLAN_OID_MISC_IP_ADDR = 0x00200013, MLAN_OID_MISC_MAC_CONTROL = 0x00200014, @@ -231,6 +232,8 @@ enum _mlan_ioctl_req_id { #ifdef WIFI_DIRECT_SUPPORT MLAN_OID_MISC_WIFI_DIRECT_CONFIG = 0x00200025, #endif + MLAN_OID_MISC_TDLS_OPER = 0x00200026, + MLAN_OID_MISC_GET_TDLS_IES = 0x00200027, }; /** Sub command size */ @@ -461,7 +464,7 @@ enum _mlan_bss_mode { #define MLAN_BEACON_INTERVAL 100 /** Receive all packets */ -#define MLAN_PROMISC_MODE 1 +#define MLAN_PROMISC_MODE 1 /** Receive multicast packets in multicast list */ #define MLAN_MULTICAST_MODE 2 /** Receive all multicast packets */ @@ -502,7 +505,9 @@ typedef struct _mlan_chan_list { chan_freq cf[MLAN_MAX_CHANNEL_NUM]; } mlan_chan_list; -/** mlan_ssid_bssid data structure for MLAN_OID_BSS_START and MLAN_OID_BSS_FIND_BSS */ +/** mlan_ssid_bssid data structure for + * MLAN_OID_BSS_START and MLAN_OID_BSS_FIND_BSS + */ typedef struct _mlan_ssid_bssid { /** SSID */ mlan_802_11_ssid ssid; @@ -1210,6 +1215,8 @@ typedef struct _mlan_fw_info { t_u32 fw_ver; /** MAC address */ mlan_802_11_mac_addr mac_addr; + /** 802.11n device capabilities */ + t_u32 hw_dot_11n_dev_cap; /** Device support for MIMO abstraction of MCSs */ t_u8 hw_dev_mcs_support; /** fw supported band */ @@ -1283,7 +1290,7 @@ typedef struct _mlan_bss_info { #define MAX_NUM_TID 8 /** Max RX Win size */ -#define MAX_RX_WINSIZE 64 +#define MAX_RX_WINSIZE 64 /** rx_reorder_tbl */ typedef struct { @@ -1319,6 +1326,25 @@ typedef struct { #define SDIO_MP_DBG_NUM 6 #endif +/** Maximum size of IEEE Information Elements */ +#define IEEE_MAX_IE_SIZE 256 + +/** support up to 8 TDLS peer */ +#define MLAN_MAX_TDLS_PEER_SUPPORTED 8 +/** TDLS peer info */ +typedef struct _tdls_peer_info { + /** station mac address */ + t_u8 mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** SNR */ + t_s8 snr; + /** Noise Floor */ + t_s8 nf; + /** Extended Capabilities IE */ + t_u8 ext_cap[IEEE_MAX_IE_SIZE]; + /** HT Capabilities IE */ + t_u8 ht_cap[IEEE_MAX_IE_SIZE]; +} tdls_peer_info; + /** mlan_debug_info data structure for MLAN_OID_GET_DEBUG_INFO */ typedef struct _mlan_debug_info { /* WMM AC_BK count */ @@ -1343,6 +1369,10 @@ typedef struct _mlan_debug_info { t_u32 rx_tbl_num; /** Rx reorder table*/ rx_reorder_tbl rx_tbl[MLAN_MAX_RX_BASTREAM_SUPPORTED]; + /** TDLS peer number */ + t_u32 tdls_peer_num; + /** TDLS peer list*/ + tdls_peer_info tdls_peer_list[MLAN_MAX_TDLS_PEER_SUPPORTED]; /** Corresponds to ps_mode member of mlan_adapter */ t_u16 ps_mode; /** Corresponds to ps_state member of mlan_adapter */ @@ -1483,6 +1513,8 @@ typedef struct _mlan_debug_info { t_u32 mlan_processing; /** mlan_rx_processing */ t_u32 mlan_rx_processing; + /** rx pkts queued */ + t_u32 rx_pkts_queued; /** mlan_adapter pointer */ t_void *mlan_adapter; /** mlan_adapter_size */ @@ -1611,11 +1643,17 @@ enum _mlan_psk_type { /** Type definition of mlan_ds_encrypt_key for MLAN_OID_SEC_CFG_ENCRYPT_KEY */ typedef struct _mlan_ds_encrypt_key { - /** Key disabled, all other fields will be ignore when this flag set to MTRUE */ + /** Key disabled, all other fields will be + * ignore when this flag set to MTRUE + */ t_u32 key_disable; - /** key removed flag, when this flag is set to MTRUE, only key_index will be check */ + /** key removed flag, when this flag is set + * to MTRUE, only key_index will be check + */ t_u32 key_remove; - /** Key index, used as current tx key index when is_current_wep_key is set to MTRUE */ + /** Key index, used as current tx key index + * when is_current_wep_key is set to MTRUE + */ t_u32 key_index; /** Current Tx key flag */ t_u32 is_current_wep_key; @@ -1712,7 +1750,9 @@ typedef struct _mlan_ds_sec_cfg { mlan_ds_encrypt_key encrypt_key; /** Passphrase for MLAN_OID_SEC_CFG_PASSPHRASE */ mlan_ds_passphrase passphrase; - /** Embedded supplicant WPA enabled flag for MLAN_OID_SEC_CFG_EWPA_ENABLED */ + /** Embedded supplicant WPA enabled flag for + * MLAN_OID_SEC_CFG_EWPA_ENABLED + */ t_u32 ewpa_enabled; /** Embedded supplicant mode for MLAN_OID_SEC_CFG_ESUPP_MODE */ mlan_ds_esupp_mode esupp_mode; @@ -1881,7 +1921,9 @@ typedef struct _mlan_ds_hs_cfg { t_u32 conditions; /** GPIO pin or 0xff for interface */ t_u32 gpio; - /** Gap in milliseconds or or 0xff for special setting when GPIO is used to wakeup host */ + /** Gap in milliseconds or or 0xff for special + * setting when GPIO is used to wakeup host + */ t_u32 gap; } mlan_ds_hs_cfg, *pmlan_ds_hs_cfg; @@ -1900,7 +1942,9 @@ typedef struct _mlan_ds_auto_ds { t_u16 idletime; } mlan_ds_auto_ds; -/** Type definition of mlan_ds_inactivity_to for MLAN_OID_PM_CFG_INACTIVITY_TO */ +/** Type definition of mlan_ds_inactivity_to + * for MLAN_OID_PM_CFG_INACTIVITY_TO + */ typedef struct _mlan_ds_inactivity_to { /** Timeout unit in microsecond, 0 means 1000us (1ms) */ t_u32 timeout_unit; @@ -2195,7 +2239,9 @@ typedef struct { */ t_u16 delay_histogram[MLAN_WMM_STATS_PKTS_HIST_BINS]; } wlan_ioctl_wmm_queue_stats_t, -/** Type definition of mlan_ds_wmm_queue_stats for MLAN_OID_WMM_CFG_QUEUE_STATS */ +/** Type definition of mlan_ds_wmm_queue_stats + * for MLAN_OID_WMM_CFG_QUEUE_STATS + */ mlan_ds_wmm_queue_stats, *pmlan_ds_wmm_queue_stats; /** @@ -2225,7 +2271,9 @@ typedef struct { /** WMM AC queue status */ wlan_ioctl_wmm_queue_status_ac_t ac_status[MLAN_WMM_MAX_AC_QUEUES]; } wlan_ioctl_wmm_queue_status_t, -/** Type definition of mlan_ds_wmm_queue_status for MLAN_OID_WMM_CFG_QUEUE_STATUS */ +/** Type definition of mlan_ds_wmm_queue_status + * for MLAN_OID_WMM_CFG_QUEUE_STATUS + */ mlan_ds_wmm_queue_status, *pmlan_ds_wmm_queue_status; /** Type definition of mlan_ds_wmm_addts for MLAN_OID_WMM_CFG_ADDTS */ @@ -2256,7 +2304,9 @@ typedef struct _mlan_ds_wmm_delts { t_u8 ie_data[MLAN_WMM_TSPEC_SIZE]; } mlan_ds_wmm_delts, *pmlan_ds_wmm_delts; -/** Type definition of mlan_ds_wmm_queue_config for MLAN_OID_WMM_CFG_QUEUE_CONFIG */ +/** Type definition of mlan_ds_wmm_queue_config + * for MLAN_OID_WMM_CFG_QUEUE_CONFIG + */ typedef struct _mlan_ds_wmm_queue_config { /** Action of Queue Config : Set, Get, or Default */ mlan_wmm_queue_config_action_e action; @@ -2340,7 +2390,9 @@ typedef struct _mlan_ds_11n_htcap_cfg { t_u32 hw_cap_req; } mlan_ds_11n_htcap_cfg, *pmlan_ds_11n_htcap_cfg; -/** Type definition of mlan_ds_11n_addba_param for MLAN_OID_11N_CFG_ADDBA_PARAM */ +/** Type definition of mlan_ds_11n_addba_param + * for MLAN_OID_11N_CFG_ADDBA_PARAM + */ typedef struct _mlan_ds_11n_addba_param { /** Timeout */ t_u32 timeout; @@ -2464,7 +2516,9 @@ typedef struct _mlan_ds_11n_amsdu_aggr_ctrl { t_u16 curr_buf_size; } mlan_ds_11n_amsdu_aggr_ctrl, *pmlan_ds_11n_amsdu_aggr_ctrl; -/** Type definition of mlan_ds_11n_aggr_prio_tbl for MLAN_OID_11N_CFG_AGGR_PRIO_TBL */ +/** Type definition of mlan_ds_11n_aggr_prio_tbl + * for MLAN_OID_11N_CFG_AGGR_PRIO_TBL + */ typedef struct _mlan_ds_11n_aggr_prio_tbl { /** ampdu priority table */ t_u8 ampdu[MAX_NUM_TID]; @@ -2536,9 +2590,6 @@ typedef struct _mlan_ds_11n_cfg { /** Country code length */ #define COUNTRY_CODE_LEN 3 -/** Maximum size of IEEE Information Elements */ -#define IEEE_MAX_IE_SIZE 256 - /*-----------------------------------------------------------------*/ /** 802.11d Configuration Group */ /*-----------------------------------------------------------------*/ @@ -2711,7 +2762,9 @@ typedef struct _mlan_ds_misc_gen_ie { } mlan_ds_misc_gen_ie; #if defined(SDIO_MULTI_PORT_TX_AGGR) || defined(SDIO_MULTI_PORT_RX_AGGR) -/** Type definition of mlan_ds_misc_sdio_mpa_ctrl for MLAN_OID_MISC_SDIO_MPA_CTRL */ +/** Type definition of mlan_ds_misc_sdio_mpa_ctrl + * for MLAN_OID_MISC_SDIO_MPA_CTRL + */ typedef struct _mlan_ds_misc_sdio_mpa_ctrl { /** SDIO MP-A TX enable/disable */ t_u16 tx_enable; @@ -2737,12 +2790,12 @@ typedef struct _mlan_ds_misc_cmd { } mlan_ds_misc_cmd; /** Maximum number of system clocks */ -#define MLAN_MAX_CLK_NUM 16 +#define MLAN_MAX_CLK_NUM 16 /** Clock type : Configurable */ -#define MLAN_CLK_CONFIGURABLE 0 +#define MLAN_CLK_CONFIGURABLE 0 /** Clock type : Supported */ -#define MLAN_CLK_SUPPORTED 1 +#define MLAN_CLK_SUPPORTED 1 /** Type definition of mlan_ds_misc_sys_clock for MLAN_OID_MISC_SYS_CLOCK */ typedef struct _mlan_ds_misc_sys_clock { @@ -2773,7 +2826,9 @@ enum _mlan_func_cmd { MLAN_FUNC_SHUTDOWN, }; -/** Type definition of mlan_ds_misc_tx_datapause for MLAN_OID_MISC_TX_DATAPAUSE */ +/** Type definition of mlan_ds_misc_tx_datapause + * for MLAN_OID_MISC_TX_DATAPAUSE + */ typedef struct _mlan_ds_misc_tx_datapause { /** Tx data pause flag */ t_u16 tx_pause; @@ -2836,7 +2891,9 @@ typedef struct _mlan_ds_misc_cfp_code { t_u32 cfp_code_a; } mlan_ds_misc_cfp_code; -/** Type definition of mlan_ds_misc_country_code for MLAN_OID_MISC_COUNTRY_CODE */ +/** Type definition of mlan_ds_misc_country_code + * for MLAN_OID_MISC_COUNTRY_CODE + */ typedef struct _mlan_ds_misc_country_code { /** Country Code */ t_u8 country_code[COUNTRY_CODE_LEN]; @@ -2881,43 +2938,63 @@ typedef struct _mlan_ds_subscribe_evt { t_u16 evt_bitmap; /** Absolute value of RSSI threshold value (dBm) */ t_u8 low_rssi; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 low_rssi_freq; /** SNR threshold value (dB) */ t_u8 low_snr; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 low_snr_freq; /** Failure count threshold */ t_u8 failure_count; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 failure_count_freq; /** num of missed beacons */ t_u8 beacon_miss; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 beacon_miss_freq; /** Absolute value of RSSI threshold value (dBm) */ t_u8 high_rssi; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 high_rssi_freq; /** SNR threshold value (dB) */ t_u8 high_snr; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 high_snr_freq; /** Absolute value of data RSSI threshold value (dBm) */ t_u8 data_low_rssi; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 data_low_rssi_freq; /** Absolute value of data SNR threshold value (dBm) */ t_u8 data_low_snr; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 data_low_snr_freq; /** Absolute value of data RSSI threshold value (dBm) */ t_u8 data_high_rssi; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 data_high_rssi_freq; /** Absolute value of data SNR threshold value (dBm) */ t_u8 data_high_snr; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 data_high_snr_freq; /* Link SNR threshold (dB) */ t_u16 link_snr; @@ -2938,7 +3015,9 @@ typedef struct _mlan_ds_subscribe_evt { /** Max OTP user data length */ #define MAX_OTP_USER_DATA_LEN 252 -/** Type definition of mlan_ds_misc_otp_user_data for MLAN_OID_MISC_OTP_USER_DATA */ +/** Type definition of mlan_ds_misc_otp_user_data + * for MLAN_OID_MISC_OTP_USER_DATA + */ typedef struct _mlan_ds_misc_otp_user_data { /** Reserved */ t_u16 reserved; @@ -2953,7 +3032,9 @@ typedef struct _mlan_ds_misc_otp_user_data { #define WIFI_DIRECT_NOA 1 /** flag for OPP_PS */ #define WIFI_DIRECT_OPP_PS 2 -/** Type definition of mlan_ds_wifi_direct_config for MLAN_OID_MISC_WIFI_DIRECT_CONFIG */ +/** Type definition of mlan_ds_wifi_direct_config + * for MLAN_OID_MISC_WIFI_DIRECT_CONFIG + */ typedef struct _mlan_ds_wifi_direct_config { /** flags for NOA/OPP_PS */ t_u8 flags; @@ -2983,6 +3064,59 @@ typedef struct _mlan_ds_misc_pmfcfg { } mlan_ds_misc_pmfcfg; #endif +/**Action ID for TDLS disable link*/ +#define WLAN_TDLS_DISABLE_LINK 0x00 +/**Action ID for TDLS enable link*/ +#define WLAN_TDLS_ENABLE_LINK 0x01 +/**Action ID for TDLS create link*/ +#define WLAN_TDLS_CREATE_LINK 0x02 +/**Action ID for TDLS config link*/ +#define WLAN_TDLS_CONFIG_LINK 0x03 +/*reason code*/ +#define WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED 26 +/** TDLS operation buffer */ +typedef struct _mlan_ds_misc_tdls_oper { + /** TDLS Action */ + t_u16 tdls_action; + /** TDLS peer address */ + t_u8 peer_mac[MLAN_MAC_ADDR_LENGTH]; + /** peer capability */ + t_u16 capability; + /** peer qos info */ + t_u8 qos_info; + /** peer extend capability */ + t_u8 *ext_capab; + /** extend capability len */ + t_u8 ext_capab_len; + /** support rates */ + t_u8 *supported_rates; + /** supported rates len */ + t_u8 supported_rates_len; + /** peer ht_cap */ + t_u8 *ht_capa; +} mlan_ds_misc_tdls_oper; + +/** flag for TDLS extcap */ +#define TDLS_IE_FLAGS_EXTCAP 0x0001 +/** flag for TDLS HTCAP */ +#define TDLS_IE_FLAGS_HTCAP 0x0002 +/** flag for TDLS HTINFO */ +#define TDLS_IE_FLAGS_HTINFO 0x0004 + +/** TDLS ie buffer */ +typedef struct _mlan_ds_misc_tdls_ies { + /** TDLS peer address */ + t_u8 peer_mac[MLAN_MAC_ADDR_LENGTH]; + /** flags for request IEs */ + t_u16 flags; + /** Extended Capabilities IE */ + t_u8 ext_cap[IEEE_MAX_IE_SIZE]; + /** HT Capabilities IE */ + t_u8 ht_cap[IEEE_MAX_IE_SIZE]; + /** HT Information IE */ + t_u8 ht_info[IEEE_MAX_IE_SIZE]; +} mlan_ds_misc_tdls_ies; + /** Type definition of mlan_ds_misc_cfg for MLAN_IOCTL_MISC_CFG */ typedef struct _mlan_ds_misc_cfg { /** Sub-command */ @@ -3009,6 +3143,12 @@ typedef struct _mlan_ds_misc_cfg { t_u32 func_init_shutdown; /** Custom IE for MLAN_OID_MISC_CUSTOM_IE */ mlan_ds_misc_custom_ie cust_ie; + /** TDLS configuration for MLAN_OID_MISC_TDLS_CONFIG */ + mlan_ds_misc_tdls_config tdls_config; + /** TDLS operation for MLAN_OID_MISC_TDLS_OPER */ + mlan_ds_misc_tdls_oper tdls_oper; + /** TDLS ies for MLAN_OID_MISC_GET_TDLS_IES */ + mlan_ds_misc_tdls_ies tdls_ies; /** Tx data pause for MLAN_OID_MISC_TX_DATAPAUSE */ mlan_ds_misc_tx_datapause tx_datapause; /** IP address configuration */ diff --git a/drivers/net/wireless/sd8797/mlinux/moal_cfg80211.c b/drivers/net/wireless/sd8797/mlinux/moal_cfg80211.c index 014d10d19307..da8c647fc1c1 100644 --- a/drivers/net/wireless/sd8797/mlinux/moal_cfg80211.c +++ b/drivers/net/wireless/sd8797/mlinux/moal_cfg80211.c @@ -229,7 +229,9 @@ woal_get_active_intf_freq(moal_private * priv) (handle->priv[i]->bss_type == priv->bss_type)) return ieee80211_channel_to_frequency(handle-> priv[i]-> - channel, + channel +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) || defined(COMPAT_WIRELESS) + , (handle-> priv[i]-> channel @@ -237,7 +239,10 @@ woal_get_active_intf_freq(moal_private * priv) 14 ? IEEE80211_BAND_2GHZ : - IEEE80211_BAND_5GHZ)); + IEEE80211_BAND_5GHZ) +#endif + ); + } #endif #ifdef UAP_SUPPORT @@ -246,7 +251,9 @@ woal_get_active_intf_freq(moal_private * priv) (handle->priv[i]->bss_type == priv->bss_type)) return ieee80211_channel_to_frequency(handle-> priv[i]-> - channel, + channel +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) || defined(COMPAT_WIRELESS) + , (handle-> priv[i]-> channel @@ -254,7 +261,9 @@ woal_get_active_intf_freq(moal_private * priv) 14 ? IEEE80211_BAND_2GHZ : - IEEE80211_BAND_5GHZ)); + IEEE80211_BAND_5GHZ) +#endif + ); } #endif } @@ -429,14 +438,10 @@ woal_cfg80211_set_key(moal_private * priv, t_u8 is_enable_wep, } /* Send IOCTL request to MLAN */ - if (MLAN_STATUS_SUCCESS != - woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT)) { - ret = MLAN_STATUS_FAILURE; - goto done; - } + ret = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); done: - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -738,7 +743,6 @@ woal_cfg80211_init_p2p_go(moal_private * priv) int ret = MLAN_STATUS_SUCCESS; t_u16 wifi_direct_mode; t_u8 bss_role; - mlan_ds_wifi_direct_config p2p_config; ENTER(); @@ -787,22 +791,6 @@ woal_cfg80211_init_p2p_go(moal_private * priv) goto done; } } -/* NoA:-- Interval = 100TUs and Duration= 50TUs, count=255*/ -#define DEF_NOA_COUNT 255 -#define DEF_NOA_DURATION 50 -#define DEF_NOA_INTERVAL 100 -/* CTWindow = 10ms*/ -#define DEF_CT_WINDOW 10 - memset(&p2p_config, 0, sizeof(p2p_config)); - p2p_config.noa_enable = MTRUE; - p2p_config.index = 0; - p2p_config.noa_count = DEF_NOA_COUNT; - p2p_config.noa_duration = DEF_NOA_DURATION; - p2p_config.noa_interval = DEF_NOA_INTERVAL; - p2p_config.opp_ps_enable = MTRUE; - p2p_config.ct_window = DEF_CT_WINDOW; - p2p_config.flags = WIFI_DIRECT_NOA | WIFI_DIRECT_OPP_PS; - woal_p2p_config(priv, MLAN_ACT_SET, &p2p_config); done: LEAVE(); return ret; @@ -932,6 +920,7 @@ woal_cfg80211_change_virtual_intf(struct wiphy *wiphy, #if defined(STA_SUPPORT) && defined(UAP_SUPPORT) t_u8 bss_role; #endif + mlan_status status = MLAN_STATUS_SUCCESS; ENTER(); @@ -1127,14 +1116,14 @@ woal_cfg80211_change_virtual_intf(struct wiphy *wiphy, if (ret) goto done; - if (MLAN_STATUS_SUCCESS != - woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT)) { + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (MLAN_STATUS_SUCCESS != status) { ret = -EFAULT; goto done; } done: - if (req) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -1519,17 +1508,18 @@ woal_cfg80211_set_bitrate_mask(struct wiphy *wiphy, #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) /* Fill MCS rates */ rate_cfg->bitmap_rates[2] = mask->control[band].mcs[0]; - if (priv->phandle->card_type == CARD_TYPE_SD8797) - rate_cfg->bitmap_rates[2] |= mask->control[band].mcs[1] << 8; + rate_cfg->bitmap_rates[2] |= mask->control[band].mcs[1] << 8; #endif - if (MLAN_STATUS_SUCCESS != - woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT)) { + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (MLAN_STATUS_SUCCESS != status) { ret = -EFAULT; goto done; } done: + if (status != MLAN_STATUS_PENDING) + kfree(req); LEAVE(); return ret; } @@ -1551,6 +1541,7 @@ woal_cfg80211_set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant) moal_private *priv = NULL; mlan_ds_radio_cfg *radio = NULL; mlan_ioctl_req *req = NULL; + mlan_status status = MLAN_STATUS_SUCCESS; int ret = 0; ENTER(); @@ -1578,14 +1569,14 @@ woal_cfg80211_set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant) radio->param.ant_cfg.tx_antenna = tx_ant; radio->param.ant_cfg.rx_antenna = rx_ant; - if (MLAN_STATUS_SUCCESS != - woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT)) { + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (MLAN_STATUS_SUCCESS != status) { ret = -EFAULT; goto done; } done: - if (req) + if (status != MLAN_STATUS_PENDING) kfree(req); /* Driver must return -EINVAL to cfg80211 */ if (ret) @@ -1811,8 +1802,8 @@ woal_cfg80211_mgmt_tx(struct wiphy *wiphy, if (buf == NULL || len == 0) { PRINTM(MERROR, "woal_cfg80211_mgmt_tx() corrupt data\n"); - ret = -EFAULT; - goto done; + LEAVE(); + return -EFAULT; } /* If the packet is probe response, that means we are in listen phase, @@ -1844,32 +1835,17 @@ woal_cfg80211_mgmt_tx(struct wiphy *wiphy, /* With sd8777 We have difficulty to receive response packet in 500ms */ #define MGMT_TX_DEFAULT_WAIT_TIME 1500 - /** cancel previous remain on channel */ - if (priv->phandle->remain_on_channel) { + if (priv->phandle->remain_on_channel) remain_priv = priv->phandle->priv[priv->phandle-> remain_bss_index]; - if (!remain_priv) { + /** cancel previous remain on channel */ + if (priv->phandle->remain_on_channel && remain_priv) { + if (woal_cfg80211_remain_on_channel_cfg + (remain_priv, MOAL_IOCTL_WAIT, MTRUE, + &channel_status, NULL, 0, 0)) PRINTM(MERROR, - "mgmt_tx:Wrong remain_bss_index=%d\n", - priv->phandle->remain_bss_index); - ret = -EFAULT; - goto done; - } - if ((priv->phandle->chan.center_freq != - chan->center_freq) - ) { - if (woal_cfg80211_remain_on_channel_cfg - (remain_priv, MOAL_IOCTL_WAIT, MTRUE, - &channel_status, NULL, 0, 0)) { - PRINTM(MERROR, - "mgmt_tx:Fail to cancel remain on channel\n"); - ret = -EFAULT; - goto done; - } - - } - + "mgmt_tx:Fail to cancel remain on channel\n"); if (priv->phandle->cookie) { cfg80211_remain_on_channel_expired( #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0) @@ -2081,6 +2057,7 @@ woal_cfg80211_custom_ie(moal_private * priv, t_u8 *pos = NULL; t_u16 len = 0; int ret = 0; + mlan_status status = MLAN_STATUS_SUCCESS; ENTER(); @@ -2137,8 +2114,8 @@ woal_cfg80211_custom_ie(moal_private * priv, memcpy(&misc->param.cust_ie, custom_ie, sizeof(mlan_ds_misc_custom_ie)); - if (MLAN_STATUS_SUCCESS != - woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT)) { + status = woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT); + if (MLAN_STATUS_SUCCESS != status) { ret = -EFAULT; goto done; } @@ -2184,10 +2161,9 @@ woal_cfg80211_custom_ie(moal_private * priv, ret = -EFAULT; done: - if (ioctl_req) + if (status != MLAN_STATUS_PENDING) kfree(ioctl_req); - if (custom_ie) - kfree(custom_ie); + kfree(custom_ie); LEAVE(); return ret; } @@ -2209,7 +2185,7 @@ woal_get_first_p2p_ie(const t_u8 * ie, int len, t_u8 * ie_out) int length; t_u8 id = 0; t_u16 out_len = 0; - IEEEtypes_VendorSpecific_t *pVendorIe = NULL; + IEEEtypes_VendorSpecific_t *pvendor_ie = NULL; const u8 p2p_oui[4] = { 0x50, 0x6f, 0x9a, 0x09 }; while (left_len >= 2) { @@ -2218,11 +2194,11 @@ woal_get_first_p2p_ie(const t_u8 * ie, int len, t_u8 * ie_out) if ((length + 2) > left_len) break; if (id == VENDOR_SPECIFIC_221) { - pVendorIe = (IEEEtypes_VendorSpecific_t *) pos; + pvendor_ie = (IEEEtypes_VendorSpecific_t *) pos; if (!memcmp - (pVendorIe->vend_hdr.oui, p2p_oui, - sizeof(pVendorIe->vend_hdr.oui)) && - pVendorIe->vend_hdr.oui_type == p2p_oui[3]) { + (pvendor_ie->vend_hdr.oui, p2p_oui, + sizeof(pvendor_ie->vend_hdr.oui)) && + pvendor_ie->vend_hdr.oui_type == p2p_oui[3]) { memcpy(ie_out + out_len, pos, length + 2); out_len += length + 2; break; @@ -2252,7 +2228,7 @@ woal_filter_beacon_ies(const t_u8 * ie, int len, t_u8 * ie_out, t_u16 wps_flag) int length; t_u8 id = 0; t_u16 out_len = 0; - IEEEtypes_VendorSpecific_t *pVendorIe = NULL; + IEEEtypes_VendorSpecific_t *pvendor_ie = NULL; const u8 wps_oui[4] = { 0x00, 0x50, 0xf2, 0x04 }; const u8 p2p_oui[4] = { 0x50, 0x6f, 0x9a, 0x09 }; const u8 wfd_oui[4] = { 0x50, 0x6f, 0x9a, 0x0a }; @@ -2274,24 +2250,24 @@ woal_filter_beacon_ies(const t_u8 * ie, int len, t_u8 * ie_out, t_u16 wps_flag) break; case VENDOR_SPECIFIC_221: /* filter out wmm ie */ - pVendorIe = (IEEEtypes_VendorSpecific_t *) pos; + pvendor_ie = (IEEEtypes_VendorSpecific_t *) pos; if (!memcmp - (pVendorIe->vend_hdr.oui, wmm_oui, - sizeof(pVendorIe->vend_hdr.oui)) && - pVendorIe->vend_hdr.oui_type == wmm_oui[3]) + (pvendor_ie->vend_hdr.oui, wmm_oui, + sizeof(pvendor_ie->vend_hdr.oui)) && + pvendor_ie->vend_hdr.oui_type == wmm_oui[3]) break; /* filter out wps ie */ if ((!memcmp - (pVendorIe->vend_hdr.oui, wps_oui, - sizeof(pVendorIe->vend_hdr.oui)) && - pVendorIe->vend_hdr.oui_type == wps_oui[3]) && + (pvendor_ie->vend_hdr.oui, wps_oui, + sizeof(pvendor_ie->vend_hdr.oui)) && + pvendor_ie->vend_hdr.oui_type == wps_oui[3]) && (wps_flag & IE_MASK_WPS)) break; /* filter out first p2p ie */ if ((!memcmp - (pVendorIe->vend_hdr.oui, p2p_oui, - sizeof(pVendorIe->vend_hdr.oui)) && - pVendorIe->vend_hdr.oui_type == p2p_oui[3])) { + (pvendor_ie->vend_hdr.oui, p2p_oui, + sizeof(pvendor_ie->vend_hdr.oui)) && + pvendor_ie->vend_hdr.oui_type == p2p_oui[3])) { if (!find_p2p_ie && (wps_flag & IE_MASK_P2P)) { find_p2p_ie = MTRUE; break; @@ -2299,9 +2275,9 @@ woal_filter_beacon_ies(const t_u8 * ie, int len, t_u8 * ie_out, t_u16 wps_flag) } /* filter out wfd ie */ if ((!memcmp - (pVendorIe->vend_hdr.oui, wfd_oui, - sizeof(pVendorIe->vend_hdr.oui)) && - pVendorIe->vend_hdr.oui_type == wfd_oui[3]) && + (pvendor_ie->vend_hdr.oui, wfd_oui, + sizeof(pvendor_ie->vend_hdr.oui)) && + pvendor_ie->vend_hdr.oui_type == wfd_oui[3]) && (wps_flag & IE_MASK_WFD)) break; memcpy(ie_out + out_len, pos, length + 2); @@ -2370,7 +2346,7 @@ woal_is_selected_registrar_on(const t_u8 * ie, int len) const t_u8 *pos = ie; int length; t_u8 id = 0; - IEEEtypes_VendorSpecific_t *pVendorIe = NULL; + IEEEtypes_VendorSpecific_t *pvendor_ie = NULL; const u8 wps_oui[4] = { 0x00, 0x50, 0xf2, 0x04 }; while (left_len >= 2) { @@ -2380,11 +2356,11 @@ woal_is_selected_registrar_on(const t_u8 * ie, int len) break; switch (id) { case VENDOR_SPECIFIC_221: - pVendorIe = (IEEEtypes_VendorSpecific_t *) pos; + pvendor_ie = (IEEEtypes_VendorSpecific_t *) pos; if (!memcmp - (pVendorIe->vend_hdr.oui, wps_oui, - sizeof(pVendorIe->vend_hdr.oui)) && - pVendorIe->vend_hdr.oui_type == wps_oui[3]) { + (pvendor_ie->vend_hdr.oui, wps_oui, + sizeof(pvendor_ie->vend_hdr.oui)) && + pvendor_ie->vend_hdr.oui_type == wps_oui[3]) { PRINTM(MIOCTL, "Find WPS ie\n"); return is_selected_registrar_on(pos, length + 2); @@ -2722,14 +2698,10 @@ woal_cfg80211_mgmt_frame_ie(moal_private * priv, PRINTM(MIOCTL, "beacon=%x assocresp=%x proberesp=%x probereq=%x\n", beacon_index, assocresp_index, proberesp_index, probereq_index); done: - if (beacon_ies_data) - kfree(beacon_ies_data); - if (proberesp_ies_data) - kfree(proberesp_ies_data); - if (assocresp_ies_data) - kfree(assocresp_ies_data); - if (probereq_ies_data) - kfree(probereq_ies_data); + kfree(beacon_ies_data); + kfree(proberesp_ies_data); + kfree(assocresp_ies_data); + kfree(probereq_ies_data); LEAVE(); diff --git a/drivers/net/wireless/sd8797/mlinux/moal_debug.c b/drivers/net/wireless/sd8797/mlinux/moal_debug.c index 4dff8de2eb49..aa1e2e642d12 100644 --- a/drivers/net/wireless/sd8797/mlinux/moal_debug.c +++ b/drivers/net/wireless/sd8797/mlinux/moal_debug.c @@ -40,17 +40,17 @@ extern mlan_debug_info info; /** Get info item size */ #define item_size(n) (sizeof(info.n)) /** Get info item address */ -#define item_addr(n) ((t_ptr) & (info.n)) +#define item_addr(n) ((t_ptr) &(info.n)) /** Get moal_private member size */ -#define item_priv_size(n) (sizeof ((moal_private *)0)->n) +#define item_priv_size(n) (sizeof((moal_private *)0)->n) /** Get moal_private member address */ -#define item_priv_addr(n) ((t_ptr) & ((moal_private *)0)->n) +#define item_priv_addr(n) ((t_ptr) &((moal_private *)0)->n) /** Get moal_handle member size */ -#define item_handle_size(n) (sizeof ((moal_handle *)0)->n) +#define item_handle_size(n) (sizeof((moal_handle *)0)->n) /** Get moal_handle member address */ -#define item_handle_addr(n) ((t_ptr) & ((moal_handle *)0)->n) +#define item_handle_addr(n) ((t_ptr) &((moal_handle *)0)->n) #ifdef STA_SUPPORT static struct debug_data items[] = { @@ -91,6 +91,8 @@ static struct debug_data items[] = { , {"hs_activated", item_size(hs_activated), item_addr(hs_activated)} , + {"rx_pkts_queued", item_size(rx_pkts_queued), item_addr(rx_pkts_queued)} + , {"tx_pkts_queued", item_size(tx_pkts_queued), item_addr(tx_pkts_queued)} , {"pps_uapsd_mode", item_size(pps_uapsd_mode), item_addr(pps_uapsd_mode)} @@ -286,6 +288,8 @@ static struct debug_data uap_items[] = { , {"hs_activated", item_size(hs_activated), item_addr(hs_activated)} , + {"rx_pkts_queued", item_size(rx_pkts_queued), item_addr(rx_pkts_queued)} + , {"tx_pkts_queued", item_size(tx_pkts_queued), item_addr(tx_pkts_queued)} , {"bypass_pkt_count", item_size(bypass_pkt_count), @@ -554,6 +558,30 @@ woal_debug_read(struct seq_file *sfp, void *data) seq_printf(sfp, "\n"); } } + if (info.tdls_peer_list) { + for (i = 0; i < info.tdls_peer_num; i++) { + unsigned int j; + seq_printf(sfp, + "tdls peer: %02x:%02x:%02x:%02x:%02x:%02x snr=%d nf=%d\n", + info.tdls_peer_list[i].mac_addr[0], + info.tdls_peer_list[i].mac_addr[1], + info.tdls_peer_list[i].mac_addr[2], + info.tdls_peer_list[i].mac_addr[3], + info.tdls_peer_list[i].mac_addr[4], + info.tdls_peer_list[i].mac_addr[5], + info.tdls_peer_list[i].snr, + -info.tdls_peer_list[i].nf); + seq_printf(sfp, "htcap: "); + for (j = 0; j < sizeof(IEEEtypes_HTCap_t); j++) + seq_printf(sfp, "%02x ", + info.tdls_peer_list[i].ht_cap[j]); + seq_printf(sfp, "\nExtcap: "); + for (j = 0; j < sizeof(IEEEtypes_ExtCap_t); j++) + seq_printf(sfp, "%02x ", + info.tdls_peer_list[i].ext_cap[j]); + seq_printf(sfp, "\n"); + } + } exit: MODULE_PUT; LEAVE(); @@ -648,16 +676,17 @@ woal_debug_write(struct file *f, const char __user * buf, size_t count, #ifdef DEBUG_LEVEL1 if (last_drvdbg != drvdbg) { woal_set_drvdbg(priv, drvdbg); + } #endif - +#if 0 /* Set debug information */ if (woal_set_debug_info(priv, MOAL_PROC_WAIT, &info)) { MODULE_PUT; LEAVE(); return 0; } - +#endif MODULE_PUT; LEAVE(); return count; @@ -780,8 +809,7 @@ woal_debug_remove(moal_private * priv) { ENTER(); - if (priv->items_priv.items) - kfree(priv->items_priv.items); + kfree(priv->items_priv.items); /* Remove proc entry */ remove_proc_entry("debug", priv->proc_entry); diff --git a/drivers/net/wireless/sd8797/mlinux/moal_eth_ioctl.c b/drivers/net/wireless/sd8797/mlinux/moal_eth_ioctl.c index 7bc5a4993e6e..9b571c7f51d6 100644 --- a/drivers/net/wireless/sd8797/mlinux/moal_eth_ioctl.c +++ b/drivers/net/wireless/sd8797/mlinux/moal_eth_ioctl.c @@ -345,8 +345,7 @@ woal_priv_hostcmd(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) memcpy(data_ptr, (t_u8 *) & ret, sizeof(t_u32)); error: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -404,9 +403,7 @@ woal_priv_customie(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = EFAULT; } done: - if (ioctl_req) { - kfree(ioctl_req); - } + kfree(ioctl_req); LEAVE(); return ret; } @@ -549,8 +546,7 @@ woal_setget_priv_bandcfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(mlan_ds_band_cfg); error: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -648,8 +644,7 @@ woal_setget_priv_httxcfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(data); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -751,8 +746,7 @@ woal_setget_priv_htcapinfo(moal_private * priv, t_u8 * respbuf, ret = sizeof(woal_ht_cap_info); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -858,8 +852,7 @@ woal_setget_priv_addbapara(moal_private * priv, t_u8 * respbuf, ret = sizeof(woal_addba); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -956,8 +949,7 @@ woal_priv_delba(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sprintf(respbuf, "OK. BA deleted successfully.\n") + 1; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1034,7 +1026,147 @@ woal_priv_rejectaddbareq(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) + kfree(req); + LEAVE(); + return ret; + +} + +/** + * @brief Set/Get the addba reject setting + * + * @param priv A pointer to moal_private structure + * @param action Action set or get + * @param addba_reject A pointer to addba_reject array. + * + * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, otherwise fail + */ +mlan_status +woal_ioctl_addba_reject(moal_private * priv, t_u32 action, t_u8 * addba_reject) +{ + mlan_ioctl_req *req = NULL; + mlan_ds_11n_cfg *cfg_11n = NULL; + mlan_status ret = MLAN_STATUS_SUCCESS; + + ENTER(); + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11n_cfg)); + if (req == NULL) { + ret = -ENOMEM; + goto done; + } + + cfg_11n = (mlan_ds_11n_cfg *) req->pbuf; + cfg_11n->sub_command = MLAN_OID_11N_CFG_ADDBA_REJECT; + req->req_id = MLAN_IOCTL_11N_CFG; + + req->action = action; + if (action == MLAN_ACT_SET) + memcpy(cfg_11n->param.addba_reject, addba_reject, + sizeof(cfg_11n->param.addba_reject)); + /* Send IOCTL request to MLAN */ + ret = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (ret != MLAN_STATUS_SUCCESS) + goto done; + if (action == MLAN_ACT_GET) + memcpy(addba_reject, cfg_11n->param.addba_reject, + sizeof(cfg_11n->param.addba_reject)); +done: + if (ret != MLAN_STATUS_PENDING) + kfree(req); + LEAVE(); + return ret; +} + +/** + * @brief Set/Get addba prio_tbl + * + * @param priv A pointer to moal_private structure + * @param action Action set or get + * @param aggr_prio_tbl A pointer to mlan_ds_11n_aggr_prio_tbl. + * + * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, otherwise fail + */ +mlan_status +woal_ioctl_aggr_prio_tbl(moal_private * priv, t_u32 action, + mlan_ds_11n_aggr_prio_tbl * aggr_prio_tbl) +{ + mlan_ioctl_req *req = NULL; + mlan_ds_11n_cfg *cfg_11n = NULL; + mlan_status ret = MLAN_STATUS_SUCCESS; + + ENTER(); + + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11n_cfg)); + if (req == NULL) { + ret = -ENOMEM; + goto done; + } + + cfg_11n = (mlan_ds_11n_cfg *) req->pbuf; + cfg_11n->sub_command = MLAN_OID_11N_CFG_AGGR_PRIO_TBL; + req->req_id = MLAN_IOCTL_11N_CFG; + + req->action = action; + if (action == MLAN_ACT_SET) + memcpy(&cfg_11n->param.aggr_prio_tbl, aggr_prio_tbl, + sizeof(mlan_ds_11n_aggr_prio_tbl)); + /* Send IOCTL request to MLAN */ + ret = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (ret != MLAN_STATUS_SUCCESS) + goto done; + if (action == MLAN_ACT_GET) + memcpy(aggr_prio_tbl, &cfg_11n->param.aggr_prio_tbl, + sizeof(mlan_ds_11n_aggr_prio_tbl)); +done: + if (ret != MLAN_STATUS_PENDING) + kfree(req); + LEAVE(); + return ret; + +} + +/** + * @brief Set/Get addba_param + * + * @param priv A pointer to moal_private structure + * @param action Action set or get + * @param addba_param A pointer to mlan_ds_11n_addba_param. + * + * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, otherwise fail + */ +mlan_status +woal_ioctl_addba_param(moal_private * priv, t_u32 action, + mlan_ds_11n_addba_param * addba_param) +{ + mlan_ioctl_req *req = NULL; + mlan_ds_11n_cfg *cfg_11n = NULL; + mlan_status ret = MLAN_STATUS_SUCCESS; + + ENTER(); + + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11n_cfg)); + if (req == NULL) { + ret = -ENOMEM; + goto done; + } + + cfg_11n = (mlan_ds_11n_cfg *) req->pbuf; + cfg_11n->sub_command = MLAN_OID_11N_CFG_ADDBA_PARAM; + req->req_id = MLAN_IOCTL_11N_CFG; + + req->action = action; + if (action == MLAN_ACT_SET) + memcpy(&cfg_11n->param.addba_param, addba_param, + sizeof(mlan_ds_11n_addba_param)); + /* Send IOCTL request to MLAN */ + ret = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (ret != MLAN_STATUS_SUCCESS) + goto done; + if (action == MLAN_ACT_GET) + memcpy(addba_param, &cfg_11n->param.addba_param, + sizeof(mlan_ds_11n_addba_param)); +done: + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -1042,6 +1174,173 @@ done: } /** + * @brief Configuring rx block-ack window size + * + * @param priv A pointer to moal_private structure + * @param respbuf A pointer to response buffer + * @param respbuflen Available length of response buffer + * + * @return 0 --success, otherwise failure + */ +int +woal_set_rx_ba_winsize(moal_private * priv, t_u8 * respbuf, int respbuflen) +{ + t_u32 data[2]; + t_u8 addba_reject[MAX_NUM_TID]; + mlan_ds_11n_addba_param addba_param; + int ret = 0; + int user_data_len = 0; + + ENTER(); + + memset((char *)data, 0, sizeof(data)); + parse_arguments(respbuf, data, ARRAY_SIZE(data), &user_data_len); + + if (user_data_len != 2) { + PRINTM(MERROR, "Invalid arguments for ba_winsize command\n"); + ret = -EINVAL; + goto done; + } + if (data[0] > 7 || data[0] < 0) { + PRINTM(MERROR, "Invalid tid %d\n", data[0]); + ret = -EINVAL; + goto done; + } + if (data[1] < 0) { + PRINTM(MERROR, "Invalid winsize %d\n", data[1]); + ret = -EINVAL; + goto done; + } + memset(addba_reject, 0, sizeof(addba_reject)); + if (MLAN_STATUS_SUCCESS != + woal_ioctl_addba_reject(priv, MLAN_ACT_GET, addba_reject)) { + ret = -EFAULT; + goto done; + } + /* disable tx ba */ + if (data[1] == 0) { + addba_reject[data[0]] = MTRUE; + if (MLAN_STATUS_SUCCESS != + woal_ioctl_addba_reject(priv, MLAN_ACT_SET, addba_reject)) + ret = -EFAULT; + } else { + if (addba_reject[data[0]] == MTRUE) { + addba_reject[data[0]] = MFALSE; + if (MLAN_STATUS_SUCCESS != + woal_ioctl_addba_reject(priv, MLAN_ACT_SET, + addba_reject)) { + ret = -EFAULT; + goto done; + } + } + memset(&addba_param, 0, sizeof(addba_param)); + if (MLAN_STATUS_SUCCESS != + woal_ioctl_addba_param(priv, MLAN_ACT_GET, &addba_param)) { + ret = -EFAULT; + goto done; + } + if (data[1] != addba_param.rxwinsize) { + addba_param.rxwinsize = data[1]; + if (MLAN_STATUS_SUCCESS != + woal_ioctl_addba_param(priv, MLAN_ACT_SET, + &addba_param)) + ret = -EFAULT; + } + + } +done: + LEAVE(); + return ret; + +} + +/** + * @brief Configuring trx block-ack window size + * + * @param priv A pointer to moal_private structure + * @param respbuf A pointer to response buffer + * @param respbuflen Available length of response buffer + * + * @return 0 --success, otherwise failure + */ +int +woal_set_tx_ba_winsize(moal_private * priv, t_u8 * respbuf, int respbuflen) +{ + t_u32 data[2]; + mlan_ds_11n_aggr_prio_tbl aggr_prio_tbl; + mlan_ds_11n_addba_param addba_param; + t_u8 tos_to_tid_inv[] = + { 0x02, 0x00, 0x01, 0x03, 0x04, 0x05, 0x06, 0x07 }; + int ret = 0; + int user_data_len = 0; + + ENTER(); + + memset((char *)data, 0, sizeof(data)); + parse_arguments(respbuf, data, ARRAY_SIZE(data), &user_data_len); + + if (user_data_len != 2) { + PRINTM(MERROR, "Invalid arguments for ba_winsize command\n"); + ret = -EINVAL; + goto done; + } + if (data[0] > 7 || data[0] < 0) { + PRINTM(MERROR, "Invalid tid %d\n", data[0]); + ret = -EINVAL; + goto done; + } + if (data[1] < 0) { + PRINTM(MERROR, "Invalid winsize %d\n", data[1]); + ret = -EINVAL; + goto done; + } + memset(&aggr_prio_tbl, 0, sizeof(aggr_prio_tbl)); + if (MLAN_STATUS_SUCCESS != + woal_ioctl_aggr_prio_tbl(priv, MLAN_ACT_GET, &aggr_prio_tbl)) { + ret = -EFAULT; + goto done; + } + /* disable tx ba */ + if (data[1] == 0) { + if (aggr_prio_tbl.ampdu[data[0]] != 0xff) { + aggr_prio_tbl.ampdu[data[0]] = 0xff; + if (MLAN_STATUS_SUCCESS != + woal_ioctl_aggr_prio_tbl(priv, MLAN_ACT_SET, + &aggr_prio_tbl)) + ret = -EFAULT; + } + } else { + if (aggr_prio_tbl.ampdu[data[0]] == 0xff) { + aggr_prio_tbl.ampdu[data[0]] = tos_to_tid_inv[data[0]]; + if (MLAN_STATUS_SUCCESS != + woal_ioctl_aggr_prio_tbl(priv, MLAN_ACT_SET, + &aggr_prio_tbl)) { + ret = -EFAULT; + goto done; + } + } + memset(&addba_param, 0, sizeof(addba_param)); + if (MLAN_STATUS_SUCCESS != + woal_ioctl_addba_param(priv, MLAN_ACT_GET, &addba_param)) { + ret = -EFAULT; + goto done; + } + if (data[1] != addba_param.txwinsize) { + addba_param.txwinsize = data[1]; + if (MLAN_STATUS_SUCCESS != + woal_ioctl_addba_param(priv, MLAN_ACT_SET, + &addba_param)) + ret = -EFAULT; + } + + } +done: + LEAVE(); + return ret; + +} + +/** * @brief Set/Get aggregation priority table configurations * * @param priv A pointer to moal_private structure @@ -1123,8 +1422,7 @@ woal_setget_priv_aggrpriotbl(moal_private * priv, t_u8 * respbuf, ret = sizeof(data); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -1209,8 +1507,7 @@ woal_setget_priv_addbareject(moal_private * priv, t_u8 * respbuf, ret = sizeof(data); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -1259,8 +1556,7 @@ woal_get_priv_datarate(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(mlan_data_rate); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -1393,8 +1689,7 @@ woal_setget_priv_txratecfg(moal_private * priv, t_u8 * respbuf, ret = sizeof(woal_tx_rate_cfg); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -1446,7 +1741,7 @@ woal_get_stats_info(moal_private * priv, t_u8 wait_option, #endif } done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -1570,8 +1865,7 @@ woal_setget_priv_esuppmode(moal_private * priv, t_u8 * respbuf, ret = sizeof(woal_esuppmode_cfg); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -1733,8 +2027,7 @@ woal_setget_priv_passphrase(moal_private * priv, t_u8 * respbuf, ret = len; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -1828,8 +2121,7 @@ woal_priv_ap_deauth(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) memcpy(data_ptr, &ioctl_req->status_code, sizeof(t_u32)); ret = sizeof(t_u32); done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -1877,8 +2169,7 @@ woal_priv_get_sta_list(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) memcpy(sta_list, &info->param.sta_list, sizeof(mlan_ds_sta_list)); ret = sizeof(mlan_ds_sta_list); done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -1938,8 +2229,7 @@ woal_priv_bss_config(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } ret = sizeof(mlan_uap_bss_param); done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -2202,7 +2492,7 @@ woal_priv_getscantable(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) scan_start); } done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -2255,7 +2545,7 @@ woal_priv_extcapcfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) goto done; } req->action = MLAN_ACT_SET; - memset(&cfg->param.ext_cap, 0, sizeof(ExtCap_t) - ie->len); + memset(&cfg->param.ext_cap, 0, sizeof(ExtCap_t)); memcpy(&cfg->param.ext_cap, ie + 1, ie->len); } @@ -2271,11 +2561,10 @@ woal_priv_extcapcfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ie->len = sizeof(ExtCap_t); memcpy(ie + 1, &cfg->param.ext_cap, sizeof(ExtCap_t)); - ret = sizeof(ie) + ie->len; + ret = sizeof(IEEEtypes_Header_t) + ie->len; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2444,8 +2733,7 @@ woal_priv_setgetipaddr(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2512,8 +2800,7 @@ woal_priv_setwpssession(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sprintf(respbuf, "OK\n") + 1; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2575,8 +2862,7 @@ woal_priv_otpuserdata(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2648,8 +2934,7 @@ woal_priv_set_get_countrycode(moal_private * priv, t_u8 * respbuf, } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -2850,15 +3135,13 @@ woal_priv_getwakeupreason(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) if (MLAN_STATUS_SUCCESS != woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT)) { ret = -EFAULT; - if (req) - kfree(req); + kfree(req); goto done; } else { data = pm_cfg->param.wakeup_reason.hs_wakeup_reason; sprintf(respbuf, " %d", data); ret = strlen(respbuf) + 1; - if (req) - kfree(req); + kfree(req); } } else { PRINTM(MERROR, "Not need argument, invalid operation!\n"); @@ -2945,8 +3228,7 @@ woal_priv_set_get_listeninterval(moal_private * priv, t_u8 * respbuf, } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -3308,8 +3590,7 @@ woal_priv_set_get_scancfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(mlan_scan_cfg); } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -3475,8 +3756,7 @@ woal_priv_set_bss_mode(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) goto done; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -4127,8 +4407,7 @@ woal_priv_txpowercfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(pcfg->param.power_ext); } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -4294,10 +4573,8 @@ woal_priv_pscfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) - kfree(req); - if (arguments) - kfree(arguments); + kfree(req); + kfree(arguments); LEAVE(); return ret; } @@ -4374,8 +4651,7 @@ woal_priv_sleeppd(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -4445,8 +4721,7 @@ woal_priv_txcontrol(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -4535,10 +4810,8 @@ woal_priv_regrdwr(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) - kfree(req); - if (arguments) - kfree(arguments); + kfree(req); + kfree(arguments); LEAVE(); return ret; } @@ -4603,8 +4876,7 @@ woal_priv_rdeeprom(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -4698,10 +4970,8 @@ woal_priv_memrdwr(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) - kfree(req); - if (arguments) - kfree(arguments); + kfree(req); + kfree(arguments); LEAVE(); return ret; } @@ -4845,8 +5115,7 @@ woal_priv_arpfilter(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) goto done; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -4914,8 +5183,7 @@ woal_priv_mgmt_frame_passthru_ctrl(moal_private * priv, t_u8 * respbuf, ret = sizeof(data); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -5010,8 +5278,7 @@ woal_priv_wmm_addts_req_ioctl(moal_private * priv, t_u8 * respbuf, ret = copy_len; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5090,8 +5357,7 @@ woal_priv_wmm_delts_req_ioctl(moal_private * priv, t_u8 * respbuf, } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5152,8 +5418,7 @@ woal_priv_qconfig(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = strlen(CMD_MARVELL) + strlen(PRIV_CMD_QCONFIG) + sizeof(qcfg_ioctl); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5213,8 +5478,7 @@ woal_priv_wmm_queue_status_ioctl(moal_private * priv, t_u8 * respbuf, } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5272,8 +5536,7 @@ woal_priv_wmm_ts_status_ioctl(moal_private * priv, t_u8 * respbuf, ret = sizeof(ts_status_ioctl); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5339,8 +5602,7 @@ woal_priv_macctrl(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(data); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5454,8 +5716,7 @@ woal_priv_region_code(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(data); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5516,8 +5777,7 @@ woal_priv_fwmacaddr(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) HEXDUMP("FW MAC Addr:", respbuf, ETH_ALEN); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5730,8 +5990,7 @@ woal_priv_get_driver_verext(moal_private * priv, t_u8 * respbuf, info->param.ver_ext.version_str); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5803,8 +6062,7 @@ woal_priv_wmm_cfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(wmm->param.wmm_enable); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5877,8 +6135,7 @@ woal_priv_11d_cfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(pcfg_11d->param.enable_11d); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5928,8 +6185,7 @@ woal_priv_11d_clr_chan_tbl(moal_private * priv, t_u8 * respbuf, } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5999,8 +6255,7 @@ woal_priv_wws_cfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(wws->param.wws_cfg); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -6116,8 +6371,7 @@ woal_priv_txbuf_cfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(buf_size); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -6250,8 +6504,7 @@ woal_priv_11h_local_pwr_constraint(moal_private * priv, t_u8 * respbuf, } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -6321,8 +6574,7 @@ woal_priv_ht_stream_cfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(data); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -6375,8 +6627,7 @@ woal_priv_thermal(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(data); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -6446,8 +6697,7 @@ woal_priv_beacon_interval(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(data); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -6712,8 +6962,7 @@ woal_priv_set_get_pmfcfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(mlan_ds_misc_pmfcfg); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -6798,8 +7047,7 @@ woal_priv_inactivity_timeout_ext(moal_private * priv, t_u8 * respbuf, } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -6860,8 +7108,7 @@ woal_priv_atim_window(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(int); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -6927,8 +7174,7 @@ woal_priv_11n_amsdu_aggr_ctrl(moal_private * priv, t_u8 * respbuf, ret = sizeof(data); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -6993,8 +7239,7 @@ woal_priv_tx_bf_cap_ioctl(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(bf_cap); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -7162,8 +7407,7 @@ woal_priv_sdio_mpa_ctrl(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -7273,8 +7517,7 @@ woal_priv_sleep_params_ioctl(moal_private * priv, t_u8 * respbuf, ret = sizeof(data); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -7372,8 +7615,7 @@ woal_priv_dfs_testing(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -7450,8 +7692,7 @@ woal_priv_cfp_code(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -7521,8 +7762,7 @@ woal_priv_set_get_tx_rx_ant(moal_private * priv, t_u8 * respbuf, memcpy(respbuf, (t_u8 *) data, sizeof(data)); } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -7644,8 +7884,7 @@ woal_priv_sysclock(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -7790,8 +8029,7 @@ woal_priv_adhoc_aes(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = copy_len; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -8340,8 +8578,7 @@ woal_priv_cmd53rdwr(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (data) - kfree(data); + kfree(data); LEAVE(); return ret; } @@ -8407,8 +8644,7 @@ woal_priv_port_ctrl(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -8463,98 +8699,6 @@ woal_priv_bypassed_packet(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } #if defined(WIFI_DIRECT_SUPPORT) -#if defined(UAP_CFG80211) -#if LINUX_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION -/** - * @brief Set/Get P2P NoA (Notice of Absence) parameters - * @param priv Pointer to moal_private structure - * @param respbuf Pointer to response buffer - * @param resplen Response buffer length - * - * @return Number of bytes written, negative for failure. - */ -static int -woal_priv_noa_cfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) -{ - int header_len = 0, user_data_len = 0; - int ret = 0, data[7]; - mlan_ds_wifi_direct_config noa_cfg; - - ENTER(); - - header_len = strlen(CMD_MARVELL) + strlen(PRIV_CMD_NOA_CFG); - memset(&noa_cfg, 0, sizeof(noa_cfg)); - if (woal_p2p_config(priv, MLAN_ACT_GET, &noa_cfg) != - MLAN_STATUS_SUCCESS) { - PRINTM(MERROR, "Could not get P2P noa config\n"); - ret = -EINVAL; - goto done; - } - - memset(data, 0, sizeof(data)); - if (strlen(respbuf) == header_len) { - /* GET operation */ - memcpy(respbuf, &noa_cfg, sizeof(noa_cfg)); - ret = sizeof(noa_cfg); - } else { - /* SET operation */ - parse_arguments(respbuf + header_len, data, ARRAY_SIZE(data), - &user_data_len); - if (user_data_len > 7) { - ret = -EINVAL; - goto done; - } - switch (user_data_len) { - case 7: - noa_cfg.ct_window = (t_u8) data[6]; - case 6: - if (data[5] < 0 || data[5] > 1) { - PRINTM(MERROR, "Invalid ps enable\n"); - ret = -EINVAL; - goto done; - } - noa_cfg.opp_ps_enable = (t_u8) data[5]; - noa_cfg.flags |= WIFI_DIRECT_OPP_PS; - case 5: - noa_cfg.noa_interval = (t_u32) data[4]; - case 4: - noa_cfg.noa_duration = (t_u32) data[3]; - case 3: - if (data[2] < 1 || data[2] > 255) { - PRINTM(MERROR, - "Invalid number of absence intervals\n"); - ret = -EINVAL; - goto done; - } - noa_cfg.noa_count = (t_u8) data[2]; - case 2: - if (data[1] < 0 || data[1] > 255) { - PRINTM(MERROR, "Invalid Index\n"); - ret = -EINVAL; - goto done; - } - noa_cfg.index = (t_u16) data[1]; - case 1: - if (data[0] < 0 || data[0] > 1) { - PRINTM(MERROR, "Invalid noa enable\n"); - ret = -EINVAL; - goto done; - } - noa_cfg.noa_enable = (t_u8) data[0]; - noa_cfg.flags |= WIFI_DIRECT_NOA; - break; - default: - break; - } - woal_p2p_config(priv, MLAN_ACT_SET, &noa_cfg); - } -done: - - LEAVE(); - return ret; -} -#endif -#endif #endif /** @@ -9347,16 +9491,6 @@ woal_android_priv_cmd(struct net_device *dev, struct ifreq *req) priv_cmd.total_len); goto handled; #if defined(WIFI_DIRECT_SUPPORT) -#if defined(UAP_CFG80211) -#if LINUX_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION - } else if (strnicmp - (buf + strlen(CMD_MARVELL), PRIV_CMD_NOA_CFG, - strlen(PRIV_CMD_NOA_CFG)) == 0) { - /* Set/Get P2P NoA (Notice of Absence) parameters */ - len = woal_priv_noa_cfg(priv, buf, priv_cmd.total_len); - goto handled; -#endif -#endif #endif } else { /* Fall through, after stripping off the custom header */ @@ -9469,6 +9603,18 @@ woal_android_priv_cmd(struct net_device *dev, struct ifreq *req) } #endif len = sprintf(buf, "OK\n") + 1; + } else if (strncmp(buf, "ROAM", strlen("ROAM")) == 0) { + pdata = buf + strlen("ROAM") + 1; +#ifdef STA_CFG80211 + if (*pdata == '1') { + priv->roaming_enabled = MTRUE; + PRINTM(MIOCTL, "Roaming enabled\n"); + } else if (*pdata == '0') { + priv->roaming_enabled = MFALSE; + PRINTM(MIOCTL, "Roaming disabled\n"); + } +#endif + len = sprintf(buf, "OK\n") + 1; } else if (strncmp(buf, "COUNTRY", strlen("COUNTRY")) == 0) { if ((strlen(buf) - strlen("COUNTRY") - 1) > COUNTRY_CODE_LEN || (strlen(buf) - strlen("COUNTRY") - 1) <= 0) { @@ -9480,6 +9626,11 @@ woal_android_priv_cmd(struct net_device *dev, struct ifreq *req) memcpy(country_code, buf + strlen("COUNTRY") + 1, strlen(buf) - strlen("COUNTRY") - 1); PRINTM(MIOCTL, "Set COUNTRY %s\n", country_code); + if (MLAN_STATUS_SUCCESS != + woal_request_country_power_table(priv, country_code)) { + ret = -EFAULT; + goto done; + } #ifdef STA_CFG80211 if (IS_STA_CFG80211(cfg80211_wext)) { PRINTM(MIOCTL, "Notify country code=%s\n", @@ -9526,13 +9677,13 @@ woal_android_priv_cmd(struct net_device *dev, struct ifreq *req) } #ifdef UAP_SUPPORT else if (strncmp(buf, "AP_BSS_START", strlen("AP_BSS_START")) == 0) { - if ((ret == - woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT, UAP_BSS_START))) + ret = woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT, UAP_BSS_START); + if (ret) goto done; len = sprintf(buf, "OK\n") + 1; } else if (strncmp(buf, "AP_BSS_STOP", strlen("AP_BSS_STOP")) == 0) { - if ((ret == - woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT, UAP_BSS_STOP))) + ret = woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT, UAP_BSS_STOP); + if (ret) goto done; len = sprintf(buf, "OK\n") + 1; } else if (strncmp(buf, "AP_SET_CFG", strlen("AP_SET_CFG")) == 0) { @@ -9692,6 +9843,38 @@ woal_android_priv_cmd(struct net_device *dev, struct ifreq *req) goto done; } len = sprintf(buf, "OK\n") + 1; + } else if (strnicmp(buf, "BA_WSIZE_RX", strlen("BA_WSIZE_RX")) == 0) { + pdata = buf + strlen("BA_WSIZE_RX") + 1; + len = priv_cmd.total_len - strlen("BA_WSIZE_RX") - 1; + if (MLAN_STATUS_SUCCESS != + woal_set_rx_ba_winsize(priv, pdata, len)) { + ret = -EFAULT; + goto done; + } + len = sprintf(buf, "OK\n") + 1; + } else if (strnicmp(buf, "BA_WSIZE_TX", strlen("BA_WSIZE_TX")) == 0) { + pdata = buf + strlen("BA_WSIZE_TX") + 1; + len = priv_cmd.total_len - strlen("BA_WSIZE_TX") - 1; + if (MLAN_STATUS_SUCCESS != + woal_set_tx_ba_winsize(priv, pdata, len)) { + ret = -EFAULT; + goto done; + } + len = sprintf(buf, "OK\n") + 1; + } else if (strncmp + (buf, "FAKE_SCAN_COMPLETE", + strlen("FAKE_SCAN_COMPLETE")) == 0) { + pdata = buf + strlen("FAKE_SCAN_COMPLETE") + 1; +#ifdef STA_CFG80211 + if (*pdata == '1') { + priv->fake_scan_complete = MTRUE; + PRINTM(MIOCTL, "fake scan complete enabled\n"); + } else if (*pdata == '0') { + priv->fake_scan_complete = MFALSE; + PRINTM(MIOCTL, "fake scan complete disabled\n"); + } +#endif + len = sprintf(buf, "OK\n") + 1; } else { PRINTM(MIOCTL, "Unknown PRIVATE command: %s, ignored\n", buf); ret = -EFAULT; @@ -9733,8 +9916,7 @@ handled: } done: - if (buf) - kfree(buf); + kfree(buf); LEAVE(); return ret; } @@ -9968,6 +10150,9 @@ woal_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) case WOAL_MGMT_FRAME_TX: ret = woal_send_host_packet(dev, req); break; + case WOAL_TDLS_CONFIG: + ret = woal_tdls_config_ioctl(dev, req); + break; case WOAL_ANDROID_PRIV_CMD: ret = woal_android_priv_cmd(dev, req); break; diff --git a/drivers/net/wireless/sd8797/mlinux/moal_eth_ioctl.h b/drivers/net/wireless/sd8797/mlinux/moal_eth_ioctl.h index c89e0f6d368f..a1d12ef2a246 100644 --- a/drivers/net/wireless/sd8797/mlinux/moal_eth_ioctl.h +++ b/drivers/net/wireless/sd8797/mlinux/moal_eth_ioctl.h @@ -186,16 +186,14 @@ Change log: #define PRIV_CMD_PB_BYPASS "pb_bypass" #define PRIV_CMD_SD_CMD53_RW "sdcmd53rw" #if defined(WIFI_DIRECT_SUPPORT) -#if defined(UAP_CFG80211) -#if LINUX_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION -#define PRIV_CMD_NOA_CFG "noacfg" -#endif -#endif #endif /** Private command ID for Android default commands */ #define WOAL_ANDROID_DEF_CMD (SIOCDEVPRIVATE + 1) +/** Private command ID to send TLD configuration */ +#define WOAL_TDLS_CONFIG (SIOCDEVPRIVATE + 5) + /** Private command ID to pass mgmt frame */ #define WOAL_MGMT_FRAME_TX WOAL_MGMT_FRAME_TX_IOCTL diff --git a/drivers/net/wireless/sd8797/mlinux/moal_ioctl.c b/drivers/net/wireless/sd8797/mlinux/moal_ioctl.c index 9e688f503922..11b43c10b2b3 100644 --- a/drivers/net/wireless/sd8797/mlinux/moal_ioctl.c +++ b/drivers/net/wireless/sd8797/mlinux/moal_ioctl.c @@ -233,7 +233,6 @@ woal_copy_mcast_addr(mlan_multicast_list * mlist, struct net_device *dev) * @param handle A pointer to moal_handle * @param mlist A pointer to multicast list * - * * @return total_mc_count */ static int @@ -385,9 +384,8 @@ woal_cac_period_block_cmd(moal_private * priv, pmlan_ioctl_req req) t_u32 sub_command; ENTER(); - if (req == NULL || req->pbuf == NULL) { + if (req == NULL || req->pbuf == NULL) goto done; - } sub_command = *(t_u32 *) req->pbuf; @@ -395,9 +393,8 @@ woal_cac_period_block_cmd(moal_private * priv, pmlan_ioctl_req req) case MLAN_IOCTL_SCAN: if (sub_command == MLAN_OID_SCAN_NORMAL || sub_command == MLAN_OID_SCAN_SPECIFIC_SSID || - sub_command == MLAN_OID_SCAN_USER_CONFIG) { + sub_command == MLAN_OID_SCAN_USER_CONFIG) ret = MTRUE; - } break; case MLAN_IOCTL_BSS: if (sub_command == MLAN_OID_BSS_STOP || @@ -405,37 +402,31 @@ woal_cac_period_block_cmd(moal_private * priv, pmlan_ioctl_req req) sub_command == MLAN_OID_UAP_BSS_CONFIG || #endif sub_command == MLAN_OID_BSS_CHANNEL - /* sub_command == MLAN_OID_BSS_ROLE */ ) { + /* sub_command == MLAN_OID_BSS_ROLE */ ) ret = MTRUE; - } break; case MLAN_IOCTL_RADIO_CFG: - if (sub_command == MLAN_OID_BAND_CFG) { + if (sub_command == MLAN_OID_BAND_CFG) ret = MTRUE; - } break; #if defined(UAP_SUPPORT) case MLAN_IOCTL_SNMP_MIB: if (sub_command == MLAN_OID_SNMP_MIB_DOT11D || - sub_command == MLAN_OID_SNMP_MIB_DOT11H) { + sub_command == MLAN_OID_SNMP_MIB_DOT11H) ret = MTRUE; - } break; #endif case MLAN_IOCTL_11D_CFG: #ifdef STA_SUPPORT - if (sub_command == MLAN_OID_11D_CFG_ENABLE) { + if (sub_command == MLAN_OID_11D_CFG_ENABLE) ret = MTRUE; - } #endif - if (sub_command == MLAN_OID_11D_DOMAIN_INFO) { + if (sub_command == MLAN_OID_11D_DOMAIN_INFO) ret = MTRUE; - } break; case MLAN_IOCTL_MISC_CFG: - if (sub_command == MLAN_OID_MISC_REGION) { + if (sub_command == MLAN_OID_MISC_REGION) ret = MTRUE; - } if (sub_command == MLAN_OID_MISC_HOST_CMD) { phostcmd_header phostcmd; t_u8 *ptlv_buf; @@ -464,9 +455,8 @@ woal_cac_period_block_cmd(moal_private * priv, pmlan_ioctl_req req) break; case MLAN_IOCTL_11H_CFG: /* Prevent execute more than once */ - if (sub_command == MLAN_OID_11H_CHANNEL_CHECK) { + if (sub_command == MLAN_OID_11H_CHANNEL_CHECK) ret = MTRUE; - } break; default: ret = MFALSE; @@ -489,7 +479,8 @@ done: * @param req A pointer to mlan_ioctl_req buffer * @param wait_option Wait option (MOAL_WAIT or MOAL_NO_WAIT) * - * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, otherwise fail + * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING + * -- success, otherwise fail */ mlan_status woal_request_ioctl(moal_private * priv, mlan_ioctl_req * req, t_u8 wait_option) @@ -559,8 +550,7 @@ woal_request_ioctl(moal_private * priv, mlan_ioctl_req * req, t_u8 wait_option) */ if (priv->phandle->delay_bss_start == MFALSE) { PRINTM(MMSG, - "Received BSS Start command during CAC period, " - "delay executing %ld seconds\n", + "Received BSS Start command during CAC period, delay executing %ld seconds\n", cac_left_jiffies / HZ); priv->phandle->delay_bss_start = MTRUE; memcpy(&priv->phandle->delay_ssid_bssid, @@ -574,16 +564,16 @@ woal_request_ioctl(moal_private * priv, mlan_ioctl_req * req, t_u8 wait_option) } else { /* TODO: not blocking it, just return failure */ PRINTM(MMSG, - "Only one BSS Start command allowed for delay " - "executing!\n"); + "Only one BSS Start command allowed for delay executing!\n"); status = MLAN_STATUS_FAILURE; goto done; } } if (woal_cac_period_block_cmd(priv, req)) { priv->phandle->meas_wait_q_woken = MFALSE; - PRINTM(MMSG, "CAC check is on going... Blocking Command" - " %ld seconds\n", cac_left_jiffies / HZ); + PRINTM(MMSG, + "CAC check is on going... Blocking Command %ld seconds\n", + cac_left_jiffies / HZ); /* blocking timeout set to 1.5 * CAC checking period left time */ wait_event_interruptible_timeout(priv->phandle-> @@ -647,7 +637,8 @@ done: * * @param priv A pointer to moal_private structure * - * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, otherwise fail + * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING + * -- success, otherwise fail */ mlan_status woal_request_set_mac_address(moal_private * priv) @@ -683,8 +674,7 @@ woal_request_set_mac_address(moal_private * priv) status, req->status_code); } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return status; } @@ -711,7 +701,7 @@ woal_request_set_multicast_list(moal_private * priv, struct net_device *dev) req = (mlan_ioctl_req *) woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_bss)); if (req == NULL) { PRINTM(MERROR, "%s:Fail to allocate ioctl req buffer\n", - __FUNCTION__); + __func__); goto done; } @@ -780,7 +770,7 @@ woal_disconnect(moal_private * priv, t_u8 wait_option, t_u8 * mac) status = woal_request_ioctl(priv, req, wait_option); done: - if (req && (wait_option || status != MLAN_STATUS_PENDING)) + if (wait_option || status != MLAN_STATUS_PENDING) kfree(req); #ifdef REASSOCIATION priv->reassoc_required = MFALSE; @@ -839,8 +829,7 @@ woal_bss_start(moal_private * priv, t_u8 wait_option, #endif #endif done: - if (req) - kfree(req); + kfree(req); LEAVE(); return status; } @@ -886,7 +875,7 @@ woal_get_bss_info(moal_private * priv, t_u8 wait_option, sizeof(mlan_bss_info)); } done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -935,9 +924,8 @@ woal_set_get_retry(moal_private * priv, t_u32 action, /* Send IOCTL request to MLAN */ ret = woal_request_ioctl(priv, req, wait_option); - if (ret == MLAN_STATUS_SUCCESS && action == MLAN_ACT_GET) { + if (ret == MLAN_STATUS_SUCCESS && action == MLAN_ACT_GET) *value = mib->param.retry_count; - } #ifdef STA_CFG80211 /* If set is invoked from other than iw i.e iwconfig, wiphy retry count should be updated as well */ @@ -950,7 +938,7 @@ woal_set_get_retry(moal_private * priv, t_u32 action, #endif done: - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -998,9 +986,8 @@ woal_set_get_rts(moal_private * priv, t_u32 action, /* Send IOCTL request to MLAN */ ret = woal_request_ioctl(priv, req, wait_option); - if (ret == MLAN_STATUS_SUCCESS && action == MLAN_ACT_GET) { + if (ret == MLAN_STATUS_SUCCESS && action == MLAN_ACT_GET) *value = mib->param.rts_threshold; - } #ifdef STA_CFG80211 /* If set is invoked from other than iw i.e iwconfig, wiphy RTS threshold should be updated as well */ @@ -1011,7 +998,7 @@ woal_set_get_rts(moal_private * priv, t_u32 action, #endif done: - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -1060,9 +1047,8 @@ woal_set_get_frag(moal_private * priv, t_u32 action, /* Send IOCTL request to MLAN */ ret = woal_request_ioctl(priv, req, wait_option); - if (ret == MLAN_STATUS_SUCCESS && action == MLAN_ACT_GET) { + if (ret == MLAN_STATUS_SUCCESS && action == MLAN_ACT_GET) *value = mib->param.frag_threshold; - } #ifdef STA_CFG80211 /* If set is invoked from other than iw i.e iwconfig, wiphy fragment threshold should be updated as well */ @@ -1073,7 +1059,7 @@ woal_set_get_frag(moal_private * priv, t_u32 action, #endif done: - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -1139,9 +1125,7 @@ woal_set_get_gen_ie(moal_private * priv, t_u32 action, t_u8 * ie, int *ie_len) } done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -1186,7 +1170,7 @@ woal_set_get_tx_power(moal_private * priv, sizeof(mlan_power_cfg_t)); done: - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -1270,9 +1254,7 @@ woal_set_get_power_mgmt(moal_private * priv, #endif done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -1306,8 +1288,7 @@ woal_set_region_code(moal_private * priv, char *region) ret = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1357,8 +1338,7 @@ woal_set_get_data_rate(moal_private * priv, } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1401,8 +1381,7 @@ woal_get_assoc_rsp(moal_private * priv, mlan_ds_misc_assoc_rsp * assoc_rsp) ret = MLAN_STATUS_FAILURE; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1458,8 +1437,7 @@ woal_request_get_fw_info(moal_private * priv, t_u8 wait_option, "get fw info failed! status=%d, error_code=0x%x\n", status, req->status_code); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return status; } @@ -1507,7 +1485,7 @@ woal_get_debug_info(moal_private * priv, t_u8 wait_option, } } done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -1557,7 +1535,7 @@ woal_set_debug_info(moal_private * priv, t_u8 wait_option, /* Send IOCTL request to MLAN */ status = woal_request_ioctl(priv, req, wait_option); done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -1568,9 +1546,9 @@ done: /** * @brief host command ioctl function * - * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure - * @return 0 --success, otherwise fail + * @param priv A pointer to moal_private structure + * @param wrq A pointer to iwreq structure + * @return 0 --success, otherwise fail */ int woal_host_command(moal_private * priv, struct iwreq *wrq) @@ -1638,8 +1616,7 @@ woal_host_command(moal_private * priv, struct iwreq *wrq) } wrq->u.data.length = misc->param.hostcmd.len; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1654,12 +1631,12 @@ done: * @return 0 --success, otherwise fail */ /********* format of ifr_data *************/ -/* buf_len + Hostcmd_body */ +/* buf_len + Hostcmd_body */ /* buf_len: 4 bytes */ /* the length of the buf which */ /* can be used to return data */ -/* to application */ -/* Hostcmd_body */ +/* to application */ +/* Hostcmd_body */ /*******************************************/ int woal_hostcmd_ioctl(struct net_device *dev, struct ifreq *req) @@ -1744,8 +1721,7 @@ woal_hostcmd_ioctl(struct net_device *dev, struct ifreq *req) goto done; } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -1827,10 +1803,8 @@ woal_custom_ie_ioctl(struct net_device *dev, struct ifreq *req) } done: - if (ioctl_req) - kfree(ioctl_req); - if (custom_ie) - kfree(custom_ie); + kfree(ioctl_req); + kfree(custom_ie); LEAVE(); return ret; } @@ -1872,6 +1846,12 @@ woal_send_host_packet(struct net_device *dev, struct ifreq *req) goto done; } #define PACKET_HEADER_LEN 8 +#define MV_ETH_FRAME_LEN 1514 + if (packet_len > MV_ETH_FRAME_LEN) { + PRINTM(MERROR, "Invalid packet length %d\n", packet_len); + ret = -EFAULT; + goto done; + } pmbuf = woal_alloc_mlan_buffer(priv->phandle, (int)(MLAN_MIN_DATA_HEADER_LEN + (int)packet_len + @@ -1966,14 +1946,93 @@ woal_set_get_custom_ie(moal_private * priv, t_u16 mask, t_u8 * ie, int ie_len) ret = -EFAULT; } - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } #endif /* defined(HOST_TXRX_MGMT_FRAME) && defined(UAP_WEXT) */ /** + * @brief TDLS configuration ioctl handler + * + * @param dev A pointer to net_device structure + * @param req A pointer to ifreq structure + * @return 0 --success, otherwise fail + */ +int +woal_tdls_config_ioctl(struct net_device *dev, struct ifreq *req) +{ + moal_private *priv = (moal_private *) netdev_priv(dev); + mlan_ioctl_req *ioctl_req = NULL; + mlan_ds_misc_cfg *misc = NULL; + mlan_ds_misc_tdls_config *tdls_data = NULL; + int ret = 0; + + ENTER(); + + /* Sanity check */ + if (req->ifr_data == NULL) { + PRINTM(MERROR, "woal_tdls_config_ioctl() corrupt data\n"); + ret = -EFAULT; + goto done; + } + + tdls_data = kmalloc(sizeof(mlan_ds_misc_tdls_config), GFP_KERNEL); + if (!tdls_data) { + ret = -ENOMEM; + goto done; + } + memset(tdls_data, 0, sizeof(mlan_ds_misc_tdls_config)); + + if (copy_from_user + (tdls_data, req->ifr_data, sizeof(mlan_ds_misc_tdls_config))) { + PRINTM(MERROR, "Copy from user failed\n"); + ret = -EFAULT; + goto done; + } + + ioctl_req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (ioctl_req == NULL) { + ret = -ENOMEM; + goto done; + } + + misc = (mlan_ds_misc_cfg *) ioctl_req->pbuf; + misc->sub_command = MLAN_OID_MISC_TDLS_CONFIG; + ioctl_req->req_id = MLAN_IOCTL_MISC_CFG; + if (tdls_data->tdls_action == WLAN_TDLS_DISCOVERY_REQ + || tdls_data->tdls_action == WLAN_TDLS_LINK_STATUS) + ioctl_req->action = MLAN_ACT_GET; + else + ioctl_req->action = MLAN_ACT_SET; + + memcpy(&misc->param.tdls_config, tdls_data, + sizeof(mlan_ds_misc_tdls_config)); + + if (MLAN_STATUS_SUCCESS != + woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT)) { + ret = -EFAULT; + goto done; + } + + if (tdls_data->tdls_action == WLAN_TDLS_DISCOVERY_REQ + || tdls_data->tdls_action == WLAN_TDLS_LINK_STATUS) { + if (copy_to_user(req->ifr_data, &misc->param.tdls_config, + sizeof(mlan_ds_misc_tdls_config))) { + PRINTM(MERROR, "Copy to user failed!\n"); + ret = -EFAULT; + goto done; + } + } + +done: + kfree(ioctl_req); + kfree(tdls_data); + LEAVE(); + return ret; +} + +/** * @brief ioctl function get BSS type * * @param dev A pointer to net_device structure @@ -2099,8 +2158,7 @@ woal_bss_role_cfg(moal_private * priv, t_u8 action, } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2236,11 +2294,10 @@ woal_set_auto_arp(moal_handle * handle, t_u8 enable) } ret = woal_request_ioctl(woal_get_priv(handle, MLAN_BSS_ROLE_ANY), req, MOAL_NO_WAIT); - if (ret != MLAN_STATUS_SUCCESS && ret != MLAN_STATUS_PENDING) { + if (ret != MLAN_STATUS_SUCCESS && ret != MLAN_STATUS_PENDING) PRINTM(MIOCTL, "Set auto arp IOCTL failed!\n"); - } done: - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -2290,7 +2347,7 @@ woal_set_get_hs_params(moal_private * priv, t_u16 action, t_u8 wait_option, } } done: - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -2302,8 +2359,8 @@ done: * @param priv A pointer to moal_private structure * @param wait_option wait option * - * @return MLAN_STATUS_SUCCESS, MLAN_STATUS_PENDING, - * or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS, MLAN_STATUS_PENDING, + * or MLAN_STATUS_FAILURE */ mlan_status woal_cancel_hs(moal_private * priv, t_u8 wait_option) @@ -2328,8 +2385,8 @@ woal_cancel_hs(moal_private * priv, t_u8 wait_option) #if defined(SDIO_SUSPEND_RESUME) /** @brief This function enables the host sleep * - * @param priv A Pointer to the moal_private structure - * @return MTRUE or MFALSE + * @param priv A Pointer to the moal_private structure + * @return MTRUE or MFALSE */ int woal_enable_hs(moal_private * priv) @@ -2356,6 +2413,7 @@ woal_enable_hs(moal_private * priv) } #if defined(WIFI_DIRECT_SUPPORT) #if defined(STA_CFG80211) && defined(UAP_CFG80211) +#if LINUX_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION if (priv->phandle->is_remain_timer_set) { woal_cancel_timer(&priv->phandle->remain_timer); woal_remain_timer_func(priv->phandle); @@ -2398,6 +2456,7 @@ woal_enable_hs(moal_private * priv) } #endif #endif +#endif #ifdef STA_SUPPORT woal_reconfig_bgscan(priv->phandle); @@ -2464,7 +2523,8 @@ done: * @brief This function send soft_reset command to firmware * * @param handle A pointer to moal_handle structure - * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING on success, otherwise failure code + * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING on success, + * otherwise failure code */ mlan_status woal_request_soft_reset(moal_handle * handle) @@ -2487,8 +2547,7 @@ woal_request_soft_reset(moal_handle * handle) handle->surprise_removed = MTRUE; woal_sched_timeout(5); - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2529,7 +2588,7 @@ woal_set_wapi_enable(moal_private * priv, t_u8 wait_option, t_u32 enable) /* Send IOCTL request to MLAN */ status = woal_request_ioctl(priv, req, wait_option); done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -2538,11 +2597,11 @@ done: /** * @brief Get version * - * @param handle A pointer to moal_handle structure - * @param version A pointer to version buffer - * @param max_len max length of version buffer + * @param handle A pointer to moal_handle structure + * @param version A pointer to version buffer + * @param max_len max length of version buffer * - * @return N/A + * @return N/A */ void woal_get_version(moal_handle * handle, char *version, int max_len) @@ -2665,8 +2724,7 @@ woal_get_driver_verext(moal_private * priv, struct ifreq *ireq) PRINTM(MINFO, "MOAL EXTENDED VERSION: %s\n", info->param.ver_ext.version_str); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -2678,7 +2736,7 @@ done: * @brief Set driver debug bit masks to mlan in order to enhance performance * * @param priv A pointer to moal_private structure - * @param drvdbg Driver debug level + * @param drvdbg Driver debug level * * @return 0 --success, otherwise fail */ @@ -2705,7 +2763,7 @@ woal_set_drvdbg(moal_private * priv, t_u32 drvdbg) ret = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); @@ -2755,7 +2813,7 @@ woal_reg_rx_mgmt_ind(moal_private * priv, t_u16 action, memcpy(pmgmt_subtype_mask, &misc->param.mgmt_subtype_mask, sizeof(misc->param.mgmt_subtype_mask)); - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); @@ -2814,8 +2872,7 @@ woal_set_get_tx_bf_cfg(moal_private * priv, t_u16 action, sizeof(mlan_ds_11n_tx_bf_cfg)); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2823,10 +2880,10 @@ done: /** * @brief Handle ioctl resp * - * @param priv Pointer to moal_private structure - * @param req Pointer to mlan_ioctl_req structure + * @param priv Pointer to moal_private structure + * @param req Pointer to mlan_ioctl_req structure * - * @return N/A + * @return N/A */ void woal_process_ioctl_resp(moal_private * priv, mlan_ioctl_req * req) @@ -2916,7 +2973,7 @@ woal_get_pm_info(moal_private * priv, mlan_ds_ps_info * pm_info) } } done: - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -2958,9 +3015,7 @@ woal_get_deep_sleep(moal_private * priv, t_u32 * data) *(data + 1) = pm->param.auto_deep_sleep.idletime; done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -2998,9 +3053,8 @@ woal_set_deep_sleep(moal_private * priv, t_u8 wait_option, BOOLEAN bdeep_sleep, if (bdeep_sleep == MTRUE) { PRINTM(MIOCTL, "Deep Sleep: sleep\n"); pm->param.auto_deep_sleep.auto_ds = DEEP_SLEEP_ON; - if (idletime) { + if (idletime) pm->param.auto_deep_sleep.idletime = idletime; - } ret = woal_request_ioctl(priv, req, wait_option); if (ret != MLAN_STATUS_SUCCESS && ret != MLAN_STATUS_PENDING) { ret = -EFAULT; @@ -3016,9 +3070,8 @@ woal_set_deep_sleep(moal_private * priv, t_u8 wait_option, BOOLEAN bdeep_sleep, } } done: - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); - LEAVE(); return ret; } @@ -3038,9 +3091,8 @@ woal_cancel_cac_block(moal_private * priv) if (priv->phandle->cac_period == MTRUE) { priv->phandle->cac_period = MFALSE; priv->phandle->meas_start_jiffies = 0; - if (priv->phandle->delay_bss_start == MTRUE) { + if (priv->phandle->delay_bss_start == MTRUE) priv->phandle->delay_bss_start = MFALSE; - } if (priv->phandle->meas_wait_q_woken == MFALSE) { priv->phandle->meas_wait_q_woken = MTRUE; wake_up_interruptible(&priv->phandle->meas_wait_q); @@ -3089,9 +3141,7 @@ woal_11h_channel_check_ioctl(moal_private * priv) priv->phandle->meas_start_jiffies = jiffies; done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -3100,11 +3150,11 @@ done: /** * @brief set/get wifi direct mode * - * @param priv A pointer to moal_private structure - * @param action set or get - * @param mode A pointer to wifi direct mode + * @param priv A pointer to moal_private structure + * @param action set or get + * @param mode A pointer to wifi direct mode * - * @return MLAN_STATUS_SUCCESS -- success, otherwise fail + * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ mlan_status woal_wifi_direct_mode_cfg(moal_private * priv, t_u16 action, t_u16 * mode) @@ -3132,8 +3182,7 @@ woal_wifi_direct_mode_cfg(moal_private * priv, t_u16 action, t_u16 * mode) PRINTM(MIOCTL, "ACT=%d, wifi_direct_mode=%d\n", action, *mode); } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -3141,11 +3190,11 @@ done: /** * @brief set remain channel * - * @param priv A pointer to moal_private structure + * @param priv A pointer to moal_private structure * @param wait_option Wait option - * @param pchan A pointer to mlan_ds_remain_chan structure + * @param pchan A pointer to mlan_ds_remain_chan structure * - * @return MLAN_STATUS_SUCCESS -- success, otherwise fail + * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ mlan_status woal_set_remain_channel_ioctl(moal_private * priv, t_u8 wait_option, @@ -3174,7 +3223,7 @@ woal_set_remain_channel_ioctl(moal_private * priv, t_u8 wait_option, sizeof(mlan_ds_remain_chan)); } done: - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -3221,7 +3270,7 @@ woal_p2p_config(moal_private * priv, t_u32 action, sizeof(mlan_ds_wifi_direct_config)); } done: - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -3280,7 +3329,7 @@ woal_get_signal_info(moal_private * priv, t_u8 wait_option, #endif } done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -3330,7 +3379,7 @@ woal_get_scan_table(moal_private * priv, t_u8 wait_option, } done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -3399,7 +3448,7 @@ woal_request_scan(moal_private * priv, goto done; } done: - if ((ioctl_req) && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(ioctl_req); if (ret == MLAN_STATUS_FAILURE) { @@ -3413,10 +3462,10 @@ done: /** * @brief Change Adhoc Channel * - * @param priv A pointer to moal_private structure - * @param channel The channel to be set. + * @param priv A pointer to moal_private structure + * @param channel The channel to be set. * - * @return MLAN_STATUS_SUCCESS--success, MLAN_STATUS_FAILURE--fail + * @return MLAN_STATUS_SUCCESS--success, MLAN_STATUS_FAILURE--fail */ mlan_status woal_change_adhoc_chan(moal_private * priv, int channel) @@ -3502,8 +3551,7 @@ woal_change_adhoc_chan(moal_private * priv, int channel) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -3511,9 +3559,9 @@ done: /** * @brief Find the best network to associate * - * @param priv A pointer to moal_private structure - * @param wait_option Wait option - * @param ssid_bssid A pointer to mlan_ssid_bssid structure + * @param priv A pointer to moal_private structure + * @param wait_option Wait option + * @param ssid_bssid A pointer to mlan_ssid_bssid structure * * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, otherwise fail */ @@ -3560,8 +3608,7 @@ woal_find_best_network(moal_private * priv, t_u8 wait_option, } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -3569,9 +3616,9 @@ done: /** * @brief Get authentication mode * - * @param priv A pointer to moal_private structure - * @param wait_option Wait option - * @param auth_mode A pointer to authentication mode + * @param priv A pointer to moal_private structure + * @param wait_option Wait option + * @param auth_mode A pointer to authentication mode * * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, otherwise fail */ @@ -3599,11 +3646,10 @@ woal_get_auth_mode(moal_private * priv, t_u8 wait_option, t_u32 * auth_mode) /* Send IOCTL request to MLAN */ status = woal_request_ioctl(priv, req, wait_option); - if (status == MLAN_STATUS_SUCCESS && auth_mode) { + if (status == MLAN_STATUS_SUCCESS && auth_mode) *auth_mode = sec->param.auth_mode; - } done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -3644,11 +3690,10 @@ woal_get_encrypt_mode(moal_private * priv, t_u8 wait_option, /* Send IOCTL request to MLAN */ status = woal_request_ioctl(priv, req, wait_option); - if (status == MLAN_STATUS_SUCCESS && encrypt_mode) { + if (status == MLAN_STATUS_SUCCESS && encrypt_mode) *encrypt_mode = sec->param.encrypt_mode; - } done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -3657,9 +3702,9 @@ done: /** * @brief Get WPA enable * - * @param priv A pointer to moal_private structure - * @param wait_option Wait option - * @param enable A pointer to wpa enable status + * @param priv A pointer to moal_private structure + * @param wait_option Wait option + * @param enable A pointer to wpa enable status * * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, otherwise fail */ @@ -3688,11 +3733,10 @@ woal_get_wpa_enable(moal_private * priv, t_u8 wait_option, t_u32 * enable) /* Send IOCTL request to MLAN */ status = woal_request_ioctl(priv, req, wait_option); - if (status == MLAN_STATUS_SUCCESS && enable) { + if (status == MLAN_STATUS_SUCCESS && enable) *enable = sec->param.wpa_enabled; - } done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -3701,9 +3745,9 @@ done: /** * @brief Set authentication mode * - * @param priv A pointer to moal_private structure - * @param wait_option Wait option - * @param auth_mode Authentication mode + * @param priv A pointer to moal_private structure + * @param wait_option Wait option + * @param auth_mode Authentication mode * * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, otherwise fail */ @@ -3733,7 +3777,7 @@ woal_set_auth_mode(moal_private * priv, t_u8 wait_option, t_u32 auth_mode) /* Send IOCTL request to MLAN */ status = woal_request_ioctl(priv, req, wait_option); done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -3774,7 +3818,7 @@ woal_set_encrypt_mode(moal_private * priv, t_u8 wait_option, t_u32 encrypt_mode) /* Send IOCTL request to MLAN */ status = woal_request_ioctl(priv, req, wait_option); done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -3815,7 +3859,7 @@ woal_set_wpa_enable(moal_private * priv, t_u8 wait_option, t_u32 enable) /* Send IOCTL request to MLAN */ status = woal_request_ioctl(priv, req, wait_option); done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -3857,7 +3901,7 @@ woal_enable_wep_key(moal_private * priv, t_u8 wait_option) /* Send IOCTL request to MLAN */ status = woal_request_ioctl(priv, req, wait_option); done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -3913,7 +3957,7 @@ woal_request_userscan(moal_private * priv, } done: - if ((ioctl_req) && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(ioctl_req); if (ret == MLAN_STATUS_FAILURE) { @@ -3930,7 +3974,6 @@ done: * @param priv A pointer to moal_private structure * @param scan_cfg A pointer to scan_cfg structure * - * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ mlan_status @@ -3962,8 +4005,7 @@ woal_get_scan_config(moal_private * priv, mlan_scan_cfg * scan_cfg) ret = MLAN_STATUS_FAILURE; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -4015,8 +4057,7 @@ woal_set_scan_time(moal_private * priv, t_u16 active_scan_time, woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT)) ret = MLAN_STATUS_FAILURE; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -4096,6 +4137,9 @@ woal_cancel_scan(moal_private * priv, t_u8 wait_option) spin_lock(&handle->priv[i]->scan_req_lock); if (IS_STA_CFG80211(cfg80211_wext) && handle->priv[i]->scan_request) { + PRINTM(MINFO, "Reporting scan results\n"); + woal_inform_bss_from_scan_result(priv, NULL, + wait_option); /** some supplicant can not handle SCAN abort event */ cfg80211_scan_done(handle->priv[i]->scan_request, MFALSE); @@ -4105,8 +4149,7 @@ woal_cancel_scan(moal_private * priv, t_u8 wait_option) } #endif done: - if (req) - kfree(req); + kfree(req); return ret; } @@ -4184,9 +4227,8 @@ woal_request_bgscan(moal_private * priv, goto done; } done: - if ((ioctl_req) && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(ioctl_req); - LEAVE(); return ret; } @@ -4254,6 +4296,13 @@ woal_set_bg_scan(moal_private * priv, char *buf, int length) buf_left -= 2; break; case WEXT_BGSCAN_INTERVAL_SECTION: + if (buf_left < 3) { + PRINTM(MERROR, + "Invalid scan_interval, buf_left=%d\n", + buf_left); + buf_left = 0; + break; + } priv->scan_cfg.scan_interval = (ptr[2] << 8 | ptr[1]) * 1000; PRINTM(MIOCTL, "BG scan: scan_interval=%d\n", @@ -4407,7 +4456,7 @@ woal_reconfig_bgscan(moal_handle * handle) * @brief set rssi low threshold * * @param priv A pointer to moal_private structure - * @param rssi A pointer to low rssi + * @param rssi A pointer to low rssi * @param wait_option Wait option * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail @@ -4453,7 +4502,7 @@ woal_set_rssi_low_threshold(moal_private * priv, char *rssi, t_u8 wait_option) goto done; } done: - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -4464,8 +4513,8 @@ done: * @brief set rssi low threshold * * @param priv A pointer to moal_private structure - * @param event_id event id. - * @param wait_option wait option + * @param event_id event id. + * @param wait_option wait option * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ @@ -4520,7 +4569,7 @@ woal_set_rssi_threshold(moal_private * priv, t_u32 event_id, t_u8 wait_option) misc->param.subscribe_event.evt_action); ret = woal_request_ioctl(priv, req, wait_option); done: - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -4600,8 +4649,7 @@ woal_set_scan_type(moal_private * priv, t_u32 scan_type) woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT)) ret = MLAN_STATUS_FAILURE; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -4646,8 +4694,7 @@ woal_enable_ext_scan(moal_private * priv, t_u8 enable) woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT)) ret = MLAN_STATUS_FAILURE; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -4861,9 +4908,7 @@ woal_get_band(moal_private * priv, int *band) if (support_band == WIFI_FREQUENCY_ALL_BAND) *band = WIFI_FREQUENCY_BAND_AUTO; done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -4871,10 +4916,10 @@ done: /** * @brief set band * - * @param priv A pointer to moal_private structure + * @param priv A pointer to moal_private structure * @param pband A pointer to band string. * - * @return MLAN_STATUS_SUCCESS -- success, otherwise fail + * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ mlan_status woal_set_band(moal_private * priv, char *pband) @@ -4959,8 +5004,7 @@ woal_set_band(moal_private * priv, char *pband) goto done; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5084,8 +5128,7 @@ woal_priv_qos_cfg(moal_private * priv, t_u32 action, char *qos_cfg) if (action == MLAN_ACT_GET) *qos_cfg = cfg->param.qos_cfg; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5138,8 +5181,7 @@ woal_set_sleeppd(moal_private * priv, char *psleeppd) goto done; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5147,11 +5189,11 @@ done: /** * @brief Set scan period function * - * @param priv A pointer to moal_private structure - * @param buf A pointer to scan command buf - * @param length buf length + * @param priv A pointer to moal_private structure + * @param buf A pointer to scan command buf + * @param length buf length * - * @return MLAN_STATUS_SUCCESS -- success, otherwise fail + * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ int woal_set_scan_cfg(moal_private * priv, char *buf, int length) @@ -5209,14 +5251,12 @@ woal_set_scan_cfg(moal_private * priv, char *buf, int length) } if (active_scan_time || passive_scan_time || specific_scan_time) { - PRINTM(MIOCTL, "Set active_scan_time= %d passive_scan_time=%d " - "specific_scan_time=%d\n", active_scan_time, - passive_scan_time, specific_scan_time); - if (MLAN_STATUS_FAILURE == woal_set_scan_time(priv, - active_scan_time, - passive_scan_time, - specific_scan_time)) - { + PRINTM(MIOCTL, + "Set active_scan_time= %d passive_scan_time=%d specific_scan_time=%d\n", + active_scan_time, passive_scan_time, specific_scan_time); + if (MLAN_STATUS_FAILURE == + woal_set_scan_time(priv, active_scan_time, + passive_scan_time, specific_scan_time)) { ret = -EFAULT; } } @@ -5260,8 +5300,7 @@ woal_set_radio(moal_private * priv, t_u8 option) goto done; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } diff --git a/drivers/net/wireless/sd8797/mlinux/moal_main.c b/drivers/net/wireless/sd8797/mlinux/moal_main.c index e76904e7f8d2..2ce792f72430 100644 --- a/drivers/net/wireless/sd8797/mlinux/moal_main.c +++ b/drivers/net/wireless/sd8797/mlinux/moal_main.c @@ -47,6 +47,10 @@ Change log: #include <linux/wlan_plat.h> #include "moal_eth_ioctl.h" +#include <linux/if_ether.h> +#include <linux/in.h> +#include <linux/tcp.h> +#include <net/tcp.h> #include <net/dsfield.h> /******************************************************** @@ -64,11 +68,6 @@ char driver_version[] = #endif " "; -/** SD8797 Card */ -#define CARD_SD8797 "SD8797" -/** SD8782 Card */ -#define CARD_SD8782 "SD8782" - /** Firmware name */ char *fw_name; int req_fw_nowait; @@ -123,6 +122,8 @@ int max_vir_bss = DEF_VIRTUAL_BSS; #ifdef SDIO_SUSPEND_RESUME /** PM keep power */ int pm_keep_power = 1; +/** HS when shutdown */ +int shutdown_hs; #endif #if defined(STA_SUPPORT) @@ -167,6 +168,12 @@ int rx_work; int hw_test; +#if defined(WIFI_DIRECT_SUPPORT) +#if LINUX_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION +int p2p_enh; +#endif +#endif + /** woal_callbacks */ static mlan_callbacks woal_callbacks = { .moal_get_fw_data = moal_get_fw_data, @@ -207,7 +214,6 @@ static mlan_callbacks woal_callbacks = { .moal_tcp_ack_tx_ind = moal_tcp_ack_tx_ind, }; -/** Default Driver mode */ #if defined(STA_SUPPORT) && defined(UAP_SUPPORT) #if defined(WIFI_DIRECT_SUPPORT) int drv_mode = (DRV_MODE_STA | DRV_MODE_UAP | DRV_MODE_WIFIDIRECT); @@ -375,9 +381,8 @@ woal_ssid_valid(mlan_802_11_ssid * pssid) /** * @brief GO timeout function * - * - * @param context A pointer to context - * @return N/A + * @param context A pointer to context + * @return N/A */ void woal_go_timer_func(void *context) @@ -396,9 +401,8 @@ woal_go_timer_func(void *context) /** * @brief Remain on Channel timeout function * - * - * @param context A pointer to context - * @return N/A + * @param context A pointer to context + * @return N/A */ void woal_remain_timer_func(void *context) @@ -434,8 +438,8 @@ woal_remain_timer_func(void *context) /** * @brief check if we already connect to the AP. - * @param priv A pointer to moal_private structure - * @param ssid_bssid A pointer to mlan_ssid_bssid structure + * @param priv A pointer to moal_private structure + * @param ssid_bssid A pointer to mlan_ssid_bssid structure * * @return MTRUE/MFALSE; */ @@ -568,7 +572,7 @@ woal_get_mode(moal_private * priv, t_u8 wait_option) } } done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return mode; @@ -728,10 +732,8 @@ woal_update_drv_tbl(moal_handle * handle, int drv_mode_local) #endif #endif /* Clear existing table, if any */ - if (handle->drv_mode.bss_attr != NULL) { - kfree(handle->drv_mode.bss_attr); - handle->drv_mode.bss_attr = NULL; - } + kfree(handle->drv_mode.bss_attr); + handle->drv_mode.bss_attr = NULL; /* Create moal_drv_mode entry */ handle->drv_mode.drv_mode = drv_mode; @@ -741,21 +743,12 @@ woal_update_drv_tbl(moal_handle * handle, int drv_mode_local) handle->drv_mode.fw_name = fw_name; } else { #if defined(UAP_SUPPORT) && defined(STA_SUPPORT) - if (handle->card_type == CARD_TYPE_SD8782) - handle->drv_mode.fw_name = DEFAULT_AP_STA_FW_NAME_8782; - else - handle->drv_mode.fw_name = DEFAULT_AP_STA_FW_NAME; + handle->drv_mode.fw_name = DEFAULT_AP_STA_FW_NAME; #else #ifdef UAP_SUPPORT - if (handle->card_type == CARD_TYPE_SD8782) - handle->drv_mode.fw_name = DEFAULT_AP_FW_NAME_8782; - else - handle->drv_mode.fw_name = DEFAULT_AP_FW_NAME; + handle->drv_mode.fw_name = DEFAULT_AP_FW_NAME; #else - if (handle->card_type == CARD_TYPE_SD8782) - handle->drv_mode.fw_name = DEFAULT_FW_NAME_8782; - else - handle->drv_mode.fw_name = DEFAULT_FW_NAME; + handle->drv_mode.fw_name = DEFAULT_FW_NAME; #endif /* UAP_SUPPORT */ #endif /* UAP_SUPPORT && STA_SUPPORT */ } @@ -768,9 +761,9 @@ done: /** * @brief This function initializes software * - * @param handle A pointer to moal_handle structure + * @param handle A pointer to moal_handle structure * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status woal_init_sw(moal_handle * handle) @@ -787,7 +780,7 @@ woal_init_sw(moal_handle * handle) handle->main_state = MOAL_STATE_IDLE; #ifdef STA_SUPPORT - if (MTRUE + if ((drv_mode & DRV_MODE_STA) #ifdef STA_WEXT && !IS_STA_WEXT(cfg80211_wext) #endif @@ -802,11 +795,16 @@ woal_init_sw(moal_handle * handle) } #endif /* STA_SUPPORT */ - /* Update driver version */ - if (handle->card_type == CARD_TYPE_SD8782) - memcpy(driver_version, CARD_SD8782, strlen(CARD_SD8782)); - else if (handle->card_type == CARD_TYPE_SD8797) - memcpy(driver_version, CARD_SD8797, strlen(CARD_SD8797)); +#if defined(STA_CFG80211) && defined(STA_SUPPORT) + if (IS_STA_CFG80211(cfg80211_wext)) + cfg80211_wext |= STA_CFG80211_MASK | UAP_CFG80211_MASK; +#endif + +#if defined(UAP_CFG80211) && defined(UAP_SUPPORT) + if (IS_UAP_CFG80211(cfg80211_wext)) + cfg80211_wext |= STA_CFG80211_MASK | UAP_CFG80211_MASK; +#endif + memcpy(handle->driver_version, driver_version, strlen(driver_version)); if (woal_update_drv_tbl(handle, drv_mode) != MLAN_STATUS_SUCCESS) { @@ -906,9 +904,6 @@ woal_init_sw(moal_handle * handle) device.mpa_rx_cfg = MLAN_INIT_PARA_DISABLED; #endif #endif - device.feature_control = FEATURE_CTRL_DEFAULT; - if (handle->card_type == CARD_TYPE_SD8782) - device.feature_control = 0; if (rx_work == MLAN_INIT_PARA_ENABLED) device.rx_work = MTRUE; @@ -956,7 +951,7 @@ woal_init_sw(moal_handle * handle) * * @param handle A pointer to moal_handle structure * - * @return N/A + * @return N/A */ static void woal_free_moal_handle(moal_handle * handle) @@ -989,10 +984,8 @@ woal_free_moal_handle(moal_handle * handle) mlan_unregister(handle->pmlan_adapter); /* Free BSS attribute table */ - if (handle->drv_mode.bss_attr != NULL) { - kfree(handle->drv_mode.bss_attr); - handle->drv_mode.bss_attr = NULL; - } + kfree(handle->drv_mode.bss_attr); + handle->drv_mode.bss_attr = NULL; PRINTM(MINFO, "Free Adapter\n"); if (atomic_read(&handle->lock_count) || atomic_read(&handle->malloc_count) || @@ -1073,15 +1066,12 @@ woal_process_regrdwr(moal_handle * handle, t_u8 * type_string, goto done; } - if (MLAN_STATUS_SUCCESS != woal_atoi(&type, type_string)) { + if (MLAN_STATUS_SUCCESS != woal_atoi(&type, type_string)) goto done; - } - if (MLAN_STATUS_SUCCESS != woal_atoi(&offset, offset_string)) { + if (MLAN_STATUS_SUCCESS != woal_atoi(&offset, offset_string)) goto done; - } - if (MLAN_STATUS_SUCCESS != woal_atoi(&value, value_string)) { + if (MLAN_STATUS_SUCCESS != woal_atoi(&value, value_string)) goto done; - } ioctl_req->req_id = MLAN_IOCTL_REG_MEM; ioctl_req->action = MLAN_ACT_SET; @@ -1099,16 +1089,14 @@ woal_process_regrdwr(moal_handle * handle, t_u8 * type_string, /* request ioctl for STA */ if (MLAN_STATUS_SUCCESS != - woal_request_ioctl(handle->priv[0], ioctl_req, MOAL_IOCTL_WAIT)) { + woal_request_ioctl(handle->priv[0], ioctl_req, MOAL_IOCTL_WAIT)) goto done; - } PRINTM(MINFO, "Register type: %d, offset: 0x%x, value: 0x%x\n", type, offset, value); ret = MLAN_STATUS_SUCCESS; done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -1278,9 +1266,8 @@ woal_process_init_cfg(moal_handle * handle, t_u8 * data, t_size size) } } - if (index == 0) { + if (index == 0) PRINTM(MINFO, "Can't find any matching MAC Address"); - } ret = MLAN_STATUS_SUCCESS; done: @@ -1352,11 +1339,10 @@ woal_process_hostcmd_cfg(moal_handle * handle, t_u8 * data, t_size size) if (start_raw == MFALSE) { intf_s = strchr(pos, '='); - if (intf_s) { + if (intf_s) intf_e = strchr(intf_s, '{'); - } else { + else intf_e = NULL; - } if (intf_s && intf_e) { start_raw = MTRUE; @@ -1380,8 +1366,7 @@ woal_process_hostcmd_cfg(moal_handle * handle, t_u8 * data, t_size size) } done: - if (buf) - kfree(buf); + kfree(buf); LEAVE(); return ret; } @@ -1389,6 +1374,7 @@ done: #define INIT_CFG_DATA 0x00 #define TXPWRLIMIT_CFG_DATA 0x01 #define INIT_HOSTCMD_CFG_DATA 0x02 +#define COUNTRY_POWER_TABLE 0x04 /** * @brief WOAL set user defined init data and param @@ -1421,6 +1407,20 @@ woal_set_user_init_data(moal_handle * handle, int type) "Init config file request_firmware() failed\n"); goto done; } + } else if (type == COUNTRY_POWER_TABLE) { + int status = + request_firmware(&handle->user_data, txpwrlimit_cfg, + handle->hotplug_device); + /* File does not exist, skip download */ + if (status == -ENOENT) { + PRINTM(MIOCTL, + "Country power table file does not exist\n"); + ret = MLAN_STATUS_SUCCESS; + } else if (status) { + PRINTM(MERROR, + "Init config file request_firmware() failed\n"); + goto done; + } } else if (type == INIT_HOSTCMD_CFG_DATA) { if ((request_firmware (&handle->user_data, init_hostcmd_cfg, @@ -1442,7 +1442,8 @@ woal_set_user_init_data(moal_handle * handle, int type) goto done; } } else if (type == TXPWRLIMIT_CFG_DATA || - type == INIT_HOSTCMD_CFG_DATA) { + type == INIT_HOSTCMD_CFG_DATA || + type == COUNTRY_POWER_TABLE) { if (MLAN_STATUS_SUCCESS != woal_process_hostcmd_cfg(handle, cfg_data, len)) { PRINTM(MERROR, @@ -1605,9 +1606,9 @@ woal_init_fw_dpc(moal_handle * handle) #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 32) sdio_release_host(((struct sdio_mmc_card *)handle->card)->func); #endif - if (ret == MLAN_STATUS_FAILURE) { + if (ret == MLAN_STATUS_FAILURE) goto done; - } else if (ret == MLAN_STATUS_SUCCESS) { + else if (ret == MLAN_STATUS_SUCCESS) { handle->hardware_status = HardwareStatusReady; goto done; } @@ -1692,7 +1693,7 @@ done: * @param firmware A pointer to firmware image * @param context A pointer to moal_handle structure * - * @return N/A + * @return N/A */ static void woal_request_fw_callback(const struct firmware *firmware, void *context) @@ -1770,9 +1771,9 @@ woal_request_fw(moal_handle * handle) /** * @brief This function initializes firmware * - * @param handle A pointer to moal_handle structure + * @param handle A pointer to moal_handle structure * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status woal_init_fw(moal_handle * handle) @@ -1782,12 +1783,14 @@ woal_init_fw(moal_handle * handle) ENTER(); do_gettimeofday(&handle->req_fw_time); + ret = woal_request_fw(handle); if (ret < 0) { PRINTM(MFATAL, "woal_request_fw failed\n"); ret = MLAN_STATUS_FAILURE; goto done; } + done: LEAVE(); return ret; @@ -1890,12 +1893,12 @@ const struct net_device_ops woal_netdev_ops = { /** * @brief This function initializes the private structure - * and dev structure for station mode + * and dev structure for station mode * - * @param dev A pointer to net_device structure - * @param priv A pointer to moal_private structure + * @param dev A pointer to net_device structure + * @param priv A pointer to moal_private structure * - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ mlan_status woal_init_sta_dev(struct net_device *dev, moal_private * priv) @@ -1967,12 +1970,12 @@ const struct net_device_ops woal_uap_netdev_ops = { /** * @brief This function initializes the private structure - * and dev structure for uap mode + * and dev structure for uap mode * - * @param dev A pointer to net_device structure - * @param priv A pointer to moal_private structure + * @param dev A pointer to net_device structure + * @param priv A pointer to moal_private structure * - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ mlan_status woal_init_uap_dev(struct net_device *dev, moal_private * priv) @@ -2026,7 +2029,7 @@ woal_init_uap_dev(struct net_device *dev, moal_private * priv) /** * @brief This function adds a new interface. It will - * allocate, initialize and register the device. + * allocate, initialize and register the device. * * @param handle A pointer to moal_handle structure * @param bss_index BSS index number @@ -2057,11 +2060,10 @@ woal_add_interface(moal_handle * handle, t_u8 bss_index, t_u8 bss_type) /* Allocate device name */ #ifdef STA_SUPPORT memset(name, 0, sizeof(name)); - if (sta_name) { + if (sta_name) snprintf(name, sizeof(name), "%s%%d", sta_name); - } else { + else sprintf(name, "mlan%%d"); - } if ((bss_type == MLAN_BSS_TYPE_STA) && (dev_alloc_name(dev, name) < 0)) { PRINTM(MERROR, "Could not allocate mlan device name\n"); goto error; @@ -2069,11 +2071,10 @@ woal_add_interface(moal_handle * handle, t_u8 bss_index, t_u8 bss_type) #endif #ifdef UAP_SUPPORT memset(name, 0, sizeof(name)); - if (uap_name) { + if (uap_name) snprintf(name, sizeof(name), "%s%%d", uap_name); - } else { + else sprintf(name, "uap%%d"); - } if ((bss_type == MLAN_BSS_TYPE_UAP) && (dev_alloc_name(dev, name) < 0)) { PRINTM(MERROR, "Could not allocate uap device name\n"); goto error; @@ -2081,11 +2082,10 @@ woal_add_interface(moal_handle * handle, t_u8 bss_index, t_u8 bss_type) #endif #if defined(WIFI_DIRECT_SUPPORT) memset(name, 0, sizeof(name)); - if (wfd_name) { + if (wfd_name) snprintf(name, sizeof(name), "%s%%d", wfd_name); - } else { + else sprintf(name, "wfd%%d"); - } if ((bss_type == MLAN_BSS_TYPE_WIFIDIRECT) && (dev_alloc_name(dev, name) < 0)) { PRINTM(MERROR, "Could not allocate wifidirect device name\n"); @@ -2231,9 +2231,8 @@ error: #if defined(STA_CFG80211) || defined(UAP_CFG80211) /* Unregister wiphy device and free */ if (priv) { - if (priv->wdev && IS_STA_OR_UAP_CFG80211(cfg80211_wext)) { + if (priv->wdev && IS_STA_OR_UAP_CFG80211(cfg80211_wext)) priv->wdev = NULL; - } } #endif if (dev && dev->reg_state == NETREG_REGISTERED) @@ -2247,10 +2246,10 @@ error: /** * @brief This function removes an interface. * - * @param handle A pointer to the moal_handle structure - * @param bss_index BSS index number + * @param handle A pointer to the moal_handle structure + * @param bss_index BSS index number * - * @return N/A + * @return N/A */ void woal_remove_interface(moal_handle * handle, t_u8 bss_index) @@ -2301,9 +2300,8 @@ woal_remove_interface(moal_handle * handle, t_u8 bss_index) #if defined(STA_CFG80211) || defined(UAP_CFG80211) /* Unregister wiphy device and free */ - if (priv->wdev && IS_STA_OR_UAP_CFG80211(cfg80211_wext)) { + if (priv->wdev && IS_STA_OR_UAP_CFG80211(cfg80211_wext)) priv->wdev = NULL; - } #endif /* Clear the priv in handle */ @@ -2319,10 +2317,11 @@ error: /** * @brief Send FW shutdown command to MLAN * - * @param priv A pointer to moal_private structure - * @param wait_option Wait option + * @param priv A pointer to moal_private structure + * @param wait_option Wait option * - * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, otherwise fail + * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, + * otherwise fail */ static mlan_status woal_shutdown_fw(moal_private * priv, t_u8 wait_option) @@ -2353,8 +2352,7 @@ woal_shutdown_fw(moal_private * priv, t_u8 wait_option) /* add 100 ms delay to avoid back to back init/shutdown */ mdelay(100); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return status; } @@ -2362,9 +2360,9 @@ done: /** * @brief Return hex value of a give character * - * @param chr Character to be converted + * @param chr Character to be converted * - * @return The converted character if chr is a valid hex, else 0 + * @return The converted character if chr is a valid hex, else 0 */ static int woal_hexval(char chr) @@ -2422,10 +2420,9 @@ static int wifi_set_carddetect(int on) { ENTER(); - PRINTM(MMSG, "%s = %d\n", __FUNCTION__, on); - if (wifi_control_data && wifi_control_data->set_carddetect) { + PRINTM(MMSG, "%s = %d\n", __func__, on); + if (wifi_control_data && wifi_control_data->set_carddetect) wifi_control_data->set_carddetect(on); - } LEAVE(); return 0; } @@ -2443,10 +2440,9 @@ static int wifi_set_power(int on, unsigned long msec) { ENTER(); - PRINTM(MMSG, "%s = %d\n", __FUNCTION__, on); - if (wifi_control_data && wifi_control_data->set_power) { + PRINTM(MMSG, "%s = %d\n", __func__, on); + if (wifi_control_data && wifi_control_data->set_power) wifi_control_data->set_power(on); - } if (msec) mdelay(msec); LEAVE(); @@ -2632,11 +2628,13 @@ woal_open(struct net_device *dev) #if defined(WIFI_DIRECT_SUPPORT) #if defined(STA_CFG80211) && defined(UAP_CFG80211) #if LINUX_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION - if (priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT && - IS_STA_CFG80211(cfg80211_wext)) { - priv->phandle->wiphy->interface_modes |= - MBIT(NL80211_IFTYPE_P2P_GO) | - MBIT(NL80211_IFTYPE_P2P_CLIENT); + if (!p2p_enh) { + if (priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT && + IS_STA_CFG80211(cfg80211_wext)) { + priv->phandle->wiphy->interface_modes |= + MBIT(NL80211_IFTYPE_P2P_GO) | + MBIT(NL80211_IFTYPE_P2P_CLIENT); + } } #endif #endif @@ -2694,11 +2692,15 @@ woal_close(struct net_device *dev) #if defined(WIFI_DIRECT_SUPPORT) #if defined(STA_CFG80211) && defined(UAP_CFG80211) #if LINUX_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION - if (priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT && !priv->bss_virtual && - IS_STA_CFG80211(cfg80211_wext) && IS_UAP_CFG80211(cfg80211_wext)) { - priv->phandle->wiphy->interface_modes &= - ~(MBIT(NL80211_IFTYPE_P2P_GO) | - MBIT(NL80211_IFTYPE_P2P_CLIENT)); + if (!p2p_enh) { + if (priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT && + !priv->bss_virtual && + IS_STA_CFG80211(cfg80211_wext) && + IS_UAP_CFG80211(cfg80211_wext)) { + priv->phandle->wiphy->interface_modes &= + ~(MBIT(NL80211_IFTYPE_P2P_GO) | + MBIT(NL80211_IFTYPE_P2P_CLIENT)); + } } #endif #endif @@ -2762,9 +2764,9 @@ done: /** * @brief Check driver status * - * @param handle A pointer to moal_handle + * @param handle A pointer to moal_handle * - * @return MTRUE/MFALSE + * @return MTRUE/MFALSE */ t_u8 woal_check_driver_status(moal_handle * handle) @@ -2793,7 +2795,7 @@ woal_check_driver_status(moal_handle * handle) } if (info.num_cmd_timeout) { PRINTM(MERROR, "num_cmd_timeout = %d\n", info.num_cmd_timeout); - PRINTM(MERROR, "Timeout cmd id = 0x%x, act = 0x%x \n", + PRINTM(MERROR, "Timeout cmd id = 0x%x, act = 0x%x\n", info.timeout_cmd_id, info.timeout_cmd_act); LEAVE(); return MTRUE; @@ -2834,7 +2836,7 @@ woal_check_driver_status(moal_handle * handle) * * @param priv A pointer to moal_private * - * @return N/A + * @return N/A */ void woal_mlan_debug_info(moal_private * priv) @@ -2857,29 +2859,26 @@ woal_mlan_debug_info(moal_private * priv) PRINTM(MERROR, "------------mlan_debug_info-------------\n"); PRINTM(MERROR, "mlan_processing =%d\n", info.mlan_processing); PRINTM(MERROR, "mlan_rx_processing =%d\n", info.mlan_rx_processing); + PRINTM(MERROR, "rx_pkts_queued=%d\n", info.rx_pkts_queued); PRINTM(MERROR, "num_cmd_timeout = %d\n", info.num_cmd_timeout); PRINTM(MERROR, "Timeout cmd id = 0x%x, act = 0x%x \n", info.timeout_cmd_id, info.timeout_cmd_act); PRINTM(MERROR, "last_cmd_index = %d\n", info.last_cmd_index); - for (s = str, i = 0; i < DBG_CMD_NUM; i++) { + for (s = str, i = 0; i < DBG_CMD_NUM; i++) s += sprintf(s, "0x%x ", info.last_cmd_id[i]); - } PRINTM(MERROR, "last_cmd_id = %s\n", str); - for (s = str, i = 0; i < DBG_CMD_NUM; i++) { + for (s = str, i = 0; i < DBG_CMD_NUM; i++) s += sprintf(s, "0x%x ", info.last_cmd_act[i]); - } PRINTM(MERROR, "last_cmd_act = %s\n", str); PRINTM(MERROR, "last_cmd_resp_index = %d\n", info.last_cmd_resp_index); - for (s = str, i = 0; i < DBG_CMD_NUM; i++) { + for (s = str, i = 0; i < DBG_CMD_NUM; i++) s += sprintf(s, "0x%x ", info.last_cmd_resp_id[i]); - } PRINTM(MERROR, "last_cmd_resp_id = %s\n", str); PRINTM(MERROR, "last_event_index = %d\n", info.last_event_index); - for (s = str, i = 0; i < DBG_CMD_NUM; i++) { + for (s = str, i = 0; i < DBG_CMD_NUM; i++) s += sprintf(s, "0x%x ", info.last_event[i]); - } PRINTM(MERROR, "last_event = %s", str); PRINTM(MERROR, "num_data_h2c_failure = %d\n", @@ -2949,7 +2948,7 @@ woal_mlan_debug_info(moal_private * priv) /** * @brief This function handles the timeout of packet - * transmission + * transmission * * @param dev A pointer to net_device structure * @@ -3150,13 +3149,13 @@ woal_process_tcp_ack(moal_private * priv, mlan_buffer * pmbuf) if (*((t_u8 *) tcph + 13) == 0x10) { /* Only replace ACK */ - priv->tcp_ack_cnt++; if (ntohs(iph->tot_len) > (iph->ihl + tcph->doff) * 4) { /* Don't drop ACK with payload */ /* TODO: should we delete previous TCP session */ LEAVE(); return ret; } + priv->tcp_ack_cnt++; spin_lock_irqsave(&priv->tcp_sess_lock, flags); tcp_session = woal_get_tcp_sess(priv, iph->saddr, tcph->source, iph->daddr, @@ -3221,7 +3220,6 @@ woal_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) struct sk_buff *new_skb = NULL; #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) t_u32 index = 0; - t_u32 tid = 0; #endif ENTER(); @@ -3279,9 +3277,7 @@ woal_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) case MLAN_STATUS_PENDING: atomic_inc(&priv->phandle->tx_pending); #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) - tid = pmbuf->priority; - index = mlan_select_wmm_queue(priv->phandle->pmlan_adapter, - priv->bss_index, tid); + index = skb_get_queue_mapping(skb); atomic_inc(&priv->wmm_tx_pending[index]); if (atomic_read(&priv->wmm_tx_pending[index]) >= MAX_TX_PENDING) { struct netdev_queue *txq = @@ -3314,11 +3310,11 @@ done: /** * @brief Convert ascii string to Hex integer * - * @param d A pointer to integer buf - * @param s A pointer to ascii string - * @param dlen The byte number of ascii string in hex + * @param d A pointer to integer buf + * @param s A pointer to ascii string + * @param dlen The byte number of ascii string in hex * - * @return Number of integer + * @return Number of integer */ int woal_ascii2hex(t_u8 * d, char *s, t_u32 dlen) @@ -3395,9 +3391,9 @@ woal_atoi(int *data, char *a) /** * @brief Return hex value of a given ascii string * - * @param a String to be converted to ascii + * @param a String to be converted to ascii * - * @return The converted character if a is a valid hex, else 0 + * @return The converted character if a is a valid hex, else 0 */ int woal_atox(char *a) @@ -3415,7 +3411,7 @@ woal_atox(char *a) /** * @brief Extension of strsep lib command. This function will also take care - * escape character + * escape character * * @param s A pointer to array of chars to process * @param delim The delimiter character to end the string @@ -3473,7 +3469,7 @@ woal_strsep(char **s, char delim, char esc) * @param mac_addr The buffer to store the mac address in. * @param buf The source of mac address which is a string. * - * @return N/A + * @return N/A */ void woal_mac2u8(t_u8 * mac_addr, char *buf) @@ -3512,12 +3508,12 @@ woal_set_multicast_list(struct net_device *dev) /** * @brief This function initializes the private structure - * and set default value to the member of moal_private. + * and set default value to the member of moal_private. * * @param priv A pointer to moal_private structure * @param wait_option Wait option * - * @return N/A + * @return N/A */ void woal_init_priv(moal_private * priv, t_u8 wait_option) @@ -3542,9 +3538,8 @@ woal_init_priv(moal_private * priv, t_u8 wait_option) } #endif /* STA_SUPPORT */ #ifdef UAP_SUPPORT - if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) { + if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) priv->bss_started = MFALSE; - } #endif priv->media_connected = MFALSE; @@ -3602,7 +3597,7 @@ woal_init_priv(moal_private * priv, t_u8 wait_option) /** * @brief Reset all interfaces if all_intf flag is TRUE, - * otherwise specified interface only + * otherwise specified interface only * * @param priv A pointer to moal_private structure * @param wait_option Wait option @@ -3768,14 +3763,14 @@ woal_alloc_mlan_buffer(moal_handle * handle, int size) pmbuf = kmalloc(sizeof(mlan_buffer), flag); if (!pmbuf) { - PRINTM(MERROR, "%s: Fail to alloc mlan buffer\n", __FUNCTION__); + PRINTM(MERROR, "%s: Fail to alloc mlan buffer\n", __func__); LEAVE(); return NULL; } memset((t_u8 *) pmbuf, 0, sizeof(mlan_buffer)); skb = __dev_alloc_skb(size, flag); if (!skb) { - PRINTM(MERROR, "%s: No free skb\n", __FUNCTION__); + PRINTM(MERROR, "%s: No free skb\n", __func__); kfree(pmbuf); LEAVE(); return NULL; @@ -3807,8 +3802,7 @@ woal_alloc_mlan_ioctl_req(int size) kmalloc((sizeof(mlan_ioctl_req) + size + sizeof(int) + sizeof(wait_queue)), flag); if (!req) { - PRINTM(MERROR, "%s: Fail to alloc ioctl buffer\n", - __FUNCTION__); + PRINTM(MERROR, "%s: Fail to alloc ioctl buffer\n", __func__); LEAVE(); return NULL; } @@ -3853,10 +3847,10 @@ woal_free_mlan_buffer(moal_handle * handle, pmlan_buffer pmbuf) /** * @brief This function handles events generated by firmware * - * @param priv A pointer to moal_private structure - * @param payload A pointer to payload buffer - * @param len Length of the payload - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @param priv A pointer to moal_private structure + * @param payload A pointer to payload buffer + * @param len Length of the payload + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status woal_broadcast_event(moal_private * priv, t_u8 * payload, t_u32 len) @@ -4201,8 +4195,7 @@ woal_reassociation_thread(void *data) LEAVE(); return MLAN_STATUS_FAILURE; } - if (req) - kfree(req); + kfree(req); } } @@ -4216,7 +4209,7 @@ woal_reassociation_thread(void *data) handle->is_reassoc_timer_set = MTRUE; if (priv && (priv->set_asynced_essid_flag == MTRUE)) { PRINTM(MERROR, - "Set Async ESSID: No AP found or assoc failed. \n"); + "Set Async ESSID: No AP found or assoc failed.\n"); priv->set_asynced_essid_flag = MFALSE; } else { PRINTM(MEVENT, @@ -4242,8 +4235,8 @@ woal_reassociation_thread(void *data) * @brief This function triggers re-association by waking up * re-assoc thread. * - * @param context A pointer to context - * @return N/A + * @param context A pointer to context + * @return N/A */ void woal_reassoc_timer_func(void *context) @@ -4269,7 +4262,7 @@ woal_reassoc_timer_func(void *context) * @brief Sends disconnect event * * @param priv A pointer to moal_private struct - * @return N/A + * @return N/A */ t_void woal_send_disconnect_to_system(moal_private * priv) @@ -4297,8 +4290,9 @@ woal_send_disconnect_to_system(moal_private * priv) if (IS_STA_CFG80211(cfg80211_wext)) { if (!priv->cfg_disconnect && !priv->cfg_connect && priv->wdev && priv->wdev->iftype != NL80211_IFTYPE_ADHOC) { - PRINTM(MMSG, "wlan: Disconnected from " MACSTR ":" - " Reason code %d\n", MAC2STR(priv->cfg_bssid), + PRINTM(MMSG, + "wlan: Disconnected from " MACSTR + ": Reason code %d\n", MAC2STR(priv->cfg_bssid), WLAN_REASON_DEAUTH_LEAVING); /* This function must be called only when disconnect issued by the FW, i.e. disconnected by AP. For IBSS @@ -4568,6 +4562,7 @@ woal_dump_mlan_drv_info(moal_private * priv, t_u8 * buf) ptr += sprintf(ptr, "mlan_processing =%d\n", info.mlan_processing); ptr += sprintf(ptr, "mlan_rx_processing =%d\n", info.mlan_rx_processing); + ptr += sprintf(ptr, "rx_pkts_queued =%d\n", info.rx_pkts_queued); ptr += sprintf(ptr, "num_cmd_timeout = %d\n", info.num_cmd_timeout); ptr += sprintf(ptr, "Timeout cmd id = 0x%x, act = 0x%x \n", info.timeout_cmd_id, info.timeout_cmd_act); @@ -4713,17 +4708,19 @@ woal_dump_moal_hex(moal_handle * phandle, t_u8 * buf) } ptr += sprintf(ptr, "<--moal_handle-->\n"); - ptr += sprintf(ptr, "moal_handle=%p, size=%d(0x%x)\n", phandle, - sizeof(*phandle), sizeof(*phandle)); + ptr += sprintf(ptr, "moal_handle=%p, size=%ld(0x%lx)\n", phandle, + (long int)sizeof(*phandle), + (long unsigned int)sizeof(*phandle)); ptr += woal_save_hex_dump(ROW_SIZE_16, phandle, sizeof(*phandle), MTRUE, ptr); ptr += sprintf(ptr, "<--moal_handle End-->\n"); for (i = 0; i < phandle->priv_num; i++) { ptr += sprintf(ptr, "<--moal_private(%d)-->\n", i); - ptr += sprintf(ptr, "moal_private=%p, size=%d(0x%x)\n", - phandle->priv[i], sizeof(*(phandle->priv[i])), - sizeof(*(phandle->priv[i]))); + ptr += sprintf(ptr, "moal_private=%p, size=%ld(0x%lx)\n", + phandle->priv[i], + (long int)sizeof(*(phandle->priv[i])), + (long unsigned int)sizeof(*(phandle->priv[i]))); ptr += woal_save_hex_dump(ROW_SIZE_16, phandle->priv[i], sizeof(*(phandle->priv[i])), MTRUE, ptr); @@ -4736,21 +4733,20 @@ woal_dump_moal_hex(moal_handle * phandle, t_u8 * buf) /** * @brief This function dump mlan hex to file * - * @param phandle A pointer to moal_handle + * @param priv A pointer to moal_private structure * @param buf A pointer to buffer * * @return The length of this log */ static int -woal_dump_mlan_hex(moal_handle * phandle, t_u8 * buf) +woal_dump_mlan_hex(moal_private * priv, t_u8 * buf) { char *ptr = (char *)buf; int i; ENTER(); - if (!phandle || !buf || - woal_get_debug_info(phandle->pmlan_adapter, MOAL_CMD_WAIT, &info)) { + if (!buf || !priv || woal_get_debug_info(priv, MOAL_CMD_WAIT, &info)) { PRINTM(MMSG, "%s: can't retreive info\n", __func__); LEAVE(); return 0; @@ -4809,10 +4805,11 @@ woal_dump_drv_info(moal_handle * phandle) (phandle, MLAN_BSS_ROLE_ANY), pos); pos += woal_dump_moal_hex(phandle, pos); - pos += woal_dump_mlan_hex(phandle, pos); + pos += woal_dump_mlan_hex(woal_get_priv(phandle, MLAN_BSS_ROLE_ANY), + pos); - PRINTM(MMSG, "Drv info total bytes = %d (0x%x)\n", pos - drv_buf, - pos - drv_buf); + PRINTM(MMSG, "Drv info total bytes = %ld (0x%lx)\n", + (long int)(pos - drv_buf), (long unsigned int)(pos - drv_buf)); pfile = filp_open("/data/file_drv_info", O_CREAT | O_RDWR, 0644); if (IS_ERR(pfile)) { @@ -4855,7 +4852,6 @@ done: /** * @brief This function dump firmware memory to file * - * @param phandle A pointer to moal_handle * * @return N/A @@ -5251,6 +5247,70 @@ woal_moal_debug_info(moal_private * priv, moal_handle * handle, u8 flag) } /** + * @brief Download power table to firmware for a specific country + * + * @param priv A pointer to moal_private + * @param country ISO 3166-1 alpha-2 country code + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +mlan_status +woal_request_country_power_table(moal_private * priv, char *country) +{ + mlan_status ret = MLAN_STATUS_SUCCESS; + moal_handle *handle = NULL; + char country_name[] = "txpower_XX.bin"; + char file_path[256]; + char *last_slash = NULL; + + ENTER(); + + if (!priv || !priv->phandle) { + PRINTM(MERROR, "Priv or handle is null\n"); + LEAVE(); + return MLAN_STATUS_FAILURE; + } + + if (!country) { + PRINTM(MERROR, "Country is null\n"); + LEAVE(); + return MLAN_STATUS_FAILURE; + } + + handle = priv->phandle; + + /* Replace XX with ISO 3166-1 alpha-2 country code */ + strncpy(strstr(country_name, "XX"), country, strlen(country)); + + memset(file_path, 0, sizeof(file_path)); + /* file_path should be Null terminated */ + if (fw_name && (strlen(fw_name) < sizeof(file_path))) { + strncpy(file_path, fw_name, strlen(fw_name)); + last_slash = strrchr(file_path, '/'); + if (last_slash) + memset(last_slash + 1, 0, + sizeof(file_path) - 1 - (last_slash - + file_path)); + else + memset(file_path, 0, sizeof(file_path)); + } else { + strncpy(file_path, "mrvl/", sizeof(file_path)); + } + txpwrlimit_cfg = strncat(file_path, country_name, + sizeof(file_path) - strlen(file_path)); + + if (MLAN_STATUS_SUCCESS != + woal_set_user_init_data(handle, COUNTRY_POWER_TABLE)) { + PRINTM(MFATAL, "Download power table to firmware failed\n"); + ret = MLAN_STATUS_FAILURE; + } + + txpwrlimit_cfg = NULL; + LEAVE(); + return ret; +} + +/** * @brief This workqueue function handles rx_process * * @param work A pointer to work_struct @@ -5365,7 +5425,7 @@ woal_interrupt(moal_handle * handle) /** * @brief This function adds the card. it will probe the - * card, allocate the mlan_private and initialize the device. + * card, allocate the mlan_private and initialize the device. * * @param card A pointer to card * @@ -5424,9 +5484,6 @@ woal_add_card(void *card) } } - /* Update card type */ - woal_sdio_update_card_type(handle, card); - ((struct sdio_mmc_card *)card)->handle = handle; #ifdef STA_SUPPORT @@ -5530,9 +5587,8 @@ woal_add_card(void *card) woal_create_thread(woal_reassociation_thread, &handle->reassoc_thread, "woal_reassoc_service"); - while (!handle->reassoc_thread.pid) { + while (!handle->reassoc_thread.pid) woal_sched_timeout(2); - } #endif /* REASSOCIATION */ /* Register the device. Fill up the private data structure with @@ -5568,20 +5624,17 @@ err_init_fw: err_registerdev: handle->surprise_removed = MTRUE; #ifdef REASSOCIATION - if (handle->reassoc_thread.pid) { + if (handle->reassoc_thread.pid) wake_up_interruptible(&handle->reassoc_thread.wait_q); - } /* waiting for main thread quit */ - while (handle->reassoc_thread.pid) { + while (handle->reassoc_thread.pid) woal_sched_timeout(2); - } #endif /* REASSOCIATION */ woal_terminate_workqueue(handle); err_kmalloc: woal_free_moal_handle(handle); - if (index < MAX_MLAN_ADAPTER) { + if (index < MAX_MLAN_ADAPTER) m_handle[index] = NULL; - } ((struct sdio_mmc_card *)card)->handle = NULL; err_handle: MOAL_REL_SEMAPHORE(&AddRemoveCardSem); @@ -5685,9 +5738,8 @@ woal_remove_card(void *card) wake_up_interruptible(&handle->reassoc_thread.wait_q); /* waiting for main thread quit */ - while (handle->reassoc_thread.pid) { + while (handle->reassoc_thread.pid) woal_sched_timeout(2); - } #endif /* REASSOCIATION */ #ifdef CONFIG_PROC_FS @@ -5717,7 +5769,7 @@ exit_sem_err: /** * @brief This function switch the drv_mode * - * @param handle A pointer to moal_handle structure + * @param handle A pointer to moal_handle structure * @param mode new drv_mode to switch. * * @return MLAN_STATUS_SUCCESS /MLAN_STATUS_FAILURE /MLAN_STATUS_PENDING @@ -5825,9 +5877,8 @@ woal_init_module(void) PRINTM(MMSG, "wlan: Loading MWLAN driver\n"); /* Init the wlan_private pointer array first */ - for (index = 0; index < MAX_MLAN_ADAPTER; index++) { + for (index = 0; index < MAX_MLAN_ADAPTER; index++) m_handle[index] = NULL; - } /* Init mutex */ MOAL_INIT_SEMAPHORE(&AddRemoveCardSem); @@ -6040,6 +6091,9 @@ MODULE_PARM_DESC(max_tx_buf, "Maximum Tx buffer size (2048/4096/8192)"); #ifdef SDIO_SUSPEND_RESUME module_param(pm_keep_power, int, 1); MODULE_PARM_DESC(pm_keep_power, "1: PM keep power; 0: PM no power"); +module_param(shutdown_hs, int, 0); +MODULE_PARM_DESC(shutdown_hs, + "1: Enable HS when shutdown; 0: No HS when shutdown"); #endif #if defined(STA_SUPPORT) module_param(cfg_11d, int, 0); @@ -6081,6 +6135,13 @@ MODULE_PARM_DESC(wq_sched_policy, module_param(rx_work, int, 0); MODULE_PARM_DESC(rx_work, "0: default; 1: Enable rx_work_queue; 2: Disable rx_work_queue"); +#if defined(WIFI_DIRECT_SUPPORT) +#if LINUX_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION +module_param(p2p_enh, int, 0); +MODULE_PARM_DESC(p2p_enh, "1: Enable enhanced P2P; 0: Disable enhanced P2P"); +#endif +#endif + MODULE_DESCRIPTION("M-WLAN Driver"); MODULE_AUTHOR("Marvell International Ltd."); MODULE_VERSION(MLAN_RELEASE_VERSION); diff --git a/drivers/net/wireless/sd8797/mlinux/moal_main.h b/drivers/net/wireless/sd8797/mlinux/moal_main.h index 68c578fb03c2..5b91be88afee 100644 --- a/drivers/net/wireless/sd8797/mlinux/moal_main.h +++ b/drivers/net/wireless/sd8797/mlinux/moal_main.h @@ -246,15 +246,15 @@ woal_initialize_timer(pmoal_drv_timer timer, * @brief Modify timer * * @param timer Timer structure - * @param MillisecondPeriod Time period in millisecond + * @param millisecondperiod Time period in millisecond * * @return N/A */ static inline void -woal_mod_timer(pmoal_drv_timer timer, t_u32 MillisecondPeriod) +woal_mod_timer(pmoal_drv_timer timer, t_u32 millisecondperiod) { - timer->time_period = MillisecondPeriod; - mod_timer(&timer->tl, jiffies + (MillisecondPeriod * HZ) / 1000); + timer->time_period = millisecondperiod; + mod_timer(&timer->tl, jiffies + (millisecondperiod * HZ) / 1000); timer->timer_is_canceled = MFALSE; } @@ -448,9 +448,8 @@ in4_pton(const char *src, int srclen, u8 * dst, int delim, const char **end) goto cont; } w = (w * 10) + c; - if ((w & 0xffff) > 255) { + if ((w & 0xffff) > 255) goto out; - } cont: if (i >= 4) goto out; @@ -481,14 +480,14 @@ out: #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37) /** Initialize semaphore */ -#define MOAL_INIT_SEMAPHORE(x) init_MUTEX(x) +#define MOAL_INIT_SEMAPHORE(x) init_MUTEX(x) /** Initialize semaphore */ -#define MOAL_INIT_SEMAPHORE_LOCKED(x) init_MUTEX_LOCKED(x) +#define MOAL_INIT_SEMAPHORE_LOCKED(x) init_MUTEX_LOCKED(x) #else /** Initialize semaphore */ -#define MOAL_INIT_SEMAPHORE(x) sema_init(x, 1) +#define MOAL_INIT_SEMAPHORE(x) sema_init(x, 1) /** Initialize semaphore */ -#define MOAL_INIT_SEMAPHORE_LOCKED(x) sema_init(x, 0) +#define MOAL_INIT_SEMAPHORE_LOCKED(x) sema_init(x, 0) #endif /** Acquire semaphore and with blocking */ @@ -496,7 +495,7 @@ out: /** Acquire semaphore without blocking */ #define MOAL_ACQ_SEMAPHORE_NOBLOCK(x) down_trylock(x) /** Release semaphore */ -#define MOAL_REL_SEMAPHORE(x) up(x) +#define MOAL_REL_SEMAPHORE(x) up(x) /** Request FW timeout in second */ #define REQUEST_FW_TIMEOUT 30 @@ -533,9 +532,9 @@ out: /** Custom event : AdHoc link lost */ #define CUS_EVT_ADHOC_LINK_LOST "EVENT=ADHOC_LINK_LOST" /** Custom event : MIC failure, unicast */ -#define CUS_EVT_MLME_MIC_ERR_UNI "MLME-MICHAELMICFAILURE.indication unicast " +#define CUS_EVT_MLME_MIC_ERR_UNI "MLME-MICHAELMICFAILURE.indication unicast" /** Custom event : MIC failure, multicast */ -#define CUS_EVT_MLME_MIC_ERR_MUL "MLME-MICHAELMICFAILURE.indication multicast " +#define CUS_EVT_MLME_MIC_ERR_MUL "MLME-MICHAELMICFAILURE.indication multicast" /** Custom event : Beacon RSSI low */ #define CUS_EVT_BEACON_RSSI_LOW "EVENT=BEACON_RSSI_LOW" /** Custom event : Beacon SNR low */ @@ -565,9 +564,9 @@ out: #define CUS_EVT_DEEP_SLEEP_AWAKE "EVENT=DS_AWAKE" /** Custom event : Host Sleep activated */ -#define CUS_EVT_HS_ACTIVATED "HS_ACTIVATED " +#define CUS_EVT_HS_ACTIVATED "HS_ACTIVATED" /** Custom event : Host Sleep deactivated */ -#define CUS_EVT_HS_DEACTIVATED "HS_DEACTIVATED " +#define CUS_EVT_HS_DEACTIVATED "HS_DEACTIVATED" /** Custom event : Host Sleep wakeup */ #define CUS_EVT_HS_WAKEUP "HS_WAKEUP" @@ -620,7 +619,7 @@ out: #define NL_MULTICAST_GROUP 1 /** MAX Tx Pending count */ -#define MAX_TX_PENDING 100 +#define MAX_TX_PENDING 100 /** LOW Tx Pending count */ #define LOW_TX_PENDING 80 @@ -897,6 +896,8 @@ struct _moal_private { u8 mrvl_rssi_low; /** last event */ u32 last_event; + /** fake scan flag */ + u8 fake_scan_complete; #endif /* STA_SUPPORT */ #endif /* STA_CFG80211 */ @@ -1160,8 +1161,6 @@ struct _moal_handle { #endif /** Driver spin lock */ spinlock_t driver_lock; - /** Card type */ - t_u16 card_type; /** Card specific driver version */ t_s8 driver_version[MLAN_MAX_VER_STR_LEN]; }; @@ -1178,9 +1177,8 @@ woal_set_trans_start(struct net_device *dev) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31) unsigned int i; - for (i = 0; i < dev->num_tx_queues; i++) { + for (i = 0; i < dev->num_tx_queues; i++) netdev_get_tx_queue(dev, i)->trans_start = jiffies; - } #endif dev->trans_start = jiffies; } @@ -1312,20 +1310,20 @@ woal_print(t_u32 level, char *fmt, ...) #define MASSERT(cond) \ do { \ if (!(cond)) { \ - PRINTM(MFATAL, "ASSERT: %s: %i\n", __FUNCTION__, __LINE__); \ + PRINTM(MFATAL, "ASSERT: %s: %i\n", __func__, __LINE__); \ panic("Assert failed: Panic!"); \ } \ } while (0) /** Log entry point for debugging */ #define ENTER() PRINTM(MENTRY, "Enter: %s\n", \ - __FUNCTION__) + __func__) /** Log exit point for debugging */ #define LEAVE() PRINTM(MENTRY, "Leave: %s\n", \ - __FUNCTION__) + __func__) #ifdef DEBUG_LEVEL1 -#define DBG_DUMP_BUF_LEN 64 +#define DBG_DUMP_BUF_LEN 64 #define MAX_DUMP_PER_LINE 16 static inline void @@ -1489,11 +1487,6 @@ typedef struct _HostCmd_DS_802_11_CFG_DATA { t_u8 data[1]; } __ATTRIB_PACK__ HostCmd_DS_802_11_CFG_DATA; -/** SD8797 card type */ -#define CARD_TYPE_SD8797 0x01 -/** SD8782 card type */ -#define CARD_TYPE_SD8782 0x02 - /** combo scan header */ #define WEXT_CSCAN_HEADER "CSCAN S\x01\x00\x00S\x00" /** combo scan header size */ @@ -1762,6 +1755,8 @@ int woal_custom_ie_ioctl(struct net_device *dev, struct ifreq *req); int woal_send_host_packet(struct net_device *dev, struct ifreq *req); /** Private command ID to pass mgmt frame */ #define WOAL_MGMT_FRAME_TX_IOCTL (SIOCDEVPRIVATE + 12) +/** common ioctl for TDLS */ +int woal_tdls_config_ioctl(struct net_device *dev, struct ifreq *req); int woal_get_bss_type(struct net_device *dev, struct ifreq *req); #if defined(STA_WEXT) || defined(UAP_WEXT) @@ -1863,9 +1858,9 @@ mlan_status woal_set_sleeppd(moal_private * priv, char *psleeppd); int woal_set_scan_cfg(moal_private * priv, char *buf, int length); /* EVENT: BCN_RSSI_LOW */ -#define EVENT_BCN_RSSI_LOW 0x0001 +#define EVENT_BCN_RSSI_LOW 0x0001 /* EVENT: PRE_BCN_LOST */ -#define EVENT_PRE_BCN_LOST 0x0002 +#define EVENT_PRE_BCN_LOST 0x0002 mlan_status woal_set_rssi_low_threshold(moal_private * priv, char *rssi, t_u8 wait_option); mlan_status woal_set_rssi_threshold(moal_private * priv, t_u32 event_id, @@ -1896,4 +1891,5 @@ int woal_is_connected(moal_private * priv, mlan_ssid_bssid * ssid_bssid); void wifi_enable_hostwake_irq(int flag); int woal_priv_hostcmd(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen); void woal_tcp_ack_tx_indication(moal_private * priv, mlan_buffer * pmbuf); +mlan_status woal_request_country_power_table(moal_private * priv, char *region); #endif /* _MOAL_MAIN_H */ diff --git a/drivers/net/wireless/sd8797/mlinux/moal_priv.c b/drivers/net/wireless/sd8797/mlinux/moal_priv.c index b9f928fe6948..a4ffc618caea 100644 --- a/drivers/net/wireless/sd8797/mlinux/moal_priv.c +++ b/drivers/net/wireless/sd8797/mlinux/moal_priv.c @@ -115,7 +115,7 @@ woal_associate_ssid_bssid(moal_private * priv, struct iwreq *wrq) } else { if (mac_idx < ETH_ALEN) ssid_bssid.bssid[mac_idx] = - (t_u8) woal_atox((char *)buf + (int)i); + (t_u8) woal_atox(buf + i); while ((isxdigit(buf[i + 1]) && (i < buflen))) { /* Skip entire hex value */ @@ -264,9 +264,9 @@ done: * @brief Get signal * * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_get_signal(moal_private * priv, struct iwreq *wrq) @@ -541,9 +541,9 @@ woal_deep_sleep_ioctl(moal_private * priv, struct iwreq *wrq) * @brief Set/Get Usr 11n configuration request * * @param priv Pointer to the moal_private driver data struct - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_11n_htcap_cfg(moal_private * priv, struct iwreq *wrq) @@ -638,8 +638,7 @@ woal_11n_htcap_cfg(moal_private * priv, struct iwreq *wrq) wrq->u.data.length = data_length; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -648,9 +647,9 @@ done: * @brief Enable/Disable amsdu_aggr_ctrl * * @param priv Pointer to the moal_private driver data struct - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_11n_amsdu_aggr_ctrl(moal_private * priv, struct iwreq *wrq) @@ -707,8 +706,7 @@ woal_11n_amsdu_aggr_ctrl(moal_private * priv, struct iwreq *wrq) } wrq->u.data.length = 2; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -717,9 +715,9 @@ done: * @brief Set/Get 11n configuration request * * @param priv Pointer to the moal_private driver data struct - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_11n_tx_cfg(moal_private * priv, struct iwreq *wrq) @@ -810,8 +808,7 @@ woal_11n_tx_cfg(moal_private * priv, struct iwreq *wrq) wrq->u.data.length = data_length; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -820,9 +817,9 @@ done: * @brief Enable/Disable TX Aggregation * * @param priv Pointer to the moal_private driver data struct - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_11n_prio_tbl(moal_private * priv, struct iwreq *wrq) @@ -902,9 +899,7 @@ woal_11n_prio_tbl(moal_private * priv, struct iwreq *wrq) } error: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -913,9 +908,9 @@ error: * @brief Set/Get add BA Reject parameters * * @param priv Pointer to the moal_private driver data struct - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_addba_reject(moal_private * priv, struct iwreq *wrq) @@ -948,9 +943,8 @@ woal_addba_reject(moal_private * priv, struct iwreq *wrq) } wrq->u.data.length = MAX_NUM_TID; - for (i = 0; i < (wrq->u.data.length); ++i) { + for (i = 0; i < (wrq->u.data.length); ++i) data[i] = cfg_11n->param.addba_reject[i]; - } if (copy_to_user(wrq->u.data.pointer, data, sizeof(int) * wrq->u.data.length)) { @@ -988,9 +982,7 @@ woal_addba_reject(moal_private * priv, struct iwreq *wrq) goto error; } error: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -999,9 +991,9 @@ error: * @brief Set/Get add BA parameters * * @param priv Pointer to the moal_private driver data struct - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_addba_para_updt(moal_private * priv, struct iwreq *wrq) @@ -1090,9 +1082,7 @@ woal_addba_para_updt(moal_private * priv, struct iwreq *wrq) } error: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -1101,9 +1091,9 @@ error: * @brief Set/Get Transmit buffer size * * @param priv Pointer to the moal_private driver data struct - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_txbuf_cfg(moal_private * priv, struct iwreq *wrq) @@ -1145,8 +1135,7 @@ woal_txbuf_cfg(moal_private * priv, struct iwreq *wrq) } wrq->u.data.length = 1; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1155,10 +1144,10 @@ done: * @brief Set/Get Host Sleep configuration * * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure - * @param invoke_hostcmd MTRUE --invoke HostCmd, otherwise MFALSE + * @param wrq A pointer to iwreq structure + * @param invoke_hostcmd MTRUE --invoke HostCmd, otherwise MFALSE * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_hs_cfg(moal_private * priv, struct iwreq *wrq, BOOLEAN invoke_hostcmd) @@ -1257,7 +1246,7 @@ done: * @brief Set Host Sleep parameters * * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * * @return 0 --success, otherwise fail */ @@ -1286,7 +1275,7 @@ done: * @brief Get/Set inactivity timeout extend * * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * * @return 0 --success, otherwise fail */ @@ -1360,8 +1349,7 @@ woal_inactivity_timeout_ext(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1370,7 +1358,7 @@ done: * @brief Set/Get system clock * * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * * @return 0 --success, otherwise fail */ @@ -1468,9 +1456,8 @@ woal_ecl_sys_clock(moal_private * priv, struct iwreq *wrq) cfg->param.sys_clock.sys_clk_type = MLAN_CLK_CONFIGURABLE; cfg->param.sys_clock.sys_clk_num = MIN(MLAN_MAX_CLK_NUM, data_length); - for (i = 0; i < cfg->param.sys_clock.sys_clk_num; i++) { + for (i = 0; i < cfg->param.sys_clock.sys_clk_num; i++) cfg->param.sys_clock.sys_clk[i] = (t_u16) data[i]; - } if (MLAN_STATUS_SUCCESS != woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT)) { @@ -1479,8 +1466,7 @@ woal_ecl_sys_clock(moal_private * priv, struct iwreq *wrq) } } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1489,7 +1475,7 @@ done: * @brief Set/Get Band and Adhoc-band setting * * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * * @return 0 --success, otherwise fail */ @@ -1635,9 +1621,7 @@ woal_band_cfg(moal_private * priv, struct iwreq *wrq) } error: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -1646,7 +1630,7 @@ error: * @brief Read/Write adapter registers value * * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * * @return 0 --success, otherwise fail */ @@ -1710,8 +1694,7 @@ woal_reg_read_write(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1720,7 +1703,7 @@ done: * @brief Read the EEPROM contents of the card * * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * * @return 0 --success, otherwise fail */ @@ -1781,8 +1764,7 @@ woal_read_eeprom(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1791,7 +1773,7 @@ done: * @brief Read/Write device memory value * * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * * @return 0 --success, otherwise fail */ @@ -1861,8 +1843,7 @@ woal_mem_read_write(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1870,10 +1851,10 @@ done: /** * @brief Get LOG * - * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param priv A pointer to moal_private structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_get_log(moal_private * priv, struct iwreq *wrq) @@ -1943,8 +1924,7 @@ woal_get_log(moal_private * priv, struct iwreq *wrq) } } done: - if (buf) - kfree(buf); + kfree(buf); LEAVE(); return ret; } @@ -1952,10 +1932,10 @@ done: /** * @brief Deauthenticate * - * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param priv A pointer to moal_private structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_deauth(moal_private * priv, struct iwreq *wrq) @@ -2113,8 +2093,7 @@ woal_tx_power_cfg(moal_private * priv, struct iwreq *wrq) wrq->u.data.length = pcfg->param.power_ext.len; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2160,8 +2139,7 @@ woal_get_txrx_rate(moal_private * priv, struct iwreq *wrq) } wrq->u.data.length = 2; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2282,8 +2260,7 @@ woal_beacon_interval(moal_private * priv, struct iwreq *wrq) } wrq->u.data.length = 1; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2347,8 +2324,7 @@ woal_atim_window(moal_private * priv, struct iwreq *wrq) } wrq->u.data.length = 1; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2356,10 +2332,10 @@ done: /** * @brief Set/Get TX data rate * - * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param priv A pointer to moal_private structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_set_get_txrate(moal_private * priv, struct iwreq *wrq) @@ -2419,13 +2395,11 @@ woal_set_get_txrate(moal_private * priv, struct iwreq *wrq) else rateindex = rate->param.rate_cfg.rate; wrq->u.data.length = 1; - if (copy_to_user(wrq->u.data.pointer, &rateindex, sizeof(int))) { + if (copy_to_user(wrq->u.data.pointer, &rateindex, sizeof(int))) ret = -EFAULT; - } } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2433,10 +2407,10 @@ done: /** * @brief Set/Get region code * - * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param priv A pointer to moal_private structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_set_get_regioncode(moal_private * priv, struct iwreq *wrq) @@ -2485,8 +2459,7 @@ woal_set_get_regioncode(moal_private * priv, struct iwreq *wrq) ret = -EFAULT; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2494,10 +2467,10 @@ done: /** * @brief Set/Get radio * - * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param priv A pointer to moal_private structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_set_get_radio(moal_private * priv, struct iwreq *wrq) @@ -2539,8 +2512,8 @@ done: /** * @brief Get/Set the bit mask of driver debug message control * - * @param priv A pointer to moal_private structure - * @param wrq A pointer to wrq structure + * @param priv A pointer to moal_private structure + * @param wrq A pointer to wrq structure * * @return 0 --success, otherwise fail */ @@ -2668,8 +2641,7 @@ woal_set_get_qos_cfg(moal_private * priv, struct iwreq *wrq) wrq->u.data.length = 1; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2677,10 +2649,10 @@ done: /** * @brief Set/Get WWS mode * - * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param priv A pointer to moal_private structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_wws_cfg(moal_private * priv, struct iwreq *wrq) @@ -2727,8 +2699,7 @@ woal_wws_cfg(moal_private * priv, struct iwreq *wrq) wrq->u.data.length = 1; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2793,8 +2764,7 @@ woal_sleep_pd(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2907,9 +2877,7 @@ woal_sleep_params_ioctl(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -2968,8 +2936,7 @@ woal_set_get_11h_local_pwr_constraint(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -3031,8 +2998,7 @@ woal_ht_stream_cfg_ioctl(moal_private * priv, struct iwreq *wrq) wrq->u.data.length = 1; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -3090,8 +3056,7 @@ woal_mac_control_ioctl(moal_private * priv, struct iwreq *wrq) wrq->u.data.length = 1; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -3144,8 +3109,7 @@ woal_thermal_ioctl(moal_private * priv, struct iwreq *wrq) wrq->u.data.length = 1; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -3208,7 +3172,7 @@ done: * @param priv Pointer to the moal_private driver data struct * @param wrq Pointer to user data * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_wmm_enable_ioctl(moal_private * priv, struct iwreq *wrq) @@ -3267,8 +3231,7 @@ woal_wmm_enable_ioctl(moal_private * priv, struct iwreq *wrq) wrq->u.data.length = 1; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -3337,9 +3300,7 @@ woal_11d_enable_ioctl(moal_private * priv, struct iwreq *wrq) wrq->u.data.length = 1; } done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -3379,9 +3340,7 @@ woal_11d_clr_chan_table(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -3392,7 +3351,7 @@ done: * @param priv Pointer to the moal_private driver data struct * @param wrq Pointer to user data * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_wps_cfg_ioctl(moal_private * priv, struct iwreq *wrq) @@ -3437,8 +3396,7 @@ woal_wps_cfg_ioctl(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -3446,10 +3404,10 @@ done: /** * @brief Set WPA passphrase and SSID * - * @param priv A pointer to moal_private structure - * @param wrq A pointer to user data + * @param priv A pointer to moal_private structure + * @param wrq A pointer to user data * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_passphrase(moal_private * priv, struct iwreq *wrq) @@ -3528,7 +3486,7 @@ woal_passphrase(moal_private * priv, struct iwreq *wrq) sec->param.passphrase.ssid.ssid, (int)sec->param.passphrase.ssid.ssid_len); } else if (!strnicmp(opt, "bssid", strlen(opt))) { - woal_mac2u8((t_u8 *) sec->param.passphrase.bssid, end); + woal_mac2u8(sec->param.passphrase.bssid, end); } else if (!strnicmp(opt, "psk", strlen(opt)) && req->action == MLAN_ACT_SET) { if (strlen(end) != MLAN_PMK_HEXSTR_LENGTH) { @@ -3603,7 +3561,7 @@ woal_passphrase(moal_private * priv, struct iwreq *wrq) len += sprintf(buf + len, "\n"); } if (sec->param.passphrase.psk_type == MLAN_PSK_PASSPHRASE) { - len += sprintf(buf + len, "passphrase:%s \n", + len += sprintf(buf + len, "passphrase:%s\n", sec->param.passphrase.psk.passphrase. passphrase); } @@ -3620,8 +3578,7 @@ woal_passphrase(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -3667,8 +3624,7 @@ woal_get_esupp_mode(moal_private * priv, struct iwreq *wrq) } wrq->u.data.length = 3; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -3678,10 +3634,10 @@ done: /** * @brief Adhoc AES control * - * @param priv A pointer to moal_private structure - * @param wrq A pointer to user data + * @param priv A pointer to moal_private structure + * @param wrq A pointer to user data * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_adhoc_aes_ioctl(moal_private * priv, struct iwreq *wrq) @@ -3759,7 +3715,7 @@ woal_adhoc_aes_ioctl(moal_private * priv, struct iwreq *wrq) tmp += sprintf((char *)tmp, "%02x", key_hex[i]); } else if (data_length >= 2) { /* Parse the buf to get the cmd_action */ - action = woal_atox((char *)buf); + action = woal_atox(buf); if (action < 1 || action > 2) { PRINTM(MERROR, "Invalid action argument %d\n", action); @@ -3832,9 +3788,7 @@ woal_adhoc_aes_ioctl(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -3842,9 +3796,9 @@ done: /** * @brief arpfilter ioctl function * - * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure - * @return 0 --success, otherwise fail + * @param priv A pointer to moal_private structure + * @param wrq A pointer to iwreq structure + * @return 0 --success, otherwise fail */ static int woal_arp_filter(moal_private * priv, struct iwreq *wrq) @@ -3885,8 +3839,7 @@ woal_arp_filter(moal_private * priv, struct iwreq *wrq) goto done; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -3973,8 +3926,7 @@ woal_set_get_ip_addr(moal_private * priv, struct iwreq *wrq) } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -4039,8 +3991,7 @@ woal_tx_bf_cap_ioctl(moal_private * priv, struct iwreq *wrq) wrq->u.data.length = 1; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -4441,9 +4392,8 @@ moal_ret_get_scan_table_ioctl(struct iwreq *wrq, &pcurrent, &space_left); - if (ret_code == MLAN_STATUS_SUCCESS) { + if (ret_code == MLAN_STATUS_SUCCESS) num_scans_done = 1; - } } else { scan_start--; @@ -4463,9 +4413,8 @@ moal_ret_get_scan_table_ioctl(struct iwreq *wrq, &pcurrent, &space_left); - if (ret_code == MLAN_STATUS_SUCCESS) { + if (ret_code == MLAN_STATUS_SUCCESS) num_scans_done++; - } } } @@ -4484,7 +4433,7 @@ moal_ret_get_scan_table_ioctl(struct iwreq *wrq, * @brief Get scan table ioctl * * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, otherwise fail */ @@ -4518,11 +4467,10 @@ woal_get_scan_table_ioctl(moal_private * priv, struct iwreq *wrq) ret = -EFAULT; goto done; } - if (scan_start) { + if (scan_start) scan->sub_command = MLAN_OID_SCAN_NORMAL; - } else { + else scan->sub_command = MLAN_OID_SCAN_GET_CURRENT_BSS; - } /* Send IOCTL request to MLAN */ status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); if (status == MLAN_STATUS_SUCCESS) { @@ -4531,7 +4479,7 @@ woal_get_scan_table_ioctl(moal_private * priv, struct iwreq *wrq) scan_start); } done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -4541,7 +4489,7 @@ done: * @brief Set user scan ext -- Async mode, without wait * * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * * @return 0 -- success, otherwise fail */ @@ -4569,7 +4517,7 @@ woal_set_user_scan_ext_ioctl(moal_private * priv, struct iwreq *wrq) * @brief Set user scan * * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, otherwise fail */ @@ -4628,7 +4576,7 @@ woal_set_user_scan_ioctl(moal_private * priv, struct iwreq *wrq) MOAL_REL_SEMAPHORE(&handle->async_sem); done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -4791,8 +4739,8 @@ woal_cmd53rdwr_ioctl(moal_private * priv, struct iwreq *wrq) ret = -EINVAL; goto done; } - PRINTM(MINFO, "CMD53 read/write, func = %d, addr = %#x, mode = %d, " - "block size = %d, block(byte) number = %d\n", + PRINTM(MINFO, + "CMD53 read/write, func = %d, addr = %#x, mode = %d, block size = %d, block(byte) number = %d\n", func, reg, mode, blklen, blknum); if (!rw) { @@ -4836,10 +4784,8 @@ woal_cmd53rdwr_ioctl(moal_private * priv, struct iwreq *wrq) } done: - if (buf) - kfree(buf); - if (data) - kfree(data); + kfree(buf); + kfree(data); LEAVE(); return ret; } @@ -4951,8 +4897,7 @@ woal_do_sdio_mpa_ctrl(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5046,8 +4991,7 @@ woal_set_get_scan_cfg(moal_private * priv, struct iwreq *wrq) wrq->u.data.length = ARRAY_SIZE(data); } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5183,8 +5127,7 @@ woal_set_get_ps_cfg(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5295,8 +5238,7 @@ woal_wmm_addts_req_ioctl(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5388,8 +5330,7 @@ woal_wmm_delts_req_ioctl(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5464,8 +5405,7 @@ woal_wmm_queue_config_ioctl(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5544,8 +5484,7 @@ woal_wmm_queue_stats_ioctl(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5610,8 +5549,7 @@ woal_wmm_queue_status_ioctl(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5682,8 +5620,7 @@ woal_wmm_ts_status_ioctl(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5743,9 +5680,9 @@ done: * @brief Set/Get auth type * * @param priv Pointer to the moal_private driver data struct - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_auth_type(moal_private * priv, struct iwreq *wrq) @@ -5799,9 +5736,9 @@ done: * @brief Set/Get Port Control mode * * @param priv Pointer to the moal_private driver data struct - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_port_ctrl(moal_private * priv, struct iwreq *wrq) @@ -5854,9 +5791,7 @@ woal_port_ctrl(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -5866,9 +5801,9 @@ done: * @brief Set/Get DFS Testing settings * * @param priv Pointer to the moal_private driver data struct - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_dfs_testing(moal_private * priv, struct iwreq *wrq) @@ -5954,9 +5889,7 @@ woal_dfs_testing(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -6024,8 +5957,7 @@ woal_mgmt_frame_passthru_ctrl(moal_private * priv, struct iwreq *wrq) wrq->u.data.length = 1; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -6105,9 +6037,7 @@ woal_cfp_code(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -6173,8 +6103,7 @@ woal_set_get_tx_rx_ant(moal_private * priv, struct iwreq *wrq) } } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -6185,11 +6114,11 @@ done: /** * @brief ioctl function - entry point * - * @param dev A pointer to net_device structure - * @param req A pointer to ifreq structure - * @param cmd Command + * @param dev A pointer to net_device structure + * @param req A pointer to ifreq structure + * @param cmd Command * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ int woal_wext_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) @@ -6592,7 +6521,7 @@ woal_get_data_rates(moal_private * priv, t_u8 wait_option, MLAN_SUPPORTED_RATES); } done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -6639,7 +6568,7 @@ woal_get_channel_list(moal_private * priv, t_u8 wait_option, } } done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -6648,10 +6577,10 @@ done: /** * @brief Handle get info resp * - * @param priv Pointer to moal_private structure - * @param info Pointer to mlan_ds_get_info structure + * @param priv Pointer to moal_private structure + * @param info Pointer to mlan_ds_get_info structure * - * @return N/A + * @return N/A */ void woal_ioctl_get_info_resp(moal_private * priv, mlan_ds_get_info * info) @@ -6680,10 +6609,10 @@ woal_ioctl_get_info_resp(moal_private * priv, mlan_ds_get_info * info) /** * @brief Handle get BSS resp * - * @param priv Pointer to moal_private structure - * @param bss Pointer to mlan_ds_bss structure + * @param priv Pointer to moal_private structure + * @param bss Pointer to mlan_ds_bss structure * - * @return N/A + * @return N/A */ void woal_ioctl_get_bss_resp(moal_private * priv, mlan_ds_bss * bss) diff --git a/drivers/net/wireless/sd8797/mlinux/moal_priv.h b/drivers/net/wireless/sd8797/mlinux/moal_priv.h index 83c364546dba..d7a988d43ca9 100644 --- a/drivers/net/wireless/sd8797/mlinux/moal_priv.h +++ b/drivers/net/wireless/sd8797/mlinux/moal_priv.h @@ -124,9 +124,9 @@ Change log: /** Private command ID to turn on/off radio */ #define WOAL_SET_RADIO 3 /** Private command ID to enable WMM */ -#define WOAL_WMM_ENABLE 4 +#define WOAL_WMM_ENABLE 4 /** Private command ID to enable 802.11D */ -#define WOAL_11D_ENABLE 5 +#define WOAL_11D_ENABLE 5 /** Private command ID to set/get QoS configuration */ #define WOAL_SET_GET_QOS_CFG 7 #if defined(REASSOCIATION) diff --git a/drivers/net/wireless/sd8797/mlinux/moal_proc.c b/drivers/net/wireless/sd8797/mlinux/moal_proc.c index 50fca54bb095..a44cc094c451 100644 --- a/drivers/net/wireless/sd8797/mlinux/moal_proc.c +++ b/drivers/net/wireless/sd8797/mlinux/moal_proc.c @@ -66,10 +66,10 @@ extern int drv_mode; /** * @brief Proc read function for info * - * @param sfp pointer to seq_file structure + * @param sfp pointer to seq_file structure * @param data * - * @return Number of output data + * @return Number of output data */ static int woal_info_proc_read(struct seq_file *sfp, void *data) @@ -284,15 +284,15 @@ static const struct file_operations info_proc_fops = { /* * @brief Parse cmd52 string * - * @param buffer A pointer user buffer - * @param len Length user buffer - * @param func Parsed func number - * @param reg Parsed reg value - * @param val Parsed value to set - * @return BT_STATUS_SUCCESS + * @param buffer A pointer user buffer + * @param len Length user buffer + * @param func Parsed func number + * @param reg Parsed reg value + * @param val Parsed value to set + * @return BT_STATUS_SUCCESS */ static int -parse_cmd52_string(const char __user * buffer, size_t len, int *func, int *reg, +parse_cmd52_string(const char *buffer, size_t len, int *func, int *reg, int *val) { int ret = MLAN_STATUS_SUCCESS; @@ -302,6 +302,9 @@ parse_cmd52_string(const char __user * buffer, size_t len, int *func, int *reg, ENTER(); string = (char *)kmalloc(CMD52_STR_LEN, GFP_KERNEL); + if (string == NULL) + return -ENOMEM; + memset(string, 0, CMD52_STR_LEN); memcpy(string, buffer + strlen("sdcmd52rw="), MIN((CMD52_STR_LEN - 1), (len - strlen("sdcmd52rw=")))); @@ -313,23 +316,19 @@ parse_cmd52_string(const char __user * buffer, size_t len, int *func, int *reg, /* Get func */ pos = strsep(&string, " \t"); - if (pos) { + if (pos) *func = woal_string_to_number(pos); - } /* Get reg */ pos = strsep(&string, " \t"); - if (pos) { + if (pos) *reg = woal_string_to_number(pos); - } /* Get val (optional) */ pos = strsep(&string, " \t"); - if (pos) { + if (pos) *val = woal_string_to_number(pos); - } - if (string) - kfree(string); + kfree(string); LEAVE(); return ret; } @@ -337,12 +336,12 @@ parse_cmd52_string(const char __user * buffer, size_t len, int *func, int *reg, /** * @brief config proc write function * - * @param f file pointer - * @param buf pointer to data buffer - * @param count data number to write - * @param off Offset + * @param f file pointer + * @param buf pointer to data buffer + * @param count data number to write + * @param off Offset * - * @return number of data + * @return number of data */ static ssize_t woal_config_write(struct file *f, const char __user * buf, size_t count, @@ -381,11 +380,10 @@ woal_config_write(struct file *f, const char __user * buf, size_t count, line += strlen("soft_reset") + 1; config_data = (t_u32) woal_string_to_number(line); PRINTM(MINFO, "soft_reset: %d\n", (int)config_data); - if (woal_request_soft_reset(handle) == MLAN_STATUS_SUCCESS) { + if (woal_request_soft_reset(handle) == MLAN_STATUS_SUCCESS) handle->hardware_status = HardwareStatusReset; - } else { + else PRINTM(MERROR, "Could not perform soft reset\n"); - } } if (!strncmp(databuf, "drv_mode", strlen("drv_mode"))) { line += strlen("drv_mode") + 1; @@ -399,8 +397,8 @@ woal_config_write(struct file *f, const char __user * buf, size_t count, } if (!strncmp(databuf, "sdcmd52rw=", strlen("sdcmd52rw=")) && count > strlen("sdcmd52rw=")) { - parse_cmd52_string((const char __user *)databuf, (size_t) count, - &func, ®, &val); + parse_cmd52_string((const char *)databuf, (size_t) count, &func, + ®, &val); woal_sdio_read_write_cmd52(handle, func, reg, val); } if (!strncmp(databuf, "debug_dump", strlen("debug_dump"))) { @@ -421,10 +419,10 @@ woal_config_write(struct file *f, const char __user * buf, size_t count, /** * @brief config proc read function * - * @param sfp pointer to seq_file structure + * @param sfp pointer to seq_file structure * @param data * - * @return number of output data + * @return number of output data */ static int woal_config_read(struct seq_file *sfp, void *data) @@ -474,9 +472,9 @@ static const struct file_operations config_proc_fops = { /** * @brief Convert string to number * - * @param s Pointer to numbered string + * @param s Pointer to numbered string * - * @return Converted number from string s + * @return Converted number from string s */ int woal_string_to_number(char *s) @@ -514,7 +512,7 @@ woal_string_to_number(char *s) * * @param handle Pointer to woal_handle * - * @return N/A + * @return N/A */ void woal_proc_init(moal_handle * handle) @@ -594,9 +592,9 @@ woal_proc_init(moal_handle * handle) /** * @brief Remove the top level proc directory * - * @param handle pointer moal_handle + * @param handle pointer moal_handle * - * @return N/A + * @return N/A */ void woal_proc_exit(moal_handle * handle) @@ -638,9 +636,9 @@ woal_proc_exit(moal_handle * handle) /** * @brief Create proc file for interface * - * @param priv pointer moal_private + * @param priv pointer moal_private * - * @return N/A + * @return N/A */ void woal_create_proc_entry(moal_private * priv) @@ -718,9 +716,9 @@ woal_create_proc_entry(moal_private * priv) /** * @brief Remove proc file * - * @param priv Pointer moal_private + * @param priv Pointer moal_private * - * @return N/A + * @return N/A */ void woal_proc_remove(moal_private * priv) diff --git a/drivers/net/wireless/sd8797/mlinux/moal_sdio.h b/drivers/net/wireless/sd8797/mlinux/moal_sdio.h index 3f8b15b7d692..7a158dd77d72 100644 --- a/drivers/net/wireless/sd8797/mlinux/moal_sdio.h +++ b/drivers/net/wireless/sd8797/mlinux/moal_sdio.h @@ -53,7 +53,6 @@ Change log: /** Default firmware name */ #define DEFAULT_FW_NAME "mrvl/sd8797_uapsta.bin" -#define DEFAULT_FW_NAME_8782 "mrvl/sd8782_uapsta.bin" #ifndef DEFAULT_FW_NAME #define DEFAULT_FW_NAME "" @@ -64,7 +63,6 @@ Change log: /** Default firmware name */ #define DEFAULT_AP_FW_NAME "mrvl/sd8797_uapsta.bin" -#define DEFAULT_AP_FW_NAME_8782 "mrvl/sd8782_uapsta.bin" #ifndef DEFAULT_AP_FW_NAME #define DEFAULT_AP_FW_NAME "" @@ -74,7 +72,6 @@ Change log: /** Default firmaware name */ #define DEFAULT_AP_STA_FW_NAME "mrvl/sd8797_uapsta.bin" -#define DEFAULT_AP_STA_FW_NAME_8782 "mrvl/sd8782_uapsta.bin" #ifndef DEFAULT_AP_STA_FW_NAME #define DEFAULT_AP_STA_FW_NAME "" @@ -83,8 +80,6 @@ Change log: /******************************************************** Global Functions ********************************************************/ -/** Function to update the SDIO card type */ -t_void woal_sdio_update_card_type(moal_handle * handle, t_void * card); /** Function to write register */ mlan_status woal_write_reg(moal_handle * handle, t_u32 reg, t_u32 data); diff --git a/drivers/net/wireless/sd8797/mlinux/moal_sdio_mmc.c b/drivers/net/wireless/sd8797/mlinux/moal_sdio_mmc.c index c64990489513..81947ae4bd0e 100644 --- a/drivers/net/wireless/sd8797/mlinux/moal_sdio_mmc.c +++ b/drivers/net/wireless/sd8797/mlinux/moal_sdio_mmc.c @@ -43,17 +43,15 @@ Change log: #ifdef SDIO_SUSPEND_RESUME /** PM keep power */ extern int pm_keep_power; +extern int shutdown_hs; #endif /** Device ID for SD8797 */ #define SD_DEVICE_ID_8797 (0x9129) -/** Device ID for SD8782 */ -#define SD_DEVICE_ID_8782 (0x9121) /** WLAN IDs */ static const struct sdio_device_id wlan_ids[] = { {SDIO_DEVICE(MARVELL_VENDOR_ID, SD_DEVICE_ID_8797)}, - {SDIO_DEVICE(MARVELL_VENDOR_ID, SD_DEVICE_ID_8782)}, {}, }; @@ -71,6 +69,8 @@ static struct dev_pm_ops wlan_sdio_pm_ops = { .suspend = woal_sdio_suspend, .resume = woal_sdio_resume, }; + +void woal_sdio_shutdown(struct device *dev); #endif #endif static struct sdio_driver REFDATA wlan_sdio = { @@ -84,14 +84,17 @@ static struct sdio_driver REFDATA wlan_sdio = { #ifdef SDIO_SUSPEND_RESUME #ifdef MMC_PM_KEEP_POWER .pm = &wlan_sdio_pm_ops, + .shutdown = woal_sdio_shutdown, #endif #endif + } #else #ifdef SDIO_SUSPEND_RESUME #ifdef MMC_PM_KEEP_POWER .drv = { .pm = &wlan_sdio_pm_ops, + .shutdown = woal_sdio_shutdown, } #endif #endif @@ -103,8 +106,8 @@ static struct sdio_driver REFDATA wlan_sdio = { ********************************************************/ /** @brief This function dump the sdio register * - * @param handle A Pointer to the moal_handle structure - * @return N/A + * @param handle A Pointer to the moal_handle structure + * @return N/A */ void woal_dump_sdio_reg(moal_handle * handle) @@ -133,30 +136,12 @@ woal_dump_sdio_reg(moal_handle * handle) /******************************************************** Global Functions ********************************************************/ -/** @brief This function updates the SDIO card types - * - * @param handle A Pointer to the moal_handle structure - * @param card A Pointer to card - * - * @return N/A - */ -t_void -woal_sdio_update_card_type(moal_handle * handle, t_void * card) -{ - struct sdio_mmc_card *cardp = (struct sdio_mmc_card *)card; - - /* Update card type */ - if (cardp->func->device == SD_DEVICE_ID_8797) - handle->card_type = CARD_TYPE_SD8797; - else if (cardp->func->device == SD_DEVICE_ID_8782) - handle->card_type = CARD_TYPE_SD8782; -} /** * @brief This function handles the interrupt. * - * @param func A pointer to the sdio_func structure - * @return N/A + * @param func A pointer to the sdio_func structure + * @return N/A */ static void woal_sdio_interrupt(struct sdio_func *func) @@ -184,9 +169,9 @@ woal_sdio_interrupt(struct sdio_func *func) /** @brief This function handles client driver probe. * - * @param func A pointer to sdio_func structure. - * @param id A pointer to sdio_device_id structure. - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE/error code + * @param func A pointer to sdio_func structure. + * @param id A pointer to sdio_device_id structure. + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE/error code */ int woal_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) @@ -246,8 +231,8 @@ woal_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) /** @brief This function handles client driver remove. * - * @param func A pointer to sdio_func structure. - * @return N/A + * @param func A pointer to sdio_func structure. + * @return N/A */ void woal_sdio_remove(struct sdio_func *func) @@ -274,8 +259,8 @@ woal_sdio_remove(struct sdio_func *func) #ifdef MMC_PM_FUNC_SUSPENDED /** @brief This function tells lower driver that WLAN is suspended * - * @param handle A Pointer to the moal_handle structure - * @return N/A + * @param handle A Pointer to the moal_handle structure + * @return N/A */ void woal_wlan_is_suspended(moal_handle * handle) @@ -290,10 +275,82 @@ woal_wlan_is_suspended(moal_handle * handle) } #endif +#define SHUTDOWN_HOST_SLEEP_DEF_GAP 100 +#define SHUTDOWN_HOST_SLEEP_DEF_GPIO 0x3 +#define SHUTDOWN_HOST_SLEEP_DEF_COND 0x0 + +/** @brief This function handles client driver shutdown + * + * @param dev A pointer to device structure + * @return N/A + */ +void +woal_sdio_shutdown(struct device *dev) +{ + struct sdio_func *func = dev_to_sdio_func(dev); + moal_handle *handle = NULL; + struct sdio_mmc_card *cardp; + mlan_ds_hs_cfg hscfg; + int timeout = 0; + int i; + + ENTER(); + PRINTM(MCMND, "<--- Enter woal_sdio_shutdown --->\n"); + cardp = sdio_get_drvdata(func); + if (!cardp || !cardp->handle) { + PRINTM(MERROR, "Card or moal_handle structure is not valid\n"); + LEAVE(); + return; + } + handle = cardp->handle; + for (i = 0; i < handle->priv_num; i++) + netif_device_detach(handle->priv[i]->netdev); + if (shutdown_hs) { + memset(&hscfg, 0, sizeof(mlan_ds_hs_cfg)); + hscfg.is_invoke_hostcmd = MFALSE; + hscfg.conditions = SHUTDOWN_HOST_SLEEP_DEF_COND; + hscfg.gap = SHUTDOWN_HOST_SLEEP_DEF_GAP; + hscfg.gpio = SHUTDOWN_HOST_SLEEP_DEF_GPIO; + if (woal_set_get_hs_params + (woal_get_priv(handle, MLAN_BSS_ROLE_ANY), MLAN_ACT_SET, + MOAL_IOCTL_WAIT, &hscfg) == MLAN_STATUS_FAILURE) { + PRINTM(MERROR, + "Fail to set HS parameter in shutdown: 0x%x 0x%x 0x%x\n", + hscfg.conditions, hscfg.gap, hscfg.gpio); + goto done; + } + /* Enable Host Sleep */ + handle->hs_activate_wait_q_woken = MFALSE; + memset(&hscfg, 0, sizeof(mlan_ds_hs_cfg)); + hscfg.is_invoke_hostcmd = MTRUE; + if (woal_set_get_hs_params + (woal_get_priv(handle, MLAN_BSS_ROLE_ANY), MLAN_ACT_SET, + MOAL_NO_WAIT, &hscfg) == MLAN_STATUS_FAILURE) { + PRINTM(MERROR, + "Request HS enable failed in shutdown\n"); + goto done; + } + timeout = + wait_event_interruptible_timeout(handle-> + hs_activate_wait_q, + handle-> + hs_activate_wait_q_woken, + HS_ACTIVE_TIMEOUT); + if (handle->hs_activated == MTRUE) + PRINTM(MMSG, "HS actived in shutdown\n"); + else + PRINTM(MMSG, "Fail to enable HS in shutdown\n"); + } +done: + PRINTM(MCMND, "<--- Leave woal_sdio_shutdown --->\n"); + LEAVE(); + return; +} + /** @brief This function handles client driver suspend * - * @param dev A pointer to device structure - * @return MLAN_STATUS_SUCCESS or error code + * @param dev A pointer to device structure + * @return MLAN_STATUS_SUCCESS or error code */ int woal_sdio_suspend(struct device *dev) @@ -360,8 +417,8 @@ woal_sdio_suspend(struct device *dev) #endif if (hs_actived) { #ifdef MMC_PM_SKIP_RESUME_PROBE - PRINTM(MCMND, "suspend with MMC_PM_KEEP_POWER and " - "MMC_PM_SKIP_RESUME_PROBE\n"); + PRINTM(MCMND, + "suspend with MMC_PM_KEEP_POWER and MMC_PM_SKIP_RESUME_PROBE\n"); ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER | MMC_PM_SKIP_RESUME_PROBE); #else @@ -389,8 +446,8 @@ done: /** @brief This function handles client driver resume * - * @param dev A pointer to device structure - * @return MLAN_STATUS_SUCCESS + * @param dev A pointer to device structure + * @return MLAN_STATUS_SUCCESS */ int woal_sdio_resume(struct device *dev) @@ -441,7 +498,7 @@ woal_sdio_resume(struct device *dev) * @param reg Register offset * @param data Value * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status woal_write_reg(moal_handle * handle, t_u32 reg, t_u32 data) @@ -465,7 +522,7 @@ woal_write_reg(moal_handle * handle, t_u32 reg, t_u32 data) * @param reg Register offset * @param data Value * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status woal_read_reg(moal_handle * handle, t_u32 reg, t_u32 * data) @@ -489,11 +546,11 @@ woal_read_reg(moal_handle * handle, t_u32 reg, t_u32 * data) * @brief This function writes multiple bytes into card memory * * @param handle A Pointer to the moal_handle structure - * @param pmbuf Pointer to mlan_buffer structure - * @param port Port - * @param timeout Time out value + * @param pmbuf Pointer to mlan_buffer structure + * @param port Port + * @param timeout Time out value * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status woal_write_data_sync(moal_handle * handle, mlan_buffer * pmbuf, t_u32 port, @@ -532,11 +589,11 @@ woal_write_data_sync(moal_handle * handle, mlan_buffer * pmbuf, t_u32 port, * @brief This function reads multiple bytes from card memory * * @param handle A Pointer to the moal_handle structure - * @param pmbuf Pointer to mlan_buffer structure - * @param port Port - * @param timeout Time out value + * @param pmbuf Pointer to mlan_buffer structure + * @param port Port + * @param timeout Time out value * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status woal_read_data_sync(moal_handle * handle, mlan_buffer * pmbuf, t_u32 port, @@ -599,7 +656,7 @@ woal_bus_register(void) /** * @brief This function de-registers the IF module in bus driver * - * @return N/A + * @return N/A */ void woal_bus_unregister(void) @@ -616,7 +673,7 @@ woal_bus_unregister(void) * @brief This function de-registers the device * * @param handle A pointer to moal_handle structure - * @return N/A + * @return N/A */ void woal_unregister_dev(moal_handle * handle) @@ -642,7 +699,7 @@ woal_unregister_dev(moal_handle * handle) * @brief This function registers the device * * @param handle A pointer to moal_handle structure - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status woal_register_dev(moal_handle * handle) @@ -692,9 +749,9 @@ release_host: /** * @brief This function set bus clock on/off * - * @param handle A pointer to moal_handle structure - * @param option TRUE--on , FALSE--off - * @return MLAN_STATUS_SUCCESS + * @param handle A pointer to moal_handle structure + * @param option TRUE--on , FALSE--off + * @return MLAN_STATUS_SUCCESS */ int woal_sdio_set_bus_clock(moal_handle * handle, t_u8 option) @@ -722,11 +779,11 @@ woal_sdio_set_bus_clock(moal_handle * handle, t_u8 option) /** * @brief This function updates card reg based on the Cmd52 value in dev structure * - * @param handle A pointer to moal_handle structure - * @param func A pointer to store func variable - * @param reg A pointer to store reg variable - * @param val A pointer to store val variable - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @param handle A pointer to moal_handle structure + * @param func A pointer to store func variable + * @param reg A pointer to store reg variable + * @param val A pointer to store val variable + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ int woal_sdio_read_write_cmd52(moal_handle * handle, int func, int reg, int val) diff --git a/drivers/net/wireless/sd8797/mlinux/moal_shim.c b/drivers/net/wireless/sd8797/mlinux/moal_shim.c index 8f60e0368499..8ecfb217550f 100644 --- a/drivers/net/wireless/sd8797/mlinux/moal_shim.c +++ b/drivers/net/wireless/sd8797/mlinux/moal_shim.c @@ -61,11 +61,11 @@ extern int hw_test; * @brief Alloc a buffer * * @param pmoal_handle Pointer to the MOAL context - * @param size The size of the buffer to be allocated - * @param flag The type of the buffer to be allocated - * @param ppbuf Pointer to a buffer location to store buffer pointer allocated + * @param size The size of the buffer to be allocated + * @param flag The type of the buffer to be allocated + * @param ppbuf Pointer to a buffer location to store buffer pointer allocated * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_malloc(IN t_void * pmoal_handle, @@ -82,7 +82,7 @@ moal_malloc(IN t_void * pmoal_handle, *ppbuf = kmalloc(size, mem_flag); if (*ppbuf == NULL) { PRINTM(MERROR, "%s: allocate memory (%d bytes) failed!\n", - __FUNCTION__, (int)size); + __func__, (int)size); return MLAN_STATUS_FAILURE; } atomic_inc(&handle->malloc_count); @@ -94,9 +94,9 @@ moal_malloc(IN t_void * pmoal_handle, * @brief Free a buffer * * @param pmoal_handle Pointer to the MOAL context - * @param pbuf Pointer to the buffer to be freed + * @param pbuf Pointer to the buffer to be freed * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_mfree(IN t_void * pmoal_handle, IN t_u8 * pbuf) @@ -114,10 +114,10 @@ moal_mfree(IN t_void * pmoal_handle, IN t_u8 * pbuf) * @brief Alloc a vitual-address-continuous buffer * * @param pmoal_handle Pointer to the MOAL context - * @param size The size of the buffer to be allocated - * @param ppbuf Pointer to a buffer location to store buffer pointer allocated + * @param size The size of the buffer to be allocated + * @param ppbuf Pointer to a buffer location to store buffer pointer allocated * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_vmalloc(IN t_void * pmoal_handle, IN t_u32 size, OUT t_u8 ** ppbuf) @@ -126,7 +126,7 @@ moal_vmalloc(IN t_void * pmoal_handle, IN t_u32 size, OUT t_u8 ** ppbuf) *ppbuf = vmalloc(size); if (*ppbuf == NULL) { - PRINTM(MERROR, "%s: vmalloc (%d bytes) failed!", __FUNCTION__, + PRINTM(MERROR, "%s: vmalloc (%d bytes) failed!", __func__, (int)size); return MLAN_STATUS_FAILURE; } @@ -139,9 +139,9 @@ moal_vmalloc(IN t_void * pmoal_handle, IN t_u32 size, OUT t_u8 ** ppbuf) * @brief Free a buffer allocated by vmalloc * * @param pmoal_handle Pointer to the MOAL context - * @param pbuf Pointer to the buffer to be freed + * @param pbuf Pointer to the buffer to be freed * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_vfree(IN t_void * pmoal_handle, IN t_u8 * pbuf) @@ -159,11 +159,11 @@ moal_vfree(IN t_void * pmoal_handle, IN t_u8 * pbuf) * @brief Fill memory with constant byte * * @param pmoal_handle Pointer to the MOAL context - * @param pmem Pointer to the memory area - * @param byte A constant byte - * @param num Number of bytes to fill + * @param pmem Pointer to the memory area + * @param byte A constant byte + * @param num Number of bytes to fill * - * @return Pointer to the memory area + * @return Pointer to the memory area */ t_void * moal_memset(IN t_void * pmoal_handle, @@ -181,11 +181,11 @@ moal_memset(IN t_void * pmoal_handle, * @brief Copy memory from one area to another * * @param pmoal_handle Pointer to the MOAL context - * @param pdest Pointer to the dest memory - * @param psrc Pointer to the src memory - * @param num Number of bytes to move + * @param pdest Pointer to the dest memory + * @param psrc Pointer to the src memory + * @param num Number of bytes to move * - * @return Pointer to the dest memory + * @return Pointer to the dest memory */ t_void * moal_memcpy(IN t_void * pmoal_handle, @@ -203,11 +203,11 @@ moal_memcpy(IN t_void * pmoal_handle, * @brief Move memory from one area to another * * @param pmoal_handle Pointer to the MOAL context - * @param pdest Pointer to the dest memory - * @param psrc Pointer to the src memory - * @param num Number of bytes to move + * @param pdest Pointer to the dest memory + * @param psrc Pointer to the src memory + * @param num Number of bytes to move * - * @return Pointer to the dest memory + * @return Pointer to the dest memory */ t_void * moal_memmove(IN t_void * pmoal_handle, @@ -225,11 +225,11 @@ moal_memmove(IN t_void * pmoal_handle, * @brief Compare two memory areas * * @param pmoal_handle Pointer to the MOAL context - * @param pmem1 Pointer to the first memory - * @param pmem2 Pointer to the second memory - * @param num Number of bytes to compare + * @param pmem1 Pointer to the first memory + * @param pmem2 Pointer to the second memory + * @param num Number of bytes to compare * - * @return Compare result returns by memcmp + * @return Compare result returns by memcmp */ t_s32 moal_memcmp(IN t_void * pmoal_handle, @@ -263,10 +263,10 @@ moal_udelay(IN t_void * pmoal_handle, IN t_u32 delay) * @brief Retrieves the current system time * * @param pmoal_handle Pointer to the MOAL context - * @param psec Pointer to buf for the seconds of system time - * @param pusec Pointer to buf the micro seconds of system time + * @param psec Pointer to buf for the seconds of system time + * @param pusec Pointer to buf the micro seconds of system time * - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ mlan_status moal_get_system_time(IN t_void * pmoal_handle, @@ -285,11 +285,11 @@ moal_get_system_time(IN t_void * pmoal_handle, * @brief Initializes the timer * * @param pmoal_handle Pointer to the MOAL context - * @param pptimer Pointer to the timer - * @param callback Pointer to callback function - * @param pcontext Pointer to context + * @param pptimer Pointer to the timer + * @param callback Pointer to callback function + * @param pcontext Pointer to context * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_init_timer(IN t_void * pmoal_handle, @@ -311,9 +311,9 @@ moal_init_timer(IN t_void * pmoal_handle, * @brief Free the timer * * @param pmoal_handle Pointer to the MOAL context - * @param ptimer Pointer to the timer + * @param ptimer Pointer to the timer * - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ mlan_status moal_free_timer(IN t_void * pmoal_handle, IN t_void * ptimer) @@ -336,11 +336,11 @@ moal_free_timer(IN t_void * pmoal_handle, IN t_void * ptimer) * @brief Start the timer * * @param pmoal_handle Pointer to the MOAL context - * @param ptimer Pointer to the timer + * @param ptimer Pointer to the timer * @param periodic Periodic timer - * @param msec Timer value in milliseconds + * @param msec Timer value in milliseconds * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_start_timer(IN t_void * pmoal_handle, @@ -359,9 +359,9 @@ moal_start_timer(IN t_void * pmoal_handle, * @brief Stop the timer * * @param pmoal_handle Pointer to the MOAL context - * @param ptimer Pointer to the timer + * @param ptimer Pointer to the timer * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_stop_timer(IN t_void * pmoal_handle, IN t_void * ptimer) @@ -377,9 +377,9 @@ moal_stop_timer(IN t_void * pmoal_handle, IN t_void * ptimer) * @brief Initializes the lock * * @param pmoal_handle Pointer to the MOAL context - * @param pplock Pointer to the lock + * @param pplock Pointer to the lock * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_init_lock(IN t_void * pmoal_handle, OUT t_void ** pplock) @@ -402,9 +402,9 @@ moal_init_lock(IN t_void * pmoal_handle, OUT t_void ** pplock) * @brief Free the lock * * @param pmoal_handle Pointer to the MOAL context - * @param plock Lock + * @param plock Lock * - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ mlan_status moal_free_lock(IN t_void * pmoal_handle, IN t_void * plock) @@ -412,10 +412,9 @@ moal_free_lock(IN t_void * pmoal_handle, IN t_void * plock) moal_handle *handle = (moal_handle *) pmoal_handle; moal_lock *mlock = plock; - if (mlock) { - kfree(mlock); + kfree(mlock); + if (mlock) atomic_dec(&handle->lock_count); - } return MLAN_STATUS_SUCCESS; } @@ -424,9 +423,9 @@ moal_free_lock(IN t_void * pmoal_handle, IN t_void * plock) * @brief Request a spin lock * * @param pmoal_handle Pointer to the MOAL context - * @param plock Pointer to the lock + * @param plock Pointer to the lock * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_spin_lock(IN t_void * pmoal_handle, IN t_void * plock) @@ -447,9 +446,9 @@ moal_spin_lock(IN t_void * pmoal_handle, IN t_void * plock) * @brief Request a spin_unlock * * @param pmoal_handle Pointer to the MOAL context - * @param plock Pointer to the lock + * @param plock Pointer to the lock * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_spin_unlock(IN t_void * pmoal_handle, IN t_void * plock) @@ -496,9 +495,9 @@ moal_get_fw_data(IN t_void * pmoal_handle, * @brief This function is called when MLAN completes the initialization firmware. * * @param pmoal_handle Pointer to the MOAL context - * @param status The status code for mlan_init_fw request + * @param status The status code for mlan_init_fw request * - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ mlan_status moal_init_fw_complete(IN t_void * pmoal_handle, IN mlan_status status) @@ -517,9 +516,9 @@ moal_init_fw_complete(IN t_void * pmoal_handle, IN mlan_status status) * @brief This function is called when MLAN shutdown firmware is completed. * * @param pmoal_handle Pointer to the MOAL context - * @param status The status code for mlan_shutdown request + * @param status The status code for mlan_shutdown request * - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ mlan_status moal_shutdown_fw_complete(IN t_void * pmoal_handle, IN mlan_status status) @@ -538,9 +537,9 @@ moal_shutdown_fw_complete(IN t_void * pmoal_handle, IN mlan_status status) * * @param pmoal_handle Pointer to the MOAL context * @param pioctl_req pointer to structure mlan_ioctl_req - * @param status The status code for mlan_ioctl request + * @param status The status code for mlan_ioctl request * - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ mlan_status moal_ioctl_complete(IN t_void * pmoal_handle, @@ -599,10 +598,10 @@ moal_ioctl_complete(IN t_void * pmoal_handle, * @brief This function allocates mlan_buffer. * * @param pmoal_handle Pointer to the MOAL context - * @param size allocation size requested - * @param pmbuf pointer to pointer to the allocated buffer + * @param size allocation size requested + * @param pmbuf pointer to pointer to the allocated buffer * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_alloc_mlan_buffer(IN t_void * pmoal_handle, @@ -618,9 +617,9 @@ moal_alloc_mlan_buffer(IN t_void * pmoal_handle, * @brief This function frees mlan_buffer. * * @param pmoal_handle Pointer to the MOAL context - * @param pmbuf pointer to buffer to be freed + * @param pmbuf pointer to buffer to be freed * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_free_mlan_buffer(IN t_void * pmoal_handle, IN pmlan_buffer pmbuf) @@ -635,10 +634,10 @@ moal_free_mlan_buffer(IN t_void * pmoal_handle, IN pmlan_buffer pmbuf) * @brief This function is called when MLAN complete send data packet. * * @param pmoal_handle Pointer to the MOAL context - * @param pmbuf Pointer to the mlan buffer structure - * @param status The status code for mlan_send_packet request + * @param pmbuf Pointer to the mlan buffer structure + * @param status The status code for mlan_send_packet request * - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ mlan_status moal_send_packet_complete(IN t_void * pmoal_handle, @@ -648,7 +647,6 @@ moal_send_packet_complete(IN t_void * pmoal_handle, moal_handle *handle = (moal_handle *) pmoal_handle; struct sk_buff *skb = NULL; #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) - t_u32 tid = 0; t_u32 index = 0; #endif @@ -672,11 +670,7 @@ moal_send_packet_complete(IN t_void * pmoal_handle, priv->stats.tx_errors++; } #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) - tid = pmbuf->priority; - index = mlan_select_wmm_queue(priv->phandle-> - pmlan_adapter, - priv->bss_index, - tid); + index = skb_get_queue_mapping(skb); atomic_dec(&handle->tx_pending); if (atomic_dec_return (&priv->wmm_tx_pending[index]) < @@ -740,11 +734,11 @@ moal_send_packet_complete(IN t_void * pmoal_handle, * This function blocks the call until it finishes * * @param pmoal_handle Pointer to the MOAL context - * @param pmbuf Pointer to the mlan buffer structure - * @param port Port number for sent - * @param timeout Timeout value in milliseconds (if 0 the wait is forever) + * @param pmbuf Pointer to the mlan buffer structure + * @param port Port number for sent + * @param timeout Timeout value in milliseconds (if 0 the wait is forever) * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_write_data_sync(IN t_void * pmoal_handle, @@ -759,11 +753,11 @@ moal_write_data_sync(IN t_void * pmoal_handle, * This function blocks the call until it finish * * @param pmoal_handle Pointer to the MOAL context - * @param pmbuf Pointer to the mlan buffer structure - * @param port Port number for read - * @param timeout Timeout value in milliseconds (if 0 the wait is forever) + * @param pmbuf Pointer to the mlan buffer structure + * @param port Port number for read + * @param timeout Timeout value in milliseconds (if 0 the wait is forever) * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_read_data_sync(IN t_void * pmoal_handle, @@ -780,7 +774,7 @@ moal_read_data_sync(IN t_void * pmoal_handle, * @param reg register offset * @param data value * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_write_reg(IN t_void * pmoal_handle, IN t_u32 reg, IN t_u32 data) @@ -795,7 +789,7 @@ moal_write_reg(IN t_void * pmoal_handle, IN t_u32 reg, IN t_u32 data) * @param reg register offset * @param data value * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_read_reg(IN t_void * pmoal_handle, IN t_u32 reg, OUT t_u32 * data) @@ -807,9 +801,9 @@ moal_read_reg(IN t_void * pmoal_handle, IN t_u32 reg, OUT t_u32 * data) * @brief This function uploads the packet to the network stack * * @param pmoal_handle Pointer to the MOAL context - * @param pmbuf Pointer to the mlan buffer structure + * @param pmbuf Pointer to the mlan buffer structure * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_recv_packet(IN t_void * pmoal_handle, IN pmlan_buffer pmbuf) @@ -830,12 +824,12 @@ moal_recv_packet(IN t_void * pmoal_handle, IN pmlan_buffer pmbuf) pmbuf->data_offset = pmbuf->data_len = 0; } else { PRINTM(MERROR, "%s without skb attach!!!\n", - __FUNCTION__); + __func__); skb = dev_alloc_skb(pmbuf->data_len + MLAN_NET_IP_ALIGN); if (!skb) { PRINTM(MERROR, "%s fail to alloc skb\n", - __FUNCTION__); + __func__); status = MLAN_STATUS_FAILURE; priv->stats.rx_dropped++; goto done; @@ -868,9 +862,9 @@ done: * @brief This function handles event receive * * @param pmoal_handle Pointer to the MOAL context - * @param pmevent Pointer to the mlan event structure + * @param pmevent Pointer to the mlan event structure * - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ mlan_status moal_recv_event(IN t_void * pmoal_handle, IN pmlan_event pmevent) @@ -895,15 +889,16 @@ moal_recv_event(IN t_void * pmoal_handle, IN pmlan_event pmevent) ENTER(); - if (pmevent->event_id != MLAN_EVENT_ID_DRV_DEFER_RX_WORK) + if ((pmevent->event_id != MLAN_EVENT_ID_DRV_DEFER_RX_WORK) && + (pmevent->event_id != MLAN_EVENT_ID_DRV_DEFER_HANDLING)) PRINTM(MEVENT, "event id:0x%x\n", pmevent->event_id); priv = woal_bss_index_to_priv(pmoal_handle, pmevent->bss_index); if (priv == NULL) { - PRINTM(MERROR, "%s: priv is null\n", __FUNCTION__); + PRINTM(MERROR, "%s: priv is null\n", __func__); goto done; } if (priv->netdev == NULL) { - PRINTM(MERROR, "%s: netdev is null\n", __FUNCTION__); + PRINTM(MERROR, "%s: netdev is null\n", __func__); goto done; } switch (pmevent->event_id) { @@ -1737,6 +1732,9 @@ moal_recv_event(IN t_void * pmoal_handle, IN pmlan_event pmevent) sizeof(pmevent-> event_id) - MLAN_MAC_ADDR_LENGTH, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) + 0, +#endif GFP_ATOMIC); #else cfg80211_rx_mgmt(priv->netdev, freq, @@ -1793,8 +1791,8 @@ moal_recv_event(IN t_void * pmoal_handle, IN pmlan_event pmevent) /* Clear flag */ priv->phandle->delay_bss_start = MFALSE; - PRINTM(MMSG, "Now CAC measure period end. " - "Execute delayed BSS Start command.\n"); + PRINTM(MMSG, + "Now CAC measure period end. Execute delayed BSS Start command.\n"); req = woal_alloc_mlan_ioctl_req(sizeof (mlan_ds_bss)); @@ -1822,6 +1820,21 @@ moal_recv_event(IN t_void * pmoal_handle, IN pmlan_event pmevent) } } break; + case MLAN_EVENT_ID_DRV_TDLS_TEARDOWN_REQ: +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) +#ifdef STA_CFG80211 + if (IS_STA_CFG80211(cfg80211_wext)) { + tdls_tear_down_event *tdls_event = + (tdls_tear_down_event *) pmevent->event_buf; + cfg80211_tdls_oper_request(priv->netdev, + tdls_event->peer_mac_addr, + NL80211_TDLS_TEARDOWN, + tdls_event->reason_code, + GFP_KERNEL); + } +#endif +#endif + break; default: break; } @@ -1834,10 +1847,10 @@ done: * @brief This function prints the debug message in mlan * * @param pmoal_handle Pointer to the MOAL context - * @param level debug level - * @param pformat point to string format buf + * @param level debug level + * @param pformat point to string format buf * - * @return N/A + * @return N/A */ t_void moal_print(IN t_void * pmoal_handle, IN t_u32 level, IN char *pformat, IN ...) @@ -1915,7 +1928,7 @@ moal_print_netintf(IN t_void * pmoal_handle, IN t_u32 bss_index, IN t_u32 level) * @param pmoal_handle A pointer to moal_private structure * @param cond Condition to check * - * @return N/A + * @return N/A */ t_void moal_assert(IN t_void * pmoal_handle, IN t_u32 cond) @@ -1929,9 +1942,9 @@ moal_assert(IN t_void * pmoal_handle, IN t_u32 cond) * @brief This function indicate tcp ack tx * * @param pmoal_handle A pointer to moal_private structure - * @param pmbuf Pointer to the mlan buffer structure + * @param pmbuf Pointer to the mlan buffer structure * - * @return N/A + * @return N/A */ t_void moal_tcp_ack_tx_ind(IN t_void * pmoal_handle, IN pmlan_buffer pmbuf) diff --git a/drivers/net/wireless/sd8797/mlinux/moal_sta_cfg80211.c b/drivers/net/wireless/sd8797/mlinux/moal_sta_cfg80211.c index e404eb2216c7..811fb90212aa 100644 --- a/drivers/net/wireless/sd8797/mlinux/moal_sta_cfg80211.c +++ b/drivers/net/wireless/sd8797/mlinux/moal_sta_cfg80211.c @@ -23,6 +23,8 @@ #include "moal_sta_cfg80211.h" #include "moal_eth_ioctl.h" +extern int cfg80211_wext; + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) static void #else @@ -125,11 +127,28 @@ int woal_cfg80211_sched_scan_start(struct wiphy *wiphy, int woal_cfg80211_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev); #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)|| defined(COMPAT_WIRELESS) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) || defined(COMPAT_WIRELESS) int woal_cfg80211_resume(struct wiphy *wiphy); int woal_cfg80211_suspend(struct wiphy *wiphy, struct cfg80211_wowlan *wow); #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)|| defined(COMPAT_WIRELESS) +int woal_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, + u8 * peer, enum nl80211_tdls_operation oper); +int woal_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, + u8 * peer, u8 action_code, u8 dialog_token, + u16 status_code, const u8 * extra_ies, + size_t extra_ies_len); +static int + +woal_cfg80211_add_station(struct wiphy *wiphy, struct net_device *dev, + u8 * mac, struct station_parameters *params); +static int + +woal_cfg80211_change_station(struct wiphy *wiphy, struct net_device *dev, + u8 * mac, struct station_parameters *params); +#endif + /** cfg80211 operations */ static struct cfg80211_ops woal_cfg80211_ops = { .change_virtual_intf = woal_cfg80211_change_virtual_intf, @@ -155,7 +174,7 @@ static struct cfg80211_ops woal_cfg80211_ops = { .sched_scan_start = woal_cfg80211_sched_scan_start, .sched_scan_stop = woal_cfg80211_sched_scan_stop, #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)|| defined(COMPAT_WIRELESS) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) || defined(COMPAT_WIRELESS) .suspend = woal_cfg80211_suspend, .resume = woal_cfg80211_resume, #endif @@ -165,6 +184,12 @@ static struct cfg80211_ops woal_cfg80211_ops = { #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35) || defined(COMPAT_WIRELESS) .set_cqm_rssi_config = woal_cfg80211_set_cqm_rssi_config, #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0) || defined(COMPAT_WIRELESS) + .tdls_oper = woal_cfg80211_tdls_oper, + .tdls_mgmt = woal_cfg80211_tdls_mgmt, + .add_station = woal_cfg80211_add_station, + .change_station = woal_cfg80211_change_station, +#endif #ifdef UAP_CFG80211 .add_virtual_intf = woal_cfg80211_add_virtual_intf, .del_virtual_intf = woal_cfg80211_del_virtual_intf, @@ -257,11 +282,55 @@ static const struct ieee80211_txrx_stypes }; #endif +#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 0, 0) +/** + * NOTE: types in all the sets must be equals to the + * initial value of wiphy->interface_modes + */ +static const struct ieee80211_iface_limit cfg80211_ap_sta_limits[] = { + { + .max = 4, + .types = MBIT(NL80211_IFTYPE_STATION) | +#ifdef UAP_CFG80211 + MBIT(NL80211_IFTYPE_AP) | +#endif +#if defined(WIFI_DIRECT_SUPPORT) +#if LINUX_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION + MBIT(NL80211_IFTYPE_P2P_GO) | MBIT(NL80211_IFTYPE_P2P_CLIENT) | +#endif +#endif + MBIT(NL80211_IFTYPE_ADHOC) + } +}; + +const struct ieee80211_iface_combination cfg80211_iface_comb_ap_sta = { + .limits = cfg80211_ap_sta_limits, + .num_different_channels = 1, + .n_limits = ARRAY_SIZE(cfg80211_ap_sta_limits), + .max_interfaces = 4, + .beacon_int_infra_match = MTRUE, +}; +#endif + extern moal_handle *m_handle[]; extern int hw_test; /** Region alpha2 string */ char *reg_alpha2; +#if defined(WIFI_DIRECT_SUPPORT) +#if LINUX_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION +extern int p2p_enh; +#endif +#endif + +#ifdef CONFIG_PM +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) +static const struct wiphy_wowlan_support wowlan_support = { + .flags = WIPHY_WOWLAN_ANY, +}; +#endif +#endif + /******************************************************** Global Variables ********************************************************/ @@ -277,16 +346,13 @@ char *reg_alpha2; * * @return MTRUE/MFALSE */ -t_u8 -is_cfg80211_special_region_code(char *region_string) -{ +t_u8 is_cfg80211_special_region_code(char *region_string) { t_u8 i; region_code_t cfg80211_special_region_code[] = { {"00 "}, {"99 "}, {"98 "}, {"97 "} }; - for (i = 0; i < COUNTRY_CODE_LEN && region_string[i]; i++) { + for (i = 0; i < COUNTRY_CODE_LEN && region_string[i]; i++) region_string[i] = toupper(region_string[i]); - } for (i = 0; i < ARRAY_SIZE(cfg80211_special_region_code); i++) { if (!memcmp(region_string, @@ -532,8 +598,7 @@ woal_wps_cfg(moal_private * priv, int enable) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -564,8 +629,8 @@ woal_cfg80211_assoc_ies_cfg(moal_private * priv, t_u8 * ie, int ie_len) element_len = *((t_u8 *) pcurrent_ptr + 1); total_ie_len = element_len + sizeof(IEEEtypes_Header_t); if (bytes_left < total_ie_len) { - PRINTM(MERROR, "InterpretIE: Error in processing IE, " - "bytes left < IE length\n"); + PRINTM(MERROR, + "InterpretIE: Error in processing IE, bytes left < IE length\n"); bytes_left = 0; continue; } @@ -742,8 +807,7 @@ woal_send_domain_info_cmd_fw(moal_private * priv, t_u8 wait_option) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -772,7 +836,7 @@ woal_set_rf_channel(moal_private * priv, if (!chan) { LEAVE(); - return EINVAL; + return -EINVAL; } mode = woal_nl80211_iftype_to_mode(priv->wdev->iftype); req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_radio_cfg)); @@ -829,8 +893,7 @@ woal_set_rf_channel(moal_private * priv, } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -881,9 +944,8 @@ woal_set_ewpa_mode(moal_private * priv, t_u8 wait_option, goto error; sec->param.ewpa_enabled = MFALSE; if (sec->param.passphrase.psk_type == MLAN_PSK_PASSPHRASE) { - if (sec->param.passphrase.psk.passphrase.passphrase_len > 0) { + if (sec->param.passphrase.psk.passphrase.passphrase_len > 0) sec->param.ewpa_enabled = MTRUE; - } } else if (sec->param.passphrase.psk_type == MLAN_PSK_PMK) sec->param.ewpa_enabled = MTRUE; @@ -894,7 +956,7 @@ woal_set_ewpa_mode(moal_private * priv, t_u8 wait_option, status = woal_request_ioctl(priv, req, wait_option); error: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -999,11 +1061,15 @@ woal_inform_bss_from_scan_result(moal_private * priv, ieee80211_channel_to_frequency((int) scan_table [i]. - channel, + channel +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) || defined(COMPAT_WIRELESS) + , woal_band_cfg_to_ieee_band (scan_table [i]. - bss_band)); + bss_band) +#endif + ); } chan = ieee80211_get_channel(priv->wdev->wiphy, scan_table[i].freq); @@ -1203,11 +1269,11 @@ woal_process_country_ie(moal_private * priv, struct cfg80211_bss *bss) /** IEEE80211_BAND_2GHZ or IEEE80211_BAND_5GHZ */ cfg_11d->param.domain_info.band = priv->phandle->band; - country_ie_len -= IEEE80211_COUNTRY_STRING_LEN; + country_ie_len -= COUNTRY_CODE_LEN; cfg_11d->param.domain_info.no_of_sub_band = country_ie_len / sizeof(struct ieee80211_country_ie_triplet); memcpy((u8 *) cfg_11d->param.domain_info.sub_band, - &country_ie[2] + IEEE80211_COUNTRY_STRING_LEN, country_ie_len); + &country_ie[2] + COUNTRY_CODE_LEN, country_ie_len); /* Send domain info command to FW */ if (MLAN_STATUS_SUCCESS != @@ -1217,8 +1283,7 @@ woal_process_country_ie(moal_private * priv, struct cfg80211_bss *bss) goto done; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1382,6 +1447,35 @@ woal_cfg80211_assoc(moal_private * priv, void *sme) #endif } else woal_send_domain_info_cmd_fw(priv, MOAL_IOCTL_WAIT); +#ifdef STA_WEXT + if (IS_STA_WEXT(cfg80211_wext)) { + switch (conn_param->crypto.wpa_versions) { + case NL80211_WPA_VERSION_2: + priv->wpa_version = IW_AUTH_WPA_VERSION_WPA2; + break; + case NL80211_WPA_VERSION_1: + priv->wpa_version = IW_AUTH_WPA_VERSION_WPA; + break; + default: + priv->wpa_version = 0; + break; + } + if (conn_param->crypto.n_akm_suites) { + switch (conn_param->crypto.akm_suites[0]) { + case WLAN_AKM_SUITE_PSK: + priv->key_mgmt = IW_AUTH_KEY_MGMT_PSK; + break; + case WLAN_AKM_SUITE_8021X: + priv->key_mgmt = + IW_AUTH_KEY_MGMT_802_1X; + break; + default: + priv->key_mgmt = 0; + break; + } + } + } +#endif } memset(&req_ssid, 0, sizeof(mlan_802_11_ssid)); @@ -1497,8 +1591,9 @@ woal_cfg80211_assoc(moal_private * priv, void *sme) woal_cfg80211_is_alg_wep(pairwise_enc_mode) | woal_cfg80211_is_alg_wep(group_enc_mode); if (alg_is_wep) { - PRINTM(MINFO, "Setting wep encryption with " - "key len %d\n", conn_param->key_len); + PRINTM(MINFO, + "Setting wep encryption with key len %d\n", + conn_param->key_len); /* Set the WEP key */ if (MLAN_STATUS_SUCCESS != woal_cfg80211_set_wep_keys(priv, @@ -1530,8 +1625,7 @@ woal_cfg80211_assoc(moal_private * priv, void *sme) ret = -EINVAL; goto done; } - if (req) - kfree(req); + kfree(req); req = NULL; req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_bss)); @@ -1651,8 +1745,7 @@ done: ret = -EFAULT; } } - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1691,18 +1784,16 @@ woal_set_get_dtim_period(moal_private * priv, req->req_id = MLAN_IOCTL_SNMP_MIB; req->action = action; - if (action == MLAN_ACT_SET) { + if (action == MLAN_ACT_SET) mib->param.dtim_period = *value; - } /* Send IOCTL request to MLAN */ ret = woal_request_ioctl(priv, req, wait_option); - if (ret == MLAN_STATUS_SUCCESS && action == MLAN_ACT_GET) { + if (ret == MLAN_STATUS_SUCCESS && action == MLAN_ACT_GET) *value = (t_u8) mib->param.dtim_period; - } done: - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -1762,12 +1853,10 @@ woal_cfg80211_dump_station_info(moal_private * priv, struct station_info *sinfo) } if (rate->param.data_rate.tx_data_rate >= MLAN_RATE_INDEX_MCS0) { sinfo->txrate.flags = RATE_INFO_FLAGS_MCS; - if (rate->param.data_rate.tx_ht_bw == MLAN_HT_BW40) { + if (rate->param.data_rate.tx_ht_bw == MLAN_HT_BW40) sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; - } - if (rate->param.data_rate.tx_ht_gi == MLAN_HT_SGI) { + if (rate->param.data_rate.tx_ht_gi == MLAN_HT_SGI) sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; - } sinfo->txrate.mcs = rate->param.data_rate.tx_data_rate - MLAN_RATE_INDEX_MCS0; @@ -1805,8 +1894,7 @@ woal_cfg80211_dump_station_info(moal_private * priv, struct station_info *sinfo) #endif done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -1834,6 +1922,7 @@ woal_cfg80211_reg_notifier(struct wiphy *wiphy, { moal_private *priv = NULL; moal_handle *handle = (moal_handle *) woal_get_wiphy_priv(wiphy); + t_u8 region[COUNTRY_CODE_LEN]; #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0) int ret = 0; #endif @@ -1842,7 +1931,7 @@ woal_cfg80211_reg_notifier(struct wiphy *wiphy, priv = woal_get_priv(handle, MLAN_BSS_ROLE_ANY); if (!priv) { - PRINTM(MFATAL, "Unable to get priv in %s()\n", __FUNCTION__); + PRINTM(MFATAL, "Unable to get priv in %s()\n", __func__); LEAVE(); #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0) return -EINVAL; @@ -1853,7 +1942,10 @@ woal_cfg80211_reg_notifier(struct wiphy *wiphy, PRINTM(MIOCTL, "cfg80211 regulatory domain callback " "%c%c\n", request->alpha2[0], request->alpha2[1]); - if (MTRUE == is_cfg80211_special_region_code(request->alpha2)) { + memset(region, 0, sizeof(region)); + memcpy(region, request->alpha2, sizeof(request->alpha2)); + region[2] = ' '; + if (MTRUE == is_cfg80211_special_region_code(region)) { PRINTM(MIOCTL, "Skip configure special region code\n"); LEAVE(); #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0) @@ -1938,6 +2030,7 @@ woal_cfg80211_scan(struct wiphy *wiphy, struct net_device *dev, PRINTM(MINFO, "Received scan request on %s\n", dev->name); #ifdef UAP_CFG80211 + /* return 0 to avoid hostapd failure */ if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) { LEAVE(); cfg80211_scan_done(request, MTRUE); @@ -1946,39 +2039,46 @@ woal_cfg80211_scan(struct wiphy *wiphy, struct net_device *dev, #endif if (priv->phandle->scan_pending_on_block == MTRUE) { - PRINTM(MINFO, "scan already in processing...\n"); + PRINTM(MCMND, "scan already in processing...\n"); LEAVE(); - return -EBUSY; + return -EAGAIN; } #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) || defined(COMPAT_WIRELESS) if (priv->last_event & EVENT_BG_SCAN_REPORT) { - PRINTM(MINFO, "block scan while pending BGSCAN result\n"); + PRINTM(MCMND, "block scan while pending BGSCAN result\n"); priv->last_event = 0; - cfg80211_scan_done(request, MTRUE); LEAVE(); - return 0; + return -EAGAIN; } #endif #if defined(STA_CFG80211) || defined(UAP_CFG80211) #ifdef WIFI_DIRECT_SUPPORT if (priv->phandle->is_go_timer_set) { - PRINTM(MINFO, "block scan in go timer....\n"); - cfg80211_scan_done(request, MTRUE); + PRINTM(MCMND, "block scan in go timer....\n"); LEAVE(); - return 0; + return -EAGAIN; } #endif #endif + if (priv->fake_scan_complete) { + PRINTM(MEVENT, "Reporting fake scan results\n"); + woal_inform_bss_from_scan_result(priv, NULL, MOAL_IOCTL_WAIT); + cfg80211_scan_done(request, MFALSE); + return ret; + } memset(&bss_info, 0, sizeof(bss_info)); if (MLAN_STATUS_SUCCESS == woal_get_bss_info(priv, MOAL_IOCTL_WAIT, &bss_info)) { if (bss_info.scan_block) { - PRINTM(MINFO, "block scan in mlan module...\n"); + PRINTM(MCMND, "block scan in mlan module...\n"); LEAVE(); - return -EBUSY; + return -EAGAIN; } } if (priv->scan_request && priv->scan_request != request) { + PRINTM(MCMND, + "different scan_request is coming before previous one is finished on %s...\n", + dev->name); LEAVE(); return -EBUSY; } @@ -2000,9 +2100,8 @@ woal_cfg80211_scan(struct wiphy *wiphy, struct net_device *dev, #if LINUX_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION if (priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT && priv->scan_request->n_ssids) { - if (!memcmp(scan_req.ssid_list[0].ssid, "DIRECT-", 7)) { + if (!memcmp(scan_req.ssid_list[0].ssid, "DIRECT-", 7)) scan_req.ssid_list[0].max_len = 0xfe; - } } #endif #endif @@ -2104,8 +2203,8 @@ woal_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, #endif /* KERNEL_VERSION */ #endif /* WIFI_DIRECT_SUPPORT && V14_FEATURE */ ) { - PRINTM(MERROR, "Received infra assoc request " - "when station not in infra mode\n"); + PRINTM(MERROR, + "Received infra assoc request when station not in infra mode\n"); LEAVE(); return -EINVAL; } @@ -2151,6 +2250,10 @@ woal_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, return ret; } } + if (priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT) { + /* WAR for P2P connection with Samsung TV */ + woal_sched_timeout(200); + } #endif #endif @@ -2329,8 +2432,8 @@ woal_cfg80211_dump_station(struct wiphy *wiphy, ENTER(); if (!priv->media_connected || idx != 0) { - PRINTM(MINFO, "cfg80211: Media not connected or" - " not for this station!\n"); + PRINTM(MINFO, + "cfg80211: Media not connected or not for this station!\n"); LEAVE(); return -ENOENT; } @@ -2372,8 +2475,8 @@ woal_cfg80211_dump_survey(struct wiphy *wiphy, struct net_device *dev, } #endif if (!priv->media_connected || idx != 0) { - PRINTM(MINFO, "cfg80211: Media not connected or" - " not for this station!\n"); + PRINTM(MINFO, + "cfg80211: Media not connected or not for this station!\n"); LEAVE(); return -ENOENT; } @@ -2388,8 +2491,11 @@ woal_cfg80211_dump_survey(struct wiphy *wiphy, struct net_device *dev, survey->channel = ieee80211_get_channel(wiphy, ieee80211_channel_to_frequency(bss_info. - bss_chan, - band)); + bss_chan +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) || defined(COMPAT_WIRELESS) + , band +#endif + )); if (bss_info.bcn_nf_last) { survey->filled = SURVEY_INFO_NOISE_DBM; @@ -2420,8 +2526,8 @@ woal_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, ENTER(); if (priv->wdev->iftype != NL80211_IFTYPE_ADHOC) { - PRINTM(MERROR, "Request IBSS join received " - "when station not in ibss mode\n"); + PRINTM(MERROR, + "Request IBSS join received when station not in ibss mode\n"); LEAVE(); return -EINVAL; } @@ -2568,7 +2674,7 @@ woal_cfg80211_set_tx_power(struct wiphy *wiphy, priv = woal_get_priv(handle, MLAN_BSS_ROLE_ANY); if (!priv) { - PRINTM(MFATAL, "Unable to get priv in %s()\n", __FUNCTION__); + PRINTM(MFATAL, "Unable to get priv in %s()\n", __func__); LEAVE(); return -EFAULT; } @@ -2831,9 +2937,7 @@ woal_cfg80211_remain_on_channel(struct wiphy *wiphy, goto done; } /** cancel previous remain on channel */ - if (priv->phandle->remain_on_channel && - ((priv->phandle->chan.center_freq != chan->center_freq) - )) { + if (priv->phandle->remain_on_channel) { remain_priv = priv->phandle->priv[priv->phandle->remain_bss_index]; if (!remain_priv) { @@ -3029,8 +3133,9 @@ woal_cfg80211_sched_scan_start(struct wiphy *wiphy, "%s sched scan: n_ssids=%d n_match_sets=%d n_channels=%d interval=%d ie_len=%d\n", priv->netdev->name, request->n_ssids, request->n_match_sets, request->n_channels, request->interval, (int)request->ie_len); - /** cancel pending scan */ - woal_cancel_scan(priv, MOAL_IOCTL_WAIT); + /** We have pending scan, start bgscan later */ + if (priv->phandle->scan_pending_on_block) + priv->scan_cfg.start_later = MTRUE; for (i = 0; i < request->n_match_sets; i++) { ssid = &request->match_sets[i].ssid; strncpy(priv->scan_cfg.ssid_list[i].ssid, ssid->ssid, @@ -3104,7 +3209,7 @@ done: * @param wiphy A pointer to wiphy structure * @param dev A pointer to net_device structure * - * @return 0 -- success, otherwise fail + * @return 0 -- success, otherwise fail */ int woal_cfg80211_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev) @@ -3127,7 +3232,7 @@ woal_cfg80211_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev) * * @param wiphy A pointer to wiphy structure * - * @return 0 -- success, otherwise fail + * @return 0 -- success, otherwise fail */ int woal_cfg80211_resume(struct wiphy *wiphy) @@ -3159,9 +3264,9 @@ woal_cfg80211_resume(struct wiphy *wiphy) * @brief cfg80211_suspend handler * * @param wiphy A pointer to wiphy structure - * @param wow A pointer to cfg80211_wowlan + * @param wow A pointer to cfg80211_wowlan * - * @return 0 -- success, otherwise fail + * @return 0 -- success, otherwise fail */ int woal_cfg80211_suspend(struct wiphy *wiphy, struct cfg80211_wowlan *wow) @@ -3186,6 +3291,974 @@ woal_cfg80211_suspend(struct wiphy *wiphy, struct cfg80211_wowlan *wow) } #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0) || defined(COMPAT_WIRELESS) +/** + * @brief TDLS operation ioctl handler + * + * @param priv A pointer to moal_private structure + * @param peer A pointer to peer mac + * @apram action action for TDLS + * @return 0 --success, otherwise fail + */ +static int +woal_tdls_oper(moal_private * priv, u8 * peer, t_u8 action) +{ + mlan_ioctl_req *ioctl_req = NULL; + mlan_ds_misc_cfg *misc = NULL; + int ret = 0; + + ENTER(); + + ioctl_req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (ioctl_req == NULL) { + ret = -ENOMEM; + goto done; + } + misc = (mlan_ds_misc_cfg *) ioctl_req->pbuf; + misc->sub_command = MLAN_OID_MISC_TDLS_OPER; + ioctl_req->req_id = MLAN_IOCTL_MISC_CFG; + ioctl_req->action = MLAN_ACT_SET; + misc->param.tdls_oper.tdls_action = action; + memcpy(misc->param.tdls_oper.peer_mac, peer, ETH_ALEN); + if (MLAN_STATUS_SUCCESS != + woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT)) { + ret = -EFAULT; + goto done; + } +done: + kfree(ioctl_req); + LEAVE(); + return ret; +} + +/** + * @brief TDLS operation ioctl handler + * + * @param priv A pointer to moal_private structure + * @param peer A pointer to peer mac + * @param tdls_ies A pointer to mlan_ds_misc_tdls_ies structure + * @param flags TDLS ie flags + * + * @return 0 --success, otherwise fail + */ +static int +woal_tdls_get_ies(moal_private * priv, u8 * peer, + mlan_ds_misc_tdls_ies * tdls_ies, t_u16 flags) +{ + mlan_ioctl_req *ioctl_req = NULL; + mlan_ds_misc_cfg *misc = NULL; + int ret = 0; + + ENTER(); + + ioctl_req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (ioctl_req == NULL) { + ret = -ENOMEM; + goto done; + } + misc = (mlan_ds_misc_cfg *) ioctl_req->pbuf; + misc->sub_command = MLAN_OID_MISC_GET_TDLS_IES; + ioctl_req->req_id = MLAN_IOCTL_MISC_CFG; + ioctl_req->action = MLAN_ACT_GET; + misc->param.tdls_ies.flags = flags; + memcpy(misc->param.tdls_ies.peer_mac, peer, ETH_ALEN); + if (MLAN_STATUS_SUCCESS != + woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT)) { + ret = -EFAULT; + goto done; + } + if (tdls_ies) + memcpy(tdls_ies, &misc->param.tdls_ies, + sizeof(mlan_ds_misc_tdls_ies)); +done: + if (ioctl_req) + kfree(ioctl_req); + LEAVE(); + return ret; +} + +/** + * @brief append tdls ext_capability + * + * @param skb A pointer to sk_buff structure + * + * @return N/A + */ +static void +woal_tdls_add_ext_capab(struct sk_buff *skb, mlan_ds_misc_tdls_ies * tdls_ies) +{ + u8 *pos = NULL; + if (tdls_ies->ext_cap[0] == WLAN_EID_EXT_CAPABILITY) { + pos = (void *)skb_put(skb, sizeof(IEEEtypes_ExtCap_t)); + memcpy(pos, tdls_ies->ext_cap, sizeof(IEEEtypes_ExtCap_t)); + } else { + PRINTM(MERROR, "Fail to append tdls ext_capability\n"); + } +} + +/** + * @brief append tdls Qos capability info + * + * @param skb A pointer to sk_buff structure + * + * @return N/A + */ +static void +woal_tdls_add_Qos_capab(struct sk_buff *skb) +{ + u8 *pos = (void *)skb_put(skb, 3); + + *pos++ = WLAN_EID_QOS_CAPA; + *pos++ = 1; /* len */ + *pos++ = 0x0f; +} + +/** + * @brief append supported rates + * + * @param priv A pointer to moal_private structure + * @param skb A pointer to sk_buff structure + * @param band AP's band + * + * @return N/A + */ +static void +woal_add_supported_rates_ie(moal_private * priv, struct sk_buff *skb, + enum ieee80211_band band) +{ + t_u8 basic_rates[] = { 0x82, 0x84, 0x8b, 0x96, 0xc, 0x12, 0x18, 0x24 }; + t_u8 basic_rates_5G[] = + { 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6c }; + t_u8 *pos; + t_u8 rate_num = 0; + if (band == IEEE80211_BAND_2GHZ) + rate_num = sizeof(basic_rates); + else + rate_num = sizeof(basic_rates_5G); + + if (skb_tailroom(skb) < rate_num + 2) + return; + + pos = skb_put(skb, rate_num + 2); + *pos++ = WLAN_EID_SUPP_RATES; + *pos++ = rate_num; + if (band == IEEE80211_BAND_2GHZ) + memcpy(pos, basic_rates, rate_num); + else + memcpy(pos, basic_rates_5G, rate_num); + return; +} + +/** + * @brief append ext_supported rates + * + * @param priv A pointer to moal_private structure + * @param skb A pointer to sk_buff structure + * @param band AP's band + * + * @return N/A + */ +static void +woal_add_ext_supported_rates_ie(moal_private * priv, struct sk_buff *skb, + enum ieee80211_band band) +{ + t_u8 ext_rates[] = { 0x0c, 0x12, 0x18, 0x60 }; + t_u8 *pos; + t_u8 rate_num = sizeof(ext_rates); + + if (band != IEEE80211_BAND_2GHZ) + return; + + if (skb_tailroom(skb) < rate_num + 2) + return; + + pos = skb_put(skb, rate_num + 2); + *pos++ = WLAN_EID_EXT_SUPP_RATES; + *pos++ = rate_num; + memcpy(pos, ext_rates, rate_num); + return; +} + +/** + * @brief woal construct tdls data frame + * + * @param priv A pointer to moal_private structure + * @param peer A pointer to peer mac + * @param action_code tdls action code + * @param dialog_token dialog_token + * @param status_code status_code + * @param skb skb buffer + * + * @return 0 -- success, otherwise fail + */ +static int +woal_construct_tdls_data_frame(moal_private * priv, + t_u8 * peer, t_u8 action_code, t_u8 dialog_token, + t_u16 status_code, struct sk_buff *skb) +{ + + struct ieee80211_tdls_data *tf; + t_u16 capability; + IEEEtypes_HTCap_t *HTcap; + IEEEtypes_HTInfo_t *HTInfo; + IEEEtypes_2040BSSCo_t *BSSCo; + mlan_ds_misc_tdls_ies *tdls_ies = NULL; + int ret = 0; + mlan_bss_info bss_info; + enum ieee80211_band band; + + ENTER(); + + memset(&bss_info, 0, sizeof(bss_info)); + if (MLAN_STATUS_SUCCESS != + woal_get_bss_info(priv, MOAL_IOCTL_WAIT, &bss_info)) { + PRINTM(MERROR, "Fail to get bss info\n"); + LEAVE(); + return -EFAULT; + } + band = woal_band_cfg_to_ieee_band(bss_info.bss_band); + tdls_ies = kmalloc(sizeof(mlan_ds_misc_tdls_ies), GFP_KERNEL); + if (!tdls_ies) { + PRINTM(MERROR, "Fail to alloc memory for tdls_ies\n"); + LEAVE(); + return -ENOMEM; + } + if (band == IEEE80211_BAND_2GHZ) + capability = 0x2421; + else + capability = 0; + + tf = (void *)skb_put(skb, offsetof(struct ieee80211_tdls_data, u)); + memcpy(tf->da, peer, ETH_ALEN); + memcpy(tf->sa, priv->current_addr, ETH_ALEN); + tf->ether_type = cpu_to_be16(MLAN_ETHER_PKT_TYPE_TDLS_ACTION); + tf->payload_type = WLAN_TDLS_SNAP_RFTYPE; + memset(tdls_ies, 0, sizeof(mlan_ds_misc_tdls_ies)); + + switch (action_code) { + case WLAN_TDLS_SETUP_REQUEST: + woal_tdls_get_ies(priv, peer, tdls_ies, + TDLS_IE_FLAGS_EXTCAP | TDLS_IE_FLAGS_HTCAP); + tf->category = WLAN_CATEGORY_TDLS; + tf->action_code = WLAN_TDLS_SETUP_REQUEST; + skb_put(skb, sizeof(tf->u.setup_req)); + tf->u.setup_req.dialog_token = dialog_token; + tf->u.setup_req.capability = cpu_to_le16(capability); + woal_add_supported_rates_ie(priv, skb, band); + woal_add_ext_supported_rates_ie(priv, skb, band); + woal_tdls_add_ext_capab(skb, tdls_ies); + woal_tdls_add_Qos_capab(skb); + break; + case WLAN_TDLS_SETUP_RESPONSE: + woal_tdls_get_ies(priv, peer, tdls_ies, + TDLS_IE_FLAGS_EXTCAP | TDLS_IE_FLAGS_HTCAP); + tf->category = WLAN_CATEGORY_TDLS; + tf->action_code = WLAN_TDLS_SETUP_RESPONSE; + + skb_put(skb, sizeof(tf->u.setup_resp)); + tf->u.setup_resp.status_code = cpu_to_le16(status_code); + tf->u.setup_resp.dialog_token = dialog_token; + tf->u.setup_resp.capability = cpu_to_le16(capability); + + woal_add_supported_rates_ie(priv, skb, band); + woal_add_ext_supported_rates_ie(priv, skb, band); + woal_tdls_add_ext_capab(skb, tdls_ies); + woal_tdls_add_Qos_capab(skb); + break; + case WLAN_TDLS_SETUP_CONFIRM: + woal_tdls_get_ies(priv, peer, tdls_ies, TDLS_IE_FLAGS_HTINFO); + tf->category = WLAN_CATEGORY_TDLS; + tf->action_code = WLAN_TDLS_SETUP_CONFIRM; + + skb_put(skb, sizeof(tf->u.setup_cfm)); + tf->u.setup_cfm.status_code = cpu_to_le16(status_code); + tf->u.setup_cfm.dialog_token = dialog_token; + break; + case WLAN_TDLS_TEARDOWN: + tf->category = WLAN_CATEGORY_TDLS; + tf->action_code = WLAN_TDLS_TEARDOWN; + + skb_put(skb, sizeof(tf->u.teardown)); + tf->u.teardown.reason_code = cpu_to_le16(status_code); + break; + case WLAN_TDLS_DISCOVERY_REQUEST: + tf->category = WLAN_CATEGORY_TDLS; + tf->action_code = WLAN_TDLS_DISCOVERY_REQUEST; + + skb_put(skb, sizeof(tf->u.discover_req)); + tf->u.discover_req.dialog_token = dialog_token; + break; + default: + ret = -EINVAL; + goto done; + } + + // TODO we should fill in ht_cap and htinfo with correct value + switch (action_code) { + case WLAN_TDLS_SETUP_REQUEST: + case WLAN_TDLS_SETUP_RESPONSE: + /* HT capability */ + if (tdls_ies->ht_cap[0] == HT_CAPABILITY) { + HTcap = (void *)skb_put(skb, sizeof(IEEEtypes_HTCap_t)); + memset(HTcap, 0, sizeof(IEEEtypes_HTCap_t)); + memcpy(HTcap, tdls_ies->ht_cap, + sizeof(IEEEtypes_HTCap_t)); + } else { + PRINTM(MERROR, "Fail to append TDLS HT capability\n"); + } + + /* 20_40_bss_coexist */ + BSSCo = (void *)skb_put(skb, sizeof(IEEEtypes_2040BSSCo_t)); + memset(BSSCo, 0, sizeof(IEEEtypes_2040BSSCo_t)); + BSSCo->ieee_hdr.element_id = BSSCO_2040; + BSSCo->ieee_hdr.len = + sizeof(IEEEtypes_2040BSSCo_t) - + sizeof(IEEEtypes_Header_t); + BSSCo->bss_co_2040.bss_co_2040_value = 0x01; + + break; + case WLAN_TDLS_SETUP_CONFIRM: + /* HT information */ + if (tdls_ies->ht_info[0] == HT_OPERATION) { + HTInfo = (void *)skb_put(skb, + sizeof(IEEEtypes_HTInfo_t)); + memset(HTInfo, 0, sizeof(IEEEtypes_HTInfo_t)); + memcpy(HTInfo, tdls_ies->ht_info, + sizeof(IEEEtypes_HTInfo_t)); + } else + PRINTM(MERROR, "Fail to append TDLS HT information\n"); + break; + default: + break; + } + +done: + if (tdls_ies) + kfree(tdls_ies); + return ret; +} + +/** + * @brief woal construct tdls action frame + * + * @param priv A pointer to moal_private structure + * @param peer A pointer to peer mac + * @param action_code tdls action code + * @param dialog_token dialog_token + * @param status_code status_code + * @param skb skb buffer + * + * @return 0 -- success, otherwise fail + */ +static int +woal_construct_tdls_action_frame(moal_private * priv, + t_u8 * peer, t_u8 action_code, + t_u8 dialog_token, t_u16 status_code, + struct sk_buff *skb) +{ + struct ieee80211_mgmt *mgmt; + t_u8 addr[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + t_u16 capability; + t_u8 *pos = NULL; + mlan_ds_misc_tdls_ies *tdls_ies = NULL; + mlan_bss_info bss_info; + enum ieee80211_band band; + + int ret = 0; + + ENTER(); + + memset(&bss_info, 0, sizeof(bss_info)); + if (MLAN_STATUS_SUCCESS != + woal_get_bss_info(priv, MOAL_IOCTL_WAIT, &bss_info)) { + PRINTM(MERROR, "Fail to get bss info\n"); + LEAVE(); + return -EFAULT; + } + band = woal_band_cfg_to_ieee_band(bss_info.bss_band); + + tdls_ies = kmalloc(sizeof(mlan_ds_misc_tdls_ies), GFP_KERNEL); + if (!tdls_ies) { + PRINTM(MERROR, "Fail to alloc memory for tdls_ies\n"); + LEAVE(); + return -ENOMEM; + } + + mgmt = (void *)skb_put(skb, 24); + memset(mgmt, 0, 24); + memcpy(mgmt->da, peer, ETH_ALEN); + memcpy(mgmt->sa, priv->current_addr, ETH_ALEN); + memcpy(mgmt->bssid, priv->cfg_bssid, ETH_ALEN); + + mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | + IEEE80211_STYPE_ACTION); + /* add address 4 */ + pos = skb_put(skb, ETH_ALEN); + + if (band == IEEE80211_BAND_2GHZ) + capability = 0x2421; + else + capability = 0; + + memset(tdls_ies, 0, sizeof(mlan_ds_misc_tdls_ies)); + + switch (action_code) { + case WLAN_PUB_ACTION_TDLS_DISCOVER_RES: + woal_tdls_get_ies(priv, peer, tdls_ies, TDLS_IE_FLAGS_EXTCAP); + skb_put(skb, 1 + sizeof(mgmt->u.action.u.tdls_discover_resp)); + mgmt->u.action.category = WLAN_CATEGORY_PUBLIC; + mgmt->u.action.u.tdls_discover_resp.action_code = + WLAN_PUB_ACTION_TDLS_DISCOVER_RES; + mgmt->u.action.u.tdls_discover_resp.dialog_token = dialog_token; + mgmt->u.action.u.tdls_discover_resp.capability = + cpu_to_le16(capability); + /* move back for addr4 */ + memmove(pos + ETH_ALEN, &mgmt->u.action.category, + 1 + sizeof(mgmt->u.action.u.tdls_discover_resp)); + /** init address 4 */ + memcpy(pos, addr, ETH_ALEN); + + woal_add_supported_rates_ie(priv, skb, band); + woal_add_ext_supported_rates_ie(priv, skb, band); + woal_tdls_add_ext_capab(skb, tdls_ies); + break; + default: + ret = -EINVAL; + break; + } + if (tdls_ies) + kfree(tdls_ies); + return ret; +} + +/** + * @brief woal add tdls link identifier ie + * + * @param skb skb buffer + * @param src_addr source address + * @param peer peer address + * @param bssid AP's bssid + * + * @return NA + */ +static void +woal_tdls_add_link_ie(struct sk_buff *skb, u8 * src_addr, u8 * peer, u8 * bssid) +{ + struct ieee80211_tdls_lnkie *lnkid; + + lnkid = (void *)skb_put(skb, sizeof(struct ieee80211_tdls_lnkie)); + + lnkid->ie_type = WLAN_EID_LINK_ID; + lnkid->ie_len = sizeof(struct ieee80211_tdls_lnkie) - 2; + + memcpy(lnkid->bssid, bssid, ETH_ALEN); + memcpy(lnkid->init_sta, src_addr, ETH_ALEN); + memcpy(lnkid->resp_sta, peer, ETH_ALEN); +} + +/** + * @brief woal send tdls action frame + * + * @param wiphy A pointer to wiphy structure + * @param dev A pointer to net_device structure + * @param peer A pointer to peer mac + * @param action_code tdls action code + * @param dialog_token dialog_token + * @param status_code status_code + * @param skb skb buffer + * + * @return 0 -- success, otherwise fail + */ +static int +woal_send_tdls_action_frame(struct wiphy *wiphy, struct net_device *dev, + t_u8 * peer, u8 action_code, t_u8 dialog_token, + t_u16 status_code, const t_u8 * extra_ies, + size_t extra_ies_len) +{ + moal_private *priv = (moal_private *) woal_get_netdev_priv(dev); + pmlan_buffer pmbuf = NULL; + mlan_status status = MLAN_STATUS_SUCCESS; + struct sk_buff *skb = NULL; + t_u8 *pos; + t_u32 pkt_type; + t_u32 tx_control; + t_u16 pkt_len; + int ret = 0; + + ENTER(); + +#define HEADER_SIZE 8 /* pkt_type + + tx_control */ + + pmbuf = woal_alloc_mlan_buffer(priv->phandle, MLAN_MIN_DATA_HEADER_LEN + HEADER_SIZE + sizeof(pkt_len) + max(sizeof(struct ieee80211_mgmt), sizeof(struct ieee80211_tdls_data)) + 50 + /* supported + rates + */ + sizeof(IEEEtypes_ExtCap_t) + /* ext + capab + */ + extra_ies_len + + sizeof(IEEEtypes_tdls_linkie)); + if (!pmbuf) { + PRINTM(MERROR, "Fail to allocate mlan_buffer\n"); + ret = -ENOMEM; + goto done; + } + + skb = (struct sk_buff *)pmbuf->pdesc; + + skb_put(skb, MLAN_MIN_DATA_HEADER_LEN); + + pos = skb_put(skb, HEADER_SIZE + sizeof(pkt_len)); + pkt_type = MRVL_PKT_TYPE_MGMT_FRAME; + tx_control = 0; + memset(pos, 0, HEADER_SIZE + sizeof(pkt_len)); + memcpy(pos, &pkt_type, sizeof(pkt_type)); + memcpy(pos + sizeof(pkt_type), &tx_control, sizeof(tx_control)); + + woal_construct_tdls_action_frame(priv, peer, action_code, + dialog_token, status_code, skb); + + if (extra_ies_len) + memcpy(skb_put(skb, extra_ies_len), extra_ies, extra_ies_len); + + /* the TDLS link IE is always added last */ + /* we are the responder */ + woal_tdls_add_link_ie(skb, peer, priv->current_addr, priv->cfg_bssid); + + /* + * According to 802.11z: Setup req/resp are sent in AC_BK, otherwise + * we should default to AC_VI. + */ + skb_set_queue_mapping(skb, WMM_AC_VI); + skb->priority = 5; + + pmbuf->data_offset = MLAN_MIN_DATA_HEADER_LEN; + pmbuf->data_len = skb->len - pmbuf->data_offset; + pmbuf->priority = skb->priority; + pmbuf->buf_type = MLAN_BUF_TYPE_RAW_DATA; + pmbuf->bss_index = priv->bss_index; + + pkt_len = pmbuf->data_len - HEADER_SIZE - sizeof(pkt_len); + memcpy(pmbuf->pbuf + pmbuf->data_offset + HEADER_SIZE, &pkt_len, + sizeof(pkt_len)); + + DBG_HEXDUMP(MDAT_D, "TDLS action:", pmbuf->pbuf + pmbuf->data_offset, + pmbuf->data_len); + + status = mlan_send_packet(priv->phandle->pmlan_adapter, pmbuf); + + switch (status) { + case MLAN_STATUS_PENDING: + atomic_inc(&priv->phandle->tx_pending); + queue_work(priv->phandle->workqueue, &priv->phandle->main_work); + break; + case MLAN_STATUS_SUCCESS: + woal_free_mlan_buffer(priv->phandle, pmbuf); + break; + case MLAN_STATUS_FAILURE: + default: + woal_free_mlan_buffer(priv->phandle, pmbuf); + ret = -EFAULT; + break; + } + +done: + LEAVE(); + return ret; +} + +/** + * @brief woal send tdls data frame + * + * @param wiphy A pointer to wiphy structure + * @param dev A pointer to net_device structure + * @param peer A pointer to peer mac + * @param action_code tdls action code + * @param dialog_token dialog_token + * @param status_code status_code + * @param skb skb buffer + * + * @return 0 -- success, otherwise fail + */ +static int +woal_send_tdls_data_frame(struct wiphy *wiphy, struct net_device *dev, + t_u8 * peer, u8 action_code, t_u8 dialog_token, + t_u16 status_code, const t_u8 * extra_ies, + size_t extra_ies_len) +{ + moal_private *priv = (moal_private *) woal_get_netdev_priv(dev); + pmlan_buffer pmbuf = NULL; + mlan_status status = MLAN_STATUS_SUCCESS; + struct sk_buff *skb = NULL; + int ret = 0; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) + t_u32 index = 0; +#endif + + ENTER(); + + skb = dev_alloc_skb(priv->extra_tx_head_len + MLAN_MIN_DATA_HEADER_LEN + sizeof(mlan_buffer) + max(sizeof(struct ieee80211_mgmt), sizeof(struct ieee80211_tdls_data)) + 50 + /* supported + rates + */ + sizeof(IEEEtypes_ExtCap_t) + /* ext capab */ + 3 + /* Qos Info */ + sizeof(IEEEtypes_HTCap_t) + + sizeof(IEEEtypes_2040BSSCo_t) + + sizeof(IEEEtypes_HTInfo_t) + extra_ies_len + + sizeof(IEEEtypes_tdls_linkie)); + if (!skb) + return -ENOMEM; + + skb_reserve(skb, + MLAN_MIN_DATA_HEADER_LEN + sizeof(mlan_buffer) + + priv->extra_tx_head_len); + + woal_construct_tdls_data_frame(priv, peer, + action_code, dialog_token, + status_code, skb); + + if (extra_ies_len) + memcpy(skb_put(skb, extra_ies_len), extra_ies, extra_ies_len); + + /* the TDLS link IE is always added last */ + switch (action_code) { + case WLAN_TDLS_SETUP_REQUEST: + case WLAN_TDLS_SETUP_CONFIRM: + case WLAN_TDLS_TEARDOWN: + case WLAN_TDLS_DISCOVERY_REQUEST: + /* we are the initiator */ + woal_tdls_add_link_ie(skb, priv->current_addr, peer, + priv->cfg_bssid); + break; + case WLAN_TDLS_SETUP_RESPONSE: + /* we are the responder */ + woal_tdls_add_link_ie(skb, peer, priv->current_addr, + priv->cfg_bssid); + break; + default: + ret = -ENOTSUPP; + goto fail; + } + + /* + * According to 802.11z: Setup req/resp are sent in AC_BK, otherwise + * we should default to AC_VI. + */ + switch (action_code) { + case WLAN_TDLS_SETUP_REQUEST: + case WLAN_TDLS_SETUP_RESPONSE: + skb_set_queue_mapping(skb, WMM_AC_BK); + skb->priority = 2; + break; + default: + skb_set_queue_mapping(skb, WMM_AC_VI); + skb->priority = 5; + break; + } + + pmbuf = (mlan_buffer *) skb->head; + memset((t_u8 *) pmbuf, 0, sizeof(mlan_buffer)); + pmbuf->bss_index = priv->bss_index; + pmbuf->pdesc = skb; + pmbuf->pbuf = skb->head + sizeof(mlan_buffer); + + pmbuf->data_offset = skb->data - (skb->head + sizeof(mlan_buffer)); + pmbuf->data_len = skb->len; + pmbuf->priority = skb->priority; + pmbuf->buf_type = MLAN_BUF_TYPE_DATA; + + DBG_HEXDUMP(MDAT_D, "TDLS data:", pmbuf->pbuf + pmbuf->data_offset, + pmbuf->data_len); + + status = mlan_send_packet(priv->phandle->pmlan_adapter, pmbuf); + + switch (status) { + case MLAN_STATUS_PENDING: + atomic_inc(&priv->phandle->tx_pending); +#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) + index = skb_get_queue_mapping(skb); + atomic_inc(&priv->wmm_tx_pending[index]); +#endif + queue_work(priv->phandle->workqueue, &priv->phandle->main_work); + /* delay 10 ms to guarantee the teardown frame can be sent out + before disalbe tdls link * if we don't delay and return + immediately, wpa_supplicant will call disalbe tdls link * + this may cause tdls link disabled before teardown frame sent + out */ + if (action_code == WLAN_TDLS_TEARDOWN) + woal_sched_timeout(10); + break; + case MLAN_STATUS_SUCCESS: + dev_kfree_skb(skb); + break; + case MLAN_STATUS_FAILURE: + default: + dev_kfree_skb(skb); + ret = -ENOTSUPP; + break; + } + + LEAVE(); + return ret; +fail: + dev_kfree_skb(skb); + return ret; +} + +/** + * @brief Tx TDLS packet + * + * @param wiphy A pointer to wiphy structure + * @param dev A pointer to net_device structure + * @param peer A pointer to peer mac + * @param action_code tdls action code + * @param dialog_token dialog_token + * @param status_code status_code + * @param extra_ie A pointer to extra ie buffer + * @param extra_ie_len etra ie len + * + * @return 0 -- success, otherwise fail + */ +int +woal_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, + t_u8 * peer, u8 action_code, t_u8 dialog_token, + t_u16 status_code, const t_u8 * extra_ies, + size_t extra_ies_len) +{ + moal_private *priv = (moal_private *) woal_get_netdev_priv(dev); + int ret = 0; + + ENTER(); + + if (!(wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS)) + return -ENOTSUPP; + /* make sure we are not in uAP mode and Go mode */ + if (priv->bss_type != MLAN_BSS_TYPE_STA) + return -ENOTSUPP; + + switch (action_code) { + case TDLS_SETUP_REQUEST: + PRINTM(MMSG, + "wlan: Send TDLS Setup Request to " MACSTR + " status_code=%d\n", MAC2STR(peer), status_code); + ret = woal_send_tdls_data_frame(wiphy, dev, peer, action_code, + dialog_token, status_code, + extra_ies, extra_ies_len); + break; + case TDLS_SETUP_RESPONSE: + PRINTM(MMSG, + "wlan: Send TDLS Setup Response to " MACSTR + " status_code=%d\n", MAC2STR(peer), status_code); + ret = woal_send_tdls_data_frame(wiphy, dev, peer, action_code, + dialog_token, status_code, + extra_ies, extra_ies_len); + break; + case TDLS_SETUP_CONFIRM: + PRINTM(MMSG, + "wlan: Send TDLS Confirm to " MACSTR " status_code=%d\n", + MAC2STR(peer), status_code); + ret = woal_send_tdls_data_frame(wiphy, dev, peer, action_code, + dialog_token, status_code, + extra_ies, extra_ies_len); + break; + case TDLS_TEARDOWN: + PRINTM(MMSG, "wlan: Send TDLS Tear down to " MACSTR "\n", + MAC2STR(peer)); + ret = woal_send_tdls_data_frame(wiphy, dev, peer, action_code, + dialog_token, status_code, + extra_ies, extra_ies_len); + break; + case TDLS_DISCOVERY_REQUEST: + PRINTM(MMSG, + "wlan: Send TDLS Discovery Request to " MACSTR "\n", + MAC2STR(peer)); + ret = woal_send_tdls_data_frame(wiphy, dev, peer, action_code, + dialog_token, status_code, + extra_ies, extra_ies_len); + break; + case TDLS_DISCOVERY_RESPONSE: + PRINTM(MMSG, + "wlan: Send TDLS Discovery Response to " MACSTR "\n", + MAC2STR(peer)); + ret = woal_send_tdls_action_frame(wiphy, dev, peer, action_code, + dialog_token, status_code, + extra_ies, extra_ies_len); + break; + default: + break; + } + + LEAVE(); + return ret; + +} + +/** + * @brief cfg80211_tdls_oper handler + * + * @param wiphy A pointer to wiphy structure + * @param dev A pointer to net_device structure + * @param peer tdls peer mac + * @param oper tdls operation code + * + * @return 0 -- success, otherwise fail + */ +int +woal_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, + u8 * peer, enum nl80211_tdls_operation oper) +{ + moal_private *priv = (moal_private *) woal_get_netdev_priv(dev); + t_u8 action; + int ret = 0; + + ENTER(); + + if (!(wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS)) + return -ENOTSUPP; + + if (!(wiphy->flags & WIPHY_FLAG_TDLS_EXTERNAL_SETUP)) + return -ENOTSUPP; + /* make sure we are in managed mode, and associated */ + if (priv->bss_type != MLAN_BSS_TYPE_STA) + return -ENOTSUPP; + + PRINTM(MIOCTL, "wlan: TDLS peer=" MACSTR ", oper=%d\n", MAC2STR(peer), + oper); + switch (oper) { + case NL80211_TDLS_ENABLE_LINK: + PRINTM(MMSG, "wlan: TDLS_ENABLE_LINK: peer=" MACSTR "\n", + MAC2STR(peer)); + action = WLAN_TDLS_ENABLE_LINK; + break; + case NL80211_TDLS_DISABLE_LINK: + PRINTM(MMSG, "wlan: TDLS_DISABLE_LINK: peer=" MACSTR "\n", + MAC2STR(peer)); + action = WLAN_TDLS_DISABLE_LINK; + break; + case NL80211_TDLS_TEARDOWN: + case NL80211_TDLS_SETUP: + case NL80211_TDLS_DISCOVERY_REQ: + return 0; + + default: + return -ENOTSUPP; + } + ret = woal_tdls_oper(priv, peer, action); + + LEAVE(); + + return ret; +} + +/** + * @brief add station + * + * @param wiphy A pointer to wiphy structure + * @param dev A pointer to net_device structure + * @param mac A pointer to peer mac + * @param params station parameters + * + * @return 0 -- success, otherwise fail + */ +static int +woal_cfg80211_add_station(struct wiphy *wiphy, struct net_device *dev, + u8 * mac, struct station_parameters *params) +{ + moal_private *priv = (moal_private *) woal_get_netdev_priv(dev); + int ret = 0; + ENTER(); + if (!(params->sta_flags_set & MBIT(NL80211_STA_FLAG_TDLS_PEER))) + goto done; + /* make sure we are in connected mode */ + if ((priv->bss_type != MLAN_BSS_TYPE_STA) || + (priv->media_connected == MFALSE)) { + ret = -ENOTSUPP; + goto done; + } + PRINTM(MMSG, "wlan: TDLS add peer station, address =" MACSTR "\n", + MAC2STR(mac)); + ret = woal_tdls_oper(priv, mac, WLAN_TDLS_CREATE_LINK); +done: + return ret; +} + +/** + * @brief change station info + * + * @param wiphy A pointer to wiphy structure + * @param dev A pointer to net_device structure + * @param mac A pointer to peer mac + * @param params station parameters + * + * @return 0 -- success, otherwise fail + */ +static int +woal_cfg80211_change_station(struct wiphy *wiphy, struct net_device *dev, + u8 * mac, struct station_parameters *params) +{ + moal_private *priv = (moal_private *) woal_get_netdev_priv(dev); + mlan_ioctl_req *ioctl_req = NULL; + mlan_ds_misc_cfg *misc = NULL; + int ret = 0; + + ENTER(); + + if (!(params->sta_flags_set & MBIT(NL80211_STA_FLAG_TDLS_PEER))) + goto done; + /* make sure we are in connected mode */ + if ((priv->bss_type != MLAN_BSS_TYPE_STA) || + (priv->media_connected == MFALSE)) { + ret = -ENOTSUPP; + goto done; + } + PRINTM(MMSG, "wlan: TDLS change peer info " MACSTR "\n", MAC2STR(mac)); + + ioctl_req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (ioctl_req == NULL) { + ret = -ENOMEM; + goto done; + } + + misc = (mlan_ds_misc_cfg *) ioctl_req->pbuf; + misc->sub_command = MLAN_OID_MISC_TDLS_OPER; + ioctl_req->req_id = MLAN_IOCTL_MISC_CFG; + ioctl_req->action = MLAN_ACT_SET; + misc->param.tdls_oper.tdls_action = WLAN_TDLS_CONFIG_LINK; + memcpy(misc->param.tdls_oper.peer_mac, mac, ETH_ALEN); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0) + misc->param.tdls_oper.capability = params->capability; +#endif + misc->param.tdls_oper.qos_info = + params->uapsd_queues | (params->max_sp << 5); + + if (params->supported_rates) { + misc->param.tdls_oper.supported_rates = params->supported_rates; + misc->param.tdls_oper.supported_rates_len = + params->supported_rates_len; + } + + if (params->ht_capa) + misc->param.tdls_oper.ht_capa = (t_u8 *) params->ht_capa; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0) + if (params->ext_capab) { + misc->param.tdls_oper.ext_capab = params->ext_capab; + misc->param.tdls_oper.ext_capab_len = params->ext_capab_len; + } +#endif + + if (MLAN_STATUS_SUCCESS != + woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT)) { + ret = -EFAULT; + goto done; + } + +done: + kfree(ioctl_req); + LEAVE(); + return ret; +} +#endif + /** * @brief Save connect parameters for roaming * @@ -3196,6 +4269,7 @@ void woal_save_conn_params(moal_private * priv, struct cfg80211_connect_params *sme) { ENTER(); + woal_clear_conn_params(priv); memcpy(&priv->sme_current, sme, sizeof(struct cfg80211_connect_params)); if (sme->channel) { priv->sme_current.channel = &priv->conn_chan; @@ -3231,7 +4305,7 @@ void woal_clear_conn_params(moal_private * priv) { ENTER(); - if (priv->sme_current.ie_len && priv->sme_current.ie) + if (priv->sme_current.ie_len) kfree(priv->sme_current.ie); memset(&priv->sme_current, 0, sizeof(struct cfg80211_connect_params)); priv->roaming_required = MFALSE; @@ -3456,12 +4530,12 @@ woal_cfg80211_init_wiphy(moal_private * priv, t_u8 wait_option) hw_dev_cap, cfg_11n->param.supported_mcs_set); /* For 2.4G band only card, this shouldn't be set */ - if (wiphy->bands[IEEE80211_BAND_5GHZ]) + if (wiphy->bands[IEEE80211_BAND_5GHZ]) { woal_cfg80211_setup_ht_cap(&wiphy->bands[IEEE80211_BAND_5GHZ]-> ht_cap, hw_dev_cap, cfg_11n->param.supported_mcs_set); - if (req) - kfree(req); + } + kfree(req); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38) || defined(COMPAT_WIRELESS) /* Get antenna modes */ @@ -3526,8 +4600,7 @@ woal_cfg80211_init_wiphy(moal_private * priv, t_u8 wait_option) done: LEAVE(); - if (req) - kfree(req); + kfree(req); return ret; } @@ -3555,6 +4628,15 @@ woal_register_cfg80211(moal_private * priv) ret = MLAN_STATUS_FAILURE; goto err_wiphy; } +#ifdef CONFIG_PM +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) + wiphy->wowlan = &wowlan_support; +#else + wiphy->wowlan.flags = WIPHY_WOWLAN_ANY; +#endif +#endif +#endif wiphy->max_scan_ssids = MRVDRV_MAX_SSID_LIST_LENGTH; wiphy->max_scan_ie_len = MAX_IE_SIZE; wiphy->interface_modes = 0; @@ -3562,12 +4644,19 @@ woal_register_cfg80211(moal_private * priv) MBIT(NL80211_IFTYPE_STATION) | MBIT(NL80211_IFTYPE_ADHOC) | MBIT(NL80211_IFTYPE_AP); +#if defined(WIFI_DIRECT_SUPPORT) +#if LINUX_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION + wiphy->interface_modes |= MBIT(NL80211_IFTYPE_P2P_GO) | + MBIT(NL80211_IFTYPE_P2P_CLIENT); +#endif +#endif + /* Make this wiphy known to this driver only */ wiphy->privid = mrvl_wiphy_privid; + woal_request_get_fw_info(priv, MOAL_CMD_WAIT, &fw_info); + /* Supported bands */ wiphy->bands[IEEE80211_BAND_2GHZ] = &cfg80211_band_2ghz; - - woal_request_get_fw_info(priv, MOAL_CMD_WAIT, &fw_info); if (fw_info.fw_bands & BAND_A) { wiphy->bands[IEEE80211_BAND_5GHZ] = &cfg80211_band_5ghz; /** reduce scan time from 110ms to 80ms */ @@ -3585,6 +4674,12 @@ woal_register_cfg80211(moal_private * priv) wiphy->cipher_suites = cfg80211_cipher_suites; wiphy->n_cipher_suites = ARRAY_SIZE(cfg80211_cipher_suites); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) + /* Initialize interface combinations */ + wiphy->iface_combinations = &cfg80211_iface_comb_ap_sta; + wiphy->n_iface_combinations = 1; +#endif + memcpy(wiphy->perm_addr, priv->current_addr, ETH_ALEN); wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; @@ -3604,6 +4699,10 @@ woal_register_cfg80211(moal_private * priv) wiphy->max_sched_scan_ie_len = MAX_IE_SIZE; wiphy->max_match_sets = MRVDRV_MAX_SSID_LIST_LENGTH; #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0) || defined(COMPAT_WIRELESS) + wiphy->flags |= + WIPHY_FLAG_SUPPORTS_TDLS | WIPHY_FLAG_TDLS_EXTERNAL_SETUP; +#endif wiphy->reg_notifier = woal_cfg80211_reg_notifier; /* Set struct moal_handle pointer in wiphy_priv */ @@ -3625,6 +4724,14 @@ woal_register_cfg80211(moal_private * priv) ret = MLAN_STATUS_FAILURE; goto err_wiphy; } +#if defined(WIFI_DIRECT_SUPPORT) +#if LINUX_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION + if (!p2p_enh) + wiphy->interface_modes &= ~(MBIT(NL80211_IFTYPE_P2P_GO) | + MBIT(NL80211_IFTYPE_P2P_CLIENT)); +#endif +#endif + /** we will try driver parameter first */ if (reg_alpha2 && woal_is_valid_alpha2(reg_alpha2)) { PRINTM(MIOCTL, "Notify reg_alpha2 %c%c\n", reg_alpha2[0], diff --git a/drivers/net/wireless/sd8797/mlinux/moal_sta_cfg80211.h b/drivers/net/wireless/sd8797/mlinux/moal_sta_cfg80211.h index 284191331b8b..1571503be4ed 100644 --- a/drivers/net/wireless/sd8797/mlinux/moal_sta_cfg80211.h +++ b/drivers/net/wireless/sd8797/mlinux/moal_sta_cfg80211.h @@ -23,7 +23,7 @@ #define _MOAL_STA_CFG80211_H_ /** Convert RSSI signal strength from dBm to mBm (100*dBm) */ -#define RSSI_DBM_TO_MDM(x) ((x) * 100) +#define RSSI_DBM_TO_MDM(x) ((x) * 100) mlan_status woal_register_sta_cfg80211(struct net_device *dev, t_u8 bss_type); diff --git a/drivers/net/wireless/sd8797/mlinux/moal_uap.c b/drivers/net/wireless/sd8797/mlinux/moal_uap.c index 263363fe5544..f6f72e771121 100644 --- a/drivers/net/wireless/sd8797/mlinux/moal_uap.c +++ b/drivers/net/wireless/sd8797/mlinux/moal_uap.c @@ -87,10 +87,10 @@ woal_uap_addba_param(struct net_device *dev, struct ifreq *req) cfg_11n->sub_command = MLAN_OID_11N_CFG_ADDBA_PARAM; ioctl_req->req_id = MLAN_IOCTL_11N_CFG; - if (!param.action) { + if (!param.action) /* Get addba param from MLAN */ ioctl_req->action = MLAN_ACT_GET; - } else { + else { /* Set addba param in MLAN */ ioctl_req->action = MLAN_ACT_SET; cfg_11n->param.addba_param.timeout = param.timeout; @@ -117,8 +117,7 @@ woal_uap_addba_param(struct net_device *dev, struct ifreq *req) goto done; } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -192,8 +191,7 @@ woal_uap_aggr_priotbl(struct net_device *dev, struct ifreq *req) goto done; } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -247,18 +245,16 @@ woal_uap_addba_reject(struct net_device *dev, struct ifreq *req) } else { /* Set addba_reject tbl in MLAN */ ioctl_req->action = MLAN_ACT_SET; - for (i = 0; i < MAX_NUM_TID; i++) { + for (i = 0; i < MAX_NUM_TID; i++) cfg_11n->param.addba_reject[i] = param.addba_reject[i]; - } } if (MLAN_STATUS_SUCCESS != woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT)) { ret = -EFAULT; goto done; } - for (i = 0; i < MAX_NUM_TID; i++) { + for (i = 0; i < MAX_NUM_TID; i++) param.addba_reject[i] = cfg_11n->param.addba_reject[i]; - } /* Copy to user */ if (copy_to_user(req->ifr_data, ¶m, sizeof(param))) { PRINTM(MERROR, "Copy to user failed!\n"); @@ -266,8 +262,7 @@ woal_uap_addba_reject(struct net_device *dev, struct ifreq *req) goto done; } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -392,8 +387,7 @@ woal_uap_deep_sleep(struct net_device *dev, struct ifreq *req) goto done; } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -465,8 +459,7 @@ woal_uap_txdatapause(struct net_device *dev, struct ifreq *req) goto done; } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -616,8 +609,8 @@ woal_uap_snmp_mib(struct net_device *dev, struct ifreq *req) snmp->sub_command = MLAN_OID_SNMP_MIB_DOT11H; break; default: - PRINTM(MERROR, "%s: Unsupported SNMP_MIB OID (%d).\n", - __FUNCTION__, param.oid); + PRINTM(MERROR, "%s: Unsupported SNMP_MIB OID (%d).\n", __func__, + param.oid); goto done; } @@ -652,8 +645,7 @@ woal_uap_snmp_mib(struct net_device *dev, struct ifreq *req) } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -762,8 +754,7 @@ woal_uap_domain_info(struct net_device *dev, struct ifreq *req) } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -854,8 +845,7 @@ woal_uap_dfs_testing(struct net_device *dev, struct ifreq *req) } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -893,13 +883,12 @@ woal_uap_tx_bf_cfg(struct net_device *dev, struct ifreq *req) ret = -EFAULT; goto done; } - if (!param.action) { + if (!param.action) /* Get BF configurations */ action = MLAN_ACT_GET; - } else { + else /* Set BF configurations */ action = MLAN_ACT_SET; - } if (copy_from_user(&bf_cfg, req->ifr_data + sizeof(tx_bf_cfg_para_hdr), sizeof(bf_cfg))) { PRINTM(MERROR, "Copy from user failed\n"); @@ -1092,11 +1081,10 @@ woal_uap_mgmt_frame_control(struct net_device *dev, struct ifreq *req) ret = -EFAULT; goto done; } - if (param.action) { + if (param.action) action = MLAN_ACT_SET; - } else { + else action = MLAN_ACT_GET; - } if (action == MLAN_ACT_SET) { /* Initialize the invalid values so that the correct values below are downloaded to firmware */ @@ -1208,8 +1196,7 @@ woal_uap_tx_rate_cfg(struct net_device *dev, struct ifreq *req) } } done: - if (mreq) - kfree(mreq); + kfree(mreq); LEAVE(); return ret; } @@ -1278,8 +1265,7 @@ woal_uap_antenna_cfg(struct net_device *dev, struct ifreq *req) } } done: - if (mreq) - kfree(mreq); + kfree(mreq); LEAVE(); return ret; } @@ -1427,8 +1413,7 @@ woal_uap_sta_deauth_ioctl(struct net_device *dev, struct ifreq *req) } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -1482,8 +1467,7 @@ woal_uap_radio_ctl(struct net_device *dev, struct ifreq *req) woal_request_ioctl(priv, mreq, MOAL_IOCTL_WAIT)) { ret = -EFAULT; } - if (mreq) - kfree(mreq); + kfree(mreq); } else { /* Get radio status */ memset(&bss_info, 0, sizeof(bss_info)); @@ -1627,8 +1611,7 @@ woal_uap_power_mode_ioctl(struct net_device *dev, struct ifreq *req) } } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -1679,11 +1662,10 @@ woal_uap_bss_cfg_ioctl(struct net_device *dev, struct ifreq *req) bss = (mlan_ds_bss *) ioctl_req->pbuf; bss->sub_command = MLAN_OID_UAP_BSS_CONFIG; ioctl_req->req_id = MLAN_IOCTL_BSS; - if (action == 1) { + if (action == 1) ioctl_req->action = MLAN_ACT_SET; - } else { + else ioctl_req->action = MLAN_ACT_GET; - } if (ioctl_req->action == MLAN_ACT_SET) { /* Get the BSS config from user */ @@ -1715,8 +1697,7 @@ woal_uap_bss_cfg_ioctl(struct net_device *dev, struct ifreq *req) } } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -1776,8 +1757,7 @@ woal_uap_get_sta_list_ioctl(struct net_device *dev, struct ifreq *req) } } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -1831,8 +1811,7 @@ woal_uap_set_wapi_key_ioctl(moal_private * priv, wapi_msg * msg) woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT)) ret = -EFAULT; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1895,8 +1874,7 @@ woal_enable_wapi(moal_private * priv, t_u8 enable) if (enable) woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT, UAP_BSS_START); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return status; } @@ -1966,8 +1944,7 @@ woal_uap_set_wapi_flag_ioctl(moal_private * priv, wapi_msg * msg) } woal_enable_wapi(priv, MTRUE); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2067,9 +2044,8 @@ woal_uap_get_bss_param(moal_private * priv, mlan_uap_bss_param * sys_cfg, memcpy(sys_cfg, &info->param.bss_config, sizeof(mlan_uap_bss_param)); done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); - LEAVE(); return status; } @@ -2189,8 +2165,9 @@ woal_uap_ap_cfg_parse_data(mlan_uap_bss_param * ap_cfg, char *buf) (int)ap_cfg->ssid.ssid_len); set_ssid = 1; } else { - PRINTM(MERROR, "AP_CFG: Invalid option %s, " - "expect SSID\n", opt); + PRINTM(MERROR, + "AP_CFG: Invalid option %s, expect SSID\n", + opt); ret = -EINVAL; goto done; } @@ -2389,8 +2366,8 @@ woal_uap_set_ap_cfg(moal_private * priv, t_u8 * data, int len) /* If the security mode is configured as WEP or WPA-PSK, it will disable 11n automatically, and if configured as open(off) or wpa2-psk, it will automatically enable 11n */ - if ((sys_config.protocol == PROTOCOL_STATIC_WEP) || - (sys_config.protocol == PROTOCOL_WPA)) { + if ((sys_config.protocol == PROTOCOL_STATIC_WEP) + || (sys_config.protocol == PROTOCOL_WPA)) { if (MLAN_STATUS_SUCCESS != woal_uap_set_11n_status(&sys_config, MLAN_ACT_DISABLE)) { ret = -EFAULT; @@ -2491,9 +2468,7 @@ woal_uap_bss_ctrl(moal_private * priv, t_u8 wait_option, int data) woal_flush_tcp_sess_queue(priv); } done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -2515,11 +2490,11 @@ woal_uap_set_multicast_list(struct net_device *dev) /** * @brief ioctl function - entry point * - * @param dev A pointer to net_device structure - * @param req A pointer to ifreq structure - * @param cmd Command + * @param dev A pointer to net_device structure + * @param req A pointer to ifreq structure + * @param cmd Command * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ int woal_uap_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) @@ -2582,11 +2557,11 @@ woal_uap_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) /** * @brief Get version * - * @param priv A pointer to moal_private structure - * @param version A pointer to version buffer - * @param max_len max length of version buffer + * @param priv A pointer to moal_private structure + * @param version A pointer to version buffer + * @param max_len max length of version buffer * - * @return N/A + * @return N/A */ void woal_uap_get_version(moal_private * priv, char *version, int max_len) @@ -2616,9 +2591,8 @@ woal_uap_get_version(moal_private * priv, char *version, int max_len) info->param.ver_ext.version_str); } - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); - LEAVE(); return; } @@ -2627,7 +2601,7 @@ woal_uap_get_version(moal_private * priv, char *version, int max_len) /** * @brief Get uap statistics * - * @param priv A pointer to moal_private structure + * @param priv A pointer to moal_private structure * @param wait_option Wait option * @param ustats A pointer to mlan_ds_uap_stats structure * @@ -2668,9 +2642,8 @@ woal_uap_get_stats(moal_private * priv, t_u8 wait_option, #endif } - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); - LEAVE(); return status; } @@ -2678,7 +2651,7 @@ woal_uap_get_stats(moal_private * priv, t_u8 wait_option, /** * @brief Set/Get system configuration parameters * - * @param priv A pointer to moal_private structure + * @param priv A pointer to moal_private structure * @param action MLAN_ACT_SET or MLAN_ACT_GET * @param wait_option Wait option * @param sys_cfg A pointer to mlan_uap_bss_param structure @@ -2722,9 +2695,7 @@ woal_set_get_sys_config(moal_private * priv, t_u16 action, t_u8 wait_option, } done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } diff --git a/drivers/net/wireless/sd8797/mlinux/moal_uap_cfg80211.c b/drivers/net/wireless/sd8797/mlinux/moal_uap_cfg80211.c index f5f702bfa916..e399dcad8e21 100644 --- a/drivers/net/wireless/sd8797/mlinux/moal_uap_cfg80211.c +++ b/drivers/net/wireless/sd8797/mlinux/moal_uap_cfg80211.c @@ -21,6 +21,12 @@ #include "moal_cfg80211.h" #include "moal_uap_cfg80211.h" +/** secondary channel is below */ +#define SECOND_CHANNEL_BELOW 0x30 +/** secondary channel is above */ +#define SECOND_CHANNEL_ABOVE 0x10 +/** no secondary channel */ +#define SECONDARY_CHANNEL_NONE 0x00 /******************************************************** Local Variables ********************************************************/ @@ -51,6 +57,7 @@ woal_deauth_station(moal_private * priv, u8 * mac_addr) mlan_ioctl_req *ioctl_req = NULL; mlan_ds_bss *bss = NULL; int ret = 0; + mlan_status status; ENTER(); @@ -68,15 +75,14 @@ woal_deauth_station(moal_private * priv, u8 * mac_addr) MLAN_MAC_ADDR_LENGTH); #define REASON_CODE_DEAUTH_LEAVING 3 bss->param.deauth_param.reason_code = REASON_CODE_DEAUTH_LEAVING; - if (MLAN_STATUS_SUCCESS != - woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT)) { + status = woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { ret = -EFAULT; goto done; } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -96,6 +102,7 @@ woal_deauth_all_station(moal_private * priv) int i = 0; mlan_ds_get_info *info = NULL; mlan_ioctl_req *ioctl_req = NULL; + mlan_status status; ENTER(); if (priv->media_connected == MFALSE) { @@ -118,10 +125,9 @@ woal_deauth_all_station(moal_private * priv) ioctl_req->req_id = MLAN_IOCTL_GET_INFO; ioctl_req->action = MLAN_ACT_GET; - if (MLAN_STATUS_SUCCESS != - woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT)) { + status = woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) goto done; - } if (!info->param.sta_list.sta_count) goto done; for (i = 0; i < info->param.sta_list.sta_count; i++) { @@ -133,8 +139,7 @@ woal_deauth_all_station(moal_private * priv) } woal_sched_timeout(200); done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); return ret; } @@ -308,8 +313,8 @@ woal_find_wpa_ies(const t_u8 * ie, int len, mlan_uap_bss_param * sys_config) element_len = *((t_u8 *) pcurrent_ptr + 1); total_ie_len = element_len + sizeof(IEEEtypes_Header_t); if (bytes_left < total_ie_len) { - PRINTM(MERROR, "InterpretIE: Error in processing IE, " - "bytes left < IE length\n"); + PRINTM(MERROR, + "InterpretIE: Error in processing IE, bytes left < IE length\n"); bytes_left = 0; continue; } @@ -350,17 +355,11 @@ woal_find_wpa_ies(const t_u8 * ie, int len, mlan_uap_bss_param * sys_config) return ret; } -/** secondary channel is below */ -#define SECOND_CHANNEL_BELOW 0x30 -/** secondary channel is above */ -#define SECOND_CHANNEL_ABOVE 0x10 -/** no secondary channel */ -#define SECONDARY_CHANNEL_NONE 0x00 - +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0) || defined(WIFI_DIRECT_SUPPORT) /** * @brief Get second channel offset * - * @param chan channel num + * @param chan channel num * @return second channel offset */ static t_u8 @@ -395,7 +394,6 @@ woal_get_second_channel_offset(int chan) case 161: chan2Offset = SECOND_CHANNEL_BELOW; break; - case 140: case 165: /* Special Case: 20Mhz-only Channel */ chan2Offset = SECONDARY_CHANNEL_NONE; @@ -403,6 +401,7 @@ woal_get_second_channel_offset(int chan) } return chan2Offset; } +#endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) /** @@ -433,21 +432,22 @@ woal_cfg80211_beacon_config(moal_private * priv, #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) || defined(COMPAT_WIRELESS) int i = 0; #else + t_u8 wpa_ies; const t_u8 *ssid_ie = NULL; struct ieee80211_mgmt *head = NULL; t_u16 capab_info = 0; #endif - t_u8 Rates_BG[13] = + t_u8 rates_bg[13] = { 0x82, 0x84, 0x8b, 0x96, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6c, 0 }; - t_u8 Rates_A[9] = { 0x8c, 0x12, 0x98, 0x24, 0xb0, 0x48, 0x60, 0x6c, 0 }; - t_u8 chan2Offset = 0; + t_u8 rates_a[9] = { 0x8c, 0x12, 0x98, 0x24, 0xb0, 0x48, 0x60, 0x6c, 0 }; #ifdef WIFI_DIRECT_SUPPORT - t_u8 Rates_WFD[9] = + t_u8 rates_wfd[9] = { 0x8c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6c, 0 }; #endif - + t_u8 chan2Offset = 0; + t_u8 enable_11n = MTRUE; ENTER(); if (params == NULL) { @@ -493,35 +493,98 @@ woal_cfg80211_beacon_config(moal_private * priv, } if (priv->channel) { memset(sys_config.rates, 0, sizeof(sys_config.rates)); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) + switch (params->chandef.width) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) + case NL80211_CHAN_WIDTH_5: + case NL80211_CHAN_WIDTH_10: +#endif + case NL80211_CHAN_WIDTH_20_NOHT: + enable_11n = MFALSE; + break; + case NL80211_CHAN_WIDTH_20: + break; + case NL80211_CHAN_WIDTH_40: + case NL80211_CHAN_WIDTH_80: + case NL80211_CHAN_WIDTH_80P80: + case NL80211_CHAN_WIDTH_160: + if (params->chandef.center_freq1 < + params->chandef.chan->center_freq) + chan2Offset = SECOND_CHANNEL_BELOW; + else + chan2Offset = SECOND_CHANNEL_ABOVE; + break; + default: + PRINTM(MWARN, "Unknown channel width: %d\n", + params->chandef.width); + break; + } +#else + switch (params->channel_type) { + case NL80211_CHAN_NO_HT: + enable_11n = MFALSE; + break; + case NL80211_CHAN_HT20: + break; + case NL80211_CHAN_HT40PLUS: + chan2Offset = SECOND_CHANNEL_ABOVE; + break; + case NL80211_CHAN_HT40MINUS: + chan2Offset = SECOND_CHANNEL_BELOW; + break; + default: + PRINTM(MWARN, "Unknown channel type: %d\n", + params->channel_type); + break; + } +#endif +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) */ sys_config.channel = priv->channel; if (priv->channel <= MAX_BG_CHANNEL) { sys_config.band_cfg = BAND_CONFIG_2G; #ifdef WIFI_DIRECT_SUPPORT if (priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT) - memcpy(sys_config.rates, Rates_WFD, - sizeof(Rates_WFD)); + memcpy(sys_config.rates, rates_wfd, + sizeof(rates_wfd)); else #endif - memcpy(sys_config.rates, Rates_BG, - sizeof(Rates_BG)); + memcpy(sys_config.rates, rates_bg, + sizeof(rates_bg)); } else { sys_config.band_cfg = BAND_CONFIG_5G; +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0) chan2Offset = woal_get_second_channel_offset(priv->channel); - if (chan2Offset) { - sys_config.band_cfg |= chan2Offset; - sys_config.ht_cap_info = 0x117e; - sys_config.ampdu_param = 3; - } +#else #ifdef WIFI_DIRECT_SUPPORT + /* Force enable 40MHZ on WFD interface */ if (priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT) - memcpy(sys_config.rates, Rates_WFD, - sizeof(Rates_WFD)); + chan2Offset = + woal_get_second_channel_offset(priv-> + channel); +#endif +#endif + +#ifdef WIFI_DIRECT_SUPPORT + if (priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT) + memcpy(sys_config.rates, rates_wfd, + sizeof(rates_wfd)); else #endif - memcpy(sys_config.rates, Rates_A, - sizeof(Rates_A)); + memcpy(sys_config.rates, rates_a, + sizeof(rates_a)); + } + sys_config.ht_cap_info = 0x111c; + if (chan2Offset) { + sys_config.band_cfg |= chan2Offset; + sys_config.ht_cap_info |= 0x72; + sys_config.ampdu_param = 3; } + PRINTM(MCMND, + "11n=%d, ht_cap=0x%x, channel=%d, band_cfg=0x%x\n", + enable_11n, sys_config.ht_cap_info, priv->channel, + sys_config.band_cfg); } #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) || defined(COMPAT_WIRELESS) if (!params->ssid || !params->ssid_len) { @@ -638,14 +701,9 @@ woal_cfg80211_beacon_config(moal_private * priv, fixed element length for beacon */ #define BEACON_IE_OFFSET 36 /* Find SSID in head SSID IE id: 0, right now use hard code */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) - ssid_ie = woal_parse_ie_tlv(params->beacon.head + BEACON_IE_OFFSET, - params->beacon.head_len - BEACON_IE_OFFSET, - 0); -#else ssid_ie = woal_parse_ie_tlv(params->head + BEACON_IE_OFFSET, params->head_len - BEACON_IE_OFFSET, 0); -#endif + if (!ssid_ie) { PRINTM(MERROR, "No ssid IE found.\n"); ret = -EFAULT; @@ -658,11 +716,8 @@ woal_cfg80211_beacon_config(moal_private * priv, } memcpy(sys_config.ssid.ssid, ssid_ie + 2, *(ssid_ie + 1)); sys_config.ssid.ssid_len = *(ssid_ie + 1); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) - head = (struct ieee80211_mgmt *)params->beacon.head; -#else head = (struct ieee80211_mgmt *)params->head; -#endif + capab_info = le16_to_cpu(head->u.beacon.capab_info); PRINTM(MIOCTL, "capab_info=0x%x\n", head->u.beacon.capab_info); sys_config.auth_mode = MLAN_AUTH_MODE_OPEN; @@ -672,25 +727,22 @@ woal_cfg80211_beacon_config(moal_private * priv, sys_config.protocol = PROTOCOL_STATIC_WEP; sys_config.key_mgmt = KEY_MGMT_NONE; sys_config.wpa_cfg.length = 0; - sys_config.wep_cfg.key0.key_index = priv->key_index; - sys_config.wep_cfg.key0.is_default = 1; - sys_config.wep_cfg.key0.length = priv->key_len; - memcpy(sys_config.wep_cfg.key0.key, priv->key_material, - priv->key_len); + memcpy(&sys_config.wep_cfg.key0, &priv->uap_wep_key[0], + sizeof(wep_key)); + memcpy(&sys_config.wep_cfg.key1, &priv->uap_wep_key[1], + sizeof(wep_key)); + memcpy(&sys_config.wep_cfg.key2, &priv->uap_wep_key[2], + sizeof(wep_key)); + memcpy(&sys_config.wep_cfg.key3, &priv->uap_wep_key[3], + sizeof(wep_key)); } else { /** Get cipher and key_mgmt from RSN/WPA IE */ if (capab_info & WLAN_CAPABILITY_PRIVACY) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) - if (MFALSE == - woal_find_wpa_ies(params->beacon.tail, - (int)params->beacon.tail_len, - &sys_config)) -#else - if (MFALSE == - woal_find_wpa_ies(params->tail, params->tail_len, - &sys_config)) -#endif - { + wpa_ies = + woal_find_wpa_ies(params->tail, + params->tail_len, + &sys_config); + if (wpa_ies == MFALSE) { /* hard code setting to wpa2-psk */ sys_config.protocol = PROTOCOL_WPA2; sys_config.key_mgmt = KEY_MGMT_PSK; @@ -707,6 +759,8 @@ woal_cfg80211_beacon_config(moal_private * priv, wpa2-psk, it will automatically enable 11n */ if ((sys_config.protocol == PROTOCOL_STATIC_WEP) || (sys_config.protocol == PROTOCOL_WPA)) + enable_11n = MFALSE; + if (!enable_11n) woal_uap_set_11n_status(&sys_config, MLAN_ACT_DISABLE); else woal_uap_set_11n_status(&sys_config, MLAN_ACT_ENABLE); @@ -726,7 +780,7 @@ done: #if LINUX_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION /** * @brief Callback function for virtual interface - * setup + * setup * * @param dev A pointer to structure net_device * @@ -951,7 +1005,7 @@ woal_bss_remove(moal_private * priv) status = woal_request_ioctl(priv, req, MOAL_CMD_WAIT); done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -1181,7 +1235,7 @@ woal_cfg80211_add_virtual_intf(struct wiphy *wiphy, #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0) #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 37) || defined(COMPAT_WIRELESS) if (ret) - return NULL; + return ERR_PTR(ret); else return ndev; #else @@ -1189,7 +1243,7 @@ woal_cfg80211_add_virtual_intf(struct wiphy *wiphy, #endif #else if (ret) - return NULL; + return ERR_PTR(ret); else return ndev->ieee80211_ptr; #endif @@ -1296,96 +1350,61 @@ woal_cfg80211_add_beacon(struct wiphy *wiphy, } /* set mgmt frame ies */ - if (MLAN_STATUS_SUCCESS != woal_cfg80211_mgmt_frame_ie(priv, + ret = woal_cfg80211_mgmt_frame_ie(priv, #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0) && !defined(COMPAT_WIRELESS) - params-> - tail, - params-> - tail_len, - NULL, 0, - NULL, 0, - NULL, 0, - MGMT_MASK_BEACON + params->tail, + params->tail_len, NULL, 0, + NULL, 0, NULL, 0, + MGMT_MASK_BEACON #else #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) - params-> - beacon. - tail, - params-> - beacon. - tail_len, - params-> - beacon. - proberesp_ies, - params-> - beacon. - proberesp_ies_len, - params-> - beacon. - assocresp_ies, - params-> - beacon. - assocresp_ies_len, + params->beacon.tail, + params->beacon.tail_len, + params->beacon.proberesp_ies, + params->beacon. + proberesp_ies_len, + params->beacon.assocresp_ies, + params->beacon. + assocresp_ies_len, #else - params-> - tail, - params-> - tail_len, - params-> - proberesp_ies, - params-> - proberesp_ies_len, - params-> - assocresp_ies, - params-> - assocresp_ies_len, + params->tail, + params->tail_len, + params->proberesp_ies, + params->proberesp_ies_len, + params->assocresp_ies, + params->assocresp_ies_len, #endif - NULL, 0, - MGMT_MASK_BEACON - | - MGMT_MASK_PROBE_RESP - | - MGMT_MASK_ASSOC_RESP + NULL, 0, + MGMT_MASK_BEACON | + MGMT_MASK_PROBE_RESP | + MGMT_MASK_ASSOC_RESP #endif - )) { - ret = -EFAULT; + ); + if (ret) goto done; - } } #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) || defined(COMPAT_WIRELESS) #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) if (params->beacon.beacon_ies && params->beacon.beacon_ies_len) { - if (MLAN_STATUS_SUCCESS != woal_cfg80211_mgmt_frame_ie(priv, - params-> - beacon. - beacon_ies, - params-> - beacon. - beacon_ies_len, - NULL, 0, - NULL, 0, - NULL, 0, - MGMT_MASK_BEACON_WPS_P2P)) - { + ret = woal_cfg80211_mgmt_frame_ie(priv, + params->beacon.beacon_ies, + params->beacon.beacon_ies_len, + NULL, 0, NULL, 0, NULL, 0, + MGMT_MASK_BEACON_WPS_P2P); + if (ret) { PRINTM(MERROR, "Failed to set beacon wps/p2p ie\n"); - ret = -EFAULT; goto done; } } #else if (params->beacon_ies && params->beacon_ies_len) { - if (MLAN_STATUS_SUCCESS != woal_cfg80211_mgmt_frame_ie(priv, - params-> - beacon_ies, - params-> - beacon_ies_len, - NULL, 0, - NULL, 0, - NULL, 0, - MGMT_MASK_BEACON_WPS_P2P)) - { + ret = woal_cfg80211_mgmt_frame_ie(priv, + params->beacon_ies, + params->beacon_ies_len, NULL, + 0, NULL, 0, NULL, 0, + MGMT_MASK_BEACON_WPS_P2P); + if (ret) { PRINTM(MERROR, "Failed to set beacon wps/p2p ie\n"); - ret = -EFAULT; goto done; } } @@ -1444,65 +1463,58 @@ woal_cfg80211_set_beacon(struct wiphy *wiphy, if (params != NULL) { #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0) && !defined(COMPAT_WIRELESS) if (params->tail && params->tail_len) { - if (MLAN_STATUS_SUCCESS != - woal_cfg80211_mgmt_frame_ie(priv, - params->tail, - params->tail_len, NULL, - 0, NULL, 0, NULL, 0, - MGMT_MASK_BEACON)) { - ret = -EFAULT; + ret = woal_cfg80211_mgmt_frame_ie(priv, + params->tail, + params->tail_len, + NULL, 0, NULL, 0, + NULL, 0, + MGMT_MASK_BEACON); + if (ret) goto done; - } } #else if (params->tail && params->tail_len) { - if (MLAN_STATUS_SUCCESS != - woal_cfg80211_mgmt_frame_ie(priv, params->tail, - params->tail_len, NULL, - 0, NULL, 0, NULL, 0, - MGMT_MASK_BEACON)) { - ret = -EFAULT; + ret = woal_cfg80211_mgmt_frame_ie(priv, params->tail, + params->tail_len, + NULL, 0, NULL, 0, + NULL, 0, + MGMT_MASK_BEACON); + if (ret) goto done; - } } if (params->beacon_ies && params->beacon_ies_len) { - if (MLAN_STATUS_SUCCESS != - woal_cfg80211_mgmt_frame_ie(priv, - params->beacon_ies, - params->beacon_ies_len, - NULL, 0, NULL, 0, NULL, - 0, - MGMT_MASK_BEACON_WPS_P2P)) - { + ret = woal_cfg80211_mgmt_frame_ie(priv, + params->beacon_ies, + params-> + beacon_ies_len, NULL, + 0, NULL, 0, NULL, 0, + MGMT_MASK_BEACON_WPS_P2P); + if (ret) { PRINTM(MERROR, "Failed to set beacon wps/p2p ie\n"); - ret = -EFAULT; goto done; } } if (params->proberesp_ies && params->proberesp_ies_len) { - if (MLAN_STATUS_SUCCESS != - woal_cfg80211_mgmt_frame_ie(priv, NULL, 0, - params->proberesp_ies, - params-> - proberesp_ies_len, NULL, - 0, NULL, 0, - MGMT_MASK_PROBE_RESP)) { - ret = -EFAULT; + ret = woal_cfg80211_mgmt_frame_ie(priv, NULL, 0, + params->proberesp_ies, + params-> + proberesp_ies_len, + NULL, 0, NULL, 0, + MGMT_MASK_PROBE_RESP); + if (ret) goto done; - } } if (params->assocresp_ies && params->assocresp_ies_len) { - if (MLAN_STATUS_SUCCESS != - woal_cfg80211_mgmt_frame_ie(priv, NULL, 0, NULL, 0, - params->assocresp_ies, - params-> - assocresp_ies_len, NULL, - 0, - MGMT_MASK_ASSOC_RESP)) { - ret = -EFAULT; + ret = woal_cfg80211_mgmt_frame_ie(priv, NULL, 0, NULL, + 0, + params->assocresp_ies, + params-> + assocresp_ies_len, + NULL, 0, + MGMT_MASK_ASSOC_RESP); + if (ret) goto done; - } } #endif } @@ -1584,8 +1596,8 @@ done: * @return 0 -- success, otherwise fail */ int -woal_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev, - u8 * mac_addr) +woal_cfg80211_del_station(struct wiphy *wiphy, + struct net_device *dev, u8 * mac_addr) { moal_private *priv = (moal_private *) woal_get_netdev_priv(dev); ENTER(); @@ -1630,6 +1642,7 @@ woal_uap_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, int i = 0; mlan_ds_get_info *info = NULL; mlan_ioctl_req *ioctl_req = NULL; + mlan_status status; ENTER(); if (priv->media_connected == MFALSE) { @@ -1652,10 +1665,9 @@ woal_uap_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, ioctl_req->req_id = MLAN_IOCTL_GET_INFO; ioctl_req->action = MLAN_ACT_GET; - if (MLAN_STATUS_SUCCESS != - woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT)) { + status = woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) goto done; - } for (i = 0; i < info->param.sta_list.sta_count; i++) { if (!memcmp (info->param.sta_list.info[i].mac_address, mac, ETH_ALEN)) { @@ -1672,8 +1684,7 @@ woal_uap_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, } } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } diff --git a/drivers/net/wireless/sd8797/mlinux/moal_uap_priv.c b/drivers/net/wireless/sd8797/mlinux/moal_uap_priv.c index 71df785e9e28..9b91d16448f8 100644 --- a/drivers/net/wireless/sd8797/mlinux/moal_uap_priv.c +++ b/drivers/net/wireless/sd8797/mlinux/moal_uap_priv.c @@ -47,9 +47,9 @@ Change log: /** * @brief ioctl function for wireless IOCTLs * - * @param dev A pointer to net_device structure - * @param req A pointer to ifreq structure - * @param cmd Command + * @param dev A pointer to net_device structure + * @param req A pointer to ifreq structure + * @param cmd Command * * @return 0 --success, otherwise fail */ @@ -156,10 +156,10 @@ woal_uap_do_priv_ioctl(struct net_device *dev, struct ifreq *req, int cmd) /** * @brief Handle get info resp * - * @param priv Pointer to moal_private structure - * @param info Pointer to mlan_ds_get_info structure + * @param priv Pointer to moal_private structure + * @param info Pointer to mlan_ds_get_info structure * - * @return N/A + * @return N/A */ void woal_ioctl_get_uap_info_resp(moal_private * priv, mlan_ds_get_info * info) diff --git a/drivers/net/wireless/sd8797/mlinux/moal_uap_wext.c b/drivers/net/wireless/sd8797/mlinux/moal_uap_wext.c index 84fadfc2557c..7f5d0e931b90 100644 --- a/drivers/net/wireless/sd8797/mlinux/moal_uap_wext.c +++ b/drivers/net/wireless/sd8797/mlinux/moal_uap_wext.c @@ -219,11 +219,10 @@ woal_get_wap(struct net_device *dev, struct iw_request_info *info, ENTER(); - if (priv->bss_started) { + if (priv->bss_started) memcpy(awrq->sa_data, priv->current_addr, MLAN_MAC_ADDR_LENGTH); - } else { + else memset(awrq->sa_data, 0, MLAN_MAC_ADDR_LENGTH); - } awrq->sa_family = ARPHRD_ETHER; LEAVE(); @@ -358,10 +357,8 @@ woal_set_freq(struct net_device *dev, struct iw_request_info *info, } done: - if (sys_cfg) - kfree(sys_cfg); - if (ap_cfg) - kfree(ap_cfg); + kfree(sys_cfg); + kfree(ap_cfg); LEAVE(); return ret; } @@ -395,10 +392,11 @@ woal_get_freq(struct net_device *dev, struct iw_request_info *info, LEAVE(); return -EFAULT; } + band = ap_cfg.band_cfg & BAND_CONFIG_5GHZ; + fwrq->m = (long)channel_to_frequency(ap_cfg.channel, band); fwrq->i = (long)ap_cfg.channel; - fwrq->m = (long)(channel_to_frequency(ap_cfg.channel, band)) * 100000; - fwrq->e = 1; + fwrq->e = 6; LEAVE(); return ret; @@ -628,10 +626,8 @@ woal_set_encode(struct net_device *dev, struct iw_request_info *info, } done: - if (sys_cfg) - kfree(sys_cfg); - if (ap_cfg) - kfree(ap_cfg); + kfree(sys_cfg); + kfree(ap_cfg); LEAVE(); return ret; } @@ -1005,8 +1001,7 @@ woal_set_encode_ext(struct net_device *dev, } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1060,8 +1055,9 @@ woal_set_mlme(struct net_device *dev, memset(sta_addr, 0, ETH_ALEN); if ((mlme->cmd == IW_MLME_DEAUTH) || (mlme->cmd == IW_MLME_DISASSOC)) { memcpy(sta_addr, (t_u8 *) mlme->addr.sa_data, ETH_ALEN); - PRINTM(MIOCTL, "Deauth station: " MACSTR ", " - "reason=%d\n", MAC2STR(sta_addr), mlme->reason_code); + PRINTM(MIOCTL, + "Deauth station: " MACSTR ", reason=%d\n", + MAC2STR(sta_addr), mlme->reason_code); /* FIXME: For flushing all stations we need to use zero MAC, but right now the FW does not support this. So, manually @@ -1094,10 +1090,8 @@ woal_set_mlme(struct net_device *dev, } memcpy(sta_list, &pinfo->param.sta_list, sizeof(mlan_ds_sta_list)); - if (req) { - kfree(req); - req = NULL; - } + kfree(req); + req = NULL; } req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_bss)); if (req == NULL) { @@ -1137,11 +1131,8 @@ woal_set_mlme(struct net_device *dev, } done: - if (req) - kfree(req); - if (sta_list) - kfree(sta_list); - + kfree(req); + kfree(sta_list); LEAVE(); return ret; } diff --git a/drivers/net/wireless/sd8797/mlinux/moal_wext.c b/drivers/net/wireless/sd8797/mlinux/moal_wext.c index 211be9ae3042..348dc794af08 100644 --- a/drivers/net/wireless/sd8797/mlinux/moal_wext.c +++ b/drivers/net/wireless/sd8797/mlinux/moal_wext.c @@ -283,8 +283,7 @@ woal_set_freq(struct net_device *dev, struct iw_request_info *info, ret = -EFAULT; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -329,9 +328,7 @@ woal_get_freq(struct net_device *dev, struct iw_request_info *info, fwrq->e = 6; fwrq->flags = IW_FREQ_FIXED; done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -389,8 +386,7 @@ woal_set_bss_mode(struct net_device *dev, struct iw_request_info *info, goto done; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -419,11 +415,10 @@ woal_get_wap(struct net_device *dev, struct iw_request_info *info, woal_get_bss_info(priv, MOAL_IOCTL_WAIT, &bss_info); - if (bss_info.media_connected == MTRUE) { + if (bss_info.media_connected == MTRUE) memcpy(awrq->sa_data, &bss_info.bssid, MLAN_MAC_ADDR_LENGTH); - } else { + else memset(awrq->sa_data, 0, MLAN_MAC_ADDR_LENGTH); - } awrq->sa_family = ARPHRD_ETHER; LEAVE(); @@ -954,9 +949,7 @@ woal_set_encode(struct net_device *dev, struct iw_request_info *info, ret = -EFAULT; } done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -1050,9 +1043,7 @@ woal_get_encode(struct net_device *dev, struct iw_request_info *info, dwrq->flags |= IW_ENCODE_NOKEY; done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -1373,8 +1364,7 @@ woal_set_gen_ie(struct net_device *dev, struct iw_request_info *info, } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -1467,7 +1457,7 @@ woal_set_encode_ext(struct net_device *dev, sec->param.encrypt_key.key_flags, MAC2STR(sec->param.encrypt_key.mac_addr)); DBG_HEXDUMP(MCMD_D, "wpa key", pkey_material, ext->key_len); -#define IW_ENCODE_ALG_AES_CMAC 5 +#define IW_ENCODE_ALG_AES_CMAC 5 if (ext->alg == IW_ENCODE_ALG_AES_CMAC) sec->param.encrypt_key.key_flags |= KEY_FLAG_AES_MCAST_IGTK; @@ -1487,8 +1477,7 @@ woal_set_encode_ext(struct net_device *dev, woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT)) ret = -EFAULT; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1955,8 +1944,7 @@ woal_set_rxfilter(moal_private * priv, BOOLEAN enable) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2202,12 +2190,10 @@ woal_set_priv(struct net_device *dev, struct iw_request_info *info, } PRINTM(MIOCTL, "PRIV Command return: %s, length=%d\n", buf, len); dwrq->length = (t_u16) len; - if (copy_to_user(dwrq->pointer, buf, dwrq->length)) { + if (copy_to_user(dwrq->pointer, buf, dwrq->length)) ret = -EFAULT; - } done: - if (buf) - kfree(buf); + kfree(buf); LEAVE(); return ret; } @@ -2561,9 +2547,8 @@ woal_get_scan(struct net_device *dev, struct iw_request_info *info, scan_table = (BSSDescriptor_t *) scan_resp.pscan_table; if (dwrq->length) end_buf = extra + dwrq->length; - if (priv->media_connected == MTRUE) { + if (priv->media_connected == MTRUE) PRINTM(MINFO, "Current Ssid: %-32s\n", bss_info.ssid.ssid); - } PRINTM(MINFO, "Scan: Get: NumInScanTable = %d\n", (int)scan_resp.num_in_scan_table); @@ -2590,9 +2575,8 @@ woal_get_scan(struct net_device *dev, struct iw_request_info *info, /* check ssid is valid or not, ex. hidden ssid will be filter out */ - if (woal_ssid_valid(&scan_table[i].ssid) == MFALSE) { + if (woal_ssid_valid(&scan_table[i].ssid) == MFALSE) continue; - } /* First entry *MUST* be the AP MAC address */ iwe.cmd = SIOCGIWAP; @@ -2608,9 +2592,8 @@ woal_get_scan(struct net_device *dev, struct iw_request_info *info, /* Add the ESSID */ iwe.u.data.length = scan_table[i].ssid.ssid_len; - if (iwe.u.data.length > 32) { + if (iwe.u.data.length > 32) iwe.u.data.length = 32; - } iwe.cmd = SIOCGIWESSID; iwe.u.essid.flags = (i + 1) & IW_ENCODE_INDEX; @@ -2647,11 +2630,11 @@ woal_get_scan(struct net_device *dev, struct iw_request_info *info, /* Add quality statistics */ iwe.cmd = IWEVQUAL; iwe.u.qual.level = SCAN_RSSI(scan_table[i].rssi); - if (!bss_info.bcn_nf_last) { + if (!bss_info.bcn_nf_last) iwe.u.qual.noise = MRVDRV_NF_DEFAULT_SCAN_VALUE; - } else { + else iwe.u.qual.noise = bss_info.bcn_nf_last; - } + if ((bss_info.bss_mode == MLAN_BSS_MODE_IBSS) && !woal_ssid_cmp(&bss_info.ssid, &scan_table[i].ssid) && bss_info.adhoc_state == ADHOC_STARTED) { @@ -2674,11 +2657,11 @@ woal_get_scan(struct net_device *dev, struct iw_request_info *info, /* Add encryption capability */ iwe.cmd = SIOCGIWENCODE; - if (scan_table[i].privacy) { + if (scan_table[i].privacy) iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; - } else { + else iwe.u.data.flags = IW_ENCODE_DISABLED; - } + iwe.u.data.length = 0; iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; current_ev = @@ -2695,9 +2678,8 @@ woal_get_scan(struct net_device *dev, struct iw_request_info *info, /* Bit rate given in 500 kb/s units (+ 0x80) */ for (j = 0; j < sizeof(scan_table[i].supported_rates); j++) { - if (!scan_table[i].supported_rates[j]) { + if (!scan_table[i].supported_rates[j]) break; - } iwe.u.bitrate.value = (scan_table[i].supported_rates[j] & 0x7f) * @@ -2819,7 +2801,7 @@ woal_get_scan(struct net_device *dev, struct iw_request_info *info, ptr += sprintf(ptr, "bg"); iwe.u.data.length = strlen(buf); PRINTM(MINFO, "iwe.u.data.length %d\n", iwe.u.data.length); - PRINTM(MINFO, "BUF: %s \n", buf); + PRINTM(MINFO, "BUF: %s\n", buf); iwe.cmd = IWEVCUSTOM; iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; current_ev = @@ -2841,8 +2823,7 @@ woal_get_scan(struct net_device *dev, struct iw_request_info *info, #endif done: - if (buf) - kfree(buf); + kfree(buf); LEAVE(); return ret; } @@ -2952,9 +2933,9 @@ static const iw_handler woal_private_handler[] = { * @brief This function sends customized event to application. * * @param priv A pointer to moal_private structure - * @param str A pointer to event string + * @param str A pointer to event string * - * @return N/A + * @return N/A */ void woal_send_iwevcustom_event(moal_private * priv, char *str) @@ -2988,7 +2969,7 @@ woal_send_iwevcustom_event(moal_private * priv, char *str) * @param priv A pointer to moal_private structure * @param event MIC MERROR EVENT. * - * @return N/A + * @return N/A */ void woal_send_mic_error_event(moal_private * priv, t_u32 event) @@ -3062,12 +3043,11 @@ woal_get_wireless_stats(struct net_device *dev) /* Send RSSI command to get beacon RSSI/NF, valid only if associated */ if (priv->media_connected == MTRUE) { if (MLAN_STATUS_SUCCESS == - woal_get_signal_info(priv, wait_option, NULL)) { + woal_get_signal_info(priv, wait_option, NULL)) priv->w_stats.qual.qual = woal_rssi_to_quality((t_s16) (priv->w_stats.qual.level - 0x100)); - } } #if WIRELESS_EXT > 18 priv->w_stats.qual.updated |= (IW_QUAL_ALL_UPDATED | IW_QUAL_DBM); diff --git a/drivers/net/wireless/sd8897/mlan/mlan_11ac.c b/drivers/net/wireless/sd8897/mlan/mlan_11ac.c index 763dc071c80a..f16ebb667744 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_11ac.c +++ b/drivers/net/wireless/sd8897/mlan/mlan_11ac.c @@ -44,7 +44,8 @@ /******************************************************** Local Functions ********************************************************/ - +t_u16 wlan_convert_mcsmap_to_maxrate(mlan_private * priv, t_u8 bands, + t_u16 mcs_map); /** * @brief determine the center frquency center index for bandwidth * of 80 MHz and 160 MHz @@ -136,8 +137,7 @@ wlan_get_center_freq_idx(IN mlan_private * pmpriv, * @return N/A */ static void -wlan_fill_cap_info(mlan_private * priv, - MrvlIETypes_VHTCap_t * pvht_cap, t_u8 bands) +wlan_fill_cap_info(mlan_private * priv, VHT_capa_t * vht_cap, t_u8 bands) { mlan_adapter *pmadapter = priv->adapter; t_u32 usr_dot_11ac_dev_cap; @@ -149,7 +149,7 @@ wlan_fill_cap_info(mlan_private * priv, else usr_dot_11ac_dev_cap = pmadapter->usr_dot_11ac_dev_cap_bg; - pvht_cap->vht_cap.vht_cap_info = usr_dot_11ac_dev_cap; + vht_cap->vht_cap_info = usr_dot_11ac_dev_cap; LEAVE(); } @@ -351,6 +351,26 @@ wlan_11ac_ioctl_vhtcfg(IN pmlan_adapter pmadapter, cfg->param.vht_cfg.vht_tx_mcs = GET_DEVTXMCSMAP(pmadapter-> usr_dot_11ac_mcs_support); + cfg->param.vht_cfg.vht_rx_max_rate = + wlan_convert_mcsmap_to_maxrate(pmpriv, + cfg-> + param. + vht_cfg. + band, + cfg-> + param. + vht_cfg. + vht_rx_mcs); + cfg->param.vht_cfg.vht_tx_max_rate = + wlan_convert_mcsmap_to_maxrate(pmpriv, + cfg-> + param. + vht_cfg. + band, + cfg-> + param. + vht_cfg. + vht_tx_mcs); } LEAVE(); return ret; @@ -627,7 +647,7 @@ wlan_fill_vht_cap_tlv(mlan_private * priv, ENTER(); /* Fill VHT cap info */ - wlan_fill_cap_info(priv, pvht_cap, bands); + wlan_fill_cap_info(priv, &pvht_cap->vht_cap, bands); pvht_cap->vht_cap.vht_cap_info = wlan_cpu_to_le32(pvht_cap->vht_cap.vht_cap_info); @@ -685,6 +705,197 @@ wlan_fill_vht_cap_tlv(mlan_private * priv, } /** + * @brief This function fills the VHT cap tlv out put format is CPU + * + * @param priv A pointer to mlan_private structure + * @param pvht_cap A pointer to MrvlIETypes_HTCap_t structure + * @param bands Band configuration + * + * @return N/A + */ +void +wlan_fill_vht_cap_ie(mlan_private * priv, + IEEEtypes_VHTCap_t * pvht_cap, t_u8 bands) +{ + mlan_adapter *pmadapter = priv->adapter; + + ENTER(); + + pvht_cap->ieee_hdr.element_id = VHT_CAPABILITY; + pvht_cap->ieee_hdr.len = sizeof(VHT_capa_t); + + /* Fill VHT cap info */ + wlan_fill_cap_info(priv, &pvht_cap->vht_cap, bands); + + /* rx MCS map */ + pvht_cap->vht_cap.mcs_sets.rx_mcs_map = + GET_DEVRXMCSMAP(pmadapter->usr_dot_11ac_mcs_support); + + /* rx highest rate */ + pvht_cap->vht_cap.mcs_sets.rx_max_rate = + wlan_convert_mcsmap_to_maxrate(priv, bands, + pvht_cap->vht_cap.mcs_sets. + rx_mcs_map); + + /* tx MCS map */ + pvht_cap->vht_cap.mcs_sets.tx_mcs_map = + GET_DEVTXMCSMAP(pmadapter->usr_dot_11ac_mcs_support); + /* tx highest rate */ + pvht_cap->vht_cap.mcs_sets.tx_max_rate = + wlan_convert_mcsmap_to_maxrate(priv, bands, + pvht_cap->vht_cap.mcs_sets. + tx_mcs_map); + + LEAVE(); + return; +} + +/* + * @brief This function check if AP is in 11ac mode + * + * @param priv A pointer to mlan_private structure + * + * @return MTRUE/MFALSE + */ +t_u8 +wlan_is_ap_in_11ac_mode(mlan_private * priv) +{ + BSSDescriptor_t *pbss_desc; + IEEEtypes_VHTOprat_t *vht_oprat = MNULL; + pbss_desc = &priv->curr_bss_params.bss_descriptor; + vht_oprat = pbss_desc->pvht_oprat; + if (!pbss_desc->pvht_cap) + return MFALSE; + if (vht_oprat && (vht_oprat->ieee_hdr.element_id == VHT_OPERATION)) { + if (vht_oprat->chan_width == VHT_OPER_CHWD_20_40MHZ) + return MFALSE; + else + return MTRUE; + } else + return MFALSE; +} + +/** + * @brief This function fills the VHTOperation ie out put format is CPU + * + * @param priv A pointer to mlan_private structure + * @param vht_oprat A pointer to IEEEtypes_VHTOprat_t structure + * @param bands Band configuration + * + * @return N/A + */ +void +wlan_fill_tdls_vht_oprat_ie(mlan_private * priv, + IEEEtypes_VHTOprat_t * vht_oprat, + sta_node * sta_ptr) +{ + mlan_adapter *pmadapter = priv->adapter; + t_u8 supp_chwd_set; + t_u8 peer_supp_chwd_set; + t_u8 ap_supp_chwd_set; + t_u32 usr_vht_cap_info; + + t_u16 mcs_map_user = 0; + t_u16 mcs_map_resp = 0; + t_u16 mcs_map_result = 0; + t_u16 mcs_user = 0; + t_u16 mcs_resp = 0; + t_u16 nss; + t_u8 chan_bw = 0; + BSSDescriptor_t *pbss_desc; + IEEEtypes_VHTCap_t *pvht_cap = &sta_ptr->vht_cap; + IEEEtypes_VHTCap_t *ap_vht_cap = MNULL; + ENTER(); + + pbss_desc = &priv->curr_bss_params.bss_descriptor; + + // Check if AP is in 11ac mode + if (MFALSE == wlan_is_ap_in_11ac_mode(priv)) { + if (sta_ptr->ExtCap.ieee_hdr.element_id != EXT_CAPABILITY) { + PRINTM(MMSG, "No Peer's Ext_cap info\n"); + return; + } + if (!ISSUPP_EXTCAP_TDLS_WIDER_BANDWIDTH + (sta_ptr->ExtCap.ext_cap)) { + PRINTM(MMSG, + "Peer don't support Wider Bandwitch in Ext_cap\n"); + return; + } + } else { + ap_vht_cap = pbss_desc->pvht_cap; + } + + vht_oprat->ieee_hdr.element_id = VHT_OPERATION; + vht_oprat->ieee_hdr.len = + sizeof(IEEEtypes_VHTOprat_t) - sizeof(IEEEtypes_Header_t); + + if (pbss_desc->bss_band & BAND_A) + usr_vht_cap_info = pmadapter->usr_dot_11ac_dev_cap_a; + else + usr_vht_cap_info = pmadapter->usr_dot_11ac_dev_cap_bg; + + /* find the minmum bandwith between AP/TDLS peers */ + supp_chwd_set = GET_VHTCAP_CHWDSET(usr_vht_cap_info); + peer_supp_chwd_set = GET_VHTCAP_CHWDSET(pvht_cap->vht_cap.vht_cap_info); + supp_chwd_set = MIN(supp_chwd_set, peer_supp_chwd_set); + + /* We need check AP's bandwidth when TDLS_WIDER_BANDWIDTH is off */ + if (ap_vht_cap && + !ISSUPP_EXTCAP_TDLS_WIDER_BANDWIDTH(sta_ptr->ExtCap.ext_cap)) { + ap_supp_chwd_set = + GET_VHTCAP_CHWDSET(ap_vht_cap->vht_cap.vht_cap_info); + supp_chwd_set = MIN(supp_chwd_set, ap_supp_chwd_set); + } + switch (supp_chwd_set) { + case VHT_CAP_CHWD_80MHZ: + vht_oprat->chan_width = VHT_OPER_CHWD_80MHZ; + break; + case VHT_CAP_CHWD_160MHZ: + vht_oprat->chan_width = VHT_OPER_CHWD_160MHZ; + break; + case VHT_CAP_CHWD_80_80MHZ: + vht_oprat->chan_width = VHT_OPER_CHWD_80_80MHZ; + break; + + } + + /* Fill BASIC VHT MCS and NSS Set */ + /* rx MCS Set, find the minimum of the user rx mcs and peer rx mcs */ + mcs_map_user = GET_DEVRXMCSMAP(pmadapter->usr_dot_11ac_mcs_support); + mcs_map_resp = pvht_cap->vht_cap.mcs_sets.rx_mcs_map; + mcs_map_result = 0; + for (nss = 1; nss <= 8; nss++) { + mcs_user = GET_VHTNSSMCS(mcs_map_user, nss); + mcs_resp = GET_VHTNSSMCS(mcs_map_resp, nss); + if ((mcs_user == NO_NSS_SUPPORT) || + (mcs_resp == NO_NSS_SUPPORT)) + SET_VHTNSSMCS(mcs_map_result, nss, NO_NSS_SUPPORT); + else + SET_VHTNSSMCS(mcs_map_result, nss, + MIN(mcs_user, mcs_resp)); + } + /* Basic MCS map */ + vht_oprat->basic_MCS_map = mcs_map_result; + switch (vht_oprat->chan_width) { + case VHT_OPER_CHWD_80MHZ: + chan_bw = CHANNEL_BW_80MHZ; + break; + case VHT_OPER_CHWD_160MHZ: + chan_bw = CHANNEL_BW_160MHZ; + break; + case VHT_OPER_CHWD_80_80MHZ: + chan_bw = CHANNEL_BW_80MHZ; + break; + } + vht_oprat->chan_center_freq_1 = + wlan_get_center_freq_idx(priv, BAND_AAC, pbss_desc->channel, + chan_bw); + + LEAVE(); + return; +} + +/** * @brief This function append the 802_11N tlv * * @param pmpriv A pointer to mlan_private structure @@ -925,6 +1136,16 @@ wlan_ret_11ac_cfg(IN pmlan_private pmpriv, &vhtcfg->vht_supp_mcs_set[4], sizeof(t_u32)); cfg->param.vht_cfg.vht_tx_mcs = wlan_le32_to_cpu(cfg->param.vht_cfg.vht_tx_mcs); + cfg->param.vht_cfg.vht_rx_max_rate = + wlan_convert_mcsmap_to_maxrate(pmpriv, + cfg->param.vht_cfg.band, + cfg->param.vht_cfg. + vht_rx_mcs); + cfg->param.vht_cfg.vht_tx_max_rate = + wlan_convert_mcsmap_to_maxrate(pmpriv, + cfg->param.vht_cfg.band, + cfg->param.vht_cfg. + vht_tx_mcs); } LEAVE(); return MLAN_STATUS_SUCCESS; diff --git a/drivers/net/wireless/sd8897/mlan/mlan_11ac.h b/drivers/net/wireless/sd8897/mlan/mlan_11ac.h index 3ed600df4d3b..be4a0ed0c986 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_11ac.h +++ b/drivers/net/wireless/sd8897/mlan/mlan_11ac.h @@ -38,6 +38,12 @@ t_u16 wlan_convert_mcsmap_to_maxrate(mlan_private * priv, t_u8 bands, t_u16 mcs_map); void wlan_fill_vht_cap_tlv(mlan_private * priv, MrvlIETypes_VHTCap_t * pvht_cap, t_u8 bands); +void wlan_fill_vht_cap_ie(mlan_private * priv, IEEEtypes_VHTCap_t * pvht_cap, + t_u8 bands); +void wlan_fill_tdls_vht_oprat_ie(mlan_private * priv, + IEEEtypes_VHTOprat_t * vht_oprat, + sta_node * sta_ptr); +t_u8 wlan_is_ap_in_11ac_mode(mlan_private * priv); int wlan_cmd_append_11ac_tlv(mlan_private * pmpriv, BSSDescriptor_t * pbss_desc, t_u8 ** ppbuffer); mlan_status wlan_11ac_cfg_ioctl(pmlan_adapter pmadapter, diff --git a/drivers/net/wireless/sd8897/mlan/mlan_11h.c b/drivers/net/wireless/sd8897/mlan/mlan_11h.c index c6a7d164a8c2..f3b7f7493936 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_11h.c +++ b/drivers/net/wireless/sd8897/mlan/mlan_11h.c @@ -631,7 +631,7 @@ wlan_11h_set_local_power_constraint_tlv(t_u8 ** ppbuffer, { MrvlIEtypes_PowerCapability_t *pcap; MrvlIEtypes_LocalPowerConstraint_t *pconstraint; - t_u8 *startPtr = MNULL; + t_u8 *start_ptr = MNULL; ENTER(); @@ -641,7 +641,7 @@ wlan_11h_set_local_power_constraint_tlv(t_u8 ** ppbuffer, return 0; } - startPtr = (t_u8 *) (*ppbuffer); + start_ptr = (t_u8 *) (*ppbuffer); PRINTM(MINFO, "11h: Set local power constraint = %d channel=%d min_tx_pwr=%d max_tx_pwr=%d\n", @@ -663,7 +663,7 @@ wlan_11h_set_local_power_constraint_tlv(t_u8 ** ppbuffer, *ppbuffer += sizeof(MrvlIEtypesHeader_t) + 2; LEAVE(); - return (t_u32) (*ppbuffer - startPtr); + return (t_u32) (*ppbuffer - start_ptr); } /** @@ -790,9 +790,9 @@ wlan_11h_process_adhoc(mlan_private * priv, } /* Append the dfs element to the TLV buffer */ - size_appended = - wlan_11h_convert_ieee_to_mrvl_ie(adapter, (t_u8 *) * ppbuffer, - (t_u8 *) & dfs_elem); + size_appended = wlan_11h_convert_ieee_to_mrvl_ie(adapter, + (t_u8 *) * ppbuffer, + (t_u8 *) & dfs_elem); HEXDUMP("11h: IBSS-DFS", (t_u8 *) * ppbuffer, size_appended); *ppbuffer += size_appended; @@ -848,16 +848,16 @@ wlan_11h_process_adhoc(mlan_private * priv, PRINTM(MINFO, "WEILIE 1: ppbuffer = %p\n", *ppbuffer); - ret_len += - wlan_11h_set_local_power_constraint_tlv(ppbuffer, - (t_u8) channel, - (t_u8) local_constraint, - (t_u8) priv->adapter-> - state_11h. - min_tx_power_capability, - (t_u8) priv->adapter-> - state_11h. - max_tx_power_capability); + ret_len += wlan_11h_set_local_power_constraint_tlv(ppbuffer, + (t_u8) channel, + (t_u8) + local_constraint, + (t_u8) priv-> + adapter->state_11h. + min_tx_power_capability, + (t_u8) priv-> + adapter->state_11h. + max_tx_power_capability); PRINTM(MINFO, "WEILIE 2: ppbuffer = %p\n", *ppbuffer); LEAVE(); @@ -980,16 +980,16 @@ wlan_11h_is_dfs_master(mlan_private * priv) ENTER(); /* UAP: all are master */ - if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) { + if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) ret = MTRUE; - } + /* STA: only ad-hoc creator is master */ else if ((GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA) && (priv->bss_mode == MLAN_BSS_MODE_IBSS) && (priv->adhoc_state == ADHOC_STARTED || - priv->adhoc_state == ADHOC_STARTING)) { + priv->adhoc_state == ADHOC_STARTING)) ret = MTRUE; - } + /* all other cases = slave interface */ LEAVE(); return ret; @@ -1061,7 +1061,7 @@ wlan_11h_get_current_radar_detect_flags(mlan_adapter * pmadapter) radar_det_flags |= SLAVE_RADAR_DET_MASK; PRINTM(MINFO, "%s: radar_det_state_curr=0x%x\n", - __FUNCTION__, radar_det_flags); + __func__, radar_det_flags); LEAVE(); return radar_det_flags; @@ -1083,7 +1083,7 @@ wlan_11h_check_radar_det_state(mlan_adapter * pmadapter, OUT t_u32 * pnew_state) ENTER(); PRINTM(MINFO, "%s: master_radar_det_pending=%d, " - " slave_radar_det_pending=%d\n", __FUNCTION__, + " slave_radar_det_pending=%d\n", __func__, pmadapter->state_11h.master_radar_det_enable_pending, pmadapter->state_11h.slave_radar_det_enable_pending); @@ -1100,7 +1100,7 @@ wlan_11h_check_radar_det_state(mlan_adapter * pmadapter, OUT t_u32 * pnew_state) radar_det_state_new |= SLAVE_RADAR_DET_MASK; PRINTM(MINFO, "%s: radar_det_state_new=0x%x\n", - __FUNCTION__, radar_det_state_new); + __func__, radar_det_state_new); /* now compare flags with current state */ ret = (wlan_11h_get_current_radar_detect_flags(pmadapter) @@ -1211,7 +1211,7 @@ wlan_11h_prepare_custom_ie_chansw(IN mlan_adapter * pmadapter, (t_u8 **) & pioctl_req); if ((ret != MLAN_STATUS_SUCCESS) || !pioctl_req) { PRINTM(MERROR, "%s(): Could not allocate ioctl req\n", - __FUNCTION__); + __func__); LEAVE(); return MLAN_STATUS_FAILURE; } @@ -1408,10 +1408,14 @@ wlan_11h_get_uap_start_channel(mlan_private * priv, t_u8 uap_band_cfg) (t_u8) chn_tbl-> pcfp[rand_entry]. channel; - } while (wlan_11h_is_channel_under_nop - (adapter, start_chn) && - (++rand_tries < - MAX_RANDOM_CHANNEL_RETRIES)); + } while ((wlan_11h_is_channel_under_nop + (adapter, start_chn) || + ((adapter->state_rdh.stage == + RDH_GET_INFO_CHANNEL) && + wlan_11h_radar_detect_required + (priv, start_chn))) + && (++rand_tries < + MAX_RANDOM_CHANNEL_RETRIES)); } } } @@ -1521,7 +1525,7 @@ wlan_11h_add_dfs_timestamp(mlan_adapter * pmadapter, t_u8 repr, t_u8 channel) (t_u8 **) & pdfs_ts); if ((ret != MLAN_STATUS_SUCCESS) || !pdfs_ts) { PRINTM(MERROR, "%s(): Could not allocate dfs_ts\n", - __FUNCTION__); + __func__); LEAVE(); return MLAN_STATUS_FAILURE; } @@ -1654,7 +1658,7 @@ wlan_11h_check_update_radar_det_state(mlan_private * pmpriv) if (wlan_11h_check_radar_det_state(pmpriv->adapter, &new_radar_det_state)) { PRINTM(MCMD_D, "%s: radar_det_state being updated.\n", - __FUNCTION__); + __func__); mib_11h |= new_radar_det_state; /* keep priv's existing 11h state */ @@ -2188,7 +2192,7 @@ wlan_11h_check_chan_report(mlan_private * priv, t_u8 chan) pmoal_handle, &sec, &usec); - PRINTM(MINFO, "11h: %s()\n", __FUNCTION__); + PRINTM(MINFO, "11h: %s()\n", __func__); PRINTM(MINFO, "- sec_now=%d, sec_report=%d.\n", sec, pstate_dfs->dfs_report_time_sec); PRINTM(MINFO, "- rpt_channel=%d, rpt_radar=%d.\n", @@ -2788,37 +2792,38 @@ mlan_status wlan_11h_handle_event_chanrpt_ready(mlan_private * priv, mlan_event * pevent) { mlan_status ret = MLAN_STATUS_SUCCESS; - HostCmd_DS_CHAN_RPT_RSP *pChanRptRsp; - MrvlIEtypes_Data_t *pTlv; - MeasRptBasicMap_t *pMeasRptBasic; - t_u8 *pBuffer; - t_s32 evtLen; - t_u16 tlvLen; - t_u32 sec, uSec; + HostCmd_DS_CHAN_RPT_RSP *pchan_rpt_rsp; + MrvlIEtypes_Data_t *ptlv; + MeasRptBasicMap_t *pmeas_rpt_basic; + t_u8 *pbuffer; + t_s32 evt_len; + t_u16 tlv_len; + t_u32 sec, usec; wlan_dfs_device_state_t *pstate_dfs = &priv->adapter->state_dfs; ENTER(); - pChanRptRsp = (HostCmd_DS_CHAN_RPT_RSP *) & pevent->event_buf; + pchan_rpt_rsp = (HostCmd_DS_CHAN_RPT_RSP *) & pevent->event_buf; DBG_HEXDUMP(MCMD_D, "11h: Event ChanRptReady (HostCmd_DS_CHAN_RPT_RSP)", - (t_u8 *) pChanRptRsp, wlan_le32_to_cpu(pevent->event_len)); + (t_u8 *) pchan_rpt_rsp, + wlan_le32_to_cpu(pevent->event_len)); - if (wlan_le32_to_cpu(pChanRptRsp->cmd_result) == + if (wlan_le32_to_cpu(pchan_rpt_rsp->cmd_result) == MLAN_CMD_RESULT_SUCCESS) { - pBuffer = (t_u8 *) & pChanRptRsp->tlv_buffer; - evtLen = wlan_le32_to_cpu(pevent->event_len); - evtLen -= + pbuffer = (t_u8 *) & pchan_rpt_rsp->tlv_buffer; + evt_len = wlan_le32_to_cpu(pevent->event_len); + evt_len -= sizeof(HostCmd_DS_CHAN_RPT_RSP) - - sizeof(pChanRptRsp->tlv_buffer); + sizeof(pchan_rpt_rsp->tlv_buffer); - while (evtLen >= sizeof(MrvlIEtypesHeader_t)) { - pTlv = (MrvlIEtypes_Data_t *) pBuffer; - tlvLen = wlan_le16_to_cpu(pTlv->header.len); + while (evt_len >= sizeof(MrvlIEtypesHeader_t)) { + ptlv = (MrvlIEtypes_Data_t *) pbuffer; + tlv_len = wlan_le16_to_cpu(ptlv->header.len); - switch (wlan_le16_to_cpu(pTlv->header.type)) { + switch (wlan_le16_to_cpu(ptlv->header.type)) { case TLV_TYPE_CHANRPT_11H_BASIC: - pMeasRptBasic = - (MeasRptBasicMap_t *) & pTlv->data; - if (pMeasRptBasic->radar) { + pmeas_rpt_basic = + (MeasRptBasicMap_t *) & ptlv->data; + if (pmeas_rpt_basic->radar) { pstate_dfs->dfs_radar_found = MTRUE; PRINTM(MMSG, "RADAR Detected on channel %d!\n", @@ -2836,9 +2841,9 @@ wlan_11h_handle_event_chanrpt_ready(mlan_private * priv, mlan_event * pevent) break; } - pBuffer += (tlvLen + sizeof(pTlv->header)); - evtLen -= (tlvLen + sizeof(pTlv->header)); - evtLen = (evtLen > 0) ? evtLen : 0; + pbuffer += (tlv_len + sizeof(ptlv->header)); + evt_len -= (tlv_len + sizeof(ptlv->header)); + evt_len = (evt_len > 0) ? evt_len : 0; } } else { ret = MLAN_STATUS_FAILURE; @@ -2847,7 +2852,7 @@ wlan_11h_handle_event_chanrpt_ready(mlan_private * priv, mlan_event * pevent) /* Update DFS structure. */ priv->adapter->callbacks.moal_get_system_time(priv->adapter-> pmoal_handle, &sec, - &uSec); + &usec); pstate_dfs->dfs_report_time_sec = sec; pstate_dfs->dfs_check_pending = MFALSE; @@ -2903,7 +2908,7 @@ mlan_status wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) { #ifdef DEBUG_LEVEL1 - const char *RDH_stage_str[] = { + const char *rdh_stage_str[] = { "RDH_OFF", "RDH_CHK_INTFS", "RDH_STOP_TRAFFIC", @@ -2928,8 +2933,8 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) switch (pstate_rdh->stage) { case RDH_CHK_INTFS: PRINTM(MCMD_D, "%s(): stage(%d)=%s\n", - __FUNCTION__, pstate_rdh->stage, - RDH_stage_str[pstate_rdh->stage]); + __func__, pstate_rdh->stage, + rdh_stage_str[pstate_rdh->stage]); /* get active interfaces */ memset(pmadapter, pstate_rdh->priv_list, 0x00, @@ -2938,11 +2943,11 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) wlan_is_intf_active, pstate_rdh-> priv_list); - PRINTM(MCMD_D, "%s(): priv_list_count = %d\n", __FUNCTION__, + PRINTM(MCMD_D, "%s(): priv_list_count = %d\n", __func__, pstate_rdh->priv_list_count); for (i = 0; i < pstate_rdh->priv_list_count; i++) PRINTM(MINFO, "%s(): priv_list[%d] = %p\n", - __FUNCTION__, i, pstate_rdh->priv_list[i]); + __func__, i, pstate_rdh->priv_list[i]); if (pstate_rdh->priv_list_count == 0) { /* no interfaces active... nothing to do */ @@ -2950,8 +2955,8 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) " skip event handling.\n"); pstate_rdh->stage = RDH_OFF; PRINTM(MCMD_D, "%s(): finished - stage(%d)=%s\n", - __FUNCTION__, pstate_rdh->stage, - RDH_stage_str[pstate_rdh->stage]); + __func__, pstate_rdh->stage, + rdh_stage_str[pstate_rdh->stage]); break; /* EXIT CASE */ } /* else: start handling */ @@ -2965,14 +2970,13 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) case RDH_STOP_TRAFFIC: PRINTM(MCMD_D, "%s(): stage(%d)=%s\n", - __FUNCTION__, pstate_rdh->stage, - RDH_stage_str[pstate_rdh->stage]); + __func__, pstate_rdh->stage, + rdh_stage_str[pstate_rdh->stage]); PRINTM(MMSG, "11h: Radar Detected - stopping host tx traffic.\n"); - for (i = 0; i < pstate_rdh->priv_list_count; i++) { + for (i = 0; i < pstate_rdh->priv_list_count; i++) wlan_11h_tx_disable(pstate_rdh->priv_list[i]); - } pstate_rdh->priv_curr_idx = RDH_STAGE_FIRST_ENTRY_PRIV_IDX; pstate_rdh->stage = RDH_GET_INFO_CHANNEL; @@ -2980,8 +2984,8 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) case RDH_GET_INFO_CHANNEL: PRINTM(MCMD_D, "%s(): stage(%d)=%s, priv_idx=%d\n", - __FUNCTION__, pstate_rdh->stage, - RDH_stage_str[pstate_rdh->stage], + __func__, pstate_rdh->stage, + rdh_stage_str[pstate_rdh->stage], pstate_rdh->priv_curr_idx); /* here, prefer STA info over UAP info - one less CMD to send */ @@ -3029,8 +3033,8 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) pmpriv->uap_state_chan_cb.channel; pstate_rdh->uap_band_cfg = pmpriv->uap_state_chan_cb.band_config; - PRINTM(MCMD_D, "%s(): uap_band_cfg=0x%02x\n", - __FUNCTION__, pstate_rdh->uap_band_cfg); + PRINTM(MCMD_D, "%s(): uap_band_cfg=0x%02x\n", __func__, + pstate_rdh->uap_band_cfg); } #endif @@ -3059,7 +3063,7 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) if (i >= MAX_RANDOM_CHANNEL_RETRIES) /* report error */ PRINTM(MERROR, "%s(): ERROR - could not choose new_chan" - " (!= curr_chan) !!\n", __FUNCTION__); + " (!= curr_chan) !!\n", __func__); #ifdef DFS_TESTING_SUPPORT if (pmadapter->dfs_test_params.fixed_new_channel_on_radar) { @@ -3072,7 +3076,7 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) } #endif PRINTM(MCMD_D, "%s(): curr_chan=%d, new_chan=%d\n", - __FUNCTION__, pstate_rdh->curr_channel, + __func__, pstate_rdh->curr_channel, pstate_rdh->new_channel); pstate_rdh->priv_curr_idx = RDH_STAGE_FIRST_ENTRY_PRIV_IDX; @@ -3081,8 +3085,8 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) case RDH_GET_INFO_BEACON_DTIM: PRINTM(MCMD_D, "%s(): stage(%d)=%s, priv_idx=%d\n", - __FUNCTION__, pstate_rdh->stage, - RDH_stage_str[pstate_rdh->stage], + __func__, pstate_rdh->stage, + rdh_stage_str[pstate_rdh->stage], pstate_rdh->priv_curr_idx); #ifdef UAP_SUPPORT @@ -3093,7 +3097,7 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) pmpriv = pstate_rdh->priv_list[pstate_rdh-> priv_curr_idx]; PRINTM(MCMD_D, "%s(): uap.bcn_pd=%d, uap.dtim_pd=%d\n", - __FUNCTION__, + __func__, pmpriv->uap_state_chan_cb.beacon_period, pmpriv->uap_state_chan_cb.dtim_period); bcn_dtim_msec = @@ -3140,7 +3144,7 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) } PRINTM(MCMD_D, "%s(): sta.bcn_pd=%d, sta.dtim_pd=%d\n", - __FUNCTION__, bcn_pd_msec, dtim_pd_msec); + __func__, bcn_pd_msec, dtim_pd_msec); bcn_dtim_msec = (bcn_pd_msec * dtim_pd_msec); if (bcn_dtim_msec > pstate_rdh->max_bcn_dtim_ms) pstate_rdh->max_bcn_dtim_ms = @@ -3157,8 +3161,8 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) case RDH_SET_CUSTOM_IE: PRINTM(MCMD_D, "%s(): stage(%d)=%s, priv_idx=%d\n", - __FUNCTION__, pstate_rdh->stage, - RDH_stage_str[pstate_rdh->stage], + __func__, pstate_rdh->stage, + rdh_stage_str[pstate_rdh->stage], pstate_rdh->priv_curr_idx); /* add CHAN_SW IE - firmware will accept on any interface, and @@ -3171,8 +3175,8 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) MTRUE); if ((ret != MLAN_STATUS_SUCCESS) || !pioctl_req) { PRINTM(MERROR, - "%s(): Error in preparng CHAN_SW IE.\n", - __FUNCTION__); + "%s(): Error in preparing CHAN_SW IE.\n", + __func__); break; /* EXIT CASE */ } @@ -3188,7 +3192,7 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) ret != MLAN_STATUS_PENDING) { PRINTM(MERROR, "%s(): Could not set IE for priv=%p [priv_bss_idx=%d]!\n", - __FUNCTION__, pmpriv, pmpriv->bss_index); + __func__, pmpriv, pmpriv->bss_index); /* TODO: how to handle this error case?? ignore & continue? */ } @@ -3204,8 +3208,8 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) case RDH_REM_CUSTOM_IE: PRINTM(MCMD_D, "%s(): stage(%d)=%s, priv_idx=%d\n", - __FUNCTION__, pstate_rdh->stage, - RDH_stage_str[pstate_rdh->stage], + __func__, pstate_rdh->stage, + rdh_stage_str[pstate_rdh->stage], pstate_rdh->priv_curr_idx); /* remove CHAN_SW IE - firmware will accept on any interface, @@ -3234,8 +3238,8 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) MFALSE); if ((ret != MLAN_STATUS_SUCCESS) || !pioctl_req) { PRINTM(MERROR, - "%s(): Error in preparng CHAN_SW IE.\n", - __FUNCTION__); + "%s(): Error in preparing CHAN_SW IE.\n", + __func__); break; /* EXIT CASE */ } @@ -3249,7 +3253,7 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) ret != MLAN_STATUS_PENDING) { PRINTM(MERROR, "%s(): Could not set IE for priv=%p [priv_bss_idx=%d]!\n", - __FUNCTION__, pmpriv, pmpriv->bss_index); + __func__, pmpriv, pmpriv->bss_index); /* TODO: hiow to handle this error case?? ignore & continue? */ } @@ -3261,25 +3265,12 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) /* else */ pstate_rdh->priv_curr_idx = RDH_STAGE_FIRST_ENTRY_PRIV_IDX; pstate_rdh->stage = RDH_STOP_INTFS; -#ifdef DFS_TESTING_SUPPORT - if (pmadapter->dfs_test_params.no_channel_change_on_radar) { - PRINTM(MCMD_D, - "dfs_testing - no channel change on radar." - " Also skip stop/restart interface stages.\n", - pmadapter->dfs_test_params. - no_channel_change_on_radar); - pstate_rdh->priv_curr_idx = - RDH_STAGE_FIRST_ENTRY_PRIV_IDX; - pstate_rdh->stage = RDH_RESTART_TRAFFIC; - goto rdh_restart_traffic; /* skip several stages */ - } -#endif /* FALL THROUGH TO NEXT STAGE */ case RDH_STOP_INTFS: PRINTM(MCMD_D, "%s(): stage(%d)=%s, priv_idx=%d\n", - __FUNCTION__, pstate_rdh->stage, - RDH_stage_str[pstate_rdh->stage], + __func__, pstate_rdh->stage, + rdh_stage_str[pstate_rdh->stage], pstate_rdh->priv_curr_idx); /* issues one cmd (DEAUTH/ADHOC_STOP/BSS_STOP) to each intf */ @@ -3318,12 +3309,24 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) /* else */ pstate_rdh->priv_curr_idx = RDH_STAGE_FIRST_ENTRY_PRIV_IDX; pstate_rdh->stage = RDH_SET_NEW_CHANNEL; +#ifdef DFS_TESTING_SUPPORT + if (pmadapter->dfs_test_params.no_channel_change_on_radar) { + PRINTM(MCMD_D, + "dfs_testing - no channel change on radar." + " Overwrite new_chan = curr_chan.\n"); + pstate_rdh->new_channel = pstate_rdh->curr_channel; + pstate_rdh->priv_curr_idx = + RDH_STAGE_FIRST_ENTRY_PRIV_IDX; + pstate_rdh->stage = RDH_RESTART_INTFS; + goto rdh_restart_intfs; /* skip next stage */ + } +#endif /* FALL THROUGH TO NEXT STAGE */ case RDH_SET_NEW_CHANNEL: PRINTM(MCMD_D, "%s(): stage(%d)=%s, priv_idx=%d\n", - __FUNCTION__, pstate_rdh->stage, - RDH_stage_str[pstate_rdh->stage], + __func__, pstate_rdh->stage, + rdh_stage_str[pstate_rdh->stage], pstate_rdh->priv_curr_idx); /* only set new channel for UAP intfs */ @@ -3361,9 +3364,12 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) /* FALL THROUGH TO NEXT STAGE */ case RDH_RESTART_INTFS: +#ifdef DFS_TESTING_SUPPORT +rdh_restart_intfs: +#endif PRINTM(MCMD_D, "%s(): stage(%d)=%s, priv_idx=%d\n", - __FUNCTION__, pstate_rdh->stage, - RDH_stage_str[pstate_rdh->stage], + __func__, pstate_rdh->stage, + rdh_stage_str[pstate_rdh->stage], pstate_rdh->priv_curr_idx); /* can only restart master intfs */ @@ -3452,24 +3458,20 @@ wlan_11h_radar_detected_handling(mlan_adapter * pmadapter) /* FALL THROUGH TO NEXT STAGE */ case RDH_RESTART_TRAFFIC: -#ifdef DFS_TESTING_SUPPORT -rdh_restart_traffic: -#endif PRINTM(MCMD_D, "%s(): stage(%d)=%s\n", - __FUNCTION__, pstate_rdh->stage, - RDH_stage_str[pstate_rdh->stage]); + __func__, pstate_rdh->stage, + rdh_stage_str[pstate_rdh->stage]); /* continue traffic for reactivated interfaces */ PRINTM(MMSG, "11h: Radar Detected - restarting host tx traffic.\n"); - for (i = 0; i < pstate_rdh->priv_list_count; i++) { + for (i = 0; i < pstate_rdh->priv_list_count; i++) wlan_11h_tx_enable(pstate_rdh->priv_list[i]); - } pstate_rdh->stage = RDH_OFF; /* DONE! */ PRINTM(MCMD_D, "%s(): finished - stage(%d)=%s\n", - __FUNCTION__, pstate_rdh->stage, - RDH_stage_str[pstate_rdh->stage]); + __func__, pstate_rdh->stage, + rdh_stage_str[pstate_rdh->stage]); break; default: @@ -3512,14 +3514,14 @@ wlan_11h_dfs_event_preprocessing(mlan_adapter * pmadapter) MTRUE, priv_list)) { pmpriv = priv_list[0]; PRINTM(MINFO, "%s: found dfs_master priv=%p\n", - __FUNCTION__, pmpriv); + __func__, pmpriv); } else if (wlan_get_privs_by_two_cond(pmadapter, wlan_11h_is_slave_active_on_dfs_chan, wlan_11h_is_dfs_slave, MTRUE, priv_list)) { pmpriv = priv_list[0]; PRINTM(MINFO, "%s: found dfs_slave priv=%p\n", - __FUNCTION__, pmpriv); + __func__, pmpriv); } /* update event_cause if we found an appropriate priv */ @@ -3531,8 +3533,7 @@ wlan_11h_dfs_event_preprocessing(mlan_adapter * pmadapter) ((GET_BSS_NUM(pmpriv) & 0xff) << 16) | ((pmpriv->bss_type & 0xff) << 24); PRINTM(MINFO, "%s: priv - bss_num=%d, bss_type=%d\n", - __FUNCTION__, GET_BSS_NUM(pmpriv), - pmpriv->bss_type); + __func__, GET_BSS_NUM(pmpriv), pmpriv->bss_type); memcpy(pmadapter, pmevbuf->pbuf + pmevbuf->data_offset, &new_event_cause, sizeof(new_event_cause)); ret = MLAN_STATUS_SUCCESS; @@ -3575,9 +3576,8 @@ wlan_11h_switch_non_dfs_chan(mlan_private * priv, t_u8 * chan) } } - if (!chn_tbl || !chn_tbl->pcfp) { + if (!chn_tbl || !chn_tbl->pcfp) goto done; - } do { rand_entry = @@ -3600,9 +3600,8 @@ wlan_11h_switch_non_dfs_chan(mlan_private * priv, t_u8 * chan) break; } } - if (i == chn_tbl->num_cfp) { + if (i == chn_tbl->num_cfp) goto done; - } } *chan = def_chan; diff --git a/drivers/net/wireless/sd8897/mlan/mlan_11h.h b/drivers/net/wireless/sd8897/mlan/mlan_11h.h index da57532ffc6d..03d6042dd407 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_11h.h +++ b/drivers/net/wireless/sd8897/mlan/mlan_11h.h @@ -49,11 +49,15 @@ Change Log: /* Is master radar detection enabled in firmware? */ extern t_bool wlan_11h_is_master_radar_det_active(mlan_private * priv); -/** Configure master radar detection. Need call wlan_11h_check_update_radar_det_state() after. */ +/** Configure master radar detection. + * Need call wlan_11h_check_update_radar_det_state() after. + */ extern mlan_status wlan_11h_config_master_radar_det(mlan_private * priv, t_bool enable); -/** Configure slave radar detection. Need call wlan_11h_check_update_radar_det_state() after. */ +/** Configure slave radar detection. + * Need call wlan_11h_check_update_radar_det_state() after. + */ extern mlan_status wlan_11h_config_slave_radar_det(mlan_private * priv, t_bool enable); diff --git a/drivers/net/wireless/sd8897/mlan/mlan_11n.c b/drivers/net/wireless/sd8897/mlan/mlan_11n.c index 24f46030488b..3ce42daf2506 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_11n.c +++ b/drivers/net/wireless/sd8897/mlan/mlan_11n.c @@ -400,7 +400,7 @@ wlan_11n_update_addba_request(mlan_private * priv) * @param pmadapter A pointer to mlan_adapter structure * @param pioctl_req A pointer to ioctl request buffer * - * @return MLAN_STATUS_SUCCESS --success + * @return MLAN_STATUS_SUCCESS --success */ static mlan_status wlan_11n_ioctl_addba_param(IN pmlan_adapter pmadapter, @@ -431,9 +431,8 @@ wlan_11n_ioctl_addba_param(IN pmlan_adapter pmadapter, cfg->param.addba_param.rxwinsize; pmpriv->add_ba_param.tx_amsdu = cfg->param.addba_param.txamsdu; pmpriv->add_ba_param.rx_amsdu = cfg->param.addba_param.rxamsdu; - if (timeout != pmpriv->add_ba_param.timeout) { + if (timeout != pmpriv->add_ba_param.timeout) wlan_11n_update_addba_request(pmpriv); - } } LEAVE(); @@ -1054,12 +1053,12 @@ wlan_is_txbastreamptr_valid(mlan_private * priv, TxBAStreamTbl * ptxtblptr) /** * @brief This function will return the pointer to a entry in BA Stream - * table which matches the ba_status requested + * table which matches the ba_status requested * * @param priv A pointer to mlan_private - * @param ba_status Current status of the BA stream + * @param ba_status Current status of the BA stream * - * @return A pointer to first entry matching status in BA stream + * @return A pointer to first entry matching status in BA stream * NULL if not found */ static TxBAStreamTbl * @@ -1324,30 +1323,22 @@ wlan_show_dot11ndevcap(pmlan_adapter pmadapter, t_u32 cap) PRINTM(MINFO, "GET_HW_SPEC: 10 Mhz channel width %s\n", (ISSUPP_CHANWIDTH10(cap) ? "supported" : "not supported")); - if (ISSUPP_RXANTENNAA(cap)) { + if (ISSUPP_RXANTENNAA(cap)) PRINTM(MINFO, "GET_HW_SPEC: Presence of Rx antenna A\n"); - } - if (ISSUPP_RXANTENNAB(cap)) { + if (ISSUPP_RXANTENNAB(cap)) PRINTM(MINFO, "GET_HW_SPEC: Presence of Rx antenna B\n"); - } - if (ISSUPP_RXANTENNAC(cap)) { + if (ISSUPP_RXANTENNAC(cap)) PRINTM(MINFO, "GET_HW_SPEC: Presence of Rx antenna C\n"); - } - if (ISSUPP_RXANTENNAD(cap)) { + if (ISSUPP_RXANTENNAD(cap)) PRINTM(MINFO, "GET_HW_SPEC: Presence of Rx antenna D\n"); - } - if (ISSUPP_TXANTENNAA(cap)) { + if (ISSUPP_TXANTENNAA(cap)) PRINTM(MINFO, "GET_HW_SPEC: Presence of Tx antenna A\n"); - } - if (ISSUPP_TXANTENNAB(cap)) { + if (ISSUPP_TXANTENNAB(cap)) PRINTM(MINFO, "GET_HW_SPEC: Presence of Tx antenna B\n"); - } - if (ISSUPP_TXANTENNAC(cap)) { + if (ISSUPP_TXANTENNAC(cap)) PRINTM(MINFO, "GET_HW_SPEC: Presence of Tx antenna C\n"); - } - if (ISSUPP_TXANTENNAD(cap)) { + if (ISSUPP_TXANTENNAD(cap)) PRINTM(MINFO, "GET_HW_SPEC: Presence of Tx antenna D\n"); - } LEAVE(); return; @@ -1404,9 +1395,8 @@ wlan_ret_11n_delba(mlan_private * priv, HostCmd_DS_COMMAND * resp) ptx_ba_tbl = wlan_11n_get_txbastream_status(priv, BA_STREAM_SETUP_INPROGRESS); - if (ptx_ba_tbl) { + if (ptx_ba_tbl) wlan_send_addba(priv, ptx_ba_tbl->tid, ptx_ba_tbl->ra); - } } else { /* * In case of failure, recreate the deleted stream in * case we initiated the ADDBA @@ -1635,11 +1625,11 @@ wlan_ret_amsdu_aggr_ctrl(IN pmlan_private pmpriv, /** * @brief This function prepares 11n cfg command * - * @param pmpriv A pointer to mlan_private structure - * @param cmd A pointer to HostCmd_DS_COMMAND structure - * @param cmd_action the action: GET or SET - * @param pdata_buf A pointer to data buffer - * @return MLAN_STATUS_SUCCESS + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param cmd_action the action: GET or SET + * @param pdata_buf A pointer to data buffer + * @return MLAN_STATUS_SUCCESS */ mlan_status wlan_cmd_11n_cfg(IN pmlan_private pmpriv, @@ -1693,18 +1683,18 @@ wlan_ret_11n_cfg(IN pmlan_private pmpriv, /** * @brief This function prepares reject addba req command * - * @param pmpriv A pointer to mlan_private structure - * @param cmd A pointer to HostCmd_DS_COMMAND structure - * @param cmd_action the action: GET or SET - * @param pdata_buf A pointer to data buffer - * @return MLAN_STATUS_SUCCESS + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param cmd_action the action: GET or SET + * @param pdata_buf A pointer to data buffer + * @return MLAN_STATUS_SUCCESS */ mlan_status wlan_cmd_reject_addba_req(IN pmlan_private pmpriv, IN HostCmd_DS_COMMAND * cmd, IN t_u16 cmd_action, IN t_void * pdata_buf) { - HostCmd_DS_REJECT_ADDBA_REQ *pRejectAddbaReq = + HostCmd_DS_REJECT_ADDBA_REQ *preject_addba_req = &cmd->params.rejectaddbareq; mlan_ds_reject_addba_req *prejaddbareq = (mlan_ds_reject_addba_req *) pdata_buf; @@ -1714,8 +1704,8 @@ wlan_cmd_reject_addba_req(IN pmlan_private pmpriv, cmd->size = wlan_cpu_to_le16(sizeof(HostCmd_DS_REJECT_ADDBA_REQ) + S_DS_GEN); - pRejectAddbaReq->action = wlan_cpu_to_le16(cmd_action); - pRejectAddbaReq->conditions = + preject_addba_req->action = wlan_cpu_to_le16(cmd_action); + preject_addba_req->conditions = wlan_cpu_to_le32(prejaddbareq->conditions); LEAVE(); return MLAN_STATUS_SUCCESS; @@ -1736,16 +1726,16 @@ wlan_ret_reject_addba_req(IN pmlan_private pmpriv, IN mlan_ioctl_req * pioctl_buf) { mlan_ds_11n_cfg *cfg = MNULL; - HostCmd_DS_REJECT_ADDBA_REQ *pRejectAddbaReq = + HostCmd_DS_REJECT_ADDBA_REQ *preject_addba_req = &resp->params.rejectaddbareq; ENTER(); if (pioctl_buf && - (wlan_le16_to_cpu(pRejectAddbaReq->action) == + (wlan_le16_to_cpu(preject_addba_req->action) == HostCmd_ACT_GEN_GET)) { cfg = (mlan_ds_11n_cfg *) pioctl_buf->pbuf; cfg->param.reject_addba_req.conditions = - wlan_le32_to_cpu(pRejectAddbaReq->conditions); + wlan_le32_to_cpu(preject_addba_req->conditions); } LEAVE(); return MLAN_STATUS_SUCCESS; @@ -1935,6 +1925,54 @@ wlan_ret_tx_bf_cfg(IN pmlan_private pmpriv, return MLAN_STATUS_SUCCESS; } +/** + * @brief Get second channel offset + * + * @param chan channel num + * @return second channel offset + */ +t_u8 +wlan_get_second_channel_offset(int chan) +{ + t_u8 chan2Offset = SEC_CHAN_NONE; + + switch (chan) { + case 36: + case 44: + case 52: + case 60: + case 100: + case 108: + case 116: + case 124: + case 132: + case 140: + case 149: + case 157: + chan2Offset = SEC_CHAN_ABOVE; + break; + case 40: + case 48: + case 56: + case 64: + case 104: + case 112: + case 120: + case 128: + case 136: + case 144: + case 153: + case 161: + chan2Offset = SEC_CHAN_BELOW; + break; + case 165: + /* Special Case: 20Mhz-only Channel */ + chan2Offset = SEC_CHAN_NONE; + break; + } + return chan2Offset; +} + #ifdef STA_SUPPORT /** * @brief validate the channel offset for Infra/Ad-hoc band configuration @@ -1978,42 +2016,8 @@ wlan_validate_chan_offset(IN mlan_private * pmpriv, chan_offset = SEC_CHAN_BELOW; } } - } else if (band & BAND_AN) { - switch (chan) { - case 36: - case 44: - case 52: - case 60: - case 100: - case 108: - case 116: - case 124: - case 132: - case 140: - case 149: - case 157: - chan_offset = SEC_CHAN_ABOVE; - break; - case 40: - case 48: - case 56: - case 64: - case 104: - case 112: - case 120: - case 128: - case 136: - case 144: - case 153: - case 161: - chan_offset = SEC_CHAN_BELOW; - break; - case 165: - /* Special Case: 20Mhz-only Channel */ - chan_offset = SEC_CHAN_NONE; - break; - } - } + } else if (band & BAND_AN) + chan_offset = wlan_get_second_channel_offset(chan); } return chan_offset; } @@ -2285,10 +2289,10 @@ wlan_11n_cfg_ioctl(IN pmlan_adapter pmadapter, IN pmlan_ioctl_req pioctl_req) /** * @brief This function will delete the given entry in Tx BA Stream table * - * @param priv Pointer to mlan_private - * @param ptx_tbl Pointer to tx ba stream entry to delete + * @param priv Pointer to mlan_private + * @param ptx_tbl Pointer to tx ba stream entry to delete * - * @return N/A + * @return N/A */ void wlan_11n_delete_txbastream_tbl_entry(mlan_private * priv, @@ -2301,9 +2305,8 @@ wlan_11n_delete_txbastream_tbl_entry(mlan_private * priv, pmadapter->callbacks.moal_spin_lock(pmadapter->pmoal_handle, priv->tx_ba_stream_tbl_ptr.plock); - if (!ptx_tbl || !wlan_is_txbastreamptr_valid(priv, ptx_tbl)) { + if (!ptx_tbl || !wlan_is_txbastreamptr_valid(priv, ptx_tbl)) goto exit; - } PRINTM(MINFO, "Delete BA stream table entry: %p\n", ptx_tbl); @@ -2354,13 +2357,13 @@ wlan_11n_deleteall_txbastream_tbl(mlan_private * priv) /** * @brief This function will return the pointer to an entry in BA Stream - * table which matches the give RA/TID pair + * table which matches the give RA/TID pair * * @param priv A pointer to mlan_private * @param tid TID to find in reordering table * @param ra RA to find in reordering table * - * @return A pointer to first entry matching RA/TID in BA stream + * @return A pointer to first entry matching RA/TID in BA stream * NULL if not found */ TxBAStreamTbl * @@ -2402,20 +2405,20 @@ wlan_11n_get_txbastream_tbl(mlan_private * priv, int tid, t_u8 * ra) /** * @brief This function will create a entry in tx ba stream table for the - * given RA/TID. + * given RA/TID. * * @param priv A pointer to mlan_private * @param ra RA to find in reordering table * @param tid TID to find in reordering table * @param ba_status BA stream status to create the stream with * - * @return N/A + * @return N/A */ void wlan_11n_create_txbastream_tbl(mlan_private * priv, t_u8 * ra, int tid, baStatus_e ba_status) { - TxBAStreamTbl *newNode = MNULL; + TxBAStreamTbl *new_node = MNULL; pmlan_adapter pmadapter = priv->adapter; ENTER(); @@ -2424,19 +2427,23 @@ wlan_11n_create_txbastream_tbl(mlan_private * priv, PRINTM(MDAT_D, "get_txbastream_tbl TID %d\n", tid); DBG_HEXDUMP(MDAT_D, "RA", ra, MLAN_MAC_ADDR_LENGTH); - pmadapter->callbacks.moal_malloc(pmadapter->pmoal_handle, - sizeof(TxBAStreamTbl), - MLAN_MEM_DEF, - (t_u8 **) & newNode); - util_init_list((pmlan_linked_list) newNode); + if (pmadapter->callbacks. + moal_malloc(pmadapter->pmoal_handle, sizeof(TxBAStreamTbl), + MLAN_MEM_DEF, (t_u8 **) & new_node)) { + PRINTM(MERROR, + "wlan_11n_create_txbastream_tbl Failed to allocate new_node\n"); + LEAVE(); + return; + } + util_init_list((pmlan_linked_list) new_node); - newNode->tid = tid; - newNode->ba_status = ba_status; - memcpy(pmadapter, newNode->ra, ra, MLAN_MAC_ADDR_LENGTH); + new_node->tid = tid; + new_node->ba_status = ba_status; + memcpy(pmadapter, new_node->ra, ra, MLAN_MAC_ADDR_LENGTH); util_enqueue_list_tail(pmadapter->pmoal_handle, &priv->tx_ba_stream_tbl_ptr, - (pmlan_linked_list) newNode, + (pmlan_linked_list) new_node, pmadapter->callbacks.moal_spin_lock, pmadapter->callbacks.moal_spin_unlock); } @@ -2451,7 +2458,7 @@ wlan_11n_create_txbastream_tbl(mlan_private * priv, * @param tid TID to send the ADDBA * @param peer_mac MAC address to send the ADDBA * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ int wlan_send_addba(mlan_private * priv, int tid, t_u8 * peer_mac) @@ -2496,13 +2503,13 @@ wlan_send_addba(mlan_private * priv, int tid, t_u8 * peer_mac) /** * @brief This function will delete a block ack to given tid/ra * - * @param priv A pointer to mlan_private - * @param pioctl_req A pointer to ioctl request buffer - * @param tid TID to send the ADDBA - * @param peer_mac MAC address to send the ADDBA - * @param initiator MTRUE if we have initiated ADDBA, MFALSE otherwise + * @param priv A pointer to mlan_private + * @param pioctl_req A pointer to ioctl request buffer + * @param tid TID to send the ADDBA + * @param peer_mac MAC address to send the ADDBA + * @param initiator MTRUE if we have initiated ADDBA, MFALSE otherwise * - * @return MLAN_STATUS_PENDING --success, otherwise fail + * @return MLAN_STATUS_PENDING --success, otherwise fail */ int wlan_send_delba(mlan_private * priv, pmlan_ioctl_req pioctl_req, int tid, @@ -2577,34 +2584,35 @@ wlan_get_rxreorder_tbl(mlan_private * priv, rx_reorder_tbl * buf) { int i; rx_reorder_tbl *ptbl = buf; - RxReorderTbl *rxReorderTblPtr; + RxReorderTbl *rx_reorder_tbl_ptr; int count = 0; ENTER(); - rxReorderTblPtr = + rx_reorder_tbl_ptr = (RxReorderTbl *) util_peek_list(priv->adapter->pmoal_handle, &priv->rx_reorder_tbl_ptr, priv->adapter->callbacks. moal_spin_lock, priv->adapter->callbacks. moal_spin_unlock); - if (!rxReorderTblPtr) { + if (!rx_reorder_tbl_ptr) { LEAVE(); return count; } - while (rxReorderTblPtr != (RxReorderTbl *) & priv->rx_reorder_tbl_ptr) { - ptbl->tid = (t_u16) rxReorderTblPtr->tid; - memcpy(priv->adapter, ptbl->ta, rxReorderTblPtr->ta, + while (rx_reorder_tbl_ptr != + (RxReorderTbl *) & priv->rx_reorder_tbl_ptr) { + ptbl->tid = (t_u16) rx_reorder_tbl_ptr->tid; + memcpy(priv->adapter, ptbl->ta, rx_reorder_tbl_ptr->ta, MLAN_MAC_ADDR_LENGTH); - ptbl->start_win = rxReorderTblPtr->start_win; - ptbl->win_size = rxReorderTblPtr->win_size; - ptbl->amsdu = rxReorderTblPtr->amsdu; - for (i = 0; i < rxReorderTblPtr->win_size; ++i) { - if (rxReorderTblPtr->rx_reorder_ptr[i]) + ptbl->start_win = rx_reorder_tbl_ptr->start_win; + ptbl->win_size = rx_reorder_tbl_ptr->win_size; + ptbl->amsdu = rx_reorder_tbl_ptr->amsdu; + for (i = 0; i < rx_reorder_tbl_ptr->win_size; ++i) { + if (rx_reorder_tbl_ptr->rx_reorder_ptr[i]) ptbl->buffer[i] = MTRUE; else ptbl->buffer[i] = MFALSE; } - rxReorderTblPtr = rxReorderTblPtr->pnext; + rx_reorder_tbl_ptr = rx_reorder_tbl_ptr->pnext; ptbl++; count++; if (count >= MLAN_MAX_RX_BASTREAM_SUPPORTED) @@ -2665,9 +2673,9 @@ wlan_get_txbastream_tbl(mlan_private * priv, tx_ba_stream_tbl * buf) /** * @brief This function cleans up txbastream_tbl for specific station * - * @param priv A pointer to mlan_private + * @param priv A pointer to mlan_private * @param ra RA to find in txbastream_tbl - * @return N/A + * @return N/A */ void wlan_11n_cleanup_txbastream_tbl(mlan_private * priv, t_u8 * ra) @@ -2677,9 +2685,8 @@ wlan_11n_cleanup_txbastream_tbl(mlan_private * priv, t_u8 * ra) ENTER(); for (i = 0; i < MAX_NUM_TID; ++i) { ptx_tbl = wlan_11n_get_txbastream_tbl(priv, i, ra); - if (ptx_tbl) { + if (ptx_tbl) wlan_11n_delete_txbastream_tbl_entry(priv, ptx_tbl); - } } LEAVE(); return; diff --git a/drivers/net/wireless/sd8897/mlan/mlan_11n.h b/drivers/net/wireless/sd8897/mlan/mlan_11n.h index 3b7aa0c9d427..a0b2bf3ad5e8 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_11n.h +++ b/drivers/net/wireless/sd8897/mlan/mlan_11n.h @@ -109,6 +109,8 @@ void wlan_11n_delete_bastream(mlan_private * priv, t_u8 * del_ba); int wlan_get_rxreorder_tbl(mlan_private * priv, rx_reorder_tbl * buf); /** get tx ba stream table */ int wlan_get_txbastream_tbl(mlan_private * priv, tx_ba_stream_tbl * buf); +/** send delba */ +void wlan_11n_delba(mlan_private * priv, int tid); /** Minimum number of AMSDU */ #define MIN_NUM_AMSDU 2 /** AMSDU Aggr control cmd resp */ @@ -126,6 +128,8 @@ mlan_status wlan_cmd_amsdu_aggr_ctrl(mlan_private * priv, t_u8 wlan_validate_chan_offset(IN mlan_private * pmpriv, IN t_u8 band, IN t_u32 chan, IN t_u8 chan_bw); +/** get channel offset */ +t_u8 wlan_get_second_channel_offset(int chan); /** clean up txbastream_tbl */ void wlan_11n_cleanup_txbastream_tbl(mlan_private * priv, t_u8 * ra); @@ -141,9 +145,8 @@ is_station_11n_enabled(mlan_private * priv, t_u8 * mac) { sta_node *sta_ptr = MNULL; sta_ptr = wlan_get_station_entry(priv, mac); - if (sta_ptr) { + if (sta_ptr) return (sta_ptr->is_11n_enabled) ? MTRUE : MFALSE; - } return MFALSE; } @@ -152,16 +155,15 @@ is_station_11n_enabled(mlan_private * priv, t_u8 * mac) * * @param priv A pointer to mlan_private * @param mac station mac address - * @return max amsdu size statio supported + * @return max amsdu size statio supported */ static INLINE t_u16 get_station_max_amsdu_size(mlan_private * priv, t_u8 * mac) { sta_node *sta_ptr = MNULL; sta_ptr = wlan_get_station_entry(priv, mac); - if (sta_ptr) { + if (sta_ptr) return sta_ptr->max_amsdu; - } return 0; } @@ -171,7 +173,7 @@ get_station_max_amsdu_size(mlan_private * priv, t_u8 * mac) * @param priv A pointer to mlan_private * @param ptr A pointer to RA list table * @param tid TID value for ptr - * @return MTRUE or MFALSE + * @return MTRUE or MFALSE */ static INLINE t_u8 is_station_ampdu_allowed(mlan_private * priv, raListTbl * ptr, int tid) @@ -196,16 +198,15 @@ is_station_ampdu_allowed(mlan_private * priv, raListTbl * ptr, int tid) * @param priv A pointer to mlan_private * @param tid tid index * @param ra station mac address - * @return N/A + * @return N/A */ static INLINE void disable_station_ampdu(mlan_private * priv, t_u8 tid, t_u8 * ra) { sta_node *sta_ptr = MNULL; sta_ptr = wlan_get_station_entry(priv, ra); - if (sta_ptr) { + if (sta_ptr) sta_ptr->ampdu_sta[tid] = BA_STREAM_NOT_ALLOWED; - } return; } @@ -215,7 +216,7 @@ disable_station_ampdu(mlan_private * priv, t_u8 tid, t_u8 * ra) * @param priv A pointer to mlan_private * @param tid TID * - * @return MTRUE or MFALSE + * @return MTRUE or MFALSE */ static INLINE t_u8 wlan_is_cur_bastream_high_prio(mlan_private * priv, int tid) @@ -254,7 +255,7 @@ wlan_is_cur_bastream_high_prio(mlan_private * priv, int tid) * @param ptr A pointer to RA list table * @param tid TID value for ptr * - * @return MTRUE or MFALSE + * @return MTRUE or MFALSE */ static INLINE t_u8 wlan_is_ampdu_allowed(mlan_private * priv, raListTbl * ptr, int tid) @@ -265,6 +266,8 @@ wlan_is_ampdu_allowed(mlan_private * priv, raListTbl * ptr, int tid) #endif /* UAP_SUPPORT */ if (priv->sec_info.wapi_enabled && !priv->sec_info.wapi_key_on) return MFALSE; + if (ptr->is_tdls_link) + return is_station_ampdu_allowed(priv, ptr, tid); return (priv->aggr_prio_tbl[tid].ampdu_ap != BA_STREAM_NOT_ALLOWED) ? MTRUE : MFALSE; @@ -277,7 +280,7 @@ wlan_is_ampdu_allowed(mlan_private * priv, raListTbl * ptr, int tid) * @param ptr A pointer to RA list table * @param tid TID value for ptr * - * @return MTRUE or MFALSE + * @return MTRUE or MFALSE */ static int INLINE wlan_is_amsdu_in_ampdu_allowed(mlan_private * priv, raListTbl * ptr, int tid) @@ -300,7 +303,7 @@ wlan_is_amsdu_in_ampdu_allowed(mlan_private * priv, raListTbl * ptr, int tid) * @param ptr A pointer to RA list table * @param tid TID value for ptr * - * @return MTRUE or MFALSE + * @return MTRUE or MFALSE */ static INLINE t_u8 wlan_is_amsdu_allowed(mlan_private * priv, raListTbl * ptr, int tid) @@ -328,7 +331,7 @@ wlan_is_amsdu_allowed(mlan_private * priv, raListTbl * ptr, int tid) * * @param priv A pointer to mlan_private * - * @return MTRUE or MFALSE + * @return MTRUE or MFALSE */ static INLINE t_u8 wlan_is_bastream_avail(mlan_private * priv) @@ -360,7 +363,7 @@ wlan_is_bastream_avail(mlan_private * priv) * @param ptid A pointer to TID of stream to delete, if return MTRUE * @param ra RA of stream to delete, if return MTRUE * - * @return MTRUE or MFALSE + * @return MTRUE or MFALSE */ static INLINE t_u8 wlan_find_stream_to_delete(mlan_private * priv, @@ -408,7 +411,7 @@ wlan_find_stream_to_delete(mlan_private * priv, * @param ptr A pointer to RA list table * @param tid TID value for ptr * - * @return MTRUE or MFALSE + * @return MTRUE or MFALSE */ static int INLINE wlan_is_bastream_setup(mlan_private * priv, raListTbl * ptr, int tid) @@ -433,7 +436,7 @@ wlan_is_bastream_setup(mlan_private * priv, raListTbl * ptr, int tid) * @param priv A pointer to mlan_private * @param ra Address of the receiver STA * - * @return MTRUE or MFALSE + * @return MTRUE or MFALSE */ static int INLINE wlan_is_11n_enabled(mlan_private * priv, t_u8 * ra) diff --git a/drivers/net/wireless/sd8897/mlan/mlan_11n_aggr.c b/drivers/net/wireless/sd8897/mlan/mlan_11n_aggr.c index cdbd50aab210..76600d3cb9d7 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_11n_aggr.c +++ b/drivers/net/wireless/sd8897/mlan/mlan_11n_aggr.c @@ -150,9 +150,9 @@ wlan_11n_form_amsdu_txpd(mlan_private * priv, mlan_buffer * mbuf) * packet is formed * * @param priv A pointer to mlan_private structure - * @param mbuf TxPD buffer + * @param mbuf TxPD buffer * - * @return N/A + * @return N/A */ static INLINE void wlan_11n_update_pktlen_amsdu_txpd(mlan_private * priv, pmlan_buffer mbuf) @@ -335,9 +335,9 @@ done: * * @param priv A pointer to mlan_private structure * @param pra_list Pointer to the RA List table containing the pointers - * to packets. + * to packets. * @param headroom Any interface specific headroom that may be need. TxPD - * will be formed leaving this headroom. + * will be formed leaving this headroom. * @param ptrindex Pointer index * * @return Final packet size or MLAN_STATUS_FAILURE diff --git a/drivers/net/wireless/sd8897/mlan/mlan_11n_rxreorder.c b/drivers/net/wireless/sd8897/mlan/mlan_11n_rxreorder.c index 8cd8332f8dbc..863de4bec364 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_11n_rxreorder.c +++ b/drivers/net/wireless/sd8897/mlan/mlan_11n_rxreorder.c @@ -51,12 +51,12 @@ Change log: ********************************************************/ /** * @brief This function will dispatch amsdu packet and - * forward it to kernel/upper layer + * forward it to kernel/upper layer * - * @param priv A pointer to mlan_private + * @param priv A pointer to mlan_private * @param pmbuf A pointer to the received buffer * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_11n_dispatch_amsdu_pkt(mlan_private * priv, pmlan_buffer pmbuf) @@ -78,12 +78,12 @@ wlan_11n_dispatch_amsdu_pkt(mlan_private * priv, pmlan_buffer pmbuf) /** * @brief This function will process the rx packet and - * forward it to kernel/upper layer + * forward it to kernel/upper layer * - * @param priv A pointer to mlan_private + * @param priv A pointer to mlan_private * @param payload A pointer to rx packet payload * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_11n_dispatch_pkt(t_void * priv, t_void * payload) @@ -127,7 +127,7 @@ wlan_11n_dispatch_pkt(t_void * priv, t_void * payload) /** * @brief This function restarts the reordering timeout timer * - * @param pmadapter A pointer to mlan_adapter + * @param pmadapter A pointer to mlan_adapter * @param rx_reor_tbl_ptr A pointer to structure RxReorderTbl * * @return N/A @@ -161,13 +161,13 @@ mlan_11n_rxreorder_timer_restart(pmlan_adapter pmadapter, /** * @brief This function dispatches all the packets in the buffer. - * There could be holes in the buffer. + * There could be holes in the buffer. * - * @param priv A pointer to mlan_private + * @param priv A pointer to mlan_private * @param rx_reor_tbl_ptr A pointer to structure RxReorderTbl * @param start_win Start window * - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ static mlan_status wlan_11n_dispatch_pkt_until_start_win(t_void * priv, @@ -230,7 +230,7 @@ wlan_11n_dispatch_pkt_until_start_win(t_void * priv, * @param pmadapter A pointer to mlan_adapter structure * @param rx_reor_tbl_ptr A pointer to structure RxReorderTbl * - * @return N/A + * @return N/A */ static t_void wlan_11n_display_tbl_ptr(pmlan_adapter pmadapter, @@ -246,13 +246,13 @@ wlan_11n_display_tbl_ptr(pmlan_adapter pmadapter, /** * @brief This function will dispatch all packets sequentially - * from start_win until a hole is found and adjust the - * start_win appropriately + * from start_win until a hole is found and adjust the + * start_win appropriately * - * @param priv A pointer to mlan_private + * @param priv A pointer to mlan_private * @param rx_reor_tbl_ptr A pointer to structure RxReorderTbl * - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ static mlan_status wlan_11n_scan_and_dispatch(t_void * priv, RxReorderTbl * rx_reor_tbl_ptr) @@ -312,12 +312,12 @@ wlan_11n_scan_and_dispatch(t_void * priv, RxReorderTbl * rx_reor_tbl_ptr) /** * @brief This function delete rxreorder table's entry - * and free the memory + * and free the memory * - * @param priv A pointer to mlan_private + * @param priv A pointer to mlan_private * @param rx_reor_tbl_ptr A pointer to structure RxReorderTbl * - * @return N/A + * @return N/A */ static t_void wlan_11n_delete_rxreorder_tbl_entry(mlan_private * priv, @@ -390,7 +390,7 @@ wlan_11n_delete_rxreorder_tbl_entry(mlan_private * priv, * * @param rx_reorder_tbl_ptr A pointer to structure RxReorderTbl * - * @return Last used sequence number + * @return Last used sequence number */ static int wlan_11n_find_last_seqnum(RxReorderTbl * rx_reorder_tbl_ptr) @@ -413,7 +413,7 @@ wlan_11n_find_last_seqnum(RxReorderTbl * rx_reorder_tbl_ptr) * * @param context Reorder context pointer * - * @return N/A + * @return N/A */ static t_void wlan_flush_data(t_void * context) @@ -444,15 +444,15 @@ wlan_flush_data(t_void * context) /** * @brief This function will create a entry in rx reordering table for the - * given ta/tid and will initialize it with seq_num, win_size + * given ta/tid and will initialize it with seq_num, win_size * * @param priv A pointer to mlan_private * @param ta ta to find in reordering table - * @param tid tid to find in reordering table + * @param tid tid to find in reordering table * @param win_size win_size for the give ta/tid pair. * @param seq_num Starting sequence number for current entry. * - * @return N/A + * @return N/A */ static t_void wlan_11n_create_rxreorder_tbl(mlan_private * priv, t_u8 * ta, int tid, @@ -476,7 +476,7 @@ wlan_11n_create_rxreorder_tbl(mlan_private * priv, t_u8 * ta, int tid, rx_reor_tbl_ptr, seq_num); } else { PRINTM(MDAT_D, "%s: seq_num %d, tid %d, ta " MACSTR - ", win_size %d\n", __FUNCTION__, + ", win_size %d\n", __func__, seq_num, tid, MAC2STR(ta), win_size); if (pmadapter->callbacks. moal_malloc(pmadapter->pmoal_handle, sizeof(RxReorderTbl), @@ -500,7 +500,11 @@ wlan_11n_create_rxreorder_tbl(mlan_private * priv, t_u8 * ta, int tid, PRINTM(MINFO, "UAP/ADHOC:last_seq=%d start_win=%d\n", last_seq, new_node->start_win); } else { - last_seq = priv->rx_seq[tid]; + sta_ptr = wlan_get_station_entry(priv, ta); + if (sta_ptr) + last_seq = sta_ptr->rx_seq[tid]; + else + last_seq = priv->rx_seq[tid]; } new_node->last_seq = last_seq; new_node->win_size = win_size; @@ -552,13 +556,13 @@ wlan_11n_create_rxreorder_tbl(mlan_private * priv, t_u8 * ta, int tid, /** * @brief This function will return the pointer to a entry in rx reordering - * table which matches the give TA/TID pair + * table which matches the give TA/TID pair * * @param priv A pointer to mlan_private * @param ta ta to find in reordering table * @param tid tid to find in reordering table * - * @return A pointer to structure RxReorderTbl + * @return A pointer to structure RxReorderTbl */ RxReorderTbl * wlan_11n_get_rxreorder_tbl(mlan_private * priv, int tid, t_u8 * ta) @@ -596,7 +600,7 @@ wlan_11n_get_rxreorder_tbl(mlan_private * priv, int tid, t_u8 * ta) /** * @brief This function prepares command for adding a block ack - * request. + * request. * * @param priv A pointer to mlan_private structure * @param cmd A pointer to HostCmd_DS_COMMAND structure @@ -631,7 +635,7 @@ wlan_cmd_11n_addba_req(mlan_private * priv, /** * @brief This function prepares command for adding a block ack - * response. + * response. * * @param priv A pointer to mlan_private structure * @param cmd A pointer to HostCmd_DS_COMMAND structure @@ -700,6 +704,7 @@ wlan_cmd_11n_addba_rspgen(mlan_private * priv, win_size = (padd_ba_rsp->block_ack_param_set & BLOCKACKPARAM_WINSIZE_MASK) >> BLOCKACKPARAM_WINSIZE_POS; + if (win_size == 0) padd_ba_rsp->status_code = wlan_cpu_to_le16(ADDBA_RSP_STATUS_DECLINED); @@ -719,7 +724,7 @@ wlan_cmd_11n_addba_rspgen(mlan_private * priv, /** * @brief This function prepares command for deleting a block ack - * request. + * request. * * @param priv A pointer to mlan_private structure * @param cmd A pointer to HostCmd_DS_COMMAND structure @@ -750,16 +755,16 @@ wlan_cmd_11n_delba(mlan_private * priv, /** * @brief This function will identify if RxReodering is needed for the packet - * and will do the reordering if required before sending it to kernel + * and will do the reordering if required before sending it to kernel * * @param priv A pointer to mlan_private * @param seq_num Seqence number of the current packet - * @param tid Tid of the current packet - * @param ta Transmiter address of the current packet + * @param tid Tid of the current packet + * @param ta Transmiter address of the current packet * @param pkt_type Packetype for the current packet (to identify if its a BAR) * @param payload Pointer to the payload * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status mlan_11n_rxreorder_pkt(void *priv, t_u16 seq_num, t_u16 tid, @@ -966,15 +971,15 @@ done: /** * @brief This function will delete an entry for a given tid/ta pair. tid/ta - * are taken from delba_event body + * are taken from delba_event body * - * @param priv A pointer to mlan_private - * @param tid tid to send delba - * @param peer_mac MAC address to send delba - * @param type TYPE_DELBA_SENT or TYPE_DELBA_RECEIVE + * @param priv A pointer to mlan_private + * @param tid tid to send delba + * @param peer_mac MAC address to send delba + * @param type TYPE_DELBA_SENT or TYPE_DELBA_RECEIVE * @param initiator MTRUE if we are initiator of ADDBA, MFALSE otherwise * - * @return N/A + * @return N/A */ void mlan_11n_delete_bastream_tbl(mlan_private * priv, int tid, @@ -1019,7 +1024,7 @@ mlan_11n_delete_bastream_tbl(mlan_private * priv, int tid, /** * @brief This function handles the command response of - * a block ack response + * a block ack response * * @param priv A pointer to mlan_private structure * @param resp A pointer to HostCmd_DS_COMMAND @@ -1092,10 +1097,10 @@ wlan_ret_11n_addba_resp(mlan_private * priv, HostCmd_DS_COMMAND * resp) /** * @brief This function handles ba_stream_timeout event * - * @param priv A pointer to mlan_private + * @param priv A pointer to mlan_private * @param event A pointer to structure HostCmd_DS_11N_BATIMEOUT * - * @return N/A + * @return N/A */ void wlan_11n_ba_stream_timeout(mlan_private * priv, @@ -1124,9 +1129,9 @@ wlan_11n_ba_stream_timeout(mlan_private * priv, /** * @brief This function cleans up reorder tbl * - * @param priv A pointer to mlan_private + * @param priv A pointer to mlan_private * - * @return N/A + * @return N/A */ void wlan_11n_cleanup_reorder_tbl(mlan_private * priv) @@ -1152,10 +1157,10 @@ wlan_11n_cleanup_reorder_tbl(mlan_private * priv) /** * @brief This function handle the rxba_sync event * - * @param priv A pointer to mlan_private + * @param priv A pointer to mlan_private * @param event_buf A pointer to event buf * @param len event_buf length - * @return N/A + * @return N/A */ void wlan_11n_rxba_sync_event(mlan_private * priv, t_u8 * event_buf, t_u16 len) @@ -1235,9 +1240,9 @@ done: /** * @brief This function cleans up reorder tbl for specific station * - * @param priv A pointer to mlan_private - * @param ta ta to find in reordering table - * @return N/A + * @param priv A pointer to mlan_private + * @param ta ta to find in reordering table + * @return N/A */ void wlan_cleanup_reorder_tbl(mlan_private * priv, t_u8 * ta) @@ -1261,7 +1266,7 @@ wlan_cleanup_reorder_tbl(mlan_private * priv, t_u8 * ta) * @param priv A pointer to mlan_private * @param flag MTRUE/MFALSE * - * @return N/A + * @return N/A */ void wlan_set_rxreorder_tbl_no_drop_flag(mlan_private * priv, t_u8 flag) @@ -1294,9 +1299,9 @@ wlan_set_rxreorder_tbl_no_drop_flag(mlan_private * priv, t_u8 flag) /** * @brief This function update all the rx_reorder_tbl's force_no_drop flag * - * @param pmadapter A pointer to mlan_adapter - * @param flag MTRUE/MFALSE - * @return N/A + * @param pmadapter A pointer to mlan_adapter + * @param flag MTRUE/MFALSE + * @return N/A */ void wlan_update_rxreorder_tbl(pmlan_adapter pmadapter, t_u8 flag) diff --git a/drivers/net/wireless/sd8897/mlan/mlan_11n_rxreorder.h b/drivers/net/wireless/sd8897/mlan/mlan_11n_rxreorder.h index 4a548433db0d..301511aa35ff 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_11n_rxreorder.h +++ b/drivers/net/wireless/sd8897/mlan/mlan_11n_rxreorder.h @@ -81,7 +81,7 @@ Change log: mlan_status mlan_11n_rxreorder_pkt(void *priv, t_u16 seqNum, t_u16 tid, t_u8 * ta, t_u8 pkttype, void *payload); -void mlan_11n_delete_bastream_tbl(mlan_private * priv, int Tid, +void mlan_11n_delete_bastream_tbl(mlan_private * priv, int tid, t_u8 * PeerMACAddr, t_u8 type, int initiator); void wlan_11n_ba_stream_timeout(mlan_private * priv, HostCmd_DS_11N_BATIMEOUT * event); diff --git a/drivers/net/wireless/sd8897/mlan/mlan_cfp.c b/drivers/net/wireless/sd8897/mlan/mlan_cfp.c index db2a8b88f944..c20fa639d1c3 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_cfp.c +++ b/drivers/net/wireless/sd8897/mlan/mlan_cfp.c @@ -778,7 +778,7 @@ wlan_memchr(pmlan_adapter pmadapter, void *s, int c, int n) /** * @brief This function finds the CFP in - * cfp_table_BG/A based on region/code and band parameter. + * cfp_table_BG/A based on region/code and band parameter. * * @param pmadapter A pointer to mlan_adapter structure * @param region The region code diff --git a/drivers/net/wireless/sd8897/mlan/mlan_cmdevt.c b/drivers/net/wireless/sd8897/mlan/mlan_cmdevt.c index db1b21e59dac..84b809b5e34e 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_cmdevt.c +++ b/drivers/net/wireless/sd8897/mlan/mlan_cmdevt.c @@ -89,7 +89,7 @@ wlan_check_scan_queue(IN pmlan_adapter pmadapter) * * @param pmadapter A pointer to mlan_adapter * - * @return N/A + * @return N/A */ static void wlan_dump_pending_commands(pmlan_adapter pmadapter) @@ -130,7 +130,7 @@ wlan_dump_pending_commands(pmlan_adapter pmadapter) /** * @brief This function dump debug info * - * @return N/A + * @return N/A */ t_void wlan_dump_info(mlan_adapter * pmadapter, t_u8 reason) @@ -173,7 +173,7 @@ wlan_dump_info(mlan_adapter * pmadapter, t_u8 reason) last_cmd_index]; PRINTM_GET_SYS_TIME(MERROR, &sec, &usec); PRINTM(MERROR, - "Current cmd id (%lu.%06lu) = 0x%x, act = 0x%x \n", + "Current cmd id (%lu.%06lu) = 0x%x, act = 0x%x\n", sec, usec, cmd_id, cmd_act); if (pcmd_node->cmdbuf) { t_u8 *pcmd_buf; @@ -181,48 +181,46 @@ wlan_dump_info(mlan_adapter * pmadapter, t_u8 reason) pcmd_node->cmdbuf->pbuf + pcmd_node->cmdbuf->data_offset + INTF_HEADER_LEN; - for (i = 0; i < 16; i++) { + for (i = 0; i < 16; i++) PRINTM(MERROR, "%02x ", *pcmd_buf++); - } PRINTM(MERROR, "\n"); } pmpriv = pcmd_node->priv; - if (pmpriv) { + if (pmpriv) PRINTM(MERROR, "BSS type = %d BSS role= %d\n", pmpriv->bss_type, pmpriv->bss_role); - } } } PRINTM(MERROR, "mlan_processing =%d\n", pmadapter->mlan_processing); PRINTM(MERROR, "mlan_rx_processing =%d\n", pmadapter->mlan_rx_processing); + PRINTM(MERROR, "rx_pkts_queued=%d\n", + util_scalar_read(pmadapter->pmoal_handle, + &pmadapter->rx_pkts_queued, MNULL, MNULL)); + PRINTM(MERROR, "more_task_flag = %d\n", pmadapter->more_task_flag); PRINTM(MERROR, "num_cmd_timeout = %d\n", pmadapter->dbg.num_cmd_timeout); PRINTM(MERROR, "last_cmd_index = %d\n", pmadapter->dbg.last_cmd_index); PRINTM(MERROR, "last_cmd_id = "); - for (i = 0; i < DBG_CMD_NUM; i++) { + for (i = 0; i < DBG_CMD_NUM; i++) PRINTM(MERROR, "0x%x ", pmadapter->dbg.last_cmd_id[i]); - } PRINTM(MERROR, "\n"); PRINTM(MERROR, "last_cmd_act = "); - for (i = 0; i < DBG_CMD_NUM; i++) { + for (i = 0; i < DBG_CMD_NUM; i++) PRINTM(MERROR, "0x%x ", pmadapter->dbg.last_cmd_act[i]); - } PRINTM(MERROR, "\n"); PRINTM(MERROR, "last_cmd_resp_index = %d\n", pmadapter->dbg.last_cmd_resp_index); PRINTM(MERROR, "last_cmd_resp_id = "); - for (i = 0; i < DBG_CMD_NUM; i++) { + for (i = 0; i < DBG_CMD_NUM; i++) PRINTM(MERROR, "0x%x ", pmadapter->dbg.last_cmd_resp_id[i]); - } PRINTM(MERROR, "\n"); PRINTM(MERROR, "last_event_index = %d\n", pmadapter->dbg.last_event_index); PRINTM(MERROR, "last_event = "); - for (i = 0; i < DBG_CMD_NUM; i++) { + for (i = 0; i < DBG_CMD_NUM; i++) PRINTM(MERROR, "0x%x ", pmadapter->dbg.last_event[i]); - } PRINTM(MERROR, "\n"); PRINTM(MERROR, "num_data_h2c_failure = %d\n", @@ -513,12 +511,12 @@ wlan_clean_cmd_node(pmlan_adapter pmadapter, cmd_ctrl_node * pcmd_node) #ifdef STA_SUPPORT /** * @brief This function will return the pointer to the first entry in - * pending cmd which matches the given req_id + * pending cmd which matches the given req_id * * @param pmadapter A pointer to mlan_adapter * @param req_id ioctl req_id. * - * @return A pointer to first entry match pioctl_req + * @return A pointer to first entry match pioctl_req */ static cmd_ctrl_node * wlan_get_pending_ioctl_by_id(pmlan_adapter pmadapter, t_u32 req_id) @@ -556,12 +554,12 @@ wlan_get_pending_ioctl_by_id(pmlan_adapter pmadapter, t_u32 req_id) /** * @brief This function will return the pointer to the first entry in - * pending cmd which matches the given pioctl_req + * pending cmd which matches the given pioctl_req * * @param pmadapter A pointer to mlan_adapter * @param pioctl_req A pointer to mlan_ioctl_req buf * - * @return A pointer to first entry match pioctl_req + * @return A pointer to first entry match pioctl_req */ static cmd_ctrl_node * wlan_get_pending_ioctl_cmd(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) @@ -595,12 +593,12 @@ wlan_get_pending_ioctl_cmd(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) /** * @brief This function will return the pointer to the first entry in - * pending cmd which matches the given bss_index + * pending cmd which matches the given bss_index * * @param pmadapter A pointer to mlan_adapter * @param bss_index bss_index * - * @return A pointer to first entry match pioctl_req + * @return A pointer to first entry match pioctl_req */ static cmd_ctrl_node * wlan_get_bss_pending_ioctl_cmd(pmlan_adapter pmadapter, t_u32 bss_index) @@ -668,10 +666,10 @@ wlan_ret_host_cmd(IN pmlan_private pmpriv, /** * @brief This function sends host command to firmware. * - * @param pmpriv A pointer to mlan_private structure - * @param cmd A pointer to HostCmd_DS_COMMAND structure - * @param pdata_buf A pointer to data buffer - * @return MLAN_STATUS_SUCCESS + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param pdata_buf A pointer to data buffer + * @return MLAN_STATUS_SUCCESS */ static mlan_status wlan_cmd_host_cmd(IN pmlan_private pmpriv, @@ -836,7 +834,7 @@ done: * * @param pmadapter A pointer to mlan_adapter structure * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_dnld_sleep_confirm_cmd(mlan_adapter * pmadapter) @@ -919,11 +917,11 @@ done: /** * @brief Event handler * - * @param priv A pointer to mlan_private structure - * @param event_id Event ID - * @param pmevent Event buffer + * @param priv A pointer to mlan_private structure + * @param event_id Event ID + * @param pmevent Event buffer * - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ mlan_status wlan_recv_event(pmlan_private priv, mlan_event_id event_id, t_void * pmevent) @@ -953,7 +951,7 @@ wlan_recv_event(pmlan_private priv, mlan_event_id event_id, t_void * pmevent) /** * @brief This function allocates the command buffer and links - * it to command free queue. + * it to command free queue. * * @param pmadapter A pointer to mlan_adapter structure * @@ -999,9 +997,8 @@ wlan_alloc_cmd_buffer(IN mlan_adapter * pmadapter) } } - for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) { + for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) wlan_insert_cmd_to_free_q(pmadapter, &pcmd_array[i]); - } ret = MLAN_STATUS_SUCCESS; done: LEAVE(); @@ -1060,9 +1057,9 @@ done: /** * @brief This function handles events generated by firmware * - * @param pmadapter A pointer to mlan_adapter structure + * @param pmadapter A pointer to mlan_adapter structure * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_process_event(pmlan_adapter pmadapter) @@ -1272,7 +1269,8 @@ wlan_prepare_cmd(IN mlan_private * pmpriv, /* Send command */ #ifdef STA_SUPPORT - if (cmd_no == HostCmd_CMD_802_11_SCAN) + if (cmd_no == HostCmd_CMD_802_11_SCAN + || cmd_no == HostCmd_CMD_802_11_SCAN_EXT) wlan_queue_scan_cmd(pmpriv, pcmd_node); else { #endif @@ -1591,9 +1589,8 @@ wlan_process_cmdresp(mlan_adapter * pmadapter) if (!(orig_cmdresp_no & HostCmd_RET_BIT)) { PRINTM(MERROR, "CMD_RESP: Invalid response to command!\n"); - if (pioctl_buf) { + if (pioctl_buf) pioctl_buf->status_code = MLAN_ERROR_FW_CMDRESP; - } wlan_insert_cmd_to_free_q(pmadapter, pmadapter->curr_cmd); wlan_request_cmd_lock(pmadapter); pmadapter->curr_cmd = MNULL; @@ -1698,10 +1695,10 @@ done: /** * @brief This function handles the timeout of command sending. - * It will re-send the same command again. + * It will re-send the same command again. * * @param function_context A pointer to function_context - * @return N/A + * @return N/A */ t_void wlan_cmd_timeout_func(t_void * function_context) @@ -1735,7 +1732,7 @@ wlan_cmd_timeout_func(t_void * function_context) pmadapter->dbg.timeout_cmd_act = pmadapter->dbg.last_cmd_act[pmadapter->dbg.last_cmd_index]; PRINTM_GET_SYS_TIME(MERROR, &sec, &usec); - PRINTM(MERROR, "Timeout cmd id (%lu.%06lu) = 0x%x, act = 0x%x \n", sec, + PRINTM(MERROR, "Timeout cmd id (%lu.%06lu) = 0x%x, act = 0x%x\n", sec, usec, pmadapter->dbg.timeout_cmd_id, pmadapter->dbg.timeout_cmd_act); if (pcmd_node->cmdbuf) { @@ -1743,17 +1740,15 @@ wlan_cmd_timeout_func(t_void * function_context) pcmd_buf = pcmd_node->cmdbuf->pbuf + pcmd_node->cmdbuf->data_offset + INTF_HEADER_LEN; - for (i = 0; i < 16; i++) { + for (i = 0; i < 16; i++) PRINTM(MERROR, "%02x ", *pcmd_buf++); - } PRINTM(MERROR, "\n"); } pmpriv = pcmd_node->priv; - if (pmpriv) { + if (pmpriv) PRINTM(MERROR, "BSS type = %d BSS role= %d\n", pmpriv->bss_type, pmpriv->bss_role); - } wlan_dump_info(pmadapter, REASON_CODE_CMD_TIMEOUT); if (pmadapter->hw_status == WlanHardwareStatusInitializing) @@ -1813,9 +1808,9 @@ wlan_flush_scan_queue(IN pmlan_adapter pmadapter) /** * @brief Cancel pending SCAN ioctl cmd. * - * @param pmadapter A pointer to mlan_adapter + * @param pmadapter A pointer to mlan_adapter * - * @return N/A + * @return N/A */ t_void wlan_cancel_pending_scan_cmd(pmlan_adapter pmadapter) @@ -1880,9 +1875,9 @@ wlan_cancel_pending_scan_cmd(pmlan_adapter pmadapter) /** * @brief Cancel all pending cmd. * - * @param pmadapter A pointer to mlan_adapter + * @param pmadapter A pointer to mlan_adapter * - * @return N/A + * @return N/A */ t_void wlan_cancel_all_pending_cmd(pmlan_adapter pmadapter) @@ -1945,10 +1940,10 @@ wlan_cancel_all_pending_cmd(pmlan_adapter pmadapter) /** * @brief Cancel specific bss's pending ioctl cmd. * - * @param pmadapter A pointer to mlan_adapter - * @param bss_index BSS index + * @param pmadapter A pointer to mlan_adapter + * @param bss_index BSS index * - * @return N/A + * @return N/A */ t_void wlan_cancel_bss_pending_cmd(pmlan_adapter pmadapter, t_u32 bss_index) @@ -2027,10 +2022,10 @@ wlan_cancel_bss_pending_cmd(pmlan_adapter pmadapter, t_u32 bss_index) /** * @brief Cancel pending ioctl cmd. * - * @param pmadapter A pointer to mlan_adapter - * @param pioctl_req A pointer to mlan_ioctl_req buf + * @param pmadapter A pointer to mlan_adapter + * @param pioctl_req A pointer to mlan_ioctl_req buf * - * @return N/A + * @return N/A */ t_void wlan_cancel_pending_ioctl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) @@ -2215,11 +2210,10 @@ wlan_host_sleep_wakeup_event(pmlan_private priv) { ENTER(); - if (priv->adapter->is_hs_configured) { + if (priv->adapter->is_hs_configured) wlan_recv_event(priv, MLAN_EVENT_ID_FW_HS_WAKEUP, MNULL); - } else { + else PRINTM(MWARN, "hs_wakeup: Host Sleep not configured !!!\n"); - } LEAVE(); } @@ -2354,12 +2348,12 @@ wlan_process_sleep_confirm_resp(pmlan_adapter pmadapter, t_u8 * pbuf, /** * @brief This function prepares command of power mode * - * @param pmpriv A pointer to mlan_private structure - * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure * @param cmd_action the action: GET or SET * @param ps_bitmap PS bitmap * @param pdata_buf A pointer to data buffer - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ mlan_status wlan_cmd_enh_power_mode(pmlan_private pmpriv, @@ -3640,11 +3634,10 @@ wlan_ret_get_hw_spec(IN pmlan_private pmpriv, pmadapter->fw_cap_info = wlan_le32_to_cpu(hw_spec->fw_cap_info); #ifdef STA_SUPPORT - if (IS_SUPPORT_MULTI_BANDS(pmadapter)) { + if (IS_SUPPORT_MULTI_BANDS(pmadapter)) pmadapter->fw_bands = (t_u8) GET_FW_DEFAULT_BANDS(pmadapter); - } else { + else pmadapter->fw_bands = BAND_B; - } pmadapter->config_bands = pmadapter->fw_bands; for (i = 0; i < pmadapter->priv_num; i++) { @@ -3980,8 +3973,8 @@ wlan_cmd_p2p_params_config(IN pmlan_private pmpriv, &cmd->params.p2p_params_config; mlan_ds_wifi_direct_config *cfg = (mlan_ds_wifi_direct_config *) pdata_buf; - MrvlIEtypes_NoA_setting_t *pNoA_tlv = MNULL; - MrvlIEtypes_OPP_PS_setting_t *pOPP_PS_tlv = MNULL; + MrvlIEtypes_NoA_setting_t *pnoa_tlv = MNULL; + MrvlIEtypes_OPP_PS_setting_t *popp_ps_tlv = MNULL; t_u8 *tlv = MNULL; ENTER(); @@ -3992,19 +3985,19 @@ wlan_cmd_p2p_params_config(IN pmlan_private pmpriv, tlv = (t_u8 *) p2p_config + sizeof(HostCmd_DS_WIFI_DIRECT_PARAM_CONFIG); if (cfg->flags & WIFI_DIRECT_NOA) { - pNoA_tlv = (MrvlIEtypes_NoA_setting_t *) tlv; - pNoA_tlv->header.type = + pnoa_tlv = (MrvlIEtypes_NoA_setting_t *) tlv; + pnoa_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_WIFI_DIRECT_NOA); - pNoA_tlv->header.len = + pnoa_tlv->header.len = wlan_cpu_to_le16(sizeof (MrvlIEtypes_NoA_setting_t) - sizeof(MrvlIEtypesHeader_t)); - pNoA_tlv->enable = cfg->noa_enable; - pNoA_tlv->index = wlan_cpu_to_le16(cfg->index); - pNoA_tlv->noa_count = cfg->noa_count; - pNoA_tlv->noa_duration = + pnoa_tlv->enable = cfg->noa_enable; + pnoa_tlv->index = wlan_cpu_to_le16(cfg->index); + pnoa_tlv->noa_count = cfg->noa_count; + pnoa_tlv->noa_duration = wlan_cpu_to_le32(cfg->noa_duration); - pNoA_tlv->noa_interval = + pnoa_tlv->noa_interval = wlan_cpu_to_le32(cfg->noa_interval); cmd->size += sizeof(MrvlIEtypes_NoA_setting_t); tlv += sizeof(MrvlIEtypes_NoA_setting_t); @@ -4014,15 +4007,15 @@ wlan_cmd_p2p_params_config(IN pmlan_private pmpriv, (int)cfg->noa_duration, (int)cfg->noa_interval); } if (cfg->flags & WIFI_DIRECT_OPP_PS) { - pOPP_PS_tlv = (MrvlIEtypes_OPP_PS_setting_t *) tlv; - pOPP_PS_tlv->header.type = + popp_ps_tlv = (MrvlIEtypes_OPP_PS_setting_t *) tlv; + popp_ps_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_WIFI_DIRECT_OPP_PS); - pOPP_PS_tlv->header.len = + popp_ps_tlv->header.len = wlan_cpu_to_le16(sizeof (MrvlIEtypes_OPP_PS_setting_t) - sizeof(MrvlIEtypesHeader_t)); - pOPP_PS_tlv->enable = cfg->opp_ps_enable; - pOPP_PS_tlv->ct_window = cfg->ct_window; + popp_ps_tlv->enable = cfg->opp_ps_enable; + popp_ps_tlv->ct_window = cfg->ct_window; cmd->size += sizeof(MrvlIEtypes_OPP_PS_setting_t); PRINTM(MCMND, "Set OPP_PS: enable=%d ct_win=%d\n", cfg->opp_ps_enable, cfg->ct_window); @@ -4050,8 +4043,8 @@ wlan_ret_p2p_params_config(IN pmlan_private pmpriv, HostCmd_DS_WIFI_DIRECT_PARAM_CONFIG *p2p_config = &resp->params.p2p_params_config; mlan_ds_misc_cfg *cfg = MNULL; - MrvlIEtypes_NoA_setting_t *pNoA_tlv = MNULL; - MrvlIEtypes_OPP_PS_setting_t *pOPP_PS_tlv = MNULL; + MrvlIEtypes_NoA_setting_t *pnoa_tlv = MNULL; + MrvlIEtypes_OPP_PS_setting_t *popp_ps_tlv = MNULL; MrvlIEtypesHeader_t *tlv = MNULL; t_u16 tlv_buf_left = 0; t_u16 tlv_type = 0; @@ -4079,23 +4072,23 @@ wlan_ret_p2p_params_config(IN pmlan_private pmpriv, } switch (tlv_type) { case TLV_TYPE_WIFI_DIRECT_NOA: - pNoA_tlv = + pnoa_tlv = (MrvlIEtypes_NoA_setting_t *) tlv; cfg->param.p2p_config.flags |= WIFI_DIRECT_NOA; cfg->param.p2p_config.noa_enable = - pNoA_tlv->enable; + pnoa_tlv->enable; cfg->param.p2p_config.index = - wlan_le16_to_cpu(pNoA_tlv-> + wlan_le16_to_cpu(pnoa_tlv-> index); cfg->param.p2p_config.noa_count = - pNoA_tlv->noa_count; + pnoa_tlv->noa_count; cfg->param.p2p_config.noa_duration = - wlan_le32_to_cpu(pNoA_tlv-> + wlan_le32_to_cpu(pnoa_tlv-> noa_duration); cfg->param.p2p_config.noa_interval = - wlan_le32_to_cpu(pNoA_tlv-> + wlan_le32_to_cpu(pnoa_tlv-> noa_interval); PRINTM(MCMND, "Get NOA: enable=%d index=%d, count=%d, duration=%d interval=%d\n", @@ -4108,15 +4101,15 @@ wlan_ret_p2p_params_config(IN pmlan_private pmpriv, noa_interval); break; case TLV_TYPE_SSID: - pOPP_PS_tlv = + popp_ps_tlv = (MrvlIEtypes_OPP_PS_setting_t *) tlv; cfg->param.p2p_config.flags |= WIFI_DIRECT_OPP_PS; cfg->param.p2p_config.opp_ps_enable = - pOPP_PS_tlv->enable; + popp_ps_tlv->enable; cfg->param.p2p_config.ct_window = - pOPP_PS_tlv->ct_window; + popp_ps_tlv->ct_window; PRINTM(MCMND, "Get OPP_PS: enable=%d ct_win=%d\n", cfg->param.p2p_config. @@ -4145,7 +4138,7 @@ wlan_ret_p2p_params_config(IN pmlan_private pmpriv, /** * @brief This function prepares command of hs wakeup reason. * - * @param pmpriv A pointer to mlan_private structure + * @param pmpriv A pointer to mlan_private structure * @param cmd A pointer to HostCmd_DS_COMMAND structure * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS @@ -4167,7 +4160,7 @@ wlan_cmd_hs_wakeup_reason(IN pmlan_private pmpriv, /** * @brief This function handles the command response of - * hs wakeup reason + * hs wakeup reason * * @param pmpriv A pointer to mlan_private structure * @param resp A pointer to HostCmd_DS_COMMAND diff --git a/drivers/net/wireless/sd8897/mlan/mlan_decl.h b/drivers/net/wireless/sd8897/mlan/mlan_decl.h index 5834a7ef47f2..39489107128f 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_decl.h +++ b/drivers/net/wireless/sd8897/mlan/mlan_decl.h @@ -32,7 +32,7 @@ Change log: #define _MLAN_DECL_H_ /** MLAN release version */ -#define MLAN_RELEASE_VERSION "434" +#define MLAN_RELEASE_VERSION "457" /** Re-define generic data types for MLAN/MOAL */ /** Signed char (1-byte) */ @@ -76,7 +76,7 @@ typedef t_s32 t_sval; /** Structure packing begins */ #define MLAN_PACK_START /** Structure packeing end */ -#define MLAN_PACK_END __attribute__ ((packed)) +#define MLAN_PACK_END __attribute__((packed)) #else /* !__GNUC__ */ #ifdef PRAGMA_PACK /** Structure packing begins */ @@ -122,7 +122,7 @@ typedef t_s32 t_sval; /** Macros for Data Alignment : address */ #define ALIGN_ADDR(p, a) \ - ((((t_ptr)(p)) + (((t_ptr)(a)) - 1)) & ~(((t_ptr)(a)) - 1)) + ((((t_ptr)(p)) + (((t_ptr)(a)) - 1)) & ~(((t_ptr)(a)) - 1)) /** Return the byte offset of a field in the given structure */ #define MLAN_FIELD_OFFSET(type, field) ((t_u32)(t_ptr)&(((type *)0)->field)) @@ -157,13 +157,24 @@ typedef t_s32 t_sval; #define MLAN_STA_AMPDU_DEF_TXWINSIZE 16 /** Default Win size attached during ADDBA response */ #define MLAN_STA_AMPDU_DEF_RXWINSIZE 32 +/** RX winsize for COEX */ +#define MLAN_STA_COEX_AMPDU_DEF_RXWINSIZE 16 #endif /* STA_SUPPORT */ #ifdef UAP_SUPPORT /** Default Win size attached during ADDBA request */ #define MLAN_UAP_AMPDU_DEF_TXWINSIZE 32 /** Default Win size attached during ADDBA response */ #define MLAN_UAP_AMPDU_DEF_RXWINSIZE 16 +/** RX winsize for COEX */ +#define MLAN_UAP_COEX_AMPDU_DEF_RXWINSIZE 16 #endif /* UAP_SUPPORT */ + +#ifdef WIFI_DIRECT_SUPPORT +/** WFD use the same window size for tx/rx */ +#define MLAN_WFD_AMPDU_DEF_TXRXWINSIZE 16 +/** RX winsize for COEX */ +#define MLAN_WFD_COEX_AMPDU_DEF_RXWINSIZE 16 +#endif /** Block ack timeout value */ #define MLAN_DEFAULT_BLOCK_ACK_TIMEOUT 0xffff /** Maximum Tx Win size configured for ADDBA request [10 bits] */ @@ -233,9 +244,9 @@ typedef t_u8 mlan_802_11_mac_addr[MLAN_MAC_ADDR_LENGTH]; #define MLAN_FRAG_MAX_VALUE (2346) /** Minimum tx retry count */ -#define MLAN_TX_RETRY_MIN (0) +#define MLAN_TX_RETRY_MIN (0) /** Maximum tx retry count */ -#define MLAN_TX_RETRY_MAX (14) +#define MLAN_TX_RETRY_MAX (14) /** define SDIO block size for data Tx/Rx */ /* We support up to 480-byte block size due to FW buffer limitation. */ @@ -275,6 +286,8 @@ typedef t_u8 mlan_802_11_mac_addr[MLAN_MAC_ADDR_LENGTH]; /** Buffer flag for bridge packet */ #define MLAN_BUF_FLAG_BRIDGE_BUF MBIT(3) +#define MLAN_BUF_FLAG_TDLS MBIT(8) + #define MLAN_BUF_FLAG_TCP_ACK MBIT(9) #ifdef DEBUG_LEVEL1 @@ -442,6 +455,7 @@ typedef enum _mlan_event_id { MLAN_EVENT_ID_DRV_BGSCAN_RESULT = 0x80000013, MLAN_EVENT_ID_DRV_FLUSH_RX_WORK = 0x80000015, MLAN_EVENT_ID_DRV_DEFER_RX_WORK = 0x80000016, + MLAN_EVENT_ID_DRV_TDLS_TEARDOWN_REQ = 0x80000017, } mlan_event_id; /** Data Structures */ @@ -478,6 +492,24 @@ typedef struct _mlan_event { t_u8 event_buf[1]; } mlan_event, *pmlan_event; +/** mlan_event_scan_result data structure */ +typedef MLAN_PACK_START struct _mlan_event_scan_result { + /** Event ID */ + t_u16 event_id; + /** BSS index number for multiple BSS support */ + t_u8 bss_index; + /** BSS type */ + t_u8 bss_type; + /** More event available or not */ + t_u8 more_event; + /** Reserved */ + t_u8 reserved[3]; + /** Size of the response buffer */ + t_u16 buf_size; + /** Number of BSS in scan response */ + t_u8 num_of_set; +} MLAN_PACK_END mlan_event_scan_result, *pmlan_event_scan_result; + /** mlan_ioctl_req data structure */ typedef struct _mlan_ioctl_req { /** Status code from firmware/driver */ @@ -671,6 +703,230 @@ typedef MLAN_PACK_START struct _tlvbuf_custom_ie { tlvbuf_max_mgmt_ie max_mgmt_ie; } MLAN_PACK_END mlan_ds_misc_custom_ie; +/** Max TDLS config data length */ +#define MAX_TDLS_DATA_LEN 1024 + +/** Action commands for TDLS enable/disable */ +#define WLAN_TDLS_CONFIG 0x00 +/** Action commands for TDLS configuration :Set */ +#define WLAN_TDLS_SET_INFO 0x01 +/** Action commands for TDLS configuration :Discovery Request */ +#define WLAN_TDLS_DISCOVERY_REQ 0x02 +/** Action commands for TDLS configuration :Setup Request */ +#define WLAN_TDLS_SETUP_REQ 0x03 +/** Action commands for TDLS configuration :Tear down Request */ +#define WLAN_TDLS_TEAR_DOWN_REQ 0x04 +/** Action ID for TDLS power mode */ +#define WLAN_TDLS_POWER_MODE 0x05 +/**Action ID for init TDLS Channel Switch*/ +#define WLAN_TDLS_INIT_CHAN_SWITCH 0x06 +/** Action ID for stop TDLS Channel Switch */ +#define WLAN_TDLS_STOP_CHAN_SWITCH 0x07 +/** Action ID for configure CS related parameters */ +#define WLAN_TDLS_CS_PARAMS 0x08 +/** Action ID for Disable CS */ +#define WLAN_TDLS_CS_DISABLE 0x09 +/** Action ID for TDLS link status */ +#define WLAN_TDLS_LINK_STATUS 0x0A +/** Action ID for TDLS CS immediate return */ +#define WLAN_TDLS_DEBUG_CS_RET_IM 0xFFF7 +/** Action ID for TDLS Stop RX */ +#define WLAN_TDLS_DEBUG_STOP_RX 0xFFF8 +/** Action ID for TDLS Allow weak security for links establish */ +#define WLAN_TDLS_DEBUG_ALLOW_WEAK_SECURITY 0xFFF9 +/** Action ID for TDLS Ignore key lifetime expiry */ +#define WLAN_TDLS_DEBUG_IGNORE_KEY_EXPIRY 0xFFFA +/** Action ID for TDLS Higher/Lower mac Test */ +#define WLAN_TDLS_DEBUG_HIGHER_LOWER_MAC 0xFFFB +/** Action ID for TDLS Prohibited Test */ +#define WLAN_TDLS_DEBUG_SETUP_PROHIBITED 0xFFFC +/** Action ID for TDLS Existing link Test */ +#define WLAN_TDLS_DEBUG_SETUP_SAME_LINK 0xFFFD +/** Action ID for TDLS Fail Setup Confirm */ +#define WLAN_TDLS_DEBUG_FAIL_SETUP_CONFIRM 0xFFFE +/** Action commands for TDLS debug: Wrong BSS Request */ +#define WLAN_TDLS_DEBUG_WRONG_BSS 0xFFFF + +/** tdls each link rate information */ +typedef MLAN_PACK_START struct _tdls_link_rate_info { + /** Tx Data Rate */ + t_u8 tx_data_rate; + /** Tx Rate HT info*/ + t_u8 tx_rate_htinfo; +} MLAN_PACK_END tdls_link_rate_info; + +/** tdls each link status */ +typedef MLAN_PACK_START struct _tdls_each_link_status { + /** peer mac Address */ + t_u8 peer_mac[MLAN_MAC_ADDR_LENGTH]; + /** Link Flags */ + t_u8 link_flags; + /** Traffic Status */ + t_u8 traffic_status; + /** Tx Failure Count */ + t_u8 tx_fail_count; + /** Channel Number */ + t_u32 active_channel; + /** Last Data RSSI in dBm */ + t_s16 data_rssi_last; + /** Last Data NF in dBm */ + t_s16 data_nf_last; + /** AVG DATA RSSI in dBm */ + t_s16 data_rssi_avg; + /** AVG DATA NF in dBm */ + t_s16 data_nf_avg; + union { + /** tdls rate info */ + tdls_link_rate_info rate_info; + /** tdls link final rate*/ + t_u16 final_data_rate; + } u; + /** Security Method */ + t_u8 security_method; + /** Key Lifetime in milliseconds */ + t_u32 key_lifetime; + /** Key Length */ + t_u8 key_length; + /** actual key */ + t_u8 key[0]; +} MLAN_PACK_END tdls_each_link_status; + +/** TDLS configuration data */ +typedef MLAN_PACK_START struct _tdls_all_config { + union { + /** TDLS state enable disable */ + MLAN_PACK_START struct _tdls_config { + /** enable or disable */ + t_u16 enable; + } MLAN_PACK_END tdls_config; + + /** TDLS set info */ + MLAN_PACK_START struct _tdls_set_data { + /** (tlv + capInfo) length */ + t_u16 tlv_length; + /** Cap Info */ + t_u16 cap_info; + /** TLV buffer */ + t_u8 tlv_buffer[0]; + } MLAN_PACK_END tdls_set; + + /** TDLS discovery and others having mac argument */ + MLAN_PACK_START struct _tdls_discovery_data { + /** peer mac Address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + } MLAN_PACK_END tdls_discovery, tdls_stop_chan_switch, + tdls_link_status_req; + + /** TDLS discovery Response */ + MLAN_PACK_START struct _tdls_discovery_resp { + /** payload length */ + t_u16 payload_len; + /** peer mac Address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** RSSI */ + t_s8 rssi; + /** Cap Info */ + t_u16 cap_info; + /** TLV buffer */ + t_u8 tlv_buffer[0]; + } MLAN_PACK_END tdls_discovery_resp; + + /** TDLS setup request */ + MLAN_PACK_START struct _tdls_setup_data { + /** peer mac Address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** timeout value in milliseconds */ + t_u32 setup_timeout; + /** key lifetime in milliseconds */ + t_u32 key_lifetime; + } MLAN_PACK_END tdls_setup; + + /** TDLS tear down info */ + MLAN_PACK_START struct _tdls_tear_down_data { + /** peer mac Address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** reason code */ + t_u16 reason_code; + } MLAN_PACK_END tdls_tear_down, tdls_cmd_resp; + + /** TDLS power mode info */ + MLAN_PACK_START struct _tdls_power_mode_data { + /** peer mac Address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** Power Mode */ + t_u16 power_mode; + } MLAN_PACK_END tdls_power_mode; + + /** TDLS channel switch info */ + MLAN_PACK_START struct _tdls_chan_switch { + /** peer mac Address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** Channel Switch primary channel no */ + t_u8 primary_channel; + /** Channel Switch secondary channel offset */ + t_u8 secondary_channel_offset; + /** Channel Switch Band */ + t_u8 band; + /** Channel Switch time in milliseconds */ + t_u16 switch_time; + /** Channel Switch timeout in milliseconds */ + t_u16 switch_timeout; + /** Channel Regulatory class*/ + t_u8 regulatory_class; + /** peridicity flag*/ + t_u8 periodicity; + } MLAN_PACK_END tdls_chan_switch; + + /** TDLS channel switch paramters */ + MLAN_PACK_START struct _tdls_cs_params { + /** unit time, multiples of 10ms */ + t_u8 unit_time; + /** threshold for other link */ + t_u8 threshold_otherlink; + /** threshold for direct link */ + t_u8 threshold_directlink; + } MLAN_PACK_END tdls_cs_params; + + /** tdls disable channel switch */ + MLAN_PACK_START struct _tdls_disable_cs { + /** Data*/ + t_u16 data; + } MLAN_PACK_END tdls_disable_cs; + /** TDLS debug data */ + MLAN_PACK_START struct _tdls_debug_data { + /** debug data */ + t_u16 debug_data; + } MLAN_PACK_END tdls_debug_data; + + /** TDLS link status Response */ + MLAN_PACK_START struct _tdls_link_status_resp { + /** payload length */ + t_u16 payload_len; + /** number of links */ + t_u8 active_links; + /** structure for link status */ + tdls_each_link_status link_stats[1]; + } MLAN_PACK_END tdls_link_status_resp; + + } u; +} MLAN_PACK_END tdls_all_config; + +/** TDLS configuration buffer */ +typedef MLAN_PACK_START struct _buf_tdls_config { + /** TDLS Action */ + t_u16 tdls_action; + /** TDLS data */ + t_u8 tdls_data[MAX_TDLS_DATA_LEN]; +} MLAN_PACK_END mlan_ds_misc_tdls_config; + +/** Event structure for tear down */ +typedef struct _tdls_tear_down_event { + /** Peer mac address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** Reason code */ + t_u16 reason_code; +} tdls_tear_down_event; + #ifdef PRAGMA_PACK #pragma pack(pop) #endif diff --git a/drivers/net/wireless/sd8897/mlan/mlan_fw.h b/drivers/net/wireless/sd8897/mlan/mlan_fw.h index ff13aca3aa0f..6de93997a297 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_fw.h +++ b/drivers/net/wireless/sd8897/mlan/mlan_fw.h @@ -36,8 +36,12 @@ Change log: /** Interface header length */ #define INTF_HEADER_LEN 4 +#ifdef PRAGMA_PACK +#pragma pack(push, 1) +#endif + /** Ethernet header */ -typedef struct { +typedef MLAN_PACK_START struct { /** Ethernet header destination address */ t_u8 dest_addr[MLAN_MAC_ADDR_LENGTH]; /** Ethernet header source address */ @@ -45,10 +49,10 @@ typedef struct { /** Ethernet header length */ t_u16 h803_len; -} Eth803Hdr_t; +} MLAN_PACK_END Eth803Hdr_t; /** RFC 1042 header */ -typedef struct { +typedef MLAN_PACK_START struct { /** LLC DSAP */ t_u8 llc_dsap; /** LLC SSAP */ @@ -60,11 +64,7 @@ typedef struct { /** SNAP type */ t_u16 snap_type; -} Rfc1042Hdr_t; - -#ifdef PRAGMA_PACK -#pragma pack(push, 1) -#endif +} MLAN_PACK_END Rfc1042Hdr_t; /** Rx packet header */ typedef MLAN_PACK_START struct { @@ -407,10 +407,18 @@ typedef enum _WLAN_802_11_WEP_STATUS { #define TLV_TYPE_MAX_MGMT_IE (PROPRIETARY_TLV_BASE_ID + 0xaa) /* 0x01aa */ +/** TLV type: key param v2 */ +#define TLV_TYPE_KEY_PARAM_V2 (PROPRIETARY_TLV_BASE_ID + 0x9C) /* 0x019C + */ + /** TLV type: hs wake hold off */ #define TLV_TYPE_HS_WAKE_HOLDOFF (PROPRIETARY_TLV_BASE_ID + 0xB6) /* 0x01b6 */ +/** TLV type : TDLS IDLE TIMEOUT */ +#define TLV_TYPE_TDLS_IDLE_TIMEOUT (PROPRIETARY_TLV_BASE_ID + 0xC2) /* 0x01C2 + */ + /** TLV type : HT Capabilities */ #define TLV_TYPE_HT_CAP (PROPRIETARY_TLV_BASE_ID + 0x4a) /* 0x014a */ @@ -461,7 +469,7 @@ typedef enum _WLAN_802_11_WEP_STATUS { #define BA_STREAM_NOT_ALLOWED 0xff /** Test if 11n is enabled by checking the HTCap IE */ -#define IS_11N_ENABLED(priv) ((priv->config_bands & BAND_GN ||priv->config_bands & BAND_AN) \ +#define IS_11N_ENABLED(priv) ((priv->config_bands & BAND_GN || priv->config_bands & BAND_AN) \ && priv->curr_bss_params.bss_descriptor.pht_cap) /** Find out if we are the initiator or not */ #define INITIATOR_BIT(DelBAParamSet) (((DelBAParamSet) & \ @@ -692,6 +700,13 @@ typedef enum _WLAN_802_11_WEP_STATUS { /** ExtCap : Reset support QosMap */ #define RESET_EXTCAP_QOS_MAP(ext_cap) (ext_cap.Qos_Map = 0) +/** ExtCap : Support for TDLS wider bandwidth */ +#define ISSUPP_EXTCAP_TDLS_WIDER_BANDWIDTH(ext_cap) (ext_cap.TDLSWildBandwidth) +/** ExtCap : Set support TDLS wider bandwidth */ +#define SET_EXTCAP_TDLS_WIDER_BANDWIDTH(ext_cap) (ext_cap.TDLSWildBandwidth = 1) +/** ExtCap : Reset support TDLS wider bandwidth */ +#define RESET_EXTCAP_TDLS_WIDER_BANDWIDTH(ext_cap) (ext_cap.TDLSWildBandwidth = 0) + /** LLC/SNAP header len */ #define LLC_SNAP_LEN 8 @@ -847,6 +862,13 @@ typedef enum _WLAN_802_11_WEP_STATUS { /** HT bandwidth 80 MHz */ #define HT_BW_80 2 +/** TLV type : Scan Response */ +#define TLV_TYPE_BSS_SCAN_RSP (PROPRIETARY_TLV_BASE_ID + 0x56) /* 0x0156 + */ +/** TLV type : Scan Response Stats */ +#define TLV_TYPE_BSS_SCAN_INFO (PROPRIETARY_TLV_BASE_ID + 0x57) /* 0x0157 + */ + /** TLV type : 11h Basic Rpt */ #define TLV_TYPE_CHANRPT_11H_BASIC (PROPRIETARY_TLV_BASE_ID + 0x5b) /* 0x015b */ @@ -890,6 +912,8 @@ typedef enum _WLAN_802_11_WEP_STATUS { /** Host Command ID : 802.11 deauthenticate */ #define HostCmd_CMD_802_11_DEAUTHENTICATE 0x0024 +/** Host Command ID: 802.11 disassoicate */ +#define HostCmd_CMD_802_11_DISASSOCIATE 0x0026 /** Host Command ID : MAC control */ #define HostCmd_CMD_MAC_CONTROL 0x0028 /** Host Command ID : 802.11 Ad-Hoc start */ @@ -1052,6 +1076,14 @@ typedef enum _WLAN_802_11_WEP_STATUS { /** Host Command ID : mgmt IE list */ #define HostCmd_CMD_MGMT_IE_LIST 0x00f2 +/** Host Command ID : TDLS configuration */ +#define HostCmd_CMD_TDLS_CONFIG 0x0100 +/** Host Command ID : TDLS operation */ +#define HostCmd_CMD_TDLS_OPERATION 0x0122 + +/** Host Command ID : Extended scan support */ +#define HostCmd_CMD_802_11_SCAN_EXT 0x0107 + /** Host Command ID : Forward mgmt frame */ #define HostCmd_CMD_RX_MGMT_IND 0x010c @@ -1196,7 +1228,7 @@ typedef enum _ENH_PS_MODES { #define MRVDRV_SIZE_OF_CMD_BUFFER (2 * 1024) /** Maximum number of BSS Descriptors */ -#define MRVDRV_MAX_BSSID_LIST 64 +#define MRVDRV_MAX_BSSID_LIST 200 /** Host command flag in command */ #define CMD_F_HOSTCMD (1 << 0) @@ -1337,6 +1369,9 @@ typedef enum _ENH_PS_MODES { #define EVENT_REMAIN_ON_CHANNEL_EXPIRED 0x0000005f #endif +/** TDLS generic event */ +#define EVENT_TDLS_GENERIC_EVENT 0x00000052 + /** Card Event definition: Channel switch pending announcment */ #define EVENT_CHANNEL_SWITCH_ANN 0x00000050 @@ -1346,6 +1381,9 @@ typedef enum _ENH_PS_MODES { /** Event definition: Radar Detected by card */ #define EVENT_CHANNEL_REPORT_RDY 0x00000054 +/** Event definition: Scan results through event */ +#define EVENT_EXT_SCAN_REPORT 0x00000058 + /** Event definition : FW debug information */ #define EVENT_FW_DEBUG_INFO 0x00000063 @@ -1390,6 +1428,76 @@ typedef enum _ENH_PS_MODES { #define EVENT_GET_BSS_TYPE(event_cause) \ (((event_cause) >> 24) & 0x00ff) +/** event type for tdls setup failure */ +#define TDLS_EVENT_TYPE_SETUP_FAILURE 1 +/** event type for tdls setup request received */ +#define TDLS_EVENT_TYPE_SETUP_REQ 2 +/** event type for tdls link torn down */ +#define TDLS_EVENT_TYPE_LINK_TORN_DOWN 3 +/** event type for tdls link established */ +#define TDLS_EVENT_TYPE_LINK_ESTABLISHED 4 +/** event type for tdls debug */ +#define TDLS_EVENT_TYPE_DEBUG 5 +/** event type for tdls packet */ +#define TDLS_EVENT_TYPE_PACKET 6 +/** event type for channel switch result */ +#define TDLS_EVENT_TYPE_CHAN_SWITCH_RESULT 7 +/** event type for start channel switch */ +#define TDLS_EVENT_TYPE_START_CHAN_SWITCH 8 +/** event type for stop channel switch */ +#define TDLS_EVENT_TYPE_CHAN_SWITCH_STOPPED 9 + +/** Packet received on direct link */ +#define RXPD_FLAG_PKT_DIRECT_LINK 1 +/** TDLS base channel */ +#define TDLS_BASE_CHANNEL 0 +/** TDLS off channel */ +#define TDLS_OFF_CHANNEL 1 + +/** structure for channel switch result from TDLS FW */ +typedef MLAN_PACK_START struct _chan_switch_result { + /** current channel, 0 - base channel, 1 - off channel*/ + t_u8 current_channel; + /** channel switch status*/ + t_u8 status; + /** channel switch fauilure reason code*/ + t_u8 reason; +} MLAN_PACK_END chan_switch_result; + +typedef MLAN_PACK_START struct _ie_data { + /** IE Length */ + t_u16 ie_length; + /** IE pointer */ + t_u8 ie_ptr[0]; +} MLAN_PACK_END tdls_ie_data; + +/** Event structure for generic events from TDLS FW */ +typedef MLAN_PACK_START struct _Event_tdls_generic { + /** Event Type */ + t_u16 event_type; + /** Peer mac address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + union { + /** channel switch result structure*/ + chan_switch_result switch_result; + /** channel switch stop reason*/ + t_u8 cs_stop_reason; + /** Reason code */ + t_u16 reason_code; + /** IE data */ + tdls_ie_data ie_data; + } u; +} MLAN_PACK_END Event_tdls_generic; + +typedef enum _tdls_error_code_e { + NO_ERROR = 0, + INTERNAL_ERROR, + MAX_TDLS_LINKS_EST, + TDLS_LINK_EXISTS, + TDLS_LINK_NONEXISTENT, + TDLS_PEER_STA_UNREACHABLE = 25, +} tdls_error_code_e; + /** Event_WEP_ICV_ERR structure */ typedef MLAN_PACK_START struct _Event_WEP_ICV_ERR { /** Reason code */ @@ -1441,6 +1549,15 @@ typedef MLAN_PACK_START struct _MrvlIEtypes_Data_t { t_u8 data[1]; } MLAN_PACK_END MrvlIEtypes_Data_t; +/*TDLS TIMEOUT VALUE (seconds)*/ +#define TDLS_IDLE_TIMEOUT 60 +/** MrvlIEtypes_Data_t */ +typedef MLAN_PACK_START struct _MrvlIEtypes_TDLS_Idle_Timeout_t { + /** Header */ + MrvlIEtypesHeader_t header; + /** value */ + t_u16 value; +} MLAN_PACK_END MrvlIEtypes_TDLS_Idle_Timeout_t; #if defined(STA_SUPPORT) /** Pairwise Cipher Suite length */ #define PAIRWISE_CIPHER_SUITE_LEN 4 @@ -1456,6 +1573,9 @@ typedef MLAN_PACK_START struct _MrvlIEtypes_Data_t { /** Bit mask for TxPD status field for last packet */ #define MRVDRV_TxPD_POWER_MGMT_LAST_PACKET 0x08 +/** Bit mask for TxPD status field for TDLS packet */ +#define MRVDRV_TxPD_FLAGS_TDLS_PACKET MBIT(4) + /** Packet type: 802.11 */ #define PKT_TYPE_802DOT11 0x05 #define PKT_TYPE_MGMT_FRAME 0xE5 @@ -1521,7 +1641,11 @@ typedef MLAN_PACK_START struct _RxPD { * [Bit 7] Reserved */ t_u8 rate_info; /** Reserved */ - t_u8 reserved; + t_u8 reserved[3]; + /** TDLS flags, bit 0: 0=InfraLink, 1=DirectLink */ + t_u8 flags; + /** Reserved */ + t_u8 reserved_1; } MLAN_PACK_END RxPD, *PRxPD; #ifdef UAP_SUPPORT @@ -1821,6 +1945,14 @@ typedef MLAN_PACK_START struct _MrvlIEtypes_RatesParamSet_t { t_u8 rates[1]; } MLAN_PACK_END MrvlIEtypes_RatesParamSet_t; +/** _MrvlIEtypes_Bssid_List_t */ +typedef MLAN_PACK_START struct _MrvlIEtypes_Bssid_List_t { + /** Header */ + MrvlIEtypesHeader_t header; + /** BSSID */ + t_u8 bssid[MLAN_MAC_ADDR_LENGTH]; +} MLAN_PACK_END MrvlIEtypes_Bssid_List_t; + /** MrvlIEtypes_SsIdParamSet_t */ typedef MLAN_PACK_START struct _MrvlIEtypes_SsIdParamSet_t { /** Header */ @@ -1966,43 +2098,112 @@ typedef MLAN_PACK_START struct _MrvlIEtypes_RsnParamSet_t { t_u8 rsn_ie[1]; } MLAN_PACK_END MrvlIEtypes_RsnParamSet_t; -/** Key_param_set fixed length */ -#define KEYPARAMSET_FIXED_LEN 6 - +/** Key Info flag for multicast key */ +#define KEY_INFO_MCAST_KEY 0x01 +/** Key Info flag for unicast key */ +#define KEY_INFO_UCAST_KEY 0x02 +/** Key Info flag for enable key */ +#define KEY_INFO_ENABLE_KEY 0x04 +/** Key Info flag for default key */ +#define KEY_INFO_DEFAULT_KEY 0x08 +/** Key Info flag for TX key */ +#define KEY_INFO_TX_KEY 0x10 +/** Key Info flag for RX key */ +#define KEY_INFO_RX_KEY 0x20 +#define KEY_INFO_CMAC_AES_KEY 0x400 +/** PN size for WPA/WPA2 */ +#define WPA_PN_SIZE 8 /** PN size for PMF IGTK */ #define IGTK_PN_SIZE 8 -/** WPA AES IGTK key length */ -#define CMAC_AES_KEY_LEN 16 +/** WAPI KEY size */ +#define WAPI_KEY_SIZE 32 +/** key params fix size */ +#define KEY_PARAMS_FIXED_LEN 10 +/** key index mask */ +#define KEY_INDEX_MASK 0xf + +/** wep_param */ +typedef MLAN_PACK_START struct _wep_param_t { + /** key_len */ + t_u16 key_len; + /** wep key */ + t_u8 key[MAX_WEP_KEY_SIZE]; +} MLAN_PACK_END wep_param_t; + +/** tkip_param */ +typedef MLAN_PACK_START struct _tkip_param { + /** Rx packet num */ + t_u8 pn[WPA_PN_SIZE]; + /** key_len */ + t_u16 key_len; + /** tkip key */ + t_u8 key[WPA_TKIP_KEY_LEN]; +} MLAN_PACK_END tkip_param; + +/** aes_param */ +typedef MLAN_PACK_START struct _aes_param { + /** Rx packet num */ + t_u8 pn[WPA_PN_SIZE]; + /** key_len */ + t_u16 key_len; + /** aes key */ + t_u8 key[WPA_AES_KEY_LEN]; +} MLAN_PACK_END aes_param; + +/** wapi_param */ +typedef MLAN_PACK_START struct _wapi_param { + /** Rx packet num */ + t_u8 pn[PN_SIZE]; + /** key_len */ + t_u16 key_len; + /** wapi key */ + t_u8 key[WAPI_KEY_SIZE]; +} MLAN_PACK_END wapi_param; + /** cmac_aes_param */ -typedef MLAN_PACK_START struct _cmac_param { +typedef MLAN_PACK_START struct _cmac_aes_param { /** IGTK pn */ t_u8 ipn[IGTK_PN_SIZE]; + /** key_len */ + t_u16 key_len; /** aes key */ t_u8 key[CMAC_AES_KEY_LEN]; -} MLAN_PACK_END cmac_param; +} MLAN_PACK_END cmac_aes_param; /** MrvlIEtype_KeyParamSet_t */ -typedef MLAN_PACK_START struct _MrvlIEtype_KeyParamSet_t { +typedef MLAN_PACK_START struct _MrvlIEtype_KeyParamSetV2_t { /** Type ID */ t_u16 type; /** Length of Payload */ t_u16 length; - /** Type of Key: WEP=0, TKIP=1, AES=2 WAPI=3 AES_CMAC=4 */ - t_u16 key_type_id; + /** mac address */ + t_u8 mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** key index */ + t_u8 key_idx; + /** Type of Key: WEP=0, TKIP=1, AES=2, WAPI=3 AES_CMAC=4 */ + t_u8 key_type; /** Key Control Info specific to a key_type_id */ t_u16 key_info; - /** Length of key */ - t_u16 key_len; - /** Key material of size key_len */ - t_u8 key[50]; -} MLAN_PACK_END MrvlIEtype_KeyParamSet_t; + union { + /** wep key param */ + wep_param_t wep; + /** tkip key param */ + tkip_param tkip; + /** aes key param */ + aes_param aes; + /** wapi key param */ + wapi_param wapi; + /** IGTK key param */ + cmac_aes_param cmac_aes; + } key_params; +} MLAN_PACK_END MrvlIEtype_KeyParamSetV2_t; /** HostCmd_DS_802_11_KEY_MATERIAL */ typedef MLAN_PACK_START struct _HostCmd_DS_802_11_KEY_MATERIAL { /** Action */ t_u16 action; /** Key parameter set */ - MrvlIEtype_KeyParamSet_t key_param_set; + MrvlIEtype_KeyParamSetV2_t key_param_set; } MLAN_PACK_END HostCmd_DS_802_11_KEY_MATERIAL; /** Data structure of WMM QoS information */ @@ -2186,7 +2387,9 @@ typedef MLAN_PACK_START struct __ps_param { t_u16 local_listen_interval; /** Adhoc awake period */ t_u16 adhoc_wake_period; - /** mode - (0x01 - firmware to automatically choose PS_POLL or NULL mode, 0x02 - PS_POLL, 0x03 - NULL mode ) */ + /** mode - (0x01 - firmware to automatically choose PS_POLL or NULL mode, + * 0x02 - PS_POLL, 0x03 - NULL mode ) + */ t_u16 mode; /** Delay to PS in milliseconds */ t_u16 delay_to_ps; @@ -2623,11 +2826,15 @@ typedef MLAN_PACK_START struct _hs_config_param { t_u32 conditions; /** GPIO pin or 0xff for interface */ t_u8 gpio; - /** gap in milliseconds or or 0xff for special setting when GPIO is used to wakeup host */ + /** gap in milliseconds or or 0xff for special setting when + * GPIO is used to wakeup host + */ t_u8 gap; } MLAN_PACK_END hs_config_param; -/** HS Action 0x0001 - Configure enhanced host sleep mode, 0x0002 - Activate enhanced host sleep mode */ +/** HS Action 0x0001 - Configure enhanced host sleep mode, + * 0x0002 - Activate enhanced host sleep mode + */ typedef enum _Host_Sleep_Action { HS_CONFIGURE = 0x0001, HS_ACTIVATE = 0x0002, @@ -2641,7 +2848,9 @@ typedef MLAN_PACK_START struct __hs_activate_param { /** HostCmd_DS_802_11_HS_CFG_ENH */ typedef MLAN_PACK_START struct _HostCmd_DS_802_11_HS_CFG_ENH { - /** Action 0x0001 - Configure enhanced host sleep mode, 0x0002 - Activate enhanced host sleep mode */ + /** Action 0x0001 - Configure enhanced host sleep mode, + * 0x0002 - Activate enhanced host sleep mode + */ t_u16 action; union { @@ -2946,6 +3155,53 @@ typedef MLAN_PACK_START struct _HostCmd_DS_802_11_SCAN { */ } MLAN_PACK_END HostCmd_DS_802_11_SCAN; +/* + * This scan handle Country Information IE(802.11d compliant) + * Define data structure for HostCmd_CMD_802_11_SCAN_EXT + */ +/** HostCmd_DS_802_11_SCAN_EXT */ +typedef MLAN_PACK_START struct _HostCmd_DS_802_11_SCAN_EXT { + /** Reserved */ + t_u32 reserved; + /** TLV buffer */ + t_u8 tlv_buffer[1]; + /** MrvlIEtypes_Bssid_List_t BssIdList; + * MrvlIEtypes_SsIdParamSet_t SSIDParamSet; + * MrvlIEtypes_ChanListParamSet_t ChanListParamSet; + * MrvlIEtypes_RatesParamSet_t OpRateSet; + * MrvlIEtypes_NumProbes_t NumProbes; + * MrvlIEtypes_WildCardSsIdParamSet_t WildCardSSIDParamSet; + */ +} MLAN_PACK_END HostCmd_DS_802_11_SCAN_EXT; + +typedef MLAN_PACK_START struct _MrvlIEtypes_Bss_Scan_Rsp_t { + /** Header */ + MrvlIEtypesHeader_t header; + /** BSSID of the BSS descriptor */ + t_u8 bssid[MLAN_MAC_ADDR_LENGTH]; + /** Beacon/Probe response buffer */ + t_u8 frame_body[1]; +} MLAN_PACK_END MrvlIEtypes_Bss_Scan_Rsp_t; + +typedef MLAN_PACK_START struct _MrvlIEtypes_Bss_Scan_Info_t { + /** Header */ + MrvlIEtypesHeader_t header; + /** RSSI for scan entry */ + t_s16 rssi; + /** Channel ANPI */ + t_s16 anpi; + /** Channel load (parts per 255) */ + t_u8 cca_busy_fraction; + /** Band */ + t_u8 band; + /** Channel */ + t_u8 channel; + /** Reserved */ + t_u8 reserved; + /** TSF data */ + t_u64 tsf; +} MLAN_PACK_END MrvlIEtypes_Bss_Scan_Info_t; + /** HostCmd_DS_RX_MGMT_IND */ typedef MLAN_PACK_START struct _HostCmd_DS_RX_MGMT_IND { /** Action */ @@ -3780,6 +4036,28 @@ typedef MLAN_PACK_START struct _HostCmd_DS_MGMT_IE_LIST { mlan_ds_misc_custom_ie ds_mgmt_ie; } MLAN_PACK_END HostCmd_DS_MGMT_IE_LIST_CFG; +/** HostCmd_DS_TDLS_CONFIG */ +typedef MLAN_PACK_START struct _HostCmd_DS_TDLS_CONFIG { + /** Set TDLS configuration */ + mlan_ds_misc_tdls_config tdls_info; +} MLAN_PACK_END HostCmd_DS_TDLS_CONFIG; + +/**Action ID for TDLS delete link*/ +#define TDLS_DELETE 0x00 +/**Action ID for TDLS create link*/ +#define TDLS_CREATE 0x01 +/**Action ID for TDLS config link*/ +#define TDLS_CONFIG 0x02 +/** HostCmd_DS_TDLS_OPER */ +typedef MLAN_PACK_START struct _HostCmd_DS_TDLS_OPER { + /** Action */ + t_u16 tdls_action; + /**reason*/ + t_u16 reason; + /** peer mac */ + t_u8 peer_mac[MLAN_MAC_ADDR_LENGTH]; +} MLAN_PACK_END HostCmd_DS_TDLS_OPER; + /** HostCmd_CMD_MAC_REG_ACCESS */ typedef MLAN_PACK_START struct _HostCmd_DS_MAC_REG_ACCESS { /** Action */ @@ -3927,112 +4205,112 @@ typedef MLAN_PACK_START struct _MrvlIEtypes_MacAddr_t { #ifdef UAP_SUPPORT /** TLV type : AP Channel band Config */ -#define TLV_TYPE_UAP_CHAN_BAND_CONFIG (PROPRIETARY_TLV_BASE_ID + 0x2a) /* 0x012a - */ +#define TLV_TYPE_UAP_CHAN_BAND_CONFIG\ + (PROPRIETARY_TLV_BASE_ID + 0x2a) /* 0x012a */ /** TLV type : AP Mac address */ -#define TLV_TYPE_UAP_MAC_ADDRESS (PROPRIETARY_TLV_BASE_ID + 0x2b) /* 0x012b - */ +#define TLV_TYPE_UAP_MAC_ADDRESS\ + (PROPRIETARY_TLV_BASE_ID + 0x2b) /* 0x012b */ /** TLV type : AP Beacon period */ -#define TLV_TYPE_UAP_BEACON_PERIOD (PROPRIETARY_TLV_BASE_ID + 0x2c) /* 0x012c - */ +#define TLV_TYPE_UAP_BEACON_PERIOD\ + (PROPRIETARY_TLV_BASE_ID + 0x2c) /* 0x012c */ /** TLV type : AP DTIM period */ -#define TLV_TYPE_UAP_DTIM_PERIOD (PROPRIETARY_TLV_BASE_ID + 0x2d) /* 0x012d - */ +#define TLV_TYPE_UAP_DTIM_PERIOD\ + (PROPRIETARY_TLV_BASE_ID + 0x2d) /* 0x012d */ /** TLV type : AP Tx power */ -#define TLV_TYPE_UAP_TX_POWER (PROPRIETARY_TLV_BASE_ID + 0x2f) /* 0x012f - */ +#define TLV_TYPE_UAP_TX_POWER\ + (PROPRIETARY_TLV_BASE_ID + 0x2f) /* 0x012f */ /** TLV type : AP SSID broadcast control */ -#define TLV_TYPE_UAP_BCAST_SSID_CTL (PROPRIETARY_TLV_BASE_ID + 0x30) /* 0x0130 - */ +#define TLV_TYPE_UAP_BCAST_SSID_CTL\ + (PROPRIETARY_TLV_BASE_ID + 0x30) /* 0x0130 */ /** TLV type : AP Preamble control */ -#define TLV_TYPE_UAP_PREAMBLE_CTL (PROPRIETARY_TLV_BASE_ID + 0x31) /* 0x0131 - */ +#define TLV_TYPE_UAP_PREAMBLE_CTL\ + (PROPRIETARY_TLV_BASE_ID + 0x31) /* 0x0131 */ /** TLV type : AP Antenna control */ -#define TLV_TYPE_UAP_ANTENNA_CTL (PROPRIETARY_TLV_BASE_ID + 0x32) /* 0x0132 - */ +#define TLV_TYPE_UAP_ANTENNA_CTL\ + (PROPRIETARY_TLV_BASE_ID + 0x32) /* 0x0132 */ /** TLV type : AP RTS threshold */ -#define TLV_TYPE_UAP_RTS_THRESHOLD (PROPRIETARY_TLV_BASE_ID + 0x33) /* 0x0133 - */ +#define TLV_TYPE_UAP_RTS_THRESHOLD\ + (PROPRIETARY_TLV_BASE_ID + 0x33) /* 0x0133 */ /** TLV type : AP Tx data rate */ -#define TLV_TYPE_UAP_TX_DATA_RATE (PROPRIETARY_TLV_BASE_ID + 0x35) /* 0x0135 - */ +#define TLV_TYPE_UAP_TX_DATA_RATE\ + (PROPRIETARY_TLV_BASE_ID + 0x35) /* 0x0135 */ /** TLV type: AP Packet forwarding control */ -#define TLV_TYPE_UAP_PKT_FWD_CTL (PROPRIETARY_TLV_BASE_ID + 0x36) /* 0x0136 - */ +#define TLV_TYPE_UAP_PKT_FWD_CTL\ + (PROPRIETARY_TLV_BASE_ID + 0x36) /* 0x0136 */ /** TLV type: STA information */ -#define TLV_TYPE_UAP_STA_INFO (PROPRIETARY_TLV_BASE_ID + 0x37) /* 0x0137 - */ +#define TLV_TYPE_UAP_STA_INFO\ + (PROPRIETARY_TLV_BASE_ID + 0x37) /* 0x0137 */ /** TLV type: AP STA MAC address filter */ -#define TLV_TYPE_UAP_STA_MAC_ADDR_FILTER (PROPRIETARY_TLV_BASE_ID + 0x38) /* 0x0138 - */ +#define TLV_TYPE_UAP_STA_MAC_ADDR_FILTER\ + (PROPRIETARY_TLV_BASE_ID + 0x38) /* 0x0138 */ /** TLV type: AP STA ageout timer */ -#define TLV_TYPE_UAP_STA_AGEOUT_TIMER (PROPRIETARY_TLV_BASE_ID + 0x39) /* 0x0139 - */ +#define TLV_TYPE_UAP_STA_AGEOUT_TIMER\ + (PROPRIETARY_TLV_BASE_ID + 0x39) /* 0x0139 */ /** TLV type: AP WEP keys */ -#define TLV_TYPE_UAP_WEP_KEY (PROPRIETARY_TLV_BASE_ID + 0x3b) /* 0x013b - */ +#define TLV_TYPE_UAP_WEP_KEY\ + (PROPRIETARY_TLV_BASE_ID + 0x3b) /* 0x013b */ /** TLV type: AP WPA passphrase */ -#define TLV_TYPE_UAP_WPA_PASSPHRASE (PROPRIETARY_TLV_BASE_ID + 0x3c) /* 0x013c - */ +#define TLV_TYPE_UAP_WPA_PASSPHRASE\ + (PROPRIETARY_TLV_BASE_ID + 0x3c) /* 0x013c */ /** TLV type: AP protocol */ -#define TLV_TYPE_UAP_ENCRYPT_PROTOCOL (PROPRIETARY_TLV_BASE_ID + 0x40) /* 0x0140 - */ +#define TLV_TYPE_UAP_ENCRYPT_PROTOCOL\ + (PROPRIETARY_TLV_BASE_ID + 0x40) /* 0x0140 */ /** TLV type: AP AKMP */ -#define TLV_TYPE_UAP_AKMP (PROPRIETARY_TLV_BASE_ID + 0x41) /* 0x0141 - */ +#define TLV_TYPE_UAP_AKMP\ + (PROPRIETARY_TLV_BASE_ID + 0x41) /* 0x0141 */ /** TLV type: AP Fragment threshold */ -#define TLV_TYPE_UAP_FRAG_THRESHOLD (PROPRIETARY_TLV_BASE_ID + 0x46) /* 0x0146 - */ +#define TLV_TYPE_UAP_FRAG_THRESHOLD\ + (PROPRIETARY_TLV_BASE_ID + 0x46) /* 0x0146 */ /** TLV type: AP Group rekey timer */ -#define TLV_TYPE_UAP_GRP_REKEY_TIME (PROPRIETARY_TLV_BASE_ID + 0x47) /* 0x0147 - */ +#define TLV_TYPE_UAP_GRP_REKEY_TIME\ + (PROPRIETARY_TLV_BASE_ID + 0x47) /* 0x0147 */ /**TLV type : AP Max Station number */ -#define TLV_TYPE_UAP_MAX_STA_CNT (PROPRIETARY_TLV_BASE_ID + 0x55) /* 0x0155 - */ +#define TLV_TYPE_UAP_MAX_STA_CNT\ + (PROPRIETARY_TLV_BASE_ID + 0x55) /* 0x0155 */ /**TLV type : AP Retry limit */ -#define TLV_TYPE_UAP_RETRY_LIMIT (PROPRIETARY_TLV_BASE_ID + 0x5d) /* 0x015d - */ +#define TLV_TYPE_UAP_RETRY_LIMIT\ + (PROPRIETARY_TLV_BASE_ID + 0x5d) /* 0x015d */ /** TLV type : AP MCBC data rate */ -#define TLV_TYPE_UAP_MCBC_DATA_RATE (PROPRIETARY_TLV_BASE_ID + 0x62) /* 0x0162 - */ +#define TLV_TYPE_UAP_MCBC_DATA_RATE\ + (PROPRIETARY_TLV_BASE_ID + 0x62) /* 0x0162 */ /**TLV type: AP RSN replay protection */ -#define TLV_TYPE_UAP_RSN_REPLAY_PROTECT (PROPRIETARY_TLV_BASE_ID + 0x64) /* 0x0164 - */ +#define TLV_TYPE_UAP_RSN_REPLAY_PROTECT\ + (PROPRIETARY_TLV_BASE_ID + 0x64) /* 0x0164 */ /** TLV ID : Management Frame */ -#define TLV_TYPE_UAP_MGMT_FRAME (PROPRIETARY_TLV_BASE_ID + 0x68) /* 0x0168 - */ +#define TLV_TYPE_UAP_MGMT_FRAME\ + (PROPRIETARY_TLV_BASE_ID + 0x68) /* 0x0168 */ #ifdef UAP_SUPPORT /**TLV type: AP mgmt IE passthru mask */ -#define TLV_TYPE_UAP_MGMT_IE_PASSTHRU_MASK (PROPRIETARY_TLV_BASE_ID + 0x70) /* 0x0170 - */ +#define TLV_TYPE_UAP_MGMT_IE_PASSTHRU_MASK\ + (PROPRIETARY_TLV_BASE_ID + 0x70) /* 0x0170 */ #endif /** TLV : 20/40 coex config */ -#define TLV_TYPE_2040_BSS_COEX_CONTROL (PROPRIETARY_TLV_BASE_ID + 0x98) /* 0x0198 - */ +#define TLV_TYPE_2040_BSS_COEX_CONTROL\ + (PROPRIETARY_TLV_BASE_ID + 0x98) /* 0x0198 */ /**TLV type: AP pairwise handshake timeout */ -#define TLV_TYPE_UAP_EAPOL_PWK_HSK_TIMEOUT (PROPRIETARY_TLV_BASE_ID + 0x75) /* 0x0175 - */ +#define TLV_TYPE_UAP_EAPOL_PWK_HSK_TIMEOUT\ + (PROPRIETARY_TLV_BASE_ID + 0x75) /* 0x0175 */ /**TLV type: AP pairwise handshake retries */ -#define TLV_TYPE_UAP_EAPOL_PWK_HSK_RETRIES (PROPRIETARY_TLV_BASE_ID + 0x76) /* 0x0176 - */ +#define TLV_TYPE_UAP_EAPOL_PWK_HSK_RETRIES\ + (PROPRIETARY_TLV_BASE_ID + 0x76) /* 0x0176 */ /**TLV type: AP groupwise handshake timeout */ -#define TLV_TYPE_UAP_EAPOL_GWK_HSK_TIMEOUT (PROPRIETARY_TLV_BASE_ID + 0x77) /* 0x0177 - */ +#define TLV_TYPE_UAP_EAPOL_GWK_HSK_TIMEOUT\ + (PROPRIETARY_TLV_BASE_ID + 0x77) /* 0x0177 */ /**TLV type: AP groupwise handshake retries */ -#define TLV_TYPE_UAP_EAPOL_GWK_HSK_RETRIES (PROPRIETARY_TLV_BASE_ID + 0x78) /* 0x0178 - */ +#define TLV_TYPE_UAP_EAPOL_GWK_HSK_RETRIES\ + (PROPRIETARY_TLV_BASE_ID + 0x78) /* 0x0178 */ /** TLV type: AP PS STA ageout timer */ -#define TLV_TYPE_UAP_PS_STA_AGEOUT_TIMER (PROPRIETARY_TLV_BASE_ID + 0x7b) /* 0x017b - */ +#define TLV_TYPE_UAP_PS_STA_AGEOUT_TIMER\ + (PROPRIETARY_TLV_BASE_ID + 0x7b) /* 0x017b */ /** TLV type : Pairwise Cipher */ -#define TLV_TYPE_PWK_CIPHER (PROPRIETARY_TLV_BASE_ID + 0x91) /* 0x0191 - */ +#define TLV_TYPE_PWK_CIPHER\ + (PROPRIETARY_TLV_BASE_ID + 0x91) /* 0x0191 */ /** TLV type : Group Cipher */ -#define TLV_TYPE_GWK_CIPHER (PROPRIETARY_TLV_BASE_ID + 0x92) /* 0x0192 - */ +#define TLV_TYPE_GWK_CIPHER\ + (PROPRIETARY_TLV_BASE_ID + 0x92) /* 0x0192 */ /** TLV type : BSS Status */ -#define TLV_TYPE_BSS_STATUS (PROPRIETARY_TLV_BASE_ID + 0x93) /* 0x0193 - */ +#define TLV_TYPE_BSS_STATUS\ + (PROPRIETARY_TLV_BASE_ID + 0x93) /* 0x0193 */ #ifdef WIFI_DIRECT_SUPPORT /** TLV type : AP PSK */ @@ -4393,11 +4671,11 @@ typedef MLAN_PACK_START struct _HostCmd_DS_STA_DEAUTH { /** Host Command id: POWER_MGMT */ #define HOST_CMD_POWER_MGMT_EXT 0x00ef /** TLV type: AP Sleep param */ -#define TLV_TYPE_AP_SLEEP_PARAM (PROPRIETARY_TLV_BASE_ID + 0x6a) /* 0x016a - */ +#define TLV_TYPE_AP_SLEEP_PARAM\ + (PROPRIETARY_TLV_BASE_ID + 0x6a) /* 0x016a */ /** TLV type: AP Inactivity Sleep param */ -#define TLV_TYPE_AP_INACT_SLEEP_PARAM (PROPRIETARY_TLV_BASE_ID + 0x6b) /* 0x016b - */ +#define TLV_TYPE_AP_INACT_SLEEP_PARAM\ + (PROPRIETARY_TLV_BASE_ID + 0x6b) /* 0x016b */ /** MrvlIEtypes_sleep_param_t */ typedef MLAN_PACK_START struct _MrvlIEtypes_sleep_param_t { @@ -4541,7 +4819,9 @@ typedef MLAN_PACK_START struct { /**< Marvell TLV header: ID/Len */ t_u8 chan; /**< Channel local constraint applies to */ - /** Power constraint included in beacons and used by fw to offset 11d info */ + /** Power constraint included in beacons + * and used by fw to offset 11d info + */ t_u8 constraint; } MLAN_PACK_END MrvlIEtypes_LocalPowerConstraint_t; @@ -4555,29 +4835,39 @@ typedef MLAN_PACK_START struct { /** TPC Info structure sent in CMD_802_11_TPC_INFO command to firmware */ typedef MLAN_PACK_START struct { MrvlIEtypes_LocalPowerConstraint_t local_constraint; - /**< Local constraint */ - MrvlIEtypes_PowerCapability_t power_cap; /**< Power Capability */ + /**< Local + constraint */ + MrvlIEtypes_PowerCapability_t power_cap; /**< Power + Capability */ } MLAN_PACK_END HostCmd_DS_802_11_TPC_INFO; -/** TPC Request structure sent in CMD_802_11_TPC_ADAPT_REQ command to firmware */ +/** TPC Request structure sent in CMD_802_11_TPC_ADAPT_REQ + * command to firmware + */ typedef MLAN_PACK_START struct { - t_u8 dest_mac[MLAN_MAC_ADDR_LENGTH]; /**< Destination STA address */ - t_u16 timeout; /**< Response timeout in ms */ - t_u8 rate_index; /**< IEEE Rate index to send request */ + t_u8 dest_mac[MLAN_MAC_ADDR_LENGTH]; /**< Destination STA address */ + t_u16 timeout; /**< Response timeout in ms */ + t_u8 rate_index; /**< IEEE Rate index to send request */ } MLAN_PACK_END HostCmd_TpcRequest; -/** TPC Response structure received from the CMD_802_11_TPC_ADAPT_REQ command */ +/** TPC Response structure received from the + * CMD_802_11_TPC_ADAPT_REQ command + */ typedef MLAN_PACK_START struct { - t_u8 tpc_ret_code; /**< Firmware command result status code */ - t_s8 tx_power; /**< Reported TX Power from the TPC Report element */ - t_s8 link_margin; /**< Reported link margin from the TPC Report element */ - t_s8 rssi; /**< RSSI of the received TPC Report frame */ + t_u8 tpc_ret_code; + /**< Firmware command result status code */ + t_s8 tx_power; /**< Reported TX Power from the TPC Report element */ + t_s8 link_margin; + /**< Reported link margin from the TPC Report element */ + t_s8 rssi; /**< RSSI of the received TPC Report frame */ } MLAN_PACK_END HostCmd_TpcResponse; -/** CMD_802_11_TPC_ADAPT_REQ substruct. Union of the TPC request and response */ +/** CMD_802_11_TPC_ADAPT_REQ substruct. + * Union of the TPC request and response + */ typedef MLAN_PACK_START union { HostCmd_TpcRequest req; /**< Request struct sent to firmware */ @@ -4602,7 +4892,7 @@ typedef MLAN_PACK_START struct { typedef MLAN_PACK_START enum _MeasType_t { WLAN_MEAS_BASIC = 0, /**< 11h: Basic */ WLAN_MEAS_NUM_TYPES, /**< Number of enumerated measurements */ - WLAN_MEAS_11H_MAX_TYPE = WLAN_MEAS_BASIC, /**< Max 11h measurement */ + WLAN_MEAS_11H_MAX_TYPE = WLAN_MEAS_BASIC, /**< Max 11h measurement */ } MLAN_PACK_END MeasType_t; @@ -4611,19 +4901,31 @@ typedef MLAN_PACK_START enum _MeasType_t { */ typedef MLAN_PACK_START struct { #ifdef BIG_ENDIAN_SUPPORT - t_u8 rsvd5_7:3; /**< Reserved */ - t_u8 duration_mandatory:1;/**< 11k: duration spec. for meas. is mandatory */ - t_u8 report:1; /**< 11h: en/disable report rcpt. of spec. type */ - t_u8 request:1; /**< 11h: en/disable requests of specified type */ - t_u8 enable:1; /**< 11h: enable report/request bits */ - t_u8 parallel:1; /**< 11k: series or parallel with previous meas */ + /**< Reserved */ + t_u8 rsvd5_7:3; + /**< 11k: duration spec. for meas. is mandatory */ + t_u8 duration_mandatory:1; + /**< 11h: en/disable report rcpt. of spec. type */ + t_u8 report:1; + /**< 11h: en/disable requests of specified type */ + t_u8 request:1; + /**< 11h: enable report/request bits */ + t_u8 enable:1; + /**< 11k: series or parallel with previous meas */ + t_u8 parallel:1; #else - t_u8 parallel:1; /**< 11k: series or parallel with previous meas */ - t_u8 enable:1; /**< 11h: enable report/request bits */ - t_u8 request:1; /**< 11h: en/disable requests of specified type */ - t_u8 report:1; /**< 11h: en/disable report rcpt. of spec. type */ - t_u8 duration_mandatory:1;/**< 11k: duration spec. for meas. is mandatory */ - t_u8 rsvd5_7:3; /**< Reserved */ + /**< 11k: series or parallel with previous meas */ + t_u8 parallel:1; + /**< 11h: enable report/request bits */ + t_u8 enable:1; + /**< 11h: en/disable requests of specified type */ + t_u8 request:1; + /**< 11h: en/disable report rcpt. of spec. type */ + t_u8 report:1; + /**< 11k: duration spec. for meas. is mandatory */ + t_u8 duration_mandatory:1; + /**< Reserved */ + t_u8 rsvd5_7:3; #endif /* BIG_ENDIAN_SUPPORT */ } MLAN_PACK_END MeasReqMode_t; @@ -4699,10 +5001,10 @@ typedef MLAN_PACK_START struct { * @brief CCA measurement report (7.3.2.22.2) */ typedef MLAN_PACK_START struct { - t_u8 channel; /**< Channel to measured */ - t_u64 start_time; /**< Start time (TSF) of measurement */ - t_u16 duration; /**< Duration of measurement in TUs */ - t_u8 busy_fraction; /**< Fractional duration CCA indicated chan busy */ + t_u8 channel; /**< Channel to measured */ + t_u64 start_time; /**< Start time (TSF) of measurement */ + t_u16 duration; /**< Duration of measurement in TUs */ + t_u8 busy_fraction; /**< Fractional duration CCA indicated chan busy */ } MLAN_PACK_END MeasRptCCA_t; @@ -4868,6 +5170,8 @@ typedef struct MLAN_PACK_START _HostCmd_DS_COMMAND { HostCmd_DS_802_11_HS_CFG_ENH opt_hs_cfg; /** Scan */ HostCmd_DS_802_11_SCAN scan; + /** Extended Scan */ + HostCmd_DS_802_11_SCAN_EXT ext_scan; /** Mgmt frame subtype mask */ HostCmd_DS_RX_MGMT_IND rx_mgmt_ind; @@ -4949,6 +5253,10 @@ typedef struct MLAN_PACK_START _HostCmd_DS_COMMAND { HostCmd_DS_802_11_IBSS_STATUS ibss_coalescing; /** Mgmt IE list configuration */ HostCmd_DS_MGMT_IE_LIST_CFG mgmt_ie_list; + /** TDLS configuration command */ + HostCmd_DS_TDLS_CONFIG tdls_config_data; + /** TDLS operation command */ + HostCmd_DS_TDLS_OPER tdls_oper_data; /** System clock configuration */ HostCmd_DS_ECL_SYSTEM_CLOCK_CONFIG sys_clock_cfg; /** MAC register access */ @@ -5012,7 +5320,8 @@ typedef MLAN_PACK_START struct _OPT_Confirm_Sleep { typedef struct MLAN_PACK_START _opt_sleep_confirm_buffer { /** Header for interface */ t_u8 hdr[4]; - /** New power save command used to send sleep confirmation to the firmware */ + /** New power save command used to send + * sleep confirmation to the firmware */ OPT_Confirm_Sleep ps_cfm_sleep; } MLAN_PACK_END opt_sleep_confirm_buffer; diff --git a/drivers/net/wireless/sd8897/mlan/mlan_ieee.h b/drivers/net/wireless/sd8897/mlan/mlan_ieee.h index 4b296f27e194..aa1d31f3ba51 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_ieee.h +++ b/drivers/net/wireless/sd8897/mlan/mlan_ieee.h @@ -33,7 +33,7 @@ Change log: #define _MLAN_IEEE_H_ /** FIX IES size in beacon buffer */ -#define WLAN_802_11_FIXED_IE_SIZE 12 +#define WLAN_802_11_FIXED_IE_SIZE 12 /** WLAN supported rates */ #define WLAN_SUPPORTED_RATES 14 @@ -1263,19 +1263,31 @@ typedef MLAN_PACK_START struct { **/ typedef MLAN_PACK_START struct { #ifdef BIG_ENDIAN_SUPPORT - t_u8 rsvd5_7:3; /**< Reserved */ - t_u8 unmeasured:1; /**< Channel is unmeasured */ - t_u8 radar:1; /**< Radar detected on channel */ - t_u8 unidentified_sig:1; /**< Unidentified signal found on channel */ - t_u8 ofdm_preamble:1; /**< OFDM preamble detected on channel */ - t_u8 bss:1; /**< At least one valid MPDU received on channel */ + /**< Reserved */ + t_u8 rsvd5_7:3; + /**< Channel is unmeasured */ + t_u8 unmeasured:1; + /**< Radar detected on channel */ + t_u8 radar:1; + /**< Unidentified signal found on channel */ + t_u8 unidentified_sig:1; + /**< OFDM preamble detected on channel */ + t_u8 ofdm_preamble:1; + /**< At least one valid MPDU received on channel */ + t_u8 bss:1; #else - t_u8 bss:1; /**< At least one valid MPDU received on channel */ - t_u8 ofdm_preamble:1; /**< OFDM preamble detected on channel */ - t_u8 unidentified_sig:1; /**< Unidentified signal found on channel */ - t_u8 radar:1; /**< Radar detected on channel */ - t_u8 unmeasured:1; /**< Channel is unmeasured */ - t_u8 rsvd5_7:3; /**< Reserved */ + /**< At least one valid MPDU received on channel */ + t_u8 bss:1; + /**< OFDM preamble detected on channel */ + t_u8 ofdm_preamble:1; + /**< Unidentified signal found on channel */ + t_u8 unidentified_sig:1; + /**< Radar detected on channel */ + t_u8 radar:1; + /**< Channel is unmeasured */ + t_u8 unmeasured:1; + /**< Reserved */ + t_u8 rsvd5_7:3; #endif /* BIG_ENDIAN_SUPPORT */ } MLAN_PACK_END MeasRptBasicMap_t; @@ -1331,6 +1343,48 @@ typedef struct { } wlan_11h_bss_info_t; +/** Ethernet packet type for TDLS */ +#define MLAN_ETHER_PKT_TYPE_TDLS_ACTION (0x890D) + +/*802.11z TDLS action frame type and strcuct */ +typedef MLAN_PACK_START struct { + /* link indentifier ie =101 */ + t_u8 element_id; + /* len = 18 */ + t_u8 len; + /** bssid */ + t_u8 bssid[MLAN_MAC_ADDR_LENGTH]; + /** init sta mac address */ + t_u8 init_sta[MLAN_MAC_ADDR_LENGTH]; + /** resp sta mac address */ + t_u8 resp_sta[MLAN_MAC_ADDR_LENGTH]; +} MLAN_PACK_END IEEEtypes_tdls_linkie; + +/** action code for tdls setup request */ +#define TDLS_SETUP_REQUEST 0 +/** action code for tdls setup response */ +#define TDLS_SETUP_RESPONSE 1 +/** action code for tdls setup confirm */ +#define TDLS_SETUP_CONFIRM 2 +/** action code for tdls tear down */ +#define TDLS_TEARDOWN 3 +/** action code for tdls traffic indication */ +#define TDLS_PEER_TRAFFIC_INDICATION 4 +/** action code for tdls channel switch request */ +#define TDLS_CHANNEL_SWITCH_REQUEST 5 +/** action code for tdls channel switch response */ +#define TDLS_CHANNEL_SWITCH_RESPONSE 6 +/** action code for tdls psm request */ +#define TDLS_PEER_PSM_REQUEST 7 +/** action code for tdls psm response */ +#define TDLS_PEER_PSM_RESPONSE 8 +/** action code for tdls traffic response */ +#define TDLS_PEER_TRAFFIC_RESPONSE 9 +/** action code for tdls discovery request */ +#define TDLS_DISCOVERY_REQUEST 10 +/** action code for TDLS discovery response */ +#define TDLS_DISCOVERY_RESPONSE 14 + #ifdef STA_SUPPORT /** Macro for maximum size of scan response buffer */ #define MAX_SCAN_RSP_BUF (16 * 1024) @@ -1475,6 +1529,8 @@ typedef MLAN_PACK_START struct { t_u8 snr_threshold; /** repeat count */ t_u16 repeat_count; + /** start later flag */ + t_u16 start_later; /** SSID filter list used in the to limit the scan results */ wlan_user_scan_ssid ssid_list[MRVDRV_MAX_SSID_LIST_LENGTH]; /** Variable number (fixed maximum) of channels to scan up */ diff --git a/drivers/net/wireless/sd8897/mlan/mlan_init.c b/drivers/net/wireless/sd8897/mlan/mlan_init.c index dbff624e2e9d..f12f3c069565 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_init.c +++ b/drivers/net/wireless/sd8897/mlan/mlan_init.c @@ -55,9 +55,9 @@ Change log: /** * @brief This function adds a BSS priority table * - * @param priv A pointer to mlan_private structure + * @param priv A pointer to mlan_private structure * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_add_bsspriotbl(pmlan_private priv) @@ -87,9 +87,8 @@ wlan_add_bsspriotbl(pmlan_private priv) = pbssprio; util_enqueue_list_tail(pmadapter->pmoal_handle, - &pmadapter->bssprio_tbl[priv-> - bss_priority].bssprio_head, - (pmlan_linked_list) pbssprio, + &pmadapter->bssprio_tbl[priv->bss_priority]. + bssprio_head, (pmlan_linked_list) pbssprio, pmadapter->callbacks.moal_spin_lock, pmadapter->callbacks.moal_spin_unlock); @@ -100,9 +99,9 @@ wlan_add_bsspriotbl(pmlan_private priv) /** * @brief This function deletes the BSS priority table * - * @param priv A pointer to mlan_private structure + * @param priv A pointer to mlan_private structure * - * @return N/A + * @return N/A */ static t_void wlan_delete_bsspriotbl(pmlan_private priv) @@ -168,11 +167,11 @@ wlan_delete_bsspriotbl(pmlan_private priv) /** * @brief This function allocates buffer for the members of adapter - * structure like command buffer and BSSID list. + * structure like command buffer and BSSID list. * - * @param pmadapter A pointer to mlan_adapter structure + * @param pmadapter A pointer to mlan_adapter structure * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_allocate_adapter(pmlan_adapter pmadapter) @@ -268,11 +267,11 @@ wlan_allocate_adapter(pmlan_adapter pmadapter) /** * @brief This function initializes the private structure - * and sets default values to the members of mlan_private. + * and sets default values to the members of mlan_private. * - * @param priv A pointer to mlan_private structure + * @param priv A pointer to mlan_private structure * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_init_priv(pmlan_private priv) @@ -377,6 +376,7 @@ wlan_init_priv(pmlan_private priv) priv->wmm_required = MTRUE; priv->wmm_enabled = MFALSE; priv->wmm_qosinfo = 0; + priv->saved_wmm_qosinfo = 0; #ifdef STA_SUPPORT priv->pcurr_bcn_buf = MNULL; priv->curr_bcn_size = 0; @@ -390,11 +390,8 @@ wlan_init_priv(pmlan_private priv) priv->addba_reject[7] = ADDBA_RSP_STATUS_REJECT; priv->max_amsdu = 0; - if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA) { - priv->port_ctrl_mode = MTRUE; - } else { - priv->port_ctrl_mode = MFALSE; - } + priv->port_ctrl_mode = MTRUE; + priv->port_open = MFALSE; ret = wlan_add_bsspriotbl(priv); @@ -405,11 +402,11 @@ wlan_init_priv(pmlan_private priv) /** * @brief This function initializes the adapter structure - * and sets default values to the members of adapter. + * and sets default values to the members of adapter. * - * @param pmadapter A pointer to mlan_adapter structure + * @param pmadapter A pointer to mlan_adapter structure * - * @return N/A + * @return N/A */ t_void wlan_init_adapter(pmlan_adapter pmadapter) @@ -423,11 +420,10 @@ wlan_init_adapter(pmlan_adapter pmadapter) data_offset); #ifdef MFG_CMD_SUPPORT - if (pmadapter->init_para.mfg_mode == MLAN_INIT_PARA_DISABLED) { + if (pmadapter->init_para.mfg_mode == MLAN_INIT_PARA_DISABLED) pmadapter->mfg_mode = MFALSE; - } else { + else pmadapter->mfg_mode = pmadapter->init_para.mfg_mode; - } #endif pmadapter->int_mode = pmadapter->init_para.int_mode; @@ -449,13 +445,12 @@ wlan_init_adapter(pmlan_adapter pmadapter) pmadapter->mpa_tx.pkt_cnt = 0; pmadapter->mpa_tx.start_port = 0; - if (!pmadapter->init_para.mpa_tx_cfg) { + if (!pmadapter->init_para.mpa_tx_cfg) pmadapter->mpa_tx.enabled = MFALSE; - } else if (pmadapter->init_para.mpa_tx_cfg == MLAN_INIT_PARA_DISABLED) { + else if (pmadapter->init_para.mpa_tx_cfg == MLAN_INIT_PARA_DISABLED) pmadapter->mpa_tx.enabled = MFALSE; - } else { + else pmadapter->mpa_tx.enabled = MTRUE; - } pmadapter->mpa_tx.pkt_aggr_limit = SDIO_MP_AGGR_DEF_PKT_LIMIT; #endif /* SDIO_MULTI_PORT_TX_AGGR */ @@ -464,13 +459,12 @@ wlan_init_adapter(pmlan_adapter pmadapter) pmadapter->mpa_rx.pkt_cnt = 0; pmadapter->mpa_rx.start_port = 0; - if (!pmadapter->init_para.mpa_rx_cfg) { + if (!pmadapter->init_para.mpa_rx_cfg) pmadapter->mpa_rx.enabled = MFALSE; - } else if (pmadapter->init_para.mpa_rx_cfg == MLAN_INIT_PARA_DISABLED) { + else if (pmadapter->init_para.mpa_rx_cfg == MLAN_INIT_PARA_DISABLED) pmadapter->mpa_rx.enabled = MFALSE; - } else { + else pmadapter->mpa_rx.enabled = MTRUE; - } pmadapter->mpa_rx.pkt_aggr_limit = SDIO_MP_AGGR_DEF_PKT_LIMIT; #endif /* SDIO_MULTI_PORT_RX_AGGR */ @@ -510,6 +504,7 @@ wlan_init_adapter(pmlan_adapter pmadapter) pmadapter->num_in_scan_table = 0; memset(pmadapter, pmadapter->pscan_table, 0, (sizeof(BSSDescriptor_t) * MRVDRV_MAX_BSSID_LIST)); + pmadapter->ext_scan = 0; pmadapter->scan_probes = DEFAULT_PROBES; memset(pmadapter, pmadapter->bcn_buf, 0, pmadapter->bcn_buf_size); @@ -570,6 +565,7 @@ wlan_init_adapter(pmlan_adapter pmadapter) #ifdef STA_SUPPORT pmadapter->chan_bandwidth = 0; pmadapter->adhoc_11n_enabled = MFALSE; + pmadapter->tdls_status = TDLS_NOT_SETUP; #endif /* STA_SUPPORT */ pmadapter->hw_dot_11ac_dev_cap = 0; @@ -604,6 +600,8 @@ wlan_init_adapter(pmlan_adapter pmadapter) sizeof(pmadapter->sleep_params)); memset(pmadapter, &pmadapter->sleep_period, 0, sizeof(pmadapter->sleep_period)); + memset(pmadapter, &pmadapter->saved_sleep_period, 0, + sizeof(pmadapter->saved_sleep_period)); pmadapter->tx_lock_flag = MFALSE; pmadapter->null_pkt_interval = 0; pmadapter->fw_bands = 0; @@ -772,6 +770,11 @@ wlan_init_lock_list(IN pmlan_adapter pmadapter) &priv->sta_list, MTRUE, pmadapter->callbacks. moal_init_lock); + /* Initialize tdls_pending_txq */ + util_init_list_head((t_void *) pmadapter->pmoal_handle, + &priv->tdls_pending_txq, MTRUE, + pmadapter->callbacks. + moal_init_lock); /* Initialize bypass_txq */ util_init_list_head((t_void *) pmadapter->pmoal_handle, &priv->bypass_txq, MTRUE, @@ -868,6 +871,10 @@ wlan_free_lock_list(IN pmlan_adapter pmadapter) priv->adapter->callbacks. moal_free_lock); util_free_list_head((t_void *) pmadapter->pmoal_handle, + &priv->tdls_pending_txq, + pmadapter->callbacks. + moal_free_lock); + util_free_list_head((t_void *) pmadapter->pmoal_handle, &priv->bypass_txq, pmadapter->callbacks. moal_free_lock); @@ -1019,7 +1026,7 @@ done: /** * @brief This function frees the structure of adapter * - * @param pmadapter A pointer to mlan_adapter structure + * @param pmadapter A pointer to mlan_adapter structure * * @return N/A */ @@ -1089,9 +1096,9 @@ wlan_free_adapter(pmlan_adapter pmadapter) /** * @brief This function frees the structure of priv * - * @param pmpriv A pointer to mlan_private structure + * @param pmpriv A pointer to mlan_private structure * - * @return N/A + * @return N/A */ t_void wlan_free_priv(mlan_private * pmpriv) @@ -1136,12 +1143,13 @@ wlan_init_fw_complete(IN pmlan_adapter pmadapter) } /** - * @brief The cmdresp handler calls this function for shutdown_fw_complete callback + * @brief The cmdresp handler calls this function + * for shutdown_fw_complete callback * - * @param pmadapter A pointer to mlan_adapter structure + * @param pmadapter A pointer to mlan_adapter structure * - * @return MLAN_STATUS_SUCCESS - * The firmware shutdown callback succeeded. + * @return MLAN_STATUS_SUCCESS + * The firmware shutdown callback succeeded. */ mlan_status wlan_shutdown_fw_complete(IN pmlan_adapter pmadapter) diff --git a/drivers/net/wireless/sd8897/mlan/mlan_init.h b/drivers/net/wireless/sd8897/mlan/mlan_init.h index 65ac015a6dc5..b9831955699b 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_init.h +++ b/drivers/net/wireless/sd8897/mlan/mlan_init.h @@ -37,7 +37,7 @@ Change log: /** Rx buffer size for firmware download*/ #define FW_DNLD_RX_BUF_SIZE 2048 /** Max firmware retry */ -#define MAX_FW_RETRY 3 +#define MAX_FW_RETRY 3 /** Firmware has last block */ #define FW_HAS_LAST_BLOCK 0x00000004 @@ -76,13 +76,17 @@ typedef struct _FWSyncHeader { } FWSyncHeader; #ifdef BIG_ENDIAN_SUPPORT -/** Convert sequence number and command fields of fwheader to correct endian format */ +/** Convert sequence number and command fields + * of fwheader to correct endian format + */ #define endian_convert_syncfwheader(x) { \ (x)->cmd = wlan_le32_to_cpu((x)->cmd); \ (x)->seq_num = wlan_le32_to_cpu((x)->seq_num); \ } #else -/** Convert sequence number and command fields of fwheader to correct endian format */ +/** Convert sequence number and command fields + * of fwheader to correct endian format + */ #define endian_convert_syncfwheader(x) #endif /* BIG_ENDIAN_SUPPORT */ diff --git a/drivers/net/wireless/sd8897/mlan/mlan_ioctl.h b/drivers/net/wireless/sd8897/mlan/mlan_ioctl.h index 799decbe20e4..797eb0876541 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_ioctl.h +++ b/drivers/net/wireless/sd8897/mlan/mlan_ioctl.h @@ -218,6 +218,7 @@ enum _mlan_ioctl_req_id { MLAN_OID_MISC_ASSOC_RSP = 0x0020000C, MLAN_OID_MISC_INIT_SHUTDOWN = 0x0020000D, MLAN_OID_MISC_CUSTOM_IE = 0x0020000F, + MLAN_OID_MISC_TDLS_CONFIG = 0x00200010, MLAN_OID_MISC_TX_DATAPAUSE = 0x00200012, MLAN_OID_MISC_IP_ADDR = 0x00200013, MLAN_OID_MISC_MAC_CONTROL = 0x00200014, @@ -243,6 +244,8 @@ enum _mlan_ioctl_req_id { #ifdef WIFI_DIRECT_SUPPORT MLAN_OID_MISC_WIFI_DIRECT_CONFIG = 0x00200025, #endif + MLAN_OID_MISC_TDLS_OPER = 0x00200026, + MLAN_OID_MISC_GET_TDLS_IES = 0x00200027, }; /** Sub command size */ @@ -425,6 +428,8 @@ typedef struct _mlan_scan_cfg { t_u32 scan_probe; /** Scan time parameters */ mlan_scan_time_params scan_time; + /** Extended Scan */ + t_u32 ext_scan; } mlan_scan_cfg, *pmlan_scan_cfg; /** Type defnition of mlan_ds_scan for MLAN_IOCTL_SCAN */ @@ -471,7 +476,7 @@ enum _mlan_bss_mode { #define MLAN_BEACON_INTERVAL 100 /** Receive all packets */ -#define MLAN_PROMISC_MODE 1 +#define MLAN_PROMISC_MODE 1 /** Receive multicast packets in multicast list */ #define MLAN_MULTICAST_MODE 2 /** Receive all multicast packets */ @@ -512,7 +517,9 @@ typedef struct _mlan_chan_list { chan_freq cf[MLAN_MAX_CHANNEL_NUM]; } mlan_chan_list; -/** mlan_ssid_bssid data structure for MLAN_OID_BSS_START and MLAN_OID_BSS_FIND_BSS */ +/** mlan_ssid_bssid data structure for + * MLAN_OID_BSS_START and MLAN_OID_BSS_FIND_BSS + */ typedef struct _mlan_ssid_bssid { /** SSID */ mlan_802_11_ssid ssid; @@ -1225,8 +1232,14 @@ typedef struct _mlan_fw_info { t_u32 fw_ver; /** MAC address */ mlan_802_11_mac_addr mac_addr; + /** 802.11n device capabilities */ + t_u32 hw_dot_11n_dev_cap; /** Device support for MIMO abstraction of MCSs */ t_u8 hw_dev_mcs_support; + /** 802.11ac device capabilities */ + t_u32 hw_dot_11ac_dev_cap; + /** 802.11ac device support for MIMO abstraction of MCSs */ + t_u32 hw_dot_11ac_mcs_support; /** fw supported band */ t_u8 fw_bands; /** region code */ @@ -1298,7 +1311,7 @@ typedef struct _mlan_bss_info { #define MAX_NUM_TID 8 /** Max RX Win size */ -#define MAX_RX_WINSIZE 64 +#define MAX_RX_WINSIZE 64 /** rx_reorder_tbl */ typedef struct { @@ -1334,6 +1347,27 @@ typedef struct { #define SDIO_MP_DBG_NUM 6 #endif +/** Maximum size of IEEE Information Elements */ +#define IEEE_MAX_IE_SIZE 256 + +/** support up to 8 TDLS peer */ +#define MLAN_MAX_TDLS_PEER_SUPPORTED 8 +/** TDLS peer info */ +typedef struct _tdls_peer_info { + /** station mac address */ + t_u8 mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** SNR */ + t_s8 snr; + /** Noise Floor */ + t_s8 nf; + /** Extended Capabilities IE */ + t_u8 ext_cap[IEEE_MAX_IE_SIZE]; + /** HT Capabilities IE */ + t_u8 ht_cap[IEEE_MAX_IE_SIZE]; + /** VHT Capabilities IE */ + t_u8 vht_cap[IEEE_MAX_IE_SIZE]; +} tdls_peer_info; + /** mlan_debug_info data structure for MLAN_OID_GET_DEBUG_INFO */ typedef struct _mlan_debug_info { /* WMM AC_BK count */ @@ -1358,6 +1392,10 @@ typedef struct _mlan_debug_info { t_u32 rx_tbl_num; /** Rx reorder table*/ rx_reorder_tbl rx_tbl[MLAN_MAX_RX_BASTREAM_SUPPORTED]; + /** TDLS peer number */ + t_u32 tdls_peer_num; + /** TDLS peer list*/ + tdls_peer_info tdls_peer_list[MLAN_MAX_TDLS_PEER_SUPPORTED]; /** Corresponds to ps_mode member of mlan_adapter */ t_u16 ps_mode; /** Corresponds to ps_state member of mlan_adapter */ @@ -1498,6 +1536,8 @@ typedef struct _mlan_debug_info { t_u32 mlan_processing; /** mlan_rx_processing */ t_u32 mlan_rx_processing; + /** rx pkts queued */ + t_u32 rx_pkts_queued; /** mlan_adapter pointer */ t_void *mlan_adapter; /** mlan_adapter_size */ @@ -1626,11 +1666,17 @@ enum _mlan_psk_type { /** Type definition of mlan_ds_encrypt_key for MLAN_OID_SEC_CFG_ENCRYPT_KEY */ typedef struct _mlan_ds_encrypt_key { - /** Key disabled, all other fields will be ignore when this flag set to MTRUE */ + /** Key disabled, all other fields will be + * ignore when this flag set to MTRUE + */ t_u32 key_disable; - /** key removed flag, when this flag is set to MTRUE, only key_index will be check */ + /** key removed flag, when this flag is set + * to MTRUE, only key_index will be check + */ t_u32 key_remove; - /** Key index, used as current tx key index when is_current_wep_key is set to MTRUE */ + /** Key index, used as current tx key index + * when is_current_wep_key is set to MTRUE + */ t_u32 key_index; /** Current Tx key flag */ t_u32 is_current_wep_key; @@ -1727,7 +1773,9 @@ typedef struct _mlan_ds_sec_cfg { mlan_ds_encrypt_key encrypt_key; /** Passphrase for MLAN_OID_SEC_CFG_PASSPHRASE */ mlan_ds_passphrase passphrase; - /** Embedded supplicant WPA enabled flag for MLAN_OID_SEC_CFG_EWPA_ENABLED */ + /** Embedded supplicant WPA enabled flag for + * MLAN_OID_SEC_CFG_EWPA_ENABLED + */ t_u32 ewpa_enabled; /** Embedded supplicant mode for MLAN_OID_SEC_CFG_ESUPP_MODE */ mlan_ds_esupp_mode esupp_mode; @@ -1943,7 +1991,9 @@ typedef struct _mlan_ds_hs_cfg { t_u32 conditions; /** GPIO pin or 0xff for interface */ t_u32 gpio; - /** Gap in milliseconds or or 0xff for special setting when GPIO is used to wakeup host */ + /** Gap in milliseconds or or 0xff for special + * setting when GPIO is used to wakeup host + */ t_u32 gap; } mlan_ds_hs_cfg, *pmlan_ds_hs_cfg; @@ -1962,7 +2012,9 @@ typedef struct _mlan_ds_auto_ds { t_u16 idletime; } mlan_ds_auto_ds; -/** Type definition of mlan_ds_inactivity_to for MLAN_OID_PM_CFG_INACTIVITY_TO */ +/** Type definition of mlan_ds_inactivity_to + * for MLAN_OID_PM_CFG_INACTIVITY_TO + */ typedef struct _mlan_ds_inactivity_to { /** Timeout unit in microsecond, 0 means 1000us (1ms) */ t_u32 timeout_unit; @@ -2257,7 +2309,9 @@ typedef struct { */ t_u16 delay_histogram[MLAN_WMM_STATS_PKTS_HIST_BINS]; } wlan_ioctl_wmm_queue_stats_t, -/** Type definition of mlan_ds_wmm_queue_stats for MLAN_OID_WMM_CFG_QUEUE_STATS */ +/** Type definition of mlan_ds_wmm_queue_stats + * for MLAN_OID_WMM_CFG_QUEUE_STATS + */ mlan_ds_wmm_queue_stats, *pmlan_ds_wmm_queue_stats; /** @@ -2287,7 +2341,9 @@ typedef struct { /** WMM AC queue status */ wlan_ioctl_wmm_queue_status_ac_t ac_status[MLAN_WMM_MAX_AC_QUEUES]; } wlan_ioctl_wmm_queue_status_t, -/** Type definition of mlan_ds_wmm_queue_status for MLAN_OID_WMM_CFG_QUEUE_STATUS */ +/** Type definition of mlan_ds_wmm_queue_status + * for MLAN_OID_WMM_CFG_QUEUE_STATUS + */ mlan_ds_wmm_queue_status, *pmlan_ds_wmm_queue_status; /** Type definition of mlan_ds_wmm_addts for MLAN_OID_WMM_CFG_ADDTS */ @@ -2318,7 +2374,9 @@ typedef struct _mlan_ds_wmm_delts { t_u8 ie_data[MLAN_WMM_TSPEC_SIZE]; } mlan_ds_wmm_delts, *pmlan_ds_wmm_delts; -/** Type definition of mlan_ds_wmm_queue_config for MLAN_OID_WMM_CFG_QUEUE_CONFIG */ +/** Type definition of mlan_ds_wmm_queue_config + * for MLAN_OID_WMM_CFG_QUEUE_CONFIG + */ typedef struct _mlan_ds_wmm_queue_config { /** Action of Queue Config : Set, Get, or Default */ mlan_wmm_queue_config_action_e action; @@ -2402,7 +2460,9 @@ typedef struct _mlan_ds_11n_htcap_cfg { t_u32 hw_cap_req; } mlan_ds_11n_htcap_cfg, *pmlan_ds_11n_htcap_cfg; -/** Type definition of mlan_ds_11n_addba_param for MLAN_OID_11N_CFG_ADDBA_PARAM */ +/** Type definition of mlan_ds_11n_addba_param + * for MLAN_OID_11N_CFG_ADDBA_PARAM + */ typedef struct _mlan_ds_11n_addba_param { /** Timeout */ t_u32 timeout; @@ -2526,7 +2586,9 @@ typedef struct _mlan_ds_11n_amsdu_aggr_ctrl { t_u16 curr_buf_size; } mlan_ds_11n_amsdu_aggr_ctrl, *pmlan_ds_11n_amsdu_aggr_ctrl; -/** Type definition of mlan_ds_11n_aggr_prio_tbl for MLAN_OID_11N_CFG_AGGR_PRIO_TBL */ +/** Type definition of mlan_ds_11n_aggr_prio_tbl + * for MLAN_OID_11N_CFG_AGGR_PRIO_TBL + */ typedef struct _mlan_ds_11n_aggr_prio_tbl { /** ampdu priority table */ t_u8 ampdu[MAX_NUM_TID]; @@ -2641,6 +2703,10 @@ typedef struct _mlan_ds_11ac_vht_cfg { t_u32 vht_tx_mcs; /** VHT Rx mcs */ t_u32 vht_rx_mcs; + /** VHT rx max rate */ + t_u16 vht_rx_max_rate; + /** VHT max tx rate */ + t_u16 vht_tx_max_rate; } mlan_ds_11ac_vht_cfg, *pmlan_ds_11ac_vht_cfg; /** Type definition of mlan_ds_11ac_cfg for MLAN_IOCTL_11AC_CFG */ @@ -2659,9 +2725,6 @@ typedef struct _mlan_ds_11ac_cfg { /** Country code length */ #define COUNTRY_CODE_LEN 3 -/** Maximum size of IEEE Information Elements */ -#define IEEE_MAX_IE_SIZE 256 - /*-----------------------------------------------------------------*/ /** 802.11d Configuration Group */ /*-----------------------------------------------------------------*/ @@ -2834,7 +2897,9 @@ typedef struct _mlan_ds_misc_gen_ie { } mlan_ds_misc_gen_ie; #if defined(SDIO_MULTI_PORT_TX_AGGR) || defined(SDIO_MULTI_PORT_RX_AGGR) -/** Type definition of mlan_ds_misc_sdio_mpa_ctrl for MLAN_OID_MISC_SDIO_MPA_CTRL */ +/** Type definition of mlan_ds_misc_sdio_mpa_ctrl + * for MLAN_OID_MISC_SDIO_MPA_CTRL + */ typedef struct _mlan_ds_misc_sdio_mpa_ctrl { /** SDIO MP-A TX enable/disable */ t_u16 tx_enable; @@ -2860,12 +2925,12 @@ typedef struct _mlan_ds_misc_cmd { } mlan_ds_misc_cmd; /** Maximum number of system clocks */ -#define MLAN_MAX_CLK_NUM 16 +#define MLAN_MAX_CLK_NUM 16 /** Clock type : Configurable */ -#define MLAN_CLK_CONFIGURABLE 0 +#define MLAN_CLK_CONFIGURABLE 0 /** Clock type : Supported */ -#define MLAN_CLK_SUPPORTED 1 +#define MLAN_CLK_SUPPORTED 1 /** Type definition of mlan_ds_misc_sys_clock for MLAN_OID_MISC_SYS_CLOCK */ typedef struct _mlan_ds_misc_sys_clock { @@ -2896,7 +2961,9 @@ enum _mlan_func_cmd { MLAN_FUNC_SHUTDOWN, }; -/** Type definition of mlan_ds_misc_tx_datapause for MLAN_OID_MISC_TX_DATAPAUSE */ +/** Type definition of mlan_ds_misc_tx_datapause + * for MLAN_OID_MISC_TX_DATAPAUSE + */ typedef struct _mlan_ds_misc_tx_datapause { /** Tx data pause flag */ t_u16 tx_pause; @@ -2959,7 +3026,9 @@ typedef struct _mlan_ds_misc_cfp_code { t_u32 cfp_code_a; } mlan_ds_misc_cfp_code; -/** Type definition of mlan_ds_misc_country_code for MLAN_OID_MISC_COUNTRY_CODE */ +/** Type definition of mlan_ds_misc_country_code + * for MLAN_OID_MISC_COUNTRY_CODE + */ typedef struct _mlan_ds_misc_country_code { /** Country Code */ t_u8 country_code[COUNTRY_CODE_LEN]; @@ -3004,43 +3073,63 @@ typedef struct _mlan_ds_subscribe_evt { t_u16 evt_bitmap; /** Absolute value of RSSI threshold value (dBm) */ t_u8 low_rssi; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 low_rssi_freq; /** SNR threshold value (dB) */ t_u8 low_snr; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 low_snr_freq; /** Failure count threshold */ t_u8 failure_count; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 failure_count_freq; /** num of missed beacons */ t_u8 beacon_miss; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 beacon_miss_freq; /** Absolute value of RSSI threshold value (dBm) */ t_u8 high_rssi; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 high_rssi_freq; /** SNR threshold value (dB) */ t_u8 high_snr; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 high_snr_freq; /** Absolute value of data RSSI threshold value (dBm) */ t_u8 data_low_rssi; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 data_low_rssi_freq; /** Absolute value of data SNR threshold value (dBm) */ t_u8 data_low_snr; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 data_low_snr_freq; /** Absolute value of data RSSI threshold value (dBm) */ t_u8 data_high_rssi; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 data_high_rssi_freq; /** Absolute value of data SNR threshold value (dBm) */ t_u8 data_high_snr; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 data_high_snr_freq; /* Link SNR threshold (dB) */ t_u16 link_snr; @@ -3061,7 +3150,9 @@ typedef struct _mlan_ds_subscribe_evt { /** Max OTP user data length */ #define MAX_OTP_USER_DATA_LEN 252 -/** Type definition of mlan_ds_misc_otp_user_data for MLAN_OID_MISC_OTP_USER_DATA */ +/** Type definition of mlan_ds_misc_otp_user_data + * for MLAN_OID_MISC_OTP_USER_DATA + */ typedef struct _mlan_ds_misc_otp_user_data { /** Reserved */ t_u16 reserved; @@ -3076,7 +3167,9 @@ typedef struct _mlan_ds_misc_otp_user_data { #define WIFI_DIRECT_NOA 1 /** flag for OPP_PS */ #define WIFI_DIRECT_OPP_PS 2 -/** Type definition of mlan_ds_wifi_direct_config for MLAN_OID_MISC_WIFI_DIRECT_CONFIG */ +/** Type definition of mlan_ds_wifi_direct_config + * for MLAN_OID_MISC_WIFI_DIRECT_CONFIG + */ typedef struct _mlan_ds_wifi_direct_config { /** flags for NOA/OPP_PS */ t_u8 flags; @@ -3117,6 +3210,73 @@ typedef MLAN_PACK_START struct _mlan_ds_multi_chan_cfg { t_u8 tlv_buf[0]; } MLAN_PACK_END mlan_ds_multi_chan_cfg; +/**Action ID for TDLS disable link*/ +#define WLAN_TDLS_DISABLE_LINK 0x00 +/**Action ID for TDLS enable link*/ +#define WLAN_TDLS_ENABLE_LINK 0x01 +/**Action ID for TDLS create link*/ +#define WLAN_TDLS_CREATE_LINK 0x02 +/**Action ID for TDLS config link*/ +#define WLAN_TDLS_CONFIG_LINK 0x03 +/*reason code*/ +#define WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED 26 +/** TDLS operation buffer */ +typedef struct _mlan_ds_misc_tdls_oper { + /** TDLS Action */ + t_u16 tdls_action; + /** TDLS peer address */ + t_u8 peer_mac[MLAN_MAC_ADDR_LENGTH]; + /** peer capability */ + t_u16 capability; + /** peer qos info */ + t_u8 qos_info; + /** peer extend capability */ + t_u8 *ext_capab; + /** extend capability len */ + t_u8 ext_capab_len; + /** support rates */ + t_u8 *supported_rates; + /** supported rates len */ + t_u8 supported_rates_len; + /** peer ht_cap */ + t_u8 *ht_capa; + /** peer vht capability */ + t_u8 *vht_cap; +} mlan_ds_misc_tdls_oper; + +/** flag for TDLS extcap */ +#define TDLS_IE_FLAGS_EXTCAP 0x0001 +/** flag for TDLS HTCAP */ +#define TDLS_IE_FLAGS_HTCAP 0x0002 +/** flag for TDLS HTINFO */ +#define TDLS_IE_FLAGS_HTINFO 0x0004 +/** flag for TDLS VHTCAP */ +#define TDLS_IE_FLAGS_VHTCAP 0x0008 +/** flag for TDLS VHTOPRAT */ +#define TDLS_IE_FLAGS_VHTOPRAT 0x0010 +/** flag for TDLS AID inof */ +#define TDLS_IE_FLAGS_AID 0x0020 + +/** TDLS ie buffer */ +typedef struct _mlan_ds_misc_tdls_ies { + /** TDLS peer address */ + t_u8 peer_mac[MLAN_MAC_ADDR_LENGTH]; + /** flags for request IEs */ + t_u16 flags; + /** Extended Capabilities IE */ + t_u8 ext_cap[IEEE_MAX_IE_SIZE]; + /** HT Capabilities IE */ + t_u8 ht_cap[IEEE_MAX_IE_SIZE]; + /** HT Information IE */ + t_u8 ht_info[IEEE_MAX_IE_SIZE]; + /** VHT Capabilities IE */ + t_u8 vht_cap[IEEE_MAX_IE_SIZE]; + /** VHT Operations IE */ + t_u8 vht_oprat[IEEE_MAX_IE_SIZE]; + /** aid Info */ + t_u8 aid_info[IEEE_MAX_IE_SIZE]; +} mlan_ds_misc_tdls_ies; + /** Type definition of mlan_ds_misc_cfg for MLAN_IOCTL_MISC_CFG */ typedef struct _mlan_ds_misc_cfg { /** Sub-command */ @@ -3143,6 +3303,12 @@ typedef struct _mlan_ds_misc_cfg { t_u32 func_init_shutdown; /** Custom IE for MLAN_OID_MISC_CUSTOM_IE */ mlan_ds_misc_custom_ie cust_ie; + /** TDLS configuration for MLAN_OID_MISC_TDLS_CONFIG */ + mlan_ds_misc_tdls_config tdls_config; + /** TDLS operation for MLAN_OID_MISC_TDLS_OPER */ + mlan_ds_misc_tdls_oper tdls_oper; + /** TDLS ies for MLAN_OID_MISC_GET_TDLS_IES */ + mlan_ds_misc_tdls_ies tdls_ies; /** Tx data pause for MLAN_OID_MISC_TX_DATAPAUSE */ mlan_ds_misc_tx_datapause tx_datapause; /** IP address configuration */ diff --git a/drivers/net/wireless/sd8897/mlan/mlan_join.c b/drivers/net/wireless/sd8897/mlan/mlan_join.c index 3028f43338d4..4a5d9f05d24e 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_join.c +++ b/drivers/net/wireless/sd8897/mlan/mlan_join.c @@ -368,24 +368,24 @@ wlan_update_tsf_timestamps(IN mlan_private * pmpriv, * the buffer as a wapi TLV type to the request. * * @param priv A pointer to mlan_private structure - * @param ppBuffer pointer to command buffer pointer + * @param ppbuffer pointer to command buffer pointer * * @return bytes added to the buffer */ static int -wlan_cmd_append_wapi_ie(mlan_private * priv, t_u8 ** ppBuffer) +wlan_cmd_append_wapi_ie(mlan_private * priv, t_u8 ** ppbuffer) { - int retLen = 0; + int retlen = 0; MrvlIEtypesHeader_t ie_header; ENTER(); /* Null Checks */ - if (ppBuffer == MNULL) { + if (ppbuffer == MNULL) { LEAVE(); return 0; } - if (*ppBuffer == MNULL) { + if (*ppbuffer == MNULL) { LEAVE(); return 0; } @@ -396,32 +396,32 @@ wlan_cmd_append_wapi_ie(mlan_private * priv, t_u8 ** ppBuffer) */ if (priv->wapi_ie_len) { PRINTM(MCMND, "append wapi ie %d to %p\n", priv->wapi_ie_len, - *ppBuffer); + *ppbuffer); /* Wrap the generic IE buffer with a pass through TLV type */ ie_header.type = wlan_cpu_to_le16(TLV_TYPE_WAPI_IE); ie_header.len = wlan_cpu_to_le16(priv->wapi_ie_len); - memcpy(priv->adapter, *ppBuffer, &ie_header, sizeof(ie_header)); + memcpy(priv->adapter, *ppbuffer, &ie_header, sizeof(ie_header)); /* Increment the return size and the return buffer pointer param */ - *ppBuffer += sizeof(ie_header); - retLen += sizeof(ie_header); + *ppbuffer += sizeof(ie_header); + retlen += sizeof(ie_header); /* Copy the wapi IE buffer to the output buffer, advance pointer */ - memcpy(priv->adapter, *ppBuffer, priv->wapi_ie, + memcpy(priv->adapter, *ppbuffer, priv->wapi_ie, priv->wapi_ie_len); /* Increment the return size and the return buffer pointer param */ - *ppBuffer += priv->wapi_ie_len; - retLen += priv->wapi_ie_len; + *ppbuffer += priv->wapi_ie_len; + retlen += priv->wapi_ie_len; } /* return the length appended to the buffer */ LEAVE(); - return retLen; + return retlen; } /******************************************************** @@ -469,15 +469,9 @@ wlan_update_rsn_ie(mlan_private * pmpriv, /* Save pointer to akm_suite_count in RSN IE to update it later */ akm_suite_count_ptr = ptr; temp = ptlv_rsn_ie->rsn_ie + sizeof(t_u16) + 4 * sizeof(t_u8) - + sizeof(t_u16) + pairwise_cipher_count * PAIRWISE_CIPHER_SUITE_LEN + sizeof(t_u16); /* ptr - now - points - to - the - 1st - AKM - suite - */ + + sizeof(t_u16) + pairwise_cipher_count + * PAIRWISE_CIPHER_SUITE_LEN + sizeof(t_u16); + /* ptr now points to the 1st AKM suite */ if (temp_akm_suite_count > 1) { while (temp_akm_suite_count) { if (!memcmp @@ -690,10 +684,8 @@ wlan_cmd_802_11_associate(IN mlan_private * pmpriv, if ((pmpriv->sec_info.wpa_enabled || pmpriv->sec_info.wpa2_enabled)) { prsn_ie_tlv = (MrvlIEtypes_RsnParamSet_t *) pos; - prsn_ie_tlv->header.type = (t_u16) pmpriv->wpa_ie[0]; /* WPA_IE - or - RSN_IE - */ + /* WPA_IE or RSN_IE */ + prsn_ie_tlv->header.type = (t_u16) pmpriv->wpa_ie[0]; prsn_ie_tlv->header.type = prsn_ie_tlv->header.type & 0x00FF; prsn_ie_tlv->header.type = @@ -812,9 +804,8 @@ wlan_cmd_802_11_associate(IN mlan_private * pmpriv, wlan_wmm_process_association_req(pmpriv, &pos, &pbss_desc->wmm_ie, pbss_desc->pht_cap); - if (pmpriv->sec_info.wapi_enabled && pmpriv->wapi_ie_len) { + if (pmpriv->sec_info.wapi_enabled && pmpriv->wapi_ie_len) wlan_cmd_append_wapi_ie(pmpriv, &pos); - } wlan_cmd_append_generic_ie(pmpriv, &pos); @@ -847,9 +838,8 @@ wlan_cmd_802_11_associate(IN mlan_private * pmpriv, memcpy(pmadapter, &tmp_cap, &pbss_desc->cap_info, sizeof(passo->cap_info)); - if (pmpriv->config_bands == BAND_B) { + if (pmpriv->config_bands == BAND_B) SHORT_SLOT_TIME_DISABLED(tmp_cap); - } tmp_cap &= CAPINFO_MASK; PRINTM(MINFO, "ASSOC_CMD: tmp_cap=%4X CAPINFO_MASK=%4lX\n", @@ -1059,9 +1049,8 @@ wlan_ret_802_11_associate(IN mlan_private * pmpriv, */ wlan_wmm_setup_queues(pmpriv); - if (enable_data) { + if (enable_data) PRINTM(MINFO, "Post association, re-enabling data flow\n"); - } /* Reset SNR/NF/RSSI values */ pmpriv->data_rssi_last = 0; @@ -1373,7 +1362,7 @@ wlan_cmd_802_11_ad_hoc_start(IN mlan_private * pmpriv, memcpy(pmadapter, &pmpriv->curr_bss_params.data_rates, &padhoc_start->DataRate, pmpriv->curr_bss_params.num_of_rates); - PRINTM(MINFO, "ADHOC_S_CMD: Rates=%02x %02x %02x %02x \n", + PRINTM(MINFO, "ADHOC_S_CMD: Rates=%02x %02x %02x %02x\n", padhoc_start->DataRate[0], padhoc_start->DataRate[1], padhoc_start->DataRate[2], padhoc_start->DataRate[3]); @@ -1452,10 +1441,8 @@ wlan_cmd_802_11_ad_hoc_start(IN mlan_private * pmpriv, if (pmpriv->sec_info.wpa_enabled || pmpriv->sec_info.ewpa_enabled) { prsn_ie_tlv = (MrvlIEtypes_RsnParamSet_t *) pos; - prsn_ie_tlv->header.type = (t_u16) pmpriv->wpa_ie[0]; /* WPA_IE - or - RSN_IE - */ + prsn_ie_tlv->header.type = (t_u16) pmpriv->wpa_ie[0]; + /* WPA_IE or RSN_IE */ prsn_ie_tlv->header.type = prsn_ie_tlv->header.type & 0x00FF; prsn_ie_tlv->header.type = wlan_cpu_to_le16(prsn_ie_tlv->header.type); @@ -1619,11 +1606,10 @@ wlan_cmd_802_11_ad_hoc_start(IN mlan_private * pmpriv, memcpy(pmadapter, &tmp_cap, &padhoc_start->cap, sizeof(t_u16)); - if (pmadapter->adhoc_start_band == BAND_B) { + if (pmadapter->adhoc_start_band == BAND_B) SHORT_SLOT_TIME_DISABLED(tmp_cap); - } else { + else SHORT_SLOT_TIME_ENABLED(tmp_cap); - } tmp_cap = wlan_cpu_to_le16(tmp_cap); memcpy(pmadapter, &padhoc_start->cap, &tmp_cap, sizeof(t_u16)); @@ -1799,10 +1785,8 @@ wlan_cmd_802_11_ad_hoc_join(IN mlan_private * pmpriv, if (pmpriv->sec_info.wpa_enabled) { prsn_ie_tlv = (MrvlIEtypes_RsnParamSet_t *) pos; - prsn_ie_tlv->header.type = (t_u16) pmpriv->wpa_ie[0]; /* WPA_IE - or - RSN_IE - */ + /* WPA_IE or RSN_IE */ + prsn_ie_tlv->header.type = (t_u16) pmpriv->wpa_ie[0]; prsn_ie_tlv->header.type = prsn_ie_tlv->header.type & 0x00FF; prsn_ie_tlv->header.type = wlan_cpu_to_le16(prsn_ie_tlv->header.type); @@ -1920,7 +1904,7 @@ done: /** * @brief This function handles the command response of ad_hoc_start and - * ad_hoc_join + * ad_hoc_join * * @param pmpriv A pointer to mlan_private structure * @param resp A pointer to HostCmd_DS_COMMAND @@ -2016,11 +2000,10 @@ wlan_ret_802_11_ad_hoc(IN mlan_private * pmpriv, done: /* Need to indicate IOCTL complete */ if (pioctl_req != MNULL) { - if (ret != MLAN_STATUS_SUCCESS) { + if (ret != MLAN_STATUS_SUCCESS) pioctl_req->status_code = MLAN_ERROR_CMD_ASSOC_FAIL; - } else { + else pioctl_req->status_code = MLAN_ERROR_NO_ERROR; - } } LEAVE(); @@ -2228,13 +2211,22 @@ wlan_disconnect(IN mlan_private * pmpriv, bss_descriptor.mac_address, MLAN_MAC_ADDR_LENGTH); } - - ret = wlan_prepare_cmd(pmpriv, - HostCmd_CMD_802_11_DEAUTHENTICATE, - HostCmd_ACT_GEN_SET, - 0, - (t_void *) pioctl_req, - &mac_address); +#ifdef WIFI_DIRECT_SUPPORT + if (pmpriv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT) + ret = wlan_prepare_cmd(pmpriv, + HostCmd_CMD_802_11_DISASSOCIATE, + HostCmd_ACT_GEN_SET, + 0, + (t_void *) pioctl_req, + &mac_address); + else +#endif + ret = wlan_prepare_cmd(pmpriv, + HostCmd_CMD_802_11_DEAUTHENTICATE, + HostCmd_ACT_GEN_SET, + 0, + (t_void *) pioctl_req, + &mac_address); if (ret == MLAN_STATUS_SUCCESS && pioctl_req) ret = MLAN_STATUS_PENDING; @@ -2257,9 +2249,9 @@ wlan_disconnect(IN mlan_private * pmpriv, /** * @brief Convert band to radio type used in channel TLV * - * @param band Band enumeration to convert to a channel TLV radio type + * @param band Band enumeration to convert to a channel TLV radio type * - * @return Radio type designator for use in a channel TLV + * @return Radio type designator for use in a channel TLV */ t_u8 wlan_band_to_radio_type(IN t_u8 band) diff --git a/drivers/net/wireless/sd8897/mlan/mlan_main.h b/drivers/net/wireless/sd8897/mlan/mlan_main.h index 7b4986df5a3a..d2c58e1545b7 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_main.h +++ b/drivers/net/wireless/sd8897/mlan/mlan_main.h @@ -151,13 +151,13 @@ do { \ /** Log entry point for debugging */ #define ENTER() \ do { \ - PRINTM(MENTRY, "Enter: %s\n", __FUNCTION__); \ + PRINTM(MENTRY, "Enter: %s\n", __func__); \ } while (0) /** Log exit point for debugging */ #define LEAVE() \ do { \ - PRINTM(MENTRY, "Leave: %s\n", __FUNCTION__); \ + PRINTM(MENTRY, "Leave: %s\n", __func__); \ } while (0) /** Find minimum */ @@ -233,7 +233,7 @@ do { \ (t_u64)(((t_u64)(x) & 0x000000ff00000000ULL) >> 8) | \ (t_u64)(((t_u64)(x) & 0x0000ff0000000000ULL) >> 24) | \ (t_u64)(((t_u64)(x) & 0x00ff000000000000ULL) >> 40) | \ - (t_u64)(((t_u64)(x) & 0xff00000000000000ULL) >> 56) )) + (t_u64)(((t_u64)(x) & 0xff00000000000000ULL) >> 56))) #ifdef BIG_ENDIAN_SUPPORT /** Convert ulong n/w to host */ @@ -309,7 +309,7 @@ extern t_void(*assert_callback) (IN t_void * pmoal_handle, IN t_u32 cond); #define MASSERT(cond) \ do { \ if (!(cond)) { \ - PRINTM(MFATAL, "ASSERT: %s: %i\n", __FUNCTION__, __LINE__); \ + PRINTM(MFATAL, "ASSERT: %s: %i\n", __func__, __LINE__); \ if (assert_callback) { \ assert_callback(MNULL, (t_ptr)(cond)); \ } else { \ @@ -326,7 +326,7 @@ do { \ #ifdef STA_SUPPORT /** Maximum buffer size for ARP filter */ -#define ARP_FILTER_MAX_BUF_SIZE 68 +#define ARP_FILTER_MAX_BUF_SIZE 68 #endif /* STA_SUPPORT */ /** 60 seconds */ @@ -398,7 +398,8 @@ do { \ /** Default beacon missing timeout */ #define DEFAULT_BCN_MISS_TIMEOUT 10 -#define MAX_SCAN_BEACON_BUFFER 16384 +/** Maximum buffer space for beacons retrieved from scan responses */ +#define MAX_SCAN_BEACON_BUFFER 49152 /** Default buffer space for beacons retrieved from scan responses */ #define DEFAULT_SCAN_BEACON_BUFFER 4096 @@ -412,13 +413,19 @@ do { \ */ #define SCAN_BEACON_ENTRY_PAD 6 -/** Scan time specified in the channel TLV for each channel for passive scans */ +/** Scan time specified in the channel TLV + * for each channel for passive scans + */ #define MRVDRV_PASSIVE_SCAN_CHAN_TIME 200 -/** Scan time specified in the channel TLV for each channel for active scans */ +/** Scan time specified in the channel TLV + * for each channel for active scans + */ #define MRVDRV_ACTIVE_SCAN_CHAN_TIME 200 -/** Scan time specified in the channel TLV for each channel for specific scans */ +/** Scan time specified in the channel TLV + * for each channel for specific scans + */ #define MRVDRV_SPECIFIC_SCAN_CHAN_TIME 110 /** @@ -610,6 +617,8 @@ struct _raListTbl { t_u8 is_11n_enabled; /** max amsdu size */ t_u16 max_amsdu; + /** tdls flag */ + t_u8 is_tdls_link; /** tx_pause flag */ t_u8 tx_pause; }; @@ -642,6 +651,8 @@ typedef struct _wmm_desc { t_u32 packets_out[MAX_NUM_TID]; /** Packets queued */ t_u32 pkts_queued[MAX_NUM_TID]; + /** Packets paused */ + t_u32 pkts_paused[MAX_NUM_TID]; /** Spin lock to protect ra_list */ t_void *ra_list_spinlock; @@ -1025,8 +1036,7 @@ typedef struct _mlan_private { t_u8 wpa_ie_len; /** GTK set flag */ t_u8 wpa_is_gtk_set; - /** AES key material */ - HostCmd_DS_802_11_KEY_MATERIAL aes_key; + mlan_ds_encrypt_key aes_key; #if defined(STA_SUPPORT) /* Mgmt Frame Protection config */ mlan_ds_misc_pmfcfg pmfcfg; @@ -1037,6 +1047,8 @@ typedef struct _mlan_private { t_u8 wapi_ie_len; /** Pointer to the station table */ mlan_list_head sta_list; + /** tdls pending queue */ + mlan_list_head tdls_pending_txq; /** MGMT IE */ custom_ie mgmt_ie[MAX_MGMT_IE_INDEX]; @@ -1050,6 +1062,8 @@ typedef struct _mlan_private { t_u8 wmm_enabled; /** WMM qos info */ t_u8 wmm_qosinfo; + /** saved WMM qos info */ + t_u8 saved_wmm_qosinfo; /** WMM related variable*/ wmm_desc_t wmm; @@ -1227,6 +1241,22 @@ struct _cmd_ctrl_node { mlan_buffer *pmbuf; }; +/** default tdls wmm qosinfo */ +#define DEFAULT_TDLS_WMM_QOS_INFO 15 +/** default tdls sleep period */ +#define DEFAULT_TDLS_SLEEP_PERIOD 30 + +/** TDLS status */ +typedef enum _tdlsStatus_e { + TDLS_NOT_SETUP = 0, + TDLS_SETUP_INPROGRESS, + TDLS_SETUP_COMPLETE, + TDLS_SETUP_FAILURE, + TDLS_TEAR_DOWN, + TDLS_SWITCHING_CHANNEL, + TDLS_IN_BASE_CHANNEL, + TDLS_IN_OFF_CHANNEL, +} tdlsStatus_e; /** station node */ typedef struct _sta_node sta_node; @@ -1250,6 +1280,38 @@ struct _sta_node { t_u16 max_amsdu; /** 11ac flag */ t_u8 is_11ac_enabled; + /** tdls status */ + tdlsStatus_e status; + /** SNR */ + t_s8 snr; + /** Noise Floor */ + t_s8 nf; + /** flag for host based tdls */ + t_u8 external_tdls; + /** peer capability */ + t_u16 capability; + /** peer support rates */ + t_u8 support_rate[32]; + /** rate size */ + t_u8 rate_len; + /* Qos capability info */ + t_u8 qos_info; + /** HT cap */ + IEEEtypes_HTCap_t HTcap; + /** HT info in TDLS setup confirm*/ + IEEEtypes_HTInfo_t HTInfo; + /** peer BSSCO_20_40*/ + IEEEtypes_2040BSSCo_t BSSCO_20_40; + /* Extended capability */ + IEEEtypes_ExtCap_t ExtCap; + /* RSN IE */ + IEEEtypes_Generic_t rsn_ie; + /** AID info */ + IEEEtypes_AID_t aid_info; + /** VHT Capabilities IE */ + IEEEtypes_VHTCap_t vht_cap; + /** VHT Operations IE */ + IEEEtypes_VHTOprat_t vht_oprat; /** wapi key on off flag */ t_u8 wapi_key_on; /** tx pause status */ @@ -1317,7 +1379,9 @@ typedef struct { t_bool dfs_radar_found; /** Channel radar is being checked on. BAND_A is assumed. */ t_u8 dfs_check_channel; - /** Timestamp when we got last report, to determine if data is old or not. */ + /** Timestamp when we got last report, + * to determine if data is old or not. + */ t_u32 dfs_report_time_sec; /** List for holding dfs_timestamps for NOP/CAC events */ mlan_list_head dfs_ts_head; @@ -1744,6 +1808,8 @@ typedef struct _mlan_adapter { t_u16 passive_scan_time; /** Scan block flag */ t_u8 scan_block; + /** Extended scan or legacy scan */ + t_u8 ext_scan; t_u16 bcn_buf_size; /** Beacon buffer */ t_u8 *bcn_buf; @@ -1770,6 +1836,8 @@ typedef struct _mlan_adapter { sleep_params_t sleep_params; /** sleep_period_t (Enhanced Power Save) */ sleep_period_t sleep_period; + /** saved sleep_period_t (Enhanced Power Save) */ + sleep_period_t saved_sleep_period; /** Power Save mode */ /** @@ -1893,15 +1961,18 @@ typedef struct _mlan_adapter { t_u8 *pcal_data; /** Cal data length */ t_u32 cal_data_len; + /** tdls status */ + /* TDLS_NOT_SETUP|TDLS_SWITCHING_CHANNEL|TDLS_IN_BASE_CHANNEL|TDLS_IN_SWITCH_CHANNEL */ + tdlsStatus_e tdls_status; } mlan_adapter, *pmlan_adapter; /** Ethernet packet type for EAPOL */ #define MLAN_ETHER_PKT_TYPE_EAPOL (0x888E) /** Ethernet packet type for WAPI */ -#define MLAN_ETHER_PKT_TYPE_WAPI (0x88B4) +#define MLAN_ETHER_PKT_TYPE_WAPI (0x88B4) /** Ethernet packet type offset */ -#define MLAN_ETHER_PKT_TYPE_OFFSET (12) +#define MLAN_ETHER_PKT_TYPE_OFFSET (12) mlan_status wlan_init_lock_list(IN pmlan_adapter pmadapter); t_void wlan_free_lock_list(IN pmlan_adapter pmadapter); @@ -1942,7 +2013,7 @@ mlan_status wlan_prepare_cmd(IN pmlan_private priv, IN t_void * pioctl_buf, IN t_void * pdata_buf); /** cmd timeout handler */ -t_void wlan_cmd_timeout_func(t_void * FunctionContext); +t_void wlan_cmd_timeout_func(t_void * function_context); /** process host cmd */ mlan_status wlan_misc_ioctl_host_cmd(IN pmlan_adapter pmadapter, IN pmlan_ioctl_req pioctl_req); @@ -2240,6 +2311,18 @@ mlan_status wlan_ret_802_11_scan(IN pmlan_private pmpriv, IN HostCmd_DS_COMMAND * resp, IN t_void * pioctl_buf); +/** Extended scan command handler */ +mlan_status wlan_cmd_802_11_scan_ext(IN pmlan_private pmpriv, + IN HostCmd_DS_COMMAND * pcmd, + IN t_void * pdata_buf); +/** Handler for extended scan command response */ +mlan_status wlan_ret_802_11_scan_ext(IN pmlan_private pmpriv, + IN HostCmd_DS_COMMAND * resp, + IN t_void * pioctl_buf); +/** Handler event for extended scan report */ +mlan_status wlan_handle_event_ext_scan_report(IN mlan_private * pmpriv, + IN mlan_buffer * pmbuf); + /** check network compatibility */ t_s32 wlan_is_network_compatible(IN mlan_private * pmpriv, IN t_u32 index, IN t_u32 mode); @@ -2469,12 +2552,86 @@ t_u8 wlan_is_wmm_ie_present(pmlan_adapter pmadapter, t_u8 * pbuf, t_u16 buf_len); /** + * @brief This function checks whether a station TDLS link is enabled or not + * + * @param priv A pointer to mlan_private + * @param mac station mac address + * @return TDLS_NOT_SETUP/TDLS_SETUP_INPROGRESS/TDLS_SETUP_COMPLETE/TDLS_SETUP_FAILURE/TDLS_TEAR_DOWN + */ +static INLINE tdlsStatus_e +wlan_get_tdls_link_status(mlan_private * priv, t_u8 * mac) +{ + sta_node *sta_ptr = MNULL; + sta_ptr = wlan_get_station_entry(priv, mac); + if (sta_ptr) { + return sta_ptr->status; + } + return TDLS_NOT_SETUP; +} + +/** + * @brief This function checks if TDLS link is in channel switching + * + * @param status tdls link status + * @return MTRUE/MFALSE + */ +static INLINE int +wlan_is_tdls_link_chan_switching(tdlsStatus_e status) +{ + return (status == TDLS_SWITCHING_CHANNEL) ? MTRUE : MFALSE; +} + +/** + * @brief This function checks if send command to firmware is allowed + * + * @param status tdls link status + * @return MTRUE/MFALSE + */ +static INLINE int +wlan_is_send_cmd_allowed(tdlsStatus_e status) +{ + int ret = MTRUE; + switch (status) { + case TDLS_SWITCHING_CHANNEL: + case TDLS_IN_OFF_CHANNEL: + ret = MFALSE; + break; + default: + break; + } + return ret; +} + +/** + * @brief This function checks if TDLS link is setup + * + * @param status tdls link status + * @return MTRUE/MFALSE + */ +static INLINE int +wlan_is_tdls_link_setup(tdlsStatus_e status) +{ + int ret = MFALSE; + switch (status) { + case TDLS_SWITCHING_CHANNEL: + case TDLS_IN_OFF_CHANNEL: + case TDLS_IN_BASE_CHANNEL: + case TDLS_SETUP_COMPLETE: + ret = MTRUE; + break; + default: + break; + } + return ret; +} + +/** * @brief This function checks tx_pause flag for peer * * @param priv A pointer to mlan_private * @param ra Address of the receiver STA * - * @return MTRUE or MFALSE + * @return MTRUE or MFALSE */ static int INLINE wlan_is_tx_pause(mlan_private * priv, t_u8 * ra) @@ -2554,6 +2711,20 @@ mlan_status wlan_cmd_reg_access(IN HostCmd_DS_COMMAND * cmd, mlan_status wlan_cmd_mem_access(IN HostCmd_DS_COMMAND * cmd, IN t_u16 cmd_action, IN t_void * pdata_buf); +int wlan_get_tdls_list(mlan_private * priv, tdls_peer_info * buf); +t_void wlan_hold_tdls_packets(pmlan_private priv, t_u8 * mac); +t_void wlan_restore_tdls_packets(pmlan_private priv, t_u8 * mac, + tdlsStatus_e status); +t_void wlan_update_non_tdls_ralist(mlan_private * priv, t_u8 * mac, + t_u8 tx_pause); +mlan_status wlan_misc_ioctl_tdls_config(IN pmlan_adapter pmadapter, + IN pmlan_ioctl_req pioctl_req); +mlan_status wlan_misc_ioctl_tdls_oper(IN pmlan_adapter pmadapter, + IN pmlan_ioctl_req pioctl_req); + +mlan_status +wlan_misc_ioctl_tdls_get_ies(IN pmlan_adapter pmadapter, + IN pmlan_ioctl_req pioctl_req); mlan_status wlan_get_info_ver_ext(IN pmlan_adapter pmadapter, IN pmlan_ioctl_req pioctl_req); @@ -2608,9 +2779,9 @@ mlan_status wlan_ret_multi_chan_policy(IN pmlan_private pmpriv, /** * @brief RA based queueing * - * @param priv A pointer to mlan_private structure + * @param priv A pointer to mlan_private structure * - * @return MTRUE or MFALSE + * @return MTRUE or MFALSE */ static INLINE t_u8 queuing_ra_based(pmlan_private priv) @@ -2629,12 +2800,12 @@ queuing_ra_based(pmlan_private priv) /** * @brief Copy Rates * - * @param dest A pointer to Dest Buf + * @param dest A pointer to Dest Buf * @param pos The position for copy * @param src A pointer to Src Buf - * @param len The len of Src Buf + * @param len The len of Src Buf * - * @return Number of Rates copied + * @return Number of Rates copied */ static INLINE t_u32 wlan_copy_rates(t_u8 * dest, t_u32 pos, t_u8 * src, int len) @@ -2655,7 +2826,7 @@ wlan_copy_rates(t_u8 * dest, t_u32 pos, t_u8 * src, int len) * * @param str A pointer to string * - * @return Length of string + * @return Length of string */ static INLINE t_u32 wlan_strlen(const char *str) @@ -2712,10 +2883,11 @@ t_void wlan_delay_func(mlan_adapter * pmadapter, t_u32 delay, t_delay_unit u); #define wlan_udelay(p, n) wlan_delay_func(p, n, USEC) /** Function to check if any command is pending in the queue */ -#define IS_COMMAND_PENDING(pmadapter) ((cmd_ctrl_node *)util_peek_list(pmadapter->pmoal_handle, \ - &pmadapter->cmd_pending_q,\ - pmadapter->callbacks.moal_spin_lock,\ - pmadapter->callbacks.moal_spin_unlock)) +#define IS_COMMAND_PENDING(pmadapter) \ + ((cmd_ctrl_node *)util_peek_list(pmadapter->pmoal_handle, \ + &pmadapter->cmd_pending_q,\ + pmadapter->callbacks.moal_spin_lock,\ + pmadapter->callbacks.moal_spin_unlock)) /** Get BSS number from priv */ #define GET_BSS_NUM(priv) ((priv)->bss_num) @@ -2874,9 +3046,8 @@ wlan_get_privs_by_cond(mlan_adapter * pmadapter, for (i = 0; i < pmadapter->priv_num; i++) { pmpriv = pmadapter->priv[i]; if (pmpriv) { - if (check_cond(pmpriv)) { + if (check_cond(pmpriv)) ppriv_list[count++] = pmpriv; - } } } @@ -2921,13 +3092,11 @@ wlan_get_privs_by_two_cond(mlan_adapter * pmadapter, pmpriv = pmadapter->priv[i]; if (pmpriv) { if (and_conditions) { - if (check_cond(pmpriv) && check_cond_2(pmpriv)) { + if (check_cond(pmpriv) && check_cond_2(pmpriv)) ppriv_list[count++] = pmpriv; - } } else { - if (check_cond(pmpriv) || check_cond_2(pmpriv)) { + if (check_cond(pmpriv) || check_cond_2(pmpriv)) ppriv_list[count++] = pmpriv; - } } } } diff --git a/drivers/net/wireless/sd8897/mlan/mlan_misc.c b/drivers/net/wireless/sd8897/mlan/mlan_misc.c index 93d98cea8061..bfbede8e5dc0 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_misc.c +++ b/drivers/net/wireless/sd8897/mlan/mlan_misc.c @@ -64,7 +64,7 @@ extern t_u8 ac_to_tid[4][2]; /** Custom IE mask for delete operation */ #define MLAN_CUSTOM_IE_DELETE_MASK 0 /** Custom IE mask for create new index */ -#define MLAN_CUSTOM_IE_NEW_MASK 0x8000 +#define MLAN_CUSTOM_IE_NEW_MASK 0x8000 /** Custom IE header size */ #define MLAN_CUSTOM_IE_HDR_SIZE (sizeof(custom_ie)-MAX_IE_SIZE) @@ -494,6 +494,8 @@ wlan_get_info_debug_info(IN pmlan_adapter pmadapter, wlan_get_rxreorder_tbl(pmpriv, debug_info->rx_tbl); debug_info->tx_tbl_num = wlan_get_txbastream_tbl(pmpriv, debug_info->tx_tbl); + debug_info->tdls_peer_num = + wlan_get_tdls_list(pmpriv, debug_info->tdls_peer_list); debug_info->ps_mode = pmadapter->ps_mode; debug_info->ps_state = pmadapter->ps_state; #ifdef STA_SUPPORT @@ -606,7 +608,10 @@ wlan_get_info_debug_info(IN pmlan_adapter pmadapter, #endif debug_info->mlan_processing = pmadapter->mlan_processing; debug_info->mlan_rx_processing = pmadapter->mlan_rx_processing; - + debug_info->rx_pkts_queued = + util_scalar_read(pmadapter->pmoal_handle, + &pmadapter->rx_pkts_queued, MNULL, + MNULL); debug_info->mlan_adapter = pmadapter; debug_info->mlan_adapter_size = sizeof(mlan_adapter); debug_info->mlan_priv_num = pmadapter->priv_num; @@ -920,11 +925,10 @@ wlan_delay_func(mlan_adapter * pmadapter, t_u32 delay, t_delay_unit u) ENTER(); if (pcb->moal_udelay) { - if (u == SEC) { + if (u == SEC) delay *= 1000000; - } else if (u == MSEC) { + else if (u == MSEC) delay *= 1000; - } pcb->moal_udelay(pmadapter->pmoal_handle, delay); } else { @@ -1156,9 +1160,8 @@ wlan_misc_ioctl_custom_ie_list(IN pmlan_adapter pmadapter, index); /* if IE to delete is not found, return error */ - if (ret == MLAN_STATUS_FAILURE) { + if (ret == MLAN_STATUS_FAILURE) goto done; - } index = ie_data->ie_index; memset(pmadapter, ie_data, 0, sizeof(custom_ie) * @@ -1273,9 +1276,8 @@ wlan_misc_ioctl_custom_ie_list(IN pmlan_adapter pmadapter, index); /* if IE to delete is not found, return error */ - if (ret == MLAN_STATUS_FAILURE) { + if (ret == MLAN_STATUS_FAILURE) goto done; - } memset(pmadapter, ie_data, 0, sizeof(custom_ie) * MAX_MGMT_IE_INDEX_TO_FW); @@ -1541,7 +1543,7 @@ wlan_is_station_list_empty(mlan_private * priv) /** * @brief This function will return the pointer to station entry in station list - * table which matches the give mac address + * table which matches the give mac address * * @param priv A pointer to mlan_private * @param mac mac address to find in station list table @@ -1584,7 +1586,7 @@ wlan_get_station_entry(mlan_private * priv, t_u8 * mac) /** * @brief This function will add a pointer to station entry in station list - * table with the give mac address, if it does not exist already + * table with the give mac address, if it does not exist already * * @param priv A pointer to mlan_private * @param mac mac address to find in station list table @@ -1684,6 +1686,435 @@ wlan_delete_station_list(pmlan_private priv) } /** + * @brief Get tdls peer list + * + * @param priv A pointer to mlan_private structure + * @param buf A pointer to tdls_peer_info buf + * @return number of tdls peer + */ +int +wlan_get_tdls_list(mlan_private * priv, tdls_peer_info * buf) +{ + tdls_peer_info *peer_info = buf; + sta_node *sta_ptr = MNULL; + int count = 0; + ENTER(); + if (priv->bss_type != MLAN_BSS_TYPE_STA) { + LEAVE(); + return count; + } + sta_ptr = (sta_node *) util_peek_list(priv->adapter->pmoal_handle, + &priv->sta_list, + priv->adapter->callbacks. + moal_spin_lock, + priv->adapter->callbacks. + moal_spin_unlock); + if (!sta_ptr) { + LEAVE(); + return count; + } + while (sta_ptr != (sta_node *) & priv->sta_list) { + peer_info->snr = sta_ptr->snr; + peer_info->nf = sta_ptr->nf; + memcpy(priv->adapter, peer_info->mac_addr, sta_ptr->mac_addr, + MLAN_MAC_ADDR_LENGTH); + memcpy(priv->adapter, peer_info->ht_cap, &sta_ptr->HTcap, + sizeof(IEEEtypes_HTCap_t)); + memcpy(priv->adapter, peer_info->ext_cap, &sta_ptr->ExtCap, + sizeof(IEEEtypes_ExtCap_t)); + memcpy(priv->adapter, peer_info->vht_cap, &sta_ptr->vht_cap, + sizeof(IEEEtypes_VHTCap_t)); + sta_ptr = sta_ptr->pnext; + peer_info++; + count++; + if (count >= MLAN_MAX_TDLS_PEER_SUPPORTED) + break; + } + LEAVE(); + return count; +} + +/** + * @brief Set the TDLS configuration to FW. + * + * @param pmadapter A pointer to mlan_adapter structure + * @param pioctl_req A pointer to ioctl request buffer + * + * @return MLAN_STATUS_PENDING --success, otherwise fail + */ +mlan_status +wlan_misc_ioctl_tdls_config(IN pmlan_adapter pmadapter, + IN pmlan_ioctl_req pioctl_req) +{ + mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; + mlan_status ret = MLAN_STATUS_SUCCESS; + mlan_ds_misc_cfg *misc = (mlan_ds_misc_cfg *) pioctl_req->pbuf; + tdls_all_config *tdls_all_cfg = + (tdls_all_config *) misc->param.tdls_config.tdls_data; + t_u8 event_buf[100]; + mlan_event *pevent = (mlan_event *) event_buf; + tdls_tear_down_event *tdls_evt = + (tdls_tear_down_event *) pevent->event_buf; + sta_node *sta_ptr = MNULL; + + ENTER(); + + if (misc->param.tdls_config.tdls_action == WLAN_TDLS_TEAR_DOWN_REQ) { + sta_ptr = + wlan_get_station_entry(pmpriv, + tdls_all_cfg->u.tdls_tear_down. + peer_mac_addr); + if (sta_ptr && sta_ptr->external_tdls) { + pevent->bss_index = pmpriv->bss_index; + pevent->event_id = MLAN_EVENT_ID_DRV_TDLS_TEARDOWN_REQ; + pevent->event_len = sizeof(tdls_tear_down_event); + memcpy(pmpriv->adapter, + (t_u8 *) tdls_evt->peer_mac_addr, + tdls_all_cfg->u.tdls_tear_down.peer_mac_addr, + MLAN_MAC_ADDR_LENGTH); + tdls_evt->reason_code = + tdls_all_cfg->u.tdls_tear_down.reason_code; + wlan_recv_event(pmpriv, + MLAN_EVENT_ID_DRV_TDLS_TEARDOWN_REQ, + pevent); + LEAVE(); + return ret; + } + } + pioctl_req->action = MLAN_ACT_SET; + + /* Send command to firmware */ + ret = wlan_prepare_cmd(pmpriv, + HostCmd_CMD_TDLS_CONFIG, + HostCmd_ACT_GEN_SET, + 0, + (t_void *) pioctl_req, &misc->param.tdls_config); + + if (ret == MLAN_STATUS_SUCCESS) + ret = MLAN_STATUS_PENDING; + LEAVE(); + return ret; +} + +/** + * @brief Set the TDLS operation to FW. + * + * @param pmadapter A pointer to mlan_adapter structure + * @param pioctl_req A pointer to ioctl request buffer + * + * @return MLAN_STATUS_PENDING --success, otherwise fail + */ +mlan_status +wlan_misc_ioctl_tdls_oper(IN pmlan_adapter pmadapter, + IN pmlan_ioctl_req pioctl_req) +{ + mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; + mlan_status ret = MLAN_STATUS_SUCCESS; + mlan_ds_misc_cfg *misc = (mlan_ds_misc_cfg *) pioctl_req->pbuf; + mlan_ds_misc_tdls_oper *ptdls_oper = &misc->param.tdls_oper; + t_u8 event_buf[100]; + mlan_event *ptdls_event = (mlan_event *) event_buf; + tdls_tear_down_event *tdls_evt = + (tdls_tear_down_event *) ptdls_event->event_buf; + sta_node *sta_ptr = MNULL; + t_u8 i = 0; + + ENTER(); + sta_ptr = wlan_get_station_entry(pmpriv, ptdls_oper->peer_mac); + switch (ptdls_oper->tdls_action) { + case WLAN_TDLS_ENABLE_LINK: + if (sta_ptr && (sta_ptr->status != TDLS_SETUP_FAILURE)) { + PRINTM(MMSG, "TDLS: Enable link " MACSTR " success\n", + MAC2STR(ptdls_oper->peer_mac)); + sta_ptr->status = TDLS_SETUP_COMPLETE; + pmadapter->tdls_status = TDLS_IN_BASE_CHANNEL; + if (sta_ptr->HTcap.ieee_hdr.element_id == HT_CAPABILITY) { + sta_ptr->is_11n_enabled = MTRUE; + if (GETHT_MAXAMSDU + (sta_ptr->HTcap.ht_cap.ht_cap_info)) + sta_ptr->max_amsdu = + MLAN_TX_DATA_BUF_SIZE_8K; + else + sta_ptr->max_amsdu = + MLAN_TX_DATA_BUF_SIZE_4K; + for (i = 0; i < MAX_NUM_TID; i++) { + if (sta_ptr->is_11n_enabled) + sta_ptr->ampdu_sta[i] = + pmpriv-> + aggr_prio_tbl[i]. + ampdu_user; + else + sta_ptr->ampdu_sta[i] = + BA_STREAM_NOT_ALLOWED; + } + memset(pmpriv->adapter, sta_ptr->rx_seq, 0xff, + sizeof(sta_ptr->rx_seq)); + } + wlan_restore_tdls_packets(pmpriv, ptdls_oper->peer_mac, + TDLS_SETUP_COMPLETE); + } else { + PRINTM(MMSG, "TDLS: Enable link " MACSTR " fail\n", + MAC2STR(ptdls_oper->peer_mac)); + /* for supplicant 2.0, we need send event to request + teardown, **for latest supplicant, we only need + return fail, and supplicant will send teardown + packet and disable tdls link */ + if (sta_ptr) { + ptdls_event->bss_index = pmpriv->bss_index; + ptdls_event->event_id = + MLAN_EVENT_ID_DRV_TDLS_TEARDOWN_REQ; + ptdls_event->event_len = + sizeof(tdls_tear_down_event); + memcpy(pmpriv->adapter, + (t_u8 *) tdls_evt->peer_mac_addr, + ptdls_oper->peer_mac, + MLAN_MAC_ADDR_LENGTH); + tdls_evt->reason_code = + WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED; + wlan_recv_event(pmpriv, + MLAN_EVENT_ID_DRV_TDLS_TEARDOWN_REQ, + ptdls_event); + wlan_restore_tdls_packets(pmpriv, + ptdls_oper->peer_mac, + TDLS_TEAR_DOWN); + if (sta_ptr->is_11n_enabled) { + wlan_cleanup_reorder_tbl(pmpriv, + ptdls_oper-> + peer_mac); + pmadapter->callbacks. + moal_spin_lock(pmadapter-> + pmoal_handle, + pmpriv->wmm. + ra_list_spinlock); + wlan_11n_cleanup_txbastream_tbl(pmpriv, + ptdls_oper-> + peer_mac); + pmadapter->callbacks. + moal_spin_unlock(pmadapter-> + pmoal_handle, + pmpriv->wmm. + ra_list_spinlock); + } + wlan_delete_station_entry(pmpriv, + ptdls_oper->peer_mac); + if (MTRUE == wlan_is_station_list_empty(pmpriv)) + pmadapter->tdls_status = TDLS_NOT_SETUP; + else + pmadapter->tdls_status = + TDLS_IN_BASE_CHANNEL; + } + ret = MLAN_STATUS_FAILURE; + } + wlan_recv_event(pmpriv, MLAN_EVENT_ID_DRV_DEFER_HANDLING, + MNULL); + break; + case WLAN_TDLS_DISABLE_LINK: + if (sta_ptr) { + wlan_restore_tdls_packets(pmpriv, ptdls_oper->peer_mac, + TDLS_TEAR_DOWN); + if (sta_ptr->is_11n_enabled) { + wlan_cleanup_reorder_tbl(pmpriv, + ptdls_oper->peer_mac); + pmadapter->callbacks.moal_spin_lock(pmadapter-> + pmoal_handle, + pmpriv->wmm. + ra_list_spinlock); + wlan_11n_cleanup_txbastream_tbl(pmpriv, + ptdls_oper-> + peer_mac); + pmadapter->callbacks. + moal_spin_unlock(pmadapter-> + pmoal_handle, + pmpriv->wmm. + ra_list_spinlock); + } + if (sta_ptr->status >= TDLS_SETUP_INPROGRESS) + wlan_delete_station_entry(pmpriv, + ptdls_oper->peer_mac); + } + if (MTRUE == wlan_is_station_list_empty(pmpriv)) + pmadapter->tdls_status = TDLS_NOT_SETUP; + else + pmadapter->tdls_status = TDLS_IN_BASE_CHANNEL; + /* Send command to firmware to delete tdls link */ + ret = wlan_prepare_cmd(pmpriv, + HostCmd_CMD_TDLS_OPERATION, + HostCmd_ACT_GEN_SET, + 0, (t_void *) pioctl_req, ptdls_oper); + if (ret == MLAN_STATUS_SUCCESS) + ret = MLAN_STATUS_PENDING; + break; + case WLAN_TDLS_CREATE_LINK: + PRINTM(MIOCTL, "CREATE TDLS LINK\n"); + if (sta_ptr && sta_ptr->status == TDLS_SETUP_INPROGRESS) { + PRINTM(MIOCTL, "We already create the link\n"); + break; + } + if (!sta_ptr) + sta_ptr = + wlan_add_station_entry(pmpriv, + misc->param.tdls_oper. + peer_mac); + if (sta_ptr) { + sta_ptr->status = TDLS_SETUP_INPROGRESS; + sta_ptr->external_tdls = MTRUE; + wlan_hold_tdls_packets(pmpriv, + misc->param.tdls_oper.peer_mac); + } + ret = wlan_prepare_cmd(pmpriv, + HostCmd_CMD_TDLS_OPERATION, + HostCmd_ACT_GEN_SET, + 0, (t_void *) pioctl_req, ptdls_oper); + if (ret == MLAN_STATUS_SUCCESS) + ret = MLAN_STATUS_PENDING; + break; + case WLAN_TDLS_CONFIG_LINK: + if (!sta_ptr || sta_ptr->status == TDLS_SETUP_FAILURE) { + PRINTM(MERROR, "Can not CONFIG TDLS Link\n"); + ret = MLAN_STATUS_FAILURE; + break; + } + ret = wlan_prepare_cmd(pmpriv, + HostCmd_CMD_TDLS_OPERATION, + HostCmd_ACT_GEN_SET, + 0, (t_void *) pioctl_req, ptdls_oper); + if (ret == MLAN_STATUS_SUCCESS) + ret = MLAN_STATUS_PENDING; + break; + default: + break; + } + LEAVE(); + return ret; +} + +/** + * @brief Set the TDLS operation to FW. + * + * @param pmadapter A pointer to mlan_adapter structure + * @param pioctl_req A pointer to ioctl request buffer + * + * @return MLAN_STATUS_PENDING --success, otherwise fail + */ +mlan_status +wlan_misc_ioctl_tdls_get_ies(IN pmlan_adapter pmadapter, + IN pmlan_ioctl_req pioctl_req) +{ + mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; + mlan_ds_misc_cfg *misc = (mlan_ds_misc_cfg *) pioctl_req->pbuf; + mlan_ds_misc_tdls_ies *tdls_ies = &misc->param.tdls_ies; + mlan_status ret = MLAN_STATUS_SUCCESS; + BSSDescriptor_t *pbss_desc; + t_u32 usr_dot_11n_dev_cap; + IEEEtypes_ExtCap_t *ext_cap = MNULL; + IEEEtypes_HTCap_t *ht_cap = MNULL; + IEEEtypes_HTInfo_t *ht_info = MNULL; + IEEEtypes_VHTCap_t *vht_cap = MNULL; + IEEEtypes_VHTOprat_t *vht_oprat = MNULL; + IEEEtypes_AssocRsp_t *passoc_rsp = MNULL; + IEEEtypes_AID_t *aid_info = MNULL; + sta_node *sta_ptr = MNULL; + ENTER(); + + sta_ptr = wlan_get_station_entry(pmpriv, tdls_ies->peer_mac); + pbss_desc = &pmpriv->curr_bss_params.bss_descriptor; + if (pbss_desc->bss_band & BAND_A) + usr_dot_11n_dev_cap = pmadapter->usr_dot_11n_dev_cap_a; + else + usr_dot_11n_dev_cap = pmadapter->usr_dot_11n_dev_cap_bg; + + /** fill the extcap */ + if (tdls_ies->flags & TDLS_IE_FLAGS_EXTCAP) { + ext_cap = (IEEEtypes_ExtCap_t *) tdls_ies->ext_cap; + ext_cap->ieee_hdr.element_id = EXT_CAPABILITY; + ext_cap->ieee_hdr.len = sizeof(ExtCap_t); + SET_EXTCAP_TDLS(ext_cap->ext_cap); + // TODO UAPSD need be enabled + RESET_EXTCAP_TDLS_UAPSD(ext_cap->ext_cap); + RESET_EXTCAP_TDLS_CHAN_SWITCH(ext_cap->ext_cap); + RESET_EXTCAP_TDLS_WIDER_BANDWIDTH(ext_cap->ext_cap); + if (MFALSE == wlan_is_ap_in_11ac_mode(pmpriv)) + SET_EXTCAP_TDLS_WIDER_BANDWIDTH(ext_cap->ext_cap); + DBG_HEXDUMP(MCMD_D, "TDLS extcap", tdls_ies->ext_cap, + sizeof(IEEEtypes_ExtCap_t)); + } + + /** fill the htcap based on hwspec */ + if (tdls_ies->flags & TDLS_IE_FLAGS_HTCAP) { + ht_cap = (IEEEtypes_HTCap_t *) tdls_ies->ht_cap; + memset(pmadapter, ht_cap, 0, sizeof(IEEEtypes_HTCap_t)); + wlan_fill_ht_cap_ie(pmpriv, ht_cap, pbss_desc->bss_band); + DBG_HEXDUMP(MCMD_D, "TDLS htcap", tdls_ies->ht_cap, + sizeof(IEEEtypes_HTCap_t)); + } + /** fill the vhtcap based on hwspec */ + if (tdls_ies->flags & TDLS_IE_FLAGS_VHTCAP) { + vht_cap = (IEEEtypes_VHTCap_t *) tdls_ies->vht_cap; + memset(pmadapter, vht_cap, 0, sizeof(IEEEtypes_VHTCap_t)); + wlan_fill_vht_cap_ie(pmpriv, vht_cap, pbss_desc->bss_band); + DBG_HEXDUMP(MCMD_D, "TDLS vhtcap", tdls_ies->vht_cap, + sizeof(IEEEtypes_VHTCap_t)); + } + /** fill the vhtoperation based on hwspec */ + if (tdls_ies->flags & TDLS_IE_FLAGS_VHTOPRAT) { + vht_oprat = (IEEEtypes_VHTOprat_t *) tdls_ies->vht_oprat; + memset(pmadapter, vht_oprat, 0, sizeof(IEEEtypes_VHTOprat_t)); + if (sta_ptr && + (sta_ptr->vht_cap.ieee_hdr.element_id == VHT_CAPABILITY) && + (pbss_desc->bss_band & BAND_A)) { + wlan_fill_tdls_vht_oprat_ie(pmpriv, vht_oprat, sta_ptr); + } + if (sta_ptr) + memcpy(pmadapter, &sta_ptr->vht_oprat, + tdls_ies->vht_oprat, + sizeof(IEEEtypes_VHTOprat_t)); + DBG_HEXDUMP(MCMD_D, "TDLS vht_oprat", tdls_ies->vht_oprat, + sizeof(IEEEtypes_VHTOprat_t)); + } + /** fill the AID info */ + if (tdls_ies->flags & TDLS_IE_FLAGS_AID) { + passoc_rsp = (IEEEtypes_AssocRsp_t *) pmpriv->assoc_rsp_buf; + aid_info = (IEEEtypes_AID_t *) tdls_ies->aid_info; + memset(pmadapter, aid_info, 0, sizeof(IEEEtypes_AID_t)); + aid_info->ieee_hdr.element_id = AID_INFO; + aid_info->ieee_hdr.len = sizeof(t_u16); + aid_info->AID = wlan_le16_to_cpu(passoc_rsp->a_id); + PRINTM(MCMND, "TDLS AID=0x%x\n", aid_info->AID); + } + /** fill the htinfo */ + if (tdls_ies->flags & TDLS_IE_FLAGS_HTINFO) { + ht_info = (IEEEtypes_HTInfo_t *) tdls_ies->ht_info; + pbss_desc = &pmpriv->curr_bss_params.bss_descriptor; + ht_info->ieee_hdr.element_id = HT_OPERATION; + ht_info->ieee_hdr.len = sizeof(HTInfo_t); + ht_info->ht_info.pri_chan = pbss_desc->channel; + /* follow AP's channel bandwidth */ + if (ISSUPP_CHANWIDTH40(usr_dot_11n_dev_cap) && + pbss_desc->pht_info && + ISALLOWED_CHANWIDTH40(pbss_desc->pht_info->ht_info. + field2)) { + ht_info->ht_info.field2 = + pbss_desc->pht_info->ht_info.field2; + } + if (vht_oprat && + vht_oprat->ieee_hdr.element_id == VHT_OPERATION) { + ht_info->ht_info.field2 = + wlan_get_second_channel_offset(pbss_desc-> + channel); + ht_info->ht_info.field2 |= MBIT(2); + } + if (sta_ptr) + memcpy(pmadapter, &sta_ptr->HTInfo, tdls_ies->ht_info, + sizeof(IEEEtypes_HTInfo_t)); + DBG_HEXDUMP(MCMD_D, "TDLS htinfo", tdls_ies->ht_info, + sizeof(IEEEtypes_HTInfo_t)); + } + + LEAVE(); + return ret; +} + +/** * @brief Get extended version information * * @param pmadapter A pointer to mlan_adapter structure diff --git a/drivers/net/wireless/sd8897/mlan/mlan_scan.c b/drivers/net/wireless/sd8897/mlan/mlan_scan.c index 7cd25aa67a9e..15f71ab25da0 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_scan.c +++ b/drivers/net/wireless/sd8897/mlan/mlan_scan.c @@ -159,7 +159,7 @@ search_oui_in_ie(mlan_adapter * pmadapter, IEBody * ie_body, t_u8 * oui) } } - PRINTM(MINFO, "The OUI %x:%x:%x:%x is not found in PTK \n", oui[0], + PRINTM(MINFO, "The OUI %x:%x:%x:%x is not found in PTK\n", oui[0], oui[1], oui[2], oui[3]); LEAVE(); return MLAN_OUI_NOT_PRESENT; @@ -855,7 +855,10 @@ wlan_scan_channel_list(IN mlan_private * pmpriv, /* Send the scan command to the firmware with the specified cfg */ - cmd_no = HostCmd_CMD_802_11_SCAN; + if (pmadapter->ext_scan) + cmd_no = HostCmd_CMD_802_11_SCAN_EXT; + else + cmd_no = HostCmd_CMD_802_11_SCAN; ret = wlan_prepare_cmd(pmpriv, cmd_no, HostCmd_ACT_GEN_SET, @@ -866,13 +869,11 @@ wlan_scan_channel_list(IN mlan_private * pmpriv, LEAVE(); - if (ptlv_temp) { + if (ptlv_temp) pcb->moal_mfree(pmadapter->pmoal_handle, ptlv_temp); - } - if (ret) { + if (ret) return MLAN_STATUS_FAILURE; - } return MLAN_STATUS_SUCCESS; } @@ -932,6 +933,7 @@ wlan_scan_setup_scan_config(IN mlan_private * pmpriv, MrvlIEtypes_NumProbes_t *pnum_probes_tlv; MrvlIEtypes_WildCardSsIdParamSet_t *pwildcard_ssid_tlv; MrvlIEtypes_RatesParamSet_t *prates_tlv; + MrvlIEtypes_Bssid_List_t *pbssid_tlv; const t_u8 zero_mac[MLAN_MAC_ADDR_LENGTH] = { 0, 0, 0, 0, 0, 0 }; t_u8 *ptlv_pos; @@ -994,6 +996,18 @@ wlan_scan_setup_scan_config(IN mlan_private * pmpriv, puser_scan_in->specific_bssid, sizeof(pscan_cfg_out->specific_bssid)); + if (pmadapter->ext_scan + && memcmp(pmadapter, pscan_cfg_out->specific_bssid, + &zero_mac, sizeof(zero_mac))) { + pbssid_tlv = (MrvlIEtypes_Bssid_List_t *) ptlv_pos; + pbssid_tlv->header.type = TLV_TYPE_BSSID; + pbssid_tlv->header.len = MLAN_MAC_ADDR_LENGTH; + memcpy(pmadapter, pbssid_tlv->bssid, + puser_scan_in->specific_bssid, + MLAN_MAC_ADDR_LENGTH); + ptlv_pos += sizeof(MrvlIEtypes_Bssid_List_t); + } + for (ssid_idx = 0; ((ssid_idx < NELEMENTS(puser_scan_in->ssid_list)) && (*puser_scan_in->ssid_list[ssid_idx].ssid || @@ -1033,9 +1047,8 @@ wlan_scan_setup_scan_config(IN mlan_private * pmpriv, pwildcard_ssid_tlv->ssid, pwildcard_ssid_tlv->max_ssid_length); - if (ssid_len) { + if (ssid_len) ssid_filter = MTRUE; - } } /* @@ -1429,11 +1442,13 @@ wlan_interpret_bss_desc_with_ie(IN pmlan_adapter pmadapter, * Next 4 fields are RSSI (for legacy scan only), time stamp, * beacon interval, and capability information */ - /* RSSI is 1 byte long */ - pbss_entry->rssi = (t_s32) (*pcurrent_ptr); - PRINTM(MINFO, "InterpretIE: RSSI=%02X\n", *pcurrent_ptr); - pcurrent_ptr += 1; - bytes_left_for_current_beacon -= 1; + if (!ext_scan) { + /* RSSI is 1 byte long */ + pbss_entry->rssi = (t_s32) (*pcurrent_ptr); + PRINTM(MINFO, "InterpretIE: RSSI=%02X\n", *pcurrent_ptr); + pcurrent_ptr += 1; + bytes_left_for_current_beacon -= 1; + } /* * The RSSI is not part of the beacon/probe response. After we have @@ -1480,11 +1495,10 @@ wlan_interpret_bss_desc_with_ie(IN pmlan_adapter pmadapter, pbss_entry->privacy = Wlan802_11PrivFilterAcceptAll; } - if (pcap_info->ibss == 1) { + if (pcap_info->ibss == 1) pbss_entry->bss_mode = MLAN_BSS_MODE_IBSS; - } else { + else pbss_entry->bss_mode = MLAN_BSS_MODE_INFRA; - } if (pcap_info->spectrum_mgmt == 1) { PRINTM(MINFO, "InterpretIE: 11h- Spectrum Management " @@ -3409,9 +3423,8 @@ wlan_scan_networks(IN mlan_private * pmpriv, return MLAN_STATUS_FAILURE; } - if (puser_scan_in) { + if (puser_scan_in) keep_previous_scan = puser_scan_in->keep_previous_scan; - } if (keep_previous_scan == MFALSE) { memset(pmadapter, pmadapter->pscan_table, 0x00, @@ -3569,11 +3582,10 @@ wlan_ret_802_11_scan(IN mlan_private * pmpriv, pcb = (pmlan_callbacks) & pmadapter->callbacks; is_bgscan_resp = (resp->command == HostCmd_CMD_802_11_BG_SCAN_QUERY); - if (is_bgscan_resp) { + if (is_bgscan_resp) pscan_rsp = &resp->params.bg_scan_query_resp.scan_resp; - } else { + else pscan_rsp = &resp->params.scan_resp; - } if (pscan_rsp->number_of_sets > MRVDRV_MAX_BSSID_LIST) { PRINTM(MERROR, @@ -3749,11 +3761,10 @@ wlan_ret_802_11_scan(IN mlan_private * pmpriv, if (bss_idx == num_in_table) { /* Range check the bss_idx, keep it limited to the last entry */ - if (bss_idx == MRVDRV_MAX_BSSID_LIST) { + if (bss_idx == MRVDRV_MAX_BSSID_LIST) bss_idx--; - } else { + else num_in_table++; - } } /* @@ -3888,6 +3899,476 @@ done: } /** + * @brief Prepare an extended scan command to be sent to the firmware + * + * Use the wlan_scan_cmd_config sent to the command processing module in + * the wlan_prepare_cmd to configure a HostCmd_DS_802_11_SCAN_EXT command + * struct to send to firmware. + * + * @param pmpriv A pointer to mlan_private structure + * @param pcmd A pointer to HostCmd_DS_COMMAND structure to be sent to + * firmware with the HostCmd_DS_802_11_SCAN_EXT structure + * @param pdata_buf Void pointer cast of a wlan_scan_cmd_config struct used + * to set the fields/TLVs for the command sent to firmware + * + * @return MLAN_STATUS_SUCCESS + */ +mlan_status +wlan_cmd_802_11_scan_ext(IN mlan_private * pmpriv, + IN HostCmd_DS_COMMAND * pcmd, IN t_void * pdata_buf) +{ + HostCmd_DS_802_11_SCAN_EXT *pext_scan_cmd = &pcmd->params.ext_scan; + wlan_scan_cmd_config *pscan_cfg = MNULL; + + ENTER(); + + pscan_cfg = (wlan_scan_cmd_config *) pdata_buf; + + memcpy(pmpriv->adapter, pext_scan_cmd->tlv_buffer, + pscan_cfg->tlv_buf, pscan_cfg->tlv_buf_len); + + pcmd->command = wlan_cpu_to_le16(HostCmd_CMD_802_11_SCAN_EXT); + + /* Size is equal to the sizeof(fixed portions) + the TLV len + header */ + pcmd->size = wlan_cpu_to_le16((t_u16) (sizeof(pext_scan_cmd->reserved) + + pscan_cfg->tlv_buf_len + + S_DS_GEN)); + + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + +/** + * @brief This function handles the command response of extended scan + * + * @param pmpriv A pointer to mlan_private structure + * @param resp A pointer to HostCmd_DS_COMMAND + * @param pioctl_buf A pointer to mlan_ioctl_req structure + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +mlan_status +wlan_ret_802_11_scan_ext(IN mlan_private * pmpriv, + IN HostCmd_DS_COMMAND * resp, IN t_void * pioctl_buf) +{ + ENTER(); + + PRINTM(MINFO, "EXT scan returns successfully\n"); + + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + +/** + * @brief This function parse and store the extended scan results + * + * @param pmpriv A pointer to mlan_private structure + * @param number_of_sets Number of BSS + * @param pscan_resp A pointer to scan response buffer + * @param scan_resp_size Size of scan response buffer + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +static mlan_status +wlan_parse_ext_scan_result(IN mlan_private * pmpriv, + IN t_u8 number_of_sets, + IN t_u8 * pscan_resp, IN t_u16 scan_resp_size) +{ + mlan_status ret = MLAN_STATUS_SUCCESS; + mlan_adapter *pmadapter = pmpriv->adapter; + mlan_callbacks *pcb = MNULL; + BSSDescriptor_t *bss_new_entry = MNULL; + t_u8 *pbss_info; + t_u32 bytes_left; + t_u32 bytes_left_for_tlv; + t_u32 num_in_table; + t_u32 bss_idx; + t_u32 idx; + t_u64 tsf_val; + chan_freq_power_t *cfp; + t_u16 tlv_type, tlv_len; + MrvlIEtypes_Data_t *ptlv = MNULL; + MrvlIEtypes_Bss_Scan_Rsp_t *pscan_rsp_tlv = MNULL; + MrvlIEtypes_Bss_Scan_Info_t *pscan_info_tlv = MNULL; + t_u8 band; + t_u32 age_ts_usec; + t_u8 null_ssid[MLAN_MAX_SSID_LENGTH] = { 0 }; + + ENTER(); + pcb = (pmlan_callbacks) & pmadapter->callbacks; + + if (number_of_sets > MRVDRV_MAX_BSSID_LIST) { + PRINTM(MERROR, + "EXT_SCAN: Invalid number of AP returned (%d)!!\n", + number_of_sets); + ret = MLAN_STATUS_FAILURE; + goto done; + } + + bytes_left = scan_resp_size; + PRINTM(MINFO, "EXT_SCAN: bss_descript_size %d\n", scan_resp_size); + PRINTM(MINFO, "EXT_SCAN: returned %d APs before parsing\n", + number_of_sets); + + num_in_table = pmadapter->num_in_scan_table; + ptlv = (MrvlIEtypes_Data_t *) pscan_resp; + + /* + * Process each scan response returned number_of_sets. Save + * the information in the bss_new_entry and then insert into the + * driver scan table either as an update to an existing entry + * or as an addition at the end of the table + */ + ret = pcb->moal_malloc(pmadapter->pmoal_handle, sizeof(BSSDescriptor_t), + MLAN_MEM_DEF, (t_u8 **) & bss_new_entry); + + if (ret != MLAN_STATUS_SUCCESS || !bss_new_entry) { + PRINTM(MERROR, "Memory allocation for bss_new_entry failed!\n"); + ret = MLAN_STATUS_FAILURE; + goto done; + } + + for (idx = 0; idx < number_of_sets && bytes_left > + sizeof(MrvlIEtypesHeader_t); idx++) { + tlv_type = wlan_le16_to_cpu(ptlv->header.type); + tlv_len = wlan_le16_to_cpu(ptlv->header.len); + if (bytes_left < sizeof(MrvlIEtypesHeader_t) + tlv_len) { + PRINTM(MERROR, + "EXT_SCAN: Error bytes left < TLV length\n"); + break; + } + pscan_rsp_tlv = MNULL; + pscan_info_tlv = MNULL; + bytes_left_for_tlv = bytes_left; + /* BSS response TLV with beacon or probe response buffer at the + initial position of each descriptor */ + if (tlv_type == TLV_TYPE_BSS_SCAN_RSP) { + pbss_info = (t_u8 *) ptlv; + pscan_rsp_tlv = (MrvlIEtypes_Bss_Scan_Rsp_t *) ptlv; + ptlv = (MrvlIEtypes_Data_t *) (ptlv->data + tlv_len); + bytes_left_for_tlv -= + (tlv_len + sizeof(MrvlIEtypesHeader_t)); + } else + break; + + /* Process variable TLV */ + while (bytes_left_for_tlv >= sizeof(MrvlIEtypesHeader_t) && + wlan_le16_to_cpu(ptlv->header.type) != + TLV_TYPE_BSS_SCAN_RSP) { + tlv_type = wlan_le16_to_cpu(ptlv->header.type); + tlv_len = wlan_le16_to_cpu(ptlv->header.len); + if (bytes_left_for_tlv < + sizeof(MrvlIEtypesHeader_t) + tlv_len) { + PRINTM(MERROR, + "EXT_SCAN: Error in processing TLV, " + "bytes left < TLV length\n"); + pscan_rsp_tlv = MNULL; + bytes_left_for_tlv = 0; + continue; + } + switch (tlv_type) { + case TLV_TYPE_BSS_SCAN_INFO: + pscan_info_tlv = + (MrvlIEtypes_Bss_Scan_Info_t *) ptlv; + if (tlv_len != + sizeof(MrvlIEtypes_Bss_Scan_Info_t) - + sizeof(MrvlIEtypesHeader_t)) { + bytes_left_for_tlv = 0; + continue; + } + break; + default: + break; + } + ptlv = (MrvlIEtypes_Data_t *) (ptlv->data + tlv_len); + bytes_left -= (tlv_len + sizeof(MrvlIEtypesHeader_t)); + bytes_left_for_tlv -= + (tlv_len + sizeof(MrvlIEtypesHeader_t)); + } + /* No BSS response TLV */ + if (pscan_rsp_tlv == MNULL) + break; + + /* Advance pointer to the beacon buffer length and update the + bytes count so that the function + wlan_interpret_bss_desc_with_ie() can handle the scan buffer + withut any change */ + pbss_info += sizeof(t_u16); + bytes_left -= sizeof(t_u16); + + /* Zero out the bss_new_entry we are about to store info in */ + memset(pmadapter, bss_new_entry, 0x00, sizeof(BSSDescriptor_t)); + + /* Process the data fields and IEs returned for this BSS */ + if (wlan_interpret_bss_desc_with_ie(pmadapter, + bss_new_entry, + &pbss_info, + &bytes_left, + MTRUE) == + MLAN_STATUS_SUCCESS) { + PRINTM(MINFO, "EXT_SCAN: BSSID = " MACSTR "\n", + MAC2STR(bss_new_entry->mac_address)); + + band = BAND_G; + /* + * If the BSS info TLV was appended to the scan results, save + * this entry's TSF value in the networkTSF field. The + * networkTSF is the firmware's TSF value at the time the + * beacon or probe response was received. + */ + if (pscan_info_tlv) { + /* RSSI is 2 byte long */ + bss_new_entry->rssi = + -(t_s32) (wlan_le16_to_cpu + (pscan_info_tlv->rssi)); + PRINTM(MINFO, "EXT_SCAN: RSSI=%d\n", + bss_new_entry->rssi); + memcpy(pmpriv->adapter, &tsf_val, + &pscan_info_tlv->tsf, sizeof(tsf_val)); + tsf_val = wlan_le64_to_cpu(tsf_val); + memcpy(pmpriv->adapter, + &bss_new_entry->network_tsf, &tsf_val, + sizeof(bss_new_entry->network_tsf)); + band = radio_type_to_band(pscan_info_tlv->band); + } + /* Save the band designation for this entry for use in + join */ + bss_new_entry->bss_band = band; + + cfp = wlan_find_cfp_by_band_and_channel(pmadapter, + (t_u8) + bss_new_entry-> + bss_band, + (t_u16) + bss_new_entry-> + channel); + if (cfp) + bss_new_entry->freq = cfp->freq; + else + bss_new_entry->freq = 0; + + /* Skip entry if on blacklisted channel */ + if (cfp && cfp->dynamic.blacklist) { + PRINTM(MINFO, + "EXT_SCAN: dropping entry on blacklist channel.\n"); + continue; + } + + /* + * Search the scan table for the same bssid + */ + for (bss_idx = 0; bss_idx < num_in_table; bss_idx++) { + if (!memcmp + (pmadapter, bss_new_entry->mac_address, + pmadapter->pscan_table[bss_idx]. + mac_address, + sizeof(bss_new_entry->mac_address))) { + /* + * If the SSID matches as well, it is a duplicate of + * this entry. Keep the bss_idx set to this + * entry so we replace the old contents in the table + */ + if ((bss_new_entry->ssid.ssid_len == + pmadapter->pscan_table[bss_idx]. + ssid.ssid_len) + && + (!memcmp + (pmadapter, + bss_new_entry->ssid.ssid, + pmadapter->pscan_table[bss_idx]. + ssid.ssid, + bss_new_entry->ssid.ssid_len))) { + PRINTM(MINFO, + "EXT_SCAN: Duplicate of index: %d\n", + bss_idx); + break; + } + /* + * If the SSID is NULL for same BSSID keep the bss_idx set + * to this entry so we replace the old contents in the table + */ + if (!memcmp + (pmadapter, + pmadapter->pscan_table[bss_idx]. + ssid.ssid, null_ssid, + pmadapter->pscan_table[bss_idx]. + ssid.ssid_len)) { + PRINTM(MINFO, + "EXT_SCAN: Duplicate of index: %d\n", + bss_idx); + break; + } + } + } + /* + * If the bss_idx is equal to the number of entries in the table, + * the new entry was not a duplicate; append it to the scan + * table + */ + if (bss_idx == num_in_table) { + /* Range check the bss_idx, keep it limited to + the last entry */ + if (bss_idx == MRVDRV_MAX_BSSID_LIST) + bss_idx--; + else + num_in_table++; + } + + /* + * Save the beacon/probe response returned for later application + * retrieval. Duplicate beacon/probe responses are updated if + * possible + */ + wlan_ret_802_11_scan_store_beacon(pmpriv, + bss_idx, + num_in_table, + bss_new_entry); + if (bss_new_entry->pbeacon_buf == MNULL) { + PRINTM(MCMND, + "No space for beacon, drop this entry\n"); + num_in_table--; + continue; + } + + /* Copy the locally created bss_new_entry to the scan + table */ + memcpy(pmadapter, &pmadapter->pscan_table[bss_idx], + bss_new_entry, + sizeof(pmadapter->pscan_table[bss_idx])); + } else { + /* Error parsing/interpreting the scan response, + skipped */ + PRINTM(MERROR, + "EXT_SCAN: wlan_interpret_bss_desc_with_ie returned error\n"); + } + } + + PRINTM(MINFO, "EXT_SCAN: Scanned %2d APs, %d valid, %d total\n", + number_of_sets, num_in_table - pmadapter->num_in_scan_table, + num_in_table); + + /* Update the total number of BSSIDs in the scan table */ + pmadapter->num_in_scan_table = num_in_table; + /* Update the age_in_second */ + pmadapter->callbacks.moal_get_system_time(pmadapter->pmoal_handle, + &pmadapter->age_in_secs, + &age_ts_usec); + +done: + if (bss_new_entry) + pcb->moal_mfree(pmadapter->pmoal_handle, + (t_u8 *) bss_new_entry); + + LEAVE(); + return ret; +} + +/** + * @brief This function handles the event extended scan report + * + * @param pmpriv A pointer to mlan_private structure + * @param pmbuf A pointer to mlan_buffer + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +mlan_status +wlan_handle_event_ext_scan_report(IN mlan_private * pmpriv, + IN mlan_buffer * pmbuf) +{ + mlan_adapter *pmadapter = pmpriv->adapter; + mlan_callbacks *pcb = &pmadapter->callbacks; + mlan_ioctl_req *pioctl_req = MNULL; + cmd_ctrl_node *pcmd_node = MNULL; + mlan_status ret = MLAN_STATUS_SUCCESS; + + mlan_event_scan_result *pevent_scan = (pmlan_event_scan_result) + (pmbuf->pbuf + pmbuf->data_offset); + t_u8 *ptlv = (pmbuf->pbuf + pmbuf->data_offset + + sizeof(mlan_event_scan_result)); + t_u16 tlv_buf_left = wlan_cpu_to_le16(pevent_scan->buf_size); + + DBG_HEXDUMP(MCMD_D, "EVENT EXT_SCAN", pmbuf->pbuf + + pmbuf->data_offset, pmbuf->data_len); + wlan_parse_ext_scan_result(pmpriv, pevent_scan->num_of_set, + ptlv, tlv_buf_left); + if (!pevent_scan->more_event) { + + if (!util_peek_list(pmadapter->pmoal_handle, + &pmadapter->scan_pending_q, + pcb->moal_spin_lock, + pcb->moal_spin_unlock)) { + /* + * Process the resulting scan table: + * - Remove any bad ssids + * - Update our current BSS information from scan data + */ + wlan_scan_process_results(pmpriv); + + wlan_request_cmd_lock(pmadapter); + pmadapter->scan_processing = MFALSE; + pioctl_req = pmadapter->pscan_ioctl_req; + pmadapter->pscan_ioctl_req = MNULL; + /* Need to indicate IOCTL complete */ + if (pioctl_req != MNULL) { + pioctl_req->status_code = MLAN_ERROR_NO_ERROR; + /* Indicate ioctl complete */ + pcb->moal_ioctl_complete(pmadapter-> + pmoal_handle, + (pmlan_ioctl_req) + pioctl_req, + MLAN_STATUS_SUCCESS); + } + wlan_release_cmd_lock(pmadapter); + + pmadapter->bgscan_reported = MFALSE; + wlan_recv_event(pmpriv, MLAN_EVENT_ID_DRV_SCAN_REPORT, + MNULL); + } else { + /* If firmware not ready, do not issue any more scan + commands */ + if (pmadapter->hw_status != WlanHardwareStatusReady) { + /* Flush all pending scan commands */ + wlan_flush_scan_queue(pmadapter); + wlan_request_cmd_lock(pmadapter); + pmadapter->scan_processing = MFALSE; + pioctl_req = pmadapter->pscan_ioctl_req; + pmadapter->pscan_ioctl_req = MNULL; + /* Indicate IOCTL complete */ + if (pioctl_req != MNULL) { + pioctl_req->status_code = + MLAN_ERROR_FW_NOT_READY; + + /* Indicate ioctl complete */ + pcb->moal_ioctl_complete(pmadapter-> + pmoal_handle, + (pmlan_ioctl_req) + pioctl_req, + MLAN_STATUS_FAILURE); + } + wlan_release_cmd_lock(pmadapter); + } else { + /* Get scan command from scan_pending_q and put + to cmd_pending_q */ + pcmd_node = + (cmd_ctrl_node *) + util_dequeue_list(pmadapter-> + pmoal_handle, + &pmadapter-> + scan_pending_q, + pcb->moal_spin_lock, + pcb-> + moal_spin_unlock); + wlan_insert_cmd_to_pending_q(pmadapter, + pcmd_node, MTRUE); + } + } + } + + LEAVE(); + return ret; +} + +/** * @brief This function prepares command of bg_scan_query. * * @param pmpriv A pointer to mlan_private structure @@ -4302,13 +4783,14 @@ wlan_cmd_bgscan_config(IN mlan_private * pmpriv, sizeof(MrvlIEtypesHeader_t) + sizeof(ChanScanParamSet_t) * chan_num; } + tlv_start_later = (MrvlIEtypes_StartLater_t *) tlv; tlv_start_later->header.type = wlan_cpu_to_le16(TLV_TYPE_STARTBGSCANLATER); tlv_start_later->header.len = wlan_cpu_to_le16(sizeof(MrvlIEtypes_StartLater_t) - sizeof(MrvlIEtypesHeader_t)); - tlv_start_later->value = 0; + tlv_start_later->value = wlan_cpu_to_le16(bg_scan_in->start_later); tlv += sizeof(MrvlIEtypes_StartLater_t); cmd_size += sizeof(MrvlIEtypes_StartLater_t); done: @@ -4450,9 +4932,8 @@ wlan_find_ssid_in_list(IN mlan_private * pmpriv, net = i; } } else { - if (net == -1) { + if (net == -1) net = j; - } } break; case MLAN_BSS_MODE_AUTO: diff --git a/drivers/net/wireless/sd8897/mlan/mlan_sdio.c b/drivers/net/wireless/sd8897/mlan/mlan_sdio.c index 6cbc009b33c7..3664b8021ec9 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_sdio.c +++ b/drivers/net/wireless/sd8897/mlan/mlan_sdio.c @@ -72,8 +72,8 @@ bitcount(t_u32 num) /** * @brief This function initialize the SDIO port * - * @param pmadapter A pointer to mlan_adapter structure - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @param pmadapter A pointer to mlan_adapter structure + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_sdio_init_ioport(mlan_adapter * pmadapter) @@ -151,7 +151,7 @@ wlan_sdio_init_ioport(mlan_adapter * pmadapter) * @param pmadapter A pointer to mlan_adapter structure * @param pmbuf A pointer to mlan_buffer (pmbuf->data_len should include SDIO header) * @param port Port - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_write_data_sync(mlan_adapter * pmadapter, mlan_buffer * pmbuf, t_u32 port) @@ -193,7 +193,7 @@ exit: * * @param pmadapter A pointer to mlan_adapter structure * @param pport A pointer to port number - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_get_rd_port(mlan_adapter * pmadapter, t_u8 * pport) @@ -234,7 +234,7 @@ wlan_get_rd_port(mlan_adapter * pmadapter, t_u8 * pport) * * @param pmadapter A pointer to mlan_adapter structure * @param pport A pointer to port number - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_get_wr_port_data(mlan_adapter * pmadapter, t_u8 * pport) @@ -275,8 +275,8 @@ wlan_get_wr_port_data(mlan_adapter * pmadapter, t_u8 * pport) * @brief This function polls the card status register. * * @param pmadapter A pointer to mlan_adapter structure - * @param bits the bit mask - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @param bits the bit mask + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_sdio_poll_card_status(mlan_adapter * pmadapter, t_u8 bits) @@ -310,9 +310,9 @@ wlan_sdio_poll_card_status(mlan_adapter * pmadapter, t_u8 bits) /** * @brief This function reads firmware status registers * - * @param pmadapter A pointer to mlan_adapter structure - * @param dat A pointer to keep returned data - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @param pmadapter A pointer to mlan_adapter structure + * @param dat A pointer to keep returned data + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_sdio_read_fw_status(mlan_adapter * pmadapter, t_u16 * dat) @@ -343,8 +343,8 @@ wlan_sdio_read_fw_status(mlan_adapter * pmadapter, t_u16 * dat) /** @brief This function disables the host interrupts mask. * * @param pmadapter A pointer to mlan_adapter structure - * @param mask the interrupt mask - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @param mask the interrupt mask + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_sdio_disable_host_int_mask(pmlan_adapter pmadapter, t_u8 mask) @@ -382,7 +382,7 @@ wlan_sdio_disable_host_int_mask(pmlan_adapter pmadapter, t_u8 mask) * * @param pmadapter A pointer to mlan_adapter structure * @param mask the interrupt mask - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_sdio_enable_host_int_mask(pmlan_adapter pmadapter, t_u8 mask) @@ -408,12 +408,12 @@ wlan_sdio_enable_host_int_mask(pmlan_adapter pmadapter, t_u8 mask) * @brief This function reads data from the card. * * @param pmadapter A pointer to mlan_adapter structure - * @param type A pointer to keep type as data or command - * @param nb A pointer to keep the data/cmd length returned in buffer - * @param pmbuf A pointer to the SDIO data/cmd buffer - * @param npayload the length of data/cmd buffer - * @param ioport the SDIO ioport - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @param type A pointer to keep type as data or command + * @param nb A pointer to keep the data/cmd length returned in buffer + * @param pmbuf A pointer to the SDIO data/cmd buffer + * @param npayload the length of data/cmd buffer + * @param ioport the SDIO ioport + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_sdio_card_to_host(mlan_adapter * pmadapter, @@ -587,9 +587,8 @@ wlan_prog_fw_w_helper(IN pmlan_adapter pmadapter, IN pmlan_fw_image pmfw) i = 0; /* Set blocksize to transfer - checking for last block */ - if (firmwarelen && firmwarelen - offset < txlen) { + if (firmwarelen && firmwarelen - offset < txlen) txlen = firmwarelen - offset; - } PRINTM(MINFO, "."); tx_blocks = @@ -646,7 +645,7 @@ done: * @brief This function disables the host interrupts. * * @param pmadapter A pointer to mlan_adapter structure - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_disable_host_int(pmlan_adapter pmadapter) @@ -666,13 +665,13 @@ wlan_disable_host_int(pmlan_adapter pmadapter) * @param pmadapter A pointer to mlan_adapter structure * @param pmbuf A pointer to the SDIO data/cmd buffer * @param upld_typ Type of rx packet - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ static mlan_status wlan_decode_rx_packet(mlan_adapter * pmadapter, mlan_buffer * pmbuf, t_u32 upld_typ) { - t_u8 *cmdBuf; + t_u8 *cmd_buf; t_u32 event; ENTER(); @@ -706,7 +705,7 @@ wlan_decode_rx_packet(mlan_adapter * pmadapter, mlan_buffer * pmbuf, PRINTM(MINFO, "--- Rx: Cmd Response ---\n"); /* take care of curr_cmd = NULL case */ if (!pmadapter->curr_cmd) { - cmdBuf = pmadapter->upld_buf; + cmd_buf = pmadapter->upld_buf; if (pmadapter->ps_state == PS_STATE_SLEEP_CFM) { wlan_process_sleep_confirm_resp(pmadapter, pmbuf->pbuf + @@ -718,7 +717,7 @@ wlan_decode_rx_packet(mlan_adapter * pmadapter, mlan_buffer * pmbuf, INTF_HEADER_LEN); } pmadapter->upld_len -= INTF_HEADER_LEN; - memcpy(pmadapter, cmdBuf, + memcpy(pmadapter, cmd_buf, pmbuf->pbuf + pmbuf->data_offset + INTF_HEADER_LEN, MIN(MRVDRV_SIZE_OF_CMD_BUFFER, pmadapter->upld_len - @@ -772,7 +771,7 @@ wlan_decode_rx_packet(mlan_adapter * pmadapter, mlan_buffer * pmbuf, * @brief This function receives data from the card in aggregate mode. * * @param pmadapter A pointer to mlan_adapter structure - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_receive_mp_aggr_buf(mlan_adapter * pmadapter) @@ -886,7 +885,7 @@ done: * @param pmbuf A pointer to the SDIO data/cmd buffer * @param port Current port on which packet needs to be rxed * @param rx_len Length of received packet - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_sdio_card_to_host_mp_aggr(mlan_adapter * pmadapter, mlan_buffer @@ -1022,7 +1021,7 @@ done: * @brief This function sends aggr buf * * @param pmadapter A pointer to mlan_adapter structure - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_send_mp_aggr_buf(mlan_adapter * pmadapter) @@ -1116,7 +1115,7 @@ wlan_send_mp_aggr_buf(mlan_adapter * pmadapter) * @param mbuf A pointer to the SDIO data/cmd buffer * @param port current port for aggregation * @param next_pkt_len Length of next packet used for multiport aggregation - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_host_to_card_mp_aggr(mlan_adapter * pmadapter, mlan_buffer * mbuf, @@ -1373,7 +1372,7 @@ done: * @param pmadapter A pointer to mlan_adapter * @param pmfw A pointer to firmware image * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_dnld_fw(IN pmlan_adapter pmadapter, IN pmlan_fw_image pmfw) @@ -1397,7 +1396,7 @@ wlan_dnld_fw(IN pmlan_adapter pmadapter, IN pmlan_fw_image pmfw) * @brief This function probes the driver * * @param pmadapter A pointer to mlan_adapter structure - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_sdio_probe(pmlan_adapter pmadapter) @@ -1489,7 +1488,7 @@ done: * @brief This function enables the host interrupts. * * @param pmadapter A pointer to mlan_adapter structure - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_enable_host_int(pmlan_adapter pmadapter) @@ -1506,7 +1505,7 @@ wlan_enable_host_int(pmlan_adapter pmadapter) * @brief This function checks the interrupt status and handle it accordingly. * * @param pmadapter A pointer to mlan_adapter structure - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_process_int_status(mlan_adapter * pmadapter) @@ -1738,7 +1737,7 @@ done: * @param type data or command * @param pmbuf A pointer to mlan_buffer (pmbuf->data_len should include SDIO header) * @param tx_param A pointer to mlan_tx_param - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_sdio_host_to_card(mlan_adapter * pmadapter, t_u8 type, mlan_buffer * pmbuf, @@ -1762,7 +1761,8 @@ wlan_sdio_host_to_card(mlan_adapter * pmadapter, t_u8 type, mlan_buffer * pmbuf, /* * This is SDIO specific header * t_u16 length, - * t_u16 type (MLAN_TYPE_DATA = 0, MLAN_TYPE_CMD = 1, MLAN_TYPE_EVENT = 3) + * t_u16 type (MLAN_TYPE_DATA = 0, + * MLAN_TYPE_CMD = 1, MLAN_TYPE_EVENT = 3) */ if (type == MLAN_TYPE_DATA) { ret = wlan_get_wr_port_data(pmadapter, &port); @@ -1834,7 +1834,7 @@ exit: #if defined(SDIO_MULTI_PORT_TX_AGGR) || defined(SDIO_MULTI_PORT_RX_AGGR) /** * @brief This function allocates buffer for the SDIO aggregation buffer - * related members of adapter structure + * related members of adapter structure * * @param pmadapter A pointer to mlan_adapter structure * @param mpa_tx_buf_size Tx buffer size to allocate @@ -1883,9 +1883,8 @@ wlan_alloc_sdio_mpa_buffers(IN mlan_adapter * pmadapter, pmadapter->mpa_rx.buf_size = mpa_rx_buf_size; #endif /* SDIO_MULTI_PORT_RX_AGGR */ error: - if (ret != MLAN_STATUS_SUCCESS) { + if (ret != MLAN_STATUS_SUCCESS) wlan_free_sdio_mpa_buffers(pmadapter); - } LEAVE(); return ret; @@ -1933,9 +1932,9 @@ wlan_free_sdio_mpa_buffers(IN mlan_adapter * pmadapter) /** * @brief This function issues commands to initialize firmware * - * @param priv A pointer to mlan_private structure + * @param priv A pointer to mlan_private structure * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_set_sdio_gpio_int(IN pmlan_private priv) @@ -1972,8 +1971,8 @@ wlan_set_sdio_gpio_int(IN pmlan_private priv) /** * @brief This function prepares command of SDIO GPIO interrupt * - * @param pmpriv A pointer to mlan_private structure - * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure * @param cmd_action The action: GET or SET * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS diff --git a/drivers/net/wireless/sd8897/mlan/mlan_sdio.h b/drivers/net/wireless/sd8897/mlan/mlan_sdio.h index 99b16867a2c3..409b0a2f410c 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_sdio.h +++ b/drivers/net/wireless/sd8897/mlan/mlan_sdio.h @@ -275,11 +275,14 @@ Change log: #define MP_TX_AGGR_IN_PROGRESS(a) (a->mpa_tx.pkt_cnt > 0) /** SDIO Tx aggregation buffer room for next packet ? */ -#define MP_TX_AGGR_BUF_HAS_ROOM(a, mbuf, len) (((a->mpa_tx.buf_len) + len) <= (a->mpa_tx.buf_size)) +#define MP_TX_AGGR_BUF_HAS_ROOM(a, mbuf, len) \ + (((a->mpa_tx.buf_len) + len) <= (a->mpa_tx.buf_size)) /** Copy current packet (SDIO Tx aggregation buffer) to SDIO buffer */ #define MP_TX_AGGR_BUF_PUT(a, mbuf, port) do { \ - pmadapter->callbacks.moal_memmove(a->pmoal_handle, &a->mpa_tx.buf[a->mpa_tx.buf_len], mbuf->pbuf+mbuf->data_offset, mbuf->data_len);\ + pmadapter->callbacks.moal_memmove(a->pmoal_handle, \ + &a->mpa_tx.buf[a->mpa_tx.buf_len], \ + mbuf->pbuf+mbuf->data_offset, mbuf->data_len);\ a->mpa_tx.buf_len += mbuf->data_len; \ a->mpa_tx.mp_wr_info[a->mpa_tx.pkt_cnt] = *(t_u16 *)(mbuf->pbuf+mbuf->data_offset); \ if (!a->mpa_tx.pkt_cnt) { \ @@ -287,7 +290,7 @@ Change log: } \ a->mpa_tx.ports |= (1 << port); \ a->mpa_tx.pkt_cnt++; \ -} while (0); +} while (0) #define MP_TX_AGGR_BUF_PUT_SG(a, mbuf, port) do { \ a->mpa_tx.buf_len += mbuf->data_len; \ @@ -298,10 +301,11 @@ Change log: } \ a->mpa_tx.ports |= (1 << port); \ a->mpa_tx.pkt_cnt++; \ -} while (0); +} while (0) /** SDIO Tx aggregation limit ? */ -#define MP_TX_AGGR_PKT_LIMIT_REACHED(a) ((a->mpa_tx.pkt_cnt) == (a->mpa_tx.pkt_aggr_limit)) +#define MP_TX_AGGR_PKT_LIMIT_REACHED(a) ((a->mpa_tx.pkt_cnt) \ + == (a->mpa_tx.pkt_aggr_limit)) /** SDIO Tx aggregation port limit ? */ /** this is for test only, because port 0 is reserved for control port */ @@ -330,7 +334,8 @@ Change log: #ifdef SDIO_MULTI_PORT_RX_AGGR /** SDIO Rx aggregation limit ? */ -#define MP_RX_AGGR_PKT_LIMIT_REACHED(a) (a->mpa_rx.pkt_cnt == a->mpa_rx.pkt_aggr_limit) +#define MP_RX_AGGR_PKT_LIMIT_REACHED(a) (a->mpa_rx.pkt_cnt \ + == a->mpa_rx.pkt_aggr_limit) /** SDIO Rx aggregation port limit ? */ /** this is for test only, because port 0 is reserved for control port */ diff --git a/drivers/net/wireless/sd8897/mlan/mlan_shim.c b/drivers/net/wireless/sd8897/mlan/mlan_shim.c index 0f63b73deff4..2bbf48c943bf 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_shim.c +++ b/drivers/net/wireless/sd8897/mlan/mlan_shim.c @@ -635,14 +635,14 @@ mlan_init_fw(IN t_void * pmlan_adapter) /** * @brief Shutdown firmware * - * @param pmlan_adapter A pointer to mlan_adapter structure + * @param pmlan_adapter A pointer to mlan_adapter structure * - * @return MLAN_STATUS_SUCCESS - * The firmware shutdown call succeeded. - * MLAN_STATUS_PENDING - * The firmware shutdown call is pending. - * MLAN_STATUS_FAILURE - * The firmware shutdown call failed. + * @return MLAN_STATUS_SUCCESS + * The firmware shutdown call succeeded. + * MLAN_STATUS_PENDING + * The firmware shutdown call is pending. + * MLAN_STATUS_FAILURE + * The firmware shutdown call failed. */ mlan_status mlan_shutdown_fw(IN t_void * pmlan_adapter) @@ -678,9 +678,8 @@ mlan_shutdown_fw(IN t_void * pmlan_adapter) /* Clean up priv structures */ for (i = 0; i < pmadapter->priv_num; i++) { - if (pmadapter->priv[i]) { + if (pmadapter->priv[i]) wlan_free_priv(pmadapter->priv[i]); - } } pcb = &pmadapter->callbacks; @@ -819,6 +818,11 @@ process_start: pmadapter->callbacks.moal_spin_unlock) > HIGH_RX_PENDING) { PRINTM(MEVENT, "Pause\n"); pmadapter->delay_task_flag = MTRUE; + if (!pmadapter->mlan_rx_processing) + wlan_recv_event(wlan_get_priv + (pmadapter, MLAN_BSS_ROLE_ANY), + MLAN_EVENT_ID_DRV_DEFER_RX_WORK, + MNULL); break; } /* Handle pending SDIO interrupts if any */ @@ -868,12 +872,15 @@ process_start: if (pmadapter->scan_processing || pmadapter->data_sent + || wlan_is_tdls_link_chan_switching(pmadapter-> + tdls_status) || (wlan_bypass_tx_list_empty(pmadapter) && wlan_wmm_lists_empty(pmadapter)) || wlan_11h_radar_detected_tx_blocked(pmadapter) ) { if (pmadapter->cmd_sent || pmadapter->curr_cmd - || + || !wlan_is_send_cmd_allowed(pmadapter-> + tdls_status) || (!util_peek_list (pmadapter->pmoal_handle, &pmadapter->cmd_pending_q, @@ -921,7 +928,9 @@ process_start: ) continue; - if (!pmadapter->cmd_sent && !pmadapter->curr_cmd) { + if (!pmadapter->cmd_sent && !pmadapter->curr_cmd + && wlan_is_send_cmd_allowed(pmadapter->tdls_status) + ) { if (wlan_exec_next_cmd(pmadapter) == MLAN_STATUS_FAILURE) { ret = MLAN_STATUS_FAILURE; @@ -932,6 +941,7 @@ process_start: if (!pmadapter->scan_processing && !pmadapter->data_sent && !wlan_11h_radar_detected_tx_blocked(pmadapter) && + !wlan_is_tdls_link_chan_switching(pmadapter->tdls_status) && !wlan_bypass_tx_list_empty(pmadapter)) { PRINTM(MINFO, "mlan_send_pkt(): deq(bybass_txq)\n"); wlan_process_bypass_tx(pmadapter); @@ -947,6 +957,7 @@ process_start: if (!pmadapter->scan_processing && !pmadapter->data_sent && !wlan_wmm_lists_empty(pmadapter) && !wlan_11h_radar_detected_tx_blocked(pmadapter) + && !wlan_is_tdls_link_chan_switching(pmadapter->tdls_status) ) { wlan_wmm_process_tx(pmadapter); if (pmadapter->hs_activated == MTRUE) { @@ -1009,6 +1020,8 @@ mlan_send_packet(IN t_void * pmlan_adapter, IN pmlan_buffer pmbuf) mlan_adapter *pmadapter = (mlan_adapter *) pmlan_adapter; mlan_private *pmpriv; t_u16 eth_type = 0; + t_u8 ra[MLAN_MAC_ADDR_LENGTH]; + tdlsStatus_e tdls_status; ENTER(); MASSERT(pmlan_adapter && pmbuf); @@ -1025,9 +1038,18 @@ mlan_send_packet(IN t_void * pmlan_adapter, IN pmlan_buffer pmbuf) ((eth_type == MLAN_ETHER_PKT_TYPE_EAPOL) || (eth_type == MLAN_ETHER_PKT_TYPE_WAPI) )) + || (eth_type == MLAN_ETHER_PKT_TYPE_TDLS_ACTION) || (pmbuf->buf_type == MLAN_BUF_TYPE_RAW_DATA) ) { + if (eth_type == MLAN_ETHER_PKT_TYPE_TDLS_ACTION) { + memcpy(pmadapter, ra, pmbuf->pbuf + pmbuf->data_offset, + MLAN_MAC_ADDR_LENGTH); + tdls_status = wlan_get_tdls_link_status(pmpriv, ra); + if (MTRUE == wlan_is_tdls_link_setup(tdls_status) || + !pmpriv->media_connected) + pmbuf->flags |= MLAN_BUF_FLAG_TDLS; + } PRINTM(MINFO, "mlan_send_pkt(): enq(bybass_txq)\n"); wlan_add_buf_bypass_txqueue(pmadapter, pmbuf); } else { diff --git a/drivers/net/wireless/sd8897/mlan/mlan_sta_cmd.c b/drivers/net/wireless/sd8897/mlan/mlan_sta_cmd.c index 9c8d5c5224eb..d1d2537d1d30 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_sta_cmd.c +++ b/drivers/net/wireless/sd8897/mlan/mlan_sta_cmd.c @@ -616,9 +616,10 @@ wlan_cmd_mac_multicast_adr(IN pmlan_private pmpriv, } /** - * @brief This function prepares command of deauthenticate. + * @brief This function prepares command of deauthenticate/disassociate. * * @param pmpriv A pointer to mlan_private structure + * @param cmd_no Command number * @param cmd A pointer to HostCmd_DS_COMMAND structure * @param pdata_buf A pointer to data buffer * @@ -626,6 +627,7 @@ wlan_cmd_mac_multicast_adr(IN pmlan_private pmpriv, */ static mlan_status wlan_cmd_802_11_deauthenticate(IN pmlan_private pmpriv, + IN t_u16 cmd_no, IN HostCmd_DS_COMMAND * cmd, IN t_void * pdata_buf) { @@ -633,7 +635,7 @@ wlan_cmd_802_11_deauthenticate(IN pmlan_private pmpriv, ENTER(); - cmd->command = wlan_cpu_to_le16(HostCmd_CMD_802_11_DEAUTHENTICATE); + cmd->command = wlan_cpu_to_le16(cmd_no); cmd->size = wlan_cpu_to_le16(sizeof(HostCmd_DS_802_11_DEAUTHENTICATE) + S_DS_GEN); @@ -641,8 +643,12 @@ wlan_cmd_802_11_deauthenticate(IN pmlan_private pmpriv, /* Set AP MAC address */ memcpy(pmpriv->adapter, pdeauth->mac_addr, (t_u8 *) pdata_buf, MLAN_MAC_ADDR_LENGTH); - - PRINTM(MCMND, "Deauth: " MACSTR "\n", MAC2STR(pdeauth->mac_addr)); + if (cmd_no == HostCmd_CMD_802_11_DEAUTHENTICATE) + PRINTM(MCMND, "Deauth: " MACSTR "\n", + MAC2STR(pdeauth->mac_addr)); + else + PRINTM(MCMND, "Disassociate: " MACSTR "\n", + MAC2STR(pdeauth->mac_addr)); if (pmpriv->adapter->state_11h.recvd_chanswann_event) { /** Reason code 36 = Requested from peer station as it is leaving the BSS */ @@ -685,83 +691,6 @@ wlan_cmd_802_11_ad_hoc_stop(IN pmlan_private pmpriv, } /** - * @brief This function sets WEP key(s) to key_param_set TLV(s). - * - * @param priv A pointer to mlan_private structure - * @param key_param_set A pointer to MrvlIEtype_KeyParamSet_t structure - * @param key_param_len A pointer to the length variable - * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE - */ -static mlan_status -wlan_set_keyparamset_wep(mlan_private * priv, - MrvlIEtype_KeyParamSet_t * key_param_set, - t_u16 * key_param_len) -{ - int cur_key_param_len = 0; - t_u8 i; - mlan_status ret = MLAN_STATUS_SUCCESS; - - ENTER(); - - /* Multi-key_param_set TLV is supported */ - for (i = 0; i < MRVL_NUM_WEP_KEY; i++) { - if ((priv->wep_key[i].key_length == WEP_40_BIT_LEN) || - (priv->wep_key[i].key_length == WEP_104_BIT_LEN)) { - key_param_set->type = - wlan_cpu_to_le16(TLV_TYPE_KEY_MATERIAL); -/** Key_param_set WEP fixed length */ -#define KEYPARAMSET_WEP_FIXED_LEN 8 - key_param_set->length = - wlan_cpu_to_le16((t_u16) - (priv->wep_key[i].key_length + - KEYPARAMSET_WEP_FIXED_LEN)); - key_param_set->key_type_id = - wlan_cpu_to_le16(KEY_TYPE_ID_WEP); - key_param_set->key_info = - wlan_cpu_to_le16(KEY_INFO_WEP_ENABLED | - KEY_INFO_WEP_UNICAST | - KEY_INFO_WEP_MCAST); - key_param_set->key_len = - (t_u16) wlan_cpu_to_le16(priv->wep_key[i]. - key_length); - /* Set WEP key index */ - key_param_set->key[0] = i; - /* Set default Tx key flag */ - if (i == - (priv-> - wep_key_curr_index & HostCmd_WEP_KEY_INDEX_MASK)) - key_param_set->key[1] = 1; - else - key_param_set->key[1] = 0; - memmove(priv->adapter, &key_param_set->key[2], - priv->wep_key[i].key_material, - priv->wep_key[i].key_length); - - cur_key_param_len = priv->wep_key[i].key_length + - KEYPARAMSET_WEP_FIXED_LEN + - sizeof(MrvlIEtypesHeader_t); - *key_param_len += (t_u16) cur_key_param_len; - key_param_set = - (MrvlIEtype_KeyParamSet_t *) ((t_u8 *) - key_param_set + - cur_key_param_len); - } else if (!priv->wep_key[i].key_length) { - continue; - } else { - PRINTM(MERROR, "key%d Length = %d is incorrect\n", - (i + 1), priv->wep_key[i].key_length); - ret = MLAN_STATUS_FAILURE; - goto done; - } - } - -done: - LEAVE(); - return ret; -} - -/** * @brief This function prepares command of key_material. * * @param pmpriv A pointer to mlan_private structure @@ -781,26 +710,25 @@ wlan_cmd_802_11_key_material(IN pmlan_private pmpriv, HostCmd_DS_802_11_KEY_MATERIAL *pkey_material = &cmd->params.key_material; mlan_ds_encrypt_key *pkey = (mlan_ds_encrypt_key *) pdata_buf; - t_u16 key_param_len = 0; mlan_status ret = MLAN_STATUS_SUCCESS; - const t_u8 bc_mac[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; ENTER(); - + if (!pkey) { + ret = MLAN_STATUS_FAILURE; + goto done; + } cmd->command = wlan_cpu_to_le16(HostCmd_CMD_802_11_KEY_MATERIAL); pkey_material->action = wlan_cpu_to_le16(cmd_action); - if (cmd_action == HostCmd_ACT_GEN_GET) { - cmd->size = - wlan_cpu_to_le16(sizeof(pkey_material->action) + - S_DS_GEN + KEYPARAMSET_FIXED_LEN + - sizeof(MrvlIEtypesHeader_t)); - memset(pmpriv->adapter, &pkey_material->key_param_set, 0, - sizeof(MrvlIEtype_KeyParamSet_t)); + PRINTM(MCMND, "GET Key\n"); + pkey_material->key_param_set.key_idx = + pkey->key_index & KEY_INDEX_MASK; pkey_material->key_param_set.type = - wlan_cpu_to_le16(TLV_TYPE_KEY_MATERIAL); + wlan_cpu_to_le16(TLV_TYPE_KEY_PARAM_V2); pkey_material->key_param_set.length = - wlan_cpu_to_le16(KEYPARAMSET_FIXED_LEN); + wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN); + memcpy(pmpriv->adapter, pkey_material->key_param_set.mac_addr, + pkey->mac_addr, MLAN_MAC_ADDR_LENGTH); if (pkey->key_flags & KEY_FLAG_GROUP_KEY) pkey_material->key_param_set.key_info |= KEY_INFO_MCAST_KEY; @@ -809,180 +737,206 @@ wlan_cmd_802_11_key_material(IN pmlan_private pmpriv, KEY_INFO_UCAST_KEY; if (pkey->key_flags & KEY_FLAG_AES_MCAST_IGTK) pkey_material->key_param_set.key_info = - KEY_INFO_AES_MCAST_IGTK; + KEY_INFO_CMAC_AES_KEY; pkey_material->key_param_set.key_info = wlan_cpu_to_le16(pkey_material->key_param_set.key_info); + cmd->size = + wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + + S_DS_GEN + KEY_PARAMS_FIXED_LEN + + sizeof(pkey_material->action)); goto done; } - - if (!pkey) { - memset(pmpriv->adapter, &pkey_material->key_param_set, 0, - (MRVL_NUM_WEP_KEY * sizeof(MrvlIEtype_KeyParamSet_t))); - ret = wlan_set_keyparamset_wep(pmpriv, - &pkey_material->key_param_set, - &key_param_len); + memset(pmpriv->adapter, &pkey_material->key_param_set, 0, + sizeof(MrvlIEtype_KeyParamSetV2_t)); + if (pkey->key_flags & KEY_FLAG_REMOVE_KEY) { + pkey_material->action = + wlan_cpu_to_le16(HostCmd_ACT_GEN_REMOVE); + pkey_material->key_param_set.type = + wlan_cpu_to_le16(TLV_TYPE_KEY_PARAM_V2); + pkey_material->key_param_set.length = + wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN); + pkey_material->key_param_set.key_idx = + pkey->key_index & KEY_INDEX_MASK; + pkey_material->key_param_set.key_info = + KEY_INFO_MCAST_KEY | KEY_INFO_UCAST_KEY; + memcpy(pmpriv->adapter, pkey_material->key_param_set.mac_addr, + pkey->mac_addr, MLAN_MAC_ADDR_LENGTH); cmd->size = - wlan_cpu_to_le16(key_param_len + - sizeof(pkey_material->action) + - S_DS_GEN); + wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + + S_DS_GEN + KEY_PARAMS_FIXED_LEN + + sizeof(pkey_material->action)); + PRINTM(MCMND, "Remove Key\n"); goto done; - } else - memset(pmpriv->adapter, &pkey_material->key_param_set, 0, - sizeof(MrvlIEtype_KeyParamSet_t)); - if (pkey->is_wapi_key) { - PRINTM(MINFO, "Set WAPI Key\n"); - pkey_material->key_param_set.key_type_id = - wlan_cpu_to_le16(KEY_TYPE_ID_WAPI); - if (cmd_oid == KEY_INFO_ENABLED) - pkey_material->key_param_set.key_info = - wlan_cpu_to_le16(KEY_INFO_WAPI_ENABLED); - else - pkey_material->key_param_set.key_info = - !(wlan_cpu_to_le16(KEY_INFO_WAPI_ENABLED)); - - pkey_material->key_param_set.key[0] = (t_u8) pkey->key_index; - if (!pmpriv->sec_info.wapi_key_on) - pkey_material->key_param_set.key[1] = 1; - else - pkey_material->key_param_set.key[1] = 0; /* set - 0 - when - re-key - */ - - if (0 != memcmp(pmpriv->adapter, pkey->mac_addr, bc_mac, sizeof(bc_mac))) /* WAPI - pairwise - key: - unicast - */ - pkey_material->key_param_set.key_info |= - wlan_cpu_to_le16(KEY_INFO_WAPI_UNICAST); - else { /* WAPI group key: multicast */ + } + pkey_material->action = wlan_cpu_to_le16(HostCmd_ACT_GEN_SET); + pkey_material->key_param_set.key_idx = pkey->key_index & KEY_INDEX_MASK; + pkey_material->key_param_set.type = + wlan_cpu_to_le16(TLV_TYPE_KEY_PARAM_V2); + pkey_material->key_param_set.key_info = KEY_INFO_ENABLE_KEY; + memcpy(pmpriv->adapter, pkey_material->key_param_set.mac_addr, + pkey->mac_addr, MLAN_MAC_ADDR_LENGTH); + if (pkey->key_len <= MAX_WEP_KEY_SIZE) { + pkey_material->key_param_set.length = + wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN + + sizeof(wep_param_t)); + pkey_material->key_param_set.key_type = KEY_TYPE_ID_WEP; + if (pkey->is_current_wep_key) { pkey_material->key_param_set.key_info |= - wlan_cpu_to_le16(KEY_INFO_WAPI_MCAST); - pmpriv->sec_info.wapi_key_on = MTRUE; + KEY_INFO_MCAST_KEY | KEY_INFO_UCAST_KEY; + if (pkey_material->key_param_set.key_idx == + (pmpriv->wep_key_curr_index & KEY_INDEX_MASK)) + pkey_material->key_param_set.key_info |= + KEY_INFO_DEFAULT_KEY; + } else { + if (pkey->key_flags & KEY_FLAG_GROUP_KEY) + pkey_material->key_param_set.key_info |= + KEY_INFO_MCAST_KEY; + else + pkey_material->key_param_set.key_info |= + KEY_INFO_UCAST_KEY; + if (pkey->key_flags & KEY_FLAG_SET_TX_KEY) + pkey_material->key_param_set.key_info |= + KEY_INFO_DEFAULT_KEY; } - - pkey_material->key_param_set.type = - wlan_cpu_to_le16(TLV_TYPE_KEY_MATERIAL); - pkey_material->key_param_set.key_len = - wlan_cpu_to_le16(WAPI_KEY_LEN); - memcpy(pmpriv->adapter, &pkey_material->key_param_set.key[2], + pkey_material->key_param_set.key_info = + wlan_cpu_to_le16(pkey_material->key_param_set.key_info); + pkey_material->key_param_set.key_params.wep.key_len = + wlan_cpu_to_le16(pkey->key_len); + memcpy(pmpriv->adapter, + pkey_material->key_param_set.key_params.wep.key, pkey->key_material, pkey->key_len); + cmd->size = + wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + + S_DS_GEN + KEY_PARAMS_FIXED_LEN + + sizeof(wep_param_t) + + sizeof(pkey_material->action)); + PRINTM(MCMND, "Set WEP Key\n"); + goto done; + } + if (pkey->key_flags & KEY_FLAG_GROUP_KEY) + pkey_material->key_param_set.key_info |= KEY_INFO_MCAST_KEY; + else + pkey_material->key_param_set.key_info |= KEY_INFO_UCAST_KEY; + if (pkey->key_flags & KEY_FLAG_SET_TX_KEY) + pkey_material->key_param_set.key_info |= + KEY_INFO_TX_KEY | KEY_INFO_RX_KEY; + else + pkey_material->key_param_set.key_info |= KEY_INFO_RX_KEY; + if (pkey->is_wapi_key) { + pkey_material->key_param_set.key_type = KEY_TYPE_ID_WAPI; memcpy(pmpriv->adapter, - &pkey_material->key_param_set.key[2 + pkey->key_len], + pkey_material->key_param_set.key_params.wapi.pn, pkey->pn, PN_SIZE); + pkey_material->key_param_set.key_params.wapi.key_len = + wlan_cpu_to_le16(pkey->key_len); + memcpy(pmpriv->adapter, + pkey_material->key_param_set.key_params.wapi.key, + pkey->key_material, pkey->key_len); + if (!pmpriv->sec_info.wapi_key_on) + pkey_material->key_param_set.key_info |= + KEY_INFO_DEFAULT_KEY; + if (pkey->key_flags & KEY_FLAG_GROUP_KEY) + pmpriv->sec_info.wapi_key_on = MTRUE; + pkey_material->key_param_set.key_info = + wlan_cpu_to_le16(pkey_material->key_param_set.key_info); pkey_material->key_param_set.length = - wlan_cpu_to_le16(WAPI_KEY_LEN + KEYPARAMSET_FIXED_LEN); - - key_param_len = - (WAPI_KEY_LEN + KEYPARAMSET_FIXED_LEN) + - sizeof(MrvlIEtypesHeader_t); + wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN + + sizeof(wapi_param)); cmd->size = - wlan_cpu_to_le16(key_param_len + - sizeof(pkey_material->action) + - S_DS_GEN); + wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + + S_DS_GEN + KEY_PARAMS_FIXED_LEN + + sizeof(wapi_param) + + sizeof(pkey_material->action)); + PRINTM(MCMND, "Set WAPI Key\n"); goto done; } - /* IGTK key length is the same as AES key length */ - if (pkey->key_len == WPA_AES_KEY_LEN && - !(pkey->key_flags & KEY_FLAG_AES_MCAST_IGTK)) { - PRINTM(MCMND, "WPA_AES\n"); - pkey_material->key_param_set.key_type_id = - wlan_cpu_to_le16(KEY_TYPE_ID_AES); - if (cmd_oid == KEY_INFO_ENABLED) - pkey_material->key_param_set.key_info = - KEY_INFO_AES_ENABLED; - else - pkey_material->key_param_set.key_info = 0; - - if (pkey->key_index & MLAN_KEY_INDEX_UNICAST) /* AES pairwise - key: unicast - */ + if (pmpriv->bss_mode == MLAN_BSS_MODE_INFRA) { + /* Enable default key for WPA/WPA2 */ + if (!pmpriv->wpa_is_gtk_set) pkey_material->key_param_set.key_info |= - KEY_INFO_AES_UNICAST; - else /* AES group key: multicast */ + KEY_INFO_DEFAULT_KEY; + } else { + pkey_material->key_param_set.key_info |= KEY_INFO_DEFAULT_KEY; + /* Enable unicast bit for WPA-NONE/ADHOC_AES */ + if ((!pmpriv->sec_info.wpa2_enabled) && + (pkey->key_flags & KEY_FLAG_SET_TX_KEY)) pkey_material->key_param_set.key_info |= - KEY_INFO_AES_MCAST; - /** pass key index to BIT(6) and BIT(7) */ - pkey_material->key_param_set.key_info |= - (pkey->key_index & 0x03) << 6; - pkey_material->key_param_set.key_info = - wlan_cpu_to_le16(pkey_material->key_param_set.key_info); - } else if ((pkey->key_flags & KEY_FLAG_AES_MCAST_IGTK) && - pkey->key_len == WPA_IGTK_KEY_LEN) { - PRINTM(MCMND, "WPA_AES_CMAC\n"); - pkey_material->key_param_set.key_type_id = - wlan_cpu_to_le16(KEY_TYPE_ID_AES_CMAC); - if (cmd_oid == KEY_INFO_ENABLED) - pkey_material->key_param_set.key_info = - wlan_cpu_to_le16(KEY_INFO_AES_ENABLED); - else - pkey_material->key_param_set.key_info = - !(wlan_cpu_to_le16(KEY_INFO_AES_ENABLED)); - + KEY_INFO_UCAST_KEY; + } + pkey_material->key_param_set.key_info = + wlan_cpu_to_le16(pkey_material->key_param_set.key_info); + if (pkey->key_len == WPA_AES_KEY_LEN && + !(pkey->key_flags & KEY_FLAG_AES_MCAST_IGTK)) { + if (pkey-> + key_flags & (KEY_FLAG_RX_SEQ_VALID | KEY_FLAG_TX_SEQ_VALID)) + memcpy(pmpriv->adapter, + pkey_material->key_param_set.key_params.aes.pn, + pkey->pn, SEQ_MAX_SIZE); + pkey_material->key_param_set.key_type = KEY_TYPE_ID_AES; + pkey_material->key_param_set.key_params.aes.key_len = + wlan_cpu_to_le16(pkey->key_len); + memcpy(pmpriv->adapter, + pkey_material->key_param_set.key_params.aes.key, + pkey->key_material, pkey->key_len); + pkey_material->key_param_set.length = + wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN + + sizeof(aes_param)); + cmd->size = + wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + + S_DS_GEN + KEY_PARAMS_FIXED_LEN + + sizeof(aes_param) + + sizeof(pkey_material->action)); + PRINTM(MCMND, "Set AES Key\n"); + goto done; + } + if (pkey->key_len == WPA_IGTK_KEY_LEN && + (pkey->key_flags & KEY_FLAG_AES_MCAST_IGTK)) { + if (pkey-> + key_flags & (KEY_FLAG_RX_SEQ_VALID | KEY_FLAG_TX_SEQ_VALID)) + memcpy(pmpriv->adapter, + pkey_material->key_param_set.key_params.cmac_aes. + ipn, pkey->pn, SEQ_MAX_SIZE); + pkey_material->key_param_set.key_info &= ~KEY_INFO_MCAST_KEY; pkey_material->key_param_set.key_info |= wlan_cpu_to_le16(KEY_INFO_AES_MCAST_IGTK); - } else if (pkey->key_len == WPA_TKIP_KEY_LEN) { - PRINTM(MCMND, "WPA_TKIP\n"); - pkey_material->key_param_set.key_type_id = - wlan_cpu_to_le16(KEY_TYPE_ID_TKIP); - pkey_material->key_param_set.key_info = KEY_INFO_TKIP_ENABLED; - if (pkey->key_index & MLAN_KEY_INDEX_UNICAST) /* TKIP - pairwise - key: unicast - */ - pkey_material->key_param_set.key_info |= - KEY_INFO_TKIP_UNICAST; - else /* TKIP group key: multicast */ - pkey_material->key_param_set.key_info |= - KEY_INFO_TKIP_MCAST; - /** pass key index to BIT(6) and BIT(7) */ - pkey_material->key_param_set.key_info |= - (pkey->key_index & 0x03) << 6; - pkey_material->key_param_set.key_info = - wlan_cpu_to_le16(pkey_material->key_param_set.key_info); + pkey_material->key_param_set.key_type = KEY_TYPE_ID_AES_CMAC; + pkey_material->key_param_set.key_params.cmac_aes.key_len = + wlan_cpu_to_le16(pkey->key_len); + memcpy(pmpriv->adapter, + pkey_material->key_param_set.key_params.cmac_aes.key, + pkey->key_material, pkey->key_len); + pkey_material->key_param_set.length = + wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN + + sizeof(cmac_aes_param)); + cmd->size = + wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + + S_DS_GEN + KEY_PARAMS_FIXED_LEN + + sizeof(cmac_aes_param) + + sizeof(pkey_material->action)); + PRINTM(MCMND, "Set CMAC AES Key\n"); + goto done; } - - if (pkey_material->key_param_set.key_type_id) { - pkey_material->key_param_set.type = - wlan_cpu_to_le16(TLV_TYPE_KEY_MATERIAL); - pkey_material->key_param_set.key_len = - wlan_cpu_to_le16((t_u16) pkey->key_len); - memcpy(pmpriv->adapter, pkey_material->key_param_set.key, + if (pkey->key_len == WPA_TKIP_KEY_LEN) { + if (pkey-> + key_flags & (KEY_FLAG_RX_SEQ_VALID | KEY_FLAG_TX_SEQ_VALID)) + memcpy(pmpriv->adapter, + pkey_material->key_param_set.key_params.tkip.pn, + pkey->pn, SEQ_MAX_SIZE); + pkey_material->key_param_set.key_type = KEY_TYPE_ID_TKIP; + pkey_material->key_param_set.key_params.tkip.key_len = + wlan_cpu_to_le16(pkey->key_len); + memcpy(pmpriv->adapter, + pkey_material->key_param_set.key_params.tkip.key, pkey->key_material, pkey->key_len); pkey_material->key_param_set.length = - wlan_cpu_to_le16((t_u16) pkey->key_len + - KEYPARAMSET_FIXED_LEN); - key_param_len = - (t_u16) (pkey->key_len + KEYPARAMSET_FIXED_LEN) + - sizeof(MrvlIEtypesHeader_t); - - /* key format with pn field is defined in Key Material V1 */ - if (pkey_material->key_param_set.key_type_id == - wlan_cpu_to_le16(KEY_TYPE_ID_AES_CMAC)) { - cmac_param *param; - param = (cmac_param *) pkey_material->key_param_set.key; - memcpy(pmpriv->adapter, param->ipn, pkey->pn, - SEQ_MAX_SIZE); - memcpy(pmpriv->adapter, param->key, pkey->key_material, - pkey->key_len); - - pkey_material->key_param_set.key_len = - wlan_cpu_to_le16((t_u16) sizeof(cmac_param)); - pkey_material->key_param_set.length = - wlan_cpu_to_le16((t_u16) sizeof(cmac_param) + - KEYPARAMSET_FIXED_LEN); - key_param_len = - (t_u16) (sizeof(cmac_param) + - KEYPARAMSET_FIXED_LEN) + - sizeof(MrvlIEtypesHeader_t); - } - + wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN + + sizeof(tkip_param)); cmd->size = - wlan_cpu_to_le16(key_param_len + - sizeof(pkey_material->action) + - S_DS_GEN); + wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + + S_DS_GEN + KEY_PARAMS_FIXED_LEN + + sizeof(tkip_param) + + sizeof(pkey_material->action)); + PRINTM(MCMND, "Set TKIP Key\n"); } done: LEAVE(); @@ -1353,13 +1307,536 @@ wlan_cmd_mgmt_ie_list(IN pmlan_private pmpriv, } /** + * @brief This function prepares command of TDLS configuration. + * + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param cmd_action The action: GET or SET + * @param pdata_buf A pointer to data buffer + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +static mlan_status +wlan_cmd_tdls_config(IN pmlan_private pmpriv, + IN HostCmd_DS_COMMAND * cmd, + IN t_u16 cmd_action, IN t_void * pdata_buf) +{ + t_u16 travel_len = 0; + mlan_ds_misc_tdls_config *tdls_config = MNULL; + tdls_all_config *tdls_all_cfg = MNULL; + HostCmd_DS_TDLS_CONFIG *ptdls_config_data = + &(cmd->params.tdls_config_data); + t_u8 zero_mac[] = { 0, 0, 0, 0, 0, 0 }; + + ENTER(); + + cmd->command = wlan_cpu_to_le16(HostCmd_CMD_TDLS_CONFIG); + cmd->size = sizeof(HostCmd_DS_TDLS_CONFIG) + S_DS_GEN; + cmd->result = 0; + + tdls_config = (mlan_ds_misc_tdls_config *) pdata_buf; + ptdls_config_data->tdls_info.tdls_action = + wlan_cpu_to_le16(tdls_config->tdls_action); + + tdls_all_cfg = (tdls_all_config *) tdls_config->tdls_data; + + switch (tdls_config->tdls_action) { + case WLAN_TDLS_CONFIG: + travel_len = sizeof(tdls_all_cfg->u.tdls_config); + tdls_all_cfg->u.tdls_config.enable = + wlan_cpu_to_le16(tdls_all_cfg->u.tdls_config.enable); + memcpy(pmpriv->adapter, ptdls_config_data->tdls_info.tdls_data, + &tdls_all_cfg->u.tdls_setup, travel_len); + break; + + case WLAN_TDLS_SET_INFO: + travel_len = tdls_all_cfg->u.tdls_set.tlv_length; + if ((travel_len + sizeof(t_u16)) > MAX_TDLS_DATA_LEN) { + PRINTM(MERROR, "TDLS configuration overflow\n"); + LEAVE(); + return MLAN_STATUS_FAILURE; + } + memcpy(pmpriv->adapter, ptdls_config_data->tdls_info.tdls_data, + (t_u8 *) & tdls_all_cfg->u.tdls_set.cap_info, + sizeof(t_u16)); + memcpy(pmpriv->adapter, + (t_u8 *) ptdls_config_data->tdls_info.tdls_data + + sizeof(t_u16), &tdls_all_cfg->u.tdls_set.tlv_buffer, + travel_len); + travel_len += sizeof(t_u16); + break; + case WLAN_TDLS_DISCOVERY_REQ: + travel_len = MLAN_MAC_ADDR_LENGTH; + memcpy(pmpriv->adapter, ptdls_config_data->tdls_info.tdls_data, + tdls_all_cfg->u.tdls_discovery.peer_mac_addr, + travel_len); + break; + + case WLAN_TDLS_SETUP_REQ: + travel_len = sizeof(tdls_all_cfg->u.tdls_setup); + tdls_all_cfg->u.tdls_setup.setup_timeout = + wlan_cpu_to_le32(tdls_all_cfg->u.tdls_setup. + setup_timeout); + tdls_all_cfg->u.tdls_setup.key_lifetime = + wlan_cpu_to_le32(tdls_all_cfg->u.tdls_setup. + key_lifetime); + memcpy(pmpriv->adapter, ptdls_config_data->tdls_info.tdls_data, + &tdls_all_cfg->u.tdls_setup, travel_len); + break; + + case WLAN_TDLS_TEAR_DOWN_REQ: + travel_len = sizeof(tdls_all_cfg->u.tdls_tear_down); + tdls_all_cfg->u.tdls_tear_down.reason_code = + wlan_cpu_to_le16(tdls_all_cfg->u.tdls_tear_down. + reason_code); + memcpy(pmpriv->adapter, ptdls_config_data->tdls_info.tdls_data, + &tdls_all_cfg->u.tdls_tear_down, travel_len); + break; + case WLAN_TDLS_STOP_CHAN_SWITCH: + travel_len = MLAN_MAC_ADDR_LENGTH; + memcpy(pmpriv->adapter, ptdls_config_data->tdls_info.tdls_data, + tdls_all_cfg->u.tdls_stop_chan_switch.peer_mac_addr, + travel_len); + break; + case WLAN_TDLS_INIT_CHAN_SWITCH: + travel_len = sizeof(tdls_all_cfg->u.tdls_chan_switch); + tdls_all_cfg->u.tdls_chan_switch.switch_time = + wlan_cpu_to_le16(tdls_all_cfg->u.tdls_chan_switch. + switch_time); + tdls_all_cfg->u.tdls_chan_switch.switch_timeout = + wlan_cpu_to_le16(tdls_all_cfg->u.tdls_chan_switch. + switch_timeout); + memcpy(pmpriv->adapter, ptdls_config_data->tdls_info.tdls_data, + &tdls_all_cfg->u.tdls_chan_switch, travel_len); + break; + case WLAN_TDLS_CS_PARAMS: + travel_len = sizeof(tdls_all_cfg->u.tdls_cs_params); + memcpy(pmpriv->adapter, ptdls_config_data->tdls_info.tdls_data, + &tdls_all_cfg->u.tdls_cs_params, travel_len); + break; + case WLAN_TDLS_CS_DISABLE: + travel_len = sizeof(tdls_all_cfg->u.tdls_disable_cs); + tdls_all_cfg->u.tdls_disable_cs.data = + wlan_cpu_to_le16(tdls_all_cfg->u.tdls_disable_cs.data); + memcpy(pmpriv->adapter, ptdls_config_data->tdls_info.tdls_data, + &tdls_all_cfg->u.tdls_disable_cs, travel_len); + break; + case WLAN_TDLS_POWER_MODE: + travel_len = sizeof(tdls_all_cfg->u.tdls_power_mode); + tdls_all_cfg->u.tdls_power_mode.power_mode = + wlan_cpu_to_le16(tdls_all_cfg->u.tdls_power_mode. + power_mode); + memcpy(pmpriv->adapter, ptdls_config_data->tdls_info.tdls_data, + &tdls_all_cfg->u.tdls_power_mode, travel_len); + break; + + case WLAN_TDLS_LINK_STATUS: + travel_len = 0; + if (memcmp + (pmpriv->adapter, + tdls_all_cfg->u.tdls_link_status_req.peer_mac_addr, + zero_mac, sizeof(zero_mac))) { + travel_len = + sizeof(tdls_all_cfg->u.tdls_link_status_req); + memcpy(pmpriv->adapter, + ptdls_config_data->tdls_info.tdls_data, + tdls_all_cfg->u.tdls_link_status_req. + peer_mac_addr, travel_len); + } + break; + + case WLAN_TDLS_DEBUG_ALLOW_WEAK_SECURITY: + case WLAN_TDLS_DEBUG_SETUP_SAME_LINK: + case WLAN_TDLS_DEBUG_FAIL_SETUP_CONFIRM: + case WLAN_TDLS_DEBUG_WRONG_BSS: + case WLAN_TDLS_DEBUG_SETUP_PROHIBITED: + case WLAN_TDLS_DEBUG_HIGHER_LOWER_MAC: + case WLAN_TDLS_DEBUG_IGNORE_KEY_EXPIRY: + case WLAN_TDLS_DEBUG_STOP_RX: + case WLAN_TDLS_DEBUG_CS_RET_IM: + travel_len = sizeof(tdls_all_cfg->u.tdls_debug_data); + tdls_all_cfg->u.tdls_debug_data.debug_data = + wlan_cpu_to_le16(tdls_all_cfg->u.tdls_debug_data. + debug_data); + memcpy(pmpriv->adapter, ptdls_config_data->tdls_info.tdls_data, + &tdls_all_cfg->u.tdls_debug_data, travel_len); + break; + + default: + LEAVE(); + return MLAN_STATUS_FAILURE; + } + + cmd->size += travel_len; + cmd->size -= MAX_TDLS_DATA_LEN; + cmd->size = wlan_cpu_to_le16(cmd->size); + + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + +/** + * @brief This function prepares command of TDLS create/config/delete + * + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param cmd_action The action: GET or SET + * @param pdata_buf A pointer to data buffer + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +static mlan_status +wlan_cmd_tdls_oper(IN pmlan_private pmpriv, + IN HostCmd_DS_COMMAND * cmd, + IN t_u16 cmd_action, IN t_void * pdata_buf) +{ + t_u16 travel_len = 0; + mlan_ds_misc_tdls_oper *tdls_oper = MNULL; + HostCmd_DS_TDLS_OPER *ptdls_oper = &(cmd->params.tdls_oper_data); + sta_node *sta_ptr; + t_u8 *pos; + MrvlIEtypes_RatesParamSet_t *Rate_tlv = MNULL; + MrvlIETypes_HTCap_t *HTcap_tlv = MNULL; + MrvlIETypes_HTInfo_t *HTInfo_tlv = MNULL; + MrvlIETypes_2040BSSCo_t *BSSCo = MNULL; + MrvlIETypes_ExtCap_t *ExCap = MNULL; + MrvlIEtypes_RsnParamSet_t *Rsn_ie = MNULL; + MrvlIETypes_qosinfo_t *qos_info = MNULL; + BSSDescriptor_t *pbss_desc = &pmpriv->curr_bss_params.bss_descriptor; + MrvlIETypes_VHTCap_t *VHTcap_tlv = MNULL; + MrvlIETypes_VHTOprat_t *VHTOper_tlv = MNULL; + MrvlIETypes_AID_t *AidInfo = MNULL; + MrvlIEtypes_TDLS_Idle_Timeout_t *TdlsIdleTimeout = MNULL; + + ENTER(); + + cmd->command = wlan_cpu_to_le16(HostCmd_CMD_TDLS_OPERATION); + cmd->size = sizeof(HostCmd_DS_TDLS_OPER) + S_DS_GEN; + cmd->result = 0; + + tdls_oper = (mlan_ds_misc_tdls_oper *) pdata_buf; + ptdls_oper->reason = 0; + memcpy(pmpriv->adapter, ptdls_oper->peer_mac, tdls_oper->peer_mac, + MLAN_MAC_ADDR_LENGTH); + sta_ptr = wlan_get_station_entry(pmpriv, tdls_oper->peer_mac); + pos = (t_u8 *) ptdls_oper + sizeof(HostCmd_DS_TDLS_OPER); + switch (tdls_oper->tdls_action) { + case WLAN_TDLS_CREATE_LINK: + if (sta_ptr) + sta_ptr->status = TDLS_SETUP_INPROGRESS; + ptdls_oper->tdls_action = wlan_cpu_to_le16(TDLS_CREATE); + break; + case WLAN_TDLS_CONFIG_LINK: + if (sta_ptr) { + ptdls_oper->tdls_action = wlan_cpu_to_le16(TDLS_CONFIG); + /* capability */ + if (tdls_oper->capability) + *(t_u16 *) pos = + wlan_cpu_to_le16(tdls_oper->capability); + else + *(t_u16 *) pos = + wlan_cpu_to_le16(sta_ptr->capability); + travel_len += sizeof(sta_ptr->capability); + + /* qos_info */ + qos_info = (MrvlIETypes_qosinfo_t *) (pos + travel_len); + qos_info->header.type = wlan_cpu_to_le16(QOS_INFO); + qos_info->header.len = wlan_cpu_to_le16(sizeof(t_u8)); + if (tdls_oper->qos_info) + qos_info->qos_info = tdls_oper->qos_info; + else + qos_info->qos_info = sta_ptr->qos_info; + travel_len += sizeof(MrvlIETypes_qosinfo_t); + + /* supported rate */ + Rate_tlv = + (MrvlIEtypes_RatesParamSet_t *) (pos + + travel_len); + Rate_tlv->header.type = + wlan_cpu_to_le16(TLV_TYPE_RATES); + if (tdls_oper->supported_rates && + tdls_oper->supported_rates_len) { + Rate_tlv->header.len = + wlan_cpu_to_le16(tdls_oper-> + supported_rates_len); + memcpy(pmpriv->adapter, + pos + travel_len + + sizeof(MrvlIEtypesHeader_t), + tdls_oper->supported_rates, + tdls_oper->supported_rates_len); + travel_len += + sizeof(MrvlIEtypesHeader_t) + + tdls_oper->supported_rates_len; + } else { + Rate_tlv->header.len = + wlan_cpu_to_le16(sta_ptr->rate_len); + memcpy(pmpriv->adapter, + pos + travel_len + + sizeof(MrvlIEtypesHeader_t), + sta_ptr->support_rate, + Rate_tlv->header.len); + travel_len += + sizeof(MrvlIEtypesHeader_t) + + sta_ptr->rate_len; + } + + /* Extended capability */ + if (tdls_oper->ext_capab && tdls_oper->ext_capab_len) { + ExCap = (MrvlIETypes_ExtCap_t *) (pos + + travel_len); + ExCap->header.type = + wlan_cpu_to_le16(TLV_TYPE_EXTCAP); + ExCap->header.len = + wlan_cpu_to_le16(tdls_oper-> + ext_capab_len); + memcpy(pmpriv->adapter, + pos + travel_len + + sizeof(MrvlIEtypesHeader_t), + tdls_oper->ext_capab, + tdls_oper->ext_capab_len); + travel_len += + sizeof(MrvlIEtypesHeader_t) + + tdls_oper->ext_capab_len; + } else if (sta_ptr->ExtCap.ieee_hdr.element_id == + EXT_CAPABILITY) { + ExCap = (MrvlIETypes_ExtCap_t *) (pos + + travel_len); + ExCap->header.type = + wlan_cpu_to_le16(TLV_TYPE_EXTCAP); + ExCap->header.len = + wlan_cpu_to_le16(sta_ptr->ExtCap. + ieee_hdr.len); + memcpy(pmpriv->adapter, &ExCap->ext_cap, + &sta_ptr->ExtCap.ext_cap, + sta_ptr->ExtCap.ieee_hdr.len); + travel_len += + sta_ptr->ExtCap.ieee_hdr.len + + sizeof(MrvlIEtypesHeader_t); + } + + /* RSN ie */ + if (sta_ptr->rsn_ie.ieee_hdr.element_id == RSN_IE) { + Rsn_ie = (MrvlIEtypes_RsnParamSet_t *) (pos + + travel_len); + Rsn_ie->header.type = + wlan_cpu_to_le16(sta_ptr->rsn_ie. + ieee_hdr.element_id); + Rsn_ie->header.len = + wlan_cpu_to_le16(sta_ptr->rsn_ie. + ieee_hdr.len); + memcpy(pmpriv->adapter, Rsn_ie->rsn_ie, + sta_ptr->rsn_ie.data, + sta_ptr->rsn_ie.ieee_hdr.len); + travel_len += + sta_ptr->rsn_ie.ieee_hdr.len + + sizeof(MrvlIEtypesHeader_t); + } + + /* HT capability */ + if (tdls_oper->ht_capa) { + HTcap_tlv = + (MrvlIETypes_HTCap_t *) (pos + + travel_len); + HTcap_tlv->header.type = + wlan_cpu_to_le16(TLV_TYPE_HT_CAP); + HTcap_tlv->header.len = + wlan_cpu_to_le16(sizeof(HTCap_t)); + memcpy(pmpriv->adapter, &HTcap_tlv->ht_cap, + tdls_oper->ht_capa, sizeof(HTCap_t)); + travel_len += + sizeof(HTCap_t) + + sizeof(MrvlIEtypesHeader_t); + } else if (sta_ptr->HTcap.ieee_hdr.element_id == + HT_CAPABILITY) { + HTcap_tlv = + (MrvlIETypes_HTCap_t *) (pos + + travel_len); + HTcap_tlv->header.type = + wlan_cpu_to_le16(TLV_TYPE_HT_CAP); + HTcap_tlv->header.len = + wlan_cpu_to_le16(sta_ptr->HTcap. + ieee_hdr.len); + memcpy(pmpriv->adapter, &HTcap_tlv->ht_cap, + &sta_ptr->HTcap.ht_cap, + sta_ptr->HTcap.ieee_hdr.len); + travel_len += + sta_ptr->HTcap.ieee_hdr.len + + sizeof(MrvlIEtypesHeader_t); + } + if (HTcap_tlv) { + wlan_fill_ht_cap_tlv(pmpriv, HTcap_tlv, + pbss_desc->bss_band); + DBG_HEXDUMP(MCMD_D, "FW htcap", + (t_u8 *) HTcap_tlv, + sizeof(MrvlIETypes_HTCap_t)); + } + + /* HT info */ + if (sta_ptr->HTInfo.ieee_hdr.element_id == HT_OPERATION) { + HTInfo_tlv = + (MrvlIETypes_HTInfo_t *) (pos + + travel_len); + HTInfo_tlv->header.type = + wlan_cpu_to_le16(TLV_TYPE_HT_INFO); + HTInfo_tlv->header.len = + wlan_cpu_to_le16(sta_ptr->HTInfo. + ieee_hdr.len); + memcpy(pmpriv->adapter, &HTInfo_tlv->ht_info, + &sta_ptr->HTInfo.ht_info, + sta_ptr->HTInfo.ieee_hdr.len); + travel_len += + sta_ptr->HTInfo.ieee_hdr.len + + sizeof(MrvlIEtypesHeader_t); + DBG_HEXDUMP(MCMD_D, "HT Info", + (t_u8 *) HTInfo_tlv, + sizeof(MrvlIETypes_HTInfo_t)); + } + /* 20/40 BSS co-exist */ + if (sta_ptr->BSSCO_20_40.ieee_hdr.element_id == + BSSCO_2040) { + BSSCo = (MrvlIETypes_2040BSSCo_t *) (pos + + travel_len); + BSSCo->header.type = + wlan_cpu_to_le16 + (TLV_TYPE_2040BSS_COEXISTENCE); + BSSCo->header.len = + wlan_cpu_to_le16(sta_ptr->BSSCO_20_40. + ieee_hdr.len); + memcpy(pmpriv->adapter, &BSSCo->bss_co_2040, + &sta_ptr->BSSCO_20_40.bss_co_2040, + sta_ptr->BSSCO_20_40.ieee_hdr.len); + travel_len += + sta_ptr->BSSCO_20_40.ieee_hdr.len + + sizeof(MrvlIEtypesHeader_t); + } + // Check if we need enable the 11AC + if (sta_ptr && + sta_ptr->vht_oprat.ieee_hdr.element_id == + VHT_OPERATION) { + /** AID */ + if (sta_ptr->aid_info.ieee_hdr.element_id == + AID_INFO) { + AidInfo = + (MrvlIETypes_AID_t *) (pos + + travel_len); + AidInfo->header.type = + wlan_cpu_to_le16(AID_INFO); + AidInfo->header.len = + wlan_cpu_to_le16(sta_ptr-> + aid_info. + ieee_hdr.len); + AidInfo->AID = + wlan_cpu_to_le16(sta_ptr-> + aid_info.AID); + } + /* Vht capability */ + if (tdls_oper->vht_cap) { + VHTcap_tlv = + (MrvlIETypes_VHTCap_t *) (pos + + travel_len); + VHTcap_tlv->header.type = + wlan_cpu_to_le16 + (VHT_CAPABILITY); + VHTcap_tlv->header.len = + wlan_cpu_to_le16(sizeof + (VHT_capa_t)); + memcpy(pmpriv->adapter, + &VHTcap_tlv->vht_cap, + tdls_oper->vht_cap, + sizeof(VHT_capa_t)); + travel_len += + sizeof(MrvlIETypes_VHTCap_t); + } else if (sta_ptr->vht_cap.ieee_hdr. + element_id == VHT_CAPABILITY) { + VHTcap_tlv = + (MrvlIETypes_VHTCap_t *) (pos + + travel_len); + VHTcap_tlv->header.type = + wlan_cpu_to_le16 + (VHT_CAPABILITY); + VHTcap_tlv->header.len = + wlan_cpu_to_le16(sta_ptr-> + vht_cap. + ieee_hdr.len); + memcpy(pmpriv->adapter, + &VHTcap_tlv->vht_cap, + &sta_ptr->vht_cap.vht_cap, + sta_ptr->vht_cap.ieee_hdr.len); + travel_len += + sta_ptr->vht_cap.ieee_hdr.len + + sizeof(MrvlIEtypesHeader_t); + } + if (VHTcap_tlv) { + wlan_fill_vht_cap_tlv(pmpriv, + VHTcap_tlv, + pbss_desc-> + bss_band); + DBG_HEXDUMP(MCMD_D, "FW Vhtcap", + (t_u8 *) VHTcap_tlv, + sizeof + (MrvlIETypes_VHTCap_t)); + } + + /* Vht operation */ + VHTOper_tlv = + (MrvlIETypes_VHTOprat_t *) (pos + + travel_len); + VHTOper_tlv->header.type = + wlan_cpu_to_le16(VHT_OPERATION); + VHTOper_tlv->header.len = + wlan_cpu_to_le16(sta_ptr->vht_oprat. + ieee_hdr.len); + memcpy(pmpriv->adapter, + &VHTOper_tlv->chan_width, + &sta_ptr->vht_oprat.chan_width, + sta_ptr->vht_oprat.ieee_hdr.len); + VHTOper_tlv->basic_MCS_map = + wlan_cpu_to_le16(VHTOper_tlv-> + basic_MCS_map); + travel_len += + sta_ptr->vht_oprat.ieee_hdr.len + + sizeof(MrvlIEtypesHeader_t); + DBG_HEXDUMP(MCMD_D, "VHT operation", + (t_u8 *) VHTOper_tlv, + sizeof(MrvlIETypes_VHTOprat_t)); + } + TdlsIdleTimeout = + (MrvlIEtypes_TDLS_Idle_Timeout_t *) (pos + + travel_len); + TdlsIdleTimeout->header.type = + wlan_cpu_to_le16(TLV_TYPE_TDLS_IDLE_TIMEOUT); + TdlsIdleTimeout->header.len = + sizeof(TdlsIdleTimeout->value); + TdlsIdleTimeout->header.len = + wlan_cpu_to_le16(TdlsIdleTimeout->header.len); + TdlsIdleTimeout->value = + wlan_cpu_to_le16(TDLS_IDLE_TIMEOUT); + travel_len += sizeof(MrvlIEtypes_TDLS_Idle_Timeout_t); + } + break; + case WLAN_TDLS_DISABLE_LINK: + if (sta_ptr) + sta_ptr->status = TDLS_TEAR_DOWN; + ptdls_oper->tdls_action = wlan_cpu_to_le16(TDLS_DELETE); + break; + default: + break; + } + cmd->size += travel_len; + cmd->size = wlan_cpu_to_le16(cmd->size); + + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + +/** * @brief This function prepares system clock cfg command * - * @param pmpriv A pointer to mlan_private structure - * @param cmd A pointer to HostCmd_DS_COMMAND structure - * @param cmd_action The action: GET or SET - * @param pdata_buf A pointer to data buffer - * @return MLAN_STATUS_SUCCESS + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param cmd_action The action: GET or SET + * @param pdata_buf A pointer to data buffer + * @return MLAN_STATUS_SUCCESS */ static mlan_status wlan_cmd_sysclock_cfg(IN pmlan_private pmpriv, @@ -1392,7 +1869,7 @@ wlan_cmd_sysclock_cfg(IN pmlan_private pmpriv, /** * @brief This function prepares command of subscribe event. * - * @param pmpriv A pointer to mlan_private structure + * @param pmpriv A pointer to mlan_private structure * @param cmd A pointer to HostCmd_DS_COMMAND structure * @param cmd_action the action: GET or SET * @param pdata_buf A pointer to data buffer @@ -1595,7 +2072,7 @@ done: /** * @brief This function prepares command of OTP user data. * - * @param pmpriv A pointer to mlan_private structure + * @param pmpriv A pointer to mlan_private structure * @param cmd A pointer to HostCmd_DS_COMMAND structure * @param cmd_action the action: GET or SET * @param pdata_buf A pointer to data buffer @@ -1765,7 +2242,8 @@ wlan_ops_sta_prepare_cmd(IN t_void * priv, ret = wlan_cmd_802_11_associate(pmpriv, cmd_ptr, pdata_buf); break; case HostCmd_CMD_802_11_DEAUTHENTICATE: - ret = wlan_cmd_802_11_deauthenticate(pmpriv, cmd_ptr, + case HostCmd_CMD_802_11_DISASSOCIATE: + ret = wlan_cmd_802_11_deauthenticate(pmpriv, cmd_no, cmd_ptr, pdata_buf); break; case HostCmd_CMD_802_11_AD_HOC_START: @@ -1926,6 +2404,17 @@ wlan_ops_sta_prepare_cmd(IN t_void * priv, ret = wlan_cmd_mgmt_ie_list(pmpriv, cmd_ptr, cmd_action, pdata_buf); break; + case HostCmd_CMD_TDLS_CONFIG: + ret = wlan_cmd_tdls_config(pmpriv, cmd_ptr, cmd_action, + pdata_buf); + break; + case HostCmd_CMD_TDLS_OPERATION: + ret = wlan_cmd_tdls_oper(pmpriv, cmd_ptr, cmd_action, + pdata_buf); + break; + case HostCmd_CMD_802_11_SCAN_EXT: + ret = wlan_cmd_802_11_scan_ext(pmpriv, cmd_ptr, pdata_buf); + break; case HostCmd_CMD_ECL_SYSTEM_CLOCK_CONFIG: ret = wlan_cmd_sysclock_cfg(pmpriv, cmd_ptr, cmd_action, pdata_buf); diff --git a/drivers/net/wireless/sd8897/mlan/mlan_sta_cmdresp.c b/drivers/net/wireless/sd8897/mlan/mlan_sta_cmdresp.c index 3b3c3967bfd6..8d0c7e2926e0 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_sta_cmdresp.c +++ b/drivers/net/wireless/sd8897/mlan/mlan_sta_cmdresp.c @@ -52,6 +52,54 @@ Change log: /******************************************************** Local Functions ********************************************************/ +/** + * @brief This function handles the command response error for TDLS operation + * + * @param pmpriv A pointer to mlan_private structure + * @param resp A pointer to HostCmd_DS_COMMAND + * + * @return N/A + */ +static void +wlan_process_cmdreps_error_tdls_operation(mlan_private * pmpriv, + HostCmd_DS_COMMAND * resp) +{ + HostCmd_DS_TDLS_OPER *ptdls_oper_data = &(resp->params.tdls_oper_data); + sta_node *sta_ptr = MNULL; + t_u16 reason; + + ENTER(); + ptdls_oper_data->tdls_action = + wlan_le16_to_cpu(ptdls_oper_data->tdls_action); + reason = wlan_le16_to_cpu(ptdls_oper_data->reason); + sta_ptr = wlan_get_station_entry(pmpriv, ptdls_oper_data->peer_mac); + switch (ptdls_oper_data->tdls_action) { + case TDLS_CREATE: + /* TDLS create command error */ + PRINTM(MERROR, + "TDLS CREATE operation: command error, reason %d\n", + reason); + if (reason != TDLS_LINK_EXISTS && sta_ptr) + sta_ptr->status = TDLS_SETUP_FAILURE; + break; + case TDLS_CONFIG: + /* TDLS config command error */ + PRINTM(MERROR, + "TDLS CONFIG operation: command error, reason %d\n", + reason); + if (sta_ptr) + sta_ptr->status = TDLS_SETUP_FAILURE; + break; + case TDLS_DELETE: + /* TDLS delete command error */ + PRINTM(MERROR, + "TDLS DELETE operation: command error, reason %d\n", + reason); + break; + } + LEAVE(); + return; +} /** * @brief This function handles the command response error @@ -67,6 +115,9 @@ wlan_process_cmdresp_error(mlan_private * pmpriv, HostCmd_DS_COMMAND * resp, mlan_ioctl_req * pioctl_buf) { mlan_adapter *pmadapter = pmpriv->adapter; + tdls_all_config *tdls_all_cfg = MNULL; + HostCmd_DS_TDLS_CONFIG *ptdls_config_data = + &(resp->params.tdls_config_data); ENTER(); @@ -93,6 +144,7 @@ wlan_process_cmdresp_error(mlan_private * pmpriv, HostCmd_DS_COMMAND * resp, pmadapter->ps_mode = Wlan802_11PowerModeCAM; } break; + case HostCmd_CMD_802_11_SCAN_EXT: case HostCmd_CMD_802_11_SCAN: /* Cancel all pending scan command */ wlan_flush_scan_queue(pmadapter); @@ -102,6 +154,38 @@ wlan_process_cmdresp_error(mlan_private * pmpriv, HostCmd_DS_COMMAND * resp, case HostCmd_CMD_MAC_CONTROL: break; + case HostCmd_CMD_TDLS_CONFIG: + ptdls_config_data->tdls_info.tdls_action = + wlan_le16_to_cpu(ptdls_config_data->tdls_info. + tdls_action); + switch (ptdls_config_data->tdls_info.tdls_action) { + case WLAN_TDLS_SETUP_REQ: + /* TDLS link setup error ;display error in logs */ + tdls_all_cfg = + (tdls_all_config *) ptdls_config_data-> + tdls_info.tdls_data; + PRINTM(MERROR, "TDLS Setup Failed, error %d\n", + wlan_le16_to_cpu(tdls_all_cfg->u.tdls_cmd_resp. + reason_code)); + break; + case WLAN_TDLS_INIT_CHAN_SWITCH: + tdls_all_cfg = + (tdls_all_config *) ptdls_config_data-> + tdls_info.tdls_data; + PRINTM(MERROR, + "TDLS init channel switch failed," MACSTR + ": reason=%d\n", + MAC2STR(tdls_all_cfg->u.tdls_cmd_resp. + peer_mac_addr), + wlan_le16_to_cpu(tdls_all_cfg->u.tdls_cmd_resp. + reason_code)); + break; + } + break; + case HostCmd_CMD_TDLS_OPERATION: + wlan_process_cmdreps_error_tdls_operation(pmpriv, resp); + break; + case HostCmd_CMD_802_11_ASSOCIATE: wlan_reset_connect_state(pmpriv, MTRUE); break; @@ -413,12 +497,10 @@ wlan_get_power_level(pmlan_private pmpriv, void *pdata_buf) } while (length) { pg++; - if (max_power < pg->power_max) { + if (max_power < pg->power_max) max_power = pg->power_max; - } - if (min_power > pg->power_min) { + if (min_power > pg->power_min) min_power = pg->power_min; - } length -= sizeof(Power_Group_t); } if (ppg_tlv->length > 0) { @@ -655,6 +737,7 @@ wlan_ret_802_11_sleep_period(IN pmlan_private pmpriv, + MLAN_SUB_COMMAND_SIZE; } pmpriv->adapter->sleep_period.period = sleep_pd; + pmpriv->adapter->saved_sleep_period.period = sleep_pd; pmpriv->adapter->pps_uapsd_mode = MFALSE; if ((pmpriv->adapter->sleep_period.period != 0) && @@ -863,61 +946,86 @@ wlan_ret_802_11_key_material(IN pmlan_private pmpriv, } else { if (pioctl_buf && (wlan_le16_to_cpu(pkey->key_param_set.type) == - TLV_TYPE_KEY_MATERIAL)) { - PRINTM(MIOCTL, - "key_type_id=%d, key_len=%d, key_info=0x%x\n", - wlan_le16_to_cpu(pkey->key_param_set. - key_type_id), - wlan_le16_to_cpu(pkey->key_param_set.key_len), - wlan_le16_to_cpu(pkey->key_param_set.key_info)); + TLV_TYPE_KEY_PARAM_V2)) { sec = (mlan_ds_sec_cfg *) pioctl_buf->pbuf; -#define WAPI_KEY_SIZE 32 - switch (wlan_le16_to_cpu - (pkey->key_param_set.key_type_id)) { - case KEY_TYPE_ID_WEP: - sec->param.encrypt_key.key_index = - pkey->key_param_set.key[0]; + memcpy(pmpriv->adapter, sec->param.encrypt_key.mac_addr, + pkey->key_param_set.mac_addr, + MLAN_MAC_ADDR_LENGTH); + sec->param.encrypt_key.key_index = + pkey->key_param_set.key_idx; + PRINTM(MIOCTL, + "key_type=%d, key_index=%d, key_info=0x%x " + MACSTR "\n", pkey->key_param_set.key_type, + pkey->key_param_set.key_idx, + wlan_le16_to_cpu(pkey->key_param_set.key_info), + MAC2STR(sec->param.encrypt_key.mac_addr)); + switch (pkey->key_param_set.key_type) { + case KEY_TYPE_ID_WAPI: + sec->param.encrypt_key.is_wapi_key = MTRUE; sec->param.encrypt_key.key_len = wlan_le16_to_cpu(pkey->key_param_set. + key_params.wapi. key_len); memcpy(pmpriv->adapter, sec->param.encrypt_key.key_material, - &pkey->key_param_set.key[2], + pkey->key_param_set.key_params.wapi.key, sec->param.encrypt_key.key_len); + memcpy(pmpriv->adapter, + sec->param.encrypt_key.pn, + pkey->key_param_set.key_params.wapi.pn, + PN_SIZE); break; case KEY_TYPE_ID_TKIP: sec->param.encrypt_key.key_len = wlan_le16_to_cpu(pkey->key_param_set. + key_params.tkip. key_len); memcpy(pmpriv->adapter, sec->param.encrypt_key.key_material, - pkey->key_param_set.key, + pkey->key_param_set.key_params.tkip.key, sec->param.encrypt_key.key_len); + memcpy(pmpriv->adapter, + sec->param.encrypt_key.pn, + pkey->key_param_set.key_params.tkip.pn, + WPA_PN_SIZE); break; case KEY_TYPE_ID_AES: - case KEY_TYPE_ID_AES_CMAC: sec->param.encrypt_key.key_len = wlan_le16_to_cpu(pkey->key_param_set. + key_params.aes. key_len); memcpy(pmpriv->adapter, sec->param.encrypt_key.key_material, - pkey->key_param_set.key, + pkey->key_param_set.key_params.aes.key, sec->param.encrypt_key.key_len); + memcpy(pmpriv->adapter, + sec->param.encrypt_key.pn, + pkey->key_param_set.key_params.aes.pn, + WPA_PN_SIZE); break; - case KEY_TYPE_ID_WAPI: - sec->param.encrypt_key.is_wapi_key = MTRUE; - sec->param.encrypt_key.key_index = - pkey->key_param_set.key[0]; - sec->param.encrypt_key.key_len = WAPI_KEY_SIZE; + case KEY_TYPE_ID_AES_CMAC: + sec->param.encrypt_key.key_len = + wlan_le16_to_cpu(pkey->key_param_set. + key_params.cmac_aes. + key_len); memcpy(pmpriv->adapter, sec->param.encrypt_key.key_material, - &pkey->key_param_set.key[2], - sec->param.encrypt_key.key_len); + pkey->key_param_set.key_params.cmac_aes. + key, sec->param.encrypt_key.key_len); memcpy(pmpriv->adapter, sec->param.encrypt_key.pn, - &pkey->key_param_set.key[2 + - WAPI_KEY_SIZE], - PN_SIZE); + pkey->key_param_set.key_params.cmac_aes. + ipn, IGTK_PN_SIZE); + break; + case KEY_TYPE_ID_WEP: + sec->param.encrypt_key.key_len = + wlan_le16_to_cpu(pkey->key_param_set. + key_params.wep. + key_len); + memcpy(pmpriv->adapter, + sec->param.encrypt_key.key_material, + pkey->key_param_set.key_params.wep.key, + sec->param.encrypt_key.key_len); break; } } @@ -1334,6 +1442,358 @@ wlan_ret_mgmt_ie_list(IN pmlan_private pmpriv, } /** + * @brief This function enable/disable tdls powermode + * + * @param pmpriv A pointer to mlan_private structure + * @param powermode 1--enable, 0--disable + * + * @return N/A + */ +static void +wlan_set_tdls_powermode(IN pmlan_private pmpriv, t_u8 powermode) +{ + ENTER(); + + if (powermode) { + pmpriv->wmm_qosinfo = DEFAULT_TDLS_WMM_QOS_INFO; + if (!pmpriv->adapter->sleep_period.period) + pmpriv->adapter->sleep_period.period = + DEFAULT_TDLS_SLEEP_PERIOD; + } else { + pmpriv->wmm_qosinfo = pmpriv->saved_wmm_qosinfo; + pmpriv->adapter->sleep_period.period = + pmpriv->adapter->saved_sleep_period.period; + } + pmpriv->adapter->pps_uapsd_mode = MFALSE; + if ((pmpriv->adapter->sleep_period.period != 0) && + (pmpriv->adapter->sleep_period.period != + SLEEP_PERIOD_RESERVED_FF)) { + pmpriv->adapter->gen_null_pkt = MTRUE; + } else { + pmpriv->adapter->delay_null_pkt = MFALSE; + pmpriv->adapter->gen_null_pkt = MFALSE; + } + LEAVE(); + return; +} + +/** + * @brief This function handles the command response of TDLS_CONFIG + * + * @param pmpriv A pointer to mlan_private structure + * @param resp A pointer to HostCmd_DS_COMMAND + * @param pioctl_buf A pointer to mlan_ioctl_req structure + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +static mlan_status +wlan_ret_tdls_config(IN pmlan_private pmpriv, + IN HostCmd_DS_COMMAND * resp, + OUT mlan_ioctl_req * pioctl_buf) +{ + t_u8 i = 0; + t_u16 link_length = 0, final_data_rate = 0; + mlan_ds_misc_cfg *misc = MNULL; + tdls_all_config *tdls_all_cfg = MNULL; + sta_node *sta_ptr = MNULL; + HostCmd_DS_TDLS_CONFIG *ptdls_config_data = + &(resp->params.tdls_config_data); + pmlan_adapter pmadapter = pmpriv->adapter; + tdls_each_link_status *link_ptr = MNULL; + + ENTER(); + + ptdls_config_data->tdls_info.tdls_action = + wlan_le16_to_cpu(ptdls_config_data->tdls_info.tdls_action); + switch (ptdls_config_data->tdls_info.tdls_action) { + case WLAN_TDLS_CONFIG: + misc = (mlan_ds_misc_cfg *) pioctl_buf->pbuf; + tdls_all_cfg = + (tdls_all_config *) ptdls_config_data->tdls_info. + tdls_data; + if (wlan_le16_to_cpu(tdls_all_cfg->u.tdls_config.enable) == 0) { + PRINTM(MINFO, "TDLS disable successful.\n"); + wlan_delete_station_list(pmpriv); + pmadapter->tdls_status = TDLS_NOT_SETUP; + if (pmpriv->saved_wmm_qosinfo) + pmpriv->wmm_qosinfo = pmpriv->saved_wmm_qosinfo; + if (pmadapter->saved_sleep_period.period) + pmadapter->sleep_period.period = + pmadapter->saved_sleep_period.period; + } + break; + + case WLAN_TDLS_SET_INFO: + break; + + case WLAN_TDLS_DISCOVERY_REQ: + misc = (mlan_ds_misc_cfg *) pioctl_buf->pbuf; + tdls_all_cfg = + (tdls_all_config *) ptdls_config_data->tdls_info. + tdls_data; + tdls_all_cfg->u.tdls_discovery_resp.payload_len = + wlan_le16_to_cpu(tdls_all_cfg->u.tdls_discovery_resp. + payload_len); + tdls_all_cfg->u.tdls_discovery_resp.cap_info = + wlan_le16_to_cpu(tdls_all_cfg->u.tdls_discovery_resp. + cap_info); + memcpy(pmpriv->adapter, &misc->param.tdls_config, + &ptdls_config_data->tdls_info, + MIN(sizeof(mlan_ds_misc_tdls_config), + (resp->size - S_DS_GEN))); + PRINTM(MCMND, "TDLS_DISCOVERY_REQ: " MACSTR "\n", + MAC2STR(tdls_all_cfg->u.tdls_discovery_resp. + peer_mac_addr)); + break; + + case WLAN_TDLS_SETUP_REQ: + /* + * TDLS link being setup, block all data for this Peer + */ + tdls_all_cfg = + (tdls_all_config *) ptdls_config_data->tdls_info. + tdls_data; + PRINTM(MCMND, "TDLS_SETUP_REQ: " MACSTR "\n", + MAC2STR(tdls_all_cfg->u.tdls_setup.peer_mac_addr)); + sta_ptr = + wlan_get_station_entry(pmpriv, + tdls_all_cfg->u.tdls_setup. + peer_mac_addr); + if (!sta_ptr) { + sta_ptr = + wlan_add_station_entry(pmpriv, + tdls_all_cfg->u. + tdls_setup. + peer_mac_addr); + if (sta_ptr) { + sta_ptr->status = TDLS_SETUP_INPROGRESS; + wlan_hold_tdls_packets(pmpriv, + tdls_all_cfg->u. + tdls_setup. + peer_mac_addr); + } + } + break; + + case WLAN_TDLS_TEAR_DOWN_REQ: + /* + * TDLS link torn down, open data ports if blocked + */ + tdls_all_cfg = + (tdls_all_config *) ptdls_config_data->tdls_info. + tdls_data; + wlan_restore_tdls_packets(pmpriv, + tdls_all_cfg->u.tdls_tear_down. + peer_mac_addr, TDLS_TEAR_DOWN); + PRINTM(MCMND, "TDLS_TEARDOWN_REQ: " MACSTR "\n", + MAC2STR(tdls_all_cfg->u.tdls_tear_down.peer_mac_addr)); + sta_ptr = + wlan_get_station_entry(pmpriv, + tdls_all_cfg->u.tdls_tear_down. + peer_mac_addr); + if (sta_ptr) { + + if (sta_ptr->is_11n_enabled) { + wlan_cleanup_reorder_tbl(pmpriv, + tdls_all_cfg->u. + tdls_tear_down. + peer_mac_addr); + pmadapter->callbacks.moal_spin_lock(pmadapter-> + pmoal_handle, + pmpriv->wmm. + ra_list_spinlock); + wlan_11n_cleanup_txbastream_tbl(pmpriv, + tdls_all_cfg->u. + tdls_tear_down. + peer_mac_addr); + pmadapter->callbacks. + moal_spin_unlock(pmadapter-> + pmoal_handle, + pmpriv->wmm. + ra_list_spinlock); + } + wlan_delete_station_entry(pmpriv, + tdls_all_cfg->u. + tdls_tear_down.peer_mac_addr); + if (MTRUE == wlan_is_station_list_empty(pmpriv)) + pmadapter->tdls_status = TDLS_NOT_SETUP; + else + pmadapter->tdls_status = TDLS_IN_BASE_CHANNEL; + } + break; + case WLAN_TDLS_INIT_CHAN_SWITCH: + tdls_all_cfg = + (tdls_all_config *) ptdls_config_data->tdls_info. + tdls_data; + PRINTM(MCMND, + "TDLS_INIT_CHANNEL_SWITCH: " MACSTR + " chan=%d periodicity=%d\n", + MAC2STR(tdls_all_cfg->u.tdls_chan_switch.peer_mac_addr), + (int)tdls_all_cfg->u.tdls_chan_switch.primary_channel, + (int)tdls_all_cfg->u.tdls_chan_switch.periodicity); + break; + + case WLAN_TDLS_LINK_STATUS: + misc = (mlan_ds_misc_cfg *) pioctl_buf->pbuf; + tdls_all_cfg = + (tdls_all_config *) ptdls_config_data->tdls_info. + tdls_data; + tdls_all_cfg->u.tdls_link_status_resp.payload_len = + wlan_le16_to_cpu(tdls_all_cfg->u.tdls_link_status_resp. + payload_len); + link_ptr = tdls_all_cfg->u.tdls_link_status_resp.link_stats; + for (i = 0; + i < tdls_all_cfg->u.tdls_link_status_resp.active_links; + i++) { + link_ptr->active_channel = + wlan_le32_to_cpu(link_ptr->active_channel); + link_ptr->data_rssi_last = + wlan_le16_to_cpu(link_ptr->data_rssi_last); + link_ptr->data_nf_last = + wlan_le16_to_cpu(link_ptr->data_nf_last); + link_ptr->data_rssi_avg = + wlan_le16_to_cpu(link_ptr->data_rssi_avg); + link_ptr->data_nf_avg = + wlan_le16_to_cpu(link_ptr->data_nf_avg); + link_length = sizeof(tdls_each_link_status); + /* adjust as per open or secure network */ + if (link_ptr->link_flags & 0x02) { + link_ptr->key_lifetime = + wlan_le32_to_cpu(link_ptr-> + key_lifetime); + link_length += link_ptr->key_length; + } else { + link_length -= + sizeof(link_ptr->security_method) + + sizeof(link_ptr->key_lifetime) + + sizeof(link_ptr->key_length); + } + final_data_rate = + (t_u16) wlan_index_to_data_rate(pmadapter, + link_ptr->u. + rate_info. + tx_data_rate, + link_ptr->u. + rate_info. + tx_rate_htinfo); + link_ptr->u.final_data_rate = final_data_rate / 2; + + link_ptr = + (tdls_each_link_status *) (((t_u8 *) link_ptr) + + link_length); + } + memcpy(pmpriv->adapter, &misc->param.tdls_config, + &ptdls_config_data->tdls_info, + MIN(sizeof(mlan_ds_misc_tdls_config), + (resp->size - S_DS_GEN))); + break; + case WLAN_TDLS_POWER_MODE: + misc = (mlan_ds_misc_cfg *) pioctl_buf->pbuf; + tdls_all_cfg = + (tdls_all_config *) ptdls_config_data->tdls_info. + tdls_data; + wlan_set_tdls_powermode(pmpriv, + (t_u8) tdls_all_cfg->u.tdls_power_mode. + power_mode); + break; + case WLAN_TDLS_STOP_CHAN_SWITCH: + tdls_all_cfg = + (tdls_all_config *) ptdls_config_data->tdls_info. + tdls_data; + PRINTM(MCMND, "TDLS_STOP_CHANNEL_SWITCH: " MACSTR "\n", + MAC2STR(tdls_all_cfg->u.tdls_stop_chan_switch. + peer_mac_addr)); + break; + case WLAN_TDLS_CS_PARAMS: + case WLAN_TDLS_CS_DISABLE: + case WLAN_TDLS_DEBUG_STOP_RX: + case WLAN_TDLS_DEBUG_ALLOW_WEAK_SECURITY: + case WLAN_TDLS_DEBUG_SETUP_SAME_LINK: + case WLAN_TDLS_DEBUG_FAIL_SETUP_CONFIRM: + case WLAN_TDLS_DEBUG_WRONG_BSS: + case WLAN_TDLS_DEBUG_SETUP_PROHIBITED: + case WLAN_TDLS_DEBUG_HIGHER_LOWER_MAC: + case WLAN_TDLS_DEBUG_IGNORE_KEY_EXPIRY: + case WLAN_TDLS_DEBUG_CS_RET_IM: + break; + default: + if (pioctl_buf) + pioctl_buf->status_code = MLAN_ERROR_CMD_RESP_FAIL; + LEAVE(); + return MLAN_STATUS_FAILURE; + } + + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + +/** + * @brief This function handles the command response of TDLS_OPERATION + * + * @param pmpriv A pointer to mlan_private structure + * @param resp A pointer to HostCmd_DS_COMMAND + * @param pioctl_buf A pointer to mlan_ioctl_req structure + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +static mlan_status +wlan_ret_tdls_oper(IN pmlan_private pmpriv, + IN HostCmd_DS_COMMAND * resp, + OUT mlan_ioctl_req * pioctl_buf) +{ + HostCmd_DS_TDLS_OPER *ptdls_oper = &(resp->params.tdls_oper_data); + sta_node *sta_ptr = MNULL; + t_u16 reason = 0; + + ENTER(); + + ptdls_oper->tdls_action = wlan_le16_to_cpu(ptdls_oper->tdls_action); + + sta_ptr = wlan_get_station_entry(pmpriv, ptdls_oper->peer_mac); + reason = wlan_le16_to_cpu(ptdls_oper->reason); + switch (ptdls_oper->tdls_action) { + case TDLS_CREATE: + if (reason) { + PRINTM(MMSG, + "TDLS: create link " MACSTR " fail, reason=%d\n", + MAC2STR(ptdls_oper->peer_mac), reason); + if (reason != TDLS_LINK_EXISTS && sta_ptr) + sta_ptr->status = TDLS_SETUP_FAILURE; + } else { + PRINTM(MMSG, "TDLS: create link " MACSTR " success\n", + MAC2STR(ptdls_oper->peer_mac), reason); + } + break; + case TDLS_CONFIG: + if (reason) { + PRINTM(MMSG, + "TDLS: Config link " MACSTR " fail, reason=%d\n", + MAC2STR(ptdls_oper->peer_mac), reason); + if (sta_ptr) + sta_ptr->status = TDLS_SETUP_FAILURE; + } else { + PRINTM(MMSG, "TDLS: Config link " MACSTR " success\n", + MAC2STR(ptdls_oper->peer_mac)); + } + break; + case TDLS_DELETE: + if (reason) + PRINTM(MMSG, + "TDLS: Delete link " MACSTR " fail, reason=%d\n", + MAC2STR(ptdls_oper->peer_mac), reason); + else + PRINTM(MMSG, "TDLS: Delete link " MACSTR " success\n", + MAC2STR(ptdls_oper->peer_mac)); + break; + default: + break; + } + + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + +/** * @brief This function handles the command response of sysclock * * @param pmpriv A pointer to mlan_private structure @@ -1539,6 +1999,11 @@ wlan_ops_sta_process_cmdresp(IN t_void * priv, pioctl_buf = MNULL; pmadapter->curr_cmd->pioctl_buf = MNULL; break; + case HostCmd_CMD_802_11_SCAN_EXT: + ret = wlan_ret_802_11_scan_ext(pmpriv, resp, pioctl_buf); + pioctl_buf = MNULL; + pmadapter->curr_cmd->pioctl_buf = MNULL; + break; case HostCmd_CMD_802_11_BG_SCAN_CONFIG: ret = wlan_ret_bgscan_config(pmpriv, resp, pioctl_buf); break; @@ -1571,6 +2036,7 @@ wlan_ops_sta_process_cmdresp(IN t_void * priv, ret = wlan_ret_802_11_associate(pmpriv, resp, pioctl_buf); break; case HostCmd_CMD_802_11_DEAUTHENTICATE: + case HostCmd_CMD_802_11_DISASSOCIATE: ret = wlan_ret_802_11_deauthenticate(pmpriv, resp, pioctl_buf); break; case HostCmd_CMD_802_11_AD_HOC_START: @@ -1687,6 +2153,12 @@ wlan_ops_sta_process_cmdresp(IN t_void * priv, case HostCmd_CMD_MGMT_IE_LIST: ret = wlan_ret_mgmt_ie_list(pmpriv, resp, pioctl_buf); break; + case HostCmd_CMD_TDLS_CONFIG: + ret = wlan_ret_tdls_config(pmpriv, resp, pioctl_buf); + break; + case HostCmd_CMD_TDLS_OPERATION: + ret = wlan_ret_tdls_oper(pmpriv, resp, pioctl_buf); + break; case HostCmd_CMD_11N_CFG: ret = wlan_ret_11n_cfg(pmpriv, resp, pioctl_buf); break; diff --git a/drivers/net/wireless/sd8897/mlan/mlan_sta_event.c b/drivers/net/wireless/sd8897/mlan/mlan_sta_event.c index 47e106eee45c..0cde72bd4681 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_sta_event.c +++ b/drivers/net/wireless/sd8897/mlan/mlan_sta_event.c @@ -47,36 +47,315 @@ Change log: /** * @brief This function handles link lost, deauth and - * disassoc events. + * disassoc events. * - * @param pmpriv A pointer to mlan_private structure - * @return N/A + * @param pmpriv A pointer to mlan_private structure + * @return N/A */ static t_void wlan_handle_disconnect_event(pmlan_private pmpriv) { ENTER(); - if (pmpriv->media_connected == MTRUE) { + if (pmpriv->media_connected == MTRUE) wlan_reset_connect_state(pmpriv, MTRUE); + + LEAVE(); +} + +/** + * @brief This function will parse the TDLS event for further wlan action + * + * @param priv A pointer to mlan_private + * @param pevent A pointer to event buf + * + * @return N/A + */ +static void +wlan_parse_tdls_event(pmlan_private priv, pmlan_buffer pevent) +{ + Event_tdls_generic *tdls_event = (Event_tdls_generic *) + (pevent->pbuf + pevent->data_offset + sizeof(mlan_event_id)); + sta_node *sta_ptr = MNULL; + pmlan_adapter pmadapter = priv->adapter; + t_u8 i = 0; + IEEEtypes_HTCap_t *pht_cap = MNULL; + t_u16 ie_len = 0; + mlan_ds_misc_tdls_oper tdls_oper; + t_u8 event_buf[100]; + mlan_event *ptdls_event = (mlan_event *) event_buf; + tdls_tear_down_event *tdls_evt = + (tdls_tear_down_event *) ptdls_event->event_buf; + ENTER(); + + /* reason code is not mandatory, hence less by sizeof(t_u16) */ + if (pevent->data_len < (sizeof(Event_tdls_generic) - + sizeof(t_u16) - sizeof(mlan_event_id))) { + PRINTM(MERROR, "Invalid length %d for TDLS event\n", + pevent->data_len); + LEAVE(); + return; } + sta_ptr = wlan_get_station_entry(priv, tdls_event->peer_mac_addr); + PRINTM(MEVENT, "TDLS_EVENT: %d " MACSTR "\n", + wlan_le16_to_cpu(tdls_event->event_type), + MAC2STR(tdls_event->peer_mac_addr)); + switch (wlan_le16_to_cpu(tdls_event->event_type)) { + case TDLS_EVENT_TYPE_SETUP_REQ: + if (sta_ptr == MNULL) { + sta_ptr = + wlan_add_station_entry(priv, + tdls_event-> + peer_mac_addr); + if (sta_ptr) { + sta_ptr->status = TDLS_SETUP_INPROGRESS; + wlan_hold_tdls_packets(priv, + tdls_event-> + peer_mac_addr); + } + } + break; + + case TDLS_EVENT_TYPE_LINK_ESTABLISHED: + if (sta_ptr) { + sta_ptr->status = TDLS_SETUP_COMPLETE; + /* parse the TLV for station's capability */ + ie_len = wlan_le16_to_cpu(tdls_event->u.ie_data. + ie_length); + if (ie_len) { + pht_cap = + (IEEEtypes_HTCap_t *) + wlan_get_specific_ie(priv, + tdls_event->u. + ie_data.ie_ptr, + ie_len, + HT_CAPABILITY); + if (pht_cap) { + sta_ptr->is_11n_enabled = MTRUE; + if (GETHT_MAXAMSDU + (pht_cap->ht_cap.ht_cap_info)) + sta_ptr->max_amsdu = + MLAN_TX_DATA_BUF_SIZE_8K; + else + sta_ptr->max_amsdu = + MLAN_TX_DATA_BUF_SIZE_4K; + } + } + for (i = 0; i < MAX_NUM_TID; i++) { + if (sta_ptr->is_11n_enabled) + sta_ptr->ampdu_sta[i] = + priv->aggr_prio_tbl[i]. + ampdu_user; + else + sta_ptr->ampdu_sta[i] = + BA_STREAM_NOT_ALLOWED; + } + memset(priv->adapter, sta_ptr->rx_seq, 0xff, + sizeof(sta_ptr->rx_seq)); + wlan_restore_tdls_packets(priv, + tdls_event->peer_mac_addr, + TDLS_SETUP_COMPLETE); + pmadapter->tdls_status = TDLS_IN_BASE_CHANNEL; + } + break; + case TDLS_EVENT_TYPE_SETUP_FAILURE: + wlan_restore_tdls_packets(priv, tdls_event->peer_mac_addr, + TDLS_SETUP_FAILURE); + if (sta_ptr) + wlan_delete_station_entry(priv, + tdls_event->peer_mac_addr); + if (MTRUE == wlan_is_station_list_empty(priv)) + pmadapter->tdls_status = TDLS_NOT_SETUP; + else + pmadapter->tdls_status = TDLS_IN_BASE_CHANNEL; + break; + case TDLS_EVENT_TYPE_LINK_TORN_DOWN: + if (sta_ptr) { + if (sta_ptr->external_tdls) { + PRINTM(MMSG, + "Receive TDLS TEAR DOWN event, Disable TDLS LINK\n"); + memset(pmadapter, &tdls_oper, 0, + sizeof(tdls_oper)); + tdls_oper.tdls_action = WLAN_TDLS_DISABLE_LINK; + memcpy(priv->adapter, tdls_oper.peer_mac, + tdls_event->peer_mac_addr, + MLAN_MAC_ADDR_LENGTH); + /* Send command to firmware to delete tdls link */ + wlan_prepare_cmd(priv, + HostCmd_CMD_TDLS_OPERATION, + HostCmd_ACT_GEN_SET, + 0, + (t_void *) MNULL, &tdls_oper); + ptdls_event->bss_index = priv->bss_index; + ptdls_event->event_id = + MLAN_EVENT_ID_DRV_TDLS_TEARDOWN_REQ; + ptdls_event->event_len = + sizeof(tdls_tear_down_event); + memcpy(priv->adapter, + (t_u8 *) tdls_evt->peer_mac_addr, + tdls_event->peer_mac_addr, + MLAN_MAC_ADDR_LENGTH); + tdls_evt->reason_code = + wlan_le16_to_cpu(tdls_event->u. + reason_code); + wlan_recv_event(priv, + MLAN_EVENT_ID_DRV_TDLS_TEARDOWN_REQ, + ptdls_event); + /* Signal MOAL to trigger mlan_main_process */ + wlan_recv_event(priv, + MLAN_EVENT_ID_DRV_DEFER_HANDLING, + MNULL); + } + wlan_restore_tdls_packets(priv, + tdls_event->peer_mac_addr, + TDLS_TEAR_DOWN); + if (sta_ptr->is_11n_enabled) { + wlan_cleanup_reorder_tbl(priv, + tdls_event-> + peer_mac_addr); + pmadapter->callbacks.moal_spin_lock(pmadapter-> + pmoal_handle, + priv->wmm. + ra_list_spinlock); + wlan_11n_cleanup_txbastream_tbl(priv, + tdls_event-> + peer_mac_addr); + pmadapter->callbacks. + moal_spin_unlock(pmadapter-> + pmoal_handle, + priv->wmm. + ra_list_spinlock); + } + wlan_delete_station_entry(priv, + tdls_event->peer_mac_addr); + if (MTRUE == wlan_is_station_list_empty(priv)) + pmadapter->tdls_status = TDLS_NOT_SETUP; + else + pmadapter->tdls_status = TDLS_IN_BASE_CHANNEL; + } + break; + case TDLS_EVENT_TYPE_CHAN_SWITCH_RESULT: + PRINTM(MEVENT, + "TDLS_CHAN_SWITCH_RESULT: status=0x%x, reason=0x%x current_channel=%d\n", + tdls_event->u.switch_result.status, + tdls_event->u.switch_result.reason, + (int)tdls_event->u.switch_result.current_channel); + if (tdls_event->u.switch_result.status == MLAN_STATUS_SUCCESS) { + if (tdls_event->u.switch_result.current_channel == + TDLS_BASE_CHANNEL) { + /* enable traffic to AP */ + if (pmadapter->tdls_status != + TDLS_IN_BASE_CHANNEL) { + wlan_update_non_tdls_ralist(priv, + tdls_event-> + peer_mac_addr, + MFALSE); + pmadapter->tdls_status = + TDLS_IN_BASE_CHANNEL; + } + } else if (tdls_event->u.switch_result. + current_channel == TDLS_OFF_CHANNEL) { + /* pause traffic to AP */ + if (pmadapter->tdls_status != + TDLS_IN_OFF_CHANNEL) { + wlan_update_non_tdls_ralist(priv, + tdls_event-> + peer_mac_addr, + MTRUE); + pmadapter->tdls_status = + TDLS_IN_OFF_CHANNEL; + } + } + } else { + if (tdls_event->u.switch_result.current_channel == + TDLS_BASE_CHANNEL) + pmadapter->tdls_status = TDLS_IN_BASE_CHANNEL; + else if (tdls_event->u.switch_result.current_channel == + TDLS_OFF_CHANNEL) + pmadapter->tdls_status = TDLS_IN_OFF_CHANNEL; + } + break; + case TDLS_EVENT_TYPE_START_CHAN_SWITCH: + PRINTM(MEVENT, "TDLS start channel switch....\n"); + pmadapter->tdls_status = TDLS_SWITCHING_CHANNEL; + break; + case TDLS_EVENT_TYPE_CHAN_SWITCH_STOPPED: + PRINTM(MEVENT, "TDLS channel switch stopped, reason=%d\n", + tdls_event->u.cs_stop_reason); + break; + case TDLS_EVENT_TYPE_DEBUG: + case TDLS_EVENT_TYPE_PACKET: + break; + default: + PRINTM(MERROR, "unknown event type %d\n", + wlan_le16_to_cpu(tdls_event->event_type)); + break; + } LEAVE(); } +/** + * @brief This function send the tdls teardown request event. + * + * @param priv A pointer to mlan_private + * + * @return N/A + */ +void +wlan_send_tdls_tear_down_request(pmlan_private priv) +{ + t_u8 event_buf[100]; + mlan_event *ptdls_event = (mlan_event *) event_buf; + tdls_tear_down_event *tdls_evt = + (tdls_tear_down_event *) ptdls_event->event_buf; + sta_node *sta_ptr = MNULL; + + ENTER(); + + sta_ptr = (sta_node *) util_peek_list(priv->adapter->pmoal_handle, + &priv->sta_list, + priv->adapter->callbacks. + moal_spin_lock, + priv->adapter->callbacks. + moal_spin_unlock); + if (!sta_ptr) { + LEAVE(); + return; + } + while (sta_ptr != (sta_node *) & priv->sta_list) { + if (sta_ptr->external_tdls) { + ptdls_event->bss_index = priv->bss_index; + ptdls_event->event_id = + MLAN_EVENT_ID_DRV_TDLS_TEARDOWN_REQ; + ptdls_event->event_len = sizeof(tdls_tear_down_event); + memcpy(priv->adapter, (t_u8 *) tdls_evt->peer_mac_addr, + sta_ptr->mac_addr, MLAN_MAC_ADDR_LENGTH); + tdls_evt->reason_code = + WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED; + wlan_recv_event(priv, + MLAN_EVENT_ID_DRV_TDLS_TEARDOWN_REQ, + ptdls_event); + } + sta_ptr = sta_ptr->pnext; + } + LEAVE(); + return; +} + /******************************************************** Global Functions ********************************************************/ /** * @brief This function handles disconnect event, reports disconnect - * to upper layer, cleans tx/rx packets, - * resets link state etc. + * to upper layer, cleans tx/rx packets, + * resets link state etc. * - * @param priv A pointer to mlan_private structure - * @param drv_disconnect Flag indicating the driver should disconnect - * and flush pending packets. + * @param priv A pointer to mlan_private structure + * @param drv_disconnect Flag indicating the driver should disconnect + * and flush pending packets. * - * @return N/A + * @return N/A */ t_void wlan_reset_connect_state(pmlan_private priv, t_u8 drv_disconnect) @@ -148,6 +427,11 @@ wlan_reset_connect_state(pmlan_private priv, t_u8 drv_disconnect) &priv->curr_bss_params, 0x00, sizeof(priv->curr_bss_params)); } + wlan_send_tdls_tear_down_request(priv); + wlan_delete_station_list(priv); + pmadapter->tdls_status = TDLS_NOT_SETUP; + priv->wmm_qosinfo = priv->saved_wmm_qosinfo; + pmadapter->sleep_period.period = pmadapter->saved_sleep_period.period; pmadapter->tx_lock_flag = MFALSE; pmadapter->pps_uapsd_mode = MFALSE; pmadapter->delay_null_pkt = MFALSE; @@ -214,11 +498,92 @@ wlan_2040_coex_event(pmlan_private pmpriv) } /** + * @brief This function will process tx pause event + * + * + * @param priv A pointer to mlan_private + * @param pevent A pointer to event buf + * + * @return N/A + */ +static void +wlan_process_sta_tx_pause_event(pmlan_private priv, pmlan_buffer pevent) +{ + t_u16 tlv_type, tlv_len; + int tlv_buf_left = pevent->data_len - sizeof(t_u32); + MrvlIEtypesHeader_t *tlv = + (MrvlIEtypesHeader_t *) (pevent->pbuf + pevent->data_offset + + sizeof(t_u32)); + MrvlIEtypes_tx_pause_t *tx_pause_tlv; + sta_node *sta_ptr = MNULL; + tdlsStatus_e status; + t_u8 *bssid = MNULL; + ENTER(); + if (priv->media_connected) + bssid = priv->curr_bss_params.bss_descriptor.mac_address; + while (tlv_buf_left >= (int)sizeof(MrvlIEtypesHeader_t)) { + tlv_type = wlan_le16_to_cpu(tlv->type); + tlv_len = wlan_le16_to_cpu(tlv->len); + if ((sizeof(MrvlIEtypesHeader_t) + tlv_len) > + (unsigned int)tlv_buf_left) { + PRINTM(MERROR, "wrong tlv: tlvLen=%d, tlvBufLeft=%d\n", + tlv_len, tlv_buf_left); + break; + } + if (tlv_type == TLV_TYPE_TX_PAUSE) { + tx_pause_tlv = (MrvlIEtypes_tx_pause_t *) tlv; + PRINTM(MCMND, + "TDLS TxPause: " MACSTR " pause=%d, pkts=%d\n", + MAC2STR(tx_pause_tlv->peermac), + tx_pause_tlv->tx_pause, tx_pause_tlv->pkt_cnt); + if (bssid && + !memcmp(priv->adapter, bssid, tx_pause_tlv->peermac, + MLAN_MAC_ADDR_LENGTH)) { + if (tx_pause_tlv->tx_pause) + priv->port_open = MFALSE; + else + priv->port_open = MTRUE; + } else { + status = wlan_get_tdls_link_status(priv, + tx_pause_tlv-> + peermac); + if (MTRUE == wlan_is_tdls_link_setup(status)) { + sta_ptr = + wlan_get_station_entry(priv, + tx_pause_tlv-> + peermac); + if (sta_ptr) { + if (sta_ptr->tx_pause != + tx_pause_tlv->tx_pause) { + sta_ptr->tx_pause = + tx_pause_tlv-> + tx_pause; + wlan_update_ralist_tx_pause + (priv, + tx_pause_tlv-> + peermac, + tx_pause_tlv-> + tx_pause); + } + } + } + } + } + tlv_buf_left -= (sizeof(MrvlIEtypesHeader_t) + tlv_len); + tlv = (MrvlIEtypesHeader_t *) ((t_u8 *) tlv + tlv_len + + sizeof(MrvlIEtypesHeader_t)); + } + + LEAVE(); + return; +} + +/** * @brief This function handles events generated by firmware * - * @param priv A pointer to mlan_private structure + * @param priv A pointer to mlan_private structure * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_ops_sta_process_event(IN t_void * priv) @@ -314,7 +679,7 @@ wlan_ops_sta_process_event(IN t_void * priv) break; case EVENT_PS_AWAKE: - PRINTM(MINFO, "EVENT: AWAKE \n"); + PRINTM(MINFO, "EVENT: AWAKE\n"); PRINTM(MEVENT, "|"); if (!pmadapter->pps_uapsd_mode && pmpriv->media_connected && @@ -492,6 +857,12 @@ wlan_ops_sta_process_event(IN t_void * priv) /* Send up this Event to unblock MOAL waitqueue */ wlan_recv_event(pmpriv, MLAN_EVENT_ID_DRV_MEAS_REPORT, MNULL); break; + case EVENT_EXT_SCAN_REPORT: + PRINTM(MEVENT, "EVENT: EXT_SCAN Report (%d)\n", + pmbuf->data_len); + if (pmadapter->pscan_ioctl_req && pmadapter->ext_scan) + ret = wlan_handle_event_ext_scan_report(priv, pmbuf); + break; case EVENT_MEAS_REPORT_RDY: PRINTM(MEVENT, "EVENT: Measurement Report Ready (%#x)\n", eventcause); @@ -682,15 +1053,39 @@ wlan_ops_sta_process_event(IN t_void * priv) break; #endif /* WIFI_DIRECT_SUPPORT */ + case EVENT_TDLS_GENERIC_EVENT: + PRINTM(MEVENT, "EVENT: TDLS event %d\n", eventcause); + wlan_parse_tdls_event(pmpriv, pmbuf); + /* Allocate memory for event buffer */ + ret = pcb->moal_malloc(pmadapter->pmoal_handle, MAX_EVENT_SIZE, + MLAN_MEM_DEF, &evt_buf); + if ((ret == MLAN_STATUS_SUCCESS) && evt_buf) { + pevent = (pmlan_event) evt_buf; + pevent->bss_index = pmpriv->bss_index; + pevent->event_id = MLAN_EVENT_ID_DRV_PASSTHRU; + pevent->event_len = pmbuf->data_len; + memcpy(pmadapter, (t_u8 *) pevent->event_buf, + pmbuf->pbuf + pmbuf->data_offset, + pevent->event_len); + wlan_recv_event(pmpriv, pevent->event_id, pevent); + pcb->moal_mfree(pmadapter->pmoal_handle, evt_buf); + } + break; + + case EVENT_TX_DATA_PAUSE: + PRINTM(MEVENT, "EVENT: TX_DATA_PAUSE\n"); + wlan_process_sta_tx_pause_event(priv, pmbuf); + break; + case EVENT_SAD_REPORT: { - t_u8 *pEvtDat = + t_u8 *pevt_dat = pmbuf->pbuf + pmbuf->data_offset + sizeof(t_u32); PRINTM(MEVENT, "EVENT: Antenna Diversity %d (%d, %d, %d, %d)\n", - eventcause, pEvtDat[0] + 1, pEvtDat[1] + 1, - pEvtDat[2], pEvtDat[3]); + eventcause, pevt_dat[0] + 1, pevt_dat[1] + 1, + pevt_dat[2], pevt_dat[3]); } break; case EVENT_MULTI_CHAN_INFO: diff --git a/drivers/net/wireless/sd8897/mlan/mlan_sta_ioctl.c b/drivers/net/wireless/sd8897/mlan/mlan_sta_ioctl.c index 7189933dcb1e..4a343f5d970b 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_sta_ioctl.c +++ b/drivers/net/wireless/sd8897/mlan/mlan_sta_ioctl.c @@ -53,34 +53,22 @@ Change log: /** * @brief enable adhoc aes key * - * @param pmpriv A pointer to mlan_private structure + * @param pmpriv A pointer to mlan_private structure * - * @return N/A + * @return N/A */ static void wlan_enable_aes_key(pmlan_private pmpriv) { - mlan_ds_encrypt_key encrypt_key; ENTER(); - if (pmpriv->aes_key.key_param_set.key_len != WPA_AES_KEY_LEN) { + if (pmpriv->aes_key.key_len != WPA_AES_KEY_LEN) { LEAVE(); return; } - - memset(pmpriv->adapter, &encrypt_key, 0, sizeof(mlan_ds_encrypt_key)); - encrypt_key.key_len = WPA_AES_KEY_LEN; - encrypt_key.key_index = MLAN_KEY_INDEX_UNICAST; - memcpy(pmpriv->adapter, encrypt_key.key_material, - pmpriv->aes_key.key_param_set.key, encrypt_key.key_len); - wlan_prepare_cmd(pmpriv, HostCmd_CMD_802_11_KEY_MATERIAL, - HostCmd_ACT_GEN_SET, KEY_INFO_ENABLED, MNULL, - &encrypt_key); - encrypt_key.key_index &= ~MLAN_KEY_INDEX_UNICAST; wlan_prepare_cmd(pmpriv, HostCmd_CMD_802_11_KEY_MATERIAL, - HostCmd_ACT_GEN_SET, - KEY_INFO_ENABLED, MNULL, &encrypt_key); + HostCmd_ACT_GEN_SET, 0, MNULL, &pmpriv->aes_key); LEAVE(); return; @@ -344,6 +332,12 @@ wlan_get_info_ioctl(IN pmlan_adapter pmadapter, IN pmlan_ioctl_req pioctl_req) pget_info->param.fw_info.region_code = pmadapter->region_code; pget_info->param.fw_info.hw_dev_mcs_support = pmadapter->hw_dev_mcs_support; + pget_info->param.fw_info.hw_dot_11n_dev_cap = + pmadapter->hw_dot_11n_dev_cap; + pget_info->param.fw_info.hw_dot_11ac_mcs_support = + pmadapter->hw_dot_11ac_mcs_support; + pget_info->param.fw_info.hw_dot_11ac_dev_cap = + pmadapter->hw_dot_11ac_dev_cap; break; case MLAN_OID_GET_BSS_INFO: status = wlan_get_info_bss_info(pmadapter, pioctl_req); @@ -525,8 +519,9 @@ wlan_radio_ioctl_band_cfg(IN pmlan_adapter pmadapter, DEFAULT_AD_HOC_CHANNEL_A; } } - } else { /* Return error if adhoc_band and adhoc_channel - combination is invalid */ + } else { + /* Return error if adhoc_band and adhoc_channel + combination is invalid */ if (!wlan_find_cfp_by_band_and_channel (pmadapter, pmadapter->adhoc_start_band, (t_u16) adhoc_channel)) { @@ -562,25 +557,20 @@ wlan_radio_ioctl_band_cfg(IN pmlan_adapter pmadapter, pmadapter->adhoc_11n_enabled = MFALSE; } } else { - radio_cfg->param.band_cfg.config_bands = pmpriv->config_bands; /* Infra - Bands - */ - radio_cfg->param.band_cfg.adhoc_start_band = pmadapter->adhoc_start_band; /* Adhoc - Band - */ - radio_cfg->param.band_cfg.adhoc_channel = pmpriv->adhoc_channel; /* Adhoc - Channel - */ - radio_cfg->param.band_cfg.fw_bands = pmadapter->fw_bands; /* FW - support - Bands - */ + /* Infra Bands */ + radio_cfg->param.band_cfg.config_bands = pmpriv->config_bands; + /* Adhoc Band */ + radio_cfg->param.band_cfg.adhoc_start_band = + pmadapter->adhoc_start_band; + /* Adhoc Channel */ + radio_cfg->param.band_cfg.adhoc_channel = pmpriv->adhoc_channel; + /* FW support Bands */ + radio_cfg->param.band_cfg.fw_bands = pmadapter->fw_bands; PRINTM(MINFO, "Global config band = %d\n", pmadapter->config_bands); - radio_cfg->param.band_cfg.adhoc_chan_bandwidth = pmadapter->chan_bandwidth; /* adhoc - channel - bandwidth - */ + /* adhoc channel bandwidth */ + radio_cfg->param.band_cfg.adhoc_chan_bandwidth = + pmadapter->chan_bandwidth; } LEAVE(); @@ -2004,9 +1994,8 @@ wlan_pm_ioctl_inactivity_timeout(IN pmlan_adapter pmadapter, pmcfg = (mlan_ds_pm_cfg *) pioctl_req->pbuf; cmd_action = HostCmd_ACT_GEN_GET; - if (pioctl_req->action == MLAN_ACT_SET) { + if (pioctl_req->action == MLAN_ACT_SET) cmd_action = HostCmd_ACT_GEN_SET; - } /* Send request to firmware */ ret = wlan_prepare_cmd(pmpriv, @@ -2024,7 +2013,7 @@ wlan_pm_ioctl_inactivity_timeout(IN pmlan_adapter pmadapter, /** * @brief Enable/Disable Auto Deep Sleep * - * @param pmadapter A pointer to mlan_adapter structure + * @param pmadapter A pointer to mlan_adapter structure * @param pioctl_req A pointer to ioctl request buffer * * @return MLAN_STATUS_PENDING --success, otherwise fail @@ -2214,9 +2203,8 @@ wlan_set_get_sleep_params(IN pmlan_adapter pmadapter, pm_cfg = (mlan_ds_pm_cfg *) pioctl_req->pbuf; cmd_action = HostCmd_ACT_GEN_GET; - if (pioctl_req->action == MLAN_ACT_SET) { + if (pioctl_req->action == MLAN_ACT_SET) cmd_action = HostCmd_ACT_GEN_SET; - } /* Send command to firmware */ ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_802_11_SLEEP_PARAMS, @@ -2359,7 +2347,7 @@ wlan_set_wpa_ie_helper(mlan_private * priv, t_u8 * ie_data_ptr, t_u16 ie_len) if (ie_len) { if (ie_len > sizeof(priv->wpa_ie)) { - PRINTM(MERROR, "failed to copy, WPA IE is too big \n"); + PRINTM(MERROR, "failed to copy, WPA IE is too big\n"); LEAVE(); return MLAN_STATUS_FAILURE; } @@ -2404,7 +2392,7 @@ wlan_set_wapi_ie(mlan_private * priv, t_u8 * ie_data_ptr, t_u16 ie_len) ENTER(); if (ie_len) { if (ie_len > sizeof(priv->wapi_ie)) { - PRINTM(MWARN, "failed to copy, WAPI IE is too big \n"); + PRINTM(MWARN, "failed to copy, WAPI IE is too big\n"); LEAVE(); return MLAN_STATUS_FAILURE; } @@ -2450,9 +2438,8 @@ wlan_sec_ioctl_wapi_enable(IN pmlan_adapter pmadapter, else sec->param.wapi_enabled = MFALSE; } else { - if (sec->param.wapi_enabled == MFALSE) { + if (sec->param.wapi_enabled == MFALSE) wlan_set_wapi_ie(pmpriv, MNULL, 0); - } } pioctl_req->data_read_written = sizeof(t_u32) + MLAN_SUB_COMMAND_SIZE; LEAVE(); @@ -2633,12 +2620,11 @@ wlan_sec_ioctl_wpa_enable(IN pmlan_adapter pmadapter, else sec->param.wpa_enabled = MFALSE; } else { - if (sec->param.wpa_enabled == MFALSE) { + if (sec->param.wpa_enabled == MFALSE) wlan_set_wpa_ie_helper(pmpriv, MNULL, 0); - } /** clear adhoc aes flag, when WPA enabled */ pmpriv->adhoc_aes_enabled = MFALSE; - pmpriv->aes_key.key_param_set.key_len = 0; + pmpriv->aes_key.key_len = 0; } pioctl_req->data_read_written = sizeof(t_u32) + MLAN_SUB_COMMAND_SIZE; LEAVE(); @@ -2672,8 +2658,20 @@ wlan_sec_ioctl_set_wep_key(IN pmlan_adapter pmadapter, sec = (mlan_ds_sec_cfg *) pioctl_req->pbuf; if (sec->param.encrypt_key.key_index == MLAN_KEY_INDEX_DEFAULT) { index = pmpriv->wep_key_curr_index; + sec->param.encrypt_key.key_index = index; } else { if (sec->param.encrypt_key.key_index >= MRVL_NUM_WEP_KEY) { + if ((sec->param.encrypt_key.key_remove == MTRUE) && + (sec->param.encrypt_key.key_index <= 5)) { + /* call firmware remove key */ + ret = wlan_prepare_cmd(pmpriv, + HostCmd_CMD_802_11_KEY_MATERIAL, + HostCmd_ACT_GEN_SET, + 0, + MNULL, + &sec->param.encrypt_key); + goto exit; + } PRINTM(MERROR, "Key_index is invalid\n"); ret = MLAN_STATUS_FAILURE; goto exit; @@ -2688,6 +2686,14 @@ wlan_sec_ioctl_set_wep_key(IN pmlan_adapter pmadapter, if (sec->param.encrypt_key.key_remove == MTRUE) { memset(pmadapter, &pmpriv->wep_key[index], 0, sizeof(mrvl_wep_key_t)); + /* call firmware remove key */ + ret = wlan_prepare_cmd(pmpriv, + HostCmd_CMD_802_11_KEY_MATERIAL, + HostCmd_ACT_GEN_SET, + 0, + MNULL, &sec->param.encrypt_key); + if (ret) + goto exit; } } else { if (sec->param.encrypt_key.key_len) { @@ -2772,16 +2778,36 @@ wlan_sec_ioctl_set_wep_key(IN pmlan_adapter pmadapter, 0, MNULL, &pmpriv->curr_pkt_filter); if (ret) goto exit; + if (!sec->param.encrypt_key.key_len) { + sec->param.encrypt_key.key_index = pwep_key->key_index; + sec->param.encrypt_key.key_len = pwep_key->key_length; + memcpy(pmadapter, sec->param.encrypt_key.key_material, + pwep_key->key_material, + sec->param.encrypt_key.key_len); + } ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_802_11_KEY_MATERIAL, HostCmd_ACT_GEN_SET, - 0, (t_void *) pioctl_req, MNULL); + 0, + (t_void *) pioctl_req, + &sec->param.encrypt_key); } else { if (pwep_key->key_length) { + if (!sec->param.encrypt_key.key_len) { + sec->param.encrypt_key.key_index = + pwep_key->key_index; + sec->param.encrypt_key.key_len = + pwep_key->key_length; + memcpy(pmadapter, + sec->param.encrypt_key.key_material, + pwep_key->key_material, + sec->param.encrypt_key.key_len); + } ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_802_11_KEY_MATERIAL, HostCmd_ACT_GEN_SET, - 0, MNULL, MNULL); + 0, + MNULL, &sec->param.encrypt_key); if (ret) goto exit; } @@ -2815,8 +2841,6 @@ wlan_sec_ioctl_set_wpa_key(IN pmlan_adapter pmadapter, mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_sec_cfg *sec = MNULL; - t_u8 broadcast_mac_addr[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - t_u8 remove_key = MFALSE; ENTER(); @@ -2829,35 +2853,13 @@ wlan_sec_ioctl_set_wpa_key(IN pmlan_adapter pmadapter, goto exit; } - if ((pmpriv->bss_mode == MLAN_BSS_MODE_IBSS) && - pmpriv->sec_info.wpa_enabled) { - /* - * IBSS/WPA-None uses only one key (Group) for both receiving and - * sending unicast and multicast packets. - */ - /* Send the key as PTK to firmware */ - sec->param.encrypt_key.key_index = MLAN_KEY_INDEX_UNICAST; - ret = wlan_prepare_cmd(pmpriv, - HostCmd_CMD_802_11_KEY_MATERIAL, - HostCmd_ACT_GEN_SET, - KEY_INFO_ENABLED, - MNULL, &sec->param.encrypt_key); - if (ret) - goto exit; - - /* Send the key as GTK to firmware */ - sec->param.encrypt_key.key_index = ~MLAN_KEY_INDEX_UNICAST; - } - if (sec->param.encrypt_key.key_len == WPA_AES_KEY_LEN) { /** back up adhoc AES key */ - memset(pmpriv->adapter, pmpriv->aes_key.key_param_set.key, 0, - sizeof(pmpriv->aes_key.key_param_set.key)); - pmpriv->aes_key.key_param_set.key_len = - sec->param.encrypt_key.key_len; - memcpy(pmpriv->adapter, pmpriv->aes_key.key_param_set.key, - sec->param.encrypt_key.key_material, - pmpriv->aes_key.key_param_set.key_len); + memset(pmpriv->adapter, &pmpriv->aes_key, 0, + sizeof(pmpriv->aes_key)); + memcpy(pmpriv->adapter, (t_u8 *) & pmpriv->aes_key, + (t_u8 *) & sec->param.encrypt_key, + sizeof(pmpriv->aes_key)); } /** only adhoc aes key_index = MLAN_KEY_INDEX_UNICAST */ @@ -2872,38 +2874,19 @@ wlan_sec_ioctl_set_wpa_key(IN pmlan_adapter pmadapter, zero_key_material, WPA_AES_KEY_LEN)) { PRINTM(MINFO, "Adhoc AES Enabled.\n"); pmpriv->adhoc_aes_enabled = MTRUE; - remove_key = MFALSE; } else { PRINTM(MINFO, "Adhoc AES Disabled.\n"); pmpriv->adhoc_aes_enabled = MFALSE; /** clear adhoc AES key */ - remove_key = MTRUE; - pmpriv->aes_key.key_param_set.key_len = 0; + pmpriv->aes_key.key_len = 0; } } - if (memcmp - (pmadapter, sec->param.encrypt_key.mac_addr, broadcast_mac_addr, - MLAN_MAC_ADDR_LENGTH)) - sec->param.encrypt_key.key_index |= MLAN_KEY_INDEX_UNICAST; - - if (remove_key == MTRUE) { - /* Send request to firmware */ - ret = wlan_prepare_cmd(pmpriv, - HostCmd_CMD_802_11_KEY_MATERIAL, - HostCmd_ACT_GEN_SET, - !(KEY_INFO_ENABLED), - (t_void *) pioctl_req, - &sec->param.encrypt_key); - } else { - /* Send request to firmware */ - ret = wlan_prepare_cmd(pmpriv, - HostCmd_CMD_802_11_KEY_MATERIAL, - HostCmd_ACT_GEN_SET, - KEY_INFO_ENABLED, - (t_void *) pioctl_req, - &sec->param.encrypt_key); - } + ret = wlan_prepare_cmd(pmpriv, + HostCmd_CMD_802_11_KEY_MATERIAL, + HostCmd_ACT_GEN_SET, + 0, + (t_void *) pioctl_req, &sec->param.encrypt_key); if (ret == MLAN_STATUS_SUCCESS) ret = MLAN_STATUS_PENDING; @@ -2936,14 +2919,11 @@ wlan_sec_ioctl_get_key(IN pmlan_adapter pmadapter, if ((sec->param.encrypt_key.key_index == MLAN_KEY_INDEX_UNICAST) && (sec->param.encrypt_key.key_len == WPA_AES_KEY_LEN)) { if (pmpriv->adhoc_aes_enabled == MTRUE && - (pmpriv->aes_key.key_param_set.key_len == - WPA_AES_KEY_LEN)) { + (pmpriv->aes_key.key_len == WPA_AES_KEY_LEN)) { HEXDUMP("Get ADHOCAES Key", - pmpriv->aes_key.key_param_set.key, - WPA_AES_KEY_LEN); + pmpriv->aes_key.key_material, WPA_AES_KEY_LEN); memcpy(pmadapter, sec->param.encrypt_key.key_material, - pmpriv->aes_key.key_param_set.key, - WPA_AES_KEY_LEN); + pmpriv->aes_key.key_material, WPA_AES_KEY_LEN); LEAVE(); return ret; } else { @@ -2987,13 +2967,14 @@ wlan_sec_ioctl_get_key(IN pmlan_adapter pmadapter, ) { /* Return WPA enabled */ sec->param.encrypt_key.key_disable = MFALSE; + memcpy(pmadapter, sec->param.encrypt_key.key_material, - pmpriv->aes_key.key_param_set.key, + pmpriv->aes_key.key_material, MIN(MLAN_MAX_KEY_LENGTH, - pmpriv->aes_key.key_param_set.key_len)); + pmpriv->aes_key.key_len)); sec->param.encrypt_key.key_len = MIN(MLAN_MAX_KEY_LENGTH, - pmpriv->aes_key.key_param_set.key_len); + pmpriv->aes_key.key_len); } else { sec->param.encrypt_key.key_disable = MTRUE; } @@ -3982,9 +3963,8 @@ wlan_misc_ioctl_warm_reset(IN pmlan_adapter pmadapter, ENTER(); /** Init all the head nodes and free all the locks here */ - for (i = 0; i < pmadapter->priv_num; i++) { + for (i = 0; i < pmadapter->priv_num; i++) wlan_free_priv(pmadapter->priv[i]); - } while ((pmbuf = (pmlan_buffer) util_dequeue_list(pmadapter->pmoal_handle, @@ -4002,9 +3982,8 @@ wlan_misc_ioctl_warm_reset(IN pmlan_adapter pmadapter, /* Initialize private structures */ for (i = 0; i < pmadapter->priv_num; i++) { - if (pmadapter->priv[i]) { + if (pmadapter->priv[i]) wlan_init_priv(pmadapter->priv[i]); - } } /* Restart the firmware */ @@ -4308,11 +4287,10 @@ wlan_misc_ioctl_subscribe_evt(IN pmlan_adapter pmadapter, ENTER(); misc = (mlan_ds_misc_cfg *) pioctl_req->pbuf; - if (pioctl_req->action == MLAN_ACT_SET) { + if (pioctl_req->action == MLAN_ACT_SET) cmd_action = HostCmd_ACT_GEN_SET; - } else { + else cmd_action = HostCmd_ACT_GEN_GET; - } /* Send command to firmware */ ret = wlan_prepare_cmd(pmpriv, @@ -4940,6 +4918,15 @@ wlan_misc_cfg_ioctl(IN pmlan_adapter pmadapter, IN pmlan_ioctl_req pioctl_req) status = wlan_misc_ioctl_custom_ie_list(pmadapter, pioctl_req, MTRUE); break; + case MLAN_OID_MISC_TDLS_CONFIG: + status = wlan_misc_ioctl_tdls_config(pmadapter, pioctl_req); + break; + case MLAN_OID_MISC_TDLS_OPER: + status = wlan_misc_ioctl_tdls_oper(pmadapter, pioctl_req); + break; + case MLAN_OID_MISC_GET_TDLS_IES: + status = wlan_misc_ioctl_tdls_get_ies(pmadapter, pioctl_req); + break; case MLAN_OID_MISC_MAC_CONTROL: status = wlan_misc_ioctl_mac_control(pmadapter, pioctl_req); @@ -5031,6 +5018,7 @@ wlan_set_get_scan_cfg(IN pmlan_adapter pmadapter, (t_u32) pmadapter->active_scan_time; scan->param.scan_cfg.scan_time.passive_scan_time = (t_u32) pmadapter->passive_scan_time; + scan->param.scan_cfg.ext_scan = pmadapter->ext_scan; } else { if (scan->param.scan_cfg.scan_type) pmadapter->scan_type = @@ -5052,6 +5040,7 @@ wlan_set_get_scan_cfg(IN pmlan_adapter pmadapter, pmadapter->passive_scan_time = (t_u16) scan->param.scan_cfg.scan_time. passive_scan_time; + pmadapter->ext_scan = scan->param.scan_cfg.ext_scan; } pioctl_req->data_read_written = sizeof(t_u32) + MLAN_SUB_COMMAND_SIZE; @@ -5077,7 +5066,8 @@ wlan_scan_ioctl(IN pmlan_adapter pmadapter, IN pmlan_ioctl_req pioctl_req) ENTER(); pscan = (mlan_ds_scan *) pioctl_req->pbuf; - if (pscan->sub_command == MLAN_OID_SCAN_CONFIG) + if (pscan->sub_command == MLAN_OID_SCAN_CONFIG + || pscan->sub_command == MLAN_OID_SCAN_BGSCAN_CONFIG) goto start_config; if (pmadapter->scan_processing && pioctl_req->action == MLAN_ACT_SET && pscan->sub_command != MLAN_OID_SCAN_CANCEL) { diff --git a/drivers/net/wireless/sd8897/mlan/mlan_sta_rx.c b/drivers/net/wireless/sd8897/mlan/mlan_sta_rx.c index 0fe4a9bc9137..97655f5cb053 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_sta_rx.c +++ b/drivers/net/wireless/sd8897/mlan/mlan_sta_rx.c @@ -65,13 +65,176 @@ typedef struct { ********************************************************/ /** + * @brief This function process tdls action frame + * + * @param priv A pointer to mlan_private structure + * @param pbuf A pointer to tdls action frame buffer + * @param len len of tdls action frame buffer + * @return N/A + */ +void +wlan_process_tdls_action_frame(pmlan_private priv, t_u8 * pbuf, t_u32 len) +{ + sta_node *sta_ptr = MNULL; + t_u8 *peer; + t_u8 *pos, *end; + t_u8 action; + int ie_len = 0; + t_u8 i; + +#define TDLS_PAYLOAD_TYPE 2 +#define TDLS_CATEGORY 0x0c +#define TDLS_REQ_FIX_LEN 6 +#define TDLS_RESP_FIX_LEN 8 +#define TDLS_CONFIRM_FIX_LEN 6 + if (len < (sizeof(EthII_Hdr_t) + 3)) + return; + if (*(t_u8 *) (pbuf + sizeof(EthII_Hdr_t)) != TDLS_PAYLOAD_TYPE) + /* TDLS payload type = 2 */ + return; + if (*(t_u8 *) (pbuf + sizeof(EthII_Hdr_t) + 1) != TDLS_CATEGORY) + /* TDLS category = 0xc */ + return; + peer = pbuf + MLAN_MAC_ADDR_LENGTH; + + action = *(t_u8 *) (pbuf + sizeof(EthII_Hdr_t) + 2); + /* 2= payload type + category */ + + if (action > TDLS_SETUP_CONFIRM) { + /* just handle TDLS setup request/response/confirm */ + PRINTM(MMSG, "Recv TDLS Action: peer=" MACSTR ", action=%d\n", + MAC2STR(peer), action); + return; + } + + sta_ptr = wlan_add_station_entry(priv, peer); + if (!sta_ptr) + return; + if (action == TDLS_SETUP_REQUEST) { /* setup request */ + sta_ptr->status = TDLS_NOT_SETUP; + PRINTM(MMSG, "Recv TDLS SETUP Request: peer=" MACSTR "\n", + MAC2STR(peer)); + wlan_hold_tdls_packets(priv, peer); + if (len < (sizeof(EthII_Hdr_t) + TDLS_REQ_FIX_LEN)) + return; + pos = pbuf + sizeof(EthII_Hdr_t) + 4; + /* payload 1+ category 1 + action 1 +dialog 1 */ + sta_ptr->capability = mlan_ntohs(*(t_u16 *) pos); + ie_len = len - sizeof(EthII_Hdr_t) - TDLS_REQ_FIX_LEN; + pos += 2; + } else if (action == 1) { /* setup respons */ + PRINTM(MMSG, "Recv TDLS SETUP Response: peer=" MACSTR "\n", + MAC2STR(peer)); + if (len < (sizeof(EthII_Hdr_t) + TDLS_RESP_FIX_LEN)) + return; + pos = pbuf + sizeof(EthII_Hdr_t) + 6; + /* payload 1+ category 1 + action 1 +dialog 1 +status 2 */ + sta_ptr->capability = mlan_ntohs(*(t_u16 *) pos); + ie_len = len - sizeof(EthII_Hdr_t) - TDLS_RESP_FIX_LEN; + pos += 2; + } else { /* setup confirm */ + PRINTM(MMSG, "Recv TDLS SETUP Confirm: peer=" MACSTR "\n", + MAC2STR(peer)); + if (len < (sizeof(EthII_Hdr_t) + TDLS_CONFIRM_FIX_LEN)) + return; + pos = pbuf + sizeof(EthII_Hdr_t) + TDLS_CONFIRM_FIX_LEN; + /* payload 1+ category 1 + action 1 +dialog 1 + status 2 */ + ie_len = len - sizeof(EthII_Hdr_t) - TDLS_CONFIRM_FIX_LEN; + } + for (end = pos + ie_len; pos + 1 < end; pos += 2 + pos[1]) { + if (pos + 2 + pos[1] > end) + break; + switch (*pos) { + case SUPPORTED_RATES: + sta_ptr->rate_len = pos[1]; + for (i = 0; i < pos[1]; i++) + sta_ptr->support_rate[i] = pos[2 + i]; + break; + case EXTENDED_SUPPORTED_RATES: + for (i = 0; i < pos[1]; i++) + sta_ptr->support_rate[sta_ptr->rate_len + i] = + pos[2 + i]; + sta_ptr->rate_len += pos[1]; + break; + case HT_CAPABILITY: + memcpy(priv->adapter, (t_u8 *) & sta_ptr->HTcap, pos, + sizeof(IEEEtypes_HTCap_t)); + sta_ptr->is_11n_enabled = 1; + DBG_HEXDUMP(MDAT_D, "TDLS HT capability", + (t_u8 *) (&sta_ptr->HTcap), + MIN(sizeof(IEEEtypes_HTCap_t), + MAX_DATA_DUMP_LEN)); + break; + case HT_OPERATION: + memcpy(priv->adapter, &sta_ptr->HTInfo, pos, + sizeof(IEEEtypes_HTInfo_t)); + DBG_HEXDUMP(MDAT_D, "TDLS HT info", + (t_u8 *) (&sta_ptr->HTInfo), + MIN(sizeof(IEEEtypes_HTInfo_t), + MAX_DATA_DUMP_LEN)); + break; + case BSSCO_2040: + memcpy(priv->adapter, (t_u8 *) & sta_ptr->BSSCO_20_40, + pos, sizeof(IEEEtypes_2040BSSCo_t)); + break; + case EXT_CAPABILITY: + memcpy(priv->adapter, (t_u8 *) & sta_ptr->ExtCap, pos, + pos[1] + sizeof(IEEEtypes_Header_t)); + DBG_HEXDUMP(MDAT_D, "TDLS Extended capability", + (t_u8 *) (&sta_ptr->ExtCap), + sta_ptr->ExtCap.ieee_hdr.len + 2); + break; + case RSN_IE: + memcpy(priv->adapter, (t_u8 *) & sta_ptr->rsn_ie, pos, + pos[1] + sizeof(IEEEtypes_Header_t)); + DBG_HEXDUMP(MDAT_D, "TDLS Rsn ie ", + (t_u8 *) (&sta_ptr->rsn_ie), + pos[1] + sizeof(IEEEtypes_Header_t)); + break; + case QOS_INFO: + sta_ptr->qos_info = pos[2]; + PRINTM(MDAT_D, "TDLS qos info %x\n", sta_ptr->qos_info); + break; + case VHT_CAPABILITY: + memcpy(priv->adapter, (t_u8 *) & sta_ptr->vht_cap, pos, + sizeof(IEEEtypes_VHTCap_t)); + sta_ptr->is_11ac_enabled = 1; + DBG_HEXDUMP(MDAT_D, "TDLS VHT capability", + (t_u8 *) (&sta_ptr->vht_cap), + MIN(sizeof(IEEEtypes_VHTCap_t), + MAX_DATA_DUMP_LEN)); + break; + case VHT_OPERATION: + memcpy(priv->adapter, (t_u8 *) & sta_ptr->vht_oprat, + pos, sizeof(IEEEtypes_VHTOprat_t)); + DBG_HEXDUMP(MDAT_D, "TDLS VHT Operation", + (t_u8 *) (&sta_ptr->vht_oprat), + MIN(sizeof(IEEEtypes_VHTOprat_t), + MAX_DATA_DUMP_LEN)); + break; + case AID_INFO: + memcpy(priv->adapter, (t_u8 *) & sta_ptr->aid_info, pos, + sizeof(IEEEtypes_AID_t)); + DBG_HEXDUMP(MDAT_D, "TDLS AID Info", + (t_u8 *) (&sta_ptr->aid_info), + MIN(sizeof(IEEEtypes_AID_t), + MAX_DATA_DUMP_LEN)); + break; + default: + break; + } + } + return; +} + +/** * @brief This function processes received packet and forwards it - * to kernel/upper layer + * to kernel/upper layer * * @param pmadapter A pointer to mlan_adapter - * @param pmbuf A pointer to mlan_buffer which includes the received packet + * @param pmbuf A pointer to mlan_buffer which includes the received packet * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_process_rx_packet(pmlan_adapter pmadapter, pmlan_buffer pmbuf) @@ -88,6 +251,7 @@ wlan_process_rx_packet(pmlan_adapter pmadapter, pmlan_buffer pmbuf) { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; t_u8 appletalk_aarp_type[2] = { 0x80, 0xf3 }; t_u8 ipx_snap_type[2] = { 0x81, 0x37 }; + t_u8 tdls_action_type[2] = { 0x89, 0x0d }; ENTER(); @@ -99,9 +263,9 @@ wlan_process_rx_packet(pmlan_adapter pmadapter, pmlan_buffer pmbuf) /** Size of debugging structure */ #define SIZE_OF_DBG_STRUCT 4 if (prx_pd->rx_pkt_type == PKT_TYPE_DEBUG) { - t_u8 dbgType; - dbgType = *(t_u8 *) & prx_pkt->eth803_hdr; - if (dbgType == DBG_TYPE_SMALL) { + t_u8 dbg_type; + dbg_type = *(t_u8 *) & prx_pkt->eth803_hdr; + if (dbg_type == DBG_TYPE_SMALL) { PRINTM(MFW_D, "\n"); DBG_HEXDUMP(MFW_D, "FWDBG", (char *)((t_u8 *) & prx_pkt->eth803_hdr + @@ -160,6 +324,14 @@ wlan_process_rx_packet(pmlan_adapter pmadapter, pmlan_buffer pmbuf) HEXDUMP("RX Data: LLC/SNAP", (t_u8 *) & prx_pkt->rfc1042_hdr, sizeof(prx_pkt->rfc1042_hdr)); + if (!memcmp + (pmadapter, &prx_pkt->eth803_hdr.h803_len, tdls_action_type, + sizeof(tdls_action_type))) { + wlan_process_tdls_action_frame(priv, + ((t_u8 *) prx_pd + + prx_pd->rx_pkt_offset), + prx_pd->rx_pkt_length); + } /* Chop off the RxPD */ hdr_chop = (t_u32) ((t_ptr) & prx_pkt->eth803_hdr - @@ -196,9 +368,8 @@ wlan_process_rx_packet(pmlan_adapter pmadapter, pmlan_buffer pmbuf) "STA Rx Error: moal_recv_packet returned error\n"); } done: - if (ret != MLAN_STATUS_PENDING) { + if (ret != MLAN_STATUS_PENDING) wlan_free_mlan_buffer(pmadapter, pmbuf); - } LEAVE(); return ret; @@ -223,6 +394,7 @@ wlan_ops_sta_process_rx_packet(IN t_void * adapter, IN pmlan_buffer pmbuf) t_u8 ta[MLAN_MAC_ADDR_LENGTH]; t_u16 rx_pkt_type = 0; wlan_mgmt_pkt *pmgmt_pkt_hdr = MNULL; + sta_node *sta_ptr = MNULL; ENTER(); prx_pd = (RxPD *) (pmbuf->pbuf + pmbuf->data_offset); @@ -274,16 +446,30 @@ wlan_ops_sta_process_rx_packet(IN t_void * adapter, IN pmlan_buffer pmbuf) * If the packet is not an unicast packet then send the packet * directly to os. Don't pass thru rx reordering */ - if (!IS_11N_ENABLED(priv) || + if ((!IS_11N_ENABLED(priv) && + !(prx_pd->flags & RXPD_FLAG_PKT_DIRECT_LINK)) || memcmp(priv->adapter, priv->curr_addr, prx_pkt->eth803_hdr.dest_addr, MLAN_MAC_ADDR_LENGTH)) { wlan_process_rx_packet(pmadapter, pmbuf); goto done; } - if (queuing_ra_based(priv)) { + if (queuing_ra_based(priv) || + (prx_pd->flags & RXPD_FLAG_PKT_DIRECT_LINK)) { memcpy(pmadapter, ta, prx_pkt->eth803_hdr.src_addr, MLAN_MAC_ADDR_LENGTH); + if ((prx_pd->flags & RXPD_FLAG_PKT_DIRECT_LINK) && + (prx_pd->priority < MAX_NUM_TID)) { + PRINTM(MDATA, "tdls packet %p " MACSTR "\n", pmbuf, + MAC2STR(ta)); + sta_ptr = wlan_get_station_entry(priv, ta); + if (sta_ptr) { + sta_ptr->rx_seq[prx_pd->priority] = + prx_pd->seq_num; + sta_ptr->snr = prx_pd->snr; + sta_ptr->nf = prx_pd->nf; + } + } } else { if ((rx_pkt_type != PKT_TYPE_BAR) && (prx_pd->priority < MAX_NUM_TID)) diff --git a/drivers/net/wireless/sd8897/mlan/mlan_sta_tx.c b/drivers/net/wireless/sd8897/mlan/mlan_sta_tx.c index 0033310bab0b..a766e77ed80a 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_sta_tx.c +++ b/drivers/net/wireless/sd8897/mlan/mlan_sta_tx.c @@ -58,7 +58,7 @@ Change log: * @param priv A pointer to mlan_private structure * @param pmbuf A pointer to the mlan_buffer for process * - * @return headptr or MNULL + * @return headptr or MNULL */ t_void * wlan_ops_sta_process_txpd(IN t_void * priv, IN pmlan_buffer pmbuf) @@ -133,6 +133,8 @@ wlan_ops_sta_process_txpd(IN t_void * priv, IN pmlan_buffer pmbuf) MRVDRV_TxPD_POWER_MGMT_LAST_PACKET; } } + if (pmbuf->flags & MLAN_BUF_FLAG_TDLS) + plocal_tx_pd->flags |= MRVDRV_TxPD_FLAGS_TDLS_PACKET; /* Offset of actual data */ plocal_tx_pd->tx_pkt_offset = (t_u16) ((t_ptr) pmbuf->pbuf + pmbuf->data_offset - @@ -166,7 +168,7 @@ done: * @param priv A pointer to mlan_private structure * @param flags Transmit Pkt Flags * - * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, otherwise failure + * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, otherwise failure */ mlan_status wlan_send_null_packet(pmlan_private priv, t_u8 flags) @@ -262,7 +264,7 @@ done: * * @param priv A pointer to mlan_private structure * - * @return MTRUE or MFALSE + * @return MTRUE or MFALSE */ t_u8 wlan_check_last_packet_indication(pmlan_private priv) diff --git a/drivers/net/wireless/sd8897/mlan/mlan_txrx.c b/drivers/net/wireless/sd8897/mlan/mlan_txrx.c index 11e18e7dd832..de29c3ebd3ff 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_txrx.c +++ b/drivers/net/wireless/sd8897/mlan/mlan_txrx.c @@ -97,7 +97,7 @@ wlan_handle_rx_packet(pmlan_adapter pmadapter, pmlan_buffer pmbuf) * @param pmbuf A pointer to the mlan_buffer for process * @param tx_param A pointer to mlan_tx_param structure * - * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, otherwise failure + * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, otherwise failure */ mlan_status wlan_process_tx(pmlan_private priv, pmlan_buffer pmbuf, @@ -279,9 +279,8 @@ wlan_add_buf_bypass_txqueue(mlan_adapter * pmadapter, pmlan_buffer pmbuf) pmlan_private priv = pmadapter->priv[pmbuf->bss_index]; ENTER(); - if (pmbuf->buf_type != MLAN_BUF_TYPE_RAW_DATA) { + if (pmbuf->buf_type != MLAN_BUF_TYPE_RAW_DATA) pmbuf->buf_type = MLAN_BUF_TYPE_DATA; - } pmadapter->callbacks.moal_spin_lock(pmadapter->pmoal_handle, priv->bypass_txq.plock); pmadapter->bypass_pkt_count++; diff --git a/drivers/net/wireless/sd8897/mlan/mlan_uap_cmdevent.c b/drivers/net/wireless/sd8897/mlan/mlan_uap_cmdevent.c index 23cfcda45960..284563a9d475 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_uap_cmdevent.c +++ b/drivers/net/wireless/sd8897/mlan/mlan_uap_cmdevent.c @@ -80,7 +80,7 @@ uap_process_cmdresp_error(mlan_private * pmpriv, HostCmd_DS_COMMAND * resp, /** * @brief This function will return the pointer to station entry in station list - * table which matches the give mac address + * table which matches the give mac address * * @param priv A pointer to mlan_private * @@ -273,6 +273,7 @@ wlan_process_tx_pause_event(pmlan_private priv, pmlan_buffer pevent) sizeof(t_u32)); MrvlIEtypes_tx_pause_t *tx_pause_tlv; sta_node *sta_ptr = MNULL; + t_u8 bc_mac[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; ENTER(); @@ -290,18 +291,38 @@ wlan_process_tx_pause_event(pmlan_private priv, pmlan_buffer pevent) PRINTM(MCMND, "TxPause: " MACSTR " pause=%d, pkts=%d\n", MAC2STR(tx_pause_tlv->peermac), tx_pause_tlv->tx_pause, tx_pause_tlv->pkt_cnt); - sta_ptr = - wlan_get_station_entry(priv, - tx_pause_tlv->peermac); - if (sta_ptr) { - if (sta_ptr->tx_pause != tx_pause_tlv->tx_pause) { - sta_ptr->tx_pause = - tx_pause_tlv->tx_pause; - wlan_update_ralist_tx_pause(priv, - tx_pause_tlv-> - peermac, - tx_pause_tlv-> - tx_pause); + if (!memcmp + (priv->adapter, bc_mac, tx_pause_tlv->peermac, + MLAN_MAC_ADDR_LENGTH)) { + wlan_update_ralist_tx_pause(priv, + tx_pause_tlv-> + peermac, + tx_pause_tlv-> + tx_pause); + } else if (!memcmp + (priv->adapter, priv->curr_addr, + tx_pause_tlv->peermac, + MLAN_MAC_ADDR_LENGTH)) { + if (tx_pause_tlv->tx_pause) + priv->port_open = MFALSE; + else + priv->port_open = MTRUE; + } else { + sta_ptr = + wlan_get_station_entry(priv, + tx_pause_tlv-> + peermac); + if (sta_ptr) { + if (sta_ptr->tx_pause != + tx_pause_tlv->tx_pause) { + sta_ptr->tx_pause = + tx_pause_tlv->tx_pause; + wlan_update_ralist_tx_pause + (priv, + tx_pause_tlv->peermac, + tx_pause_tlv-> + tx_pause); + } } } } @@ -317,8 +338,8 @@ wlan_process_tx_pause_event(pmlan_private priv, pmlan_buffer pevent) /** * @brief This function prepares command for config uap settings * - * @param pmpriv A pointer to mlan_private structure - * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure * @param cmd_action the action: GET or SET * @param pioctl_buf A pointer to mlan_ioctl_req structure * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE @@ -1061,8 +1082,8 @@ wlan_uap_cmd_ap_config(pmlan_private pmpriv, /** * @brief This function prepares command of sys_config * - * @param pmpriv A pointer to mlan_private structure - * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure * @param cmd_action the action: GET or SET * @param pioctl_buf A pointer to mlan_ioctl_req structure * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE @@ -2010,8 +2031,8 @@ wlan_uap_ret_sys_config(IN pmlan_private pmpriv, /** * @brief This function prepares command of snmp_mib * - * @param pmpriv A pointer to mlan_private structure - * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure * @param cmd_action the action: GET or SET * @param cmd_oid Cmd oid: treated as sub command * @param pioctl_buf A pointer to mlan_ioctl_req structure @@ -2249,8 +2270,8 @@ wlan_uap_ret_snmp_mib(IN pmlan_private pmpriv, /** * @brief This function prepares command of deauth station * - * @param pmpriv A pointer to mlan_private structure - * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure * @param pdata_buf A pointer to data buffer * @return MLAN_STATUS_SUCCESS */ @@ -2291,191 +2312,204 @@ wlan_uap_cmd_key_material(IN pmlan_private pmpriv, HostCmd_DS_802_11_KEY_MATERIAL *pkey_material = &cmd->params.key_material; mlan_ds_encrypt_key *pkey = (mlan_ds_encrypt_key *) pdata_buf; - MrvlIEtypes_MacAddr_t *tlv = MNULL; - const t_u8 bc_mac[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - t_u16 key_param_len = 0; mlan_status ret = MLAN_STATUS_SUCCESS; sta_node *sta_ptr = MNULL; ENTER(); - + if (!pkey) { + ret = MLAN_STATUS_FAILURE; + goto done; + } cmd->command = wlan_cpu_to_le16(HostCmd_CMD_802_11_KEY_MATERIAL); pkey_material->action = wlan_cpu_to_le16(cmd_action); - if (cmd_action == HostCmd_ACT_GEN_GET) { cmd->size = wlan_cpu_to_le16(sizeof(pkey_material->action) + S_DS_GEN); goto done; } - memset(pmpriv->adapter, &pkey_material->key_param_set, 0, - sizeof(MrvlIEtype_KeyParamSet_t)); + sizeof(MrvlIEtype_KeyParamSetV2_t)); + if (pkey->key_flags & KEY_FLAG_REMOVE_KEY) { + pkey_material->action = + wlan_cpu_to_le16(HostCmd_ACT_GEN_REMOVE); + pkey_material->key_param_set.type = + wlan_cpu_to_le16(TLV_TYPE_KEY_PARAM_V2); + pkey_material->key_param_set.length = + wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN); + pkey_material->key_param_set.key_idx = + pkey->key_index & KEY_INDEX_MASK; + pkey_material->key_param_set.key_info = + KEY_INFO_MCAST_KEY | KEY_INFO_UCAST_KEY; + memcpy(pmpriv->adapter, pkey_material->key_param_set.mac_addr, + pkey->mac_addr, MLAN_MAC_ADDR_LENGTH); + cmd->size = + wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + + S_DS_GEN + KEY_PARAMS_FIXED_LEN + + sizeof(pkey_material->action)); + PRINTM(MCMND, "Remove Key\n"); + goto done; + } + pkey_material->action = wlan_cpu_to_le16(HostCmd_ACT_GEN_SET); + pkey_material->key_param_set.key_idx = pkey->key_index & KEY_INDEX_MASK; + pkey_material->key_param_set.type = + wlan_cpu_to_le16(TLV_TYPE_KEY_PARAM_V2); + pkey_material->key_param_set.key_info = KEY_INFO_ENABLE_KEY; + memcpy(pmpriv->adapter, pkey_material->key_param_set.mac_addr, + pkey->mac_addr, MLAN_MAC_ADDR_LENGTH); + if (pkey->key_len <= MAX_WEP_KEY_SIZE) { + pkey_material->key_param_set.length = + wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN + + sizeof(wep_param_t)); + pkey_material->key_param_set.key_type = + wlan_cpu_to_le16(KEY_TYPE_ID_WEP); + pkey_material->key_param_set.key_info |= + KEY_INFO_MCAST_KEY | KEY_INFO_UCAST_KEY; + if (pkey_material->key_param_set.key_idx == + (pmpriv->wep_key_curr_index & KEY_INDEX_MASK)) + pkey_material->key_param_set.key_info |= + KEY_INFO_DEFAULT_KEY; + pkey_material->key_param_set.key_info = + wlan_cpu_to_le16(pkey_material->key_param_set.key_info); + pkey_material->key_param_set.key_params.wep.key_len = + wlan_cpu_to_le16(pkey->key_len); + memcpy(pmpriv->adapter, + pkey_material->key_param_set.key_params.wep.key, + pkey->key_material, pkey->key_len); + cmd->size = + wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + + S_DS_GEN + KEY_PARAMS_FIXED_LEN + + sizeof(wep_param_t) + + sizeof(pkey_material->action)); + PRINTM(MCMND, "Set WEP Key\n"); + goto done; + } + if (pkey->key_flags & KEY_FLAG_GROUP_KEY) + pkey_material->key_param_set.key_info |= KEY_INFO_MCAST_KEY; + else + pkey_material->key_param_set.key_info |= KEY_INFO_UCAST_KEY; + if (pkey->key_flags & KEY_FLAG_AES_MCAST_IGTK) + pkey_material->key_param_set.key_info = KEY_INFO_CMAC_AES_KEY; + if (pkey->key_flags & KEY_FLAG_SET_TX_KEY) + pkey_material->key_param_set.key_info |= + KEY_INFO_TX_KEY | KEY_INFO_RX_KEY; + else + pkey_material->key_param_set.key_info |= KEY_INFO_TX_KEY; if (pkey->is_wapi_key) { - PRINTM(MINFO, "Set WAPI Key\n"); - pkey_material->key_param_set.key_type_id = + pkey_material->key_param_set.key_type = wlan_cpu_to_le16(KEY_TYPE_ID_WAPI); - if (cmd_oid == KEY_INFO_ENABLED) - pkey_material->key_param_set.key_info = - wlan_cpu_to_le16(KEY_INFO_WAPI_ENABLED); - else - pkey_material->key_param_set.key_info = - !(wlan_cpu_to_le16(KEY_INFO_WAPI_ENABLED)); - - pkey_material->key_param_set.key[0] = pkey->key_index; + memcpy(pmpriv->adapter, + pkey_material->key_param_set.key_params.wapi.pn, + pkey->pn, PN_SIZE); + pkey_material->key_param_set.key_params.wapi.key_len = + MIN(WAPI_KEY_SIZE, wlan_cpu_to_le16(pkey->key_len)); + memcpy(pmpriv->adapter, + pkey_material->key_param_set.key_params.wapi.key, + pkey->key_material, MIN(WAPI_KEY_SIZE, pkey->key_len)); if (!pmpriv->sec_info.wapi_key_on) - pkey_material->key_param_set.key[1] = 1; - else - pkey_material->key_param_set.key[1] = 0; /* set - 0 - when - re-key - */ - - if (0 != memcmp(pmpriv->adapter, pkey->mac_addr, bc_mac, sizeof(bc_mac))) { /* WAPI - pairwise - key: - unicast - */ pkey_material->key_param_set.key_info |= - wlan_cpu_to_le16(KEY_INFO_WAPI_UNICAST); + KEY_INFO_DEFAULT_KEY; + if (pkey->key_flags & KEY_FLAG_GROUP_KEY) { + pmpriv->sec_info.wapi_key_on = MTRUE; + } else { + /* WAPI pairwise key: unicast */ sta_ptr = wlan_add_station_entry(pmpriv, pkey->mac_addr); if (sta_ptr) { PRINTM(MCMND, "station: wapi_key_on\n"); sta_ptr->wapi_key_on = MTRUE; } - } else { /* WAPI group key: multicast */ - pkey_material->key_param_set.key_info |= - wlan_cpu_to_le16(KEY_INFO_WAPI_MCAST); - pmpriv->sec_info.wapi_key_on = MTRUE; } - pkey_material->key_param_set.type = - wlan_cpu_to_le16(TLV_TYPE_KEY_MATERIAL); - pkey_material->key_param_set.key_len = - wlan_cpu_to_le16(WAPI_KEY_LEN); - memcpy(pmpriv->adapter, &pkey_material->key_param_set.key[2], - pkey->key_material, pkey->key_len); + pkey_material->key_param_set.key_info = + wlan_cpu_to_le16(pkey_material->key_param_set.key_info); pkey_material->key_param_set.length = - wlan_cpu_to_le16(WAPI_KEY_LEN + KEYPARAMSET_FIXED_LEN); - - key_param_len = - (WAPI_KEY_LEN + KEYPARAMSET_FIXED_LEN) + - sizeof(MrvlIEtypesHeader_t); - tlv = (MrvlIEtypes_MacAddr_t *) ((t_u8 *) & pkey_material-> - key_param_set + key_param_len); - tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_STA_MAC_ADDRESS); - tlv->header.len = wlan_cpu_to_le16(MLAN_MAC_ADDR_LENGTH); - memcpy(pmpriv->adapter, tlv->mac, pkey->mac_addr, - MLAN_MAC_ADDR_LENGTH); + wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN + + sizeof(wapi_param)); cmd->size = - wlan_cpu_to_le16(key_param_len + - sizeof(pkey_material->action) + - S_DS_GEN + - sizeof(MrvlIEtypes_MacAddr_t)); + wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + + S_DS_GEN + KEY_PARAMS_FIXED_LEN + + sizeof(wapi_param) + + sizeof(pkey_material->action)); + PRINTM(MCMND, "Set WAPI Key\n"); goto done; } - /* IGTK key length is the same as AES key length */ + pkey_material->key_param_set.key_info |= KEY_INFO_DEFAULT_KEY; + pkey_material->key_param_set.key_info = + wlan_cpu_to_le16(pkey_material->key_param_set.key_info); if (pkey->key_len == WPA_AES_KEY_LEN && !(pkey->key_flags & KEY_FLAG_AES_MCAST_IGTK)) { - PRINTM(MCMND, "WPA_AES\n"); - pkey_material->key_param_set.key_type_id = + if (pkey-> + key_flags & (KEY_FLAG_RX_SEQ_VALID | KEY_FLAG_TX_SEQ_VALID)) + memcpy(pmpriv->adapter, + pkey_material->key_param_set.key_params.aes.pn, + pkey->pn, SEQ_MAX_SIZE); + pkey_material->key_param_set.key_type = wlan_cpu_to_le16(KEY_TYPE_ID_AES); - if (cmd_oid == KEY_INFO_ENABLED) - pkey_material->key_param_set.key_info = - wlan_cpu_to_le16(KEY_INFO_AES_ENABLED); - else - pkey_material->key_param_set.key_info = - !(wlan_cpu_to_le16(KEY_INFO_AES_ENABLED)); - - if (memcmp(pmpriv->adapter, pkey->mac_addr, bc_mac, sizeof(bc_mac))) /* AES - pairwise - key: - unicast - */ - pkey_material->key_param_set.key_info |= - wlan_cpu_to_le16(KEY_INFO_AES_UNICAST); - else /* AES group key: multicast */ - pkey_material->key_param_set.key_info |= - wlan_cpu_to_le16(KEY_INFO_AES_MCAST); - } else if ((pkey->key_flags & KEY_FLAG_AES_MCAST_IGTK) && - pkey->key_len == WPA_IGTK_KEY_LEN) { - PRINTM(MCMND, "WPA_AES_CMAC\n"); - pkey_material->key_param_set.key_type_id = - wlan_cpu_to_le16(KEY_TYPE_ID_AES_CMAC); - if (cmd_oid == KEY_INFO_ENABLED) - pkey_material->key_param_set.key_info = - wlan_cpu_to_le16(KEY_INFO_AES_ENABLED); - else - pkey_material->key_param_set.key_info = - !(wlan_cpu_to_le16(KEY_INFO_AES_ENABLED)); - + pkey_material->key_param_set.key_params.aes.key_len = + wlan_cpu_to_le16(pkey->key_len); + memcpy(pmpriv->adapter, + pkey_material->key_param_set.key_params.aes.key, + pkey->key_material, pkey->key_len); + pkey_material->key_param_set.length = + wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN + + sizeof(aes_param)); + cmd->size = + wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + + S_DS_GEN + KEY_PARAMS_FIXED_LEN + + sizeof(aes_param) + + sizeof(pkey_material->action)); + PRINTM(MCMND, "Set AES Key\n"); + goto done; + } + if (pkey->key_len == WPA_IGTK_KEY_LEN && + (pkey->key_flags & KEY_FLAG_AES_MCAST_IGTK)) { + if (pkey-> + key_flags & (KEY_FLAG_RX_SEQ_VALID | KEY_FLAG_TX_SEQ_VALID)) + memcpy(pmpriv->adapter, + pkey_material->key_param_set.key_params.cmac_aes. + ipn, pkey->pn, SEQ_MAX_SIZE); + pkey_material->key_param_set.key_info &= ~KEY_INFO_MCAST_KEY; pkey_material->key_param_set.key_info |= wlan_cpu_to_le16(KEY_INFO_AES_MCAST_IGTK); - } else if (pkey->key_len == WPA_TKIP_KEY_LEN) { - PRINTM(MCMND, "WPA_TKIP\n"); - pkey_material->key_param_set.key_type_id = - wlan_cpu_to_le16(KEY_TYPE_ID_TKIP); - pkey_material->key_param_set.key_info = - wlan_cpu_to_le16(KEY_INFO_TKIP_ENABLED); - - if (memcmp(pmpriv->adapter, pkey->mac_addr, bc_mac, sizeof(bc_mac))) /* TKIP - pairwise - key: - unicast - */ - pkey_material->key_param_set.key_info |= - wlan_cpu_to_le16(KEY_INFO_TKIP_UNICAST); - else /* TKIP group key: multicast */ - pkey_material->key_param_set.key_info |= - wlan_cpu_to_le16(KEY_INFO_TKIP_MCAST); + pkey_material->key_param_set.key_type = KEY_TYPE_ID_AES_CMAC; + pkey_material->key_param_set.key_params.cmac_aes.key_len = + wlan_cpu_to_le16(pkey->key_len); + memcpy(pmpriv->adapter, + pkey_material->key_param_set.key_params.cmac_aes.key, + pkey->key_material, pkey->key_len); + pkey_material->key_param_set.length = + wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN + + sizeof(cmac_aes_param)); + cmd->size = + wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + + S_DS_GEN + KEY_PARAMS_FIXED_LEN + + sizeof(cmac_aes_param) + + sizeof(pkey_material->action)); + PRINTM(MCMND, "Set CMAC AES Key\n"); + goto done; } - - if (pkey_material->key_param_set.key_type_id) { - pkey_material->key_param_set.type = - wlan_cpu_to_le16(TLV_TYPE_KEY_MATERIAL); - pkey_material->key_param_set.key_len = + if (pkey->key_len == WPA_TKIP_KEY_LEN) { + if (pkey-> + key_flags & (KEY_FLAG_RX_SEQ_VALID | KEY_FLAG_TX_SEQ_VALID)) + memcpy(pmpriv->adapter, + pkey_material->key_param_set.key_params.tkip.pn, + pkey->pn, SEQ_MAX_SIZE); + pkey_material->key_param_set.key_type = + wlan_cpu_to_le16(KEY_TYPE_ID_TKIP); + pkey_material->key_param_set.key_params.tkip.key_len = wlan_cpu_to_le16(pkey->key_len); - memcpy(pmpriv->adapter, pkey_material->key_param_set.key, + memcpy(pmpriv->adapter, + pkey_material->key_param_set.key_params.tkip.key, pkey->key_material, pkey->key_len); pkey_material->key_param_set.length = - wlan_cpu_to_le16((t_u16) pkey->key_len + - KEYPARAMSET_FIXED_LEN); - key_param_len = - (pkey->key_len + KEYPARAMSET_FIXED_LEN) + - sizeof(MrvlIEtypesHeader_t); - /* key format with pn field is defined in Key Material V1 */ - if (pkey_material->key_param_set.key_type_id == - wlan_cpu_to_le16(KEY_TYPE_ID_AES_CMAC)) { - cmac_param *param; - param = (cmac_param *) pkey_material->key_param_set.key; - memcpy(pmpriv->adapter, param->ipn, pkey->pn, - SEQ_MAX_SIZE); - memcpy(pmpriv->adapter, param->key, pkey->key_material, - pkey->key_len); - - pkey_material->key_param_set.key_len = - wlan_cpu_to_le16((t_u16) sizeof(cmac_param)); - pkey_material->key_param_set.length = - wlan_cpu_to_le16((t_u16) sizeof(cmac_param) + - KEYPARAMSET_FIXED_LEN); - key_param_len = - (t_u16) (sizeof(cmac_param) + - KEYPARAMSET_FIXED_LEN) + - sizeof(MrvlIEtypesHeader_t); - } - - tlv = (MrvlIEtypes_MacAddr_t *) ((t_u8 *) & pkey_material-> - key_param_set + key_param_len); - tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_STA_MAC_ADDRESS); - tlv->header.len = wlan_cpu_to_le16(MLAN_MAC_ADDR_LENGTH); - memcpy(pmpriv->adapter, tlv->mac, pkey->mac_addr, - MLAN_MAC_ADDR_LENGTH); + wlan_cpu_to_le16(KEY_PARAMS_FIXED_LEN + + sizeof(tkip_param)); cmd->size = - wlan_cpu_to_le16(key_param_len + - sizeof(pkey_material->action) + - S_DS_GEN + - sizeof(MrvlIEtypes_MacAddr_t)); + wlan_cpu_to_le16(sizeof(MrvlIEtypesHeader_t) + + S_DS_GEN + KEY_PARAMS_FIXED_LEN + + sizeof(tkip_param) + + sizeof(pkey_material->action)); + PRINTM(MCMND, "Set TKIP Key\n"); } done: LEAVE(); @@ -2673,8 +2707,8 @@ wlan_check_uap_capability(pmlan_private priv, pmlan_buffer pevent) (MrvlIEtypesHeader_t *) (pevent->pbuf + pevent->data_offset + BSS_START_EVENT_FIX_SIZE); const t_u8 wmm_oui[4] = { 0x00, 0x50, 0xf2, 0x02 }; - IEEEtypes_WmmParameter_t WmmParamIe; - MrvlIEtypes_channel_band_t *pChanInfo; + IEEEtypes_WmmParameter_t wmm_param_ie; + MrvlIEtypes_channel_band_t *pchan_info; priv->wmm_enabled = MFALSE; priv->pkt_fwd = MFALSE; priv->is_11n_enabled = MFALSE; @@ -2711,13 +2745,13 @@ wlan_check_uap_capability(pmlan_private priv, pmlan_buffer pevent) priv->wmm_enabled = MFALSE; wlan_wmm_setup_ac_downgrade(priv); priv->wmm_enabled = MTRUE; - memcpy(priv->adapter, &WmmParamIe, + memcpy(priv->adapter, &wmm_param_ie, ((t_u8 *) tlv + 2), sizeof(IEEEtypes_WmmParameter_t)); - WmmParamIe.vend_hdr.len = (t_u8) tlv_len; - WmmParamIe.vend_hdr.element_id = WMM_IE; + wmm_param_ie.vend_hdr.len = (t_u8) tlv_len; + wmm_param_ie.vend_hdr.element_id = WMM_IE; wlan_wmm_setup_queue_priorities(priv, - &WmmParamIe); + &wmm_param_ie); } } if (tlv_type == TLV_TYPE_UAP_PKT_FWD_CTL) { @@ -2735,8 +2769,8 @@ wlan_check_uap_capability(pmlan_private priv, pmlan_buffer pevent) if (tlv_type == TLV_TYPE_UAP_CHAN_BAND_CONFIG) { DBG_HEXDUMP(MCMD_D, "chan_band_config tlv", tlv, tlv_len + sizeof(MrvlIEtypesHeader_t)); - pChanInfo = (MrvlIEtypes_channel_band_t *) tlv; - priv->uap_channel = pChanInfo->channel; + pchan_info = (MrvlIEtypes_channel_band_t *) tlv; + priv->uap_channel = pchan_info->channel; PRINTM(MCMND, "uap_channel FW: 0x%x\n", priv->uap_channel); } @@ -2810,7 +2844,7 @@ wlan_update_wapi_info_tlv(pmlan_private priv, pmlan_buffer pevent) /** * @brief This function send sta_assoc_event to moal - * payload with sta mac address and assoc ie. + * payload with sta mac address and assoc ie. * * @param priv A pointer to mlan_private * @param pevent A pointer to mlan_event buffer @@ -3169,6 +3203,7 @@ wlan_ops_uap_process_cmdresp(IN t_void * priv, if (pmpriv->adapter->state_rdh.stage == RDH_STOP_INTFS) wlan_11h_radar_detected_callback((t_void *) pmpriv); + break; case HOST_CMD_APCMD_BSS_START: if (pmpriv->adapter->state_rdh.stage == RDH_RESTART_INTFS) @@ -3390,6 +3425,7 @@ wlan_ops_uap_process_event(IN t_void * priv) case EVENT_MICRO_AP_BSS_ACTIVE: PRINTM(MEVENT, "EVENT: MICRO_AP_BSS_ACTIVE\n"); pmpriv->media_connected = MTRUE; + pmpriv->port_open = MTRUE; pevent->event_id = MLAN_EVENT_ID_UAP_FW_BSS_ACTIVE; break; case EVENT_MICRO_AP_BSS_IDLE: @@ -3399,9 +3435,10 @@ wlan_ops_uap_process_event(IN t_void * priv) wlan_clean_txrx(pmpriv); wlan_notify_station_deauth(pmpriv); wlan_delete_station_list(pmpriv); + pmpriv->port_open = MFALSE; break; case EVENT_PS_AWAKE: - PRINTM(MINFO, "EVENT: AWAKE \n"); + PRINTM(MINFO, "EVENT: AWAKE\n"); PRINTM(MEVENT, "||"); /* Handle unexpected PS AWAKE event */ if (pmadapter->ps_state == PS_STATE_SLEEP_CFM) @@ -3612,10 +3649,10 @@ done: /** * @brief This function issues commands to initialize firmware * - * @param priv A pointer to mlan_private structure - * @param first_bss flag for first BSS + * @param priv A pointer to mlan_private structure + * @param first_bss flag for first BSS * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_PENDING or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_PENDING or MLAN_STATUS_FAILURE */ mlan_status wlan_ops_uap_init_cmd(IN t_void * priv, IN t_u8 first_bss) diff --git a/drivers/net/wireless/sd8897/mlan/mlan_uap_ioctl.c b/drivers/net/wireless/sd8897/mlan/mlan_uap_ioctl.c index 88d89e2573e6..00fc8fe71890 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_uap_ioctl.c +++ b/drivers/net/wireless/sd8897/mlan/mlan_uap_ioctl.c @@ -245,9 +245,8 @@ wlan_uap_bss_ioctl_reset(IN pmlan_adapter pmadapter, /* * Reset any uap private parameters here */ - for (i = 0; i < pmadapter->max_mgmt_ie_index; i++) { + for (i = 0; i < pmadapter->max_mgmt_ie_index; i++) memset(pmadapter, &pmpriv->mgmt_ie[i], 0, sizeof(custom_ie)); - } pmpriv->add_ba_param.timeout = MLAN_DEFAULT_BLOCK_ACK_TIMEOUT; pmpriv->add_ba_param.tx_win_size = MLAN_UAP_AMPDU_DEF_TXWINSIZE; pmpriv->add_ba_param.rx_win_size = MLAN_UAP_AMPDU_DEF_RXWINSIZE; @@ -571,7 +570,7 @@ wlan_uap_set_wapi_ie(mlan_private * priv, pmlan_ioctl_req pioctl_req) misc = (mlan_ds_misc_cfg *) pioctl_req->pbuf; if (misc->param.gen_ie.len) { if (misc->param.gen_ie.len > sizeof(priv->wapi_ie)) { - PRINTM(MWARN, "failed to copy WAPI IE, too big \n"); + PRINTM(MWARN, "failed to copy WAPI IE, too big\n"); pioctl_req->status_code = MLAN_ERROR_INVALID_PARAMETER; LEAVE(); return MLAN_STATUS_FAILURE; @@ -705,7 +704,8 @@ wlan_uap_sec_ioctl_set_encrypt_key(IN pmlan_adapter pmadapter, LEAVE(); return MLAN_STATUS_FAILURE; } - if (!sec->param.encrypt_key.key_len) { + if (!sec->param.encrypt_key.key_remove && + !sec->param.encrypt_key.key_len) { PRINTM(MCMND, "Skip set key with key_len = 0\n"); LEAVE(); return ret; @@ -1357,6 +1357,12 @@ wlan_ops_uap_ioctl(t_void * adapter, pmlan_ioctl_req pioctl_req) pget_info->param.fw_info.fw_bands = pmadapter->fw_bands; pget_info->param.fw_info.hw_dev_mcs_support = pmadapter->hw_dev_mcs_support; + pget_info->param.fw_info.hw_dot_11n_dev_cap = + pmadapter->hw_dot_11n_dev_cap; + pget_info->param.fw_info.hw_dot_11ac_mcs_support = + pmadapter->hw_dot_11ac_mcs_support; + pget_info->param.fw_info.hw_dot_11ac_dev_cap = + pmadapter->hw_dot_11ac_dev_cap; pget_info->param.fw_info.region_code = pmadapter->region_code; } @@ -1412,16 +1418,13 @@ wlan_ops_uap_ioctl(t_void * adapter, pmlan_ioctl_req pioctl_req) if (pm->sub_command == MLAN_OID_PM_CFG_DEEP_SLEEP) status = wlan_uap_pm_ioctl_deepsleep(pmadapter, pioctl_req); - if (pm->sub_command == MLAN_OID_PM_CFG_HS_CFG) { + if (pm->sub_command == MLAN_OID_PM_CFG_HS_CFG) status = wlan_pm_ioctl_hscfg(pmadapter, pioctl_req); - } - if (pm->sub_command == MLAN_OID_PM_HS_WAKEUP_REASON) { + if (pm->sub_command == MLAN_OID_PM_HS_WAKEUP_REASON) status = wlan_get_hs_wakeup_reason(pmadapter, pioctl_req); - } - if (pm->sub_command == MLAN_OID_PM_INFO) { + if (pm->sub_command == MLAN_OID_PM_INFO) status = wlan_get_pm_info(pmadapter, pioctl_req); - } break; case MLAN_IOCTL_SNMP_MIB: snmp = (mlan_ds_snmp_mib *) pioctl_req->pbuf; diff --git a/drivers/net/wireless/sd8897/mlan/mlan_uap_txrx.c b/drivers/net/wireless/sd8897/mlan/mlan_uap_txrx.c index 14240f28e723..6333bd282e2e 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_uap_txrx.c +++ b/drivers/net/wireless/sd8897/mlan/mlan_uap_txrx.c @@ -47,12 +47,12 @@ Change log: /** * @brief This function processes received packet and forwards it - * to kernel/upper layer + * to kernel/upper layer * * @param pmadapter A pointer to mlan_adapter * @param pmbuf A pointer to mlan_buffer which includes the received packet * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_upload_uap_rx_packet(pmlan_adapter pmadapter, pmlan_buffer pmbuf) @@ -89,9 +89,8 @@ wlan_upload_uap_rx_packet(pmlan_adapter pmadapter, pmlan_buffer pmbuf) pmbuf->status_code = MLAN_ERROR_PKT_INVALID; } - if (ret != MLAN_STATUS_PENDING) { + if (ret != MLAN_STATUS_PENDING) wlan_free_mlan_buffer(pmadapter, pmbuf); - } LEAVE(); return ret; @@ -153,7 +152,7 @@ wlan_check_unicast_packet(mlan_private * priv, t_u8 * mac) * @param priv A pointer to mlan_private structure * @param pmbuf A pointer to the mlan_buffer for process * - * @return headptr or MNULL + * @return headptr or MNULL */ t_void * wlan_ops_uap_process_txpd(IN t_void * priv, IN pmlan_buffer pmbuf) @@ -250,12 +249,12 @@ done: /** * @brief This function processes received packet and forwards it - * to kernel/upper layer + * to kernel/upper layer * * @param adapter A pointer to mlan_adapter * @param pmbuf A pointer to mlan_buffer which includes the received packet * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_ops_uap_process_rx_packet(IN t_void * adapter, IN pmlan_buffer pmbuf) @@ -355,12 +354,12 @@ done: /** * @brief This function processes received packet and forwards it - * to kernel/upper layer or send back to firmware + * to kernel/upper layer or send back to firmware * * @param priv A pointer to mlan_private * @param pmbuf A pointer to mlan_buffer which includes the received packet * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_uap_recv_packet(IN mlan_private * priv, IN pmlan_buffer pmbuf) @@ -476,12 +475,12 @@ done: /** * @brief This function processes received packet and forwards it - * to kernel/upper layer or send back to firmware + * to kernel/upper layer or send back to firmware * * @param priv A pointer to mlan_private * @param pmbuf A pointer to mlan_buffer which includes the received packet * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status wlan_process_uap_rx_packet(IN mlan_private * priv, IN pmlan_buffer pmbuf) @@ -600,9 +599,8 @@ upload: pmbuf->status_code = MLAN_ERROR_PKT_INVALID; } - if (ret != MLAN_STATUS_PENDING) { + if (ret != MLAN_STATUS_PENDING) wlan_free_mlan_buffer(pmadapter, pmbuf); - } done: LEAVE(); return ret; diff --git a/drivers/net/wireless/sd8897/mlan/mlan_util.h b/drivers/net/wireless/sd8897/mlan/mlan_util.h index a0ef370a11e6..caced4dc621b 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_util.h +++ b/drivers/net/wireless/sd8897/mlan/mlan_util.h @@ -126,9 +126,8 @@ util_peek_list(t_void * pmoal_handle, if (moal_spin_lock) moal_spin_lock(pmoal_handle, phead->plock); - if (phead->pnext != (pmlan_linked_list) phead) { + if (phead->pnext != (pmlan_linked_list) phead) pnode = phead->pnext; - } if (moal_spin_unlock) moal_spin_unlock(pmoal_handle, phead->plock); return pnode; @@ -253,11 +252,10 @@ util_dequeue_list(t_void * pmoal_handle, if (moal_spin_lock) moal_spin_lock(pmoal_handle, phead->plock); pnode = phead->pnext; - if (pnode && (pnode != (pmlan_linked_list) phead)) { + if (pnode && (pnode != (pmlan_linked_list) phead)) util_unlink_list(pmoal_handle, phead, pnode, 0, 0); - } else { + else pnode = 0; - } if (moal_spin_unlock) moal_spin_unlock(pmoal_handle, phead->plock); return pnode; @@ -468,15 +466,15 @@ util_scalar_offset(t_void * pmoal_handle, * @brief This function writes the value to the scalar * if existing value compared with other value is true. * - * @param pscalar Pointer to scalar - * @param condition Condition to check - * @param val_compare Value to compare against current value - * ((A X B), where B = val_compare) - * @param val_to_set Value to set if comparison is true - * @param moal_spin_lock A pointer to spin lock handler - * @param moal_spin_unlock A pointer to spin unlock handler + * @param pscalar Pointer to scalar + * @param condition Condition to check + * @param val_compare Value to compare against current value + * ((A X B), where B = val_compare) + * @param val_to_set Value to set if comparison is true + * @param moal_spin_lock A pointer to spin lock handler + * @param moal_spin_unlock A pointer to spin unlock handler * - * @return Comparison result (MTRUE or MFALSE) + * @return Comparison result (MTRUE or MFALSE) */ static INLINE t_u8 util_scalar_conditional_write(t_void * pmoal_handle, diff --git a/drivers/net/wireless/sd8897/mlan/mlan_wmm.c b/drivers/net/wireless/sd8897/mlan/mlan_wmm.c index 78183129990f..9ccb89bba0bf 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_wmm.c +++ b/drivers/net/wireless/sd8897/mlan/mlan_wmm.c @@ -215,6 +215,56 @@ done: } /** + * @brief Add packet to TDLS pending TX queue + * + * @param priv A pointer to mlan_private + * @param pmbuf Pointer to the mlan_buffer data struct + * + * @return N/A + */ +static t_void +wlan_add_buf_tdls_txqueue(pmlan_private priv, pmlan_buffer pmbuf) +{ + mlan_adapter *pmadapter = priv->adapter; + ENTER(); + util_enqueue_list_tail(pmadapter->pmoal_handle, &priv->tdls_pending_txq, + (pmlan_linked_list) pmbuf, + pmadapter->callbacks.moal_spin_lock, + pmadapter->callbacks.moal_spin_unlock); + LEAVE(); +} + +/** + * @brief Clean up the tdls pending TX queue + * + * @param priv A pointer to mlan_private + * + * @return N/A + */ +static t_void +wlan_cleanup_tdls_txq(pmlan_private priv) +{ + pmlan_buffer pmbuf; + mlan_adapter *pmadapter = priv->adapter; + ENTER(); + + pmadapter->callbacks.moal_spin_lock(pmadapter->pmoal_handle, + priv->tdls_pending_txq.plock); + while ((pmbuf = + (pmlan_buffer) util_peek_list(pmadapter->pmoal_handle, + &priv->tdls_pending_txq, MNULL, + MNULL))) { + util_unlink_list(pmadapter->pmoal_handle, + &priv->tdls_pending_txq, + (pmlan_linked_list) pmbuf, MNULL, MNULL); + wlan_write_data_complete(pmadapter, pmbuf, MLAN_STATUS_FAILURE); + } + pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle, + priv->tdls_pending_txq.plock); + LEAVE(); +} + +/** * @brief Map ACs to TID * * @param priv Pointer to the mlan_private driver data struct @@ -234,9 +284,8 @@ wlan_wmm_queue_priorities_tid(pmlan_private priv, t_u8 queue_priority[]) tos_to_tid[6 - (i * 2)] = ac_to_tid[queue_priority[i]][0]; } - for (i = 0; i < MAX_NUM_TID; i++) { + for (i = 0; i < MAX_NUM_TID; i++) tos_to_tid_inv[tos_to_tid[i]] = (t_u8) i; - } /* in case priorities have changed, force highest priority so next packet will check from top to re-establish the highest */ @@ -323,10 +372,10 @@ wlan_wmm_convert_tos_to_ac(pmlan_adapter pmadapter, t_u32 tos) * @brief Evaluate a given TID and downgrade it to a lower TID if the * WMM Parameter IE received from the AP indicates that the AP * is disabled (due to call admission control (ACM bit). Mapping - * of TID to AC is taken care internally + * of TID to AC is taken care internally * * @param priv Pointer to the mlan_private data struct - * @param tid tid to evaluate for downgrading + * @param tid tid to evaluate for downgrading * * @return Same tid as input if downgrading not required or * the tid the traffic for the given tid should be downgraded to @@ -358,10 +407,10 @@ wlan_wmm_downgrade_tid(pmlan_private priv, t_u32 tid) /** * @brief Delete packets in RA node * - * @param priv Pointer to the mlan_private driver data struct - * @param ra_list Pointer to raListTbl + * @param priv Pointer to the mlan_private driver data struct + * @param ra_list Pointer to raListTbl * - * @return N/A + * @return N/A */ static INLINE void wlan_wmm_del_pkts_in_ralist_node(pmlan_private priv, raListTbl * ra_list) @@ -431,6 +480,7 @@ wlan_wmm_cleanup_queues(pmlan_private priv) wlan_wmm_del_pkts_in_ralist(priv, &priv->wmm.tid_tbl_ptr[i].ra_list); priv->wmm.pkts_queued[i] = 0; + priv->wmm.pkts_paused[i] = 0; } util_scalar_write(priv->adapter->pmoal_handle, &priv->wmm.tx_pkts_queued, 0, MNULL, MNULL); @@ -523,25 +573,25 @@ wlan_wmm_get_queue_raptr(pmlan_private priv, t_u8 tid, t_u8 * ra_addr) #ifdef STA_SUPPORT /** - * @brief Sends wmmac host event + * @brief Sends wmmac host event * - * @param priv Pointer to the mlan_private driver data struct - * @param typeStr Type of host event - * @param srcAddr Pointer to the source Address - * @param tid TID - * @param up User priority - * @param status Status code or Reason code + * @param priv Pointer to the mlan_private driver data struct + * @param type_str Type of host event + * @param src_addr Pointer to the source Address + * @param tid TID + * @param up User priority + * @param status Status code or Reason code * - * @return N/A + * @return N/A */ static void wlan_send_wmmac_host_event(pmlan_private priv, - char *typeStr, - t_u8 * srcAddr, t_u8 tid, t_u8 up, t_u8 status) + char *type_str, + t_u8 * src_addr, t_u8 tid, t_u8 up, t_u8 status) { t_u8 event_buf[100]; mlan_event *pevent; - t_u8 *pOutBuf; + t_u8 *pout_buf; ENTER(); @@ -549,38 +599,39 @@ wlan_send_wmmac_host_event(pmlan_private priv, TSPEC:ADDTS_RSP:[<status code>]:TID=X:UP=Y ** - TSPEC:DELTS_RX:[<reason code>]:TID=X:UP=Y */ pevent = (mlan_event *) event_buf; - pOutBuf = pevent->event_buf; + pout_buf = pevent->event_buf; - memcpy(priv->adapter, pOutBuf, (t_u8 *) "TSPEC:", 6); - pOutBuf += 6; + memcpy(priv->adapter, pout_buf, (t_u8 *) "TSPEC:", 6); + pout_buf += 6; - memcpy(priv->adapter, pOutBuf, (t_u8 *) typeStr, wlan_strlen(typeStr)); - pOutBuf += wlan_strlen(typeStr); + memcpy(priv->adapter, pout_buf, (t_u8 *) type_str, + wlan_strlen(type_str)); + pout_buf += wlan_strlen(type_str); - *pOutBuf++ = ':'; - *pOutBuf++ = '['; + *pout_buf++ = ':'; + *pout_buf++ = '['; if (status >= 100) { - *pOutBuf++ = (status / 100) + '0'; + *pout_buf++ = (status / 100) + '0'; status = (status % 100); } if (status >= 10) { - *pOutBuf++ = (status / 10) + '0'; + *pout_buf++ = (status / 10) + '0'; status = (status % 10); } - *pOutBuf++ = status + '0'; + *pout_buf++ = status + '0'; - memcpy(priv->adapter, pOutBuf, (t_u8 *) "]:TID", 5); - pOutBuf += 5; - *pOutBuf++ = tid + '0'; + memcpy(priv->adapter, pout_buf, (t_u8 *) "]:TID", 5); + pout_buf += 5; + *pout_buf++ = tid + '0'; - memcpy(priv->adapter, pOutBuf, (t_u8 *) ":UP", 3); - pOutBuf += 3; - *pOutBuf++ = up + '0'; + memcpy(priv->adapter, pout_buf, (t_u8 *) ":UP", 3); + pout_buf += 3; + *pout_buf++ = up + '0'; - *pOutBuf = '\0'; + *pout_buf = '\0'; pevent->bss_index = priv->bss_index; pevent->event_id = MLAN_EVENT_ID_DRV_REPORT_STRING; @@ -690,7 +741,11 @@ wlan_wmm_get_highest_priolist_ptr(pmlan_adapter pmadapter, next_tid = tos_to_tid[next_prio]; if (priv_tmp->wmm. - pkts_queued[next_tid]) + pkts_queued[next_tid] && + (priv_tmp->wmm. + pkts_queued[next_tid] > + priv_tmp->wmm. + pkts_paused[next_tid])) util_scalar_write (pmadapter-> pmoal_handle, @@ -728,12 +783,24 @@ wlan_wmm_get_highest_priolist_ptr(pmlan_adapter pmadapter, } while (ptr != head); } - /* No packet at any TID for this priv. Mark as such to - skip checking TIDs for this priv (until pkt is - added). */ - util_scalar_write(pmadapter->pmoal_handle, - &priv_tmp->wmm.highest_queued_prio, - NO_PKT_PRIO_TID, MNULL, MNULL); + /* If priv still has packets queued, reset to + HIGH_PRIO_TID */ + if (util_scalar_read(pmadapter->pmoal_handle, + &priv_tmp->wmm.tx_pkts_queued, + MNULL, MNULL)) + util_scalar_write(pmadapter->pmoal_handle, + &priv_tmp->wmm. + highest_queued_prio, + HIGH_PRIO_TID, MNULL, MNULL); + else + /* No packet at any TID for this priv. Mark as + such to skip * checking TIDs for this priv + (until pkt is added). */ + util_scalar_write(pmadapter->pmoal_handle, + &priv_tmp->wmm. + highest_queued_prio, + NO_PKT_PRIO_TID, MNULL, + MNULL); pmadapter->callbacks.moal_spin_unlock(pmadapter-> pmoal_handle, @@ -756,14 +823,14 @@ next_intf: /** * @brief This function gets the number of packets in the Tx queue * - * @param priv A pointer to mlan_private - * @param ptr A pointer to RA list table - * @param maxBufSize Maximum buffer size + * @param priv A pointer to mlan_private + * @param ptr A pointer to RA list table + * @param max_buf_size Maximum buffer size * * @return Packet count */ static int -wlan_num_pkts_in_txq(mlan_private * priv, raListTbl * ptr, int maxBufSize) +wlan_num_pkts_in_txq(mlan_private * priv, raListTbl * ptr, int max_buf_size) { int count = 0, total_size = 0; pmlan_buffer pmbuf; @@ -774,7 +841,7 @@ wlan_num_pkts_in_txq(mlan_private * priv, raListTbl * ptr, int maxBufSize) pmbuf != (pmlan_buffer) (&ptr->buf_head); pmbuf = pmbuf->pnext) { total_size += pmbuf->data_len; - if (total_size < maxBufSize) + if (total_size < max_buf_size) ++count; else break; @@ -894,7 +961,7 @@ wlan_send_single_packet(pmlan_private priv, raListTbl * ptr, int ptrindex) * @param priv A pointer to mlan_private * @param ptr A pointer to RA list table * - * @return MTRUE or MFALSE + * @return MTRUE or MFALSE */ static int INLINE wlan_is_ptr_processed(mlan_private * priv, raListTbl * ptr) @@ -1026,7 +1093,7 @@ wlan_send_processed_packet(pmlan_private priv, raListTbl * ptr, int ptrindex) * * @param pmadapter A pointer to mlan_adapter * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static int wlan_dequeue_tx_packet(pmlan_adapter pmadapter) @@ -1146,9 +1213,14 @@ wlan_update_ralist_tx_pause(pmlan_private priv, t_u8 * mac, t_u8 tx_pause) priv->wmm.ra_list_spinlock); for (i = 0; i < MAX_NUM_TID; ++i) { ra_list = wlan_wmm_get_ralist_node(priv, i, mac); - if (ra_list) { + if (ra_list && ra_list->tx_pause != tx_pause) { pkt_cnt += ra_list->total_pkts; ra_list->tx_pause = tx_pause; + if (tx_pause) + priv->wmm.pkts_paused[i] += ra_list->total_pkts; + else + priv->wmm.pkts_paused[i] -= ra_list->total_pkts; + } } if (pkt_cnt) { @@ -1172,6 +1244,208 @@ wlan_update_ralist_tx_pause(pmlan_private priv, t_u8 * mac, t_u8 tx_pause) } #ifdef STA_SUPPORT +/** + * @brief update tx_pause flag in none tdls ra_list + * + * @param priv A pointer to mlan_private + * @param mac peer mac address + * @param tx_pause tx_pause flag (0/1) + * + * @return N/A + */ +t_void +wlan_update_non_tdls_ralist(mlan_private * priv, t_u8 * mac, t_u8 tx_pause) +{ + raListTbl *ra_list; + int i; + pmlan_adapter pmadapter = priv->adapter; + t_u32 pkt_cnt = 0; + t_u32 tx_pkts_queued = 0; + ENTER(); + + pmadapter->callbacks.moal_spin_lock(pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); + for (i = 0; i < MAX_NUM_TID; ++i) { + ra_list = + (raListTbl *) util_peek_list(priv->adapter-> + pmoal_handle, + &priv->wmm.tid_tbl_ptr[i]. + ra_list, MNULL, MNULL); + while (ra_list && + (ra_list != + (raListTbl *) & priv->wmm.tid_tbl_ptr[i].ra_list)) { + if (memcmp + (priv->adapter, ra_list->ra, mac, + MLAN_MAC_ADDR_LENGTH)) { + pkt_cnt += ra_list->total_pkts; + ra_list->tx_pause = tx_pause; + if (tx_pause) + priv->wmm.pkts_paused[i] += + ra_list->total_pkts; + else + priv->wmm.pkts_paused[i] -= + ra_list->total_pkts; + } + ra_list = ra_list->pnext; + } + } + if (pkt_cnt) { + tx_pkts_queued = util_scalar_read(pmadapter->pmoal_handle, + &priv->wmm.tx_pkts_queued, + MNULL, MNULL); + if (tx_pause) + tx_pkts_queued -= pkt_cnt; + else + tx_pkts_queued += pkt_cnt; + util_scalar_write(priv->adapter->pmoal_handle, + &priv->wmm.tx_pkts_queued, tx_pkts_queued, + MNULL, MNULL); + util_scalar_write(priv->adapter->pmoal_handle, + &priv->wmm.highest_queued_prio, HIGH_PRIO_TID, + MNULL, MNULL); + } + pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); + LEAVE(); + return; +} + +/** + * @brief find tdls buffer from ralist + * + * @param priv A pointer to mlan_private + * @param ralist A pointer to ralistTbl + * @param mac TDLS peer mac address + * + * @return pmlan_buffer or MNULL + */ +static pmlan_buffer +wlan_find_tdls_packets(mlan_private * priv, raListTbl * ra_list, t_u8 * mac) +{ + pmlan_buffer pmbuf = MNULL; + mlan_adapter *pmadapter = priv->adapter; + t_u8 ra[MLAN_MAC_ADDR_LENGTH]; + ENTER(); + pmbuf = (pmlan_buffer) util_peek_list(priv->adapter->pmoal_handle, + &ra_list->buf_head, MNULL, MNULL); + if (!pmbuf) { + LEAVE(); + return MNULL; + } + while (pmbuf != (pmlan_buffer) & ra_list->buf_head) { + memcpy(pmadapter, ra, pmbuf->pbuf + pmbuf->data_offset, + MLAN_MAC_ADDR_LENGTH); + if (!memcmp(priv->adapter, ra, mac, MLAN_MAC_ADDR_LENGTH)) { + LEAVE(); + return pmbuf; + } + pmbuf = pmbuf->pnext; + } + LEAVE(); + return MNULL; +} + +/** + * @brief find tdls buffer from tdls pending queue + * + * @param priv A pointer to mlan_private + * @param mac TDLS peer mac address + * + * @return pmlan_buffer or MNULL + */ +static pmlan_buffer +wlan_find_packets_tdls_txq(mlan_private * priv, t_u8 * mac) +{ + pmlan_buffer pmbuf = MNULL; + mlan_adapter *pmadapter = priv->adapter; + t_u8 ra[MLAN_MAC_ADDR_LENGTH]; + ENTER(); + pmbuf = (pmlan_buffer) util_peek_list(priv->adapter->pmoal_handle, + &priv->tdls_pending_txq, + MNULL, MNULL); + if (!pmbuf) { + LEAVE(); + return MNULL; + } + while (pmbuf != (pmlan_buffer) & priv->tdls_pending_txq) { + memcpy(pmadapter, ra, pmbuf->pbuf + pmbuf->data_offset, + MLAN_MAC_ADDR_LENGTH); + if (!memcmp(priv->adapter, ra, mac, MLAN_MAC_ADDR_LENGTH)) { + LEAVE(); + return pmbuf; + } + pmbuf = pmbuf->pnext; + } + LEAVE(); + return MNULL; +} + +/** + * @brief Remove TDLS ralist and move packets to AP's ralist + * + * @param priv A pointer to mlan_private + * @param mac TDLS peer mac address + * + * @return N/A + */ +static t_void +wlan_wmm_delete_tdls_ralist(pmlan_private priv, t_u8 * mac) +{ + raListTbl *ra_list; + raListTbl *ra_list_ap = MNULL; + int i; + pmlan_adapter pmadapter = priv->adapter; + pmlan_buffer pmbuf; + ENTER(); + + for (i = 0; i < MAX_NUM_TID; ++i) { + ra_list = wlan_wmm_get_ralist_node(priv, i, mac); + if (ra_list) { + PRINTM(MDATA, "delete TDLS ralist %p\n", ra_list); + ra_list_ap = + (raListTbl *) util_peek_list(pmadapter-> + pmoal_handle, + &priv->wmm. + tid_tbl_ptr[i]. + ra_list, MNULL, + MNULL); + while ((pmbuf = + (pmlan_buffer) util_peek_list(pmadapter-> + pmoal_handle, + &ra_list-> + buf_head, MNULL, + MNULL))) { + util_unlink_list(pmadapter->pmoal_handle, + &ra_list->buf_head, + (pmlan_linked_list) pmbuf, + MNULL, MNULL); + util_enqueue_list_tail(pmadapter->pmoal_handle, + &ra_list_ap->buf_head, + (pmlan_linked_list) + pmbuf, MNULL, MNULL); + ra_list_ap->total_pkts++; + ra_list_ap->packet_count++; + } + util_free_list_head((t_void *) pmadapter->pmoal_handle, + &ra_list->buf_head, + pmadapter->callbacks. + moal_free_lock); + + util_unlink_list(pmadapter->pmoal_handle, + &priv->wmm.tid_tbl_ptr[i].ra_list, + (pmlan_linked_list) ra_list, MNULL, + MNULL); + pmadapter->callbacks.moal_mfree(pmadapter->pmoal_handle, + (t_u8 *) ra_list); + if (priv->wmm.tid_tbl_ptr[i].ra_list_curr == ra_list) + priv->wmm.tid_tbl_ptr[i].ra_list_curr = + ra_list_ap; + } + } + + LEAVE(); + +} #endif /* STA_SUPPORT */ /******************************************************** Global Functions @@ -1230,6 +1504,9 @@ wlan_clean_txrx(pmlan_private priv) wlan_cleanup_bypass_txq(priv); + if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA) { + wlan_cleanup_tdls_txq(priv); + } wlan_11n_cleanup_reorder_tbl(priv); pmadapter->callbacks.moal_spin_lock(pmadapter->pmoal_handle, @@ -1240,11 +1517,12 @@ wlan_clean_txrx(pmlan_private priv) #ifdef SDIO_MULTI_PORT_TX_AGGR /** * Before reset the TX aggregation buffer, check for any pre-copied data. - * & If any data was pre-copied, restore the current write port and write bitmap, - * to the values that they would have if those data buffers were not copied. - * This is required as FW expects the driver to use the write bitmap sequentially. - * If write bitmap is not re-stored, few bits get skipped for next write and - * fw doesn't issue tx-done interrupt in this condition. + * & If any data was pre-copied, restore the current write port and write + * bitmap, to the values that they would have if those data buffers were + * not copied. This is required as FW expects the driver to use the write + * bitmap sequentially. If write bitmap is not re-stored, few bits get + * skipped for next write and fw doesn't issue tx-done interrupt in this + * condition. */ while (pmadapter->mpa_tx.pkt_cnt) { @@ -1263,9 +1541,8 @@ wlan_clean_txrx(pmlan_private priv) #endif wlan_wmm_delete_all_ralist(priv); memcpy(pmadapter, tos_to_tid, ac_to_tid, sizeof(tos_to_tid)); - for (i = 0; i < MAX_NUM_TID; i++) { + for (i = 0; i < MAX_NUM_TID; i++) tos_to_tid_inv[tos_to_tid[i]] = (t_u8) i; - } #if defined(UAP_SUPPORT) priv->num_drop_pkts = 0; #endif @@ -1330,6 +1607,7 @@ wlan_wmm_setup_queue_priorities(pmlan_private priv, LEAVE(); return; } + memset(priv->adapter, tmp, 0, sizeof(tmp)); HEXDUMP("WMM: setup_queue_priorities: param IE", (t_u8 *) pwmm_ie, sizeof(IEEEtypes_WmmParameter_t)); @@ -1436,6 +1714,7 @@ wlan_ralist_add(mlan_private * priv, t_u8 * ra) int i; raListTbl *ra_list; pmlan_adapter pmadapter = priv->adapter; + tdlsStatus_e status; ENTER(); @@ -1452,9 +1731,22 @@ wlan_ralist_add(mlan_private * priv, t_u8 * ra) get_station_max_amsdu_size(priv, ra); ra_list->tx_pause = wlan_is_tx_pause(priv, ra); } else { - ra_list->is_11n_enabled = IS_11N_ENABLED(priv); - if (ra_list->is_11n_enabled) - ra_list->max_amsdu = priv->max_amsdu; + ra_list->is_tdls_link = MFALSE; + ra_list->tx_pause = MFALSE; + status = wlan_get_tdls_link_status(priv, ra); + if (MTRUE == wlan_is_tdls_link_setup(status)) { + ra_list->is_11n_enabled = + is_station_11n_enabled(priv, ra); + if (ra_list->is_11n_enabled) + ra_list->max_amsdu = + get_station_max_amsdu_size(priv, + ra); + ra_list->is_tdls_link = MTRUE; + } else { + ra_list->is_11n_enabled = IS_11N_ENABLED(priv); + if (ra_list->is_11n_enabled) + ra_list->max_amsdu = priv->max_amsdu; + } } PRINTM_NETINTF(MDATA, priv); @@ -1504,6 +1796,7 @@ wlan_wmm_init(pmlan_adapter pmadapter) priv->aggr_prio_tbl[i].ampdu_user = tos_to_tid_inv[i]; priv->wmm.pkts_queued[i] = 0; + priv->wmm.pkts_paused[i] = 0; priv->wmm.tid_tbl_ptr[i].ra_list_curr = MNULL; } priv->wmm.drv_pkt_delay_max = WMM_DRV_DELAY_MAX; @@ -1526,12 +1819,16 @@ wlan_wmm_init(pmlan_adapter pmadapter) MLAN_STA_AMPDU_DEF_RXWINSIZE; } #endif -#ifdef UAP_SUPPORT - if (priv->bss_type == MLAN_BSS_TYPE_UAP #ifdef WIFI_DIRECT_SUPPORT - || priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT + if (priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT) { + priv->add_ba_param.tx_win_size = + MLAN_WFD_AMPDU_DEF_TXRXWINSIZE; + priv->add_ba_param.rx_win_size = + MLAN_WFD_AMPDU_DEF_TXRXWINSIZE; + } #endif - ) { +#ifdef UAP_SUPPORT + if (priv->bss_type == MLAN_BSS_TYPE_UAP) { priv->add_ba_param.tx_win_size = MLAN_UAP_AMPDU_DEF_TXWINSIZE; priv->add_ba_param.rx_win_size = @@ -1760,6 +2057,7 @@ wlan_wmm_add_buf_txqueue(pmlan_adapter pmadapter, pmlan_buffer pmbuf) t_u32 tid; raListTbl *ra_list; t_u8 ra[MLAN_MAC_ADDR_LENGTH], tid_down; + tdlsStatus_e status; #if defined(UAP_SUPPORT) sta_node *sta_ptr = MNULL; #endif @@ -1783,10 +2081,28 @@ wlan_wmm_add_buf_txqueue(pmlan_adapter pmadapter, pmlan_buffer pmbuf) association we just don't have to call get_queue_raptr, we will have only 1 raptr for a tid in case of infra */ if (!queuing_ra_based(priv)) { - ra_list = (raListTbl *) util_peek_list(pmadapter->pmoal_handle, - &priv->wmm. - tid_tbl_ptr[tid_down]. - ra_list, MNULL, MNULL); + memcpy(pmadapter, ra, pmbuf->pbuf + pmbuf->data_offset, + MLAN_MAC_ADDR_LENGTH); + status = wlan_get_tdls_link_status(priv, ra); + if (MTRUE == wlan_is_tdls_link_setup(status)) { + ra_list = wlan_wmm_get_queue_raptr(priv, tid_down, ra); + pmbuf->flags |= MLAN_BUF_FLAG_TDLS; + } else if (status == TDLS_SETUP_INPROGRESS) { + wlan_add_buf_tdls_txqueue(priv, pmbuf); + pmadapter->callbacks.moal_spin_unlock(pmadapter-> + pmoal_handle, + priv->wmm. + ra_list_spinlock); + LEAVE(); + return; + } else + ra_list = + (raListTbl *) util_peek_list(pmadapter-> + pmoal_handle, + &priv->wmm. + tid_tbl_ptr + [tid_down].ra_list, + MNULL, MNULL); } else { memcpy(pmadapter, ra, pmbuf->pbuf + pmbuf->data_offset, MLAN_MAC_ADDR_LENGTH); @@ -1797,7 +2113,8 @@ wlan_wmm_add_buf_txqueue(pmlan_adapter pmadapter, pmlan_buffer pmbuf) else if (priv->bss_type == MLAN_BSS_TYPE_UAP) { sta_ptr = wlan_get_station_entry(priv, ra); if (sta_ptr) { - if (!sta_ptr->is_wmm_enabled) { + if (!sta_ptr->is_wmm_enabled + && !priv->is_11ac_enabled) { tid_down = wlan_wmm_downgrade_tid(priv, 0xff); @@ -1832,7 +2149,9 @@ wlan_wmm_add_buf_txqueue(pmlan_adapter pmadapter, pmlan_buffer pmbuf) ra_list->packet_count++; priv->wmm.pkts_queued[tid_down]++; - if (!ra_list->tx_pause) { + if (ra_list->tx_pause) { + priv->wmm.pkts_paused[tid_down]++; + } else { util_scalar_increment(pmadapter->pmoal_handle, &priv->wmm.tx_pkts_queued, MNULL, MNULL); /* if highest_queued_prio < prio(tid_down), set it to @@ -1881,47 +2200,48 @@ wlan_ret_wmm_get_status(pmlan_private priv, t_u8 * ptlv, int resp_len) { t_u8 *pcurrent = ptlv; t_u32 tlv_len; - t_u8 sendWmmEvent; - MrvlIEtypes_Data_t *pTlvHdr; - MrvlIEtypes_WmmQueueStatus_t *pTlvWmmQStatus; - IEEEtypes_WmmParameter_t *pWmmParamIe = MNULL; + t_u8 send_wmm_event; + MrvlIEtypes_Data_t *ptlv_hdr; + MrvlIEtypes_WmmQueueStatus_t *ptlv_wmm_q_status; + IEEEtypes_WmmParameter_t *pwmm_param_ie = MNULL; WmmAcStatus_t *pac_status; - MrvlIETypes_ActionFrame_t *pTlvAction; - IEEEtypes_Action_WMM_AddTsRsp_t *pAddTsRsp; - IEEEtypes_Action_WMM_DelTs_t *pDelTs; + MrvlIETypes_ActionFrame_t *ptlv_action; + IEEEtypes_Action_WMM_AddTsRsp_t *padd_ts_rsp; + IEEEtypes_Action_WMM_DelTs_t *pdel_ts; ENTER(); - sendWmmEvent = MFALSE; + send_wmm_event = MFALSE; PRINTM(MINFO, "WMM: WMM_GET_STATUS cmdresp received: %d\n", resp_len); HEXDUMP("CMD_RESP: WMM_GET_STATUS", pcurrent, resp_len); - while (resp_len >= sizeof(pTlvHdr->header)) { - pTlvHdr = (MrvlIEtypes_Data_t *) pcurrent; - tlv_len = wlan_le16_to_cpu(pTlvHdr->header.len); + while (resp_len >= sizeof(ptlv_hdr->header)) { + ptlv_hdr = (MrvlIEtypes_Data_t *) pcurrent; + tlv_len = wlan_le16_to_cpu(ptlv_hdr->header.len); - switch (wlan_le16_to_cpu(pTlvHdr->header.type)) { + switch (wlan_le16_to_cpu(ptlv_hdr->header.type)) { case TLV_TYPE_WMMQSTATUS: - pTlvWmmQStatus = - (MrvlIEtypes_WmmQueueStatus_t *) pTlvHdr; + ptlv_wmm_q_status = + (MrvlIEtypes_WmmQueueStatus_t *) ptlv_hdr; PRINTM(MEVENT, "WMM_STATUS: QSTATUS TLV: %d\n", - pTlvWmmQStatus->queue_index); + ptlv_wmm_q_status->queue_index); PRINTM(MINFO, "CMD_RESP: WMM_GET_STATUS: QSTATUS TLV: %d, %d, %d\n", - pTlvWmmQStatus->queue_index, - pTlvWmmQStatus->flow_required, - pTlvWmmQStatus->disabled); + ptlv_wmm_q_status->queue_index, + ptlv_wmm_q_status->flow_required, + ptlv_wmm_q_status->disabled); pac_status = - &priv->wmm.ac_status[pTlvWmmQStatus-> + &priv->wmm.ac_status[ptlv_wmm_q_status-> queue_index]; - pac_status->disabled = pTlvWmmQStatus->disabled; + pac_status->disabled = ptlv_wmm_q_status->disabled; pac_status->flow_required = - pTlvWmmQStatus->flow_required; - pac_status->flow_created = pTlvWmmQStatus->flow_created; + ptlv_wmm_q_status->flow_required; + pac_status->flow_created = + ptlv_wmm_q_status->flow_created; break; case WMM_IE: @@ -1932,72 +2252,74 @@ wlan_ret_wmm_get_status(pmlan_private priv, t_u8 * ptlv, int resp_len) PRINTM(MEVENT, "WMM STATUS: WMM IE\n"); - HEXDUMP("WMM: WMM TLV:", (t_u8 *) pTlvHdr, tlv_len + 4); + HEXDUMP("WMM: WMM TLV:", (t_u8 *) ptlv_hdr, + tlv_len + 4); - pWmmParamIe = + pwmm_param_ie = (IEEEtypes_WmmParameter_t *) (pcurrent + 2); - pWmmParamIe->vend_hdr.len = (t_u8) tlv_len; - pWmmParamIe->vend_hdr.element_id = WMM_IE; + pwmm_param_ie->vend_hdr.len = (t_u8) tlv_len; + pwmm_param_ie->vend_hdr.element_id = WMM_IE; PRINTM(MINFO, "CMD_RESP: WMM_GET_STATUS: WMM Parameter Set: %d\n", - pWmmParamIe->qos_info.para_set_count); + pwmm_param_ie->qos_info.para_set_count); memcpy(priv->adapter, (t_u8 *) & priv->curr_bss_params.bss_descriptor. - wmm_ie, pWmmParamIe, + wmm_ie, pwmm_param_ie, MIN(sizeof(IEEEtypes_WmmParameter_t), - (pWmmParamIe->vend_hdr.len + 2))); - sendWmmEvent = MTRUE; + (pwmm_param_ie->vend_hdr.len + 2))); + send_wmm_event = MTRUE; break; case TLV_TYPE_IEEE_ACTION_FRAME: PRINTM(MEVENT, "WMM_STATUS: IEEE Action Frame\n"); - pTlvAction = (MrvlIETypes_ActionFrame_t *) pcurrent; + ptlv_action = (MrvlIETypes_ActionFrame_t *) pcurrent; - if (pTlvAction->actionFrame.wmmAc.tspecAct.category + if (ptlv_action->actionFrame.wmmAc.tspecAct.category == IEEE_MGMT_ACTION_CATEGORY_WMM_TSPEC) { - switch (pTlvAction->actionFrame.wmmAc.tspecAct. + switch (ptlv_action->actionFrame.wmmAc.tspecAct. action) { case TSPEC_ACTION_CODE_ADDTS_RSP: - pAddTsRsp = - &pTlvAction->actionFrame.wmmAc. + padd_ts_rsp = + &ptlv_action->actionFrame.wmmAc. addTsRsp; wlan_send_wmmac_host_event(priv, "ADDTS_RSP", - pTlvAction-> + ptlv_action-> srcAddr, - pAddTsRsp-> + padd_ts_rsp-> tspecIE. TspecBody. TSInfo.TID, - pAddTsRsp-> + padd_ts_rsp-> tspecIE. TspecBody. TSInfo. UserPri, - pAddTsRsp-> + padd_ts_rsp-> statusCode); break; case TSPEC_ACTION_CODE_DELTS: - pDelTs = &pTlvAction->actionFrame.wmmAc. + pdel_ts = + &ptlv_action->actionFrame.wmmAc. delTs; wlan_send_wmmac_host_event(priv, "DELTS_RX", - pTlvAction-> + ptlv_action-> srcAddr, - pDelTs-> + pdel_ts-> tspecIE. TspecBody. TSInfo.TID, - pDelTs-> + pdel_ts-> tspecIE. TspecBody. TSInfo. UserPri, - pDelTs-> + pdel_ts-> reasonCode); break; @@ -2012,14 +2334,14 @@ wlan_ret_wmm_get_status(pmlan_private priv, t_u8 * ptlv, int resp_len) break; } - pcurrent += (tlv_len + sizeof(pTlvHdr->header)); - resp_len -= (tlv_len + sizeof(pTlvHdr->header)); + pcurrent += (tlv_len + sizeof(ptlv_hdr->header)); + resp_len -= (tlv_len + sizeof(ptlv_hdr->header)); } - wlan_wmm_setup_queue_priorities(priv, pWmmParamIe); + wlan_wmm_setup_queue_priorities(priv, pwmm_param_ie); wlan_wmm_setup_ac_downgrade(priv); - if (sendWmmEvent) { + if (send_wmm_event) { wlan_recv_event(priv, MLAN_EVENT_ID_FW_WMM_CONFIG_CHANGE, MNULL); } @@ -2035,19 +2357,19 @@ wlan_ret_wmm_get_status(pmlan_private priv, t_u8 * ptlv, int resp_len) * Information IE to the association request command buffer in the form * of a Marvell extended IEEE IE. * - * @param priv Pointer to the mlan_private driver data struct - * @param ppAssocBuf Output parameter: Pointer to the TLV output buffer, - * modified on return to point after the appended WMM TLV - * @param pWmmIE Pointer to the WMM IE for the BSS we are joining - * @param pHTCap Pointer to the HT IE for the BSS we are joining + * @param priv Pointer to the mlan_private driver data struct + * @param ppassoc_buf Output parameter: Pointer to the TLV output buffer, + * modified on return to point after the appended WMM TLV + * @param pwmm_ie Pointer to the WMM IE for the BSS we are joining + * @param pht_cap Pointer to the HT IE for the BSS we are joining * * @return Length of data appended to the association tlv buffer */ t_u32 wlan_wmm_process_association_req(pmlan_private priv, - t_u8 ** ppAssocBuf, - IEEEtypes_WmmParameter_t * pWmmIE, - IEEEtypes_HTCap_t * pHTCap) + t_u8 ** ppassoc_buf, + IEEEtypes_WmmParameter_t * pwmm_ie, + IEEEtypes_HTCap_t * pht_cap) { MrvlIEtypes_WmmParamSet_t *pwmm_tlv; t_u32 ret_len = 0; @@ -2055,36 +2377,36 @@ wlan_wmm_process_association_req(pmlan_private priv, ENTER(); /* Null checks */ - if (!ppAssocBuf) { + if (!ppassoc_buf) { LEAVE(); return 0; } - if (!(*ppAssocBuf)) { + if (!(*ppassoc_buf)) { LEAVE(); return 0; } - if (!pWmmIE) { + if (!pwmm_ie) { LEAVE(); return 0; } PRINTM(MINFO, "WMM: process assoc req: bss->wmmIe=0x%x\n", - pWmmIE->vend_hdr.element_id); + pwmm_ie->vend_hdr.element_id); if ((priv->wmm_required - || (pHTCap && (pHTCap->ieee_hdr.element_id == HT_CAPABILITY) + || (pht_cap && (pht_cap->ieee_hdr.element_id == HT_CAPABILITY) && (priv->config_bands & BAND_GN || priv->config_bands & BAND_AN)) ) - && pWmmIE->vend_hdr.element_id == WMM_IE) { - pwmm_tlv = (MrvlIEtypes_WmmParamSet_t *) * ppAssocBuf; + && pwmm_ie->vend_hdr.element_id == WMM_IE) { + pwmm_tlv = (MrvlIEtypes_WmmParamSet_t *) * ppassoc_buf; pwmm_tlv->header.type = (t_u16) wmm_info_ie[0]; pwmm_tlv->header.type = wlan_cpu_to_le16(pwmm_tlv->header.type); pwmm_tlv->header.len = (t_u16) wmm_info_ie[1]; memcpy(priv->adapter, pwmm_tlv->wmm_ie, &wmm_info_ie[2], pwmm_tlv->header.len); - if (pWmmIE->qos_info.qos_uapsd) + if (pwmm_ie->qos_info.qos_uapsd) memcpy(priv->adapter, (t_u8 *) (pwmm_tlv->wmm_ie + pwmm_tlv->header.len - @@ -2095,7 +2417,7 @@ wlan_wmm_process_association_req(pmlan_private priv, pwmm_tlv->header.len = wlan_cpu_to_le16(pwmm_tlv->header.len); HEXDUMP("ASSOC_CMD: WMM IE", (t_u8 *) pwmm_tlv, ret_len); - *ppAssocBuf += ret_len; + *ppassoc_buf += ret_len; } LEAVE(); @@ -2243,7 +2565,9 @@ wlan_del_tx_pkts_in_ralist(pmlan_private priv, priv->wmm.pkts_queued[tid]--; priv->num_drop_pkts++; ra_list->total_pkts--; - if (!ra_list->tx_pause) + if (ra_list->tx_pause) + priv->wmm.pkts_paused[tid]--; + else util_scalar_decrement(pmadapter-> pmoal_handle, &priv->wmm. @@ -2313,7 +2637,10 @@ wlan_wmm_delete_peer_ralist(pmlan_private priv, t_u8 * mac) ra_list = wlan_wmm_get_ralist_node(priv, i, mac); if (ra_list) { PRINTM(MINFO, "delete sta ralist %p\n", ra_list); - if (!ra_list->tx_pause) + priv->wmm.pkts_queued[i] -= ra_list->total_pkts; + if (ra_list->tx_pause) + priv->wmm.pkts_paused[i] -= ra_list->total_pkts; + else pkt_cnt += ra_list->total_pkts; wlan_wmm_del_pkts_in_ralist_node(priv, ra_list); @@ -2348,6 +2675,132 @@ wlan_wmm_delete_peer_ralist(pmlan_private priv, t_u8 * mac) #endif #ifdef STA_SUPPORT +/** + * @brief Hold TDLS packets to tdls pending queue + * + * @param priv A pointer to mlan_private + * @param mac station mac address + * + * @return N/A + */ +t_void +wlan_hold_tdls_packets(pmlan_private priv, t_u8 * mac) +{ + pmlan_buffer pmbuf; + mlan_adapter *pmadapter = priv->adapter; + raListTbl *ra_list = MNULL; + t_u8 i; + + ENTER(); + pmadapter->callbacks.moal_spin_lock(pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); + PRINTM(MDATA, "wlan_hold_tdls_packets: " MACSTR "\n", MAC2STR(mac)); + for (i = 0; i < MAX_NUM_TID; ++i) { + ra_list = (raListTbl *) util_peek_list(pmadapter->pmoal_handle, + &priv->wmm. + tid_tbl_ptr[i].ra_list, + MNULL, MNULL); + if (ra_list) { + while ((pmbuf = + wlan_find_tdls_packets(priv, ra_list, mac))) { + util_unlink_list(pmadapter->pmoal_handle, + &ra_list->buf_head, + (pmlan_linked_list) pmbuf, + MNULL, MNULL); + ra_list->total_pkts--; + priv->wmm.pkts_queued[i]--; + util_scalar_decrement(pmadapter->pmoal_handle, + &priv->wmm.tx_pkts_queued, + MNULL, MNULL); + ra_list->packet_count--; + wlan_add_buf_tdls_txqueue(priv, pmbuf); + PRINTM(MDATA, "hold tdls packet=%p\n", pmbuf); + } + } + } + pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); + LEAVE(); +} + +/** + * @brief move TDLS packets back to ralist + * + * @param priv A pointer to mlan_private + * @param mac TDLS peer mac address + * @param status tdlsStatus + * + * @return pmlan_buffer or MNULL + */ +t_void +wlan_restore_tdls_packets(pmlan_private priv, t_u8 * mac, tdlsStatus_e status) +{ + pmlan_buffer pmbuf; + mlan_adapter *pmadapter = priv->adapter; + raListTbl *ra_list = MNULL; + t_u32 tid; + t_u32 tid_down; + + ENTER(); + PRINTM(MDATA, "wlan_restore_tdls_packets: " MACSTR " status=%d\n", + MAC2STR(mac), status); + + pmadapter->callbacks.moal_spin_lock(pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); + + while ((pmbuf = wlan_find_packets_tdls_txq(priv, mac))) { + util_unlink_list(pmadapter->pmoal_handle, + &priv->tdls_pending_txq, + (pmlan_linked_list) pmbuf, MNULL, MNULL); + tid = pmbuf->priority; + tid_down = wlan_wmm_downgrade_tid(priv, tid); + if (status == TDLS_SETUP_COMPLETE) { + ra_list = wlan_wmm_get_queue_raptr(priv, tid_down, mac); + pmbuf->flags |= MLAN_BUF_FLAG_TDLS; + } else { + ra_list = + (raListTbl *) util_peek_list(pmadapter-> + pmoal_handle, + &priv->wmm. + tid_tbl_ptr + [tid_down].ra_list, + MNULL, MNULL); + pmbuf->flags &= ~MLAN_BUF_FLAG_TDLS; + } + if (!ra_list) { + PRINTM_NETINTF(MWARN, priv); + PRINTM(MWARN, + "Drop packet %p, ra_list=%p media_connected=%d\n", + pmbuf, ra_list, priv->media_connected); + wlan_write_data_complete(pmadapter, pmbuf, + MLAN_STATUS_FAILURE); + continue; + } + PRINTM_NETINTF(MDATA, priv); + PRINTM(MDATA, + "ADD TDLS pkt %p (priority=%d) back to ra_list %p\n", + pmbuf, pmbuf->priority, ra_list); + util_enqueue_list_tail(pmadapter->pmoal_handle, + &ra_list->buf_head, + (pmlan_linked_list) pmbuf, MNULL, MNULL); + ra_list->total_pkts++; + ra_list->packet_count++; + priv->wmm.pkts_queued[tid_down]++; + util_scalar_increment(pmadapter->pmoal_handle, + &priv->wmm.tx_pkts_queued, MNULL, MNULL); + util_scalar_conditional_write(pmadapter->pmoal_handle, + &priv->wmm.highest_queued_prio, + MLAN_SCALAR_COND_LESS_THAN, + tos_to_tid_inv[tid_down], + tos_to_tid_inv[tid_down], MNULL, + MNULL); + } + if (status != TDLS_SETUP_COMPLETE) + wlan_wmm_delete_tdls_ralist(priv, mac); + pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); + LEAVE(); +} /** * @brief This function prepares the command of ADDTS @@ -2494,7 +2947,7 @@ wlan_ret_wmm_delts_req(IN pmlan_private pmpriv, OUT mlan_ioctl_req * pioctl_buf) { mlan_ds_wmm_cfg *pwmm; - IEEEtypes_WMM_TSPEC_t *pTspecIE; + IEEEtypes_WMM_TSPEC_t *ptspec_ie; const HostCmd_DS_WMM_DELTS_REQ *presp_delts = &resp->params.del_ts; ENTER(); @@ -2507,13 +2960,13 @@ wlan_ret_wmm_delts_req(IN pmlan_private pmpriv, presp_delts->command_result); if (presp_delts->command_result == 0) { - pTspecIE = + ptspec_ie = (IEEEtypes_WMM_TSPEC_t *) presp_delts-> tspec_data; wlan_send_wmmac_host_event(pmpriv, "DELTS_TX", MNULL, - pTspecIE->TspecBody.TSInfo. + ptspec_ie->TspecBody.TSInfo. TID, - pTspecIE->TspecBody.TSInfo. + ptspec_ie->TspecBody.TSInfo. UserPri, presp_delts-> ieee_reason_code); @@ -2726,6 +3179,7 @@ wlan_wmm_ioctl_qos(IN pmlan_adapter pmadapter, IN pmlan_ioctl_req pioctl_req) wmm->param.qos_cfg = pmpriv->wmm_qosinfo; else { pmpriv->wmm_qosinfo = wmm->param.qos_cfg; + pmpriv->saved_wmm_qosinfo = wmm->param.qos_cfg; } pioctl_req->data_read_written = sizeof(t_u8) + MLAN_SUB_COMMAND_SIZE; diff --git a/drivers/net/wireless/sd8897/mlan/mlan_wmm.h b/drivers/net/wireless/sd8897/mlan/mlan_wmm.h index 8a3b983ecfd9..a30f26e3f043 100644 --- a/drivers/net/wireless/sd8897/mlan/mlan_wmm.h +++ b/drivers/net/wireless/sd8897/mlan/mlan_wmm.h @@ -38,7 +38,7 @@ Change log: * @param pmadapter A pointer to mlan_adapter structure * @param ptr A pointer to RA list table * - * @return TID + * @return TID */ static INLINE int wlan_get_tid(pmlan_adapter pmadapter, raListTbl * ptr) @@ -59,7 +59,7 @@ wlan_get_tid(pmlan_adapter pmadapter, raListTbl * ptr) * @param pmadapter A pointer to mlan_adapter structure * @param head A pointer to mlan_list_head * - * @return Length of list + * @return Length of list */ static INLINE int wlan_wmm_list_len(pmlan_adapter pmadapter, pmlan_list_head head) diff --git a/drivers/net/wireless/sd8897/mlinux/mlan_decl.h b/drivers/net/wireless/sd8897/mlinux/mlan_decl.h index ecbd365be9e9..eaf81a87ac0b 100644 --- a/drivers/net/wireless/sd8897/mlinux/mlan_decl.h +++ b/drivers/net/wireless/sd8897/mlinux/mlan_decl.h @@ -27,7 +27,7 @@ Change log: #define _MLAN_DECL_H_ /** MLAN release version */ -#define MLAN_RELEASE_VERSION "434" +#define MLAN_RELEASE_VERSION "457" /** Re-define generic data types for MLAN/MOAL */ /** Signed char (1-byte) */ @@ -71,7 +71,7 @@ typedef t_s32 t_sval; /** Structure packing begins */ #define MLAN_PACK_START /** Structure packeing end */ -#define MLAN_PACK_END __attribute__ ((packed)) +#define MLAN_PACK_END __attribute__((packed)) #else /* !__GNUC__ */ #ifdef PRAGMA_PACK /** Structure packing begins */ @@ -117,7 +117,7 @@ typedef t_s32 t_sval; /** Macros for Data Alignment : address */ #define ALIGN_ADDR(p, a) \ - ((((t_ptr)(p)) + (((t_ptr)(a)) - 1)) & ~(((t_ptr)(a)) - 1)) + ((((t_ptr)(p)) + (((t_ptr)(a)) - 1)) & ~(((t_ptr)(a)) - 1)) /** Return the byte offset of a field in the given structure */ #define MLAN_FIELD_OFFSET(type, field) ((t_u32)(t_ptr)&(((type *)0)->field)) @@ -152,13 +152,24 @@ typedef t_s32 t_sval; #define MLAN_STA_AMPDU_DEF_TXWINSIZE 16 /** Default Win size attached during ADDBA response */ #define MLAN_STA_AMPDU_DEF_RXWINSIZE 32 +/** RX winsize for COEX */ +#define MLAN_STA_COEX_AMPDU_DEF_RXWINSIZE 16 #endif /* STA_SUPPORT */ #ifdef UAP_SUPPORT /** Default Win size attached during ADDBA request */ #define MLAN_UAP_AMPDU_DEF_TXWINSIZE 32 /** Default Win size attached during ADDBA response */ #define MLAN_UAP_AMPDU_DEF_RXWINSIZE 16 +/** RX winsize for COEX */ +#define MLAN_UAP_COEX_AMPDU_DEF_RXWINSIZE 16 #endif /* UAP_SUPPORT */ + +#ifdef WIFI_DIRECT_SUPPORT +/** WFD use the same window size for tx/rx */ +#define MLAN_WFD_AMPDU_DEF_TXRXWINSIZE 16 +/** RX winsize for COEX */ +#define MLAN_WFD_COEX_AMPDU_DEF_RXWINSIZE 16 +#endif /** Block ack timeout value */ #define MLAN_DEFAULT_BLOCK_ACK_TIMEOUT 0xffff /** Maximum Tx Win size configured for ADDBA request [10 bits] */ @@ -228,9 +239,9 @@ typedef t_u8 mlan_802_11_mac_addr[MLAN_MAC_ADDR_LENGTH]; #define MLAN_FRAG_MAX_VALUE (2346) /** Minimum tx retry count */ -#define MLAN_TX_RETRY_MIN (0) +#define MLAN_TX_RETRY_MIN (0) /** Maximum tx retry count */ -#define MLAN_TX_RETRY_MAX (14) +#define MLAN_TX_RETRY_MAX (14) /** define SDIO block size for data Tx/Rx */ /* We support up to 480-byte block size due to FW buffer limitation. */ @@ -270,6 +281,8 @@ typedef t_u8 mlan_802_11_mac_addr[MLAN_MAC_ADDR_LENGTH]; /** Buffer flag for bridge packet */ #define MLAN_BUF_FLAG_BRIDGE_BUF MBIT(3) +#define MLAN_BUF_FLAG_TDLS MBIT(8) + #define MLAN_BUF_FLAG_TCP_ACK MBIT(9) #ifdef DEBUG_LEVEL1 @@ -437,6 +450,7 @@ typedef enum _mlan_event_id { MLAN_EVENT_ID_DRV_BGSCAN_RESULT = 0x80000013, MLAN_EVENT_ID_DRV_FLUSH_RX_WORK = 0x80000015, MLAN_EVENT_ID_DRV_DEFER_RX_WORK = 0x80000016, + MLAN_EVENT_ID_DRV_TDLS_TEARDOWN_REQ = 0x80000017, } mlan_event_id; /** Data Structures */ @@ -473,6 +487,24 @@ typedef struct _mlan_event { t_u8 event_buf[1]; } mlan_event, *pmlan_event; +/** mlan_event_scan_result data structure */ +typedef MLAN_PACK_START struct _mlan_event_scan_result { + /** Event ID */ + t_u16 event_id; + /** BSS index number for multiple BSS support */ + t_u8 bss_index; + /** BSS type */ + t_u8 bss_type; + /** More event available or not */ + t_u8 more_event; + /** Reserved */ + t_u8 reserved[3]; + /** Size of the response buffer */ + t_u16 buf_size; + /** Number of BSS in scan response */ + t_u8 num_of_set; +} MLAN_PACK_END mlan_event_scan_result, *pmlan_event_scan_result; + /** mlan_ioctl_req data structure */ typedef struct _mlan_ioctl_req { /** Status code from firmware/driver */ @@ -666,6 +698,230 @@ typedef MLAN_PACK_START struct _tlvbuf_custom_ie { tlvbuf_max_mgmt_ie max_mgmt_ie; } MLAN_PACK_END mlan_ds_misc_custom_ie; +/** Max TDLS config data length */ +#define MAX_TDLS_DATA_LEN 1024 + +/** Action commands for TDLS enable/disable */ +#define WLAN_TDLS_CONFIG 0x00 +/** Action commands for TDLS configuration :Set */ +#define WLAN_TDLS_SET_INFO 0x01 +/** Action commands for TDLS configuration :Discovery Request */ +#define WLAN_TDLS_DISCOVERY_REQ 0x02 +/** Action commands for TDLS configuration :Setup Request */ +#define WLAN_TDLS_SETUP_REQ 0x03 +/** Action commands for TDLS configuration :Tear down Request */ +#define WLAN_TDLS_TEAR_DOWN_REQ 0x04 +/** Action ID for TDLS power mode */ +#define WLAN_TDLS_POWER_MODE 0x05 +/**Action ID for init TDLS Channel Switch*/ +#define WLAN_TDLS_INIT_CHAN_SWITCH 0x06 +/** Action ID for stop TDLS Channel Switch */ +#define WLAN_TDLS_STOP_CHAN_SWITCH 0x07 +/** Action ID for configure CS related parameters */ +#define WLAN_TDLS_CS_PARAMS 0x08 +/** Action ID for Disable CS */ +#define WLAN_TDLS_CS_DISABLE 0x09 +/** Action ID for TDLS link status */ +#define WLAN_TDLS_LINK_STATUS 0x0A +/** Action ID for TDLS CS immediate return */ +#define WLAN_TDLS_DEBUG_CS_RET_IM 0xFFF7 +/** Action ID for TDLS Stop RX */ +#define WLAN_TDLS_DEBUG_STOP_RX 0xFFF8 +/** Action ID for TDLS Allow weak security for links establish */ +#define WLAN_TDLS_DEBUG_ALLOW_WEAK_SECURITY 0xFFF9 +/** Action ID for TDLS Ignore key lifetime expiry */ +#define WLAN_TDLS_DEBUG_IGNORE_KEY_EXPIRY 0xFFFA +/** Action ID for TDLS Higher/Lower mac Test */ +#define WLAN_TDLS_DEBUG_HIGHER_LOWER_MAC 0xFFFB +/** Action ID for TDLS Prohibited Test */ +#define WLAN_TDLS_DEBUG_SETUP_PROHIBITED 0xFFFC +/** Action ID for TDLS Existing link Test */ +#define WLAN_TDLS_DEBUG_SETUP_SAME_LINK 0xFFFD +/** Action ID for TDLS Fail Setup Confirm */ +#define WLAN_TDLS_DEBUG_FAIL_SETUP_CONFIRM 0xFFFE +/** Action commands for TDLS debug: Wrong BSS Request */ +#define WLAN_TDLS_DEBUG_WRONG_BSS 0xFFFF + +/** tdls each link rate information */ +typedef MLAN_PACK_START struct _tdls_link_rate_info { + /** Tx Data Rate */ + t_u8 tx_data_rate; + /** Tx Rate HT info*/ + t_u8 tx_rate_htinfo; +} MLAN_PACK_END tdls_link_rate_info; + +/** tdls each link status */ +typedef MLAN_PACK_START struct _tdls_each_link_status { + /** peer mac Address */ + t_u8 peer_mac[MLAN_MAC_ADDR_LENGTH]; + /** Link Flags */ + t_u8 link_flags; + /** Traffic Status */ + t_u8 traffic_status; + /** Tx Failure Count */ + t_u8 tx_fail_count; + /** Channel Number */ + t_u32 active_channel; + /** Last Data RSSI in dBm */ + t_s16 data_rssi_last; + /** Last Data NF in dBm */ + t_s16 data_nf_last; + /** AVG DATA RSSI in dBm */ + t_s16 data_rssi_avg; + /** AVG DATA NF in dBm */ + t_s16 data_nf_avg; + union { + /** tdls rate info */ + tdls_link_rate_info rate_info; + /** tdls link final rate*/ + t_u16 final_data_rate; + } u; + /** Security Method */ + t_u8 security_method; + /** Key Lifetime in milliseconds */ + t_u32 key_lifetime; + /** Key Length */ + t_u8 key_length; + /** actual key */ + t_u8 key[0]; +} MLAN_PACK_END tdls_each_link_status; + +/** TDLS configuration data */ +typedef MLAN_PACK_START struct _tdls_all_config { + union { + /** TDLS state enable disable */ + MLAN_PACK_START struct _tdls_config { + /** enable or disable */ + t_u16 enable; + } MLAN_PACK_END tdls_config; + + /** TDLS set info */ + MLAN_PACK_START struct _tdls_set_data { + /** (tlv + capInfo) length */ + t_u16 tlv_length; + /** Cap Info */ + t_u16 cap_info; + /** TLV buffer */ + t_u8 tlv_buffer[0]; + } MLAN_PACK_END tdls_set; + + /** TDLS discovery and others having mac argument */ + MLAN_PACK_START struct _tdls_discovery_data { + /** peer mac Address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + } MLAN_PACK_END tdls_discovery, tdls_stop_chan_switch, + tdls_link_status_req; + + /** TDLS discovery Response */ + MLAN_PACK_START struct _tdls_discovery_resp { + /** payload length */ + t_u16 payload_len; + /** peer mac Address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** RSSI */ + t_s8 rssi; + /** Cap Info */ + t_u16 cap_info; + /** TLV buffer */ + t_u8 tlv_buffer[0]; + } MLAN_PACK_END tdls_discovery_resp; + + /** TDLS setup request */ + MLAN_PACK_START struct _tdls_setup_data { + /** peer mac Address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** timeout value in milliseconds */ + t_u32 setup_timeout; + /** key lifetime in milliseconds */ + t_u32 key_lifetime; + } MLAN_PACK_END tdls_setup; + + /** TDLS tear down info */ + MLAN_PACK_START struct _tdls_tear_down_data { + /** peer mac Address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** reason code */ + t_u16 reason_code; + } MLAN_PACK_END tdls_tear_down, tdls_cmd_resp; + + /** TDLS power mode info */ + MLAN_PACK_START struct _tdls_power_mode_data { + /** peer mac Address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** Power Mode */ + t_u16 power_mode; + } MLAN_PACK_END tdls_power_mode; + + /** TDLS channel switch info */ + MLAN_PACK_START struct _tdls_chan_switch { + /** peer mac Address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** Channel Switch primary channel no */ + t_u8 primary_channel; + /** Channel Switch secondary channel offset */ + t_u8 secondary_channel_offset; + /** Channel Switch Band */ + t_u8 band; + /** Channel Switch time in milliseconds */ + t_u16 switch_time; + /** Channel Switch timeout in milliseconds */ + t_u16 switch_timeout; + /** Channel Regulatory class*/ + t_u8 regulatory_class; + /** peridicity flag*/ + t_u8 periodicity; + } MLAN_PACK_END tdls_chan_switch; + + /** TDLS channel switch paramters */ + MLAN_PACK_START struct _tdls_cs_params { + /** unit time, multiples of 10ms */ + t_u8 unit_time; + /** threshold for other link */ + t_u8 threshold_otherlink; + /** threshold for direct link */ + t_u8 threshold_directlink; + } MLAN_PACK_END tdls_cs_params; + + /** tdls disable channel switch */ + MLAN_PACK_START struct _tdls_disable_cs { + /** Data*/ + t_u16 data; + } MLAN_PACK_END tdls_disable_cs; + /** TDLS debug data */ + MLAN_PACK_START struct _tdls_debug_data { + /** debug data */ + t_u16 debug_data; + } MLAN_PACK_END tdls_debug_data; + + /** TDLS link status Response */ + MLAN_PACK_START struct _tdls_link_status_resp { + /** payload length */ + t_u16 payload_len; + /** number of links */ + t_u8 active_links; + /** structure for link status */ + tdls_each_link_status link_stats[1]; + } MLAN_PACK_END tdls_link_status_resp; + + } u; +} MLAN_PACK_END tdls_all_config; + +/** TDLS configuration buffer */ +typedef MLAN_PACK_START struct _buf_tdls_config { + /** TDLS Action */ + t_u16 tdls_action; + /** TDLS data */ + t_u8 tdls_data[MAX_TDLS_DATA_LEN]; +} MLAN_PACK_END mlan_ds_misc_tdls_config; + +/** Event structure for tear down */ +typedef struct _tdls_tear_down_event { + /** Peer mac address */ + t_u8 peer_mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** Reason code */ + t_u16 reason_code; +} tdls_tear_down_event; + #ifdef PRAGMA_PACK #pragma pack(pop) #endif diff --git a/drivers/net/wireless/sd8897/mlinux/mlan_ieee.h b/drivers/net/wireless/sd8897/mlinux/mlan_ieee.h index fcc9d6cc6c5e..2a0b7b8dadec 100644 --- a/drivers/net/wireless/sd8897/mlinux/mlan_ieee.h +++ b/drivers/net/wireless/sd8897/mlinux/mlan_ieee.h @@ -28,7 +28,7 @@ Change log: #define _MLAN_IEEE_H_ /** FIX IES size in beacon buffer */ -#define WLAN_802_11_FIXED_IE_SIZE 12 +#define WLAN_802_11_FIXED_IE_SIZE 12 /** WLAN supported rates */ #define WLAN_SUPPORTED_RATES 14 @@ -1258,19 +1258,31 @@ typedef MLAN_PACK_START struct { **/ typedef MLAN_PACK_START struct { #ifdef BIG_ENDIAN_SUPPORT - t_u8 rsvd5_7:3; /**< Reserved */ - t_u8 unmeasured:1; /**< Channel is unmeasured */ - t_u8 radar:1; /**< Radar detected on channel */ - t_u8 unidentified_sig:1; /**< Unidentified signal found on channel */ - t_u8 ofdm_preamble:1; /**< OFDM preamble detected on channel */ - t_u8 bss:1; /**< At least one valid MPDU received on channel */ + /**< Reserved */ + t_u8 rsvd5_7:3; + /**< Channel is unmeasured */ + t_u8 unmeasured:1; + /**< Radar detected on channel */ + t_u8 radar:1; + /**< Unidentified signal found on channel */ + t_u8 unidentified_sig:1; + /**< OFDM preamble detected on channel */ + t_u8 ofdm_preamble:1; + /**< At least one valid MPDU received on channel */ + t_u8 bss:1; #else - t_u8 bss:1; /**< At least one valid MPDU received on channel */ - t_u8 ofdm_preamble:1; /**< OFDM preamble detected on channel */ - t_u8 unidentified_sig:1; /**< Unidentified signal found on channel */ - t_u8 radar:1; /**< Radar detected on channel */ - t_u8 unmeasured:1; /**< Channel is unmeasured */ - t_u8 rsvd5_7:3; /**< Reserved */ + /**< At least one valid MPDU received on channel */ + t_u8 bss:1; + /**< OFDM preamble detected on channel */ + t_u8 ofdm_preamble:1; + /**< Unidentified signal found on channel */ + t_u8 unidentified_sig:1; + /**< Radar detected on channel */ + t_u8 radar:1; + /**< Channel is unmeasured */ + t_u8 unmeasured:1; + /**< Reserved */ + t_u8 rsvd5_7:3; #endif /* BIG_ENDIAN_SUPPORT */ } MLAN_PACK_END MeasRptBasicMap_t; @@ -1326,6 +1338,48 @@ typedef struct { } wlan_11h_bss_info_t; +/** Ethernet packet type for TDLS */ +#define MLAN_ETHER_PKT_TYPE_TDLS_ACTION (0x890D) + +/*802.11z TDLS action frame type and strcuct */ +typedef MLAN_PACK_START struct { + /* link indentifier ie =101 */ + t_u8 element_id; + /* len = 18 */ + t_u8 len; + /** bssid */ + t_u8 bssid[MLAN_MAC_ADDR_LENGTH]; + /** init sta mac address */ + t_u8 init_sta[MLAN_MAC_ADDR_LENGTH]; + /** resp sta mac address */ + t_u8 resp_sta[MLAN_MAC_ADDR_LENGTH]; +} MLAN_PACK_END IEEEtypes_tdls_linkie; + +/** action code for tdls setup request */ +#define TDLS_SETUP_REQUEST 0 +/** action code for tdls setup response */ +#define TDLS_SETUP_RESPONSE 1 +/** action code for tdls setup confirm */ +#define TDLS_SETUP_CONFIRM 2 +/** action code for tdls tear down */ +#define TDLS_TEARDOWN 3 +/** action code for tdls traffic indication */ +#define TDLS_PEER_TRAFFIC_INDICATION 4 +/** action code for tdls channel switch request */ +#define TDLS_CHANNEL_SWITCH_REQUEST 5 +/** action code for tdls channel switch response */ +#define TDLS_CHANNEL_SWITCH_RESPONSE 6 +/** action code for tdls psm request */ +#define TDLS_PEER_PSM_REQUEST 7 +/** action code for tdls psm response */ +#define TDLS_PEER_PSM_RESPONSE 8 +/** action code for tdls traffic response */ +#define TDLS_PEER_TRAFFIC_RESPONSE 9 +/** action code for tdls discovery request */ +#define TDLS_DISCOVERY_REQUEST 10 +/** action code for TDLS discovery response */ +#define TDLS_DISCOVERY_RESPONSE 14 + #ifdef STA_SUPPORT /** Macro for maximum size of scan response buffer */ #define MAX_SCAN_RSP_BUF (16 * 1024) @@ -1470,6 +1524,8 @@ typedef MLAN_PACK_START struct { t_u8 snr_threshold; /** repeat count */ t_u16 repeat_count; + /** start later flag */ + t_u16 start_later; /** SSID filter list used in the to limit the scan results */ wlan_user_scan_ssid ssid_list[MRVDRV_MAX_SSID_LIST_LENGTH]; /** Variable number (fixed maximum) of channels to scan up */ diff --git a/drivers/net/wireless/sd8897/mlinux/mlan_ioctl.h b/drivers/net/wireless/sd8897/mlinux/mlan_ioctl.h index c73547796fd7..4f498d001e74 100644 --- a/drivers/net/wireless/sd8897/mlinux/mlan_ioctl.h +++ b/drivers/net/wireless/sd8897/mlinux/mlan_ioctl.h @@ -213,6 +213,7 @@ enum _mlan_ioctl_req_id { MLAN_OID_MISC_ASSOC_RSP = 0x0020000C, MLAN_OID_MISC_INIT_SHUTDOWN = 0x0020000D, MLAN_OID_MISC_CUSTOM_IE = 0x0020000F, + MLAN_OID_MISC_TDLS_CONFIG = 0x00200010, MLAN_OID_MISC_TX_DATAPAUSE = 0x00200012, MLAN_OID_MISC_IP_ADDR = 0x00200013, MLAN_OID_MISC_MAC_CONTROL = 0x00200014, @@ -238,6 +239,8 @@ enum _mlan_ioctl_req_id { #ifdef WIFI_DIRECT_SUPPORT MLAN_OID_MISC_WIFI_DIRECT_CONFIG = 0x00200025, #endif + MLAN_OID_MISC_TDLS_OPER = 0x00200026, + MLAN_OID_MISC_GET_TDLS_IES = 0x00200027, }; /** Sub command size */ @@ -420,6 +423,8 @@ typedef struct _mlan_scan_cfg { t_u32 scan_probe; /** Scan time parameters */ mlan_scan_time_params scan_time; + /** Extended Scan */ + t_u32 ext_scan; } mlan_scan_cfg, *pmlan_scan_cfg; /** Type defnition of mlan_ds_scan for MLAN_IOCTL_SCAN */ @@ -466,7 +471,7 @@ enum _mlan_bss_mode { #define MLAN_BEACON_INTERVAL 100 /** Receive all packets */ -#define MLAN_PROMISC_MODE 1 +#define MLAN_PROMISC_MODE 1 /** Receive multicast packets in multicast list */ #define MLAN_MULTICAST_MODE 2 /** Receive all multicast packets */ @@ -507,7 +512,9 @@ typedef struct _mlan_chan_list { chan_freq cf[MLAN_MAX_CHANNEL_NUM]; } mlan_chan_list; -/** mlan_ssid_bssid data structure for MLAN_OID_BSS_START and MLAN_OID_BSS_FIND_BSS */ +/** mlan_ssid_bssid data structure for + * MLAN_OID_BSS_START and MLAN_OID_BSS_FIND_BSS + */ typedef struct _mlan_ssid_bssid { /** SSID */ mlan_802_11_ssid ssid; @@ -1220,8 +1227,14 @@ typedef struct _mlan_fw_info { t_u32 fw_ver; /** MAC address */ mlan_802_11_mac_addr mac_addr; + /** 802.11n device capabilities */ + t_u32 hw_dot_11n_dev_cap; /** Device support for MIMO abstraction of MCSs */ t_u8 hw_dev_mcs_support; + /** 802.11ac device capabilities */ + t_u32 hw_dot_11ac_dev_cap; + /** 802.11ac device support for MIMO abstraction of MCSs */ + t_u32 hw_dot_11ac_mcs_support; /** fw supported band */ t_u8 fw_bands; /** region code */ @@ -1293,7 +1306,7 @@ typedef struct _mlan_bss_info { #define MAX_NUM_TID 8 /** Max RX Win size */ -#define MAX_RX_WINSIZE 64 +#define MAX_RX_WINSIZE 64 /** rx_reorder_tbl */ typedef struct { @@ -1329,6 +1342,27 @@ typedef struct { #define SDIO_MP_DBG_NUM 6 #endif +/** Maximum size of IEEE Information Elements */ +#define IEEE_MAX_IE_SIZE 256 + +/** support up to 8 TDLS peer */ +#define MLAN_MAX_TDLS_PEER_SUPPORTED 8 +/** TDLS peer info */ +typedef struct _tdls_peer_info { + /** station mac address */ + t_u8 mac_addr[MLAN_MAC_ADDR_LENGTH]; + /** SNR */ + t_s8 snr; + /** Noise Floor */ + t_s8 nf; + /** Extended Capabilities IE */ + t_u8 ext_cap[IEEE_MAX_IE_SIZE]; + /** HT Capabilities IE */ + t_u8 ht_cap[IEEE_MAX_IE_SIZE]; + /** VHT Capabilities IE */ + t_u8 vht_cap[IEEE_MAX_IE_SIZE]; +} tdls_peer_info; + /** mlan_debug_info data structure for MLAN_OID_GET_DEBUG_INFO */ typedef struct _mlan_debug_info { /* WMM AC_BK count */ @@ -1353,6 +1387,10 @@ typedef struct _mlan_debug_info { t_u32 rx_tbl_num; /** Rx reorder table*/ rx_reorder_tbl rx_tbl[MLAN_MAX_RX_BASTREAM_SUPPORTED]; + /** TDLS peer number */ + t_u32 tdls_peer_num; + /** TDLS peer list*/ + tdls_peer_info tdls_peer_list[MLAN_MAX_TDLS_PEER_SUPPORTED]; /** Corresponds to ps_mode member of mlan_adapter */ t_u16 ps_mode; /** Corresponds to ps_state member of mlan_adapter */ @@ -1493,6 +1531,8 @@ typedef struct _mlan_debug_info { t_u32 mlan_processing; /** mlan_rx_processing */ t_u32 mlan_rx_processing; + /** rx pkts queued */ + t_u32 rx_pkts_queued; /** mlan_adapter pointer */ t_void *mlan_adapter; /** mlan_adapter_size */ @@ -1621,11 +1661,17 @@ enum _mlan_psk_type { /** Type definition of mlan_ds_encrypt_key for MLAN_OID_SEC_CFG_ENCRYPT_KEY */ typedef struct _mlan_ds_encrypt_key { - /** Key disabled, all other fields will be ignore when this flag set to MTRUE */ + /** Key disabled, all other fields will be + * ignore when this flag set to MTRUE + */ t_u32 key_disable; - /** key removed flag, when this flag is set to MTRUE, only key_index will be check */ + /** key removed flag, when this flag is set + * to MTRUE, only key_index will be check + */ t_u32 key_remove; - /** Key index, used as current tx key index when is_current_wep_key is set to MTRUE */ + /** Key index, used as current tx key index + * when is_current_wep_key is set to MTRUE + */ t_u32 key_index; /** Current Tx key flag */ t_u32 is_current_wep_key; @@ -1722,7 +1768,9 @@ typedef struct _mlan_ds_sec_cfg { mlan_ds_encrypt_key encrypt_key; /** Passphrase for MLAN_OID_SEC_CFG_PASSPHRASE */ mlan_ds_passphrase passphrase; - /** Embedded supplicant WPA enabled flag for MLAN_OID_SEC_CFG_EWPA_ENABLED */ + /** Embedded supplicant WPA enabled flag for + * MLAN_OID_SEC_CFG_EWPA_ENABLED + */ t_u32 ewpa_enabled; /** Embedded supplicant mode for MLAN_OID_SEC_CFG_ESUPP_MODE */ mlan_ds_esupp_mode esupp_mode; @@ -1938,7 +1986,9 @@ typedef struct _mlan_ds_hs_cfg { t_u32 conditions; /** GPIO pin or 0xff for interface */ t_u32 gpio; - /** Gap in milliseconds or or 0xff for special setting when GPIO is used to wakeup host */ + /** Gap in milliseconds or or 0xff for special + * setting when GPIO is used to wakeup host + */ t_u32 gap; } mlan_ds_hs_cfg, *pmlan_ds_hs_cfg; @@ -1957,7 +2007,9 @@ typedef struct _mlan_ds_auto_ds { t_u16 idletime; } mlan_ds_auto_ds; -/** Type definition of mlan_ds_inactivity_to for MLAN_OID_PM_CFG_INACTIVITY_TO */ +/** Type definition of mlan_ds_inactivity_to + * for MLAN_OID_PM_CFG_INACTIVITY_TO + */ typedef struct _mlan_ds_inactivity_to { /** Timeout unit in microsecond, 0 means 1000us (1ms) */ t_u32 timeout_unit; @@ -2252,7 +2304,9 @@ typedef struct { */ t_u16 delay_histogram[MLAN_WMM_STATS_PKTS_HIST_BINS]; } wlan_ioctl_wmm_queue_stats_t, -/** Type definition of mlan_ds_wmm_queue_stats for MLAN_OID_WMM_CFG_QUEUE_STATS */ +/** Type definition of mlan_ds_wmm_queue_stats + * for MLAN_OID_WMM_CFG_QUEUE_STATS + */ mlan_ds_wmm_queue_stats, *pmlan_ds_wmm_queue_stats; /** @@ -2282,7 +2336,9 @@ typedef struct { /** WMM AC queue status */ wlan_ioctl_wmm_queue_status_ac_t ac_status[MLAN_WMM_MAX_AC_QUEUES]; } wlan_ioctl_wmm_queue_status_t, -/** Type definition of mlan_ds_wmm_queue_status for MLAN_OID_WMM_CFG_QUEUE_STATUS */ +/** Type definition of mlan_ds_wmm_queue_status + * for MLAN_OID_WMM_CFG_QUEUE_STATUS + */ mlan_ds_wmm_queue_status, *pmlan_ds_wmm_queue_status; /** Type definition of mlan_ds_wmm_addts for MLAN_OID_WMM_CFG_ADDTS */ @@ -2313,7 +2369,9 @@ typedef struct _mlan_ds_wmm_delts { t_u8 ie_data[MLAN_WMM_TSPEC_SIZE]; } mlan_ds_wmm_delts, *pmlan_ds_wmm_delts; -/** Type definition of mlan_ds_wmm_queue_config for MLAN_OID_WMM_CFG_QUEUE_CONFIG */ +/** Type definition of mlan_ds_wmm_queue_config + * for MLAN_OID_WMM_CFG_QUEUE_CONFIG + */ typedef struct _mlan_ds_wmm_queue_config { /** Action of Queue Config : Set, Get, or Default */ mlan_wmm_queue_config_action_e action; @@ -2397,7 +2455,9 @@ typedef struct _mlan_ds_11n_htcap_cfg { t_u32 hw_cap_req; } mlan_ds_11n_htcap_cfg, *pmlan_ds_11n_htcap_cfg; -/** Type definition of mlan_ds_11n_addba_param for MLAN_OID_11N_CFG_ADDBA_PARAM */ +/** Type definition of mlan_ds_11n_addba_param + * for MLAN_OID_11N_CFG_ADDBA_PARAM + */ typedef struct _mlan_ds_11n_addba_param { /** Timeout */ t_u32 timeout; @@ -2521,7 +2581,9 @@ typedef struct _mlan_ds_11n_amsdu_aggr_ctrl { t_u16 curr_buf_size; } mlan_ds_11n_amsdu_aggr_ctrl, *pmlan_ds_11n_amsdu_aggr_ctrl; -/** Type definition of mlan_ds_11n_aggr_prio_tbl for MLAN_OID_11N_CFG_AGGR_PRIO_TBL */ +/** Type definition of mlan_ds_11n_aggr_prio_tbl + * for MLAN_OID_11N_CFG_AGGR_PRIO_TBL + */ typedef struct _mlan_ds_11n_aggr_prio_tbl { /** ampdu priority table */ t_u8 ampdu[MAX_NUM_TID]; @@ -2636,6 +2698,10 @@ typedef struct _mlan_ds_11ac_vht_cfg { t_u32 vht_tx_mcs; /** VHT Rx mcs */ t_u32 vht_rx_mcs; + /** VHT rx max rate */ + t_u16 vht_rx_max_rate; + /** VHT max tx rate */ + t_u16 vht_tx_max_rate; } mlan_ds_11ac_vht_cfg, *pmlan_ds_11ac_vht_cfg; /** Type definition of mlan_ds_11ac_cfg for MLAN_IOCTL_11AC_CFG */ @@ -2654,9 +2720,6 @@ typedef struct _mlan_ds_11ac_cfg { /** Country code length */ #define COUNTRY_CODE_LEN 3 -/** Maximum size of IEEE Information Elements */ -#define IEEE_MAX_IE_SIZE 256 - /*-----------------------------------------------------------------*/ /** 802.11d Configuration Group */ /*-----------------------------------------------------------------*/ @@ -2829,7 +2892,9 @@ typedef struct _mlan_ds_misc_gen_ie { } mlan_ds_misc_gen_ie; #if defined(SDIO_MULTI_PORT_TX_AGGR) || defined(SDIO_MULTI_PORT_RX_AGGR) -/** Type definition of mlan_ds_misc_sdio_mpa_ctrl for MLAN_OID_MISC_SDIO_MPA_CTRL */ +/** Type definition of mlan_ds_misc_sdio_mpa_ctrl + * for MLAN_OID_MISC_SDIO_MPA_CTRL + */ typedef struct _mlan_ds_misc_sdio_mpa_ctrl { /** SDIO MP-A TX enable/disable */ t_u16 tx_enable; @@ -2855,12 +2920,12 @@ typedef struct _mlan_ds_misc_cmd { } mlan_ds_misc_cmd; /** Maximum number of system clocks */ -#define MLAN_MAX_CLK_NUM 16 +#define MLAN_MAX_CLK_NUM 16 /** Clock type : Configurable */ -#define MLAN_CLK_CONFIGURABLE 0 +#define MLAN_CLK_CONFIGURABLE 0 /** Clock type : Supported */ -#define MLAN_CLK_SUPPORTED 1 +#define MLAN_CLK_SUPPORTED 1 /** Type definition of mlan_ds_misc_sys_clock for MLAN_OID_MISC_SYS_CLOCK */ typedef struct _mlan_ds_misc_sys_clock { @@ -2891,7 +2956,9 @@ enum _mlan_func_cmd { MLAN_FUNC_SHUTDOWN, }; -/** Type definition of mlan_ds_misc_tx_datapause for MLAN_OID_MISC_TX_DATAPAUSE */ +/** Type definition of mlan_ds_misc_tx_datapause + * for MLAN_OID_MISC_TX_DATAPAUSE + */ typedef struct _mlan_ds_misc_tx_datapause { /** Tx data pause flag */ t_u16 tx_pause; @@ -2954,7 +3021,9 @@ typedef struct _mlan_ds_misc_cfp_code { t_u32 cfp_code_a; } mlan_ds_misc_cfp_code; -/** Type definition of mlan_ds_misc_country_code for MLAN_OID_MISC_COUNTRY_CODE */ +/** Type definition of mlan_ds_misc_country_code + * for MLAN_OID_MISC_COUNTRY_CODE + */ typedef struct _mlan_ds_misc_country_code { /** Country Code */ t_u8 country_code[COUNTRY_CODE_LEN]; @@ -2999,43 +3068,63 @@ typedef struct _mlan_ds_subscribe_evt { t_u16 evt_bitmap; /** Absolute value of RSSI threshold value (dBm) */ t_u8 low_rssi; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 low_rssi_freq; /** SNR threshold value (dB) */ t_u8 low_snr; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 low_snr_freq; /** Failure count threshold */ t_u8 failure_count; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 failure_count_freq; /** num of missed beacons */ t_u8 beacon_miss; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 beacon_miss_freq; /** Absolute value of RSSI threshold value (dBm) */ t_u8 high_rssi; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 high_rssi_freq; /** SNR threshold value (dB) */ t_u8 high_snr; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 high_snr_freq; /** Absolute value of data RSSI threshold value (dBm) */ t_u8 data_low_rssi; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 data_low_rssi_freq; /** Absolute value of data SNR threshold value (dBm) */ t_u8 data_low_snr; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 data_low_snr_freq; /** Absolute value of data RSSI threshold value (dBm) */ t_u8 data_high_rssi; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 data_high_rssi_freq; /** Absolute value of data SNR threshold value (dBm) */ t_u8 data_high_snr; - /** 0--report once, 1--report everytime happen, N -- report only happend > N consecutive times */ + /** 0--report once, 1--report everytime happen, + * N -- report only happend > N consecutive times + */ t_u8 data_high_snr_freq; /* Link SNR threshold (dB) */ t_u16 link_snr; @@ -3056,7 +3145,9 @@ typedef struct _mlan_ds_subscribe_evt { /** Max OTP user data length */ #define MAX_OTP_USER_DATA_LEN 252 -/** Type definition of mlan_ds_misc_otp_user_data for MLAN_OID_MISC_OTP_USER_DATA */ +/** Type definition of mlan_ds_misc_otp_user_data + * for MLAN_OID_MISC_OTP_USER_DATA + */ typedef struct _mlan_ds_misc_otp_user_data { /** Reserved */ t_u16 reserved; @@ -3071,7 +3162,9 @@ typedef struct _mlan_ds_misc_otp_user_data { #define WIFI_DIRECT_NOA 1 /** flag for OPP_PS */ #define WIFI_DIRECT_OPP_PS 2 -/** Type definition of mlan_ds_wifi_direct_config for MLAN_OID_MISC_WIFI_DIRECT_CONFIG */ +/** Type definition of mlan_ds_wifi_direct_config + * for MLAN_OID_MISC_WIFI_DIRECT_CONFIG + */ typedef struct _mlan_ds_wifi_direct_config { /** flags for NOA/OPP_PS */ t_u8 flags; @@ -3112,6 +3205,73 @@ typedef MLAN_PACK_START struct _mlan_ds_multi_chan_cfg { t_u8 tlv_buf[0]; } MLAN_PACK_END mlan_ds_multi_chan_cfg; +/**Action ID for TDLS disable link*/ +#define WLAN_TDLS_DISABLE_LINK 0x00 +/**Action ID for TDLS enable link*/ +#define WLAN_TDLS_ENABLE_LINK 0x01 +/**Action ID for TDLS create link*/ +#define WLAN_TDLS_CREATE_LINK 0x02 +/**Action ID for TDLS config link*/ +#define WLAN_TDLS_CONFIG_LINK 0x03 +/*reason code*/ +#define WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED 26 +/** TDLS operation buffer */ +typedef struct _mlan_ds_misc_tdls_oper { + /** TDLS Action */ + t_u16 tdls_action; + /** TDLS peer address */ + t_u8 peer_mac[MLAN_MAC_ADDR_LENGTH]; + /** peer capability */ + t_u16 capability; + /** peer qos info */ + t_u8 qos_info; + /** peer extend capability */ + t_u8 *ext_capab; + /** extend capability len */ + t_u8 ext_capab_len; + /** support rates */ + t_u8 *supported_rates; + /** supported rates len */ + t_u8 supported_rates_len; + /** peer ht_cap */ + t_u8 *ht_capa; + /** peer vht capability */ + t_u8 *vht_cap; +} mlan_ds_misc_tdls_oper; + +/** flag for TDLS extcap */ +#define TDLS_IE_FLAGS_EXTCAP 0x0001 +/** flag for TDLS HTCAP */ +#define TDLS_IE_FLAGS_HTCAP 0x0002 +/** flag for TDLS HTINFO */ +#define TDLS_IE_FLAGS_HTINFO 0x0004 +/** flag for TDLS VHTCAP */ +#define TDLS_IE_FLAGS_VHTCAP 0x0008 +/** flag for TDLS VHTOPRAT */ +#define TDLS_IE_FLAGS_VHTOPRAT 0x0010 +/** flag for TDLS AID inof */ +#define TDLS_IE_FLAGS_AID 0x0020 + +/** TDLS ie buffer */ +typedef struct _mlan_ds_misc_tdls_ies { + /** TDLS peer address */ + t_u8 peer_mac[MLAN_MAC_ADDR_LENGTH]; + /** flags for request IEs */ + t_u16 flags; + /** Extended Capabilities IE */ + t_u8 ext_cap[IEEE_MAX_IE_SIZE]; + /** HT Capabilities IE */ + t_u8 ht_cap[IEEE_MAX_IE_SIZE]; + /** HT Information IE */ + t_u8 ht_info[IEEE_MAX_IE_SIZE]; + /** VHT Capabilities IE */ + t_u8 vht_cap[IEEE_MAX_IE_SIZE]; + /** VHT Operations IE */ + t_u8 vht_oprat[IEEE_MAX_IE_SIZE]; + /** aid Info */ + t_u8 aid_info[IEEE_MAX_IE_SIZE]; +} mlan_ds_misc_tdls_ies; + /** Type definition of mlan_ds_misc_cfg for MLAN_IOCTL_MISC_CFG */ typedef struct _mlan_ds_misc_cfg { /** Sub-command */ @@ -3138,6 +3298,12 @@ typedef struct _mlan_ds_misc_cfg { t_u32 func_init_shutdown; /** Custom IE for MLAN_OID_MISC_CUSTOM_IE */ mlan_ds_misc_custom_ie cust_ie; + /** TDLS configuration for MLAN_OID_MISC_TDLS_CONFIG */ + mlan_ds_misc_tdls_config tdls_config; + /** TDLS operation for MLAN_OID_MISC_TDLS_OPER */ + mlan_ds_misc_tdls_oper tdls_oper; + /** TDLS ies for MLAN_OID_MISC_GET_TDLS_IES */ + mlan_ds_misc_tdls_ies tdls_ies; /** Tx data pause for MLAN_OID_MISC_TX_DATAPAUSE */ mlan_ds_misc_tx_datapause tx_datapause; /** IP address configuration */ diff --git a/drivers/net/wireless/sd8897/mlinux/moal_cfg80211.c b/drivers/net/wireless/sd8897/mlinux/moal_cfg80211.c index 275ef0680fca..f5d9e11329f6 100644 --- a/drivers/net/wireless/sd8897/mlinux/moal_cfg80211.c +++ b/drivers/net/wireless/sd8897/mlinux/moal_cfg80211.c @@ -93,6 +93,7 @@ static struct ieee80211_channel cfg80211_channels_5ghz[] = { {.center_freq = 5660,.hw_value = 132,.max_power = 20}, {.center_freq = 5680,.hw_value = 136,.max_power = 20}, {.center_freq = 5700,.hw_value = 140,.max_power = 20}, + {.center_freq = 5720,.hw_value = 144,.max_power = 20}, {.center_freq = 5745,.hw_value = 149,.max_power = 20}, {.center_freq = 5765,.hw_value = 153,.max_power = 20}, {.center_freq = 5785,.hw_value = 157,.max_power = 20}, @@ -229,7 +230,9 @@ woal_get_active_intf_freq(moal_private * priv) (handle->priv[i]->bss_type == priv->bss_type)) return ieee80211_channel_to_frequency(handle-> priv[i]-> - channel, + channel +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) || defined(COMPAT_WIRELESS) + , (handle-> priv[i]-> channel @@ -237,7 +240,10 @@ woal_get_active_intf_freq(moal_private * priv) 14 ? IEEE80211_BAND_2GHZ : - IEEE80211_BAND_5GHZ)); + IEEE80211_BAND_5GHZ) +#endif + ); + } #endif #ifdef UAP_SUPPORT @@ -246,7 +252,9 @@ woal_get_active_intf_freq(moal_private * priv) (handle->priv[i]->bss_type == priv->bss_type)) return ieee80211_channel_to_frequency(handle-> priv[i]-> - channel, + channel +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) || defined(COMPAT_WIRELESS) + , (handle-> priv[i]-> channel @@ -254,7 +262,9 @@ woal_get_active_intf_freq(moal_private * priv) 14 ? IEEE80211_BAND_2GHZ : - IEEE80211_BAND_5GHZ)); + IEEE80211_BAND_5GHZ) +#endif + ); } #endif } @@ -429,14 +439,10 @@ woal_cfg80211_set_key(moal_private * priv, t_u8 is_enable_wep, } /* Send IOCTL request to MLAN */ - if (MLAN_STATUS_SUCCESS != - woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT)) { - ret = MLAN_STATUS_FAILURE; - goto done; - } + ret = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); done: - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -915,6 +921,7 @@ woal_cfg80211_change_virtual_intf(struct wiphy *wiphy, #if defined(STA_SUPPORT) && defined(UAP_SUPPORT) t_u8 bss_role; #endif + mlan_status status = MLAN_STATUS_SUCCESS; ENTER(); @@ -1110,14 +1117,14 @@ woal_cfg80211_change_virtual_intf(struct wiphy *wiphy, if (ret) goto done; - if (MLAN_STATUS_SUCCESS != - woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT)) { + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (MLAN_STATUS_SUCCESS != status) { ret = -EFAULT; goto done; } done: - if (req) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -1301,12 +1308,6 @@ woal_cfg80211_del_key(struct wiphy *wiphy, struct net_device *netdev, LEAVE(); return 0; } -#define MRVL_NUM_WEP_KEY 4 - if (key_index >= MRVL_NUM_WEP_KEY) { - PRINTM(MINFO, "Skip Crypto keys delete %d\n", key_index); - LEAVE(); - return 0; - } if (woal_cfg80211_set_key(priv, 0, 0, NULL, 0, NULL, 0, key_index, mac_addr, 1)) { @@ -1511,13 +1512,15 @@ woal_cfg80211_set_bitrate_mask(struct wiphy *wiphy, rate_cfg->bitmap_rates[2] |= mask->control[band].mcs[1] << 8; #endif - if (MLAN_STATUS_SUCCESS != - woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT)) { + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (MLAN_STATUS_SUCCESS != status) { ret = -EFAULT; goto done; } done: + if (status != MLAN_STATUS_PENDING) + kfree(req); LEAVE(); return ret; } @@ -1539,6 +1542,7 @@ woal_cfg80211_set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant) moal_private *priv = NULL; mlan_ds_radio_cfg *radio = NULL; mlan_ioctl_req *req = NULL; + mlan_status status = MLAN_STATUS_SUCCESS; int ret = 0; ENTER(); @@ -1566,14 +1570,14 @@ woal_cfg80211_set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant) radio->param.ant_cfg.tx_antenna = tx_ant; radio->param.ant_cfg.rx_antenna = rx_ant; - if (MLAN_STATUS_SUCCESS != - woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT)) { + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (MLAN_STATUS_SUCCESS != status) { ret = -EFAULT; goto done; } done: - if (req) + if (status != MLAN_STATUS_PENDING) kfree(req); /* Driver must return -EINVAL to cfg80211 */ if (ret) @@ -1799,8 +1803,8 @@ woal_cfg80211_mgmt_tx(struct wiphy *wiphy, if (buf == NULL || len == 0) { PRINTM(MERROR, "woal_cfg80211_mgmt_tx() corrupt data\n"); - ret = -EFAULT; - goto done; + LEAVE(); + return -EFAULT; } /* If the packet is probe response, that means we are in listen phase, @@ -1832,27 +1836,17 @@ woal_cfg80211_mgmt_tx(struct wiphy *wiphy, /* With sd8777 We have difficulty to receive response packet in 500ms */ #define MGMT_TX_DEFAULT_WAIT_TIME 1500 - /** cancel previous remain on channel */ - if (priv->phandle->remain_on_channel) { + if (priv->phandle->remain_on_channel) remain_priv = priv->phandle->priv[priv->phandle-> remain_bss_index]; - if (!remain_priv) { - PRINTM(MERROR, - "mgmt_tx:Wrong remain_bss_index=%d\n", - priv->phandle->remain_bss_index); - ret = -EFAULT; - goto done; - } + /** cancel previous remain on channel */ + if (priv->phandle->remain_on_channel && remain_priv) { if (woal_cfg80211_remain_on_channel_cfg (remain_priv, MOAL_IOCTL_WAIT, MTRUE, - &channel_status, NULL, 0, 0)) { + &channel_status, NULL, 0, 0)) PRINTM(MERROR, "mgmt_tx:Fail to cancel remain on channel\n"); - ret = -EFAULT; - goto done; - } - if (priv->phandle->cookie) { cfg80211_remain_on_channel_expired( #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0) @@ -2064,6 +2058,7 @@ woal_cfg80211_custom_ie(moal_private * priv, t_u8 *pos = NULL; t_u16 len = 0; int ret = 0; + mlan_status status = MLAN_STATUS_SUCCESS; ENTER(); @@ -2120,8 +2115,8 @@ woal_cfg80211_custom_ie(moal_private * priv, memcpy(&misc->param.cust_ie, custom_ie, sizeof(mlan_ds_misc_custom_ie)); - if (MLAN_STATUS_SUCCESS != - woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT)) { + status = woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT); + if (MLAN_STATUS_SUCCESS != status) { ret = -EFAULT; goto done; } @@ -2167,10 +2162,9 @@ woal_cfg80211_custom_ie(moal_private * priv, ret = -EFAULT; done: - if (ioctl_req) + if (status != MLAN_STATUS_PENDING) kfree(ioctl_req); - if (custom_ie) - kfree(custom_ie); + kfree(custom_ie); LEAVE(); return ret; } @@ -2192,7 +2186,7 @@ woal_get_first_p2p_ie(const t_u8 * ie, int len, t_u8 * ie_out) int length; t_u8 id = 0; t_u16 out_len = 0; - IEEEtypes_VendorSpecific_t *pVendorIe = NULL; + IEEEtypes_VendorSpecific_t *pvendor_ie = NULL; const u8 p2p_oui[4] = { 0x50, 0x6f, 0x9a, 0x09 }; while (left_len >= 2) { @@ -2201,11 +2195,11 @@ woal_get_first_p2p_ie(const t_u8 * ie, int len, t_u8 * ie_out) if ((length + 2) > left_len) break; if (id == VENDOR_SPECIFIC_221) { - pVendorIe = (IEEEtypes_VendorSpecific_t *) pos; + pvendor_ie = (IEEEtypes_VendorSpecific_t *) pos; if (!memcmp - (pVendorIe->vend_hdr.oui, p2p_oui, - sizeof(pVendorIe->vend_hdr.oui)) && - pVendorIe->vend_hdr.oui_type == p2p_oui[3]) { + (pvendor_ie->vend_hdr.oui, p2p_oui, + sizeof(pvendor_ie->vend_hdr.oui)) && + pvendor_ie->vend_hdr.oui_type == p2p_oui[3]) { memcpy(ie_out + out_len, pos, length + 2); out_len += length + 2; break; @@ -2235,7 +2229,7 @@ woal_filter_beacon_ies(const t_u8 * ie, int len, t_u8 * ie_out, t_u16 wps_flag) int length; t_u8 id = 0; t_u16 out_len = 0; - IEEEtypes_VendorSpecific_t *pVendorIe = NULL; + IEEEtypes_VendorSpecific_t *pvendor_ie = NULL; const u8 wps_oui[4] = { 0x00, 0x50, 0xf2, 0x04 }; const u8 p2p_oui[4] = { 0x50, 0x6f, 0x9a, 0x09 }; const u8 wfd_oui[4] = { 0x50, 0x6f, 0x9a, 0x0a }; @@ -2257,24 +2251,24 @@ woal_filter_beacon_ies(const t_u8 * ie, int len, t_u8 * ie_out, t_u16 wps_flag) break; case VENDOR_SPECIFIC_221: /* filter out wmm ie */ - pVendorIe = (IEEEtypes_VendorSpecific_t *) pos; + pvendor_ie = (IEEEtypes_VendorSpecific_t *) pos; if (!memcmp - (pVendorIe->vend_hdr.oui, wmm_oui, - sizeof(pVendorIe->vend_hdr.oui)) && - pVendorIe->vend_hdr.oui_type == wmm_oui[3]) + (pvendor_ie->vend_hdr.oui, wmm_oui, + sizeof(pvendor_ie->vend_hdr.oui)) && + pvendor_ie->vend_hdr.oui_type == wmm_oui[3]) break; /* filter out wps ie */ if ((!memcmp - (pVendorIe->vend_hdr.oui, wps_oui, - sizeof(pVendorIe->vend_hdr.oui)) && - pVendorIe->vend_hdr.oui_type == wps_oui[3]) && + (pvendor_ie->vend_hdr.oui, wps_oui, + sizeof(pvendor_ie->vend_hdr.oui)) && + pvendor_ie->vend_hdr.oui_type == wps_oui[3]) && (wps_flag & IE_MASK_WPS)) break; /* filter out first p2p ie */ if ((!memcmp - (pVendorIe->vend_hdr.oui, p2p_oui, - sizeof(pVendorIe->vend_hdr.oui)) && - pVendorIe->vend_hdr.oui_type == p2p_oui[3])) { + (pvendor_ie->vend_hdr.oui, p2p_oui, + sizeof(pvendor_ie->vend_hdr.oui)) && + pvendor_ie->vend_hdr.oui_type == p2p_oui[3])) { if (!find_p2p_ie && (wps_flag & IE_MASK_P2P)) { find_p2p_ie = MTRUE; break; @@ -2282,9 +2276,9 @@ woal_filter_beacon_ies(const t_u8 * ie, int len, t_u8 * ie_out, t_u16 wps_flag) } /* filter out wfd ie */ if ((!memcmp - (pVendorIe->vend_hdr.oui, wfd_oui, - sizeof(pVendorIe->vend_hdr.oui)) && - pVendorIe->vend_hdr.oui_type == wfd_oui[3]) && + (pvendor_ie->vend_hdr.oui, wfd_oui, + sizeof(pvendor_ie->vend_hdr.oui)) && + pvendor_ie->vend_hdr.oui_type == wfd_oui[3]) && (wps_flag & IE_MASK_WFD)) break; memcpy(ie_out + out_len, pos, length + 2); @@ -2353,7 +2347,7 @@ woal_is_selected_registrar_on(const t_u8 * ie, int len) const t_u8 *pos = ie; int length; t_u8 id = 0; - IEEEtypes_VendorSpecific_t *pVendorIe = NULL; + IEEEtypes_VendorSpecific_t *pvendor_ie = NULL; const u8 wps_oui[4] = { 0x00, 0x50, 0xf2, 0x04 }; while (left_len >= 2) { @@ -2363,11 +2357,11 @@ woal_is_selected_registrar_on(const t_u8 * ie, int len) break; switch (id) { case VENDOR_SPECIFIC_221: - pVendorIe = (IEEEtypes_VendorSpecific_t *) pos; + pvendor_ie = (IEEEtypes_VendorSpecific_t *) pos; if (!memcmp - (pVendorIe->vend_hdr.oui, wps_oui, - sizeof(pVendorIe->vend_hdr.oui)) && - pVendorIe->vend_hdr.oui_type == wps_oui[3]) { + (pvendor_ie->vend_hdr.oui, wps_oui, + sizeof(pvendor_ie->vend_hdr.oui)) && + pvendor_ie->vend_hdr.oui_type == wps_oui[3]) { PRINTM(MIOCTL, "Find WPS ie\n"); return is_selected_registrar_on(pos, length + 2); @@ -2705,14 +2699,10 @@ woal_cfg80211_mgmt_frame_ie(moal_private * priv, PRINTM(MIOCTL, "beacon=%x assocresp=%x proberesp=%x probereq=%x\n", beacon_index, assocresp_index, proberesp_index, probereq_index); done: - if (beacon_ies_data) - kfree(beacon_ies_data); - if (proberesp_ies_data) - kfree(proberesp_ies_data); - if (assocresp_ies_data) - kfree(assocresp_ies_data); - if (probereq_ies_data) - kfree(probereq_ies_data); + kfree(beacon_ies_data); + kfree(proberesp_ies_data); + kfree(assocresp_ies_data); + kfree(probereq_ies_data); LEAVE(); @@ -2770,3 +2760,60 @@ woal_cfg80211_setup_ht_cap(struct ieee80211_sta_ht_cap *ht_info, LEAVE(); } + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) +/** + * @brief Sets up the CFG802.11 specific VHT capability fields + * with default values + * + * @param priv A pointer to moal private structure + * @param vht_cap A pointer to ieee80211_sta_vht_cap structure + * + * @return N/A + */ +void +woal_cfg80211_setup_vht_cap(moal_private * priv, + struct ieee80211_sta_vht_cap *vht_cap) +{ + mlan_ioctl_req *req = NULL; + mlan_ds_11ac_cfg *cfg_11ac = NULL; + mlan_status status; + + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11ac_cfg)); + if (req == NULL) { + PRINTM(MERROR, "Fail to allocate buf for setup vht_cap\n"); + goto done; + } + cfg_11ac = (mlan_ds_11ac_cfg *) req->pbuf; + cfg_11ac->sub_command = MLAN_OID_11AC_VHT_CFG; + req->req_id = MLAN_IOCTL_11AC_CFG; + req->action = MLAN_ACT_GET; + cfg_11ac->param.vht_cfg.band = BAND_SELECT_A; + cfg_11ac->param.vht_cfg.txrx = MLAN_RADIO_TXRX; + status = woal_request_ioctl(priv, req, MOAL_CMD_WAIT); + if (MLAN_STATUS_SUCCESS != status) { + PRINTM(MERROR, "Fail to get vht_cfg\n"); + goto done; + } + vht_cap->vht_supported = true; + vht_cap->cap = cfg_11ac->param.vht_cfg.vht_cap_info; + vht_cap->vht_mcs.rx_mcs_map = + (t_u16) cfg_11ac->param.vht_cfg.vht_rx_mcs; + vht_cap->vht_mcs.rx_highest = + (t_u16) cfg_11ac->param.vht_cfg.vht_rx_max_rate; + vht_cap->vht_mcs.tx_mcs_map = + (t_u16) cfg_11ac->param.vht_cfg.vht_tx_mcs; + vht_cap->vht_mcs.tx_highest = + (t_u16) cfg_11ac->param.vht_cfg.vht_tx_max_rate; + PRINTM(MCMND, + "vht_cap=0x%x rx_mcs_map=0x%x rx_max=0x%x tx_mcs_map=0x%x tx_max=0x%x\n", + vht_cap->cap, vht_cap->vht_mcs.rx_mcs_map, + vht_cap->vht_mcs.rx_highest, vht_cap->vht_mcs.tx_mcs_map, + vht_cap->vht_mcs.tx_highest); +done: + if (status != MLAN_STATUS_PENDING) + kfree(req); + LEAVE(); + return; +} +#endif diff --git a/drivers/net/wireless/sd8897/mlinux/moal_cfg80211.h b/drivers/net/wireless/sd8897/mlinux/moal_cfg80211.h index 56c340b1db64..8e49c7c5772c 100644 --- a/drivers/net/wireless/sd8897/mlinux/moal_cfg80211.h +++ b/drivers/net/wireless/sd8897/mlinux/moal_cfg80211.h @@ -297,6 +297,10 @@ int woal_get_active_intf_freq(moal_private * priv); void woal_cfg80211_setup_ht_cap(struct ieee80211_sta_ht_cap *ht_info, t_u32 dev_cap, t_u8 * mcs_set); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) +void woal_cfg80211_setup_vht_cap(moal_private * priv, + struct ieee80211_sta_vht_cap *vht_cap); +#endif int woal_cfg80211_assoc(moal_private * priv, void *sme); #endif /* _MOAL_CFG80211_H_ */ diff --git a/drivers/net/wireless/sd8897/mlinux/moal_debug.c b/drivers/net/wireless/sd8897/mlinux/moal_debug.c index 4dff8de2eb49..426442e83cfc 100644 --- a/drivers/net/wireless/sd8897/mlinux/moal_debug.c +++ b/drivers/net/wireless/sd8897/mlinux/moal_debug.c @@ -40,17 +40,17 @@ extern mlan_debug_info info; /** Get info item size */ #define item_size(n) (sizeof(info.n)) /** Get info item address */ -#define item_addr(n) ((t_ptr) & (info.n)) +#define item_addr(n) ((t_ptr) &(info.n)) /** Get moal_private member size */ -#define item_priv_size(n) (sizeof ((moal_private *)0)->n) +#define item_priv_size(n) (sizeof((moal_private *)0)->n) /** Get moal_private member address */ -#define item_priv_addr(n) ((t_ptr) & ((moal_private *)0)->n) +#define item_priv_addr(n) ((t_ptr) &((moal_private *)0)->n) /** Get moal_handle member size */ -#define item_handle_size(n) (sizeof ((moal_handle *)0)->n) +#define item_handle_size(n) (sizeof((moal_handle *)0)->n) /** Get moal_handle member address */ -#define item_handle_addr(n) ((t_ptr) & ((moal_handle *)0)->n) +#define item_handle_addr(n) ((t_ptr) &((moal_handle *)0)->n) #ifdef STA_SUPPORT static struct debug_data items[] = { @@ -91,6 +91,8 @@ static struct debug_data items[] = { , {"hs_activated", item_size(hs_activated), item_addr(hs_activated)} , + {"rx_pkts_queued", item_size(rx_pkts_queued), item_addr(rx_pkts_queued)} + , {"tx_pkts_queued", item_size(tx_pkts_queued), item_addr(tx_pkts_queued)} , {"pps_uapsd_mode", item_size(pps_uapsd_mode), item_addr(pps_uapsd_mode)} @@ -286,6 +288,8 @@ static struct debug_data uap_items[] = { , {"hs_activated", item_size(hs_activated), item_addr(hs_activated)} , + {"rx_pkts_queued", item_size(rx_pkts_queued), item_addr(rx_pkts_queued)} + , {"tx_pkts_queued", item_size(tx_pkts_queued), item_addr(tx_pkts_queued)} , {"bypass_pkt_count", item_size(bypass_pkt_count), @@ -554,6 +558,35 @@ woal_debug_read(struct seq_file *sfp, void *data) seq_printf(sfp, "\n"); } } + if (info.tdls_peer_list) { + for (i = 0; i < info.tdls_peer_num; i++) { + unsigned int j; + seq_printf(sfp, + "tdls peer: %02x:%02x:%02x:%02x:%02x:%02x snr=%d nf=%d\n", + info.tdls_peer_list[i].mac_addr[0], + info.tdls_peer_list[i].mac_addr[1], + info.tdls_peer_list[i].mac_addr[2], + info.tdls_peer_list[i].mac_addr[3], + info.tdls_peer_list[i].mac_addr[4], + info.tdls_peer_list[i].mac_addr[5], + info.tdls_peer_list[i].snr, + -info.tdls_peer_list[i].nf); + seq_printf(sfp, "htcap: "); + for (j = 0; j < sizeof(IEEEtypes_HTCap_t); j++) + seq_printf(sfp, "%02x ", + info.tdls_peer_list[i].ht_cap[j]); + seq_printf(sfp, "\nExtcap: "); + for (j = 0; j < sizeof(IEEEtypes_ExtCap_t); j++) + seq_printf(sfp, "%02x ", + info.tdls_peer_list[i].ext_cap[j]); + seq_printf(sfp, "\n"); + seq_printf(sfp, "vhtcap: "); + for (j = 0; j < sizeof(IEEEtypes_VHTCap_t); j++) + seq_printf(sfp, "%02x ", + info.tdls_peer_list[i].vht_cap[j]); + seq_printf(sfp, "\n"); + } + } exit: MODULE_PUT; LEAVE(); @@ -648,16 +681,17 @@ woal_debug_write(struct file *f, const char __user * buf, size_t count, #ifdef DEBUG_LEVEL1 if (last_drvdbg != drvdbg) { woal_set_drvdbg(priv, drvdbg); + } #endif - +#if 0 /* Set debug information */ if (woal_set_debug_info(priv, MOAL_PROC_WAIT, &info)) { MODULE_PUT; LEAVE(); return 0; } - +#endif MODULE_PUT; LEAVE(); return count; @@ -780,8 +814,7 @@ woal_debug_remove(moal_private * priv) { ENTER(); - if (priv->items_priv.items) - kfree(priv->items_priv.items); + kfree(priv->items_priv.items); /* Remove proc entry */ remove_proc_entry("debug", priv->proc_entry); diff --git a/drivers/net/wireless/sd8897/mlinux/moal_eth_ioctl.c b/drivers/net/wireless/sd8897/mlinux/moal_eth_ioctl.c index 2685503fc718..6e38cf201b5a 100644 --- a/drivers/net/wireless/sd8897/mlinux/moal_eth_ioctl.c +++ b/drivers/net/wireless/sd8897/mlinux/moal_eth_ioctl.c @@ -353,8 +353,7 @@ woal_priv_hostcmd(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) memcpy(data_ptr, (t_u8 *) & ret, sizeof(t_u32)); error: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -412,9 +411,7 @@ woal_priv_customie(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = EFAULT; } done: - if (ioctl_req) { - kfree(ioctl_req); - } + kfree(ioctl_req); LEAVE(); return ret; } @@ -567,8 +564,7 @@ woal_setget_priv_bandcfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(mlan_ds_band_cfg); error: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -666,8 +662,7 @@ woal_setget_priv_httxcfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(data); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -769,8 +764,7 @@ woal_setget_priv_htcapinfo(moal_private * priv, t_u8 * respbuf, ret = sizeof(woal_ht_cap_info); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -876,8 +870,7 @@ woal_setget_priv_addbapara(moal_private * priv, t_u8 * respbuf, ret = sizeof(woal_addba); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -974,8 +967,7 @@ woal_priv_delba(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sprintf(respbuf, "OK. BA deleted successfully.\n") + 1; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1052,10 +1044,317 @@ woal_priv_rejectaddbareq(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) + kfree(req); + LEAVE(); + return ret; + +} + +/** + * @brief Set/Get the addba reject setting + * + * @param priv A pointer to moal_private structure + * @param action Action set or get + * @param addba_reject A pointer to addba_reject array. + * + * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, otherwise fail + */ +mlan_status +woal_ioctl_addba_reject(moal_private * priv, t_u32 action, t_u8 * addba_reject) +{ + mlan_ioctl_req *req = NULL; + mlan_ds_11n_cfg *cfg_11n = NULL; + mlan_status ret = MLAN_STATUS_SUCCESS; + + ENTER(); + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11n_cfg)); + if (req == NULL) { + ret = -ENOMEM; + goto done; + } + + cfg_11n = (mlan_ds_11n_cfg *) req->pbuf; + cfg_11n->sub_command = MLAN_OID_11N_CFG_ADDBA_REJECT; + req->req_id = MLAN_IOCTL_11N_CFG; + + req->action = action; + if (action == MLAN_ACT_SET) + memcpy(cfg_11n->param.addba_reject, addba_reject, + sizeof(cfg_11n->param.addba_reject)); + /* Send IOCTL request to MLAN */ + ret = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (ret != MLAN_STATUS_SUCCESS) + goto done; + if (action == MLAN_ACT_GET) + memcpy(addba_reject, cfg_11n->param.addba_reject, + sizeof(cfg_11n->param.addba_reject)); +done: + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; +} + +/** + * @brief Set/Get addba prio_tbl + * + * @param priv A pointer to moal_private structure + * @param action Action set or get + * @param aggr_prio_tbl A pointer to mlan_ds_11n_aggr_prio_tbl. + * + * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, otherwise fail + */ +mlan_status +woal_ioctl_aggr_prio_tbl(moal_private * priv, t_u32 action, + mlan_ds_11n_aggr_prio_tbl * aggr_prio_tbl) +{ + mlan_ioctl_req *req = NULL; + mlan_ds_11n_cfg *cfg_11n = NULL; + mlan_status ret = MLAN_STATUS_SUCCESS; + + ENTER(); + + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11n_cfg)); + if (req == NULL) { + ret = -ENOMEM; + goto done; + } + + cfg_11n = (mlan_ds_11n_cfg *) req->pbuf; + cfg_11n->sub_command = MLAN_OID_11N_CFG_AGGR_PRIO_TBL; + req->req_id = MLAN_IOCTL_11N_CFG; + + req->action = action; + if (action == MLAN_ACT_SET) + memcpy(&cfg_11n->param.aggr_prio_tbl, aggr_prio_tbl, + sizeof(mlan_ds_11n_aggr_prio_tbl)); + /* Send IOCTL request to MLAN */ + ret = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (ret != MLAN_STATUS_SUCCESS) + goto done; + if (action == MLAN_ACT_GET) + memcpy(aggr_prio_tbl, &cfg_11n->param.aggr_prio_tbl, + sizeof(mlan_ds_11n_aggr_prio_tbl)); +done: + if (ret != MLAN_STATUS_PENDING) + kfree(req); + LEAVE(); + return ret; + +} + +/** + * @brief Set/Get addba_param + * + * @param priv A pointer to moal_private structure + * @param action Action set or get + * @param addba_param A pointer to mlan_ds_11n_addba_param. + * + * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, otherwise fail + */ +mlan_status +woal_ioctl_addba_param(moal_private * priv, t_u32 action, + mlan_ds_11n_addba_param * addba_param) +{ + mlan_ioctl_req *req = NULL; + mlan_ds_11n_cfg *cfg_11n = NULL; + mlan_status ret = MLAN_STATUS_SUCCESS; + + ENTER(); + + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11n_cfg)); + if (req == NULL) { + ret = -ENOMEM; + goto done; + } + + cfg_11n = (mlan_ds_11n_cfg *) req->pbuf; + cfg_11n->sub_command = MLAN_OID_11N_CFG_ADDBA_PARAM; + req->req_id = MLAN_IOCTL_11N_CFG; + + req->action = action; + if (action == MLAN_ACT_SET) + memcpy(&cfg_11n->param.addba_param, addba_param, + sizeof(mlan_ds_11n_addba_param)); + /* Send IOCTL request to MLAN */ + ret = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (ret != MLAN_STATUS_SUCCESS) + goto done; + if (action == MLAN_ACT_GET) + memcpy(addba_param, &cfg_11n->param.addba_param, + sizeof(mlan_ds_11n_addba_param)); +done: + if (ret != MLAN_STATUS_PENDING) + kfree(req); + LEAVE(); + return ret; + +} + +/** + * @brief Configuring rx block-ack window size + * + * @param priv A pointer to moal_private structure + * @param respbuf A pointer to response buffer + * @param respbuflen Available length of response buffer + * + * @return 0 --success, otherwise failure + */ +int +woal_set_rx_ba_winsize(moal_private * priv, t_u8 * respbuf, int respbuflen) +{ + t_u32 data[2]; + t_u8 addba_reject[MAX_NUM_TID]; + mlan_ds_11n_addba_param addba_param; + int ret = 0; + int user_data_len = 0; + + ENTER(); + + memset((char *)data, 0, sizeof(data)); + parse_arguments(respbuf, data, ARRAY_SIZE(data), &user_data_len); + + if (user_data_len != 2) { + PRINTM(MERROR, "Invalid arguments for ba_winsize command\n"); + ret = -EINVAL; + goto done; + } + if (data[0] > 7 || data[0] < 0) { + PRINTM(MERROR, "Invalid tid %d\n", data[0]); + ret = -EINVAL; + goto done; + } + if (data[1] < 0) { + PRINTM(MERROR, "Invalid winsize %d\n", data[1]); + ret = -EINVAL; + goto done; + } + memset(addba_reject, 0, sizeof(addba_reject)); + if (MLAN_STATUS_SUCCESS != + woal_ioctl_addba_reject(priv, MLAN_ACT_GET, addba_reject)) { + ret = -EFAULT; + goto done; + } + /* disable tx ba */ + if (data[1] == 0) { + addba_reject[data[0]] = MTRUE; + if (MLAN_STATUS_SUCCESS != + woal_ioctl_addba_reject(priv, MLAN_ACT_SET, addba_reject)) + ret = -EFAULT; + } else { + if (addba_reject[data[0]] == MTRUE) { + addba_reject[data[0]] = MFALSE; + if (MLAN_STATUS_SUCCESS != + woal_ioctl_addba_reject(priv, MLAN_ACT_SET, + addba_reject)) { + ret = -EFAULT; + goto done; + } + } + memset(&addba_param, 0, sizeof(addba_param)); + if (MLAN_STATUS_SUCCESS != + woal_ioctl_addba_param(priv, MLAN_ACT_GET, &addba_param)) { + ret = -EFAULT; + goto done; + } + if (data[1] != addba_param.rxwinsize) { + addba_param.rxwinsize = data[1]; + if (MLAN_STATUS_SUCCESS != + woal_ioctl_addba_param(priv, MLAN_ACT_SET, + &addba_param)) + ret = -EFAULT; + } + + } +done: + LEAVE(); + return ret; + +} + +/** + * @brief Configuring trx block-ack window size + * + * @param priv A pointer to moal_private structure + * @param respbuf A pointer to response buffer + * @param respbuflen Available length of response buffer + * + * @return 0 --success, otherwise failure + */ +int +woal_set_tx_ba_winsize(moal_private * priv, t_u8 * respbuf, int respbuflen) +{ + t_u32 data[2]; + mlan_ds_11n_aggr_prio_tbl aggr_prio_tbl; + mlan_ds_11n_addba_param addba_param; + t_u8 tos_to_tid_inv[] = + { 0x02, 0x00, 0x01, 0x03, 0x04, 0x05, 0x06, 0x07 }; + int ret = 0; + int user_data_len = 0; + + ENTER(); + + memset((char *)data, 0, sizeof(data)); + parse_arguments(respbuf, data, ARRAY_SIZE(data), &user_data_len); + + if (user_data_len != 2) { + PRINTM(MERROR, "Invalid arguments for ba_winsize command\n"); + ret = -EINVAL; + goto done; + } + if (data[0] > 7 || data[0] < 0) { + PRINTM(MERROR, "Invalid tid %d\n", data[0]); + ret = -EINVAL; + goto done; + } + if (data[1] < 0) { + PRINTM(MERROR, "Invalid winsize %d\n", data[1]); + ret = -EINVAL; + goto done; + } + memset(&aggr_prio_tbl, 0, sizeof(aggr_prio_tbl)); + if (MLAN_STATUS_SUCCESS != + woal_ioctl_aggr_prio_tbl(priv, MLAN_ACT_GET, &aggr_prio_tbl)) { + ret = -EFAULT; + goto done; + } + /* disable tx ba */ + if (data[1] == 0) { + if (aggr_prio_tbl.ampdu[data[0]] != 0xff) { + aggr_prio_tbl.ampdu[data[0]] = 0xff; + if (MLAN_STATUS_SUCCESS != + woal_ioctl_aggr_prio_tbl(priv, MLAN_ACT_SET, + &aggr_prio_tbl)) + ret = -EFAULT; + } + } else { + if (aggr_prio_tbl.ampdu[data[0]] == 0xff) { + aggr_prio_tbl.ampdu[data[0]] = tos_to_tid_inv[data[0]]; + if (MLAN_STATUS_SUCCESS != + woal_ioctl_aggr_prio_tbl(priv, MLAN_ACT_SET, + &aggr_prio_tbl)) { + ret = -EFAULT; + goto done; + } + } + memset(&addba_param, 0, sizeof(addba_param)); + if (MLAN_STATUS_SUCCESS != + woal_ioctl_addba_param(priv, MLAN_ACT_GET, &addba_param)) { + ret = -EFAULT; + goto done; + } + if (data[1] != addba_param.txwinsize) { + addba_param.txwinsize = data[1]; + if (MLAN_STATUS_SUCCESS != + woal_ioctl_addba_param(priv, MLAN_ACT_SET, + &addba_param)) + ret = -EFAULT; + } + + } +done: + LEAVE(); + return ret; } @@ -1141,8 +1440,7 @@ woal_setget_priv_aggrpriotbl(moal_private * priv, t_u8 * respbuf, ret = sizeof(data); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -1227,8 +1525,7 @@ woal_setget_priv_addbareject(moal_private * priv, t_u8 * respbuf, ret = sizeof(data); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -1377,8 +1674,7 @@ woal_setget_priv_vhtcfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -1427,8 +1723,7 @@ woal_get_priv_datarate(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(mlan_data_rate); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -1566,8 +1861,7 @@ woal_setget_priv_txratecfg(moal_private * priv, t_u8 * respbuf, ret = sizeof(woal_tx_rate_cfg); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -1619,7 +1913,7 @@ woal_get_stats_info(moal_private * priv, t_u8 wait_option, #endif } done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -1743,8 +2037,7 @@ woal_setget_priv_esuppmode(moal_private * priv, t_u8 * respbuf, ret = sizeof(woal_esuppmode_cfg); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -1906,8 +2199,7 @@ woal_setget_priv_passphrase(moal_private * priv, t_u8 * respbuf, ret = len; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -2001,8 +2293,7 @@ woal_priv_ap_deauth(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) memcpy(data_ptr, &ioctl_req->status_code, sizeof(t_u32)); ret = sizeof(t_u32); done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -2050,8 +2341,7 @@ woal_priv_get_sta_list(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) memcpy(sta_list, &info->param.sta_list, sizeof(mlan_ds_sta_list)); ret = sizeof(mlan_ds_sta_list); done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -2111,8 +2401,7 @@ woal_priv_bss_config(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } ret = sizeof(mlan_uap_bss_param); done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -2375,7 +2664,7 @@ woal_priv_getscantable(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) scan_start); } done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -2428,7 +2717,7 @@ woal_priv_extcapcfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) goto done; } req->action = MLAN_ACT_SET; - memset(&cfg->param.ext_cap, 0, sizeof(ExtCap_t) - ie->len); + memset(&cfg->param.ext_cap, 0, sizeof(ExtCap_t)); memcpy(&cfg->param.ext_cap, ie + 1, ie->len); } @@ -2444,11 +2733,10 @@ woal_priv_extcapcfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ie->len = sizeof(ExtCap_t); memcpy(ie + 1, &cfg->param.ext_cap, sizeof(ExtCap_t)); - ret = sizeof(ie) + ie->len; + ret = sizeof(IEEEtypes_Header_t) + ie->len; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2617,8 +2905,7 @@ woal_priv_setgetipaddr(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2685,8 +2972,7 @@ woal_priv_setwpssession(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sprintf(respbuf, "OK\n") + 1; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2748,8 +3034,7 @@ woal_priv_otpuserdata(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2821,8 +3106,7 @@ woal_priv_set_get_countrycode(moal_private * priv, t_u8 * respbuf, } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -3023,15 +3307,13 @@ woal_priv_getwakeupreason(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) if (MLAN_STATUS_SUCCESS != woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT)) { ret = -EFAULT; - if (req) - kfree(req); + kfree(req); goto done; } else { data = pm_cfg->param.wakeup_reason.hs_wakeup_reason; sprintf(respbuf, " %d", data); ret = strlen(respbuf) + 1; - if (req) - kfree(req); + kfree(req); } } else { PRINTM(MERROR, "Not need argument, invalid operation!\n"); @@ -3118,8 +3400,7 @@ woal_priv_set_get_listeninterval(moal_private * priv, t_u8 * respbuf, } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -3401,7 +3682,7 @@ woal_priv_set_get_scancfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) { int ret = 0; int user_data_len = 0; - int arg_len = 6; + int arg_len = 7; int data[arg_len]; mlan_ds_scan *scan = NULL; mlan_ioctl_req *req = NULL; @@ -3461,6 +3742,11 @@ woal_priv_set_get_scancfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = -EINVAL; goto done; } + if ((data[6] < 0) || (data[6] > 1)) { + PRINTM(MERROR, "Invalid argument for extended scan\n"); + ret = -EINVAL; + goto done; + } req->action = MLAN_ACT_SET; memcpy(&scan->param.scan_cfg, data, sizeof(data)); } else @@ -3476,8 +3762,7 @@ woal_priv_set_get_scancfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(mlan_scan_cfg); } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -3643,8 +3928,7 @@ woal_priv_set_bss_mode(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) goto done; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -4346,8 +4630,7 @@ woal_priv_txpowercfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(pcfg->param.power_ext); } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -4513,10 +4796,8 @@ woal_priv_pscfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) - kfree(req); - if (arguments) - kfree(arguments); + kfree(req); + kfree(arguments); LEAVE(); return ret; } @@ -4593,8 +4874,7 @@ woal_priv_sleeppd(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -4664,8 +4944,7 @@ woal_priv_txcontrol(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -4754,10 +5033,8 @@ woal_priv_regrdwr(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) - kfree(req); - if (arguments) - kfree(arguments); + kfree(req); + kfree(arguments); LEAVE(); return ret; } @@ -4822,8 +5099,7 @@ woal_priv_rdeeprom(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -4917,10 +5193,8 @@ woal_priv_memrdwr(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) - kfree(req); - if (arguments) - kfree(arguments); + kfree(req); + kfree(arguments); LEAVE(); return ret; } @@ -5064,8 +5338,7 @@ woal_priv_arpfilter(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) goto done; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5133,8 +5406,7 @@ woal_priv_mgmt_frame_passthru_ctrl(moal_private * priv, t_u8 * respbuf, ret = sizeof(data); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -5229,8 +5501,7 @@ woal_priv_wmm_addts_req_ioctl(moal_private * priv, t_u8 * respbuf, ret = copy_len; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5309,8 +5580,7 @@ woal_priv_wmm_delts_req_ioctl(moal_private * priv, t_u8 * respbuf, } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5371,8 +5641,7 @@ woal_priv_qconfig(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = strlen(CMD_MARVELL) + strlen(PRIV_CMD_QCONFIG) + sizeof(qcfg_ioctl); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5432,8 +5701,7 @@ woal_priv_wmm_queue_status_ioctl(moal_private * priv, t_u8 * respbuf, } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5491,8 +5759,7 @@ woal_priv_wmm_ts_status_ioctl(moal_private * priv, t_u8 * respbuf, ret = sizeof(ts_status_ioctl); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5558,8 +5825,7 @@ woal_priv_macctrl(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(data); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5673,8 +5939,7 @@ woal_priv_region_code(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(data); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5740,8 +6005,7 @@ woal_priv_multi_chan_config(moal_private * priv, t_u8 * respbuf, ret = req->buf_len; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5759,11 +6023,11 @@ int woal_priv_multi_chan_policy(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) { - mlan_ioctl_req *req = NULL; - mlan_ds_misc_cfg *cfg = NULL; int ret = 0; int user_data_len = 0, header_len = 0; int data = 0; + t_u16 enable; + t_u8 action; ENTER(); @@ -5781,36 +6045,23 @@ woal_priv_multi_chan_policy(moal_private * priv, t_u8 * respbuf, ret = -EINVAL; goto done; } - req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); - if (req == NULL) { - ret = -ENOMEM; - goto done; - } - - cfg = (mlan_ds_misc_cfg *) req->pbuf; - cfg->sub_command = MLAN_OID_MISC_MULTI_CHAN_POLICY; - req->req_id = MLAN_IOCTL_MISC_CFG; if (user_data_len == 0) { - req->action = MLAN_ACT_GET; + action = MLAN_ACT_GET; } else { - req->action = MLAN_ACT_SET; - cfg->param.multi_chan_policy = (t_u16) data; + action = MLAN_ACT_SET; + enable = (t_u16) data; } if (MLAN_STATUS_SUCCESS != - woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT)) { + woal_mc_policy_cfg(priv, &enable, MOAL_IOCTL_WAIT, action)) { ret = -EFAULT; goto done; } - - memcpy(respbuf, (t_u16 *) & cfg->param.multi_chan_policy, - sizeof(t_u16)); + memcpy(respbuf, &enable, sizeof(t_u16)); ret = sizeof(t_u16); done: - if (req) - kfree(req); LEAVE(); return ret; } @@ -5871,8 +6122,7 @@ woal_priv_fwmacaddr(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) HEXDUMP("FW MAC Addr:", respbuf, ETH_ALEN); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -6085,8 +6335,7 @@ woal_priv_get_driver_verext(moal_private * priv, t_u8 * respbuf, info->param.ver_ext.version_str); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -6158,8 +6407,7 @@ woal_priv_wmm_cfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(wmm->param.wmm_enable); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -6232,8 +6480,7 @@ woal_priv_11d_cfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(pcfg_11d->param.enable_11d); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -6283,8 +6530,7 @@ woal_priv_11d_clr_chan_tbl(moal_private * priv, t_u8 * respbuf, } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -6354,8 +6600,7 @@ woal_priv_wws_cfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(wws->param.wws_cfg); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -6471,8 +6716,7 @@ woal_priv_txbuf_cfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(buf_size); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -6605,8 +6849,7 @@ woal_priv_11h_local_pwr_constraint(moal_private * priv, t_u8 * respbuf, } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -6676,8 +6919,7 @@ woal_priv_ht_stream_cfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(data); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -6730,8 +6972,7 @@ woal_priv_thermal(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(data); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -6801,8 +7042,7 @@ woal_priv_beacon_interval(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(data); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -7067,8 +7307,7 @@ woal_priv_set_get_pmfcfg(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(mlan_ds_misc_pmfcfg); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -7153,8 +7392,7 @@ woal_priv_inactivity_timeout_ext(moal_private * priv, t_u8 * respbuf, } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -7215,8 +7453,7 @@ woal_priv_atim_window(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(int); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -7282,8 +7519,7 @@ woal_priv_11n_amsdu_aggr_ctrl(moal_private * priv, t_u8 * respbuf, ret = sizeof(data); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -7348,8 +7584,7 @@ woal_priv_tx_bf_cap_ioctl(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = sizeof(bf_cap); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -7517,8 +7752,7 @@ woal_priv_sdio_mpa_ctrl(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -7628,8 +7862,7 @@ woal_priv_sleep_params_ioctl(moal_private * priv, t_u8 * respbuf, ret = sizeof(data); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -7727,8 +7960,7 @@ woal_priv_dfs_testing(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -7805,8 +8037,7 @@ woal_priv_cfp_code(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -7876,8 +8107,7 @@ woal_priv_set_get_tx_rx_ant(moal_private * priv, t_u8 * respbuf, memcpy(respbuf, (t_u8 *) data, sizeof(data)); } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -7999,8 +8229,7 @@ woal_priv_sysclock(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -8145,8 +8374,7 @@ woal_priv_adhoc_aes(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) ret = copy_len; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -8695,8 +8923,7 @@ woal_priv_cmd53rdwr(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (data) - kfree(data); + kfree(data); LEAVE(); return ret; } @@ -8762,8 +8989,7 @@ woal_priv_port_ctrl(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -9744,6 +9970,18 @@ woal_android_priv_cmd(struct net_device *dev, struct ifreq *req) } #endif len = sprintf(buf, "OK\n") + 1; + } else if (strncmp(buf, "ROAM", strlen("ROAM")) == 0) { + pdata = buf + strlen("ROAM") + 1; +#ifdef STA_CFG80211 + if (*pdata == '1') { + priv->roaming_enabled = MTRUE; + PRINTM(MIOCTL, "Roaming enabled\n"); + } else if (*pdata == '0') { + priv->roaming_enabled = MFALSE; + PRINTM(MIOCTL, "Roaming disabled\n"); + } +#endif + len = sprintf(buf, "OK\n") + 1; } else if (strncmp(buf, "COUNTRY", strlen("COUNTRY")) == 0) { if ((strlen(buf) - strlen("COUNTRY") - 1) > COUNTRY_CODE_LEN || (strlen(buf) - strlen("COUNTRY") - 1) <= 0) { @@ -9755,6 +9993,11 @@ woal_android_priv_cmd(struct net_device *dev, struct ifreq *req) memcpy(country_code, buf + strlen("COUNTRY") + 1, strlen(buf) - strlen("COUNTRY") - 1); PRINTM(MIOCTL, "Set COUNTRY %s\n", country_code); + if (MLAN_STATUS_SUCCESS != + woal_request_country_power_table(priv, country_code)) { + ret = -EFAULT; + goto done; + } #ifdef STA_CFG80211 if (IS_STA_CFG80211(cfg80211_wext)) { PRINTM(MIOCTL, "Notify country code=%s\n", @@ -9801,13 +10044,13 @@ woal_android_priv_cmd(struct net_device *dev, struct ifreq *req) } #ifdef UAP_SUPPORT else if (strncmp(buf, "AP_BSS_START", strlen("AP_BSS_START")) == 0) { - if ((ret == - woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT, UAP_BSS_START))) + ret = woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT, UAP_BSS_START); + if (ret) goto done; len = sprintf(buf, "OK\n") + 1; } else if (strncmp(buf, "AP_BSS_STOP", strlen("AP_BSS_STOP")) == 0) { - if ((ret == - woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT, UAP_BSS_STOP))) + ret = woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT, UAP_BSS_STOP); + if (ret) goto done; len = sprintf(buf, "OK\n") + 1; } else if (strncmp(buf, "AP_SET_CFG", strlen("AP_SET_CFG")) == 0) { @@ -9967,6 +10210,38 @@ woal_android_priv_cmd(struct net_device *dev, struct ifreq *req) goto done; } len = sprintf(buf, "OK\n") + 1; + } else if (strnicmp(buf, "BA_WSIZE_RX", strlen("BA_WSIZE_RX")) == 0) { + pdata = buf + strlen("BA_WSIZE_RX") + 1; + len = priv_cmd.total_len - strlen("BA_WSIZE_RX") - 1; + if (MLAN_STATUS_SUCCESS != + woal_set_rx_ba_winsize(priv, pdata, len)) { + ret = -EFAULT; + goto done; + } + len = sprintf(buf, "OK\n") + 1; + } else if (strnicmp(buf, "BA_WSIZE_TX", strlen("BA_WSIZE_TX")) == 0) { + pdata = buf + strlen("BA_WSIZE_TX") + 1; + len = priv_cmd.total_len - strlen("BA_WSIZE_TX") - 1; + if (MLAN_STATUS_SUCCESS != + woal_set_tx_ba_winsize(priv, pdata, len)) { + ret = -EFAULT; + goto done; + } + len = sprintf(buf, "OK\n") + 1; + } else if (strncmp + (buf, "FAKE_SCAN_COMPLETE", + strlen("FAKE_SCAN_COMPLETE")) == 0) { + pdata = buf + strlen("FAKE_SCAN_COMPLETE") + 1; +#ifdef STA_CFG80211 + if (*pdata == '1') { + priv->fake_scan_complete = MTRUE; + PRINTM(MIOCTL, "fake scan complete enabled\n"); + } else if (*pdata == '0') { + priv->fake_scan_complete = MFALSE; + PRINTM(MIOCTL, "fake scan complete disabled\n"); + } +#endif + len = sprintf(buf, "OK\n") + 1; } else { PRINTM(MIOCTL, "Unknown PRIVATE command: %s, ignored\n", buf); ret = -EFAULT; @@ -10008,8 +10283,7 @@ handled: } done: - if (buf) - kfree(buf); + kfree(buf); LEAVE(); return ret; } @@ -10243,6 +10517,9 @@ woal_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) case WOAL_MGMT_FRAME_TX: ret = woal_send_host_packet(dev, req); break; + case WOAL_TDLS_CONFIG: + ret = woal_tdls_config_ioctl(dev, req); + break; case WOAL_ANDROID_PRIV_CMD: ret = woal_android_priv_cmd(dev, req); break; diff --git a/drivers/net/wireless/sd8897/mlinux/moal_eth_ioctl.h b/drivers/net/wireless/sd8897/mlinux/moal_eth_ioctl.h index 4a4cc452eded..2135b8042a69 100644 --- a/drivers/net/wireless/sd8897/mlinux/moal_eth_ioctl.h +++ b/drivers/net/wireless/sd8897/mlinux/moal_eth_ioctl.h @@ -195,6 +195,9 @@ Change log: /** Private command ID for Android default commands */ #define WOAL_ANDROID_DEF_CMD (SIOCDEVPRIVATE + 1) +/** Private command ID to send TLD configuration */ +#define WOAL_TDLS_CONFIG (SIOCDEVPRIVATE + 5) + /** Private command ID to pass mgmt frame */ #define WOAL_MGMT_FRAME_TX WOAL_MGMT_FRAME_TX_IOCTL diff --git a/drivers/net/wireless/sd8897/mlinux/moal_ioctl.c b/drivers/net/wireless/sd8897/mlinux/moal_ioctl.c index 8062963a65bc..d0efaaa7c30c 100644 --- a/drivers/net/wireless/sd8897/mlinux/moal_ioctl.c +++ b/drivers/net/wireless/sd8897/mlinux/moal_ioctl.c @@ -233,7 +233,6 @@ woal_copy_mcast_addr(mlan_multicast_list * mlist, struct net_device *dev) * @param handle A pointer to moal_handle * @param mlist A pointer to multicast list * - * * @return total_mc_count */ static int @@ -385,9 +384,8 @@ woal_cac_period_block_cmd(moal_private * priv, pmlan_ioctl_req req) t_u32 sub_command; ENTER(); - if (req == NULL || req->pbuf == NULL) { + if (req == NULL || req->pbuf == NULL) goto done; - } sub_command = *(t_u32 *) req->pbuf; @@ -395,9 +393,8 @@ woal_cac_period_block_cmd(moal_private * priv, pmlan_ioctl_req req) case MLAN_IOCTL_SCAN: if (sub_command == MLAN_OID_SCAN_NORMAL || sub_command == MLAN_OID_SCAN_SPECIFIC_SSID || - sub_command == MLAN_OID_SCAN_USER_CONFIG) { + sub_command == MLAN_OID_SCAN_USER_CONFIG) ret = MTRUE; - } break; case MLAN_IOCTL_BSS: if (sub_command == MLAN_OID_BSS_STOP || @@ -405,37 +402,31 @@ woal_cac_period_block_cmd(moal_private * priv, pmlan_ioctl_req req) sub_command == MLAN_OID_UAP_BSS_CONFIG || #endif sub_command == MLAN_OID_BSS_CHANNEL - /* sub_command == MLAN_OID_BSS_ROLE */ ) { + /* sub_command == MLAN_OID_BSS_ROLE */ ) ret = MTRUE; - } break; case MLAN_IOCTL_RADIO_CFG: - if (sub_command == MLAN_OID_BAND_CFG) { + if (sub_command == MLAN_OID_BAND_CFG) ret = MTRUE; - } break; #if defined(UAP_SUPPORT) case MLAN_IOCTL_SNMP_MIB: if (sub_command == MLAN_OID_SNMP_MIB_DOT11D || - sub_command == MLAN_OID_SNMP_MIB_DOT11H) { + sub_command == MLAN_OID_SNMP_MIB_DOT11H) ret = MTRUE; - } break; #endif case MLAN_IOCTL_11D_CFG: #ifdef STA_SUPPORT - if (sub_command == MLAN_OID_11D_CFG_ENABLE) { + if (sub_command == MLAN_OID_11D_CFG_ENABLE) ret = MTRUE; - } #endif - if (sub_command == MLAN_OID_11D_DOMAIN_INFO) { + if (sub_command == MLAN_OID_11D_DOMAIN_INFO) ret = MTRUE; - } break; case MLAN_IOCTL_MISC_CFG: - if (sub_command == MLAN_OID_MISC_REGION) { + if (sub_command == MLAN_OID_MISC_REGION) ret = MTRUE; - } if (sub_command == MLAN_OID_MISC_HOST_CMD) { phostcmd_header phostcmd; t_u8 *ptlv_buf; @@ -464,9 +455,8 @@ woal_cac_period_block_cmd(moal_private * priv, pmlan_ioctl_req req) break; case MLAN_IOCTL_11H_CFG: /* Prevent execute more than once */ - if (sub_command == MLAN_OID_11H_CHANNEL_CHECK) { + if (sub_command == MLAN_OID_11H_CHANNEL_CHECK) ret = MTRUE; - } break; default: ret = MFALSE; @@ -489,7 +479,8 @@ done: * @param req A pointer to mlan_ioctl_req buffer * @param wait_option Wait option (MOAL_WAIT or MOAL_NO_WAIT) * - * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, otherwise fail + * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING + * -- success, otherwise fail */ mlan_status woal_request_ioctl(moal_private * priv, mlan_ioctl_req * req, t_u8 wait_option) @@ -559,8 +550,7 @@ woal_request_ioctl(moal_private * priv, mlan_ioctl_req * req, t_u8 wait_option) */ if (priv->phandle->delay_bss_start == MFALSE) { PRINTM(MMSG, - "Received BSS Start command during CAC period, " - "delay executing %ld seconds\n", + "Received BSS Start command during CAC period, delay executing %ld seconds\n", cac_left_jiffies / HZ); priv->phandle->delay_bss_start = MTRUE; memcpy(&priv->phandle->delay_ssid_bssid, @@ -574,16 +564,16 @@ woal_request_ioctl(moal_private * priv, mlan_ioctl_req * req, t_u8 wait_option) } else { /* TODO: not blocking it, just return failure */ PRINTM(MMSG, - "Only one BSS Start command allowed for delay " - "executing!\n"); + "Only one BSS Start command allowed for delay executing!\n"); status = MLAN_STATUS_FAILURE; goto done; } } if (woal_cac_period_block_cmd(priv, req)) { priv->phandle->meas_wait_q_woken = MFALSE; - PRINTM(MMSG, "CAC check is on going... Blocking Command" - " %ld seconds\n", cac_left_jiffies / HZ); + PRINTM(MMSG, + "CAC check is on going... Blocking Command %ld seconds\n", + cac_left_jiffies / HZ); /* blocking timeout set to 1.5 * CAC checking period left time */ wait_event_interruptible_timeout(priv->phandle-> @@ -647,7 +637,8 @@ done: * * @param priv A pointer to moal_private structure * - * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, otherwise fail + * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING + * -- success, otherwise fail */ mlan_status woal_request_set_mac_address(moal_private * priv) @@ -683,8 +674,7 @@ woal_request_set_mac_address(moal_private * priv) status, req->status_code); } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return status; } @@ -711,7 +701,7 @@ woal_request_set_multicast_list(moal_private * priv, struct net_device *dev) req = (mlan_ioctl_req *) woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_bss)); if (req == NULL) { PRINTM(MERROR, "%s:Fail to allocate ioctl req buffer\n", - __FUNCTION__); + __func__); goto done; } @@ -780,7 +770,7 @@ woal_disconnect(moal_private * priv, t_u8 wait_option, t_u8 * mac) status = woal_request_ioctl(priv, req, wait_option); done: - if (req && (wait_option || status != MLAN_STATUS_PENDING)) + if (wait_option || status != MLAN_STATUS_PENDING) kfree(req); #ifdef REASSOCIATION priv->reassoc_required = MFALSE; @@ -839,8 +829,7 @@ woal_bss_start(moal_private * priv, t_u8 wait_option, #endif #endif done: - if (req) - kfree(req); + kfree(req); LEAVE(); return status; } @@ -886,7 +875,7 @@ woal_get_bss_info(moal_private * priv, t_u8 wait_option, sizeof(mlan_bss_info)); } done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -935,9 +924,8 @@ woal_set_get_retry(moal_private * priv, t_u32 action, /* Send IOCTL request to MLAN */ ret = woal_request_ioctl(priv, req, wait_option); - if (ret == MLAN_STATUS_SUCCESS && action == MLAN_ACT_GET) { + if (ret == MLAN_STATUS_SUCCESS && action == MLAN_ACT_GET) *value = mib->param.retry_count; - } #ifdef STA_CFG80211 /* If set is invoked from other than iw i.e iwconfig, wiphy retry count should be updated as well */ @@ -950,7 +938,7 @@ woal_set_get_retry(moal_private * priv, t_u32 action, #endif done: - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -998,9 +986,8 @@ woal_set_get_rts(moal_private * priv, t_u32 action, /* Send IOCTL request to MLAN */ ret = woal_request_ioctl(priv, req, wait_option); - if (ret == MLAN_STATUS_SUCCESS && action == MLAN_ACT_GET) { + if (ret == MLAN_STATUS_SUCCESS && action == MLAN_ACT_GET) *value = mib->param.rts_threshold; - } #ifdef STA_CFG80211 /* If set is invoked from other than iw i.e iwconfig, wiphy RTS threshold should be updated as well */ @@ -1011,7 +998,7 @@ woal_set_get_rts(moal_private * priv, t_u32 action, #endif done: - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -1060,9 +1047,8 @@ woal_set_get_frag(moal_private * priv, t_u32 action, /* Send IOCTL request to MLAN */ ret = woal_request_ioctl(priv, req, wait_option); - if (ret == MLAN_STATUS_SUCCESS && action == MLAN_ACT_GET) { + if (ret == MLAN_STATUS_SUCCESS && action == MLAN_ACT_GET) *value = mib->param.frag_threshold; - } #ifdef STA_CFG80211 /* If set is invoked from other than iw i.e iwconfig, wiphy fragment threshold should be updated as well */ @@ -1073,7 +1059,7 @@ woal_set_get_frag(moal_private * priv, t_u32 action, #endif done: - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -1139,9 +1125,7 @@ woal_set_get_gen_ie(moal_private * priv, t_u32 action, t_u8 * ie, int *ie_len) } done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -1186,7 +1170,7 @@ woal_set_get_tx_power(moal_private * priv, sizeof(mlan_power_cfg_t)); done: - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -1270,9 +1254,7 @@ woal_set_get_power_mgmt(moal_private * priv, #endif done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -1306,8 +1288,7 @@ woal_set_region_code(moal_private * priv, char *region) ret = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1357,8 +1338,7 @@ woal_set_get_data_rate(moal_private * priv, } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1401,8 +1381,7 @@ woal_get_assoc_rsp(moal_private * priv, mlan_ds_misc_assoc_rsp * assoc_rsp) ret = MLAN_STATUS_FAILURE; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1458,8 +1437,7 @@ woal_request_get_fw_info(moal_private * priv, t_u8 wait_option, "get fw info failed! status=%d, error_code=0x%x\n", status, req->status_code); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return status; } @@ -1507,7 +1485,7 @@ woal_get_debug_info(moal_private * priv, t_u8 wait_option, } } done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -1557,7 +1535,7 @@ woal_set_debug_info(moal_private * priv, t_u8 wait_option, /* Send IOCTL request to MLAN */ status = woal_request_ioctl(priv, req, wait_option); done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -1568,9 +1546,9 @@ done: /** * @brief host command ioctl function * - * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure - * @return 0 --success, otherwise fail + * @param priv A pointer to moal_private structure + * @param wrq A pointer to iwreq structure + * @return 0 --success, otherwise fail */ int woal_host_command(moal_private * priv, struct iwreq *wrq) @@ -1638,8 +1616,7 @@ woal_host_command(moal_private * priv, struct iwreq *wrq) } wrq->u.data.length = misc->param.hostcmd.len; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1654,12 +1631,12 @@ done: * @return 0 --success, otherwise fail */ /********* format of ifr_data *************/ -/* buf_len + Hostcmd_body */ +/* buf_len + Hostcmd_body */ /* buf_len: 4 bytes */ /* the length of the buf which */ /* can be used to return data */ -/* to application */ -/* Hostcmd_body */ +/* to application */ +/* Hostcmd_body */ /*******************************************/ int woal_hostcmd_ioctl(struct net_device *dev, struct ifreq *req) @@ -1744,8 +1721,7 @@ woal_hostcmd_ioctl(struct net_device *dev, struct ifreq *req) goto done; } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -1827,10 +1803,8 @@ woal_custom_ie_ioctl(struct net_device *dev, struct ifreq *req) } done: - if (ioctl_req) - kfree(ioctl_req); - if (custom_ie) - kfree(custom_ie); + kfree(ioctl_req); + kfree(custom_ie); LEAVE(); return ret; } @@ -1872,6 +1846,12 @@ woal_send_host_packet(struct net_device *dev, struct ifreq *req) goto done; } #define PACKET_HEADER_LEN 8 +#define MV_ETH_FRAME_LEN 1514 + if (packet_len > MV_ETH_FRAME_LEN) { + PRINTM(MERROR, "Invalid packet length %d\n", packet_len); + ret = -EFAULT; + goto done; + } pmbuf = woal_alloc_mlan_buffer(priv->phandle, (int)(MLAN_MIN_DATA_HEADER_LEN + (int)packet_len + @@ -1966,14 +1946,93 @@ woal_set_get_custom_ie(moal_private * priv, t_u16 mask, t_u8 * ie, int ie_len) ret = -EFAULT; } - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } #endif /* defined(HOST_TXRX_MGMT_FRAME) && defined(UAP_WEXT) */ /** + * @brief TDLS configuration ioctl handler + * + * @param dev A pointer to net_device structure + * @param req A pointer to ifreq structure + * @return 0 --success, otherwise fail + */ +int +woal_tdls_config_ioctl(struct net_device *dev, struct ifreq *req) +{ + moal_private *priv = (moal_private *) netdev_priv(dev); + mlan_ioctl_req *ioctl_req = NULL; + mlan_ds_misc_cfg *misc = NULL; + mlan_ds_misc_tdls_config *tdls_data = NULL; + int ret = 0; + + ENTER(); + + /* Sanity check */ + if (req->ifr_data == NULL) { + PRINTM(MERROR, "woal_tdls_config_ioctl() corrupt data\n"); + ret = -EFAULT; + goto done; + } + + tdls_data = kmalloc(sizeof(mlan_ds_misc_tdls_config), GFP_KERNEL); + if (!tdls_data) { + ret = -ENOMEM; + goto done; + } + memset(tdls_data, 0, sizeof(mlan_ds_misc_tdls_config)); + + if (copy_from_user + (tdls_data, req->ifr_data, sizeof(mlan_ds_misc_tdls_config))) { + PRINTM(MERROR, "Copy from user failed\n"); + ret = -EFAULT; + goto done; + } + + ioctl_req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (ioctl_req == NULL) { + ret = -ENOMEM; + goto done; + } + + misc = (mlan_ds_misc_cfg *) ioctl_req->pbuf; + misc->sub_command = MLAN_OID_MISC_TDLS_CONFIG; + ioctl_req->req_id = MLAN_IOCTL_MISC_CFG; + if (tdls_data->tdls_action == WLAN_TDLS_DISCOVERY_REQ + || tdls_data->tdls_action == WLAN_TDLS_LINK_STATUS) + ioctl_req->action = MLAN_ACT_GET; + else + ioctl_req->action = MLAN_ACT_SET; + + memcpy(&misc->param.tdls_config, tdls_data, + sizeof(mlan_ds_misc_tdls_config)); + + if (MLAN_STATUS_SUCCESS != + woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT)) { + ret = -EFAULT; + goto done; + } + + if (tdls_data->tdls_action == WLAN_TDLS_DISCOVERY_REQ + || tdls_data->tdls_action == WLAN_TDLS_LINK_STATUS) { + if (copy_to_user(req->ifr_data, &misc->param.tdls_config, + sizeof(mlan_ds_misc_tdls_config))) { + PRINTM(MERROR, "Copy to user failed!\n"); + ret = -EFAULT; + goto done; + } + } + +done: + kfree(ioctl_req); + kfree(tdls_data); + LEAVE(); + return ret; +} + +/** * @brief ioctl function get BSS type * * @param dev A pointer to net_device structure @@ -2099,8 +2158,7 @@ woal_bss_role_cfg(moal_private * priv, t_u8 action, } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2236,11 +2294,10 @@ woal_set_auto_arp(moal_handle * handle, t_u8 enable) } ret = woal_request_ioctl(woal_get_priv(handle, MLAN_BSS_ROLE_ANY), req, MOAL_NO_WAIT); - if (ret != MLAN_STATUS_SUCCESS && ret != MLAN_STATUS_PENDING) { + if (ret != MLAN_STATUS_SUCCESS && ret != MLAN_STATUS_PENDING) PRINTM(MIOCTL, "Set auto arp IOCTL failed!\n"); - } done: - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -2290,7 +2347,7 @@ woal_set_get_hs_params(moal_private * priv, t_u16 action, t_u8 wait_option, } } done: - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -2302,8 +2359,8 @@ done: * @param priv A pointer to moal_private structure * @param wait_option wait option * - * @return MLAN_STATUS_SUCCESS, MLAN_STATUS_PENDING, - * or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS, MLAN_STATUS_PENDING, + * or MLAN_STATUS_FAILURE */ mlan_status woal_cancel_hs(moal_private * priv, t_u8 wait_option) @@ -2328,8 +2385,8 @@ woal_cancel_hs(moal_private * priv, t_u8 wait_option) #if defined(SDIO_SUSPEND_RESUME) /** @brief This function enables the host sleep * - * @param priv A Pointer to the moal_private structure - * @return MTRUE or MFALSE + * @param priv A Pointer to the moal_private structure + * @return MTRUE or MFALSE */ int woal_enable_hs(moal_private * priv) @@ -2356,6 +2413,7 @@ woal_enable_hs(moal_private * priv) } #if defined(WIFI_DIRECT_SUPPORT) #if defined(STA_CFG80211) && defined(UAP_CFG80211) +#if LINUX_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION if (priv->phandle->is_remain_timer_set) { woal_cancel_timer(&priv->phandle->remain_timer); woal_remain_timer_func(priv->phandle); @@ -2398,6 +2456,7 @@ woal_enable_hs(moal_private * priv) } #endif #endif +#endif #ifdef STA_SUPPORT woal_reconfig_bgscan(priv->phandle); @@ -2464,7 +2523,8 @@ done: * @brief This function send soft_reset command to firmware * * @param handle A pointer to moal_handle structure - * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING on success, otherwise failure code + * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING on success, + * otherwise failure code */ mlan_status woal_request_soft_reset(moal_handle * handle) @@ -2487,8 +2547,7 @@ woal_request_soft_reset(moal_handle * handle) handle->surprise_removed = MTRUE; woal_sched_timeout(5); - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2529,7 +2588,7 @@ woal_set_wapi_enable(moal_private * priv, t_u8 wait_option, t_u32 enable) /* Send IOCTL request to MLAN */ status = woal_request_ioctl(priv, req, wait_option); done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -2538,11 +2597,11 @@ done: /** * @brief Get version * - * @param handle A pointer to moal_handle structure - * @param version A pointer to version buffer - * @param max_len max length of version buffer + * @param handle A pointer to moal_handle structure + * @param version A pointer to version buffer + * @param max_len max length of version buffer * - * @return N/A + * @return N/A */ void woal_get_version(moal_handle * handle, char *version, int max_len) @@ -2665,8 +2724,7 @@ woal_get_driver_verext(moal_private * priv, struct ifreq *ireq) PRINTM(MINFO, "MOAL EXTENDED VERSION: %s\n", info->param.ver_ext.version_str); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -2678,7 +2736,7 @@ done: * @brief Set driver debug bit masks to mlan in order to enhance performance * * @param priv A pointer to moal_private structure - * @param drvdbg Driver debug level + * @param drvdbg Driver debug level * * @return 0 --success, otherwise fail */ @@ -2705,7 +2763,7 @@ woal_set_drvdbg(moal_private * priv, t_u32 drvdbg) ret = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); @@ -2755,7 +2813,7 @@ woal_reg_rx_mgmt_ind(moal_private * priv, t_u16 action, memcpy(pmgmt_subtype_mask, &misc->param.mgmt_subtype_mask, sizeof(misc->param.mgmt_subtype_mask)); - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); @@ -2814,8 +2872,7 @@ woal_set_get_tx_bf_cfg(moal_private * priv, t_u16 action, sizeof(mlan_ds_11n_tx_bf_cfg)); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2823,10 +2880,10 @@ done: /** * @brief Handle ioctl resp * - * @param priv Pointer to moal_private structure - * @param req Pointer to mlan_ioctl_req structure + * @param priv Pointer to moal_private structure + * @param req Pointer to mlan_ioctl_req structure * - * @return N/A + * @return N/A */ void woal_process_ioctl_resp(moal_private * priv, mlan_ioctl_req * req) @@ -2916,7 +2973,7 @@ woal_get_pm_info(moal_private * priv, mlan_ds_ps_info * pm_info) } } done: - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -2958,9 +3015,7 @@ woal_get_deep_sleep(moal_private * priv, t_u32 * data) *(data + 1) = pm->param.auto_deep_sleep.idletime; done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -2998,9 +3053,8 @@ woal_set_deep_sleep(moal_private * priv, t_u8 wait_option, BOOLEAN bdeep_sleep, if (bdeep_sleep == MTRUE) { PRINTM(MIOCTL, "Deep Sleep: sleep\n"); pm->param.auto_deep_sleep.auto_ds = DEEP_SLEEP_ON; - if (idletime) { + if (idletime) pm->param.auto_deep_sleep.idletime = idletime; - } ret = woal_request_ioctl(priv, req, wait_option); if (ret != MLAN_STATUS_SUCCESS && ret != MLAN_STATUS_PENDING) { ret = -EFAULT; @@ -3016,9 +3070,8 @@ woal_set_deep_sleep(moal_private * priv, t_u8 wait_option, BOOLEAN bdeep_sleep, } } done: - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); - LEAVE(); return ret; } @@ -3038,9 +3091,8 @@ woal_cancel_cac_block(moal_private * priv) if (priv->phandle->cac_period == MTRUE) { priv->phandle->cac_period = MFALSE; priv->phandle->meas_start_jiffies = 0; - if (priv->phandle->delay_bss_start == MTRUE) { + if (priv->phandle->delay_bss_start == MTRUE) priv->phandle->delay_bss_start = MFALSE; - } if (priv->phandle->meas_wait_q_woken == MFALSE) { priv->phandle->meas_wait_q_woken = MTRUE; wake_up_interruptible(&priv->phandle->meas_wait_q); @@ -3089,9 +3141,7 @@ woal_11h_channel_check_ioctl(moal_private * priv) priv->phandle->meas_start_jiffies = jiffies; done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -3100,11 +3150,11 @@ done: /** * @brief set/get wifi direct mode * - * @param priv A pointer to moal_private structure - * @param action set or get - * @param mode A pointer to wifi direct mode + * @param priv A pointer to moal_private structure + * @param action set or get + * @param mode A pointer to wifi direct mode * - * @return MLAN_STATUS_SUCCESS -- success, otherwise fail + * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ mlan_status woal_wifi_direct_mode_cfg(moal_private * priv, t_u16 action, t_u16 * mode) @@ -3132,8 +3182,7 @@ woal_wifi_direct_mode_cfg(moal_private * priv, t_u16 action, t_u16 * mode) PRINTM(MIOCTL, "ACT=%d, wifi_direct_mode=%d\n", action, *mode); } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -3141,11 +3190,11 @@ done: /** * @brief set remain channel * - * @param priv A pointer to moal_private structure + * @param priv A pointer to moal_private structure * @param wait_option Wait option - * @param pchan A pointer to mlan_ds_remain_chan structure + * @param pchan A pointer to mlan_ds_remain_chan structure * - * @return MLAN_STATUS_SUCCESS -- success, otherwise fail + * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ mlan_status woal_set_remain_channel_ioctl(moal_private * priv, t_u8 wait_option, @@ -3174,7 +3223,7 @@ woal_set_remain_channel_ioctl(moal_private * priv, t_u8 wait_option, sizeof(mlan_ds_remain_chan)); } done: - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -3221,7 +3270,7 @@ woal_p2p_config(moal_private * priv, t_u32 action, sizeof(mlan_ds_wifi_direct_config)); } done: - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -3280,7 +3329,7 @@ woal_get_signal_info(moal_private * priv, t_u8 wait_option, #endif } done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -3330,7 +3379,7 @@ woal_get_scan_table(moal_private * priv, t_u8 wait_option, } done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -3399,7 +3448,7 @@ woal_request_scan(moal_private * priv, goto done; } done: - if ((ioctl_req) && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(ioctl_req); if (ret == MLAN_STATUS_FAILURE) { @@ -3413,10 +3462,10 @@ done: /** * @brief Change Adhoc Channel * - * @param priv A pointer to moal_private structure - * @param channel The channel to be set. + * @param priv A pointer to moal_private structure + * @param channel The channel to be set. * - * @return MLAN_STATUS_SUCCESS--success, MLAN_STATUS_FAILURE--fail + * @return MLAN_STATUS_SUCCESS--success, MLAN_STATUS_FAILURE--fail */ mlan_status woal_change_adhoc_chan(moal_private * priv, int channel) @@ -3502,8 +3551,7 @@ woal_change_adhoc_chan(moal_private * priv, int channel) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -3511,9 +3559,9 @@ done: /** * @brief Find the best network to associate * - * @param priv A pointer to moal_private structure - * @param wait_option Wait option - * @param ssid_bssid A pointer to mlan_ssid_bssid structure + * @param priv A pointer to moal_private structure + * @param wait_option Wait option + * @param ssid_bssid A pointer to mlan_ssid_bssid structure * * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, otherwise fail */ @@ -3560,8 +3608,7 @@ woal_find_best_network(moal_private * priv, t_u8 wait_option, } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -3569,9 +3616,9 @@ done: /** * @brief Get authentication mode * - * @param priv A pointer to moal_private structure - * @param wait_option Wait option - * @param auth_mode A pointer to authentication mode + * @param priv A pointer to moal_private structure + * @param wait_option Wait option + * @param auth_mode A pointer to authentication mode * * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, otherwise fail */ @@ -3599,11 +3646,10 @@ woal_get_auth_mode(moal_private * priv, t_u8 wait_option, t_u32 * auth_mode) /* Send IOCTL request to MLAN */ status = woal_request_ioctl(priv, req, wait_option); - if (status == MLAN_STATUS_SUCCESS && auth_mode) { + if (status == MLAN_STATUS_SUCCESS && auth_mode) *auth_mode = sec->param.auth_mode; - } done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -3644,11 +3690,10 @@ woal_get_encrypt_mode(moal_private * priv, t_u8 wait_option, /* Send IOCTL request to MLAN */ status = woal_request_ioctl(priv, req, wait_option); - if (status == MLAN_STATUS_SUCCESS && encrypt_mode) { + if (status == MLAN_STATUS_SUCCESS && encrypt_mode) *encrypt_mode = sec->param.encrypt_mode; - } done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -3657,9 +3702,9 @@ done: /** * @brief Get WPA enable * - * @param priv A pointer to moal_private structure - * @param wait_option Wait option - * @param enable A pointer to wpa enable status + * @param priv A pointer to moal_private structure + * @param wait_option Wait option + * @param enable A pointer to wpa enable status * * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, otherwise fail */ @@ -3688,11 +3733,10 @@ woal_get_wpa_enable(moal_private * priv, t_u8 wait_option, t_u32 * enable) /* Send IOCTL request to MLAN */ status = woal_request_ioctl(priv, req, wait_option); - if (status == MLAN_STATUS_SUCCESS && enable) { + if (status == MLAN_STATUS_SUCCESS && enable) *enable = sec->param.wpa_enabled; - } done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -3701,9 +3745,9 @@ done: /** * @brief Set authentication mode * - * @param priv A pointer to moal_private structure - * @param wait_option Wait option - * @param auth_mode Authentication mode + * @param priv A pointer to moal_private structure + * @param wait_option Wait option + * @param auth_mode Authentication mode * * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, otherwise fail */ @@ -3733,7 +3777,7 @@ woal_set_auth_mode(moal_private * priv, t_u8 wait_option, t_u32 auth_mode) /* Send IOCTL request to MLAN */ status = woal_request_ioctl(priv, req, wait_option); done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -3774,7 +3818,7 @@ woal_set_encrypt_mode(moal_private * priv, t_u8 wait_option, t_u32 encrypt_mode) /* Send IOCTL request to MLAN */ status = woal_request_ioctl(priv, req, wait_option); done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -3815,7 +3859,7 @@ woal_set_wpa_enable(moal_private * priv, t_u8 wait_option, t_u32 enable) /* Send IOCTL request to MLAN */ status = woal_request_ioctl(priv, req, wait_option); done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -3857,7 +3901,7 @@ woal_enable_wep_key(moal_private * priv, t_u8 wait_option) /* Send IOCTL request to MLAN */ status = woal_request_ioctl(priv, req, wait_option); done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -3913,7 +3957,7 @@ woal_request_userscan(moal_private * priv, } done: - if ((ioctl_req) && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(ioctl_req); if (ret == MLAN_STATUS_FAILURE) { @@ -3930,7 +3974,6 @@ done: * @param priv A pointer to moal_private structure * @param scan_cfg A pointer to scan_cfg structure * - * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ mlan_status @@ -3962,8 +4005,7 @@ woal_get_scan_config(moal_private * priv, mlan_scan_cfg * scan_cfg) ret = MLAN_STATUS_FAILURE; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -4015,8 +4057,7 @@ woal_set_scan_time(moal_private * priv, t_u16 active_scan_time, woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT)) ret = MLAN_STATUS_FAILURE; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -4096,6 +4137,9 @@ woal_cancel_scan(moal_private * priv, t_u8 wait_option) spin_lock(&handle->priv[i]->scan_req_lock); if (IS_STA_CFG80211(cfg80211_wext) && handle->priv[i]->scan_request) { + PRINTM(MINFO, "Reporting scan results\n"); + woal_inform_bss_from_scan_result(priv, NULL, + wait_option); /** some supplicant can not handle SCAN abort event */ cfg80211_scan_done(handle->priv[i]->scan_request, MFALSE); @@ -4105,8 +4149,7 @@ woal_cancel_scan(moal_private * priv, t_u8 wait_option) } #endif done: - if (req) - kfree(req); + kfree(req); return ret; } @@ -4184,9 +4227,8 @@ woal_request_bgscan(moal_private * priv, goto done; } done: - if ((ioctl_req) && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(ioctl_req); - LEAVE(); return ret; } @@ -4254,6 +4296,13 @@ woal_set_bg_scan(moal_private * priv, char *buf, int length) buf_left -= 2; break; case WEXT_BGSCAN_INTERVAL_SECTION: + if (buf_left < 3) { + PRINTM(MERROR, + "Invalid scan_interval, buf_left=%d\n", + buf_left); + buf_left = 0; + break; + } priv->scan_cfg.scan_interval = (ptr[2] << 8 | ptr[1]) * 1000; PRINTM(MIOCTL, "BG scan: scan_interval=%d\n", @@ -4407,7 +4456,7 @@ woal_reconfig_bgscan(moal_handle * handle) * @brief set rssi low threshold * * @param priv A pointer to moal_private structure - * @param rssi A pointer to low rssi + * @param rssi A pointer to low rssi * @param wait_option Wait option * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail @@ -4453,7 +4502,7 @@ woal_set_rssi_low_threshold(moal_private * priv, char *rssi, t_u8 wait_option) goto done; } done: - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -4464,8 +4513,8 @@ done: * @brief set rssi low threshold * * @param priv A pointer to moal_private structure - * @param event_id event id. - * @param wait_option wait option + * @param event_id event id. + * @param wait_option wait option * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ @@ -4520,7 +4569,7 @@ woal_set_rssi_threshold(moal_private * priv, t_u32 event_id, t_u8 wait_option) misc->param.subscribe_event.evt_action); ret = woal_request_ioctl(priv, req, wait_option); done: - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -4600,8 +4649,52 @@ woal_set_scan_type(moal_private * priv, t_u32 scan_type) woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT)) ret = MLAN_STATUS_FAILURE; done: - if (req) - kfree(req); + kfree(req); + LEAVE(); + return ret; +} + +/** + * @brief enable/disable ext_scan + * + * @param priv A pointer to moal_private structure + * @param enable MTRUE -- enable, MFALSE --disable + * + * @return MLAN_STATUS_SUCCESS -- success, otherwise fail + */ +mlan_status +woal_enable_ext_scan(moal_private * priv, t_u8 enable) +{ + mlan_status ret = MLAN_STATUS_SUCCESS; + mlan_ds_scan *scan = NULL; + mlan_ioctl_req *req = NULL; + mlan_scan_cfg scan_cfg; + + ENTER(); + memset(&scan_cfg, 0, sizeof(scan_cfg)); + if (MLAN_STATUS_SUCCESS != woal_get_scan_config(priv, &scan_cfg)) { + ret = MLAN_STATUS_FAILURE; + goto done; + } + + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_scan)); + if (req == NULL) { + ret = MLAN_STATUS_FAILURE; + goto done; + } + scan = (mlan_ds_scan *) req->pbuf; + scan->sub_command = MLAN_OID_SCAN_CONFIG; + req->req_id = MLAN_IOCTL_SCAN; + req->action = MLAN_ACT_SET; + memset(&scan->param.scan_cfg, 0, sizeof(mlan_scan_cfg)); + scan_cfg.ext_scan = enable; + PRINTM(MIOCTL, "Set ext_scan=%d\n", (int)enable); + memcpy(&scan->param.scan_cfg, &scan_cfg, sizeof(mlan_scan_cfg)); + if (MLAN_STATUS_SUCCESS != + woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT)) + ret = MLAN_STATUS_FAILURE; +done: + kfree(req); LEAVE(); return ret; } @@ -4815,9 +4908,7 @@ woal_get_band(moal_private * priv, int *band) if (support_band == WIFI_FREQUENCY_ALL_BAND) *band = WIFI_FREQUENCY_BAND_AUTO; done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -4825,10 +4916,10 @@ done: /** * @brief set band * - * @param priv A pointer to moal_private structure + * @param priv A pointer to moal_private structure * @param pband A pointer to band string. * - * @return MLAN_STATUS_SUCCESS -- success, otherwise fail + * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ mlan_status woal_set_band(moal_private * priv, char *pband) @@ -4913,8 +5004,7 @@ woal_set_band(moal_private * priv, char *pband) goto done; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5038,8 +5128,7 @@ woal_priv_qos_cfg(moal_private * priv, t_u32 action, char *qos_cfg) if (action == MLAN_ACT_GET) *qos_cfg = cfg->param.qos_cfg; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5092,8 +5181,7 @@ woal_set_sleeppd(moal_private * priv, char *psleeppd) goto done; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5101,11 +5189,11 @@ done: /** * @brief Set scan period function * - * @param priv A pointer to moal_private structure - * @param buf A pointer to scan command buf - * @param length buf length + * @param priv A pointer to moal_private structure + * @param buf A pointer to scan command buf + * @param length buf length * - * @return MLAN_STATUS_SUCCESS -- success, otherwise fail + * @return MLAN_STATUS_SUCCESS -- success, otherwise fail */ int woal_set_scan_cfg(moal_private * priv, char *buf, int length) @@ -5163,14 +5251,12 @@ woal_set_scan_cfg(moal_private * priv, char *buf, int length) } if (active_scan_time || passive_scan_time || specific_scan_time) { - PRINTM(MIOCTL, "Set active_scan_time= %d passive_scan_time=%d " - "specific_scan_time=%d\n", active_scan_time, - passive_scan_time, specific_scan_time); - if (MLAN_STATUS_FAILURE == woal_set_scan_time(priv, - active_scan_time, - passive_scan_time, - specific_scan_time)) - { + PRINTM(MIOCTL, + "Set active_scan_time= %d passive_scan_time=%d specific_scan_time=%d\n", + active_scan_time, passive_scan_time, specific_scan_time); + if (MLAN_STATUS_FAILURE == + woal_set_scan_time(priv, active_scan_time, + passive_scan_time, specific_scan_time)) { ret = -EFAULT; } } @@ -5214,10 +5300,54 @@ woal_set_radio(moal_private * priv, t_u8 option) goto done; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } #endif /* STA_SUPPORT */ + +/** + * @brief Set/Get configure multi-channel policy + * + * @param priv A pointer to moal_private structure + * @param enable A pointer to enable + * @param wait_option wait_option of ioctl + * @param action action of ioctl + * + * @return MLAN_STATUS_SUCCESS -- success, otherwise fail + */ +mlan_status +woal_mc_policy_cfg(moal_private * priv, t_u16 * enable, + t_u8 wait_option, t_u8 action) +{ + mlan_ioctl_req *req = NULL; + mlan_ds_misc_cfg *cfg = NULL; + mlan_status status = MLAN_STATUS_SUCCESS; + + ENTER(); + + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (req == NULL) { + status = MLAN_STATUS_FAILURE; + goto done; + } + + cfg = (mlan_ds_misc_cfg *) req->pbuf; + cfg->sub_command = MLAN_OID_MISC_MULTI_CHAN_POLICY; + req->req_id = MLAN_IOCTL_MISC_CFG; + req->action = action; + if (MLAN_ACT_SET == action) + cfg->param.multi_chan_policy = *enable; + status = woal_request_ioctl(priv, req, wait_option); + if (status != MLAN_STATUS_SUCCESS) + goto done; + if (MLAN_ACT_GET == action) + *enable = cfg->param.multi_chan_policy; + +done: + if (wait_option && status != MLAN_STATUS_PENDING) + kfree(req); + LEAVE(); + return status; +} diff --git a/drivers/net/wireless/sd8897/mlinux/moal_main.c b/drivers/net/wireless/sd8897/mlinux/moal_main.c index 8edef210e5a0..35f4c3fa5f0d 100644 --- a/drivers/net/wireless/sd8897/mlinux/moal_main.c +++ b/drivers/net/wireless/sd8897/mlinux/moal_main.c @@ -47,6 +47,10 @@ Change log: #include <linux/wlan_plat.h> #include "moal_eth_ioctl.h" +#include <linux/if_ether.h> +#include <linux/in.h> +#include <linux/tcp.h> +#include <net/tcp.h> #include <net/dsfield.h> /******************************************************** @@ -118,6 +122,8 @@ int max_vir_bss = DEF_VIRTUAL_BSS; #ifdef SDIO_SUSPEND_RESUME /** PM keep power */ int pm_keep_power = 1; +/** HS when shutdown */ +int shutdown_hs; #endif #if defined(STA_SUPPORT) @@ -162,6 +168,12 @@ int rx_work; int hw_test; +#if defined(WIFI_DIRECT_SUPPORT) +#if LINUX_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION +int p2p_enh; +#endif +#endif + /** woal_callbacks */ static mlan_callbacks woal_callbacks = { .moal_get_fw_data = moal_get_fw_data, @@ -202,7 +214,6 @@ static mlan_callbacks woal_callbacks = { .moal_tcp_ack_tx_ind = moal_tcp_ack_tx_ind, }; -/** Default Driver mode */ #if defined(STA_SUPPORT) && defined(UAP_SUPPORT) #if defined(WIFI_DIRECT_SUPPORT) int drv_mode = (DRV_MODE_STA | DRV_MODE_UAP | DRV_MODE_WIFIDIRECT); @@ -370,9 +381,8 @@ woal_ssid_valid(mlan_802_11_ssid * pssid) /** * @brief GO timeout function * - * - * @param context A pointer to context - * @return N/A + * @param context A pointer to context + * @return N/A */ void woal_go_timer_func(void *context) @@ -391,9 +401,8 @@ woal_go_timer_func(void *context) /** * @brief Remain on Channel timeout function * - * - * @param context A pointer to context - * @return N/A + * @param context A pointer to context + * @return N/A */ void woal_remain_timer_func(void *context) @@ -429,8 +438,8 @@ woal_remain_timer_func(void *context) /** * @brief check if we already connect to the AP. - * @param priv A pointer to moal_private structure - * @param ssid_bssid A pointer to mlan_ssid_bssid structure + * @param priv A pointer to moal_private structure + * @param ssid_bssid A pointer to mlan_ssid_bssid structure * * @return MTRUE/MFALSE; */ @@ -563,7 +572,7 @@ woal_get_mode(moal_private * priv, t_u8 wait_option) } } done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return mode; @@ -723,10 +732,8 @@ woal_update_drv_tbl(moal_handle * handle, int drv_mode_local) #endif #endif /* Clear existing table, if any */ - if (handle->drv_mode.bss_attr != NULL) { - kfree(handle->drv_mode.bss_attr); - handle->drv_mode.bss_attr = NULL; - } + kfree(handle->drv_mode.bss_attr); + handle->drv_mode.bss_attr = NULL; /* Create moal_drv_mode entry */ handle->drv_mode.drv_mode = drv_mode; @@ -754,9 +761,9 @@ done: /** * @brief This function initializes software * - * @param handle A pointer to moal_handle structure + * @param handle A pointer to moal_handle structure * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status woal_init_sw(moal_handle * handle) @@ -773,7 +780,7 @@ woal_init_sw(moal_handle * handle) handle->main_state = MOAL_STATE_IDLE; #ifdef STA_SUPPORT - if (MTRUE + if ((drv_mode & DRV_MODE_STA) #ifdef STA_WEXT && !IS_STA_WEXT(cfg80211_wext) #endif @@ -788,6 +795,16 @@ woal_init_sw(moal_handle * handle) } #endif /* STA_SUPPORT */ +#if defined(STA_CFG80211) && defined(STA_SUPPORT) + if (IS_STA_CFG80211(cfg80211_wext)) + cfg80211_wext |= STA_CFG80211_MASK | UAP_CFG80211_MASK; +#endif + +#if defined(UAP_CFG80211) && defined(UAP_SUPPORT) + if (IS_UAP_CFG80211(cfg80211_wext)) + cfg80211_wext |= STA_CFG80211_MASK | UAP_CFG80211_MASK; +#endif + memcpy(handle->driver_version, driver_version, strlen(driver_version)); if (woal_update_drv_tbl(handle, drv_mode) != MLAN_STATUS_SUCCESS) { @@ -946,7 +963,7 @@ woal_init_sw(moal_handle * handle) * * @param handle A pointer to moal_handle structure * - * @return N/A + * @return N/A */ static void woal_free_moal_handle(moal_handle * handle) @@ -979,10 +996,8 @@ woal_free_moal_handle(moal_handle * handle) mlan_unregister(handle->pmlan_adapter); /* Free BSS attribute table */ - if (handle->drv_mode.bss_attr != NULL) { - kfree(handle->drv_mode.bss_attr); - handle->drv_mode.bss_attr = NULL; - } + kfree(handle->drv_mode.bss_attr); + handle->drv_mode.bss_attr = NULL; PRINTM(MINFO, "Free Adapter\n"); if (atomic_read(&handle->lock_count) || atomic_read(&handle->malloc_count) || @@ -994,8 +1009,7 @@ woal_free_moal_handle(moal_handle * handle) atomic_read(&handle->mbufalloc_count)); } /* Free allocated memory for fwdump filename */ - if (handle->fwdump_fname) - kfree(handle->fwdump_fname); + kfree(handle->fwdump_fname); /* Free the moal handle itself */ kfree(handle); LEAVE(); @@ -1066,15 +1080,12 @@ woal_process_regrdwr(moal_handle * handle, t_u8 * type_string, goto done; } - if (MLAN_STATUS_SUCCESS != woal_atoi(&type, type_string)) { + if (MLAN_STATUS_SUCCESS != woal_atoi(&type, type_string)) goto done; - } - if (MLAN_STATUS_SUCCESS != woal_atoi(&offset, offset_string)) { + if (MLAN_STATUS_SUCCESS != woal_atoi(&offset, offset_string)) goto done; - } - if (MLAN_STATUS_SUCCESS != woal_atoi(&value, value_string)) { + if (MLAN_STATUS_SUCCESS != woal_atoi(&value, value_string)) goto done; - } ioctl_req->req_id = MLAN_IOCTL_REG_MEM; ioctl_req->action = MLAN_ACT_SET; @@ -1092,16 +1103,14 @@ woal_process_regrdwr(moal_handle * handle, t_u8 * type_string, /* request ioctl for STA */ if (MLAN_STATUS_SUCCESS != - woal_request_ioctl(handle->priv[0], ioctl_req, MOAL_IOCTL_WAIT)) { + woal_request_ioctl(handle->priv[0], ioctl_req, MOAL_IOCTL_WAIT)) goto done; - } PRINTM(MINFO, "Register type: %d, offset: 0x%x, value: 0x%x\n", type, offset, value); ret = MLAN_STATUS_SUCCESS; done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -1271,9 +1280,8 @@ woal_process_init_cfg(moal_handle * handle, t_u8 * data, t_size size) } } - if (index == 0) { + if (index == 0) PRINTM(MINFO, "Can't find any matching MAC Address"); - } ret = MLAN_STATUS_SUCCESS; done: @@ -1345,11 +1353,10 @@ woal_process_hostcmd_cfg(moal_handle * handle, t_u8 * data, t_size size) if (start_raw == MFALSE) { intf_s = strchr(pos, '='); - if (intf_s) { + if (intf_s) intf_e = strchr(intf_s, '{'); - } else { + else intf_e = NULL; - } if (intf_s && intf_e) { start_raw = MTRUE; @@ -1373,8 +1380,7 @@ woal_process_hostcmd_cfg(moal_handle * handle, t_u8 * data, t_size size) } done: - if (buf) - kfree(buf); + kfree(buf); LEAVE(); return ret; } @@ -1382,6 +1388,7 @@ done: #define INIT_CFG_DATA 0x00 #define TXPWRLIMIT_CFG_DATA 0x01 #define INIT_HOSTCMD_CFG_DATA 0x02 +#define COUNTRY_POWER_TABLE 0x04 /** * @brief WOAL set user defined init data and param @@ -1414,6 +1421,20 @@ woal_set_user_init_data(moal_handle * handle, int type) "Init config file request_firmware() failed\n"); goto done; } + } else if (type == COUNTRY_POWER_TABLE) { + int status = + request_firmware(&handle->user_data, txpwrlimit_cfg, + handle->hotplug_device); + /* File does not exist, skip download */ + if (status == -ENOENT) { + PRINTM(MIOCTL, + "Country power table file does not exist\n"); + ret = MLAN_STATUS_SUCCESS; + } else if (status) { + PRINTM(MERROR, + "Init config file request_firmware() failed\n"); + goto done; + } } else if (type == INIT_HOSTCMD_CFG_DATA) { if ((request_firmware (&handle->user_data, init_hostcmd_cfg, @@ -1435,7 +1456,8 @@ woal_set_user_init_data(moal_handle * handle, int type) goto done; } } else if (type == TXPWRLIMIT_CFG_DATA || - type == INIT_HOSTCMD_CFG_DATA) { + type == INIT_HOSTCMD_CFG_DATA || + type == COUNTRY_POWER_TABLE) { if (MLAN_STATUS_SUCCESS != woal_process_hostcmd_cfg(handle, cfg_data, len)) { PRINTM(MERROR, @@ -1598,9 +1620,9 @@ woal_init_fw_dpc(moal_handle * handle) #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 32) sdio_release_host(((struct sdio_mmc_card *)handle->card)->func); #endif - if (ret == MLAN_STATUS_FAILURE) { + if (ret == MLAN_STATUS_FAILURE) goto done; - } else if (ret == MLAN_STATUS_SUCCESS) { + else if (ret == MLAN_STATUS_SUCCESS) { handle->hardware_status = HardwareStatusReady; goto done; } @@ -1685,7 +1707,7 @@ done: * @param firmware A pointer to firmware image * @param context A pointer to moal_handle structure * - * @return N/A + * @return N/A */ static void woal_request_fw_callback(const struct firmware *firmware, void *context) @@ -1712,33 +1734,9 @@ woal_request_fw(moal_handle * handle) { mlan_status ret = MLAN_STATUS_SUCCESS; int err; - t_u32 revision_id = 0; ENTER(); - if (!fw_name) { -/** Revision ID register */ -#define REV_ID_REG 0xbc -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 32) - sdio_claim_host(((struct sdio_mmc_card *)handle->card)->func); -#endif - woal_read_reg(handle, REV_ID_REG, &revision_id); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 32) - sdio_release_host(((struct sdio_mmc_card *)handle->card)->func); -#endif - /* Check revision ID */ - switch (revision_id) { - case SD8897_A0: - handle->drv_mode.fw_name = SD8897_A0_FW_NAME; - break; - case SD8897_B0: - handle->drv_mode.fw_name = SD8897_B0_FW_NAME; - break; - default: - break; - } - } - if (req_fw_nowait) { #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32) err = request_firmware_nowait(THIS_MODULE, FW_ACTION_HOTPLUG, @@ -1787,9 +1785,9 @@ woal_request_fw(moal_handle * handle) /** * @brief This function initializes firmware * - * @param handle A pointer to moal_handle structure + * @param handle A pointer to moal_handle structure * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status woal_init_fw(moal_handle * handle) @@ -1799,12 +1797,14 @@ woal_init_fw(moal_handle * handle) ENTER(); do_gettimeofday(&handle->req_fw_time); + ret = woal_request_fw(handle); if (ret < 0) { PRINTM(MFATAL, "woal_request_fw failed\n"); ret = MLAN_STATUS_FAILURE; goto done; } + done: LEAVE(); return ret; @@ -1907,12 +1907,12 @@ const struct net_device_ops woal_netdev_ops = { /** * @brief This function initializes the private structure - * and dev structure for station mode + * and dev structure for station mode * - * @param dev A pointer to net_device structure - * @param priv A pointer to moal_private structure + * @param dev A pointer to net_device structure + * @param priv A pointer to moal_private structure * - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ mlan_status woal_init_sta_dev(struct net_device *dev, moal_private * priv) @@ -1984,12 +1984,12 @@ const struct net_device_ops woal_uap_netdev_ops = { /** * @brief This function initializes the private structure - * and dev structure for uap mode + * and dev structure for uap mode * - * @param dev A pointer to net_device structure - * @param priv A pointer to moal_private structure + * @param dev A pointer to net_device structure + * @param priv A pointer to moal_private structure * - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ mlan_status woal_init_uap_dev(struct net_device *dev, moal_private * priv) @@ -2043,7 +2043,7 @@ woal_init_uap_dev(struct net_device *dev, moal_private * priv) /** * @brief This function adds a new interface. It will - * allocate, initialize and register the device. + * allocate, initialize and register the device. * * @param handle A pointer to moal_handle structure * @param bss_index BSS index number @@ -2074,11 +2074,10 @@ woal_add_interface(moal_handle * handle, t_u8 bss_index, t_u8 bss_type) /* Allocate device name */ #ifdef STA_SUPPORT memset(name, 0, sizeof(name)); - if (sta_name) { + if (sta_name) snprintf(name, sizeof(name), "%s%%d", sta_name); - } else { + else sprintf(name, "mlan%%d"); - } if ((bss_type == MLAN_BSS_TYPE_STA) && (dev_alloc_name(dev, name) < 0)) { PRINTM(MERROR, "Could not allocate mlan device name\n"); goto error; @@ -2086,11 +2085,10 @@ woal_add_interface(moal_handle * handle, t_u8 bss_index, t_u8 bss_type) #endif #ifdef UAP_SUPPORT memset(name, 0, sizeof(name)); - if (uap_name) { + if (uap_name) snprintf(name, sizeof(name), "%s%%d", uap_name); - } else { + else sprintf(name, "uap%%d"); - } if ((bss_type == MLAN_BSS_TYPE_UAP) && (dev_alloc_name(dev, name) < 0)) { PRINTM(MERROR, "Could not allocate uap device name\n"); goto error; @@ -2098,11 +2096,10 @@ woal_add_interface(moal_handle * handle, t_u8 bss_index, t_u8 bss_type) #endif #if defined(WIFI_DIRECT_SUPPORT) memset(name, 0, sizeof(name)); - if (wfd_name) { + if (wfd_name) snprintf(name, sizeof(name), "%s%%d", wfd_name); - } else { + else sprintf(name, "wfd%%d"); - } if ((bss_type == MLAN_BSS_TYPE_WIFIDIRECT) && (dev_alloc_name(dev, name) < 0)) { PRINTM(MERROR, "Could not allocate wifidirect device name\n"); @@ -2248,9 +2245,8 @@ error: #if defined(STA_CFG80211) || defined(UAP_CFG80211) /* Unregister wiphy device and free */ if (priv) { - if (priv->wdev && IS_STA_OR_UAP_CFG80211(cfg80211_wext)) { + if (priv->wdev && IS_STA_OR_UAP_CFG80211(cfg80211_wext)) priv->wdev = NULL; - } } #endif if (dev && dev->reg_state == NETREG_REGISTERED) @@ -2264,10 +2260,10 @@ error: /** * @brief This function removes an interface. * - * @param handle A pointer to the moal_handle structure - * @param bss_index BSS index number + * @param handle A pointer to the moal_handle structure + * @param bss_index BSS index number * - * @return N/A + * @return N/A */ void woal_remove_interface(moal_handle * handle, t_u8 bss_index) @@ -2318,9 +2314,8 @@ woal_remove_interface(moal_handle * handle, t_u8 bss_index) #if defined(STA_CFG80211) || defined(UAP_CFG80211) /* Unregister wiphy device and free */ - if (priv->wdev && IS_STA_OR_UAP_CFG80211(cfg80211_wext)) { + if (priv->wdev && IS_STA_OR_UAP_CFG80211(cfg80211_wext)) priv->wdev = NULL; - } #endif /* Clear the priv in handle */ @@ -2336,10 +2331,11 @@ error: /** * @brief Send FW shutdown command to MLAN * - * @param priv A pointer to moal_private structure - * @param wait_option Wait option + * @param priv A pointer to moal_private structure + * @param wait_option Wait option * - * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, otherwise fail + * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, + * otherwise fail */ static mlan_status woal_shutdown_fw(moal_private * priv, t_u8 wait_option) @@ -2370,8 +2366,7 @@ woal_shutdown_fw(moal_private * priv, t_u8 wait_option) /* add 100 ms delay to avoid back to back init/shutdown */ mdelay(100); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return status; } @@ -2379,9 +2374,9 @@ done: /** * @brief Return hex value of a give character * - * @param chr Character to be converted + * @param chr Character to be converted * - * @return The converted character if chr is a valid hex, else 0 + * @return The converted character if chr is a valid hex, else 0 */ static int woal_hexval(char chr) @@ -2439,10 +2434,9 @@ static int wifi_set_carddetect(int on) { ENTER(); - PRINTM(MMSG, "%s = %d\n", __FUNCTION__, on); - if (wifi_control_data && wifi_control_data->set_carddetect) { + PRINTM(MMSG, "%s = %d\n", __func__, on); + if (wifi_control_data && wifi_control_data->set_carddetect) wifi_control_data->set_carddetect(on); - } LEAVE(); return 0; } @@ -2460,10 +2454,9 @@ static int wifi_set_power(int on, unsigned long msec) { ENTER(); - PRINTM(MMSG, "%s = %d\n", __FUNCTION__, on); - if (wifi_control_data && wifi_control_data->set_power) { + PRINTM(MMSG, "%s = %d\n", __func__, on); + if (wifi_control_data && wifi_control_data->set_power) wifi_control_data->set_power(on); - } if (msec) mdelay(msec); LEAVE(); @@ -2649,11 +2642,13 @@ woal_open(struct net_device *dev) #if defined(WIFI_DIRECT_SUPPORT) #if defined(STA_CFG80211) && defined(UAP_CFG80211) #if LINUX_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION - if (priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT && - IS_STA_CFG80211(cfg80211_wext)) { - priv->phandle->wiphy->interface_modes |= - MBIT(NL80211_IFTYPE_P2P_GO) | - MBIT(NL80211_IFTYPE_P2P_CLIENT); + if (!p2p_enh) { + if (priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT && + IS_STA_CFG80211(cfg80211_wext)) { + priv->phandle->wiphy->interface_modes |= + MBIT(NL80211_IFTYPE_P2P_GO) | + MBIT(NL80211_IFTYPE_P2P_CLIENT); + } } #endif #endif @@ -2711,11 +2706,15 @@ woal_close(struct net_device *dev) #if defined(WIFI_DIRECT_SUPPORT) #if defined(STA_CFG80211) && defined(UAP_CFG80211) #if LINUX_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION - if (priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT && !priv->bss_virtual && - IS_STA_CFG80211(cfg80211_wext) && IS_UAP_CFG80211(cfg80211_wext)) { - priv->phandle->wiphy->interface_modes &= - ~(MBIT(NL80211_IFTYPE_P2P_GO) | - MBIT(NL80211_IFTYPE_P2P_CLIENT)); + if (!p2p_enh) { + if (priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT && + !priv->bss_virtual && + IS_STA_CFG80211(cfg80211_wext) && + IS_UAP_CFG80211(cfg80211_wext)) { + priv->phandle->wiphy->interface_modes &= + ~(MBIT(NL80211_IFTYPE_P2P_GO) | + MBIT(NL80211_IFTYPE_P2P_CLIENT)); + } } #endif #endif @@ -2779,9 +2778,9 @@ done: /** * @brief Check driver status * - * @param handle A pointer to moal_handle + * @param handle A pointer to moal_handle * - * @return MTRUE/MFALSE + * @return MTRUE/MFALSE */ t_u8 woal_check_driver_status(moal_handle * handle) @@ -2810,7 +2809,7 @@ woal_check_driver_status(moal_handle * handle) } if (info.num_cmd_timeout) { PRINTM(MERROR, "num_cmd_timeout = %d\n", info.num_cmd_timeout); - PRINTM(MERROR, "Timeout cmd id = 0x%x, act = 0x%x \n", + PRINTM(MERROR, "Timeout cmd id = 0x%x, act = 0x%x\n", info.timeout_cmd_id, info.timeout_cmd_act); LEAVE(); return MTRUE; @@ -2851,7 +2850,7 @@ woal_check_driver_status(moal_handle * handle) * * @param priv A pointer to moal_private * - * @return N/A + * @return N/A */ void woal_mlan_debug_info(moal_private * priv) @@ -2874,29 +2873,26 @@ woal_mlan_debug_info(moal_private * priv) PRINTM(MERROR, "------------mlan_debug_info-------------\n"); PRINTM(MERROR, "mlan_processing =%d\n", info.mlan_processing); PRINTM(MERROR, "mlan_rx_processing =%d\n", info.mlan_rx_processing); + PRINTM(MERROR, "rx_pkts_queued=%d\n", info.rx_pkts_queued); PRINTM(MERROR, "num_cmd_timeout = %d\n", info.num_cmd_timeout); PRINTM(MERROR, "Timeout cmd id = 0x%x, act = 0x%x \n", info.timeout_cmd_id, info.timeout_cmd_act); PRINTM(MERROR, "last_cmd_index = %d\n", info.last_cmd_index); - for (s = str, i = 0; i < DBG_CMD_NUM; i++) { + for (s = str, i = 0; i < DBG_CMD_NUM; i++) s += sprintf(s, "0x%x ", info.last_cmd_id[i]); - } PRINTM(MERROR, "last_cmd_id = %s\n", str); - for (s = str, i = 0; i < DBG_CMD_NUM; i++) { + for (s = str, i = 0; i < DBG_CMD_NUM; i++) s += sprintf(s, "0x%x ", info.last_cmd_act[i]); - } PRINTM(MERROR, "last_cmd_act = %s\n", str); PRINTM(MERROR, "last_cmd_resp_index = %d\n", info.last_cmd_resp_index); - for (s = str, i = 0; i < DBG_CMD_NUM; i++) { + for (s = str, i = 0; i < DBG_CMD_NUM; i++) s += sprintf(s, "0x%x ", info.last_cmd_resp_id[i]); - } PRINTM(MERROR, "last_cmd_resp_id = %s\n", str); PRINTM(MERROR, "last_event_index = %d\n", info.last_event_index); - for (s = str, i = 0; i < DBG_CMD_NUM; i++) { + for (s = str, i = 0; i < DBG_CMD_NUM; i++) s += sprintf(s, "0x%x ", info.last_event[i]); - } PRINTM(MERROR, "last_event = %s", str); PRINTM(MERROR, "num_data_h2c_failure = %d\n", @@ -2966,7 +2962,7 @@ woal_mlan_debug_info(moal_private * priv) /** * @brief This function handles the timeout of packet - * transmission + * transmission * * @param dev A pointer to net_device structure * @@ -3167,13 +3163,13 @@ woal_process_tcp_ack(moal_private * priv, mlan_buffer * pmbuf) if (*((t_u8 *) tcph + 13) == 0x10) { /* Only replace ACK */ - priv->tcp_ack_cnt++; if (ntohs(iph->tot_len) > (iph->ihl + tcph->doff) * 4) { /* Don't drop ACK with payload */ /* TODO: should we delete previous TCP session */ LEAVE(); return ret; } + priv->tcp_ack_cnt++; spin_lock_irqsave(&priv->tcp_sess_lock, flags); tcp_session = woal_get_tcp_sess(priv, iph->saddr, tcph->source, iph->daddr, @@ -3238,7 +3234,6 @@ woal_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) struct sk_buff *new_skb = NULL; #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) t_u32 index = 0; - t_u32 tid = 0; #endif ENTER(); @@ -3296,9 +3291,7 @@ woal_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) case MLAN_STATUS_PENDING: atomic_inc(&priv->phandle->tx_pending); #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) - tid = pmbuf->priority; - index = mlan_select_wmm_queue(priv->phandle->pmlan_adapter, - priv->bss_index, tid); + index = skb_get_queue_mapping(skb); atomic_inc(&priv->wmm_tx_pending[index]); if (atomic_read(&priv->wmm_tx_pending[index]) >= MAX_TX_PENDING) { struct netdev_queue *txq = @@ -3331,11 +3324,11 @@ done: /** * @brief Convert ascii string to Hex integer * - * @param d A pointer to integer buf - * @param s A pointer to ascii string - * @param dlen The byte number of ascii string in hex + * @param d A pointer to integer buf + * @param s A pointer to ascii string + * @param dlen The byte number of ascii string in hex * - * @return Number of integer + * @return Number of integer */ int woal_ascii2hex(t_u8 * d, char *s, t_u32 dlen) @@ -3412,9 +3405,9 @@ woal_atoi(int *data, char *a) /** * @brief Return hex value of a given ascii string * - * @param a String to be converted to ascii + * @param a String to be converted to ascii * - * @return The converted character if a is a valid hex, else 0 + * @return The converted character if a is a valid hex, else 0 */ int woal_atox(char *a) @@ -3432,7 +3425,7 @@ woal_atox(char *a) /** * @brief Extension of strsep lib command. This function will also take care - * escape character + * escape character * * @param s A pointer to array of chars to process * @param delim The delimiter character to end the string @@ -3490,7 +3483,7 @@ woal_strsep(char **s, char delim, char esc) * @param mac_addr The buffer to store the mac address in. * @param buf The source of mac address which is a string. * - * @return N/A + * @return N/A */ void woal_mac2u8(t_u8 * mac_addr, char *buf) @@ -3529,12 +3522,12 @@ woal_set_multicast_list(struct net_device *dev) /** * @brief This function initializes the private structure - * and set default value to the member of moal_private. + * and set default value to the member of moal_private. * * @param priv A pointer to moal_private structure * @param wait_option Wait option * - * @return N/A + * @return N/A */ void woal_init_priv(moal_private * priv, t_u8 wait_option) @@ -3559,9 +3552,8 @@ woal_init_priv(moal_private * priv, t_u8 wait_option) } #endif /* STA_SUPPORT */ #ifdef UAP_SUPPORT - if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) { + if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) priv->bss_started = MFALSE; - } #endif priv->media_connected = MFALSE; @@ -3619,7 +3611,7 @@ woal_init_priv(moal_private * priv, t_u8 wait_option) /** * @brief Reset all interfaces if all_intf flag is TRUE, - * otherwise specified interface only + * otherwise specified interface only * * @param priv A pointer to moal_private structure * @param wait_option Wait option @@ -3785,14 +3777,14 @@ woal_alloc_mlan_buffer(moal_handle * handle, int size) pmbuf = kmalloc(sizeof(mlan_buffer), flag); if (!pmbuf) { - PRINTM(MERROR, "%s: Fail to alloc mlan buffer\n", __FUNCTION__); + PRINTM(MERROR, "%s: Fail to alloc mlan buffer\n", __func__); LEAVE(); return NULL; } memset((t_u8 *) pmbuf, 0, sizeof(mlan_buffer)); skb = __dev_alloc_skb(size, flag); if (!skb) { - PRINTM(MERROR, "%s: No free skb\n", __FUNCTION__); + PRINTM(MERROR, "%s: No free skb\n", __func__); kfree(pmbuf); LEAVE(); return NULL; @@ -3824,8 +3816,7 @@ woal_alloc_mlan_ioctl_req(int size) kmalloc((sizeof(mlan_ioctl_req) + size + sizeof(int) + sizeof(wait_queue)), flag); if (!req) { - PRINTM(MERROR, "%s: Fail to alloc ioctl buffer\n", - __FUNCTION__); + PRINTM(MERROR, "%s: Fail to alloc ioctl buffer\n", __func__); LEAVE(); return NULL; } @@ -3870,10 +3861,10 @@ woal_free_mlan_buffer(moal_handle * handle, pmlan_buffer pmbuf) /** * @brief This function handles events generated by firmware * - * @param priv A pointer to moal_private structure - * @param payload A pointer to payload buffer - * @param len Length of the payload - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @param priv A pointer to moal_private structure + * @param payload A pointer to payload buffer + * @param len Length of the payload + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status woal_broadcast_event(moal_private * priv, t_u8 * payload, t_u32 len) @@ -4218,8 +4209,7 @@ woal_reassociation_thread(void *data) LEAVE(); return MLAN_STATUS_FAILURE; } - if (req) - kfree(req); + kfree(req); } } @@ -4233,7 +4223,7 @@ woal_reassociation_thread(void *data) handle->is_reassoc_timer_set = MTRUE; if (priv && (priv->set_asynced_essid_flag == MTRUE)) { PRINTM(MERROR, - "Set Async ESSID: No AP found or assoc failed. \n"); + "Set Async ESSID: No AP found or assoc failed.\n"); priv->set_asynced_essid_flag = MFALSE; } else { PRINTM(MEVENT, @@ -4259,8 +4249,8 @@ woal_reassociation_thread(void *data) * @brief This function triggers re-association by waking up * re-assoc thread. * - * @param context A pointer to context - * @return N/A + * @param context A pointer to context + * @return N/A */ void woal_reassoc_timer_func(void *context) @@ -4286,7 +4276,7 @@ woal_reassoc_timer_func(void *context) * @brief Sends disconnect event * * @param priv A pointer to moal_private struct - * @return N/A + * @return N/A */ t_void woal_send_disconnect_to_system(moal_private * priv) @@ -4314,8 +4304,9 @@ woal_send_disconnect_to_system(moal_private * priv) if (IS_STA_CFG80211(cfg80211_wext)) { if (!priv->cfg_disconnect && !priv->cfg_connect && priv->wdev && priv->wdev->iftype != NL80211_IFTYPE_ADHOC) { - PRINTM(MMSG, "wlan: Disconnected from " MACSTR ":" - " Reason code %d\n", MAC2STR(priv->cfg_bssid), + PRINTM(MMSG, + "wlan: Disconnected from " MACSTR + ": Reason code %d\n", MAC2STR(priv->cfg_bssid), WLAN_REASON_DEAUTH_LEAVING); /* This function must be called only when disconnect issued by the FW, i.e. disconnected by AP. For IBSS @@ -4343,8 +4334,8 @@ woal_send_disconnect_to_system(moal_private * priv) /** * @brief This function stores the FW dumps received from events in a file * - * @param priv A pointer to moal_private - * @param pmevent A pointer to mlan_event structure + * @param priv A pointer to moal_private + * @param pmevent A pointer to mlan_event structure * * @return N/A */ @@ -4627,6 +4618,7 @@ woal_dump_mlan_drv_info(moal_private * priv, t_u8 * buf) ptr += sprintf(ptr, "mlan_processing =%d\n", info.mlan_processing); ptr += sprintf(ptr, "mlan_rx_processing =%d\n", info.mlan_rx_processing); + ptr += sprintf(ptr, "rx_pkts_queued =%d\n", info.rx_pkts_queued); ptr += sprintf(ptr, "num_cmd_timeout = %d\n", info.num_cmd_timeout); ptr += sprintf(ptr, "Timeout cmd id = 0x%x, act = 0x%x \n", info.timeout_cmd_id, info.timeout_cmd_act); @@ -4772,17 +4764,19 @@ woal_dump_moal_hex(moal_handle * phandle, t_u8 * buf) } ptr += sprintf(ptr, "<--moal_handle-->\n"); - ptr += sprintf(ptr, "moal_handle=%p, size=%d(0x%x)\n", phandle, - sizeof(*phandle), sizeof(*phandle)); + ptr += sprintf(ptr, "moal_handle=%p, size=%ld(0x%lx)\n", phandle, + (long int)sizeof(*phandle), + (long unsigned int)sizeof(*phandle)); ptr += woal_save_hex_dump(ROW_SIZE_16, phandle, sizeof(*phandle), MTRUE, ptr); ptr += sprintf(ptr, "<--moal_handle End-->\n"); for (i = 0; i < phandle->priv_num; i++) { ptr += sprintf(ptr, "<--moal_private(%d)-->\n", i); - ptr += sprintf(ptr, "moal_private=%p, size=%d(0x%x)\n", - phandle->priv[i], sizeof(*(phandle->priv[i])), - sizeof(*(phandle->priv[i]))); + ptr += sprintf(ptr, "moal_private=%p, size=%ld(0x%lx)\n", + phandle->priv[i], + (long int)sizeof(*(phandle->priv[i])), + (long unsigned int)sizeof(*(phandle->priv[i]))); ptr += woal_save_hex_dump(ROW_SIZE_16, phandle->priv[i], sizeof(*(phandle->priv[i])), MTRUE, ptr); @@ -4795,21 +4789,20 @@ woal_dump_moal_hex(moal_handle * phandle, t_u8 * buf) /** * @brief This function dump mlan hex to file * - * @param phandle A pointer to moal_handle + * @param priv A pointer to moal_private structure * @param buf A pointer to buffer * * @return The length of this log */ static int -woal_dump_mlan_hex(moal_handle * phandle, t_u8 * buf) +woal_dump_mlan_hex(moal_private * priv, t_u8 * buf) { char *ptr = (char *)buf; int i; ENTER(); - if (!phandle || !buf || - woal_get_debug_info(phandle->pmlan_adapter, MOAL_CMD_WAIT, &info)) { + if (!buf || !priv || woal_get_debug_info(priv, MOAL_CMD_WAIT, &info)) { PRINTM(MMSG, "%s: can't retreive info\n", __func__); LEAVE(); return 0; @@ -4868,10 +4861,11 @@ woal_dump_drv_info(moal_handle * phandle) (phandle, MLAN_BSS_ROLE_ANY), pos); pos += woal_dump_moal_hex(phandle, pos); - pos += woal_dump_mlan_hex(phandle, pos); + pos += woal_dump_mlan_hex(woal_get_priv(phandle, MLAN_BSS_ROLE_ANY), + pos); - PRINTM(MMSG, "Drv info total bytes = %d (0x%x)\n", pos - drv_buf, - pos - drv_buf); + PRINTM(MMSG, "Drv info total bytes = %ld (0x%lx)\n", + (long int)(pos - drv_buf), (long unsigned int)(pos - drv_buf)); pfile = filp_open("/data/file_drv_info", O_CREAT | O_RDWR, 0644); if (IS_ERR(pfile)) { @@ -4908,13 +4902,12 @@ done: #define DEBUG_DUMP_START_REG 0xE4 #define DEBUG_DUMP_END_REG 0xEA #define ITCM_SIZE 0x10000 -#define SQRAM_SIZE 0x40000 +#define SQRAM_SIZE 0xA0000 #define DTCM_SIZE 0x8000 /** * @brief This function dump firmware memory to file * - * @param phandle A pointer to moal_handle * * @return N/A @@ -5311,6 +5304,70 @@ woal_moal_debug_info(moal_private * priv, moal_handle * handle, u8 flag) } /** + * @brief Download power table to firmware for a specific country + * + * @param priv A pointer to moal_private + * @param country ISO 3166-1 alpha-2 country code + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +mlan_status +woal_request_country_power_table(moal_private * priv, char *country) +{ + mlan_status ret = MLAN_STATUS_SUCCESS; + moal_handle *handle = NULL; + char country_name[] = "txpower_XX.bin"; + char file_path[256]; + char *last_slash = NULL; + + ENTER(); + + if (!priv || !priv->phandle) { + PRINTM(MERROR, "Priv or handle is null\n"); + LEAVE(); + return MLAN_STATUS_FAILURE; + } + + if (!country) { + PRINTM(MERROR, "Country is null\n"); + LEAVE(); + return MLAN_STATUS_FAILURE; + } + + handle = priv->phandle; + + /* Replace XX with ISO 3166-1 alpha-2 country code */ + strncpy(strstr(country_name, "XX"), country, strlen(country)); + + memset(file_path, 0, sizeof(file_path)); + /* file_path should be Null terminated */ + if (fw_name && (strlen(fw_name) < sizeof(file_path))) { + strncpy(file_path, fw_name, strlen(fw_name)); + last_slash = strrchr(file_path, '/'); + if (last_slash) + memset(last_slash + 1, 0, + sizeof(file_path) - 1 - (last_slash - + file_path)); + else + memset(file_path, 0, sizeof(file_path)); + } else { + strncpy(file_path, "mrvl/", sizeof(file_path)); + } + txpwrlimit_cfg = strncat(file_path, country_name, + sizeof(file_path) - strlen(file_path)); + + if (MLAN_STATUS_SUCCESS != + woal_set_user_init_data(handle, COUNTRY_POWER_TABLE)) { + PRINTM(MFATAL, "Download power table to firmware failed\n"); + ret = MLAN_STATUS_FAILURE; + } + + txpwrlimit_cfg = NULL; + LEAVE(); + return ret; +} + +/** * @brief This workqueue function handles rx_process * * @param work A pointer to work_struct @@ -5425,7 +5482,7 @@ woal_interrupt(moal_handle * handle) /** * @brief This function adds the card. it will probe the - * card, allocate the mlan_private and initialize the device. + * card, allocate the mlan_private and initialize the device. * * @param card A pointer to card * @@ -5587,9 +5644,8 @@ woal_add_card(void *card) woal_create_thread(woal_reassociation_thread, &handle->reassoc_thread, "woal_reassoc_service"); - while (!handle->reassoc_thread.pid) { + while (!handle->reassoc_thread.pid) woal_sched_timeout(2); - } #endif /* REASSOCIATION */ /* Register the device. Fill up the private data structure with @@ -5625,20 +5681,17 @@ err_init_fw: err_registerdev: handle->surprise_removed = MTRUE; #ifdef REASSOCIATION - if (handle->reassoc_thread.pid) { + if (handle->reassoc_thread.pid) wake_up_interruptible(&handle->reassoc_thread.wait_q); - } /* waiting for main thread quit */ - while (handle->reassoc_thread.pid) { + while (handle->reassoc_thread.pid) woal_sched_timeout(2); - } #endif /* REASSOCIATION */ woal_terminate_workqueue(handle); err_kmalloc: woal_free_moal_handle(handle); - if (index < MAX_MLAN_ADAPTER) { + if (index < MAX_MLAN_ADAPTER) m_handle[index] = NULL; - } ((struct sdio_mmc_card *)card)->handle = NULL; err_handle: MOAL_REL_SEMAPHORE(&AddRemoveCardSem); @@ -5742,9 +5795,8 @@ woal_remove_card(void *card) wake_up_interruptible(&handle->reassoc_thread.wait_q); /* waiting for main thread quit */ - while (handle->reassoc_thread.pid) { + while (handle->reassoc_thread.pid) woal_sched_timeout(2); - } #endif /* REASSOCIATION */ #ifdef CONFIG_PROC_FS @@ -5774,7 +5826,7 @@ exit_sem_err: /** * @brief This function switch the drv_mode * - * @param handle A pointer to moal_handle structure + * @param handle A pointer to moal_handle structure * @param mode new drv_mode to switch. * * @return MLAN_STATUS_SUCCESS /MLAN_STATUS_FAILURE /MLAN_STATUS_PENDING @@ -5882,9 +5934,8 @@ woal_init_module(void) PRINTM(MMSG, "wlan: Loading MWLAN driver\n"); /* Init the wlan_private pointer array first */ - for (index = 0; index < MAX_MLAN_ADAPTER; index++) { + for (index = 0; index < MAX_MLAN_ADAPTER; index++) m_handle[index] = NULL; - } /* Init mutex */ MOAL_INIT_SEMAPHORE(&AddRemoveCardSem); @@ -6097,6 +6148,9 @@ MODULE_PARM_DESC(max_tx_buf, "Maximum Tx buffer size (2048/4096/8192)"); #ifdef SDIO_SUSPEND_RESUME module_param(pm_keep_power, int, 1); MODULE_PARM_DESC(pm_keep_power, "1: PM keep power; 0: PM no power"); +module_param(shutdown_hs, int, 0); +MODULE_PARM_DESC(shutdown_hs, + "1: Enable HS when shutdown; 0: No HS when shutdown"); #endif #if defined(STA_SUPPORT) module_param(cfg_11d, int, 0); @@ -6138,6 +6192,13 @@ MODULE_PARM_DESC(wq_sched_policy, module_param(rx_work, int, 0); MODULE_PARM_DESC(rx_work, "0: default; 1: Enable rx_work_queue; 2: Disable rx_work_queue"); +#if defined(WIFI_DIRECT_SUPPORT) +#if LINUX_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION +module_param(p2p_enh, int, 0); +MODULE_PARM_DESC(p2p_enh, "1: Enable enhanced P2P; 0: Disable enhanced P2P"); +#endif +#endif + MODULE_DESCRIPTION("M-WLAN Driver"); MODULE_AUTHOR("Marvell International Ltd."); MODULE_VERSION(MLAN_RELEASE_VERSION); diff --git a/drivers/net/wireless/sd8897/mlinux/moal_main.h b/drivers/net/wireless/sd8897/mlinux/moal_main.h index 2cd802645573..eba49e9bd062 100644 --- a/drivers/net/wireless/sd8897/mlinux/moal_main.h +++ b/drivers/net/wireless/sd8897/mlinux/moal_main.h @@ -246,15 +246,15 @@ woal_initialize_timer(pmoal_drv_timer timer, * @brief Modify timer * * @param timer Timer structure - * @param MillisecondPeriod Time period in millisecond + * @param millisecondperiod Time period in millisecond * * @return N/A */ static inline void -woal_mod_timer(pmoal_drv_timer timer, t_u32 MillisecondPeriod) +woal_mod_timer(pmoal_drv_timer timer, t_u32 millisecondperiod) { - timer->time_period = MillisecondPeriod; - mod_timer(&timer->tl, jiffies + (MillisecondPeriod * HZ) / 1000); + timer->time_period = millisecondperiod; + mod_timer(&timer->tl, jiffies + (millisecondperiod * HZ) / 1000); timer->timer_is_canceled = MFALSE; } @@ -448,9 +448,8 @@ in4_pton(const char *src, int srclen, u8 * dst, int delim, const char **end) goto cont; } w = (w * 10) + c; - if ((w & 0xffff) > 255) { + if ((w & 0xffff) > 255) goto out; - } cont: if (i >= 4) goto out; @@ -481,14 +480,14 @@ out: #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37) /** Initialize semaphore */ -#define MOAL_INIT_SEMAPHORE(x) init_MUTEX(x) +#define MOAL_INIT_SEMAPHORE(x) init_MUTEX(x) /** Initialize semaphore */ -#define MOAL_INIT_SEMAPHORE_LOCKED(x) init_MUTEX_LOCKED(x) +#define MOAL_INIT_SEMAPHORE_LOCKED(x) init_MUTEX_LOCKED(x) #else /** Initialize semaphore */ -#define MOAL_INIT_SEMAPHORE(x) sema_init(x, 1) +#define MOAL_INIT_SEMAPHORE(x) sema_init(x, 1) /** Initialize semaphore */ -#define MOAL_INIT_SEMAPHORE_LOCKED(x) sema_init(x, 0) +#define MOAL_INIT_SEMAPHORE_LOCKED(x) sema_init(x, 0) #endif /** Acquire semaphore and with blocking */ @@ -496,7 +495,7 @@ out: /** Acquire semaphore without blocking */ #define MOAL_ACQ_SEMAPHORE_NOBLOCK(x) down_trylock(x) /** Release semaphore */ -#define MOAL_REL_SEMAPHORE(x) up(x) +#define MOAL_REL_SEMAPHORE(x) up(x) /** Request FW timeout in second */ #define REQUEST_FW_TIMEOUT 30 @@ -533,9 +532,9 @@ out: /** Custom event : AdHoc link lost */ #define CUS_EVT_ADHOC_LINK_LOST "EVENT=ADHOC_LINK_LOST" /** Custom event : MIC failure, unicast */ -#define CUS_EVT_MLME_MIC_ERR_UNI "MLME-MICHAELMICFAILURE.indication unicast " +#define CUS_EVT_MLME_MIC_ERR_UNI "MLME-MICHAELMICFAILURE.indication unicast" /** Custom event : MIC failure, multicast */ -#define CUS_EVT_MLME_MIC_ERR_MUL "MLME-MICHAELMICFAILURE.indication multicast " +#define CUS_EVT_MLME_MIC_ERR_MUL "MLME-MICHAELMICFAILURE.indication multicast" /** Custom event : Beacon RSSI low */ #define CUS_EVT_BEACON_RSSI_LOW "EVENT=BEACON_RSSI_LOW" /** Custom event : Beacon SNR low */ @@ -565,9 +564,9 @@ out: #define CUS_EVT_DEEP_SLEEP_AWAKE "EVENT=DS_AWAKE" /** Custom event : Host Sleep activated */ -#define CUS_EVT_HS_ACTIVATED "HS_ACTIVATED " +#define CUS_EVT_HS_ACTIVATED "HS_ACTIVATED" /** Custom event : Host Sleep deactivated */ -#define CUS_EVT_HS_DEACTIVATED "HS_DEACTIVATED " +#define CUS_EVT_HS_DEACTIVATED "HS_DEACTIVATED" /** Custom event : Host Sleep wakeup */ #define CUS_EVT_HS_WAKEUP "HS_WAKEUP" @@ -620,7 +619,7 @@ out: #define NL_MULTICAST_GROUP 1 /** MAX Tx Pending count */ -#define MAX_TX_PENDING 100 +#define MAX_TX_PENDING 100 /** LOW Tx Pending count */ #define LOW_TX_PENDING 80 @@ -897,6 +896,8 @@ struct _moal_private { u8 mrvl_rssi_low; /** last event */ u32 last_event; + /** fake scan flag */ + u8 fake_scan_complete; #endif /* STA_SUPPORT */ #endif /* STA_CFG80211 */ @@ -1177,9 +1178,8 @@ woal_set_trans_start(struct net_device *dev) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31) unsigned int i; - for (i = 0; i < dev->num_tx_queues; i++) { + for (i = 0; i < dev->num_tx_queues; i++) netdev_get_tx_queue(dev, i)->trans_start = jiffies; - } #endif dev->trans_start = jiffies; } @@ -1311,20 +1311,20 @@ woal_print(t_u32 level, char *fmt, ...) #define MASSERT(cond) \ do { \ if (!(cond)) { \ - PRINTM(MFATAL, "ASSERT: %s: %i\n", __FUNCTION__, __LINE__); \ + PRINTM(MFATAL, "ASSERT: %s: %i\n", __func__, __LINE__); \ panic("Assert failed: Panic!"); \ } \ } while (0) /** Log entry point for debugging */ #define ENTER() PRINTM(MENTRY, "Enter: %s\n", \ - __FUNCTION__) + __func__) /** Log exit point for debugging */ #define LEAVE() PRINTM(MENTRY, "Leave: %s\n", \ - __FUNCTION__) + __func__) #ifdef DEBUG_LEVEL1 -#define DBG_DUMP_BUF_LEN 64 +#define DBG_DUMP_BUF_LEN 64 #define MAX_DUMP_PER_LINE 16 static inline void @@ -1758,6 +1758,8 @@ int woal_custom_ie_ioctl(struct net_device *dev, struct ifreq *req); int woal_send_host_packet(struct net_device *dev, struct ifreq *req); /** Private command ID to pass mgmt frame */ #define WOAL_MGMT_FRAME_TX_IOCTL (SIOCDEVPRIVATE + 12) +/** common ioctl for TDLS */ +int woal_tdls_config_ioctl(struct net_device *dev, struct ifreq *req); int woal_get_bss_type(struct net_device *dev, struct ifreq *req); #if defined(STA_WEXT) || defined(UAP_WEXT) @@ -1840,6 +1842,7 @@ void woal_moal_debug_info(moal_private * priv, moal_handle * handle, u8 flag); #ifdef STA_SUPPORT mlan_status woal_get_powermode(moal_private * priv, int *powermode); mlan_status woal_set_scan_type(moal_private * priv, t_u32 scan_type); +mlan_status woal_enable_ext_scan(moal_private * priv, t_u8 enable); mlan_status woal_set_powermode(moal_private * priv, char *powermode); int woal_find_essid(moal_private * priv, mlan_ssid_bssid * ssid_bssid); mlan_status woal_request_userscan(moal_private * priv, t_u8 wait_option, @@ -1858,9 +1861,9 @@ mlan_status woal_set_sleeppd(moal_private * priv, char *psleeppd); int woal_set_scan_cfg(moal_private * priv, char *buf, int length); /* EVENT: BCN_RSSI_LOW */ -#define EVENT_BCN_RSSI_LOW 0x0001 +#define EVENT_BCN_RSSI_LOW 0x0001 /* EVENT: PRE_BCN_LOST */ -#define EVENT_PRE_BCN_LOST 0x0002 +#define EVENT_PRE_BCN_LOST 0x0002 mlan_status woal_set_rssi_low_threshold(moal_private * priv, char *rssi, t_u8 wait_option); mlan_status woal_set_rssi_threshold(moal_private * priv, t_u32 event_id, @@ -1891,4 +1894,7 @@ int woal_is_connected(moal_private * priv, mlan_ssid_bssid * ssid_bssid); void wifi_enable_hostwake_irq(int flag); int woal_priv_hostcmd(moal_private * priv, t_u8 * respbuf, t_u32 respbuflen); void woal_tcp_ack_tx_indication(moal_private * priv, mlan_buffer * pmbuf); +mlan_status woal_request_country_power_table(moal_private * priv, char *region); +mlan_status woal_mc_policy_cfg(moal_private * priv, t_u16 * enable, + t_u8 wait_option, t_u8 action); #endif /* _MOAL_MAIN_H */ diff --git a/drivers/net/wireless/sd8897/mlinux/moal_priv.c b/drivers/net/wireless/sd8897/mlinux/moal_priv.c index c9492ace37df..ca5e920107e4 100644 --- a/drivers/net/wireless/sd8897/mlinux/moal_priv.c +++ b/drivers/net/wireless/sd8897/mlinux/moal_priv.c @@ -123,7 +123,7 @@ woal_associate_ssid_bssid(moal_private * priv, struct iwreq *wrq) } else { if (mac_idx < ETH_ALEN) ssid_bssid.bssid[mac_idx] = - (t_u8) woal_atox((char *)buf + (int)i); + (t_u8) woal_atox(buf + i); while ((isxdigit(buf[i + 1]) && (i < buflen))) { /* Skip entire hex value */ @@ -272,9 +272,9 @@ done: * @brief Get signal * * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_get_signal(moal_private * priv, struct iwreq *wrq) @@ -549,9 +549,9 @@ woal_deep_sleep_ioctl(moal_private * priv, struct iwreq *wrq) * @brief Set/Get Usr 11n configuration request * * @param priv Pointer to the moal_private driver data struct - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_11n_htcap_cfg(moal_private * priv, struct iwreq *wrq) @@ -646,8 +646,7 @@ woal_11n_htcap_cfg(moal_private * priv, struct iwreq *wrq) wrq->u.data.length = data_length; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -656,9 +655,9 @@ done: * @brief Enable/Disable amsdu_aggr_ctrl * * @param priv Pointer to the moal_private driver data struct - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_11n_amsdu_aggr_ctrl(moal_private * priv, struct iwreq *wrq) @@ -715,8 +714,7 @@ woal_11n_amsdu_aggr_ctrl(moal_private * priv, struct iwreq *wrq) } wrq->u.data.length = 2; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -725,9 +723,9 @@ done: * @brief Set/Get 11n configuration request * * @param priv Pointer to the moal_private driver data struct - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_11n_tx_cfg(moal_private * priv, struct iwreq *wrq) @@ -818,8 +816,7 @@ woal_11n_tx_cfg(moal_private * priv, struct iwreq *wrq) wrq->u.data.length = data_length; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -828,9 +825,9 @@ done: * @brief Enable/Disable TX Aggregation * * @param priv Pointer to the moal_private driver data struct - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_11n_prio_tbl(moal_private * priv, struct iwreq *wrq) @@ -910,9 +907,7 @@ woal_11n_prio_tbl(moal_private * priv, struct iwreq *wrq) } error: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -921,9 +916,9 @@ error: * @brief Set/Get add BA Reject parameters * * @param priv Pointer to the moal_private driver data struct - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_addba_reject(moal_private * priv, struct iwreq *wrq) @@ -956,9 +951,8 @@ woal_addba_reject(moal_private * priv, struct iwreq *wrq) } wrq->u.data.length = MAX_NUM_TID; - for (i = 0; i < (wrq->u.data.length); ++i) { + for (i = 0; i < (wrq->u.data.length); ++i) data[i] = cfg_11n->param.addba_reject[i]; - } if (copy_to_user(wrq->u.data.pointer, data, sizeof(int) * wrq->u.data.length)) { @@ -996,9 +990,7 @@ woal_addba_reject(moal_private * priv, struct iwreq *wrq) goto error; } error: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -1007,9 +999,9 @@ error: * @brief Set/Get add BA parameters * * @param priv Pointer to the moal_private driver data struct - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_addba_para_updt(moal_private * priv, struct iwreq *wrq) @@ -1098,9 +1090,7 @@ woal_addba_para_updt(moal_private * priv, struct iwreq *wrq) } error: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -1109,9 +1099,9 @@ error: * @brief Set/Get Transmit buffer size * * @param priv Pointer to the moal_private driver data struct - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_txbuf_cfg(moal_private * priv, struct iwreq *wrq) @@ -1153,8 +1143,7 @@ woal_txbuf_cfg(moal_private * priv, struct iwreq *wrq) } wrq->u.data.length = 1; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1163,10 +1152,10 @@ done: * @brief Set/Get Host Sleep configuration * * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure - * @param invoke_hostcmd MTRUE --invoke HostCmd, otherwise MFALSE + * @param wrq A pointer to iwreq structure + * @param invoke_hostcmd MTRUE --invoke HostCmd, otherwise MFALSE * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_hs_cfg(moal_private * priv, struct iwreq *wrq, BOOLEAN invoke_hostcmd) @@ -1265,7 +1254,7 @@ done: * @brief Set Host Sleep parameters * * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * * @return 0 --success, otherwise fail */ @@ -1294,7 +1283,7 @@ done: * @brief Get/Set inactivity timeout extend * * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * * @return 0 --success, otherwise fail */ @@ -1368,8 +1357,7 @@ woal_inactivity_timeout_ext(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1378,7 +1366,7 @@ done: * @brief Set/Get system clock * * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * * @return 0 --success, otherwise fail */ @@ -1476,9 +1464,8 @@ woal_ecl_sys_clock(moal_private * priv, struct iwreq *wrq) cfg->param.sys_clock.sys_clk_type = MLAN_CLK_CONFIGURABLE; cfg->param.sys_clock.sys_clk_num = MIN(MLAN_MAX_CLK_NUM, data_length); - for (i = 0; i < cfg->param.sys_clock.sys_clk_num; i++) { + for (i = 0; i < cfg->param.sys_clock.sys_clk_num; i++) cfg->param.sys_clock.sys_clk[i] = (t_u16) data[i]; - } if (MLAN_STATUS_SUCCESS != woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT)) { @@ -1487,8 +1474,7 @@ woal_ecl_sys_clock(moal_private * priv, struct iwreq *wrq) } } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1497,7 +1483,7 @@ done: * @brief Set/Get Band and Adhoc-band setting * * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * * @return 0 --success, otherwise fail */ @@ -1649,9 +1635,7 @@ woal_band_cfg(moal_private * priv, struct iwreq *wrq) } error: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -1660,7 +1644,7 @@ error: * @brief Read/Write adapter registers value * * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * * @return 0 --success, otherwise fail */ @@ -1724,8 +1708,7 @@ woal_reg_read_write(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1734,7 +1717,7 @@ done: * @brief Read the EEPROM contents of the card * * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * * @return 0 --success, otherwise fail */ @@ -1795,8 +1778,7 @@ woal_read_eeprom(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1805,7 +1787,7 @@ done: * @brief Read/Write device memory value * * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * * @return 0 --success, otherwise fail */ @@ -1875,8 +1857,7 @@ woal_mem_read_write(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1884,10 +1865,10 @@ done: /** * @brief Get LOG * - * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param priv A pointer to moal_private structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_get_log(moal_private * priv, struct iwreq *wrq) @@ -1957,8 +1938,7 @@ woal_get_log(moal_private * priv, struct iwreq *wrq) } } done: - if (buf) - kfree(buf); + kfree(buf); LEAVE(); return ret; } @@ -1966,10 +1946,10 @@ done: /** * @brief Deauthenticate * - * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param priv A pointer to moal_private structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_deauth(moal_private * priv, struct iwreq *wrq) @@ -2203,8 +2183,7 @@ woal_tx_power_cfg(moal_private * priv, struct iwreq *wrq) wrq->u.data.length = power_ext_len; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2250,8 +2229,7 @@ woal_get_txrx_rate(moal_private * priv, struct iwreq *wrq) } wrq->u.data.length = 2; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2372,8 +2350,7 @@ woal_beacon_interval(moal_private * priv, struct iwreq *wrq) } wrq->u.data.length = 1; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2437,8 +2414,7 @@ woal_atim_window(moal_private * priv, struct iwreq *wrq) } wrq->u.data.length = 1; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2446,10 +2422,10 @@ done: /** * @brief Set/Get TX data rate * - * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param priv A pointer to moal_private structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_set_get_txrate(moal_private * priv, struct iwreq *wrq) @@ -2509,13 +2485,11 @@ woal_set_get_txrate(moal_private * priv, struct iwreq *wrq) else rateindex = rate->param.rate_cfg.rate; wrq->u.data.length = 1; - if (copy_to_user(wrq->u.data.pointer, &rateindex, sizeof(int))) { + if (copy_to_user(wrq->u.data.pointer, &rateindex, sizeof(int))) ret = -EFAULT; - } } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2523,10 +2497,10 @@ done: /** * @brief Set/Get region code * - * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param priv A pointer to moal_private structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_set_get_regioncode(moal_private * priv, struct iwreq *wrq) @@ -2575,8 +2549,7 @@ woal_set_get_regioncode(moal_private * priv, struct iwreq *wrq) ret = -EFAULT; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2584,10 +2557,10 @@ done: /** * @brief Set/Get radio * - * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param priv A pointer to moal_private structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_set_get_radio(moal_private * priv, struct iwreq *wrq) @@ -2629,8 +2602,8 @@ done: /** * @brief Get/Set the bit mask of driver debug message control * - * @param priv A pointer to moal_private structure - * @param wrq A pointer to wrq structure + * @param priv A pointer to moal_private structure + * @param wrq A pointer to wrq structure * * @return 0 --success, otherwise fail */ @@ -2758,8 +2731,7 @@ woal_set_get_qos_cfg(moal_private * priv, struct iwreq *wrq) wrq->u.data.length = 1; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2767,10 +2739,10 @@ done: /** * @brief Set/Get WWS mode * - * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param priv A pointer to moal_private structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_wws_cfg(moal_private * priv, struct iwreq *wrq) @@ -2817,8 +2789,7 @@ woal_wws_cfg(moal_private * priv, struct iwreq *wrq) wrq->u.data.length = 1; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2883,8 +2854,7 @@ woal_sleep_pd(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2997,9 +2967,7 @@ woal_sleep_params_ioctl(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -3058,8 +3026,7 @@ woal_set_get_11h_local_pwr_constraint(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -3121,8 +3088,7 @@ woal_ht_stream_cfg_ioctl(moal_private * priv, struct iwreq *wrq) wrq->u.data.length = 1; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -3180,8 +3146,7 @@ woal_mac_control_ioctl(moal_private * priv, struct iwreq *wrq) wrq->u.data.length = 1; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -3234,8 +3199,7 @@ woal_thermal_ioctl(moal_private * priv, struct iwreq *wrq) wrq->u.data.length = 1; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -3298,7 +3262,7 @@ done: * @param priv Pointer to the moal_private driver data struct * @param wrq Pointer to user data * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_wmm_enable_ioctl(moal_private * priv, struct iwreq *wrq) @@ -3357,8 +3321,7 @@ woal_wmm_enable_ioctl(moal_private * priv, struct iwreq *wrq) wrq->u.data.length = 1; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -3427,9 +3390,7 @@ woal_11d_enable_ioctl(moal_private * priv, struct iwreq *wrq) wrq->u.data.length = 1; } done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -3469,9 +3430,7 @@ woal_11d_clr_chan_table(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -3482,7 +3441,7 @@ done: * @param priv Pointer to the moal_private driver data struct * @param wrq Pointer to user data * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_wps_cfg_ioctl(moal_private * priv, struct iwreq *wrq) @@ -3527,8 +3486,7 @@ woal_wps_cfg_ioctl(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -3536,10 +3494,10 @@ done: /** * @brief Set WPA passphrase and SSID * - * @param priv A pointer to moal_private structure - * @param wrq A pointer to user data + * @param priv A pointer to moal_private structure + * @param wrq A pointer to user data * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_passphrase(moal_private * priv, struct iwreq *wrq) @@ -3618,7 +3576,7 @@ woal_passphrase(moal_private * priv, struct iwreq *wrq) sec->param.passphrase.ssid.ssid, (int)sec->param.passphrase.ssid.ssid_len); } else if (!strnicmp(opt, "bssid", strlen(opt))) { - woal_mac2u8((t_u8 *) sec->param.passphrase.bssid, end); + woal_mac2u8(sec->param.passphrase.bssid, end); } else if (!strnicmp(opt, "psk", strlen(opt)) && req->action == MLAN_ACT_SET) { if (strlen(end) != MLAN_PMK_HEXSTR_LENGTH) { @@ -3693,7 +3651,7 @@ woal_passphrase(moal_private * priv, struct iwreq *wrq) len += sprintf(buf + len, "\n"); } if (sec->param.passphrase.psk_type == MLAN_PSK_PASSPHRASE) { - len += sprintf(buf + len, "passphrase:%s \n", + len += sprintf(buf + len, "passphrase:%s\n", sec->param.passphrase.psk.passphrase. passphrase); } @@ -3710,8 +3668,7 @@ woal_passphrase(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -3757,8 +3714,7 @@ woal_get_esupp_mode(moal_private * priv, struct iwreq *wrq) } wrq->u.data.length = 3; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -3768,10 +3724,10 @@ done: /** * @brief Adhoc AES control * - * @param priv A pointer to moal_private structure - * @param wrq A pointer to user data + * @param priv A pointer to moal_private structure + * @param wrq A pointer to user data * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_adhoc_aes_ioctl(moal_private * priv, struct iwreq *wrq) @@ -3849,7 +3805,7 @@ woal_adhoc_aes_ioctl(moal_private * priv, struct iwreq *wrq) tmp += sprintf((char *)tmp, "%02x", key_hex[i]); } else if (data_length >= 2) { /* Parse the buf to get the cmd_action */ - action = woal_atox((char *)buf); + action = woal_atox(buf); if (action < 1 || action > 2) { PRINTM(MERROR, "Invalid action argument %d\n", action); @@ -3922,9 +3878,7 @@ woal_adhoc_aes_ioctl(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -3932,9 +3886,9 @@ done: /** * @brief arpfilter ioctl function * - * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure - * @return 0 --success, otherwise fail + * @param priv A pointer to moal_private structure + * @param wrq A pointer to iwreq structure + * @return 0 --success, otherwise fail */ static int woal_arp_filter(moal_private * priv, struct iwreq *wrq) @@ -3975,8 +3929,7 @@ woal_arp_filter(moal_private * priv, struct iwreq *wrq) goto done; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -4063,8 +4016,7 @@ woal_set_get_ip_addr(moal_private * priv, struct iwreq *wrq) } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -4129,8 +4081,7 @@ woal_tx_bf_cap_ioctl(moal_private * priv, struct iwreq *wrq) wrq->u.data.length = 1; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -4531,9 +4482,8 @@ moal_ret_get_scan_table_ioctl(struct iwreq *wrq, &pcurrent, &space_left); - if (ret_code == MLAN_STATUS_SUCCESS) { + if (ret_code == MLAN_STATUS_SUCCESS) num_scans_done = 1; - } } else { scan_start--; @@ -4553,9 +4503,8 @@ moal_ret_get_scan_table_ioctl(struct iwreq *wrq, &pcurrent, &space_left); - if (ret_code == MLAN_STATUS_SUCCESS) { + if (ret_code == MLAN_STATUS_SUCCESS) num_scans_done++; - } } } @@ -4574,7 +4523,7 @@ moal_ret_get_scan_table_ioctl(struct iwreq *wrq, * @brief Get scan table ioctl * * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, otherwise fail */ @@ -4608,11 +4557,10 @@ woal_get_scan_table_ioctl(moal_private * priv, struct iwreq *wrq) ret = -EFAULT; goto done; } - if (scan_start) { + if (scan_start) scan->sub_command = MLAN_OID_SCAN_NORMAL; - } else { + else scan->sub_command = MLAN_OID_SCAN_GET_CURRENT_BSS; - } /* Send IOCTL request to MLAN */ status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); if (status == MLAN_STATUS_SUCCESS) { @@ -4621,7 +4569,7 @@ woal_get_scan_table_ioctl(moal_private * priv, struct iwreq *wrq) scan_start); } done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -4631,7 +4579,7 @@ done: * @brief Set user scan ext -- Async mode, without wait * * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * * @return 0 -- success, otherwise fail */ @@ -4659,7 +4607,7 @@ woal_set_user_scan_ext_ioctl(moal_private * priv, struct iwreq *wrq) * @brief Set user scan * * @param priv A pointer to moal_private structure - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, otherwise fail */ @@ -4718,7 +4666,7 @@ woal_set_user_scan_ioctl(moal_private * priv, struct iwreq *wrq) MOAL_REL_SEMAPHORE(&handle->async_sem); done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -4881,8 +4829,8 @@ woal_cmd53rdwr_ioctl(moal_private * priv, struct iwreq *wrq) ret = -EINVAL; goto done; } - PRINTM(MINFO, "CMD53 read/write, func = %d, addr = %#x, mode = %d, " - "block size = %d, block(byte) number = %d\n", + PRINTM(MINFO, + "CMD53 read/write, func = %d, addr = %#x, mode = %d, block size = %d, block(byte) number = %d\n", func, reg, mode, blklen, blknum); if (!rw) { @@ -4926,10 +4874,8 @@ woal_cmd53rdwr_ioctl(moal_private * priv, struct iwreq *wrq) } done: - if (buf) - kfree(buf); - if (data) - kfree(data); + kfree(buf); + kfree(data); LEAVE(); return ret; } @@ -5041,8 +4987,7 @@ woal_do_sdio_mpa_ctrl(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5060,7 +5005,7 @@ static int woal_set_get_scan_cfg(moal_private * priv, struct iwreq *wrq) { int ret = 0; - int arg_len = 6; + int arg_len = 7; int data[arg_len], copy_len; mlan_ds_scan *scan = NULL; mlan_ioctl_req *req = NULL; @@ -5113,6 +5058,11 @@ woal_set_get_scan_cfg(moal_private * priv, struct iwreq *wrq) ret = -EINVAL; goto done; } + if ((data[6] < 0) || (data[6] > 1)) { + PRINTM(MERROR, "Invalid argument for extended scan\n"); + ret = -EINVAL; + goto done; + } req->action = MLAN_ACT_SET; memcpy(&scan->param.scan_cfg, data, sizeof(data)); } else @@ -5131,8 +5081,7 @@ woal_set_get_scan_cfg(moal_private * priv, struct iwreq *wrq) wrq->u.data.length = ARRAY_SIZE(data); } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5268,8 +5217,7 @@ woal_set_get_ps_cfg(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5380,8 +5328,7 @@ woal_wmm_addts_req_ioctl(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5473,8 +5420,7 @@ woal_wmm_delts_req_ioctl(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5549,8 +5495,7 @@ woal_wmm_queue_config_ioctl(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5629,8 +5574,7 @@ woal_wmm_queue_stats_ioctl(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5695,8 +5639,7 @@ woal_wmm_queue_status_ioctl(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5767,8 +5710,7 @@ woal_wmm_ts_status_ioctl(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -5828,9 +5770,9 @@ done: * @brief Set/Get auth type * * @param priv Pointer to the moal_private driver data struct - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_auth_type(moal_private * priv, struct iwreq *wrq) @@ -5884,9 +5826,9 @@ done: * @brief Set/Get Port Control mode * * @param priv Pointer to the moal_private driver data struct - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_port_ctrl(moal_private * priv, struct iwreq *wrq) @@ -5939,9 +5881,7 @@ woal_port_ctrl(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -5951,9 +5891,9 @@ done: * @brief Set/Get DFS Testing settings * * @param priv Pointer to the moal_private driver data struct - * @param wrq A pointer to iwreq structure + * @param wrq A pointer to iwreq structure * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ static int woal_dfs_testing(moal_private * priv, struct iwreq *wrq) @@ -6039,9 +5979,7 @@ woal_dfs_testing(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -6109,8 +6047,7 @@ woal_mgmt_frame_passthru_ctrl(moal_private * priv, struct iwreq *wrq) wrq->u.data.length = 1; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -6190,9 +6127,7 @@ woal_cfp_code(moal_private * priv, struct iwreq *wrq) } done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -6258,8 +6193,7 @@ woal_set_get_tx_rx_ant(moal_private * priv, struct iwreq *wrq) } } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -6270,11 +6204,11 @@ done: /** * @brief ioctl function - entry point * - * @param dev A pointer to net_device structure - * @param req A pointer to ifreq structure - * @param cmd Command + * @param dev A pointer to net_device structure + * @param req A pointer to ifreq structure + * @param cmd Command * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ int woal_wext_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) @@ -6677,7 +6611,7 @@ woal_get_data_rates(moal_private * priv, t_u8 wait_option, MLAN_SUPPORTED_RATES); } done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -6724,7 +6658,7 @@ woal_get_channel_list(moal_private * priv, t_u8 wait_option, } } done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -6733,10 +6667,10 @@ done: /** * @brief Handle get info resp * - * @param priv Pointer to moal_private structure - * @param info Pointer to mlan_ds_get_info structure + * @param priv Pointer to moal_private structure + * @param info Pointer to mlan_ds_get_info structure * - * @return N/A + * @return N/A */ void woal_ioctl_get_info_resp(moal_private * priv, mlan_ds_get_info * info) @@ -6765,10 +6699,10 @@ woal_ioctl_get_info_resp(moal_private * priv, mlan_ds_get_info * info) /** * @brief Handle get BSS resp * - * @param priv Pointer to moal_private structure - * @param bss Pointer to mlan_ds_bss structure + * @param priv Pointer to moal_private structure + * @param bss Pointer to mlan_ds_bss structure * - * @return N/A + * @return N/A */ void woal_ioctl_get_bss_resp(moal_private * priv, mlan_ds_bss * bss) diff --git a/drivers/net/wireless/sd8897/mlinux/moal_priv.h b/drivers/net/wireless/sd8897/mlinux/moal_priv.h index 83c364546dba..d7a988d43ca9 100644 --- a/drivers/net/wireless/sd8897/mlinux/moal_priv.h +++ b/drivers/net/wireless/sd8897/mlinux/moal_priv.h @@ -124,9 +124,9 @@ Change log: /** Private command ID to turn on/off radio */ #define WOAL_SET_RADIO 3 /** Private command ID to enable WMM */ -#define WOAL_WMM_ENABLE 4 +#define WOAL_WMM_ENABLE 4 /** Private command ID to enable 802.11D */ -#define WOAL_11D_ENABLE 5 +#define WOAL_11D_ENABLE 5 /** Private command ID to set/get QoS configuration */ #define WOAL_SET_GET_QOS_CFG 7 #if defined(REASSOCIATION) diff --git a/drivers/net/wireless/sd8897/mlinux/moal_proc.c b/drivers/net/wireless/sd8897/mlinux/moal_proc.c index bbdab3e53e33..6d9755801da8 100644 --- a/drivers/net/wireless/sd8897/mlinux/moal_proc.c +++ b/drivers/net/wireless/sd8897/mlinux/moal_proc.c @@ -66,10 +66,10 @@ extern int drv_mode; /** * @brief Proc read function for info * - * @param sfp pointer to seq_file structure + * @param sfp pointer to seq_file structure * @param data * - * @return Number of output data + * @return Number of output data */ static int woal_info_proc_read(struct seq_file *sfp, void *data) @@ -284,15 +284,15 @@ static const struct file_operations info_proc_fops = { /* * @brief Parse cmd52 string * - * @param buffer A pointer user buffer - * @param len Length user buffer - * @param func Parsed func number - * @param reg Parsed reg value - * @param val Parsed value to set - * @return BT_STATUS_SUCCESS + * @param buffer A pointer user buffer + * @param len Length user buffer + * @param func Parsed func number + * @param reg Parsed reg value + * @param val Parsed value to set + * @return BT_STATUS_SUCCESS */ static int -parse_cmd52_string(const char __user * buffer, size_t len, int *func, int *reg, +parse_cmd52_string(const char *buffer, size_t len, int *func, int *reg, int *val) { int ret = MLAN_STATUS_SUCCESS; @@ -302,6 +302,9 @@ parse_cmd52_string(const char __user * buffer, size_t len, int *func, int *reg, ENTER(); string = (char *)kmalloc(CMD52_STR_LEN, GFP_KERNEL); + if (string == NULL) + return -ENOMEM; + memset(string, 0, CMD52_STR_LEN); memcpy(string, buffer + strlen("sdcmd52rw="), MIN((CMD52_STR_LEN - 1), (len - strlen("sdcmd52rw=")))); @@ -313,23 +316,19 @@ parse_cmd52_string(const char __user * buffer, size_t len, int *func, int *reg, /* Get func */ pos = strsep(&string, " \t"); - if (pos) { + if (pos) *func = woal_string_to_number(pos); - } /* Get reg */ pos = strsep(&string, " \t"); - if (pos) { + if (pos) *reg = woal_string_to_number(pos); - } /* Get val (optional) */ pos = strsep(&string, " \t"); - if (pos) { + if (pos) *val = woal_string_to_number(pos); - } - if (string) - kfree(string); + kfree(string); LEAVE(); return ret; } @@ -337,12 +336,12 @@ parse_cmd52_string(const char __user * buffer, size_t len, int *func, int *reg, /** * @brief config proc write function * - * @param f file pointer - * @param buf pointer to data buffer - * @param count data number to write - * @param off Offset + * @param f file pointer + * @param buf pointer to data buffer + * @param count data number to write + * @param off Offset * - * @return number of data + * @return number of data */ static ssize_t woal_config_write(struct file *f, const char __user * buf, size_t count, @@ -381,11 +380,10 @@ woal_config_write(struct file *f, const char __user * buf, size_t count, line += strlen("soft_reset") + 1; config_data = (t_u32) woal_string_to_number(line); PRINTM(MINFO, "soft_reset: %d\n", (int)config_data); - if (woal_request_soft_reset(handle) == MLAN_STATUS_SUCCESS) { + if (woal_request_soft_reset(handle) == MLAN_STATUS_SUCCESS) handle->hardware_status = HardwareStatusReset; - } else { + else PRINTM(MERROR, "Could not perform soft reset\n"); - } } if (!strncmp(databuf, "drv_mode", strlen("drv_mode"))) { line += strlen("drv_mode") + 1; @@ -399,8 +397,8 @@ woal_config_write(struct file *f, const char __user * buf, size_t count, } if (!strncmp(databuf, "sdcmd52rw=", strlen("sdcmd52rw=")) && count > strlen("sdcmd52rw=")) { - parse_cmd52_string((const char __user *)databuf, (size_t) count, - &func, ®, &val); + parse_cmd52_string((const char *)databuf, (size_t) count, &func, + ®, &val); woal_sdio_read_write_cmd52(handle, func, reg, val); } if (!strncmp(databuf, "debug_dump", strlen("debug_dump"))) { @@ -416,8 +414,7 @@ woal_config_write(struct file *f, const char __user * buf, size_t count, if (!strncmp(databuf, "fwdump_file=", strlen("fwdump_file="))) { int len = strlen(databuf) - strlen("fwdump_file="); if (len) { - if (handle->fwdump_fname) - kfree(handle->fwdump_fname); + kfree(handle->fwdump_fname); handle->fwdump_fname = kzalloc(len, GFP_KERNEL); if (handle->fwdump_fname) memcpy(handle->fwdump_fname, @@ -433,10 +430,10 @@ woal_config_write(struct file *f, const char __user * buf, size_t count, /** * @brief config proc read function * - * @param sfp pointer to seq_file structure + * @param sfp pointer to seq_file structure * @param data * - * @return number of output data + * @return number of output data */ static int woal_config_read(struct seq_file *sfp, void *data) @@ -486,9 +483,9 @@ static const struct file_operations config_proc_fops = { /** * @brief Convert string to number * - * @param s Pointer to numbered string + * @param s Pointer to numbered string * - * @return Converted number from string s + * @return Converted number from string s */ int woal_string_to_number(char *s) @@ -526,7 +523,7 @@ woal_string_to_number(char *s) * * @param handle Pointer to woal_handle * - * @return N/A + * @return N/A */ void woal_proc_init(moal_handle * handle) @@ -606,9 +603,9 @@ woal_proc_init(moal_handle * handle) /** * @brief Remove the top level proc directory * - * @param handle pointer moal_handle + * @param handle pointer moal_handle * - * @return N/A + * @return N/A */ void woal_proc_exit(moal_handle * handle) @@ -650,9 +647,9 @@ woal_proc_exit(moal_handle * handle) /** * @brief Create proc file for interface * - * @param priv pointer moal_private + * @param priv pointer moal_private * - * @return N/A + * @return N/A */ void woal_create_proc_entry(moal_private * priv) @@ -730,9 +727,9 @@ woal_create_proc_entry(moal_private * priv) /** * @brief Remove proc file * - * @param priv Pointer moal_private + * @param priv Pointer moal_private * - * @return N/A + * @return N/A */ void woal_proc_remove(moal_private * priv) diff --git a/drivers/net/wireless/sd8897/mlinux/moal_sdio.h b/drivers/net/wireless/sd8897/mlinux/moal_sdio.h index ed52123a419e..5f3cf541b1da 100644 --- a/drivers/net/wireless/sd8897/mlinux/moal_sdio.h +++ b/drivers/net/wireless/sd8897/mlinux/moal_sdio.h @@ -49,13 +49,6 @@ Change log: #define FIXED_ADDRESS 0 #endif -/** SD8897 chip revision ID */ -#define SD8897_A0 0x10 -#define SD8897_B0 0x20 - -#define SD8897_A0_FW_NAME "mrvl/sd8897_uapsta_a0.bin" -#define SD8897_B0_FW_NAME "mrvl/sd8897_uapsta.bin" - #ifdef STA_SUPPORT /** Default firmware name */ diff --git a/drivers/net/wireless/sd8897/mlinux/moal_sdio_mmc.c b/drivers/net/wireless/sd8897/mlinux/moal_sdio_mmc.c index 31c79fbc3bc5..ceb285039b1c 100644 --- a/drivers/net/wireless/sd8897/mlinux/moal_sdio_mmc.c +++ b/drivers/net/wireless/sd8897/mlinux/moal_sdio_mmc.c @@ -43,6 +43,7 @@ Change log: #ifdef SDIO_SUSPEND_RESUME /** PM keep power */ extern int pm_keep_power; +extern int shutdown_hs; #endif /** Device ID for SD8897 */ @@ -68,6 +69,8 @@ static struct dev_pm_ops wlan_sdio_pm_ops = { .suspend = woal_sdio_suspend, .resume = woal_sdio_resume, }; + +void woal_sdio_shutdown(struct device *dev); #endif #endif static struct sdio_driver REFDATA wlan_sdio = { @@ -81,14 +84,17 @@ static struct sdio_driver REFDATA wlan_sdio = { #ifdef SDIO_SUSPEND_RESUME #ifdef MMC_PM_KEEP_POWER .pm = &wlan_sdio_pm_ops, + .shutdown = woal_sdio_shutdown, #endif #endif + } #else #ifdef SDIO_SUSPEND_RESUME #ifdef MMC_PM_KEEP_POWER .drv = { .pm = &wlan_sdio_pm_ops, + .shutdown = woal_sdio_shutdown, } #endif #endif @@ -100,8 +106,8 @@ static struct sdio_driver REFDATA wlan_sdio = { ********************************************************/ /** @brief This function dump the sdio register * - * @param handle A Pointer to the moal_handle structure - * @return N/A + * @param handle A Pointer to the moal_handle structure + * @return N/A */ void woal_dump_sdio_reg(moal_handle * handle) @@ -134,8 +140,8 @@ woal_dump_sdio_reg(moal_handle * handle) /** * @brief This function handles the interrupt. * - * @param func A pointer to the sdio_func structure - * @return N/A + * @param func A pointer to the sdio_func structure + * @return N/A */ static void woal_sdio_interrupt(struct sdio_func *func) @@ -163,9 +169,9 @@ woal_sdio_interrupt(struct sdio_func *func) /** @brief This function handles client driver probe. * - * @param func A pointer to sdio_func structure. - * @param id A pointer to sdio_device_id structure. - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE/error code + * @param func A pointer to sdio_func structure. + * @param id A pointer to sdio_device_id structure. + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE/error code */ int woal_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) @@ -225,8 +231,8 @@ woal_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) /** @brief This function handles client driver remove. * - * @param func A pointer to sdio_func structure. - * @return N/A + * @param func A pointer to sdio_func structure. + * @return N/A */ void woal_sdio_remove(struct sdio_func *func) @@ -253,8 +259,8 @@ woal_sdio_remove(struct sdio_func *func) #ifdef MMC_PM_FUNC_SUSPENDED /** @brief This function tells lower driver that WLAN is suspended * - * @param handle A Pointer to the moal_handle structure - * @return N/A + * @param handle A Pointer to the moal_handle structure + * @return N/A */ void woal_wlan_is_suspended(moal_handle * handle) @@ -269,10 +275,82 @@ woal_wlan_is_suspended(moal_handle * handle) } #endif +#define SHUTDOWN_HOST_SLEEP_DEF_GAP 100 +#define SHUTDOWN_HOST_SLEEP_DEF_GPIO 0x3 +#define SHUTDOWN_HOST_SLEEP_DEF_COND 0x0 + +/** @brief This function handles client driver shutdown + * + * @param dev A pointer to device structure + * @return N/A + */ +void +woal_sdio_shutdown(struct device *dev) +{ + struct sdio_func *func = dev_to_sdio_func(dev); + moal_handle *handle = NULL; + struct sdio_mmc_card *cardp; + mlan_ds_hs_cfg hscfg; + int timeout = 0; + int i; + + ENTER(); + PRINTM(MCMND, "<--- Enter woal_sdio_shutdown --->\n"); + cardp = sdio_get_drvdata(func); + if (!cardp || !cardp->handle) { + PRINTM(MERROR, "Card or moal_handle structure is not valid\n"); + LEAVE(); + return; + } + handle = cardp->handle; + for (i = 0; i < handle->priv_num; i++) + netif_device_detach(handle->priv[i]->netdev); + if (shutdown_hs) { + memset(&hscfg, 0, sizeof(mlan_ds_hs_cfg)); + hscfg.is_invoke_hostcmd = MFALSE; + hscfg.conditions = SHUTDOWN_HOST_SLEEP_DEF_COND; + hscfg.gap = SHUTDOWN_HOST_SLEEP_DEF_GAP; + hscfg.gpio = SHUTDOWN_HOST_SLEEP_DEF_GPIO; + if (woal_set_get_hs_params + (woal_get_priv(handle, MLAN_BSS_ROLE_ANY), MLAN_ACT_SET, + MOAL_IOCTL_WAIT, &hscfg) == MLAN_STATUS_FAILURE) { + PRINTM(MERROR, + "Fail to set HS parameter in shutdown: 0x%x 0x%x 0x%x\n", + hscfg.conditions, hscfg.gap, hscfg.gpio); + goto done; + } + /* Enable Host Sleep */ + handle->hs_activate_wait_q_woken = MFALSE; + memset(&hscfg, 0, sizeof(mlan_ds_hs_cfg)); + hscfg.is_invoke_hostcmd = MTRUE; + if (woal_set_get_hs_params + (woal_get_priv(handle, MLAN_BSS_ROLE_ANY), MLAN_ACT_SET, + MOAL_NO_WAIT, &hscfg) == MLAN_STATUS_FAILURE) { + PRINTM(MERROR, + "Request HS enable failed in shutdown\n"); + goto done; + } + timeout = + wait_event_interruptible_timeout(handle-> + hs_activate_wait_q, + handle-> + hs_activate_wait_q_woken, + HS_ACTIVE_TIMEOUT); + if (handle->hs_activated == MTRUE) + PRINTM(MMSG, "HS actived in shutdown\n"); + else + PRINTM(MMSG, "Fail to enable HS in shutdown\n"); + } +done: + PRINTM(MCMND, "<--- Leave woal_sdio_shutdown --->\n"); + LEAVE(); + return; +} + /** @brief This function handles client driver suspend * - * @param dev A pointer to device structure - * @return MLAN_STATUS_SUCCESS or error code + * @param dev A pointer to device structure + * @return MLAN_STATUS_SUCCESS or error code */ int woal_sdio_suspend(struct device *dev) @@ -339,8 +417,8 @@ woal_sdio_suspend(struct device *dev) #endif if (hs_actived) { #ifdef MMC_PM_SKIP_RESUME_PROBE - PRINTM(MCMND, "suspend with MMC_PM_KEEP_POWER and " - "MMC_PM_SKIP_RESUME_PROBE\n"); + PRINTM(MCMND, + "suspend with MMC_PM_KEEP_POWER and MMC_PM_SKIP_RESUME_PROBE\n"); ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER | MMC_PM_SKIP_RESUME_PROBE); #else @@ -368,8 +446,8 @@ done: /** @brief This function handles client driver resume * - * @param dev A pointer to device structure - * @return MLAN_STATUS_SUCCESS + * @param dev A pointer to device structure + * @return MLAN_STATUS_SUCCESS */ int woal_sdio_resume(struct device *dev) @@ -420,7 +498,7 @@ woal_sdio_resume(struct device *dev) * @param reg Register offset * @param data Value * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status woal_write_reg(moal_handle * handle, t_u32 reg, t_u32 data) @@ -444,7 +522,7 @@ woal_write_reg(moal_handle * handle, t_u32 reg, t_u32 data) * @param reg Register offset * @param data Value * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status woal_read_reg(moal_handle * handle, t_u32 reg, t_u32 * data) @@ -468,11 +546,11 @@ woal_read_reg(moal_handle * handle, t_u32 reg, t_u32 * data) * @brief This function use SG mode to read/write data into card memory * * @param handle A Pointer to the moal_handle structure - * @param pmbuf Pointer to mlan_buffer structure - * @param port Port + * @param pmbuf Pointer to mlan_buffer structure + * @param port Port * @param write write flag * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status woal_sdio_rw_mb(moal_handle * handle, pmlan_buffer pmbuf_list, t_u32 port, @@ -547,11 +625,11 @@ woal_sdio_rw_mb(moal_handle * handle, pmlan_buffer pmbuf_list, t_u32 port, * @brief This function writes multiple bytes into card memory * * @param handle A Pointer to the moal_handle structure - * @param pmbuf Pointer to mlan_buffer structure - * @param port Port - * @param timeout Time out value + * @param pmbuf Pointer to mlan_buffer structure + * @param port Port + * @param timeout Time out value * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status woal_write_data_sync(moal_handle * handle, mlan_buffer * pmbuf, t_u32 port, @@ -593,11 +671,11 @@ woal_write_data_sync(moal_handle * handle, mlan_buffer * pmbuf, t_u32 port, * @brief This function reads multiple bytes from card memory * * @param handle A Pointer to the moal_handle structure - * @param pmbuf Pointer to mlan_buffer structure - * @param port Port - * @param timeout Time out value + * @param pmbuf Pointer to mlan_buffer structure + * @param port Port + * @param timeout Time out value * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status woal_read_data_sync(moal_handle * handle, mlan_buffer * pmbuf, t_u32 port, @@ -663,7 +741,7 @@ woal_bus_register(void) /** * @brief This function de-registers the IF module in bus driver * - * @return N/A + * @return N/A */ void woal_bus_unregister(void) @@ -680,7 +758,7 @@ woal_bus_unregister(void) * @brief This function de-registers the device * * @param handle A pointer to moal_handle structure - * @return N/A + * @return N/A */ void woal_unregister_dev(moal_handle * handle) @@ -706,7 +784,7 @@ woal_unregister_dev(moal_handle * handle) * @brief This function registers the device * * @param handle A pointer to moal_handle structure - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status woal_register_dev(moal_handle * handle) @@ -756,9 +834,9 @@ release_host: /** * @brief This function set bus clock on/off * - * @param handle A pointer to moal_handle structure - * @param option TRUE--on , FALSE--off - * @return MLAN_STATUS_SUCCESS + * @param handle A pointer to moal_handle structure + * @param option TRUE--on , FALSE--off + * @return MLAN_STATUS_SUCCESS */ int woal_sdio_set_bus_clock(moal_handle * handle, t_u8 option) @@ -786,11 +864,11 @@ woal_sdio_set_bus_clock(moal_handle * handle, t_u8 option) /** * @brief This function updates card reg based on the Cmd52 value in dev structure * - * @param handle A pointer to moal_handle structure - * @param func A pointer to store func variable - * @param reg A pointer to store reg variable - * @param val A pointer to store val variable - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @param handle A pointer to moal_handle structure + * @param func A pointer to store func variable + * @param reg A pointer to store reg variable + * @param val A pointer to store val variable + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ int woal_sdio_read_write_cmd52(moal_handle * handle, int func, int reg, int val) diff --git a/drivers/net/wireless/sd8897/mlinux/moal_shim.c b/drivers/net/wireless/sd8897/mlinux/moal_shim.c index 186864437a7e..131ab05b1aaa 100644 --- a/drivers/net/wireless/sd8897/mlinux/moal_shim.c +++ b/drivers/net/wireless/sd8897/mlinux/moal_shim.c @@ -61,11 +61,11 @@ extern int hw_test; * @brief Alloc a buffer * * @param pmoal_handle Pointer to the MOAL context - * @param size The size of the buffer to be allocated - * @param flag The type of the buffer to be allocated - * @param ppbuf Pointer to a buffer location to store buffer pointer allocated + * @param size The size of the buffer to be allocated + * @param flag The type of the buffer to be allocated + * @param ppbuf Pointer to a buffer location to store buffer pointer allocated * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_malloc(IN t_void * pmoal_handle, @@ -82,7 +82,7 @@ moal_malloc(IN t_void * pmoal_handle, *ppbuf = kmalloc(size, mem_flag); if (*ppbuf == NULL) { PRINTM(MERROR, "%s: allocate memory (%d bytes) failed!\n", - __FUNCTION__, (int)size); + __func__, (int)size); return MLAN_STATUS_FAILURE; } atomic_inc(&handle->malloc_count); @@ -94,9 +94,9 @@ moal_malloc(IN t_void * pmoal_handle, * @brief Free a buffer * * @param pmoal_handle Pointer to the MOAL context - * @param pbuf Pointer to the buffer to be freed + * @param pbuf Pointer to the buffer to be freed * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_mfree(IN t_void * pmoal_handle, IN t_u8 * pbuf) @@ -114,10 +114,10 @@ moal_mfree(IN t_void * pmoal_handle, IN t_u8 * pbuf) * @brief Alloc a vitual-address-continuous buffer * * @param pmoal_handle Pointer to the MOAL context - * @param size The size of the buffer to be allocated - * @param ppbuf Pointer to a buffer location to store buffer pointer allocated + * @param size The size of the buffer to be allocated + * @param ppbuf Pointer to a buffer location to store buffer pointer allocated * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_vmalloc(IN t_void * pmoal_handle, IN t_u32 size, OUT t_u8 ** ppbuf) @@ -126,7 +126,7 @@ moal_vmalloc(IN t_void * pmoal_handle, IN t_u32 size, OUT t_u8 ** ppbuf) *ppbuf = vmalloc(size); if (*ppbuf == NULL) { - PRINTM(MERROR, "%s: vmalloc (%d bytes) failed!", __FUNCTION__, + PRINTM(MERROR, "%s: vmalloc (%d bytes) failed!", __func__, (int)size); return MLAN_STATUS_FAILURE; } @@ -139,9 +139,9 @@ moal_vmalloc(IN t_void * pmoal_handle, IN t_u32 size, OUT t_u8 ** ppbuf) * @brief Free a buffer allocated by vmalloc * * @param pmoal_handle Pointer to the MOAL context - * @param pbuf Pointer to the buffer to be freed + * @param pbuf Pointer to the buffer to be freed * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_vfree(IN t_void * pmoal_handle, IN t_u8 * pbuf) @@ -159,11 +159,11 @@ moal_vfree(IN t_void * pmoal_handle, IN t_u8 * pbuf) * @brief Fill memory with constant byte * * @param pmoal_handle Pointer to the MOAL context - * @param pmem Pointer to the memory area - * @param byte A constant byte - * @param num Number of bytes to fill + * @param pmem Pointer to the memory area + * @param byte A constant byte + * @param num Number of bytes to fill * - * @return Pointer to the memory area + * @return Pointer to the memory area */ t_void * moal_memset(IN t_void * pmoal_handle, @@ -181,11 +181,11 @@ moal_memset(IN t_void * pmoal_handle, * @brief Copy memory from one area to another * * @param pmoal_handle Pointer to the MOAL context - * @param pdest Pointer to the dest memory - * @param psrc Pointer to the src memory - * @param num Number of bytes to move + * @param pdest Pointer to the dest memory + * @param psrc Pointer to the src memory + * @param num Number of bytes to move * - * @return Pointer to the dest memory + * @return Pointer to the dest memory */ t_void * moal_memcpy(IN t_void * pmoal_handle, @@ -203,11 +203,11 @@ moal_memcpy(IN t_void * pmoal_handle, * @brief Move memory from one area to another * * @param pmoal_handle Pointer to the MOAL context - * @param pdest Pointer to the dest memory - * @param psrc Pointer to the src memory - * @param num Number of bytes to move + * @param pdest Pointer to the dest memory + * @param psrc Pointer to the src memory + * @param num Number of bytes to move * - * @return Pointer to the dest memory + * @return Pointer to the dest memory */ t_void * moal_memmove(IN t_void * pmoal_handle, @@ -225,11 +225,11 @@ moal_memmove(IN t_void * pmoal_handle, * @brief Compare two memory areas * * @param pmoal_handle Pointer to the MOAL context - * @param pmem1 Pointer to the first memory - * @param pmem2 Pointer to the second memory - * @param num Number of bytes to compare + * @param pmem1 Pointer to the first memory + * @param pmem2 Pointer to the second memory + * @param num Number of bytes to compare * - * @return Compare result returns by memcmp + * @return Compare result returns by memcmp */ t_s32 moal_memcmp(IN t_void * pmoal_handle, @@ -263,10 +263,10 @@ moal_udelay(IN t_void * pmoal_handle, IN t_u32 delay) * @brief Retrieves the current system time * * @param pmoal_handle Pointer to the MOAL context - * @param psec Pointer to buf for the seconds of system time - * @param pusec Pointer to buf the micro seconds of system time + * @param psec Pointer to buf for the seconds of system time + * @param pusec Pointer to buf the micro seconds of system time * - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ mlan_status moal_get_system_time(IN t_void * pmoal_handle, @@ -285,11 +285,11 @@ moal_get_system_time(IN t_void * pmoal_handle, * @brief Initializes the timer * * @param pmoal_handle Pointer to the MOAL context - * @param pptimer Pointer to the timer - * @param callback Pointer to callback function - * @param pcontext Pointer to context + * @param pptimer Pointer to the timer + * @param callback Pointer to callback function + * @param pcontext Pointer to context * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_init_timer(IN t_void * pmoal_handle, @@ -311,9 +311,9 @@ moal_init_timer(IN t_void * pmoal_handle, * @brief Free the timer * * @param pmoal_handle Pointer to the MOAL context - * @param ptimer Pointer to the timer + * @param ptimer Pointer to the timer * - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ mlan_status moal_free_timer(IN t_void * pmoal_handle, IN t_void * ptimer) @@ -336,11 +336,11 @@ moal_free_timer(IN t_void * pmoal_handle, IN t_void * ptimer) * @brief Start the timer * * @param pmoal_handle Pointer to the MOAL context - * @param ptimer Pointer to the timer + * @param ptimer Pointer to the timer * @param periodic Periodic timer - * @param msec Timer value in milliseconds + * @param msec Timer value in milliseconds * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_start_timer(IN t_void * pmoal_handle, @@ -359,9 +359,9 @@ moal_start_timer(IN t_void * pmoal_handle, * @brief Stop the timer * * @param pmoal_handle Pointer to the MOAL context - * @param ptimer Pointer to the timer + * @param ptimer Pointer to the timer * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_stop_timer(IN t_void * pmoal_handle, IN t_void * ptimer) @@ -377,9 +377,9 @@ moal_stop_timer(IN t_void * pmoal_handle, IN t_void * ptimer) * @brief Initializes the lock * * @param pmoal_handle Pointer to the MOAL context - * @param pplock Pointer to the lock + * @param pplock Pointer to the lock * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_init_lock(IN t_void * pmoal_handle, OUT t_void ** pplock) @@ -402,9 +402,9 @@ moal_init_lock(IN t_void * pmoal_handle, OUT t_void ** pplock) * @brief Free the lock * * @param pmoal_handle Pointer to the MOAL context - * @param plock Lock + * @param plock Lock * - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ mlan_status moal_free_lock(IN t_void * pmoal_handle, IN t_void * plock) @@ -412,10 +412,9 @@ moal_free_lock(IN t_void * pmoal_handle, IN t_void * plock) moal_handle *handle = (moal_handle *) pmoal_handle; moal_lock *mlock = plock; - if (mlock) { - kfree(mlock); + kfree(mlock); + if (mlock) atomic_dec(&handle->lock_count); - } return MLAN_STATUS_SUCCESS; } @@ -424,9 +423,9 @@ moal_free_lock(IN t_void * pmoal_handle, IN t_void * plock) * @brief Request a spin lock * * @param pmoal_handle Pointer to the MOAL context - * @param plock Pointer to the lock + * @param plock Pointer to the lock * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_spin_lock(IN t_void * pmoal_handle, IN t_void * plock) @@ -447,9 +446,9 @@ moal_spin_lock(IN t_void * pmoal_handle, IN t_void * plock) * @brief Request a spin_unlock * * @param pmoal_handle Pointer to the MOAL context - * @param plock Pointer to the lock + * @param plock Pointer to the lock * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_spin_unlock(IN t_void * pmoal_handle, IN t_void * plock) @@ -496,9 +495,9 @@ moal_get_fw_data(IN t_void * pmoal_handle, * @brief This function is called when MLAN completes the initialization firmware. * * @param pmoal_handle Pointer to the MOAL context - * @param status The status code for mlan_init_fw request + * @param status The status code for mlan_init_fw request * - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ mlan_status moal_init_fw_complete(IN t_void * pmoal_handle, IN mlan_status status) @@ -517,9 +516,9 @@ moal_init_fw_complete(IN t_void * pmoal_handle, IN mlan_status status) * @brief This function is called when MLAN shutdown firmware is completed. * * @param pmoal_handle Pointer to the MOAL context - * @param status The status code for mlan_shutdown request + * @param status The status code for mlan_shutdown request * - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ mlan_status moal_shutdown_fw_complete(IN t_void * pmoal_handle, IN mlan_status status) @@ -538,9 +537,9 @@ moal_shutdown_fw_complete(IN t_void * pmoal_handle, IN mlan_status status) * * @param pmoal_handle Pointer to the MOAL context * @param pioctl_req pointer to structure mlan_ioctl_req - * @param status The status code for mlan_ioctl request + * @param status The status code for mlan_ioctl request * - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ mlan_status moal_ioctl_complete(IN t_void * pmoal_handle, @@ -599,10 +598,10 @@ moal_ioctl_complete(IN t_void * pmoal_handle, * @brief This function allocates mlan_buffer. * * @param pmoal_handle Pointer to the MOAL context - * @param size allocation size requested - * @param pmbuf pointer to pointer to the allocated buffer + * @param size allocation size requested + * @param pmbuf pointer to pointer to the allocated buffer * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_alloc_mlan_buffer(IN t_void * pmoal_handle, @@ -618,9 +617,9 @@ moal_alloc_mlan_buffer(IN t_void * pmoal_handle, * @brief This function frees mlan_buffer. * * @param pmoal_handle Pointer to the MOAL context - * @param pmbuf pointer to buffer to be freed + * @param pmbuf pointer to buffer to be freed * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_free_mlan_buffer(IN t_void * pmoal_handle, IN pmlan_buffer pmbuf) @@ -635,10 +634,10 @@ moal_free_mlan_buffer(IN t_void * pmoal_handle, IN pmlan_buffer pmbuf) * @brief This function is called when MLAN complete send data packet. * * @param pmoal_handle Pointer to the MOAL context - * @param pmbuf Pointer to the mlan buffer structure - * @param status The status code for mlan_send_packet request + * @param pmbuf Pointer to the mlan buffer structure + * @param status The status code for mlan_send_packet request * - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ mlan_status moal_send_packet_complete(IN t_void * pmoal_handle, @@ -648,7 +647,6 @@ moal_send_packet_complete(IN t_void * pmoal_handle, moal_handle *handle = (moal_handle *) pmoal_handle; struct sk_buff *skb = NULL; #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) - t_u32 tid = 0; t_u32 index = 0; #endif @@ -672,11 +670,7 @@ moal_send_packet_complete(IN t_void * pmoal_handle, priv->stats.tx_errors++; } #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) - tid = pmbuf->priority; - index = mlan_select_wmm_queue(priv->phandle-> - pmlan_adapter, - priv->bss_index, - tid); + index = skb_get_queue_mapping(skb); atomic_dec(&handle->tx_pending); if (atomic_dec_return (&priv->wmm_tx_pending[index]) < @@ -740,11 +734,11 @@ moal_send_packet_complete(IN t_void * pmoal_handle, * This function blocks the call until it finishes * * @param pmoal_handle Pointer to the MOAL context - * @param pmbuf Pointer to the mlan buffer structure - * @param port Port number for sent - * @param timeout Timeout value in milliseconds (if 0 the wait is forever) + * @param pmbuf Pointer to the mlan buffer structure + * @param port Port number for sent + * @param timeout Timeout value in milliseconds (if 0 the wait is forever) * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_write_data_sync(IN t_void * pmoal_handle, @@ -759,11 +753,11 @@ moal_write_data_sync(IN t_void * pmoal_handle, * This function blocks the call until it finish * * @param pmoal_handle Pointer to the MOAL context - * @param pmbuf Pointer to the mlan buffer structure - * @param port Port number for read - * @param timeout Timeout value in milliseconds (if 0 the wait is forever) + * @param pmbuf Pointer to the mlan buffer structure + * @param port Port number for read + * @param timeout Timeout value in milliseconds (if 0 the wait is forever) * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_read_data_sync(IN t_void * pmoal_handle, @@ -780,7 +774,7 @@ moal_read_data_sync(IN t_void * pmoal_handle, * @param reg register offset * @param data value * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_write_reg(IN t_void * pmoal_handle, IN t_u32 reg, IN t_u32 data) @@ -795,7 +789,7 @@ moal_write_reg(IN t_void * pmoal_handle, IN t_u32 reg, IN t_u32 data) * @param reg register offset * @param data value * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_read_reg(IN t_void * pmoal_handle, IN t_u32 reg, OUT t_u32 * data) @@ -807,9 +801,9 @@ moal_read_reg(IN t_void * pmoal_handle, IN t_u32 reg, OUT t_u32 * data) * @brief This function uploads the packet to the network stack * * @param pmoal_handle Pointer to the MOAL context - * @param pmbuf Pointer to the mlan buffer structure + * @param pmbuf Pointer to the mlan buffer structure * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status moal_recv_packet(IN t_void * pmoal_handle, IN pmlan_buffer pmbuf) @@ -830,12 +824,12 @@ moal_recv_packet(IN t_void * pmoal_handle, IN pmlan_buffer pmbuf) pmbuf->data_offset = pmbuf->data_len = 0; } else { PRINTM(MERROR, "%s without skb attach!!!\n", - __FUNCTION__); + __func__); skb = dev_alloc_skb(pmbuf->data_len + MLAN_NET_IP_ALIGN); if (!skb) { PRINTM(MERROR, "%s fail to alloc skb\n", - __FUNCTION__); + __func__); status = MLAN_STATUS_FAILURE; priv->stats.rx_dropped++; goto done; @@ -868,9 +862,9 @@ done: * @brief This function handles event receive * * @param pmoal_handle Pointer to the MOAL context - * @param pmevent Pointer to the mlan event structure + * @param pmevent Pointer to the mlan event structure * - * @return MLAN_STATUS_SUCCESS + * @return MLAN_STATUS_SUCCESS */ mlan_status moal_recv_event(IN t_void * pmoal_handle, IN pmlan_event pmevent) @@ -895,15 +889,16 @@ moal_recv_event(IN t_void * pmoal_handle, IN pmlan_event pmevent) ENTER(); - if (pmevent->event_id != MLAN_EVENT_ID_DRV_DEFER_RX_WORK) + if ((pmevent->event_id != MLAN_EVENT_ID_DRV_DEFER_RX_WORK) && + (pmevent->event_id != MLAN_EVENT_ID_DRV_DEFER_HANDLING)) PRINTM(MEVENT, "event id:0x%x\n", pmevent->event_id); priv = woal_bss_index_to_priv(pmoal_handle, pmevent->bss_index); if (priv == NULL) { - PRINTM(MERROR, "%s: priv is null\n", __FUNCTION__); + PRINTM(MERROR, "%s: priv is null\n", __func__); goto done; } if (priv->netdev == NULL) { - PRINTM(MERROR, "%s: netdev is null\n", __FUNCTION__); + PRINTM(MERROR, "%s: netdev is null\n", __func__); goto done; } switch (pmevent->event_id) { @@ -1737,6 +1732,9 @@ moal_recv_event(IN t_void * pmoal_handle, IN pmlan_event pmevent) sizeof(pmevent-> event_id) - MLAN_MAC_ADDR_LENGTH, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) + 0, +#endif GFP_ATOMIC); #else cfg80211_rx_mgmt(priv->netdev, freq, @@ -1793,8 +1791,8 @@ moal_recv_event(IN t_void * pmoal_handle, IN pmlan_event pmevent) /* Clear flag */ priv->phandle->delay_bss_start = MFALSE; - PRINTM(MMSG, "Now CAC measure period end. " - "Execute delayed BSS Start command.\n"); + PRINTM(MMSG, + "Now CAC measure period end. Execute delayed BSS Start command.\n"); req = woal_alloc_mlan_ioctl_req(sizeof (mlan_ds_bss)); @@ -1822,6 +1820,21 @@ moal_recv_event(IN t_void * pmoal_handle, IN pmlan_event pmevent) } } break; + case MLAN_EVENT_ID_DRV_TDLS_TEARDOWN_REQ: +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) +#ifdef STA_CFG80211 + if (IS_STA_CFG80211(cfg80211_wext)) { + tdls_tear_down_event *tdls_event = + (tdls_tear_down_event *) pmevent->event_buf; + cfg80211_tdls_oper_request(priv->netdev, + tdls_event->peer_mac_addr, + NL80211_TDLS_TEARDOWN, + tdls_event->reason_code, + GFP_KERNEL); + } +#endif +#endif + break; case MLAN_EVENT_ID_FW_DUMP_INFO: woal_store_firmware_dump(priv, pmevent); break; @@ -1837,10 +1850,10 @@ done: * @brief This function prints the debug message in mlan * * @param pmoal_handle Pointer to the MOAL context - * @param level debug level - * @param pformat point to string format buf + * @param level debug level + * @param pformat point to string format buf * - * @return N/A + * @return N/A */ t_void moal_print(IN t_void * pmoal_handle, IN t_u32 level, IN char *pformat, IN ...) @@ -1918,7 +1931,7 @@ moal_print_netintf(IN t_void * pmoal_handle, IN t_u32 bss_index, IN t_u32 level) * @param pmoal_handle A pointer to moal_private structure * @param cond Condition to check * - * @return N/A + * @return N/A */ t_void moal_assert(IN t_void * pmoal_handle, IN t_u32 cond) @@ -1932,9 +1945,9 @@ moal_assert(IN t_void * pmoal_handle, IN t_u32 cond) * @brief This function indicate tcp ack tx * * @param pmoal_handle A pointer to moal_private structure - * @param pmbuf Pointer to the mlan buffer structure + * @param pmbuf Pointer to the mlan buffer structure * - * @return N/A + * @return N/A */ t_void moal_tcp_ack_tx_ind(IN t_void * pmoal_handle, IN pmlan_buffer pmbuf) diff --git a/drivers/net/wireless/sd8897/mlinux/moal_sta_cfg80211.c b/drivers/net/wireless/sd8897/mlinux/moal_sta_cfg80211.c index 2d67c4f48a8b..a8d31a6b56fb 100644 --- a/drivers/net/wireless/sd8897/mlinux/moal_sta_cfg80211.c +++ b/drivers/net/wireless/sd8897/mlinux/moal_sta_cfg80211.c @@ -23,6 +23,8 @@ #include "moal_sta_cfg80211.h" #include "moal_eth_ioctl.h" +extern int cfg80211_wext; + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) static void #else @@ -125,11 +127,28 @@ int woal_cfg80211_sched_scan_start(struct wiphy *wiphy, int woal_cfg80211_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev); #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)|| defined(COMPAT_WIRELESS) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) || defined(COMPAT_WIRELESS) int woal_cfg80211_resume(struct wiphy *wiphy); int woal_cfg80211_suspend(struct wiphy *wiphy, struct cfg80211_wowlan *wow); #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)|| defined(COMPAT_WIRELESS) +int woal_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, + u8 * peer, enum nl80211_tdls_operation oper); +int woal_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, + u8 * peer, u8 action_code, u8 dialog_token, + u16 status_code, const u8 * extra_ies, + size_t extra_ies_len); +static int + +woal_cfg80211_add_station(struct wiphy *wiphy, struct net_device *dev, + u8 * mac, struct station_parameters *params); +static int + +woal_cfg80211_change_station(struct wiphy *wiphy, struct net_device *dev, + u8 * mac, struct station_parameters *params); +#endif + /** cfg80211 operations */ static struct cfg80211_ops woal_cfg80211_ops = { .change_virtual_intf = woal_cfg80211_change_virtual_intf, @@ -155,7 +174,7 @@ static struct cfg80211_ops woal_cfg80211_ops = { .sched_scan_start = woal_cfg80211_sched_scan_start, .sched_scan_stop = woal_cfg80211_sched_scan_stop, #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)|| defined(COMPAT_WIRELESS) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) || defined(COMPAT_WIRELESS) .suspend = woal_cfg80211_suspend, .resume = woal_cfg80211_resume, #endif @@ -165,6 +184,12 @@ static struct cfg80211_ops woal_cfg80211_ops = { #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35) || defined(COMPAT_WIRELESS) .set_cqm_rssi_config = woal_cfg80211_set_cqm_rssi_config, #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0) || defined(COMPAT_WIRELESS) + .tdls_oper = woal_cfg80211_tdls_oper, + .tdls_mgmt = woal_cfg80211_tdls_mgmt, + .add_station = woal_cfg80211_add_station, + .change_station = woal_cfg80211_change_station, +#endif #ifdef UAP_CFG80211 .add_virtual_intf = woal_cfg80211_add_virtual_intf, .del_virtual_intf = woal_cfg80211_del_virtual_intf, @@ -257,11 +282,55 @@ static const struct ieee80211_txrx_stypes }; #endif +#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 0, 0) +/** + * NOTE: types in all the sets must be equals to the + * initial value of wiphy->interface_modes + */ +static const struct ieee80211_iface_limit cfg80211_ap_sta_limits[] = { + { + .max = 4, + .types = MBIT(NL80211_IFTYPE_STATION) | +#ifdef UAP_CFG80211 + MBIT(NL80211_IFTYPE_AP) | +#endif +#if defined(WIFI_DIRECT_SUPPORT) +#if LINUX_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION + MBIT(NL80211_IFTYPE_P2P_GO) | MBIT(NL80211_IFTYPE_P2P_CLIENT) | +#endif +#endif + MBIT(NL80211_IFTYPE_ADHOC) + } +}; + +const struct ieee80211_iface_combination cfg80211_iface_comb_ap_sta = { + .limits = cfg80211_ap_sta_limits, + .num_different_channels = 1, + .n_limits = ARRAY_SIZE(cfg80211_ap_sta_limits), + .max_interfaces = 4, + .beacon_int_infra_match = MTRUE, +}; +#endif + extern moal_handle *m_handle[]; extern int hw_test; /** Region alpha2 string */ char *reg_alpha2; +#if defined(WIFI_DIRECT_SUPPORT) +#if LINUX_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION +extern int p2p_enh; +#endif +#endif + +#ifdef CONFIG_PM +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) +static const struct wiphy_wowlan_support wowlan_support = { + .flags = WIPHY_WOWLAN_ANY, +}; +#endif +#endif + /******************************************************** Global Variables ********************************************************/ @@ -277,16 +346,13 @@ char *reg_alpha2; * * @return MTRUE/MFALSE */ -t_u8 -is_cfg80211_special_region_code(char *region_string) -{ +t_u8 is_cfg80211_special_region_code(char *region_string) { t_u8 i; region_code_t cfg80211_special_region_code[] = { {"00 "}, {"99 "}, {"98 "}, {"97 "} }; - for (i = 0; i < COUNTRY_CODE_LEN && region_string[i]; i++) { + for (i = 0; i < COUNTRY_CODE_LEN && region_string[i]; i++) region_string[i] = toupper(region_string[i]); - } for (i = 0; i < ARRAY_SIZE(cfg80211_special_region_code); i++) { if (!memcmp(region_string, @@ -532,8 +598,7 @@ woal_wps_cfg(moal_private * priv, int enable) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -564,8 +629,8 @@ woal_cfg80211_assoc_ies_cfg(moal_private * priv, t_u8 * ie, int ie_len) element_len = *((t_u8 *) pcurrent_ptr + 1); total_ie_len = element_len + sizeof(IEEEtypes_Header_t); if (bytes_left < total_ie_len) { - PRINTM(MERROR, "InterpretIE: Error in processing IE, " - "bytes left < IE length\n"); + PRINTM(MERROR, + "InterpretIE: Error in processing IE, bytes left < IE length\n"); bytes_left = 0; continue; } @@ -742,8 +807,7 @@ woal_send_domain_info_cmd_fw(moal_private * priv, t_u8 wait_option) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -772,7 +836,7 @@ woal_set_rf_channel(moal_private * priv, if (!chan) { LEAVE(); - return EINVAL; + return -EINVAL; } mode = woal_nl80211_iftype_to_mode(priv->wdev->iftype); req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_radio_cfg)); @@ -829,8 +893,7 @@ woal_set_rf_channel(moal_private * priv, } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -881,9 +944,8 @@ woal_set_ewpa_mode(moal_private * priv, t_u8 wait_option, goto error; sec->param.ewpa_enabled = MFALSE; if (sec->param.passphrase.psk_type == MLAN_PSK_PASSPHRASE) { - if (sec->param.passphrase.psk.passphrase.passphrase_len > 0) { + if (sec->param.passphrase.psk.passphrase.passphrase_len > 0) sec->param.ewpa_enabled = MTRUE; - } } else if (sec->param.passphrase.psk_type == MLAN_PSK_PMK) sec->param.ewpa_enabled = MTRUE; @@ -894,7 +956,7 @@ woal_set_ewpa_mode(moal_private * priv, t_u8 wait_option, status = woal_request_ioctl(priv, req, wait_option); error: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -999,11 +1061,15 @@ woal_inform_bss_from_scan_result(moal_private * priv, ieee80211_channel_to_frequency((int) scan_table [i]. - channel, + channel +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) || defined(COMPAT_WIRELESS) + , woal_band_cfg_to_ieee_band (scan_table [i]. - bss_band)); + bss_band) +#endif + ); } chan = ieee80211_get_channel(priv->wdev->wiphy, scan_table[i].freq); @@ -1203,11 +1269,11 @@ woal_process_country_ie(moal_private * priv, struct cfg80211_bss *bss) /** IEEE80211_BAND_2GHZ or IEEE80211_BAND_5GHZ */ cfg_11d->param.domain_info.band = priv->phandle->band; - country_ie_len -= IEEE80211_COUNTRY_STRING_LEN; + country_ie_len -= COUNTRY_CODE_LEN; cfg_11d->param.domain_info.no_of_sub_band = country_ie_len / sizeof(struct ieee80211_country_ie_triplet); memcpy((u8 *) cfg_11d->param.domain_info.sub_band, - &country_ie[2] + IEEE80211_COUNTRY_STRING_LEN, country_ie_len); + &country_ie[2] + COUNTRY_CODE_LEN, country_ie_len); /* Send domain info command to FW */ if (MLAN_STATUS_SUCCESS != @@ -1217,8 +1283,7 @@ woal_process_country_ie(moal_private * priv, struct cfg80211_bss *bss) goto done; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1382,6 +1447,35 @@ woal_cfg80211_assoc(moal_private * priv, void *sme) #endif } else woal_send_domain_info_cmd_fw(priv, MOAL_IOCTL_WAIT); +#ifdef STA_WEXT + if (IS_STA_WEXT(cfg80211_wext)) { + switch (conn_param->crypto.wpa_versions) { + case NL80211_WPA_VERSION_2: + priv->wpa_version = IW_AUTH_WPA_VERSION_WPA2; + break; + case NL80211_WPA_VERSION_1: + priv->wpa_version = IW_AUTH_WPA_VERSION_WPA; + break; + default: + priv->wpa_version = 0; + break; + } + if (conn_param->crypto.n_akm_suites) { + switch (conn_param->crypto.akm_suites[0]) { + case WLAN_AKM_SUITE_PSK: + priv->key_mgmt = IW_AUTH_KEY_MGMT_PSK; + break; + case WLAN_AKM_SUITE_8021X: + priv->key_mgmt = + IW_AUTH_KEY_MGMT_802_1X; + break; + default: + priv->key_mgmt = 0; + break; + } + } + } +#endif } memset(&req_ssid, 0, sizeof(mlan_802_11_ssid)); @@ -1497,8 +1591,9 @@ woal_cfg80211_assoc(moal_private * priv, void *sme) woal_cfg80211_is_alg_wep(pairwise_enc_mode) | woal_cfg80211_is_alg_wep(group_enc_mode); if (alg_is_wep) { - PRINTM(MINFO, "Setting wep encryption with " - "key len %d\n", conn_param->key_len); + PRINTM(MINFO, + "Setting wep encryption with key len %d\n", + conn_param->key_len); /* Set the WEP key */ if (MLAN_STATUS_SUCCESS != woal_cfg80211_set_wep_keys(priv, @@ -1530,8 +1625,7 @@ woal_cfg80211_assoc(moal_private * priv, void *sme) ret = -EINVAL; goto done; } - if (req) - kfree(req); + kfree(req); req = NULL; req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_bss)); @@ -1651,8 +1745,7 @@ done: ret = -EFAULT; } } - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1691,18 +1784,16 @@ woal_set_get_dtim_period(moal_private * priv, req->req_id = MLAN_IOCTL_SNMP_MIB; req->action = action; - if (action == MLAN_ACT_SET) { + if (action == MLAN_ACT_SET) mib->param.dtim_period = *value; - } /* Send IOCTL request to MLAN */ ret = woal_request_ioctl(priv, req, wait_option); - if (ret == MLAN_STATUS_SUCCESS && action == MLAN_ACT_GET) { + if (ret == MLAN_STATUS_SUCCESS && action == MLAN_ACT_GET) *value = (t_u8) mib->param.dtim_period; - } done: - if (req && (ret != MLAN_STATUS_PENDING)) + if (ret != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return ret; @@ -1762,12 +1853,10 @@ woal_cfg80211_dump_station_info(moal_private * priv, struct station_info *sinfo) } if (rate->param.data_rate.tx_data_rate >= MLAN_RATE_INDEX_MCS0) { sinfo->txrate.flags = RATE_INFO_FLAGS_MCS; - if (rate->param.data_rate.tx_ht_bw == MLAN_HT_BW40) { + if (rate->param.data_rate.tx_ht_bw == MLAN_HT_BW40) sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; - } - if (rate->param.data_rate.tx_ht_gi == MLAN_HT_SGI) { + if (rate->param.data_rate.tx_ht_gi == MLAN_HT_SGI) sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; - } sinfo->txrate.mcs = rate->param.data_rate.tx_mcs_index; } else { /* Bit rate is in 500 kb/s units. Convert it to 100kb/s units */ @@ -1803,8 +1892,7 @@ woal_cfg80211_dump_station_info(moal_private * priv, struct station_info *sinfo) #endif done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -1832,6 +1920,7 @@ woal_cfg80211_reg_notifier(struct wiphy *wiphy, { moal_private *priv = NULL; moal_handle *handle = (moal_handle *) woal_get_wiphy_priv(wiphy); + t_u8 region[COUNTRY_CODE_LEN]; #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0) int ret = 0; #endif @@ -1840,7 +1929,7 @@ woal_cfg80211_reg_notifier(struct wiphy *wiphy, priv = woal_get_priv(handle, MLAN_BSS_ROLE_ANY); if (!priv) { - PRINTM(MFATAL, "Unable to get priv in %s()\n", __FUNCTION__); + PRINTM(MFATAL, "Unable to get priv in %s()\n", __func__); LEAVE(); #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0) return -EINVAL; @@ -1851,7 +1940,10 @@ woal_cfg80211_reg_notifier(struct wiphy *wiphy, PRINTM(MIOCTL, "cfg80211 regulatory domain callback " "%c%c\n", request->alpha2[0], request->alpha2[1]); - if (MTRUE == is_cfg80211_special_region_code(request->alpha2)) { + memset(region, 0, sizeof(region)); + memcpy(region, request->alpha2, sizeof(request->alpha2)); + region[2] = ' '; + if (MTRUE == is_cfg80211_special_region_code(region)) { PRINTM(MIOCTL, "Skip configure special region code\n"); LEAVE(); #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0) @@ -1936,6 +2028,7 @@ woal_cfg80211_scan(struct wiphy *wiphy, struct net_device *dev, PRINTM(MINFO, "Received scan request on %s\n", dev->name); #ifdef UAP_CFG80211 + /* return 0 to avoid hostapd failure */ if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) { LEAVE(); cfg80211_scan_done(request, MTRUE); @@ -1944,39 +2037,46 @@ woal_cfg80211_scan(struct wiphy *wiphy, struct net_device *dev, #endif if (priv->phandle->scan_pending_on_block == MTRUE) { - PRINTM(MINFO, "scan already in processing...\n"); + PRINTM(MCMND, "scan already in processing...\n"); LEAVE(); - return -EBUSY; + return -EAGAIN; } #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) || defined(COMPAT_WIRELESS) if (priv->last_event & EVENT_BG_SCAN_REPORT) { - PRINTM(MINFO, "block scan while pending BGSCAN result\n"); + PRINTM(MCMND, "block scan while pending BGSCAN result\n"); priv->last_event = 0; - cfg80211_scan_done(request, MTRUE); LEAVE(); - return 0; + return -EAGAIN; } #endif #if defined(STA_CFG80211) || defined(UAP_CFG80211) #ifdef WIFI_DIRECT_SUPPORT if (priv->phandle->is_go_timer_set) { - PRINTM(MINFO, "block scan in go timer....\n"); - cfg80211_scan_done(request, MTRUE); + PRINTM(MCMND, "block scan in go timer....\n"); LEAVE(); - return 0; + return -EAGAIN; } #endif #endif + if (priv->fake_scan_complete) { + PRINTM(MEVENT, "Reporting fake scan results\n"); + woal_inform_bss_from_scan_result(priv, NULL, MOAL_IOCTL_WAIT); + cfg80211_scan_done(request, MFALSE); + return ret; + } memset(&bss_info, 0, sizeof(bss_info)); if (MLAN_STATUS_SUCCESS == woal_get_bss_info(priv, MOAL_IOCTL_WAIT, &bss_info)) { if (bss_info.scan_block) { - PRINTM(MINFO, "block scan in mlan module...\n"); + PRINTM(MCMND, "block scan in mlan module...\n"); LEAVE(); - return -EBUSY; + return -EAGAIN; } } if (priv->scan_request && priv->scan_request != request) { + PRINTM(MCMND, + "different scan_request is coming before previous one is finished on %s...\n", + dev->name); LEAVE(); return -EBUSY; } @@ -1998,9 +2098,8 @@ woal_cfg80211_scan(struct wiphy *wiphy, struct net_device *dev, #if LINUX_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION if (priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT && priv->scan_request->n_ssids) { - if (!memcmp(scan_req.ssid_list[0].ssid, "DIRECT-", 7)) { + if (!memcmp(scan_req.ssid_list[0].ssid, "DIRECT-", 7)) scan_req.ssid_list[0].max_len = 0xfe; - } } #endif #endif @@ -2102,8 +2201,8 @@ woal_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, #endif /* KERNEL_VERSION */ #endif /* WIFI_DIRECT_SUPPORT && V14_FEATURE */ ) { - PRINTM(MERROR, "Received infra assoc request " - "when station not in infra mode\n"); + PRINTM(MERROR, + "Received infra assoc request when station not in infra mode\n"); LEAVE(); return -EINVAL; } @@ -2149,6 +2248,10 @@ woal_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, return ret; } } + if (priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT) { + /* WAR for P2P connection with Samsung TV */ + woal_sched_timeout(200); + } #endif #endif @@ -2327,8 +2430,8 @@ woal_cfg80211_dump_station(struct wiphy *wiphy, ENTER(); if (!priv->media_connected || idx != 0) { - PRINTM(MINFO, "cfg80211: Media not connected or" - " not for this station!\n"); + PRINTM(MINFO, + "cfg80211: Media not connected or not for this station!\n"); LEAVE(); return -ENOENT; } @@ -2370,8 +2473,8 @@ woal_cfg80211_dump_survey(struct wiphy *wiphy, struct net_device *dev, } #endif if (!priv->media_connected || idx != 0) { - PRINTM(MINFO, "cfg80211: Media not connected or" - " not for this station!\n"); + PRINTM(MINFO, + "cfg80211: Media not connected or not for this station!\n"); LEAVE(); return -ENOENT; } @@ -2386,8 +2489,11 @@ woal_cfg80211_dump_survey(struct wiphy *wiphy, struct net_device *dev, survey->channel = ieee80211_get_channel(wiphy, ieee80211_channel_to_frequency(bss_info. - bss_chan, - band)); + bss_chan +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) || defined(COMPAT_WIRELESS) + , band +#endif + )); if (bss_info.bcn_nf_last) { survey->filled = SURVEY_INFO_NOISE_DBM; @@ -2418,8 +2524,8 @@ woal_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, ENTER(); if (priv->wdev->iftype != NL80211_IFTYPE_ADHOC) { - PRINTM(MERROR, "Request IBSS join received " - "when station not in ibss mode\n"); + PRINTM(MERROR, + "Request IBSS join received when station not in ibss mode\n"); LEAVE(); return -EINVAL; } @@ -2566,7 +2672,7 @@ woal_cfg80211_set_tx_power(struct wiphy *wiphy, priv = woal_get_priv(handle, MLAN_BSS_ROLE_ANY); if (!priv) { - PRINTM(MFATAL, "Unable to get priv in %s()\n", __FUNCTION__); + PRINTM(MFATAL, "Unable to get priv in %s()\n", __func__); LEAVE(); return -EFAULT; } @@ -3025,8 +3131,9 @@ woal_cfg80211_sched_scan_start(struct wiphy *wiphy, "%s sched scan: n_ssids=%d n_match_sets=%d n_channels=%d interval=%d ie_len=%d\n", priv->netdev->name, request->n_ssids, request->n_match_sets, request->n_channels, request->interval, (int)request->ie_len); - /** cancel pending scan */ - woal_cancel_scan(priv, MOAL_IOCTL_WAIT); + /** We have pending scan, start bgscan later */ + if (priv->phandle->scan_pending_on_block) + priv->scan_cfg.start_later = MTRUE; for (i = 0; i < request->n_match_sets; i++) { ssid = &request->match_sets[i].ssid; strncpy(priv->scan_cfg.ssid_list[i].ssid, ssid->ssid, @@ -3100,7 +3207,7 @@ done: * @param wiphy A pointer to wiphy structure * @param dev A pointer to net_device structure * - * @return 0 -- success, otherwise fail + * @return 0 -- success, otherwise fail */ int woal_cfg80211_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev) @@ -3123,7 +3230,7 @@ woal_cfg80211_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev) * * @param wiphy A pointer to wiphy structure * - * @return 0 -- success, otherwise fail + * @return 0 -- success, otherwise fail */ int woal_cfg80211_resume(struct wiphy *wiphy) @@ -3155,9 +3262,9 @@ woal_cfg80211_resume(struct wiphy *wiphy) * @brief cfg80211_suspend handler * * @param wiphy A pointer to wiphy structure - * @param wow A pointer to cfg80211_wowlan + * @param wow A pointer to cfg80211_wowlan * - * @return 0 -- success, otherwise fail + * @return 0 -- success, otherwise fail */ int woal_cfg80211_suspend(struct wiphy *wiphy, struct cfg80211_wowlan *wow) @@ -3182,6 +3289,1017 @@ woal_cfg80211_suspend(struct wiphy *wiphy, struct cfg80211_wowlan *wow) } #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0) || defined(COMPAT_WIRELESS) +/** + * @brief TDLS operation ioctl handler + * + * @param priv A pointer to moal_private structure + * @param peer A pointer to peer mac + * @apram action action for TDLS + * @return 0 --success, otherwise fail + */ +static int +woal_tdls_oper(moal_private * priv, u8 * peer, t_u8 action) +{ + mlan_ioctl_req *ioctl_req = NULL; + mlan_ds_misc_cfg *misc = NULL; + int ret = 0; + + ENTER(); + + ioctl_req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (ioctl_req == NULL) { + ret = -ENOMEM; + goto done; + } + misc = (mlan_ds_misc_cfg *) ioctl_req->pbuf; + misc->sub_command = MLAN_OID_MISC_TDLS_OPER; + ioctl_req->req_id = MLAN_IOCTL_MISC_CFG; + ioctl_req->action = MLAN_ACT_SET; + misc->param.tdls_oper.tdls_action = action; + memcpy(misc->param.tdls_oper.peer_mac, peer, ETH_ALEN); + if (MLAN_STATUS_SUCCESS != + woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT)) { + ret = -EFAULT; + goto done; + } +done: + kfree(ioctl_req); + LEAVE(); + return ret; +} + +/** + * @brief TDLS operation ioctl handler + * + * @param priv A pointer to moal_private structure + * @param peer A pointer to peer mac + * @param tdls_ies A pointer to mlan_ds_misc_tdls_ies structure + * @param flags TDLS ie flags + * + * @return 0 --success, otherwise fail + */ +static int +woal_tdls_get_ies(moal_private * priv, u8 * peer, + mlan_ds_misc_tdls_ies * tdls_ies, t_u16 flags) +{ + mlan_ioctl_req *ioctl_req = NULL; + mlan_ds_misc_cfg *misc = NULL; + int ret = 0; + + ENTER(); + + ioctl_req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (ioctl_req == NULL) { + ret = -ENOMEM; + goto done; + } + misc = (mlan_ds_misc_cfg *) ioctl_req->pbuf; + misc->sub_command = MLAN_OID_MISC_GET_TDLS_IES; + ioctl_req->req_id = MLAN_IOCTL_MISC_CFG; + ioctl_req->action = MLAN_ACT_GET; + misc->param.tdls_ies.flags = flags; + memcpy(misc->param.tdls_ies.peer_mac, peer, ETH_ALEN); + if (MLAN_STATUS_SUCCESS != + woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT)) { + ret = -EFAULT; + goto done; + } + if (tdls_ies) + memcpy(tdls_ies, &misc->param.tdls_ies, + sizeof(mlan_ds_misc_tdls_ies)); +done: + if (ioctl_req) + kfree(ioctl_req); + LEAVE(); + return ret; +} + +/** + * @brief append tdls ext_capability + * + * @param skb A pointer to sk_buff structure + * + * @return N/A + */ +static void +woal_tdls_add_ext_capab(struct sk_buff *skb, mlan_ds_misc_tdls_ies * tdls_ies) +{ + u8 *pos = NULL; + if (tdls_ies->ext_cap[0] == WLAN_EID_EXT_CAPABILITY) { + pos = (void *)skb_put(skb, sizeof(IEEEtypes_ExtCap_t)); + memcpy(pos, tdls_ies->ext_cap, sizeof(IEEEtypes_ExtCap_t)); + } else { + PRINTM(MERROR, "Fail to append tdls ext_capability\n"); + } +} + +/** + * @brief append tdls Qos capability info + * + * @param skb A pointer to sk_buff structure + * + * @return N/A + */ +static void +woal_tdls_add_Qos_capab(struct sk_buff *skb) +{ + u8 *pos = (void *)skb_put(skb, 3); + + *pos++ = WLAN_EID_QOS_CAPA; + *pos++ = 1; /* len */ + *pos++ = 0x0f; +} + +/** + * @brief append supported rates + * + * @param priv A pointer to moal_private structure + * @param skb A pointer to sk_buff structure + * @param band AP's band + * + * @return N/A + */ +static void +woal_add_supported_rates_ie(moal_private * priv, struct sk_buff *skb, + enum ieee80211_band band) +{ + t_u8 basic_rates[] = { 0x82, 0x84, 0x8b, 0x96, 0xc, 0x12, 0x18, 0x24 }; + t_u8 basic_rates_5G[] = + { 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6c }; + t_u8 *pos; + t_u8 rate_num = 0; + if (band == IEEE80211_BAND_2GHZ) + rate_num = sizeof(basic_rates); + else + rate_num = sizeof(basic_rates_5G); + + if (skb_tailroom(skb) < rate_num + 2) + return; + + pos = skb_put(skb, rate_num + 2); + *pos++ = WLAN_EID_SUPP_RATES; + *pos++ = rate_num; + if (band == IEEE80211_BAND_2GHZ) + memcpy(pos, basic_rates, rate_num); + else + memcpy(pos, basic_rates_5G, rate_num); + return; +} + +/** + * @brief append ext_supported rates + * + * @param priv A pointer to moal_private structure + * @param skb A pointer to sk_buff structure + * @param band AP's band + * + * @return N/A + */ +static void +woal_add_ext_supported_rates_ie(moal_private * priv, struct sk_buff *skb, + enum ieee80211_band band) +{ + t_u8 ext_rates[] = { 0x0c, 0x12, 0x18, 0x60 }; + t_u8 *pos; + t_u8 rate_num = sizeof(ext_rates); + + if (band != IEEE80211_BAND_2GHZ) + return; + + if (skb_tailroom(skb) < rate_num + 2) + return; + + pos = skb_put(skb, rate_num + 2); + *pos++ = WLAN_EID_EXT_SUPP_RATES; + *pos++ = rate_num; + memcpy(pos, ext_rates, rate_num); + return; +} + +/** + * @brief woal construct tdls data frame + * + * @param priv A pointer to moal_private structure + * @param peer A pointer to peer mac + * @param action_code tdls action code + * @param dialog_token dialog_token + * @param status_code status_code + * @param skb skb buffer + * + * @return 0 -- success, otherwise fail + */ +static int +woal_construct_tdls_data_frame(moal_private * priv, + t_u8 * peer, t_u8 action_code, t_u8 dialog_token, + t_u16 status_code, struct sk_buff *skb) +{ + + struct ieee80211_tdls_data *tf; + t_u16 capability; + IEEEtypes_HTCap_t *HTcap; + IEEEtypes_HTInfo_t *HTInfo; + IEEEtypes_2040BSSCo_t *BSSCo; + IEEEtypes_VHTCap_t *VHTcap; + IEEEtypes_VHTOprat_t *vht_oprat; + IEEEtypes_AID_t *AidInfo; + mlan_ds_misc_tdls_ies *tdls_ies = NULL; + int ret = 0; + mlan_bss_info bss_info; + enum ieee80211_band band; + + ENTER(); + + memset(&bss_info, 0, sizeof(bss_info)); + if (MLAN_STATUS_SUCCESS != + woal_get_bss_info(priv, MOAL_IOCTL_WAIT, &bss_info)) { + PRINTM(MERROR, "Fail to get bss info\n"); + LEAVE(); + return -EFAULT; + } + band = woal_band_cfg_to_ieee_band(bss_info.bss_band); + tdls_ies = kmalloc(sizeof(mlan_ds_misc_tdls_ies), GFP_KERNEL); + if (!tdls_ies) { + PRINTM(MERROR, "Fail to alloc memory for tdls_ies\n"); + LEAVE(); + return -ENOMEM; + } + if (band == IEEE80211_BAND_2GHZ) + capability = 0x2421; + else + capability = 0; + + tf = (void *)skb_put(skb, offsetof(struct ieee80211_tdls_data, u)); + memcpy(tf->da, peer, ETH_ALEN); + memcpy(tf->sa, priv->current_addr, ETH_ALEN); + tf->ether_type = cpu_to_be16(MLAN_ETHER_PKT_TYPE_TDLS_ACTION); + tf->payload_type = WLAN_TDLS_SNAP_RFTYPE; + memset(tdls_ies, 0, sizeof(mlan_ds_misc_tdls_ies)); + + switch (action_code) { + case WLAN_TDLS_SETUP_REQUEST: + woal_tdls_get_ies(priv, peer, tdls_ies, + TDLS_IE_FLAGS_EXTCAP | TDLS_IE_FLAGS_HTCAP | + TDLS_IE_FLAGS_VHTCAP | TDLS_IE_FLAGS_AID); + tf->category = WLAN_CATEGORY_TDLS; + tf->action_code = WLAN_TDLS_SETUP_REQUEST; + skb_put(skb, sizeof(tf->u.setup_req)); + tf->u.setup_req.dialog_token = dialog_token; + tf->u.setup_req.capability = cpu_to_le16(capability); + woal_add_supported_rates_ie(priv, skb, band); + woal_add_ext_supported_rates_ie(priv, skb, band); + woal_tdls_add_ext_capab(skb, tdls_ies); + woal_tdls_add_Qos_capab(skb); + break; + case WLAN_TDLS_SETUP_RESPONSE: + woal_tdls_get_ies(priv, peer, tdls_ies, + TDLS_IE_FLAGS_EXTCAP | TDLS_IE_FLAGS_HTCAP | + TDLS_IE_FLAGS_VHTCAP | TDLS_IE_FLAGS_AID); + tf->category = WLAN_CATEGORY_TDLS; + tf->action_code = WLAN_TDLS_SETUP_RESPONSE; + + skb_put(skb, sizeof(tf->u.setup_resp)); + tf->u.setup_resp.status_code = cpu_to_le16(status_code); + tf->u.setup_resp.dialog_token = dialog_token; + tf->u.setup_resp.capability = cpu_to_le16(capability); + + woal_add_supported_rates_ie(priv, skb, band); + woal_add_ext_supported_rates_ie(priv, skb, band); + woal_tdls_add_ext_capab(skb, tdls_ies); + woal_tdls_add_Qos_capab(skb); + break; + case WLAN_TDLS_SETUP_CONFIRM: + woal_tdls_get_ies(priv, peer, tdls_ies, + TDLS_IE_FLAGS_HTINFO | + TDLS_IE_FLAGS_VHTOPRAT); + tf->category = WLAN_CATEGORY_TDLS; + tf->action_code = WLAN_TDLS_SETUP_CONFIRM; + + skb_put(skb, sizeof(tf->u.setup_cfm)); + tf->u.setup_cfm.status_code = cpu_to_le16(status_code); + tf->u.setup_cfm.dialog_token = dialog_token; + break; + case WLAN_TDLS_TEARDOWN: + tf->category = WLAN_CATEGORY_TDLS; + tf->action_code = WLAN_TDLS_TEARDOWN; + + skb_put(skb, sizeof(tf->u.teardown)); + tf->u.teardown.reason_code = cpu_to_le16(status_code); + break; + case WLAN_TDLS_DISCOVERY_REQUEST: + tf->category = WLAN_CATEGORY_TDLS; + tf->action_code = WLAN_TDLS_DISCOVERY_REQUEST; + + skb_put(skb, sizeof(tf->u.discover_req)); + tf->u.discover_req.dialog_token = dialog_token; + break; + default: + ret = -EINVAL; + goto done; + } + + // TODO we should fill in ht_cap and htinfo with correct value + switch (action_code) { + case WLAN_TDLS_SETUP_REQUEST: + case WLAN_TDLS_SETUP_RESPONSE: + /* HT capability */ + if (tdls_ies->ht_cap[0] == HT_CAPABILITY) { + HTcap = (void *)skb_put(skb, sizeof(IEEEtypes_HTCap_t)); + memset(HTcap, 0, sizeof(IEEEtypes_HTCap_t)); + memcpy(HTcap, tdls_ies->ht_cap, + sizeof(IEEEtypes_HTCap_t)); + } else { + PRINTM(MERROR, "Fail to append TDLS HT capability\n"); + } + + /* 20_40_bss_coexist */ + BSSCo = (void *)skb_put(skb, sizeof(IEEEtypes_2040BSSCo_t)); + memset(BSSCo, 0, sizeof(IEEEtypes_2040BSSCo_t)); + BSSCo->ieee_hdr.element_id = BSSCO_2040; + BSSCo->ieee_hdr.len = + sizeof(IEEEtypes_2040BSSCo_t) - + sizeof(IEEEtypes_Header_t); + BSSCo->bss_co_2040.bss_co_2040_value = 0x01; + + /* AID info */ + if (tdls_ies->aid_info[0] == AID_INFO) { + AidInfo = (void *)skb_put(skb, sizeof(IEEEtypes_AID_t)); + memset(AidInfo, 0, sizeof(IEEEtypes_AID_t)); + memcpy(AidInfo, tdls_ies->aid_info, + sizeof(IEEEtypes_AID_t)); + } else { + PRINTM(MERROR, "Fail to appened TDLS AID info\n"); + } + /* VHT capability */ + if (tdls_ies->vht_cap[0] == VHT_CAPABILITY) { + VHTcap = (void *)skb_put(skb, + sizeof(IEEEtypes_VHTCap_t)); + memset(VHTcap, 0, sizeof(IEEEtypes_VHTCap_t)); + memcpy(VHTcap, tdls_ies->vht_cap, + sizeof(IEEEtypes_VHTCap_t)); + } else { + PRINTM(MIOCTL, "NO TDLS VHT capability\n"); + } + break; + case WLAN_TDLS_SETUP_CONFIRM: + /* HT information */ + if (tdls_ies->ht_info[0] == HT_OPERATION) { + HTInfo = (void *)skb_put(skb, + sizeof(IEEEtypes_HTInfo_t)); + memset(HTInfo, 0, sizeof(IEEEtypes_HTInfo_t)); + memcpy(HTInfo, tdls_ies->ht_info, + sizeof(IEEEtypes_HTInfo_t)); + } else + PRINTM(MERROR, "Fail to append TDLS HT information\n"); + /** VHT operation */ + if (tdls_ies->vht_oprat[0] == VHT_OPERATION) { + vht_oprat = + (void *)skb_put(skb, + sizeof(IEEEtypes_VHTOprat_t)); + memset(vht_oprat, 0, sizeof(IEEEtypes_VHTOprat_t)); + memcpy(vht_oprat, tdls_ies->vht_oprat, + sizeof(IEEEtypes_VHTOprat_t)); + } else + PRINTM(MIOCTL, "NO TDLS VHT Operation IE\n"); + break; + default: + break; + } + +done: + if (tdls_ies) + kfree(tdls_ies); + return ret; +} + +/** + * @brief woal construct tdls action frame + * + * @param priv A pointer to moal_private structure + * @param peer A pointer to peer mac + * @param action_code tdls action code + * @param dialog_token dialog_token + * @param status_code status_code + * @param skb skb buffer + * + * @return 0 -- success, otherwise fail + */ +static int +woal_construct_tdls_action_frame(moal_private * priv, + t_u8 * peer, t_u8 action_code, + t_u8 dialog_token, t_u16 status_code, + struct sk_buff *skb) +{ + struct ieee80211_mgmt *mgmt; + t_u8 addr[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + t_u16 capability; + t_u8 *pos = NULL; + mlan_ds_misc_tdls_ies *tdls_ies = NULL; + mlan_bss_info bss_info; + enum ieee80211_band band; + + int ret = 0; + + ENTER(); + + memset(&bss_info, 0, sizeof(bss_info)); + if (MLAN_STATUS_SUCCESS != + woal_get_bss_info(priv, MOAL_IOCTL_WAIT, &bss_info)) { + PRINTM(MERROR, "Fail to get bss info\n"); + LEAVE(); + return -EFAULT; + } + band = woal_band_cfg_to_ieee_band(bss_info.bss_band); + + tdls_ies = kmalloc(sizeof(mlan_ds_misc_tdls_ies), GFP_KERNEL); + if (!tdls_ies) { + PRINTM(MERROR, "Fail to alloc memory for tdls_ies\n"); + LEAVE(); + return -ENOMEM; + } + + mgmt = (void *)skb_put(skb, 24); + memset(mgmt, 0, 24); + memcpy(mgmt->da, peer, ETH_ALEN); + memcpy(mgmt->sa, priv->current_addr, ETH_ALEN); + memcpy(mgmt->bssid, priv->cfg_bssid, ETH_ALEN); + + mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | + IEEE80211_STYPE_ACTION); + /* add address 4 */ + pos = skb_put(skb, ETH_ALEN); + + if (band == IEEE80211_BAND_2GHZ) + capability = 0x2421; + else + capability = 0; + + memset(tdls_ies, 0, sizeof(mlan_ds_misc_tdls_ies)); + + switch (action_code) { + case WLAN_PUB_ACTION_TDLS_DISCOVER_RES: + woal_tdls_get_ies(priv, peer, tdls_ies, TDLS_IE_FLAGS_EXTCAP); + skb_put(skb, 1 + sizeof(mgmt->u.action.u.tdls_discover_resp)); + mgmt->u.action.category = WLAN_CATEGORY_PUBLIC; + mgmt->u.action.u.tdls_discover_resp.action_code = + WLAN_PUB_ACTION_TDLS_DISCOVER_RES; + mgmt->u.action.u.tdls_discover_resp.dialog_token = dialog_token; + mgmt->u.action.u.tdls_discover_resp.capability = + cpu_to_le16(capability); + /* move back for addr4 */ + memmove(pos + ETH_ALEN, &mgmt->u.action.category, + 1 + sizeof(mgmt->u.action.u.tdls_discover_resp)); + /** init address 4 */ + memcpy(pos, addr, ETH_ALEN); + + woal_add_supported_rates_ie(priv, skb, band); + woal_add_ext_supported_rates_ie(priv, skb, band); + woal_tdls_add_ext_capab(skb, tdls_ies); + break; + default: + ret = -EINVAL; + break; + } + if (tdls_ies) + kfree(tdls_ies); + return ret; +} + +/** + * @brief woal add tdls link identifier ie + * + * @param skb skb buffer + * @param src_addr source address + * @param peer peer address + * @param bssid AP's bssid + * + * @return NA + */ +static void +woal_tdls_add_link_ie(struct sk_buff *skb, u8 * src_addr, u8 * peer, u8 * bssid) +{ + struct ieee80211_tdls_lnkie *lnkid; + + lnkid = (void *)skb_put(skb, sizeof(struct ieee80211_tdls_lnkie)); + + lnkid->ie_type = WLAN_EID_LINK_ID; + lnkid->ie_len = sizeof(struct ieee80211_tdls_lnkie) - 2; + + memcpy(lnkid->bssid, bssid, ETH_ALEN); + memcpy(lnkid->init_sta, src_addr, ETH_ALEN); + memcpy(lnkid->resp_sta, peer, ETH_ALEN); +} + +/** + * @brief woal send tdls action frame + * + * @param wiphy A pointer to wiphy structure + * @param dev A pointer to net_device structure + * @param peer A pointer to peer mac + * @param action_code tdls action code + * @param dialog_token dialog_token + * @param status_code status_code + * @param skb skb buffer + * + * @return 0 -- success, otherwise fail + */ +static int +woal_send_tdls_action_frame(struct wiphy *wiphy, struct net_device *dev, + t_u8 * peer, u8 action_code, t_u8 dialog_token, + t_u16 status_code, const t_u8 * extra_ies, + size_t extra_ies_len) +{ + moal_private *priv = (moal_private *) woal_get_netdev_priv(dev); + pmlan_buffer pmbuf = NULL; + mlan_status status = MLAN_STATUS_SUCCESS; + struct sk_buff *skb = NULL; + t_u8 *pos; + t_u32 pkt_type; + t_u32 tx_control; + t_u16 pkt_len; + int ret = 0; + + ENTER(); + +#define HEADER_SIZE 8 /* pkt_type + + tx_control */ + + pmbuf = woal_alloc_mlan_buffer(priv->phandle, MLAN_MIN_DATA_HEADER_LEN + HEADER_SIZE + sizeof(pkt_len) + max(sizeof(struct ieee80211_mgmt), sizeof(struct ieee80211_tdls_data)) + 50 + /* supported + rates + */ + sizeof(IEEEtypes_ExtCap_t) + /* ext + capab + */ + extra_ies_len + + sizeof(IEEEtypes_tdls_linkie)); + if (!pmbuf) { + PRINTM(MERROR, "Fail to allocate mlan_buffer\n"); + ret = -ENOMEM; + goto done; + } + + skb = (struct sk_buff *)pmbuf->pdesc; + + skb_put(skb, MLAN_MIN_DATA_HEADER_LEN); + + pos = skb_put(skb, HEADER_SIZE + sizeof(pkt_len)); + pkt_type = MRVL_PKT_TYPE_MGMT_FRAME; + tx_control = 0; + memset(pos, 0, HEADER_SIZE + sizeof(pkt_len)); + memcpy(pos, &pkt_type, sizeof(pkt_type)); + memcpy(pos + sizeof(pkt_type), &tx_control, sizeof(tx_control)); + + woal_construct_tdls_action_frame(priv, peer, action_code, + dialog_token, status_code, skb); + + if (extra_ies_len) + memcpy(skb_put(skb, extra_ies_len), extra_ies, extra_ies_len); + + /* the TDLS link IE is always added last */ + /* we are the responder */ + woal_tdls_add_link_ie(skb, peer, priv->current_addr, priv->cfg_bssid); + + /* + * According to 802.11z: Setup req/resp are sent in AC_BK, otherwise + * we should default to AC_VI. + */ + skb_set_queue_mapping(skb, WMM_AC_VI); + skb->priority = 5; + + pmbuf->data_offset = MLAN_MIN_DATA_HEADER_LEN; + pmbuf->data_len = skb->len - pmbuf->data_offset; + pmbuf->priority = skb->priority; + pmbuf->buf_type = MLAN_BUF_TYPE_RAW_DATA; + pmbuf->bss_index = priv->bss_index; + + pkt_len = pmbuf->data_len - HEADER_SIZE - sizeof(pkt_len); + memcpy(pmbuf->pbuf + pmbuf->data_offset + HEADER_SIZE, &pkt_len, + sizeof(pkt_len)); + + DBG_HEXDUMP(MDAT_D, "TDLS action:", pmbuf->pbuf + pmbuf->data_offset, + pmbuf->data_len); + + status = mlan_send_packet(priv->phandle->pmlan_adapter, pmbuf); + + switch (status) { + case MLAN_STATUS_PENDING: + atomic_inc(&priv->phandle->tx_pending); + queue_work(priv->phandle->workqueue, &priv->phandle->main_work); + break; + case MLAN_STATUS_SUCCESS: + woal_free_mlan_buffer(priv->phandle, pmbuf); + break; + case MLAN_STATUS_FAILURE: + default: + woal_free_mlan_buffer(priv->phandle, pmbuf); + ret = -EFAULT; + break; + } + +done: + LEAVE(); + return ret; +} + +/** + * @brief woal send tdls data frame + * + * @param wiphy A pointer to wiphy structure + * @param dev A pointer to net_device structure + * @param peer A pointer to peer mac + * @param action_code tdls action code + * @param dialog_token dialog_token + * @param status_code status_code + * @param skb skb buffer + * + * @return 0 -- success, otherwise fail + */ +static int +woal_send_tdls_data_frame(struct wiphy *wiphy, struct net_device *dev, + t_u8 * peer, u8 action_code, t_u8 dialog_token, + t_u16 status_code, const t_u8 * extra_ies, + size_t extra_ies_len) +{ + moal_private *priv = (moal_private *) woal_get_netdev_priv(dev); + pmlan_buffer pmbuf = NULL; + mlan_status status = MLAN_STATUS_SUCCESS; + struct sk_buff *skb = NULL; + int ret = 0; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) + t_u32 index = 0; +#endif + + ENTER(); + + skb = dev_alloc_skb(priv->extra_tx_head_len + MLAN_MIN_DATA_HEADER_LEN + sizeof(mlan_buffer) + max(sizeof(struct ieee80211_mgmt), sizeof(struct ieee80211_tdls_data)) + 50 + /* supported + rates + */ + sizeof(IEEEtypes_ExtCap_t) + /* ext capab */ + 3 + /* Qos Info */ + sizeof(IEEEtypes_HTCap_t) + + sizeof(IEEEtypes_2040BSSCo_t) + + sizeof(IEEEtypes_HTInfo_t) + + sizeof(IEEEtypes_VHTCap_t) + + sizeof(IEEEtypes_VHTOprat_t) + + sizeof(IEEEtypes_AID_t) + extra_ies_len + + sizeof(IEEEtypes_tdls_linkie)); + if (!skb) + return -ENOMEM; + + skb_reserve(skb, + MLAN_MIN_DATA_HEADER_LEN + sizeof(mlan_buffer) + + priv->extra_tx_head_len); + + woal_construct_tdls_data_frame(priv, peer, + action_code, dialog_token, + status_code, skb); + + if (extra_ies_len) + memcpy(skb_put(skb, extra_ies_len), extra_ies, extra_ies_len); + + /* the TDLS link IE is always added last */ + switch (action_code) { + case WLAN_TDLS_SETUP_REQUEST: + case WLAN_TDLS_SETUP_CONFIRM: + case WLAN_TDLS_TEARDOWN: + case WLAN_TDLS_DISCOVERY_REQUEST: + /* we are the initiator */ + woal_tdls_add_link_ie(skb, priv->current_addr, peer, + priv->cfg_bssid); + break; + case WLAN_TDLS_SETUP_RESPONSE: + /* we are the responder */ + woal_tdls_add_link_ie(skb, peer, priv->current_addr, + priv->cfg_bssid); + break; + default: + ret = -ENOTSUPP; + goto fail; + } + + /* + * According to 802.11z: Setup req/resp are sent in AC_BK, otherwise + * we should default to AC_VI. + */ + switch (action_code) { + case WLAN_TDLS_SETUP_REQUEST: + case WLAN_TDLS_SETUP_RESPONSE: + skb_set_queue_mapping(skb, WMM_AC_BK); + skb->priority = 2; + break; + default: + skb_set_queue_mapping(skb, WMM_AC_VI); + skb->priority = 5; + break; + } + + pmbuf = (mlan_buffer *) skb->head; + memset((t_u8 *) pmbuf, 0, sizeof(mlan_buffer)); + pmbuf->bss_index = priv->bss_index; + pmbuf->pdesc = skb; + pmbuf->pbuf = skb->head + sizeof(mlan_buffer); + + pmbuf->data_offset = skb->data - (skb->head + sizeof(mlan_buffer)); + pmbuf->data_len = skb->len; + pmbuf->priority = skb->priority; + pmbuf->buf_type = MLAN_BUF_TYPE_DATA; + + DBG_HEXDUMP(MDAT_D, "TDLS data:", pmbuf->pbuf + pmbuf->data_offset, + pmbuf->data_len); + + status = mlan_send_packet(priv->phandle->pmlan_adapter, pmbuf); + + switch (status) { + case MLAN_STATUS_PENDING: + atomic_inc(&priv->phandle->tx_pending); +#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) + index = skb_get_queue_mapping(skb); + atomic_inc(&priv->wmm_tx_pending[index]); +#endif + queue_work(priv->phandle->workqueue, &priv->phandle->main_work); + /* delay 10 ms to guarantee the teardown frame can be sent out + before disalbe tdls link * if we don't delay and return + immediately, wpa_supplicant will call disalbe tdls link * + this may cause tdls link disabled before teardown frame sent + out */ + if (action_code == WLAN_TDLS_TEARDOWN) + woal_sched_timeout(10); + break; + case MLAN_STATUS_SUCCESS: + dev_kfree_skb(skb); + break; + case MLAN_STATUS_FAILURE: + default: + dev_kfree_skb(skb); + ret = -ENOTSUPP; + break; + } + + LEAVE(); + return ret; +fail: + dev_kfree_skb(skb); + return ret; +} + +/** + * @brief Tx TDLS packet + * + * @param wiphy A pointer to wiphy structure + * @param dev A pointer to net_device structure + * @param peer A pointer to peer mac + * @param action_code tdls action code + * @param dialog_token dialog_token + * @param status_code status_code + * @param extra_ie A pointer to extra ie buffer + * @param extra_ie_len etra ie len + * + * @return 0 -- success, otherwise fail + */ +int +woal_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, + t_u8 * peer, u8 action_code, t_u8 dialog_token, + t_u16 status_code, const t_u8 * extra_ies, + size_t extra_ies_len) +{ + moal_private *priv = (moal_private *) woal_get_netdev_priv(dev); + int ret = 0; + + ENTER(); + + if (!(wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS)) + return -ENOTSUPP; + /* make sure we are not in uAP mode and Go mode */ + if (priv->bss_type != MLAN_BSS_TYPE_STA) + return -ENOTSUPP; + + switch (action_code) { + case TDLS_SETUP_REQUEST: + PRINTM(MMSG, + "wlan: Send TDLS Setup Request to " MACSTR + " status_code=%d\n", MAC2STR(peer), status_code); + ret = woal_send_tdls_data_frame(wiphy, dev, peer, action_code, + dialog_token, status_code, + extra_ies, extra_ies_len); + break; + case TDLS_SETUP_RESPONSE: + PRINTM(MMSG, + "wlan: Send TDLS Setup Response to " MACSTR + " status_code=%d\n", MAC2STR(peer), status_code); + ret = woal_send_tdls_data_frame(wiphy, dev, peer, action_code, + dialog_token, status_code, + extra_ies, extra_ies_len); + break; + case TDLS_SETUP_CONFIRM: + PRINTM(MMSG, + "wlan: Send TDLS Confirm to " MACSTR " status_code=%d\n", + MAC2STR(peer), status_code); + ret = woal_send_tdls_data_frame(wiphy, dev, peer, action_code, + dialog_token, status_code, + extra_ies, extra_ies_len); + break; + case TDLS_TEARDOWN: + PRINTM(MMSG, "wlan: Send TDLS Tear down to " MACSTR "\n", + MAC2STR(peer)); + ret = woal_send_tdls_data_frame(wiphy, dev, peer, action_code, + dialog_token, status_code, + extra_ies, extra_ies_len); + break; + case TDLS_DISCOVERY_REQUEST: + PRINTM(MMSG, + "wlan: Send TDLS Discovery Request to " MACSTR "\n", + MAC2STR(peer)); + ret = woal_send_tdls_data_frame(wiphy, dev, peer, action_code, + dialog_token, status_code, + extra_ies, extra_ies_len); + break; + case TDLS_DISCOVERY_RESPONSE: + PRINTM(MMSG, + "wlan: Send TDLS Discovery Response to " MACSTR "\n", + MAC2STR(peer)); + ret = woal_send_tdls_action_frame(wiphy, dev, peer, action_code, + dialog_token, status_code, + extra_ies, extra_ies_len); + break; + default: + break; + } + + LEAVE(); + return ret; + +} + +/** + * @brief cfg80211_tdls_oper handler + * + * @param wiphy A pointer to wiphy structure + * @param dev A pointer to net_device structure + * @param peer tdls peer mac + * @param oper tdls operation code + * + * @return 0 -- success, otherwise fail + */ +int +woal_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, + u8 * peer, enum nl80211_tdls_operation oper) +{ + moal_private *priv = (moal_private *) woal_get_netdev_priv(dev); + t_u8 action; + int ret = 0; + + ENTER(); + + if (!(wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS)) + return -ENOTSUPP; + + if (!(wiphy->flags & WIPHY_FLAG_TDLS_EXTERNAL_SETUP)) + return -ENOTSUPP; + /* make sure we are in managed mode, and associated */ + if (priv->bss_type != MLAN_BSS_TYPE_STA) + return -ENOTSUPP; + + PRINTM(MIOCTL, "wlan: TDLS peer=" MACSTR ", oper=%d\n", MAC2STR(peer), + oper); + switch (oper) { + case NL80211_TDLS_ENABLE_LINK: + PRINTM(MMSG, "wlan: TDLS_ENABLE_LINK: peer=" MACSTR "\n", + MAC2STR(peer)); + action = WLAN_TDLS_ENABLE_LINK; + break; + case NL80211_TDLS_DISABLE_LINK: + PRINTM(MMSG, "wlan: TDLS_DISABLE_LINK: peer=" MACSTR "\n", + MAC2STR(peer)); + action = WLAN_TDLS_DISABLE_LINK; + break; + case NL80211_TDLS_TEARDOWN: + case NL80211_TDLS_SETUP: + case NL80211_TDLS_DISCOVERY_REQ: + return 0; + + default: + return -ENOTSUPP; + } + ret = woal_tdls_oper(priv, peer, action); + + LEAVE(); + + return ret; +} + +/** + * @brief add station + * + * @param wiphy A pointer to wiphy structure + * @param dev A pointer to net_device structure + * @param mac A pointer to peer mac + * @param params station parameters + * + * @return 0 -- success, otherwise fail + */ +static int +woal_cfg80211_add_station(struct wiphy *wiphy, struct net_device *dev, + u8 * mac, struct station_parameters *params) +{ + moal_private *priv = (moal_private *) woal_get_netdev_priv(dev); + int ret = 0; + ENTER(); + if (!(params->sta_flags_set & MBIT(NL80211_STA_FLAG_TDLS_PEER))) + goto done; + /* make sure we are in connected mode */ + if ((priv->bss_type != MLAN_BSS_TYPE_STA) || + (priv->media_connected == MFALSE)) { + ret = -ENOTSUPP; + goto done; + } + PRINTM(MMSG, "wlan: TDLS add peer station, address =" MACSTR "\n", + MAC2STR(mac)); + ret = woal_tdls_oper(priv, mac, WLAN_TDLS_CREATE_LINK); +done: + return ret; +} + +/** + * @brief change station info + * + * @param wiphy A pointer to wiphy structure + * @param dev A pointer to net_device structure + * @param mac A pointer to peer mac + * @param params station parameters + * + * @return 0 -- success, otherwise fail + */ +static int +woal_cfg80211_change_station(struct wiphy *wiphy, struct net_device *dev, + u8 * mac, struct station_parameters *params) +{ + moal_private *priv = (moal_private *) woal_get_netdev_priv(dev); + mlan_ioctl_req *ioctl_req = NULL; + mlan_ds_misc_cfg *misc = NULL; + int ret = 0; + + ENTER(); + + if (!(params->sta_flags_set & MBIT(NL80211_STA_FLAG_TDLS_PEER))) + goto done; + /* make sure we are in connected mode */ + if ((priv->bss_type != MLAN_BSS_TYPE_STA) || + (priv->media_connected == MFALSE)) { + ret = -ENOTSUPP; + goto done; + } + PRINTM(MMSG, "wlan: TDLS change peer info " MACSTR "\n", MAC2STR(mac)); + + ioctl_req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (ioctl_req == NULL) { + ret = -ENOMEM; + goto done; + } + + misc = (mlan_ds_misc_cfg *) ioctl_req->pbuf; + misc->sub_command = MLAN_OID_MISC_TDLS_OPER; + ioctl_req->req_id = MLAN_IOCTL_MISC_CFG; + ioctl_req->action = MLAN_ACT_SET; + misc->param.tdls_oper.tdls_action = WLAN_TDLS_CONFIG_LINK; + memcpy(misc->param.tdls_oper.peer_mac, mac, ETH_ALEN); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0) + misc->param.tdls_oper.capability = params->capability; +#endif + misc->param.tdls_oper.qos_info = + params->uapsd_queues | (params->max_sp << 5); + + if (params->supported_rates) { + misc->param.tdls_oper.supported_rates = params->supported_rates; + misc->param.tdls_oper.supported_rates_len = + params->supported_rates_len; + } + + if (params->ht_capa) + misc->param.tdls_oper.ht_capa = (t_u8 *) params->ht_capa; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0) + if (params->ext_capab) { + misc->param.tdls_oper.ext_capab = params->ext_capab; + misc->param.tdls_oper.ext_capab_len = params->ext_capab_len; + } +#endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) + if (params->vht_capa) + misc->param.tdls_oper.vht_cap = (t_u8 *) params->vht_capa; +#endif + + if (MLAN_STATUS_SUCCESS != + woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT)) { + ret = -EFAULT; + goto done; + } + +done: + kfree(ioctl_req); + LEAVE(); + return ret; +} +#endif + /** * @brief Save connect parameters for roaming * @@ -3192,6 +4310,7 @@ void woal_save_conn_params(moal_private * priv, struct cfg80211_connect_params *sme) { ENTER(); + woal_clear_conn_params(priv); memcpy(&priv->sme_current, sme, sizeof(struct cfg80211_connect_params)); if (sme->channel) { priv->sme_current.channel = &priv->conn_chan; @@ -3227,7 +4346,7 @@ void woal_clear_conn_params(moal_private * priv) { ENTER(); - if (priv->sme_current.ie_len && priv->sme_current.ie) + if (priv->sme_current.ie_len) kfree(priv->sme_current.ie); memset(&priv->sme_current, 0, sizeof(struct cfg80211_connect_params)); priv->roaming_required = MFALSE; @@ -3452,12 +4571,17 @@ woal_cfg80211_init_wiphy(moal_private * priv, t_u8 wait_option) hw_dev_cap, cfg_11n->param.supported_mcs_set); /* For 2.4G band only card, this shouldn't be set */ - if (wiphy->bands[IEEE80211_BAND_5GHZ]) + if (wiphy->bands[IEEE80211_BAND_5GHZ]) { woal_cfg80211_setup_ht_cap(&wiphy->bands[IEEE80211_BAND_5GHZ]-> ht_cap, hw_dev_cap, cfg_11n->param.supported_mcs_set); - if (req) - kfree(req); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) + woal_cfg80211_setup_vht_cap(priv, + &wiphy->bands[IEEE80211_BAND_5GHZ]-> + vht_cap); +#endif + } + kfree(req); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38) || defined(COMPAT_WIRELESS) /* Get antenna modes */ @@ -3519,11 +4643,18 @@ woal_cfg80211_init_wiphy(moal_private * priv, t_u8 wait_option) if (frag_thr < MLAN_RTS_MIN_VALUE || frag_thr > MLAN_RTS_MAX_VALUE) frag_thr = MLAN_FRAG_RTS_DISABLED; wiphy->frag_threshold = (t_u32) frag_thr; +#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 0, 0) + /* Enable multi-channel by default if multi-channel is supported */ + if (cfg80211_iface_comb_ap_sta.num_different_channels > 1) { + t_u16 enable = 1; + ret = woal_mc_policy_cfg(priv, &enable, wait_option, + MLAN_ACT_SET); + } +#endif done: LEAVE(); - if (req) - kfree(req); + kfree(req); return ret; } @@ -3551,6 +4682,15 @@ woal_register_cfg80211(moal_private * priv) ret = MLAN_STATUS_FAILURE; goto err_wiphy; } +#ifdef CONFIG_PM +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) + wiphy->wowlan = &wowlan_support; +#else + wiphy->wowlan.flags = WIPHY_WOWLAN_ANY; +#endif +#endif +#endif wiphy->max_scan_ssids = MRVDRV_MAX_SSID_LIST_LENGTH; wiphy->max_scan_ie_len = MAX_IE_SIZE; wiphy->interface_modes = 0; @@ -3558,12 +4698,19 @@ woal_register_cfg80211(moal_private * priv) MBIT(NL80211_IFTYPE_STATION) | MBIT(NL80211_IFTYPE_ADHOC) | MBIT(NL80211_IFTYPE_AP); +#if defined(WIFI_DIRECT_SUPPORT) +#if LINUX_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION + wiphy->interface_modes |= MBIT(NL80211_IFTYPE_P2P_GO) | + MBIT(NL80211_IFTYPE_P2P_CLIENT); +#endif +#endif + /* Make this wiphy known to this driver only */ wiphy->privid = mrvl_wiphy_privid; + woal_request_get_fw_info(priv, MOAL_CMD_WAIT, &fw_info); + /* Supported bands */ wiphy->bands[IEEE80211_BAND_2GHZ] = &cfg80211_band_2ghz; - - woal_request_get_fw_info(priv, MOAL_CMD_WAIT, &fw_info); if (fw_info.fw_bands & BAND_A) { wiphy->bands[IEEE80211_BAND_5GHZ] = &cfg80211_band_5ghz; /** reduce scan time from 110ms to 80ms */ @@ -3574,12 +4721,19 @@ woal_register_cfg80211(moal_private * priv) woal_set_scan_time(priv, ACTIVE_SCAN_CHAN_TIME, PASSIVE_SCAN_CHAN_TIME, SPECIFIC_SCAN_CHAN_TIME); + woal_enable_ext_scan(priv, MTRUE); priv->phandle->band = IEEE80211_BAND_2GHZ; /* Initialize cipher suits */ wiphy->cipher_suites = cfg80211_cipher_suites; wiphy->n_cipher_suites = ARRAY_SIZE(cfg80211_cipher_suites); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) + /* Initialize interface combinations */ + wiphy->iface_combinations = &cfg80211_iface_comb_ap_sta; + wiphy->n_iface_combinations = 1; +#endif + memcpy(wiphy->perm_addr, priv->current_addr, ETH_ALEN); wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; @@ -3599,6 +4753,10 @@ woal_register_cfg80211(moal_private * priv) wiphy->max_sched_scan_ie_len = MAX_IE_SIZE; wiphy->max_match_sets = MRVDRV_MAX_SSID_LIST_LENGTH; #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0) || defined(COMPAT_WIRELESS) + wiphy->flags |= + WIPHY_FLAG_SUPPORTS_TDLS | WIPHY_FLAG_TDLS_EXTERNAL_SETUP; +#endif wiphy->reg_notifier = woal_cfg80211_reg_notifier; /* Set struct moal_handle pointer in wiphy_priv */ @@ -3620,6 +4778,14 @@ woal_register_cfg80211(moal_private * priv) ret = MLAN_STATUS_FAILURE; goto err_wiphy; } +#if defined(WIFI_DIRECT_SUPPORT) +#if LINUX_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION + if (!p2p_enh) + wiphy->interface_modes &= ~(MBIT(NL80211_IFTYPE_P2P_GO) | + MBIT(NL80211_IFTYPE_P2P_CLIENT)); +#endif +#endif + /** we will try driver parameter first */ if (reg_alpha2 && woal_is_valid_alpha2(reg_alpha2)) { PRINTM(MIOCTL, "Notify reg_alpha2 %c%c\n", reg_alpha2[0], diff --git a/drivers/net/wireless/sd8897/mlinux/moal_sta_cfg80211.h b/drivers/net/wireless/sd8897/mlinux/moal_sta_cfg80211.h index 284191331b8b..1571503be4ed 100644 --- a/drivers/net/wireless/sd8897/mlinux/moal_sta_cfg80211.h +++ b/drivers/net/wireless/sd8897/mlinux/moal_sta_cfg80211.h @@ -23,7 +23,7 @@ #define _MOAL_STA_CFG80211_H_ /** Convert RSSI signal strength from dBm to mBm (100*dBm) */ -#define RSSI_DBM_TO_MDM(x) ((x) * 100) +#define RSSI_DBM_TO_MDM(x) ((x) * 100) mlan_status woal_register_sta_cfg80211(struct net_device *dev, t_u8 bss_type); diff --git a/drivers/net/wireless/sd8897/mlinux/moal_uap.c b/drivers/net/wireless/sd8897/mlinux/moal_uap.c index 263363fe5544..27616df73b80 100644 --- a/drivers/net/wireless/sd8897/mlinux/moal_uap.c +++ b/drivers/net/wireless/sd8897/mlinux/moal_uap.c @@ -87,10 +87,10 @@ woal_uap_addba_param(struct net_device *dev, struct ifreq *req) cfg_11n->sub_command = MLAN_OID_11N_CFG_ADDBA_PARAM; ioctl_req->req_id = MLAN_IOCTL_11N_CFG; - if (!param.action) { + if (!param.action) /* Get addba param from MLAN */ ioctl_req->action = MLAN_ACT_GET; - } else { + else { /* Set addba param in MLAN */ ioctl_req->action = MLAN_ACT_SET; cfg_11n->param.addba_param.timeout = param.timeout; @@ -117,8 +117,7 @@ woal_uap_addba_param(struct net_device *dev, struct ifreq *req) goto done; } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -192,8 +191,7 @@ woal_uap_aggr_priotbl(struct net_device *dev, struct ifreq *req) goto done; } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -247,18 +245,16 @@ woal_uap_addba_reject(struct net_device *dev, struct ifreq *req) } else { /* Set addba_reject tbl in MLAN */ ioctl_req->action = MLAN_ACT_SET; - for (i = 0; i < MAX_NUM_TID; i++) { + for (i = 0; i < MAX_NUM_TID; i++) cfg_11n->param.addba_reject[i] = param.addba_reject[i]; - } } if (MLAN_STATUS_SUCCESS != woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT)) { ret = -EFAULT; goto done; } - for (i = 0; i < MAX_NUM_TID; i++) { + for (i = 0; i < MAX_NUM_TID; i++) param.addba_reject[i] = cfg_11n->param.addba_reject[i]; - } /* Copy to user */ if (copy_to_user(req->ifr_data, ¶m, sizeof(param))) { PRINTM(MERROR, "Copy to user failed!\n"); @@ -266,8 +262,7 @@ woal_uap_addba_reject(struct net_device *dev, struct ifreq *req) goto done; } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -392,8 +387,7 @@ woal_uap_deep_sleep(struct net_device *dev, struct ifreq *req) goto done; } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -465,8 +459,7 @@ woal_uap_txdatapause(struct net_device *dev, struct ifreq *req) goto done; } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -616,8 +609,8 @@ woal_uap_snmp_mib(struct net_device *dev, struct ifreq *req) snmp->sub_command = MLAN_OID_SNMP_MIB_DOT11H; break; default: - PRINTM(MERROR, "%s: Unsupported SNMP_MIB OID (%d).\n", - __FUNCTION__, param.oid); + PRINTM(MERROR, "%s: Unsupported SNMP_MIB OID (%d).\n", __func__, + param.oid); goto done; } @@ -652,8 +645,7 @@ woal_uap_snmp_mib(struct net_device *dev, struct ifreq *req) } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -762,8 +754,7 @@ woal_uap_domain_info(struct net_device *dev, struct ifreq *req) } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -854,8 +845,7 @@ woal_uap_dfs_testing(struct net_device *dev, struct ifreq *req) } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -893,13 +883,12 @@ woal_uap_tx_bf_cfg(struct net_device *dev, struct ifreq *req) ret = -EFAULT; goto done; } - if (!param.action) { + if (!param.action) /* Get BF configurations */ action = MLAN_ACT_GET; - } else { + else /* Set BF configurations */ action = MLAN_ACT_SET; - } if (copy_from_user(&bf_cfg, req->ifr_data + sizeof(tx_bf_cfg_para_hdr), sizeof(bf_cfg))) { PRINTM(MERROR, "Copy from user failed\n"); @@ -1092,11 +1081,10 @@ woal_uap_mgmt_frame_control(struct net_device *dev, struct ifreq *req) ret = -EFAULT; goto done; } - if (param.action) { + if (param.action) action = MLAN_ACT_SET; - } else { + else action = MLAN_ACT_GET; - } if (action == MLAN_ACT_SET) { /* Initialize the invalid values so that the correct values below are downloaded to firmware */ @@ -1208,8 +1196,7 @@ woal_uap_tx_rate_cfg(struct net_device *dev, struct ifreq *req) } } done: - if (mreq) - kfree(mreq); + kfree(mreq); LEAVE(); return ret; } @@ -1278,8 +1265,7 @@ woal_uap_antenna_cfg(struct net_device *dev, struct ifreq *req) } } done: - if (mreq) - kfree(mreq); + kfree(mreq); LEAVE(); return ret; } @@ -1427,8 +1413,7 @@ woal_uap_sta_deauth_ioctl(struct net_device *dev, struct ifreq *req) } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -1482,8 +1467,7 @@ woal_uap_radio_ctl(struct net_device *dev, struct ifreq *req) woal_request_ioctl(priv, mreq, MOAL_IOCTL_WAIT)) { ret = -EFAULT; } - if (mreq) - kfree(mreq); + kfree(mreq); } else { /* Get radio status */ memset(&bss_info, 0, sizeof(bss_info)); @@ -1627,8 +1611,7 @@ woal_uap_power_mode_ioctl(struct net_device *dev, struct ifreq *req) } } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -1679,11 +1662,10 @@ woal_uap_bss_cfg_ioctl(struct net_device *dev, struct ifreq *req) bss = (mlan_ds_bss *) ioctl_req->pbuf; bss->sub_command = MLAN_OID_UAP_BSS_CONFIG; ioctl_req->req_id = MLAN_IOCTL_BSS; - if (action == 1) { + if (action == 1) ioctl_req->action = MLAN_ACT_SET; - } else { + else ioctl_req->action = MLAN_ACT_GET; - } if (ioctl_req->action == MLAN_ACT_SET) { /* Get the BSS config from user */ @@ -1715,8 +1697,7 @@ woal_uap_bss_cfg_ioctl(struct net_device *dev, struct ifreq *req) } } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -1776,8 +1757,7 @@ woal_uap_get_sta_list_ioctl(struct net_device *dev, struct ifreq *req) } } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -1831,8 +1811,7 @@ woal_uap_set_wapi_key_ioctl(moal_private * priv, wapi_msg * msg) woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT)) ret = -EFAULT; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1895,8 +1874,7 @@ woal_enable_wapi(moal_private * priv, t_u8 enable) if (enable) woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT, UAP_BSS_START); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return status; } @@ -1966,8 +1944,7 @@ woal_uap_set_wapi_flag_ioctl(moal_private * priv, wapi_msg * msg) } woal_enable_wapi(priv, MTRUE); done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2067,9 +2044,8 @@ woal_uap_get_bss_param(moal_private * priv, mlan_uap_bss_param * sys_cfg, memcpy(sys_cfg, &info->param.bss_config, sizeof(mlan_uap_bss_param)); done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); - LEAVE(); return status; } @@ -2119,6 +2095,74 @@ done: return status; } +#define VHT_CAP_11AC_MASK 0x007fffff + +/** + * @brief enable/disable 11AC + * + * @param priv A pointer to moal_private structure + * @param action MLAN_ACT_DISABLE or MLAN_ACT_ENABLE + * + * @return 0--success, otherwise failure + */ +int +woal_uap_set_11ac_status(moal_private * priv, t_u8 action) +{ + + mlan_ioctl_req *req = NULL; + mlan_ds_11ac_cfg *cfg_11ac = NULL; + mlan_fw_info fw_info; + int ret = 0; + + ENTER(); + + woal_request_get_fw_info(priv, MOAL_IOCTL_WAIT, &fw_info); + + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11ac_cfg)); + if (req == NULL) { + ret = -ENOMEM; + goto done; + } + + cfg_11ac = (mlan_ds_11ac_cfg *) req->pbuf; + cfg_11ac->sub_command = MLAN_OID_11AC_VHT_CFG; + req->req_id = MLAN_IOCTL_11AC_CFG; + req->action = MLAN_ACT_SET; + + cfg_11ac->param.vht_cfg.band = BAND_SELECT_A; + cfg_11ac->param.vht_cfg.txrx = MLAN_RADIO_TXRX; + + cfg_11ac->param.vht_cfg.vht_cap_info = fw_info.hw_dot_11ac_dev_cap; + if (action == MLAN_ACT_DISABLE) { + cfg_11ac->param.vht_cfg.bwcfg = MFALSE; + cfg_11ac->param.vht_cfg.vht_cap_info &= ~VHT_CAP_11AC_MASK; + cfg_11ac->param.vht_cfg.vht_rx_mcs = + cfg_11ac->param.vht_cfg.vht_tx_mcs = 0xffff; + } else { + cfg_11ac->param.vht_cfg.bwcfg = MTRUE; + cfg_11ac->param.vht_cfg.vht_tx_mcs = + fw_info.hw_dot_11ac_mcs_support >> 16; + cfg_11ac->param.vht_cfg.vht_rx_mcs = + fw_info.hw_dot_11ac_mcs_support & 0xffff; + } + PRINTM(MCMND, + "Uap:11ac=%d vht_cap_info=0x%x, vht_tx_mcs=0x%x, vht_rx_mcs=0x%x\n", + action, cfg_11ac->param.vht_cfg.vht_cap_info, + cfg_11ac->param.vht_cfg.vht_tx_mcs, + cfg_11ac->param.vht_cfg.vht_rx_mcs); + + if (MLAN_STATUS_SUCCESS != + woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT)) { + ret = -EFAULT; + goto done; + } +done: + kfree(req); + LEAVE(); + return ret; + +} + /** * @brief Parse AP configuration from ASCII string * @@ -2189,8 +2233,9 @@ woal_uap_ap_cfg_parse_data(mlan_uap_bss_param * ap_cfg, char *buf) (int)ap_cfg->ssid.ssid_len); set_ssid = 1; } else { - PRINTM(MERROR, "AP_CFG: Invalid option %s, " - "expect SSID\n", opt); + PRINTM(MERROR, + "AP_CFG: Invalid option %s, expect SSID\n", + opt); ret = -EINVAL; goto done; } @@ -2389,8 +2434,8 @@ woal_uap_set_ap_cfg(moal_private * priv, t_u8 * data, int len) /* If the security mode is configured as WEP or WPA-PSK, it will disable 11n automatically, and if configured as open(off) or wpa2-psk, it will automatically enable 11n */ - if ((sys_config.protocol == PROTOCOL_STATIC_WEP) || - (sys_config.protocol == PROTOCOL_WPA)) { + if ((sys_config.protocol == PROTOCOL_STATIC_WEP) + || (sys_config.protocol == PROTOCOL_WPA)) { if (MLAN_STATUS_SUCCESS != woal_uap_set_11n_status(&sys_config, MLAN_ACT_DISABLE)) { ret = -EFAULT; @@ -2491,9 +2536,7 @@ woal_uap_bss_ctrl(moal_private * priv, t_u8 wait_option, int data) woal_flush_tcp_sess_queue(priv); } done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -2515,11 +2558,11 @@ woal_uap_set_multicast_list(struct net_device *dev) /** * @brief ioctl function - entry point * - * @param dev A pointer to net_device structure - * @param req A pointer to ifreq structure - * @param cmd Command + * @param dev A pointer to net_device structure + * @param req A pointer to ifreq structure + * @param cmd Command * - * @return 0 --success, otherwise fail + * @return 0 --success, otherwise fail */ int woal_uap_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) @@ -2582,11 +2625,11 @@ woal_uap_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) /** * @brief Get version * - * @param priv A pointer to moal_private structure - * @param version A pointer to version buffer - * @param max_len max length of version buffer + * @param priv A pointer to moal_private structure + * @param version A pointer to version buffer + * @param max_len max length of version buffer * - * @return N/A + * @return N/A */ void woal_uap_get_version(moal_private * priv, char *version, int max_len) @@ -2616,9 +2659,8 @@ woal_uap_get_version(moal_private * priv, char *version, int max_len) info->param.ver_ext.version_str); } - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); - LEAVE(); return; } @@ -2627,7 +2669,7 @@ woal_uap_get_version(moal_private * priv, char *version, int max_len) /** * @brief Get uap statistics * - * @param priv A pointer to moal_private structure + * @param priv A pointer to moal_private structure * @param wait_option Wait option * @param ustats A pointer to mlan_ds_uap_stats structure * @@ -2668,9 +2710,8 @@ woal_uap_get_stats(moal_private * priv, t_u8 wait_option, #endif } - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); - LEAVE(); return status; } @@ -2678,7 +2719,7 @@ woal_uap_get_stats(moal_private * priv, t_u8 wait_option, /** * @brief Set/Get system configuration parameters * - * @param priv A pointer to moal_private structure + * @param priv A pointer to moal_private structure * @param action MLAN_ACT_SET or MLAN_ACT_GET * @param wait_option Wait option * @param sys_cfg A pointer to mlan_uap_bss_param structure @@ -2722,9 +2763,7 @@ woal_set_get_sys_config(moal_private * priv, t_u16 action, t_u8 wait_option, } done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } diff --git a/drivers/net/wireless/sd8897/mlinux/moal_uap.h b/drivers/net/wireless/sd8897/mlinux/moal_uap.h index 333355c37e6e..c4d6b4942959 100644 --- a/drivers/net/wireless/sd8897/mlinux/moal_uap.h +++ b/drivers/net/wireless/sd8897/mlinux/moal_uap.h @@ -386,6 +386,7 @@ mlan_status woal_set_get_sys_config(moal_private * priv, t_u16 action, t_u8 wait_option, mlan_uap_bss_param * sys_cfg); int woal_uap_set_ap_cfg(moal_private * priv, t_u8 * data, int len); +int woal_uap_set_11ac_status(moal_private * priv, t_u8 action); mlan_status woal_uap_set_11n_status(mlan_uap_bss_param * sys_cfg, t_u8 action); #ifdef UAP_WEXT void woal_ioctl_get_uap_info_resp(moal_private * priv, mlan_ds_get_info * info); diff --git a/drivers/net/wireless/sd8897/mlinux/moal_uap_cfg80211.c b/drivers/net/wireless/sd8897/mlinux/moal_uap_cfg80211.c index 8ece9563df28..9ee6bd3d7002 100644 --- a/drivers/net/wireless/sd8897/mlinux/moal_uap_cfg80211.c +++ b/drivers/net/wireless/sd8897/mlinux/moal_uap_cfg80211.c @@ -21,6 +21,12 @@ #include "moal_cfg80211.h" #include "moal_uap_cfg80211.h" +/** secondary channel is below */ +#define SECOND_CHANNEL_BELOW 0x30 +/** secondary channel is above */ +#define SECOND_CHANNEL_ABOVE 0x10 +/** no secondary channel */ +#define SECONDARY_CHANNEL_NONE 0x00 /******************************************************** Local Variables ********************************************************/ @@ -51,6 +57,7 @@ woal_deauth_station(moal_private * priv, u8 * mac_addr) mlan_ioctl_req *ioctl_req = NULL; mlan_ds_bss *bss = NULL; int ret = 0; + mlan_status status; ENTER(); @@ -68,15 +75,14 @@ woal_deauth_station(moal_private * priv, u8 * mac_addr) MLAN_MAC_ADDR_LENGTH); #define REASON_CODE_DEAUTH_LEAVING 3 bss->param.deauth_param.reason_code = REASON_CODE_DEAUTH_LEAVING; - if (MLAN_STATUS_SUCCESS != - woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT)) { + status = woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { ret = -EFAULT; goto done; } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } @@ -96,6 +102,7 @@ woal_deauth_all_station(moal_private * priv) int i = 0; mlan_ds_get_info *info = NULL; mlan_ioctl_req *ioctl_req = NULL; + mlan_status status; ENTER(); if (priv->media_connected == MFALSE) { @@ -118,10 +125,9 @@ woal_deauth_all_station(moal_private * priv) ioctl_req->req_id = MLAN_IOCTL_GET_INFO; ioctl_req->action = MLAN_ACT_GET; - if (MLAN_STATUS_SUCCESS != - woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT)) { + status = woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) goto done; - } if (!info->param.sta_list.sta_count) goto done; for (i = 0; i < info->param.sta_list.sta_count; i++) { @@ -133,8 +139,7 @@ woal_deauth_all_station(moal_private * priv) } woal_sched_timeout(200); done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); return ret; } @@ -308,8 +313,8 @@ woal_find_wpa_ies(const t_u8 * ie, int len, mlan_uap_bss_param * sys_config) element_len = *((t_u8 *) pcurrent_ptr + 1); total_ie_len = element_len + sizeof(IEEEtypes_Header_t); if (bytes_left < total_ie_len) { - PRINTM(MERROR, "InterpretIE: Error in processing IE, " - "bytes left < IE length\n"); + PRINTM(MERROR, + "InterpretIE: Error in processing IE, bytes left < IE length\n"); bytes_left = 0; continue; } @@ -350,17 +355,11 @@ woal_find_wpa_ies(const t_u8 * ie, int len, mlan_uap_bss_param * sys_config) return ret; } -/** secondary channel is below */ -#define SECOND_CHANNEL_BELOW 0x30 -/** secondary channel is above */ -#define SECOND_CHANNEL_ABOVE 0x10 -/** no secondary channel */ -#define SECONDARY_CHANNEL_NONE 0x00 - +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0) || defined(WIFI_DIRECT_SUPPORT) /** * @brief Get second channel offset * - * @param chan channel num + * @param chan channel num * @return second channel offset */ static t_u8 @@ -404,6 +403,42 @@ woal_get_second_channel_offset(int chan) } return chan2Offset; } +#endif + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) +/** + * @brief initialize AP or GO bss config + * @param priv A pointer to moal private structure + * @param params A pointer to cfg80211_ap_settings structure + * @return 0 -- success, otherwise fail + */ +t_u8 +woal_check_11ac_capability(moal_private * priv, + struct cfg80211_ap_settings * params) +{ + mlan_fw_info fw_info; + t_u8 enable_11ac = MFALSE; + ENTER(); + woal_request_get_fw_info(priv, MOAL_IOCTL_WAIT, &fw_info); + switch (params->chandef.width) { + case NL80211_CHAN_WIDTH_80: + enable_11ac = MTRUE; + break; + case NL80211_CHAN_WIDTH_80P80: + if (fw_info.hw_dot_11ac_dev_cap & MBIT(3)) + enable_11ac = MTRUE; + break; + case NL80211_CHAN_WIDTH_160: + if (fw_info.hw_dot_11ac_dev_cap & MBIT(2)) + enable_11ac = MTRUE; + break; + default: + break; + } + LEAVE(); + return enable_11ac; +} +#endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) /** @@ -434,21 +469,23 @@ woal_cfg80211_beacon_config(moal_private * priv, #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) || defined(COMPAT_WIRELESS) int i = 0; #else + t_u8 wpa_ies; const t_u8 *ssid_ie = NULL; struct ieee80211_mgmt *head = NULL; t_u16 capab_info = 0; #endif - t_u8 Rates_BG[13] = + t_u8 rates_bg[13] = { 0x82, 0x84, 0x8b, 0x96, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6c, 0 }; - t_u8 Rates_A[9] = { 0x8c, 0x12, 0x98, 0x24, 0xb0, 0x48, 0x60, 0x6c, 0 }; - t_u8 chan2Offset = 0; + t_u8 rates_a[9] = { 0x8c, 0x12, 0x98, 0x24, 0xb0, 0x48, 0x60, 0x6c, 0 }; #ifdef WIFI_DIRECT_SUPPORT - t_u8 Rates_WFD[9] = + t_u8 rates_wfd[9] = { 0x8c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6c, 0 }; #endif - + t_u8 chan2Offset = 0; + t_u8 enable_11n = MTRUE; + t_u8 enable_11ac = MFALSE; ENTER(); if (params == NULL) { @@ -494,35 +531,103 @@ woal_cfg80211_beacon_config(moal_private * priv, } if (priv->channel) { memset(sys_config.rates, 0, sizeof(sys_config.rates)); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) + switch (params->chandef.width) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) + case NL80211_CHAN_WIDTH_5: + case NL80211_CHAN_WIDTH_10: +#endif + case NL80211_CHAN_WIDTH_20_NOHT: + enable_11n = MFALSE; + break; + case NL80211_CHAN_WIDTH_20: + break; + case NL80211_CHAN_WIDTH_40: + case NL80211_CHAN_WIDTH_80: + case NL80211_CHAN_WIDTH_80P80: + case NL80211_CHAN_WIDTH_160: + if (params->chandef.center_freq1 < + params->chandef.chan->center_freq) + chan2Offset = SECOND_CHANNEL_BELOW; + else + chan2Offset = SECOND_CHANNEL_ABOVE; + break; + default: + PRINTM(MWARN, "Unknown channel width: %d\n", + params->chandef.width); + break; + } +#else + switch (params->channel_type) { + case NL80211_CHAN_NO_HT: + enable_11n = MFALSE; + break; + case NL80211_CHAN_HT20: + break; + case NL80211_CHAN_HT40PLUS: + chan2Offset = SECOND_CHANNEL_ABOVE; + break; + case NL80211_CHAN_HT40MINUS: + chan2Offset = SECOND_CHANNEL_BELOW; + break; + default: + PRINTM(MWARN, "Unknown channel type: %d\n", + params->channel_type); + break; + } +#endif +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) */ sys_config.channel = priv->channel; if (priv->channel <= MAX_BG_CHANNEL) { sys_config.band_cfg = BAND_CONFIG_2G; #ifdef WIFI_DIRECT_SUPPORT if (priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT) - memcpy(sys_config.rates, Rates_WFD, - sizeof(Rates_WFD)); + memcpy(sys_config.rates, rates_wfd, + sizeof(rates_wfd)); else #endif - memcpy(sys_config.rates, Rates_BG, - sizeof(Rates_BG)); + memcpy(sys_config.rates, rates_bg, + sizeof(rates_bg)); } else { sys_config.band_cfg = BAND_CONFIG_5G; +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0) chan2Offset = woal_get_second_channel_offset(priv->channel); - if (chan2Offset) { - sys_config.band_cfg |= chan2Offset; - sys_config.ht_cap_info = 0x117e; - sys_config.ampdu_param = 3; - } +#else +#ifdef WIFI_DIRECT_SUPPORT + /* Force enable 40MHZ on WFD interface */ + if (priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT) + chan2Offset = + woal_get_second_channel_offset(priv-> + channel); +#endif +#endif + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) + enable_11ac = woal_check_11ac_capability(priv, params); +#else + enable_11ac = MTRUE; +#endif #ifdef WIFI_DIRECT_SUPPORT if (priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT) - memcpy(sys_config.rates, Rates_WFD, - sizeof(Rates_WFD)); + memcpy(sys_config.rates, rates_wfd, + sizeof(rates_wfd)); else #endif - memcpy(sys_config.rates, Rates_A, - sizeof(Rates_A)); + memcpy(sys_config.rates, rates_a, + sizeof(rates_a)); } + sys_config.ht_cap_info = 0x111c; + if (chan2Offset) { + sys_config.band_cfg |= chan2Offset; + sys_config.ht_cap_info |= 0x72; + sys_config.ampdu_param = 3; + } + PRINTM(MCMND, + "11n=%d, ht_cap=0x%x, channel=%d, band_cfg=0x%x\n", + enable_11n, sys_config.ht_cap_info, priv->channel, + sys_config.band_cfg); } #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) || defined(COMPAT_WIRELESS) if (!params->ssid || !params->ssid_len) { @@ -639,14 +744,9 @@ woal_cfg80211_beacon_config(moal_private * priv, fixed element length for beacon */ #define BEACON_IE_OFFSET 36 /* Find SSID in head SSID IE id: 0, right now use hard code */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) - ssid_ie = woal_parse_ie_tlv(params->beacon.head + BEACON_IE_OFFSET, - params->beacon.head_len - BEACON_IE_OFFSET, - 0); -#else ssid_ie = woal_parse_ie_tlv(params->head + BEACON_IE_OFFSET, params->head_len - BEACON_IE_OFFSET, 0); -#endif + if (!ssid_ie) { PRINTM(MERROR, "No ssid IE found.\n"); ret = -EFAULT; @@ -659,11 +759,8 @@ woal_cfg80211_beacon_config(moal_private * priv, } memcpy(sys_config.ssid.ssid, ssid_ie + 2, *(ssid_ie + 1)); sys_config.ssid.ssid_len = *(ssid_ie + 1); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) - head = (struct ieee80211_mgmt *)params->beacon.head; -#else head = (struct ieee80211_mgmt *)params->head; -#endif + capab_info = le16_to_cpu(head->u.beacon.capab_info); PRINTM(MIOCTL, "capab_info=0x%x\n", head->u.beacon.capab_info); sys_config.auth_mode = MLAN_AUTH_MODE_OPEN; @@ -673,25 +770,22 @@ woal_cfg80211_beacon_config(moal_private * priv, sys_config.protocol = PROTOCOL_STATIC_WEP; sys_config.key_mgmt = KEY_MGMT_NONE; sys_config.wpa_cfg.length = 0; - sys_config.wep_cfg.key0.key_index = priv->key_index; - sys_config.wep_cfg.key0.is_default = 1; - sys_config.wep_cfg.key0.length = priv->key_len; - memcpy(sys_config.wep_cfg.key0.key, priv->key_material, - priv->key_len); + memcpy(&sys_config.wep_cfg.key0, &priv->uap_wep_key[0], + sizeof(wep_key)); + memcpy(&sys_config.wep_cfg.key1, &priv->uap_wep_key[1], + sizeof(wep_key)); + memcpy(&sys_config.wep_cfg.key2, &priv->uap_wep_key[2], + sizeof(wep_key)); + memcpy(&sys_config.wep_cfg.key3, &priv->uap_wep_key[3], + sizeof(wep_key)); } else { /** Get cipher and key_mgmt from RSN/WPA IE */ if (capab_info & WLAN_CAPABILITY_PRIVACY) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) - if (MFALSE == - woal_find_wpa_ies(params->beacon.tail, - (int)params->beacon.tail_len, - &sys_config)) -#else - if (MFALSE == - woal_find_wpa_ies(params->tail, params->tail_len, - &sys_config)) -#endif - { + wpa_ies = + woal_find_wpa_ies(params->tail, + params->tail_len, + &sys_config); + if (wpa_ies == MFALSE) { /* hard code setting to wpa2-psk */ sys_config.protocol = PROTOCOL_WPA2; sys_config.key_mgmt = KEY_MGMT_PSK; @@ -708,9 +802,17 @@ woal_cfg80211_beacon_config(moal_private * priv, wpa2-psk, it will automatically enable 11n */ if ((sys_config.protocol == PROTOCOL_STATIC_WEP) || (sys_config.protocol == PROTOCOL_WPA)) + enable_11n = MFALSE; + if (!enable_11n) woal_uap_set_11n_status(&sys_config, MLAN_ACT_DISABLE); else woal_uap_set_11n_status(&sys_config, MLAN_ACT_ENABLE); + if (sys_config.band_cfg & BAND_CONFIG_5G) { + if (enable_11ac && chan2Offset && enable_11n) + woal_uap_set_11ac_status(priv, MLAN_ACT_ENABLE); + else + woal_uap_set_11ac_status(priv, MLAN_ACT_DISABLE); + } if (MLAN_STATUS_SUCCESS != woal_set_get_sys_config(priv, MLAN_ACT_SET, MOAL_IOCTL_WAIT, @@ -727,7 +829,7 @@ done: #if LINUX_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION /** * @brief Callback function for virtual interface - * setup + * setup * * @param dev A pointer to structure net_device * @@ -952,7 +1054,7 @@ woal_bss_remove(moal_private * priv) status = woal_request_ioctl(priv, req, MOAL_CMD_WAIT); done: - if (req && (status != MLAN_STATUS_PENDING)) + if (status != MLAN_STATUS_PENDING) kfree(req); LEAVE(); return status; @@ -1182,7 +1284,7 @@ woal_cfg80211_add_virtual_intf(struct wiphy *wiphy, #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0) #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 37) || defined(COMPAT_WIRELESS) if (ret) - return NULL; + return ERR_PTR(ret); else return ndev; #else @@ -1190,7 +1292,7 @@ woal_cfg80211_add_virtual_intf(struct wiphy *wiphy, #endif #else if (ret) - return NULL; + return ERR_PTR(ret); else return ndev->ieee80211_ptr; #endif @@ -1297,96 +1399,61 @@ woal_cfg80211_add_beacon(struct wiphy *wiphy, } /* set mgmt frame ies */ - if (MLAN_STATUS_SUCCESS != woal_cfg80211_mgmt_frame_ie(priv, + ret = woal_cfg80211_mgmt_frame_ie(priv, #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0) && !defined(COMPAT_WIRELESS) - params-> - tail, - params-> - tail_len, - NULL, 0, - NULL, 0, - NULL, 0, - MGMT_MASK_BEACON + params->tail, + params->tail_len, NULL, 0, + NULL, 0, NULL, 0, + MGMT_MASK_BEACON #else #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) - params-> - beacon. - tail, - params-> - beacon. - tail_len, - params-> - beacon. - proberesp_ies, - params-> - beacon. - proberesp_ies_len, - params-> - beacon. - assocresp_ies, - params-> - beacon. - assocresp_ies_len, + params->beacon.tail, + params->beacon.tail_len, + params->beacon.proberesp_ies, + params->beacon. + proberesp_ies_len, + params->beacon.assocresp_ies, + params->beacon. + assocresp_ies_len, #else - params-> - tail, - params-> - tail_len, - params-> - proberesp_ies, - params-> - proberesp_ies_len, - params-> - assocresp_ies, - params-> - assocresp_ies_len, + params->tail, + params->tail_len, + params->proberesp_ies, + params->proberesp_ies_len, + params->assocresp_ies, + params->assocresp_ies_len, #endif - NULL, 0, - MGMT_MASK_BEACON - | - MGMT_MASK_PROBE_RESP - | - MGMT_MASK_ASSOC_RESP + NULL, 0, + MGMT_MASK_BEACON | + MGMT_MASK_PROBE_RESP | + MGMT_MASK_ASSOC_RESP #endif - )) { - ret = -EFAULT; + ); + if (ret) goto done; - } } #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) || defined(COMPAT_WIRELESS) #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) if (params->beacon.beacon_ies && params->beacon.beacon_ies_len) { - if (MLAN_STATUS_SUCCESS != woal_cfg80211_mgmt_frame_ie(priv, - params-> - beacon. - beacon_ies, - params-> - beacon. - beacon_ies_len, - NULL, 0, - NULL, 0, - NULL, 0, - MGMT_MASK_BEACON_WPS_P2P)) - { + ret = woal_cfg80211_mgmt_frame_ie(priv, + params->beacon.beacon_ies, + params->beacon.beacon_ies_len, + NULL, 0, NULL, 0, NULL, 0, + MGMT_MASK_BEACON_WPS_P2P); + if (ret) { PRINTM(MERROR, "Failed to set beacon wps/p2p ie\n"); - ret = -EFAULT; goto done; } } #else if (params->beacon_ies && params->beacon_ies_len) { - if (MLAN_STATUS_SUCCESS != woal_cfg80211_mgmt_frame_ie(priv, - params-> - beacon_ies, - params-> - beacon_ies_len, - NULL, 0, - NULL, 0, - NULL, 0, - MGMT_MASK_BEACON_WPS_P2P)) - { + ret = woal_cfg80211_mgmt_frame_ie(priv, + params->beacon_ies, + params->beacon_ies_len, NULL, + 0, NULL, 0, NULL, 0, + MGMT_MASK_BEACON_WPS_P2P); + if (ret) { PRINTM(MERROR, "Failed to set beacon wps/p2p ie\n"); - ret = -EFAULT; goto done; } } @@ -1445,65 +1512,58 @@ woal_cfg80211_set_beacon(struct wiphy *wiphy, if (params != NULL) { #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0) && !defined(COMPAT_WIRELESS) if (params->tail && params->tail_len) { - if (MLAN_STATUS_SUCCESS != - woal_cfg80211_mgmt_frame_ie(priv, - params->tail, - params->tail_len, NULL, - 0, NULL, 0, NULL, 0, - MGMT_MASK_BEACON)) { - ret = -EFAULT; + ret = woal_cfg80211_mgmt_frame_ie(priv, + params->tail, + params->tail_len, + NULL, 0, NULL, 0, + NULL, 0, + MGMT_MASK_BEACON); + if (ret) goto done; - } } #else if (params->tail && params->tail_len) { - if (MLAN_STATUS_SUCCESS != - woal_cfg80211_mgmt_frame_ie(priv, params->tail, - params->tail_len, NULL, - 0, NULL, 0, NULL, 0, - MGMT_MASK_BEACON)) { - ret = -EFAULT; + ret = woal_cfg80211_mgmt_frame_ie(priv, params->tail, + params->tail_len, + NULL, 0, NULL, 0, + NULL, 0, + MGMT_MASK_BEACON); + if (ret) goto done; - } } if (params->beacon_ies && params->beacon_ies_len) { - if (MLAN_STATUS_SUCCESS != - woal_cfg80211_mgmt_frame_ie(priv, - params->beacon_ies, - params->beacon_ies_len, - NULL, 0, NULL, 0, NULL, - 0, - MGMT_MASK_BEACON_WPS_P2P)) - { + ret = woal_cfg80211_mgmt_frame_ie(priv, + params->beacon_ies, + params-> + beacon_ies_len, NULL, + 0, NULL, 0, NULL, 0, + MGMT_MASK_BEACON_WPS_P2P); + if (ret) { PRINTM(MERROR, "Failed to set beacon wps/p2p ie\n"); - ret = -EFAULT; goto done; } } if (params->proberesp_ies && params->proberesp_ies_len) { - if (MLAN_STATUS_SUCCESS != - woal_cfg80211_mgmt_frame_ie(priv, NULL, 0, - params->proberesp_ies, - params-> - proberesp_ies_len, NULL, - 0, NULL, 0, - MGMT_MASK_PROBE_RESP)) { - ret = -EFAULT; + ret = woal_cfg80211_mgmt_frame_ie(priv, NULL, 0, + params->proberesp_ies, + params-> + proberesp_ies_len, + NULL, 0, NULL, 0, + MGMT_MASK_PROBE_RESP); + if (ret) goto done; - } } if (params->assocresp_ies && params->assocresp_ies_len) { - if (MLAN_STATUS_SUCCESS != - woal_cfg80211_mgmt_frame_ie(priv, NULL, 0, NULL, 0, - params->assocresp_ies, - params-> - assocresp_ies_len, NULL, - 0, - MGMT_MASK_ASSOC_RESP)) { - ret = -EFAULT; + ret = woal_cfg80211_mgmt_frame_ie(priv, NULL, 0, NULL, + 0, + params->assocresp_ies, + params-> + assocresp_ies_len, + NULL, 0, + MGMT_MASK_ASSOC_RESP); + if (ret) goto done; - } } #endif } @@ -1585,8 +1645,8 @@ done: * @return 0 -- success, otherwise fail */ int -woal_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev, - u8 * mac_addr) +woal_cfg80211_del_station(struct wiphy *wiphy, + struct net_device *dev, u8 * mac_addr) { moal_private *priv = (moal_private *) woal_get_netdev_priv(dev); ENTER(); @@ -1631,6 +1691,7 @@ woal_uap_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, int i = 0; mlan_ds_get_info *info = NULL; mlan_ioctl_req *ioctl_req = NULL; + mlan_status status; ENTER(); if (priv->media_connected == MFALSE) { @@ -1653,10 +1714,9 @@ woal_uap_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, ioctl_req->req_id = MLAN_IOCTL_GET_INFO; ioctl_req->action = MLAN_ACT_GET; - if (MLAN_STATUS_SUCCESS != - woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT)) { + status = woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) goto done; - } for (i = 0; i < info->param.sta_list.sta_count; i++) { if (!memcmp (info->param.sta_list.info[i].mac_address, mac, ETH_ALEN)) { @@ -1673,8 +1733,7 @@ woal_uap_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, } } done: - if (ioctl_req) - kfree(ioctl_req); + kfree(ioctl_req); LEAVE(); return ret; } diff --git a/drivers/net/wireless/sd8897/mlinux/moal_uap_priv.c b/drivers/net/wireless/sd8897/mlinux/moal_uap_priv.c index 71df785e9e28..9b91d16448f8 100644 --- a/drivers/net/wireless/sd8897/mlinux/moal_uap_priv.c +++ b/drivers/net/wireless/sd8897/mlinux/moal_uap_priv.c @@ -47,9 +47,9 @@ Change log: /** * @brief ioctl function for wireless IOCTLs * - * @param dev A pointer to net_device structure - * @param req A pointer to ifreq structure - * @param cmd Command + * @param dev A pointer to net_device structure + * @param req A pointer to ifreq structure + * @param cmd Command * * @return 0 --success, otherwise fail */ @@ -156,10 +156,10 @@ woal_uap_do_priv_ioctl(struct net_device *dev, struct ifreq *req, int cmd) /** * @brief Handle get info resp * - * @param priv Pointer to moal_private structure - * @param info Pointer to mlan_ds_get_info structure + * @param priv Pointer to moal_private structure + * @param info Pointer to mlan_ds_get_info structure * - * @return N/A + * @return N/A */ void woal_ioctl_get_uap_info_resp(moal_private * priv, mlan_ds_get_info * info) diff --git a/drivers/net/wireless/sd8897/mlinux/moal_uap_wext.c b/drivers/net/wireless/sd8897/mlinux/moal_uap_wext.c index 84fadfc2557c..7f5d0e931b90 100644 --- a/drivers/net/wireless/sd8897/mlinux/moal_uap_wext.c +++ b/drivers/net/wireless/sd8897/mlinux/moal_uap_wext.c @@ -219,11 +219,10 @@ woal_get_wap(struct net_device *dev, struct iw_request_info *info, ENTER(); - if (priv->bss_started) { + if (priv->bss_started) memcpy(awrq->sa_data, priv->current_addr, MLAN_MAC_ADDR_LENGTH); - } else { + else memset(awrq->sa_data, 0, MLAN_MAC_ADDR_LENGTH); - } awrq->sa_family = ARPHRD_ETHER; LEAVE(); @@ -358,10 +357,8 @@ woal_set_freq(struct net_device *dev, struct iw_request_info *info, } done: - if (sys_cfg) - kfree(sys_cfg); - if (ap_cfg) - kfree(ap_cfg); + kfree(sys_cfg); + kfree(ap_cfg); LEAVE(); return ret; } @@ -395,10 +392,11 @@ woal_get_freq(struct net_device *dev, struct iw_request_info *info, LEAVE(); return -EFAULT; } + band = ap_cfg.band_cfg & BAND_CONFIG_5GHZ; + fwrq->m = (long)channel_to_frequency(ap_cfg.channel, band); fwrq->i = (long)ap_cfg.channel; - fwrq->m = (long)(channel_to_frequency(ap_cfg.channel, band)) * 100000; - fwrq->e = 1; + fwrq->e = 6; LEAVE(); return ret; @@ -628,10 +626,8 @@ woal_set_encode(struct net_device *dev, struct iw_request_info *info, } done: - if (sys_cfg) - kfree(sys_cfg); - if (ap_cfg) - kfree(ap_cfg); + kfree(sys_cfg); + kfree(ap_cfg); LEAVE(); return ret; } @@ -1005,8 +1001,7 @@ woal_set_encode_ext(struct net_device *dev, } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1060,8 +1055,9 @@ woal_set_mlme(struct net_device *dev, memset(sta_addr, 0, ETH_ALEN); if ((mlme->cmd == IW_MLME_DEAUTH) || (mlme->cmd == IW_MLME_DISASSOC)) { memcpy(sta_addr, (t_u8 *) mlme->addr.sa_data, ETH_ALEN); - PRINTM(MIOCTL, "Deauth station: " MACSTR ", " - "reason=%d\n", MAC2STR(sta_addr), mlme->reason_code); + PRINTM(MIOCTL, + "Deauth station: " MACSTR ", reason=%d\n", + MAC2STR(sta_addr), mlme->reason_code); /* FIXME: For flushing all stations we need to use zero MAC, but right now the FW does not support this. So, manually @@ -1094,10 +1090,8 @@ woal_set_mlme(struct net_device *dev, } memcpy(sta_list, &pinfo->param.sta_list, sizeof(mlan_ds_sta_list)); - if (req) { - kfree(req); - req = NULL; - } + kfree(req); + req = NULL; } req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_bss)); if (req == NULL) { @@ -1137,11 +1131,8 @@ woal_set_mlme(struct net_device *dev, } done: - if (req) - kfree(req); - if (sta_list) - kfree(sta_list); - + kfree(req); + kfree(sta_list); LEAVE(); return ret; } diff --git a/drivers/net/wireless/sd8897/mlinux/moal_wext.c b/drivers/net/wireless/sd8897/mlinux/moal_wext.c index 56e759eec9c0..348dc794af08 100644 --- a/drivers/net/wireless/sd8897/mlinux/moal_wext.c +++ b/drivers/net/wireless/sd8897/mlinux/moal_wext.c @@ -283,8 +283,7 @@ woal_set_freq(struct net_device *dev, struct iw_request_info *info, ret = -EFAULT; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -329,9 +328,7 @@ woal_get_freq(struct net_device *dev, struct iw_request_info *info, fwrq->e = 6; fwrq->flags = IW_FREQ_FIXED; done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -389,8 +386,7 @@ woal_set_bss_mode(struct net_device *dev, struct iw_request_info *info, goto done; } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -419,11 +415,10 @@ woal_get_wap(struct net_device *dev, struct iw_request_info *info, woal_get_bss_info(priv, MOAL_IOCTL_WAIT, &bss_info); - if (bss_info.media_connected == MTRUE) { + if (bss_info.media_connected == MTRUE) memcpy(awrq->sa_data, &bss_info.bssid, MLAN_MAC_ADDR_LENGTH); - } else { + else memset(awrq->sa_data, 0, MLAN_MAC_ADDR_LENGTH); - } awrq->sa_family = ARPHRD_ETHER; LEAVE(); @@ -954,9 +949,7 @@ woal_set_encode(struct net_device *dev, struct iw_request_info *info, ret = -EFAULT; } done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -1050,9 +1043,7 @@ woal_get_encode(struct net_device *dev, struct iw_request_info *info, dwrq->flags |= IW_ENCODE_NOKEY; done: - if (req) - kfree(req); - + kfree(req); LEAVE(); return ret; } @@ -1373,8 +1364,7 @@ woal_set_gen_ie(struct net_device *dev, struct iw_request_info *info, } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; @@ -1428,10 +1418,6 @@ woal_set_encode_ext(struct net_device *dev, ETH_ALEN); /* Disable and Remove Key */ if ((dwrq->flags & IW_ENCODE_DISABLED) && !ext->key_len) { - if ((key_index <= 5) && (key_index > 3)) { - ret = MLAN_STATUS_SUCCESS; - goto done; - } sec->param.encrypt_key.key_remove = MTRUE; sec->param.encrypt_key.key_index = key_index; sec->param.encrypt_key.key_flags = KEY_FLAG_REMOVE_KEY; @@ -1471,7 +1457,7 @@ woal_set_encode_ext(struct net_device *dev, sec->param.encrypt_key.key_flags, MAC2STR(sec->param.encrypt_key.mac_addr)); DBG_HEXDUMP(MCMD_D, "wpa key", pkey_material, ext->key_len); -#define IW_ENCODE_ALG_AES_CMAC 5 +#define IW_ENCODE_ALG_AES_CMAC 5 if (ext->alg == IW_ENCODE_ALG_AES_CMAC) sec->param.encrypt_key.key_flags |= KEY_FLAG_AES_MCAST_IGTK; @@ -1491,8 +1477,7 @@ woal_set_encode_ext(struct net_device *dev, woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT)) ret = -EFAULT; done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -1959,8 +1944,7 @@ woal_set_rxfilter(moal_private * priv, BOOLEAN enable) } done: - if (req) - kfree(req); + kfree(req); LEAVE(); return ret; } @@ -2206,12 +2190,10 @@ woal_set_priv(struct net_device *dev, struct iw_request_info *info, } PRINTM(MIOCTL, "PRIV Command return: %s, length=%d\n", buf, len); dwrq->length = (t_u16) len; - if (copy_to_user(dwrq->pointer, buf, dwrq->length)) { + if (copy_to_user(dwrq->pointer, buf, dwrq->length)) ret = -EFAULT; - } done: - if (buf) - kfree(buf); + kfree(buf); LEAVE(); return ret; } @@ -2565,9 +2547,8 @@ woal_get_scan(struct net_device *dev, struct iw_request_info *info, scan_table = (BSSDescriptor_t *) scan_resp.pscan_table; if (dwrq->length) end_buf = extra + dwrq->length; - if (priv->media_connected == MTRUE) { + if (priv->media_connected == MTRUE) PRINTM(MINFO, "Current Ssid: %-32s\n", bss_info.ssid.ssid); - } PRINTM(MINFO, "Scan: Get: NumInScanTable = %d\n", (int)scan_resp.num_in_scan_table); @@ -2594,9 +2575,8 @@ woal_get_scan(struct net_device *dev, struct iw_request_info *info, /* check ssid is valid or not, ex. hidden ssid will be filter out */ - if (woal_ssid_valid(&scan_table[i].ssid) == MFALSE) { + if (woal_ssid_valid(&scan_table[i].ssid) == MFALSE) continue; - } /* First entry *MUST* be the AP MAC address */ iwe.cmd = SIOCGIWAP; @@ -2612,9 +2592,8 @@ woal_get_scan(struct net_device *dev, struct iw_request_info *info, /* Add the ESSID */ iwe.u.data.length = scan_table[i].ssid.ssid_len; - if (iwe.u.data.length > 32) { + if (iwe.u.data.length > 32) iwe.u.data.length = 32; - } iwe.cmd = SIOCGIWESSID; iwe.u.essid.flags = (i + 1) & IW_ENCODE_INDEX; @@ -2651,11 +2630,11 @@ woal_get_scan(struct net_device *dev, struct iw_request_info *info, /* Add quality statistics */ iwe.cmd = IWEVQUAL; iwe.u.qual.level = SCAN_RSSI(scan_table[i].rssi); - if (!bss_info.bcn_nf_last) { + if (!bss_info.bcn_nf_last) iwe.u.qual.noise = MRVDRV_NF_DEFAULT_SCAN_VALUE; - } else { + else iwe.u.qual.noise = bss_info.bcn_nf_last; - } + if ((bss_info.bss_mode == MLAN_BSS_MODE_IBSS) && !woal_ssid_cmp(&bss_info.ssid, &scan_table[i].ssid) && bss_info.adhoc_state == ADHOC_STARTED) { @@ -2678,11 +2657,11 @@ woal_get_scan(struct net_device *dev, struct iw_request_info *info, /* Add encryption capability */ iwe.cmd = SIOCGIWENCODE; - if (scan_table[i].privacy) { + if (scan_table[i].privacy) iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; - } else { + else iwe.u.data.flags = IW_ENCODE_DISABLED; - } + iwe.u.data.length = 0; iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; current_ev = @@ -2699,9 +2678,8 @@ woal_get_scan(struct net_device *dev, struct iw_request_info *info, /* Bit rate given in 500 kb/s units (+ 0x80) */ for (j = 0; j < sizeof(scan_table[i].supported_rates); j++) { - if (!scan_table[i].supported_rates[j]) { + if (!scan_table[i].supported_rates[j]) break; - } iwe.u.bitrate.value = (scan_table[i].supported_rates[j] & 0x7f) * @@ -2823,7 +2801,7 @@ woal_get_scan(struct net_device *dev, struct iw_request_info *info, ptr += sprintf(ptr, "bg"); iwe.u.data.length = strlen(buf); PRINTM(MINFO, "iwe.u.data.length %d\n", iwe.u.data.length); - PRINTM(MINFO, "BUF: %s \n", buf); + PRINTM(MINFO, "BUF: %s\n", buf); iwe.cmd = IWEVCUSTOM; iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; current_ev = @@ -2845,8 +2823,7 @@ woal_get_scan(struct net_device *dev, struct iw_request_info *info, #endif done: - if (buf) - kfree(buf); + kfree(buf); LEAVE(); return ret; } @@ -2956,9 +2933,9 @@ static const iw_handler woal_private_handler[] = { * @brief This function sends customized event to application. * * @param priv A pointer to moal_private structure - * @param str A pointer to event string + * @param str A pointer to event string * - * @return N/A + * @return N/A */ void woal_send_iwevcustom_event(moal_private * priv, char *str) @@ -2992,7 +2969,7 @@ woal_send_iwevcustom_event(moal_private * priv, char *str) * @param priv A pointer to moal_private structure * @param event MIC MERROR EVENT. * - * @return N/A + * @return N/A */ void woal_send_mic_error_event(moal_private * priv, t_u32 event) @@ -3066,12 +3043,11 @@ woal_get_wireless_stats(struct net_device *dev) /* Send RSSI command to get beacon RSSI/NF, valid only if associated */ if (priv->media_connected == MTRUE) { if (MLAN_STATUS_SUCCESS == - woal_get_signal_info(priv, wait_option, NULL)) { + woal_get_signal_info(priv, wait_option, NULL)) priv->w_stats.qual.qual = woal_rssi_to_quality((t_s16) (priv->w_stats.qual.level - 0x100)); - } } #if WIRELESS_EXT > 18 priv->w_stats.qual.updated |= (IW_QUAL_ALL_UPDATED | IW_QUAL_DBM); |