06 Aug, 2018

1 commit

  • [ Upstream commit a94c689e6c9e72e722f28339e12dff191ee5a265 ]

    If a DSA slave network device was previously disabled, there is no need
    to suspend or resume it.

    Fixes: 2446254915a7 ("net: dsa: allow switch drivers to implement suspend/resume hooks")
    Signed-off-by: Florian Fainelli
    Reviewed-by: Andrew Lunn
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Florian Fainelli
     

26 Jun, 2018

1 commit

  • [ Upstream commit 349b71d6f427ff8211adf50839dbbff3f27c1805 ]

    When pskb_trim_rcsum fails, the lack of error-handling code may
    cause unexpected results.

    This patch adds error-handling code after calling pskb_trim_rcsum.

    Signed-off-by: Zhouyang Jia
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Zhouyang Jia
     

24 Apr, 2018

1 commit

  • commit fc5f33768cca7144f8d793205b229d46740d183b upstream.

    The Marvell switches under some conditions will pass a frame to the
    host with the port being the CPU port. Such frames are invalid, and
    should be dropped. Not dropping them can result in a crash when
    incrementing the receive statistics for an invalid port.

    This has been reworked for 4.14, which does not have the central
    dsa_master_find_slave() function, so each tag driver needs to check.

    Reported-by: Chris Healy
    Fixes: 91da11f870f0 ("net: Distributed Switch Architecture protocol support")
    Signed-off-by: Andrew Lunn
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Andrew Lunn
     

11 Nov, 2017

2 commits

  • The current code does not return after successfully preparing the VLAN
    addition on every ports member of a it. Fix this.

    Fixes: 1ca4aa9cd4cc ("net: dsa: check VLAN capability of every switch")
    Signed-off-by: Vivien Didelot
    Reviewed-by: Andrew Lunn
    Signed-off-by: David S. Miller

    Vivien Didelot
     
  • The current code does not return after successfully preparing the MDB
    addition on every ports member of a multicast group. Fix this.

    Fixes: a1a6b7ea7f2d ("net: dsa: add cross-chip multicast support")
    Reported-by: Egil Hjelmeland
    Signed-off-by: Vivien Didelot
    Reviewed-by: Andrew Lunn
    Signed-off-by: David S. Miller

    Vivien Didelot
     

03 Nov, 2017

