1. 01 Mar, 2017 2 commits
  2. 24 Feb, 2017 1 commit
  3. 31 Jan, 2017 1 commit
  4. 13 Jan, 2017 1 commit
    • Alessandro Rubini's avatar
      general: avoid linux/ includes when possible · 922e2caf
      Alessandro Rubini authored
      Building with musl was spitting errors for redefined data structures.
      Use the standard headers when available (I found not alternatives to
      linux/if_packet.h, but it spits no error).
      
      Then, ifr.ifr_data is "caddr_t" not "void *" in musl, so cast the
      pointer being assigned to silent a warning.
      
      Finally, the fields of udphdr in musl use different names unless wi
      add _GNU_SOURCE -- most likely musl is more posixly-correct, I didn't check.
      Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
      922e2caf
  5. 12 Dec, 2016 1 commit
  6. 07 Dec, 2016 1 commit
  7. 03 Dec, 2016 1 commit
  8. 02 Dec, 2016 2 commits
    • Alessandro Rubini's avatar
      bugfix: wrs was crazy when slave of non-wr masters · 289371e7
      Alessandro Rubini authored
      The main problem was introduced by:
      
         d2a57023 std-servo: fix initial jump for p2p slaves
      
      There, we falled back on unix->get_time to make adjustments if
      hal->get_time failed.  Only happens as non-wr slave.
      
      Actually, the get_time call has never been implemented in the hal, and
      we always falled on unix time. But if frames are timestamped with
      WR time, we can adjust based on Unix time.
      
      We now read WR time internally, waiting for something better (we have
      constant addresses in here).
      
      Note: we are still unable to steer frequency, despite the efforts
      (and it used to work, ages ago).
      Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
      289371e7
    • Alessandro Rubini's avatar
      bugfix: calloc was misused. Memory corruption. · ceb14b1c
      Alessandro Rubini authored
      This dates back to the original copying over from ptp-noposix:
      
        89a46c6d time-wrs/wrs-socket.c: implementation of net functions for wrs arch
      
      (but the bug was not in ptp-noposix).
      
      It is exposed by the newer compiler (well, library) we are using.
      But a calloc of 0 bytes should return NULL, to ensure it's not used...
      Documentation disagrees:
      
             If size is 0, then malloc() returns either NULL, or a unique
             pointer value that can later be successfully passed to free().
      Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
      ceb14b1c
  9. 21 Nov, 2016 1 commit
  10. 04 Nov, 2016 1 commit
    • Alessandro Rubini's avatar
      remove arguments to net->send; some fixes as side effect · faa87f7a
      Alessandro Rubini authored
      Most arguments of net->send are redundant, as the ppi includes all
      info. In particular, chtype and "is_pdelay_addr" derive from the
      message type.  And the timestamp is always internal.
      
      I chose not to remove message, len and msgtype because the message
      being sent includes the header (ppi->tx_offset), so there's some
      calculation to extract them.  This may happen in a later commit, if I
      find that is a size improvement.
      
      Bugs fixed as a side effect:
         - the "if" for "is_pelay" missed PDELAY_RESP_F_UP (now it's in msgtype.c)
         - wrpc pdelay was always using the e2e mac address
      
      This commit decreases the size of all archs by 60 bytes, but increases
      wrpc by 20 bytes because of the fix above
      Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
      faa87f7a
  11. 03 Nov, 2016 1 commit
  12. 16 May, 2016 1 commit
  13. 13 May, 2016 1 commit
  14. 01 Mar, 2016 1 commit
  15. 29 Feb, 2016 1 commit
  16. 09 Feb, 2016 1 commit
  17. 13 Oct, 2015 2 commits
  18. 01 Sep, 2015 1 commit
    • Alessandro Rubini's avatar
      general: cleanup prototypes · 1acf50d1
      Alessandro Rubini authored
      This adds -Wstrict-prototypes -Wmissing-prototypes and takes actions
      accordingly.
      
      Some of the solutions are ugly, especially in the bare architectures,
      but I prefer to be warned if I take dangerous paths wrt prototypes while
      writing further code.
      
      I'm upset by those two not being included in -Wall, as they used to.
      Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
      1acf50d1
  19. 21 Aug, 2015 4 commits
    • Alessandro Rubini's avatar
      wrs-socket: decrease the timeout when waiting for a timestamp · 2f989cb5
      Alessandro Rubini authored
      Even under load, with queues full, the wrs delays frames less than one ms.
      
      Thus, if we didn't get a timestamp in 1ms, we won't ever get it. Add
      some software delay and clearly we don't need 100ms as in current
      code.  Please note that all state machines are not running during this
      wait, as we are single-process single-thread.
      
      So now we wait for 6ms at most (3 times 2ms at most, but the first
      time we may get an older timestamp, then discarded).
      Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
      2f989cb5
    • Alessandro Rubini's avatar
      wrs-socket: simplify the code retrieving timestamps · 9250cea8
      Alessandro Rubini authored
      This turns the while(1) with internal retry++ to a loop based on retry.
      With two changes:
      
      1- when recvmsg() gets EAGAIN (or other errors), we loop over instead
      of returning. Maybe this doesn't happen anymore thanks to the change
      from POLLIN to POLLERR (previous commit), but this is philosophically
      correct anyways.
      
      2- we don't print anything when poll() returns 0, as these messages
      were redundant, especially when there were many in a row. And if
      nothing is there we expect to get 0. So we removed these:
      
         poll_tx_timestamp: poll() = 0 (Success)
      
      Still, knowing the timestamp was late is useful, but a single message
      suffices, and it's there now.  If you wonder why we loop instead of
      using a longer timeout, the reason is we must get rid of timestamps
      for older frames (the ones that timeout at the previous iteration).
      Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
      9250cea8
    • Alessandro Rubini's avatar
      unix and wrs socket: open in non-blocking mode and report write errors · 4c6953fb
      Alessandro Rubini authored
      It may happen, though rarely, that frames are not sent (or not freed
      at kernel level), and we build up an output queue, so at some point we
      get -EAGAIN on sending.
      
      With blocking writes, this situation was stalling the whole process.
      This patch helped us diagnosing a problem in our own network driver,
      which had a memory leakage, but using non-blocking sockets and
      reporting erors is the right thing to do anyways.
      
      This patch reports the error using pp_diag with a priority 0; thus
      the message is always printed, but by virtue of pp_diag we have the
      name of the port automatically added.
      Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
      4c6953fb
    • Alessandro Rubini's avatar
      wrs-socket: use POLLERR for timestamps · 0bef6863
      Alessandro Rubini authored
      While the manual pages say nothing, https://lwn.net/Articles/291793/
      hints that we should use POLLERR instead of POLLIN.
      
      I hoped to get rid of some of the poll messages, but nothing changes
      in simple tests. I hope we get rid of the EAGAIN in the later recvmsg()
      (likely with POLLIN we got the socket as readable, but nothing was
      in the error queue -- we had a new incoming frame instead).
      Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
      0bef6863
  20. 20 Jul, 2015 1 commit
  21. 06 Jul, 2015 6 commits
  22. 20 Apr, 2015 1 commit
    • Alessandro Rubini's avatar
      wrs-socket: bugfix: wait for late tx stamps · 4179fcdc
      Alessandro Rubini authored
      When the wrs has high data traffic, the tx stamp can be delayed more than
      the time it takes for software to poll for it.
      
      What happened is that we got back -EAGAIN, but when collecting the
      next stamp we got the previous one, and sync goes nuts ever after.
      
      This uses poll() to wait a little for the timestamp.
      
      Moreover, we check the frame we get back, so we can discard it in case
      some unsync between tx frames and timestamps happen -- checking frame
      contents is the suggested policy anyways, but I've been lazy in this,
      when I drafted this wrs support.
      Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
      4179fcdc
  23. 08 Jan, 2015 1 commit
    • Alessandro Rubini's avatar
      time-wrs: fix for a mishap when WR time starts at 0. · 4dbc6b0b
      Alessandro Rubini authored
      System time is used for log messages and nothing critical, so we'd
      better have it different from WR time, when WR time is clearly wrong.
      This commit avoids setting Unix time from WR time when WR time is
      clearly wrong (i.e. earlier than today).
      
      This, among other things, fixes a "fatal error" startup failure when
      two free-running WRS devices are turned one at the same time
      (noted by Adam Wujek).
      
      This is because the master was counting from zero and the slave,
      was setting system time accordingly; but the slave's boot procedure
      already used wr_date to set the utc/tai offset, and system time
      as a result  was being set to a negative value -- tai's being small,
      "tai - 35" was negative.
      Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
      4dbc6b0b
  24. 05 Dec, 2014 2 commits
  25. 04 Dec, 2014 1 commit
    • Alessandro Rubini's avatar
      arch-wrs: replace some RPC with shared memory access · 513151b2
      Alessandro Rubini authored
      The HAL process, in the white rabbit switch, is now exporting data
      structures in shared memory. Thus, we don't need to "get_port_state"
      by RPC, and accessing shared memory is enough.  This change in ppsi
      involves the following changes:
      
      arch-wrs/wrs-startup.c: offer global hal_ports[] for others to use
      (yes, globals are bad, I know...)
      
      arch-wrs/include/ppsi-wrs.h: provide pp_wrs_lookup_port
      
      time-wrs/wrs-socket.c: use shmem. This means some values are now
      hardwired as constants, because they were passed as such from the hal.
      
      arch-wrs/main-loop.c: verify link up or down in the shared mem status
      
      arch-wrs/wrs-calibration.c: wrs_read_calibration_data uses shmem
      Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
      513151b2
  26. 07 Nov, 2014 3 commits