Skip to content

Commit 05c00d8

Browse files
Elad Kanfidavem330
authored andcommitted
net: nps_enet: bug fix - handle lost tx interrupts
The tx interrupt is of edge type, and in case such interrupt is triggered while it is masked it will not be handled even after tx interrupts are re-enabled in the end of NAPI poll. This will cause tx network to stop in the following scenario: * Rx is being handled, hence interrupts are masked. * Tx interrupt is triggered after checking if there is some tx to handle and before re-enabling the interrupts. In this situation only rx transaction will release tx requests. In order to handle the tx that was missed( if there was one ), a NAPI reschdule was added after enabling the interrupts. Signed-off-by: Elad Kanfi <[email protected]> Acked-by: Noam Camus <[email protected]> Acked-by: Gilad Ben-Yossef <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e5df49d commit 05c00d8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

drivers/net/ethernet/ezchip/nps_enet.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ static int nps_enet_poll(struct napi_struct *napi, int budget)
183183
work_done = nps_enet_rx_handler(ndev);
184184
if (work_done < budget) {
185185
u32 buf_int_enable_value = 0;
186+
u32 tx_ctrl_value = nps_enet_reg_get(priv, NPS_ENET_REG_TX_CTL);
187+
u32 tx_ctrl_ct =
188+
(tx_ctrl_value & TX_CTL_CT_MASK) >> TX_CTL_CT_SHIFT;
186189

187190
napi_complete(napi);
188191

@@ -192,6 +195,18 @@ static int nps_enet_poll(struct napi_struct *napi, int budget)
192195

193196
nps_enet_reg_set(priv, NPS_ENET_REG_BUF_INT_ENABLE,
194197
buf_int_enable_value);
198+
199+
/* in case we will get a tx interrupt while interrupts
200+
* are masked, we will lose it since the tx is edge interrupt.
201+
* specifically, while executing the code section above,
202+
* between nps_enet_tx_handler and the interrupts enable, all
203+
* tx requests will be stuck until we will get an rx interrupt.
204+
* the two code lines below will solve this situation by
205+
* re-adding ourselves to the poll list.
206+
*/
207+
208+
if (priv->tx_skb && !tx_ctrl_ct)
209+
napi_reschedule(napi);
195210
}
196211

197212
return work_done;

0 commit comments

Comments
 (0)