1. 19 Dec, 2019 3 commits
  2. 18 Dec, 2019 37 commits
    • Jose Abreu's avatar
      net: stmmac: tc: Fix TAPRIO division operation · a1ec57c0
      Jose Abreu authored
      For ARCHs that don't support 64 bits division we need to use the
      helpers.
      
      Fixes: b60189e0 ("net: stmmac: Integrate EST with TAPRIO scheduler API")
      Signed-off-by: default avatarJose Abreu <Jose.Abreu@synopsys.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a1ec57c0
    • David S. Miller's avatar
      Merge branch 'ETS-qdisc' · 6bff0017
      David S. Miller authored
      Petr Machata says:
      
      ====================
      Add a new Qdisc, ETS
      
      The IEEE standard 802.1Qaz (and 802.1Q-2014) specifies four principal
      transmission selection algorithms: strict priority, credit-based shaper,
      ETS (bandwidth sharing), and vendor-specific. All these have their
      corresponding knobs in DCB. But DCB does not have interfaces to configure
      RED and ECN, unlike Qdiscs.
      
      In the Qdisc land, strict priority is implemented by PRIO. Credit-based
      transmission selection algorithm can then be modeled by having e.g. TBF or
      CBS Qdisc below some of the PRIO bands. ETS would then be modeled by
      placing a DRR Qdisc under the last PRIO band.
      
      The problem with this approach is that DRR on its own, as well as the
      combination of PRIO and DRR, are tricky to configure and tricky to offload
      to 802.1Qaz-compliant hardware. This is due to several reasons:
      
      - As any classful Qdisc, DRR supports adding classifiers to decide in which
        class to enqueue packets. Unlike PRIO, there's however no fallback in the
        form of priomap. A way to achieve classification based on packet priority
        is e.g. like this:
      
          # tc filter add dev swp1 root handle 1: \
      		basic match 'meta(priority eq 0)' flowid 1:10
      
        Expressing the priomap in this manner however forces drivers to deep dive
        into the classifier block to parse the individual rules.
      
        A possible solution would be to extend the classes with a "defmap" a la
        split / defmap mechanism of CBQ, and introduce this as a last resort
        classification. However, unlike priomap, this doesn't have the guarantee
        of covering all priorities. Traffic whose priority is not covered is
        dropped by DRR as unclassified. But ASICs tend to implement dropping in
        the ACL block, not in scheduling pipelines. The need to treat these
        configurations correctly (if only to decide to not offload at all)
        complicates a driver.
      
        It's not clear how to retrofit priomap with all its benefits to DRR
        without changing it beyond recognition.
      
      - The interplay between PRIO and DRR is also causing problems. 802.1Qaz has
        all ETS TCs as a last resort. Switch ASICs that support ETS at all are
        likely to handle ETS traffic this way as well. However, the Linux model
        is more generic, allowing the DRR block in any band. Drivers would need
        to be careful to handle this case correctly, otherwise the offloaded
        model might not match the slow-path one.
      
        In a similar vein, PRIO and DRR need to agree on the list of priorities
        assigned to DRR. This is doubly problematic--the user needs to take care
        to keep the two in sync, and the driver needs to watch for any holes in
        DRR coverage and treat the traffic correctly, as discussed above.
      
        Note that at the time that DRR Qdisc is added, it has no classes, and
        thus any priorities assigned to that PRIO band are not covered. Thus this
        case is surprisingly rather common, and needs to be handled gracefully by
        the driver.
      
      - Similarly due to DRR flexibility, when a Qdisc (such as RED) is attached
        below it, it is not immediately clear which TC the class represents. This
        is unlike PRIO with its straightforward classid scheme. When DRR is
        combined with PRIO, the relationship between classes and TCs gets even
        more murky.
      
        This is a problem for users as well: the TC mapping is rather important
        for (devlink) shared buffer configuration and (ethtool) counters.
      
      So instead, this patch set introduces a new Qdisc, which is based on
      802.1Qaz wording. It is PRIO-like in how it is configured, meaning one
      needs to specify how many bands there are, how many are strict and how many
      are ETS, quanta for the latter, and priomap.
      
      The new Qdisc operates like the PRIO / DRR combo would when configured as
      per the standard. The strict classes, if any, are tried for traffic first.
      When there's no traffic in any of the strict queues, the ETS ones (if any)
      are treated in the same way as in DRR.
      
      The chosen interface makes the overall system both reasonably easy to
      configure, and reasonably easy to offload. The extra code to support ETS in
      mlxsw (which already supports PRIO) is about 150 lines, of which perhaps 20
      lines is bona fide new business logic.
      
      Credit-based shaping transmission selection algorithm can be configured by
      adding a CBS Qdisc under one of the strict bands (e.g. TBF can be used to a
      similar effect as well). As a non-work-conserving Qdisc, CBS can't be
      hooked under the ETS bands. This is detected and handled identically to DRR
      Qdisc at runtime. Note that offloading CBS is not subject of this patchset.
      
      The patchset proceeds in four stages:
      
      - Patches #1-#3 are cleanups.
      - Patches #4 and #5 contain the new Qdisc.
      - Patches #6 and #7 update mlxsw to offload the new Qdisc.
      - Patches #8-#10 add selftests for ETS.
      
      Examples:
      
      - Add a Qdisc with 6 bands, 3 strict and 3 ETS with 45%-30%-25% weights:
      
          # tc qdisc add dev swp1 root handle 1: \
      	ets strict 3 quanta 4500 3000 2500 priomap 0 1 1 1 2 3 4 5
          # tc qdisc sh dev swp1
          qdisc ets 1: root refcnt 2 bands 6 strict 3 quanta 4500 3000 2500 priomap 0 1 1 1 2 3 4 5 5 5 5 5 5 5 5 5
      
      - Tweak quantum of one of the classes of the previous Qdisc:
      
          # tc class ch dev swp1 classid 1:4 ets quantum 1000
          # tc qdisc sh dev swp1
          qdisc ets 1: root refcnt 2 bands 6 strict 3 quanta 1000 3000 2500 priomap 0 1 1 1 2 3 4 5 5 5 5 5 5 5 5 5
          # tc class ch dev swp1 classid 1:3 ets quantum 1000
          Error: Strict bands do not have a configurable quantum.
      
      - Purely strict Qdisc with 1:1 mapping between priorities and TCs:
      
          # tc qdisc add dev swp1 root handle 1: \
      	ets strict 8 priomap 7 6 5 4 3 2 1 0
          # tc qdisc sh dev swp1
          qdisc ets 1: root refcnt 2 bands 8 strict 8 priomap 7 6 5 4 3 2 1 0 7 7 7 7 7 7 7 7
      
      - Use "bands" to specify number of bands explicitly. Underspecified bands
        are implicitly ETS and their quantum is taken from MTU. The following
        thus gives each band the same weight:
      
          # tc qdisc add dev swp1 root handle 1: \
      	ets bands 8 priomap 7 6 5 4 3 2 1 0
          # tc qdisc sh dev swp1
          qdisc ets 1: root refcnt 2 bands 8 quanta 1514 1514 1514 1514 1514 1514 1514 1514 priomap 7 6 5 4 3 2 1 0 7 7 7 7 7 7 7 7
      
      v2:
      - This addresses points raised by David Miller.
      - Patch #4:
          - sch_ets.c: Add a comment with description of the Qdisc and the
            dequeuing algorithm.
          - Kconfig: Add a high-level description to the help blurb.
      
      v1:
      - No changes, first upstream submission after RFC.
      
      v3 (internal):
      - This addresses review from Jiri Pirko.
      - Patch #3:
          - Rename to _HR_ instead of to _HIERARCHY_.
      - Patch #4:
          - pkt_sched.h: Keep all the TCA_ETS_ constants in one enum.
          - pkt_sched.h: Rename TCA_ETS_BANDS to _NBANDS, _STRICT to _NSTRICT,
            _BAND_QUANTUM to _QUANTA_BAND and _PMAP_BAND to _PRIOMAP_BAND.
          - sch_ets.c: Update to reflect the above changes. Add a new policy,
            ets_class_policy, which is used when parsing class changes.
            Currently that policy is the same as the quanta policy, but that
            might change.
          - sch_ets.c: Move MTU handling from ets_quantum_parse() to the one
            caller that makes use of it.
          - sch_ets.c: ets_qdisc_priomap_parse(): WARN_ON_ONCE on invalid
            attribute instead of returning an extack.
      - Patch #6:
          - __mlxsw_sp_qdisc_ets_replace(): Pass the weights argument to this
            function in this patch already. Drop the weight computation.
          - mlxsw_sp_qdisc_prio_replace(): Rename "quanta" to "zeroes" and
            pass for the abovementioned "weights".
          - mlxsw_sp_qdisc_prio_graft(): Convert to a wrapper around
            __mlxsw_sp_qdisc_ets_graft(), instead of invoking the latter
            directly from mlxsw_sp_setup_tc_prio().
          - Update to follow the _HIERARCHY_ -> _HR_ renaming.
      - Patch #7:
          - __mlxsw_sp_qdisc_ets_replace(): The "weights" argument passing and
            weight computation removal are now done in a previous patch.
          - mlxsw_sp_setup_tc_ets(): Drop case TC_ETS_REPLACE, which is handled
            earlier in the function.
      - Patch #3 (iproute2):
          - Add an example output to the commit message.
          - tc-ets.8: Fix output of two examples.
          - tc-ets.8: Describe default values of "bands", "quanta".
          - q_ets.c: A number of fixes in error messages.
          - q_ets.c: Comment formatting: /*padding*/ -> /* padding */
          - q_ets.c: parse_nbands: Move duplicate checking to callers.
          - q_ets.c: Don't accept both "quantum" and "quanta" as equivalent.
      
      v2 (internal):
      - This addresses review from Ido Schimmel and comments from Alexander
        Kushnarov.
      - Patch #2:
          - s/coment/comment in the commit message.
      - Patch #4:
          - sch_ets: ets_class_is_strict(), ets_class_id(): Constify an argument
          - ets_class_find(): RXTify
      - Patch #3 (iproute2):
          - tc-ets.8: some spelling fixes
          - tc-ets.8: add another example
          - tc.8: add an ETS to "CLASSFUL QDISCS" section
      
      v1 (internal):
      - This addresses RFC reviews from Ido Schimmel and Roman Mashak, bugs found
        by Alexander Petrovskiy and myself, and other improvements.
      - Patch #2:
          - Expand the explanation with an explicit example.
      - Patch #4:
          - Kconfig: s/sch_drr/sch_ets/
          - sch_ets: Reorder includes to be in alphabetical order
          - sch_ets: ets_quantum_parse(): Rename the return-pointer argument
            from pquantum to quantum, and use it directly, not going through a
            local temporary.
          - sch_ets: ets_qdisc_quanta_parse(): Convert syntax of function
            argument "quanta" from an array to a pointer.
          - sch_ets: ets_qdisc_priomap_parse(): Likewise with "priomap".
          - sch_ets: ets_qdisc_quanta_parse(), ets_qdisc_priomap_parse(): Invoke
            __nla_validate_nested directly instead of nl80211_validate_nested().
          - sch_ets: ets_qdisc_quanta_parse(): WARN_ON_ONCE on invalid attribute
            instead of returning an extack.
          - sch_ets: ets_qdisc_change(): Make the last band the default one for
            unmentioned priomap priorities.
          - sch_ets: Fix a panic when an offloaded child in a bandwidth-sharing
            band notified its ETS parent.
          - sch_ets: When ungrafting, add the newly-created invisible FIFO to
            the Qdisc hash
      - Patch #5:
          - pkt_cls.h: Note that quantum=0 signifies a strict band.
          - Fix error path handling when ets_offload_dump() fails.
      - Patch #6:
          - __mlxsw_sp_qdisc_ets_replace(): Convert syntax of function arguments
            "quanta" and "priomap" from arrays to pointers.
      - Patch #7:
          - __mlxsw_sp_qdisc_ets_replace(): Convert syntax of function argument
            "weights" from an array to a pointer.
      - Patch #9:
          - mlxsw/sch_ets.sh: Add a comment explaining packet prioritization.
          - Adjust the whole suite to allow testing of traffic classifiers
            in addition to testing priomap.
      - Patch #10:
          - Add a number of new tests to test default priomap band, overlarge
            number of bands, zeroes in quanta, and altogether missing quanta.
      - Patch #1 (iproute2):
          - State motivation for inclusion of this patch in the patcheset in the
            commit message.
      - Patch #3 (iproute2):
          - tc-ets.8: it is now December
          - tc-ets.8: explain inactivity WRT using non-WC Qdiscs under ETS band
          - tc-ets.8: s/flow/band in explanation of quantum
          - tc-ets.8: explain what happens with priorities not covered by priomap
          - tc-ets.8: default priomap band is now the last one
          - q_ets.c: ets_parse_opt(): Remove unnecessary initialization of
            priomap and quanta.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6bff0017
    • Petr Machata's avatar
      selftests: qdiscs: Add test coverage for ETS Qdisc · 82c664b6
      Petr Machata authored
      Add TDC coverage for the new ETS Qdisc.
      Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      82c664b6
    • Petr Machata's avatar
      selftests: forwarding: sch_ets: Add test coverage for ETS Qdisc · ddd3fd75
      Petr Machata authored
      This tests the newly-added ETS Qdisc. It runs two to three streams of
      traffic, each with a different priority. ETS Qdisc is supposed to allocate
      bandwidth according to the DRR algorithm and given weights. After running
      the traffic for a while, counters are compared for each stream to check
      that the expected ratio is in fact observed.
      
      In order for the DRR process to kick in, a traffic bottleneck must exist in
      the first place. In slow path, such bottleneck can be implemented by
      wrapping the ETS Qdisc inside a TBF or other shaper. This might however
      make the configuration unoffloadable. Instead, on HW datapath, the
      bottleneck would be set up by lowering port speed and configuring shared
      buffer suitably.
      
      Therefore the test is structured as a core component that implements the
      testing, with two wrapper scripts that implement the details of slow path
      resp. fast path configuration.
      Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ddd3fd75
    • Petr Machata's avatar
      selftests: forwarding: Move start_/stop_traffic from mlxsw to lib.sh · 4cf9b8f9
      Petr Machata authored
      These two functions are used for starting several streams of traffic, and
      then stopping them later. They will be handy for the test coverage of ETS
      Qdisc. Move them from mlxsw-specific qos_lib.sh to the generic lib.sh.
      Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4cf9b8f9
    • Petr Machata's avatar
      mlxsw: spectrum_qdisc: Support offloading of ETS Qdisc · 19f405b9
      Petr Machata authored
      Handle TC_SETUP_QDISC_ETS, add a new ops structure for the ETS Qdisc.
      Invoke the extended prio handlers implemented in the previous patch. For
      stats ops, invoke directly the prio callbacks, which are not sensitive to
      differences between PRIO and ETS.
      Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      19f405b9
    • Petr Machata's avatar
      mlxsw: spectrum_qdisc: Generalize PRIO offload to support ETS · 7917f52a
      Petr Machata authored
      Thanks to the similarity between PRIO and ETS it is possible to simply
      reuse most of the code for offloading PRIO Qdisc. Extract the common
      functionality into separate functions, making the current PRIO handlers
      thin API adapters.
      
      Extend the new functions to pass quanta for individual bands, which allows
      configuring a subset of bands as WRR. Invoke mlxsw_sp_port_ets_set() as
      appropriate to de/configure WRR-ness and weight of individual bands.
      Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7917f52a
    • Petr Machata's avatar
      net: sch_ets: Make the ETS qdisc offloadable · d35eb52b
      Petr Machata authored
      Add hooks at appropriate points to make it possible to offload the ETS
      Qdisc.
      Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d35eb52b
    • Petr Machata's avatar
      net: sch_ets: Add a new Qdisc · dcc68b4d
      Petr Machata authored
      Introduces a new Qdisc, which is based on 802.1Q-2014 wording. It is
      PRIO-like in how it is configured, meaning one needs to specify how many
      bands there are, how many are strict and how many are dwrr, quanta for the
      latter, and priomap.
      
      The new Qdisc operates like the PRIO / DRR combo would when configured as
      per the standard. The strict classes, if any, are tried for traffic first.
      When there's no traffic in any of the strict queues, the ETS ones (if any)
      are treated in the same way as in DRR.
      Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      dcc68b4d
    • Petr Machata's avatar
      mlxsw: spectrum: Rename MLXSW_REG_QEEC_HIERARCY_* enumerators · 9cf9b925
      Petr Machata authored
      These enums want to be named MLXSW_REG_QEEC_HIERARCHY_, but due to a typo
      lack the second H. That is confusing and complicates searching.
      
      But actually the enumerators should be named _HR_, because that is how
      their enum type is called. So rename them as appropriate.
      Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9cf9b925
    • Petr Machata's avatar
      mlxsw: spectrum_qdisc: Clarify a comment · 5bc146c9
      Petr Machata authored
      Expand the comment at mlxsw_sp_qdisc_prio_graft() to make the problem that
      this function is trying to handle clearer.
      Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5bc146c9
    • Petr Machata's avatar
      net: pkt_cls: Clarify a comment · 9586a992
      Petr Machata authored
      The bit about negating HW backlog left me scratching my head. Clarify the
      comment.
      Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9586a992
    • Kevin 'ldir' Darbyshire-Bryant's avatar
      sch_cake: drop unused variable tin_quantum_prio · cbd22f17
      Kevin 'ldir' Darbyshire-Bryant authored
      Turns out tin_quantum_prio isn't used anymore and is a leftover from a
      previous implementation of diffserv tins.  Since the variable isn't used
      in any calculations it can be eliminated.
      
      Drop variable and places where it was set.  Rename remaining variable
      and consolidate naming of intermediate variables that set it.
      Signed-off-by: default avatarKevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
      Acked-by: default avatarToke Høiland-Jørgensen <toke@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cbd22f17
    • David S. Miller's avatar
      Merge branch 's390-next' · dcbe4e95
      David S. Miller authored
      Julian Wiedmann says:
      
      ====================
      s390/qeth: features 2019-12-18
      
      please apply the following patch series to your net-next tree.
      Nothing major, just the usual mix of small improvements and cleanups.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      dcbe4e95
    • Julian Wiedmann's avatar
      s390/qeth: make use of napi_schedule_irqoff() · 334b49de
      Julian Wiedmann authored
      qeth_qdio_start_poll() is called from the qdio layer's IRQ handler,
      while IRQs are masked.
      Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      334b49de
    • Julian Wiedmann's avatar
      s390/qeth: consolidate helpers for capability checking · 52f82bf1
      Julian Wiedmann authored
      Convert the old code to use struct qeth_ipa_caps, and while at it remove
      all unused helper macros.
      Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      52f82bf1
    • Julian Wiedmann's avatar
      s390/qeth: stop yielding the ip_lock during IPv4 registration · adee2592
      Julian Wiedmann authored
      As commit df2a2a52 ("s390/qeth: convert IP table spinlock to mutex")
      converted the ip_lock to a mutex, we no longer have to yield it while
      the subsequent IO sleep-waits for completion.
      Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      adee2592
    • Julian Wiedmann's avatar
      s390/qeth: don't raise NETDEV_REBOOT event from L3 offline path · b6beb62a
      Julian Wiedmann authored
      This is a leftover from back when a recovery action didn't go through
      dev_close(), and was meant to shoot down all remaining af_iucv sockets
      on the interface.
      
      Now that the offline path always calls dev_close(), the
      NETDEV_GOING_DOWN event from __dev_close_many() is sufficient and this
      hack can be removed.
      Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b6beb62a
    • Julian Wiedmann's avatar
      s390/qeth: remove open-coded inet_make_mask() · 490df971
      Julian Wiedmann authored
      Use inet_make_mask() to replace some complicated bit-fiddling.
      
      Also use the right data types to replace some raw memcpy calls with
      proper assignments.
      Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      490df971
    • Julian Wiedmann's avatar
      s390/qeth: clean up L3 sysfs code · 2390166a
      Julian Wiedmann authored
      Consolidate some duplicated code for adding RXIP/VIPA addresses, and
      move the locking to where it's actually needed.
      Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2390166a
    • Julian Wiedmann's avatar
      s390/qeth: overhaul L3 IP address dump code · e6b1b7da
      Julian Wiedmann authored
      The current code that dumps the RXIP/VIPA/IPATO addresses via sysfs
      first checks whether the buffer still provides sufficient space to hold
      another formatted address.
      But the maximum length of an formatted IPv4 address is 15 characters,
      not 12. So we underestimate the max required length and if the buffer
      was previously filled to _just_ the right level, a formatted address can
      end up being truncated.
      
      Revamp these code paths to use the _actually_ required length of the
      formatted IP address, and while at it suppress a gratuitous newline.
      
      Also use scnprintf() to format the output. In case of a truncation, this
      would allow us to return the number of characters that were actually
      written.
      Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e6b1b7da
    • Julian Wiedmann's avatar
      s390/qeth: wake up all waiters from qeth_irq() · 7359393f
      Julian Wiedmann authored
      card->wait_q is shared by different users, for different wake-up
      conditions. qeth_irq() can potentially trigger multiple of these
      conditions:
      1) A change to channel->irq_pending, which qeth_send_control_data() is
         waiting for.
      2) A change to card->state, which qeth_clear_channel() and
         qeth_halt_channel() are waiting for.
      
      As qeth_irq() does only a single wake_up(), we might miss to wake up
      a second eligible waiter. Luckily all waiters are guarded with a
      timeout, so this situation should recover on its own eventually.
      
      To make things work robustly, add an additional wake_up() for changes
      to channel->state. And extract a helper that updates
      channel->irq_pending along with the needed wake_up().
      Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7359393f
    • Julian Wiedmann's avatar
      s390/qeth: only handle IRQs while device is online · 871602b1
      Julian Wiedmann authored
      A qeth device that's offline should not be receiving any IRQs - all
      pending IOs have been terminated, and we avoid starting any new ones.
      
      So rather than immediately registering the IRQ handler when the device
      is probed, only register it while the device is online.
      Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      871602b1
    • David S. Miller's avatar
      Merge branch 'stmmac-taprio' · 3a74a62d
      David S. Miller authored
      Jose Abreu says:
      
      ====================
      net: stmmac: TSN support using TAPRIO API
      
      This series adds TSN support (EST and Frame Preemption) for stmmac driver.
      
      1) Adds the HW specific support for EST in GMAC5+ cores.
      
      2) Adds the HW specific support for EST in XGMAC3+ cores.
      
      3) Integrates EST HW specific support with TAPRIO scheduler API.
      
      4) Adds the Frame Preemption suppor on stmmac TAPRIO implementation.
      
      5) Adds the HW specific support for Frame Preemption in GMAC5+ cores.
      
      6) Adds the HW specific support for Frame Preemption in XGMAC3+ cores.
      
      7) Adds support for HW debug counters for Frame Preemption available in
      GMAC5+ cores.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3a74a62d
    • Jose Abreu's avatar
      net: stmmac: mmc: Add Frame Preemption counters on GMAC5+ cores · ea77b8c8
      Jose Abreu authored
      This can be useful for debug. Add these counters on GMAC5+ cores just
      like we did for XGMAC.
      Signed-off-by: default avatarJose Abreu <Jose.Abreu@synopsys.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ea77b8c8
    • Jose Abreu's avatar
      net: stmmac: xgmac3+: Add support for Frame Preemption · f0e56c8d
      Jose Abreu authored
      Adds the HW specific support for Frame Preemption on XGMAC3+ cores.
      Signed-off-by: default avatarJose Abreu <Jose.Abreu@synopsys.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f0e56c8d
    • Jose Abreu's avatar
      net: stmmac: gmac5+: Add support for Frame Preemption · 7c728274
      Jose Abreu authored
      Adds the HW specific support for Frame Preemption on GMAC5+ cores.
      Signed-off-by: default avatarJose Abreu <Jose.Abreu@synopsys.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7c728274
    • Jose Abreu's avatar
      net: stmmac: Add Frame Preemption support using TAPRIO API · 1ac14241
      Jose Abreu authored
      Adds the support for Frame Preemption using TAPRIO API. This works along
      with EST feature and allows to select if preemptable traffic shall be
      sent during specific queues opening time.
      Signed-off-by: default avatarJose Abreu <Jose.Abreu@synopsys.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1ac14241
    • Jose Abreu's avatar
      net: stmmac: Integrate EST with TAPRIO scheduler API · b60189e0
      Jose Abreu authored
      Now that we have the EST code for XGMAC and QoS we can use it with the
      TAPRIO scheduler. Integrate it into the main driver and use the API to
      configure the EST feature.
      Signed-off-by: default avatarJose Abreu <Jose.Abreu@synopsys.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b60189e0
    • Jose Abreu's avatar
      net: stmmac: Add basic EST support for XGMAC · 8572aec3
      Jose Abreu authored
      Adds the support for EST in XGMAC cores. This feature allows to offload
      scheduling of queues opening time to the IP.
      Signed-off-by: default avatarJose Abreu <Jose.Abreu@synopsys.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8572aec3
    • Jose Abreu's avatar
      net: stmmac: Add basic EST support for GMAC5+ · 504723af
      Jose Abreu authored
      Adds the support for EST in GMAC5+ cores. This feature allows to offload
      scheduling of queues opening time to the IP.
      Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      504723af
    • David S. Miller's avatar
      Merge branch 'stmmac-next' · 6dbb2e91
      David S. Miller authored
      Jose Abreu says:
      
      ====================
      net: stmmac: Improvements for -next
      
      Misc improvements for stmmac.
      
      1) Adds more information regarding HW Caps in the DebugFS file.
      
      2) Allows interrupts to be independently enabled or disabled so that we don't
      have to schedule both TX and RX NAPIs.
      
      3) Stops using a magic number in coalesce timer re-arm.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6dbb2e91
    • Jose Abreu's avatar
      net: stmmac: Always use TX coalesce timer value when rescheduling · 3755b21b
      Jose Abreu authored
      When we have pending packets we re-arm the TX timer with a magic value.
      
      This changes the re-arm of the timer from 10us to the user-defined
      coalesce value. As we support different speeds, having a magic value of
      10us can be either too short or to large depending on the speed so we
      let user configure it. The default value of the timer is 1ms but it can
      be reconfigured by ethtool.
      
      Changes from v1:
      - Reword commit message (Jakub)
      Signed-off-by: default avatarJose Abreu <Jose.Abreu@synopsys.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3755b21b
    • Jose Abreu's avatar
      net: stmmac: Let TX and RX interrupts be independently enabled/disabled · 021bd5e3
      Jose Abreu authored
      By using this mechanism we can get rid of the not so nice method of
      scheduling TX NAPI when the RX was scheduled. No bandwidth reduction was
      seen with this change.
      
      Changes from v1:
      - Remove useless comment (Jakub)
      - Do not bind the TX clean to NAPI budget (Jakub)
      Signed-off-by: default avatarJose Abreu <Jose.Abreu@synopsys.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      021bd5e3
    • Jose Abreu's avatar
      net: stmmac: Print more information in DebugFS DMA Capabilities file · 7d0b447a
      Jose Abreu authored
      DMA Capabilites have grown but the DebugFS that shows this info has not
      been updated. Lets add the missing information.
      Signed-off-by: default avatarJose Abreu <Jose.Abreu@synopsys.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7d0b447a
    • Paul Durrant's avatar
      xen-netback: remove 'hotplug-status' once it has served its purpose · 1f256578
      Paul Durrant authored
      Removing the 'hotplug-status' node in netback_remove() is wrong; the script
      may not have completed. Only remove the node once the watch has fired and
      has been unregistered.
      Signed-off-by: default avatarPaul Durrant <pdurrant@amazon.com>
      Acked-by: default avatarWei Liu <wei.liu@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1f256578
    • Paul Durrant's avatar
      xen-netback: switch state to InitWait at the end of netback_probe()... · f55c3188
      Paul Durrant authored
      ...as the comment above the function states.
      
      The switch to Initialising at the start of the function is somewhat bogus
      as the toolstack will have set that initial state anyway. To behave
      correctly, a backend should switch to InitWait once it has set up all
      xenstore values that may be required by a initialising frontend. This
      patch calls backend_switch_state() to make the transition at the
      appropriate point.
      
      NOTE: backend_switch_state() ignores errors from xenbus_switch_state()
            and so this patch removes an error path from netback_probe(). This
            means a failure to change state at this stage (in the absence of
            other failures) will leave the device instantiated. This is highly
            unlikley to happen as a failure to change state would indicate a
            failure to write to xenstore, and that will trigger other error
            paths. Also, a 'stuck' device can still be cleaned up using 'unbind'
            in any case.
      Signed-off-by: default avatarPaul Durrant <pdurrant@amazon.com>
      Acked-by: default avatarWei Liu <wei.liu@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f55c3188