Merge "ipacm: Fix to reset free_index when state is updated"
diff --git a/hal/Android.bp b/hal/Android.bp
index 1c52dcd..f7559b2 100644
--- a/hal/Android.bp
+++ b/hal/Android.bp
@@ -22,7 +22,6 @@
         "libhardware",
         "android.hardware.tetheroffload.config@1.0",
         "android.hardware.tetheroffload.control@1.0",
-        "android.hardware.tetheroffload.control@1.1",
     ],
     export_include_dirs: ["inc"],
     vendor: true,
diff --git a/hal/inc/CtUpdateAmbassador.h b/hal/inc/CtUpdateAmbassador.h
index ef4c5ee..d4890f3 100644
--- a/hal/inc/CtUpdateAmbassador.h
+++ b/hal/inc/CtUpdateAmbassador.h
@@ -32,12 +32,13 @@
 #include <hidl/HidlTransportSupport.h>
 
 /* HIDL Includes */
-#include <android/hardware/tetheroffload/control/1.1/ITetheringOffloadCallback.h>
+#include <android/hardware/tetheroffload/control/1.0/ITetheringOffloadCallback.h>
 
 /* Internal Includes */
 #include "IOffloadManager.h"
 
 /* Namespace pollution avoidance */
+using ::android::hardware::tetheroffload::control::V1_0::ITetheringOffloadCallback;
 using ::android::hardware::tetheroffload::control::V1_0::NetworkProtocol;
 using HALIpAddrPortPair = ::android::hardware::tetheroffload::control::V1_0::IPv4AddrPortPair;
 using HALNatTimeoutUpdate = ::android::hardware::tetheroffload::control::V1_0::NatTimeoutUpdate;
@@ -49,13 +50,13 @@
 
 class CtUpdateAmbassador : public IOffloadManager::ConntrackTimeoutUpdater {
 public:
-    CtUpdateAmbassador(const ::android::sp<::android::hardware::tetheroffload::control::V1_0::ITetheringOffloadCallback>& /* cb */);
+    CtUpdateAmbassador(const ::android::sp<ITetheringOffloadCallback>& /* cb */);
     /* ------------------- CONNTRACK TIMEOUT UPDATER ------------------------ */
     void updateTimeout(IpaNatTimeoutUpdate /* update */);
 private:
     static bool translate(IpaNatTimeoutUpdate /* in */, HALNatTimeoutUpdate& /* out */);
     static bool translate(IpaIpAddrPortPair /* in */, HALIpAddrPortPair& /* out */);
     static bool L4ToNetwork(IpaL4Protocol /* in */, NetworkProtocol& /* out */);
-    const ::android::sp<::android::hardware::tetheroffload::control::V1_0::ITetheringOffloadCallback>& mFramework;
+    const ::android::sp<ITetheringOffloadCallback>& mFramework;
 }; /* CtUpdateAmbassador */
 #endif /* _CT_UPDATE_AMBASSADOR_H_ */
\ No newline at end of file
diff --git a/hal/inc/HAL.h b/hal/inc/HAL.h
index cbabb1b..92ec135 100644
--- a/hal/inc/HAL.h
+++ b/hal/inc/HAL.h
@@ -31,7 +31,7 @@
 
 /* HIDL Includes */
 #include <android/hardware/tetheroffload/config/1.0/IOffloadConfig.h>
-#include <android/hardware/tetheroffload/control/1.1/IOffloadControl.h>
+#include <android/hardware/tetheroffload/control/1.0/IOffloadControl.h>
 #include <hidl/HidlTransportSupport.h>
 
 /* External Includes */
@@ -59,11 +59,10 @@
 using ::std::string;
 using ::std::vector;
 
-using namespace android::hardware::tetheroffload::control;
-using ::android::sp;
 using ::android::hardware::tetheroffload::config::V1_0::IOffloadConfig;
-using ::android::hardware::tetheroffload::control::V1_1::IOffloadControl;
-using ::android::hardware::tetheroffload::control::V1_1::ITetheringOffloadCallback;
+using ::android::hardware::tetheroffload::control::V1_0::IOffloadControl;
+
+using ::android::hardware::tetheroffload::control::V1_0::ITetheringOffloadCallback;
 
 #define KERNEL_PAGE 4096
 
