1. 07 May, 2019 22 commits
  2. 06 May, 2019 18 commits
    • Björn Töpel's avatar
      libbpf: remove unnecessary cast-to-void · d24ed99b
      Björn Töpel authored
      The patches with fixes tags added a cast-to-void in the places when
      the return value of a function was ignored.
      
      This is not common practice in the kernel, and is therefore removed in
      this patch.
      Reported-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Fixes: 5750902a ("libbpf: proper XSKMAP cleanup")
      Fixes: 0e6741f0 ("libbpf: fix invalid munmap call")
      Signed-off-by: default avatarBjörn Töpel <bjorn.topel@intel.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      d24ed99b
    • Andrii Nakryiko's avatar
      kbuild: tolerate missing pahole when generating BTF · 581b31c3
      Andrii Nakryiko authored
      When BTF generation is enabled through CONFIG_DEBUG_INFO_BTF,
      scripts/link-vmlinux.sh detects if pahole version is too old and
      gracefully continues build process, skipping BTF generation build step.
      But if pahole is not available, build will still fail. This patch adds
      check for whether pahole exists at all and bails out gracefully, if not.
      
      Cc: Alexei Starovoitov <ast@fb.com>
      Reported-by: default avatarYonghong Song <yhs@fb.com>
      Fixes: e83b9f55 ("kbuild: add ability to generate BTF type info for vmlinux")
      Signed-off-by: default avatarAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      581b31c3
    • David S. Miller's avatar
      Merge branch 'r8169-replace-some-magic-with-more-speaking-functions' · 54516da1
      David S. Miller authored
      Heiner Kallweit says:
      
      ====================
      r8169: replace some magic with more speaking functions
      
      Based on info from Realtek replace some magic with speaking functions
      even though the exact meaning of certain values isn't known.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      54516da1
    • Heiner Kallweit's avatar
      r8169: add rtl8168g_set_pause_thresholds · 0ebacd12
      Heiner Kallweit authored
      Based on info from Realtek add a function for defining the thresholds
      controlling ethernet flow control.
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0ebacd12
    • Heiner Kallweit's avatar
      r8169: add rtl_set_fifo_size · 6b1bd242
      Heiner Kallweit authored
      Based on info from Realtek replace FIFO size config magic with
      a function.
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6b1bd242
    • David S. Miller's avatar
      Merge branch 'mlxsw-spectrum-Implement-loopback-ethtool-feature' · 3a972364
      David S. Miller authored
      Ido Schimmel says:
      
      ====================
      mlxsw: spectrum: Implement loopback ethtool feature
      
      This patchset from Jiri allows users to enable loopback feature for
      individual ports using ethtool. The loopback feature is useful for
      testing purposes and will also be used by upcoming patchsets to enable
      the monitoring of buffer drops.
      
      Patch #1 adds the relevant device register.
      
      Patch #2 Implements support in the driver.
      
      Patch #3 adds a selftest.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3a972364
    • Jiri Pirko's avatar
      selftests: Add loopback test · ad113409
      Jiri Pirko authored
      Add selftest for loopback feature
      Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ad113409
    • Jiri Pirko's avatar
      mlxsw: spectrum: Implement loopback ethtool feature · 8e44c0ce
      Jiri Pirko authored
      Allow user to enable loopback feature for individual ports using ethtool.
      Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8e44c0ce
    • Jiri Pirko's avatar
      mlxsw: reg: Add Port Physical Loopback Register · a0c25387
      Jiri Pirko authored
      The PPLR register allows configuration of the port's loopback mode.
      Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a0c25387
    • Cong Wang's avatar
      sch_htb: redefine htb qdisc overlimits · b362487a
      Cong Wang authored
      In commit 3c75f6ee ("net_sched: sch_htb: add per class overlimits counter")
      we added an overlimits counter for each HTB class which could
      properly reflect how many times we use up all the bandwidth
      on each class. However, the overlimits counter in HTB qdisc
      does not, it is way bigger than the sum of each HTB class.
      In fact, this qdisc overlimits counter increases when we have
      no skb to dequeue, which happens more often than we run out of
      bandwidth.
      
      It makes more sense to make this qdisc overlimits counter just
      be a sum of each HTB class, in case people still get confused.
      
      I have verified this patch with one single HTB class, where HTB
      qdisc counters now always match HTB class counters as expected.
      
      Eric suggested we could fold this field into 'direct_pkts' as
      we only use its 32bit on 64bit CPU, this saves one cache line.
      
      Cc: Eric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b362487a
    • Heiner Kallweit's avatar
      r8169: move EEE LED config to rtl8168_config_eee_mac · f452825d
      Heiner Kallweit authored
      Move adjusting the EEE LED frequency to rtl8168_config_eee_mac.
      Exclude RTL8411 (version 38) like in the existing code.
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f452825d
    • Heiner Kallweit's avatar
      r8169: simplify rtl_writephy_batch and rtl_ephy_init · 1791ad50
      Heiner Kallweit authored
      Make both functions macros to allow omitting the ARRAY_SIZE(x) argument.
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1791ad50
    • David S. Miller's avatar
      Merge branch 'Traffic-support-for-SJA1105-DSA-driver' · 0e5ef5a2
      David S. Miller authored
      Vladimir Oltean says:
      
      ====================
      Traffic support for SJA1105 DSA driver
      
      This patch set is a continuation of the "NXP SJA1105 DSA driver" v3
      series, which was split in multiple pieces for easier review.
      
      Supporting a fully-featured (traffic-capable) driver for this switch
      requires some rework in DSA and also leaves behind a more generic
      infrastructure for other dumb switches that rely on 802.1Q pseudo-switch
      tagging for port separation. Among the DSA changes required are:
      
      * Generic xmit and rcv functions for pushing/popping 802.1Q tags on
        skb's. These are modeled as a tagging protocol of its own but which
        must be customized by drivers to fit their own hardware possibilities.
      
      * Permitting the .setup callback to invoke switchdev operations that
        will loop back into the driver through the switchdev notifier chain.
      
      The SJA1105 driver then proceeds to extend this 8021q switch tagging
      protocol while adding its own (tag_sja1105). This is done because
      the driver actually implements a "dual tagger":
      
      * For normal traffic it uses 802.1Q tags
      
      * For management (multicast DMAC) frames the switch has native support
        for recognizing and annotating these with source port and switch id
        information.
      
      Because this is a "dual tagger", decoding of management frames should
      still function when regular traffic can't (under a bridge with VLAN
      filtering).
      There was intervention in the DSA receive hotpath, where a new
      filtering function called from eth_type_trans() is needed. This is
      useful in the general sense for switches that might actually have some
      limited means of source port decoding, such as only for management
      traffic, but not for everything.
      In order for the 802.1Q tagging protocol (which cannot be enabled under
      all conditions, unlike the management traffic decoding) to not be an
      all-or-nothing choice, the filtering function matches everything that
      can be decoded, and everything else is left to pass to the master
      netdevice.
      
      Lastly, DSA core support was added for drivers to request skb deferral.
      SJA1105 needs this for SPI intervention during transmission of link-local
      traffic. This is not done from within the tagger.
      
      Some patches were carried over unchanged from the previous patchset
      (01/09). Others were slightly reworked while adapting to the recent
      changes in "Make DSA tag drivers kernel modules" (02/09).
      
      The introduction of some structures (DSA_SKB_CB, dp->priv) may seem a
      little premature at this point and the new structures under-utilized.
      The reason is that traffic support has been rewritten with PTP
      timestamping in mind, and then I removed the timestamping code from the
      current submission (1. it is a different topic, 2. it does not work very
      well yet). On demand I can provide the timestamping patchset as a RFC
      though.
      
      "NXP SJA1105 DSA driver" v3 patchset can be found at:
      https://lkml.org/lkml/2019/4/12/978
      
      v1 patchset can be found at:
      https://lkml.org/lkml/2019/5/3/877
      
      Changes in v2:
      
      * Made the deferred xmit workqueue also be drained on the netdev suspend
        callback, not just on ndo_stop.
      
      * Added clarification about how other netdevices may be bridged with the
        switch ports.
      
      v2 patchset can be found at:
      https://www.spinics.net/lists/netdev/msg568818.html
      
      Changes in v3:
      
      * Exported the dsa_port_vid_add and dsa_port_vid_del symbols to fix an
        error reported by the kbuild test robot
      
      * Fixed the following checkpatch warnings in 05/10:
        Macro argument reuse 'skb' - possible side-effects?
        Macro argument reuse 'clone' - possible side-effects?
      
      * Added a commit description to the documentation patch (10/10)
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0e5ef5a2
    • Vladimir Oltean's avatar
      Documentation: net: dsa: sja1105: Add info about supported traffic modes · 0a58d471
      Vladimir Oltean authored
      This adds a table which illustrates what combinations of management /
      regular traffic work depending on the state the switch ports are in.
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0a58d471
    • Vladimir Oltean's avatar
      net: dsa: sja1105: Add support for Spanning Tree Protocol · 640f763f
      Vladimir Oltean authored
      While not explicitly documented as supported in UM10944, compliance with
      the STP states can be obtained by manipulating 3 settings at the
      (per-port) MAC config level: dynamic learning, inhibiting reception of
      regular traffic, and inhibiting transmission of regular traffic.
      
      In all these modes, transmission and reception of special BPDU frames
      from the stack is still enabled (not inhibited by the MAC-level
      settings).
      
      On ingress, BPDUs are classified by the MAC filter as link-local
      (01-80-C2-00-00-00) and forwarded to the CPU port.  This mechanism works
      under all conditions (even without the custom 802.1Q tagging) because
      the switch hardware inserts the source port and switch ID into bytes 4
      and 5 of the MAC-filtered frames. Then the DSA .rcv handler needs to put
      back zeroes into the MAC address after decoding the source port
      information.
      
      On egress, BPDUs are transmitted using management routes from the xmit
      worker thread. Again this does not require switch tagging, as the switch
      port is programmed through SPI to hold a temporary (single-fire) route
      for a frame with the programmed destination MAC (01-80-C2-00-00-00).
      
      STP is activated using the following commands and was tested by
      connecting two front-panel ports together and noticing that switching
      loops were prevented (one port remains in the blocking state):
      
      $ ip link add name br0 type bridge stp_state 1 && ip link set br0 up
      $ for eth in $(ls /sys/devices/platform/soc/2100000.spi/spi_master/spi0/spi0.1/net/);
        do ip link set ${eth} master br0 && ip link set ${eth} up; done
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      640f763f
    • Vladimir Oltean's avatar
      net: dsa: sja1105: Add support for traffic through standalone ports · 227d07a0
      Vladimir Oltean authored
      In order to support this, we are creating a make-shift switch tag out of
      a VLAN trunk configured on the CPU port. Termination of normal traffic
      on switch ports only works when not under a vlan_filtering bridge.
      Termination of management (PTP, BPDU) traffic works under all
      circumstances because it uses a different tagging mechanism
      (incl_srcpt). We are making use of the generic CONFIG_NET_DSA_TAG_8021Q
      code and leveraging it from our own CONFIG_NET_DSA_TAG_SJA1105.
      
      There are two types of traffic: regular and link-local.
      
      The link-local traffic received on the CPU port is trapped from the
      switch's regular forwarding decisions because it matched one of the two
      DMAC filters for management traffic.
      
      On transmission, the switch requires special massaging for these
      link-local frames. Due to a weird implementation of the switching IP, by
      default it drops link-local frames that originate on the CPU port.
      It needs to be told where to forward them to, through an SPI command
      ("management route") that is valid for only a single frame.
      So when we're sending link-local traffic, we are using the
      dsa_defer_xmit mechanism.
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      227d07a0
    • Vladimir Oltean's avatar
      net: dsa: Add a private structure pointer to dsa_port · c362beb0
      Vladimir Oltean authored
      This is supposed to share information between the driver and the tagger,
      or used by the tagger to keep some state. Its use is optional.
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: default avatarVivien Didelot <vivien.didelot@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c362beb0
    • Vladimir Oltean's avatar
      net: dsa: Add support for deferred xmit · 97a69a0d
      Vladimir Oltean authored
      Some hardware needs to take work to get convinced to receive frames on
      the CPU port (such as the sja1105 which takes temporary L2 forwarding
      rules over SPI that last for a single frame). Such work needs a
      sleepable context, and because the regular .ndo_start_xmit is atomic,
      this cannot be done in the tagger. So introduce a generic DSA mechanism
      that sets up a transmit skb queue and a workqueue for deferred
      transmission.
      
      The new driver callback (.port_deferred_xmit) is in dsa_switch and not
      in the tagger because the operations that require sleeping typically
      also involve interacting with the hardware, and not simply skb
      manipulations. Therefore having it there simplifies the structure a bit
      and makes it unnecessary to export functions from the driver to the
      tagger.
      
      The driver is responsible of calling dsa_enqueue_skb which transfers it
      to the master netdevice. This is so that it has a chance of performing
      some more work afterwards, such as cleanup or TX timestamping.
      
      To tell DSA that skb xmit deferral is required, I have thought about
      changing the return type of the tagger .xmit from struct sk_buff * into
      a enum dsa_tx_t that could potentially encode a DSA_XMIT_DEFER value.
      
      But the trailer tagger is reallocating every skb on xmit and therefore
      making a valid use of the pointer return value. So instead of reworking
      the API in complicated ways, right now a boolean property in the newly
      introduced DSA_SKB_CB is set.
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      97a69a0d