ipacm: do not post internal link up events

The internal link up events clear up the cache of requests
from FWK causing offload to fail. This CL fixes not to post
internal link up events when IPACM is started from boot.

Test: WiFi tethering offload is verified on B1C1

Bug: 110913099

Change-Id: I4b310423e188923a3a251c29cc6f7e30edc05797
diff --git a/ipacm/inc/IPACM_Iface.h b/ipacm/inc/IPACM_Iface.h
index 2e18f51..8ff7450 100644
--- a/ipacm/inc/IPACM_Iface.h
+++ b/ipacm/inc/IPACM_Iface.h
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
+Copyright (c) 2013-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
@@ -144,6 +144,7 @@
 
 	/* software routing disable */
 	virtual int handle_software_routing_disable(void);
+	void delete_iface(void);
 
 private:
 
diff --git a/ipacm/src/IPACM_Iface.cpp b/ipacm/src/IPACM_Iface.cpp
index e24f7d9..bee69ed 100644
--- a/ipacm/src/IPACM_Iface.cpp
+++ b/ipacm/src/IPACM_Iface.cpp
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2013, The Linux Foundation. All rights reserved.
+Copyright (c) 2013-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
@@ -1026,3 +1026,10 @@
 
 	return;
 }
+
+void IPACM_Iface::delete_iface(void)
+{
+	IPACMDBG_H("netdev (%s):ipa_index (%d) instance close \n",
+			IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].iface_name, ipa_if_num);
+	delete this;
+}
\ No newline at end of file
diff --git a/ipacm/src/IPACM_IfaceManager.cpp b/ipacm/src/IPACM_IfaceManager.cpp
index 85033a3..e7660b1 100644
--- a/ipacm/src/IPACM_IfaceManager.cpp
+++ b/ipacm/src/IPACM_IfaceManager.cpp
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
+Copyright (c) 2013-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
@@ -257,6 +257,12 @@
 			{
 				IPACMDBG_H("Creating Lan interface\n");
 				IPACM_Lan *lan = new IPACM_Lan(ipa_interface_index);
+				if (lan->rx_prop == NULL && lan->tx_prop == NULL)
+				{
+					/* close the netdev instance if IPA not support*/
+					lan->delete_iface();
+					return IPACM_FAILURE;
+				}
 				IPACM_EvtDispatcher::registr(IPA_ADDR_ADD_EVENT, lan);
 				//IPACM_EvtDispatcher::registr(IPA_ROUTE_ADD_EVENT, lan);
 				//IPACM_EvtDispatcher::registr(IPA_ROUTE_DEL_EVENT, lan);
@@ -365,6 +371,14 @@
 			{
 				IPACMDBG_H("Creating WLan interface\n");
 				IPACM_Wlan *wl = new IPACM_Wlan(ipa_interface_index);
+				if (wl->rx_prop == NULL && wl->tx_prop == NULL)
+				{
+					/* reset the AP-iface category to unknown */
+					IPACM_Iface::ipacmcfg->iface_table[ipa_interface_index].if_cat = UNKNOWN_IF;
+					/* close the netdev instance if IPA not support*/
+					wl->delete_iface();
+					return IPACM_FAILURE;
+				}
 				IPACM_EvtDispatcher::registr(IPA_ADDR_ADD_EVENT, wl);
 				IPACM_EvtDispatcher::registr(IPA_ROUTE_DEL_EVENT, wl);
 				IPACM_EvtDispatcher::registr(IPA_WLAN_CLIENT_ADD_EVENT, wl);
@@ -421,6 +435,14 @@
 					if(is_sta_mode == WLAN_WAN)
 					{
 						w = new IPACM_Wan(ipa_interface_index, is_sta_mode, param->mac_addr);
+						if (w->rx_prop == NULL && w->tx_prop == NULL)
+						{
+							/* reset the AP-iface category to unknown */
+							IPACM_Iface::ipacmcfg->iface_table[ipa_interface_index].if_cat = UNKNOWN_IF;
+							/* close the netdev instance if IPA not support*/
+							w->delete_iface();
+							return IPACM_FAILURE;
+						}
 					}
 					else
 					{
diff --git a/ipacm/src/IPACM_Wlan.cpp b/ipacm/src/IPACM_Wlan.cpp
index 090aee2..829416d 100644
--- a/ipacm/src/IPACM_Wlan.cpp
+++ b/ipacm/src/IPACM_Wlan.cpp
@@ -133,6 +133,7 @@
 {
 	IPACM_EvtDispatcher::deregistr(this);
 	IPACM_IfaceManager::deregistr(this);
+	IPACM_Wlan::num_wlan_ap_iface--;
 	return;
 }
 
@@ -196,7 +197,6 @@
 		ipacm_event_data_fid *data = (ipacm_event_data_fid *)param;
 		if(data->if_index == ipa_if_num)
 		{
-			IPACM_Wlan::num_wlan_ap_iface--;
 			IPACMDBG_H("Now the number of wlan AP iface is %d\n", IPACM_Wlan::num_wlan_ap_iface);
 
 			IPACMDBG_H("Received IPA_LAN_DELETE_SELF event.\n");