Skip to content

Commit

Permalink
r8152: change rx early size when the mtu is changed
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
hayeswang authored and David S. Miller committed Feb 19, 2015
1 parent 464ec10 commit 396e2e2
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion drivers/net/usb/r8152.c
Original file line number Diff line number Diff line change
Expand Up @@ -3777,6 +3777,7 @@ static int rtl8152_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
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:
Expand All @@ -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 = {
Expand Down

0 comments on commit 396e2e2

Please sign in to comment.