> DESCRIBE_THE_CONFIRMED_FAILURE_AND_WHY_RETRYING_IS_SAFE. > > Allow up to three total attempts for WLAN initialization commands,Sleep for 10 ms between failed attempts before reporting the final error. Can you please provide more details about the issue? What is the root cause of the problem? Can you please explain why just commands in airoha_npu_wlan_init_memory() can fail? > > Fixes: REAL_LINUX_SHA ("EXACT_ORIGINAL_COMMIT_SUBJECT") Ivalid Fixes tag. Regards, Lorenzo > Signed-off-by: Faliang Wang > --- > drivers/net/ethernet/airoha/airoha_npu.c | 41 ++++++++++++++++++------ > 1 file changed, 31 insertions(+), 10 deletions(-) > > diff --git a/drivers/net/ethernet/airoha/airoha_npu.c b/drivers/net/ethernet/airoha/airoha_npu.c > index 7f7cdc2553ad..6fb4eec20c20 100644 > --- a/drivers/net/ethernet/airoha/airoha_npu.c > +++ b/drivers/net/ethernet/airoha/airoha_npu.c > @@ -527,44 +527,65 @@ airoha_npu_wlan_set_reserved_memory(struct airoha_npu *npu, > return airoha_npu_wlan_msg_send(npu, ifindex, func_id, &val, > sizeof(val), GFP_KERNEL); > } > +static int airoha_npu_wlan_cmd_with_retry(struct airoha_npu *npu, > + int ifindex, > + enum airoha_npu_wlan_set_cmd cmd, > + const char *name, bool is_msg_send, > + u32 *val) > +{ > + int retry, err; > + > + for (retry = 0; retry < 3; retry++) { > + if (is_msg_send) > + err = airoha_npu_wlan_msg_send(npu, ifindex, cmd, val, > + sizeof(*val), > + GFP_KERNEL); > + else > + err = airoha_npu_wlan_set_reserved_memory(npu, ifindex, > + name, cmd); > + if (!err) > + return 0; > + > + if (retry < 2) > + msleep(10); > + } > > + return err; > +} > static int airoha_npu_wlan_init_memory(struct airoha_npu *npu) > { > enum airoha_npu_wlan_set_cmd cmd = WLAN_FUNC_SET_WAIT_NPU_BAND0_ONCPU; > u32 val = 0; > - int err; > - > - err = airoha_npu_wlan_msg_send(npu, 1, cmd, &val, sizeof(val), > - GFP_KERNEL); > + int err = 0; > + err = airoha_npu_wlan_cmd_with_retry(npu, 1, cmd, "band0_oncpu",1, &val); > if (err) > return err; > > cmd = WLAN_FUNC_SET_WAIT_TX_BUF_CHECK_ADDR; > - err = airoha_npu_wlan_set_reserved_memory(npu, 0, "tx-bufid", cmd); > + err = airoha_npu_wlan_cmd_with_retry(npu, 0, cmd, "tx-bufid", 0, NULL); > if (err) > return err; > > cmd = WLAN_FUNC_SET_WAIT_PKT_BUF_ADDR; > - err = airoha_npu_wlan_set_reserved_memory(npu, 0, "pkt", cmd); > + err = airoha_npu_wlan_cmd_with_retry(npu, 0, cmd, "pkt", 0, NULL); > if (err) > return err; > > cmd = WLAN_FUNC_SET_WAIT_TX_PKT_BUF_ADDR; > - err = airoha_npu_wlan_set_reserved_memory(npu, 0, "tx-pkt", cmd); > + err = airoha_npu_wlan_cmd_with_retry(npu, 0, cmd, "tx-pkt", 0, NULL); > if (err) > return err; > > if (of_property_match_string(npu->dev->of_node, "memory-region-names", > "ba") >= 0) { > cmd = WLAN_FUNC_SET_WAIT_DRAM_BA_NODE_ADDR; > - err = airoha_npu_wlan_set_reserved_memory(npu, 0, "ba", cmd); > + err = airoha_npu_wlan_cmd_with_retry(npu, 0, cmd, "ba",false, NULL); > if (err) > return err; > } > > cmd = WLAN_FUNC_SET_WAIT_IS_FORCE_TO_CPU; > - return airoha_npu_wlan_msg_send(npu, 0, cmd, &val, sizeof(val), > - GFP_KERNEL); > + return airoha_npu_wlan_cmd_with_retry(npu, 0, cmd, "force_to_cpu", 1,&val); > } > > static u32 airoha_npu_wlan_queue_addr_get(struct airoha_npu *npu, int qid, > -- > 2.43.0 >