1. 17 6月, 2022 1 次提交
  2. 23 2月, 2022 1 次提交
  3. 04 6月, 2021 1 次提交
    • J
      tipc: simplify handling of lookup scope during multicast message reception · 5ef21325
      Jon Maloy 提交于
      We introduce a new macro TIPC_ANY_SCOPE to make the handling of the
      lookup scope value more comprehensible during multicast reception.
      
      The (unchanged) rules go as follows:
      
      1) Multicast messages sent from own node are delivered to all matching
         sockets on the own node, irrespective of their binding scope.
      
      2) Multicast messages sent from other nodes arrive here because they
         have found TIPC_CLUSTER_SCOPE bindings emanating from this node.
         Those messages should be delivered to exactly those sockets, but not
         to local sockets bound with TIPC_NODE_SCOPE, since the latter
         obviously were not meant to be visible for those senders.
      
      3) Group multicast/broadcast messages are delivered to the sockets with
         a binding scope matching exactly the lookup scope indicated in the
         message header, and nobody else.
      Reviewed-by: NXin Long <lucien.xin@gmail.com>
      Tested-by: NHoang Le <hoang.h.le@dektech.com.au>
      Signed-off-by: NJon Maloy <jmaloy@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5ef21325
  4. 09 4月, 2021 1 次提交
  5. 06 4月, 2021 1 次提交
  6. 18 3月, 2021 15 次提交
  7. 02 12月, 2020 2 次提交
    • R
      net/tipc: fix name_table.c kernel-doc · 5c5d6796
      Randy Dunlap 提交于
      Fix name_table.c kernel-doc warnings in preparation for adding to the
      networking docbook.
      
      ../net/tipc/name_table.c:115: warning: Function parameter or member 'start' not described in 'service_range_foreach_match'
      ../net/tipc/name_table.c:115: warning: Function parameter or member 'end' not described in 'service_range_foreach_match'
      ../net/tipc/name_table.c:127: warning: Function parameter or member 'start' not described in 'service_range_match_first'
      ../net/tipc/name_table.c:127: warning: Function parameter or member 'end' not described in 'service_range_match_first'
      ../net/tipc/name_table.c:176: warning: Function parameter or member 'start' not described in 'service_range_match_next'
      ../net/tipc/name_table.c:176: warning: Function parameter or member 'end' not described in 'service_range_match_next'
      ../net/tipc/name_table.c:225: warning: Function parameter or member 'type' not described in 'tipc_publ_create'
      ../net/tipc/name_table.c:225: warning: Function parameter or member 'lower' not described in 'tipc_publ_create'
      ../net/tipc/name_table.c:225: warning: Function parameter or member 'upper' not described in 'tipc_publ_create'
      ../net/tipc/name_table.c:225: warning: Function parameter or member 'scope' not described in 'tipc_publ_create'
      ../net/tipc/name_table.c:225: warning: Function parameter or member 'node' not described in 'tipc_publ_create'
      ../net/tipc/name_table.c:225: warning: Function parameter or member 'port' not described in 'tipc_publ_create'
      ../net/tipc/name_table.c:225: warning: Function parameter or member 'key' not described in 'tipc_publ_create'
      ../net/tipc/name_table.c:252: warning: Function parameter or member 'type' not described in 'tipc_service_create'
      ../net/tipc/name_table.c:252: warning: Function parameter or member 'hd' not described in 'tipc_service_create'
      ../net/tipc/name_table.c:367: warning: Function parameter or member 'sr' not described in 'tipc_service_remove_publ'
      ../net/tipc/name_table.c:367: warning: Function parameter or member 'node' not described in 'tipc_service_remove_publ'
      ../net/tipc/name_table.c:367: warning: Function parameter or member 'key' not described in 'tipc_service_remove_publ'
      ../net/tipc/name_table.c:383: warning: Function parameter or member 'pa' not described in 'publication_after'
      ../net/tipc/name_table.c:383: warning: Function parameter or member 'pb' not described in 'publication_after'
      ../net/tipc/name_table.c:401: warning: Function parameter or member 'service' not described in 'tipc_service_subscribe'
      ../net/tipc/name_table.c:401: warning: Function parameter or member 'sub' not described in 'tipc_service_subscribe'
      ../net/tipc/name_table.c:546: warning: Function parameter or member 'net' not described in 'tipc_nametbl_translate'
      ../net/tipc/name_table.c:546: warning: Function parameter or member 'type' not described in 'tipc_nametbl_translate'
      ../net/tipc/name_table.c:546: warning: Function parameter or member 'instance' not described in 'tipc_nametbl_translate'
      ../net/tipc/name_table.c:546: warning: Function parameter or member 'dnode' not described in 'tipc_nametbl_translate'
      ../net/tipc/name_table.c:762: warning: Function parameter or member 'net' not described in 'tipc_nametbl_withdraw'
      ../net/tipc/name_table.c:762: warning: Function parameter or member 'type' not described in 'tipc_nametbl_withdraw'
      ../net/tipc/name_table.c:762: warning: Function parameter or member 'lower' not described in 'tipc_nametbl_withdraw'
      ../net/tipc/name_table.c:762: warning: Function parameter or member 'upper' not described in 'tipc_nametbl_withdraw'
      ../net/tipc/name_table.c:762: warning: Function parameter or member 'key' not described in 'tipc_nametbl_withdraw'
      ../net/tipc/name_table.c:796: warning: Function parameter or member 'sub' not described in 'tipc_nametbl_subscribe'
      ../net/tipc/name_table.c:826: warning: Function parameter or member 'sub' not described in 'tipc_nametbl_unsubscribe'
      ../net/tipc/name_table.c:876: warning: Function parameter or member 'net' not described in 'tipc_service_delete'
      ../net/tipc/name_table.c:876: warning: Function parameter or member 'sc' not described in 'tipc_service_delete'
      Signed-off-by: NRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      5c5d6796
    • R
      net/tipc: fix various kernel-doc warnings · 5fcb7d47
      Randy Dunlap 提交于
      kernel-doc and Sphinx fixes to eliminate lots of warnings
      in preparation for adding to the networking docbook.
      
      ../net/tipc/crypto.c:57: warning: cannot understand function prototype: 'enum '
      ../net/tipc/crypto.c:69: warning: cannot understand function prototype: 'enum '
      ../net/tipc/crypto.c:130: warning: Function parameter or member 'tfm' not described in 'tipc_tfm'
      ../net/tipc/crypto.c:130: warning: Function parameter or member 'list' not described in 'tipc_tfm'
      ../net/tipc/crypto.c:172: warning: Function parameter or member 'stat' not described in 'tipc_crypto_stats'
      ../net/tipc/crypto.c:232: warning: Function parameter or member 'flags' not described in 'tipc_crypto'
      ../net/tipc/crypto.c:329: warning: Function parameter or member 'ukey' not described in 'tipc_aead_key_validate'
      ../net/tipc/crypto.c:329: warning: Function parameter or member 'info' not described in 'tipc_aead_key_validate'
      ../net/tipc/crypto.c:482: warning: Function parameter or member 'aead' not described in 'tipc_aead_tfm_next'
      ../net/tipc/trace.c:43: warning: cannot understand function prototype: 'unsigned long sysctl_tipc_sk_filter[5] __read_mostly = '
      
      Documentation/networking/tipc:57: ../net/tipc/msg.c:584: WARNING: Unexpected indentation.
      Documentation/networking/tipc:63: ../net/tipc/name_table.c:536: WARNING: Unexpected indentation.
      Documentation/networking/tipc:63: ../net/tipc/name_table.c:537: WARNING: Block quote ends without a blank line; unexpected unindent.
      Documentation/networking/tipc:78: ../net/tipc/socket.c:3809: WARNING: Unexpected indentation.
      Documentation/networking/tipc:78: ../net/tipc/socket.c:3807: WARNING: Inline strong start-string without end-string.
      Documentation/networking/tipc:72: ../net/tipc/node.c:904: WARNING: Unexpected indentation.
      Documentation/networking/tipc:39: ../net/tipc/crypto.c:97: WARNING: Block quote ends without a blank line; unexpected unindent.
      Documentation/networking/tipc:39: ../net/tipc/crypto.c:98: WARNING: Block quote ends without a blank line; unexpected unindent.
      Documentation/networking/tipc:39: ../net/tipc/crypto.c:141: WARNING: Inline strong start-string without end-string.
      
      ../net/tipc/discover.c:82: warning: Function parameter or member 'skb' not described in 'tipc_disc_init_msg'
      
      ../net/tipc/msg.c:69: warning: Function parameter or member 'gfp' not described in 'tipc_buf_acquire'
      ../net/tipc/msg.c:382: warning: Function parameter or member 'offset' not described in 'tipc_msg_build'
      ../net/tipc/msg.c:708: warning: Function parameter or member 'net' not described in 'tipc_msg_lookup_dest'
      
      ../net/tipc/subscr.c:65: warning: Function parameter or member 'seq' not described in 'tipc_sub_check_overlap'
      ../net/tipc/subscr.c:65: warning: Function parameter or member 'found_lower' not described in 'tipc_sub_check_overlap'
      ../net/tipc/subscr.c:65: warning: Function parameter or member 'found_upper' not described in 'tipc_sub_check_overlap'
      
      ../net/tipc/udp_media.c:75: warning: Function parameter or member 'proto' not described in 'udp_media_addr'
      ../net/tipc/udp_media.c:75: warning: Function parameter or member 'port' not described in 'udp_media_addr'
      ../net/tipc/udp_media.c:75: warning: Function parameter or member 'ipv4' not described in 'udp_media_addr'
      ../net/tipc/udp_media.c:75: warning: Function parameter or member 'ipv6' not described in 'udp_media_addr'
      ../net/tipc/udp_media.c:98: warning: Function parameter or member 'rcast' not described in 'udp_bearer'
      
      Also fixed a typo of "duest" to "dest".
      Signed-off-by: NRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      5fcb7d47
  8. 28 11月, 2020 1 次提交
  9. 17 6月, 2020 1 次提交
    • H
      tipc: update a binding service via broadcast · cad2929d
      Hoang Huu Le 提交于
      Currently, updating binding table (add service binding to
      name table/withdraw a service binding) is being sent over replicast.
      However, if we are scaling up clusters to > 100 nodes/containers this
      method is less affection because of looping through nodes in a cluster one
      by one.
      
      It is worth to use broadcast to update a binding service. This way, the
      binding table can be updated on all peer nodes in one shot.
      
      Broadcast is used when all peer nodes, as indicated by a new capability
      flag TIPC_NAMED_BCAST, support reception of this message type.
      
      Four problems need to be considered when introducing this feature.
      1) When establishing a link to a new peer node we still update this by a
      unicast 'bulk' update. This may lead to race conditions, where a later
      broadcast publication/withdrawal bypass the 'bulk', resulting in
      disordered publications, or even that a withdrawal may arrive before the
      corresponding publication. We solve this by adding an 'is_last_bulk' bit
      in the last bulk messages so that it can be distinguished from all other
      messages. Only when this message has arrived do we open up for reception
      of broadcast publications/withdrawals.
      
      2) When a first legacy node is added to the cluster all distribution
      will switch over to use the legacy 'replicast' method, while the
      opposite happens when the last legacy node leaves the cluster. This
      entails another risk of message disordering that has to be handled. We
      solve this by adding a sequence number to the broadcast/replicast
      messages, so that disordering can be discovered and corrected. Note
      however that we don't need to consider potential message loss or
      duplication at this protocol level.
      
      3) Bulk messages don't contain any sequence numbers, and will always
      arrive in order. Hence we must exempt those from the sequence number
      control and deliver them unconditionally. We solve this by adding a new
      'is_bulk' bit in those messages so that they can be recognized.
      
      4) Legacy messages, which don't contain any new bits or sequence
      numbers, but neither can arrive out of order, also need to be exempt
      from the initial synchronization and sequence number check, and
      delivered unconditionally. Therefore, we add another 'is_not_legacy' bit
      to all new messages so that those can be distinguished from legacy
      messages and the latter delivered directly.
      
      v1->v2:
       - fix warning issue reported by kbuild test robot <lkp@intel.com>
       - add santiy check to drop the publication message with a sequence
      number that is lower than the agreed synch point
      Signed-off-by: Nkernel test robot <lkp@intel.com>
      Signed-off-by: NHoang Huu Le <hoang.h.le@dektech.com.au>
      Acked-by: NJon Maloy <jmaloy@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      cad2929d
  10. 11 12月, 2019 1 次提交
    • T
      tipc: fix name table rbtree issues · d5162f34
      Tuong Lien 提交于
      The current rbtree for service ranges in the name table is built based
      on the 'lower' & 'upper' range values resulting in a flaw in the rbtree
      searching. Some issues have been observed in case of range overlapping:
      
      Case #1: unable to withdraw a name entry:
      After some name services are bound, all of them are withdrawn by user
      but one remains in the name table forever. This corrupts the table and
      that service becomes dummy i.e. no real port.
      E.g.
      
                      /
                 {22, 22}
                    /
                   /
         --->  {10, 50}
                 /  \
                /    \
          {10, 30}  {20, 60}
      
      The node {10, 30} cannot be removed since the rbtree searching stops at
      the node's ancestor i.e. {10, 50}, so starting from it will never reach
      the finding node.
      
      Case #2: failed to send data in some cases:
      E.g. Two service ranges: {20, 60}, {10, 50} are bound. The rbtree for
      this service will be one of the two cases below depending on the order
      of the bindings:
      
              {20, 60}             {10, 50} <--
                /  \                 /  \
               /    \               /    \
          {10, 50}  NIL <--       NIL  {20, 60}
      
                (a)                    (b)
      
      Now, try to send some data to service {30}, there will be two results:
      (a): Failed, no route to host.
      (b): Ok.
      
      The reason is that the rbtree searching will stop at the pointing node
      as shown above.
      
      Case #3: Same as case #2b above but if the data sending's scope is
      local and the {10, 50} is published by a peer node, then it will result
      in 'no route to host' even though the other {20, 60} is for example on
      the local node which should be able to get the data.
      
      The issues are actually due to the way we built the rbtree. This commit
      fixes it by introducing an additional field to each node - named 'max',
      which is the largest 'upper' of that node subtree. The 'max' value for
      each subtrees will be propagated correctly whenever a node is inserted/
      removed or the tree is rebalanced by the augmented rbtree callbacks.
      
      By this way, we can change the rbtree searching appoarch to solve the
      issues above. Another benefit from this is that we can now improve the
      searching for a next range matching e.g. in case of multicast, so get
      rid of the unneeded looping over all nodes in the tree.
      Acked-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NTuong Lien <tuong.t.lien@dektech.com.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d5162f34
  11. 23 11月, 2019 1 次提交
    • T
      tipc: support in-order name publication events · 41b416f1
      Tuong Lien 提交于
      It is observed that TIPC service binding order will not be kept in the
      publication event report to user if the service is subscribed after the
      bindings.
      
      For example, services are bound by application in the following order:
      
      Server: bound port A to {18888,66,66} scope 2
      Server: bound port A to {18888,33,33} scope 2
      
      Now, if a client subscribes to the service range (e.g. {18888, 0-100}),
      it will get the 'TIPC_PUBLISHED' events in that binding order only when
      the subscription is started before the bindings.
      Otherwise, if started after the bindings, the events will arrive in the
      opposite order:
      
      Client: received event for published {18888,33,33}
      Client: received event for published {18888,66,66}
      
      For the latter case, it is clear that the bindings have existed in the
      name table already, so when reported, the events' order will follow the
      order of the rbtree binding nodes (- a node with lesser 'lower'/'upper'
      range value will be first).
      
      This is correct as we provide the tracking on a specific service status
      (available or not), not the relationship between multiple services.
      However, some users expect to see the same order of arriving events
      irrespective of when the subscription is issued. This turns out to be
      easy to fix. We now add functionality to ensure that publication events
      always are issued in the same temporal order as the corresponding
      bindings were performed.
      
      v2: replace the unnecessary macro - 'publication_after()' with inline
      function.
      v3: reuse 'time_after32()' instead of reinventing the same exact code.
      Acked-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NTuong Lien <tuong.t.lien@dektech.com.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      41b416f1
  12. 28 4月, 2019 1 次提交
    • M
      netlink: make nla_nest_start() add NLA_F_NESTED flag · ae0be8de
      Michal Kubecek 提交于
      Even if the NLA_F_NESTED flag was introduced more than 11 years ago, most
      netlink based interfaces (including recently added ones) are still not
      setting it in kernel generated messages. Without the flag, message parsers
      not aware of attribute semantics (e.g. wireshark dissector or libmnl's
      mnl_nlmsg_fprintf()) cannot recognize nested attributes and won't display
      the structure of their contents.
      
      Unfortunately we cannot just add the flag everywhere as there may be
      userspace applications which check nlattr::nla_type directly rather than
      through a helper masking out the flags. Therefore the patch renames
      nla_nest_start() to nla_nest_start_noflag() and introduces nla_nest_start()
      as a wrapper adding NLA_F_NESTED. The calls which add NLA_F_NESTED manually
      are rewritten to use nla_nest_start().
      
      Except for changes in include/net/netlink.h, the patch was generated using
      this semantic patch:
      
      @@ expression E1, E2; @@
      -nla_nest_start(E1, E2)
      +nla_nest_start_noflag(E1, E2)
      
      @@ expression E1, E2; @@
      -nla_nest_start_noflag(E1, E2 | NLA_F_NESTED)
      +nla_nest_start(E1, E2)
      Signed-off-by: NMichal Kubecek <mkubecek@suse.cz>
      Acked-by: NJiri Pirko <jiri@mellanox.com>
      Acked-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ae0be8de
  13. 11 4月, 2019 1 次提交
    • H
      tipc: missing entries in name table of publications · d1841533
      Hoang Le 提交于
      When binding multiple services with specific type 1Ki, 2Ki..,
      this leads to some entries in the name table of publications
      missing when listed out via 'tipc name show'.
      
      The problem is at identify zero last_type conditional provided
      via netlink. The first is initial 'type' when starting name table
      dummping. The second is continuously with zero type (node state
      service type). Then, lookup function failure to finding node state
      service type in next iteration.
      
      To solve this, adding more conditional to marked as dirty type and
      lookup correct service type for the next iteration instead of select
      the first service as initial 'type' zero.
      Acked-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NHoang Le <hoang.h.le@dektech.com.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d1841533
  14. 23 10月, 2018 1 次提交
    • J
      tipc: eliminate message disordering during binding table update · 988f3f16
      Jon Maloy 提交于
      We have seen the following race scenario:
      1) named_distribute() builds a "bulk" message, containing a PUBLISH
         item for a certain publication. This is based on the contents of
         the binding tables's 'cluster_scope' list.
      2) tipc_named_withdraw() removes the same publication from the list,
         bulds a WITHDRAW message and distributes it to all cluster nodes.
      3) tipc_named_node_up(), which was calling named_distribute(), sends
         out the bulk message built under 1)
      4) The WITHDRAW message arrives at the just detected node, finds
         no corresponding publication, and is dropped.
      5) The PUBLISH item arrives at the same node, is added to its binding
         table, and remains there forever.
      
      This arrival disordering was earlier taken care of by the backlog queue,
      originally added for a different purpose, which was removed in the
      commit referred to below, but we now need a different solution.
      In this commit, we replace the rcu lock protecting the 'cluster_scope'
      list with a regular RW lock which comprises even the sending of the
      bulk message. This both guarantees both the list integrity and the
      message sending order. We will later add a commit which cleans up
      this code further.
      
      Note that this commit needs recently added commit d3092b2e ("tipc:
      fix unsafe rcu locking when accessing publication list") to apply
      cleanly.
      
      Fixes: 37922ea4 ("tipc: permit overlapping service ranges in name table")
      Reported-by: NTuong Lien Tong <tuong.t.lien@dektech.com.au>
      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>
      988f3f16
  15. 28 8月, 2018 1 次提交
  16. 28 7月, 2018 1 次提交
  17. 11 5月, 2018 1 次提交
  18. 19 4月, 2018 1 次提交
    • J
      tipc: fix use-after-free in tipc_nametbl_stop · be47e41d
      Jon Maloy 提交于
      When we delete a service item in tipc_nametbl_stop() we loop over
      all service ranges in the service's RB tree, and for each service
      range we loop over its pertaining publications while calling
      tipc_service_remove_publ() for each of them.
      
      However, tipc_service_remove_publ() has the side effect that it also
      removes the comprising service range item when there are no publications
      left. This leads to a "use-after-free" access when the inner loop
      continues to the next iteration, since the range item holding the list
      we are looping no longer exists.
      
      We fix this by moving the delete of the service range item outside
      the said function. Instead, we now let the two functions calling it
      test if the list is empty and perform the removal when that is the
      case.
      
      Reported-by: syzbot+d64b64afc55660106556@syzkaller.appspotmail.com
      Signed-off-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      be47e41d
  19. 13 4月, 2018 1 次提交
    • J
      tipc: fix unbalanced reference counter · c3317f4d
      Jon Maloy 提交于
      When a topology subscription is created, we may encounter (or KASAN
      may provoke) a failure to create a corresponding service instance in
      the binding table. Instead of letting the tipc_nametbl_subscribe()
      report the failure back to the caller, the function just makes a warning
      printout and returns, without incrementing the subscription reference
      counter as expected by the caller.
      
      This makes the caller believe that the subscription was successful, so
      it will at a later moment try to unsubscribe the item. This involves
      a sub_put() call. Since the reference counter never was incremented
      in the first place, we get a premature delete of the subscription item,
      followed by a "use-after-free" warning.
      
      We fix this by adding a return value to tipc_nametbl_subscribe() and
      make the caller aware of the failure to subscribe.
      
      This bug seems to always have been around, but this fix only applies
      back to the commit shown below. Given the low risk of this happening
      we believe this to be sufficient.
      
      Fixes: commit 218527fe ("tipc: replace name table service range
      array with rb tree")
      Reported-by: syzbot+aa245f26d42b8305d157@syzkaller.appspotmail.com
      Signed-off-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c3317f4d
  20. 01 4月, 2018 3 次提交
    • J
      tipc: permit overlapping service ranges in name table · 37922ea4
      Jon Maloy 提交于
      With the new RB tree structure for service ranges it becomes possible to
      solve an old problem; - we can now allow overlapping service ranges in
      the table.
      
      When inserting a new service range to the tree, we use 'lower' as primary
      key, and when necessary 'upper' as secondary key.
      
      Since there may now be multiple service ranges matching an indicated
      'lower' value, we must also add the 'upper' value to the functions
      used for removing publications, so that the correct, corresponding
      range item can be found.
      
      These changes guarantee that a well-formed publication/withdrawal item
      from a peer node never will be rejected, and make it possible to
      eliminate the problematic backlog functionality we currently have for
      handling such cases.
      Signed-off-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      37922ea4
    • J
      tipc: refactor name table translate function · f20889f7
      Jon Maloy 提交于
      The function tipc_nametbl_translate() function is ugly and hard to
      follow. This can be improved somewhat by introducing a stack variable
      for holding the publication list to be used and re-ordering the if-
      clauses for selection of algorithm.
      Signed-off-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f20889f7
    • J
      tipc: replace name table service range array with rb tree · 218527fe
      Jon Maloy 提交于
      The current design of the binding table has an unnecessary memory
      consuming and complex data structure. It aggregates the service range
      items into an array, which is expanded by a factor two every time it
      becomes too small to hold a new item. Furthermore, the arrays never
      shrink when the number of ranges diminishes.
      
      We now replace this array with an RB tree that is holding the range
      items as tree nodes, each range directly holding a list of bindings.
      
      This, along with a few name changes, improves both readability and
      volume of the code, as well as reducing memory consumption and hopefully
      improving cache hit rate.
      Signed-off-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      218527fe
  21. 24 3月, 2018 2 次提交
    • J
      tipc: remove direct accesses to own_addr field in struct tipc_net · 23fd3eac
      Jon Maloy 提交于
      As a preparation to changing the addressing structure of TIPC we replace
      all direct accesses to the tipc_net::own_addr field with the function
      dedicated for this, tipc_own_addr().
      
      There are no changes to program logics in this commit.
      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>
      23fd3eac
    • J
      tipc: allow closest-first lookup algorithm when legacy address is configured · b89afb11
      Jon Maloy 提交于
      The removal of an internal structure of the node address has an unwanted
      side effect.
      - Currently, if a user is sending an anycast message with destination
        domain 0, the tipc_namebl_translate() function will use the 'closest-
        first' algorithm to first look for a node local destination, and only
        when no such is found, will it resort to the cluster global 'round-
        robin' lookup algorithm.
      - Current users can get around this, and enforce unconditional use of
        global round-robin by indicating a destination as Z.0.0 or Z.C.0.
      - This option disappears when we make the node address flat, since the
        lookup algorithm has no way of recognizing this case. So, as long as
        there are node local destinations, the algorithm will always select
        one of those, and there is nothing the sender can do to change this.
      
      We solve this by eliminating the 'closest-first' option, which was never
      a good idea anyway, for non-legacy users, but only for those. To
      distinguish between legacy users and non-legacy users we introduce a new
      flag 'legacy_addr_format' in struct tipc_core, to be set when the user
      configures a legacy-style Z.C.N node address. Hence, when a legacy user
      indicates a zero lookup domain 'closest-first' is selected, and in all
      other cases we use 'round-robin'.
      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>
      b89afb11
  22. 18 3月, 2018 1 次提交