* [PATCH net] ethernet: s2io: disable napi when start nic failed in s2io_card_up()
@ 2022-11-08 0:59 Zhengchao Shao
2022-11-09 1:29 ` Jakub Kicinski
0 siblings, 1 reply; 3+ messages in thread
From: Zhengchao Shao @ 2022-11-08 0:59 UTC (permalink / raw)
To: netdev, jdmason, davem, edumazet, kuba, pabeni
Cc: jeffrey.t.kirsher, weiyongjun1, yuehaibing, shaozhengchao
When failed to start nic or add interrupt service routine in
s2io_card_up() for opening device, napi isn't disabled. When open
s2io device next time, it will reports a invalid opcode issue. Fix
it. Only be compiled, not be tested.
Fixes: 86387e1ac4fc ("s2io/vxge: Move the Exar drivers")
Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
---
drivers/net/ethernet/neterion/s2io.c | 29 +++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/neterion/s2io.c b/drivers/net/ethernet/neterion/s2io.c
index dcf8212119f9..1d3c4474b7cb 100644
--- a/drivers/net/ethernet/neterion/s2io.c
+++ b/drivers/net/ethernet/neterion/s2io.c
@@ -7128,9 +7128,8 @@ static int s2io_card_up(struct s2io_nic *sp)
if (ret) {
DBG_PRINT(ERR_DBG, "%s: Out of memory in Open\n",
dev->name);
- s2io_reset(sp);
- free_rx_buffers(sp);
- return -ENOMEM;
+ ret = -ENOMEM;
+ goto err_fill_buff;
}
DBG_PRINT(INFO_DBG, "Buf in ring:%d is %d:\n", i,
ring->rx_bufs_left);
@@ -7168,18 +7167,16 @@ static int s2io_card_up(struct s2io_nic *sp)
/* Enable Rx Traffic and interrupts on the NIC */
if (start_nic(sp)) {
DBG_PRINT(ERR_DBG, "%s: Starting NIC failed\n", dev->name);
- s2io_reset(sp);
- free_rx_buffers(sp);
- return -ENODEV;
+ ret = -ENODEV;
+ goto err_out;
}
/* Add interrupt service routine */
if (s2io_add_isr(sp) != 0) {
if (sp->config.intr_type == MSI_X)
s2io_rem_isr(sp);
- s2io_reset(sp);
- free_rx_buffers(sp);
- return -ENODEV;
+ ret = -ENODEV;
+ goto err_out;
}
timer_setup(&sp->alarm_timer, s2io_alarm_handle, 0);
@@ -7199,6 +7196,20 @@ static int s2io_card_up(struct s2io_nic *sp)
}
return 0;
+
+err_out:
+ if (config->napi) {
+ if (config->intr_type == MSI_X) {
+ for (i = 0; i < sp->config.rx_ring_num; i++)
+ napi_disable(&sp->mac_control.rings[i].napi);
+ } else {
+ napi_disable(&sp->napi);
+ }
+ }
+err_fill_buff:
+ s2io_reset(sp);
+ free_rx_buffers(sp);
+ return ret;
}
/**
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net] ethernet: s2io: disable napi when start nic failed in s2io_card_up()
2022-11-08 0:59 [PATCH net] ethernet: s2io: disable napi when start nic failed in s2io_card_up() Zhengchao Shao
@ 2022-11-09 1:29 ` Jakub Kicinski
2022-11-09 1:43 ` shaozhengchao
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2022-11-09 1:29 UTC (permalink / raw)
To: Zhengchao Shao
Cc: netdev, jdmason, davem, edumazet, pabeni, jeffrey.t.kirsher,
weiyongjun1, yuehaibing
On Tue, 8 Nov 2022 08:59:52 +0800 Zhengchao Shao wrote:
> Fixes: 86387e1ac4fc ("s2io/vxge: Move the Exar drivers")
Again, unlikely to be the culprit.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net] ethernet: s2io: disable napi when start nic failed in s2io_card_up()
2022-11-09 1:29 ` Jakub Kicinski
@ 2022-11-09 1:43 ` shaozhengchao
0 siblings, 0 replies; 3+ messages in thread
From: shaozhengchao @ 2022-11-09 1:43 UTC (permalink / raw)
To: Jakub Kicinski
Cc: netdev, jdmason, davem, edumazet, pabeni, jeffrey.t.kirsher,
weiyongjun1, yuehaibing
On 2022/11/9 9:29, Jakub Kicinski wrote:
> On Tue, 8 Nov 2022 08:59:52 +0800 Zhengchao Shao wrote:
>> Fixes: 86387e1ac4fc ("s2io/vxge: Move the Exar drivers")
>
> Again, unlikely to be the culprit.
Thank you. Also will fix in v2.
Zhengchao Shao
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-09 1:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-08 0:59 [PATCH net] ethernet: s2io: disable napi when start nic failed in s2io_card_up() Zhengchao Shao
2022-11-09 1:29 ` Jakub Kicinski
2022-11-09 1:43 ` shaozhengchao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).