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

Commit 48e898a9 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "net: rmnet_data: new structure for rmnet ioctls"

parents 975adc69 8f8a436a
Loading
Loading
Loading
Loading
+26 −7
Original line number Diff line number Diff line
@@ -607,6 +607,7 @@ static int rmnet_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
	unsigned long flags;
	int prev_mtu = dev->mtu;
	int rc = 0;
	struct rmnet_ioctl_data_s ioctl_data;

	/* Process IOCTL command */
	switch (cmd) {
@@ -656,9 +657,11 @@ static int rmnet_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
		break;

	case RMNET_IOCTL_GET_LLP:           /* Get link protocol state */
		ifr->ifr_ifru.ifru_data =
			(void *)(p->operation_mode &
		ioctl_data.u.operation_mode = (p->operation_mode &
				 (RMNET_MODE_LLP_ETH|RMNET_MODE_LLP_IP));
		if (copy_to_user(ifr->ifr_ifru.ifru_data, &ioctl_data,
			sizeof(struct rmnet_ioctl_data_s)))
			rc = -EFAULT;
		break;

	case RMNET_IOCTL_SET_QOS_ENABLE:    /* Set QoS header enabled  */
@@ -678,22 +681,38 @@ static int rmnet_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
		break;

	case RMNET_IOCTL_FLOW_ENABLE:
		tc_qdisc_flow_control(dev, (u32)ifr->ifr_data, 1);
		if (copy_from_user(&ioctl_data, ifr->ifr_ifru.ifru_data,
			sizeof(struct rmnet_ioctl_data_s))) {
			rc = -EFAULT;
			break;
		}
		tc_qdisc_flow_control(dev, ioctl_data.u.tcm_handle, 1);
		DBG0("[%s] rmnet_ioctl(): enabled flow", dev->name);
		break;

	case RMNET_IOCTL_FLOW_DISABLE:
		tc_qdisc_flow_control(dev, (u32)ifr->ifr_data, 0);
		if (copy_from_user(&ioctl_data, ifr->ifr_ifru.ifru_data,
			sizeof(struct rmnet_ioctl_data_s))) {
			rc = -EFAULT;
			break;
		}
		tc_qdisc_flow_control(dev, ioctl_data.u.tcm_handle, 0);
		DBG0("[%s] rmnet_ioctl(): disabled flow", dev->name);
		break;

	case RMNET_IOCTL_GET_QOS:           /* Get QoS header state    */
		ifr->ifr_ifru.ifru_data =
			(void *)(p->operation_mode & RMNET_MODE_QOS);
		ioctl_data.u.operation_mode = (p->operation_mode
						& RMNET_MODE_QOS);
		if (copy_to_user(ifr->ifr_ifru.ifru_data, &ioctl_data,
			sizeof(struct rmnet_ioctl_data_s)))
			rc = -EFAULT;
		break;

	case RMNET_IOCTL_GET_OPMODE:        /* Get operation mode      */
		ifr->ifr_ifru.ifru_data = (void *)p->operation_mode;
		ioctl_data.u.operation_mode = p->operation_mode;
		if (copy_to_user(ifr->ifr_ifru.ifru_data, &ioctl_data,
			sizeof(struct rmnet_ioctl_data_s)))
			rc = -EFAULT;
		break;

	case RMNET_IOCTL_OPEN:              /* Open transport port     */
+15 −6
Original line number Diff line number Diff line
/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -678,6 +678,7 @@ static int rmnet_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
	unsigned long flags;
	int prev_mtu = dev->mtu;
	int rc = 0;
	struct rmnet_ioctl_data_s ioctl_data;

	/* Process IOCTL command */
	switch (cmd) {
@@ -727,9 +728,11 @@ static int rmnet_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
		break;

	case RMNET_IOCTL_GET_LLP:	/* Get link protocol state */
		ifr->ifr_ifru.ifru_data =
		(void *)(p->operation_mode &
		ioctl_data.u.operation_mode = (p->operation_mode &
				 (RMNET_MODE_LLP_ETH|RMNET_MODE_LLP_IP));
		if (copy_to_user(ifr->ifr_ifru.ifru_data, &ioctl_data,
			sizeof(struct rmnet_ioctl_data_s)))
			rc = -EFAULT;
		break;

	case RMNET_IOCTL_SET_QOS_ENABLE:	/* Set QoS header enabled */
@@ -749,12 +752,18 @@ static int rmnet_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
		break;

	case RMNET_IOCTL_GET_QOS:	/* Get QoS header state */
		ifr->ifr_ifru.ifru_data =
		(void *)(p->operation_mode & RMNET_MODE_QOS);
		ioctl_data.u.operation_mode = (p->operation_mode
						& RMNET_MODE_QOS);
		if (copy_to_user(ifr->ifr_ifru.ifru_data, &ioctl_data,
			sizeof(struct rmnet_ioctl_data_s)))
			rc = -EFAULT;
		break;

	case RMNET_IOCTL_GET_OPMODE:	/* Get operation mode */
		ifr->ifr_ifru.ifru_data = (void *)p->operation_mode;
		ioctl_data.u.operation_mode = p->operation_mode;
		if (copy_to_user(ifr->ifr_ifru.ifru_data, &ioctl_data,
			sizeof(struct rmnet_ioctl_data_s)))
			rc = -EFAULT;
		break;

	case RMNET_IOCTL_OPEN:		/* Open transport port */
+25 −5
Original line number Diff line number Diff line
@@ -579,12 +579,16 @@ static void wwan_tx_timeout(struct net_device *dev)
static int wwan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
	int rc = 0;
	struct rmnet_ioctl_data_s ioctl_data;

	switch (cmd) {
	case RMNET_IOCTL_SET_LLP_IP:        /* Set RAWIP protocol */
		break;
	case RMNET_IOCTL_GET_LLP:           /* Get link protocol state */
		ifr->ifr_ifru.ifru_data = (void *) RMNET_MODE_LLP_IP;
		ioctl_data.u.operation_mode = RMNET_MODE_LLP_IP;
		if (copy_to_user(ifr->ifr_ifru.ifru_data, &ioctl_data,
			sizeof(struct rmnet_ioctl_data_s)))
			rc = -EFAULT;
		break;
	case RMNET_IOCTL_SET_QOS_ENABLE:    /* Set QoS header enabled  */
		pr_debug("[%s] wwan_ioctl(): QOS header addition is not supported\n",
@@ -593,19 +597,35 @@ static int wwan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
	case RMNET_IOCTL_SET_QOS_DISABLE:   /* Set QoS header disabled */
		break;
	case RMNET_IOCTL_FLOW_ENABLE:
		tc_qdisc_flow_control(dev, (u32)ifr->ifr_data, 1);
		if (copy_from_user(&ioctl_data, ifr->ifr_ifru.ifru_data,
			sizeof(struct rmnet_ioctl_data_s))) {
			rc = -EFAULT;
			break;
		}
		tc_qdisc_flow_control(dev, ioctl_data.u.tcm_handle, 1);
		pr_debug("[%s] %s: enabled flow", dev->name, __func__);
		break;
	case RMNET_IOCTL_FLOW_DISABLE:
		tc_qdisc_flow_control(dev, (u32)ifr->ifr_data, 0);
		if (copy_from_user(&ioctl_data, ifr->ifr_ifru.ifru_data,
			sizeof(struct rmnet_ioctl_data_s))) {
			rc = -EFAULT;
			break;
		}
		tc_qdisc_flow_control(dev, ioctl_data.u.tcm_handle, 0);
		pr_debug("[%s] %s: disabled flow", dev->name, __func__);
		break;
	case RMNET_IOCTL_GET_QOS:           /* Get QoS header state    */
		/* QoS disabled */
		ifr->ifr_ifru.ifru_data = (void *) 0;
		ioctl_data.u.operation_mode = 0;
		if (copy_to_user(ifr->ifr_ifru.ifru_data, &ioctl_data,
			sizeof(struct rmnet_ioctl_data_s)))
			rc = -EFAULT;
		break;
	case RMNET_IOCTL_GET_OPMODE:        /* Get operation mode      */
		ifr->ifr_ifru.ifru_data = (void *) RMNET_MODE_LLP_IP;
		ioctl_data.u.operation_mode = RMNET_MODE_LLP_IP;
		if (copy_to_user(ifr->ifr_ifru.ifru_data, &ioctl_data,
			sizeof(struct rmnet_ioctl_data_s)))
			rc = -EFAULT;
		break;
	case RMNET_IOCTL_OPEN:  /* Open transport port */
		rc = __wwan_open(dev);
+15 −5
Original line number Diff line number Diff line
@@ -375,9 +375,10 @@ static int rmnet_ioctl_extended(struct net_device *dev, struct ifreq *ifr)
static int rmnet_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
	struct usbnet	*unet = netdev_priv(dev);
	u32		old_opmode;
	unsigned long	old_opmode;
	int		prev_mtu = dev->mtu;
	int		rc = 0;
	struct rmnet_ioctl_data_s ioctl_data;

	old_opmode = unet->data[0]; /*data[0] saves operation mode*/
	/* Process IOCTL command */
@@ -416,9 +417,12 @@ static int rmnet_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
		break;

	case RMNET_IOCTL_GET_LLP:	/* Get link protocol state */
		ifr->ifr_ifru.ifru_data = (void *)(unet->data[0]
		ioctl_data.u.operation_mode = (unet->data[0]
						& (RMNET_MODE_LLP_ETH
						| RMNET_MODE_LLP_IP));
		if (copy_to_user(ifr->ifr_ifru.ifru_data, &ioctl_data,
			sizeof(struct rmnet_ioctl_data_s)))
			rc = -EFAULT;
		break;

	case RMNET_IOCTL_SET_QOS_ENABLE:	/* Set QoS header enabled*/
@@ -434,12 +438,18 @@ static int rmnet_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
		break;

	case RMNET_IOCTL_GET_QOS:		/* Get QoS header state */
		ifr->ifr_ifru.ifru_data = (void *)(unet->data[0]
		ioctl_data.u.operation_mode = (unet->data[0]
						& RMNET_MODE_QOS);
		if (copy_to_user(ifr->ifr_ifru.ifru_data, &ioctl_data,
			sizeof(struct rmnet_ioctl_data_s)))
			rc = -EFAULT;
		break;

	case RMNET_IOCTL_GET_OPMODE:		/* Get operation mode*/
		ifr->ifr_ifru.ifru_data = (void *)unet->data[0];
		ioctl_data.u.operation_mode = unet->data[0];
		if (copy_to_user(ifr->ifr_ifru.ifru_data, &ioctl_data,
			sizeof(struct rmnet_ioctl_data_s)))
			rc = -EFAULT;
		break;

	case RMNET_IOCTL_OPEN:			/* Open transport port */
@@ -463,7 +473,7 @@ static int rmnet_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
		return -EINVAL;
	}

	DBG2("[%s] %s: cmd=0x%x opmode old=0x%08x new=0x%08lx\n",
	DBG2("[%s] %s: cmd=0x%x opmode old=0x%08lx new=0x%08lx\n",
		dev->name, __func__, cmd, old_opmode, unet->data[0]);

	return rc;
+13 −3
Original line number Diff line number Diff line
@@ -885,6 +885,7 @@ static int ipa_wwan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
	int rc = 0;
	int mru = 1000, epid = 1, mux_index;
	struct rmnet_ioctl_extended_s extend_ioctl_data;
	struct rmnet_ioctl_data_s ioctl_data;

	IPAWANDBG("rmnet_ipa got ioctl number 0x%08x", cmd);
	switch (cmd) {
@@ -896,7 +897,10 @@ static int ipa_wwan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
		break;
	/*  Get link protocol  */
	case RMNET_IOCTL_GET_LLP:
		ifr->ifr_ifru.ifru_data = (void *)RMNET_MODE_LLP_IP;
		ioctl_data.u.operation_mode = RMNET_MODE_LLP_IP;
		if (copy_to_user(ifr->ifr_ifru.ifru_data, &ioctl_data,
			sizeof(struct rmnet_ioctl_data_s)))
			rc = -EFAULT;
		break;
	/*  Set QoS header enabled  */
	case RMNET_IOCTL_SET_QOS_ENABLE:
@@ -906,11 +910,17 @@ static int ipa_wwan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
		break;
	/*  Get QoS header state  */
	case RMNET_IOCTL_GET_QOS:
		ifr->ifr_ifru.ifru_data = (void *)RMNET_MODE_NONE;
		ioctl_data.u.operation_mode = RMNET_MODE_NONE;
		if (copy_to_user(ifr->ifr_ifru.ifru_data, &ioctl_data,
			sizeof(struct rmnet_ioctl_data_s)))
			rc = -EFAULT;
		break;
	/*  Get operation mode  */
	case RMNET_IOCTL_GET_OPMODE:
		ifr->ifr_ifru.ifru_data = (void *)RMNET_MODE_LLP_IP;
		ioctl_data.u.operation_mode = RMNET_MODE_LLP_IP;
		if (copy_to_user(ifr->ifr_ifru.ifru_data, &ioctl_data,
			sizeof(struct rmnet_ioctl_data_s)))
			rc = -EFAULT;
		break;
	/*  Open transport port  */
	case RMNET_IOCTL_OPEN:
Loading