From ed1e6ed96e200f6758db703d4705f3544006cf56 Mon Sep 17 00:00:00 2001 From: Mohammed Javid Date: Mon, 4 Dec 2017 15:30:19 +0530 Subject: ipacm: Change error value for set quota Currently IPA send common error FAIL_TRY_AGAIN to framework in case of IOCTL fails. Change error value for set quota based on error received from modem. Change-Id: I7e31cb27892bed733d71173e9cc479a06b3f462f --- ipacm/src/IPACM_OffloadManager.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/ipacm/src/IPACM_OffloadManager.cpp b/ipacm/src/IPACM_OffloadManager.cpp index 9be019f..777edb6 100644 --- a/ipacm/src/IPACM_OffloadManager.cpp +++ b/ipacm/src/IPACM_OffloadManager.cpp @@ -536,7 +536,7 @@ RET IPACM_OffloadManager::stopAllOffload() RET IPACM_OffloadManager::setQuota(const char * upstream_name /* upstream */, uint64_t mb/* limit */) { wan_ioctl_set_data_quota quota; - int fd = -1; + int fd = -1,rc = 0; if ((fd = open(DEVICE_NAME, O_RDWR)) < 0) { @@ -556,12 +556,20 @@ RET IPACM_OffloadManager::setQuota(const char * upstream_name /* upstream */, ui IPACMDBG_H("SET_DATA_QUOTA %s %lu", quota.interface_name, mb); - if (ioctl(fd, WAN_IOC_SET_DATA_QUOTA, "a) < 0) { - IPACMERR("IOCTL WAN_IOCTL_SET_DATA_QUOTA call failed: %s", strerror(errno)); + rc = ioctl(fd, WAN_IOC_SET_DATA_QUOTA, "a); + + if(rc != 0) + { close(fd); - return FAIL_TRY_AGAIN; + IPACMERR("IOCTL WAN_IOCTL_SET_DATA_QUOTA call failed: %s rc: %d\n", strerror(errno),rc); + if (errno == ENODEV) { + IPACMDBG_H("Invalid argument.\n"); + return FAIL_UNSUPPORTED; + } + else { + return FAIL_TRY_AGAIN; + } } - close(fd); return SUCCESS; } -- cgit v1.2.3