X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fwifi-firmware.c;h=60a7abe1366d32aa00a4031cc8fd9996d8acec19;hb=80d17fd983ce5ab9b6aa7cd3cbfda529ef46dcf9;hp=3cfd322d61f0e967b177001ad61822ea2a05d7a9;hpb=47583ad99afe9f3f12c2bba1881682519cb44ff8;p=platform%2Fcore%2Fconnectivity%2Fnet-config.git diff --git a/src/wifi-firmware.c b/src/wifi-firmware.c index 3cfd322..60a7abe 100755 --- a/src/wifi-firmware.c +++ b/src/wifi-firmware.c @@ -20,6 +20,8 @@ #include #include #include +#include +#include #include "log.h" #include "util.h" @@ -36,6 +38,9 @@ #define WLAN_P2P_IFACE_NAME_TV "p2p0" #define WLAN_P2P_IFACE_NAME_COMMON "wlan0" #define WLAN_P2P_IFACE_NAME ((TIZEN_TV) ? (WLAN_P2P_IFACE_NAME_TV) : (WLAN_P2P_IFACE_NAME_COMMON)) +#define QUAD_CPUS_COUNT 4 +#define TEMP_BUFFER_LEN 100 +#define WIFI_MAC_ADD_PATH "/sys/class/net/wlan0/address" static int __netconfig_sta_firmware_start(void) { @@ -205,6 +210,69 @@ static int __netconfig_wifi_firmware_stop(enum netconfig_wifi_firmware type) return -ENXIO; } +static int __netconfig_set_rps_cpus(void) +{ + int fd, i; + ssize_t count; + char t_buf[TEMP_BUFFER_LEN]; + char r_buf[TEMP_BUFFER_LEN]; + + if (access(WIFI_MAC_ADD_PATH, F_OK) != 0) { + DBG("WiFi driver is not loaded... "); + return -1; + } else { + 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); + + if (fd < 0) { + DBG("failed to open rps file"); + 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); + } + + close(fd); + } + } + + return 0; +} + int netconfig_wifi_firmware(enum netconfig_wifi_firmware type, gboolean enable) { int err; @@ -244,6 +312,9 @@ int netconfig_wifi_firmware(enum netconfig_wifi_firmware type, gboolean enable) else current_driver = alias; + if (__netconfig_set_rps_cpus() < 0) + DBG("Failed to set rps_cpus"); + return err; } @@ -251,7 +322,7 @@ gboolean handle_start(WifiFirmware *firmware, GDBusMethodInvocation *context, co { int err; - g_return_val_if_fail(firmware != NULL, FALSE); + g_return_val_if_fail(firmware != NULL, TRUE); DBG("Wi-Fi firmware start %s", device != NULL ? device : "null"); @@ -274,7 +345,7 @@ gboolean handle_start(WifiFirmware *firmware, GDBusMethodInvocation *context, co } else netconfig_error_wifi_driver_failed(context); - return FALSE; + return TRUE; } wifi_firmware_complete_start(firmware, context); @@ -285,7 +356,7 @@ gboolean handle_stop(WifiFirmware *firmware, GDBusMethodInvocation *context, con { int err; - g_return_val_if_fail(firmware != NULL, FALSE); + g_return_val_if_fail(firmware != NULL, TRUE); DBG("Wi-Fi firmware stop %s", device != NULL ? device : "null"); @@ -302,7 +373,7 @@ gboolean handle_stop(WifiFirmware *firmware, GDBusMethodInvocation *context, con else netconfig_error_wifi_driver_failed(context); - return FALSE; + return TRUE; } wifi_firmware_complete_stop(firmware, context);