1 commit

  • …el/git/gregkh/driver-core

    Pull initial SPDX identifiers from Greg KH:
    "License cleanup: add SPDX license identifiers to some files

    Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the
    'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally
    binding shorthand, which can be used instead of the full boiler plate
    text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart
    and Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset
    of the use cases:

    - file had no licensing information it it.

    - file was a */uapi/* one with no licensing information in it,

    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to
    license had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied
    to a file was done in a spreadsheet of side by side results from of
    the output of two independent scanners (ScanCode & Windriver)
    producing SPDX tag:value files created by Philippe Ombredanne.
    Philippe prepared the base worksheet, and did an initial spot review
    of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537
    files assessed. Kate Stewart did a file by file comparison of the
    scanner results in the spreadsheet to determine which SPDX license
    identifier(s) to be applied to the file. She confirmed any
    determination that was not immediately clear with lawyers working with
    the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:

    - Files considered eligible had to be source code files.

    - Make and config files were included as candidates if they contained
    >5 lines of source

    - File already had some variant of a license header in it (even if <5
    lines).

    All documentation files were explicitly excluded.

    The following heuristics were used to determine which SPDX license
    identifiers to apply.

    - when both scanners couldn't find any license traces, file was
    considered to have no license information in it, and the top level
    COPYING file license applied.

    For non */uapi/* files that summary was:

    SPDX license identifier # files
    ---------------------------------------------------|-------
    GPL-2.0 11139

    and resulted in the first patch in this series.

    If that file was a */uapi/* path one, it was "GPL-2.0 WITH
    Linux-syscall-note" otherwise it was "GPL-2.0". Results of that
    was:

    SPDX license identifier # files
    ---------------------------------------------------|-------
    GPL-2.0 WITH Linux-syscall-note 930

    and resulted in the second patch in this series.

    - if a file had some form of licensing information in it, and was one
    of the */uapi/* ones, it was denoted with the Linux-syscall-note if
    any GPL family license was found in the file or had no licensing in
    it (per prior point). Results summary:

    SPDX license identifier # files
    ---------------------------------------------------|------
    GPL-2.0 WITH Linux-syscall-note 270
    GPL-2.0+ WITH Linux-syscall-note 169
    ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
    ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
    LGPL-2.1+ WITH Linux-syscall-note 15
    GPL-1.0+ WITH Linux-syscall-note 14
    ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
    LGPL-2.0+ WITH Linux-syscall-note 4
    LGPL-2.1 WITH Linux-syscall-note 3
    ((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
    ((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1

    and that resulted in the third patch in this series.

    - when the two scanners agreed on the detected license(s), that
    became the concluded license(s).

    - when there was disagreement between the two scanners (one detected
    a license but the other didn't, or they both detected different
    licenses) a manual inspection of the file occurred.

    - In most cases a manual inspection of the information in the file
    resulted in a clear resolution of the license that should apply
    (and which scanner probably needed to revisit its heuristics).

    - When it was not immediately clear, the license identifier was
    confirmed with lawyers working with the Linux Foundation.

    - If there was any question as to the appropriate license identifier,
    the file was flagged for further research and to be revisited later
    in time.

    In total, over 70 hours of logged manual review was done on the
    spreadsheet to determine the SPDX license identifiers to apply to the
    source files by Kate, Philippe, Thomas and, in some cases,
    confirmation by lawyers working with the Linux Foundation.

    Kate also obtained a third independent scan of the 4.13 code base from
    FOSSology, and compared selected files where the other two scanners
    disagreed against that SPDX file, to see if there was new insights.
    The Windriver scanner is based on an older version of FOSSology in
    part, so they are related.

    Thomas did random spot checks in about 500 files from the spreadsheets
    for the uapi headers and agreed with SPDX license identifier in the
    files he inspected. For the non-uapi files Thomas did random spot
    checks in about 15000 files.

    In initial set of patches against 4.14-rc6, 3 files were found to have
    copy/paste license identifier errors, and have been fixed to reflect
    the correct identifier.

    Additionally Philippe spent 10 hours this week doing a detailed manual
    inspection and review of the 12,461 patched files from the initial
    patch version early this week with:

    - a full scancode scan run, collecting the matched texts, detected
    license ids and scores

    - reviewing anything where there was a license detected (about 500+
    files) to ensure that the applied SPDX license was correct

    - reviewing anything where there was no detection but the patch
    license was not GPL-2.0 WITH Linux-syscall-note to ensure that the
    applied SPDX license was correct

    This produced a worksheet with 20 files needing minor correction. This
    worksheet was then exported into 3 different .csv files for the
    different types of files to be modified.

    These .csv files were then reviewed by Greg. Thomas wrote a script to
    parse the csv files and add the proper SPDX tag to the file, in the
    format that the file expected. This script was further refined by Greg
    based on the output to detect more types of files automatically and to
    distinguish between header and source .c files (which need different
    comment types.) Finally Greg ran the script using the .csv files to
    generate the patches.

    Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
    Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
    Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"

    * tag 'spdx_identifiers-4.14-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
    License cleanup: add SPDX license identifier to uapi header files with a license
    License cleanup: add SPDX license identifier to uapi header files with no license
    License cleanup: add SPDX GPL-2.0 license identifier to files with no license

    Linus Torvalds
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

25 Oct, 2017

1 commit

  • In the case of pdata, the dsa_cpu_parse function calls dev_put() before
    making sure it isn't NULL. Fix this.

    Fixes: 71e0bbde0d88 ("net: dsa: Add support for platform data")
    Signed-off-by: Vivien Didelot
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Vivien Didelot
     

29 Sep, 2017

1 commit

  • We cannot be registering the network device first, then setting its
    carrier off and finally connecting it to a PHY, doing that leaves a
    window during which the carrier is at best inconsistent, and at worse
    the device is not usable without a down/up sequence since the network
    device is visible to user space with possibly no PHY device attached.

    Re-order steps so that they make logical sense. This fixes some devices
    where the port was not usable after e.g: an unbind then bind of the
    driver.

    Fixes: 0071f56e46da ("dsa: Register netdev before phy")
    Fixes: 91da11f870f0 ("net: Distributed Switch Architecture protocol support")
    Signed-off-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Florian Fainelli
     

06 Sep, 2017

2 commits


02 Sep, 2017

1 commit


29 Aug, 2017

1 commit

  • If we do not have a master network device attached dst->cpu_dp will be
    NULL and accessing cpu_dp->netdev will create a trace similar to the one
    below. The correct check is on dst->cpu_dp period.

    [ 1.004650] DSA: switch 0 0 parsed
    [ 1.008078] Unable to handle kernel NULL pointer dereference at
    virtual address 00000010
    [ 1.016195] pgd = c0003000
    [ 1.018918] [00000010] *pgd=80000000004003, *pmd=00000000
    [ 1.024349] Internal error: Oops: 206 [#1] SMP ARM
    [ 1.029157] Modules linked in:
    [ 1.032228] CPU: 0 PID: 1 Comm: swapper/0 Not tainted
    4.13.0-rc6-00071-g45b45afab9bd-dirty #7
    [ 1.040772] Hardware name: Broadcom STB (Flattened Device Tree)
    [ 1.046704] task: ee08f840 task.stack: ee090000
    [ 1.051258] PC is at dsa_register_switch+0x5e0/0x9dc
    [ 1.056234] LR is at dsa_register_switch+0x5d0/0x9dc
    [ 1.061211] pc : [] lr : [] psr: 60000213
    [ 1.067491] sp : ee091d88 ip : 00000000 fp : 0000000c
    [ 1.072728] r10: 00000000 r9 : 00000001 r8 : ee208010
    [ 1.077965] r7 : ee2b57b0 r6 : ee2b5780 r5 : 00000000 r4 :
    ee208e0c
    [ 1.084506] r3 : 00000000 r2 : 00040d00 r1 : 2d1b2000 r0 :
    00000016
    [ 1.091050] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM
    Segment user
    [ 1.098199] Control: 32c5387d Table: 00003000 DAC: fffffffd
    [ 1.103957] Process swapper/0 (pid: 1, stack limit = 0xee090210)

    Reported-by: Dan Carpenter
    Fixes: 6d3c8c0dd88a ("net: dsa: Remove master_netdev and use dst->cpu_dp->netdev")
    Signed-off-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Florian Fainelli
     

24 Aug, 2017

2 commits

  • Two kfree_skb() should be consume_skb(), to be friend with drop monitor
    (perf record ... -e skb:kfree_skb)

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     
  • The first call of skb_put_padto() will free up the SKB on error, but we
    return NULL which tells dsa_slave_xmit() that the original SKB should be
    freed so this would lead to a double free here.

    The second skb_put_padto() already frees the passed sk_buff reference
    upon error, so calling kfree_skb() on it again is not necessary.

    Detected by CoverityScan, CID#1416687 ("USE_AFTER_FREE")

    Fixes: e71cb9e00922 ("net: dsa: ksz: fix skb freeing")
    Signed-off-by: Florian Fainelli
    Reviewed-by: Woojung Huh
    Signed-off-by: David S. Miller

    Florian Fainelli
     

22 Aug, 2017

1 commit


16 Aug, 2017

1 commit


12 Aug, 2017

2 commits

  • The DSA layer frees the original skb when an xmit function returns NULL,
    meaning an error occurred. But if the tagging code copied the original
    skb, it is responsible of freeing the copy if an error occurs.

    The ksz tagging code currently has two issues: if skb_put_padto fails,
    the skb copy is not freed, and the original skb will be freed twice.

    To fix that, move skb_put_padto inside both branches of the skb_tailroom
    condition, before freeing the original skb, and free the copy on error.

    Signed-off-by: Vivien Didelot
    Reviewed-by: Woojung Huh
    Signed-off-by: David S. Miller

    Vivien Didelot
     
  • Instead of checking handle, which does not have the inner class
    information and drivers wrongly assume clsact->egress as ingress, use
    the newly introduced classid identification helpers.

    Signed-off-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Jiri Pirko
     

10 Aug, 2017

2 commits

  • The MT7530 inserts the 4 magic header in between the 802.3 address and
    protocol field. The patch implements the callback that can be called by
    the flow dissector to figure out the real protocol and offset of the
    network header. With this patch applied we can properly parse the packet
    and thus make hashing function properly.

    Signed-off-by: Muciri Gatimu
    Signed-off-by: Shashidhar Lakkavalli
    Signed-off-by: John Crispin
    Reviewed-by: Andrew Lunn
    Signed-off-by: David S. Miller

    John Crispin
     
  • We need to access this struct from within the flow_dissector to fix
    dissection for packets coming in on DSA devices.

    Signed-off-by: Muciri Gatimu
    Signed-off-by: Shashidhar Lakkavalli
    Signed-off-by: John Crispin
    Signed-off-by: David S. Miller

    John Crispin
     

09 Aug, 2017

1 commit

  • Save 2628 bytes on arm eabi by allocate only the required 3 ports.

    Now that ds->num_ports is correct: In net/dsa/tag_lan9303.c
    eliminate duplicate LAN9303_MAX_PORTS, use ds->num_ports.
    (Matching the pattern of other net/dsa/tag_xxx.c files.)

    Signed-off-by: Egil Hjelmeland
    Reviewed-by: Florian Fainelli
    Reviewed-by: Vivien Didelot
    Signed-off-by: David S. Miller

    Egil Hjelmeland
     

08 Aug, 2017

17 commits


07 Aug, 2017

1 commit

  • During testing with a background iperf pushing 1Gbit/sec worth of
    traffic and having both ifconfig and ethtool collect statistics, we
    could see quite frequent deadlocks. Convert the often accessed DSA slave
    network devices statistics to per-cpu 64-bit statistics to remove these
    deadlocks and provide fast efficient statistics updates.

    Fixes: f613ed665bb3 ("net: dsa: Add support for 64-bit statistics")
    Signed-off-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Florian Fainelli