@@ -132,9 +131,9 @@
             const hidl_handle& /* fd2 */,
             setHandles_cb /* hidl_cb */);
 
-    /* IOffloadControl 1.0 */
+    /* IOffloadControl */
     Return<void> initOffload(
-            const ::android::sp<::android::hardware::tetheroffload::control::V1_0::ITetheringOffloadCallback>& /* cb */,
+            const ::android::sp<ITetheringOffloadCallback>& /* cb */,
             initOffload_cb /* hidl_cb */);
     Return<void> stopOffload(
             stopOffload_cb /* hidl_cb */);
@@ -162,12 +161,6 @@
             const hidl_string& /* iface */,
             const hidl_string& /* prefix */,
             removeDownstream_cb /* hidl_cb */);
-    /* IOffloadControl 1.1 */
-    Return<void> setDataWarningAndLimit(
-            const hidl_string& /* upstream */,
-            uint64_t /* warningBytes */,
-            uint64_t /* limitBytes */,
-            setDataWarningAndLimit_cb /* hidl_cb */);
 
 private:
     typedef struct BoolResult {
@@ -200,8 +193,7 @@
     hidl_handle mHandle1;
     hidl_handle mHandle2;
     LocalLogBuffer mLogs;
-    android::sp<V1_0::ITetheringOffloadCallback> mCb;
-    android::sp<V1_1::ITetheringOffloadCallback> mCb_1_1;
+    ::android::sp<ITetheringOffloadCallback> mCb;
     IpaEventRelay *mCbIpa;
     CtUpdateAmbassador *mCbCt;
 }; /* HAL */
diff --git a/hal/inc/IOffloadManager.h b/hal/inc/IOffloadManager.h
index 14edffd..6a357b3 100644
--- a/hal/inc/IOffloadManager.h
+++ b/hal/inc/IOffloadManager.h
@@ -120,12 +120,6 @@
          * tether interface pairs when this callback is called.
          */
         virtual void onLimitReached(){}
-        /**
-         * Called when the warning set via setQuota has expired. It is expected
-         * that limit has not been reached yet.
-         *
-         */
-        virtual void onWarningReached(){}
     }; /* IpaEventListener */
 
     /**
@@ -333,34 +327,6 @@
      */
     virtual RET setQuota(const char* /* upstream */, uint64_t /* limit */) = 0;
     /**
-     * This api replaces setQuota.
-     *
-     * Instruct hardware to stop forwarding traffic and send a callback after
-     * warning/limit bytes have been transferred in either direction on this upstream
-     * interface.
-     *
-     * Note that when one of the quota bytes is reached, the other one is still considered valid
-     * unless this method is called again with the same interface.
-     *
-     * @param upstream Upstream interface name that the limit should apply to
-     * @param warningBytes The quota of warning, defined as the number of bytes, starting from
-     *                     zero and counting from now.
-     * @param limitBytes The quota of limit, defined as the number of bytes, starting from zero
-     *                   and counting from now.
-     *
-     * @return SUCCESS If the limit was successfully applied
-     *         SUCCESS_OPTIMIZED If the limit was sufficiently high to be
-     *                           interpreted as "no quota".
-     *         FAIL_HARDWARE If the limit was rejected by the hardware
-     *         FAIL_UNSUPPORTED If metering is not supported on this interface
-     *         FAIL_TRY_AGAIN If this upstream has not been previously
-     *                        configured to allow offload
-     *                        (via setUpstreamParameters)
-     */
-    virtual RET setQuotaWarning(const char* /* upstream */,
-            uint64_t /* warningBytes */,
-            uint64_t /* limitBytes */) = 0;
-    /**
      * Query for statistics counters in hardware.
      *
      * This returns an aggregate of all hardware accelerated traffic which
diff --git a/hal/inc/IpaEventRelay.h b/hal/inc/IpaEventRelay.h
index a426b79..4541510 100644
--- a/hal/inc/IpaEventRelay.h
+++ b/hal/inc/IpaEventRelay.h
@@ -32,32 +32,24 @@
 #include <hidl/HidlTransportSupport.h>
 
 /* HIDL Includes */
