1. 04 Mar, 2019 10 commits
    • Francesco Ruggeri's avatar
      net: ipv6: add socket option IPV6_ROUTER_ALERT_ISOLATE · 9036b2fe
      Francesco Ruggeri authored
      By default IPv6 socket with IPV6_ROUTER_ALERT socket option set will
      receive all IPv6 RA packets from all namespaces.
      IPV6_ROUTER_ALERT_ISOLATE socket option restricts packets received by
      the socket to be only from the socket's namespace.
      Signed-off-by: default avatarMaxim Martynov <maxim@arista.com>
      Signed-off-by: default avatarFrancesco Ruggeri <fruggeri@arista.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9036b2fe
    • Ben Dooks's avatar
      net: fixup address-space warnings in compat_mc_{get,set}sockopt() · 46d84110
      Ben Dooks authored
      Add __user attributes in some of the casts in this function to avoid
      the following sparse warnings:
      
      net/compat.c:592:57: warning: cast removes address space of expression
      net/compat.c:592:57: warning: incorrect type in initializer (different address spaces)
      net/compat.c:592:57:    expected struct compat_group_req [noderef] <asn:1>*gr32
      net/compat.c:592:57:    got void *<noident>
      net/compat.c:613:65: warning: cast removes address space of expression
      net/compat.c:613:65: warning: incorrect type in initializer (different address spaces)
      net/compat.c:613:65:    expected struct compat_group_source_req [noderef] <asn:1>*gsr32
      net/compat.c:613:65:    got void *<noident>
      net/compat.c:634:60: warning: cast removes address space of expression
      net/compat.c:634:60: warning: incorrect type in initializer (different address spaces)
      net/compat.c:634:60:    expected struct compat_group_filter [noderef] <asn:1>*gf32
      net/compat.c:634:60:    got void *<noident>
      net/compat.c:672:52: warning: cast removes address space of expression
      net/compat.c:672:52: warning: incorrect type in initializer (different address spaces)
      net/compat.c:672:52:    expected struct compat_group_filter [noderef] <asn:1>*gf32
      net/compat.c:672:52:    got void *<noident>
      Signed-off-by: default avatarBen Dooks <ben.dooks@codethink.co.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      46d84110
    • Florian Fainelli's avatar
      net: dsa: Use prepare/commit phase in dsa_slave_vlan_rx_add_vid() · d6af21a4
      Florian Fainelli authored
      We were skipping the prepare phase which causes some problems with at
      least a couple of drivers:
      
      - mv88e6xxx chooses to skip programming VID = 0 with -EOPNOTSUPP in
        the prepare phase, but we would still try to force this VID since we
        would only call the commit phase and so we would get the driver to
        return -EINVAL instead
      
      - qca8k does not currently have a port_vlan_add() callback implemented,
        yet we would try to call that unconditionally leading to a NPD
      
      Fix both issues by conforming to the current model doing a
      prepare/commit phase, this makes us consistent throughout the code and
      assumptions.
      Reported-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Reported-by: default avatarMichal Vokáč <michal.vokac@ysoft.com>
      Fixes: 061f6a50 ("net: dsa: Add ndo_vlan_rx_{add, kill}_vid implementation")
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d6af21a4
    • David S. Miller's avatar
      Merge branch 'dpaa2-eth-add-XDP_REDIRECT-support' · a5f1512d
      David S. Miller authored
      Ioana Ciornei says:
      
      ====================
      dpaa2-eth: add XDP_REDIRECT support
      
      The first patch adds different software annotation types for Tx frames
      depending on frame type while the second one actually adds support for basic
      XDP_REDIRECT.
      
      Changes in v2:
        - add missing xdp_do_flush_map() call
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a5f1512d
    • Ioana Radulescu's avatar
      dpaa2-eth: add XDP_REDIRECT support · d678be1d
      Ioana Radulescu authored
      Implement support for the XDP_REDIRECT action.
      
      The redirected frame is transmitted and confirmed on the regular Tx/Tx
      conf queues. Frame is marked with the "XDP" type in the software
      annotation, since it requires special treatment.
      
      We don't have good hardware support for TX batching, so the
      XDP_XMIT_FLUSH flag doesn't make a difference for now; ndo_xdp_xmit
      performs the actual Tx operation on the spot.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarIoana Radulescu <ruxandra.radulescu@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d678be1d
    • Ioana Radulescu's avatar
      dpaa2-eth: Add software annotation types · e3fdf6ba
      Ioana Radulescu authored
      We write different metadata information in the software annotation
      area of Tx frames, depending on frame type. Make this more explicit
      by introducing a type field and separate structures for single buffer
      and scatter-gather frames.
      Signed-off-by: default avatarIoana Radulescu <ruxandra.radulescu@nxp.com>
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e3fdf6ba
    • David S. Miller's avatar
      Merge branch 'sched-Patches-from-out-of-tree-version-of-sch_cake' · 3cec12ce
      David S. Miller authored
      Toke Høiland-Jørgensen says:
      
      ====================
      sched: Patches from out-of-tree version of sch_cake
      
      This series includes a couple of patches with updates from the out-of-tree
      version of sch_cake. The first one is a fix to the fairness scheduling when
      dual-mode fairness is enabled. The second patch is an additional feature flag
      that allows using fwmark as a tin selector, as a convenience for people who want
      to customise tin selection. The third patch is just a cleanup to the tin
      selection logic.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3cec12ce
    • Toke Høiland-Jørgensen's avatar
      sch_cake: Simplify logic in cake_select_tin() · 4976e3c6
      Toke Høiland-Jørgensen authored
      With more modes added the logic in cake_select_tin() was getting a bit
      hairy, and it turns out we can actually simplify it quite a bit. This also
      allows us to get rid of one of the two diffserv parsing functions, which
      has the added benefit that already-zeroed DSCP fields won't get re-written.
      Suggested-by: default avatarKevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
      Signed-off-by: default avatarToke Høiland-Jørgensen <toke@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4976e3c6
    • Kevin Darbyshire-Bryant's avatar
      sch_cake: Permit use of connmarks as tin classifiers · 0b5c7efd
      Kevin Darbyshire-Bryant authored
      Add flag 'FWMARK' to enable use of firewall connmarks as tin selector.
      The connmark (skbuff->mark) needs to be in the range 1->tin_cnt ie.
      for diffserv3 the mark needs to be 1->3.
      
      Background
      
      Typically CAKE uses DSCP as the basis for tin selection.  DSCP values
      are relatively easily changed as part of the egress path, usually with
      iptables & the mangle table, ingress is more challenging.  CAKE is often
      used on the WAN interface of a residential gateway where passthrough of
      DSCP from the ISP is either missing or set to unhelpful values thus use
      of ingress DSCP values for tin selection isn't helpful in that
      environment.
      
      An approach to solving the ingress tin selection problem is to use
      CAKE's understanding of tc filters.  Naive tc filters could match on
      source/destination port numbers and force tin selection that way, but
      multiple filters don't scale particularly well as each filter must be
      traversed whether it matches or not. e.g. a simple example to map 3
      firewall marks to tins:
      
      MAJOR=$( tc qdisc show dev $DEV | head -1 | awk '{print $3}' )
      tc filter add dev $DEV parent $MAJOR protocol all handle 0x01 fw action skbedit priority ${MAJOR}1
      tc filter add dev $DEV parent $MAJOR protocol all handle 0x02 fw action skbedit priority ${MAJOR}2
      tc filter add dev $DEV parent $MAJOR protocol all handle 0x03 fw action skbedit priority ${MAJOR}3
      
      Another option is to use eBPF cls_act with tc filters e.g.
      
      MAJOR=$( tc qdisc show dev $DEV | head -1 | awk '{print $3}' )
      tc filter add dev $DEV parent $MAJOR bpf da obj my-bpf-fwmark-to-class.o
      
      This has the disadvantages of a) needing someone to write & maintain
      the bpf program, b) a bpf toolchain to compile it and c) needing to
      hardcode the major number in the bpf program so it matches the cake
      instance (or forcing the cake instance to a particular major number)
      since the major number cannot be passed to the bpf program via tc
      command line.
      
      As already hinted at by the previous examples, it would be helpful
      to associate tins with something that survives the Internet path and
      ideally allows tin selection on both egress and ingress.  Netfilter's
      conntrack permits setting an identifying mark on a connection which
      can also be restored to an ingress packet with tc action connmark e.g.
      
      tc filter add dev eth0 parent ffff: protocol all prio 10 u32 \
      	match u32 0 0 flowid 1:1 action connmark action mirred egress redirect dev ifb1
      
      Since tc's connmark action has restored any connmark into skb->mark,
      any of the previous solutions are based upon it and in one form or
      another copy that mark to the skb->priority field where again CAKE
      picks this up.
      
      This change cuts out at least one of the (less intuitive &
      non-scalable) middlemen and permit direct access to skb->mark.
      Signed-off-by: default avatarKevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
      Signed-off-by: default avatarToke Høiland-Jørgensen <toke@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0b5c7efd
    • George Amanakis's avatar
      sch_cake: Make the dual modes fairer · 71263992
      George Amanakis authored
      CAKE host fairness does not work well with TCP flows in dual-srchost and
      dual-dsthost setup. The reason is that ACKs generated by TCP flows are
      classified as sparse flows, and affect flow isolation from other hosts. Fix
      this by calculating host_load based only on the bulk flows a host
      generates. In a hash collision the host_bulk_flow_count values must be
      decremented on the old hosts and incremented on the new ones *if* the queue
      is in the bulk set.
      Reported-by: default avatarPete Heist <peteheist@gmail.com>
      Signed-off-by: default avatarGeorge Amanakis <gamanakis@gmail.com>
      Signed-off-by: default avatarToke Høiland-Jørgensen <toke@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      71263992
  2. 03 Mar, 2019 9 commits
  3. 02 Mar, 2019 21 commits
    • David S. Miller's avatar
      Merge tag 'mlx5-updates-2019-03-01' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux · d5fa9c55
      David S. Miller authored
      Saeed Mahameed says:
      
      ====================
      mlx5-updates-2019-03-01
      
      This series adds multipath offload support and contains some small updates
      to mlx5 driver.
      
      Multipath offload support from Roi Dayan:
      
      We are going to track SW multipath route and related nexthops and reflect
      that as port affinity to the HW.
      
      1) Some patches are preparation.
      2) add the multipath mode and fib events handling.
      3) add support to handle offload failure for net error, i.e.
      port down.
      4) Small updates to match the behavior of multipath
      
      Two small updates from Eran Ben Elisha,
      5) Make a function static
      6) Update PCIe supported devices list.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d5fa9c55
    • David S. Miller's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next · 4e7df119
      David S. Miller authored
      Pablo Neira Ayuso says:
      
      ====================
      Netfilter/IPVS updates for net-next
      
      The following patchset contains Netfilter/IPVS updates for net-next:
      
      1) Add .release_ops to properly unroll .select_ops, use it from nft_compat.
         After this change, we can remove list of extensions too to simplify this
         codebase.
      
      2) Update amanda conntrack helper to support v3.4, from Florian Tham.
      
      3) Get rid of the obsolete BUGPRINT macro in ebtables, from
         Florian Westphal.
      
      4) Merge IPv4 and IPv6 masquerading infrastructure into one single module.
         From Florian Westphal.
      
      5) Patchset to remove nf_nat_l3proto structure to get rid of
         indirections, from Florian Westphal.
      
      6) Skip unnecessary conntrack timeout updates in case the value is
         still the same, also from Florian Westphal.
      
      7) Remove unnecessary 'fall through' comments in empty switch cases,
         from Li RongQing.
      
      8) Fix lookup to fixed size hashtable sets on big endian with 32-bit keys.
      
      9) Incorrect logic to deactivate path of fixed size hashtable sets,
         element was being tested to self.
      
      10) Remove nft_hash_key(), the bitmap set is always selected for 16-bit
          keys.
      
      11) Use boolean whenever possible in IPVS codebase, from Andrea Claudi.
      
      12) Enter close state in conntrack if RST matches exact sequence number,
          from Florian Westphal.
      
      13) Initialize dst_cache in tunnel extension, from wenxu.
      
      14) Pass protocol as u16 to xt_check_match and xt_check_target, from
          Li RongQing.
      
      15) SCTP header is granted to be in a linear area from IPVS NAT handler,
          from Xin Long.
      
      16) Don't steal packets coming from slave VRF device from the
          ip_sabotage_in() path, from David Ahern.
      
      17) Fix unsafe update of basechain stats, from Li RongQing.
      
      18) Make sure CONNTRACK_LOCKS is power of 2 to let compiler optimize
          modulo operation as bitwise AND, from Li RongQing.
      
      19) Use device_attribute instead of internal definition in the IDLETIMER
          target, from Sami Tolvanen.
      
      20) Merge redir, masq and IPv4/IPv6 NAT chain types, from Florian Westphal.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4e7df119
    • David S. Miller's avatar
      Merge branch 'for-upstream' of... · 2369afb6
      David S. Miller authored
      Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next
      
      Johan Hedberg says:
      
      ====================
      pull request: bluetooth-next 2019-03-02
      
      Here's one more bluetooth-next pull request for the 5.1 kernel:
      
       - Added support for MediaTek MT7663U and MT7668U UART devices
       - Cleanups & fixes to the hci_qca driver
       - Fixed wakeup pin behavior for QCA6174A controller
      
      Please let me know if there are any issues pulling. Thanks.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2369afb6
    • David S. Miller's avatar
    • Sean Wang's avatar
      Bluetooth: mediatek: add support for MediaTek MT7663U and MT7668U UART devices · 22eaf6c9
      Sean Wang authored
      This adds the support of enabling MT7663U and MT7668U Bluetooth function
      running on the top of btmtkuart driver.
      
      There are a few differences between MT766[3,8]U and MT7622 where
      MT766[3,8]U are standalone devices based on UART transport while MT7622
      bluetooth is a built-in device on MediaTek SoC communicating with the host
      through BTIF serial transport. Thus, extra setup sequence is necessary
      for these standalone devices such as remote regulator and reset control via
      GPIO, baud rate changing handshake between the host and device and so on.
      Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      22eaf6c9
    • Sean Wang's avatar
      dt-bindings: net: bluetooth: add support for MediaTek MT7663U and MT7668U UART devices · b805c403
      Sean Wang authored
      Update binding document with adding support of MT7663U and MT7668U UART
      devices to mediatek-bluetooth.
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      b805c403
    • Matthias Kaehlcke's avatar
      Bluetooth: hci_qca: Reduce delay after sending baudrate request for WCN3990 · 94d66714
      Matthias Kaehlcke authored
      The current 300ms delay after a baudrate change is extremely long.
      For WCN3990 it is sufficient to wait 10ms after the baudrate change
      request has been sent over the wire.
      Signed-off-by: default avatarMatthias Kaehlcke <mka@chromium.org>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      94d66714
    • David S. Miller's avatar
      Merge tag 'wireless-drivers-next-for-davem-2019-03-01' of... · cf29576f
      David S. Miller authored
      Merge tag 'wireless-drivers-next-for-davem-2019-03-01' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next
      
      Kalle Valo says:
      
      ====================
      wireless-drivers-next patches for 5.1
      
      Last set of patches. A new hardware support for mt76 otherwise quite
      normal.
      
      Major changes:
      
      mt76
      
      * add driver for MT7603E/MT7628
      
      ath10k
      
      * more preparation for SDIO support
      
      wil6210
      
      * support up to 20 stations in AP mode
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cf29576f
    • Mao Wenan's avatar
      net: sit: fix memory leak in sit_init_net() · 07f12b26
      Mao Wenan authored
      If register_netdev() is failed to register sitn->fb_tunnel_dev,
      it will go to err_reg_dev and forget to free netdev(sitn->fb_tunnel_dev).
      
      BUG: memory leak
      unreferenced object 0xffff888378daad00 (size 512):
        comm "syz-executor.1", pid 4006, jiffies 4295121142 (age 16.115s)
        hex dump (first 32 bytes):
          00 e6 ed c0 83 88 ff ff 00 00 00 00 00 00 00 00  ................
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
      backtrace:
          [<00000000d6dcb63e>] kvmalloc include/linux/mm.h:577 [inline]
          [<00000000d6dcb63e>] kvzalloc include/linux/mm.h:585 [inline]
          [<00000000d6dcb63e>] netif_alloc_netdev_queues net/core/dev.c:8380 [inline]
          [<00000000d6dcb63e>] alloc_netdev_mqs+0x600/0xcc0 net/core/dev.c:8970
          [<00000000867e172f>] sit_init_net+0x295/0xa40 net/ipv6/sit.c:1848
          [<00000000871019fa>] ops_init+0xad/0x3e0 net/core/net_namespace.c:129
          [<00000000319507f6>] setup_net+0x2ba/0x690 net/core/net_namespace.c:314
          [<0000000087db4f96>] copy_net_ns+0x1dc/0x330 net/core/net_namespace.c:437
          [<0000000057efc651>] create_new_namespaces+0x382/0x730 kernel/nsproxy.c:107
          [<00000000676f83de>] copy_namespaces+0x2ed/0x3d0 kernel/nsproxy.c:165
          [<0000000030b74bac>] copy_process.part.27+0x231e/0x6db0 kernel/fork.c:1919
          [<00000000fff78746>] copy_process kernel/fork.c:1713 [inline]
          [<00000000fff78746>] _do_fork+0x1bc/0xe90 kernel/fork.c:2224
          [<000000001c2e0d1c>] do_syscall_64+0xc8/0x580 arch/x86/entry/common.c:290
          [<00000000ec48bd44>] entry_SYSCALL_64_after_hwframe+0x49/0xbe
          [<0000000039acff8a>] 0xffffffffffffffff
      Signed-off-by: default avatarMao Wenan <maowenan@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      07f12b26
    • Andrew Lunn's avatar
      net: dsa: mv88e6xxx: Fix statistics on mv88e6161 · a6da21bb
      Andrew Lunn authored
      Despite what the datesheet says, the silicon implements the older way
      of snapshoting the statistics. Change the op.
      
      Reported-by: Chris.Healy@zii.aero
      Tested-by: Chris.Healy@zii.aero
      Fixes: 0ac64c39 ("net: dsa: mv88e6xxx: mv88e6161 uses mv88e6320 stats snapshot")
      Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a6da21bb
    • Ido Schimmel's avatar
      net: ipv4: Fix NULL pointer dereference in route lookup · 2a8e4997
      Ido Schimmel authored
      When calculating the multipath hash for input routes the flow info is
      not available and therefore should not be used.
      
      Fixes: 24ba1440 ("route: Add multipath_hash in flowi_common to make user-define hash")
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Cc: wenxu <wenxu@ucloud.cn>
      Acked-by: default avatarwenxu <wenxu@ucloud.cn>
      Acked-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2a8e4997
    • David S. Miller's avatar
      Merge branch 'net-mvpp2-fixes-and-improvements' · 04c2632a
      David S. Miller authored
      Antoine Tenart says:
      
      ====================
      net: mvpp2: fixes and improvements
      
      This series aims to improve the Marvell PPv2 driver and to fix various
      issues we encountered while testing the ports in many different
      configurations. The series is based on top of Russell PPv2 phylink
      rework and improvement.
      
      I'm not sending a v2 of the previous fixes series as half the patches
      are not the same and lots of development happened in between.
      
      While this series contains fixes, it's sent to net-next as it is based
      on top of Russell patches that were merged into net-next. I'm also
      aiming at net-next as the series reworks critical paths of the PPv2
      driver, such as the reset handling of various blocks, to let more weeks
      for users to tests and for possible fixes to be sent before it lands
      into a stable kernel version.
      
      The series is divided into three parts:
      
      - Patches 1 to 3 are cosmetic changes, sent alongside the series, as I
        saw these small issues while working on this.
      
      - Patches 5 to 8 are fixing (or improving) individual issues that we
        found while testing PPv2.1 and PPv2.2 ports while using various
        interfaces.
      
        Notable fixes are we support back RGMII interfaces (on both PPv2.1 and
        PPv2.2), as their support was broken by previous patches. We also
        reworked the RXQ computation as the RXQ assignment was not checking
        the maximum number of RXQ available, and was broken for PPv2.1.
      
      - As discussed in a previous fixes series, patches 9 to 15 rework the
        way blocks are set in reset in the PPv2 engine (plus related changes).
      
        There are four blocks we want to control the reset status: two MAC
        (GMAC and XLG MAC) and two PCS (MPCS and XPCS). The XLG MAC is used
        for 10G connexions and uses the MPCS or the XPCS depending on the mode
        used (10GKR / XAUI / RXAUI) and the GMAC is used for the other modes.
      
        The idea is to set all blocks in reset by default, and when not used,
        and to de-assert the reset only when a block is used. There are four
        cases to take in account:
      
        1. Boot time: all four blocks should be put in reset, as we do not
           know their initial state (configured by the firmware/bootloader).
      
        2. Link up: only the blocks used by a given mode should be put out of
           reset (eg. 10GKR uses the XLG MAC and the MPCS).
      
        3. Mode reconfiguration: some ports may support mode reconfiguration,
           and switching between the GMAC and the XLG MAC (or between the two
           PCS). All blocks should be put in reset, and only the one used
           should be put out of reset.
      
        4. Link down: all four blocks are put in reset.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      04c2632a
    • Antoine Tenart's avatar
      net: mvpp2: set the GMAC, XLG MAC, XPCS and MPCS in reset when a port is down · 1f69afce
      Antoine Tenart authored
      This patch adds calls in the stop() helper to ensure both MACs and
      both PCS blocks are set in reset when the user manually sets a port
      down. This is done so that we have the exact same block reset states at
      boot time and when a port is set down.
      Signed-off-by: default avatarAntoine Tenart <antoine.tenart@bootlin.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1f69afce
    • Antoine Tenart's avatar
      net: mvpp2: set the XPCS and MPCS in reset when not used · 7409e66e
      Antoine Tenart authored
      This patch sets both the XPCS and MPCS blocks in reset when they aren't
      used. This is done both at boot time and when reconfiguring a port mode.
      The advantage now is that only the PCS used is set out of reset when the
      port is configured (10GKR uses the MCPS while RXAUI uses the XPCS).
      Signed-off-by: default avatarAntoine Tenart <antoine.tenart@bootlin.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7409e66e
    • Antoine Tenart's avatar
      net: mvpp2: reset the MACs when reconfiguring a port · 5434e8fa
      Antoine Tenart authored
      This patch makes sure both PPv2 MACs (GMAC + XLG MAC) are set in reset
      while a port is reconfigured. This is done so that we make sure a MAC is
      in a reset state when not used, as only one of the two will be set out
      of reset after the port is configured properly.
      Signed-off-by: default avatarAntoine Tenart <antoine.tenart@bootlin.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5434e8fa
    • Antoine Tenart's avatar
      net: mvpp2: rework the XLG MAC reset handling · 649e51d5
      Antoine Tenart authored
      This patch reworks the way the XLG MAC is set in reset: the XLG MAC is
      set in reset at probe time and taken out of this state only when used.
      The idea is to move forward a situation where only the blocks used are
      taken out of reset. This also has the effect to handle the GMAC and the
      XLG MAC in a similar way (the GMAC already is set in reset at boot
      time).
      Signed-off-by: default avatarAntoine Tenart <antoine.tenart@bootlin.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      649e51d5
    • Antoine Tenart's avatar
      net: mvpp2: force the XLG MAC link up or down when not using in-band · 1970ee96
      Antoine Tenart authored
      This patch force the XLG MAC link state in the phylink link_up() and
      link_down() helpers when not using in-band auto-negotiation. This mimics
      what's already done for the GMAC and follows what's advised in the
      phylink documentation.
      Signed-off-by: default avatarAntoine Tenart <antoine.tenart@bootlin.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1970ee96
    • Antoine Tenart's avatar
      net: mvpp2: only update the XLG configuration when needed · f17e70d2
      Antoine Tenart authored
      This patch improves the XLG configuration function, to only update the
      XLG configuration register when a change is needed. This helps not
      writing over and over the same XLG configuration each time phylink
      request the MAC to be configured. This mimics the GMAC configuration
      function.
      Signed-off-by: default avatarAntoine Tenart <antoine.tenart@bootlin.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f17e70d2
    • Antoine Tenart's avatar
      net: mvpp2: always disable both MACs when disabling a port · 6b10bfc5
      Antoine Tenart authored
      This patch modifies the port_disable() helper to always disable both the
      GMAC and the XLG MAC when called. At boot time we do not know of a port
      was enabled in the firmware/bootloader, and if so what mode was used
      (hence which of the two MACs was used).
      
      This also help in implementing a logic where all blocks are disabled
      when not used, and only enabled regarding the current mode used on a
      given port.
      Signed-off-by: default avatarAntoine Tenart <antoine.tenart@bootlin.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6b10bfc5
    • Antoine Tenart's avatar
      net: mvpp2: some AN fields require the link to be down when updated · 9a490e34
      Antoine Tenart authored
      The GMAC configuration helper modifies values in the auto-negotiation
      register. Some of its values require the port to be forced down when
      modifying their values. This patches fixes the check made on the bit to
      be updated in this register, so that the port is forced down when
      needed. This fix cases where some of those parameters were updated, but
      not taken into account, such as when using RGMII interfaces.
      
      Fixes: d14e078f ("net: marvell: mvpp2: only reprogram what is necessary on mac_config")
      Signed-off-by: default avatarAntoine Tenart <antoine.tenart@bootlin.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9a490e34
    • Antoine Tenart's avatar
      net: mvpp2: fix the computation of the RXQs · 3f136849
      Antoine Tenart authored
      The patch fixes the computation of RXQs being used by the PPv2 driver,
      which is set depending on the PPv2 engine version and the queue mode
      used. There are three cases:
      
      - PPv2.1: 1 RXQ per CPU.
      - PPV2.2 with MVPP2_QDIST_MULTI_MODE: 1 RXQ per CPU.
      - PPv2.2 with MVPP2_QDIST_SINGLE_MODE: 1 RXQ is shared between the CPUs.
      
      The PPv2 engine supports a maximum of 32 queues per port. This patch
      adds a check so that we do not overstep this maximum.
      
      It appeared the calculation was broken for PPv2.1 engines since
      f8c6ba84, as PPv2.1 ports ended up with a single RXQ while they
      needed 4. This patch fixes it.
      
      Fixes: f8c6ba84 ("net: mvpp2: use only one rx queue per port per CPU")
      Signed-off-by: default avatarAntoine Tenart <antoine.tenart@bootlin.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3f136849