]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
net: wireless: bcmdhd: Add pno timing to custom scan policy.
authorMichael Hsu <mhsu@nvidia.com>
Thu, 6 Aug 2015 02:34:58 +0000 (19:34 -0700)
committermobile promotions <svcmobile_promotions@nvidia.com>
Sat, 5 Sep 2015 00:40:37 +0000 (17:40 -0700)
Allow PNO (preferred network offload) scanning timing parameters to
be configured via the bcmdhd driver sysfs node.

Write this character string to the bcmdhd sysfs node for scan configuration:
  pno <time> <repeat> <freq_expo_max> <pno-timing-parameter>...
where <pno-timing-parameter> is one of these options:
  -H home_away_time
  -n nprobes
  -a active_time
  -p passive_time
  -h home_time

Change-Id: I0ac75a6935dad2af53c998f871d4f5bbab9cc4de
Signed-off-by: Michael Hsu <mhsu@nvidia.com>
Reviewed-on: http://git-master/r/782133
(cherry picked from commit 265c05f28b74c2886efecc4b76c1e99a4650f8f7)
Reviewed-on: http://git-master/r/779545
Tested-by: Nagaraj Annaiah <nannaiah@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
drivers/net/wireless/bcmdhd/dhd_custom_sysfs_tegra_scan.c
drivers/net/wireless/bcmdhd/dhd_custom_sysfs_tegra_scan.h
drivers/net/wireless/bcmdhd/wl_cfg80211.c

index 675bb4906c18e4729f614990dc45c9ba55b99713..24c6278c0035a207c920fc307394bd3b49ff0672 100644 (file)
@@ -1249,6 +1249,11 @@ wifi_scan_request_done(struct cfg80211_scan_request *request)
 int wifi_scan_pno_time;
 int wifi_scan_pno_repeat;
 int wifi_scan_pno_freq_expo_max;
+int wifi_scan_pno_home_away_time;
+int wifi_scan_pno_nprobes;
+int wifi_scan_pno_active_time;
+int wifi_scan_pno_passive_time;
+int wifi_scan_pno_home_time;
 
 int wifi_scan_wait;
 DECLARE_WAIT_QUEUE_HEAD(wifi_scan_wait_queue);