-#include <android/hardware/tetheroffload/control/1.1/ITetheringOffloadCallback.h>
+#include <android/hardware/tetheroffload/control/1.0/ITetheringOffloadCallback.h>
 
 /* Internal Includes */
 #include "IOffloadManager.h"
 
 /* Namespace pollution avoidance */
-using namespace android::hardware::tetheroffload::control;
-using ::android::hardware::tetheroffload::control::V1_1::OffloadCallbackEvent;
+using ::android::hardware::tetheroffload::control::V1_0::ITetheringOffloadCallback;
+
 
 class IpaEventRelay : public IOffloadManager::IpaEventListener {
 public:
-    IpaEventRelay(const ::android::sp<V1_0::ITetheringOffloadCallback>& /* 1.0 cb */,
-                  const ::android::sp<V1_1::ITetheringOffloadCallback>& /* 1.1 cb */);
+    IpaEventRelay(const ::android::sp<ITetheringOffloadCallback>& /* cb */);
     /* ----------------------- IPA EVENT LISTENER --------------------------- */
     void onOffloadStarted();
     void onOffloadStopped(StoppedReason /* reason */);
     void onOffloadSupportAvailable();
     void onLimitReached();
-    void onWarningReached();
 private:
-    const ::android::sp<V1_0::ITetheringOffloadCallback>& mFramework;
-    const ::android::sp<V1_1::ITetheringOffloadCallback>& mFramework_1_1;
-
-    static const int V1_0 = 0;
-    static const int V1_1 = 1;
-
-    void sendEvent(OffloadCallbackEvent, int /* version */);
+    const ::android::sp<ITetheringOffloadCallback>& mFramework;
 }; /* IpaEventRelay */
 #endif /* _IPA_EVENT_RELAY_H_ */
\ No newline at end of file
diff --git a/hal/src/CtUpdateAmbassador.cpp b/hal/src/CtUpdateAmbassador.cpp
index 2ae10f8..eba6b93 100644
--- a/hal/src/CtUpdateAmbassador.cpp
+++ b/hal/src/CtUpdateAmbassador.cpp
@@ -36,7 +36,7 @@
 #include <cutils/log.h>
 
 /* HIDL Includes */
-#include <android/hardware/tetheroffload/control/1.1/ITetheringOffloadCallback.h>
+#include <android/hardware/tetheroffload/control/1.0/ITetheringOffloadCallback.h>
 
 /* Internal Includes */
 #include "CtUpdateAmbassador.h"
diff --git a/hal/src/HAL.cpp b/hal/src/HAL.cpp
index fb204f7..f18767a 100644
--- a/hal/src/HAL.cpp
+++ b/hal/src/HAL.cpp
@@ -60,6 +60,7 @@
 using ::std::map;
 using ::std::vector;
 
