net: ppp: Refactor because of timeout overhaul
Use k_timeout_t internally, no change to user API. Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
40f269f033
commit
ab5aba4f8f
4 changed files with 7 additions and 7 deletions
|
@ -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.
|
* @brief Send PPP Echo-Request to peer. We expect to receive Echo-Reply back.
|
||||||
*
|
*
|
||||||
* @param idx PPP network interface index
|
* @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
|
* @return 0 if Echo-Reply was received, < 0 if there is a timeout or network
|
||||||
* index is not a valid PPP network index.
|
* index is not a valid PPP network index.
|
||||||
|
|
|
@ -3213,7 +3213,7 @@ static int cmd_net_ppp_ping(const struct shell *shell, size_t argc,
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = net_ppp_ping(idx, K_SECONDS(1));
|
ret = net_ppp_ping(idx, MSEC_PER_SEC * 1);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (ret == -EAGAIN) {
|
if (ret == -EAGAIN) {
|
||||||
PR_INFO("PPP Echo-Req timeout.\n");
|
PR_INFO("PPP Echo-Req timeout.\n");
|
||||||
|
|
|
@ -19,7 +19,7 @@ LOG_MODULE_DECLARE(net_l2_ppp, CONFIG_NET_L2_PPP_LOG_LEVEL);
|
||||||
#define BUF_ALLOC_TIMEOUT K_MSEC(100)
|
#define BUF_ALLOC_TIMEOUT K_MSEC(100)
|
||||||
|
|
||||||
/* This timeout is in milliseconds */
|
/* 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
|
#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--;
|
fsm->retransmits--;
|
||||||
|
|
||||||
(void)k_delayed_work_submit(&fsm->timer,
|
(void)k_delayed_work_submit(&fsm->timer, FSM_TIMEOUT);
|
||||||
FSM_TIMEOUT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -517,7 +516,7 @@ int ppp_send_pkt(struct ppp_fsm *fsm, struct net_if *iface,
|
||||||
* in that case.
|
* in that case.
|
||||||
*/
|
*/
|
||||||
(void)k_delayed_work_submit(&fsm->sender.work,
|
(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 {
|
} else {
|
||||||
ret = net_send_data(pkt);
|
ret = net_send_data(pkt);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
|
|
@ -373,7 +373,7 @@ int net_ppp_ping(int idx, s32_t timeout)
|
||||||
return ret;
|
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;
|
ctx->shell.echo_reply.cb = NULL;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue