1. 17 2月, 2018 6 次提交
    • J
      tipc: collapse subscription creation functions · 242e82cc
      Jon Maloy 提交于
      After the previous changes it becomes logical to collapse the two-level
      creation of subscription instances into one. We do that here.
      
      We also rename the creation and deletion functions for more consistency.
      Acked-by: NYing Xue <ying.xue@windriver.com>
      Signed-off-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      242e82cc
    • J
      tipc: simplify endianness handling in topology subscriber · 8985ecc7
      Jon Maloy 提交于
      Because of the requirement for total distribution transparency, users
      send subscriptions and receive topology events in their own host format.
      It is up to the topology server to determine this format and do the
      correct conversions to and from its own host format when needed.
      
      Until now, this has been handled in a rather non-transparent way inside
      the topology server and subscriber code, leading to unnecessary
      complexity when creating subscriptions and issuing events.
      
      We now improve this situation by adding two new macros, tipc_sub_read()
      and tipc_evt_write(). Both those functions calculate the need for
      conversion internally before performing their respective operations.
      Hence, all handling of such conversions become transparent to the rest
      of the code.
      Acked-by: NYing Xue <ying.xue@windriver.com>
      Signed-off-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8985ecc7
    • J
      tipc: simplify interaction between subscription and topology connection · 414574a0
      Jon Maloy 提交于
      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: NYing Xue <ying.xue@windriver.com>
      Signed-off-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      414574a0
    • J
      tipc: eliminate struct tipc_subscriber · df79d040
      Jon Maloy 提交于
      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: NYing Xue <ying.xue@windriver.com>
      Signed-off-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      df79d040
    • J
      tipc: remove unnecessary function pointers · c901d26d
      Jon Maloy 提交于
      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: NYing Xue <ying.xue@windriver.com>
      Signed-off-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c901d26d
    • J
      tipc: remove redundant code in topology server · 27469b73
      Jon Maloy 提交于
      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: NYing Xue <ying.xue@windriver.com>
      Signed-off-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      27469b73
  2. 16 2月, 2018 15 次提交
  3. 15 2月, 2018 19 次提交