Sfoglia il codice sorgente

Merge "msm: ipa3: add ipa sw-flt functionality"

qctecmdr 3 anni fa
parent
commit
432970c45d

+ 72 - 0
drivers/platform/msm/ipa/ipa_v3/ipa.c

@@ -2132,6 +2132,69 @@ static int ipa3_send_mac_flt_list(unsigned long usr_param)
 	return 0;
 }
 
+static int ipa3_send_sw_flt_list(unsigned long usr_param)
+{
+	int retval;
+	struct ipa_msg_meta msg_meta;
+	struct ipa_ioc_sw_flt_list_type sw_flt_list;
+	void *buff;
+
+	if (copy_from_user(&sw_flt_list, (const void __user *)usr_param,
+		sizeof(struct ipa_ioc_sw_flt_list_type))) {
+		IPAERR("Copy ipa_ioc_sw_flt_list_type failure\n");
+		return -EFAULT;
+	}
+
+	if (sw_flt_list.ioctl_data_size !=
+		sizeof(struct ipa_sw_flt_list_type)) {
+		IPAERR("IPA_IOC_SET_SW_FLT size not match(%d,%d)!\n",
+		sw_flt_list.ioctl_data_size,
+		sizeof(struct ipa_sw_flt_list_type));
+		return -EFAULT;
+	}
+
+	buff = kzalloc(sizeof(struct ipa_sw_flt_list_type),
+				GFP_KERNEL);
+	if (!buff) {
+		IPAERR("ipa_sw_flt_list_type mem-allocate failure\n");
+		return -ENOMEM;
+	}
+
+	if (copy_from_user(buff, u64_to_user_ptr(sw_flt_list.ioctl_ptr),
+		sizeof(struct ipa_sw_flt_list_type))) {
+		IPAERR("Failed to copy ipa_sw_flt_list_type\n");
+		kfree(buff);
+		return -EFAULT;
+	}
+	memset(&msg_meta, 0, sizeof(struct ipa_msg_meta));
+	msg_meta.msg_type = IPA_SW_FLT_EVENT;
+	msg_meta.msg_len = sizeof(struct ipa_sw_flt_list_type);
+
+	IPADBG("No of clients: %d, mac-flt enable: %d\n",
+		((struct ipa_sw_flt_list_type *)buff)->num_of_mac,
+		((struct ipa_sw_flt_list_type *)buff)->mac_enable);
+
+	IPADBG("No of segs: %d, ipv4-seg-flt enable: %d v6-offload %d\n",
+		((struct ipa_sw_flt_list_type *)buff)->num_of_ipv4_segs,
+		((struct ipa_sw_flt_list_type *)buff)->ipv4_segs_enable,
+		((struct ipa_sw_flt_list_type *)buff)->ipv4_segs_ipv6_offload);
+
+	IPADBG("No of ifaces: %d, iface-flt enable: %d\n",
+		((struct ipa_sw_flt_list_type *)buff)->num_of_iface,
+		((struct ipa_sw_flt_list_type *)buff)->iface_enable);
+
+	retval = ipa3_send_msg(&msg_meta, buff,
+		ipa3_mac_flt_list_free_cb);
+	if (retval) {
+		IPAERR("ipa3_send_msg failed: %d, msg_type %d\n",
+		retval,
+		msg_meta.msg_type);
+		kfree(buff);
+		return retval;
+	}
+	return 0;
+}
+
 static long ipa3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
 	int retval = 0;
@@ -3368,12 +3431,21 @@ static long ipa3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 		break;
 
 	case IPA_IOC_SET_MAC_FLT:
+		IPADBG("Got IPA_IOC_SET_MAC_FLT\n");
 		if (ipa3_send_mac_flt_list(arg)) {
 			retval = -EFAULT;
 			break;
 		}
 		break;
 
+	case IPA_IOC_SET_SW_FLT:
+		IPADBG("Got IPA_IOC_SET_SW_FLT\n");
+		if (ipa3_send_sw_flt_list(arg)) {
+			retval = -EFAULT;
+			break;
+		}
+		break;
+
 	case IPA_IOC_GET_PHERIPHERAL_EP_INFO:
 		IPADBG("Got IPA_IOC_GET_EP_INFO\n");
 		if (ipa3_ctx->ipa_config_is_auto == false) {

+ 2 - 0
drivers/platform/msm/ipa/ipa_v3/ipa_debugfs.c

@@ -90,6 +90,8 @@ const char *ipa3_event_name[IPA_EVENT_MAX_NUM] = {
 	__stringify(IPA_PDN_DEFAULT_MODE_CONFIG),
 	__stringify(IPA_PDN_DEFAULT_MODE_CONFIG),
 	__stringify(IPA_MAC_FLT_EVENT),
+	__stringify(IPA_DONE_RESTORE_EVENT),
+	__stringify(IPA_SW_FLT_EVENT),
 };
 
 const char *ipa3_hdr_l2_type_name[] = {