Loading drivers/platform/msm/ipa/ipa_v2/ipa_debugfs.c +2 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,8 @@ const char *ipa_event_name[] = { __stringify(DEL_L2TP_VLAN_MAPPING), __stringify(IPA_PER_CLIENT_STATS_CONNECT_EVENT), __stringify(IPA_PER_CLIENT_STATS_DISCONNECT_EVENT), __stringify(ADD_BRIDGE_VLAN_MAPPING), __stringify(DEL_BRIDGE_VLAN_MAPPING), }; const char *ipa_hdr_l2_type_name[] = { Loading drivers/platform/msm/ipa/ipa_v3/ipa.c +65 −26 Original line number Diff line number Diff line Loading @@ -499,10 +499,15 @@ static void ipa3_vlan_l2tp_msg_free_cb(void *buff, u32 len, u32 type) return; } if (type != ADD_VLAN_IFACE && type != DEL_VLAN_IFACE && type != ADD_L2TP_VLAN_MAPPING && type != DEL_L2TP_VLAN_MAPPING) { switch (type) { case ADD_VLAN_IFACE: case DEL_VLAN_IFACE: case ADD_L2TP_VLAN_MAPPING: case DEL_L2TP_VLAN_MAPPING: case ADD_BRIDGE_VLAN_MAPPING: case DEL_BRIDGE_VLAN_MAPPING: break; default: IPAERR("Wrong type given. buff %pK type %d\n", buff, type); return; } Loading @@ -515,10 +520,17 @@ static int ipa3_send_vlan_l2tp_msg(unsigned long usr_param, uint8_t msg_type) int retval; struct ipa_ioc_vlan_iface_info *vlan_info; struct ipa_ioc_l2tp_vlan_mapping_info *mapping_info; struct ipa_ioc_bridge_vlan_mapping_info *bridge_vlan_info; struct ipa_msg_meta msg_meta; void *buff; IPADBG("type %d\n", msg_type); memset(&msg_meta, 0, sizeof(msg_meta)); msg_meta.msg_type = msg_type; if (msg_type == ADD_VLAN_IFACE || msg_type == DEL_VLAN_IFACE) { if ((msg_type == ADD_VLAN_IFACE) || (msg_type == DEL_VLAN_IFACE)) { vlan_info = kzalloc(sizeof(struct ipa_ioc_vlan_iface_info), GFP_KERNEL); if (!vlan_info) { Loading @@ -532,18 +544,10 @@ static int ipa3_send_vlan_l2tp_msg(unsigned long usr_param, uint8_t msg_type) return -EFAULT; } memset(&msg_meta, 0, sizeof(msg_meta)); msg_meta.msg_type = msg_type; msg_meta.msg_len = sizeof(struct ipa_ioc_vlan_iface_info); retval = ipa3_send_msg(&msg_meta, vlan_info, ipa3_vlan_l2tp_msg_free_cb); if (retval) { IPAERR("ipa3_send_msg failed: %d\n", retval); kfree(vlan_info); return retval; } } else if (msg_type == ADD_L2TP_VLAN_MAPPING || msg_type == DEL_L2TP_VLAN_MAPPING) { buff = vlan_info; } else if ((msg_type == ADD_L2TP_VLAN_MAPPING) || (msg_type == DEL_L2TP_VLAN_MAPPING)) { mapping_info = kzalloc(sizeof(struct ipa_ioc_l2tp_vlan_mapping_info), GFP_KERNEL); if (!mapping_info) { Loading @@ -558,22 +562,46 @@ static int ipa3_send_vlan_l2tp_msg(unsigned long usr_param, uint8_t msg_type) return -EFAULT; } memset(&msg_meta, 0, sizeof(msg_meta)); msg_meta.msg_type = msg_type; msg_meta.msg_len = sizeof(struct ipa_ioc_l2tp_vlan_mapping_info); retval = ipa3_send_msg(&msg_meta, mapping_info, ipa3_vlan_l2tp_msg_free_cb); if (retval) { IPAERR("ipa3_send_msg failed: %d\n", retval); kfree(mapping_info); return retval; buff = mapping_info; } else if ((msg_type == ADD_BRIDGE_VLAN_MAPPING) || (msg_type == DEL_BRIDGE_VLAN_MAPPING)) { bridge_vlan_info = kzalloc( sizeof(struct ipa_ioc_bridge_vlan_mapping_info), GFP_KERNEL); if (!bridge_vlan_info) { IPAERR("no memory\n"); return -ENOMEM; } if (copy_from_user((u8 *)bridge_vlan_info, (void __user *)usr_param, sizeof(struct ipa_ioc_bridge_vlan_mapping_info))) { kfree(bridge_vlan_info); IPAERR("copy from user failed\n"); return -EFAULT; } msg_meta.msg_len = sizeof(struct ipa_ioc_bridge_vlan_mapping_info); buff = bridge_vlan_info; } else { IPAERR("Unexpected event\n"); return -EFAULT; } retval = ipa3_send_msg(&msg_meta, buff, ipa3_vlan_l2tp_msg_free_cb); if (retval) { IPAERR("ipa3_send_msg failed: %d, msg_type %d\n", retval, msg_type); kfree(buff); return retval; } IPADBG("exit\n"); return 0; } Loading Loading @@ -1726,7 +1754,18 @@ static long ipa3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) break; } break; case IPA_IOC_ADD_BRIDGE_VLAN_MAPPING: if (ipa3_send_vlan_l2tp_msg(arg, ADD_BRIDGE_VLAN_MAPPING)) { retval = -EFAULT; break; } break; case IPA_IOC_DEL_BRIDGE_VLAN_MAPPING: if (ipa3_send_vlan_l2tp_msg(arg, DEL_BRIDGE_VLAN_MAPPING)) { retval = -EFAULT; break; } break; case IPA_IOC_ADD_L2TP_VLAN_MAPPING: if (ipa3_send_vlan_l2tp_msg(arg, ADD_L2TP_VLAN_MAPPING)) { retval = -EFAULT; Loading drivers/platform/msm/ipa/ipa_v3/ipa_debugfs.c +2 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,8 @@ const char *ipa3_event_name[] = { __stringify(DEL_L2TP_VLAN_MAPPING), __stringify(IPA_PER_CLIENT_STATS_CONNECT_EVENT), __stringify(IPA_PER_CLIENT_STATS_DISCONNECT_EVENT), __stringify(ADD_BRIDGE_VLAN_MAPPING), __stringify(DEL_BRIDGE_VLAN_MAPPING), }; const char *ipa3_hdr_l2_type_name[] = { Loading include/uapi/linux/msm_ipa.h +32 −1 Original line number Diff line number Diff line Loading @@ -98,6 +98,8 @@ #define IPA_IOCTL_CLEANUP 56 #define IPA_IOCTL_QUERY_WLAN_CLIENT 57 #define IPA_IOCTL_GET_VLAN_MODE 58 #define IPA_IOCTL_ADD_BRIDGE_VLAN_MAPPING 59 #define IPA_IOCTL_DEL_BRIDGE_VLAN_MAPPING 60 /** * max size of the header to be inserted Loading Loading @@ -512,7 +514,13 @@ enum ipa_per_client_stats_event { IPA_PER_CLIENT_STATS_EVENT_MAX }; #define IPA_EVENT_MAX_NUM (IPA_PER_CLIENT_STATS_EVENT_MAX) enum ipa_vlan_bridge_event { ADD_BRIDGE_VLAN_MAPPING = IPA_PER_CLIENT_STATS_EVENT_MAX, DEL_BRIDGE_VLAN_MAPPING, BRIDGE_VLAN_MAPPING_MAX }; #define IPA_EVENT_MAX_NUM (BRIDGE_VLAN_MAPPING_MAX) #define IPA_EVENT_MAX ((int)IPA_EVENT_MAX_NUM) /** Loading Loading @@ -1871,6 +1879,20 @@ struct ipa_ioc_get_vlan_mode { uint32_t is_vlan_mode; }; /** * struct ipa_ioc_bridge_vlan_mapping_info - vlan to bridge mapping info * @bridge_name: bridge interface name * @vlan_id: vlan ID bridge is mapped to * @bridge_ipv4: bridge interface ipv4 address * @subnet_mask: bridge interface subnet mask */ struct ipa_ioc_bridge_vlan_mapping_info { char bridge_name[IPA_RESOURCE_NAME_MAX]; uint16_t vlan_id; uint32_t bridge_ipv4; uint32_t subnet_mask; }; /** * actual IOCTLs supported by IPA driver */ Loading Loading @@ -2056,6 +2078,15 @@ struct ipa_ioc_get_vlan_mode { #define IPA_IOC_GET_VLAN_MODE _IOWR(IPA_IOC_MAGIC, \ IPA_IOCTL_GET_VLAN_MODE, \ struct ipa_ioc_get_vlan_mode *) #define IPA_IOC_ADD_BRIDGE_VLAN_MAPPING _IOWR(IPA_IOC_MAGIC, \ IPA_IOCTL_ADD_BRIDGE_VLAN_MAPPING, \ struct ipa_ioc_bridge_vlan_mapping_info) #define IPA_IOC_DEL_BRIDGE_VLAN_MAPPING _IOWR(IPA_IOC_MAGIC, \ IPA_IOCTL_DEL_BRIDGE_VLAN_MAPPING, \ struct ipa_ioc_bridge_vlan_mapping_info) /* * unique magic number of the Tethering bridge ioctls */ Loading Loading
drivers/platform/msm/ipa/ipa_v2/ipa_debugfs.c +2 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,8 @@ const char *ipa_event_name[] = { __stringify(DEL_L2TP_VLAN_MAPPING), __stringify(IPA_PER_CLIENT_STATS_CONNECT_EVENT), __stringify(IPA_PER_CLIENT_STATS_DISCONNECT_EVENT), __stringify(ADD_BRIDGE_VLAN_MAPPING), __stringify(DEL_BRIDGE_VLAN_MAPPING), }; const char *ipa_hdr_l2_type_name[] = { Loading
drivers/platform/msm/ipa/ipa_v3/ipa.c +65 −26 Original line number Diff line number Diff line Loading @@ -499,10 +499,15 @@ static void ipa3_vlan_l2tp_msg_free_cb(void *buff, u32 len, u32 type) return; } if (type != ADD_VLAN_IFACE && type != DEL_VLAN_IFACE && type != ADD_L2TP_VLAN_MAPPING && type != DEL_L2TP_VLAN_MAPPING) { switch (type) { case ADD_VLAN_IFACE: case DEL_VLAN_IFACE: case ADD_L2TP_VLAN_MAPPING: case DEL_L2TP_VLAN_MAPPING: case ADD_BRIDGE_VLAN_MAPPING: case DEL_BRIDGE_VLAN_MAPPING: break; default: IPAERR("Wrong type given. buff %pK type %d\n", buff, type); return; } Loading @@ -515,10 +520,17 @@ static int ipa3_send_vlan_l2tp_msg(unsigned long usr_param, uint8_t msg_type) int retval; struct ipa_ioc_vlan_iface_info *vlan_info; struct ipa_ioc_l2tp_vlan_mapping_info *mapping_info; struct ipa_ioc_bridge_vlan_mapping_info *bridge_vlan_info; struct ipa_msg_meta msg_meta; void *buff; IPADBG("type %d\n", msg_type); memset(&msg_meta, 0, sizeof(msg_meta)); msg_meta.msg_type = msg_type; if (msg_type == ADD_VLAN_IFACE || msg_type == DEL_VLAN_IFACE) { if ((msg_type == ADD_VLAN_IFACE) || (msg_type == DEL_VLAN_IFACE)) { vlan_info = kzalloc(sizeof(struct ipa_ioc_vlan_iface_info), GFP_KERNEL); if (!vlan_info) { Loading @@ -532,18 +544,10 @@ static int ipa3_send_vlan_l2tp_msg(unsigned long usr_param, uint8_t msg_type) return -EFAULT; } memset(&msg_meta, 0, sizeof(msg_meta)); msg_meta.msg_type = msg_type; msg_meta.msg_len = sizeof(struct ipa_ioc_vlan_iface_info); retval = ipa3_send_msg(&msg_meta, vlan_info, ipa3_vlan_l2tp_msg_free_cb); if (retval) { IPAERR("ipa3_send_msg failed: %d\n", retval); kfree(vlan_info); return retval; } } else if (msg_type == ADD_L2TP_VLAN_MAPPING || msg_type == DEL_L2TP_VLAN_MAPPING) { buff = vlan_info; } else if ((msg_type == ADD_L2TP_VLAN_MAPPING) || (msg_type == DEL_L2TP_VLAN_MAPPING)) { mapping_info = kzalloc(sizeof(struct ipa_ioc_l2tp_vlan_mapping_info), GFP_KERNEL); if (!mapping_info) { Loading @@ -558,22 +562,46 @@ static int ipa3_send_vlan_l2tp_msg(unsigned long usr_param, uint8_t msg_type) return -EFAULT; } memset(&msg_meta, 0, sizeof(msg_meta)); msg_meta.msg_type = msg_type; msg_meta.msg_len = sizeof(struct ipa_ioc_l2tp_vlan_mapping_info); retval = ipa3_send_msg(&msg_meta, mapping_info, ipa3_vlan_l2tp_msg_free_cb); if (retval) { IPAERR("ipa3_send_msg failed: %d\n", retval); kfree(mapping_info); return retval; buff = mapping_info; } else if ((msg_type == ADD_BRIDGE_VLAN_MAPPING) || (msg_type == DEL_BRIDGE_VLAN_MAPPING)) { bridge_vlan_info = kzalloc( sizeof(struct ipa_ioc_bridge_vlan_mapping_info), GFP_KERNEL); if (!bridge_vlan_info) { IPAERR("no memory\n"); return -ENOMEM; } if (copy_from_user((u8 *)bridge_vlan_info, (void __user *)usr_param, sizeof(struct ipa_ioc_bridge_vlan_mapping_info))) { kfree(bridge_vlan_info); IPAERR("copy from user failed\n"); return -EFAULT; } msg_meta.msg_len = sizeof(struct ipa_ioc_bridge_vlan_mapping_info); buff = bridge_vlan_info; } else { IPAERR("Unexpected event\n"); return -EFAULT; } retval = ipa3_send_msg(&msg_meta, buff, ipa3_vlan_l2tp_msg_free_cb); if (retval) { IPAERR("ipa3_send_msg failed: %d, msg_type %d\n", retval, msg_type); kfree(buff); return retval; } IPADBG("exit\n"); return 0; } Loading Loading @@ -1726,7 +1754,18 @@ static long ipa3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) break; } break; case IPA_IOC_ADD_BRIDGE_VLAN_MAPPING: if (ipa3_send_vlan_l2tp_msg(arg, ADD_BRIDGE_VLAN_MAPPING)) { retval = -EFAULT; break; } break; case IPA_IOC_DEL_BRIDGE_VLAN_MAPPING: if (ipa3_send_vlan_l2tp_msg(arg, DEL_BRIDGE_VLAN_MAPPING)) { retval = -EFAULT; break; } break; case IPA_IOC_ADD_L2TP_VLAN_MAPPING: if (ipa3_send_vlan_l2tp_msg(arg, ADD_L2TP_VLAN_MAPPING)) { retval = -EFAULT; Loading
drivers/platform/msm/ipa/ipa_v3/ipa_debugfs.c +2 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,8 @@ const char *ipa3_event_name[] = { __stringify(DEL_L2TP_VLAN_MAPPING), __stringify(IPA_PER_CLIENT_STATS_CONNECT_EVENT), __stringify(IPA_PER_CLIENT_STATS_DISCONNECT_EVENT), __stringify(ADD_BRIDGE_VLAN_MAPPING), __stringify(DEL_BRIDGE_VLAN_MAPPING), }; const char *ipa3_hdr_l2_type_name[] = { Loading
include/uapi/linux/msm_ipa.h +32 −1 Original line number Diff line number Diff line Loading @@ -98,6 +98,8 @@ #define IPA_IOCTL_CLEANUP 56 #define IPA_IOCTL_QUERY_WLAN_CLIENT 57 #define IPA_IOCTL_GET_VLAN_MODE 58 #define IPA_IOCTL_ADD_BRIDGE_VLAN_MAPPING 59 #define IPA_IOCTL_DEL_BRIDGE_VLAN_MAPPING 60 /** * max size of the header to be inserted Loading Loading @@ -512,7 +514,13 @@ enum ipa_per_client_stats_event { IPA_PER_CLIENT_STATS_EVENT_MAX }; #define IPA_EVENT_MAX_NUM (IPA_PER_CLIENT_STATS_EVENT_MAX) enum ipa_vlan_bridge_event { ADD_BRIDGE_VLAN_MAPPING = IPA_PER_CLIENT_STATS_EVENT_MAX, DEL_BRIDGE_VLAN_MAPPING, BRIDGE_VLAN_MAPPING_MAX }; #define IPA_EVENT_MAX_NUM (BRIDGE_VLAN_MAPPING_MAX) #define IPA_EVENT_MAX ((int)IPA_EVENT_MAX_NUM) /** Loading Loading @@ -1871,6 +1879,20 @@ struct ipa_ioc_get_vlan_mode { uint32_t is_vlan_mode; }; /** * struct ipa_ioc_bridge_vlan_mapping_info - vlan to bridge mapping info * @bridge_name: bridge interface name * @vlan_id: vlan ID bridge is mapped to * @bridge_ipv4: bridge interface ipv4 address * @subnet_mask: bridge interface subnet mask */ struct ipa_ioc_bridge_vlan_mapping_info { char bridge_name[IPA_RESOURCE_NAME_MAX]; uint16_t vlan_id; uint32_t bridge_ipv4; uint32_t subnet_mask; }; /** * actual IOCTLs supported by IPA driver */ Loading Loading @@ -2056,6 +2078,15 @@ struct ipa_ioc_get_vlan_mode { #define IPA_IOC_GET_VLAN_MODE _IOWR(IPA_IOC_MAGIC, \ IPA_IOCTL_GET_VLAN_MODE, \ struct ipa_ioc_get_vlan_mode *) #define IPA_IOC_ADD_BRIDGE_VLAN_MAPPING _IOWR(IPA_IOC_MAGIC, \ IPA_IOCTL_ADD_BRIDGE_VLAN_MAPPING, \ struct ipa_ioc_bridge_vlan_mapping_info) #define IPA_IOC_DEL_BRIDGE_VLAN_MAPPING _IOWR(IPA_IOC_MAGIC, \ IPA_IOCTL_DEL_BRIDGE_VLAN_MAPPING, \ struct ipa_ioc_bridge_vlan_mapping_info) /* * unique magic number of the Tethering bridge ioctls */ Loading