Parcourir la source

msm: ipa: ioctl to receive mac addr list and parental control flag

ioctl to receive mac addr list and parental control
flag from QCMAP to enable data offload to HW or
exception path.

Change-Id: Iad837c4dbf6edb3055181c43436a7fb9e73396a3
Armaan Siddiqui il y a 4 ans
Parent
commit
90836a3b70

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

@@ -1894,6 +1894,51 @@ static int proc_sram_info_rqst(
 	return 0;
 }
 
+static void ipa3_mac_flt_list_free_cb(void *buff, u32 len, u32 type)
+{
+	if (!buff) {
+		IPAERR("Null buffer\n");
+		return;
+	}
+	kfree(buff);
+}
+
+static int ipa3_send_mac_flt_list(unsigned long usr_param)
+{
+	int retval;
+	struct ipa_msg_meta msg_meta;
+	void *buff;
+
+	buff = kzalloc(sizeof(struct ipa_ioc_mac_client_list_type),
+				GFP_KERNEL);
+	if (!buff)
+		return -ENOMEM;
+
+	if (copy_from_user(buff, (const void __user *)usr_param,
+		sizeof(struct ipa_ioc_mac_client_list_type))) {
+		kfree(buff);
+		return -EFAULT;
+	}
+	memset(&msg_meta, 0, sizeof(struct ipa_msg_meta));
+	msg_meta.msg_type = IPA_MAC_FLT_EVENT;
+	msg_meta.msg_len = sizeof(struct ipa_ioc_mac_client_list_type);
+
+	IPADBG("No of clients: %d, flt state: %d\n",
+		((struct ipa_ioc_mac_client_list_type *)buff)->num_of_clients,
+		((struct ipa_ioc_mac_client_list_type *)buff)->flt_state);
+
+	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;
@@ -3127,6 +3172,13 @@ static long ipa3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 		}
 		break;
 
+	case IPA_IOC_SET_MAC_FLT:
+		if (ipa3_send_mac_flt_list(arg)) {
+			retval = -EFAULT;
+			break;
+		}
+		break;
+
 	default:
 		IPA_ACTIVE_CLIENTS_DEC_SIMPLE();
 		return -ENOTTY;

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

@@ -80,6 +80,7 @@ const char *ipa3_event_name[IPA_EVENT_MAX_NUM] = {
 	__stringify(IPA_PDN_DEFAULT_MODE_CONFIG),
 	__stringify(IPA_PDN_DEFAULT_MODE_CONFIG),
 	__stringify(IPA_PDN_DEFAULT_MODE_CONFIG),
+	__stringify(IPA_MAC_FLT_EVENT),
 };
 
 const char *ipa3_hdr_l2_type_name[] = {