Skip to content
  1. Jun 23, 2021
    • Marcin Wojtas's avatar
      net/fsl: switch to fwnode_mdiobus_register · 33fc11f0
      Marcin Wojtas authored
      
      
      Utilize the newly added helper routine
      for registering the MDIO bus via fwnode_
      interface.
      
      Signed-off-by: default avatarMarcin Wojtas <mw@semihalf.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      33fc11f0
    • Marcin Wojtas's avatar
      net: mdiobus: Introduce fwnode_mdbiobus_register() · 62a6ef6a
      Marcin Wojtas authored
      
      
      This patch introduces a new helper function that
      wraps acpi_/of_ mdiobus_register() and allows its
      usage via common fwnode_ interface.
      
      Fall back to raw mdiobus_register() in case CONFIG_FWNODE_MDIO
      is not enabled, in order to satisfy compatibility
      in all future user drivers.
      
      Signed-off-by: default avatarMarcin Wojtas <mw@semihalf.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      62a6ef6a
    • Marcin Wojtas's avatar
      Documentation: ACPI: DSD: describe additional MAC configuration · 7c4d7ca8
      Marcin Wojtas authored
      
      
      Document additional MAC configuration modes which can be processed
      by the existing fwnode_ phylink helpers:
      
      * "managed" standard ACPI _DSD property [1]
      * "fixed-link" data-only subnode linked in the _DSD package via
        generic mechanism of the hierarchical data extension [2]
      
      [1] https://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf
      [2] https://github.com/UEFI/DSD-Guide/blob/main/dsd-guide.pdf
      
      Signed-off-by: default avatarMarcin Wojtas <mw@semihalf.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7c4d7ca8
    • Eric Dumazet's avatar
      virtio/vsock: avoid NULL deref in virtio_transport_seqpacket_allow() · 64295f0d
      Eric Dumazet authored
      Make sure the_virtio_vsock is not NULL before dereferencing it.
      
      general protection fault, probably for non-canonical address 0xdffffc0000000071: 0000 [#1] PREEMPT SMP KASAN
      KASAN: null-ptr-deref in range [0x0000000000000388-0x000000000000038f]
      CPU: 0 PID: 8452 Comm: syz-executor406 Not tainted 5.13.0-rc6-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      RIP: 0010:virtio_transport_seqpacket_allow+0xbf/0x210 net/vmw_vsock/virtio_transport.c:503
      Code: e8 c6 d9 ab f8 84 db 0f 84 0f 01 00 00 e8 09 d3 ab f8 48 8d bd 88 03 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 06 0f 8e 2a 01 00 00 44 0f b6 a5 88 03 00 00
      RSP: 0018:ffffc90003757c18 EFLAGS: 00010206
      RAX: dffffc0000000000 RBX: 0000000000000001 RCX: 0000000000000000
      RDX: 0000000000000071 RSI: ffffffff88c908e7 RDI: 0000000000000388
      RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
      R10: ffffffff88c90a06 R11: 0000000000000000 R12: 0000000000000000
      R13: ffffffff88c90840 R14: 0000000000000000 R15: 0000000000000001
      FS:  0000000001bee300(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000020000082 CR3: 000000002847e000 CR4: 00000000001506f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       vsock_assign_transport+0x575/0x700 net/vmw_vsock/af_vsock.c:490
       vsock_connect+0x200/0xc00 net/vmw_vsock/af_vsock.c:1337
       __sys_connect_file+0x155/0x1a0 net/socket.c:1824
       __sys_connect+0x161/0x190 net/socket.c:1841
       __do_sys_connect net/socket.c:1851 [inline]
       __se_sys_connect net/socket.c:1848 [inline]
       __x64_sys_connect+0x6f/0xb0 net/socket.c:1848
       do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      RIP: 0033:0x43ee69
      Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
      RSP: 002b:00007ffd49e7c788 EFLAGS: 00000246 ORIG_RAX: 000000000000002a
      RAX: ffffffffffffffda RBX: 0000000000400488 RCX: 000000000043ee69
      RDX: 0000000000000010 RSI: 0000000020000080 RDI: 0000000000000003
      RBP: 0000000000402e50 R08: 0000000000000000 R09: 0000000000400488
      R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000402ee0
      R13: 0000000000000000 R14: 00000000004ac018 R15: 0000000000400488
      
      Fixes: 53efbba1
      
       ("virtio/vsock: enable SEQPACKET for transport")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Arseny Krasnov <arseny.krasnov@kaspersky.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Reviewed-by: default avatarStefano Garzarella <sgarzare@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      64295f0d
  2. Jun 22, 2021
    • Kees Cook's avatar
      ibmvnic: Use strscpy() instead of strncpy() · ef2c3dda
      Kees Cook authored
      
      
      Since these strings are expected to be NUL-terminated and the buffers
      are exactly sized (in vnic_client_data_len()) with no padding, strncpy()
      can be safely replaced with strscpy() here, as strncpy() on
      NUL-terminated string is considered deprecated[1]. This has the
      side-effect of silencing a -Warray-bounds warning due to the compiler
      being confused about the vlcd incrementing:
      
      In file included from ./include/linux/string.h:253,
                       from ./include/linux/bitmap.h:10,
                       from ./include/linux/cpumask.h:12,
                       from ./include/linux/mm_types_task.h:14,
                       from ./include/linux/mm_types.h:5,
                       from ./include/linux/buildid.h:5,
                       from ./include/linux/module.h:14,
                       from drivers/net/ethernet/ibm/ibmvnic.c:35:
      In function '__fortify_strncpy',
          inlined from 'vnic_add_client_data' at drivers/net/ethernet/ibm/ibmvnic.c:3919:2:
      ./include/linux/fortify-string.h:39:30: warning: '__builtin_strncpy' offset 12 from the object at 'v
      lcd' is out of the bounds of referenced subobject 'name' with type 'char[]' at offset 12 [-Warray-bo
      unds]
         39 | #define __underlying_strncpy __builtin_strncpy
            |                              ^
      ./include/linux/fortify-string.h:51:9: note: in expansion of macro '__underlying_strncpy'
         51 |  return __underlying_strncpy(p, q, size);
            |         ^~~~~~~~~~~~~~~~~~~~
      drivers/net/ethernet/ibm/ibmvnic.c: In function 'vnic_add_client_data':
      drivers/net/ethernet/ibm/ibmvnic.c:3883:7: note: subobject 'name' declared here
       3883 |  char name[];
            |       ^~~~
      
      [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings
      
      Cc: Dany Madden <drt@linux.ibm.com>
      Cc: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
      Cc: Thomas Falcon <tlfalcon@linux.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: netdev@vger.kernel.org
      Cc: linuxppc-dev@lists.ozlabs.org
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ef2c3dda
    • Guillaume Nault's avatar
      net: handle ARPHRD_IP6GRE in dev_is_mac_header_xmit() · a3fa449f
      Guillaume Nault authored
      Similar to commit 3b707c30
      
       ("net: dev_is_mac_header_xmit() true for
      ARPHRD_RAWIP"), add ARPHRD_IP6GRE to dev_is_mac_header_xmit(), to make
      ip6gre compatible with act_mirred and __bpf_redirect().
      
      Signed-off-by: default avatarGuillaume Nault <gnault@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a3fa449f
    • Boris Sukholitko's avatar
      Revert "net/sched: cls_flower: Remove match on n_proto" · 6d551617
      Boris Sukholitko authored
      This reverts commit 0dca2c74
      
      .
      
      The commit in question breaks hardware offload of flower filters.
      
      Quoting Vladimir Oltean <olteanv@gmail.com>:
      
       fl_hw_replace_filter() and fl_reoffload() create a struct
       flow_cls_offload with a rule->match.mask member derived from the mask
       of the software classifier: &f->mask->key - that same mask that is used
       for initializing the flow dissector keys, and the one from which Boris
       removed the basic.n_proto member because it was bothering him.
      
      Reported-by: default avatarVadym Kochan <vadym.kochan@plvision.eu>
      Signed-off-by: default avatarBoris Sukholitko <boris.sukholitko@broadcom.com>
      Reviewed-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6d551617
    • Esben Haabendal's avatar
      net: ll_temac: Remove left-over debug message · ce03b94b
      Esben Haabendal authored
      Fixes: f6396341
      
       ("net: ll_temac: Avoid ndo_start_xmit returning NETDEV_TX_BUSY")
      Signed-off-by: default avatarEsben Haabendal <esben@geanix.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ce03b94b
    • Yejune Deng's avatar
      net: add pf_family_names[] for protocol family · fe0bdbde
      Yejune Deng authored
      
      
      Modify the pr_info content from int to char * in sock_register() and
      sock_unregister(), this looks more readable.
      
      Fixed build error in ARCH=sparc64.
      
      Signed-off-by: default avatarYejune Deng <yejune.deng@gmail.com>
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fe0bdbde
    • David S. Miller's avatar
      Merge branch 'ingenic-fixes' · c829de39
      David S. Miller authored
      
      
      Zhou Yanjie says:
      
      ====================
      Fix for Ingenic MAC support.
      
      1.Remove the unexpected "snps,dwmac" item in the example.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c829de39
    • 周琰杰 (Zhou Yanjie)'s avatar
      dt-bindings: dwmac: Remove unexpected item. · 19e068b1
      周琰杰 (Zhou Yanjie) authored
      Remove the unexpected "snps,dwmac" item in the example.
      
      Fixes: 3b840106
      
       ("dt-bindings: dwmac: Add bindings for new Ingenic SoCs.")
      
      Signed-off-by: default avatar周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      19e068b1
    • Christophe JAILLET's avatar
      net: hns3: Fix a memory leak in an error handling path in 'hclge_handle_error_info_log()' · b40d7af7
      Christophe JAILLET authored
      If this 'kzalloc()' fails we must free some resources as in all the other
      error handling paths of this function.
      
      Fixes: 2e2deee7
      
       ("net: hns3: add the RAS compatibility adaptation solution")
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Reviewed-by: default avatarJiaran Zhang <zhangjiaran@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b40d7af7
    • David S. Miller's avatar
      Merge branch 'fec-tx' · ebe9d9eb
      David S. Miller authored
      
      
      Joakim Zhang says:
      
      ====================
      net: fec: fix TX bandwidth fluctuations
      
      This patch set intends to fix TX bandwidth fluctuations, any feedback would be appreciated.
      
      ---
      ChangeLogs:
      	V1: remove RFC tag, RFC discussions please turn to below:
      	    https://lore.kernel.org/lkml/YK0Ce5YxR2WYbrAo@lunn.ch/T/
      	V2: change functions to be static in this patch set. And add the
      	t-b tag.
      	V3: fix sparse warining: ntohs()->htons()
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ebe9d9eb
    • Fugang Duan's avatar
      net: fec: add ndo_select_queue to fix TX bandwidth fluctuations · 52c4a1a8
      Fugang Duan authored
      
      
      As we know that AVB is enabled by default, and the ENET IP design is
      queue 0 for best effort, queue 1&2 for AVB Class A&B. Bandwidth of each
      queue 1&2 set in driver is 50%, TX bandwidth fluctuated when selecting
      tx queues randomly with FEC_QUIRK_HAS_AVB quirk available.
      
      This patch adds ndo_select_queue callback to select queues for
      transmitting to fix this issue. It will always return queue 0 if this is
      not a vlan packet, and return queue 1 or 2 based on priority of vlan
      packet.
      
      You may complain that in fact we only use single queue for trasmitting
      if we are not targeted to VLAN. Yes, but seems we have no choice, since
      AVB is enabled when the driver probed, we can't switch this feature
      dynamicly. After compare multiple queues to single queue, TX throughput
      almost no improvement.
      
      One way we can implemet is to configure the driver to multiple queues
      with Round-robin scheme by default. Then add ndo_setup_tc callback to
      enable/disable AVB feature for users. Unfortunately, ENET AVB IP seems
      not follow the standard 802.1Qav spec. We only can program
      DMAnCFG[IDLE_SLOPE] field to calculate bandwidth fraction. And idle
      slope is restricted to certain valus (a total of 19). It's far away from
      CBS QDisc implemented in Linux TC framework. If you strongly suggest to do
      this, I think we only can support limited numbers of bandwidth and reject
      others, but it's really urgly and wried.
      
      With this patch, VLAN tagged packets route to queue 0/1/2 based on vlan
      priority; VLAN untagged packets route to queue 0.
      
      Tested-by: default avatarFrieder Schrempf <frieder.schrempf@kontron.de>
      Reported-by: default avatarFrieder Schrempf <frieder.schrempf@kontron.de>
      Signed-off-by: default avatarFugang Duan <fugang.duan@nxp.com>
      Signed-off-by: default avatarJoakim Zhang <qiangqing.zhang@nxp.com>
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      52c4a1a8
    • Joakim Zhang's avatar
      net: fec: add FEC_QUIRK_HAS_MULTI_QUEUES represents i.MX6SX ENET IP · 471ff445
      Joakim Zhang authored
      
      
      Frieder Schrempf reported a TX throuthput issue [1], it happens quite often
      that the measured bandwidth in TX direction drops from its expected/nominal
      value to something like ~50% (for 100M) or ~67% (for 1G) connections.
      
      [1] https://lore.kernel.org/linux-arm-kernel/421cc86c-b66f-b372-32f7-21e59f9a98bc@kontron.de/
      
      The issue becomes clear after digging into it, Net core would select
      queues when transmitting packets. Since FEC have not impletemented
      ndo_select_queue callback yet, so it will call netdev_pick_tx to select
      queues randomly.
      
      For i.MX6SX ENET IP with AVB support, driver default enables this
      feature. According to the setting of QOS/RCMRn/DMAnCFG registers, AVB
      configured to Credit-based scheme, 50% bandwidth of each queue 1&2.
      
      With below tests let me think more:
      1) With FEC_QUIRK_HAS_AVB quirk, can reproduce TX bandwidth fluctuations issue.
      2) Without FEC_QUIRK_HAS_AVB quirk, can't reproduce TX bandwidth fluctuations issue.
      
      The related difference with or w/o FEC_QUIRK_HAS_AVB quirk is that, whether we
      program FTYPE field of TxBD or not. As I describe above, AVB feature is
      enabled by default. With FEC_QUIRK_HAS_AVB quirk, frames in queue 0
      marked as non-AVB, and frames in queue 1&2 marked as AVB Class A&B. It's
      unreasonable if frames in queue 1&2 are not required to be time-sensitive.
      So when Net core select tx queues ramdomly, Credit-based scheme would work
      and lead to TX bandwidth fluctuated. On the other hand, w/o
      FEC_QUIRK_HAS_AVB quirk, frames in queue 1&2 are all marked as non-AVB, so
      Credit-based scheme would not work.
      
      Till now, how can we fix this TX throughput issue? Yes, please remove
      FEC_QUIRK_HAS_AVB quirk if you suffer it from time-nonsensitive networking.
      However, this quirk is used to indicate i.MX6SX, other setting depends
      on it. So this patch adds a new quirk FEC_QUIRK_HAS_MULTI_QUEUES to
      represent i.MX6SX, it is safe for us remove FEC_QUIRK_HAS_AVB quirk
      now.
      
      FEC_QUIRK_HAS_AVB quirk is set by default in the driver, and users may
      not know much about driver details, they would waste effort to find the
      root cause, that is not we want. The following patch is a implementation
      to fix it and users don't need to modify the driver.
      
      Tested-by: default avatarFrieder Schrempf <frieder.schrempf@kontron.de>
      Reported-by: default avatarFrieder Schrempf <frieder.schrempf@kontron.de>
      Signed-off-by: default avatarJoakim Zhang <qiangqing.zhang@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      471ff445
    • David S. Miller's avatar
      Merge branch 'dsa-cross-chip' · 6ff5f813
      David S. Miller authored
      
      
      Vladimir Oltean says:
      
      ====================
      Improvement for DSA cross-chip setups
      
      This series improves some aspects in multi-switch DSA tree topologies:
      - better device tree validation
      - better handling of MTU changes
      - better handling of multicast addresses
      - removal of some unused code
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6ff5f813
    • Vladimir Oltean's avatar
      net: dsa: remove cross-chip support from the MRP notifiers · f9bcdc36
      Vladimir Oltean authored
      
      
      With MRP hardware assist being supported only by the ocelot switch
      family, which by design does not support cross-chip bridging, the
      current match functions are at best a guess and have not been confirmed
      in any way to do anything relevant in a multi-switch topology.
      
      Drop the code and make the notifiers match only on the targeted switch
      port.
      
      Cc: Horatiu Vultur <horatiu.vultur@microchip.com>
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f9bcdc36
    • Vladimir Oltean's avatar
      net: dsa: targeted MTU notifiers should only match on one port · 88faba20
      Vladimir Oltean authored
      
      
      dsa_slave_change_mtu() calls dsa_port_mtu_change() twice:
      - it sends a cross-chip notifier with the MTU of the CPU port which is
        used to update the DSA links.
      - it sends one targeted MTU notifier which is supposed to only match the
        user port on which we are changing the MTU. The "propagate_upstream"
        variable is used here to bypass the cross-chip notifier system from
        switch.c
      
      But due to a mistake, the second, targeted notifier matches not only on
      the user port, but also on the DSA link which is a member of the same
      switch, if that exists.
      
      And because the DSA links of the entire dst were programmed in a
      previous round to the largest_mtu via a "propagate_upstream == true"
      notification, then the dsa_port_mtu_change(propagate_upstream == false)
      call that is immediately upcoming will break the MTU on the one DSA link
      which is chip-wise local to the dp whose MTU is changing right now.
      
      Example given this daisy chain topology:
      
         sw0p0     sw0p1     sw0p2     sw0p3     sw0p4
      [  cpu  ] [  user ] [  user ] [  dsa  ] [  user ]
      [   x   ] [       ] [       ] [   x   ] [       ]
                                        |
                                        +---------+
                                                  |
         sw1p0     sw1p1     sw1p2     sw1p3     sw1p4
      [  user ] [  user ] [  user ] [  dsa  ] [  dsa  ]
      [       ] [       ] [       ] [       ] [   x   ]
      
      ip link set sw0p1 mtu 9000
      ip link set sw1p1 mtu 9000 # at this stage, sw0p1 and sw1p1 can talk
                                 # to one another using jumbo frames
      ip link set sw0p2 mtu 1500 # this programs the sw0p3 DSA link first to
                                 # the largest_mtu of 9000, then reprograms it to
                                 # 1500 with the "propagate_upstream == false"
                                 # notifier, breaking communication between
                                 # sw0p1 and sw1p1
      
      To escape from this situation, make the targeted match really match on a
      single port - the user port, and rename the "propagate_upstream"
      variable to "targeted_match" to clarify the intention and avoid future
      issues.
      
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      88faba20
    • Vladimir Oltean's avatar
      net: dsa: calculate the largest_mtu across all ports in the tree · 4e4ab795
      Vladimir Oltean authored
      
      
      If we have a cross-chip topology like this:
      
         sw0p0     sw0p1     sw0p2     sw0p3     sw0p4
      [  cpu  ] [  user ] [  user ] [  dsa  ] [  user ]
                                        |
                                        +---------+
                                                  |
         sw1p0     sw1p1     sw1p2     sw1p3     sw1p4
      [  user ] [  user ] [  user ] [  dsa  ] [  dsa  ]
      
      and we issue the following commands:
      
      1. ip link set sw0p1 mtu 1700
      2. ip link set sw1p1 mtu 1600
      
      we notice the following happening:
      
      Command 1. emits a non-targeted MTU notifier for the CPU port (sw0p0)
      with the largest_mtu calculated across switch 0, of 1700. This matches
      sw0p0, sw0p3 and sw1p4 (all CPU ports and DSA links).
      Then, it emits a targeted MTU notifier for the user port (sw0p1), again
      with MTU 1700 (this doesn't matter).
      
      Command 2. emits a non-targeted MTU notifier for the CPU port (sw0p0)
      with the largest_mtu calculated across switch 1, of 1600. This matches
      the same group of ports as above, and decreases the MTU for the CPU port
      and the DSA links from 1700 to 1600.
      
      As a result, the sw0p1 user port can no longer communicate with its CPU
      port at MTU 1700.
      
      To address this, we should calculate the largest_mtu across all switches
      that may share a CPU port, and only emit MTU notifiers with that value.
      
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4e4ab795
    • Vladimir Oltean's avatar
      net: dsa: execute dsa_switch_mdb_add only for routing port in cross-chip topologies · abd49535
      Vladimir Oltean authored
      
      
      Currently, the notifier for adding a multicast MAC address matches on
      the targeted port and on all DSA links in the system, be they upstream
      or downstream links.
      
      This leads to a considerable amount of useless traffic.
      
      Consider this daisy chain topology, and a MDB add notifier emitted on
      sw0p0. It matches on sw0p0, sw0p3, sw1p3 and sw2p4.
      
         sw0p0     sw0p1     sw0p2     sw0p3     sw0p4
      [  user ] [  user ] [  user ] [  dsa  ] [  cpu  ]
      [   x   ] [       ] [       ] [   x   ] [       ]
                                        |
                                        +---------+
                                                  |
         sw1p0     sw1p1     sw1p2     sw1p3     sw1p4
      [  user ] [  user ] [  user ] [  dsa  ] [  dsa  ]
      [       ] [       ] [       ] [   x   ] [   x   ]
                                        |
                                        +---------+
                                                  |
         sw2p0     sw2p1     sw2p2     sw2p3     sw2p4
      [  user ] [  user ] [  user ] [  user ] [  dsa  ]
      [       ] [       ] [       ] [       ] [   x   ]
      
      But switch 0 has no reason to send the multicast traffic for that MAC
      address on sw0p3, which is how it reaches switches 1 and 2. Those
      switches don't expect, according to the user configuration, to receive
      this multicast address from switch 1, and they will drop it anyway,
      because the only valid destination is the port they received it on.
      They only need to configure themselves to deliver that multicast address
      _towards_ switch 1, where the MDB entry is installed.
      
      Similarly, switch 1 should not send this multicast traffic towards
      sw1p3, because that is how it reaches switch 2.
      
      With this change, the heat map for this MDB notifier changes as follows:
      
         sw0p0     sw0p1     sw0p2     sw0p3     sw0p4
      [  user ] [  user ] [  user ] [  dsa  ] [  cpu  ]
      [   x   ] [       ] [       ] [       ] [       ]
                                        |
                                        +---------+
                                                  |
         sw1p0     sw1p1     sw1p2     sw1p3     sw1p4
      [  user ] [  user ] [  user ] [  dsa  ] [  dsa  ]
      [       ] [       ] [       ] [       ] [   x   ]
                                        |
                                        +---------+
                                                  |
         sw2p0     sw2p1     sw2p2     sw2p3     sw2p4
      [  user ] [  user ] [  user ] [  user ] [  dsa  ]
      [       ] [       ] [       ] [       ] [   x   ]
      
      Now the mdb notifier behaves the same as the fdb notifier.
      
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      abd49535
    • Vladimir Oltean's avatar
      net: dsa: export the dsa_port_is_{user,cpu,dsa} helpers · a8986681
      Vladimir Oltean authored
      
      
      The difference between dsa_is_user_port and dsa_port_is_user is that the
      former needs to look up the list of ports of the DSA switch tree in
      order to find the struct dsa_port, while the latter directly receives it
      as an argument.
      
      dsa_is_user_port is already in widespread use and has its place, so
      there isn't any chance of converting all callers to a single form.
      But being able to do:
      	dsa_port_is_user(dp)
      instead of
      	dsa_is_user_port(dp->ds, dp->index)
      
      is much more efficient too, especially when the "dp" comes from an
      iterator over the DSA switch tree - this reduces the complexity from
      quadratic to linear.
      
      Move these helpers from dsa2.c to include/net/dsa.h so that others can
      use them too.
      
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a8986681
    • Vladimir Oltean's avatar
      net: dsa: assert uniqueness of dsa,member properties · 8674f8d3
      Vladimir Oltean authored
      
      
      The cross-chip notifiers work by comparing each ds->index against the
      info->sw_index value from the notifier. The ds->index is retrieved from
      the device tree dsa,member property.
      
      If a single tree cross-chip topology does not declare unique switch IDs,
      this will result in hard-to-debug issues/voodoo effects such as the
      cross-chip notifier for one switch port also matching the port with the
      same number from another switch.
      
      Check in dsa_switch_parse_member_of() whether the DSA switch tree
      contains a DSA switch with the index we're preparing to add, before
      actually adding it.
      
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8674f8d3
    • Peng Li's avatar
      net: c101: remove redundant spaces · 41505d3f
      Peng Li authored
      
      
      According to the chackpatch.pl, no space before tabs.
      
      Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      41505d3f
    • Peng Li's avatar
      net: c101: replace comparison to NULL with "!card" · 7774318b
      Peng Li authored
      
      
      According to the chackpatch.pl, comparison to NULL could
      be written "!card".
      
      Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7774318b
    • Peng Li's avatar
      net: c101: add blank line after declarations · 4f7d2247
      Peng Li authored
      
      
      This patch fixes the checkpatch error about missing a blank line
      after declarations.
      
      Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4f7d2247
    • David S. Miller's avatar
      Merge branch 'mlxsw-eeprom-page-by-page' · c3dcb4b6
      David S. Miller authored
      
      
      Ido Schimmel says:
      
      ====================
      mlxsw: Add support for module EEPROM read by page
      
      Add support for ethtool_ops::get_module_eeprom_by_page() operation.
      
      Patch #1 adds necessary field in device register.
      
      Patch #2 documents possible MCIA status values so that more meaningful
      error messages could be returned to user space via extack.
      
      Patch #3 adds the actual implementation.
      ===================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c3dcb4b6
    • Ido Schimmel's avatar
      mlxsw: core: Add support for module EEPROM read by page · 1e27b9e4
      Ido Schimmel authored
      
      
      Add support for ethtool_ops::get_module_eeprom_by_page() which allows
      user space to read transceiver module EEPROM based on passed parameters.
      
      The I2C address is not validated in order to avoid module-specific code.
      In case of wrong address, error will be returned from device's firmware.
      
      Tested by comparing output with legacy method (ioctl) output.
      
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Tested-by: default avatarVadim Pasternak <vadimp@nvidia.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1e27b9e4
    • Ido Schimmel's avatar
      mlxsw: reg: Document possible MCIA status values · cecefb3a
      Ido Schimmel authored
      
      
      Will be used to emit meaningful messages to user space via extack in a
      subsequent patch.
      
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cecefb3a
    • Ido Schimmel's avatar
      mlxsw: reg: Add bank number to MCIA register · d51ea60e
      Ido Schimmel authored
      
      
      Add bank number to MCIA (Management Cable Info Access) register in order
      to allow access to banked pages on EEPROMs using CMIS (Common Management
      Interface Specification) memory map.
      
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d51ea60e
    • David S. Miller's avatar
      Merge branch 'ipa-v3.1' · 63d66ec9
      David S. Miller authored
      
      
      Alex Elder says:
      
      ====================
      net: ipa: add support for IPA v3.1
      
      This series adds support for IPA v3.1, used by the Qualcomm
      Snapdragon 835 (MSM8998).
      
      The first patch adds "qcom,msm8998-ipa" to the DT binding.
      
      The next four patches add code to ensure correct operation on
      IPA v3.1:
        - Avoid touching unsupported inter-EE interrupt mask registers
        - Set the proper flags in the clock configuration register
        - Work around the lack of an IPA FLAVOR_0 register
        - Work around the lack of a GSI PARAM_2 register
      
      The last patch defines configuration data for this version of IPA.
      
      Many thanks are due to AngeloGioacchino Del Regno and Jami Kettunen,
      both associated with SoMainline.  Angelo first posted code to
      implement most of what was required for this, and Jami has been
      helpful testing these changes on his hardware.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      63d66ec9
    • Alex Elder's avatar
      net: ipa: add IPA v3.1 configuration data · 1bb1a117
      Alex Elder authored
      
      
      Add support for the MSM8998 SoC, which includes IPA version 3.1.
      
      Originally proposed by AngeloGioacchino Del Regno.
      
      Link: https://lore.kernel.org/netdev/20210211175015.200772-6-angelogioacchino.delregno@somainline.org
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Acked-by: AngeloGioacchino Del Regno
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1bb1a117
    • Alex Elder's avatar
      net: ipa: introduce gsi_ring_setup() · bae70a80
      Alex Elder authored
      
      
      Prior to IPA v3.5.1, there is no HW_PARAM_2 GSI register, which we
      use to determine the number of channels and endpoints per execution
      environment.  In that case, we will just assume the number supported
      is the maximum supported by the driver.
      
      Introduce gsi_ring_setup() to encapsulate the code that determines
      the number of channels and endpoints.
      
      Update GSI_EVT_RING_COUNT_MAX so it is big enough to handle any
      available channel for all supported hardware (IPA v4.9 can have 23
      channels and 24 event rings).
      
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Acked-by: AngeloGioacchino Del Regno
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bae70a80
    • Alex Elder's avatar
      net: ipa: FLAVOR_0 register doesn't exist until IPA v3.5 · 110971d1
      Alex Elder authored
      
      
      The FLAVOR_0 version first appears in IPA v3.5, so avoid attempting
      to read it for versions prior to that.
      
      This register contains a concise definition of the number and
      direction of endpoints supported by the hardware, and without it
      we can't verify endpoint configuration in ipa_endpoint_config().
      In this case, just indicate that any endpoint number is available
      for use.
      
      Originally proposed by AngeloGioacchino Del Regno.
      
      Link: https://lore.kernel.org/netdev/20210211175015.200772-3-angelogioacchino.delregno@somainline.org
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Acked-by: AngeloGioacchino Del Regno
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      110971d1
    • Alex Elder's avatar
      net: ipa: disable misc clock gating for IPA v3.1 · 3833d0ab
      Alex Elder authored
      
      
      For IPA v3.1, a workaround is needed to disable gating on a MISC
      clock.  I have no further explanation, but this is what the
      downstream code (msm-4.4) does.
      
      This was suggested in a patch from AngeloGioacchino Del Regno.
      
      Link: https://lore.kernel.org/netdev/20210211175015.200772-2-angelogioacchino.delregno@somainline.org
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Acked-by: AngeloGioacchino Del Regno
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3833d0ab
    • Alex Elder's avatar
      net: ipa: inter-EE interrupts aren't always available · c31d7349
      Alex Elder authored
      
      
      The GSI inter-EE interrupts are not supported prior to IPA v3.5.
      Don't attempt to initialize them in gsi_irq_setup() for hardware
      that does not support them.
      
      Originally proposed by AngeloGioacchino Del Regno.
      
      Link: https://lore.kernel.org/netdev/20210211175015.200772-4-angelogioacchino.delregno@somainline.org
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Acked-by: AngeloGioacchino Del Regno
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c31d7349
    • Alex Elder's avatar
      dt-bindings: net: qcom,ipa: add support for MSM8998 · 2afd6c8b
      Alex Elder authored
      
      
      Add support for "qcom,msm8998-ipa", which uses IPA v3.1.
      
      Originally proposed by AngeloGioacchino Del Regno.
      
      Link: https://lore.kernel.org/linux-arm-msm/20210211175015.200772-8-angelogioacchino.delregno@somainline.org
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2afd6c8b
    • Al Viro's avatar
      __unix_find_socket_byname(): don't pass hash and type separately · be752283
      Al Viro authored
      
      
      We only care about exclusive or of those, so pass that directly.
      Makes life simpler for callers as well...
      
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      be752283
    • Al Viro's avatar
      unix_bind_bsd(): unlink if we fail after successful mknod · c0c3b8d3
      Al Viro authored
      
      
      We can do that more or less safely, since the parent is
      held locked all along.  Yes, somebody might observe the
      object via dcache, only to have it disappear afterwards,
      but there's really no good way to prevent that.  It won't
      race with other bind(2) or attempts to move the sucker
      elsewhere, or put something else in its place - locked
      parent prevents that.
      
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c0c3b8d3
    • Al Viro's avatar
      unix_bind_bsd(): move done_path_create() call after dealing with ->bindlock · 56c1731b
      Al Viro authored
      
      
      Final preparations for doing unlink on failure past the successful
      mknod.  We can't hold ->bindlock over ->mknod() or ->unlink(), since
      either might do sb_start_write() (e.g. on overlayfs).  However, we
      can do it while holding filesystem and VFS locks - doing
      	kern_path_create()
      	vfs_mknod()
      	grab ->bindlock
      	if u->addr had been set
      		drop ->bindlock
      		done_path_create
      		return -EINVAL
      	else
      		assign the address to socket
      		drop ->bindlock
      		done_path_create
      		return 0
      would be deadlock-free.  Here we massage unix_bind_bsd() to that
      form.  We are still doing equivalent transformations.
      
      Next commit will *not* be an equivalent transformation - it will
      add a call of vfs_unlink() before done_path_create() in "alread bound"
      case.
      
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      56c1731b
    • Al Viro's avatar
      fold unix_mknod() into unix_bind_bsd() · 71e6be6f
      Al Viro authored
      
      
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      71e6be6f