1. 23 Aug, 2014 17 commits
    • Jon Paul Maloy's avatar
      tipc: replace port pointer with socket pointer in registry · 9b50fd08
      Jon Paul Maloy authored
      In order to make tipc_sock the only entity referencable from other
      parts of the stack, we add a tipc_sock pointer instead of a tipc_port
      pointer to the registry. As a consequence, we also let the function
      tipc_port_lock() return a pointer to a tipc_sock instead  of a tipc_port.
      We keep the function's name for now, since the lock still is owned by
      the port.
      
      This is another step in the direction of eliminating port_lock, replacing
      its usage with lock_sock() and bh_lock_sock().
      Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
      Reviewed-by: default avatarErik Hugne <erik.hugne@ericsson.com>
      Reviewed-by: default avatarYing Xue <ying.xue@windriver.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9b50fd08
    • Jon Paul Maloy's avatar
      tipc: use registry when scanning sockets · 5a9ee0be
      Jon Paul Maloy authored
      The functions tipc_port_get_ports() and tipc_port_reinit() scan over
      all sockets/ports to access each of them. This is done by using a
      dedicated linked list, 'tipc_socks' where all sockets are members. The
      list is in turn protected by a spinlock, 'port_list_lock', while each
      socket is locked by using port_lock at the moment of access.
      
      In order to reduce complexity and risk of deadlock, we want to get
      rid of the linked list and the accompanying spinlock.
      
      This is what we do in this commit. Instead of the linked list, we use
      the port registry to scan across the sockets. We also add usage of
      bh_lock_sock() inside the scope of port_lock in both functions, as a
      preparation for the complete removal of port_lock.
      
      Finally, we move the functions from port.c to socket.c, and rename them
      to tipc_sk_sock_show() and tipc_sk_reinit() repectively.
      Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
      Reviewed-by: default avatarErik Hugne <erik.hugne@ericsson.com>
      Reviewed-by: default avatarYing Xue <ying.xue@windriver.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5a9ee0be
    • Jon Paul Maloy's avatar
      tipc: eliminate functions tipc_port_init and tipc_port_destroy · 5b8fa7ce
      Jon Paul Maloy authored
      After the latest changes to the socket/port layer the existence of
      the functions tipc_port_init() and tipc_port_destroy() cannot be
      justified. They are both called only once, from tipc_sk_create() and
      tipc_sk_delete() respectively, and their functionality can better be
      merged into the latter two functions.
      
      This also entails that all remaining references to port_lock now are
      made from inside socket.c, something that will make it easier to remove
      this lock.
      Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
      Reviewed-by: default avatarErik Hugne <erik.hugne@ericsson.com>
      Reviewed-by: default avatarYing Xue <ying.xue@windriver.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5b8fa7ce
    • Jon Paul Maloy's avatar
      tipc: redefine message acknowledge function · 739f5e4e
      Jon Paul Maloy authored
      The function tipc_acknowledge() is a remnant from the obsolete native
      API. Currently, it grabs port_lock, before building an acknowledge
      message and sending it to the peer.
      
      Since all access to socket members now is protected by the socket lock,
      it has become unnecessary to grab port_lock here.
      
      In this commit, we remove the usage of port_lock, simplify the
      function, and move it to socket.c, renaming it to tipc_sk_send_ack().
      Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
      Reviewed-by: default avatarErik Hugne <erik.hugne@ericsson.com>
      Reviewed-by: default avatarYing Xue <ying.xue@windriver.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      739f5e4e
    • Jon Paul Maloy's avatar
      tipc: eliminate port_connect()/port_disconnect() functions · dadebc00
      Jon Paul Maloy authored
      tipc_port_connect()/tipc_port_disconnect() are remnants of the obsolete
      native API. Their only task is to grab port_lock and call the functions
      __tipc_port_connect()/__tipc_port_disconnect() respectively, which will
      perform the actual state change.
      
      Since socket/port exection now is single-threaded the use of port_lock
      is not needed any more, so we can safely replace the two functions with
      their lock-free counterparts.
      
      In this commit, we remove the two functions. Furthermore, the contents
      of __tipc_port_disconnect() is so trivial that we choose to eliminate
      that function too, expanding its functionality into tipc_shutdown().
      __tipc_port_connect() is simplified, moved to socket.c, and given the
      more correct name tipc_sk_finish_conn(). Finally, we eliminate the
      function auto_connect(), and expand its contents into filter_connect().
      Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
      Reviewed-by: default avatarErik Hugne <erik.hugne@ericsson.com>
      Reviewed-by: default avatarYing Xue <ying.xue@windriver.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      dadebc00
    • Jon Paul Maloy's avatar
      tipc: eliminate function tipc_port_shutdown() · 80e44c22
      Jon Paul Maloy authored
      tipc_port_shutdown() is a remnant from the now obsolete native
      interface. As such it grabs port_lock in order to protect itself
      from concurrent BH processing.
      
      However, after the recent changes to the port/socket upcalls, sockets
      are now basically single-threaded, and all execution, except the read-only
      tipc_sk_timer(), is executing within the protection of lock_sock(). So
      the use of port_lock is not needed here.
      
      In this commit we eliminate the whole function, and merge it into its
      only caller, tipc_shutdown().
      Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
      Reviewed-by: default avatarErik Hugne <erik.hugne@ericsson.com>
      Reviewed-by: default avatarYing Xue <ying.xue@windriver.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      80e44c22
    • Jon Paul Maloy's avatar
      tipc: clean up socket timer function · 57289015
      Jon Paul Maloy authored
      The last remaining BH upcall to the socket, apart for the message
      reception function tipc_sk_rcv(), is the timer function.
      
      We prefer to let this function continue executing in BH, since it only
      does read-acces to semi-permanent data, but we make three changes to it:
      
      1) We introduce a bh_lock_sock()/bh_unlock_sock() inside the scope
         of port_lock.  This is a preparation for replacing port_lock with
         bh_lock_sock() at the locations where it is still used.
      
      2) We move the function from port.c to socket.c, as a further step
         of eliminating the port code level altogether.
      
      3) We let it make use of the newly introduced tipc_msg_create()
         function. This enables us to get rid of three context specific
         functions (port_create_self_abort_msg() etc.) in port.c
      Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
      Reviewed-by: default avatarErik Hugne <erik.hugne@ericsson.com>
      Reviewed-by: default avatarYing Xue <ying.xue@windriver.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      57289015
    • Jon Paul Maloy's avatar
      tipc: use message to abort connections when losing contact to node · 02be61a9
      Jon Paul Maloy authored
      In the current implementation, each 'struct tipc_node' instance keeps
      a linked list of those ports/sockets that are connected to the node
      represented by that struct. The purpose of this is to let the node
      object know which sockets to alert when it loses contact with its peer
      node, i.e., which sockets need to have their connections aborted.
      
      This entails an unwanted direct reference from the node structure
      back to the port/socket structure, and a need to grab port_lock
      when we have to make an upcall to the port. We want to get rid of
      this unecessary BH entry point into the socket, and also eliminate
      its use of port_lock.
      
      In this commit, we instead let the node struct keep list of "connected
      socket" structs, which each represents a connected socket, but is
      allocated independently by the node at the moment of connection. If
      the node loses contact with its peer node, the list is traversed, and
      a "connection abort" message is created for each entry in the list. The
      message is sent to it respective connected socket using the ordinary
      data path, and the receiving socket aborts its connections upon reception
      of the message.
      
      This enables us to get rid of the direct reference from 'struct node' to
      ´struct port', and another unwanted BH access point to the latter.
      Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
      Reviewed-by: default avatarErik Hugne <erik.hugne@ericsson.com>
      Reviewed-by: default avatarYing Xue <ying.xue@windriver.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      02be61a9
    • Jon Paul Maloy's avatar
      tipc: use pseudo message to wake up sockets after link congestion · 50100a5e
      Jon Paul Maloy authored
      The current link implementation keeps a linked list of blocked ports/
      sockets that is populated when there is link congestion. The purpose
      of this is to let the link know which users to wake up when the
      congestion abates.
      
      This adds unnecessary complexity to the data structure and the code,
      since it forces us to involve the link each time we want to delete
      a socket. It also forces us to grab the spinlock port_lock within
      the scope of node_lock. We want to get rid of this direct dependence,
      as well as the deadlock hazard resulting from the usage of port_lock.
      
      In this commit, we instead let the link keep list of a "wakeup" pseudo
      messages for use in such situations. Those messages are sent to the
      pending sockets via the ordinary message reception path, and wake up
      the socket's owner when they are received.
      
      This enables us to get rid of the 'waiting_ports' linked lists in struct
      tipc_port that manifest this direct reference. As a consequence, we can
      eliminate another BH entry into the socket, and hence the need to grab
      port_lock. This is a further step in our effort to remove port_lock
      altogether.
      Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
      Reviewed-by: default avatarErik Hugne <erik.hugne@ericsson.com>
      Reviewed-by: default avatarYing Xue <ying.xue@windriver.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      50100a5e
    • Jon Paul Maloy's avatar
      tipc: introduce new function tipc_msg_create() · 1dd0bd2b
      Jon Paul Maloy authored
      The function tipc_msg_init() has turned out to be of limited value
      in many cases. It take too few parameters to be usable for creating
      a complete message, it makes too many assumptions about what the
      message should be used for, and it does not allocate any buffer to
      be returned to the caller.
      
      Therefore, we now introduce the new function tipc_msg_create(), which
      takes all the parameters needed to create a full message, and returns
      a buffer of the requested size. The new function will be very useful
      for the changes we will be doing in later commits in this series.
      Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
      Reviewed-by: default avatarErik Hugne <erik.hugne@ericsson.com>
      Reviewed-by: default avatarYing Xue <ying.xue@windriver.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1dd0bd2b
    • David S. Miller's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · f9474ddf
      David S. Miller authored
      Pulling to get some TIPC fixes that a net-next series depends
      upon.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f9474ddf
    • Yuchung Cheng's avatar
      tcp: improve undo on timeout · 989e04c5
      Yuchung Cheng authored
      Upon timeout, undo (via both timestamps/Eifel and DSACKs) was
      disabled if any retransmits were still in flight.  The concern was
      perhaps that spurious retransmission sent in a previous recovery
      episode may trigger DSACKs to falsely undo the current recovery.
      
      However, this inadvertently misses undo opportunities (using either
      TCP timestamps or DSACKs) when timeout occurs during a loss episode,
      i.e.  recurring timeouts or timeout during fast recovery. In these
      cases some retransmissions will be in flight but we should allow
      undo. Furthermore, we should only reset undo_marker and undo_retrans
      upon timeout if we are starting a new recovery episode. Finally,
      when we do reset our undo state, we now do so in a manner similar
      to tcp_enter_recovery(), so that we require a DSACK for each of
      the outstsanding retransmissions. This will achieve the original
      goal by requiring that we receive the same number of DSACKs as
      retransmissions.
      
      This patch increases the undo events by 50% on Google servers.
      Signed-off-by: default avatarYuchung Cheng <ycheng@google.com>
      Signed-off-by: default avatarNeal Cardwell <ncardwell@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      989e04c5
    • Sergei Shtylyov's avatar
      phylib: use MDIO_DEVS[12] · a7d5f58d
      Sergei Shtylyov authored
      The bare register numbers are used despite <uapi/linux/mdio.h> has MDIO_DEVS[12]
      #define'd for those.
      Signed-off-by: default avatarSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a7d5f58d
    • Eric Dumazet's avatar
      net: remove dead code after sk_data_ready change · 884cf705
      Eric Dumazet authored
      As a followup to commit 676d2369 ("net: Fix use after free by
      removing length arg from sk_data_ready callbacks"), we can remove
      some useless code in sock_queue_rcv_skb() and rxrpc_queue_rcv_skb()
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      884cf705
    • Eric Dumazet's avatar
      net: use ktime_get_ns() and ktime_get_real_ns() helpers · d2de875c
      Eric Dumazet authored
      ktime_get_ns() replaces ktime_to_ns(ktime_get())
      
      ktime_get_real_ns() replaces ktime_to_ns(ktime_get_real())
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d2de875c
    • Gerhard Stenzel's avatar
      vxlan: fix incorrect initializer in union vxlan_addr · a45e92a5
      Gerhard Stenzel authored
      The first initializer in the following
      
              union vxlan_addr ipa = {
                  .sin.sin_addr.s_addr = tip,
                  .sa.sa_family = AF_INET,
              };
      
      is optimised away by the compiler, due to the second initializer,
      therefore initialising .sin.sin_addr.s_addr always to 0.
      This results in netlink messages indicating a L3 miss never contain the
      missed IP address. This was observed with GCC 4.8 and 4.9. I do not know about previous versions.
      The problem affects user space programs relying on an IP address being
      sent as part of a netlink message indicating a L3 miss.
      
      Changing
                  .sa.sa_family = AF_INET,
      to
                  .sin.sin_family = AF_INET,
      fixes the problem.
      Signed-off-by: default avatarGerhard Stenzel <gerhard.stenzel@de.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a45e92a5
    • David S. Miller's avatar
      Merge tag 'linux-can-next-for-3.18-20140820' of git://gitorious.org/linux-can/linux-can-next · 3f8a2b74
      David S. Miller authored
      Marc Kleine-Budde says:
      
      ====================
      pull-request: can-next 2014-08-20
      
      this is a pull request of 10 patches for net-next/master.
      
      There is one patch by Wolfram Sang to clean up the build system.
      Two patches by Stefan Agner that add vf610 support to the flexcan
      driver. Dong Aisheng add support for bosch's m_can core, which is found
      in the new freescale ARM SoCs. Sergei Shtylyov improves the rcar_can
      driver by supporting all input clocks and adding device tree support.
      The next patch is a small cleanup for the bit rate calculation function
      by Lad, Prabhakar. And finally a patch by Himangi Saraogi, which
      converts the mcp251x driver to use dmam_alloc_coherent.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3f8a2b74
  2. 22 Aug, 2014 23 commits