1. 24 8月, 2020 1 次提交
  2. 22 8月, 2020 1 次提交
    • T
      net: dsa: b53: check for timeout · 774d977a
      Tom Rix 提交于
      clang static analysis reports this problem
      
      b53_common.c:1583:13: warning: The left expression of the compound
        assignment is an uninitialized value. The computed value will
        also be garbage
              ent.port &= ~BIT(port);
              ~~~~~~~~ ^
      
      ent is set by a successful call to b53_arl_read().  Unsuccessful
      calls are caught by an switch statement handling specific returns.
      b32_arl_read() calls b53_arl_op_wait() which fails with the
      unhandled -ETIMEDOUT.
      
      So add -ETIMEDOUT to the switch statement.  Because
      b53_arl_op_wait() already prints out a message, do not add another
      one.
      
      Fixes: 1da6df85 ("net: dsa: b53: Implement ARL add/del/dump operations")
      Signed-off-by: NTom Rix <trix@redhat.com>
      Acked-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      774d977a
  3. 19 8月, 2020 1 次提交
  4. 06 8月, 2020 1 次提交
    • V
      net: dsa: sja1105: use detected device id instead of DT one on mismatch · 0b0e2997
      Vladimir Oltean 提交于
      Although we can detect the chip revision 100% at runtime, it is useful
      to specify it in the device tree compatible string too, because
      otherwise there would be no way to assess the correctness of device tree
      bindings statically, without booting a board (only some switch versions
      have internal RGMII delays and/or an SGMII port).
      
      But for testing the P/Q/R/S support, what I have is a reworked board
      with the SJA1105T replaced by a pin-compatible SJA1105Q, and I don't
      want to keep a separate device tree blob just for this one-off board.
      Since just the chip has been replaced, its RGMII delay setup is
      inherently the same (meaning: delays added by the PHY on the slave
      ports, and by PCB traces on the fixed-link CPU port).
      
      For this board, I'd rather have the driver shout at me, but go ahead and
      use what it found even if it doesn't match what it's been told is there.
      
      [    2.970826] sja1105 spi0.1: Device tree specifies chip SJA1105T but found SJA1105Q, please fix it!
      [    2.980010] sja1105 spi0.1: Probed switch chip: SJA1105Q
      [    3.005082] sja1105 spi0.1: Enabled switch tagging
      Signed-off-by: NVladimir Oltean <olteanv@gmail.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0b0e2997
  5. 04 8月, 2020 8 次提交
    • F
      net: dsa: loop: Set correct number of ports · 947b6ef9
      Florian Fainelli 提交于
      We only support DSA_LOOP_NUM_PORTS in the switch, do not tell the DSA
      core to allocate up to DSA_MAX_PORTS which is nearly the double (6 vs.
      11).
      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>
      947b6ef9
    • F
      net: dsa: loop: Wire-up MTU callbacks · c99194ed
      Florian Fainelli 提交于
      For now we simply store the port MTU into a per-port member.
      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>
      c99194ed
    • F
      net: dsa: loop: Move data structures to header · 6c84a589
      Florian Fainelli 提交于
      In preparation for adding support for a mockup data path, move the
      driver data structures to include/linux/dsa/loop.h such that we can
      share them between net/dsa/ and drivers/net/dsa/ later on.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6c84a589
    • F
      net: dsa: loop: Support 4K VLANs · 916a8d16
      Florian Fainelli 提交于
      Allocate a 4K array of VLANs instead of limiting ourselves to just 5
      which is arbitrary.
      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>
      916a8d16
    • F
      net: dsa: loop: PVID should be per-port · 81d4e8e0
      Florian Fainelli 提交于
      The PVID should be per-port, this is a preliminary change to support a
      802.1Q data path in the driver.
      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>
      81d4e8e0
    • V
      net: dsa: sja1105: poll for extts events from a timer · af9fdd2b
      Vladimir Oltean 提交于
      The current poll interval is enough to ensure that rising and falling
      edge events are not lost for a 1 PPS signal with 50% duty cycle.
      
      But when we deliver the events to user space, it will try to infer if
      they were corresponding to a rising or to a falling edge (the kernel
      driver doesn't know that either). User space will try to make that
      inference based on the time at which the PPS master had emitted the
      pulse (i.e. if it's a .0 time, it's rising edge, if it's .5 time, it's
      falling edge).
      
      But there is no in-kernel API for retrieving the precise timestamp
      corresponding to a PPS master (aka perout) pulse. So user space has to
      guess even that. It will read the PTP time on the PPS master right after
      we've delivered the extts event, and declare that the PPS master time
      was just the closest integer second, based on 2 thresholds (lower than
      .25, or higher than .75, and ignore anything else).
      
      Except that, if we poll for extts events (and our hardware doesn't
      really help us, by not providing an interrupt), then there is a risk
      that the poll period (and therefore the time at which the event is
      delivered) might confuse user space.
      
      Because we are always scheduling the next extts poll at
      SJA1105_EXTTS_INTERVAL "from now" (that's the only thing that the
      schedule_delayed_work() API gives us), it means that the start time of
      the next delayed workqueue will always be shifted to the right a little
      bit (shifted with the SPI access duration of this workqueue run).
      In turn, because user space sees extts events that are non-periodic
      compared to the PPS master's time, this means that it might start making
      wrong guesses about rising/falling edge.
      
      To understand the effect, here is the output of ts2phc currently. Notice
      the 'src' timestamps of the 'SKIP extts' events, and how they have a
      large wander. They keep increasing until the upper limit for the ignore
      threshold (.75 seconds), after which the application starts ignoring the
      _other_ edge.
      
      ts2phc[26.624]: /dev/ptp3 SKIP extts index 0 at 21.449898912 src 21.657784518
      ts2phc[27.133]: adding tstamp 21.949894240 to clock /dev/ptp3
      ts2phc[27.133]: adding tstamp 22.000000000 to clock /dev/ptp1
      ts2phc[27.133]: /dev/ptp3 offset        640 s2 freq   +5112
      ts2phc[27.636]: /dev/ptp3 SKIP extts index 0 at 22.449889360 src 22.669398022
      ts2phc[28.140]: adding tstamp 22.949884376 to clock /dev/ptp3
      ts2phc[28.140]: adding tstamp 23.000000000 to clock /dev/ptp1
      ts2phc[28.140]: /dev/ptp3 offset         96 s2 freq   +4760
      ts2phc[28.644]: /dev/ptp3 SKIP extts index 0 at 23.449879504 src 23.677420422
      ts2phc[29.153]: adding tstamp 23.949874704 to clock /dev/ptp3
      ts2phc[29.153]: adding tstamp 24.000000000 to clock /dev/ptp1
      ts2phc[29.153]: /dev/ptp3 offset       -264 s2 freq   +4429
      ts2phc[29.656]: /dev/ptp3 SKIP extts index 0 at 24.449870008 src 24.689407238
      ts2phc[30.160]: adding tstamp 24.949865376 to clock /dev/ptp3
      ts2phc[30.160]: adding tstamp 25.000000000 to clock /dev/ptp1
      ts2phc[30.160]: /dev/ptp3 offset       -280 s2 freq   +4334
      ts2phc[30.664]: /dev/ptp3 SKIP extts index 0 at 25.449860760 src 25.697449926
      ts2phc[31.168]: adding tstamp 25.949856176 to clock /dev/ptp3
      ts2phc[31.168]: adding tstamp 26.000000000 to clock /dev/ptp1
      ts2phc[31.168]: /dev/ptp3 offset       -176 s2 freq   +4354
      ts2phc[31.672]: /dev/ptp3 SKIP extts index 0 at 26.449851584 src 26.705433606
      ts2phc[32.180]: adding tstamp 26.949846992 to clock /dev/ptp3
      ts2phc[32.180]: adding tstamp 27.000000000 to clock /dev/ptp1
      ts2phc[32.180]: /dev/ptp3 offset        -80 s2 freq   +4397
      ts2phc[32.684]: /dev/ptp3 SKIP extts index 0 at 27.449842384 src 27.717415110
      ts2phc[33.192]: adding tstamp 27.949837768 to clock /dev/ptp3
      ts2phc[33.192]: adding tstamp 28.000000000 to clock /dev/ptp1
      ts2phc[33.192]: /dev/ptp3 offset          0 s2 freq   +4453
      ts2phc[33.696]: /dev/ptp3 SKIP extts index 0 at 28.449833128 src 28.729412902
      ts2phc[34.200]: adding tstamp 28.949828472 to clock /dev/ptp3
      ts2phc[34.200]: adding tstamp 29.000000000 to clock /dev/ptp1
      ts2phc[34.200]: /dev/ptp3 offset          8 s2 freq   +4461
      ts2phc[34.704]: /dev/ptp3 SKIP extts index 0 at 29.449823816 src 29.737416038
      ts2phc[35.208]: adding tstamp 29.949819152 to clock /dev/ptp3
      ts2phc[35.208]: adding tstamp 30.000000000 to clock /dev/ptp1
      ts2phc[35.208]: /dev/ptp3 offset         -8 s2 freq   +4447
      ts2phc[35.712]: /dev/ptp3 SKIP extts index 0 at 30.449814496 src 30.745554982
      ts2phc[36.216]: adding tstamp 30.949809840 to clock /dev/ptp3
      ts2phc[36.216]: adding tstamp 31.000000000 to clock /dev/ptp1
      ts2phc[36.216]: /dev/ptp3 offset         -8 s2 freq   +4445
      ts2phc[36.468]: /dev/ptp3 SKIP extts index 0 at 31.449805184 src 31.501109446
      ts2phc[36.972]: adding tstamp 31.949800536 to clock /dev/ptp3
      ts2phc[36.972]: adding tstamp 32.000000000 to clock /dev/ptp1
      ts2phc[36.972]: /dev/ptp3 offset         -8 s2 freq   +4442
      ts2phc[37.480]: /dev/ptp3 SKIP extts index 0 at 32.449795896 src 32.513320070
      ts2phc[37.984]: adding tstamp 32.949791248 to clock /dev/ptp3
      ts2phc[37.984]: adding tstamp 33.000000000 to clock /dev/ptp1
      ts2phc[37.984]: /dev/ptp3 offset          0 s2 freq   +4448
      
      Fix that by taking the following measures:
      - Schedule the poll from a timer. Because we are really scheduling the
        timer periodically, the extts events delivered to user space are
        periodic too, and don't suffer from the "shift-to-the-right" effect.
      - Increase the poll period to 6 times a second. This imposes a smaller
        upper bound to the shift that can occur to the delivery time of extts
        events, and makes user space (ts2phc) to always interpret correctly
        which events should be skipped and which shouldn't.
      - Move the SPI readout itself to the main PTP kernel thread, instead of
        the generic workqueue. This is because the timer runs in atomic
        context, but is also better than before, because if needed, we can
        chrt & taskset this kernel thread, to ensure it gets enough priority
        under load.
      
      After this patch, one can notice that the wander is greatly reduced, and
      that the latencies of one extts poll are not propagated to the next. The
      'src' timestamp that is skipped is never larger than .65 seconds (which
      means .15 seconds larger than the time at which the real event occurred
      at, and .10 seconds smaller than the .75 upper threshold for ignoring
      the falling edge):
      
      ts2phc[40.076]: adding tstamp 34.949261296 to clock /dev/ptp3
      ts2phc[40.076]: adding tstamp 35.000000000 to clock /dev/ptp1
      ts2phc[40.076]: /dev/ptp3 offset         48 s2 freq   +4631
      ts2phc[40.568]: /dev/ptp3 SKIP extts index 0 at 35.449256496 src 35.595791078
      ts2phc[41.064]: adding tstamp 35.949251744 to clock /dev/ptp3
      ts2phc[41.064]: adding tstamp 36.000000000 to clock /dev/ptp1
      ts2phc[41.064]: /dev/ptp3 offset       -224 s2 freq   +4374
      ts2phc[41.552]: /dev/ptp3 SKIP extts index 0 at 36.449247088 src 36.579825574
      ts2phc[42.044]: adding tstamp 36.949242456 to clock /dev/ptp3
      ts2phc[42.044]: adding tstamp 37.000000000 to clock /dev/ptp1
      ts2phc[42.044]: /dev/ptp3 offset       -240 s2 freq   +4290
      ts2phc[42.536]: /dev/ptp3 SKIP extts index 0 at 37.449237848 src 37.563828774
      ts2phc[43.028]: adding tstamp 37.949233264 to clock /dev/ptp3
      ts2phc[43.028]: adding tstamp 38.000000000 to clock /dev/ptp1
      ts2phc[43.028]: /dev/ptp3 offset       -144 s2 freq   +4314
      ts2phc[43.520]: /dev/ptp3 SKIP extts index 0 at 38.449228656 src 38.547823238
      ts2phc[44.012]: adding tstamp 38.949224048 to clock /dev/ptp3
      ts2phc[44.012]: adding tstamp 39.000000000 to clock /dev/ptp1
      ts2phc[44.012]: /dev/ptp3 offset        -80 s2 freq   +4335
      ts2phc[44.508]: /dev/ptp3 SKIP extts index 0 at 39.449219432 src 39.535846118
      ts2phc[44.996]: adding tstamp 39.949214816 to clock /dev/ptp3
      ts2phc[44.996]: adding tstamp 40.000000000 to clock /dev/ptp1
      ts2phc[44.996]: /dev/ptp3 offset        -32 s2 freq   +4359
      ts2phc[45.488]: /dev/ptp3 SKIP extts index 0 at 40.449210192 src 40.515824678
      ts2phc[45.980]: adding tstamp 40.949205568 to clock /dev/ptp3
      ts2phc[45.980]: adding tstamp 41.000000000 to clock /dev/ptp1
      ts2phc[45.980]: /dev/ptp3 offset          8 s2 freq   +4390
      ts2phc[46.636]: /dev/ptp3 SKIP extts index 0 at 41.449200928 src 41.664176902
      ts2phc[47.132]: adding tstamp 41.949196288 to clock /dev/ptp3
      ts2phc[47.132]: adding tstamp 42.000000000 to clock /dev/ptp1
      ts2phc[47.132]: /dev/ptp3 offset          0 s2 freq   +4384
      ts2phc[47.620]: /dev/ptp3 SKIP extts index 0 at 42.449191656 src 42.648117190
      ts2phc[48.112]: adding tstamp 42.949187016 to clock /dev/ptp3
      ts2phc[48.112]: adding tstamp 43.000000000 to clock /dev/ptp1
      ts2phc[48.112]: /dev/ptp3 offset          0 s2 freq   +4384
      ts2phc[48.604]: /dev/ptp3 SKIP extts index 0 at 43.449182384 src 43.632112582
      ts2phc[49.100]: adding tstamp 43.949177736 to clock /dev/ptp3
      ts2phc[49.100]: adding tstamp 44.000000000 to clock /dev/ptp1
      ts2phc[49.100]: /dev/ptp3 offset         -8 s2 freq   +4376
      ts2phc[49.588]: /dev/ptp3 SKIP extts index 0 at 44.449173096 src 44.616136774
      ts2phc[50.080]: adding tstamp 44.949168464 to clock /dev/ptp3
      ts2phc[50.080]: adding tstamp 45.000000000 to clock /dev/ptp1
      ts2phc[50.080]: /dev/ptp3 offset          8 s2 freq   +4390
      ts2phc[50.572]: /dev/ptp3 SKIP extts index 0 at 45.449163816 src 45.600134662
      ts2phc[51.064]: adding tstamp 45.949159160 to clock /dev/ptp3
      ts2phc[51.064]: adding tstamp 46.000000000 to clock /dev/ptp1
      ts2phc[51.064]: /dev/ptp3 offset         -8 s2 freq   +4376
      ts2phc[51.556]: /dev/ptp3 SKIP extts index 0 at 46.449154528 src 46.584588550
      ts2phc[52.048]: adding tstamp 46.949149896 to clock /dev/ptp3
      ts2phc[52.048]: adding tstamp 47.000000000 to clock /dev/ptp1
      ts2phc[52.048]: /dev/ptp3 offset          0 s2 freq   +4382
      ts2phc[52.540]: /dev/ptp3 SKIP extts index 0 at 47.449145256 src 47.568132198
      ts2phc[53.032]: adding tstamp 47.949140616 to clock /dev/ptp3
      ts2phc[53.032]: adding tstamp 48.000000000 to clock /dev/ptp1
      ts2phc[53.032]: /dev/ptp3 offset          0 s2 freq   +4382
      ts2phc[53.524]: /dev/ptp3 SKIP extts index 0 at 48.449135968 src 48.552121446
      ts2phc[54.016]: adding tstamp 48.949131320 to clock /dev/ptp3
      ts2phc[54.016]: adding tstamp 49.000000000 to clock /dev/ptp1
      ts2phc[54.016]: /dev/ptp3 offset          0 s2 freq   +4382
      ts2phc[54.512]: /dev/ptp3 SKIP extts index 0 at 49.449126680 src 49.540147014
      ts2phc[55.000]: adding tstamp 49.949122040 to clock /dev/ptp3
      ts2phc[55.000]: adding tstamp 50.000000000 to clock /dev/ptp1
      ts2phc[55.000]: /dev/ptp3 offset          0 s2 freq   +4382
      ts2phc[55.492]: /dev/ptp3 SKIP extts index 0 at 50.449117400 src 50.520119078
      ts2phc[55.988]: adding tstamp 50.949112768 to clock /dev/ptp3
      ts2phc[55.988]: adding tstamp 51.000000000 to clock /dev/ptp1
      ts2phc[55.988]: /dev/ptp3 offset          8 s2 freq   +4390
      ts2phc[56.476]: /dev/ptp3 SKIP extts index 0 at 51.449108120 src 51.504175910
      ts2phc[57.132]: adding tstamp 51.949103480 to clock /dev/ptp3
      ts2phc[57.132]: adding tstamp 52.000000000 to clock /dev/ptp1
      ts2phc[57.132]: /dev/ptp3 offset          0 s2 freq   +4384
      ts2phc[57.624]: /dev/ptp3 SKIP extts index 0 at 52.449098840 src 52.651833574
      ts2phc[58.116]: adding tstamp 52.949094200 to clock /dev/ptp3
      ts2phc[58.116]: adding tstamp 53.000000000 to clock /dev/ptp1
      ts2phc[58.116]: /dev/ptp3 offset          8 s2 freq   +4392
      ts2phc[58.612]: /dev/ptp3 SKIP extts index 0 at 53.449089560 src 53.639826918
      ts2phc[59.100]: adding tstamp 53.949084920 to clock /dev/ptp3
      ts2phc[59.100]: adding tstamp 54.000000000 to clock /dev/ptp1
      ts2phc[59.100]: /dev/ptp3 offset          8 s2 freq   +4394
      ts2phc[59.592]: /dev/ptp3 SKIP extts index 0 at 54.449080272 src 54.619842278
      ts2phc[60.084]: adding tstamp 54.949075624 to clock /dev/ptp3
      ts2phc[60.084]: adding tstamp 55.000000000 to clock /dev/ptp1
      ts2phc[60.084]: /dev/ptp3 offset          8 s2 freq   +4397
      ts2phc[60.576]: /dev/ptp3 SKIP extts index 0 at 55.449070968 src 55.603885542
      ts2phc[61.068]: adding tstamp 55.949066312 to clock /dev/ptp3
      ts2phc[61.068]: adding tstamp 56.000000000 to clock /dev/ptp1
      ts2phc[61.068]: /dev/ptp3 offset          0 s2 freq   +4391
      ts2phc[61.560]: /dev/ptp3 SKIP extts index 0 at 56.449061680 src 56.587885798
      ts2phc[62.052]: adding tstamp 56.949057032 to clock /dev/ptp3
      ts2phc[62.052]: adding tstamp 57.000000000 to clock /dev/ptp1
      ts2phc[62.052]: /dev/ptp3 offset         -8 s2 freq   +4383
      Signed-off-by: NVladimir Oltean <olteanv@gmail.com>
      Acked-by: NRichard Cochran <richardcochran@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      af9fdd2b
    • J
      net: dsa: qca8k: Add 802.1q VLAN support · 69462fe6
      Jonathan McDowell 提交于
      This adds full 802.1q VLAN support to the qca8k, allowing the use of
      vlan_filtering and more complicated bridging setups than allowed by
      basic port VLAN support.
      
      Tested with a number of untagged ports with separate VLANs and then a
      trunk port with all the VLANs tagged on it.
      
      v3:
      - Pull QCA8K_PORT_VID_DEF changes into separate cleanup patch
      - Reverse Christmas tree notation for variable definitions
      - Use untagged instead of tagged for consistency
      v2:
      - Return sensible errnos on failure rather than -1 (rmk)
      - Style cleanups based on Florian's feedback
      - Silently allow VLAN 0 as device correctly treats this as no tag
      Signed-off-by: NJonathan McDowell <noodles@earth.li>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Acked-by: NVladimir Oltean <olteanv@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      69462fe6
    • J
      net: dsa: qca8k: Add define for port VID · e9d204fd
      Jonathan McDowell 提交于
      Rather than using a magic value of 1 when configuring the port VIDs add
      a QCA8K_PORT_VID_DEF define and use that instead. Also fix up the
      bitmask in the process; the top 4 bits are reserved so this wasn't a
      problem, but only masking 12 bits is the correct approach.
      Signed-off-by: NJonathan McDowell <noodles@earth.li>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Acked-by: NVladimir Oltean <olteanv@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e9d204fd
  6. 29 7月, 2020 2 次提交
    • L
      net: dsa: rtl8366: Fix VLAN set-up · 788abc6d
      Linus Walleij 提交于
      Alter the rtl8366_vlan_add() to call rtl8366_set_vlan()
      inside the loop that goes over all VIDs since we now
      properly support calling that function more than once.
      Augment the loop to postincrement as this is more
      intuitive.
      
      The loop moved past the last VID but called
      rtl8366_set_vlan() with the port number instead of
      the VID, assuming a 1-to-1 correspondence between
      ports and VIDs. This was also a bug.
      
      Cc: DENG Qingfang <dqfext@gmail.com>
      Cc: Mauri Sandberg <sandberg@mailfence.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Fixes: d8652956 ("net: dsa: realtek-smi: Add Realtek SMI driver")
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      788abc6d
    • L
      net: dsa: rtl8366: Fix VLAN semantics · 15ab7906
      Linus Walleij 提交于
      The RTL8366 would not handle adding new members (ports) to
      a VLAN: the code assumed that ->port_vlan_add() was only
      called once for a single port. When intializing the
      switch with .configure_vlan_while_not_filtering set to
      true, the function is called numerous times for adding
      all ports to VLAN1, which was something the code could
      not handle.
      
      Alter rtl8366_set_vlan() to just |= new members and
      untagged flags to 4k and MC VLAN table entries alike.
      This makes it possible to just add new ports to a
      VLAN.
      
      Put in some helpful debug code that can be used to find
      any further bugs here.
      
      Cc: DENG Qingfang <dqfext@gmail.com>
      Cc: Mauri Sandberg <sandberg@mailfence.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Fixes: d8652956 ("net: dsa: realtek-smi: Add Realtek SMI driver")
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      15ab7906
  7. 25 7月, 2020 3 次提交
  8. 22 7月, 2020 1 次提交
    • H
      net: dsa: microchip: call phy_remove_link_mode during probe · 3506b2f4
      Helmut Grohne 提交于
      When doing "ip link set dev ... up" for a ksz9477 backed link,
      ksz9477_phy_setup is called and it calls phy_remove_link_mode to remove
      1000baseT HDX. During phy_remove_link_mode, phy_advertise_supported is
      called. Doing so reverts any previous change to advertised link modes
      e.g. using a udevd .link file.
      
      phy_remove_link_mode is not meant to be used while opening a link and
      should be called during phy probe when the link is not yet available to
      userspace.
      
      Therefore move the phy_remove_link_mode calls into
      ksz9477_switch_register. It indirectly calls dsa_register_switch, which
      creates the relevant struct phy_devices and we update the link modes
      right after that. At that time dev->features is already initialized by
      ksz9477_switch_detect.
      
      Remove phy_setup from ksz_dev_ops as no users remain.
      
      Link: https://lore.kernel.org/netdev/20200715192722.GD1256692@lunn.ch/
      Fixes: 42fc6a4c ("net: dsa: microchip: prepare PHY for proper advertisement")
      Signed-off-by: NHelmut Grohne <helmut.grohne@intenta.de>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3506b2f4
  9. 21 7月, 2020 1 次提交
  10. 20 7月, 2020 2 次提交
  11. 17 7月, 2020 1 次提交
    • V
      net: mscc: ocelot: rethink Kconfig dependencies again · 89e35f66
      Vladimir Oltean 提交于
      Having the users of MSCC_OCELOT_SWITCH_LIB depend on REGMAP_MMIO was a
      bad idea, since that symbol is not user-selectable. So we should have
      kept a 'select REGMAP_MMIO'.
      
      When we do that, we run into 2 more problems:
      
      - By depending on GENERIC_PHY, we are causing a recursive dependency.
        But it looks like GENERIC_PHY has no other dependencies, and other
        drivers select it, so we can select it too:
      
      drivers/of/Kconfig:69:error: recursive dependency detected!
      drivers/of/Kconfig:69:  symbol OF_IRQ depends on IRQ_DOMAIN
      kernel/irq/Kconfig:68:  symbol IRQ_DOMAIN is selected by REGMAP
      drivers/base/regmap/Kconfig:7:  symbol REGMAP default is visible depending on REGMAP_MMIO
      drivers/base/regmap/Kconfig:39: symbol REGMAP_MMIO is selected by MSCC_OCELOT_SWITCH_LIB
      drivers/net/ethernet/mscc/Kconfig:15:   symbol MSCC_OCELOT_SWITCH_LIB is selected by MSCC_OCELOT_SWITCH
      drivers/net/ethernet/mscc/Kconfig:22:   symbol MSCC_OCELOT_SWITCH depends on GENERIC_PHY
      drivers/phy/Kconfig:8:  symbol GENERIC_PHY is selected by PHY_BCM_NS_USB3
      drivers/phy/broadcom/Kconfig:41:        symbol PHY_BCM_NS_USB3 depends on MDIO_BUS
      drivers/net/phy/Kconfig:13:     symbol MDIO_BUS depends on MDIO_DEVICE
      drivers/net/phy/Kconfig:6:      symbol MDIO_DEVICE is selected by PHYLIB
      drivers/net/phy/Kconfig:254:    symbol PHYLIB is selected by ARC_EMAC_CORE
      drivers/net/ethernet/arc/Kconfig:19:    symbol ARC_EMAC_CORE is selected by ARC_EMAC
      drivers/net/ethernet/arc/Kconfig:25:    symbol ARC_EMAC depends on OF_IRQ
      
      - By depending on PHYLIB, we are causing a recursive dependency. PHYLIB
        only has a single dependency, "depends on NETDEVICES", which we are
        already depending on, so we can again hack our way into conformance by
        turning the PHYLIB dependency into a select.
      
      drivers/of/Kconfig:69:error: recursive dependency detected!
      drivers/of/Kconfig:69:  symbol OF_IRQ depends on IRQ_DOMAIN
      kernel/irq/Kconfig:68:  symbol IRQ_DOMAIN is selected by REGMAP
      drivers/base/regmap/Kconfig:7:  symbol REGMAP default is visible depending on REGMAP_MMIO
      drivers/base/regmap/Kconfig:39: symbol REGMAP_MMIO is selected by MSCC_OCELOT_SWITCH_LIB
      drivers/net/ethernet/mscc/Kconfig:15:   symbol MSCC_OCELOT_SWITCH_LIB is selected by MSCC_OCELOT_SWITCH
      drivers/net/ethernet/mscc/Kconfig:22:   symbol MSCC_OCELOT_SWITCH depends on PHYLIB
      drivers/net/phy/Kconfig:254:    symbol PHYLIB is selected by ARC_EMAC_CORE
      drivers/net/ethernet/arc/Kconfig:19:    symbol ARC_EMAC_CORE is selected by ARC_EMAC
      drivers/net/ethernet/arc/Kconfig:25:    symbol ARC_EMAC depends on OF_IRQ
      
      Fixes: f4d0323b ("net: mscc: ocelot: convert MSCC_OCELOT_SWITCH into a library")
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      89e35f66
  12. 14 7月, 2020 8 次提交
    • M
      net: dsa: felix: introduce support for Seville VSC9953 switch · 84705fc1
      Maxim Kochetkov 提交于
      This is another switch from Vitesse / Microsemi / Microchip, that has
      10 ports (8 external, 2 internal) and is integrated into the Freescale /
      NXP T1040 PowerPC SoC. It is very similar to Felix from NXP LS1028A,
      except that this is a platform device and Felix is a PCI device, and it
      doesn't support IEEE 1588 and TSN.
      
      Like Felix, this driver configures its own PCS on the internal MDIO bus
      using a phy_device abstraction for it (yes, it will be refactored to use
      a raw mdio_device, like other phylink drivers do, but let's keep it like
      that for now). But unlike Felix, the MDIO bus and the PCS are not from
      the same vendor. The PCS is the same QorIQ/Layerscape PCS as found in
      Felix/ENETC/DPAA*, but the internal MDIO bus that is used to access it
      is actually an instantiation of drivers/net/phy/mdio-mscc-miim.c. But it
      would be difficult to reuse that driver (it doesn't even use regmap, and
      it's less than 200 lines of code), so we hand-roll here some internal
      MDIO bus accessors within seville_vsc9953.c, which serves the purpose of
      driving the PCS absolutely fine.
      
      Also, same as Felix, the PCS doesn't support dynamic reconfiguration of
      SerDes protocol, so we need to do pre-validation of PHY mode from device
      tree and not let phylink change it.
      Signed-off-by: NMaxim Kochetkov <fido_max@inbox.ru>
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      84705fc1
    • V
      net: dsa: felix: move probing to felix_vsc9959.c · 375e1314
      Vladimir Oltean 提交于
      Felix is not actually meant to be a DSA driver only for the switch
      inside NXP LS1028A, but an umbrella for all Vitesse / Microsemi /
      Microchip switches that are register-compatible with Ocelot and that are
      using in DSA mode (with an NPI Ethernet port).
      
      For the dsa_switch_ops exported by the felix driver to be generic enough
      to be used by other non-PCI switches, we need to move the PCI-specific
      probing to the low-level translation module felix_vsc9959.c. This way,
      other switches can have their own probing functions, as platform devices
      or otherwise.
      
      This patch also removes the "Felix instance table", which did not stand
      the test of time and is unnecessary at this point.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      375e1314
    • M
      net: mscc: ocelot: extend watermark encoding function · aa92d836
      Maxim Kochetkov 提交于
      The ocelot_wm_encode function deals with setting thresholds for pause
      frame start and stop. In Ocelot and Felix the register layout is the
      same, but for Seville, it isn't. The easiest way to accommodate Seville
      hardware configuration is to introduce a function pointer for setting
      this up.
      Signed-off-by: NMaxim Kochetkov <fido_max@inbox.ru>
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      aa92d836
    • M
      net: mscc: ocelot: convert SYS_PAUSE_CFG register access to regfield · 541132f0
      Maxim Kochetkov 提交于
      Seville has a different bitwise layout than Ocelot and Felix.
      Signed-off-by: NMaxim Kochetkov <fido_max@inbox.ru>
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      541132f0
    • V
      net: dsa: felix: create a template for the DSA tags on xmit · 67c24049
      Vladimir Oltean 提交于
      With this patch we try to kill 2 birds with 1 stone.
      
      First of all, some switches that use tag_ocelot.c don't have the exact
      same bitfield layout for the DSA tags. The destination ports field is
      different for Seville VSC9953 for example. So the choices are to either
      duplicate tag_ocelot.c into a new tag_seville.c (sub-optimal) or somehow
      take into account a supposed ocelot->dest_ports_offset when packing this
      field into the DSA injection header (again not ideal).
      
      Secondly, tag_ocelot.c already needs to memset a 128-bit area to zero
      and call some packing() functions of dubious performance in the
      fastpath. And most of the values it needs to pack are pretty much
      constant (BYPASS=1, SRC_PORT=CPU, DEST=port index). So it would be good
      if we could improve that.
      
      The proposed solution is to allocate a memory area per port at probe
      time, initialize that with the statically defined bits as per chip
      hardware revision, and just perform a simpler memcpy in the fastpath.
      
      Other alternatives have been analyzed, such as:
      - Create a separate tag_seville.c: too much code duplication for just 1
        bit field difference.
      - Create a separate DSA_TAG_PROTO_SEVILLE under tag_ocelot.c, just like
        tag_brcm.c, which would have a separate .xmit function. Again, too
        much code duplication for just 1 bit field difference.
      - Allocate the template from the init function of the tag_ocelot.c
        module, instead of from the driver: couldn't figure out a method of
        accessing the correct port template corresponding to the correct
        tagger in the .xmit function.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      67c24049
    • V
      net: mscc: ocelot: convert QSYS_SWITCH_PORT_MODE and SYS_PORT_MODE to regfields · 886e1387
      Vladimir Oltean 提交于
      Currently Felix and Ocelot share the same bit layout in these per-port
      registers, but Seville does not. So we need reg_fields for that.
      
      Actually since these are per-port registers, we need to also specify the
      number of ports, and register size per port, and use the regmap API for
      multiple ports.
      
      There's a more subtle point to be made about the other 2 register
      fields:
      - QSYS_SWITCH_PORT_MODE_SCH_NEXT_CFG
      - QSYS_SWITCH_PORT_MODE_INGRESS_DROP_MODE
      which we are not writing any longer, for 2 reasons:
      - Using the previous API (ocelot_write_rix), we were only writing 1 for
        Felix and Ocelot, which was their hardware-default value, and which
        there wasn't any intention in changing.
      - In the case of SCH_NEXT_CFG, in fact Seville does not have this
        register field at all, and therefore, if we want to have common code
        we would be required to not write to it.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      886e1387
    • M
      soc: mscc: ocelot: add MII registers description · 2789658f
      Maxim Kochetkov 提交于
      Add the register definitions for the MSCC MIIM MDIO controller in
      preparation for seville_vsc9959.c to create its accessors for the
      internal MDIO bus.
      
      Since we've introduced elements to ocelot_regfields that are not
      instantiated by felix and ocelot, we need to define the size of the
      regfields arrays explicitly, otherwise ocelot_regfields_init, which
      iterates up to REGFIELD_MAX, will fault on the undefined regfield
      entries (if we're lucky).
      Signed-off-by: NMaxim Kochetkov <fido_max@inbox.ru>
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2789658f
    • V
      net: mscc: ocelot: convert port registers to regmap · 91c724cf
      Vladimir Oltean 提交于
      At the moment, there are some minimal register differences between
      VSC7514 Ocelot and VSC9959 Felix. To be precise, the PCS1G registers are
      missing from Felix because it was integrated with an NXP PCS.
      
      But with VSC9953 Seville (not yet introduced), the register differences
      are more pronounced.  The MAC registers are located at different offsets
      within the DEV_GMII target. So we need to refactor the driver to keep a
      regmap even for per-port registers. The callers of the ocelot_port_readl
      and ocelot_port_writel were kept unchanged, only the implementation is
      now more generic.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      91c724cf
  13. 13 7月, 2020 1 次提交
  14. 09 7月, 2020 2 次提交
  15. 06 7月, 2020 7 次提交