Skip to content
Permalink
Alvin-ipraga/n…
Switch branches/tags

Commits on Aug 22, 2021

  1. net: phy: realtek: add support for RTL8365MB-VC internal PHYs

    The RTL8365MB-VC ethernet switch controller has 4 internal PHYs for its
    user-facing ports. All that is needed is to let the PHY driver core
    pick up the IRQ made available by the switch driver.
    
    Signed-off-by: Alvin Šipraga <alsi@bang-olufsen.dk>
    sipraga authored and intel-lab-lkp committed Aug 22, 2021
  2. net: dsa: realtek-smi: add rtl8365mb subdriver for RTL8365MB-VC

    This patch adds a realtek-smi subdriver for the RTL8365MB-VC 4+1 port
    10/100/1000M Ethernet switch controller. The driver has been developed
    based on a GPL-licensed OS-agnostic Realtek vendor driver known as
    rtl8367c found in the OpenWrt source tree.
    
    Despite the name, the RTL8365MB-VC has an entirely different register
    layout to the already-supported RTL8366RB ASIC. Notwithstanding this,
    the structure of the rtl8365mb subdriver is based on the rtl8366rb
    subdriver and makes use of the rtl8366 helper library for VLAN
    configuration. Like the 'rb, it establishes its own irqchip to handle
    cascaded PHY link status interrupts.
    
    The RTL8365MB-VC is a capable switch and provides a number of offload
    features that are not yet supported by this subdriver. However, the
    basic functionality should be the same as that the rtl8366rb, modulo LED
    support, Energy-Efficient Ethernet (EEE), and MTU configuration. Support
    for these features - and more - may follow.
    
    One more thing. Realtek's nomenclature for switches makes it hard to
    know exactly what other ASICs might be supported by this driver. The
    vendor driver goes by the name rtl8367c, but as far as I can tell, no
    chip actually exists under this name. As such, the subdriver is named
    rtl8365mb to emphasize the potentially limited support. But it is clear
    from the vendor sources that a number of other more advanced switches
    share a similar register layout, and further support should not be too
    hard to add given access to the relevant hardware. With this in mind,
    the subdriver has been written with as few assumptions about the
    particular chip as is reasonable. But the RTL8365MB-VC is the only
    hardware I have available, so some further work is surely needed.
    
    Signed-off-by: Alvin Šipraga <alsi@bang-olufsen.dk>
    Co-developed-by: Michael Rasmussen <mir@bang-olufsen.dk>
    Signed-off-by: Michael Rasmussen <mir@bang-olufsen.dk>
    sipraga authored and intel-lab-lkp committed Aug 22, 2021
  3. net: dsa: tag_rtl8_4: add realtek 8 byte protocol 4 tag

    This commit implements a basic version of the 8 byte tag protocol used
    in the Realtek RTL8365MB-VC switch, which carries with it a protocol
    version of 0x04.
    
    The implementation itself only handles the parsing of the EtherType
    value and Realtek protocol version, together with the source or
    destination port fields. The rest is left unimplemented for now.
    
    The tag format is described in a confidential document provided to my
    employer - Bang & Olufsen a/s - by Realtek Semiconductor Corp.
    Permission has been granted by Realtek to publish this driver based on
    that material, together with an extract from the document describing the
    tag format and its fields.  It is hoped that this will help future
    implementors who do not have access to the material but who wish to
    extend the functionality of drivers for chips which use this protocol.
    
    Signed-off-by: Alvin Šipraga <alsi@bang-olufsen.dk>
    sipraga authored and intel-lab-lkp committed Aug 22, 2021
  4. dt-bindings: net: dsa: realtek-smi: document new compatible rtl8365mb

    rtl8365mb is a new realtek-smi subdriver for the RTL8365MB-VC 4+1 port
    10/100/1000M Ethernet switch controller. Its compatible string is
    "realtek,rtl8365mb".
    
    Signed-off-by: Alvin Šipraga <alsi@bang-olufsen.dk>
    sipraga authored and intel-lab-lkp committed Aug 22, 2021
  5. net: dsa: realtek-smi: fix mdio_free bug on module unload

    realtek-smi-core fails to unregister the slave MII bus on module unload,
    raising the following BUG warning:
    
        mdio_bus.c:650: BUG_ON(bus->state != MDIOBUS_UNREGISTERED);
    
        kernel BUG at drivers/net/phy/mdio_bus.c:650!
        Internal error: Oops - BUG: 0 [#1] PREEMPT_RT SMP
        Call trace:
         mdiobus_free+0x4c/0x50
         devm_mdiobus_free+0x18/0x20
         release_nodes.isra.0+0x1c0/0x2b0
         devres_release_all+0x38/0x58
         device_release_driver_internal+0x124/0x1e8
         driver_detach+0x54/0xe0
         bus_remove_driver+0x60/0xd8
         driver_unregister+0x34/0x60
         platform_driver_unregister+0x18/0x20
         realtek_smi_driver_exit+0x14/0x1c [realtek_smi]
    
    Fix this by duly unregistering the slave MII bus with
    mdiobus_unregister. We do this in the DSA teardown path, since
    registration is performed in the DSA setup path.
    
    Cc: Linus Walleij <linus.walleij@linaro.org>
    Fixes: d865295 ("net: dsa: realtek-smi: Add Realtek SMI driver")
    Signed-off-by: Alvin Šipraga <alsi@bang-olufsen.dk>
    sipraga authored and intel-lab-lkp committed Aug 22, 2021
  6. Merge branch 'dsa-docs'

    Vladimir Oltean says:
    
    ====================
    DSA documentation updates for v5.15
    
    There were some documentation-visible changes made to DSA in the
    net-next tree for v5.15. There may be more, but these are the ones I am
    aware of.
    ====================
    
    Signed-off-by: David S. Miller <davem@davemloft.net>
    davem330 committed Aug 22, 2021
  7. docs: net: dsa: document the new methods for bridge TX forwarding off…

    …load
    
    Two new methods have been introduced, add some verbiage about what they do.
    
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    vladimiroltean authored and davem330 committed Aug 22, 2021
  8. docs: net: dsa: remove references to struct dsa_device_ops::filter

    This function has disappeared in commit edac6f6 ("Revert "net: dsa:
    Allow drivers to filter packets they can decode source port from"").
    
    Also, since commit 4e50025 ("net: dsa: generalize overhead for
    taggers that use both headers and trailers"), the next paragraph is no
    longer true (it is still discouraged to do that, but it is now
    supported, so no point in mentioning it). Delete.
    
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    vladimiroltean authored and davem330 committed Aug 22, 2021
  9. docs: net: dsa: sja1105: update list of limitations

    Remove the paragraphs that talk about the various modes of traffic
    support, bridging with foreign interfaces, etc etc. There is nothing
    that the user needs to know now, it should all work out of the box as
    expected.
    
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    vladimiroltean authored and davem330 committed Aug 22, 2021
  10. docs: devlink: remove the references to sja1105

    The sja1105 driver has removed its devlink params, so there is nothing
    to see here.
    
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    vladimiroltean authored and davem330 committed Aug 22, 2021
  11. Merge branch 'ipa-autosuspend'

    Alex Elder says:
    
    ====================
    net: ipa: enable automatic suspend
    
    At long last, the first patch in this series enables automatic
    suspend managed by the power management core.  The remaining two
    just rename things to be "power" oriented rather than "clock"
    oriented.
    ====================
    
    Signed-off-by: David S. Miller <davem@davemloft.net>
    davem330 committed Aug 22, 2021
  12. net: ipa: rename "ipa_clock.c"

    Finally, rename "ipa_clock.c" to be "ipa_power.c" and "ipa_clock.h"
    to be "ipa_power.h".
    
    Signed-off-by: Alex Elder <elder@linaro.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    alexelder authored and davem330 committed Aug 22, 2021
  13. net: ipa: rename ipa_clock_* symbols

    Rename a number of functions to clarify that there is no longer a
    notion of an "IPA clock," but rather that the functions are more
    generally related to IPA power management.
    
      ipa_clock_enable() -> ipa_power_enable()
      ipa_clock_disable() -> ipa_power_disable()
      ipa_clock_rate() -> ipa_core_clock_rate()
      ipa_clock_init() -> ipa_power_init()
      ipa_clock_exit() -> ipa_power_exit()
    
    Rename the ipa_clock structure to be ipa_power.  Rename all
    variables and fields using that structure type "power" rather
    than "clock".
    
    Rename the ipa_clock_data structure to be ipa_power_data, and more
    broadly, just substitute "power" for "clock" in places that
    previously represented things related to the "IPA clock".
    
    Update comments throughout.
    
    Signed-off-by: Alex Elder <elder@linaro.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    alexelder authored and davem330 committed Aug 22, 2021
  14. net: ipa: use autosuspend

    Use runtime power management autosuspend.
    
    Up until this point, we only suspended the IPA hardware for system
    suspend; now we'll suspend it aggressively using runtime power
    management, setting the initial autosuspend delay to half a second
    of inactivity.
    
    Replace pm_runtime_put() calls with pm_runtime_put_autosuspend(),
    call pm_runtime_mark_last_busy() before each of those.  In places
    where we're shutting things down, or decrementing power references
    for errors, use pm_runtime_put_noidle() instead.
    
    Finally, remove ipa_runtime_idle(), so the ->runtime_suspend
    callback will occur if idle.
    
    Signed-off-by: Alex Elder <elder@linaro.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    alexelder authored and davem330 committed Aug 22, 2021

Commits on Aug 20, 2021

  1. Merge tag 'mac80211-next-for-net-next-2021-08-20' of git://git.kernel…

    ….org/pub/scm/linux/kernel/git/jberg/mac80211-next
    
    Johannes Berg says:
    
    ====================
    Minor updates:
     * BSS coloring support
     * MEI commands for Intel platforms
     * various fixes/cleanups
    
    * tag 'mac80211-next-for-net-next-2021-08-20' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next:
      cfg80211: fix BSS color notify trace enum confusion
      mac80211: Fix insufficient headroom issue for AMSDU
      mac80211: add support for BSS color change
      nl80211: add support for BSS coloring
      mac80211: Use flex-array for radiotap header bitmap
      mac80211: radiotap: Use BIT() instead of shifts
      mac80211: Remove unnecessary variable and label
      mac80211: include <linux/rbtree.h>
      mac80211: Fix monitor MTU limit so that A-MSDUs get through
      mac80211: remove unnecessary NULL check in ieee80211_register_hw()
      mac80211: Reject zero MAC address in sta_info_insert_check()
      nl80211: vendor-cmd: add Intel vendor commands for iwlmei usage
    ====================
    
    Link: https://lore.kernel.org/r/20210820105329.48674-1-johannes@sipsolutions.net
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Jakub Kicinski committed Aug 20, 2021
  2. Merge branch 'bridge-vlan'

    Nikolay Aleksandrov says:
    
    ====================
    net: bridge: mcast: add support for port/vlan router control
    
    This small set adds control over port/vlan mcast router config.
    Initially I had added host vlan entry router control via vlan's global
    options but that is really unnecessary and we can use a single per-vlan
    option to control it both for port/vlan and host/vlan entries. Since
    it's all still in net-next we can convert BRIDGE_VLANDB_GOPTS_MCAST_ROUTER
    to BRIDGE_VLANDB_ENTRY_MCAST_ROUTER and use it for both. That makes much
    more sense and is easier for user-space. Patch 01 prepares the port
    router function to be used with port mcast context instead of port and
    then patch 02 converts the global vlan mcast router option to per-vlan
    mcast router option which directly gives us both host/vlan and port/vlan
    mcast router control without any additional changes.
    
    This way we get the following coherent syntax:
     [ port/vlan mcast router]
     $ bridge vlan set vid 100 dev ens20 mcast_router 2
    
     [ bridge/vlan mcast router ]
     $ bridge vlan set vid 100 dev bridge mcast_router 2
    instead of:
     $ bridge vlan set vid 100 dev bridge mcast_router 1 global
    
    The mcast_router should not be regarded as a global option, it controls
    the port/vlan and bridge/vlan mcast router behaviour.
    
    This is the last set needed for the initial per-vlan mcast support.
    Next patch-sets:
     - iproute2 support
     - selftests
    ====================
    
    Signed-off-by: David S. Miller <davem@davemloft.net>
    davem330 committed Aug 20, 2021
  3. net: bridge: vlan: convert mcast router global option to per-vlan entry

    The per-vlan router option controls the port/vlan and host vlan entries'
    mcast router config. The global option controlled only the host vlan
    config, but that is unnecessary and incosistent as it's not really a
    global vlan option, but rather bridge option to control host router
    config, so convert BRIDGE_VLANDB_GOPTS_MCAST_ROUTER to
    BRIDGE_VLANDB_ENTRY_MCAST_ROUTER which can be used to control both host
    vlan and port vlan mcast router config.
    
    Signed-off-by: Nikolay Aleksandrov <nikolay@nvidia.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Nikolay Aleksandrov authored and davem330 committed Aug 20, 2021
  4. net: bridge: mcast: br_multicast_set_port_router takes multicast cont…

    …ext as argument
    
    Change br_multicast_set_port_router to take port multicast context as
    its first argument so we can later use it to control port/vlan mcast
    router option.
    
    Signed-off-by: Nikolay Aleksandrov <nikolay@nvidia.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Nikolay Aleksandrov authored and davem330 committed Aug 20, 2021
  5. octeontx2-pf: Add check for non zero mcam flows

    This patch ensures that mcam flows are allocated
    before adding or destroying the flows.
    
    Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
    Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Sunil Goutham authored and davem330 committed Aug 20, 2021
  6. tools/net: Use bitwise instead of arithmetic operator for flags

    This silences the following coccinelle warning:
    
    "WARNING: sum of probable bitmasks, consider |"
    
    Reported-by: Zeal Robot <zealci@zte.com.cn>
    Signed-off-by: jing yangyang <jing.yangyang@zte.com.cn>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    jing yangyang authored and davem330 committed Aug 20, 2021
  7. Merge branch 'ipa-kill-off-ipa_clock_get'

    Alex Elder says:
    
    ====================
    net: ipa: kill off ipa_clock_get()
    
    This series replaces the remaining uses of ipa_clock_get() with
    calls to pm_runtime_get_sync() instead.  It replaces all calls to
    ipa_clock_put() with calls to pm_runtime_put().
    
    This completes the preparation for enabling automated suspend under
    the control of the power management core code.  The next patch (in
    an upcoming series) enables that.  Then the "ipa_clock" files and
    symbols will switch to using an "ipa_power" naming convention instead.
    
    Additional info
    
    It is possible for pm_runtime_get_sync() to return an error.  There
    are really three cases, identified by return value:
      - 1, meaning power was already active
      - 0, meaning power was not previously active, but is now
      - EACCES, meaning runtime PM is disabled
    One additional case is EINVAL, meaning a previous suspend or resume
    (or idle) call returned an error.  But we have always assumed this
    won't happen (we previously didn't even check for an error).
    
    But because we use pm_runtime_force_suspend() to implement system
    suspend, there's a chance we'd get an EACCES error (the first thing
    that function does is disable runtime suspend).  Individual patches
    explain what happens in that case, but generally we just accept that
    it could be an unlikely problem (occurring only at startup time).
    
    Similarly, pm_runtime_put() could return an error.  There too, we
    ignore EINVAL, assuming the IPA suspend and resume operations won't
    produce an error.  EBUSY and EPERM are not applicable, EAGAIN is not
    expected (and harmless).  We should never get EACCES (runtime
    suspend disabled), because pm_runtime_put() calls match prior
    pm_runtime_get_sync() calls, and a system suspend will not be
    started while a runtime suspend or resume is underway.  In summary,
    the value returned from pm_runtime_put() is not meaningful, so we
    explicitly ignore it.
    ====================
    
    Signed-off-by: David S. Miller <davem@davemloft.net>
    davem330 committed Aug 20, 2021
  8. net: ipa: kill ipa_clock_get()

    The only remaining user of the ipa_clock_{get,put}() interface is
    ipa_isr_thread().  Replace calls to ipa_clock_get() there calling
    pm_runtime_get_sync() instead.  And call pm_runtime_put() there
    rather than ipa_clock_put().  Warn if we ever get an error.
    
    With that, we can get rid of ipa_clock_get() and ipa_clock_put().
    
    Signed-off-by: Alex Elder <elder@linaro.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    alexelder authored and davem330 committed Aug 20, 2021
  9. net: ipa: don't use ipa_clock_get() in "ipa_modem.c"

    When we open or close the modem network device we need to ensure the
    hardware is powered.  Replace the callers of ipa_clock_get() found
    in ipa_open() and ipa_stop() with calls to pm_runtime_get_sync().
    If an error is returned, simply return that error to the caller
    (without any error or warning message).  This could conceivably
    occur if the function was called while the system was suspended,
    but that really shouldn't happen.  Replace corresponding calls to
    ipa_clock_put() with pm_runtime_put() also.
    
    If the modem crashes we also need to ensure the hardware is powered
    to recover.  If getting power returns an error there's not much we
    can do, but at least report the error.  (Ideally the remoteproc SSR
    code would ensure the AP was not suspended when it sends the
    notification, but that is not (yet) the case.)
    
    Signed-off-by: Alex Elder <elder@linaro.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    alexelder authored and davem330 committed Aug 20, 2021
  10. net: ipa: don't use ipa_clock_get() in "ipa_uc.c"

    Replace the ipa_clock_get() call in ipa_uc_clock() when taking the
    "proxy" clock reference for the microcontroller with a call to
    pm_runtime_get_sync().  Replace calls of ipa_clock_put() for the
    microcontroller with pm_runtime_put() calls instead.
    
    There is a chance we get an error when taking the microcontroller
    power reference.  This is an unlikely scenario, where system suspend
    is initiated just before we learn the modem is booting.  For now
    we'll just accept that this could occur, and report it if it does.
    
    Signed-off-by: Alex Elder <elder@linaro.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    alexelder authored and davem330 committed Aug 20, 2021
  11. net: ipa: don't use ipa_clock_get() in "ipa_smp2p.c"

    If the "modem-init" Device Tree property is present for a platform,
    the modem performs early IPA hardware initialization, and signals
    this is complete with an "ipa-setup-ready" SMP2P interrupt.  This
    triggers a call to ipa_setup(), which requires the hardware to be
    powered.
    
    Replace the call to ipa_clock_get() in this case with a call to
    pm_runtime_get_sync().  And replace the corresponding calls to
    ipa_clock_put() with calls to pm_runtime_put() instead.
    
    There is a chance we get an error when taking this power reference.
    This is an unlikely scenario, where system suspend is initiated just
    before the modem signals it has finished initializing the IPA
    hardware.  For now we'll just accept that this could occur, and
    report it if it does.
    
    Signed-off-by: Alex Elder <elder@linaro.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    alexelder authored and davem330 committed Aug 20, 2021
  12. net: ipa: don't use ipa_clock_get() in "ipa_main.c"

    We need the hardware to be powered starting at the config stage of
    initialization when the IPA driver probes.  And we need it powered
    when the driver is removed, at least until the deconfig stage has
    completed.
    
    Replace callers of ipa_clock_get() in ipa_probe() and ipa_exit(),
    calling pm_runtime_get_sync() instead.  Replace the corresponding
    callers of ipa_clock_put(), calling pm_runtime_put() instead.
    
    The only error we expect when getting power would occur when the
    system is suspended.  The ->probe and ->remove driver callbacks
    won't be called when suspended, so issue a WARN() call if an error
    is seen getting power.
    
    Signed-off-by: Alex Elder <elder@linaro.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    alexelder authored and davem330 committed Aug 20, 2021
  13. net: ipa: fix TX queue race

    Jakub Kicinski pointed out a race condition in ipa_start_xmit() in a
    recently-accepted series of patches:
      https://lore.kernel.org/netdev/20210812195035.2816276-1-elder@linaro.org/
    We are stopping the modem TX queue in that function if the power
    state is not active.  We restart the TX queue again once hardware
    resume is complete.
    
      TX path                       Power Management
      -------                       ----------------
      pm_runtime_get(); no power    Start resume
      Stop TX queue                      ...
      pm_runtime_put()              Resume complete
      return NETDEV_TX_BUSY         Start TX queue
    
      pm_runtime_get()
      Power present, transmit
      pm_runtime_put()              (auto-suspend)
    
    The issue is that the power management (resume) activity and the
    network transmit activity can occur concurrently, and there's a
    chance the queue will be stopped *after* it has been started again.
    
      TX path                       Power Management
      -------                       ----------------
                                    Resume underway
      pm_runtime_get(); no power         ...
                                    Resume complete
                                    Start TX queue
      Stop TX queue       <-- No more transmits after this
      pm_runtime_put()
      return NETDEV_TX_BUSY
    
    We address this using a STARTED flag to indicate when the TX queue
    has been started from the resume path, and a spinlock to make the
    flag and queue updates happen atomically.
    
      TX path                       Power Management
      -------                       ----------------
                                    Resume underway
      pm_runtime_get(); no power    Resume complete
                                    start TX queue     \
      If STARTED flag is *not* set:                     > atomic
          Stop TX queue             set STARTED flag   /
      pm_runtime_put()
      return NETDEV_TX_BUSY
    
    A second flag is used to address a different race that involves
    another path requesting power.
    
      TX path            Other path              Power Management
      -------            ----------              ----------------
                         pm_runtime_get_sync()   Resume
                                                 Start TX queue   \ atomic
                                                 Set STARTED flag /
                         (do its thing)
                         pm_runtime_put()
                                                 (auto-suspend)
      pm_runtime_get()                           Mark delayed resume
      STARTED *is* set, so
        do *not* stop TX queue  <-- Queue should be stopped here
      pm_runtime_put()
      return NETDEV_TX_BUSY                      Suspend done, resume
                                                 Resume complete
      pm_runtime_get()
      Stop TX queue
        (STARTED is *not* set)                   Start TX queue   \ atomic
      pm_runtime_put()                           Set STARTED flag /
      return NETDEV_TX_BUSY
    
    So a STOPPED flag is set in the transmit path when it has stopped
    the TX queue, and this pair of operations is also protected by the
    spinlock.  The resume path only restarts the TX queue if the STOPPED
    flag is set.  This case isn't a major problem, but it avoids the
    "non-trivial amount of useless work" done by the networking stack
    when NETDEV_TX_BUSY is returned.
    
    Fixes: 6b51f80 ("net: ipa: ensure hardware has power in ipa_start_xmit()")
    Signed-off-by: Alex Elder <elder@linaro.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    alexelder authored and davem330 committed Aug 20, 2021
  14. Merge branch 'ocelot-vlan'

    Vladimir Oltean says:
    
    ====================
    Small ocelot VLAN improvements
    
    This small series propagates some VLAN restrictions via netlink extack
    and creates some helper functions instead of open-coding VLAN table
    manipulations from multiple places.
    
    This is split from the larger "DSA FDB isolation" series, hence the v2
    tag:
    https://patchwork.kernel.org/project/netdevbpf/cover/20210818120150.892647-1-vladimir.oltean@nxp.com/
    ====================
    
    Signed-off-by: David S. Miller <davem@davemloft.net>
    davem330 committed Aug 20, 2021
  15. net: mscc: ocelot: use helpers for port VLAN membership

    This is a mostly cosmetic patch that creates some helpers for accessing
    the VLAN table. These helpers are also a bit more careful in that they
    do not modify the ocelot->vlan_mask unless the hardware operation
    succeeded.
    
    Not all callers check the return value (the init code doesn't), but anyway.
    
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    vladimiroltean authored and davem330 committed Aug 20, 2021
  16. net: mscc: ocelot: transmit the VLAN filtering restrictions via extack

    We need to transmit more restrictions in future patches, convert this
    one to netlink extack.
    
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    vladimiroltean authored and davem330 committed Aug 20, 2021
  17. net: mscc: ocelot: transmit the "native VLAN" error via extack

    We need to reject some more configurations in future patches, convert
    the existing one to netlink extack.
    
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    vladimiroltean authored and davem330 committed Aug 20, 2021
  18. Merge branch 'ocelot-phylink-fixes'

    Vladimir Oltean says:
    
    ====================
    Ocelot phylink fixes
    
    This series addresses a regression reported by Horatiu which introduced
    by the ocelot conversion to phylink: there are broken device trees in
    the wild, and the driver fails to probe the entire switch when a port
    fails to probe, which it previously did not do.
    
    Continue probing even when some ports fail to initialize properly.
    ====================
    
    Signed-off-by: David S. Miller <davem@davemloft.net>
    davem330 committed Aug 20, 2021
  19. net: mscc: ocelot: allow probing to continue with ports that fail to …

    …register
    
    The existing ocelot device trees, like ocelot_pcb123.dts for example,
    have SERDES ports (ports 4 and higher) that do not have status = "disabled";
    but on the other hand do not have a phy-handle or a fixed-link either.
    
    So from the perspective of phylink, they have broken DT bindings.
    
    Since the blamed commit, probing for the entire switch will fail when
    such a device tree binding is encountered on a port. There used to be
    this piece of code which skipped ports without a phy-handle:
    
    	phy_node = of_parse_phandle(portnp, "phy-handle", 0);
    	if (!phy_node)
    		continue;
    
    but now it is gone.
    
    Anyway, fixed-link setups are a thing which should work out of the box
    with phylink, so it would not be in the best interest of the driver to
    add that check back.
    
    Instead, let's look at what other drivers do. Since commit 86f8b1c
    ("net: dsa: Do not make user port errors fatal"), DSA continues after a
    switch port fails to register, and works only with the ports that
    succeeded.
    
    We can achieve the same behavior in ocelot by unregistering the devlink
    port for ports where ocelot_port_phylink_create() failed (called via
    ocelot_probe_port), and clear the bit in devlink_ports_registered for
    that port. This will make the next iteration reconsider the port that
    failed to probe as an unused port, and re-register a devlink port of
    type UNUSED for it. No other cleanup should need to be performed, since
    ocelot_probe_port() should be self-contained when it fails.
    
    Fixes: e6e12df ("net: mscc: ocelot: convert to phylink")
    Reported-and-tested-by: Horatiu Vultur <horatiu.vultur@microchip.com>
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    vladimiroltean authored and davem330 committed Aug 20, 2021
  20. net: mscc: ocelot: be able to reuse a devlink_port after teardown

    There are cases where we would like to continue probing the switch even
    if one port has failed to probe. When that happens, we need to
    unregister a devlink_port of type DEVLINK_PORT_FLAVOUR_PHYSICAL and
    re-register it of type DEVLINK_PORT_FLAVOUR_UNUSED.
    
    This is fine, except when calling devlink_port_attrs_set on a structure
    on which devlink_port_register has been previously called, there is a
    WARN_ON in devlink_port_attrs_set that devlink_port->devlink must be
    NULL.
    
    So don't assume that the memory behind dlp is clean when calling
    ocelot_port_devlink_init, just zero-initialize it.
    
    Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    HoratiuVultur authored and davem330 committed Aug 20, 2021
  21. Merge branch 'dpaa2-switch-phylikn-fixes'

    Vladimir Oltean says:
    
    ====================
    dpaa2-switch phylink fixes
    
    This is fixing two regressions introduced by the recent conversion of
    the dpaa2-switch driver to phylink.
    ====================
    
    Signed-off-by: David S. Miller <davem@davemloft.net>
    davem330 committed Aug 20, 2021
Older