system/qcom: Add new SoftAP APIs to send new commands to driver

- Add SoftAP API to send initAP cmd to Driver
- Add SoftAP API to send exitAP cmd to Driver
- Add SoftAP API to update macaddr_acl value

CRs-fixed: 331343, 333643

Change-Id: I662b819a4055a652649748461e58b1ab50e0b01e
Acked-by:  Ramasundar Kara Venkata <nkaraven@qca.qualcomm.com>
This commit is contained in:
Sameer Thalappil
2012-01-30 16:56:29 -08:00
committed by Linux Build Service Account
parent baad0d7814
commit caf8792027
4 changed files with 104 additions and 5 deletions

View File

@@ -263,6 +263,63 @@ void qsap_send_module_down_indication(void)
}
}
s32 qsap_send_init_ap(void)
{
int s, ret;
struct iwreq wrq;
s32 status = eSUCCESS;
u32 *params = (u32 *)&wrq.u;
/* Equivalent to: iwpriv wlan0 initAP */
if ((s = socket(AF_INET, SOCK_DGRAM, 0)) >= 0) {
strncpy(wrq.ifr_name, "wlan0", IFNAMSIZ);
wrq.u.data.length = 0; /* No Set arguments */
wrq.u.data.flags = 2; /* WE_INIT_AP sub-command */
ret = ioctl(s, (SIOCIWFIRSTPRIV + 6), &wrq);
if (ret < 0 ) {
LOGE("ioctl failed: %s", strerror(errno));
status = eERR_START_SAP;
}
close(s);
sched_yield();
}
else {
LOGE("Socket open failed: %s", strerror(errno));
status = eERR_START_SAP;
}
return status;
}
s32 qsap_send_exit_ap(void)
{
int s, ret;
struct iwreq wrq;
s32 status = eSUCCESS;
u32 *params = (u32 *)&wrq.u;
/* Equivalent to: iwpriv wlan0 exitAP */
if ((s = socket(AF_INET, SOCK_DGRAM, 0)) >= 0) {
strncpy(wrq.ifr_name, "wlan0", IFNAMSIZ);
wrq.u.data.length = 0; /* No Set arguments */
wrq.u.data.flags = 3; /*WE_EXIT_AP sub-command */
ret = ioctl(s, (SIOCIWFIRSTPRIV + 6), &wrq);
if (ret < 0 ) {
LOGE("ioctl failed: %s", strerror(errno));
status = eERR_STOP_SAP;
}
close(s);
sched_yield();
}
else {
LOGE("Socket open failed: %s", strerror(errno));
status = eERR_STOP_SAP;
}
return status;
}
s32 wifi_qsap_unload_driver()
{
s32 ret = eSUCCESS;
@@ -434,6 +491,25 @@ s32 wifi_qsap_start_softap()
return eERR_START_SAP;
}
#ifdef QCOM_WLAN_CONCURRENCY
s32 wifi_qsap_start_softap_in_concurrency()
{
s32 status;
/*Send initAP IOCTL to Driver. Hostapd start is done by Netd.*/
status = qsap_send_init_ap();
return status;
}
s32 wifi_qsap_stop_softap_in_concurrency()
{
s32 status;
/*Send exitAP IOCTL to Driver. Hostapd stop is done by Netd.*/
status = qsap_send_exit_ap();
return status;
}
#endif
s32 wifi_qsap_stop_softap()
{
s32 ret = eSUCCESS;

View File

@@ -47,6 +47,11 @@ s32 wifi_qsap_stop_softap(void);
s32 wifi_qsap_reload_softap(void);
s32 wifi_qsap_unload_wifi_sta_driver(void);
#ifdef QCOM_WLAN_CONCURRENCY
s32 wifi_qsap_start_softap_in_concurrency(void);
s32 wifi_qsap_stop_softap_in_concurrency(void);
#endif
#if __cplusplus
}; // extern "C"
#endif

View File

@@ -2291,20 +2291,25 @@ static void qsap_handle_set_request(s8 *pcmd, s8 *presp, u32 *plen)
value = atoi(pVal);
if(FALSE == IS_VALID_MAC_ACL(value))
goto error;
/** Write back the integer value. This is to avoid values like 01, 001, 0001
* being written to the configuration
*/
snprintf(pVal, sizeof(u32), "%ld", value);
if(ACL_ALLOW_LIST == value) {
value = ENABLE;
status = DISABLE;
}
else {
else if(ACL_DENY_LIST == value){
value = DISABLE;
status = ENABLE;
}
else {
// must be ACL_ALLOW_AND_DENY_LIST
value = ENABLE;
status = ENABLE;
}
if(eERR_UNKNOWN != qsap_change_cfg(pconffile, &qsap_str[STR_ACCEPT_MAC_FILE], value)) {
if(eERR_UNKNOWN != qsap_change_cfg(pconffile, &qsap_str[STR_DENY_MAC_FILE], status))
@@ -2508,6 +2513,14 @@ static void qsap_handle_set_request(s8 *pcmd, s8 *presp, u32 *plen)
if(status == eSUCCESS)
status = wifi_qsap_unload_driver();
}
#ifdef QCOM_WLAN_CONCURRENCY
else if(SAP_INITAP == value) {
status = wifi_qsap_start_softap_in_concurrency();
}
else if(SAP_EXITAP == value) {
status = wifi_qsap_stop_softap_in_concurrency();
}
#endif
else {
status = !eSUCCESS;
}

View File

@@ -392,7 +392,8 @@ enum auth_alg {
/** Allow or Deny MAC address list selection */
enum macaddr_acl {
ACL_DENY_LIST = 0,
ACL_ALLOW_LIST = 1
ACL_ALLOW_LIST = 1,
ACL_ALLOW_AND_DENY_LIST = 2
};
enum ap_reset {
@@ -400,6 +401,10 @@ enum ap_reset {
SAP_RESET_DRIVER_BSS = 1,
SAP_STOP_BSS = 2,
SAP_STOP_DRIVER_BSS = 3,
#ifdef QCOM_WLAN_CONCURRENCY
SAP_INITAP = 4,
SAP_EXITAP = 5,
#endif
SAP_RESET_INVALID
};
@@ -442,7 +447,7 @@ struct Command
#define IS_VALID_SEC_MODE(x) (((x >= SEC_MODE_NONE) && (x < SEC_MODE_INVALID)) ? TRUE : FALSE)
/** Validate the selection of access or deny MAC address list */
#define IS_VALID_MAC_ACL(x) (((x==ACL_DENY_LIST) || (x==ACL_ALLOW_LIST)) ? TRUE : FALSE)
#define IS_VALID_MAC_ACL(x) (((x==ACL_DENY_LIST) || (x==ACL_ALLOW_LIST) || (x==ACL_ALLOW_AND_DENY_LIST)) ? TRUE : FALSE)
/** Validate the broadcast SSID status */
#define IS_VALID_BSSID(x) (((value == ENABLE) || (value == DISABLE)) ? TRUE: FALSE)