[etherlab-dev] FoE erroneous timeouts

Dave Page dave.page at gleeble.com
Mon Dec 16 20:10:39 CET 2013


Hi,
     I experienced an issue with the FoE write where a spurious timeout 
would occur. This turned out to be due to datagram->jiffies_received < 
fsm->jiffies_start for some reason. The following patch resolves this issue:

diff -r 2eff7c993a63 master/fsm_foe.c
--- a/master/fsm_foe.c  Tue Feb 12 17:31:08 2013 +0100
+++ b/master/fsm_foe.c  Mon Dec 16 14:01:56 2013 -0500
@@ -42,9 +42,9 @@

  /*****************************************************************************/

-/** Maximum time in ms to wait for responses when reading out the 
dictionary.
+/** Maximum time in jiffies to wait for responses when reading out the 
dictionary.
   */
-#define EC_FSM_FOE_TIMEOUT 3000
+#define EC_FSM_FOE_TIMEOUT (3*HZ)

  /** Mailbox type FoE.
   */
@@ -370,9 +370,7 @@

      if (!ec_slave_mbox_check(fsm->datagram)) {
          // slave did not put anything in the mailbox yet
-        unsigned long diff_ms =
-            (datagram->jiffies_received - fsm->jiffies_start) * 1000 / HZ;
-        if (diff_ms >= EC_FSM_FOE_TIMEOUT) {
+        if (time_after(datagram->jiffies_received, 
fsm->jiffies_start+EC_FSM_FOE_TIMEOUT)) {
              ec_foe_set_tx_error(fsm, FOE_TIMEOUT_ERROR);
              EC_SLAVE_ERR(slave, "Timeout while waiting for ack 
response.\n");
              return;
@@ -709,10 +707,7 @@
      }

      if (!ec_slave_mbox_check(fsm->datagram)) {
-        unsigned long diff_ms =
-            (fsm->datagram->jiffies_received - fsm->jiffies_start) *
-            1000 / HZ;
-        if (diff_ms >= EC_FSM_FOE_TIMEOUT) {
+        if (time_after(datagram->jiffies_received, 
fsm->jiffies_start+EC_FSM_FOE_TIMEOUT)) {
              ec_foe_set_tx_error(fsm, FOE_TIMEOUT_ERROR);
              EC_SLAVE_ERR(slave, "Timeout while waiting for ack 
response.\n");
              return;



-- 
------------------------------------------------------------------------
David Page, Chief Embedded Architect
Dynamic Systems Inc.
PO Box 1234
Poestenkill, NY 12140
Telephone: +1 (518) 283-5350 | Fax: +1 (518) 283-3160 |
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.etherlab.org/pipermail/etherlab-dev/attachments/20131216/c005ec35/attachment.html>


More information about the etherlab-dev mailing list