1. 10 12月, 2013 1 次提交
    • E
      tipc: remove interface state mirroring in bearer · 512137ee
      Erik Hugne 提交于
      struct 'tipc_bearer' is a generic representation of the underlying
      media type, and exists in a one-to-one relationship to each interface
      TIPC is using. The struct contains a 'blocked' flag that mirrors the
      operational and execution state of the represented interface, and is
      updated through notification calls from the latter. The users of
      tipc_bearer are checking this flag before each attempt to send a
      packet via the interface.
      
      This state mirroring serves no purpose in the current code base. TIPC
      links will not discover a media failure any faster through this
      mechanism, and in reality the flag only adds overhead at packet
      sending and reception.
      
      Furthermore, the fact that the flag needs to be protected by a spinlock
      aggregated into tipc_bearer has turned out to cause a serious and
      completely unnecessary deadlock problem.
      
      CPU0                                    CPU1
      ----                                    ----
      Time 0: bearer_disable()                link_timeout()
      Time 1:   spin_lock_bh(&b_ptr->lock)      tipc_link_push_queue()
      Time 2:   tipc_link_delete()                tipc_bearer_blocked(b_ptr)
      Time 3:     k_cancel_timer(&req->timer)       spin_lock_bh(&b_ptr->lock)
      Time 4:       del_timer_sync(&req->timer)
      
      I.e., del_timer_sync() on CPU0 never returns, because the timer handler
      on CPU1 is waiting for the bearer lock.
      
      We eliminate the 'blocked' flag from struct tipc_bearer, along with all
      tests on this flag. This not only resolves the deadlock, but also
      simplifies and speeds up the data path execution of TIPC. It also fits
      well into our ongoing effort to make the locking policy simpler and
      more manageable.
      
      An effect of this change is that we can get rid of functions such as
      tipc_bearer_blocked(), tipc_continue() and tipc_block_bearer().
      We replace the latter with a new function, tipc_reset_bearer(), which
      resets all links associated to the bearer immediately after an
      interface goes down.
      
      A user might notice one slight change in link behaviour after this
      change. When an interface goes down, (e.g. through a NETDEV_DOWN
      event) all attached links will be reset immediately, instead of
      leaving it to each link to detect the failure through a timer-driven
      mechanism. We consider this an improvement, and see no obvious risks
      with the new behavior.
      Signed-off-by: NErik Hugne <erik.hugne@ericsson.com>
      Reviewed-by: NYing Xue <ying.xue@windriver.com>
      Reviewed-by: NPaul Gortmaker <Paul.Gortmaker@windriver.com>
      Signed-off-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      512137ee
  2. 19 10月, 2013 2 次提交
  3. 18 4月, 2013 3 次提交
    • P
      tipc: add InfiniBand media type · a29a194a
      Patrick McHardy 提交于
      Add InfiniBand media type based on the ethernet media type.
      
      The only real difference is that in case of InfiniBand, we need the entire
      20 bytes of space reserved for media addresses, so the TIPC media type ID is
      not explicitly stored in the packet payload.
      
      Sample output of tipc-config:
      
      # tipc-config -v -addr -netid -nt=all -p -m -b -n -ls
      
      node address: <10.1.4>
      current network id: 4711
      Type       Lower      Upper      Port Identity              Publication Scope
      0          167776257  167776257  <10.1.1:1855512577>        1855512578  cluster
                 167776260  167776260  <10.1.4:1216454657>        1216454658  zone
      1          1          1          <10.1.4:1216479235>        1216479236  node
      Ports:
      1216479235: bound to {1,1}
      1216454657: bound to {0,167776260}
      Media:
      eth
      ib
      Bearers:
      ib:ib0
      Nodes known:
      <10.1.1>: up
      Link <broadcast-link>
        Window:20 packets
        RX packets:0 fragments:0/0 bundles:0/0
        TX packets:0 fragments:0/0 bundles:0/0
        RX naks:0 defs:0 dups:0
        TX naks:0 acks:0 dups:0
        Congestion bearer:0 link:0  Send queue max:0 avg:0
      
      Link <10.1.4:ib0-10.1.1:ib0>
        ACTIVE  MTU:2044  Priority:10  Tolerance:1500 ms  Window:50 packets
        RX packets:80 fragments:0/0 bundles:0/0
        TX packets:40 fragments:0/0 bundles:0/0
        TX profile sample:22 packets  average:54 octets
        0-64:100% -256:0% -1024:0% -4096:0% -16384:0% -32768:0% -66000:0%
        RX states:410 probes:213 naks:0 defs:0 dups:0
        TX states:410 probes:197 naks:0 acks:0 dups:0
        Congestion bearer:0 link:0  Send queue max:1 avg:0
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a29a194a
    • P
      tipc: move bcast_addr from struct tipc_media to struct tipc_bearer · 8aeb89f2
      Patrick McHardy 提交于
      Some network protocols, like InfiniBand, don't have a fixed broadcast
      address but one that depends on the configuration. Move the bcast_addr
      to struct tipc_bearer and initialize it with the broadcast address of
      the network device when the bearer is enabled.
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8aeb89f2
    • P
      ccc4ba2e
  4. 22 11月, 2012 1 次提交
    • Y
      tipc: remove the bearer congestion mechanism · 3c294cb3
      Ying Xue 提交于
      Currently at the TIPC bearer layer there is the following congestion
      mechanism:
      
      Once sending packets has failed via that bearer, the bearer will be
      flagged as being in congested state at once. During bearer congestion,
      all packets arriving at link will be queued on the link's outgoing
      buffer.  When we detect that the state of bearer congestion has
      relaxed (e.g. some packets are received from the bearer) we will try
      our best to push all packets in the link's outgoing buffer until the
      buffer is empty, or until the bearer is congested again.
      
      However, in fact the TIPC bearer never receives any feedback from the
      device layer whether a send was successful or not, so it must always
      assume it was successful. Therefore, the bearer congestion mechanism
      as it exists currently is of no value.
      
      But the bearer blocking state is still useful for us. For example,
      when the physical media goes down/up, we need to change the state of
      the links bound to the bearer.  So the code maintaing the state
      information is not removed.
      Signed-off-by: NYing Xue <ying.xue@windriver.com>
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      3c294cb3
  5. 14 7月, 2012 1 次提交
    • E
      tipc: phase out most of the struct print_buf usage · dc1aed37
      Erik Hugne 提交于
      The tipc_printf is renamed to tipc_snprintf, as the new name
      describes more what the function actually does.  It is also
      changed to take a buffer and length parameter and return
      number of characters written to the buffer.  All callers of
      this function that used to pass a print_buf are updated.
      
      Final removal of the struct print_buf itself will be done
      synchronously with the pending removal of the deprecated
      logging code that also was using it.
      
      Functions that build up a response message with a list of
      ports, nametable contents etc. are changed to return the number
      of characters written to the output buffer. This information
      was previously hidden in a field of the print_buf struct, and
      the number of chars written was fetched with a call to
      tipc_printbuf_validate.  This function is removed since it
      is no longer referenced nor needed.
      
      A generic max size ULTRA_STRING_MAX_LEN is defined, named
      in keeping with the existing TIPC_TLV_ULTRA_STRING, and the
      various definitions in port, link and nametable code that
      largely duplicated this information are removed.  This means
      that amount of link statistics that can be returned is now
      increased from 2k to 32k.
      
      The buffer overflow check is now done just before the reply
      message is passed over netlink or TIPC to a remote node and
      the message indicating a truncated buffer is changed to a less
      dramatic one (less CAPS), placed at the end of the message.
      Signed-off-by: NErik Hugne <erik.hugne@ericsson.com>
      Signed-off-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      dc1aed37
  6. 11 7月, 2012 1 次提交
  7. 01 5月, 2012 1 次提交
    • P
      tipc: compress out gratuitous extra carriage returns · 617d3c7a
      Paul Gortmaker 提交于
      Some of the comment blocks are floating in limbo between two
      functions, or between blocks of code.  Delete the extra line
      feeds between any comment and its associated following block
      of code, to be consistent with the majority of the rest of
      the kernel.  Also delete trailing newlines at EOF and fix
      a couple trivial typos in existing comments.
      
      This is a 100% cosmetic change with no runtime impact.  We get
      rid of over 500 lines of non-code, and being blank line deletes,
      they won't even show up as noise in git blame.
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      617d3c7a
  8. 30 12月, 2011 3 次提交
  9. 28 12月, 2011 5 次提交
  10. 18 9月, 2011 1 次提交
  11. 25 6月, 2011 1 次提交
  12. 14 3月, 2011 3 次提交
  13. 24 2月, 2011 1 次提交
    • A
      tipc: Combine bearer structure with tipc_bearer structure · 2d627b92
      Allan Stephens 提交于
      Combines two distinct structures containing information about a TIPC bearer
      into a single structure. The structures were previously kept separate so
      that public information about a bearer could be made available to plug-in
      media types using TIPC's native API, while the remaining information was
      kept private for use by TIPC itself. However, now that the native API has
      been removed there is no longer any need for this arrangement.
      
      Since one of the structures was already embedded within the other, the
      change largely involves replacing instances of "publ.foo" with "foo".
      The changes do not otherwise alter the operation of TIPC bearers.
      Signed-off-by: NAllan Stephens <Allan.Stephens@windriver.com>
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      2d627b92
  14. 03 12月, 2010 3 次提交
  15. 13 5月, 2010 1 次提交
  16. 04 3月, 2010 1 次提交
    • N
      tipc: Fix oops on send prior to entering networked mode (v3) · d0021b25
      Neil Horman 提交于
      Fix TIPC to disallow sending to remote addresses prior to entering NET_MODE
      
      user programs can oops the kernel by sending datagrams via AF_TIPC prior to
      entering networked mode.  The following backtrace has been observed:
      
      ID: 13459  TASK: ffff810014640040  CPU: 0   COMMAND: "tipc-client"
      [exception RIP: tipc_node_select_next_hop+90]
      RIP: ffffffff8869d3c3  RSP: ffff81002d9a5ab8  RFLAGS: 00010202
      RAX: 0000000000000001  RBX: 0000000000000001  RCX: 0000000000000001
      RDX: 0000000000000000  RSI: 0000000000000001  RDI: 0000000001001001
      RBP: 0000000001001001   R8: 0074736575716552   R9: 0000000000000000
      R10: ffff81003fbd0680  R11: 00000000000000c8  R12: 0000000000000008
      R13: 0000000000000001  R14: 0000000000000001  R15: ffff810015c6ca00
      ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
      RIP: 0000003cbd8d49a3  RSP: 00007fffc84e0be8  RFLAGS: 00010206
      RAX: 000000000000002c  RBX: ffffffff8005d116  RCX: 0000000000000000
      RDX: 0000000000000008  RSI: 00007fffc84e0c00  RDI: 0000000000000003
      RBP: 0000000000000000   R8: 00007fffc84e0c10   R9: 0000000000000010
      R10: 0000000000000000  R11: 0000000000000246  R12: 0000000000000000
      R13: 00007fffc84e0d10  R14: 0000000000000000  R15: 00007fffc84e0c30
      ORIG_RAX: 000000000000002c  CS: 0033  SS: 002b
      
      What happens is that, when the tipc module in inserted it enters a standalone
      node mode in which communication to its own address is allowed <0.0.0> but not
      to other addresses, since the appropriate data structures have not been
      allocated yet (specifically the tipc_net pointer).  There is nothing stopping a
      client from trying to send such a message however, and if that happens, we
      attempt to dereference tipc_net.zones while the pointer is still NULL, and
      explode.  The fix is pretty straightforward.  Since these oopses all arise from
      the dereference of global pointers prior to their assignment to allocated
      values, and since these allocations are small (about 2k total), lets convert
      these pointers to static arrays of the appropriate size.  All the accesses to
      these bits consider 0/NULL to be a non match when searching, so all the lookups
      still work properly, and there is no longer a chance of a bad dererence
      anywhere.  As a bonus, this lets us eliminate the setup/teardown routines for
      those pointers, and elimnates the need to preform any locking around them to
      prevent access while their being allocated/freed.
      
      I've updated the tipc_net structure to behave this way to fix the exact reported
      problem, and also fixed up the tipc_bearers and media_list arrays to fix an
      obvious simmilar problem that arises from issuing tipc-config commands to
      manipulate bearers/links prior to entering networked mode
      
      I've tested this for a few hours by running the sanity tests and stress test
      with the tipcutils suite, and nothing has fallen over.  There have been a few
      lockdep warnings, but those were there before, and can be addressed later, as
      they didn't actually result in any deadlock.
      Signed-off-by: NNeil Horman <nhorman@tuxdriver.com>
      CC: Allan Stephens <allan.stephens@windriver.com>
      CC: David S. Miller <davem@davemloft.net>
      CC: tipc-discussion@lists.sourceforge.net
      
       bearer.c |   37 ++++++-------------------------------
       bearer.h |    2 +-
       net.c    |   25 ++++---------------------
       3 files changed, 11 insertions(+), 53 deletions(-)
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d0021b25
  17. 03 9月, 2008 1 次提交
  18. 11 2月, 2007 1 次提交
  19. 18 1月, 2006 2 次提交
  20. 13 1月, 2006 4 次提交