summaryrefslogtreecommitdiffstats
path: root/drivers/net/usb
diff options
context:
space:
mode:
authorhayeswang <hayeswang@realtek.com>2015-02-12 14:33:47 +0800
committerDavid S. Miller <davem@davemloft.net>2015-02-19 15:08:43 -0500
commit396e2e235af79b39d605ad6259f366e502e21959 (patch)
treec18049fcd5f0793af6253e879eb1b2b53bb2a4f4 /drivers/net/usb
parent464ec10a2d7f09784517040fae8de54a39c2765f (diff)
downloadlinux-396e2e235af79b39d605ad6259f366e502e21959.tar.gz
linux-396e2e235af79b39d605ad6259f366e502e21959.tar.bz2
linux-396e2e235af79b39d605ad6259f366e502e21959.zip
r8152: change rx early size when the mtu is changed
The rx early size is calculated with the mtu, so it has to be re-calculated when the mtu is changed. Signed-off-by: Hayes Wang <hayeswang@realtek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r--drivers/net/usb/r8152.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 8a8d3a3b18bd..5a3a689b3a60 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -3777,6 +3777,7 @@ out:
static int rtl8152_change_mtu(struct net_device *dev, int new_mtu)
{
struct r8152 *tp = netdev_priv(dev);
+ int ret;
switch (tp->version) {
case RTL_VER_01:
@@ -3789,9 +3790,22 @@ static int rtl8152_change_mtu(struct net_device *dev, int new_mtu)
if (new_mtu < 68 || new_mtu > RTL8153_MAX_MTU)
return -EINVAL;
+ ret = usb_autopm_get_interface(tp->intf);
+ if (ret < 0)
+ return ret;
+
+ mutex_lock(&tp->control);
+
dev->mtu = new_mtu;
- return 0;
+ if (netif_running(dev) && netif_carrier_ok(dev))
+ r8153_set_rx_early_size(tp);
+
+ mutex_unlock(&tp->control);
+
+ usb_autopm_put_interface(tp->intf);
+
+ return ret;
}
static const struct net_device_ops rtl8152_netdev_ops = {