Loading drivers/platform/msm/ipa/ipa_v3/ipa.c +70 −0 Original line number Diff line number Diff line Loading @@ -548,6 +548,68 @@ static void ipa3_vlan_l2tp_msg_free_cb(void *buff, u32 len, u32 type) kfree(buff); } static void ipa3_pdn_config_msg_free_cb(void *buff, u32 len, u32 type) { if (!buff) { IPAERR("Null buffer\n"); return; } kfree(buff); } static int ipa3_send_pdn_config_msg(unsigned long usr_param) { int retval; struct ipa_ioc_pdn_config *pdn_info; struct ipa_msg_meta msg_meta; void *buff; memset(&msg_meta, 0, sizeof(msg_meta)); pdn_info = kzalloc(sizeof(struct ipa_ioc_pdn_config), GFP_KERNEL); if (!pdn_info) return -ENOMEM; if (copy_from_user((u8 *)pdn_info, (void __user *)usr_param, sizeof(struct ipa_ioc_pdn_config))) { kfree(pdn_info); return -EFAULT; } msg_meta.msg_len = sizeof(struct ipa_ioc_pdn_config); buff = pdn_info; msg_meta.msg_type = pdn_info->pdn_cfg_type; IPADBG("type %d, interface name: %s, enable:%d\n", msg_meta.msg_type, pdn_info->dev_name, pdn_info->enable); if (pdn_info->pdn_cfg_type == IPA_PDN_IP_PASSTHROUGH_MODE_CONFIG) { IPADBG("Client MAC %02x:%02x:%02x:%02x:%02x:%02x\n", pdn_info->u.passthrough_cfg.client_mac_addr[0], pdn_info->u.passthrough_cfg.client_mac_addr[1], pdn_info->u.passthrough_cfg.client_mac_addr[2], pdn_info->u.passthrough_cfg.client_mac_addr[3], pdn_info->u.passthrough_cfg.client_mac_addr[4], pdn_info->u.passthrough_cfg.client_mac_addr[5]); } retval = ipa3_send_msg(&msg_meta, buff, ipa3_pdn_config_msg_free_cb); if (retval) { IPAERR("ipa3_send_msg failed: %d, msg_type %d\n", retval, msg_meta.msg_type); kfree(buff); return retval; } IPADBG("exit\n"); return 0; } static int ipa3_send_vlan_l2tp_msg(unsigned long usr_param, uint8_t msg_type) { int retval; Loading Loading @@ -632,6 +694,7 @@ static int ipa3_send_vlan_l2tp_msg(unsigned long usr_param, uint8_t msg_type) return 0; } static void ipa3_gsb_msg_free_cb(void *buff, u32 len, u32 type) { if (!buff) { Loading Loading @@ -2920,6 +2983,13 @@ static long ipa3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) (enum ipa_app_clock_vote_type) arg); break; case IPA_IOC_PDN_CONFIG: if (ipa3_send_pdn_config_msg(arg)) { retval = -EFAULT; break; } break; default: IPA_ACTIVE_CLIENTS_DEC_SIMPLE(); return -ENOTTY; Loading drivers/platform/msm/ipa/ipa_v3/ipa_debugfs.c +3 −0 Original line number Diff line number Diff line Loading @@ -86,6 +86,9 @@ const char *ipa3_event_name[] = { __stringify(WIGIG_FST_SWITCH), __stringify(IPA_SOCKV5_ADD), __stringify(IPA_SOCKV5_DEL), __stringify(IPA_PDN_DEFAULT_MODE_CONFIG), __stringify(IPA_PDN_IP_COLLISION_MODE_CONFIG), __stringify(IPA_PDN_IP_PASSTHROUGH_MODE_CONFIG), }; const char *ipa3_hdr_l2_type_name[] = { Loading include/uapi/linux/msm_ipa.h +46 −1 Original line number Diff line number Diff line Loading @@ -125,6 +125,7 @@ #define IPA_IOCTL_GET_NAT_IN_SRAM_INFO 77 #define IPA_IOCTL_GET_PHERIPHERAL_EP_INFO 78 #define IPA_IOCTL_APP_CLOCK_VOTE 79 #define IPA_IOCTL_PDN_CONFIG 80 /** * max size of the header to be inserted Loading Loading @@ -739,7 +740,15 @@ enum ipa_sockv5_event { #define IPA_SOCKV5_EVENT_MAX IPA_SOCKV5_EVENT_MAX }; #define IPA_EVENT_MAX_NUM (IPA_SOCKV5_EVENT_MAX) enum ipa_pdn_config_event { IPA_PDN_DEFAULT_MODE_CONFIG = IPA_SOCKV5_EVENT_MAX, /* Default mode. */ IPA_PDN_IP_COLLISION_MODE_CONFIG, /* IP Collision detected. */ IPA_PDN_IP_PASSTHROUGH_MODE_CONFIG, /* IP Passthrough mode. */ IPA_PDN_CONFIG_EVENT_MAX #define IPA_PDN_CONFIG_EVENT_MAX IPA_PDN_CONFIG_EVENT_MAX }; #define IPA_EVENT_MAX_NUM (IPA_PDN_CONFIG_EVENT_MAX) #define IPA_EVENT_MAX ((int)IPA_EVENT_MAX_NUM) /** Loading Loading @@ -2745,6 +2754,39 @@ struct ipa_odl_modem_config { __u8 config_status; }; /** * struct ipa_ioc_pdn_config - provide pdn configuration * @dev_name: PDN interface name * @pdn_cfg_type: type of the pdn config applied. * @enable: enable/disable pdn config type. * @u.collison_cfg.pdn_ip_addr: pdn_ip_address used in collision config. * @u.passthrough_cfg.pdn_ip_addr: pdn_ip_address used in passthrough config. * @u.passthrough_cfg.device_type: Device type of the client. * @u.passthrough_cfg.vlan_id: VLAN ID of the client. * @u.passthrough_cfg.client_mac_addr: client mac for which passthough * is enabled. * @u.passthrough_cfg.skip_nat: skip NAT processing. */ struct ipa_ioc_pdn_config { char dev_name[IPA_RESOURCE_NAME_MAX]; enum ipa_pdn_config_event pdn_cfg_type; uint8_t enable; union { struct ipa_pdn_ip_collision_cfg { uint32_t pdn_ip_addr; } collison_cfg; struct ipa_pdn_ip_passthrough_cfg { uint32_t pdn_ip_addr; enum ipacm_per_client_device_type device_type; uint16_t vlan_id; uint8_t client_mac_addr[IPA_MAC_ADDR_SIZE]; uint8_t skip_nat; } passthrough_cfg; } u; }; /** * actual IOCTLs supported by IPA driver Loading Loading @@ -3007,6 +3049,9 @@ struct ipa_odl_modem_config { IPA_IOCTL_APP_CLOCK_VOTE, \ uint32_t) #define IPA_IOC_PDN_CONFIG _IOWR(IPA_IOC_MAGIC, \ IPA_IOCTL_PDN_CONFIG, \ struct ipa_ioc_pdn_config) /* * unique magic number of the Tethering bridge ioctls */ Loading Loading
drivers/platform/msm/ipa/ipa_v3/ipa.c +70 −0 Original line number Diff line number Diff line Loading @@ -548,6 +548,68 @@ static void ipa3_vlan_l2tp_msg_free_cb(void *buff, u32 len, u32 type) kfree(buff); } static void ipa3_pdn_config_msg_free_cb(void *buff, u32 len, u32 type) { if (!buff) { IPAERR("Null buffer\n"); return; } kfree(buff); } static int ipa3_send_pdn_config_msg(unsigned long usr_param) { int retval; struct ipa_ioc_pdn_config *pdn_info; struct ipa_msg_meta msg_meta; void *buff; memset(&msg_meta, 0, sizeof(msg_meta)); pdn_info = kzalloc(sizeof(struct ipa_ioc_pdn_config), GFP_KERNEL); if (!pdn_info) return -ENOMEM; if (copy_from_user((u8 *)pdn_info, (void __user *)usr_param, sizeof(struct ipa_ioc_pdn_config))) { kfree(pdn_info); return -EFAULT; } msg_meta.msg_len = sizeof(struct ipa_ioc_pdn_config); buff = pdn_info; msg_meta.msg_type = pdn_info->pdn_cfg_type; IPADBG("type %d, interface name: %s, enable:%d\n", msg_meta.msg_type, pdn_info->dev_name, pdn_info->enable); if (pdn_info->pdn_cfg_type == IPA_PDN_IP_PASSTHROUGH_MODE_CONFIG) { IPADBG("Client MAC %02x:%02x:%02x:%02x:%02x:%02x\n", pdn_info->u.passthrough_cfg.client_mac_addr[0], pdn_info->u.passthrough_cfg.client_mac_addr[1], pdn_info->u.passthrough_cfg.client_mac_addr[2], pdn_info->u.passthrough_cfg.client_mac_addr[3], pdn_info->u.passthrough_cfg.client_mac_addr[4], pdn_info->u.passthrough_cfg.client_mac_addr[5]); } retval = ipa3_send_msg(&msg_meta, buff, ipa3_pdn_config_msg_free_cb); if (retval) { IPAERR("ipa3_send_msg failed: %d, msg_type %d\n", retval, msg_meta.msg_type); kfree(buff); return retval; } IPADBG("exit\n"); return 0; } static int ipa3_send_vlan_l2tp_msg(unsigned long usr_param, uint8_t msg_type) { int retval; Loading Loading @@ -632,6 +694,7 @@ static int ipa3_send_vlan_l2tp_msg(unsigned long usr_param, uint8_t msg_type) return 0; } static void ipa3_gsb_msg_free_cb(void *buff, u32 len, u32 type) { if (!buff) { Loading Loading @@ -2920,6 +2983,13 @@ static long ipa3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) (enum ipa_app_clock_vote_type) arg); break; case IPA_IOC_PDN_CONFIG: if (ipa3_send_pdn_config_msg(arg)) { retval = -EFAULT; break; } break; default: IPA_ACTIVE_CLIENTS_DEC_SIMPLE(); return -ENOTTY; Loading
drivers/platform/msm/ipa/ipa_v3/ipa_debugfs.c +3 −0 Original line number Diff line number Diff line Loading @@ -86,6 +86,9 @@ const char *ipa3_event_name[] = { __stringify(WIGIG_FST_SWITCH), __stringify(IPA_SOCKV5_ADD), __stringify(IPA_SOCKV5_DEL), __stringify(IPA_PDN_DEFAULT_MODE_CONFIG), __stringify(IPA_PDN_IP_COLLISION_MODE_CONFIG), __stringify(IPA_PDN_IP_PASSTHROUGH_MODE_CONFIG), }; const char *ipa3_hdr_l2_type_name[] = { Loading
include/uapi/linux/msm_ipa.h +46 −1 Original line number Diff line number Diff line Loading @@ -125,6 +125,7 @@ #define IPA_IOCTL_GET_NAT_IN_SRAM_INFO 77 #define IPA_IOCTL_GET_PHERIPHERAL_EP_INFO 78 #define IPA_IOCTL_APP_CLOCK_VOTE 79 #define IPA_IOCTL_PDN_CONFIG 80 /** * max size of the header to be inserted Loading Loading @@ -739,7 +740,15 @@ enum ipa_sockv5_event { #define IPA_SOCKV5_EVENT_MAX IPA_SOCKV5_EVENT_MAX }; #define IPA_EVENT_MAX_NUM (IPA_SOCKV5_EVENT_MAX) enum ipa_pdn_config_event { IPA_PDN_DEFAULT_MODE_CONFIG = IPA_SOCKV5_EVENT_MAX, /* Default mode. */ IPA_PDN_IP_COLLISION_MODE_CONFIG, /* IP Collision detected. */ IPA_PDN_IP_PASSTHROUGH_MODE_CONFIG, /* IP Passthrough mode. */ IPA_PDN_CONFIG_EVENT_MAX #define IPA_PDN_CONFIG_EVENT_MAX IPA_PDN_CONFIG_EVENT_MAX }; #define IPA_EVENT_MAX_NUM (IPA_PDN_CONFIG_EVENT_MAX) #define IPA_EVENT_MAX ((int)IPA_EVENT_MAX_NUM) /** Loading Loading @@ -2745,6 +2754,39 @@ struct ipa_odl_modem_config { __u8 config_status; }; /** * struct ipa_ioc_pdn_config - provide pdn configuration * @dev_name: PDN interface name * @pdn_cfg_type: type of the pdn config applied. * @enable: enable/disable pdn config type. * @u.collison_cfg.pdn_ip_addr: pdn_ip_address used in collision config. * @u.passthrough_cfg.pdn_ip_addr: pdn_ip_address used in passthrough config. * @u.passthrough_cfg.device_type: Device type of the client. * @u.passthrough_cfg.vlan_id: VLAN ID of the client. * @u.passthrough_cfg.client_mac_addr: client mac for which passthough * is enabled. * @u.passthrough_cfg.skip_nat: skip NAT processing. */ struct ipa_ioc_pdn_config { char dev_name[IPA_RESOURCE_NAME_MAX]; enum ipa_pdn_config_event pdn_cfg_type; uint8_t enable; union { struct ipa_pdn_ip_collision_cfg { uint32_t pdn_ip_addr; } collison_cfg; struct ipa_pdn_ip_passthrough_cfg { uint32_t pdn_ip_addr; enum ipacm_per_client_device_type device_type; uint16_t vlan_id; uint8_t client_mac_addr[IPA_MAC_ADDR_SIZE]; uint8_t skip_nat; } passthrough_cfg; } u; }; /** * actual IOCTLs supported by IPA driver Loading Loading @@ -3007,6 +3049,9 @@ struct ipa_odl_modem_config { IPA_IOCTL_APP_CLOCK_VOTE, \ uint32_t) #define IPA_IOC_PDN_CONFIG _IOWR(IPA_IOC_MAGIC, \ IPA_IOCTL_PDN_CONFIG, \ struct ipa_ioc_pdn_config) /* * unique magic number of the Tethering bridge ioctls */ Loading