1. 12 Aug, 2021 9 commits
    • Vladimir Oltean's avatar
      net: dsa: tag_8021q: don't broadcast during setup/teardown · 724395f4
      Vladimir Oltean authored
      Currently, on my board with multiple sja1105 switches in disjoint trees
      described in commit f66a6a69 ("net: dsa: permit cross-chip bridging
      between all trees in the system"), rebooting the board triggers the
      following benign warnings:
      
      [   12.345566] sja1105 spi2.0: port 0 failed to notify tag_8021q VLAN 1088 deletion: -ENOENT
      [   12.353804] sja1105 spi2.0: port 0 failed to notify tag_8021q VLAN 2112 deletion: -ENOENT
      [   12.362019] sja1105 spi2.0: port 1 failed to notify tag_8021q VLAN 1089 deletion: -ENOENT
      [   12.370246] sja1105 spi2.0: port 1 failed to notify tag_8021q VLAN 2113 deletion: -ENOENT
      [   12.378466] sja1105 spi2.0: port 2 failed to notify tag_8021q VLAN 1090 deletion: -ENOENT
      [   12.386683] sja1105 spi2.0: port 2 failed to notify tag_8021q VLAN 2114 deletion: -ENOENT
      
      Basically switch 1 calls dsa_tag_8021q_unregister, and switch 1's TX and
      RX VLANs cannot be found on switch 2's CPU port.
      
      But why would switch 2 even attempt to delete switch 1's TX and RX
      tag_8021q VLANs from its CPU port? Well, because we use dsa_broadcast,
      and it is supposed that it had added those VLANs in the first place
      (because in dsa_port_tag_8021q_vlan_match, all CPU ports match
      regardless of their tree index or switch index).
      
      The two trees probe asynchronously, and when switch 1 probed, it called
      dsa_broadcast which did not notify the tree of switch 2, because that
      didn't probe yet. But during unbind, switch 2's tree _is_ probed, so it
      _is_ notified of the deletion.
      
      Before jumping to introduce a synchronization mechanism between the
      probing across disjoint switch trees, let's take a step back and see
      whether we _need_ to do that in the first place.
      
      The RX and TX VLANs of switch 1 would be needed on switch 2's CPU port
      only if switch 1 and 2 were part of a cross-chip bridge. And
      dsa_tag_8021q_bridge_join takes care precisely of that (but if probing
      was synchronous, the bridge_join would just end up bumping the VLANs'
      refcount, because they are already installed by the setup path).
      
      Since by the time the ports are bridged, all DSA trees are already set
      up, and we don't need the tag_8021q VLANs of one switch installed on the
      other switches during probe time, the answer is that we don't need to
      fix the synchronization issue.
      
      So make the setup and teardown code paths call dsa_port_notify, which
      notifies only the local tree, and the bridge code paths call
      dsa_broadcast, which let the other trees know as well.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      724395f4
    • Vladimir Oltean's avatar
      net: dsa: print more information when a cross-chip notifier fails · ab97462b
      Vladimir Oltean authored
      Currently this error message does not say a lot:
      
      [   32.693498] DSA: failed to notify tag_8021q VLAN deletion: -ENOENT
      [   32.699725] DSA: failed to notify tag_8021q VLAN deletion: -ENOENT
      [   32.705931] DSA: failed to notify tag_8021q VLAN deletion: -ENOENT
      [   32.712139] DSA: failed to notify tag_8021q VLAN deletion: -ENOENT
      [   32.718347] DSA: failed to notify tag_8021q VLAN deletion: -ENOENT
      [   32.724554] DSA: failed to notify tag_8021q VLAN deletion: -ENOENT
      
      but in this form, it is immediately obvious (at least to me) what the
      problem is, even without further looking at the code:
      
      [   12.345566] sja1105 spi2.0: port 0 failed to notify tag_8021q VLAN 1088 deletion: -ENOENT
      [   12.353804] sja1105 spi2.0: port 0 failed to notify tag_8021q VLAN 2112 deletion: -ENOENT
      [   12.362019] sja1105 spi2.0: port 1 failed to notify tag_8021q VLAN 1089 deletion: -ENOENT
      [   12.370246] sja1105 spi2.0: port 1 failed to notify tag_8021q VLAN 2113 deletion: -ENOENT
      [   12.378466] sja1105 spi2.0: port 2 failed to notify tag_8021q VLAN 1090 deletion: -ENOENT
      [   12.386683] sja1105 spi2.0: port 2 failed to notify tag_8021q VLAN 2114 deletion: -ENOENT
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ab97462b
    • Andy Shevchenko's avatar
      wwan: core: Unshadow error code returned by ida_alloc_range() · 0de6fd5f
      Andy Shevchenko authored
      ida_alloc_range() may return other than -ENOMEM error code.
      Unshadow it in the wwan_create_port().
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Reviewed-by: default avatarSergey Ryazanov <ryazanov.s.a@gmail.com>
      Reviewed-by: default avatarLoic Poulain <loic.poulain@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0de6fd5f
    • DENG Qingfang's avatar
      net: dsa: mt7530: fix VLAN traffic leaks again · 7428022b
      DENG Qingfang authored
      When a port leaves a VLAN-aware bridge, the current code does not clear
      other ports' matrix field bit. If the bridge is later set to VLAN-unaware
      mode, traffic in the bridge may leak to that port.
      
      Remove the VLAN filtering check in mt7530_port_bridge_leave.
      
      Fixes: 474a2dda ("net: dsa: mt7530: fix VLAN traffic leaks")
      Fixes: 83163f7d ("net: dsa: mediatek: add VLAN support for MT7530")
      Signed-off-by: default avatarDENG Qingfang <dqfext@gmail.com>
      Reviewed-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7428022b
    • Oleksij Rempel's avatar
      net: phy: nxp-tja11xx: log critical health state · e0ba6050
      Oleksij Rempel authored
      TJA1102 provides interrupt notification for the critical health states
      like overtemperature and undervoltage.
      
      The overtemperature bit is set if package temperature is beyond 155C°.
      This functionality was tested by heating the package up to 200C°
      
      The undervoltage bit is set if supply voltage drops beyond some critical
      threshold. Currently not tested.
      
      In a typical use case, both of this events should be logged and stored
      (or send to some remote system) for further investigations.
      Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e0ba6050
    • David S. Miller's avatar
      Merge branch 'pktgen-imix' · 445af0d2
      David S. Miller authored
      Nick Richardson says:
      
      ====================
      pktgen: Add IMIX mode
      
      Adds internet mix (IMIX) mode to pktgen. Internet mix is
      included in many user-space network perf testing tools. It allows
      for the user to specify a distribution of discrete packet sizes to be
      generated. This type of test is common among vendors when perf testing
      their devices.
      [RFC link: https://datatracker.ietf.org/doc/html/rfc2544#section-9.1]
      
      This allows users to get a
      more complete picture of how their device will perform in the
      real-world.
      
      This feature adds a command that allows users to specify an imix
      distribution in the following format:
        imix_weights size_1,weight_1 size_2,weight_2 ... size_n,weight_n
      
      The distribution of packets with size_i will be
      (weight_i / total_weights) where
      total_weights = weight_1 + weight_2 + ... + weight_n
      
      For example:
        imix_weights 40,7 576,4 1500,1
      
      The pkt_size "40" will account for 7 / (7 + 4 + 1) = ~58% of the total
      packets sent.
      
      This patch was tested with the following:
      1. imix_weights = 40,7 576,4 1500,1
      2. imix_weights = 0,7 576,4 1500,1
        - Packet size of 0 is resized to the minimum, 42
      3. imix_weights = 40,7 576,4 1500,1 count = 0
        - Zero count.
        - Runs until user stops pktgen.
      Invalid Configurations
      1. clone_skb = 200 imix_weights = 40,7 576,4 1500,1
          - Returns error code -524 (-ENOTSUPP) when setting imix_weights
      2. len(imix_weights) > MAX_IMIX_ENTRIES
          - Returns -7 (-E2BIG)
      
      This patch is split into three parts, each provide different aspects of
      required functionality:
        1. Parse internet mix input.
        2. Add IMIX Distribution representation.
        3. Process and output IMIX results.
      
      Changes in v2:
      * Remove __ prefix outside of uAPI.
      * Use seq_puts instead of seq_printf where necessary.
      * Reorder variable declaration.
      * Return -EINVAL instead of -ENOTSUPP when using IMIX with clone_skb > 0
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      445af0d2
    • Nick Richardson's avatar
      pktgen: Add output for imix results · 769afb3f
      Nick Richardson authored
      The bps for imix mode is calculated by:
      sum(imix_entry.size) / time_elapsed
      
      The actual counts of each imix_entry are displayed under the
      "Current:" section of the interface output in the following format:
      imix_size_counts: size_1,count_1 size_2,count_2 ... size_n,count_n
      
      Example (count = 200000):
      imix_weights: 256,1 859,3 205,2
      imix_size_counts: 256,32082 859,99796 205,68122
      Result: OK: 17992362(c17964678+d27684) usec, 200000 (859byte,0frags)
        11115pps 47Mb/sec (47977140bps) errors: 0
      
      Summary of changes:
      Calculate bps based on imix counters when in IMIX mode.
      Add output for IMIX counters.
      Signed-off-by: default avatarNick Richardson <richardsonnick@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      769afb3f
    • Nick Richardson's avatar
      pktgen: Add imix distribution bins · 90149031
      Nick Richardson authored
      In order to represent the distribution of imix packet sizes, a
      pre-computed data structure is used. It features 100 (IMIX_PRECISION)
      "bins". Contiguous ranges of these bins represent the respective
      packet size of each imix entry. This is done to avoid the overhead of
      selecting the correct imix packet size based on the corresponding weights.
      
      Example:
      imix_weights 40,7 576,4 1500,1
      total_weight = 7 + 4 + 1 = 12
      
      pkt_size 40 occurs 7/total_weight = 58% of the time
      pkt_size 576 occurs 4/total_weight = 33% of the time
      pkt_size 1500 occurs 1/total_weight = 9% of the time
      
      We generate a random number between 0-100 and select the corresponding
      packet size based on the specified weights.
      Eg. random number = 358723895 % 100 = 65
      Selects the packet size corresponding to index:65 in the pre-computed
      imix_distribution array.
      An example of the  pre-computed array is below:
      
      The imix_distribution will look like the following:
      0        ->  0 (index of imix_entry.size == 40)
      1        ->  0 (index of imix_entry.size == 40)
      2        ->  0 (index of imix_entry.size == 40)
      [...]    ->  0 (index of imix_entry.size == 40)
      57       ->  0 (index of imix_entry.size == 40)
      58       ->  1 (index of imix_entry.size == 576)
      [...]    ->  1 (index of imix_entry.size == 576)
      90       ->  1 (index of imix_entry.size == 576)
      91       ->  2 (index of imix_entry.size == 1500)
      [...]    ->  2 (index of imix_entry.size == 1500)
      99       ->  2 (index of imix_entry.size == 1500)
      
      Create and use "bin" representation of the imix distribution.
      Signed-off-by: default avatarNick Richardson <richardsonnick@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      90149031
    • Nick Richardson's avatar
      pktgen: Parse internet mix (imix) input · 52a62f86
      Nick Richardson authored
      Adds "imix_weights" command for specifying internet mix distribution.
      
      The command is in this format:
      "imix_weights size_1,weight_1 size_2,weight_2 ... size_n,weight_n"
      where the probability that packet size_i is picked is:
      weight_i / (weight_1 + weight_2 + .. + weight_n)
      
      The user may provide up to 100 imix entries (size_i,weight_i) in this
      command.
      
      The user specified imix entries will be displayed in the "Params"
      section of the interface output.
      
      Values for clone_skb > 0 is not supported in IMIX mode.
      
      Summary of changes:
      Add flag for enabling internet mix mode.
      Add command (imix_weights) for internet mix input.
      Return -ENOTSUPP when clone_skb > 0 in IMIX mode.
      Display imix_weights in Params.
      Create data structures to store imix entries and distribution.
      Signed-off-by: default avatarNick Richardson <richardsonnick@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      52a62f86
  2. 11 Aug, 2021 31 commits