aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/r8169.c
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2010-10-20 18:25:41 -0400
committerDavid S. Miller <davem@davemloft.net>2010-10-21 04:32:47 -0400
commit323bb6857533d7132e1d4fd9cc8edc599a06f5e6 (patch)
tree0598317a2c2ef15007ae6b356e808bc65c6e0e09 /drivers/net/r8169.c
parentcac4b22f3d6a2601d896e9ae5147d173342c66f8 (diff)
r8169: changing mtu clean up
Since we do not change rx buffer size any longer, we can clean up rtl8169_change_mtu and in consequence rtl8169_down. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/r8169.c')
-rw-r--r--drivers/net/r8169.c47
1 files changed, 6 insertions, 41 deletions
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index a8be98cad579..8715ec3a25a8 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -3908,31 +3908,11 @@ static void rtl_hw_start_8101(struct net_device *dev)
3908 3908
3909static int rtl8169_change_mtu(struct net_device *dev, int new_mtu) 3909static int rtl8169_change_mtu(struct net_device *dev, int new_mtu)
3910{ 3910{
3911 struct rtl8169_private *tp = netdev_priv(dev);
3912 int ret = 0;
3913
3914 if (new_mtu < ETH_ZLEN || new_mtu > SafeMtu) 3911 if (new_mtu < ETH_ZLEN || new_mtu > SafeMtu)
3915 return -EINVAL; 3912 return -EINVAL;
3916 3913
3917 dev->mtu = new_mtu; 3914 dev->mtu = new_mtu;
3918 3915 return 0;
3919 if (!netif_running(dev))
3920 goto out;
3921
3922 rtl8169_down(dev);
3923
3924 ret = rtl8169_init_ring(dev);
3925 if (ret < 0)
3926 goto out;
3927
3928 napi_enable(&tp->napi);
3929
3930 rtl_hw_start(dev);
3931
3932 rtl8169_request_timer(dev);
3933
3934out:
3935 return ret;
3936} 3916}
3937 3917
3938static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc) 3918static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc)
@@ -4684,7 +4664,6 @@ static void rtl8169_down(struct net_device *dev)
4684{ 4664{
4685 struct rtl8169_private *tp = netdev_priv(dev); 4665 struct rtl8169_private *tp = netdev_priv(dev);
4686 void __iomem *ioaddr = tp->mmio_addr; 4666 void __iomem *ioaddr = tp->mmio_addr;
4687 unsigned int intrmask;
4688 4667
4689 rtl8169_delete_timer(dev); 4668 rtl8169_delete_timer(dev);
4690 4669
@@ -4692,11 +4671,14 @@ static void rtl8169_down(struct net_device *dev)
4692 4671
4693 napi_disable(&tp->napi); 4672 napi_disable(&tp->napi);
4694 4673
4695core_down:
4696 spin_lock_irq(&tp->lock); 4674 spin_lock_irq(&tp->lock);
4697 4675
4698 rtl8169_asic_down(ioaddr); 4676 rtl8169_asic_down(ioaddr);
4699 4677 /*
4678 * At this point device interrupts can not be enabled in any function,
4679 * as netif_running is not true (rtl8169_interrupt, rtl8169_reset_task,
4680 * rtl8169_reinit_task) and napi is disabled (rtl8169_poll).
4681 */
4700 rtl8169_rx_missed(dev, ioaddr); 4682 rtl8169_rx_missed(dev, ioaddr);
4701 4683
4702 spin_unlock_irq(&tp->lock); 4684 spin_unlock_irq(&tp->lock);
@@ -4706,23 +4688,6 @@ core_down:
4706 /* Give a racing hard_start_xmit a few cycles to complete. */ 4688 /* Give a racing hard_start_xmit a few cycles to complete. */
4707 synchronize_sched(); /* FIXME: should this be synchronize_irq()? */ 4689 synchronize_sched(); /* FIXME: should this be synchronize_irq()? */
4708 4690
4709 /*
4710 * And now for the 50k$ question: are IRQ disabled or not ?
4711 *
4712 * Two paths lead here:
4713 * 1) dev->close
4714 * -> netif_running() is available to sync the current code and the
4715 * IRQ handler. See rtl8169_interrupt for details.
4716 * 2) dev->change_mtu
4717 * -> rtl8169_poll can not be issued again and re-enable the
4718 * interruptions. Let's simply issue the IRQ down sequence again.
4719 *
4720 * No loop if hotpluged or major error (0xffff).
4721 */
4722 intrmask = RTL_R16(IntrMask);
4723 if (intrmask && (intrmask != 0xffff))
4724 goto core_down;
4725
4726 rtl8169_tx_clear(tp); 4691 rtl8169_tx_clear(tp);
4727 4692
4728 rtl8169_rx_clear(tp); 4693 rtl8169_rx_clear(tp);