>
> Maybe your sys_now() or sys_jiffies() functions are too course?
> They should have a resolution of approx. 1 msec.


I am not even talking about observed delays.
I am looking at the code, and based on that, those packets will be delayed
by up to twice the value of TCP_TMR_INTERVAL in milliseconds.
TCP_TMR_INTERVAL is set, by default, to 250.

The TCP timer is scheduled to run every TCP_TMR_INTERVAL milliseconds.
Actually every TCP_TMR_INTERVAL values returned by sys_now(),
which is supposed to return milliseconds. That timer calls tcp_tmr(), which
will always call tcp_fasttmr() and call tcp_slowtmr() every other time.
Even the comments in tcp_tmr() say that tcp_slowtmr() will be called every
500ms.

And I am looking at tcp_write(). It is a pretty big function so I may be
missing something,
but it doesn't look like it's actually sending any of the packets being
written,
it just appends them to 'unsent' queue.

The actual writing happens inside tcp_slowtmr() which, again, is called
every 500ms.
So if something is written using tcp_write() 10ms after tcp_slowtmr()
triggered,
it will be actually sent out 490ms later. Even assuming perfect resolution
of sys_now
and being able to call things at exactly the right time. It's still up to a
half a second later!
Which is the problem I am experiencing.

Now I could modify TCP_TMR_INTERVAL to much lower value,
and call sys_check_timeouts() much more often to cause tcp_slowtmr() to be
called much more frequently.

Or modify sys_now() to return values that don't represent milliseconds but
something smaller
(and still call sys_check_timeouts() more often), but this changes the
whole time scale and I have no idea
what other effects this might have.

Both of these solutions feel ugly and could affect the performance.

I even tried calling tcp_slowtmr() manually, and it seems to send out those
TCP packets
sooner, but it doesn't feel like the right solution.

I haven't looked into manually calling tcp_output after each tcp_write as
suggested in an earlier response yet,
but the same response also says that it's a wrong thing to do...

That is why I am asking if I am missing something...

But depending on your hardware it could not be so easy to accomplish. BTW,
> what is your hardware?
>

I am running it as a part of  a system that generates IP packets in
software.
Right now I am running it on a powerful i5 machine, so performance is not
an issue.


> I've myself built with NO_SYS=1 on djgpp/MSDOS with no long delays
> as you describe. Hence I think it's a problem with your 'clock-tick'
> function.
>

What is your TCP_TMR_INTERVAL?
What do you return in sys_now()?


Thanks!
_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to