diff options
author | Steve Kondik <steve@cyngn.com> | 2016-05-17 13:50:43 -0700 |
---|---|---|
committer | davidevinavil <davidevinavil@gmail.com> | 2017-01-21 18:20:40 +0100 |
commit | 9b2f586aa30c3802a7663a25cf98eb8f06309d2f (patch) | |
tree | df43e5bb7aeb9957b31ebdfbdce45baec7744f20 /data-ipa-cfg-mgr/ipacm/inc/IPACM_Lan.h | |
parent | 11e7b3c6aa71b15800f7cf989ac71bbd85a68e51 (diff) |
z2_plus: Update IPA connection manager to 1.0 branch
Change-Id: I20555a4bd9981f652f71360bdb7d83e822fad883
Diffstat (limited to 'data-ipa-cfg-mgr/ipacm/inc/IPACM_Lan.h')
-rw-r--r-- | data-ipa-cfg-mgr/ipacm/inc/IPACM_Lan.h | 188 |
1 files changed, 30 insertions, 158 deletions
diff --git a/data-ipa-cfg-mgr/ipacm/inc/IPACM_Lan.h b/data-ipa-cfg-mgr/ipacm/inc/IPACM_Lan.h index a210255..6c54f5e 100644 --- a/data-ipa-cfg-mgr/ipacm/inc/IPACM_Lan.h +++ b/data-ipa-cfg-mgr/ipacm/inc/IPACM_Lan.h @@ -1,5 +1,5 @@ /* -Copyright (c) 2013, The Linux Foundation. All rights reserved. +Copyright (c) 2013-2016, 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 @@ -73,18 +73,6 @@ struct ipa_lan_rt_rule uint32_t rt_rule_hdl[0]; }; -typedef enum -{ - SRC_WLAN, - SRC_LAN -} eth_bridge_src_iface; - -typedef enum -{ - DST_WLAN, - DST_LAN -} eth_bridge_dst_iface; - /* Support multiple eth client */ typedef struct _eth_client_rt_hdl { @@ -109,44 +97,6 @@ typedef struct _ipa_eth_client eth_client_rt_hdl eth_rt_hdl[0]; /* depends on number of tx properties */ }ipa_eth_client; -struct lan2lan_flt_rule_hdl -{ - uint32_t rule_hdl; - bool valid; -}; - -struct lan2lan_hdr_hdl -{ - uint32_t hdr_hdl; - bool valid; -}; - -struct eth_bridge_client_flt_info -{ - uint8_t mac[IPA_MAC_ADDR_SIZE]; - uint32_t flt_rule_hdl_v4; - bool flt_rule_set_v4; - uint32_t flt_rule_hdl_v6; - bool flt_rule_set_v6; -}; - -struct eth_bridge_client_rt_info -{ - uint8_t mac[IPA_MAC_ADDR_SIZE]; - uint32_t rt_rule_hdl[0]; -}; - -struct hdr_proc_ctx_info -{ - uint32_t proc_ctx_hdl; - bool valid; -}; - -struct eth_bridge_subnet_client_info -{ - uint8_t mac[IPA_MAC_ADDR_SIZE]; - int ipa_if_num; -}; /* lan iface */ class IPACM_Lan : public IPACM_Iface @@ -191,110 +141,46 @@ public: /* install UL filter rule from Q6 */ virtual int handle_uplink_filter_rule(ipacm_ext_prop* prop, ipa_ip_type iptype, uint8_t xlat_mux_id); - int add_lan2lan_flt_rule(ipa_ip_type iptype, uint32_t src_v4_addr, uint32_t dst_v4_addr, uint32_t* src_v6_addr, uint32_t* dst_v6_addr, uint32_t* rule_hdl); - - int del_lan2lan_flt_rule(ipa_ip_type iptype, uint32_t rule_hdl); - - virtual int add_lan2lan_hdr(ipa_ip_type iptype, uint8_t* src_mac, uint8_t* dst_mac, uint32_t* hdr_hdl); - - int add_lan2lan_rt_rule(ipa_ip_type iptype, uint32_t src_v4_addr, uint32_t dst_v4_addr, - uint32_t* src_v6_addr, uint32_t* dst_v6_addr, uint32_t hdr_hdl, lan_to_lan_rt_rule_hdl* rule_hdl); - - int del_lan2lan_rt_rule(ipa_ip_type iptype, lan_to_lan_rt_rule_hdl); - - int del_lan2lan_hdr(ipa_ip_type iptype, uint32_t hdr_hdl); - int handle_cradle_wan_mode_switch(bool is_wan_bridge_mode); int install_ipv4_icmp_flt_rule(); - static ipa_hdr_l2_type lan_hdr_type; - static ipa_hdr_l2_type wlan_hdr_type; - static uint32_t usb_hdr_template_hdl; - static uint32_t wlan_hdr_template_hdl; - static uint32_t cpe_hdr_template_hdl; + /* add header processing context and return handle to lan2lan controller */ + int eth_bridge_add_hdr_proc_ctx(ipa_hdr_l2_type peer_l2_hdr_type, uint32_t *hdl); - static hdr_proc_ctx_info lan_to_wlan_hdr_proc_ctx, wlan_to_usb_hdr_proc_ctx, wlan_to_cpe_hdr_proc_ctx; - static hdr_proc_ctx_info wlan_to_wlan_hdr_proc_ctx; - static hdr_proc_ctx_info cpe_to_usb_hdr_proc_ctx, usb_to_cpe_hdr_proc_ctx; + /* add routing rule and return handle to lan2lan controller */ + int eth_bridge_add_rt_rule(uint8_t *mac, char *rt_tbl_name, uint32_t hdr_proc_ctx_hdl, + ipa_hdr_l2_type peer_l2_hdr_type, ipa_ip_type iptype, uint32_t *rt_rule_hdl, int *rt_rule_count); - static eth_bridge_subnet_client_info eth_bridge_wlan_client[IPA_LAN_TO_LAN_MAX_WLAN_CLIENT]; - static eth_bridge_subnet_client_info eth_bridge_lan_client[IPA_LAN_TO_LAN_MAX_LAN_CLIENT]; + /* modify routing rule*/ + int eth_bridge_modify_rt_rule(uint8_t *mac, uint32_t hdr_proc_ctx_hdl, + ipa_hdr_l2_type peer_l2_hdr_type, ipa_ip_type iptype, uint32_t *rt_rule_hdl, int rt_rule_count); - static int num_wlan_client; - static int num_lan_client; + /* add filtering rule and return handle to lan2lan controller */ + int eth_bridge_add_flt_rule(uint8_t *mac, uint32_t rt_tbl_hdl, ipa_ip_type iptype, uint32_t *flt_rule_hdl); - static bool is_usb_up; - static bool is_cpe_up; + /* delete filtering rule */ + int eth_bridge_del_flt_rule(uint32_t flt_rule_hdl, ipa_ip_type iptype); -protected: - - lan2lan_flt_rule_hdl wlan_client_flt_rule_hdl_v4[IPA_LAN_TO_LAN_MAX_WLAN_CLIENT]; - lan2lan_flt_rule_hdl wlan_client_flt_rule_hdl_v6[IPA_LAN_TO_LAN_MAX_WLAN_CLIENT]; - lan2lan_flt_rule_hdl lan_client_flt_rule_hdl_v4[IPA_LAN_TO_LAN_MAX_LAN_CLIENT]; - lan2lan_flt_rule_hdl lan_client_flt_rule_hdl_v6[IPA_LAN_TO_LAN_MAX_LAN_CLIENT]; - - eth_bridge_client_flt_info eth_bridge_wlan_client_flt_info[IPA_LAN_TO_LAN_MAX_WLAN_CLIENT]; - eth_bridge_client_flt_info eth_bridge_lan_client_flt_info[IPA_LAN_TO_LAN_MAX_LAN_CLIENT]; - - int wlan_client_flt_info_count; - int lan_client_flt_info_count; - - int client_rt_info_size_v4; - int client_rt_info_size_v6; - - eth_bridge_client_rt_info* eth_bridge_lan_client_rt_from_lan_info_v4; - int lan_client_rt_from_lan_info_count_v4; - eth_bridge_client_rt_info* eth_bridge_lan_client_rt_from_lan_info_v6; - int lan_client_rt_from_lan_info_count_v6; - eth_bridge_client_rt_info* eth_bridge_lan_client_rt_from_wlan_info_v4; - int lan_client_rt_from_wlan_info_count_v4; - eth_bridge_client_rt_info* eth_bridge_lan_client_rt_from_wlan_info_v6; - int lan_client_rt_from_wlan_info_count_v6; - - int each_client_rt_rule_count_v4; - int each_client_rt_rule_count_v6; - - virtual int eth_bridge_handle_dummy_wlan_client_flt_rule(ipa_ip_type iptype); - - virtual int eth_bridge_handle_dummy_lan_client_flt_rule(ipa_ip_type iptype); - - int eth_bridge_add_lan_client_flt_rule(uint8_t* mac, ipa_ip_type iptype); - - int eth_bridge_del_lan_client_flt_rule(uint8_t* mac); - - int eth_bridge_add_wlan_client_flt_rule(uint8_t* mac, ipa_ip_type iptype); - - int eth_bridge_del_wlan_client_flt_rule(uint8_t* mac); - - int eth_bridge_post_lan_client_event(uint8_t* mac_addr, ipa_cm_event_id evt); - - int add_hdr_proc_ctx(); - - int del_hdr_proc_ctx(); + /* delete routing rule */ + int eth_bridge_del_rt_rule(uint32_t rt_rule_hdl, ipa_ip_type iptype); - ipa_hdr_proc_type get_hdr_proc_type(ipa_hdr_l2_type t1, ipa_hdr_l2_type t2); + /* delete header processing context */ + int eth_bridge_del_hdr_proc_ctx(uint32_t hdr_proc_ctx_hdl); - virtual int eth_bridge_install_cache_wlan_client_flt_rule(ipa_ip_type iptype); - virtual int eth_bridge_install_cache_lan_client_flt_rule(ipa_ip_type iptype); - int eth_bridge_add_lan_client_rt_rule(uint8_t* mac, eth_bridge_src_iface src, ipa_ip_type iptype); - - int eth_bridge_del_lan_client_rt_rule(uint8_t* mac, eth_bridge_src_iface src); - - eth_bridge_client_rt_info* eth_bridge_get_client_rt_info_ptr(uint8_t index, eth_bridge_src_iface src, ipa_ip_type iptype); - - void eth_bridge_add_lan_client(uint8_t* mac); +protected: - void eth_bridge_del_lan_client(uint8_t* mac); + int each_client_rt_rule_count[IPA_IP_MAX]; - int eth_bridge_get_hdr_template_hdl(uint32_t* hdr_hdl); + uint32_t eth_bridge_flt_rule_offset[IPA_IP_MAX]; + /* mac address has to be provided for client related events */ + void eth_bridge_post_event(ipa_cm_event_id evt, ipa_ip_type iptype, uint8_t *mac); - virtual int add_dummy_lan2lan_flt_rule(ipa_ip_type iptype); virtual int add_dummy_private_subnet_flt_rule(ipa_ip_type iptype); @@ -302,9 +188,6 @@ protected: int reset_to_dummy_flt_rule(ipa_ip_type iptype, uint32_t rule_hdl); - /*handle lan2lan client active*/ - int handle_lan2lan_client_active(ipacm_event_data_all *data, ipa_cm_event_id event); - virtual int install_ipv6_prefix_flt_rule(uint32_t* prefix); virtual void delete_ipv6_prefix_flt_rule(); @@ -319,26 +202,13 @@ protected: /* handle tethering client */ int handle_tethering_client(bool reset, ipacm_client_enum ipa_client); - lan2lan_flt_rule_hdl lan2lan_flt_rule_hdl_v4[MAX_OFFLOAD_PAIR]; - lan2lan_flt_rule_hdl lan2lan_flt_rule_hdl_v6[MAX_OFFLOAD_PAIR]; - - uint8_t num_lan2lan_flt_rule_v4; - uint8_t num_lan2lan_flt_rule_v6; - - lan2lan_hdr_hdl lan2lan_hdr_hdl_v4[MAX_OFFLOAD_PAIR]; - lan2lan_hdr_hdl lan2lan_hdr_hdl_v6[MAX_OFFLOAD_PAIR]; - /* store ipv4 UL filter rule handlers from Q6*/ uint32_t wan_ul_fl_rule_hdl_v4[MAX_WAN_UL_FILTER_RULES]; /* store ipv6 UL filter rule handlers from Q6*/ uint32_t wan_ul_fl_rule_hdl_v6[MAX_WAN_UL_FILTER_RULES]; - virtual void install_tcp_ctl_flt_rule(ipa_ip_type iptype); - uint32_t ipv4_icmp_flt_rule_hdl[NUM_IPV4_ICMP_FLT_RULE]; - uint32_t tcp_ctl_flt_rule_hdl_v4[NUM_TCP_CTL_FLT_RULE]; - uint32_t tcp_ctl_flt_rule_hdl_v6[NUM_TCP_CTL_FLT_RULE]; uint32_t ipv6_prefix_flt_rule_hdl[NUM_IPV6_PREFIX_FLT_RULE]; uint32_t ipv6_icmp_flt_rule_hdl[NUM_IPV6_ICMP_FLT_RULE]; @@ -352,12 +222,17 @@ protected: uint32_t if_ipv4_subnet; - /* expected modem UL rules starting index */ - int exp_index_v4; - int exp_index_v6; + uint32_t ipv6_prefix[2]; private: + /* get hdr proc ctx type given source and destination l2 hdr type */ + ipa_hdr_proc_type eth_bridge_get_hdr_proc_type(ipa_hdr_l2_type t1, ipa_hdr_l2_type t2); + + /* get partial header (header template of hdr proc ctx) */ + int eth_bridge_get_hdr_template_hdl(uint32_t* hdr_hdl); + + /* dynamically allocate lan iface's unicast routing rule structure */ bool is_mode_switch; /* indicate mode switch, need post internal up event */ @@ -508,9 +383,6 @@ private: /*handle lan iface down event*/ int handle_down_evt(); - /*handle lan2lan internal mesg posting*/ - int post_lan2lan_client_disconnect_msg(ipa_ip_type iptype); - /*handle reset usb-client rt-rules */ int handle_lan_client_reset_rt(ipa_ip_type iptype); }; |