]>
Commit | Line | Data |
---|---|---|
12fbf0f8 GKH |
1 | From a7475906bc496456ded9e4b062f94067fb93057a Mon Sep 17 00:00:00 2001 |
2 | From: Manfred Spraul <manfred@colorfullife.com> | |
3 | Date: Wed, 17 Oct 2007 21:52:33 +0200 | |
4 | Subject: forcedeth msi bugfix | |
5 | Message-ID: <4716A761.5040307@garzik.org> | |
6 | ||
7 | From: Manfred Spraul <manfred@colorfullife.com> | |
8 | ||
9 | patch a7475906bc496456ded9e4b062f94067fb93057a in mainline. | |
10 | ||
11 | pci_enable_msi() replaces the INTx irq number in pci_dev->irq with the | |
12 | new MSI irq number. | |
13 | The forcedeth driver did not update the copy in netdevice->irq and | |
14 | parts of the driver used the stale copy. | |
15 | See bugzilla.kernel.org, bug 9047. | |
16 | ||
17 | The patch | |
18 | - updates netdevice->irq | |
19 | - replaces all accesses to netdevice->irq with pci_dev->irq. | |
20 | ||
21 | The patch is against 2.6.23.1. IMHO suitable for both 2.6.23 and 2.6.24 | |
22 | ||
23 | Signed-off-by: Manfred Spraul <manfred@colorfullife.com> | |
24 | Signed-off-by: Jeff Garzik <jeff@garzik.org> | |
25 | Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> | |
26 | ||
27 | --- | |
28 | drivers/net/forcedeth.c | 19 +++++++++++-------- | |
29 | 1 file changed, 11 insertions(+), 8 deletions(-) | |
30 | ||
31 | --- a/drivers/net/forcedeth.c | |
32 | +++ b/drivers/net/forcedeth.c | |
33 | @@ -987,7 +987,7 @@ static void nv_enable_irq(struct net_dev | |
34 | if (np->msi_flags & NV_MSI_X_ENABLED) | |
35 | enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); | |
36 | else | |
37 | - enable_irq(dev->irq); | |
38 | + enable_irq(np->pci_dev->irq); | |
39 | } else { | |
40 | enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); | |
41 | enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector); | |
42 | @@ -1003,7 +1003,7 @@ static void nv_disable_irq(struct net_de | |
43 | if (np->msi_flags & NV_MSI_X_ENABLED) | |
44 | disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); | |
45 | else | |
46 | - disable_irq(dev->irq); | |
47 | + disable_irq(np->pci_dev->irq); | |
48 | } else { | |
49 | disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); | |
50 | disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector); | |
51 | @@ -1600,7 +1600,7 @@ static void nv_do_rx_refill(unsigned lon | |
52 | if (np->msi_flags & NV_MSI_X_ENABLED) | |
53 | disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); | |
54 | else | |
55 | - disable_irq(dev->irq); | |
56 | + disable_irq(np->pci_dev->irq); | |
57 | } else { | |
58 | disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); | |
59 | } | |
60 | @@ -1618,7 +1618,7 @@ static void nv_do_rx_refill(unsigned lon | |
61 | if (np->msi_flags & NV_MSI_X_ENABLED) | |
62 | enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); | |
63 | else | |
64 | - enable_irq(dev->irq); | |
65 | + enable_irq(np->pci_dev->irq); | |
66 | } else { | |
67 | enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); | |
68 | } | |
69 | @@ -3556,10 +3556,12 @@ static int nv_request_irq(struct net_dev | |
70 | if (ret != 0 && np->msi_flags & NV_MSI_CAPABLE) { | |
71 | if ((ret = pci_enable_msi(np->pci_dev)) == 0) { | |
72 | np->msi_flags |= NV_MSI_ENABLED; | |
73 | + dev->irq = np->pci_dev->irq; | |
74 | if (request_irq(np->pci_dev->irq, handler, IRQF_SHARED, dev->name, dev) != 0) { | |
75 | printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret); | |
76 | pci_disable_msi(np->pci_dev); | |
77 | np->msi_flags &= ~NV_MSI_ENABLED; | |
78 | + dev->irq = np->pci_dev->irq; | |
79 | goto out_err; | |
80 | } | |
81 | ||
82 | @@ -3622,7 +3624,7 @@ static void nv_do_nic_poll(unsigned long | |
83 | if (np->msi_flags & NV_MSI_X_ENABLED) | |
84 | disable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); | |
85 | else | |
86 | - disable_irq_lockdep(dev->irq); | |
87 | + disable_irq_lockdep(np->pci_dev->irq); | |
88 | mask = np->irqmask; | |
89 | } else { | |
90 | if (np->nic_poll_irq & NVREG_IRQ_RX_ALL) { | |
91 | @@ -3640,6 +3642,8 @@ static void nv_do_nic_poll(unsigned long | |
92 | } | |
93 | np->nic_poll_irq = 0; | |
94 | ||
95 | + /* disable_irq() contains synchronize_irq, thus no irq handler can run now */ | |
96 | + | |
97 | if (np->recover_error) { | |
98 | np->recover_error = 0; | |
99 | printk(KERN_INFO "forcedeth: MAC in recoverable error state\n"); | |
100 | @@ -3676,7 +3680,6 @@ static void nv_do_nic_poll(unsigned long | |
101 | } | |
102 | } | |
103 | ||
104 | - /* FIXME: Do we need synchronize_irq(dev->irq) here? */ | |
105 | ||
106 | writel(mask, base + NvRegIrqMask); | |
107 | pci_push(base); | |
108 | @@ -3689,7 +3692,7 @@ static void nv_do_nic_poll(unsigned long | |
109 | if (np->msi_flags & NV_MSI_X_ENABLED) | |
110 | enable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); | |
111 | else | |
112 | - enable_irq_lockdep(dev->irq); | |
113 | + enable_irq_lockdep(np->pci_dev->irq); | |
114 | } else { | |
115 | if (np->nic_poll_irq & NVREG_IRQ_RX_ALL) { | |
116 | nv_nic_irq_rx(0, dev); | |
117 | @@ -4943,7 +4946,7 @@ static int nv_close(struct net_device *d | |
118 | np->in_shutdown = 1; | |
119 | spin_unlock_irq(&np->lock); | |
120 | netif_poll_disable(dev); | |
121 | - synchronize_irq(dev->irq); | |
122 | + synchronize_irq(np->pci_dev->irq); | |
123 | ||
124 | del_timer_sync(&np->oom_kick); | |
125 | del_timer_sync(&np->nic_poll); |