(owner of http://bugzilla.kernel.org/show_bug.cgi?id=5681 Cc:ed)

Nikolaus Filus <[EMAIL PROTECTED]> :
[...]
> I'm using linux 2.6.14.3 with swsusp2 2.2rc14 (not the most new ones).
> Since I'm using NetworkManager, which switches and manages my wired and 
> wireless devices, I have to reload 8139too after resume, before plugin 
> events of wired network are recognized. Some other users of NM are 
> reporting similar problems.

May I assume that your 8139too device does not need to be reloaded when
you suspend/resume and NM is not used ?

[...]
> mobile ~ # cat /sys/class/net/eth1/carrier
> cat: /sys/class/net/eth1/carrier: Invalid argument
> ----------
> mobile src # rtl8139-diag -mm
> rtl8139-diag.c:v2.11 4/22/2003 Donald Becker ([EMAIL PROTECTED])
>  http://www.scyld.com/diag/index.html
> Index #1: Found a RealTek RTL8139 adapter at 0x4000.
> Realtek station address 00:00:f0:92:f7:5f, chip type 'rtl8139C+'.
                                                        ^^^^^^^^^ 
Can you send a lspci -vx ?

If it really is a 8139C+, you could use the 8139cp instead.

http://bugzilla.kernel.org/show_bug.cgi?id=5681 suggests that
suspend/resume support is broken in 8139cp but I have some
code to test (see above).

(please upgrade to 2.6.14-rc4 kernel while you are at it)

Signed-off-by: Francois Romieu <[EMAIL PROTECTED]>

diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index f822cd3..dd41049 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -1118,13 +1118,18 @@ err_out:
        return -ENOMEM;
 }
 
+static void cp_init_rings_index (struct cp_private *cp)
+{
+       cp->rx_tail = 0;
+       cp->tx_head = cp->tx_tail = 0;
+}
+
 static int cp_init_rings (struct cp_private *cp)
 {
        memset(cp->tx_ring, 0, sizeof(struct cp_desc) * CP_TX_RING_SIZE);
        cp->tx_ring[CP_TX_RING_SIZE - 1].opts1 = cpu_to_le32(RingEnd);
 
-       cp->rx_tail = 0;
-       cp->tx_head = cp->tx_tail = 0;
+       cp_init_rings_index(cp);
 
        return cp_refill_rx (cp);
 }
@@ -1886,30 +1891,30 @@ static int cp_suspend (struct pci_dev *p
 
        spin_unlock_irqrestore (&cp->lock, flags);
 
-       if (cp->pdev && cp->wol_enabled) {
-               pci_save_state (cp->pdev);
-               cp_set_d3_state (cp);
-       }
+       pci_save_state(pdev);
+       pci_enable_wake(pdev, pci_choose_state(pdev, state), cp->wol_enabled);
+       pci_set_power_state(pdev, pci_choose_state(pdev, state));
 
        return 0;
 }
 
 static int cp_resume (struct pci_dev *pdev)
 {
-       struct net_device *dev;
-       struct cp_private *cp;
+       struct net_device *dev = pci_get_drvdata (pdev);
+       struct cp_private *cp = netdev_priv(dev);
        unsigned long flags;
 
-       dev = pci_get_drvdata (pdev);
-       cp  = netdev_priv(dev);
+       if (!netif_running(dev))
+               return 0;
 
        netif_device_attach (dev);
-       
-       if (cp->pdev && cp->wol_enabled) {
-               pci_set_power_state (cp->pdev, PCI_D0);
-               pci_restore_state (cp->pdev);
-       }
-       
+
+       pci_set_power_state(pdev, PCI_D0);
+       pci_restore_state(pdev);
+       pci_enable_wake(pdev, PCI_D0, 0);
+
+       /* FIXME: sh*t may happen if the Rx ring buffer is depleted */
+       cp_init_rings_index (cp);
        cp_init_hw (cp);
        netif_start_queue (dev);
 
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to