1. 01 7月, 2020 3 次提交
  2. 30 6月, 2020 1 次提交
  3. 26 6月, 2020 5 次提交
  4. 23 6月, 2020 7 次提交
  5. 21 6月, 2020 2 次提交
  6. 20 6月, 2020 2 次提交
  7. 19 6月, 2020 4 次提交
    • F
      net: dsa: bcm_sf2: Fix node reference count · 8dbe4c5d
      Florian Fainelli 提交于
      of_find_node_by_name() will do an of_node_put() on the "from" argument.
      With CONFIG_OF_DYNAMIC enabled which checks for device_node reference
      counts, we would be getting a warning like this:
      
      [    6.347230] refcount_t: increment on 0; use-after-free.
      [    6.352498] WARNING: CPU: 3 PID: 77 at lib/refcount.c:156
      refcount_inc_checked+0x38/0x44
      [    6.360601] Modules linked in:
      [    6.363661] CPU: 3 PID: 77 Comm: kworker/3:1 Tainted: G        W
      5.4.46-gb78b3e9956e6 #13
      [    6.372546] Hardware name: BCM97278SV (DT)
      [    6.376649] Workqueue: events deferred_probe_work_func
      [    6.381796] pstate: 60000005 (nZCv daif -PAN -UAO)
      [    6.386595] pc : refcount_inc_checked+0x38/0x44
      [    6.391133] lr : refcount_inc_checked+0x38/0x44
      ...
      [    6.478791] Call trace:
      [    6.481243]  refcount_inc_checked+0x38/0x44
      [    6.485433]  kobject_get+0x3c/0x4c
      [    6.488840]  of_node_get+0x24/0x34
      [    6.492247]  of_irq_find_parent+0x3c/0xe0
      [    6.496263]  of_irq_parse_one+0xe4/0x1d0
      [    6.500191]  irq_of_parse_and_map+0x44/0x84
      [    6.504381]  bcm_sf2_sw_probe+0x22c/0x844
      [    6.508397]  platform_drv_probe+0x58/0xa8
      [    6.512413]  really_probe+0x238/0x3fc
      [    6.516081]  driver_probe_device+0x11c/0x12c
      [    6.520358]  __device_attach_driver+0xa8/0x100
      [    6.524808]  bus_for_each_drv+0xb4/0xd0
      [    6.528650]  __device_attach+0xd0/0x164
      [    6.532493]  device_initial_probe+0x24/0x30
      [    6.536682]  bus_probe_device+0x38/0x98
      [    6.540524]  deferred_probe_work_func+0xa8/0xd4
      [    6.545061]  process_one_work+0x178/0x288
      [    6.549078]  process_scheduled_works+0x44/0x48
      [    6.553529]  worker_thread+0x218/0x270
      [    6.557285]  kthread+0xdc/0xe4
      [    6.560344]  ret_from_fork+0x10/0x18
      [    6.563925] ---[ end trace 68f65caf69bb152a ]---
      
      Fix this by adding a of_node_get() to increment the reference count
      prior to the call.
      
      Fixes: afa3b592 ("net: dsa: bcm_sf2: Ensure correct sub-node is parsed")
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8dbe4c5d
    • V
      net: dsa: sja1105: fix checks for VLAN state in gate action · 5182a622
      Vladimir Oltean 提交于
      This action requires the VLAN awareness state of the switch to be of the
      same type as the key that's being added:
      
      - If the switch is unaware of VLAN, then the tc filter key must only
        contain the destination MAC address.
      - If the switch is VLAN-aware, the key must also contain the VLAN ID and
        PCP.
      
      But this check doesn't work unless we verify the VLAN awareness state on
      both the "if" and the "else" branches.
      
      Fixes: 834f8933 ("net: dsa: sja1105: implement tc-gate using time-triggered virtual links")
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5182a622
    • V
      net: dsa: sja1105: fix checks for VLAN state in redirect action · c6ae970b
      Vladimir Oltean 提交于
      This action requires the VLAN awareness state of the switch to be of the
      same type as the key that's being added:
      
      - If the switch is unaware of VLAN, then the tc filter key must only
        contain the destination MAC address.
      - If the switch is VLAN-aware, the key must also contain the VLAN ID and
        PCP.
      
      But this check doesn't work unless we verify the VLAN awareness state on
      both the "if" and the "else" branches.
      
      Fixes: dfacc5a2 ("net: dsa: sja1105: support flow-based redirection via virtual links")
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c6ae970b
    • V
      net: dsa: sja1105: remove debugging code in sja1105_vl_gate · 5b3b396c
      Vladimir Oltean 提交于
      This shouldn't be there.
      
      Fixes: 834f8933 ("net: dsa: sja1105: implement tc-gate using time-triggered virtual links")
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5b3b396c
  8. 16 6月, 2020 1 次提交
    • V
      net: dsa: sja1105: fix PTP timestamping with large tc-taprio cycles · c92cbaea
      Vladimir Oltean 提交于
      It isn't actually described clearly at all in UM10944.pdf, but on TX of
      a management frame (such as PTP), this needs to happen:
      
      - The destination MAC address (i.e. 01-80-c2-00-00-0e), along with the
        desired destination port, need to be installed in one of the 4
        management slots of the switch, over SPI.
      - The host can poll over SPI for that management slot's ENFPORT field.
        That gets unset when the switch has matched the slot to the frame.
      
      And therein lies the problem. ENFPORT does not mean that the packet has
      been transmitted. Just that it has been received over the CPU port, and
      that the mgmt slot is yet again available.
      
      This is relevant because of what we are doing in sja1105_ptp_txtstamp_skb,
      which is called right after sja1105_mgmt_xmit. We are in a hard
      real-time deadline, since the hardware only gives us 24 bits of TX
      timestamp, so we need to read the full PTP clock to reconstruct it.
      Because we're in a hurry (in an attempt to make sure that we have a full
      64-bit PTP time which is as close as possible to the actual transmission
      time of the frame, to avoid 24-bit wraparounds), first we read the PTP
      clock, then we poll for the TX timestamp to become available.
      
      But of course, we don't know for sure that the frame has been
      transmitted when we read the full PTP clock. We had assumed that ENFPORT
      means it has, but the assumption is incorrect. And while in most
      real-life scenarios this has never been caught due to software delays,
      nowhere is this fact more obvious than with a tc-taprio offload, where
      PTP traffic gets a small timeslot very rarely (example: 1 packet per 10
      ms). In that case, we will be reading the PTP clock for timestamp
      reconstruction too early (before the packet has been transmitted), and
      this renders the reconstruction procedure incorrect (see the assumptions
      described in the comments found on function sja1105_tstamp_reconstruct).
      So the PTP TX timestamps will be off by 1<<24 clock ticks, or 135 ms
      (1 tick is 8 ns).
      
      So fix this case of premature optimization by simply reordering the
      sja1105_ptpegr_ts_poll and the sja1105_ptpclkval_read function calls. It
      turns out that in practice, the 135 ms hard deadline for PTP timestamp
      wraparound is not so hard, since even the most bandwidth-intensive PTP
      profiles, such as 802.1AS-2011, have a sync frame interval of 125 ms.
      So if we couldn't deliver a timestamp in 135 ms (which we can), we're
      toast and have much bigger problems anyway.
      
      Fixes: 47ed985e ("net: dsa: sja1105: Add logic for TX timestamping")
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Acked-by: NRichard Cochran <richardcochran@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c92cbaea
  9. 14 6月, 2020 1 次提交
    • M
      treewide: replace '---help---' in Kconfig files with 'help' · a7f7f624
      Masahiro Yamada 提交于
      Since commit 84af7a61 ("checkpatch: kconfig: prefer 'help' over
      '---help---'"), the number of '---help---' has been gradually
      decreasing, but there are still more than 2400 instances.
      
      This commit finishes the conversion. While I touched the lines,
      I also fixed the indentation.
      
      There are a variety of indentation styles found.
      
        a) 4 spaces + '---help---'
        b) 7 spaces + '---help---'
        c) 8 spaces + '---help---'
        d) 1 space + 1 tab + '---help---'
        e) 1 tab + '---help---'    (correct indentation)
        f) 1 tab + 1 space + '---help---'
        g) 1 tab + 2 spaces + '---help---'
      
      In order to convert all of them to 1 tab + 'help', I ran the
      following commend:
      
        $ find . -name 'Kconfig*' | xargs sed -i 's/^[[:space:]]*---help---/\thelp/'
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      a7f7f624
  10. 08 6月, 2020 1 次提交
  11. 05 6月, 2020 1 次提交
    • M
      net: dsa: qca8k: Fix "Unexpected gfp" kernel exception · 67122a79
      Michal Vokáč 提交于
      Commit 7e99e347 ("net: dsa: remove dsa_switch_alloc helper")
      replaced the dsa_switch_alloc helper by devm_kzalloc in all DSA
      drivers. Unfortunately it introduced a typo in qca8k.c driver and
      wrong argument is passed to the devm_kzalloc function.
      
      This fix mitigates the following kernel exception:
      
        Unexpected gfp: 0x6 (__GFP_HIGHMEM|GFP_DMA32). Fixing up to gfp: 0x101 (GFP_DMA|__GFP_ZERO). Fix your code!
        CPU: 1 PID: 44 Comm: kworker/1:1 Not tainted 5.5.9-yocto-ua #1
        Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
        Workqueue: events deferred_probe_work_func
        [<c0014924>] (unwind_backtrace) from [<c00123bc>] (show_stack+0x10/0x14)
        [<c00123bc>] (show_stack) from [<c04c8fb4>] (dump_stack+0x90/0xa4)
        [<c04c8fb4>] (dump_stack) from [<c00e1b10>] (new_slab+0x20c/0x214)
        [<c00e1b10>] (new_slab) from [<c00e1cd0>] (___slab_alloc.constprop.0+0x1b8/0x540)
        [<c00e1cd0>] (___slab_alloc.constprop.0) from [<c00e2074>] (__slab_alloc.constprop.0+0x1c/0x24)
        [<c00e2074>] (__slab_alloc.constprop.0) from [<c00e4538>] (__kmalloc_track_caller+0x1b0/0x298)
        [<c00e4538>] (__kmalloc_track_caller) from [<c02cccac>] (devm_kmalloc+0x24/0x70)
        [<c02cccac>] (devm_kmalloc) from [<c030d888>] (qca8k_sw_probe+0x94/0x1ac)
        [<c030d888>] (qca8k_sw_probe) from [<c0304788>] (mdio_probe+0x30/0x54)
        [<c0304788>] (mdio_probe) from [<c02c93bc>] (really_probe+0x1e0/0x348)
        [<c02c93bc>] (really_probe) from [<c02c9884>] (driver_probe_device+0x60/0x16c)
        [<c02c9884>] (driver_probe_device) from [<c02c7fb0>] (bus_for_each_drv+0x70/0x94)
        [<c02c7fb0>] (bus_for_each_drv) from [<c02c9708>] (__device_attach+0xb4/0x11c)
        [<c02c9708>] (__device_attach) from [<c02c8148>] (bus_probe_device+0x84/0x8c)
        [<c02c8148>] (bus_probe_device) from [<c02c8cec>] (deferred_probe_work_func+0x64/0x90)
        [<c02c8cec>] (deferred_probe_work_func) from [<c0033c14>] (process_one_work+0x1d4/0x41c)
        [<c0033c14>] (process_one_work) from [<c00340a4>] (worker_thread+0x248/0x528)
        [<c00340a4>] (worker_thread) from [<c0039148>] (kthread+0x124/0x150)
        [<c0039148>] (kthread) from [<c00090d8>] (ret_from_fork+0x14/0x3c)
        Exception stack(0xee1b5fb0 to 0xee1b5ff8)
        5fa0:                                     00000000 00000000 00000000 00000000
        5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
        5fe0: 00000000 00000000 00000000 00000000 00000013 00000000
        qca8k 2188000.ethernet-1:0a: Using legacy PHYLIB callbacks. Please migrate to PHYLINK!
        qca8k 2188000.ethernet-1:0a eth2 (uninitialized): PHY [2188000.ethernet-1:01] driver [Generic PHY]
        qca8k 2188000.ethernet-1:0a eth1 (uninitialized): PHY [2188000.ethernet-1:02] driver [Generic PHY]
      
      Fixes: 7e99e347 ("net: dsa: remove dsa_switch_alloc helper")
      Signed-off-by: NMichal Vokáč <michal.vokac@ysoft.com>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      67122a79
  12. 02 6月, 2020 1 次提交
  13. 31 5月, 2020 2 次提交
  14. 30 5月, 2020 1 次提交
    • V
      net: dsa: sja1105: avoid invalid state in sja1105_vlan_filtering · aef31718
      Vladimir Oltean 提交于
      Be there 2 switches spi/spi2.0 and spi/spi2.1 in a cross-chip setup,
      both under the same VLAN-filtering bridge, both in the
      SJA1105_VLAN_BEST_EFFORT state.
      
      If we try to change the VLAN state of one of the switches (to
      SJA1105_VLAN_FILTERING_FULL) we get the following error:
      
      devlink dev param set spi/spi2.1 name best_effort_vlan_filtering value
      false cmode runtime
      [   38.325683] sja1105 spi2.1: Not allowed to overcommit frame memory.
                     L2 memory partitions and VL memory partitions share the
                     same space. The sum of all 16 memory partitions is not
                     allowed to be larger than 929 128-byte blocks (or 910
                     with retagging). Please adjust
                     l2-forwarding-parameters-table.part_spc and/or
                     vl-forwarding-parameters-table.partspc.
      [   38.356803] sja1105 spi2.1: Invalid config, cannot upload
      
      This is because the spi/spi2.1 switch doesn't support tagging anymore in
      the SJA1105_VLAN_FILTERING_FULL state, so it doesn't need to have any
      retagging rules defined. Great, so it can use more frame memory
      (retagging consumes extra memory).
      
      But the built-in low-level static config checker from the sja1105 driver
      says "not so fast, you've increased the frame memory to non-retagging
      values, but you still kept the retagging rules in the static config".
      
      So we need to rebuild the VLAN table immediately before re-uploading the
      static config, operation which will take care, based on the new VLAN
      state, of removing the retagging rules.
      
      Fixes: 3f01c91a ("net: dsa: sja1105: implement VLAN retagging for dsa_8021q sub-VLANs")
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      aef31718
  15. 29 5月, 2020 1 次提交
    • V
      net: dsa: sja1105: offload the Credit-Based Shaper qdisc · 4d752508
      Vladimir Oltean 提交于
      SJA1105, being AVB/TSN switches, provide hardware assist for the
      Credit-Based Shaper as described in the IEEE 8021Q-2018 document.
      
      First generation has 10 shapers, freely assignable to any of the 4
      external ports and 8 traffic classes, and second generation has 16
      shapers.
      
      The Credit-Based Shaper tables are accessed through the dynamic
      reconfiguration interface, so we have to restore them manually after a
      switch reset. The tables are backed up by the static config only on
      P/Q/R/S, and we don't want to add custom code only for that family,
      since the procedure that is in place now works for both.
      
      Tested with the following commands:
      
      data_rate_kbps=67000
      port_transmit_rate_kbps=1000000
      idleslope=$data_rate_kbps
      sendslope=$(($idleslope - $port_transmit_rate_kbps))
      locredit=$((-0x80000000))
      hicredit=$((0x7fffffff))
      tc qdisc add dev swp2 root handle 1: mqprio hw 0 num_tc 8 \
              map 0 1 2 3 4 5 6 7 \
              queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7
      tc qdisc replace dev swp2 parent 1:1 cbs \
              idleslope $idleslope \
              sendslope $sendslope \
              hicredit $hicredit \
              locredit $locredit \
              offload 1
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4d752508
  16. 28 5月, 2020 3 次提交
  17. 24 5月, 2020 1 次提交
  18. 23 5月, 2020 1 次提交
  19. 17 5月, 2020 1 次提交
    • D
      net: dsa: mt7530: fix roaming from DSA user ports · 5e5502e0
      DENG Qingfang 提交于
      When a client moves from a DSA user port to a software port in a bridge,
      it cannot reach any other clients that connected to the DSA user ports.
      That is because SA learning on the CPU port is disabled, so the switch
      ignores the client's frames from the CPU port and still thinks it is at
      the user port.
      
      Fix it by enabling SA learning on the CPU port.
      
      To prevent the switch from learning from flooding frames from the CPU
      port, set skb->offload_fwd_mark to 1 for unicast and broadcast frames,
      and let the switch flood them instead of trapping to the CPU port.
      Multicast frames still need to be trapped to the CPU port for snooping,
      so set the SA_DIS bit of the MTK tag to 1 when transmitting those frames
      to disable SA learning.
      
      Fixes: b8f126a8 ("net-next: dsa: add dsa support for Mediatek MT7530 switch")
      Signed-off-by: NDENG Qingfang <dqfext@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5e5502e0
  20. 16 5月, 2020 1 次提交