1. 28 4月, 2018 25 次提交
  2. 27 4月, 2018 15 次提交
    • D
      Merge branch 'net-Extend-availability-of-PHY-statistics' · 21fca6e0
      David S. Miller 提交于
      Florian Fainelli says:
      
      ====================
      net: Extend availability of PHY statistics
      
      This patch series adds support for retrieving PHY statistics with DSA switches
      when the CPU port uses a PHY to PHY connection (as opposed to MAC to MAC).
      To get there a number of things are done:
      
      - first we move the code dealing with PHY statistics outside of net/core/ethtool.c
        and create helper functions since the same code will be reused
      - then we allow network device drivers to provide an ethtool_get_phy_stats callback
        when the standard PHY library helpers are not suitable
      - we update the DSA functions dealing with ethtool operations to get passed a
        stringset instead of assuming ETH_SS_STATS like they currently do
      - then we provide a set of standard helpers within DSA as a framework and add
        the plumbing to allow retrieving the PHY statistics of the CPU port(s)
      - finally plug support for retrieving such PHY statistics with the b53 driver
      
      Changes in v3:
      
      - retrict the b53 change to 539x and 531x5 series of switches
      - added a change to dsa_loop.c to help test the feature
      
      Changes in v2:
      
      - got actual testing when the DSA master network device has a PHY that
        already provides statistics (thanks Nikita!)
      
      - fixed the kbuild error reported when CONFIG_PHYLIB=n
      
      - removed the checking of ops which is redundant and not needed
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      21fca6e0
    • F
      net: dsa: loop: Hook PHY statistics · 96cbddcd
      Florian Fainelli 提交于
      We just return the same statistics through ethtool_get_stats() and
      ethtool_get_phy_stats() for simplicity since this is just a mock-up driver.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      96cbddcd
    • F
      net: dsa: b53: Add support for reading PHY statistics · c7d28c9d
      Florian Fainelli 提交于
      Allow the b53 driver to return PHY statistics when the CPU port used is
      different than 5, 7 or 8, because those are typically PHY-less on most
      devices. This is useful for debugging link problems between the switch
      and an external host when using a non standard CPU port number (e.g: 4).
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c7d28c9d
    • F
      net: dsa: Allow providing PHY statistics from CPU port · cf963573
      Florian Fainelli 提交于
      Implement the same type of ethtool diversion that we have for
      ETH_SS_STATS and make it work with ETH_SS_PHY_STATS. This allows
      providing PHY level statistics for CPU ports that are directly
      connecting to a PHY device.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      cf963573
    • F
      net: dsa: Add helper function to obtain PHY device of a given port · 6207a78c
      Florian Fainelli 提交于
      In preparation for having more call sites attempting to obtain a
      reference against a PHY device corresponding to a particular port,
      introduce a helper function for that purpose.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6207a78c
    • F
      net: dsa: Pass stringset to ethtool operations · 89f09048
      Florian Fainelli 提交于
      Up until now we largely assumed that we were interested in ETH_SS_STATS
      type of strings for all ethtool operations, this is about to change with
      the introduction of additional string sets, e.g: ETH_SS_PHY_STATS.
      Update all functions to take an appropriate stringset argument and act
      on it when it is different than ETH_SS_STATS for now.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      89f09048
    • F
      net: dsa: Do not check for ethtool_ops validity · 1d1e79f1
      Florian Fainelli 提交于
      This is completely redundant with what netdev_set_default_ethtool_ops()
      does, we are always guaranteed to have a valid dev->ethtool_ops pointer,
      however, within that structure, not all function calls may be populated,
      so we still have to check them individually.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1d1e79f1
    • F
      net: Allow network devices to have PHY statistics · 99943382
      Florian Fainelli 提交于
      Add a new callback: get_ethtool_phy_stats() which allows network device
      drivers not making use of the PHY library to return PHY statistics.
      Update ethtool_get_phy_stats(), __ethtool_get_sset_count() and
      __ethtool_get_strings() accordingly to interogate the network device
      about ETH_SS_PHY_STATS.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      99943382
    • F
      net: Move PHY statistics code into PHY library helpers · c59530d0
      Florian Fainelli 提交于
      In order to make it possible for network device drivers that do not
      necessarily have a phy_device attached, but still report PHY statistics,
      have a preliminary refactoring consisting in creating helper functions
      that encapsulate the PHY device driver knowledge within PHYLIB.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c59530d0
    • G
      l2tp: consistent reference counting in procfs and debufs · 83494407
      Guillaume Nault 提交于
      The 'pppol2tp' procfs and 'l2tp/tunnels' debugfs files handle reference
      counting of sessions differently than for tunnels.
      
      For consistency, use the same mechanism for handling both sessions and
      tunnels. That is, drop the reference on the previous session just
      before looking up the next one (rather than in .show()). If necessary
      (if dump stops before *_next_session() returns NULL), drop the last
      reference in .stop().
      Signed-off-by: NGuillaume Nault <g.nault@alphalink.fr>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      83494407
    • J
      tipc: introduce ioctl for fetching node identity · 3e5cf362
      Jon Maloy 提交于
      After the introduction of a 128-bit node identity it may be difficult
      for a user to correlate between this identity and the generated node
      hash address.
      
      We now try to make this easier by introducing a new ioctl() call for
      fetching a node identity by using the hash value as key. This will
      be particularly useful when we extend some of the commands in the
      'tipc' tool, but we also expect regular user applications to need
      this feature.
      Acked-by: NYing Xue <ying.xue@windriver.com>
      Signed-off-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3e5cf362
    • D
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next · 79741a38
      David S. Miller 提交于
      Daniel Borkmann says:
      
      ====================
      pull-request: bpf-next 2018-04-27
      
      The following pull-request contains BPF updates for your *net-next* tree.
      
      The main changes are:
      
      1) Add extensive BPF helper description into include/uapi/linux/bpf.h
         and a new script bpf_helpers_doc.py which allows for generating a
         man page out of it. Thus, every helper in BPF now comes with proper
         function signature, detailed description and return code explanation,
         from Quentin.
      
      2) Migrate the BPF collect metadata tunnel tests from BPF samples over
         to the BPF selftests and further extend them with v6 vxlan, geneve
         and ipip tests, simplify the ipip tests, improve documentation and
         convert to bpf_ntoh*() / bpf_hton*() api, from William.
      
      3) Currently, helpers that expect ARG_PTR_TO_MAP_{KEY,VALUE} can only
         access stack and packet memory. Extend this to allow such helpers
         to also use map values, which enabled use cases where value from
         a first lookup can be directly used as a key for a second lookup,
         from Paul.
      
      4) Add a new helper bpf_skb_get_xfrm_state() for tc BPF programs in
         order to retrieve XFRM state information containing SPI, peer
         address and reqid values, from Eyal.
      
      5) Various optimizations in nfp driver's BPF JIT in order to turn ADD
         and SUB instructions with negative immediate into the opposite
         operation with a positive immediate such that nfp can better fit
         small immediates into instructions. Savings in instruction count
         up to 4% have been observed, from Jakub.
      
      6) Add the BPF prog's gpl_compatible flag to struct bpf_prog_info
         and add support for dumping this through bpftool, from Jiri.
      
      7) Move the BPF sockmap samples over into BPF selftests instead since
         sockmap was rather a series of tests than sample anyway and this way
         this can be run from automated bots, from John.
      
      8) Follow-up fix for bpf_adjust_tail() helper in order to make it work
         with generic XDP, from Nikita.
      
      9) Some follow-up cleanups to BTF, namely, removing unused defines from
         BTF uapi header and renaming 'name' struct btf_* members into name_off
         to make it more clear they are offsets into string section, from Martin.
      
      10) Remove test_sock_addr from TEST_GEN_PROGS in BPF selftests since
          not run directly but invoked from test_sock_addr.sh, from Yonghong.
      
      11) Remove redundant ret assignment in sample BPF loader, from Wang.
      
      12) Add couple of missing files to BPF selftest's gitignore, from Anders.
      
      There are two trivial merge conflicts while pulling:
      
        1) Remove samples/sockmap/Makefile since all sockmap tests have been
           moved to selftests.
        2) Add both hunks from tools/testing/selftests/bpf/.gitignore to the
           file since git should ignore all of them.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      79741a38
    • W
      samples, bpf: remove redundant ret assignment in bpf_load_program() · c0885f61
      Wang Sheng-Hui 提交于
      2 redundant ret assignments removed:
      
      * 'ret = 1' before the logic 'if (data_maps)', and if any errors jump to
        label 'done'. No 'ret = 1' needed before the error jump.
      
      * After the '/* load programs */' part, if everything goes well, then
        the BPF code will be loaded and 'ret' set to 0 by load_and_attach().
        If something goes wrong, 'ret' set to none-O, the redundant 'ret = 0'
        after the for clause will make the error skipped.
      
        For example, if some BPF code cannot provide supported program types
        in ELF SEC("unknown"), the for clause will not call load_and_attach()
        to load the BPF code. 1 should be returned to callees instead of 0.
      Signed-off-by: NWang Sheng-Hui <shhuiw@foxmail.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      c0885f61
    • D
      Merge branch 'bpf-uapi-helper-doc' · a6712d45
      Daniel Borkmann 提交于
      Quentin Monnet says:
      
      ====================
      eBPF helper functions can be called from within eBPF programs to perform
      a variety of tasks that would be otherwise hard or impossible to do with
      eBPF itself. There is a growing number of such helper functions in the
      kernel, but documentation is scarce. The main user space header file
      does contain a short commented description of most helpers, but it is
      somewhat outdated and not complete. It is more a "cheat sheet" than a
      real documentation accessible to new eBPF developers.
      
      This commit attempts to improve the situation by replacing the existing
      overview for the helpers with a more developed description. Furthermore,
      a Python script is added to generate a manual page for eBPF helpers. The
      workflow is the following, and requires the rst2man utility:
      
          $ ./scripts/bpf_helpers_doc.py \
                  --filename include/uapi/linux/bpf.h > /tmp/bpf-helpers.rst
          $ rst2man /tmp/bpf-helpers.rst > /tmp/bpf-helpers.7
          $ man /tmp/bpf-helpers.7
      
      The objective is to keep all documentation related to the helpers in a
      single place, and to be able to generate from here a manual page that
      could be packaged in the man-pages repository and shipped with most
      distributions.
      
      Additionally, parsing the prototypes of the helper functions could
      hopefully be reused, with a different Printer object, to generate
      header files needed in some eBPF-related projects.
      
      Regarding the description of each helper, it comprises several items:
      
      - The function prototype.
      - A description of the function and of its arguments (except for a
        couple of cases, when there are no arguments and the return value
        makes the function usage really obvious).
      - A description of return values (if not void).
      
      Additional items such as the list of compatible eBPF program and map
      types for each helper, Linux kernel version that introduced the helper,
      GPL-only restriction, and commit hash could be added in the future, but
      it was decided on the mailing list to leave them aside for now.
      
      For several helpers, descriptions are inspired (at times, nearly copied)
      from the commit logs introducing them in the kernel--Many thanks to
      their respective authors! Some sentences were also adapted from comments
      from the reviews, thanks to the reviewers as well. Descriptions were
      completed as much as possible, the objective being to have something easily
      accessible even for people just starting with eBPF. There is probably a bit
      more work to do in this direction for some helpers.
      
      Some RST formatting is used in the descriptions (not in function
      prototypes, to keep them readable, but the Python script provided in
      order to generate the RST for the manual page does add formatting to
      prototypes, to produce something pretty) to get "bold" and "italics" in
      manual pages. Hopefully, the descriptions in bpf.h file remains
      perfectly readable. Note that the few trailing white spaces are
      intentional, removing them would break paragraphs for rst2man.
      
      The descriptions should ideally be updated each time someone adds a new
      helper, or updates the behaviour (new socket option supported, ...) or
      the interface (new flags available, ...) of existing ones.
      
      To ease the review process, the documentation has been split into several
      patches.
      
      v3 -> v4:
      - Add a patch (#9) for newly added BPF helpers.
      - Add a patch (#10) to update UAPI bpf.h version under tools/.
      - Use SPDX tag in Python script.
      - Several fixes on man page header and footer, and helpers documentation.
        Please refer to individual patches for details.
      
      RFC v2 -> PATCH v3:
      Several fixes on man page header and footer, and helpers documentation.
      Please refer to individual patches for details.
      
      RFC v1 -> RFC v2:
      - Remove "For" (compatible program and map types), "Since" (minimal
        Linux kernel version required), "GPL only" sections and commit hashes
        for the helpers.
      - Add comment on top of the description list to explain how this
        documentation is supposed to be processed.
      - Update Python script accordingly (remove the same sections, and remove
        paragraphs on program types and GPL restrictions from man page
        header).
      - Split series into several patches.
      ====================
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Cc: linux-doc@vger.kernel.org
      Cc: linux-man@vger.kernel.org
      a6712d45
    • Q
      bpf: update bpf.h uapi header for tools · 9cde0c88
      Quentin Monnet 提交于
      Update tools/include/uapi/linux/bpf.h file in order to reflect the
      changes for BPF helper functions documentation introduced in previous
      commits.
      Signed-off-by: NQuentin Monnet <quentin.monnet@netronome.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      9cde0c88