PPP, PPP_MAXIDLEFLAG is now in ms instead of jiffies

Jiffies isn't really a humanly readable value and it means the default
PPP_MAXIDLEFLAG period depends on the platform "jiffies" frequency,
which isn't nice.

Change PPP_MAXIDLEFLAG to use ms instead of jiffies, the current
PPP_MAXIDLEFLAG default (100 ms), looks like a sane value and is
left unchanged.
This commit is contained in:
Sylvain Rochet 2015-09-26 23:01:15 +02:00
parent ba41685353
commit 9e0202b38f
3 changed files with 6 additions and 4 deletions

View File

@ -419,3 +419,5 @@ from previous lwIP version is pretty easy:
conditional.
* PPPoS now requires a serial output callback
* PPP_MAXIDLEFLAG is now in ms instead of jiffies

View File

@ -2394,7 +2394,7 @@
#endif
/**
* PPP_MAXIDLEFLAG: Max Xmit idle time (in jiffies) before resend flag char.
* PPP_MAXIDLEFLAG: Max Xmit idle time (in ms) before resend flag char.
*/
#ifndef PPP_MAXIDLEFLAG
#define PPP_MAXIDLEFLAG 100

View File

@ -215,7 +215,7 @@ pppos_write(ppp_pcb *ppp, void *ctx, struct pbuf *p)
/* If the link has been idle, we'll send a fresh flag character to
* flush any noise. */
err = ERR_OK;
if ((sys_jiffies() - pppos->last_xmit) >= PPP_MAXIDLEFLAG) {
if ((sys_now() - pppos->last_xmit) >= PPP_MAXIDLEFLAG) {
err = pppos_output_append(pppos, err, nb, PPP_FLAG, 0, NULL);
}
@ -260,7 +260,7 @@ pppos_netif_output(ppp_pcb *ppp, void *ctx, struct pbuf *pb, u16_t protocol)
/* If the link has been idle, we'll send a fresh flag character to
* flush any noise. */
err = ERR_OK;
if ((sys_jiffies() - pppos->last_xmit) >= PPP_MAXIDLEFLAG) {
if ((sys_now() - pppos->last_xmit) >= PPP_MAXIDLEFLAG) {
err = pppos_output_append(pppos, err, nb, PPP_FLAG, 0, NULL);
}
@ -879,7 +879,7 @@ pppos_output_last(pppos_pcb *pppos, err_t err, struct pbuf *nb, u16_t *fcs)
}
}
pppos->last_xmit = sys_jiffies();
pppos->last_xmit = sys_now();
MIB2_STATS_NETIF_ADD(ppp->netif, ifoutoctets, nb->tot_len);
MIB2_STATS_NETIF_INC(ppp->netif, ifoutucastpkts);
LINK_STATS_INC(link.xmit);