diff --git a/include/net/ppp.h b/include/net/ppp.h index c5f307a4b66..fb1c1ca400a 100644 --- a/include/net/ppp.h +++ b/include/net/ppp.h @@ -611,7 +611,8 @@ static inline void ppp_mgmt_raise_carrier_off_event(struct net_if *iface) * @brief Send PPP Echo-Request to peer. We expect to receive Echo-Reply back. * * @param idx PPP network interface index - * @param timeout Amount of time to wait Echo-Reply. + * @param timeout Amount of time to wait Echo-Reply. The value is in + * milliseconds. * * @return 0 if Echo-Reply was received, < 0 if there is a timeout or network * index is not a valid PPP network index. diff --git a/subsys/net/ip/net_shell.c b/subsys/net/ip/net_shell.c index 87b888dc965..755fcd49736 100644 --- a/subsys/net/ip/net_shell.c +++ b/subsys/net/ip/net_shell.c @@ -3213,7 +3213,7 @@ static int cmd_net_ppp_ping(const struct shell *shell, size_t argc, return -ENOEXEC; } - ret = net_ppp_ping(idx, K_SECONDS(1)); + ret = net_ppp_ping(idx, MSEC_PER_SEC * 1); if (ret < 0) { if (ret == -EAGAIN) { PR_INFO("PPP Echo-Req timeout.\n"); diff --git a/subsys/net/l2/ppp/fsm.c b/subsys/net/l2/ppp/fsm.c index 06d2d3ec773..743ce0f9681 100644 --- a/subsys/net/l2/ppp/fsm.c +++ b/subsys/net/l2/ppp/fsm.c @@ -19,7 +19,7 @@ LOG_MODULE_DECLARE(net_l2_ppp, CONFIG_NET_L2_PPP_LOG_LEVEL); #define BUF_ALLOC_TIMEOUT K_MSEC(100) /* This timeout is in milliseconds */ -#define FSM_TIMEOUT CONFIG_NET_L2_PPP_TIMEOUT +#define FSM_TIMEOUT K_MSEC(CONFIG_NET_L2_PPP_TIMEOUT) #define MAX_NACK_LOOPS CONFIG_NET_L2_PPP_MAX_NACK_LOOPS @@ -118,8 +118,7 @@ static void ppp_fsm_timeout(struct k_work *work) fsm->retransmits--; - (void)k_delayed_work_submit(&fsm->timer, - FSM_TIMEOUT); + (void)k_delayed_work_submit(&fsm->timer, FSM_TIMEOUT); } break; @@ -517,7 +516,7 @@ int ppp_send_pkt(struct ppp_fsm *fsm, struct net_if *iface, * in that case. */ (void)k_delayed_work_submit(&fsm->sender.work, - IS_ENABLED(CONFIG_NET_TEST) ? K_MSEC(1) : 0); + IS_ENABLED(CONFIG_NET_TEST) ? K_MSEC(1) : K_NO_WAIT); } else { ret = net_send_data(pkt); if (ret < 0) { diff --git a/subsys/net/l2/ppp/ppp_l2.c b/subsys/net/l2/ppp/ppp_l2.c index c5d4dc07e12..131746c4f0a 100644 --- a/subsys/net/l2/ppp/ppp_l2.c +++ b/subsys/net/l2/ppp/ppp_l2.c @@ -373,7 +373,7 @@ int net_ppp_ping(int idx, s32_t timeout) return ret; } - ret = k_sem_take(&ctx->shell.wait_echo_reply, timeout); + ret = k_sem_take(&ctx->shell.wait_echo_reply, K_MSEC(timeout)); ctx->shell.echo_reply.cb = NULL;