1. 16 Feb, 2018 4 commits
    • Jon Maloy's avatar
      tipc: simplify interaction between subscription and topology connection · 414574a0
      Jon Maloy authored
      The message transmission and reception in the topology server is more
      generic than is currently necessary. By basing the funtionality on the
      fact that we only send items of type struct tipc_event and always
      receive items of struct tipc_subcr we can make several simplifications,
      and also get rid of some unnecessary dynamic memory allocations.
      Acked-by: default avatarYing Xue <ying.xue@windriver.com>
      Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      414574a0
    • Jon Maloy's avatar
      tipc: eliminate struct tipc_subscriber · df79d040
      Jon Maloy authored
      It is unnecessary to keep two structures, struct tipc_conn and struct
      tipc_subscriber, with a one-to-one relationship and still with different
      life cycles. The fact that the two often run in different contexts, and
      still may access each other via direct pointers constitutes an additional
      hazard, something we have experienced at several occasions, and still
      see happening.
      
      We have identified at least two remaining problems that are easier to
      fix if we simplify the topology server data structure somewhat.
      
      - When there is a race between a subscription up/down event and a
        timeout event, it is fully possible that the former might be delivered
        after the latter, leading to confusion for the receiver.
      
      - The function tipc_subcrp_timeout() is executing in interrupt context,
        while the following call chain is at least theoretically possible:
        tipc_subscrp_timeout()
          tipc_subscrp_send_event()
            tipc_conn_sendmsg()
              conn_put()
                tipc_conn_kref_release()
                  sock_release(sock)
      
      I.e., we end up calling a function that might try to sleep in
      interrupt context. To eliminate this, we need to ensure that the
      tipc_conn structure and the socket, as well as the subscription
      instances, only are deleted in work queue context, i.e., after the
      timeout event really has been sent out.
      
      We now remove this unnecessary complexity, by merging data and
      functionality of the subscriber structure into struct tipc_conn
      and the associated file server.c. We thereafter add a spinlock and
      a new 'inactive' state to the subscription structure. Using those,
      both problems described above can be easily solved.
      Acked-by: default avatarYing Xue <ying.xue@windriver.com>
      Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      df79d040
    • Jon Maloy's avatar
      tipc: remove unnecessary function pointers · c901d26d
      Jon Maloy authored
      Interaction between the functionality in server.c and subscr.c is
      done via function pointers installed in struct server. This makes
      the code harder to follow, and doesn't serve any obvious purpose.
      
      Here, we replace the function pointers with direct function calls.
      Acked-by: default avatarYing Xue <ying.xue@windriver.com>
      Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c901d26d
    • Jon Maloy's avatar
      tipc: remove redundant code in topology server · 27469b73
      Jon Maloy authored
      The socket handling in the topology server is unnecessarily generic.
      It is prepared to handle both SOCK_RDM, SOCK_DGRAM and SOCK_STREAM
      type sockets, as well as the only socket type which is really used,
      SOCK_SEQPACKET.
      
      We now remove this redundant code to make the code more readable.
      Acked-by: default avatarYing Xue <ying.xue@windriver.com>
      Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      27469b73
  2. 15 Feb, 2018 15 commits
  3. 14 Feb, 2018 21 commits