1. 15 Aug, 2019 1 commit
  2. 26 Jul, 2019 4 commits
  3. 25 Jul, 2019 1 commit
    • William A. Kennington III's avatar
      console-client: Cleanup the escape code · ff569830
      William A. Kennington III authored
      This change fixes a bug where multiple tildes were sent if a user typed
      \r~~ This is unlike ssh, which allows nesting of escape sequences by
      ensuring that only the second tilde is sent after the command sequence
      is issued. This patch fixes the behavior so the console-server only ever
      gets \r~ for an issued \r~~
      
      This also prepares the escape sequence handling code for an upcoming
      change which allows a user configurable escape sequence in addition to
      the default ssh like one.
      
      Change-Id: Iaff04e62fb57fab88d413df2b347809b98f728bb
      Signed-off-by: default avatarWilliam A. Kennington III <wak@google.com>
      ff569830
  4. 22 Mar, 2019 1 commit
    • Johnathan Mantey's avatar
      Eliminate excessive CPU consumption when redirecting UART over SSH · 1cecc5de
      Johnathan Mantey authored
      Redirecting the external UART via SSH caused the console-server,
      console-client, and dropbear to consume ~30% of the available CPU each
      when a large amount of data was being written to the UART output.
      
      Buffering all of the small 16550 FIFO bytes into a larger packet and
      then sending that to the SSH SW allows more efficient transmission
      over the ethernet connection.
      
      Tested this by "ssh root@<bmc.ip.addr> -p 2200" on a system running a
      CentOS distribution.  Using a BASH console run a large binary file
      through "od -t x1 <fname>" to create a large amount of traffic.  At
      the BMC console run "top" to review the CPU usage.  My experience is
      after this change is applied:
      console-server: ~25% CPU
      dropbear: ~3% CPU
      console-client: ~1% CPU
      
      Change-Id: Ibabfd285e97a487e7ff040e1cb3159fbff360328
      Signed-off-by: default avatarJohnathan Mantey <johnathanx.mantey@intel.com>
      1cecc5de
  5. 19 Mar, 2019 1 commit
  6. 04 Mar, 2019 1 commit
    • Cheng C Yang's avatar
      Change baudrate dynamically through dbus · f9c8f6ca
      Cheng C Yang authored
      Create a dbus interface so that user can change baudrate dynamically.
      With this feature, SOL can still work correctly when BIOS switch uart
      from high speed uart to normal uart.
      
      Tested By:
      Run busctl introspect xyz.openbmc_project.console /xyz/openbmc_project/console
      the property baudrate show the current baudrate.
      Run busctl call xyz.openbmc_project.console /xyz/openbmc_project/console
      xyz.openbmc_project.console setBaudRate x 9600
      The property baudrate show 9600 now. After change BIOS console redirection
      to 9600 baudrate and change putty client also to 9600. SOL and serial port can
      work correctly.
      
      Change-Id: I2045f47520275a0b5bb9242af78a64e5aac8ea8a
      Signed-off-by: default avatarCheng C Yang <cheng.c.yang@linux.intel.com>
      f9c8f6ca
  7. 18 Dec, 2018 1 commit
    • Vernon Mauery's avatar
      obmc-console-server: bind/connect with the correct sockaddr size · fcf8541b
      Vernon Mauery authored
      Abstract unix sockets start with the nul-charater, but are not nul
      terminated. In fact, the nul-character has no meaning in the path.
      According to the man page unix(7),
      
      abstract:  an abstract socket address is distinguished (from a pathname
                 socket) by the fact that sun_path[0] is a null byte ('\0').
                 The socket's address in  this  namespace is  given by the
                 additional bytes in sun_path that are covered by the
                 specified length of the address structure.  (Null bytes in
                 the name have no special significance.)
      
      This means that when calling bind/connect, the size of the sockaddr
      structure is not sizeof(sockaddr_un), it is sizeof(sockaddr_un) -
      sizeof(sun_path) + (path_len)
      
      Change-Id: I6560ba8b2a25a60644873adf66f02a60ded42b1d
      Signed-off-by: default avatarVernon Mauery <vernon.mauery@linux.intel.com>
      fcf8541b
  8. 27 Aug, 2018 1 commit
    • Kun Yi's avatar
      log-handler: Init log size properly · 18644357
      Kun Yi authored
      Log size is not initialized when the config string is not
      present in the configuration file. Add a default value
      in that case.
      
      Resolves openbmc/obmc-console#14
      
      Tested:
      Made sure when configuration file contains no logsize
      option, the size is configured to 16kB.
      
      Change-Id: I20b109fc791f2d6ac54704c9aabb5cd129a8bf13
      Signed-off-by: default avatarKun Yi <kunyi731@gmail.com>
      18644357
  9. 03 Jul, 2018 3 commits
    • Kun Yi's avatar
      Add gitignore · 3c89b263
      Kun Yi authored
      Tested:
      git status is clean after 'make' and 'cd test && make check'.
      
      Change-Id: I5a6dd2a8a85b0621b0d055910071da632ccc810d
      Signed-off-by: default avatarKun Yi <kunyi731@gmail.com>
      3c89b263
    • Kun Yi's avatar
      test: config: Add a test for config_parse_logsize. · 9747d63d
      Kun Yi authored
      Add a unit test that validates config_parse_logsize returns
      expected values.
      
      Tested: 'make check' passed when ran under x86_64 environment.
      
      Change-Id: I54d9478157fab3db7c2c5879d12e719e738a1099
      Signed-off-by: default avatarKun Yi <kunyi731@gmail.com>
      9747d63d
    • Kun Yi's avatar
      log-handler: Add a config option for log size. · 6424cc3b
      Kun Yi authored
      Allow a configuration option to specify a log size. The parameter takes and
      interprets common size suffixes k/M/G. 1kB = 1024B, 1MB=1024kB, 1GB=1024MB.
      Default unit is byte. If "B" is specified at the end it will be ignored.
      
      Tested:
      Tested that "logsize = 567kB" correctly sets up a 567KB log buffer.
      Tested that invalid/overflow values will be ignored and 16KB will be used.
      Tested that if log size smaller than pagesize is rounded up.
      
      Change-Id: I2fb50462c6ff7873130be80f7d57ef8065acc5da
      Signed-off-by: default avatarKun Yi <kunyi731@gmail.com>
      6424cc3b
  10. 05 Jun, 2018 1 commit
    • Benjamin Fair's avatar
      server: allow setting baud rate on host tty · c7fbcd48
      Benjamin Fair authored
      The Nuvoton NPCM7xx series BMCs have a real UART which receives output
      from the host serial console, rather than a virtual UART as on Aspeed
      parts. This means we have to set the baud rate of the tty to match the
      host console.
      
      This change adds the "baud" config option. If it is present in the
      config file and has a valid value, the host console tty's baud rate will
      be set to that value.
      
      Change-Id: If2156c2032e7527709713f13654ce8bca9bf4c1d
      Signed-off-by: default avatarBenjamin Fair <benjaminfair@google.com>
      c7fbcd48
  11. 04 Jun, 2018 1 commit
  12. 18 May, 2018 1 commit
  13. 12 Jul, 2017 1 commit
    • Jeremy Kerr's avatar
      tty-handler: unify error handling for poller failures · 67eab046
      Jeremy Kerr authored
      We currently have a bug where we don't unregister from the ringbuffer
      poller if we get an error on read(). This change unifies the
      error-handling for potential failure cases in the poller handler, and
      ensures that we unregister the ringbuffer poller and console poller in
      all cases.
      
      Change-Id: If354dd3c7f2a1ec534c6b42020fd9978e53cb20d
      Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
      67eab046
  14. 27 Jun, 2017 7 commits
    • Jeremy Kerr's avatar
      server: ensure per-cycle buffer is smaller than ringbuffer · 1764145d
      Jeremy Kerr authored
      ... otherwise there's a chance we can't queue a full read.
      
      Change-Id: I7bae8b124a523aac39045b6da97b486924e69f97
      Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
      1764145d
    • Jeremy Kerr's avatar
      server: improve blocked-write behaviour for handlers · 6b1fed27
      Jeremy Kerr authored
      We currently don't implement POLLOUT properly; we never set this for
      polled events, and will repeat calls to write() if we see EAGAIN.
      
      This change improves the behaviour when writes start to block, by
      tracking when a fd is blocked. Once we detect blocking behaviour, we
      supress future (non-forced) writes, and wait for POLLOUT so we know when
      we can write again.
      
      Change-Id: I809bde4e1c7c78a58ea296d5c076b3d93c272558
      Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
      6b1fed27
    • Jeremy Kerr's avatar
      server: use ringbuffer for all handlers · f733c85a
      Jeremy Kerr authored
      Currently, we use the a ringbuffer within the socket handler to manage
      bursts of data to slower clients.
      
      However, we're also seeing cases where the local tty handler becomes
      blocking as well. So, we want to implement a buffer within the tty
      handler too.
      
      This change moves the ringbuffer 'up a layer' - from the socket handler
      to the core console code.
      
      We remove the ->data_in callback from handlers, and work on the
      assumption that handlers have registered their own consumer on the
      console's ringbuffer (through a new helper function,
      console_ringbuffer_consumer_register()).
      
      Change-Id: Ie8f02d6632578c50bb5e2dfb9bee6ece86432135
      Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
      f733c85a
    • Jeremy Kerr's avatar
      server: Add documentation to struct handler · 1b575010
      Jeremy Kerr authored
      Add a little documentation for the handler API, as we'll be changing
      this with upcoming buffer code.
      
      Change-Id: I0d33c415f577b9bdc6b53bb8151bb7f564733b3d
      Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
      1b575010
    • Jeremy Kerr's avatar
      server: Use consistent function names · 55c9712d
      Jeremy Kerr authored
      Put verbs at the end, ie:
       console_register_poller -> console_poller_register
       console_register_handler -> console_handler_register
      
      Change-Id: I4fa78137ce54a3f15aad87c3371569b084e47094
      Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
      55c9712d
    • Jeremy Kerr's avatar
      server: Use ringbuffer for socket backlog · c9775ce7
      Jeremy Kerr authored
      Currently, the socket handler uses a linear buffer for the backlog data;
      this means we need to shift up to 128kB of data after each socket
      write().
      
      This change introduces a single-producer-multiple-consumer ringbuffer,
      to avoid the need for memmove()ing data around; we can simply update
      pointers instead of shifting data.
      
      We add this as a new file (ringbuffer.c), to make it a little more
      modular. To mitigate the risk of subtle pointer arithmetic issues, we
      add a set of tests too.
      
      Change-Id: Ib7c5151d3cf1f588436f5461000b6fed22d0681c
      Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
      c9775ce7
    • Jeremy Kerr's avatar
      tty-handler: use simpler open in non-blocking mode · bc506fd2
      Jeremy Kerr authored
      Currently, we're opening the tty file descriptor in blocking mode, then
      switching to non-blocking mode with fcntl(F_SETFL, F_NDELAY);
      
      [and F_NDELAY == O_NDELAY == O_NONBLOCK ]
      
      This change just opens with O_NONBLOCK instead.
      
      Change-Id: I414ebec632008d65dec87d956d5a0ac1a46ec837
      Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
      bc506fd2
  15. 18 Apr, 2017 1 commit
    • Xo Wang's avatar
      tty-handler: Use raw byte handling for terminal · 81408bd0
      Xo Wang authored
      When opening the tty for local UART mirroring, disable various special
      processing of terminal input and output like flow control, line edit
      (canonical) mode, character translation, special characters, etc.
      
      This forwards all terminal input to the VUART and allow the host OS to
      perform any necessary processing.
      
      Change-Id: I8b2896e7465c8af643f0cbbcaf7ef2f9ee96e2f5
      Signed-off-by: default avatarXo Wang <xow@google.com>
      81408bd0
  16. 17 Apr, 2017 1 commit
    • Xo Wang's avatar
      tty-handler: Add baud rate setting · c5ef8ead
      Xo Wang authored
      Add local-tty-baud setting for configuration file.
      Optionally change tty baud rate using termios.
      
      For errors, use prints to stderr where warn/error calls are not
      appropriate (i.e. errno hasn't been set by the error-causing call).
      
      Fixes openbmc/openbmc#992.
      
      Change-Id: Ia9226d1666f2626b2c04f30297755d93aee4994e
      Signed-off-by: default avatarXo Wang <xow@google.com>
      c5ef8ead
  17. 19 Jan, 2017 3 commits
    • Jeremy Kerr's avatar
      socket-handler: fix leak if we exit with multiple clients · abd8e255
      Jeremy Kerr authored
      sh->n_clients is decremented by client_close(), so don't iterate through
      the array.
      
      Change-Id: Id44b596a483758fb8218d472a3ac411c04aacd74
      Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
      abd8e255
    • Jeremy Kerr's avatar
      socket-handler: Use a global backlog buffer instead of per-client · 5708dfb2
      Jeremy Kerr authored
      Currently, we keep a backlog buffer for each connected client. This is a
      waste, as it's storing the same data, just at different offsets.
      
      This change uses a global buffer for the client backlog, with each
      client tracking its current position in this buffer. We just make this
      fixed-size, rather than trying to dynamically allocate.
      
      Change-Id: I20bd0772c95d8237677108c7a62d9ec6ff8ed35d
      Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
      5708dfb2
    • Jeremy Kerr's avatar
      socket-handler: don't disconnect on slow client writes · 848fc877
      Jeremy Kerr authored
      If a socket client is slow to receive data from the console server, we
      start filling a buffer. Currently, if we have more data to send and the
      buffer is full, we disconnect the client.
      
      Instead, this change will start performing blocking writes to the client
      if the buffer becomes full. This means we'll rate-limit the console data
      (including reads from the tty device) instead of disconnecting. This
      gives us a little flow control of tty data.
      
      Fixes openbmc/obmc-console#9 .
      
      Change-Id: Icf8ff7246f9ba776ff6fd76a25156ddd89d271d9
      Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
      848fc877
  18. 17 Jan, 2017 3 commits
  19. 11 Nov, 2016 1 commit
  20. 24 Oct, 2016 1 commit
  21. 27 Sep, 2016 2 commits
  22. 31 Aug, 2016 1 commit
    • Joel Stanley's avatar
      console-server: include poll.h · 87e344cd
      Joel Stanley authored
      musl freaks out when including sys/poll.h, so include poll.h directly.
      
      arm-linux-musleabi/sysroot/usr/include/sys/poll.h:1:2:
      error: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Werror=cpp]
       #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
        ^~~~~~~
      
      Change-Id: Iad13ba2af242ab0708b327e68668a8739f555a1f
      Signed-off-by: default avatarJoel Stanley <joel@jms.id.au>
      87e344cd
  23. 29 Jul, 2016 1 commit
    • Vishwanatha Subbanna's avatar
      Supply Serial port as an optional argument to obmc-console-server · 6221ce94
      Vishwanatha Subbanna authored
      obmc-console-server is a serial console server that currently uses
      ttyS5 on the BMC and this is configured in obmc-console.conf.
      
      This patch introduced a new parameter so that tty port can be specified
      while starting the server. When this parameter is passed, it overrides
      the TTY that has been given in the configuration file.
      
      This feature is being added to support systemd template unit files.
      
      We would write a 'obmc-console@.service' file and then start
      'obmc-console@ttyS5' and the part after the @ becomes a parameter to the unit
      that can be passed along. This is only "useful" if we have somewhere to pass it
      to.
      
      One aspect of the template unit, which is appropriate to this issue, is that the
      template parameter can be used as a dependency, so we can ensure the service
      obmc-console@%s will not start unless /dev/%s is present.
      
      Below are the advantages of this approach:
      
      	1. We can use systemd template unit files as intended without hard-coding the
      	   dev-entry.
      
      	2. It gets us very close to being able to handle multiple host consoles for a
      	   blade-chassis style system.
      
      	3. It allows us to easily map a [virtual] physical UART in QEMU to the
      	   obmc-console application for test purposes.
      
      Change-Id: I6599a2572e2db996fba9a19a3d65ff502d550114
      Signed-off-by: default avatarVishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
      6221ce94
  24. 28 Apr, 2016 1 commit