static int wl_android_iolist_add(struct net_device *dev, struct list_head *head, struct io_cfg *config) { struct io_cfg *resume_cfg; s32 ret; resume_cfg = kzalloc(sizeof(struct io_cfg), GFP_KERNEL); if (!resume_cfg) return -ENOMEM; if (config->iovar) { ret = wldev_iovar_getint(dev, config->iovar, &resume_cfg->param); if (ret) { DHD_ERROR(("%s: Failed to get current %s value\n", __FUNCTION__, config->iovar)); goto error; } ret = wldev_iovar_setint(dev, config->iovar, config->param); if (ret) { DHD_ERROR(("%s: Failed to set %s to %d\n", __FUNCTION__, config->iovar, config->param)); goto error; } resume_cfg->iovar = config->iovar; } else { resume_cfg->arg = kzalloc(config->len, GFP_KERNEL); if (!resume_cfg->arg) { ret = -ENOMEM; goto error; } ret = wldev_ioctl(dev, config->ioctl, resume_cfg->arg, config->len, false); if (ret) { DHD_ERROR(("%s: Failed to get ioctl %d\n", __FUNCTION__, config->ioctl)); goto error; } ret = wldev_ioctl(dev, config->ioctl + 1, config->arg, config->len, true); if (ret) { DHD_ERROR(("%s: Failed to set %s to %d\n", __FUNCTION__, config->iovar, config->param)); goto error; } if (config->ioctl + 1 == WLC_SET_PM) wl_cfg80211_update_power_mode(dev); resume_cfg->ioctl = config->ioctl; resume_cfg->len = config->len; } list_add(&resume_cfg->list, head); return 0; error: kfree(resume_cfg->arg); kfree(resume_cfg); return ret; }
int wldev_set_ap_sta_registra_wsec(struct net_device *dev, char *command, int total_len) { int bytes_written = 0; int wsec = 0; if ( !ap_net_dev ) return 0; wldev_iovar_getint(ap_net_dev, "wsec", &wsec); WLDEV_ERROR(("### %s devname[%s],got wsec(bset)=0x%x\n", __FUNCTION__, ap_net_dev->name, wsec)); wsec |= SES_OW_ENABLED; WLDEV_ERROR(("### %s devname[%s],wsec=0x%x\n", __FUNCTION__, ap_net_dev->name, wsec)); wldev_iovar_setint(ap_net_dev, "wsec", wsec); WLDEV_ERROR(("### %s devname[%s] seting\n", __FUNCTION__, ap_net_dev->name)); wldev_iovar_getint(ap_net_dev, "wsec", &wsec); WLDEV_ERROR(("### %s devname[%s],got(aset) wsec=0x%x\n", __FUNCTION__, ap_net_dev->name, wsec)); return bytes_written; }
static int wl_android_get_cckm_rn(struct net_device *dev, char *command) { int error, rn; WL_TRACE(("%s:wl_android_get_cckm_rn\n", dev->name)); error = wldev_iovar_getint(dev, "cckm_rn", &rn); if (unlikely(error)) { WL_ERR(("wl_android_get_cckm_rn error (%d)\n", error)); return -1; } memcpy(command, &rn, sizeof(int)); return sizeof(int); }
static int wl_android_get_full_roam_scan_period( struct net_device *dev, char *command, int total_len) { int error; int bytes_written; int full_roam_scan_period = 0; error = wldev_iovar_getint(dev, "fullroamperiod", &full_roam_scan_period); if (error) { DHD_ERROR(("%s: get full roam scan period failed code %d\n", __func__, error)); return -1; } else { DHD_INFO(("%s: get full roam scan period %d\n", __func__, full_roam_scan_period)); } bytes_written = snprintf(command, total_len, "%s %d", CMD_FULLROAMSCANPERIOD_GET, full_roam_scan_period); return bytes_written; }
int wldev_set_apsta(struct net_device *dev, bool enable) { int res = 0; int mpc = 0; int concr_mode = 0; int roam_off; char smbuf[WLC_IOCTL_SMLEN]; bss_setbuf_t bss_setbuf; int frameburst; memset(smbuf, 0, sizeof(smbuf)); printf("%s: enter\n", __FUNCTION__); if (!dev) { WLDEV_ERROR(("%s: dev is null\n", __FUNCTION__)); return -1; } if (enable){ /* wait for interface ready */ wait_for_ap_ready(1); if ( ap_net_dev == NULL ) { WLDEV_ERROR(("%s ap_net_dev == NULL\n", __FUNCTION__)); goto fail; } concr_mode = 1; if ((res = wldev_iovar_setint(dev, "concr_mode_set", concr_mode))) { printf("%s fail to set concr_mode res[%d]\n", __FUNCTION__,res); } rxglom_fail_count = RXGLOM_CONCUR_MODE_FAIL_COUNT; max_cntl_timeout = MAX_CONCUR_MODE_CNTL_TIMEOUT; roam_off = 1; if((res = wldev_iovar_setint(dev, "roam_off", roam_off))) printf("%s fail to set roam_off res[%d]\n", __FUNCTION__,res); mpc = 0; if ((res = wldev_iovar_setint(dev, "mpc", mpc))) { WLDEV_ERROR(("%s fail to set mpc\n", __FUNCTION__)); goto fail; } if ((res = wl_iw_set_ap_security(ap_net_dev, &ap_cfg)) != 0) { WLDEV_ERROR((" %s ERROR setting SOFTAP security in :%d\n", __FUNCTION__, res)); goto fail; } if(wl_get_drv_status(wlcfg_drv_priv,CONNECTED,dev)) { u32 chanspec = 0; int err; if(wldev_iovar_getint(dev, "chanspec", (s32 *)&chanspec) == BCME_OK) { printf("%s get Chanspec [%0x]\n",__func__ ,chanspec); if((err = wldev_iovar_setint(ap_net_dev, "chanspec", chanspec)) == BCME_BADCHAN) { printf("%s set Chanspec failed\n",__func__); } else printf("%s set Chanspec OK\n",__func__); } else printf("%s get Chanspec failed\n",__func__); } else printf("%s Sta is not connected with any AP\n",__func__); bss_setbuf.cfg = 1; bss_setbuf.val = 1; /* up the interface */ if ((res = wldev_iovar_setbuf_bsscfg(dev, "bss", &bss_setbuf, sizeof(bss_setbuf), smbuf, sizeof(smbuf), 1, NULL)) < 0){ WLDEV_ERROR(("%s: ERROR:%d, set bss up failed\n", __FUNCTION__, res)); goto fail; } bcm_mdelay(500); printf("prepare set frameburst \n"); frameburst = 1; if ((res = wldev_ioctl(dev, WLC_SET_FAKEFRAG, &frameburst, sizeof(frameburst), 0))) { printf("%s fail to set frameburst !!\n", __FUNCTION__); } if ((res = wldev_iovar_setint(dev, "allmulti", 1))) { WLDEV_ERROR(("%s: ERROR:%d, set allmulti failed\n", __FUNCTION__, res)); goto fail; } #if !defined(WLCREDALL) if ((res = wldev_iovar_setint(dev, "bus:credall", 1))) { WLDEV_ERROR(("%s: ERROR:%d, set credall failed\n", __FUNCTION__, res)); goto fail; } #endif set_ap_channel(dev,&ap_cfg); ap_net_dev->operstate = IF_OPER_UP; } else { if ((res = wl_softap_stop(ap_net_dev))){ WLDEV_ERROR(("%s: ERROR:%d, call wl_softap_stop failed\n", __FUNCTION__, res)); goto fail; } concr_mode = 0; if ((res = wldev_iovar_setint(dev, "concr_mode_set", concr_mode))) { printf("%s fail to set concr_mode res[%d]\n", __FUNCTION__,res); } rxglom_fail_count = RXGLOM_FAIL_COUNT; max_cntl_timeout = MAX_CNTL_TIMEOUT; scan_suppress_flag = 0; /* 2012-09-21 Stop roam when start Concurrent ++++ */ roam_off = 0; if((res = wldev_iovar_setint(dev, "roam_off", roam_off))) printf("%s fail to set roam_off res[%d]\n", __FUNCTION__,res); mpc = 1; if ((res = wldev_iovar_setint(dev, "mpc", mpc))) { WLDEV_ERROR(("%s fail to set mpc\n", __FUNCTION__)); goto fail; } #if !defined(WLCREDALL) if ((res = wldev_iovar_setint(dev, "bus:credall", 0))) { WLDEV_ERROR(("%s fail to set credall\n", __FUNCTION__)); goto fail; } #endif printf("prepare set frameburst \n"); frameburst = 0; if ((res = wldev_ioctl(dev, WLC_SET_FAKEFRAG, &frameburst, sizeof(frameburst), 0))) { printf("%s fail to set frameburst !!\n", __FUNCTION__); } wlcfg_drv_priv->dongle_connected = 0; wldev_adj_apsta_scan_param(dev,wlcfg_drv_priv->dongle_connected); } fail: return res; }
int wldev_set_apsta(struct net_device *dev, bool enable) { int res = 0; int mpc = 0; int concr_mode = 0; int roam_off; char smbuf[WLC_IOCTL_SMLEN]; bss_setbuf_t bss_setbuf; int frameburst; memset(smbuf, 0, sizeof(smbuf)); printf("%s: enter\n", __FUNCTION__); if (!dev) { WLDEV_ERROR(("%s: dev is null\n", __FUNCTION__)); return -1; } if (enable){ wait_for_ap_ready(1); if ( ap_net_dev == NULL ) { WLDEV_ERROR(("%s ap_net_dev == NULL\n", __FUNCTION__)); goto fail; } concr_mode = 1; if ((res = wldev_iovar_setint(dev, "concr_mode_set", concr_mode))) { printf("%s fail to set concr_mode res[%d]\n", __FUNCTION__,res); } roam_off = 1; if((res = wldev_iovar_setint(dev, "roam_off", roam_off))) printf("%s fail to set roam_off res[%d]\n", __FUNCTION__,res); mpc = 0; if ((res = wldev_iovar_setint(dev, "mpc", mpc))) { WLDEV_ERROR(("%s fail to set mpc\n", __FUNCTION__)); goto fail; } if ((res = wl_iw_set_ap_security(ap_net_dev, &ap_cfg)) != 0) { WLDEV_ERROR((" %s ERROR setting SOFTAP security in :%d\n", __FUNCTION__, res)); goto fail; } if(wl_get_drv_status(wlcfg_drv_priv,CONNECTED,dev)) { u32 chanspec = 0; int err; if(wldev_iovar_getint(dev, "chanspec", (s32 *)&chanspec) == BCME_OK) { printf("%s get Chanspec [%0x]\n",__func__ ,chanspec); if((err = wldev_iovar_setint(ap_net_dev, "chanspec", chanspec)) == BCME_BADCHAN) { printf("%s set Chanspec failed\n",__func__); } else printf("%s set Chanspec OK\n",__func__); } else printf("%s get Chanspec failed\n",__func__); } else printf("%s Sta is not connected with any AP\n",__func__); bss_setbuf.cfg = 1; bss_setbuf.val = 1; if ((res = wldev_iovar_setbuf_bsscfg(dev, "bss", &bss_setbuf, sizeof(bss_setbuf), smbuf, sizeof(smbuf), 1, NULL)) < 0){ WLDEV_ERROR(("%s: ERROR:%d, set bss up failed\n", __FUNCTION__, res)); goto fail; } printf("prepare set frameburst \n"); frameburst = 1; if ((res = wldev_ioctl(dev, WLC_SET_FAKEFRAG, &frameburst, sizeof(frameburst), 0))) { printf("%s fail to set frameburst !!\n", __FUNCTION__); } if ((res = wldev_iovar_setint(dev, "allmulti", 1))) { WLDEV_ERROR(("%s: ERROR:%d, set allmulti failed\n", __FUNCTION__, res)); goto fail; } set_ap_channel(dev,&ap_cfg); ap_net_dev->operstate = IF_OPER_UP; } else { if ((res = wl_softap_stop(ap_net_dev))){ WLDEV_ERROR(("%s: ERROR:%d, call wl_softap_stop failed\n", __FUNCTION__, res)); goto fail; } concr_mode = 0; if ((res = wldev_iovar_setint(dev, "concr_mode_set", concr_mode))) { printf("%s fail to set concr_mode res[%d]\n", __FUNCTION__,res); } roam_off = 0; if((res = wldev_iovar_setint(dev, "roam_off", roam_off))) printf("%s fail to set roam_off res[%d]\n", __FUNCTION__,res); mpc = 1; if ((res = wldev_iovar_setint(dev, "mpc", mpc))) { WLDEV_ERROR(("%s fail to set mpc\n", __FUNCTION__)); goto fail; } printf("prepare set frameburst \n"); frameburst = 0; if ((res = wldev_ioctl(dev, WLC_SET_FAKEFRAG, &frameburst, sizeof(frameburst), 0))) { printf("%s fail to set frameburst !!\n", __FUNCTION__); } } fail: return res; }