+
 /* ------------------------------ PUBLIC ------------------------------------ */
 Return<::android::sp<HAL>> HAL::makeIPAHAL(int version, IOffloadManager* mgr) {
     android::hardware::ProcessState::initWithMmapSize((size_t)(2 * KERNEL_PAGE));
@@ -81,7 +82,6 @@
 HAL::HAL(IOffloadManager* mgr) : mLogs("HAL Function Calls", 50) {
     mIPA = mgr;
     mCb.clear();
-    mCb_1_1.clear();
     mCbIpa = nullptr;
     mCbCt = nullptr;
 } /* HAL */
@@ -89,13 +89,8 @@
 void HAL::registerAsSystemService(const char* name) {
     status_t ret = 0;
 
-    // Attempt to register 1.1 first
     ret = IOffloadControl::registerAsService();
-    if (ret != 0) {
-        // Fallback to using 1.0 if 1.1 HAL is not in manifst
-        ret = ::android::hardware::tetheroffload::control::V1_0::IOffloadControl::registerAsService();
-        if (ret != 0) ALOGE("Failed to register IOffloadControl (%d) name(%s)", ret, name);
-    }
+    if (ret != 0) ALOGE("Failed to register IOffloadControl (%d) name(%s)", ret, name);
     else if (DBG) {
         ALOGI("Successfully registered IOffloadControl");
     }
@@ -185,7 +180,7 @@
 void HAL::registerIpaCb() {
     if (isInitialized() && mCbIpa == nullptr) {
         LocalLogBuffer::FunctionLog fl("registerEventListener");
-        mCbIpa = new IpaEventRelay(mCb, mCb_1_1);
+        mCbIpa = new IpaEventRelay(mCb);
         mIPA->registerEventListener(mCbIpa);
         mLogs.addLog(fl);
     } else {
@@ -198,8 +193,6 @@
 void HAL::registerCtCb() {
     if (isInitialized() && mCbCt == nullptr) {
         LocalLogBuffer::FunctionLog fl("registerCtTimeoutUpdater");
-        // We can allways use the 1.0 callback here since it is always guarenteed to
-        // be non-nullptr if any version is created.
         mCbCt = new CtUpdateAmbassador(mCb);
         mIPA->registerCtTimeoutUpdater(mCbCt);
         mLogs.addLog(fl);
@@ -253,7 +246,6 @@
 } /* clearHandles */
 
 bool HAL::isInitialized() {
-    // Only have to check 1.0 Callback since it will always be created.
     return mCb.get() != nullptr;
 } /* isInitialized */
 
@@ -336,7 +328,7 @@
 /* -------------------------- IOffloadControl ------------------------------- */
 Return<void> HAL::initOffload
 (
-    const ::android::sp<V1_0::ITetheringOffloadCallback>& cb,
+    const ::android::sp<ITetheringOffloadCallback>& cb,
     initOffload_cb hidl_cb
 ) {
     LocalLogBuffer::FunctionLog fl(__func__);
@@ -349,21 +341,12 @@
     } else {
         /* Should storing the CB be a function? */
         mCb = cb;
-        mCb_1_1 = V1_1::ITetheringOffloadCallback::castFrom(cb).withDefault(nullptr);
-        // As long as 1 callback version is supported we are fine.
-        if (mCb == nullptr && mCb_1_1 == nullptr) {
-            BoolResult res = makeInputCheckFailure("callbacks are nullptr");
-            hidl_cb(res.success, res.errMsg);
-            fl.setResult(res.success, res.errMsg);
-            mLogs.addLog(fl);
-        } else {
         registerEventListeners();
         BoolResult res = ipaResultToBoolResult(RET::SUCCESS);
         hidl_cb(res.success, res.errMsg);
         fl.setResult(res.success, res.errMsg);
         mLogs.addLog(fl);
     }
-    }
 
     return Void();
 } /* initOffload */
@@ -382,7 +365,6 @@
     } else {
         /* Should removing the CB be a function? */
         mCb.clear();
-        mCb_1_1.clear();
         unregisterEventListeners();
 
         RET ipaReturn = mIPA->stopAllOffload();
@@ -430,7 +412,7 @@
     memset(&res,0,sizeof(BoolResult));
 
     if (!isInitialized()) {
-        res = makeInputCheckFailure("Not initialized");
+        BoolResult res = makeInputCheckFailure("Not initialized");
     } else if(prefixesStr.size() < 1) {
         res = ipaResultToBoolResult(RET::FAIL_INPUT_CHECK);
     } else if (!parser.add(prefixesStr)) {
@@ -579,7 +561,7 @@
     PrefixParser prefixParser;
 
     if (!isInitialized()) {
-        BoolResult res = makeInputCheckFailure("Not initialized (addDownstream)");
+        BoolResult res = makeInputCheckFailure("Not initialized (setUpstreamParameters)");
         hidl_cb(res.success, res.errMsg);
         fl.setResult(res.success, res.errMsg);
     }
@@ -613,7 +595,7 @@
     PrefixParser prefixParser;
 
     if (!isInitialized()) {
-        BoolResult res = makeInputCheckFailure("Not initialized (removeDownstream)");
+        BoolResult res = makeInputCheckFailure("Not initialized (setUpstreamParameters)");
         hidl_cb(res.success, res.errMsg);
         fl.setResult(res.success, res.errMsg);
     }
@@ -633,34 +615,3 @@
     mLogs.addLog(fl);
     return Void();
 } /* removeDownstream */
-
-Return<void> HAL::setDataWarningAndLimit
-(
-    const hidl_string& upstream,
-    uint64_t warningBytes,
-    uint64_t limitBytes,
-    setDataWarningAndLimit_cb hidl_cb
-) {
-    LocalLogBuffer::FunctionLog fl(__func__);
-    fl.addArg("upstream", upstream);
-    fl.addArg("warningBytes", warningBytes);
-    fl.addArg("limitBytes", limitBytes);
-
-    // Can only be called from HAL 1.1 so no check here is needed.
-    if (!isInitialized()) {
-        BoolResult res = makeInputCheckFailure("Not initialized (setDataWarningAndLimit)");
-        hidl_cb(res.success, res.errMsg);
-        fl.setResult(res.success, res.errMsg);
-    } else {
-        RET ipaReturn = mIPA->setQuotaWarning(upstream.c_str(), limitBytes, warningBytes);
-        if(ipaReturn == RET::FAIL_TRY_AGAIN) {
-            ipaReturn = RET::SUCCESS;
-        }
-        BoolResult res = ipaResultToBoolResult(ipaReturn);
-        hidl_cb(res.success, res.errMsg);
-        fl.setResult(res.success, res.errMsg);
-    }
-
-    mLogs.addLog(fl);
-    return Void();
-} /* setDataWarningAndLimit */
diff --git a/hal/src/IpaEventRelay.cpp b/hal/src/IpaEventRelay.cpp
index f0cbd21..137092f 100644
--- a/hal/src/IpaEventRelay.cpp
+++ b/hal/src/IpaEventRelay.cpp
@@ -29,48 +29,28 @@
 #define LOG_TAG "IPAHALService/IpaEventRelay"
 /* External Includes */
 #include <cutils/log.h>
-//#include <hidl/Status.h> //TODO: Might be easier to return Status
 
 /* HIDL Includes */
-#include <android/hardware/tetheroffload/control/1.1/ITetheringOffloadCallback.h>
+#include <android/hardware/tetheroffload/control/1.0/ITetheringOffloadCallback.h>
 
 /* Internal Includes */
 #include "IpaEventRelay.h"
 
 /* Namespace pollution avoidance */
-using ::android::hardware::Return;
-// using ::android::hardware::Status;
-using ::android::hardware::tetheroffload::control::V1_1::ITetheringOffloadCallback;
+using ::android::hardware::tetheroffload::control::V1_0::ITetheringOffloadCallback;
+using ::android::hardware::tetheroffload::control::V1_0::OffloadCallbackEvent;
 
 
 IpaEventRelay::IpaEventRelay(
-        const ::android::sp<V1_0::ITetheringOffloadCallback>& cb,
-        const ::android::sp<V1_1::ITetheringOffloadCallback>& cb_1_1) : mFramework(cb), mFramework_1_1(cb_1_1) {
+        const ::android::sp<ITetheringOffloadCallback>& cb) : mFramework(cb) {
 } /* IpaEventRelay */
 
-using OnEventVersion = std::function<Return<void>()>;
-void IpaEventRelay::sendEvent(OffloadCallbackEvent event, int version) {
-    // Events need to be sent for the version passed in and all versions defined after that.
-    // This ensures all new versions get the correct events, but vrsion where events where not
-    // defined do not.
-    std::vector<OnEventVersion> getVersion = {
-        { [&]() -> Return<void> { return mFramework->onEvent(
-            (::android::hardware::tetheroffload::control::V1_0::OffloadCallbackEvent) event); }},
-        { [&]() -> Return<void> { return mFramework_1_1->onEvent_1_1(event); }}
-    };
-
-    for (int i = version; i < getVersion.size(); i++) {
-        OnEventVersion func = getVersion[i];
-        auto ret = func();
-    if (!ret.isOk()) {
-            ALOGE("Triggering onEvent CallbackV1_%d failed.", i);
-    }
-    }
-}
-
 void IpaEventRelay::onOffloadStarted() {
     ALOGI("onOffloadStarted()");
-    sendEvent(OffloadCallbackEvent::OFFLOAD_STARTED, V1_0);
+    auto ret = mFramework->onEvent(OffloadCallbackEvent::OFFLOAD_STARTED);
+    if (!ret.isOk()) {
+        ALOGE("Triggering OffloadStarted Callback failed.");
+    }
 } /* onOffloadStarted */
 
 void IpaEventRelay::onOffloadStopped(StoppedReason reason) {
@@ -83,10 +63,16 @@
          */
     }
     else if ( reason == StoppedReason::ERROR ) {
-        sendEvent(OffloadCallbackEvent::OFFLOAD_STOPPED_ERROR, V1_0);
+        auto ret = mFramework->onEvent(OffloadCallbackEvent::OFFLOAD_STOPPED_ERROR);
+        if (!ret.isOk()) {
+            ALOGE("Triggering OffloadStopped Callback failed.");
+        }
     }
     else if ( reason == StoppedReason::UNSUPPORTED ) {
-        sendEvent(OffloadCallbackEvent::OFFLOAD_STOPPED_UNSUPPORTED, V1_0);
+        auto ret = mFramework->onEvent(OffloadCallbackEvent::OFFLOAD_STOPPED_UNSUPPORTED);
+        if (!ret.isOk()) {
+            ALOGE("Triggering OffloadStopped Callback failed.");
+        }
     }
     else {
         ALOGE("Unknown stopped reason(%d)", reason);
@@ -95,16 +81,16 @@
 
 void IpaEventRelay::onOffloadSupportAvailable() {
     ALOGI("onOffloadSupportAvailable()");
-    sendEvent(OffloadCallbackEvent::OFFLOAD_SUPPORT_AVAILABLE, V1_0);
+    auto ret = mFramework->onEvent(OffloadCallbackEvent::OFFLOAD_SUPPORT_AVAILABLE);
+    if (!ret.isOk()) {
+        ALOGE("Triggering OffloadSupportAvailable Callback failed.");
+    }
 } /* onOffloadSupportAvailable */
 
 void IpaEventRelay::onLimitReached() {
     ALOGI("onLimitReached()");
-    sendEvent(OffloadCallbackEvent::OFFLOAD_STOPPED_LIMIT_REACHED, V1_0);
+    auto ret = mFramework->onEvent(OffloadCallbackEvent::OFFLOAD_STOPPED_LIMIT_REACHED);
+    if (!ret.isOk()) {
+        ALOGE("Triggering LimitReached Callback failed.");
+    }
 } /* onLimitReached */
-
-/** V1_1 API's **/
-void IpaEventRelay::onWarningReached() {
-    ALOGI("onWarningReached()");
-    sendEvent(OffloadCallbackEvent::OFFLOAD_WARNING_REACHED, V1_1);
-} /* onWarningReached */
diff --git a/ipacm/Android.bp b/ipacm/Android.bp
index a237e7c..fbb69e3 100644
--- a/ipacm/Android.bp
+++ b/ipacm/Android.bp
@@ -57,7 +57,6 @@
         "libhardware",
         "android.hardware.tetheroffload.config@1.0",
         "android.hardware.tetheroffload.control@1.0",
-        "android.hardware.tetheroffload.control@1.1",
     ],
 }
 
diff --git a/ipacm/inc/IPACM_OffloadManager.h b/ipacm/inc/IPACM_OffloadManager.h
index 146fde8..8ac904f 100644
--- a/ipacm/inc/IPACM_OffloadManager.h
+++ b/ipacm/inc/IPACM_OffloadManager.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -83,10 +83,8 @@
 
     /* ------------------------- STATS/POLICY --------------------------- */
     virtual RET setQuota(const char * /* upstream */, uint64_t /* limit */);
-    virtual RET setQuotaWarning(const char * /* upstream */,
-	uint64_t /* quota limit */, uint64_t /* warning limit */);
     virtual RET getStats(const char * /* upstream */, bool /* reset */,
-	OffloadStatistics& /* ret */);
+		OffloadStatistics& /* ret */);
 
 	static IPACM_OffloadManager *pInstance;
 
diff --git a/ipacm/src/IPACM_Main.cpp b/ipacm/src/IPACM_Main.cpp
index 8166329..e29289d 100644
--- a/ipacm/src/IPACM_Main.cpp
+++ b/ipacm/src/IPACM_Main.cpp
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2013-2021, The Linux Foundation. All rights reserved.
+Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are
@@ -783,18 +783,6 @@
 				OffloadMng->elrInstance->onLimitReached();
 			}
 			continue;
-#ifdef IPA_WARNING_LIMIT_EVENT_MAX
-		case IPA_WARNING_LIMIT_REACHED:
-			IPACMDBG_H("Received IPA_WARNING_LIMIT_REACHED\n");
-			OffloadMng = IPACM_OffloadManager::GetInstance();
-			if (OffloadMng->elrInstance == NULL) {
-				IPACMERR("OffloadMng->elrInstance is NULL, can't forward to framework!\n");
-			} else {
-				IPACMERR("calling OffloadMng->elrInstance->onWarningReached \n");
-				OffloadMng->elrInstance->onWarningReached();
-			}
-			continue;
-#endif
 		case IPA_SSR_BEFORE_SHUTDOWN:
 			IPACMDBG_H("Received IPA_SSR_BEFORE_SHUTDOWN\n");
 			IPACM_Wan::clearExtProp();
diff --git a/ipacm/src/IPACM_OffloadManager.cpp b/ipacm/src/IPACM_OffloadManager.cpp
index 2b8012d..708725b 100644
--- a/ipacm/src/IPACM_OffloadManager.cpp
+++ b/ipacm/src/IPACM_OffloadManager.cpp
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
+Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are
@@ -651,63 +651,6 @@
 	return SUCCESS;
 }
 
