| 1 | From f872b237c1750221932e715da2552225afe4a95c Mon Sep 17 00:00:00 2001 |
| 2 | From: Jason Wang <jasowang@redhat.com> |
| 3 | Date: Fri, 30 Dec 2011 23:44:42 +0000 |
| 4 | Subject: [PATCH] 8139cp: properly config rx mode after resuming |
| 5 | |
| 6 | Rx mode should be reset after resming, so unconditionally updating rx |
| 7 | mode rather than conditionally updating based on the value we |
| 8 | remembered, otherwise unexpected value may be used by the nic after |
| 9 | resuming. |
| 10 | |
| 11 | btw. I find and test this when debugging guest hibernation in qemu, as |
| 12 | I did not have a 8139cp card in hand, this patch is untested in a |
| 13 | physical 8139cp card, plase review it carefully. |
| 14 | |
| 15 | Signed-off-by: Jason Wang <jasowang@redhat.com> |
| 16 | Signed-off-by: David S. Miller <davem@davemloft.net> |
| 17 | --- |
| 18 | drivers/net/ethernet/realtek/8139cp.c | 9 +++------ |
| 19 | 1 files changed, 3 insertions(+), 6 deletions(-) |
| 20 | |
| 21 | --- a/drivers/net/ethernet/realtek/8139cp.c |
| 22 | +++ b/drivers/net/ethernet/realtek/8139cp.c |
| 23 | @@ -860,7 +860,6 @@ static void __cp_set_rx_mode (struct net |
| 24 | struct cp_private *cp = netdev_priv(dev); |
| 25 | u32 mc_filter[2]; /* Multicast hash filter */ |
| 26 | int rx_mode; |
| 27 | - u32 tmp; |
| 28 | |
| 29 | /* Note: do not reorder, GCC is clever about common statements. */ |
| 30 | if (dev->flags & IFF_PROMISC) { |
| 31 | @@ -887,11 +886,9 @@ static void __cp_set_rx_mode (struct net |
| 32 | } |
| 33 | |
| 34 | /* We can safely update without stopping the chip. */ |
| 35 | - tmp = cp_rx_config | rx_mode; |
| 36 | - if (cp->rx_config != tmp) { |
| 37 | - cpw32_f (RxConfig, tmp); |
| 38 | - cp->rx_config = tmp; |
| 39 | - } |
| 40 | + cp->rx_config = cp_rx_config | rx_mode; |
| 41 | + cpw32_f(RxConfig, cp->rx_config); |
| 42 | + |
| 43 | cpw32_f (MAR0 + 0, mc_filter[0]); |
| 44 | cpw32_f (MAR0 + 4, mc_filter[1]); |
| 45 | } |
| 46 | |