old mode 100644new mode 100755| .. | .. |
|---|
| 88 | 88 | #define WL_BSSIDX_MAX 16 |
|---|
| 89 | 89 | #endif /* WL_STATIC_IF */ |
|---|
| 90 | 90 | |
|---|
| 91 | +uint android_msg_level = ANDROID_ERROR_LEVEL | ANDROID_MSG_LEVEL; |
|---|
| 92 | + |
|---|
| 91 | 93 | #define ANDROID_ERROR_MSG(x, args...) \ |
|---|
| 92 | 94 | do { \ |
|---|
| 93 | 95 | if (android_msg_level & ANDROID_ERROR_LEVEL) { \ |
|---|
| .. | .. |
|---|
| 726 | 728 | #define CMD_TWT_SETUP "TWT_SETUP" |
|---|
| 727 | 729 | #define CMD_TWT_TEARDOWN "TWT_TEARDOWN" |
|---|
| 728 | 730 | #define CMD_TWT_INFO "TWT_INFO_FRM" |
|---|
| 729 | | -#define CMD_TWT_STATUS_QUERY "GET_TWT_STATUS" |
|---|
| 730 | | -#define CMD_TWT_CAPABILITY "GET_TWT_CAP" |
|---|
| 731 | | -#define CMD_TWT_GET_STATS "GET_TWT_STATISTICS" |
|---|
| 732 | | -#define CMD_TWT_CLR_STATS "CLEAR_TWT_STATISTICS" |
|---|
| 733 | | -#define WL_TWT_CMD_INVAL 255 |
|---|
| 734 | | - |
|---|
| 735 | | -/* setup command name to value conversion */ |
|---|
| 736 | | -static struct { |
|---|
| 737 | | - const char *name; |
|---|
| 738 | | - uint8 val; |
|---|
| 739 | | -} setup_cmd_val[] = { |
|---|
| 740 | | - {"request", TWT_SETUP_CMD_REQUEST_TWT}, |
|---|
| 741 | | - {"suggest", TWT_SETUP_CMD_SUGGEST_TWT}, |
|---|
| 742 | | - {"demand", TWT_SETUP_CMD_DEMAND_TWT}, |
|---|
| 743 | | - {"accept", TWT_SETUP_CMD_ACCEPT_TWT}, |
|---|
| 744 | | - {"alternate", TWT_SETUP_CMD_ALTER_TWT}, |
|---|
| 745 | | - {"reject", TWT_SETUP_CMD_REJECT_TWT} |
|---|
| 746 | | -}; |
|---|
| 731 | +#define CMD_TWT_STATUS_QUERY "TWT_STATUS" |
|---|
| 732 | +#define CMD_TWT_CAPABILITY "TWT_CAP" |
|---|
| 747 | 733 | #endif /* WL_TWT */ |
|---|
| 748 | 734 | |
|---|
| 749 | 735 | /* drv command info structure */ |
|---|
| .. | .. |
|---|
| 910 | 896 | char *command, int total_len); |
|---|
| 911 | 897 | static int wlc_wbtext_get_roam_prof(struct net_device *ndev, wl_roamprof_band_t *rp, |
|---|
| 912 | 898 | uint8 band, uint8 *roam_prof_ver, uint8 *roam_prof_size); |
|---|
| 913 | | -#ifdef WES_SUPPORT |
|---|
| 914 | 899 | static int wl_android_wbtext_enable(struct net_device *dev, int mode); |
|---|
| 915 | | -#endif // WES_SUPPORT |
|---|
| 916 | 900 | #endif /* WBTEXT */ |
|---|
| 917 | 901 | #ifdef WES_SUPPORT |
|---|
| 918 | 902 | /* wl_roam.c */ |
|---|
| .. | .. |
|---|
| 1693 | 1677 | |
|---|
| 1694 | 1678 | #ifdef CUSTOMER_HW4_PRIVATE_CMD |
|---|
| 1695 | 1679 | #ifdef ROAM_API |
|---|
| 1680 | +#ifdef WBTEXT |
|---|
| 1681 | +static bool wl_android_check_wbtext_support(struct net_device *dev) |
|---|
| 1682 | +{ |
|---|
| 1683 | + dhd_pub_t *dhdp = wl_cfg80211_get_dhdp(dev); |
|---|
| 1684 | + return dhdp->wbtext_support; |
|---|
| 1685 | +} |
|---|
| 1686 | +#endif /* WBTEXT */ |
|---|
| 1687 | + |
|---|
| 1696 | 1688 | static bool |
|---|
| 1697 | 1689 | wl_android_check_wbtext_policy(struct net_device *dev) |
|---|
| 1698 | 1690 | { |
|---|
| .. | .. |
|---|
| 4298 | 4290 | return error; |
|---|
| 4299 | 4291 | } |
|---|
| 4300 | 4292 | |
|---|
| 4301 | | -#ifdef WES_SUPPORT |
|---|
| 4302 | | -static bool wl_android_check_wbtext_support(struct net_device *dev) |
|---|
| 4303 | | -{ |
|---|
| 4304 | | - dhd_pub_t *dhdp = wl_cfg80211_get_dhdp(dev); |
|---|
| 4305 | | - return dhdp->wbtext_support; |
|---|
| 4306 | | -} |
|---|
| 4307 | | - |
|---|
| 4308 | 4293 | static int |
|---|
| 4309 | 4294 | wl_android_wbtext_enable(struct net_device *dev, int mode) |
|---|
| 4310 | 4295 | { |
|---|
| .. | .. |
|---|
| 4323 | 4308 | |
|---|
| 4324 | 4309 | return error; |
|---|
| 4325 | 4310 | } |
|---|
| 4326 | | -#endif /* WES_SUPPORT */ |
|---|
| 4327 | 4311 | |
|---|
| 4328 | 4312 | static int wl_cfg80211_wbtext_btm_timer_threshold(struct net_device *dev, |
|---|
| 4329 | 4313 | char *command, int total_len) |
|---|
| .. | .. |
|---|
| 10282 | 10266 | exit: |
|---|
| 10283 | 10267 | #ifdef DHD_SEND_HANG_PRIVCMD_ERRORS |
|---|
| 10284 | 10268 | if (ret) { |
|---|
| 10285 | | - /* Avoid incrementing priv_cmd_errors in case of unsupported feature |
|---|
| 10286 | | - * or BUSY state specific to TWT commands |
|---|
| 10287 | | - */ |
|---|
| 10288 | | - if ( |
|---|
| 10289 | | -#ifdef WL_TWT |
|---|
| 10290 | | - ((ret != BCME_BUSY) && |
|---|
| 10291 | | - ((strnicmp(command, CMD_TWT_SETUP, strlen(CMD_TWT_SETUP)) == 0) || |
|---|
| 10292 | | - (strnicmp(command, CMD_TWT_TEARDOWN, strlen(CMD_TWT_TEARDOWN)) == 0) || |
|---|
| 10293 | | - (strnicmp(command, CMD_TWT_INFO, strlen(CMD_TWT_INFO)) == 0))) || |
|---|
| 10294 | | -#endif /* WL_TWT */ |
|---|
| 10295 | | - (ret != BCME_UNSUPPORTED)) { |
|---|
| 10269 | + /* Avoid incrementing priv_cmd_errors in case of unsupported feature */ |
|---|
| 10270 | + if (ret != BCME_UNSUPPORTED) { |
|---|
| 10296 | 10271 | wl_android_check_priv_cmd_errors(net); |
|---|
| 10297 | 10272 | } |
|---|
| 10298 | 10273 | } else { |
|---|
| .. | .. |
|---|
| 11172 | 11147 | |
|---|
| 11173 | 11148 | #ifdef WL_TWT |
|---|
| 11174 | 11149 | |
|---|
| 11175 | | -static uint8 |
|---|
| 11176 | | -wl_twt_cmd2val(const char *name) |
|---|
| 11177 | | -{ |
|---|
| 11178 | | - uint i; |
|---|
| 11179 | | - |
|---|
| 11180 | | - for (i = 0; i < ARRAYSIZE(setup_cmd_val); i ++) { |
|---|
| 11181 | | - if (strcmp(name, setup_cmd_val[i].name) == 0) { |
|---|
| 11182 | | - return setup_cmd_val[i].val; |
|---|
| 11183 | | - } |
|---|
| 11184 | | - } |
|---|
| 11185 | | - |
|---|
| 11186 | | - return WL_TWT_CMD_INVAL; |
|---|
| 11187 | | -} |
|---|
| 11188 | | - |
|---|
| 11189 | 11150 | static int |
|---|
| 11190 | 11151 | wl_android_twt_setup(struct net_device *ndev, char *command, int total_len) |
|---|
| 11191 | 11152 | { |
|---|
| 11192 | | - wl_twt_setup_t val; |
|---|
| 11193 | | - s32 bw = 0; |
|---|
| 11153 | + wl_twt_config_t val; |
|---|
| 11154 | + s32 bw; |
|---|
| 11194 | 11155 | char *token, *pos; |
|---|
| 11195 | 11156 | u8 mybuf[WLC_IOCTL_SMLEN] = {0}; |
|---|
| 11196 | 11157 | u8 resp_buf[WLC_IOCTL_SMLEN] = {0}; |
|---|
| 11158 | + u64 twt; |
|---|
| 11197 | 11159 | uint8 *rem = mybuf; |
|---|
| 11198 | 11160 | uint16 rem_len = sizeof(mybuf); |
|---|
| 11199 | | - uint8 tmp; |
|---|
| 11161 | + int32 val32; |
|---|
| 11200 | 11162 | |
|---|
| 11201 | 11163 | WL_DBG_MEM(("Enter. cmd:%s\n", command)); |
|---|
| 11202 | 11164 | |
|---|
| .. | .. |
|---|
| 11210 | 11172 | val.version = WL_TWT_SETUP_VER; |
|---|
| 11211 | 11173 | val.length = sizeof(val.version) + sizeof(val.length); |
|---|
| 11212 | 11174 | |
|---|
| 11213 | | - val.desc.bid = WL_TWT_INV_BCAST_ID; |
|---|
| 11214 | | - val.desc.flow_id = WL_TWT_INV_FLOW_ID; |
|---|
| 11215 | | - val.desc.btwt_persistence = WL_TWT_INFINITE_BTWT_PERSIST; |
|---|
| 11216 | | - val.desc.wake_type = WL_TWT_TIME_TYPE_AUTO; |
|---|
| 11175 | + /* Default values, Overide Below */ |
|---|
| 11176 | + val.desc.wake_time_h = 0xFFFFFFFF; |
|---|
| 11177 | + val.desc.wake_time_l = 0xFFFFFFFF; |
|---|
| 11178 | + val.desc.wake_int_min = 0xFFFFFFFF; |
|---|
| 11179 | + val.desc.wake_int_max = 0xFFFFFFFF; |
|---|
| 11180 | + val.desc.wake_dur_min = 0xFFFFFFFF; |
|---|
| 11181 | + val.desc.wake_dur_max = 0xFFFFFFFF; |
|---|
| 11182 | + val.desc.avg_pkt_num = 0xFFFFFFFF; |
|---|
| 11217 | 11183 | |
|---|
| 11218 | 11184 | pos = command + sizeof(CMD_TWT_SETUP); |
|---|
| 11219 | | - |
|---|
| 11220 | | - /* setup_cmd */ |
|---|
| 11221 | | - token = strsep((char**)&pos, " "); |
|---|
| 11222 | | - if (!token) { |
|---|
| 11223 | | - ANDROID_ERROR(("Mandaory param setup_cmd not present\n")); |
|---|
| 11224 | | - bw = -EINVAL; |
|---|
| 11225 | | - goto exit; |
|---|
| 11226 | | - } |
|---|
| 11227 | | - |
|---|
| 11228 | | - val.desc.setup_cmd = wl_twt_cmd2val(token); |
|---|
| 11229 | | - if (val.desc.setup_cmd == WL_TWT_CMD_INVAL) { |
|---|
| 11230 | | - ANDROID_ERROR(("Unrecognized TWT Setup command '%s'\n", token)); |
|---|
| 11231 | | - } |
|---|
| 11232 | | - ANDROID_INFO(("TWT_SETUP val.desc.setup_cmd %s\n", token)); |
|---|
| 11233 | 11185 | |
|---|
| 11234 | 11186 | /* negotiation_type */ |
|---|
| 11235 | 11187 | token = strsep((char**)&pos, " "); |
|---|
| .. | .. |
|---|
| 11238 | 11190 | bw = -EINVAL; |
|---|
| 11239 | 11191 | goto exit; |
|---|
| 11240 | 11192 | } |
|---|
| 11241 | | - val.desc.negotiation_type = htod32((u32)bcm_atoi(token)); |
|---|
| 11242 | | - ANDROID_INFO(("TWT_SETUP val.desc.negotiation_type %d\n", val.desc.negotiation_type)); |
|---|
| 11193 | + val.desc.negotiation_type = htod32((u32)bcm_atoi(token)); |
|---|
| 11243 | 11194 | |
|---|
| 11244 | | - if (pos != NULL) { |
|---|
| 11245 | | - ANDROID_INFO(("TWT_SETUP string %s\n", pos)); |
|---|
| 11246 | | - while ((token = bcmstrtok(&pos, " ", 0)) != NULL) { |
|---|
| 11247 | | - ANDROID_INFO(("TWT_SETUP token is %s\n", token)); |
|---|
| 11195 | + /* Wake Duration */ |
|---|
| 11196 | + token = strsep((char**)&pos, " "); |
|---|
| 11197 | + if (!token) { |
|---|
| 11198 | + ANDROID_ERROR(("Mandatory param wake Duration not present\n")); |
|---|
| 11199 | + bw = -EINVAL; |
|---|
| 11200 | + goto exit; |
|---|
| 11201 | + } |
|---|
| 11202 | + val.desc.wake_dur = htod32((u32)bcm_atoi(token)); |
|---|
| 11248 | 11203 | |
|---|
| 11249 | | - if (!strnicmp(token, "u", 1)) { |
|---|
| 11250 | | - val.desc.flow_flags |= WL_TWT_FLOW_FLAG_UNANNOUNCED; |
|---|
| 11251 | | - } |
|---|
| 11252 | | - else if (!strnicmp(token, "t", 1)) { |
|---|
| 11253 | | - val.desc.flow_flags |= WL_TWT_FLOW_FLAG_TRIGGER; |
|---|
| 11254 | | - } |
|---|
| 11255 | | - else if (!strnicmp(token, "n", 1)) { |
|---|
| 11256 | | - val.desc.flow_flags |= WL_TWT_FLOW_FLAG_UNSOLICITED; |
|---|
| 11257 | | - } |
|---|
| 11258 | | - else if (!strnicmp(token, "p", 1)) { |
|---|
| 11259 | | - token++; |
|---|
| 11260 | | - val.desc.btwt_persistence = (int)simple_strtol(token, NULL, 0); |
|---|
| 11261 | | - ANDROID_INFO(("TWT_SETUP broadcast persistence %d\n", |
|---|
| 11262 | | - val.desc.btwt_persistence)); |
|---|
| 11263 | | - } |
|---|
| 11264 | | - /* Wake Duration */ |
|---|
| 11265 | | - else if (!strnicmp(token, "-d", 2)) { |
|---|
| 11266 | | - if ((token = bcmstrtok(&pos, " ", 0)) != NULL) { |
|---|
| 11267 | | - val.desc.wake_dur = (int)simple_strtol(token, NULL, 0); |
|---|
| 11268 | | - ANDROID_INFO(("TWT_SETUP val.desc.wake_dur %d\n", |
|---|
| 11269 | | - val.desc.wake_dur)); |
|---|
| 11270 | | - } |
|---|
| 11271 | | - } |
|---|
| 11272 | | - /* Wake Interval */ |
|---|
| 11273 | | - else if (!strnicmp(token, "-i", 2)) { |
|---|
| 11274 | | - if ((token = bcmstrtok(&pos, " ", 0)) != NULL) { |
|---|
| 11275 | | - val.desc.wake_int = (int)simple_strtol(token, NULL, 0); |
|---|
| 11276 | | - ANDROID_INFO(("TWT_SETUP val.desc.wake_int %d\n", |
|---|
| 11277 | | - val.desc.wake_int)); |
|---|
| 11278 | | - } |
|---|
| 11279 | | - } |
|---|
| 11280 | | - /* flow id */ |
|---|
| 11281 | | - else if (!strnicmp(token, "-f", 2)) { |
|---|
| 11282 | | - if ((token = bcmstrtok(&pos, " ", 0)) != NULL) { |
|---|
| 11283 | | - val.desc.flow_id = (int)simple_strtol(token, NULL, 0); |
|---|
| 11284 | | - ANDROID_INFO(("TWT_SETUP val.desc.flow_id %d\n", |
|---|
| 11285 | | - val.desc.flow_id)); |
|---|
| 11286 | | - } |
|---|
| 11287 | | - } |
|---|
| 11288 | | - else if (!strnicmp(token, "-b", 2)) { |
|---|
| 11289 | | - if ((token = bcmstrtok(&pos, " ", 0)) != NULL) { |
|---|
| 11290 | | - val.desc.bid = (int)simple_strtol(token, NULL, 0); |
|---|
| 11291 | | - ANDROID_INFO(("TWT_SETUP val.desc.bid %d\n", val.desc.bid)); |
|---|
| 11292 | | - } |
|---|
| 11293 | | - } |
|---|
| 11294 | | - else if (!strnicmp(token, "-r", 2)) { |
|---|
| 11295 | | - if ((token = bcmstrtok(&pos, " ", 0)) != NULL) { |
|---|
| 11296 | | - tmp = (int)simple_strtol(token, NULL, 0); |
|---|
| 11297 | | - if (tmp > TWT_BCAST_FRAME_RECOMM_3) { |
|---|
| 11298 | | - bw = -EINVAL; |
|---|
| 11299 | | - goto exit; |
|---|
| 11300 | | - } |
|---|
| 11301 | | - val.desc.bid = tmp; |
|---|
| 11302 | | - ANDROID_INFO(("TWT_SETUP frame recommendation %d\n", |
|---|
| 11303 | | - val.desc.frame_recomm)); |
|---|
| 11304 | | - } |
|---|
| 11305 | | - } |
|---|
| 11306 | | - else if (!strnicmp(token, "-s", 2)) { |
|---|
| 11307 | | - if ((token = bcmstrtok(&pos, " ", 0)) != NULL) { |
|---|
| 11308 | | - val.desc.duty_cycle_min = |
|---|
| 11309 | | - (int)simple_strtol(token, NULL, 0); |
|---|
| 11310 | | - ANDROID_INFO(("TWT_SETUP duty_cycle_min %d\n", |
|---|
| 11311 | | - val.desc.duty_cycle_min)); |
|---|
| 11312 | | - } |
|---|
| 11313 | | - } |
|---|
| 11314 | | - else if (!strnicmp(token, "-v", 2)) { |
|---|
| 11315 | | - if ((token = bcmstrtok(&pos, " ", 0)) != NULL) { |
|---|
| 11316 | | - val.desc.wake_int_max = (int)simple_strtol(token, NULL, 0); |
|---|
| 11317 | | - ANDROID_INFO(("TWT_SETUP wake_int_max %d\n", |
|---|
| 11318 | | - val.desc.wake_int_max)); |
|---|
| 11319 | | - } |
|---|
| 11320 | | - } |
|---|
| 11321 | | - /* a peer_address */ |
|---|
| 11322 | | - else if (!strnicmp(token, "-a", 2)) { |
|---|
| 11323 | | - if ((token = bcmstrtok(&pos, " ", 0)) != NULL) { |
|---|
| 11324 | | - if (!bcm_ether_atoe(token, &val.peer)) { |
|---|
| 11325 | | - ANDROID_ERROR(("%s : Malformed peer addr\n", |
|---|
| 11326 | | - __FUNCTION__)); |
|---|
| 11327 | | - bw = -EINVAL; |
|---|
| 11328 | | - goto exit; |
|---|
| 11329 | | - } |
|---|
| 11330 | | - } |
|---|
| 11331 | | - } |
|---|
| 11204 | + /* Wake interval */ |
|---|
| 11205 | + token = strsep((char**)&pos, " "); |
|---|
| 11206 | + if (!token) { |
|---|
| 11207 | + ANDROID_ERROR(("Mandaory param Wake Interval not present\n")); |
|---|
| 11208 | + bw = -EINVAL; |
|---|
| 11209 | + goto exit; |
|---|
| 11210 | + } |
|---|
| 11211 | + val.desc.wake_int = htod32((u32)bcm_atoi(token)); |
|---|
| 11212 | + |
|---|
| 11213 | + /* Wake Time parameter */ |
|---|
| 11214 | + token = strsep((char**)&pos, " "); |
|---|
| 11215 | + if (!token) { |
|---|
| 11216 | + ANDROID_ERROR(("No Wake Time parameter provided, using default\n")); |
|---|
| 11217 | + } else { |
|---|
| 11218 | + twt = (u64)bcm_atoi(token); |
|---|
| 11219 | + val32 = htod32((u32)(twt >> 32)); |
|---|
| 11220 | + if ((val32 != -1) && ((int32)(htod32((u32)twt)) != -1)) { |
|---|
| 11221 | + val.desc.wake_time_h = htod32((u32)(twt >> 32)); |
|---|
| 11222 | + val.desc.wake_time_l = htod32((u32)twt); |
|---|
| 11332 | 11223 | } |
|---|
| 11333 | 11224 | } |
|---|
| 11334 | 11225 | |
|---|
| 11335 | | - bw = bcm_pack_xtlv_entry(&rem, &rem_len, WL_TWT_CMD_SETUP, |
|---|
| 11226 | + /* Minimum allowed Wake interval */ |
|---|
| 11227 | + token = strsep((char**)&pos, " "); |
|---|
| 11228 | + if (!token) { |
|---|
| 11229 | + ANDROID_ERROR(("No Minimum allowed Wake interval provided, using default\n")); |
|---|
| 11230 | + } else { |
|---|
| 11231 | + val32 = htod32((u32)bcm_atoi(token)); |
|---|
| 11232 | + if (val32 != -1) { |
|---|
| 11233 | + val.desc.wake_int_min = htod32((u32)bcm_atoi(token)); |
|---|
| 11234 | + } |
|---|
| 11235 | + } |
|---|
| 11236 | + |
|---|
| 11237 | + /* Max Allowed Wake interval */ |
|---|
| 11238 | + token = strsep((char**)&pos, " "); |
|---|
| 11239 | + if (!token) { |
|---|
| 11240 | + ANDROID_ERROR(("Maximum allowed Wake interval not provided, using default\n")); |
|---|
| 11241 | + } else { |
|---|
| 11242 | + val32 = htod32((u32)bcm_atoi(token)); |
|---|
| 11243 | + if (val32 != -1) { |
|---|
| 11244 | + val.desc.wake_int_max = htod32((u32)bcm_atoi(token)); |
|---|
| 11245 | + } |
|---|
| 11246 | + } |
|---|
| 11247 | + |
|---|
| 11248 | + /* Minimum allowed Wake duration */ |
|---|
| 11249 | + token = strsep((char**)&pos, " "); |
|---|
| 11250 | + if (!token) { |
|---|
| 11251 | + ANDROID_ERROR(("Maximum allowed Wake duration not provided, using default\n")); |
|---|
| 11252 | + } else { |
|---|
| 11253 | + val32 = htod32((u32)bcm_atoi(token)); |
|---|
| 11254 | + if (val32 != -1) { |
|---|
| 11255 | + val.desc.wake_dur_min = htod32((u32)bcm_atoi(token)); |
|---|
| 11256 | + } |
|---|
| 11257 | + } |
|---|
| 11258 | + |
|---|
| 11259 | + /* Maximum allowed Wake duration */ |
|---|
| 11260 | + token = strsep((char**)&pos, " "); |
|---|
| 11261 | + if (!token) { |
|---|
| 11262 | + ANDROID_ERROR(("Maximum allowed Wake duration not provided, using default\n")); |
|---|
| 11263 | + } else { |
|---|
| 11264 | + val32 = htod32((u32)bcm_atoi(token)); |
|---|
| 11265 | + if (val32 != -1) { |
|---|
| 11266 | + val.desc.wake_dur_max = htod32((u32)bcm_atoi(token)); |
|---|
| 11267 | + } |
|---|
| 11268 | + } |
|---|
| 11269 | + |
|---|
| 11270 | + /* Average number of packets */ |
|---|
| 11271 | + token = strsep((char**)&pos, " "); |
|---|
| 11272 | + if (!token) { |
|---|
| 11273 | + ANDROID_ERROR(("Average number of packets not provided, using default\n")); |
|---|
| 11274 | + } else { |
|---|
| 11275 | + val32 = htod32((u32)bcm_atoi(token)); |
|---|
| 11276 | + if (val32 != -1) { |
|---|
| 11277 | + val.desc.avg_pkt_num = htod32((u32)bcm_atoi(token)); |
|---|
| 11278 | + } |
|---|
| 11279 | + } |
|---|
| 11280 | + |
|---|
| 11281 | + /* a peer_address */ |
|---|
| 11282 | + token = strsep((char**)&pos, " "); |
|---|
| 11283 | + if (!token) { |
|---|
| 11284 | + ANDROID_ERROR(("Average number of packets not provided, using default\n")); |
|---|
| 11285 | + } else { |
|---|
| 11286 | + /* get peer mac */ |
|---|
| 11287 | + if (!bcm_ether_atoe(token, &val.peer)) { |
|---|
| 11288 | + ANDROID_ERROR(("%s : Malformed peer addr\n", __FUNCTION__)); |
|---|
| 11289 | + bw = BCME_ERROR; |
|---|
| 11290 | + goto exit; |
|---|
| 11291 | + } |
|---|
| 11292 | + } |
|---|
| 11293 | + |
|---|
| 11294 | + bw = bcm_pack_xtlv_entry(&rem, &rem_len, WL_TWT_CMD_CONFIG, |
|---|
| 11336 | 11295 | sizeof(val), (uint8 *)&val, BCM_XTLV_OPTION_ALIGN32); |
|---|
| 11337 | 11296 | if (bw != BCME_OK) { |
|---|
| 11338 | 11297 | goto exit; |
|---|
| .. | .. |
|---|
| 11341 | 11300 | bw = wldev_iovar_setbuf(ndev, "twt", |
|---|
| 11342 | 11301 | mybuf, sizeof(mybuf) - rem_len, resp_buf, WLC_IOCTL_SMLEN, NULL); |
|---|
| 11343 | 11302 | if (bw < 0) { |
|---|
| 11344 | | - ANDROID_ERROR(("twt setup failed. ret:%d\n", bw)); |
|---|
| 11303 | + ANDROID_ERROR(("twt config set failed. ret:%d\n", bw)); |
|---|
| 11345 | 11304 | } |
|---|
| 11346 | 11305 | exit: |
|---|
| 11347 | 11306 | return bw; |
|---|
| .. | .. |
|---|
| 11949 | 11908 | } |
|---|
| 11950 | 11909 | exit: |
|---|
| 11951 | 11910 | return bw; |
|---|
| 11952 | | -} |
|---|
| 11953 | | - |
|---|
| 11954 | | -/* wl twt stats result display version 2 */ |
|---|
| 11955 | | -static int |
|---|
| 11956 | | -wl_android_twt_stats_display_v2(wl_twt_stats_v2_t *stats, char *command, int total_len) |
|---|
| 11957 | | -{ |
|---|
| 11958 | | - u32 i; |
|---|
| 11959 | | - wl_twt_peer_stats_v2_t *peer_stats; |
|---|
| 11960 | | - int rem_len = 0, bytes_written = 0; |
|---|
| 11961 | | - |
|---|
| 11962 | | - rem_len = total_len; |
|---|
| 11963 | | - for (i = 0; i < stats->num_stats; i++) { |
|---|
| 11964 | | - peer_stats = &stats->peer_stats_list[i]; |
|---|
| 11965 | | - |
|---|
| 11966 | | - bytes_written = scnprintf(command, rem_len, |
|---|
| 11967 | | - "%u %u %u %u %u", |
|---|
| 11968 | | - peer_stats->eosp_dur_avg, peer_stats->tx_pkts_avg, peer_stats->rx_pkts_avg, |
|---|
| 11969 | | - peer_stats->tx_pkt_sz_avg, peer_stats->rx_pkt_sz_avg); |
|---|
| 11970 | | - CHECK_SCNPRINTF_RET_VAL(bytes_written); |
|---|
| 11971 | | - command += bytes_written; |
|---|
| 11972 | | - rem_len -= bytes_written; |
|---|
| 11973 | | - } |
|---|
| 11974 | | - |
|---|
| 11975 | | - if ((total_len - rem_len) > 0) { |
|---|
| 11976 | | - return (total_len - rem_len); |
|---|
| 11977 | | - } else { |
|---|
| 11978 | | - return BCME_ERROR; |
|---|
| 11979 | | - } |
|---|
| 11980 | | -} |
|---|
| 11981 | | - |
|---|
| 11982 | | -static int |
|---|
| 11983 | | -wl_android_twt_stats(struct net_device *ndev, char *command, int total_len) |
|---|
| 11984 | | -{ |
|---|
| 11985 | | - wl_twt_stats_cmd_v1_t query; |
|---|
| 11986 | | - wl_twt_stats_v2_t stats_v2; |
|---|
| 11987 | | - int ret = BCME_OK; |
|---|
| 11988 | | - char iovbuf[WLC_IOCTL_SMLEN] = {0, }; |
|---|
| 11989 | | - uint8 *pxtlv = NULL; |
|---|
| 11990 | | - uint8 *iovresp = NULL; |
|---|
| 11991 | | - char *token, *pos; |
|---|
| 11992 | | - uint16 buflen = 0, bufstart = 0; |
|---|
| 11993 | | - struct bcm_cfg80211 *cfg = wl_get_cfg(ndev); |
|---|
| 11994 | | - |
|---|
| 11995 | | - WL_DBG_MEM(("Enter. cmd:%s\n", command)); |
|---|
| 11996 | | - |
|---|
| 11997 | | - bzero(&query, sizeof(query)); |
|---|
| 11998 | | - query.version = WL_TWT_STATS_CMD_VERSION_1; |
|---|
| 11999 | | - query.length = sizeof(query) - OFFSETOF(wl_twt_stats_cmd_v1_t, peer); |
|---|
| 12000 | | - |
|---|
| 12001 | | - /* Default values, Overide Below */ |
|---|
| 12002 | | - query.num_bid = 0xFF; |
|---|
| 12003 | | - query.num_fid = 0xFF; |
|---|
| 12004 | | - |
|---|
| 12005 | | - if (!(strnicmp(command, CMD_TWT_CLR_STATS, strlen(CMD_TWT_CLR_STATS)))) { |
|---|
| 12006 | | - query.flags |= WL_TWT_STATS_CMD_FLAGS_RESET; |
|---|
| 12007 | | - pos = command + sizeof(CMD_TWT_CLR_STATS); |
|---|
| 12008 | | - } else if (!(strnicmp(command, CMD_TWT_GET_STATS, strlen(CMD_TWT_GET_STATS)))) { |
|---|
| 12009 | | - pos = command + sizeof(CMD_TWT_GET_STATS); |
|---|
| 12010 | | - } |
|---|
| 12011 | | - |
|---|
| 12012 | | - /* Config ID */ |
|---|
| 12013 | | - token = strsep((char**)&pos, " "); |
|---|
| 12014 | | - if (!token) { |
|---|
| 12015 | | - ANDROID_ERROR(("Mandatory param config ID not present\n")); |
|---|
| 12016 | | - ret = -EINVAL; |
|---|
| 12017 | | - goto exit; |
|---|
| 12018 | | - } |
|---|
| 12019 | | - query.configID = (u8)bcm_atoi(token); |
|---|
| 12020 | | - |
|---|
| 12021 | | - iovresp = (uint8 *)MALLOCZ(cfg->osh, WLC_IOCTL_MEDLEN); |
|---|
| 12022 | | - if (iovresp == NULL) { |
|---|
| 12023 | | - ANDROID_ERROR(("%s: iov resp memory alloc exited\n", __FUNCTION__)); |
|---|
| 12024 | | - goto exit; |
|---|
| 12025 | | - } |
|---|
| 12026 | | - |
|---|
| 12027 | | - buflen = bufstart = WLC_IOCTL_SMLEN; |
|---|
| 12028 | | - pxtlv = (uint8 *)iovbuf; |
|---|
| 12029 | | - ret = bcm_pack_xtlv_entry(&pxtlv, &buflen, WL_TWT_CMD_STATS, |
|---|
| 12030 | | - sizeof(query), (uint8 *)&query, BCM_XTLV_OPTION_ALIGN32); |
|---|
| 12031 | | - if (ret != BCME_OK) { |
|---|
| 12032 | | - ANDROID_ERROR(("%s : Error return during pack xtlv :%d\n", __FUNCTION__, ret)); |
|---|
| 12033 | | - goto exit; |
|---|
| 12034 | | - } |
|---|
| 12035 | | - |
|---|
| 12036 | | - if ((ret = wldev_iovar_getbuf(ndev, "twt", iovbuf, bufstart-buflen, |
|---|
| 12037 | | - iovresp, WLC_IOCTL_MEDLEN, NULL))) { |
|---|
| 12038 | | - ANDROID_ERROR(("twt status failed with err=%d \n", ret)); |
|---|
| 12039 | | - goto exit; |
|---|
| 12040 | | - } |
|---|
| 12041 | | - |
|---|
| 12042 | | - (void)memcpy_s(&stats_v2, sizeof(stats_v2), iovresp, sizeof(stats_v2)); |
|---|
| 12043 | | - |
|---|
| 12044 | | - if (dtoh16(stats_v2.version) == WL_TWT_STATS_VERSION_2) { |
|---|
| 12045 | | - if (!(strnicmp(command, CMD_TWT_GET_STATS, strlen(CMD_TWT_GET_STATS)))) { |
|---|
| 12046 | | - ANDROID_ERROR(("stats query ver %d, \n", dtoh16(stats_v2.version))); |
|---|
| 12047 | | - ret = wl_android_twt_stats_display_v2((wl_twt_stats_v2_t*)iovresp, |
|---|
| 12048 | | - command, total_len); |
|---|
| 12049 | | - } |
|---|
| 12050 | | - } else { |
|---|
| 12051 | | - ret = BCME_UNSUPPORTED; |
|---|
| 12052 | | - ANDROID_ERROR(("Version 1 unsupported. ver %d, \n", dtoh16(stats_v2.version))); |
|---|
| 12053 | | - goto exit; |
|---|
| 12054 | | - } |
|---|
| 12055 | | - |
|---|
| 12056 | | -exit: |
|---|
| 12057 | | - if (iovresp) { |
|---|
| 12058 | | - MFREE(cfg->osh, iovresp, WLC_IOCTL_MEDLEN); |
|---|
| 12059 | | - } |
|---|
| 12060 | | - |
|---|
| 12061 | | - return ret; |
|---|
| 12062 | 11911 | } |
|---|
| 12063 | 11912 | #endif /* WL_TWT */ |
|---|
| 12064 | 11913 | |
|---|
| .. | .. |
|---|
| 13026 | 12875 | } |
|---|
| 13027 | 12876 | else if (strnicmp(command, CMD_TWT_CAPABILITY, strlen(CMD_TWT_CAPABILITY)) == 0) { |
|---|
| 13028 | 12877 | bytes_written = wl_android_twt_cap(net, command, priv_cmd.total_len); |
|---|
| 13029 | | - } |
|---|
| 13030 | | - else if ((strnicmp(command, CMD_TWT_GET_STATS, strlen(CMD_TWT_GET_STATS)) == 0) || |
|---|
| 13031 | | - (strnicmp(command, CMD_TWT_CLR_STATS, strlen(CMD_TWT_CLR_STATS)) == 0)) { |
|---|
| 13032 | | - bytes_written = wl_android_twt_stats(net, command, priv_cmd.total_len); |
|---|
| 13033 | 12878 | } |
|---|
| 13034 | 12879 | #endif /* WL_TWT */ |
|---|
| 13035 | 12880 | #ifdef WL_P2P_6G |
|---|