-RET IPACM_OffloadManager::setQuotaWarning(const char * upstream_name /* upstream */,
-uint64_t quota_mb/* quota limit */, uint64_t warning_mb/* warning limit */)
-{
-#ifdef WAN_IOC_SET_DATA_QUOTA_WARNING
-	wan_ioctl_set_data_quota_warning ioctl_data;
-	int fd = -1, rc = 0, err_type = 0;
-
-	if ((fd = open(DEVICE_NAME, O_RDWR)) < 0)
-	{
-		IPACMERR("Failed opening %s.\n", DEVICE_NAME);
-		return FAIL_HARDWARE;
-	}
-
-	memset(&ioctl_data, 0, sizeof(ioctl_data));
-
-	if (quota_mb != 0)
-	{
-		ioctl_data.quota_mbytes = quota_mb;
-		ioctl_data.set_quota = true;
-	}
-
-	if (warning_mb != 0)
-	{
-		ioctl_data.warning_mbytes = warning_mb;
-		ioctl_data.set_warning = true;
-	}
-
-
-	if (strlcpy(ioctl_data.interface_name, upstream_name, IFNAMSIZ) >= IFNAMSIZ) {
-		IPACMERR("String truncation occurred on upstream");
-		close(fd);
-		return FAIL_INPUT_CHECK;
-	}
-
-	IPACMDBG_H("SET_DATA_QUOTA_WARNING: Dev: %s, Quota: %llu, Warning: %llu\n",
-		ioctl_data.interface_name, (long long)quota_mb,
-		(long long)warning_mb);
-
-	rc = ioctl(fd, WAN_IOC_SET_DATA_QUOTA_WARNING, &ioctl_data);
-	close(fd);
-	if(rc != 0)
-	{
-		err_type = errno;
-		IPACMERR("IOCTL WAN_IOC_SET_DATA_QUOTA_WARNING call failed: %s err_type: %d\n", strerror(err_type), err_type);
-		if (err_type == ENODEV) {
-			IPACMDBG_H("Invalid argument.\n");
-			return FAIL_UNSUPPORTED;
-		}
-		else {
-			return FAIL_TRY_AGAIN;
-		}
-	}
-#endif
-	return SUCCESS;
-}
-
-
 RET IPACM_OffloadManager::getStats(const char * upstream_name /* upstream */,
 		bool reset /* reset */, OffloadStatistics& offload_stats/* ret */)
 {