Merge "Set passphrase for connman service when connecting using WPS without SSID... accepted/tizen/unified/20180709.064832 submit/tizen/20180706.050915
authortaesub kim <taesub.kim@samsung.com>
Fri, 6 Jul 2018 04:01:58 +0000 (04:01 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Fri, 6 Jul 2018 04:01:58 +0000 (04:01 +0000)
src/wifi-firmware.c

index 60a7abe..812755f 100755 (executable)
@@ -212,7 +212,7 @@ static int __netconfig_wifi_firmware_stop(enum netconfig_wifi_firmware type)
 
 static int __netconfig_set_rps_cpus(void)
 {
-       int fd, i;
+       int fd, curr;
        ssize_t count;
        char t_buf[TEMP_BUFFER_LEN];
        char r_buf[TEMP_BUFFER_LEN];
@@ -224,50 +224,51 @@ static int __netconfig_set_rps_cpus(void)
                DBG("WiFi driver loaded... ");
        }
 
-       for (i = 0; i < QUAD_CPUS_COUNT; i++) {
-               snprintf(t_buf, TEMP_BUFFER_LEN, "/sys/class/net/wlan0/queues/rx-%d/rps_cpus", i);
-               DBG("Command : [%s]", t_buf);
-               fd = open(t_buf, O_RDWR | O_CLOEXEC);
+       snprintf(t_buf, TEMP_BUFFER_LEN, "/sys/class/net/wlan0/queues/rx-0/rps_cpus");
+       DBG("Command : [%s]", t_buf);
+       curr = 0;
+
+       while ((fd = open(t_buf, O_RDWR | O_CLOEXEC)) >= 0) {
+               curr++;
+               count = read(fd, r_buf, 1);
 
-               if (fd < 0) {
-                       DBG("failed to open rps file");
+               if (count < 0) {
+                       DBG("read failed");
+                       close(fd);
                        return -1;
                } else {
-                       count = read(fd, r_buf, 1);
-
-                       if (count < 0) {
-                               DBG("read failed");
-                               close(fd);
-                               return -1;
-                       } else {
-                               DBG("read size = %d", count);
-                       }
-
-                       if (r_buf[0] == 'e') {
-                               close(fd);
-                               continue;
-                       } else {
-                               DBG("e is already written");
-                       }
-
-                       if (lseek(fd, 0, SEEK_SET) < 0) {
-                               DBG("lseek failed");
-                               close(fd);
-                               return -1;
-                       }
-
-                       count = write(fd, "e", 1);
-
-                       if (count < 0) {
-                               DBG("write failed");
-                               close(fd);
-                               return -1;
-                       } else {
-                               DBG("write size = %d", count);
-                       }
+                       DBG("read size = %d", count);
+               }
 
+               if (r_buf[0] == 'e') {
                        close(fd);
+                       DBG("e is already written");
+                       snprintf(t_buf, TEMP_BUFFER_LEN, "/sys/class/net/wlan0/queues/rx-%d/rps_cpus", curr);
+                       DBG("Command : [%s]", t_buf);
+                       continue;
+               } else {
+                       DBG("writing e");
+               }
+
+               if (lseek(fd, 0, SEEK_SET) < 0) {
+                       DBG("lseek failed");
+                       close(fd);
+                       return -1;
                }
+
+               count = write(fd, "e", 1);
+
+               if (count < 0) {
+                       DBG("write failed");
+                       close(fd);
+                       return -1;
+               } else {
+                       DBG("write size = %d", count);
+               }
+
+               close(fd);
+               snprintf(t_buf, TEMP_BUFFER_LEN, "/sys/class/net/wlan0/queues/rx-%d/rps_cpus", curr);
+               DBG("Command : [%s]", t_buf);
        }
 
        return 0;