Skip to content

Commit 0795fb2

Browse files
sammjdavem330
authored andcommitted
net/ncsi: Stop monitor if channel times out or is inactive
ncsi_channel_monitor() misses stopping the channel monitor in several places that it should, causing a WARN_ON_ONCE() to trigger when the monitor is re-started later, eg: [ 459.040000] WARNING: CPU: 0 PID: 1093 at net/ncsi/ncsi-manage.c:269 ncsi_start_channel_monitor+0x7c/0x90 [ 459.040000] CPU: 0 PID: 1093 Comm: kworker/0:3 Not tainted 4.10.17-gaca2fdd #140 [ 459.040000] Hardware name: ASpeed SoC [ 459.040000] Workqueue: events ncsi_dev_work [ 459.040000] [<80010094>] (unwind_backtrace) from [<8000d950>] (show_stack+0x20/0x24) [ 459.040000] [<8000d950>] (show_stack) from [<801dbf70>] (dump_stack+0x20/0x28) [ 459.040000] [<801dbf70>] (dump_stack) from [<80018d7c>] (__warn+0xe0/0x108) [ 459.040000] [<80018d7c>] (__warn) from [<80018e70>] (warn_slowpath_null+0x30/0x38) [ 459.040000] [<80018e70>] (warn_slowpath_null) from [<803f6a08>] (ncsi_start_channel_monitor+0x7c/0x90) [ 459.040000] [<803f6a08>] (ncsi_start_channel_monitor) from [<803f7664>] (ncsi_configure_channel+0xdc/0x5fc) [ 459.040000] [<803f7664>] (ncsi_configure_channel) from [<803f8160>] (ncsi_dev_work+0xac/0x474) [ 459.040000] [<803f8160>] (ncsi_dev_work) from [<8002d244>] (process_one_work+0x1e0/0x450) [ 459.040000] [<8002d244>] (process_one_work) from [<8002d510>] (worker_thread+0x5c/0x570) [ 459.040000] [<8002d510>] (worker_thread) from [<80033614>] (kthread+0x124/0x164) [ 459.040000] [<80033614>] (kthread) from [<8000a5e8>] (ret_from_fork+0x14/0x2c) This also updates the monitor instead of just returning if ncsi_xmit_cmd() fails to send the get-link-status command so that the monitor properly times out. Fixes: e6f44ed "net/ncsi: Package and channel management" Signed-off-by: Samuel Mendoza-Jonas <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6850d0f commit 0795fb2

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

net/ncsi/ncsi-manage.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,15 @@ static void ncsi_channel_monitor(unsigned long data)
202202
monitor_state = nc->monitor.state;
203203
spin_unlock_irqrestore(&nc->lock, flags);
204204

205-
if (!enabled || chained)
205+
if (!enabled || chained) {
206+
ncsi_stop_channel_monitor(nc);
206207
return;
208+
}
207209
if (state != NCSI_CHANNEL_INACTIVE &&
208-
state != NCSI_CHANNEL_ACTIVE)
210+
state != NCSI_CHANNEL_ACTIVE) {
211+
ncsi_stop_channel_monitor(nc);
209212
return;
213+
}
210214

211215
switch (monitor_state) {
212216
case NCSI_CHANNEL_MONITOR_START:
@@ -217,12 +221,9 @@ static void ncsi_channel_monitor(unsigned long data)
217221
nca.type = NCSI_PKT_CMD_GLS;
218222
nca.req_flags = 0;
219223
ret = ncsi_xmit_cmd(&nca);
220-
if (ret) {
224+
if (ret)
221225
netdev_err(ndp->ndev.dev, "Error %d sending GLS\n",
222226
ret);
223-
return;
224-
}
225-
226227
break;
227228
case NCSI_CHANNEL_MONITOR_WAIT ... NCSI_CHANNEL_MONITOR_WAIT_MAX:
228229
break;
@@ -233,6 +234,8 @@ static void ncsi_channel_monitor(unsigned long data)
233234
ndp->flags |= NCSI_DEV_RESHUFFLE;
234235
}
235236

237+
ncsi_stop_channel_monitor(nc);
238+
236239
spin_lock_irqsave(&nc->lock, flags);
237240
nc->state = NCSI_CHANNEL_INVISIBLE;
238241
spin_unlock_irqrestore(&nc->lock, flags);

0 commit comments

Comments
 (0)