@@ -1445,10 +1450,20 @@ tegra_sysfs_histogram_scan_show(struct device *dev,
                        "PNO scan settings:\n"
                        "  pno_time %d\n"
                        "  pno_repeat %d\n"
-                       "  pno_freq_expo_max %d\n",
+                       "  pno_freq_expo_max %d\n"
+                       "  wifi_scan_pno_home_away_time %d\n"
+                       "  wifi_scan_pno_nprobes %d\n"
+                       "  wifi_scan_pno_active_time %d\n"
+                       "  wifi_scan_pno_passive_time %d\n"
+                       "  wifi_scan_pno_home_time %d\n",
                        wifi_scan_pno_time,
                        wifi_scan_pno_repeat,
-                       wifi_scan_pno_freq_expo_max);
+                       wifi_scan_pno_freq_expo_max,
+                       wifi_scan_pno_home_away_time,
+                       wifi_scan_pno_nprobes,
+                       wifi_scan_pno_active_time,
+                       wifi_scan_pno_passive_time,
+                       wifi_scan_pno_home_time);
                if (PAGE_SIZE - (s - buf) == strlen(s) + 1) {
                        *s = '\0';
                        goto abort_show_item;
@@ -1473,7 +1488,7 @@ tegra_sysfs_histogram_scan_store(struct device *dev,
        struct device_attribute *attr,
        const char *buf, size_t count)
 {
-       int a, b, c;
+       int a, b, c, skip;
 
 //     pr_info("%s\n", __func__);
 
@@ -1488,16 +1503,48 @@ tegra_sysfs_histogram_scan_store(struct device *dev,
        } else if (strncmp(buf, "-policy ", 8) == 0) {
                wifi_scan_policy__remove(buf + 8, count - 8);
        } else if (strncmp(buf, "pno ", 4) == 0) {
-               if (sscanf(buf + 4, "%d %d %d", &a, &b, &c) != 3) {
+               if (sscanf(buf + 4, "%d %d %d%n", &a, &b, &c, &skip) < 3) {
                        pr_err("%s: invalid pno setting:"
                                " pno <pno_time>"
                                " <pno_repeat> <pno_freq_expo_max>\n",
                                __func__);
                        return count;
                }
+               buf += 4 + skip;
                wifi_scan_pno_time = a;
                wifi_scan_pno_repeat = b;
                wifi_scan_pno_freq_expo_max = c;
+check_pno_arguments_again:
+               if (sscanf(buf, " -H %d%n", &a, &skip) >= 1) {
+                       pr_info("-H %d\n", a);
+                       wifi_scan_pno_home_away_time = a;
+                       buf += skip;
+                       goto check_pno_arguments_again;
+               }
+               if (sscanf(buf, " -n %d%n", &a, &skip) >= 1) {
+                       pr_info("-n %d\n", a);
+                       wifi_scan_pno_nprobes = a;
+                       buf += skip;
+                       goto check_pno_arguments_again;
+               }
+               if (sscanf(buf, " -a %d%n", &a, &skip) >= 1) {
+                       pr_info("-a %d\n", a);
+                       wifi_scan_pno_active_time = a;
+                       buf += skip;
+                       goto check_pno_arguments_again;
+               }
+               if (sscanf(buf, " -p %d%n", &a, &skip) >= 1) {
+                       pr_info("-p %d\n", a);
+                       wifi_scan_pno_passive_time = a;
+                       buf += skip;
+                       goto check_pno_arguments_again;
+               }
+               if (sscanf(buf, " -h %d%n", &a, &skip) >= 1) {
+                       pr_info("-h %d\n", a);
+                       wifi_scan_pno_home_time = a;
+                       buf += skip;
+                       goto check_pno_arguments_again;
+               }
        } else {
                pr_err("%s: unknown command\n", __func__);
        }
index d6165aaf36d7993f2a468d8bc99cc9b5c2395a7a..9871b3e82c66918b9281d988f0f7961d20296af0 100644 (file)
@@ -427,8 +427,13 @@ wifi_scan_request_done(struct cfg80211_scan_request *request);
 extern int wifi_scan_pno_time;
 extern int wifi_scan_pno_repeat;
 extern int wifi_scan_pno_freq_expo_max;
+extern int wifi_scan_pno_home_away_time;
+extern int wifi_scan_pno_nprobes;
+extern int wifi_scan_pno_active_time;
+extern int wifi_scan_pno_passive_time;
+extern int wifi_scan_pno_home_time;
 
-#define TEGRA_PNO_SCAN_PREPARE(request,\
+#define TEGRA_PNO_SCAN_PREPARE(netdev, dhd, request,\
                pno_time, pno_repeat, pno_freq_expo_max)\
        {\
                if ((wifi_scan_pno_time != 0) &&\
@@ -458,6 +463,64 @@ extern int wifi_scan_pno_freq_expo_max;
                                wifi_scan_pno_freq_expo_max);\
                        pno_freq_expo_max = wifi_scan_pno_freq_expo_max;\
                }\
+               if (wifi_scan_pno_home_away_time != 0) {\
+                       WIFI_SCAN_DEBUG("%s: TEGRA_PNO_SCAN_PREPARE:"\
+                               " home_away_time %d ms\n",\
+                               __func__,\
+                               wifi_scan_pno_home_away_time);\
+                       wldev_iovar_setint(netdev,\
+                               "scan_home_away_time",\
+                               wifi_scan_pno_home_away_time);\
+               }\
+               if (wifi_scan_pno_nprobes != 0) {\
+                       WIFI_SCAN_DEBUG("%s: TEGRA_PNO_SCAN_PREPARE:"\
+                               " nprobes %d\n",\
+                               __func__,\
+                               wifi_scan_pno_nprobes);\
+                       dhd_wl_ioctl_cmd(dhd,\
+                               WLC_SET_SCAN_NPROBES,\
+                               (char *) &wifi_scan_pno_nprobes,\
+                               sizeof(wifi_scan_pno_nprobes),\
+                               TRUE, 0);\
+               }\
+               if (wifi_scan_pno_active_time != 0) {\
+                       WIFI_SCAN_DEBUG("%s: TEGRA_PNO_SCAN_PREPARE:"\
+                               " active_time %d ms\n",\
+                               __func__,\
+                               wifi_scan_pno_active_time);\
+                       dhd_wl_ioctl_cmd(dhd,\
+                               WLC_SET_SCAN_CHANNEL_TIME,\
+                               (char *) &wifi_scan_pno_active_time,\
+                               sizeof(wifi_scan_pno_active_time),\
+                               TRUE, 0);\
+                       dhd_wl_ioctl_cmd(dhd,\
+                               WLC_SET_SCAN_UNASSOC_TIME,\
+                               (char *) &wifi_scan_pno_active_time,\
+                               sizeof(wifi_scan_pno_active_time),\
+                               TRUE, 0);\
+               }\
+               if (wifi_scan_pno_passive_time != 0) {\
+                       WIFI_SCAN_DEBUG("%s: TEGRA_PNO_SCAN_PREPARE:"\
+                               " passive_time %d ms\n",\
+                               __func__,\
+                               wifi_scan_pno_passive_time);\
+                       dhd_wl_ioctl_cmd(dhd,\
+                               WLC_SET_SCAN_PASSIVE_TIME,\
+                               (char *) &wifi_scan_pno_passive_time,\
+                               sizeof(wifi_scan_pno_passive_time),\
+                               TRUE, 0);\
+               }\
+               if (wifi_scan_pno_home_time != 0) {\
+                       WIFI_SCAN_DEBUG("%s: TEGRA_PNO_SCAN_PREPARE:"\
+                               " home_time %d ms\n",\
+                               __func__,\
+                               wifi_scan_pno_home_time);\
+                       dhd_wl_ioctl_cmd(dhd,\
+                               WLC_SET_SCAN_HOME_TIME,\
+                               (char *) &wifi_scan_pno_home_time,\
+                               sizeof(wifi_scan_pno_home_time),\
+                               TRUE, 0);\
+               }\
        }\
 
 extern int wifi_scan_wait;
index c9870ae073ac3c17c201da8c180be1d500b7d699..28a24b59e6d26d512729e861c1e843ee987af7e7 100644 (file)
@@ -7723,8 +7723,13 @@ wl_cfg80211_sched_scan_start(struct wiphy *wiphy,
                request->n_ssids, pno_time, pno_repeat, pno_freq_expo_max));
 
 #ifdef CONFIG_BCMDHD_CUSTOM_SYSFS_TEGRA
-       TEGRA_PNO_SCAN_PREPARE(request,
-               pno_time, pno_repeat, pno_freq_expo_max)
+       {
+               struct bcm_cfg80211 *cfg = wiphy_priv(wiphy);
+               dhd_pub_t *dhd = (dhd_pub_t *)(cfg->pub);
+               if (cfg && dhd)
+                       TEGRA_PNO_SCAN_PREPARE(dev, dhd, request,
+                               pno_time, pno_repeat, pno_freq_expo_max)
+       }
 #endif
 
        if (!request || !request->n_ssids || !request->n_match_sets) {