Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2dfedfa3 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

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

parents 9c9fa703 3737329d
Loading
Loading
Loading
Loading
+52 −0
Original line number Diff line number Diff line
@@ -934,6 +934,51 @@ static int ipa3_send_gsb_msg(unsigned long usr_param, uint8_t msg_type)
	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;
@@ -2990,6 +3035,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
Original line number Diff line number Diff line
@@ -89,6 +89,7 @@ const char *ipa3_event_name[] = {
	__stringify(IPA_PDN_DEFAULT_MODE_CONFIG),
	__stringify(IPA_PDN_IP_COLLISION_MODE_CONFIG),
	__stringify(IPA_PDN_IP_PASSTHROUGH_MODE_CONFIG),
	__stringify(IPA_MAC_FLT_EVENT),
};

const char *ipa3_hdr_l2_type_name[] = {
+30 −1
Original line number Diff line number Diff line
@@ -126,6 +126,7 @@
#define IPA_IOCTL_GET_PHERIPHERAL_EP_INFO       78
#define IPA_IOCTL_APP_CLOCK_VOTE                79
#define IPA_IOCTL_PDN_CONFIG                    80
#define IPA_IOCTL_SET_MAC_FLT                   81

/**
 * max size of the header to be inserted
@@ -168,6 +169,11 @@
 */
#define QMI_IPA_MAX_CLIENT_DST_PIPES 4

/**
 * Max number of clients supported for mac based exception
 */
#define IPA_MAX_NUM_MAC_FLT 5

/**
 * MAX number of the FLT_RT stats counter supported.
 */
@@ -748,7 +754,13 @@ enum ipa_pdn_config_event {
#define IPA_PDN_CONFIG_EVENT_MAX IPA_PDN_CONFIG_EVENT_MAX
};

#define IPA_EVENT_MAX_NUM (IPA_PDN_CONFIG_EVENT_MAX)
enum ipa_mac_flt_event {
	IPA_MAC_FLT_EVENT = IPA_PDN_CONFIG_EVENT_MAX,
	IPA_MAC_FLT_EVENT_MAX
#define IPA_MAC_FLT_EVENT_MAX IPA_MAC_FLT_EVENT_MAX
};

#define IPA_EVENT_MAX_NUM (IPA_MAC_FLT_EVENT_MAX)
#define IPA_EVENT_MAX ((int)IPA_EVENT_MAX_NUM)

/**
@@ -2787,6 +2799,18 @@ struct ipa_ioc_pdn_config {
	} u;
};

/**
 * struct ipa_ioc_mac_client_list_type- mac addr exception list
 * @mac_addr: an array to hold clients mac addrs
 * @num_of_clients: holds num of clients to blacklist or whitelist
 * @flt_state: true to block current mac addrs and false to clean
 *		up all previous mac addrs
 */
struct ipa_ioc_mac_client_list_type {
	uint8_t mac_addr[IPA_MAX_NUM_MAC_FLT][IPA_MAC_ADDR_SIZE];
	int num_of_clients;
	uint8_t flt_state;
};

/**
 *   actual IOCTLs supported by IPA driver
@@ -3052,6 +3076,11 @@ struct ipa_ioc_pdn_config {
#define IPA_IOC_PDN_CONFIG _IOWR(IPA_IOC_MAGIC, \
				IPA_IOCTL_PDN_CONFIG, \
				struct ipa_ioc_pdn_config)

#define IPA_IOC_SET_MAC_FLT _IOWR(IPA_IOC_MAGIC, \
				IPA_IOCTL_SET_MAC_FLT, \
				struct ipa_ioc_mac_client_list_type)

/*
 * unique magic number of the Tethering bridge ioctls
 */