From: Mayank Haarit Date: Tue, 3 Jul 2018 11:44:36 +0000 (+0530) Subject: net-config:Generalize the setting of rps_cpus X-Git-Tag: submit/tizen/20180706.050915~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=52ad195bd9b800d67d70094ea9123ecfe0d3ca0f;p=platform%2Fcore%2Fconnectivity%2Fnet-config.git net-config:Generalize the setting of rps_cpus This patch generalize the logic to set rps_cpus in all receive queues of the wlan interface. Change-Id: I2b4c2883338bcbaa989d52f9a1beac1409e2a5c7 Signed-off-by: Mayank Haarit --- diff --git a/src/wifi-firmware.c b/src/wifi-firmware.c index 60a7abe..812755f 100755 --- a/src/wifi-firmware.c +++ b/src/wifi-firmware.c @@ -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;