lxip: fix timer handling and jiffies update

This commit is contained in:
Christian Helmuth 2017-09-19 12:27:14 +02:00
parent be753ee863
commit 9ff82d76c0
3 changed files with 13 additions and 1 deletions

View File

@ -47,6 +47,8 @@ class Nic_client
if (_nic.link_state() == false || lxip_do_dhcp() == false) if (_nic.link_state() == false || lxip_do_dhcp() == false)
return; return;
Lx::timer_update_jiffies();
/* reconnect dhcp client */ /* reconnect dhcp client */
lxip_configure_dhcp(); lxip_configure_dhcp();
} }
@ -56,6 +58,8 @@ class Nic_client
*/ */
void _packet_avail() void _packet_avail()
{ {
Lx::timer_update_jiffies();
/* process a batch of only MAX_PACKETS in one run */ /* process a batch of only MAX_PACKETS in one run */
enum { MAX_PACKETS = 20 }; enum { MAX_PACKETS = 20 };

View File

@ -378,6 +378,8 @@ class Net::Socketcall : public Lxip::Socketcall,
void _dispatch() void _dispatch()
{ {
Lx::timer_update_jiffies();
switch (_call.opcode) { switch (_call.opcode) {
case OP_ACCEPT : _do_accept(); break; case OP_ACCEPT : _do_accept(); break;

View File

@ -178,8 +178,11 @@ class Lx::Timer
if (ctx->timeout > jiffies) if (ctx->timeout > jiffies)
break; break;
ctx->pending = false;
ctx->function(); ctx->function();
del(ctx->timer);
if (!ctx->pending)
del(ctx->timer);
} }
/* tick the higher layer of the component */ /* tick the higher layer of the component */
@ -360,3 +363,6 @@ int del_timer(struct timer_list *timer)
return rv; return rv;
} }
void Lx::timer_update_jiffies() { update_jiffies(); }