1. 18 Mar, 2016 26 commits
    • Zhang Shengju's avatar
      net: fix a comment typo · 93e68cd6
      Zhang Shengju authored
      Fix a comment typo.
      Signed-off-by: default avatarZhang Shengju <zhangshengju@cmss.chinamobile.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      93e68cd6
    • Dan Carpenter's avatar
      ethernet: micrel: fix some error codes · 3af0d554
      Dan Carpenter authored
      There were two issues here:
      1) dma_mapping_error() return true/false but we want to return -ENOMEM
      2) If dmaengine_prep_slave_sg() failed then "err" wasn't set but
         presumably that should be -ENOMEM as well.
      
      I changed the success path to "return 0;" instead of "return ret;" for
      clarity.
      
      Fixes: 94fe8c68 ('ks8842: Support DMA when accessed via timberdale')
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3af0d554
    • David S. Miller's avatar
      Merge branch 'bpf-misc' · 3004932c
      David S. Miller authored
      Daniel Borkmann says:
      
      ====================
      Minor BPF follow-ups
      
      Some minor last follow-ups I still had in my queue. The first one adds
      readability support for __sk_buff's tc_classid member, the remaining
      two are some minor cleanups. For details please see individual patches.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3004932c
    • Daniel Borkmann's avatar
      ip_tunnels, bpf: define IP_TUNNEL_OPTS_MAX and use it · fca5fdf6
      Daniel Borkmann authored
      eBPF defines this as BPF_TUNLEN_MAX and OVS just uses the hard-coded
      value inside struct sw_flow_key. Thus, add and use IP_TUNNEL_OPTS_MAX
      for this, which makes the code a bit more generic and allows to remove
      BPF_TUNLEN_MAX from eBPF code.
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fca5fdf6
    • Daniel Borkmann's avatar
      bpf, dst: add and use dst_tclassid helper · 808c1b69
      Daniel Borkmann authored
      We can just add a small helper dst_tclassid() for retrieving the
      dst->tclassid value. It makes the code a bit better in that we can
      get rid of the ifdef from filter.c by moving this into the header.
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      808c1b69
    • Daniel Borkmann's avatar
      bpf: make skb->tc_classid also readable · 09c37a2c
      Daniel Borkmann authored
      Currently, the tc_classid from eBPF skb context is write-only, but there's
      no good reason for tc programs to limit it to write-only. For example,
      it can be used to transfer its state via tail calls where the resulting
      tc_classid gets filled gradually.
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      09c37a2c
    • Arnd Bergmann's avatar
      net: mvneta: bm: clarify dependencies · 019ded3a
      Arnd Bergmann authored
      MVNETA_BM has a dependency on MVNETA, so we can only select the former
      if the latter is enabled. However, the code dependency is the reverse:
      The mvneta module can call into the mvneta_bm module, so mvneta cannot
      be a built-in if mvneta_bm is a module, or we get a link error:
      
      drivers/net/built-in.o: In function `mvneta_remove':
      drivers/net/ethernet/marvell/mvneta.c:4211: undefined reference to `mvneta_bm_pool_destroy'
      drivers/net/built-in.o: In function `mvneta_bm_update_mtu':
      drivers/net/ethernet/marvell/mvneta.c:1034: undefined reference to `mvneta_bm_bufs_free'
      
      This avoids the problem by further clarifying the dependency so that
      MVNETA_BM is a silent Kconfig option that gets turned on by the
      new MVNETA_BM_ENABLE option. This way both the core HWBM module and
      the MVNETA_BM code are always built-in when needed.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Fixes: dc35a10f ("net: mvneta: bm: add support for hardware buffer management")
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      019ded3a
    • Daniel Borkmann's avatar
      cls_bpf: reset class and reuse major in da · 3a461da1
      Daniel Borkmann authored
      There are two issues with the current code. First one is that we need
      to set res->class to 0 in case we use non-default classid matching.
      
      This is important for the case where cls_bpf was initially set up with
      an optional binding to a default class with tcf_bind_filter(), where
      the underlying qdisc implements bind_tcf() that fills res->class and
      tests for it later on when doing the classification. Convention for
      these cases is that after tc_classify() was called, such qdiscs (atm,
      drr, qfq, cbq, hfsc, htb) first test class, and if 0, then they lookup
      based on classid.
      
      Second, there's a bug with da mode, where res->classid is only assigned
      a 16 bit minor, but it needs to expand to the full 32 bit major/minor
      combination instead, therefore we need to expand with the bound major.
      This is fine as classes belonging to a classful qdisc must share the
      same major.
      
      Fixes: 045efa82 ("cls_bpf: introduce integrated actions")
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3a461da1
    • David S. Miller's avatar
      Merge branch 'ldmvsw' · 70063e94
      David S. Miller authored
      Aaron Young says:
      
      ====================
      ldmvsw: Add ldmvsw driver
      
      This series adds a new Logical Domains vSwitch (ldmvsw) driver.
      
      The ldmvsw driver code will live in the drivers/net/ethernet/sun/
      directory and will operate on Oracle systems running SPARC Linux in a
      Logical Domains environment (typically in the control domain).
      
      The ldmvsw driver is very similar in function to the existing sunvnet
      driver. Ldmvsw creates a network interface for each "vsw-port" node
      found in the Machine Description (MD) of a service domain. These
      nodes correspond to ports on a vswitch created by the logical domains
      manager. The created network interface(s) can be used by bridge/vswitch
      software (such as the Linux bridge or Open vSwitch) to provide
      guest domain(s) with network interconnectivity or connectivity
      to a physical network.
      
      Here is a example diagram of ldmvsw driver usage in a logical
      domain environment to provide a guest domain with network connectivity
      to a physical NIC on the service domain:
      
         +----------------+             +-----------------
         | Service Domain |             |  Guest domain  |
         |                |             |                |
         |  LinuxBridge   |             |                |
         |    |    |      |             |                |
         |   NIC Ldmvsw   |             |    Sunvnet     |
         +----------------+             +----------------+
              |    |           LDC              |
             LAN   ------------------------------
      
      As stated, the sunvnet and ldmvsw drivers are _very_ similar in function.
      They both create network interface(s) to receive/transmit network
      traffic across LDC network channel(s). Since the driver is so similar
      in function to sunvnet, the approach will be as follows to integrate
      the driver and take advantage of common code:
      
      Patch #1: Split sunvnet.c driver into sunvnet.c and sunvnet_common.c
      Patch #2: Modify the sunvnet_common code and data structures to be compatible
                with both the sunvnet and ldmvsw drivers.
      Patch #3: Add the new ldmvsw.c driver code
      Patch #4: Checkpatch cleanup of the sunvnet/sunvnet_common code.
      
      NOTE - Patch#1 renames a file (sunvnet.h -> sunvnet_common.h). When generating
      the patches (using git format-patch), I had to use the --no-renames option
      otherwise patch#1 would NOT apply using 'patch -p1' - which as I
      understand is a requirement for patch acceptance. I wasn't sure if this
      is proper thing to do.  Please advise if not. Thanks.
      
      v2 changes:
        * change all EXPORT_SYMBOL declarations to EXPORT_SYMBOL_GPL
        * remove inline attribute for external function port_is_up_common()
        * Give all exported/global funcs in sunvnet_common.c a 'sunvnet_' prefix
          to avoid kernel global namespace pollution/collisions
        * ldmvsw.c: Order local variable declarations from longest to shortest line
        * ldmvsw.c: register the netdevice after all supporting state is ready/setup.
                    NOTE: The consensus at Oracle is that the following functions
                          must be done AFTER register_netdev() - this is the same
                          ordering currently used in the sunvnet driver:
                          1. sunvnet_port_add_txq_common() - needs registered netdev
                          2. napi_enable() - requires registered netdev
                          3. vio_port_up() - as soon as this function is called
                                             LDC handshake messages will come in
                                             which must be handled by the napi code.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      70063e94
    • Aaron Young's avatar
      ldmvsw: Checkpatch sunvnet.c and sunvnet_common.c · dc153f85
      Aaron Young authored
        Checkpatch updates for sunvnet.c and sunvnet_common.c.
      Signed-off-by: default avatarAaron Young <aaron.young@oracle.com>
      Signed-off-by: default avatarRashmi Narasimhan <rashmi.narasimhan@oracle.com>
      Reviewed-by: default avatarSowmini Varadhan <sowmini.varadhan@oracle.com>
      Reviewed-by: default avatarAlexandre Chartre <Alexandre.Chartre@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      dc153f85
    • Aaron Young's avatar
      ldmvsw: Add ldmvsw.c driver code · 5d01fa0c
      Aaron Young authored
        Add ldmvsw.c driver
      
        Details:
      
        The ldmvsw driver very closely follows the sunvnet.c code and makes
        use of the sunvnet_common.c code for core functionality.
      
        A significant difference between sunvnet and ldmvsw driver is
        sunvnet creates a network interface for each vnet-port *parent*
        node in the MD while the ldmvsw driver creates a network interface
        for every vsw-port node in the Machine Description (MD).
        Therefore the netdev_priv() for sunvnet is a vnet structure while
        the netdev_priv() for ldmvsw is a vnet_port structure.
      
        Vnet_port structures allocated by ldmvsw have the vsw bit set.
        When finding the net_device associated with a port, the common code keys
        off this bit to use either the net_device found in the vnet_port or the
        net_device in the vnet structure (see the VNET_PORT_TO_NET_DEVICE() macro in
        sunvnet_common.h). This scheme allows the common code to work with
        both drivers with minimal changes.
      
        Similar to Xen, network interfaces created by the ldmvsw driver will always
        have a HW Addr (i.e. mac address) of FE:FF:FF:FF:FF:FF and each will be
        assigned the devname "vif<cfg_handle>.<port_id>" - where <cfg_handle> and
        <port_id> are a unique handle/port pair assigned to the associated
        vsw-port node in the MD.
      Signed-off-by: default avatarAaron Young <aaron.young@oracle.com>
      Signed-off-by: default avatarRashmi Narasimhan <rashmi.narasimhan@oracle.com>
      Reviewed-by: default avatarSowmini Varadhan <sowmini.varadhan@oracle.com>
      Reviewed-by: default avatarAlexandre Chartre <Alexandre.Chartre@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5d01fa0c
    • Aaron Young's avatar
      ldmvsw: Make sunvnet_common compatible with ldmvsw · 67d0719f
      Aaron Young authored
        Modify sunvnet common code and data structures to be compatible
        with both sunvnet and ldmvsw drivers.
      
        Details:
      
        Sunvnet operates on "vnet-port" nodes which appear in the Machine
        Description (MD) in a guest domain. Ldmvsw operates on "vsw-port"
        nodes which appear in the MD of a service domain.
      
        A difference between the sunvnet driver and the ldmvsw driver is
        the sunvnet driver creates a network interface (i.e. a struct net_device)
        for every vnet-port *parent* "network" node. Several vnet-ports may appear
        under this common parent network node - each corresponding to a common parent
        network interface.  Conversely, since bridge/vswitch software will need
        to interface with every vsw-port in a system, the ldmvsw driver creates
        a network interface (i.e. a struct net_device) for every vsw-port - not
        every parent node as with sunvnet.  This difference required some special
        handling in the common code as explained below.
      
        There are 2 key data structures used by the sunvnet and ldmvsw drivers
        (which are now found in sunvnet_common.h):
      
        1. struct vnet_port
           This structure represents a vnet-port node in sunvnet and a vsw-port
           in the ldmvsw driver.
      
        2. struct vnet
           This structure represents a parent "network" node in sunvnet and a parent
           "virtual-network-switch" node in ldmvsw.
      
        Since the sunvnet driver allocates a net_device for every parent "network"
        node, a net_device member appears in the struct vnet. Since the ldmvsw
        driver allocates a net_device for every port, a net_device member was
        added to the vnet_port. The common code distinguishes which structure
        net_device member to use by checking a 'vsw' bit that was added to the
        vnet_port structure. See the VNET_PORT_TO_NET_DEVICE() marco in
        sunvnet_common.h.
      
        The netdev_priv() in sunvnet is allocated as a vnet. The netdev_priv()
        in ldmvsw is a vnet_port. Therefore, any place in the common code
        where a netdev_priv() call was made, a wrapper function was implemented
        in each driver to first get the vnet and/or vnet_port (in a driver
        specific way) and pass them as newly added parameters to the common
        functions (see wrapper funcs: vnet_set_rx_mode() and vnet_poll_controller()).
        Since these wrapper functions call __tx_port_find(), __tx_port_find() was
        moved from the common code back into sunvnet.c. Note - ldmvsw.c does not
        require this function.
      
        These changes also required that port_is_up() be made
        into a common function and thus it was given a _common suffix and
        exported like the other common functions.
      
        A wrapper function was also added for vnet_start_xmit_common() to pass a
        driver-specific function arg to return the port associated with a given
        struct sk_buff and struct net_device. This was required because
        vnet_start_xmit_common() grabs a lock prior to getting the associated
        port. Using a function pointer arg allowed the code to work unchanged
        without risking changes to the non-trivial locking logic in
        vnet_start_xmit_common().
      Signed-off-by: default avatarAaron Young <aaron.young@oracle.com>
      Signed-off-by: default avatarRashmi Narasimhan <rashmi.narasimhan@oracle.com>
      Reviewed-by: default avatarSowmini Varadhan <sowmini.varadhan@oracle.com>
      Reviewed-by: default avatarAlexandre Chartre <Alexandre.Chartre@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      67d0719f
    • Aaron Young's avatar
      ldmvsw: Split sunvnet driver into common code · 31762eaa
      Aaron Young authored
        Split sunvnet.c into sunvnet.c and sunvnet_common.c.
      
        Details:
      
        Since the sunvnet and ldmvsw drivers will both use common sunvnet code,
        move the functions (and support functions) anticipated to be common code
        from sunvnet.c to sunvnet_common.c. Similarly, sunvnet.h was renamed to
        sunvnet_common.h. The sunvnet_common.c code will be compiled into the
        kernel and act as a library of functions that are linked by either
        (or both) drivers when loaded.
      
        Function names for external functions in sunvnet_common.c (to be
        called by both the sunvnet and ldmvsw drivers) were tagged with a "_common"
        suffix to clearly designate them as common functions.
      
        No functional changes as of yet... just moved code verbatim to the new
        sunvnet_common.c/h files.
      
        Makefile/Kconfig support added to build sunvnet_common.c file. The code
        is included in the kernel if SUN_LDOMS is defined/selected.
      
        NOTE - per the SubmittingPatches documentation, since the code was just
        moved from one file another, the code was NOT checkpatch'd in this commit
        to aid in review.
      Signed-off-by: default avatarAaron Young <aaron.young@oracle.com>
      Signed-off-by: default avatarRashmi Narasimhan <rashmi.narasimhan@oracle.com>
      Reviewed-by: default avatarSowmini Varadhan <sowmini.varadhan@oracle.com>
      Reviewed-by: default avatarAlexandre Chartre <Alexandre.Chartre@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      31762eaa
    • Yuval Mintz's avatar
      bnx2x: Prevent false warning for lack of FC NPIV · 1e6bb1a3
      Yuval Mintz authored
      Not all adapters have FC-NPIV configured. If bnx2fc is used with such an
      adapter, driver would read irrelevant data from the the nvram and log
      "FC-NPIV table with bad length..." In system logs.
      
      Simply accept that reading '0' as the feature offset in nvram indicates
      the feature isn't there and return.
      Reported-by: default avatarAndrew Patterson <andrew.patterson@hpe.com>
      Signed-off-by: default avatarYuval Mintz <Yuval.Mintz@qlogic.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1e6bb1a3
    • Yoshihiro Kaneko's avatar
      ravb: fix result value overwrite · 38c848c7
      Yoshihiro Kaneko authored
      The result value is overwritten by a return value of
      ravb_ptp_interrupt().
      Signed-off-by: default avatarYoshihiro Kaneko <ykaneko0929@gmail.com>
      Acked-by: default avatarSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      38c848c7
    • Manish Chopra's avatar
      qlge: Fix receive packets drop. · 2c9a266a
      Manish Chopra authored
      When running small packets [length < 256 bytes] traffic, packets were
      being dropped due to invalid data in those packets which were
      delivered by the driver upto the stack. Using pci_dma_sync_single_for_cpu
      ensures copying latest and updated data into skb from the receive buffer.
      Signed-off-by: default avatarSony Chacko <sony.chacko@qlogic.com>
      Signed-off-by: default avatarManish Chopra <manish.chopra@qlogic.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2c9a266a
    • Phil Reid's avatar
      net: stmmac: Don't search for phys if mdio node is defined. · cc2fa619
      Phil Reid authored
      If a dt mdio entry has been added least assume that we wont
      search for phys attached. The DT and of_mdiobus_register already do
      this. This stops DSA phys being found and phys created for them, as
      this is handled by the DSA driver.
      Signed-off-by: default avatarPhil Reid <preid@electromag.com.au>
      Acked-by: default avatarGiuseppe Cavallaro <peppe.cavallaro@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cc2fa619
    • Dan Carpenter's avatar
      mediatek: unlock on error in mtk_tx_map() · 48e77422
      Dan Carpenter authored
      There was a missing unlock on the error path.
      
      Fixes: 656e7052 ('net-next: mediatek: add support for MT7623 ethernet')
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Acked-by: default avatarJohn Crispin <blogic@openwrt.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      48e77422
    • Dan Carpenter's avatar
      mediatek: checking for IS_ERR() instead of NULL · 977bc20c
      Dan Carpenter authored
      of_phy_connect() returns NULL on error, it never returns error pointers.
      
      Fixes: 656e7052 ('net-next: mediatek: add support for MT7623 ethernet')
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Acked-by: default avatarJohn Crispin <blogic@openwrt.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      977bc20c
    • Simon Horman's avatar
      openvswitch: allow output of MPLS packets on tunnel vports · fe3a5f6c
      Simon Horman authored
      Currently output of MPLS packets on tunnel vports is not allowed by Open
      vSwitch. This is because historically encapsulation was done in such a way
      that the inner_protocol field of the skb needed to hold the inner protocol
      for both MPLS and tunnel encapsulation in order for GSO segmentation to be
      performed correctly.
      
      Since b2acd1dc ("openvswitch: Use regular GRE net_device instead of
      vport") Open vSwitch makes use of lwt to output to tunnel netdevs which
      perform encapsulation. As no drivers expose support for MPLS offloads this
      means that GSO packets are segmented in software by validate_xmit_skb(),
      which is called from __dev_queue_xmit(), before tunnel encapsulation occurs.
      This means that the inner protocol of MPLS is no longer needed by the time
      encapsulation occurs and the contention on the inner_protocol field of the
      skb no longer occurs.
      
      Thus it is now safe to output MPLS to tunnel vports.
      Signed-off-by: default avatarSimon Horman <simon.horman@netronome.com>
      Reviewed-by: default avatarJesse Gross <jesse@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fe3a5f6c
    • David Daney's avatar
      netdev: Move octeon/octeon_mgmt driver to cavium directory. · d07a147f
      David Daney authored
      No code changes.  Since OCTEON is a Cavium product, move the driver to
      the vendor directory to unclutter things a bit.
      Signed-off-by: default avatarDavid Daney <david.daney@cavium.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d07a147f
    • Wu Fengguang's avatar
      e014e846
    • Wu Fengguang's avatar
      b73f96fc
    • Schemmel Hans-Christoph's avatar
      qmi_wwan: Added support for Gemalto's Cinterion PHxx WWAN interface · bd9e3350
      Schemmel Hans-Christoph authored
      Added support for Gemalto's Cinterion PHxx WWAN interfaces
      by adding QMI_FIXED_INTF with Cinterion's VID and PID.
      
      PHxx can have:
      2 RmNet Interfaces (PID 0x0082) or
      1 RmNet + 1 USB Audio interface (PID 0x0083).
      Signed-off-by: default avatarHans-Christoph Schemmel <hans-christoph.schemmel@gemalto.com>
      Acked-by: default avatarBjørn Mork <bjorn@mork.no>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bd9e3350
    • Eric Dumazet's avatar
      tcp/dccp: remove obsolete WARN_ON() in icmp handlers · e316ea62
      Eric Dumazet authored
      Now SYN_RECV request sockets are installed in ehash table, an ICMP
      handler can find a request socket while another cpu handles an incoming
      packet transforming this SYN_RECV request socket into an ESTABLISHED
      socket.
      
      We need to remove the now obsolete WARN_ON(req->sk), since req->sk
      is set when a new child is created and added into listener accept queue.
      
      If this race happens, the ICMP will do nothing special.
      
      Fixes: 079096f1 ("tcp/dccp: install syn_recv requests into ehash table")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarBen Lazarus <blazarus@google.com>
      Reported-by: default avatarNeal Cardwell <ncardwell@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e316ea62
    • Eric Dumazet's avatar
      vlan: propagate gso_max_segs · f6773c5e
      Eric Dumazet authored
      vlan drivers lack proper propagation of gso_max_segs from
      lower device.
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f6773c5e
  2. 16 Mar, 2016 14 commits
    • David S. Miller's avatar
      Merge branch 'thunderx-mdio-fixes' · b4ab9d76
      David S. Miller authored
      David Daney says:
      
      ====================
      net/phy: Fixes for Cavium Thunder MDIO code.
      
      Previous patch set:
      commit 5fc7cf17 ("net: thunderx: Cleanup PHY probing code.")
      commit 1eefee90 ("phy: mdio-octeon: Refactor into two files/modules")
      commit 379d7ac7 ("phy: mdio-thunder: Add driver for Cavium Thunder SoC MDIO buses.")
      
      Had several problems.  We try to fix them here.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b4ab9d76
    • David Daney's avatar
      net: thunderx: Don't leak phy device references on -EPROBE_DEFER condition. · b7d3e3d3
      David Daney authored
      It is possible, although unlikely, that probing will find the
      phy_device for the first LMAC of a thunder BGX device, but then need
      to fail with -EPROBE_DEFER on a subsequent LMAC.  In this case, we
      need to call put_device() on each of the phy_devices that were
      obtained, but will be unused due to returning -EPROBE_DEFER.
      
      Also, since we can break out of the probing loop early, we need to
      explicitly call of_node_put() outside of the loop.
      Signed-off-by: default avatarDavid Daney <david.daney@cavium.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b7d3e3d3
    • David Daney's avatar
      net: cavium: For Kconfig THUNDER_NIC_BGX, select MDIO_THUNDER. · 9277a4f8
      David Daney authored
      Previously we selected MDIO_OCTEON, which after creating the Thunder
      specific MDIO bus driver is much less useful.
      Signed-off-by: default avatarDavid Daney <david.daney@cavium.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9277a4f8
    • David Daney's avatar
      phy: mdio-cavium: Add missing MODULE_* annotations. · 7091f01e
      David Daney authored
      When the code was factored out of mdio-octeon.c, the
      MODULE_DESCRIPTION, MODULE_AUTHOR and MODULE_LICENSE annotations were
      inadvertently omitted.  Restore them so that we don't get kernel taint
      warnings upon module loading.
      Signed-off-by: default avatarDavid Daney <david.daney@cavium.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7091f01e
    • Guillaume Nault's avatar
      ppp: ensure file->private_data can't be overridden · e8e56ffd
      Guillaume Nault authored
      Locking ppp_mutex must be done before dereferencing file->private_data,
      otherwise it could be modified before ppp_unattached_ioctl() takes the
      lock. This could lead ppp_unattached_ioctl() to override ->private_data,
      thus leaking reference to the ppp_file previously pointed to.
      
      v2: lock all ppp_ioctl() instead of just checking private_data in
          ppp_unattached_ioctl(), to avoid ambiguous behaviour.
      
      Fixes: f3ff8a4d ("ppp: push BKL down into the driver")
      Signed-off-by: default avatarGuillaume Nault <g.nault@alphalink.fr>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e8e56ffd
    • David S. Miller's avatar
      Merge branch 'arc_emac-next' · c8f5d298
      David S. Miller authored
      Caesar Wang says:
      
      ====================
      arc_emac: fixes the emac issues and cleanup emac drivers
      
      This series patches are based on kernel 4.5-rc7+ version.
      Linux version 4.5.0-rc7-next-20160311+ (wxt@nb) (...) #45 SMP Sun Mar 13 16:17:56
      
      The history patch in here:
      Patch-v1: https://lkml.org/lkml/2016/3/11/209
      Patch-v2: https://lkml.org/lkml/2016/3/13/39
      
      Verified on kylin board with my github.
      https://github.com/Caesar-github/rockchip/tree/kylin/next
      
      That's verified on kylin board with ubuntu os.
      
      This series patches are built all pass with Mr.robot on
      https://github.com/Caesar-github/linux/tree/build-emac-v3
      
      How to test and verify?
      
      You can refer to the following wiki document.
      http://rockchip.wikidot.com/linux-develop-guide
      
      bootup log:
      [    1.264740] rockchip_emac 10200000.ethernet: no regulator found
      [    1.270908] rockchip_emac 10200000.ethernet: ARC EMAC detected with id: 0x7fd02
      [    1.278362] rockchip_emac 10200000.ethernet: IRQ is 29
      [    1.283747] rockchip_emac 10200000.ethernet: MAC address is now 06:5d:61:c7:39:41
      [    1.291314] rockchip_emac 10200000.ethernet: GPIO lookup for consumer phy-reset
      [    1.291333] rockchip_emac 10200000.ethernet: using device tree for GPIO lookup
      [    1.663155] rockchip_emac 10200000.ethernet: connected to Generic PHY phy with id 0xffffc816
      [    8.863448] rockchip_emac 10200000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off
      
      root@localhost:/# busybox ping www.baidu.com
      PING www.baidu.com (14.215.177.38): 56 data bytes
      64 bytes from 14.215.177.38: seq=0 ttl=48 time=35.046 ms
      64 bytes from 14.215.177.38: seq=1 ttl=48 time=35.095 ms
      64 bytes from 14.215.177.38: seq=2 ttl=48 time=34.203 ms
      64 bytes from 14.215.177.38: seq=3 ttl=48 time=38.516 ms
      ...
      ---
      
      1) This series has 6 patches: (1--->9)
      net: arc_emac: make the rockchip emac document more compatible
      net: arc_emac: add phy reset is optional for device tree
      net: arc_emac: support the phy reset for emac driver
      net: arc: trivial: cleanup the emac driver
      clk: rockchip: add node-id for rk3036 emac hclk
      clk: rockchip: associate the rk3036 HCLK_EMAC clock-id
      clk: rockchip: add clock-id for rk3036 emac pll source clock
      clk: rockchip: associate SCLK_MAC_PLL and disable reparenting on rk3036
      ARM: dts: rockchip: add support emac for RK3036
      
      2) This series patches have the following descriptions:
      
      Hi Rob, David:
      PATCH[1/9-2/9]: ====>
      net: arc_emac: make the rockchip emac document more compatible
      net: arc_emac: add phy reset is optional for device tree
      
      The patches change the rockchip emac document for more compatible and
      Add the phy reset property for document.
      ---
      
      Hi David
      PATCH[3/9]: ====>
      net: arc_emac: support the phy reset for emac driver
      
      The emac didn't work on kylin board since in some case the clocks parent changed.
      The kylin hardware connects the phy reset pin, we should use it with real world.
      As the previous patch discuss on https://patchwork.kernel.org/patch/8186801/
      
      And as sergei/Heiko suggestions on
      https://patchwork.kernel.org/patch/8564571/
      ---
      
      Hi David
      PATCH[4/9]: ====>
      net: arc: trivial: cleanup the emac driver
      
      The first time to look the emac drivers, I think that have to cleanup the drivers with scripts.
      Although it's the trivial things, in order to be more read.
      ---
      
      Hi Heiko,Michael,Stephen:
      PATCH[5/9-8/9]: ====> clk: rockchip: rk3036: fix and add node id for emac clock
      
      Four-part from https://patchwork.kernel.org/patch/8564581/
      clk: rockchip: add node-id for rk3036 emac hclk
      clk: rockchip: associate the rk3036 HCLK_EMAC clock-id
      clk: rockchip: add clock-id for rk3036 emac pll source clock
      clk: rockchip: associate SCLK_MAC_PLL and disable reparenting on rk3036
      
      Add the emac needed clocks for rk3036 SoCs
      ---
      
      Hi Heiko:
      PATCH[9/9]: ====>
      ARM: dts: rockchip: add support emac for RK3036
      
      Add the emac needed main info for rk3036 dts.
      ---
      
      Thanks your reviewing! :)
      
      Changes in v3:
      - %s/he/the
      - Add the Cc people
      - As Sergei comments, the original name is better, so
        %s/reset-gpios/phy-reset-gpios
      - Add the Cc people.
      - Caused the build error since the missing include head file.
      - %s/reset/phy-reset to match the device tree.
      - Add the Cc people
      - Add the Cc people.
      - Add the Cc people.
      - Add the Cc people.
      - Add the Cc people.
      - Add the Cc people.
      - rename reset-gpio to phy-reset-gpios.
      - change the commit.
      - remove the pcfg_output_high, that's really not needed for emac.
      - Add the Cc people.
      - Fixes the 'zhengxing' to 'Xing Zheng'.
      
      Changes in v2:
      - change the commit and remove the repeat the name 'rockchip'.
      - %s/phy-reset-gpios/reset-gpios
      - As the pervious version, Sergei and Heiko comments on
        https://patchwork.kernel.org/patch/8564571/.
      - Nevermind, add signed-off since Heiko the original patch,
        refer the Heiko's test patch on
        https://github.com/mmind/linux-rockchip/commit/a943c588783438ff1c508dfa8c79f1709aa5775e
        :)
      - As the robot notice the build error since overflow in implicit
        constant conversion.
      - rename phy-reset-gpio to reset-gpios.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c8f5d298
    • Xing Zheng's avatar
      ARM: dts: rockchip: add to support emac for rk3036 SoCs · af671e7b
      Xing Zheng authored
      This patch adds the emac device node for rk3036 SoCs.
      We need to let mac clock under the DPLL which is able to provide
      the accurate 50MHz what mac_ref need, since that will cause some
      unstable things if the cpufreq is working.
      Signed-off-by: default avatarXing Zheng <zhengxing@rock-chips.com>
      Signed-off-by: default avatarCaesar Wang <wxt@rock-chips.com>
      Cc: linux-rockchip@lists.infradead.org
      Cc: Xing Zheng <zhengxing@rock-chips.com>
      Cc: Heiko Stuebner <heiko@sntech.de>
      Cc: linux-arm-kernel@lists.infradead.org
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      af671e7b
    • Heiko Stuebner's avatar
      clk: rockchip: associate SCLK_MAC_PLL and disable reparenting on rk3036 · 2c6fae25
      Heiko Stuebner authored
      The emac needs constant and very specific rate but the possible PLL-sources
      are very limited, so we expect the PLL source to be set manually on per
      board and don't want it to get changed in an automatic way later.
      So add the necessary clock-id and disable reparenting on set_rate calls.
      Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Heiko Stuebner <heiko@sntech.de>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Cc: linux-clk@vger.kernel.org
      Signed-off-by: default avatarCaesar Wang <wxt@rock-chips.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2c6fae25
    • Xing Zheng's avatar
      clk: rockchip: add clock-id for rk3036 emac pll source clock · f7e18022
      Xing Zheng authored
      Suitable PLLs for the emac on the rk3036 are difficult to find
      and one of them is the (continuously changing) APLL. So in most
      cases it will be necessary to select a PLL manually.
      So add a clock-id for it.
      Signed-off-by: default avatarXing Zheng <zhengxing@rock-chips.com>
      Signed-off-by: default avatarCaesar Wang <wxt@rock-chips.com>
      Cc: Xing Zheng <zhengxing@rock-chips.com>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Heiko Stuebner <heiko@sntech.de>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Cc: linux-clk@vger.kernel.org
      Cc: linux-rockchip@lists.infradead.org
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f7e18022
    • Xing Zheng's avatar
      clk: rockchip: associate the rk3036 HCLK_EMAC clock-id · e764b939
      Xing Zheng authored
      Associate the new clock id the clock.
      Signed-off-by: default avatarXing Zheng <zhengxing@rock-chips.com>
      Signed-off-by: default avatarCaesar Wang <wxt@rock-chips.com>
      Cc: Xing Zheng <zhengxing@rock-chips.com>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Heiko Stuebner <heiko@sntech.de>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Cc: linux-clk@vger.kernel.org
      Cc: linux-rockchip@lists.infradead.org
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e764b939
    • Xing Zheng's avatar
      clk: rockchip: add node-id for rk3036 emac hclk · fb781c8e
      Xing Zheng authored
      Add the node-id for the emac hclk to the binding header.
      Signed-off-by: default avatarXing Zheng <zhengxing@rock-chips.com>
      Signed-off-by: default avatarCaesar Wang <wxt@rock-chips.com>
      Cc: Xing Zheng <zhengxing@rock-chips.com>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Heiko Stuebner <heiko@sntech.de>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Cc: linux-clk@vger.kernel.org
      Cc: linux-rockchip@lists.infradead.org
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fb781c8e
    • Caesar Wang's avatar
      net: arc: trivial: cleanup the emac driver · 663713eb
      Caesar Wang authored
      This patch will make the driver more readability
      
      The emac has the error and warnings if you run
      'scripts/checkpatch.pl -f --subjective xxx' to check.
      
      Let's clean up such trivial details.
      Signed-off-by: default avatarCaesar Wang <wxt@rock-chips.com>
      Cc: Jiri Kosina <trivial@kernel.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Alexander Kochetkov <al.kochet@gmail.com>
      Cc: netdev@vger.kernel.org
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      663713eb
    • Caesar Wang's avatar
      net: arc_emac: support the phy reset for emac driver · 1bddd96c
      Caesar Wang authored
      This patch adds to support the emac phy reset.
      
      Different boards may require different phy reset duration. Add property
      phy-reset-duration for emac driver, so that the boards that need
      a longer reset duration can specify it in their device tree.
      Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
      Signed-off-by: default avatarCaesar Wang <wxt@rock-chips.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: netdev@vger.kernel.org
      Cc: Alexander Kochetkov <al.kochet@gmail.com>
      Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1bddd96c
    • Caesar Wang's avatar
      net: arc_emac: add phy reset is optional for device tree · 8700eee6
      Caesar Wang authored
      This patch adds the following property for arc_emac.
      
      1) phy-reset-gpios:
      The phy-reset-gpio is an optional property for arc emac device tree boot.
      Change the binding document to match the driver code.
      
      2) phy-reset-duration:
      Different boards may require different phy reset duration. Add property
      phy-reset-duration for device tree probe, so that the boards that need
      a longer reset duration can specify it in their device tree.
      
      Anyway, we can add the above property for arc emac.
      Signed-off-by: default avatarCaesar Wang <wxt@rock-chips.com>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: devicetree@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      Cc; Alexander Kochetkov <al.kochet@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8700eee6