@@ -27,57 +27,19 @@ void txgbe_irq_enable(struct wx *wx, bool queues)
27
27
}
28
28
29
29
/**
30
- * txgbe_intr - msi/legacy mode Interrupt Handler
31
- * @irq: interrupt number
32
- * @data: pointer to a network interface device structure
33
- **/
34
- static irqreturn_t txgbe_intr (int __always_unused irq , void * data )
35
- {
36
- struct wx_q_vector * q_vector ;
37
- struct wx * wx = data ;
38
- struct pci_dev * pdev ;
39
- u32 eicr ;
40
-
41
- q_vector = wx -> q_vector [0 ];
42
- pdev = wx -> pdev ;
43
-
44
- eicr = wx_misc_isb (wx , WX_ISB_VEC0 );
45
- if (!eicr ) {
46
- /* shared interrupt alert!
47
- * the interrupt that we masked before the ICR read.
48
- */
49
- if (netif_running (wx -> netdev ))
50
- txgbe_irq_enable (wx , true);
51
- return IRQ_NONE ; /* Not our interrupt */
52
- }
53
- wx -> isb_mem [WX_ISB_VEC0 ] = 0 ;
54
- if (!(pdev -> msi_enabled ))
55
- wr32 (wx , WX_PX_INTA , 1 );
56
-
57
- wx -> isb_mem [WX_ISB_MISC ] = 0 ;
58
- /* would disable interrupts here but it is auto disabled */
59
- napi_schedule_irqoff (& q_vector -> napi );
60
-
61
- /* re-enable link(maybe) and non-queue interrupts, no flush.
62
- * txgbe_poll will re-enable the queue interrupts
63
- */
64
- if (netif_running (wx -> netdev ))
65
- txgbe_irq_enable (wx , false);
66
-
67
- return IRQ_HANDLED ;
68
- }
69
-
70
- /**
71
- * txgbe_request_msix_irqs - Initialize MSI-X interrupts
30
+ * txgbe_request_queue_irqs - Initialize MSI-X queue interrupts
72
31
* @wx: board private structure
73
32
*
74
- * Allocate MSI-X vectors and request interrupts from the kernel.
33
+ * Allocate MSI-X queue vectors and request interrupts from the kernel.
75
34
**/
76
- static int txgbe_request_msix_irqs (struct wx * wx )
35
+ int txgbe_request_queue_irqs (struct wx * wx )
77
36
{
78
37
struct net_device * netdev = wx -> netdev ;
79
38
int vector , err ;
80
39
40
+ if (!wx -> pdev -> msix_enabled )
41
+ return 0 ;
42
+
81
43
for (vector = 0 ; vector < wx -> num_q_vectors ; vector ++ ) {
82
44
struct wx_q_vector * q_vector = wx -> q_vector [vector ];
83
45
struct msix_entry * entry = & wx -> msix_q_entries [vector ];
@@ -110,34 +72,6 @@ static int txgbe_request_msix_irqs(struct wx *wx)
110
72
return err ;
111
73
}
112
74
113
- /**
114
- * txgbe_request_irq - initialize interrupts
115
- * @wx: board private structure
116
- *
117
- * Attempt to configure interrupts using the best available
118
- * capabilities of the hardware and kernel.
119
- **/
120
- int txgbe_request_irq (struct wx * wx )
121
- {
122
- struct net_device * netdev = wx -> netdev ;
123
- struct pci_dev * pdev = wx -> pdev ;
124
- int err ;
125
-
126
- if (pdev -> msix_enabled )
127
- err = txgbe_request_msix_irqs (wx );
128
- else if (pdev -> msi_enabled )
129
- err = request_irq (wx -> pdev -> irq , & txgbe_intr , 0 ,
130
- netdev -> name , wx );
131
- else
132
- err = request_irq (wx -> pdev -> irq , & txgbe_intr , IRQF_SHARED ,
133
- netdev -> name , wx );
134
-
135
- if (err )
136
- wx_err (wx , "request_irq failed, Error %d\n" , err );
137
-
138
- return err ;
139
- }
140
-
141
75
static int txgbe_request_gpio_irq (struct txgbe * txgbe )
142
76
{
143
77
txgbe -> gpio_irq = irq_find_mapping (txgbe -> misc .domain , TXGBE_IRQ_GPIO );
@@ -177,6 +111,36 @@ static const struct irq_domain_ops txgbe_misc_irq_domain_ops = {
177
111
};
178
112
179
113
static irqreturn_t txgbe_misc_irq_handle (int irq , void * data )
114
+ {
115
+ struct wx_q_vector * q_vector ;
116
+ struct txgbe * txgbe = data ;
117
+ struct wx * wx = txgbe -> wx ;
118
+ u32 eicr ;
119
+
120
+ if (wx -> pdev -> msix_enabled )
121
+ return IRQ_WAKE_THREAD ;
122
+
123
+ eicr = wx_misc_isb (wx , WX_ISB_VEC0 );
124
+ if (!eicr ) {
125
+ /* shared interrupt alert!
126
+ * the interrupt that we masked before the ICR read.
127
+ */
128
+ if (netif_running (wx -> netdev ))
129
+ txgbe_irq_enable (wx , true);
130
+ return IRQ_NONE ; /* Not our interrupt */
131
+ }
132
+ wx -> isb_mem [WX_ISB_VEC0 ] = 0 ;
133
+ if (!(wx -> pdev -> msi_enabled ))
134
+ wr32 (wx , WX_PX_INTA , 1 );
135
+
136
+ /* would disable interrupts here but it is auto disabled */
137
+ q_vector = wx -> q_vector [0 ];
138
+ napi_schedule_irqoff (& q_vector -> napi );
139
+
140
+ return IRQ_WAKE_THREAD ;
141
+ }
142
+
143
+ static irqreturn_t txgbe_misc_irq_thread_fn (int irq , void * data )
180
144
{
181
145
struct txgbe * txgbe = data ;
182
146
struct wx * wx = txgbe -> wx ;
@@ -223,6 +187,7 @@ void txgbe_free_misc_irq(struct txgbe *txgbe)
223
187
224
188
int txgbe_setup_misc_irq (struct txgbe * txgbe )
225
189
{
190
+ unsigned long flags = IRQF_ONESHOT ;
226
191
struct wx * wx = txgbe -> wx ;
227
192
int hwirq , err ;
228
193
@@ -236,14 +201,17 @@ int txgbe_setup_misc_irq(struct txgbe *txgbe)
236
201
irq_create_mapping (txgbe -> misc .domain , hwirq );
237
202
238
203
txgbe -> misc .chip = txgbe_irq_chip ;
239
- if (wx -> pdev -> msix_enabled )
204
+ if (wx -> pdev -> msix_enabled ) {
240
205
txgbe -> misc .irq = wx -> msix_entry -> vector ;
241
- else
206
+ } else {
242
207
txgbe -> misc .irq = wx -> pdev -> irq ;
208
+ if (!wx -> pdev -> msi_enabled )
209
+ flags |= IRQF_SHARED ;
210
+ }
243
211
244
- err = request_threaded_irq (txgbe -> misc .irq , NULL ,
245
- txgbe_misc_irq_handle ,
246
- IRQF_ONESHOT ,
212
+ err = request_threaded_irq (txgbe -> misc .irq , txgbe_misc_irq_handle ,
213
+ txgbe_misc_irq_thread_fn ,
214
+ flags ,
247
215
wx -> netdev -> name , txgbe );
248
216
if (err )
249
217
goto del_misc_irq ;
@@ -256,6 +224,8 @@ int txgbe_setup_misc_irq(struct txgbe *txgbe)
256
224
if (err )
257
225
goto free_gpio_irq ;
258
226
227
+ wx -> misc_irq_domain = true;
228
+
259
229
return 0 ;
260
230
261
231
free_gpio_irq :
0 commit comments