1. 10 Mar, 2016 1 commit
    • Arnd Bergmann's avatar
      kcm: mark helper functions inline · f720d0ca
      Arnd Bergmann authored
      The stub helper functions for the newly added kcm_proc_init/exit interfaces
      are defined as 'static' in a header file, which leads to build warnings for
      each file that includes them without calling them:
      
      include/net/kcm.h:183:12: error: 'kcm_proc_init' defined but not used [-Werror=unused-function]
      include/net/kcm.h:184:13: error: 'kcm_proc_exit' defined but not used [-Werror=unused-function]
      
      This marks the two functions as 'static inline' instead, which avoids the
      warnings and is obviously what was meant here.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Fixes: cd6e111b ("kcm: Add statistics and proc interfaces")
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f720d0ca
  2. 09 Mar, 2016 4 commits
    • Tom Herbert's avatar
      kcm: Add receive message timeout · 29152a34
      Tom Herbert authored
      This patch adds receive timeout for message assembly on the attached TCP
      sockets. The timeout is set when a new messages is started and the whole
      message has not been received by TCP (not in the receive queue). If the
      completely message is subsequently received the timer is cancelled, if the
      timer expires the RX side is aborted.
      
      The timeout value is taken from the socket timeout (SO_RCVTIMEO) that is
      set on a TCP socket (i.e. set by get sockopt before attaching a TCP socket
      to KCM.
      Signed-off-by: default avatarTom Herbert <tom@herbertland.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      29152a34
    • Tom Herbert's avatar
      kcm: Add memory limit for receive message construction · 7ced95ef
      Tom Herbert authored
      Message assembly is performed on the TCP socket. This is logically
      equivalent of an application that performs a peek on the socket to find
      out how much memory is needed for a receive buffer. The receive socket
      buffer also provides the maximum message size which is checked.
      
      The receive algorithm is something like:
      
         1) Receive the first skbuf for a message (or skbufs if multiple are
            needed to determine message length).
         2) Check the message length against the number of bytes in the TCP
            receive queue (tcp_inq()).
      	- If all the bytes of the message are in the queue (incluing the
      	  skbuf received), then proceed with message assembly (it should
      	  complete with the tcp_read_sock)
              - Else, mark the psock with the number of bytes needed to
      	  complete the message.
         3) In TCP data ready function, if the psock indicates that we are
            waiting for the rest of the bytes of a messages, check the number
            of queued bytes against that.
              - If there are still not enough bytes for the message, just
      	  return
              - Else, clear the waiting bytes and proceed to receive the
      	  skbufs.  The message should now be received in one
      	  tcp_read_sock
      Signed-off-by: default avatarTom Herbert <tom@herbertland.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7ced95ef
    • Tom Herbert's avatar
      kcm: Add statistics and proc interfaces · cd6e111b
      Tom Herbert authored
      This patch adds various counters for KCM. These include counters for
      messages and bytes received or sent, as well as counters for number of
      attached/unattached TCP sockets and other error or edge events.
      
      The statistics are exposed via a proc interface. /proc/net/kcm provides
      statistics per KCM socket and per psock (attached TCP sockets).
      /proc/net/kcm_stats provides aggregate statistics.
      Signed-off-by: default avatarTom Herbert <tom@herbertland.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cd6e111b
    • Tom Herbert's avatar
      kcm: Kernel Connection Multiplexor module · ab7ac4eb
      Tom Herbert authored
      This module implements the Kernel Connection Multiplexor.
      
      Kernel Connection Multiplexor (KCM) is a facility that provides a
      message based interface over TCP for generic application protocols.
      With KCM an application can efficiently send and receive application
      protocol messages over TCP using datagram sockets.
      
      For more information see the included Documentation/networking/kcm.txt
      Signed-off-by: default avatarTom Herbert <tom@herbertland.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ab7ac4eb