Samsung VZW MB1 update
/drivers/net/wireless/bcmdhd/dhd_common.c
blob:b985a7c46f868ea1a7df3def6b968869bc5c70aa -> blob:a7e6f549f3bf206ef5a1461775394f9472909ecb
--- drivers/net/wireless/bcmdhd/dhd_common.c
+++ drivers/net/wireless/bcmdhd/dhd_common.c
@@ -21,7 +21,7 @@
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
- * $Id: dhd_common.c 357867 2012-09-20 06:57:44Z $
+ * $Id: dhd_common.c 375020 2012-12-17 06:10:40Z $
*/
#include <typedefs.h>
#include <osl.h>
@@ -339,7 +339,7 @@ dhd_doiovar(dhd_pub_t *dhd_pub, const bc
else if (int_val & DHD_WL_VAL)
wl_cfg80211_enable_trace(FALSE, WL_DBG_DBG);
if (!(int_val & DHD_WL_VAL2))
-#endif
+#endif /* WL_CFG80211 */
dhd_msg_level = int_val;
break;
case IOV_GVAL(IOV_BCMERRORSTR):
@@ -677,7 +677,7 @@ dhd_ioctl(dhd_pub_t * dhd_pub, dhd_ioctl
case DHD_GET_VERSION:
if (buflen < sizeof(int))
- bcmerror = -BCME_BUFTOOSHORT;
+ bcmerror = BCME_BUFTOOSHORT;
else
*(int*)buf = DHD_IOCTL_VERSION;
break;
@@ -1454,10 +1454,10 @@ dhd_arp_offload_set(dhd_pub_t * dhd, int
retcode = retcode >= 0 ? 0 : retcode;
if (retcode)
DHD_TRACE(("%s: failed to set ARP offload mode to 0x%x, retcode = %d\n",
- __FUNCTION__, arp_mode, retcode));
+ __FUNCTION__, arp_mode, retcode));
else
DHD_TRACE(("%s: successfully set ARP offload mode to 0x%x\n",
- __FUNCTION__, arp_mode));
+ __FUNCTION__, arp_mode));
}
void
@@ -1471,49 +1471,73 @@ dhd_arp_offload_enable(dhd_pub_t * dhd,
retcode = retcode >= 0 ? 0 : retcode;
if (retcode)
DHD_TRACE(("%s: failed to enabe ARP offload to %d, retcode = %d\n",
- __FUNCTION__, arp_enable, retcode));
+ __FUNCTION__, arp_enable, retcode));
else
DHD_TRACE(("%s: successfully enabed ARP offload to %d\n",
- __FUNCTION__, arp_enable));
+ __FUNCTION__, arp_enable));
+ if (arp_enable) {
+ uint32 version;
+ bcm_mkiovar("arp_version", 0, 0, iovbuf, sizeof(iovbuf));
+ retcode = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, iovbuf, sizeof(iovbuf), FALSE, 0);
+ if (retcode) {
+ DHD_INFO(("%s: fail to get version (maybe version 1:retcode = %d\n",
+ __FUNCTION__, retcode));
+ dhd->arp_version = 1;
+ }
+ else {
+ memcpy(&version, iovbuf, sizeof(version));
+ DHD_INFO(("%s: ARP Version= %x\n", __FUNCTION__, version));
+ dhd->arp_version = version;
+ }
+ }
}
void
-dhd_aoe_arp_clr(dhd_pub_t *dhd)
+dhd_aoe_arp_clr(dhd_pub_t *dhd, int idx)
{
int ret = 0;
int iov_len = 0;
char iovbuf[128];
if (dhd == NULL) return;
+ if (dhd->arp_version == 1)
+ idx = 0;
iov_len = bcm_mkiovar("arp_table_clear", 0, 0, iovbuf, sizeof(iovbuf));
- if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, iov_len, TRUE, 0) < 0))
+ if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, iov_len, TRUE, idx)) < 0)
DHD_ERROR(("%s failed code %d\n", __FUNCTION__, ret));
}
void
-dhd_aoe_hostip_clr(dhd_pub_t *dhd)
+dhd_aoe_hostip_clr(dhd_pub_t *dhd, int idx)
{
int ret = 0;
int iov_len = 0;
char iovbuf[128];
if (dhd == NULL) return;
+ if (dhd->arp_version == 1)
+ idx = 0;
iov_len = bcm_mkiovar("arp_hostip_clear", 0, 0, iovbuf, sizeof(iovbuf));
- if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, iov_len, TRUE, 0)) < 0)
+ if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, iov_len, TRUE, idx)) < 0)
DHD_ERROR(("%s failed code %d\n", __FUNCTION__, ret));
}
void
-dhd_arp_offload_add_ip(dhd_pub_t *dhd, uint32 ipaddr)
+dhd_arp_offload_add_ip(dhd_pub_t *dhd, uint32 ipaddr, int idx)
{
int iov_len = 0;
char iovbuf[32];
int retcode;
- iov_len = bcm_mkiovar("arp_hostip", (char *)&ipaddr, 4, iovbuf, sizeof(iovbuf));
- retcode = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, iov_len, TRUE, 0);
+
+ if (dhd == NULL) return;
+ if (dhd->arp_version == 1)
+ idx = 0;
+ iov_len = bcm_mkiovar("arp_hostip", (char *)&ipaddr,
+ sizeof(ipaddr), iovbuf, sizeof(iovbuf));
+ retcode = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, iov_len, TRUE, idx);
if (retcode)
DHD_TRACE(("%s: ARP ip addr add failed, retcode = %d\n",
@@ -1524,7 +1548,7 @@ dhd_arp_offload_add_ip(dhd_pub_t *dhd, u
}
int
-dhd_arp_get_arp_hostip_table(dhd_pub_t *dhd, void *buf, int buflen)
+dhd_arp_get_arp_hostip_table(dhd_pub_t *dhd, void *buf, int buflen, int idx)
{
int retcode, i;
int iov_len;
@@ -1533,10 +1557,13 @@ dhd_arp_get_arp_hostip_table(dhd_pub_t *
if (!buf)
return -1;
+ if (dhd == NULL) return -1;
+ if (dhd->arp_version == 1)
+ idx = 0;
iov_len = bcm_mkiovar("arp_hostip", 0, 0, buf, buflen);
BCM_REFERENCE(iov_len);
- retcode = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, buf, buflen, FALSE, 0);
+ retcode = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, buf, buflen, FALSE, idx);
if (retcode) {
DHD_TRACE(("%s: ioctl WLC_GET_VAR error %d\n",
@@ -1804,16 +1831,13 @@ bool dhd_is_associated(dhd_pub_t *dhd, v
/* Function to estimate possible DTIM_SKIP value */
int
-dhd_get_dtim_skip(dhd_pub_t *dhd)
+dhd_get_suspend_bcn_li_dtim(dhd_pub_t *dhd)
{
int bcn_li_dtim;
int ret = -1;
int dtim_assoc = 0;
- if ((dhd->dtim_skip == 0) || (dhd->dtim_skip == 1))
- bcn_li_dtim = 3;
- else
- bcn_li_dtim = dhd->dtim_skip;
+ bcn_li_dtim = dhd->suspend_bcn_li_dtim;
/* Check if associated */
if (dhd_is_associated(dhd, NULL, NULL) == FALSE) {
@@ -1855,34 +1879,16 @@ exit:
return bcn_li_dtim;
}
-/* Check if HostAPD or WFD mode setup */
-bool dhd_check_ap_wfd_mode_set(dhd_pub_t *dhd)
+/* Check if the mode supports STA MODE */
+bool dhd_support_sta_mode(dhd_pub_t *dhd)
{
-#if !defined(AP) && defined(WLP2P)
- if ((dhd->op_mode & CONCURRENT_FW_MASK) == CONCURRENT_FW_MASK)
- return FALSE;
-#endif
+
#ifdef WL_CFG80211
-#ifndef WL_ENABLE_P2P_IF
- /* To be back compatble with ICS MR1 release where p2p interface
- * disable but wlan0 used for p2p
- */
- if (((dhd->op_mode & HOSTAPD_MASK) == HOSTAPD_MASK) ||
- ((dhd->op_mode & WFD_MASK) == WFD_MASK)) {
- return TRUE;
- }
- else
-#else
- /* concurent mode with p2p interface for wfd and wlan0 for sta */
- if (((dhd->op_mode & P2P_GO_ENABLED) == P2P_GO_ENABLED) ||
- ((dhd->op_mode & P2P_GC_ENABLED) == P2P_GC_ENABLED)) {
- DHD_ERROR(("%s P2P enabled for mode=%d\n", __FUNCTION__, dhd->op_mode));
- return TRUE;
- }
+ if (!(dhd->op_mode & DHD_FLAG_STA_MODE))
+ return FALSE;
else
-#endif /* WL_ENABLE_P2P_IF */
#endif /* WL_CFG80211 */
- return FALSE;
+ return TRUE;
}
#if defined(PNO_SUPPORT)
@@ -1927,7 +1933,8 @@ dhd_pno_enable(dhd_pub_t *dhd, int pfn_e
return ret;
}
- if (dhd_check_ap_wfd_mode_set(dhd) == TRUE)
+#ifndef WL_SCHED_SCAN
+ if (!dhd_support_sta_mode(dhd))
return (ret);
memset(iovbuf, 0, sizeof(iovbuf));
@@ -1936,6 +1943,7 @@ dhd_pno_enable(dhd_pub_t *dhd, int pfn_e
DHD_ERROR(("%s pno is NOT enable : called in assoc mode , ignore\n", __FUNCTION__));
return ret;
}
+#endif /* !WL_SCHED_SCAN */
/* Enable/disable PNO */
if ((ret = bcm_mkiovar("pfn", (char *)&pfn_enabled, 4, iovbuf, sizeof(iovbuf))) > 0) {
@@ -1975,9 +1983,10 @@ dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t*
err = -1;
return err;
}
-
- if (dhd_check_ap_wfd_mode_set(dhd) == TRUE)
- return (err);
+#ifndef WL_SCHED_SCAN
+ if (!dhd_support_sta_mode(dhd))
+ return err;
+#endif /* !WL_SCHED_SCAN */
/* Check for broadcast ssid */
for (k = 0; k < nssid; k++) {
@@ -2094,8 +2103,8 @@ int dhd_keep_alive_onoff(dhd_pub_t *dhd)
int str_len;
int res = -1;
- if (dhd_check_ap_wfd_mode_set(dhd) == TRUE)
- return (res);
+ if (!dhd_support_sta_mode(dhd))
+ return res;
DHD_TRACE(("%s execution\n", __FUNCTION__));