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

Commit 11f0bcaf authored by Chaitanya Pratapa's avatar Chaitanya Pratapa
Browse files

msm: ipa: interface to provide pdn configuration



Make interface changes to get PDN configuration. The ioctl
can be used to notify whether a PDN is in IP collision
mode or in IP passthrough mode and provide the required configuration
information.

Change-Id: I13a7c28bad2702a933e80428d54745a86a4c62ec
Signed-off-by: default avatarChaitanya Pratapa <cpratapa@codeaurora.org>
parent c67cb625
Loading
Loading
Loading
Loading
+70 −0
Original line number Diff line number Diff line
@@ -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;
@@ -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) {
@@ -2911,6 +2974,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;
+3 −0
Original line number Diff line number Diff line
@@ -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[] = {
+46 −1
Original line number Diff line number Diff line
@@ -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
@@ -728,7 +729,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)

/**
@@ -2722,6 +2731,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
@@ -2984,6 +3026,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
 */