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

Commit 8853713d authored by Amir Levy's avatar Amir Levy
Browse files

msm: ipa4: add IOCTL for reading vlan mode



Add IOCTL for reading LAN interfaces VLAN mode from
user space.

Change-Id: I85634b21adf2b1b79feb1b282597289e89ad1df1
Signed-off-by: default avatarAmir Levy <alevy@codeaurora.org>
parent 7be3a3f5
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -682,6 +682,7 @@ static long ipa3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
	u32 pyld_sz;
	u8 header[128] = { 0 };
	u8 *param = NULL;
	bool is_vlan_mode;
	struct ipa_ioc_nat_alloc_mem nat_mem;
	struct ipa_ioc_nat_ipv6ct_table_alloc table_alloc;
	struct ipa_ioc_v4_nat_init nat_init;
@@ -691,6 +692,7 @@ static long ipa3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
	struct ipa_ioc_nat_pdn_entry mdfy_pdn;
	struct ipa_ioc_rm_dependency rm_depend;
	struct ipa_ioc_nat_dma_cmd *table_dma_cmd;
	struct ipa_ioc_get_vlan_mode vlan_mode;
	size_t sz;
	int pre_entry;

@@ -1785,6 +1787,28 @@ static long ipa3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		}
		break;

	case IPA_IOC_GET_VLAN_MODE:
		if (copy_from_user(&vlan_mode, (const void __user *)arg,
			sizeof(struct ipa_ioc_get_vlan_mode))) {
			retval = -EFAULT;
			break;
		}
		retval = ipa3_is_vlan_mode(
			vlan_mode.iface,
			&is_vlan_mode);
		if (retval)
			break;

		vlan_mode.is_vlan_mode = is_vlan_mode;

		if (copy_to_user((void __user *)arg,
			&vlan_mode,
			sizeof(struct ipa_ioc_get_vlan_mode))) {
			retval = -EFAULT;
			break;
		}
		break;

	case IPA_IOC_ADD_VLAN_IFACE:
		if (ipa3_send_vlan_l2tp_msg(arg, ADD_VLAN_IFACE)) {
			retval = -EFAULT;
+1 −0
Original line number Diff line number Diff line
@@ -2361,4 +2361,5 @@ void __ipa_gsi_irq_rx_scedule_poll(struct ipa3_sys_context *sys);
int ipa3_tz_unlock_reg(struct ipa_tz_unlock_reg_info *reg_info, u16 num_regs);
void ipa3_init_imm_cmd_desc(struct ipa3_desc *desc,
	struct ipahal_imm_cmd_pyld *cmd_pyld);
int ipa3_is_vlan_mode(enum ipa_vlan_ifaces iface, bool *res);
#endif /* _IPA3_I_H_ */
+1 −1
Original line number Diff line number Diff line
@@ -4645,7 +4645,7 @@ static void ipa3_set_tag_process_before_gating(bool val)
 *
 * Returns: 0 on success, negative on failure
 */
static int ipa3_is_vlan_mode(enum ipa_vlan_ifaces iface, bool *res)
int ipa3_is_vlan_mode(enum ipa_vlan_ifaces iface, bool *res)
{
	if (!res) {
		IPAERR("NULL out param\n");
+0 −13
Original line number Diff line number Diff line
@@ -115,19 +115,6 @@ enum hdr_total_len_or_pad_type {
	IPA_HDR_TOTAL_LEN = 1,
};

/**
* enum ipa_vlan_ifaces - vlan interfaces types
* @IPA_VLAN_IF_EMAC: used for EMAC ethernet device
* @IPA_VLAN_IF_RNDIS: used for RNDIS USB device
* @IPA_VLAN_IF_ECM: used for ECM USB device
*/
enum ipa_vlan_ifaces {
	IPA_VLAN_IF_EMAC,
	IPA_VLAN_IF_RNDIS,
	IPA_VLAN_IF_ECM,
	IPA_VLAN_IF_MAX
};

/**
 * struct ipa_ep_cfg_nat - NAT configuration in IPA end-point
 * @nat_en:	This defines the default NAT mode for the pipe: in case of
+27 −0
Original line number Diff line number Diff line
@@ -95,6 +95,7 @@
#define IPA_IOCTL_ALLOC_IPV6CT_TABLE            53
#define IPA_IOCTL_DEL_NAT_TABLE                 54
#define IPA_IOCTL_DEL_IPV6CT_TABLE              55
#define IPA_IOCTL_GET_VLAN_MODE                 56

/**
 * max size of the header to be inserted
@@ -1848,6 +1849,29 @@ struct ipa_tether_device_info {
	struct ipa_lan_client lan_client[IPA_MAX_NUM_HW_PATH_CLIENTS];
};

/**
 * enum ipa_vlan_ifaces - vlan interfaces types
 */
enum ipa_vlan_ifaces {
	IPA_VLAN_IF_ETH,
	IPA_VLAN_IF_RNDIS,
	IPA_VLAN_IF_ECM
};

#define IPA_VLAN_IF_EMAC IPA_VLAN_IF_ETH
#define IPA_VLAN_IF_MAX (IPA_VLAN_IF_ECM + 1)

/**
 * struct ipa_get_vlan_mode - get vlan mode of a Lan interface
 * @iface: Lan interface type to be queried.
 * @is_vlan_mode: output parameter, is interface in vlan mode, valid only when
 *		ioctl return val is non-negative
 */
struct ipa_ioc_get_vlan_mode {
	enum ipa_vlan_ifaces iface;
	uint32_t is_vlan_mode;
};

/**
 *   actual IOCTLs supported by IPA driver
 */
@@ -2026,6 +2050,9 @@ struct ipa_tether_device_info {
#define IPA_IOC_DEL_L2TP_VLAN_MAPPING _IOWR(IPA_IOC_MAGIC, \
				IPA_IOCTL_DEL_L2TP_VLAN_MAPPING, \
				struct ipa_ioc_l2tp_vlan_mapping_info *)
#define IPA_IOC_GET_VLAN_MODE _IOWR(IPA_IOC_MAGIC, \
				IPA_IOCTL_GET_VLAN_MODE, \
				struct ipa_ioc_get_vlan_mode *)
/*
 * unique magic number of the Tethering bridge ioctls
 */