Skip to content

Commit 1e1fa17

Browse files
Jiawen WuPaolo Abeni
authored andcommitted
net: txgbe: add extra handle for MSI/INTx into thread irq handle
Rename original txgbe_misc_irq_handle() to txgbe_misc_irq_thread_fn() since it is the handle thread to wake up. And add the primary handler to deal the case of MSI/INTx, because there is a schedule NAPI poll. Fixes: aefd013 ("net: txgbe: use irq_domain for interrupt controller") Signed-off-by: Jiawen Wu <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent bd07a98 commit 1e1fa17

File tree

1 file changed

+39
-5
lines changed

1 file changed

+39
-5
lines changed

drivers/net/ethernet/wangxun/txgbe/txgbe_irq.c

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,36 @@ static const struct irq_domain_ops txgbe_misc_irq_domain_ops = {
111111
};
112112

113113
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)
114144
{
115145
struct txgbe *txgbe = data;
116146
struct wx *wx = txgbe->wx;
@@ -157,6 +187,7 @@ void txgbe_free_misc_irq(struct txgbe *txgbe)
157187

158188
int txgbe_setup_misc_irq(struct txgbe *txgbe)
159189
{
190+
unsigned long flags = IRQF_ONESHOT;
160191
struct wx *wx = txgbe->wx;
161192
int hwirq, err;
162193

@@ -170,14 +201,17 @@ int txgbe_setup_misc_irq(struct txgbe *txgbe)
170201
irq_create_mapping(txgbe->misc.domain, hwirq);
171202

172203
txgbe->misc.chip = txgbe_irq_chip;
173-
if (wx->pdev->msix_enabled)
204+
if (wx->pdev->msix_enabled) {
174205
txgbe->misc.irq = wx->msix_entry->vector;
175-
else
206+
} else {
176207
txgbe->misc.irq = wx->pdev->irq;
208+
if (!wx->pdev->msi_enabled)
209+
flags |= IRQF_SHARED;
210+
}
177211

178-
err = request_threaded_irq(txgbe->misc.irq, NULL,
179-
txgbe_misc_irq_handle,
180-
IRQF_ONESHOT,
212+
err = request_threaded_irq(txgbe->misc.irq, txgbe_misc_irq_handle,
213+
txgbe_misc_irq_thread_fn,
214+
flags,
181215
wx->netdev->name, txgbe);
182216
if (err)
183217
goto del_misc_irq;

0 commit comments

Comments
 (0)