static void wl_cfg80211_bt_setflag(struct net_device *dev, bool set) { #if defined(BT_DHCP_USE_FLAGS) char buf_flag7_dhcp_on[8] = { 7, 00, 00, 00, 0x1, 0x0, 0x00, 0x00 }; char buf_flag7_default[8] = { 7, 00, 00, 00, 0x0, 0x00, 0x00, 0x00}; #endif int bt_coex = 0; #if defined(BT_DHCP_eSCO_FIX) set_btc_esco_params(dev, set); #endif #if defined(BT_DHCP_USE_FLAGS) WL_TRACE(("WI-FI priority boost via bt flags, set:%d\n", set)); if (set == TRUE) { dev_wlc_bufvar_set(dev, "btc_flags", (char *)&buf_flag7_dhcp_on[0], sizeof(buf_flag7_dhcp_on)); wldev_iovar_setint(dev, "btc_mode", bt_coex); } else { dev_wlc_bufvar_set(dev, "btc_flags", (char *)&buf_flag7_default[0], sizeof(buf_flag7_default)); bt_coex = 1; wldev_iovar_setint(dev, "btc_mode", bt_coex); } #endif }
static int wl_android_okc_enable(struct net_device *dev, char *command, int total_len) { int error = 0; char okc_enable = 0; okc_enable = command[strlen(CMD_OKC_ENABLE) + 1] - '0'; error = wldev_iovar_setint(dev, "okc_enable", okc_enable); if (error) { DHD_ERROR(("Failed to %s OKC, error = %d\n", okc_enable ? "enable" : "disable", error)); } wldev_iovar_setint(dev, "ccx_enable", 0); return error; }
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; }
static int wl_android_set_max_num_sta(struct net_device *dev, const char* string_num) { int max_assoc; max_assoc = bcm_atoi(string_num); DHD_INFO(("%s : HAPD_MAX_NUM_STA = %d\n", __FUNCTION__, max_assoc)); wldev_iovar_setint(dev, "maxassoc", max_assoc); return 1; }
int set_roamscan_channel_list(struct net_device *dev, unsigned char n, unsigned char channels[], int ioctl_ver) { int i; int error; channel_list_t channel_list; char iobuf[WLC_IOCTL_SMLEN]; roamscan_mode = ROAMSCAN_MODE_WES; if (n > MAX_CHANNEL_LIST) n = MAX_CHANNEL_LIST; for (i = 0; i < n; i++) { chanspec_t chanspec; if (channels[i] <= CH_MAX_2G_CHANNEL) { chanspec = band2G | band_bw | channels[i]; } else { chanspec = band5G | band_bw | channels[i]; } roam_cache[i].chanspec = chanspec; channel_list.channels[i] = chanspec; WL_DBG(("channel[%d] - [%02d] \n", i, channels[i])); } n_roam_cache = n; channel_list.n = n; /* need to set ROAMSCAN_MODE_NORMAL to update roamscan_channels, * otherwise, it won't be updated */ wldev_iovar_setint(dev, "roamscan_mode", ROAMSCAN_MODE_NORMAL); error = wldev_iovar_setbuf(dev, "roamscan_channels", &channel_list, sizeof(channel_list), iobuf, sizeof(iobuf), NULL); if (error) { WL_DBG(("Failed to set roamscan channels, error = %d\n", error)); } wldev_iovar_setint(dev, "roamscan_mode", ROAMSCAN_MODE_WES); return error; }
int set_roamscan_mode(struct net_device *dev, int mode) { int error = 0; roamscan_mode = mode; n_roam_cache = 0; error = wldev_iovar_setint(dev, "roamscan_mode", mode); if (error) { WL_ERROR(("Failed to set roamscan mode to %d, error = %d\n", mode, error)); } return error; }
static int wl_android_set_hide_ssid(struct net_device *dev, const char* string_num) { int hide_ssid; int enable = 0; hide_ssid = bcm_atoi(string_num); DHD_INFO(("%s: HAPD_HIDE_SSID = %d\n", __FUNCTION__, hide_ssid)); if (hide_ssid) enable = 1; wldev_iovar_setint(dev, "closednet", enable); return 1; }
int wl_android_wifi_on(struct net_device *dev) { int ret = 0; int retry = POWERUP_MAX_RETRY; printk("%s in\n", __FUNCTION__); if (!dev) { DHD_ERROR(("%s: dev is null\n", __FUNCTION__)); return -EINVAL; } dhd_net_if_lock(dev); if (!g_wifi_on) { do { dhd_customer_gpio_wlan_ctrl(WLAN_RESET_ON); ret = sdioh_start(NULL, 0); if (ret == 0) break; DHD_ERROR(("\nfailed to power up wifi chip, retry again (%d left) **\n\n", retry+1)); dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF); } while (retry-- >= 0); if (ret != 0) { DHD_ERROR(("\nfailed to power up wifi chip, max retry reached **\n\n")); goto exit; } ret = dhd_dev_reset(dev, FALSE); sdioh_start(NULL, 1); if (!ret) { if (dhd_dev_init_ioctl(dev) < 0) ret = -EFAULT; } #if defined(PROP_TXSTATUS) && !defined(PROP_TXSTATUS_VSDB) dhd_wlfc_init(bcmsdh_get_drvdata()); #endif g_wifi_on = TRUE; } wldev_iovar_setint(dev, "mimo_bw_cap", 1); exit: dhd_net_if_unlock(dev); return ret; }
static void wl_android_iolist_resume(struct net_device *dev, struct list_head *head) { struct io_cfg *config; struct list_head *cur, *q; list_for_each_safe(cur, q, head) { config = list_entry(cur, struct io_cfg, list); if (config->iovar) { wldev_iovar_setint(dev, config->iovar, config->param); } else { wldev_ioctl(dev, config->ioctl + 1, config->arg, config->len, true); if (config->ioctl + 1 == WLC_SET_PM) wl_cfg80211_update_power_mode(dev); kfree(config->arg); } list_del(cur); kfree(config); }
/* CMD_AMPDU_MPDU */ static int wl_android_set_ampdu_mpdu(struct net_device *dev, const char* string_num) { int err = 0; int ampdu_mpdu; ampdu_mpdu = bcm_atoi(string_num); if (ampdu_mpdu > 32) { DHD_ERROR(("%s : ampdu_mpdu MAX value is 32.\n", __FUNCTION__)); return -1; } DHD_ERROR(("%s : ampdu_mpdu = %d\n", __FUNCTION__, ampdu_mpdu)); err = wldev_iovar_setint(dev, "ampdu_mpdu", ampdu_mpdu); if (err < 0) { DHD_ERROR(("%s : ampdu_mpdu set error. %d\n", __FUNCTION__, err)); return -1; } return 0; }
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; }
int wl_android_set_roam_mode(struct net_device *dev, char *command, int total_len) { int error = 0; int mode = 0; if (sscanf(command, "%*s %d", &mode) != 1) { DHD_ERROR(("%s: Failed to get Parameter\n", __FUNCTION__)); return -1; } error = wldev_iovar_setint(dev, "roam_off", mode); if (error) { DHD_ERROR(("%s: Failed to set roaming Mode %d, error = %d\n", __FUNCTION__, mode, error)); return -1; } else DHD_ERROR(("%s: succeeded to set roaming Mode %d, error = %d\n", __FUNCTION__, mode, error)); return 0; }
int wldev_set_scansuppress(struct net_device *dev,int enable) { int res = 0; int scan_unassoc_time ; printf("%s: enter\n", __FUNCTION__); if (!dev) { WLDEV_ERROR(("%s: dev is null\n", __FUNCTION__)); return -1; } printf("wldev_set_scansuppress enable[%d]\n", enable); if(enable){ #if 1 scan_unassoc_time = 20; if((res = wldev_ioctl(dev, WLC_SET_SCAN_UNASSOC_TIME, (char *)&scan_unassoc_time,sizeof(scan_unassoc_time), 1))) { WLDEV_ERROR(("%s fail to set WLC_SET_SCAN_UNASSOC_TIME\n", __FUNCTION__)); } if ((res = wldev_ioctl(dev, WLC_SET_SCANSUPPRESS, &enable, sizeof(enable), 1))) { WLDEV_ERROR(("%s fail to get ap\n", __FUNCTION__)); } scan_suppress_flag = 1; #else dhd_wl_ioctl_cmd(dhd, WLC_SET_SCAN_UNASSOC_TIME, (char *)&scan_unassoc_time, sizeof(scan_unassoc_time), TRUE, 0); roam_off = 1; if((res = wldev_iovar_setint(dev, "roam_off", roam_off))){ printf("%s fail to set roam_off[%d]\n", __FUNCTION__,roam_off); return -1; }else{ printf("Set roam_off 1 and enable scansuppress_flag!!\n"); scan_suppress_flag = 1; } #endif printf("Successful enable scan suppress!!\n"); }else{ #if 1 scan_unassoc_time = 80; if ((res = wldev_ioctl(dev, WLC_SET_SCAN_UNASSOC_TIME, (char *)&scan_unassoc_time,sizeof(scan_unassoc_time), 1))) { WLDEV_ERROR(("%s fail to set WLC_SET_SCAN_UNASSOC_TIME\n", __FUNCTION__)); } if ((res = wldev_ioctl(dev, WLC_SET_SCANSUPPRESS, &enable, sizeof(enable), 1))) { WLDEV_ERROR(("%s fail to get ap\n", __FUNCTION__)); } scan_suppress_flag = 0; #else roam_off = 0; if((res = wldev_iovar_setint(dev, "roam_off", roam_off))){ printf("%s fail to set roam_off[%d]\n", __FUNCTION__,roam_off); return -1; }else{ printf("set roam_off to zero and disable scansuppress_flag!!\n"); scan_suppress_flag = 0; } #endif printf("Successful disable scan suppress!!\n"); } return 0; }
int wldev_set_apsta(struct net_device *dev, bool enable) { int res = 0; int mpc = 0; int concr_mode = 0; char smbuf[WLC_IOCTL_SMLEN]; bss_setbuf_t bss_setbuf; 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); //broacom 0405 if ( ap_net_dev == NULL ) { WLDEV_ERROR(("%s ap_net_dev == NULL\n", __FUNCTION__)); goto fail; } //2012-09-10 CT2 set Concr_mode ++++ 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); } //2012-09-10 CT2 set Concr_mode ++++ 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; } 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); if ((res = wldev_iovar_setint(dev, "allmulti", 1))) { WLDEV_ERROR(("%s: ERROR:%d, set allmulti failed\n", __FUNCTION__, res)); goto fail; } //BRCM_APSTA_START set_ap_channel(dev,&ap_cfg); ap_net_dev->operstate = IF_OPER_UP; //BRCM_APSTA_END } else { if ((res = wl_softap_stop(ap_net_dev))){ WLDEV_ERROR(("%s: ERROR:%d, call wl_softap_stop failed\n", __FUNCTION__, res)); goto fail; } //2012-09-10 CT2 set Concr_mode ++++ 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); } //2012-09-10 CT2 set Concr_mode ++++ mpc = 1; if ((res = wldev_iovar_setint(dev, "mpc", mpc))) { WLDEV_ERROR(("%s fail to set mpc\n", __FUNCTION__)); goto fail; } } fail: return res; }
int wldev_set_country( struct net_device *dev, char *country_code, bool notify, bool user_enforced) { int error = -1; wl_country_t cspec = {{0}, 0, {0}}; scb_val_t scbval; char smbuf[WLC_IOCTL_SMLEN]; //CY+ default country when set country fail char default_country[10] = "XY"; //CY- #ifdef CHIPNUM uint chipnum = 0; #endif if (!country_code) return error; bzero(&scbval, sizeof(scb_val_t)); error = wldev_iovar_getbuf(dev, "country", NULL, 0, &cspec, sizeof(cspec), NULL); if (error < 0) { WLDEV_ERROR(("%s: get country failed = %d\n", __FUNCTION__, error)); return error; } //CY+ always set country #if 0 if ((error < 0) || (strncmp(country_code, cspec.country_abbrev, WLC_CNTRY_BUF_SZ) != 0)) { #else if(true){ #endif //CY- always set country if (user_enforced) { bzero(&scbval, sizeof(scb_val_t)); error = wldev_ioctl(dev, WLC_DISASSOC, &scbval, sizeof(scb_val_t), true); if (error < 0) { WLDEV_ERROR(("%s: set country failed due to Disassoc error %d\n", __FUNCTION__, error)); return error; } } cspec.rev = -1; memcpy(cspec.country_abbrev, country_code, WLC_CNTRY_BUF_SZ); memcpy(cspec.ccode, country_code, WLC_CNTRY_BUF_SZ); #ifdef CHIPNUM chipnum = dhd_get_chipnum(dev); printk("%s: chipnum:%d\n", __FUNCTION__, chipnum); dhd_get_customized_country_code(dev, (char *)&cspec.country_abbrev, &cspec, chipnum); //CY+ set default country //BCM43340: XY //BCM43362: XV //BCM4343s: XV if (chipnum == 43430){ sprintf(default_country, "XV"); }else if (chipnum == 43362){ sprintf(default_country, "XV"); }else { sprintf(default_country, "XY"); } WLDEV_ERROR(("%s: set default country to %s for CHIP %d\n", __FUNCTION__, default_country, chipnum)); //CY- #else dhd_get_customized_country_code(dev, (char *)&cspec.country_abbrev, &cspec); #endif error = wldev_iovar_setbuf(dev, "country", &cspec, sizeof(cspec), smbuf, sizeof(smbuf), NULL); if (error < 0) { WLDEV_ERROR(("%s: set country for %s as %s rev %d failed, try to use %s\n", __FUNCTION__, country_code, cspec.ccode, cspec.rev, default_country)); //return error; //if set country error, use default_country cspec.rev = -1; memcpy(cspec.country_abbrev, default_country, WLC_CNTRY_BUF_SZ); memcpy(cspec.ccode, default_country, WLC_CNTRY_BUF_SZ); #ifdef CHIPNUM dhd_get_customized_country_code(dev, (char *)&cspec.country_abbrev, &cspec, chipnum); #else dhd_get_customized_country_code(dev, (char *)&cspec.country_abbrev, &cspec); #endif error = wldev_iovar_setbuf(dev, "country", &cspec, sizeof(cspec), smbuf, sizeof(smbuf), NULL); if (error < 0) { WLDEV_ERROR(("%s: set country for %s as %s rev %d failed\n", __FUNCTION__, country_code, cspec.ccode, cspec.rev)); return error; } } dhd_bus_country_set(dev, &cspec, notify); WLDEV_ERROR(("%s: set country for %s as %s rev %d\n", __FUNCTION__, country_code, cspec.ccode, cspec.rev)); } return 0; } #if defined(CUSTOM_PLATFORM_NV_TEGRA) /* tuning performance for miracast */ int wldev_miracast_tuning( struct net_device *dev, char *command, int total_len) { int error = 0; int mode = 0; int ampdu_mpdu; int roam_off; #ifdef VSDB_BW_ALLOCATE_ENABLE int mchan_algo; int mchan_bw; #endif /* VSDB_BW_ALLOCATE_ENABLE */ if (sscanf(command, "%*s %d", &mode) != 1) { WLDEV_ERROR(("Failed to get mode\n")); return -1; } WLDEV_ERROR(("mode: %d\n", mode)); if (mode == 0) { /* Normal mode: restore everything to default */ ampdu_mpdu = -1; /* FW default */ #if defined(ROAM_ENABLE) roam_off = 0; /* roam enable */ #elif defined(DISABLE_BUILTIN_ROAM) roam_off = 1; /* roam disable */ #endif #ifdef VSDB_BW_ALLOCATE_ENABLE mchan_algo = 0; /* Default */ mchan_bw = 50; /* 50:50 */ #endif /* VSDB_BW_ALLOCATE_ENABLE */ } else if (mode == 1) { /* Miracast source mode */ ampdu_mpdu = 8; /* for tx latency */ #if defined(ROAM_ENABLE) || defined(DISABLE_BUILTIN_ROAM) roam_off = 1; /* roam disable */ #endif #ifdef VSDB_BW_ALLOCATE_ENABLE mchan_algo = 1; /* BW based */ mchan_bw = 25; /* 25:75 */ #endif /* VSDB_BW_ALLOCATE_ENABLE */ } else if (mode == 2) { /* Miracast sink/PC Gaming mode */ ampdu_mpdu = -1; /* FW default */ #if defined(ROAM_ENABLE) || defined(DISABLE_BUILTIN_ROAM) roam_off = 1; /* roam disable */ #endif #ifdef VSDB_BW_ALLOCATE_ENABLE mchan_algo = 0; /* Default */ mchan_bw = 50; /* 50:50 */ #endif /* VSDB_BW_ALLOCATE_ENABLE */ } else { WLDEV_ERROR(("Unknown mode: %d\n", mode)); return -1; } /* Update ampdu_mpdu */ error = wldev_iovar_setint(dev, "ampdu_mpdu", ampdu_mpdu); if (error) { WLDEV_ERROR(("Failed to set ampdu_mpdu: mode:%d, error:%d\n", mode, error)); return -1; } #if defined(ROAM_ENABLE) || defined(DISABLE_BUILTIN_ROAM) error = wldev_iovar_setint(dev, "roam_off", roam_off); if (error) { WLDEV_ERROR(("Failed to set roam_off: mode:%d, error:%d\n", mode, error)); return -1; } #endif /* ROAM_ENABLE || DISABLE_BUILTIN_ROAM */ #ifdef VSDB_BW_ALLOCATE_ENABLE error = wldev_iovar_setint(dev, "mchan_algo", mchan_algo); if (error) { WLDEV_ERROR(("Failed to set mchan_algo: mode:%d, error:%d\n", mode, error)); return -1; } error = wldev_iovar_setint(dev, "mchan_bw", mchan_bw); if (error) { WLDEV_ERROR(("Failed to set mchan_bw: mode:%d, error:%d\n", mode, error)); return -1; } #endif /* VSDB_BW_ALLOCATE_ENABLE */ return error; }
/* tuning performance for miracast */ int wldev_miracast_tuning( struct net_device *dev, int mode) { int error = 0; int ampdu_mpdu; int roam_off; #ifdef VSDB_BW_ALLOCATE_ENABLE int mchan_algo; int mchan_bw; #endif /* VSDB_BW_ALLOCATE_ENABLE */ WLDEV_ERROR(("mode: %d\n", mode)); if (mode == 0) { /* Normal mode: restore everything to default */ ampdu_mpdu = -1; /* FW default */ #if defined(ROAM_ENABLE) roam_off = 0; /* roam enable */ #elif defined(DISABLE_BUILTIN_ROAM) roam_off = 1; /* roam disable */ #endif #ifdef VSDB_BW_ALLOCATE_ENABLE mchan_algo = 0; /* Default */ mchan_bw = 50; /* 50:50 */ #endif /* VSDB_BW_ALLOCATE_ENABLE */ } else if (mode == 1) { /* Miracast source mode */ ampdu_mpdu = 8; /* for tx latency */ #if defined(ROAM_ENABLE) || defined(DISABLE_BUILTIN_ROAM) roam_off = 1; /* roam disable */ #endif #ifdef VSDB_BW_ALLOCATE_ENABLE mchan_algo = 1; /* BW based */ mchan_bw = 35; /* 35:65 */ #endif /* VSDB_BW_ALLOCATE_ENABLE */ } else if (mode == 2) { /* Miracast sink/PC Gaming mode */ ampdu_mpdu = -1; /* FW default */ #if defined(ROAM_ENABLE) || defined(DISABLE_BUILTIN_ROAM) roam_off = 1; /* roam disable */ #endif #ifdef VSDB_BW_ALLOCATE_ENABLE mchan_algo = 0; /* Default */ mchan_bw = 50; /* 50:50 */ #endif /* VSDB_BW_ALLOCATE_ENABLE */ } else { WLDEV_ERROR(("Unknown mode: %d\n", mode)); return -1; } /* Update ampdu_mpdu */ error = wldev_iovar_setint(dev, "ampdu_mpdu", ampdu_mpdu); if (error) { WLDEV_ERROR(("Failed to set ampdu_mpdu: mode:%d, error:%d\n", mode, error)); return -1; } #if defined(ROAM_ENABLE) || defined(DISABLE_BUILTIN_ROAM) error = wldev_iovar_setint(dev, "roam_off", roam_off); if (error) { WLDEV_ERROR(("Failed to set roam_off: mode:%d, error:%d\n", mode, error)); return -1; } #endif /* ROAM_ENABLE || DISABLE_BUILTIN_ROAM */ #ifdef VSDB_BW_ALLOCATE_ENABLE error = wldev_iovar_setint(dev, "mchan_algo", mchan_algo); if (error) { WLDEV_ERROR(("Failed to set mchan_algo: mode:%d, error:%d\n", mode, error)); return -1; } error = wldev_iovar_setint(dev, "mchan_bw", mchan_bw); if (error) { WLDEV_ERROR(("Failed to set mchan_bw: mode:%d, error:%d\n", mode, error)); return -1; } #endif /* VSDB_BW_ALLOCATE_ENABLE */ return error; }
/* tuning performance for miracast */ int wldev_miracast_tuning( struct net_device *dev, char *command, int total_len) { int error = 0; int mode = 0; int ampdu_mpdu; int ampdu_rx_tid = -1; int disable_interference_mitigation = 0; int auto_interference_mitigation = -1; #ifdef VSDB_BW_ALLOCATE_ENABLE int mchan_algo; int mchan_bw; #endif /* VSDB_BW_ALLOCATE_ENABLE */ if (sscanf(command, "%*s %d", &mode) != 1) { WLDEV_ERROR(("Failed to get mode\n")); return -1; } set_mode: WLDEV_ERROR(("mode: %d\n", mode)); if (mode == 0) { /* Normal mode: restore everything to default */ ampdu_mpdu = -1; /* FW default */ #ifdef VSDB_BW_ALLOCATE_ENABLE mchan_algo = 0; /* Default */ mchan_bw = 50; /* 50:50 */ #endif /* VSDB_BW_ALLOCATE_ENABLE */ } else if (mode == 1) { /* Miracast source mode */ ampdu_mpdu = 8; /* for tx latency */ #ifdef VSDB_BW_ALLOCATE_ENABLE mchan_algo = 1; /* BW based */ mchan_bw = 25; /* 25:75 */ #endif /* VSDB_BW_ALLOCATE_ENABLE */ } else if (mode == 2) { /* Miracast sink/PC Gaming mode */ ampdu_mpdu = 8; /* FW default */ #ifdef VSDB_BW_ALLOCATE_ENABLE mchan_algo = 0; /* Default */ mchan_bw = 50; /* 50:50 */ #endif /* VSDB_BW_ALLOCATE_ENABLE */ } else if (mode == 3) { ampdu_rx_tid = 0; mode = 2; goto set_mode; } else if (mode == 4) { ampdu_rx_tid = 0x5f; mode = 0; goto set_mode; } else if (mode == 5) { /* Blake connected mode, disable interference mitigation */ error = wldev_ioctl(dev, WLC_SET_INTERFERENCE_OVERRIDE_MODE, &disable_interference_mitigation, sizeof(int), true); if (error) { WLDEV_ERROR(( "Failed to set interference_override: mode:%d, error:%d\n", mode, error)); return -1; } return error; } else if (mode == 6) { /* No Blake connected, enable auto interference mitigation */ error = wldev_ioctl(dev, WLC_SET_INTERFERENCE_OVERRIDE_MODE, &auto_interference_mitigation, sizeof(int), true); if (error) { WLDEV_ERROR(( "Failed to set interference_override: mode:%d, error:%d\n", mode, error)); return -1; } return error; } else { WLDEV_ERROR(("Unknown mode: %d\n", mode)); return -1; } /* Update ampdu_mpdu */ error = wldev_iovar_setint(dev, "ampdu_mpdu", ampdu_mpdu); if (error) { WLDEV_ERROR(("Failed to set ampdu_mpdu: mode:%d, error:%d\n", mode, error)); return -1; } if (ampdu_rx_tid != -1) dhd_set_ampdu_rx_tid(dev, ampdu_rx_tid); #ifdef VSDB_BW_ALLOCATE_ENABLE error = wldev_iovar_setint(dev, "mchan_algo", mchan_algo); if (error) { WLDEV_ERROR(("Failed to set mchan_algo: mode:%d, error:%d\n", mode, error)); return -1; } error = wldev_iovar_setint(dev, "mchan_bw", mchan_bw); if (error) { WLDEV_ERROR(("Failed to set mchan_bw: mode:%d, error:%d\n", mode, error)); return -1; } #endif /* VSDB_BW_ALLOCATE_ENABLE */ return error; }
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; }
int wldev_miracast_tuning( struct net_device *dev, int mode) { int error = 0; int ampdu_mpdu; int roam_off; #ifdef VSDB_BW_ALLOCATE_ENABLE int mchan_algo; int mchan_bw; #endif WLDEV_ERROR(("mode: %d\n", mode)); if (mode == 0) { ampdu_mpdu = -1; #if defined(ROAM_ENABLE) roam_off = 0; #elif defined(DISABLE_BUILTIN_ROAM) roam_off = 1; #endif #ifdef VSDB_BW_ALLOCATE_ENABLE mchan_algo = 0; mchan_bw = 50; #endif } else if (mode == 1) { ampdu_mpdu = 8; #if defined(ROAM_ENABLE) || defined(DISABLE_BUILTIN_ROAM) roam_off = 1; #endif #ifdef VSDB_BW_ALLOCATE_ENABLE mchan_algo = 1; mchan_bw = 35; #endif } else if (mode == 2) { ampdu_mpdu = -1; #if defined(ROAM_ENABLE) || defined(DISABLE_BUILTIN_ROAM) roam_off = 1; #endif #ifdef VSDB_BW_ALLOCATE_ENABLE mchan_algo = 0; mchan_bw = 50; #endif } else { WLDEV_ERROR(("Unknown mode: %d\n", mode)); return -1; } error = wldev_iovar_setint(dev, "ampdu_mpdu", ampdu_mpdu); if (error) { WLDEV_ERROR(("Failed to set ampdu_mpdu: mode:%d, error:%d\n", mode, error)); return -1; } #if defined(ROAM_ENABLE) || defined(DISABLE_BUILTIN_ROAM) error = wldev_iovar_setint(dev, "roam_off", roam_off); if (error) { WLDEV_ERROR(("Failed to set roam_off: mode:%d, error:%d\n", mode, error)); return -1; } #endif #ifdef VSDB_BW_ALLOCATE_ENABLE error = wldev_iovar_setint(dev, "mchan_algo", mchan_algo); if (error) { WLDEV_ERROR(("Failed to set mchan_algo: mode:%d, error:%d\n", mode, error)); return -1; } error = wldev_iovar_setint(dev, "mchan_bw", mchan_bw); if (error) { WLDEV_ERROR(("Failed to set mchan_bw: mode:%d, error:%d\n", mode, error)); return -1; } #endif return error; }
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; } 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; } 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; } 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; }