diff options
Diffstat (limited to 'data-ipa-cfg-mgr/ipacm/src/IPACM_Lan.cpp')
-rw-r--r-- | data-ipa-cfg-mgr/ipacm/src/IPACM_Lan.cpp | 149 |
1 files changed, 101 insertions, 48 deletions
diff --git a/data-ipa-cfg-mgr/ipacm/src/IPACM_Lan.cpp b/data-ipa-cfg-mgr/ipacm/src/IPACM_Lan.cpp index 7503df1..afb1f0d 100644 --- a/data-ipa-cfg-mgr/ipacm/src/IPACM_Lan.cpp +++ b/data-ipa-cfg-mgr/ipacm/src/IPACM_Lan.cpp @@ -1,5 +1,5 @@ /* -Copyright (c) 2013-2017, 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 @@ -193,6 +193,14 @@ IPACM_Lan::IPACM_Lan(int iface_index) : IPACM_Iface(iface_index) memset(&prefix, 0, sizeof(prefix)); #ifdef FEATURE_IPACM_HAL + + /* check if Upstream was set before as WIFI with RNDIS case */ + if(ipa_if_cate == LAN_IF && IPACM_Wan::backhaul_is_sta_mode == true) /* STA */ + { + IPACMDBG_H(" Skip the Upstream flag set on LAN instance (%d) with WIFI backhaul (%d)\n", ipa_if_cate, IPACM_Wan::backhaul_is_sta_mode ); /* RNDIS+WIFI not support on msm*/ + return; + } + /* check if Upstream was set before */ if (IPACM_Wan::isWanUP(ipa_if_num)) { @@ -227,6 +235,7 @@ void IPACM_Lan::event_callback(ipa_cm_event_id event, void *param) } int ipa_interface_index; + uint32_t i; ipacm_ext_prop* ext_prop; ipacm_event_iface_up_tehter* data_wan_tether; @@ -261,7 +270,7 @@ void IPACM_Lan::event_callback(ipa_cm_event_id event, void *param) if (rx_prop != NULL || tx_prop != NULL) { IPACMDBG_H(" Has rx/tx properties registered for iface %s, add for NATTING \n", dev_name); - IPACM_Iface::ipacmcfg->AddNatIfaces(dev_name); + IPACM_Iface::ipacmcfg->AddNatIfaces(dev_name, IPA_IP_MAX); } } break; @@ -501,6 +510,45 @@ void IPACM_Lan::event_callback(ipa_cm_event_id event, void *param) IPACMERR("IPA_HANDLE_WAN_UP_TETHER tether_if(%d), not valid (%d) ignore\n", data_wan_tether->if_index_tether, ipa_if_num); return; } +#else /* not offload rndis on WIFI mode on MSM targets sky*/ + if (data_wan_tether->is_sta) + { + IPACMERR("Not support RNDIS offload on WIFI mode, dun install UL filter rules for WIFI mode\n"); + + /* clean rndis header, routing rules */ + IPACMDBG_H("left %d eth clients need to be deleted \n ", num_eth_client); + for (i = 0; i < num_eth_client; i++) + { + /* First reset nat rules and then route rules */ + if(get_client_memptr(eth_client, i)->ipv4_set == true) + { + IPACMDBG_H("Clean Nat Rules for ipv4:0x%x\n", get_client_memptr(eth_client, i)->v4_addr); + CtList->HandleNeighIpAddrDelEvt(get_client_memptr(eth_client, i)->v4_addr); + } + if (delete_eth_rtrules(i, IPA_IP_v4)) + IPACMERR("unbale to delete usb-client v4 route rules for index %d\n", i); + + if (delete_eth_rtrules(i, IPA_IP_v6)) + IPACMERR("unbale to delete ecm-client v6 route rules for index %d\n", i); + + IPACMDBG_H("Delete %d client header\n", num_eth_client); + + if(get_client_memptr(eth_client, i)->ipv4_header_set == true) + { + if (m_header.DeleteHeaderHdl(get_client_memptr(eth_client, i)->hdr_hdl_v4) + == false) + IPACMERR("unbale to delete usb-client v4 header for index %d\n", i); + } + + if(get_client_memptr(eth_client, i)->ipv6_header_set == true) + { + if (m_header.DeleteHeaderHdl(get_client_memptr(eth_client, i)->hdr_hdl_v6) + == false) + IPACMERR("unable to delete usb-client v6 header for index %d\n", i); + } + } /* end of for loop */ + return; + } #endif if (ip_type == IPA_IP_v4 || ip_type == IPA_IP_MAX) { @@ -673,7 +721,7 @@ void IPACM_Lan::event_callback(ipa_cm_event_id event, void *param) if (ipa_interface_index == ipa_if_num) { IPACMDBG_H("Received IPA_DOWNSTREAM_ADD event.\n"); - if (is_downstream_set[data->prefix.iptype] == false) + if (data->prefix.iptype < IPA_IP_MAX && is_downstream_set[data->prefix.iptype] == false) { IPACMDBG_H("Add downstream for IP iptype %d\n", data->prefix.iptype); is_downstream_set[data->prefix.iptype] = true; @@ -832,6 +880,14 @@ void IPACM_Lan::event_callback(ipa_cm_event_id event, void *param) IPACMDBG_H("Recieved IPA_NEIGH_CLIENT_IP_ADDR_ADD_EVENT event \n"); IPACMDBG_H("check iface %s category: %d\n", dev_name, ipa_if_cate); + /* if RNDIS under WIFI mode in MSM, dun add RT rule*/ +#ifdef FEATURE_IPACM_HAL + if(IPACM_Wan::backhaul_is_sta_mode == true) /* WIFI */ + { + IPACMDBG_H(" dun construct header and RT-rules for RNDIS-PC in WIFI mode on MSM targets (STA %d) \n", IPACM_Wan::backhaul_is_sta_mode); + return; + } +#endif if (ipa_interface_index == ipa_if_num && ipa_if_cate == ODU_IF) { IPACMDBG_H("ODU iface got v4-ip \n"); @@ -3194,46 +3250,43 @@ int IPACM_Lan::handle_uplink_filter_rule(ipacm_ext_prop *prop, ipa_ip_type iptyp #ifdef FEATURE_IPACM_HAL /* add prefix equation in modem UL rules */ - if(iptype == IPA_IP_v4) + if(iptype == IPA_IP_v4 && flt_rule_entry.rule.eq_attrib.num_offset_meq_32 < IPA_IPFLTR_NUM_MEQ_32_EQNS) { flt_rule_entry.rule.eq_attrib.num_offset_meq_32++; - if(flt_rule_entry.rule.eq_attrib.num_offset_meq_32 <= IPA_IPFLTR_NUM_MEQ_32_EQNS) - { - eq_index = flt_rule_entry.rule.eq_attrib.num_offset_meq_32 - 1; + eq_index = flt_rule_entry.rule.eq_attrib.num_offset_meq_32 - 1; #ifdef FEATURE_IPA_V3 - if(eq_index == 0) - { - flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<5); - } - else - { - flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<6); - } + if(eq_index == 0) + { + flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<5); + } + else + { + flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<6); + } #else - if(eq_index == 0) - { - flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<2); - } - else - { - flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<3); - } -#endif - flt_rule_entry.rule.eq_attrib.offset_meq_32[eq_index].offset = 12; - flt_rule_entry.rule.eq_attrib.offset_meq_32[eq_index].mask = prefix[IPA_IP_v4].v4Mask; - flt_rule_entry.rule.eq_attrib.offset_meq_32[eq_index].value = prefix[IPA_IP_v4].v4Addr; + if(eq_index == 0) + { + flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<2); } else { - IPACMERR("Run out of MEQ32 equation.\n"); - flt_rule_entry.rule.eq_attrib.num_offset_meq_32--; + flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<3); } +#endif + flt_rule_entry.rule.eq_attrib.offset_meq_32[eq_index].offset = 12; + flt_rule_entry.rule.eq_attrib.offset_meq_32[eq_index].mask = prefix[IPA_IP_v4].v4Mask; + flt_rule_entry.rule.eq_attrib.offset_meq_32[eq_index].value = prefix[IPA_IP_v4].v4Addr; + } + else if (flt_rule_entry.rule.eq_attrib.num_offset_meq_32 > IPA_IPFLTR_NUM_MEQ_32_EQNS) + { + IPACMERR("Run out of MEQ32 equation.\n"); + flt_rule_entry.rule.eq_attrib.num_offset_meq_32--; } else { - flt_rule_entry.rule.eq_attrib.num_offset_meq_128++; - if(flt_rule_entry.rule.eq_attrib.num_offset_meq_128 <= IPA_IPFLTR_NUM_MEQ_128_EQNS) + if (flt_rule_entry.rule.eq_attrib.num_offset_meq_128 < IPA_IPFLTR_NUM_MEQ_128_EQNS) { + flt_rule_entry.rule.eq_attrib.num_offset_meq_128++; eq_index = flt_rule_entry.rule.eq_attrib.num_offset_meq_128 - 1; #ifdef FEATURE_IPA_V3 if(eq_index == 0) @@ -3245,21 +3298,21 @@ int IPACM_Lan::handle_uplink_filter_rule(ipacm_ext_prop *prop, ipa_ip_type iptyp flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<4); } *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].mask + 0) - = prefix[IPA_IP_v6].v6Mask[3]; + = prefix[IPA_IP_v6].v6Mask[3]; *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].mask + 4) - = prefix[IPA_IP_v6].v6Mask[2]; + = prefix[IPA_IP_v6].v6Mask[2]; *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].mask + 8) - = prefix[IPA_IP_v6].v6Mask[1]; + = prefix[IPA_IP_v6].v6Mask[1]; *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].mask + 12) - = prefix[IPA_IP_v6].v6Mask[0]; + = prefix[IPA_IP_v6].v6Mask[0]; *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].value + 0) - = prefix[IPA_IP_v6].v6Addr[3]; + = prefix[IPA_IP_v6].v6Addr[3]; *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].value + 4) - = prefix[IPA_IP_v6].v6Addr[2]; + = prefix[IPA_IP_v6].v6Addr[2]; *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].value + 8) - = prefix[IPA_IP_v6].v6Addr[1]; + = prefix[IPA_IP_v6].v6Addr[1]; *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].value + 12) - = prefix[IPA_IP_v6].v6Addr[0]; + = prefix[IPA_IP_v6].v6Addr[0]; #else if(eq_index == 0) { @@ -3270,24 +3323,24 @@ int IPACM_Lan::handle_uplink_filter_rule(ipacm_ext_prop *prop, ipa_ip_type iptyp flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<10); } *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].mask + 0) - = prefix[IPA_IP_v6].v6Mask[0]; + = prefix[IPA_IP_v6].v6Mask[0]; *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].mask + 4) - = prefix[IPA_IP_v6].v6Mask[1]; + = prefix[IPA_IP_v6].v6Mask[1]; *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].mask + 8) - = prefix[IPA_IP_v6].v6Mask[2]; + = prefix[IPA_IP_v6].v6Mask[2]; *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].mask + 12) - = prefix[IPA_IP_v6].v6Mask[3]; + = prefix[IPA_IP_v6].v6Mask[3]; *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].value + 0) - = prefix[IPA_IP_v6].v6Addr[0]; + = prefix[IPA_IP_v6].v6Addr[0]; *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].value + 4) - = prefix[IPA_IP_v6].v6Addr[1]; + = prefix[IPA_IP_v6].v6Addr[1]; *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].value + 8) - = prefix[IPA_IP_v6].v6Addr[2]; + = prefix[IPA_IP_v6].v6Addr[2]; *(uint32_t *)(flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].value + 12) - = prefix[IPA_IP_v6].v6Addr[3]; + = prefix[IPA_IP_v6].v6Addr[3]; #endif flt_rule_entry.rule.eq_attrib.offset_meq_128[eq_index].offset = 8; - } + } else { IPACMERR("Run out of MEQ128 equation.\n"); |