1. 23 Aug, 2014 23 commits
    • David S. Miller's avatar
      Merge branch 'tipc-next' · 5aa8dbbd
      David S. Miller authored
      Jon Maloy says:
      
      ====================
      tipc: Merge port and socket layer code
      
      After the removal of the TIPC native interface, there is no reason to
      keep a distinction between a "generic" port layer and a "specific"
      socket layer in the code. Throughout the last months, we have posted
      several series that aimed at facilitating removal of the port layer,
      and in particular the port_lock spinlock, which in reality duplicates
      the role normally kept by lock_sock()/bh_lock_sock().
      
      In this series, we finalize this work, by making a significant number of
      changes to the link, node, port and socket code, all with the aim of
      reducing dependencies between the layers. In the final commits, we then
      remove the port spinlock, port.c and port.h altogether.
      
      After this series, we have a socket layer that has only few dependencies
      to the rest of the stack, so that it should be possible to continue
      cleanups of its code without significantly affecting other code.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5aa8dbbd
    • Jon Paul Maloy's avatar
      tipc: merge struct tipc_port into struct tipc_sock · 301bae56
      Jon Paul Maloy authored
      We complete the merging of the port and socket layer by aggregating
      the fields of struct tipc_port directly into struct tipc_sock, and
      moving the combined structure into socket.c.
      
      We also move all functions and macros that are not any longer
      exposed to the rest of the stack into socket.c, and rename them
      accordingly.
      
      Despite the size of this commit, there are no functional changes.
      We have only made such changes that are necessary due of the removal
      of struct tipc_port.
      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>
      301bae56
    • Jon Paul Maloy's avatar
      tipc: remove files ref.h and ref.c · 808d90f9
      Jon Paul Maloy authored
      The reference table is now 'socket aware' instead of being generic,
      and has in reality become a socket internal table. In order to be
      able to minimize the API exposed by the socket layer towards the rest
      of the stack, we now move the reference table definitions and functions
      into the file socket.c, and rename the functions accordingly.
      
      There are no functional changes in this commit.
      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>
      808d90f9
    • Jon Paul Maloy's avatar
      tipc: remove include file port.h · 2e84c60b
      Jon Paul Maloy authored
      We move the inline functions in the file port.h to socket.c, and modify
      their names accordingly.
      
      We move struct tipc_port and some macros to socket.h.
      
      Finally, we remove the file port.h.
      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>
      2e84c60b
    • Jon Paul Maloy's avatar
      tipc: remove source file port.c · 0fc87aae
      Jon Paul Maloy authored
      In this commit, we move the remaining functions in port.c to
      socket.c, and give them new names that correspond to their new
      location. We then remove the file port.c.
      
      There are only cosmetic changes to the moved functions.
      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>
      0fc87aae
    • Jon Paul Maloy's avatar
      tipc: remove port_lock · 6c9808ce
      Jon Paul Maloy authored
      In previous commits we have reduced usage of port_lock to a minimum,
      and complemented it with usage of bh_lock_sock() at the remaining
      locations. The purpose has been to remove this lock altogether, since
      it largely duplicates the role of bh_lock_sock. We are now ready to do
      this.
      
      However, we still need to protect the BH callers from inadvertent
      release of the socket while they hold a reference to it. We do this by
      replacing port_lock by a combination of a rw-lock protecting the
      reference table as such, and updating the socket reference counter while
      the socket is referenced from BH. This technique is more standard and
      comprehensible than the previous approach, and turns out to have a
      positive effect on overall performance.
      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>
      6c9808ce
    • 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 17 commits