Skip to content

Commit 4e4269e

Browse files
Luo binkuba-moo
authored andcommitted
hinic: bump up the timeout of SET_FUNC_STATE cmd
We free memory regardless of the return value of SET_FUNC_STATE cmd in hinic_close function to avoid memory leak and this cmd may timeout when fw is busy with handling other cmds, so we bump up the timeout of this cmd to ensure it won't return failure. Fixes: 00e57a6 ("net-next/hinic: Add Tx operation") Signed-off-by: Luo bin <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent cc8e58f commit 4e4269e

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

drivers/net/ethernet/huawei/hinic/hinic_hw_mgmt.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747

4848
#define MGMT_MSG_TIMEOUT 5000
4949

50+
#define SET_FUNC_PORT_MBOX_TIMEOUT 30000
51+
5052
#define SET_FUNC_PORT_MGMT_TIMEOUT 25000
5153

5254
#define mgmt_to_pfhwdev(pf_mgmt) \
@@ -361,16 +363,20 @@ int hinic_msg_to_mgmt(struct hinic_pf_to_mgmt *pf_to_mgmt,
361363
return -EINVAL;
362364
}
363365

364-
if (cmd == HINIC_PORT_CMD_SET_FUNC_STATE)
365-
timeout = SET_FUNC_PORT_MGMT_TIMEOUT;
366+
if (HINIC_IS_VF(hwif)) {
367+
if (cmd == HINIC_PORT_CMD_SET_FUNC_STATE)
368+
timeout = SET_FUNC_PORT_MBOX_TIMEOUT;
366369

367-
if (HINIC_IS_VF(hwif))
368370
return hinic_mbox_to_pf(pf_to_mgmt->hwdev, mod, cmd, buf_in,
369-
in_size, buf_out, out_size, 0);
370-
else
371+
in_size, buf_out, out_size, timeout);
372+
} else {
373+
if (cmd == HINIC_PORT_CMD_SET_FUNC_STATE)
374+
timeout = SET_FUNC_PORT_MGMT_TIMEOUT;
375+
371376
return msg_to_mgmt_sync(pf_to_mgmt, mod, cmd, buf_in, in_size,
372377
buf_out, out_size, MGMT_DIRECT_SEND,
373378
MSG_NOT_RESP, timeout);
379+
}
374380
}
375381

376382
static void recv_mgmt_msg_work_handler(struct work_struct *work)

0 commit comments

Comments
 (0)