11 Sep, 2020

1 commit

  • The parameter passed via DCB_ATTR_DCB_BUFFER is a struct dcbnl_buffer. The
    field prio2buffer is an array of IEEE_8021Q_MAX_PRIORITIES bytes, where
    each value is a number of a buffer to direct that priority's traffic to.
    That value is however never validated to lie within the bounds set by
    DCBX_MAX_BUFFERS. The only driver that currently implements the callback is
    mlx5 (maintainers CCd), and that does not do any validation either, in
    particual allowing incorrect configuration if the prio2buffer value does
    not fit into 4 bits.

    Instead of offloading the need to validate the buffer index to drivers, do
    it right there in core, and bounce the request if the value is too large.

    CC: Parav Pandit
    CC: Saeed Mahameed
    Fixes: e549f6f9c098 ("net/dcb: Add dcbnl buffer attribute")
    Signed-off-by: Petr Machata
    Reviewed-by: Ido Schimmel
    Reviewed-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Petr Machata
     

24 Jun, 2020

1 commit


14 Jun, 2020

1 commit

  • Since commit 84af7a6194e4 ("checkpatch: kconfig: prefer 'help' over
    '---help---'"), the number of '---help---' has been gradually
    decreasing, but there are still more than 2400 instances.

    This commit finishes the conversion. While I touched the lines,
    I also fixed the indentation.

    There are a variety of indentation styles found.

    a) 4 spaces + '---help---'
    b) 7 spaces + '---help---'
    c) 8 spaces + '---help---'
    d) 1 space + 1 tab + '---help---'
    e) 1 tab + '---help---' (correct indentation)
    f) 1 tab + 1 space + '---help---'
    g) 1 tab + 2 spaces + '---help---'

    In order to convert all of them to 1 tab + 'help', I ran the
    following commend:

    $ find . -name 'Kconfig*' | xargs sed -i 's/^[[:space:]]*---help---/\thelp/'

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

31 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms and conditions of the gnu general public license
    version 2 as published by the free software foundation this program
    is distributed in the hope it will be useful but without any
    warranty without even the implied warranty of merchantability or
    fitness for a particular purpose see the gnu general public license
    for more details you should have received a copy of the gnu general
    public license along with this program if not see http www gnu org
    licenses

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 228 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Steve Winslow
    Reviewed-by: Richard Fontana
    Reviewed-by: Alexios Zavras
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190528171438.107155473@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

21 May, 2019

1 commit


28 Apr, 2019

2 commits

  • We currently have two levels of strict validation:

    1) liberal (default)
    - undefined (type >= max) & NLA_UNSPEC attributes accepted
    - attribute length >= expected accepted
    - garbage at end of message accepted
    2) strict (opt-in)
    - NLA_UNSPEC attributes accepted
    - attribute length >= expected accepted

    Split out parsing strictness into four different options:
    * TRAILING - check that there's no trailing data after parsing
    attributes (in message or nested)
    * MAXTYPE - reject attrs > max known type
    * UNSPEC - reject attributes with NLA_UNSPEC policy entries
    * STRICT_ATTRS - strictly validate attribute size

    The default for future things should be *everything*.
    The current *_strict() is a combination of TRAILING and MAXTYPE,
    and is renamed to _deprecated_strict().
    The current regular parsing has none of this, and is renamed to
    *_parse_deprecated().

    Additionally it allows us to selectively set one of the new flags
    even on old policies. Notably, the UNSPEC flag could be useful in
    this case, since it can be arranged (by filling in the policy) to
    not be an incompatible userspace ABI change, but would then going
    forward prevent forgetting attribute entries. Similar can apply
    to the POLICY flag.

    We end up with the following renames:
    * nla_parse -> nla_parse_deprecated
    * nla_parse_strict -> nla_parse_deprecated_strict
    * nlmsg_parse -> nlmsg_parse_deprecated
    * nlmsg_parse_strict -> nlmsg_parse_deprecated_strict
    * nla_parse_nested -> nla_parse_nested_deprecated
    * nla_validate_nested -> nla_validate_nested_deprecated

    Using spatch, of course:
    @@
    expression TB, MAX, HEAD, LEN, POL, EXT;
    @@
    -nla_parse(TB, MAX, HEAD, LEN, POL, EXT)
    +nla_parse_deprecated(TB, MAX, HEAD, LEN, POL, EXT)

    @@
    expression NLH, HDRLEN, TB, MAX, POL, EXT;
    @@
    -nlmsg_parse(NLH, HDRLEN, TB, MAX, POL, EXT)
    +nlmsg_parse_deprecated(NLH, HDRLEN, TB, MAX, POL, EXT)

    @@
    expression NLH, HDRLEN, TB, MAX, POL, EXT;
    @@
    -nlmsg_parse_strict(NLH, HDRLEN, TB, MAX, POL, EXT)
    +nlmsg_parse_deprecated_strict(NLH, HDRLEN, TB, MAX, POL, EXT)

    @@
    expression TB, MAX, NLA, POL, EXT;
    @@
    -nla_parse_nested(TB, MAX, NLA, POL, EXT)
    +nla_parse_nested_deprecated(TB, MAX, NLA, POL, EXT)

    @@
    expression START, MAX, POL, EXT;
    @@
    -nla_validate_nested(START, MAX, POL, EXT)
    +nla_validate_nested_deprecated(START, MAX, POL, EXT)

    @@
    expression NLH, HDRLEN, MAX, POL, EXT;
    @@
    -nlmsg_validate(NLH, HDRLEN, MAX, POL, EXT)
    +nlmsg_validate_deprecated(NLH, HDRLEN, MAX, POL, EXT)

    For this patch, don't actually add the strict, non-renamed versions
    yet so that it breaks compile if I get it wrong.

    Also, while at it, make nla_validate and nla_parse go down to a
    common __nla_validate_parse() function to avoid code duplication.

    Ultimately, this allows us to have very strict validation for every
    new caller of nla_parse()/nlmsg_parse() etc as re-introduced in the
    next patch, while existing things will continue to work as is.

    In effect then, this adds fully strict validation for any new command.

    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     
  • Even if the NLA_F_NESTED flag was introduced more than 11 years ago, most
    netlink based interfaces (including recently added ones) are still not
    setting it in kernel generated messages. Without the flag, message parsers
    not aware of attribute semantics (e.g. wireshark dissector or libmnl's
    mnl_nlmsg_fprintf()) cannot recognize nested attributes and won't display
    the structure of their contents.

    Unfortunately we cannot just add the flag everywhere as there may be
    userspace applications which check nlattr::nla_type directly rather than
    through a helper masking out the flags. Therefore the patch renames
    nla_nest_start() to nla_nest_start_noflag() and introduces nla_nest_start()
    as a wrapper adding NLA_F_NESTED. The calls which add NLA_F_NESTED manually
    are rewritten to use nla_nest_start().

    Except for changes in include/net/netlink.h, the patch was generated using
    this semantic patch:

    @@ expression E1, E2; @@
    -nla_nest_start(E1, E2)
    +nla_nest_start_noflag(E1, E2)

    @@ expression E1, E2; @@
    -nla_nest_start_noflag(E1, E2 | NLA_F_NESTED)
    +nla_nest_start(E1, E2)

    Signed-off-by: Michal Kubecek
    Acked-by: Jiri Pirko
    Acked-by: David Ahern
    Signed-off-by: David S. Miller

    Michal Kubecek
     

28 Jul, 2018

2 commits

  • On ingress, a network device such as a switch assigns to packets
    priority based on various criteria. Common options include interpreting
    PCP and DSCP fields according to user configuration. When a packet
    egresses the switch, a reverse process may rewrite PCP and/or DSCP
    values according to packet priority.

    The following three functions support a) obtaining a DSCP-to-priority
    map or vice versa, and b) finding default-priority entries in APP
    database.

    The DCB subsystem supports for APP entries a very generous M:N mapping
    between priorities and protocol identifiers. Understandably,
    several (say) DSCP values can map to the same priority. But this
    asymmetry holds the other way around as well--one priority can map to
    several DSCP values. For this reason, the following functions operate in
    terms of bitmaps, with ones in positions that match some APP entry.

    - dcb_ieee_getapp_dscp_prio_mask_map() to compute for a given netdevice
    a map of DSCP-to-priority-mask, which gives for each DSCP value a
    bitmap of priorities related to that DSCP value by APP, along the
    lines of dcb_ieee_getapp_mask().

    - dcb_ieee_getapp_prio_dscp_mask_map() similarly to compute for a given
    netdevice a map from priorities to a bitmap of DSCPs.

    - dcb_ieee_getapp_default_prio_mask() which finds all default-priority
    rules for a given port in APP database, and returns a mask of
    priorities allowed by these default-priority rules.

    Signed-off-by: Petr Machata
    Signed-off-by: Ido Schimmel
    Signed-off-by: David S. Miller

    Petr Machata
     
  • The function dcb_app_lookup walks the list of specified DCB APP entries,
    looking for one that matches a given criteria: ifindex, selector,
    protocol ID and optionally also priority. The "don't care" value for
    priority is set to 0, because that priority has not been allowed under
    CEE regime, which predates the IEEE standardization.

    Under IEEE, 0 is a valid priority number. But because dcb_app_lookup
    considers zero a wild card, attempts to add an APP entry with priority 0
    fail when other entries exist for a given ifindex / selector / PID
    triplet.

    Fix by changing the wild-card value to -1.

    Signed-off-by: Petr Machata
    Signed-off-by: Ido Schimmel
    Signed-off-by: David S. Miller

    Petr Machata
     

13 Jun, 2018

1 commit

  • The kmalloc() function has a 2-factor argument form, kmalloc_array(). This
    patch replaces cases of:

    kmalloc(a * b, gfp)

    with:
    kmalloc_array(a * b, gfp)

    as well as handling cases of:

    kmalloc(a * b * c, gfp)

    with:

    kmalloc(array3_size(a, b, c), gfp)

    as it's slightly less ugly than:

    kmalloc_array(array_size(a, b), c, gfp)

    This does, however, attempt to ignore constant size factors like:

    kmalloc(4 * 1024, gfp)

    though any constants defined via macros get caught up in the conversion.

    Any factors with a sizeof() of "unsigned char", "char", and "u8" were
    dropped, since they're redundant.

    The tools/ directory was manually excluded, since it has its own
    implementation of kmalloc().

    The Coccinelle script used for this was:

    // Fix redundant parens around sizeof().
    @@
    type TYPE;
    expression THING, E;
    @@

    (
    kmalloc(
    - (sizeof(TYPE)) * E
    + sizeof(TYPE) * E
    , ...)
    |
    kmalloc(
    - (sizeof(THING)) * E
    + sizeof(THING) * E
    , ...)
    )

    // Drop single-byte sizes and redundant parens.
    @@
    expression COUNT;
    typedef u8;
    typedef __u8;
    @@

    (
    kmalloc(
    - sizeof(u8) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(__u8) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(char) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(unsigned char) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(u8) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(__u8) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(char) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(unsigned char) * COUNT
    + COUNT
    , ...)
    )

    // 2-factor product with sizeof(type/expression) and identifier or constant.
    @@
    type TYPE;
    expression THING;
    identifier COUNT_ID;
    constant COUNT_CONST;
    @@

    (
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * (COUNT_ID)
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * COUNT_ID
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * (COUNT_CONST)
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * COUNT_CONST
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * (COUNT_ID)
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * COUNT_ID
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * (COUNT_CONST)
    + COUNT_CONST, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * COUNT_CONST
    + COUNT_CONST, sizeof(THING)
    , ...)
    )

    // 2-factor product, only identifiers.
    @@
    identifier SIZE, COUNT;
    @@

    - kmalloc
    + kmalloc_array
    (
    - SIZE * COUNT
    + COUNT, SIZE
    , ...)

    // 3-factor product with 1 sizeof(type) or sizeof(expression), with
    // redundant parens removed.
    @@
    expression THING;
    identifier STRIDE, COUNT;
    type TYPE;
    @@

    (
    kmalloc(
    - sizeof(TYPE) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    )

    // 3-factor product with 2 sizeof(variable), with redundant parens removed.
    @@
    expression THING1, THING2;
    identifier COUNT;
    type TYPE1, TYPE2;
    @@

    (
    kmalloc(
    - sizeof(TYPE1) * sizeof(TYPE2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kmalloc(
    - sizeof(THING1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - sizeof(THING1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    )

    // 3-factor product, only identifiers, with redundant parens removed.
    @@
    identifier STRIDE, SIZE, COUNT;
    @@

    (
    kmalloc(
    - (COUNT) * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    )

    // Any remaining multi-factor products, first at least 3-factor products,
    // when they're not all constants...
    @@
    expression E1, E2, E3;
    constant C1, C2, C3;
    @@

    (
    kmalloc(C1 * C2 * C3, ...)
    |
    kmalloc(
    - (E1) * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - (E1) * (E2) * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - (E1) * (E2) * (E3)
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - E1 * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    )

    // And then all remaining 2 factors products when they're not all constants,
    // keeping sizeof() as the second factor argument.
    @@
    expression THING, E1, E2;
    type TYPE;
    constant C1, C2, C3;
    @@

    (
    kmalloc(sizeof(THING) * C2, ...)
    |
    kmalloc(sizeof(TYPE) * C2, ...)
    |
    kmalloc(C1 * C2 * C3, ...)
    |
    kmalloc(C1 * C2, ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * (E2)
    + E2, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * E2
    + E2, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * (E2)
    + E2, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * E2
    + E2, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - (E1) * E2
    + E1, E2
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - (E1) * (E2)
    + E1, E2
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - E1 * E2
    + E1, E2
    , ...)
    )

    Signed-off-by: Kees Cook

    Kees Cook
     

25 May, 2018

1 commit

  • In this patch, we add dcbnl buffer attribute to allow user
    change the NIC's buffer configuration such as priority
    to buffer mapping and buffer size of individual buffer.

    This attribute combined with pfc attribute allows advanced user to
    fine tune the qos setting for specific priority queue. For example,
    user can give dedicated buffer for one or more priorities or user
    can give large buffer to certain priorities.

    The dcb buffer configuration will be controlled by lldptool.
    lldptool -T -i eth2 -V BUFFER prio 0,2,5,7,1,2,3,6
    maps priorities 0,1,2,3,4,5,6,7 to receive buffer 0,2,5,7,1,2,3,6
    lldptool -T -i eth2 -V BUFFER size 87296,87296,0,87296,0,0,0,0
    sets receive buffer size for buffer 0,1,2,3,4,5,6,7 respectively

    After discussion on mailing list with Jakub, Jiri, Ido and John, we agreed to
    choose dcbnl over devlink interface since this feature is intended to set
    port attributes which are governed by the netdev instance of that port, where
    devlink API is more suitable for global ASIC configurations.

    We present an use case scenario where dcbnl buffer attribute configured
    by advance user helps reduce the latency of messages of different sizes.

    Scenarios description:
    On ConnectX-5, we run latency sensitive traffic with
    small/medium message sizes ranging from 64B to 256KB and bandwidth sensitive
    traffic with large messages sizes 512KB and 1MB. We group small, medium,
    and large message sizes to their own pfc enables priorities as follow.
    Priorities 1 & 2 (64B, 256B and 1KB)
    Priorities 3 & 4 (4KB, 8KB, 16KB, 64KB, 128KB and 256KB)
    Priorities 5 & 6 (512KB and 1MB)

    By default, ConnectX-5 maps all pfc enabled priorities to a single
    lossless fixed buffer size of 50% of total available buffer space. The
    other 50% is assigned to lossy buffer. Using dcbnl buffer attribute,
    we create three equal size lossless buffers. Each buffer has 25% of total
    available buffer space. Thus, the lossy buffer size reduces to 25%. Priority
    to lossless buffer mappings are set as follow.
    Priorities 1 & 2 on lossless buffer #1
    Priorities 3 & 4 on lossless buffer #2
    Priorities 5 & 6 on lossless buffer #3

    We observe improvements in latency for small and medium message sizes
    as follows. Please note that the large message sizes bandwidth performance is
    reduced but the total bandwidth remains the same.
    256B message size (42 % latency reduction)
    4K message size (21% latency reduction)
    64K message size (16% latency reduction)

    CC: Ido Schimmel
    CC: Jakub Kicinski
    CC: Jiri Pirko
    CC: Or Gerlitz
    CC: Parav Pandit
    CC: Aron Silverton
    Signed-off-by: Huy Nguyen
    Reviewed-by: Parav Pandit
    Signed-off-by: Saeed Mahameed

    Huy Nguyen
     

10 Aug, 2017

1 commit

  • This change allows us to later indicate to rtnetlink core that certain
    doit functions should be called without acquiring rtnl_mutex.

    This change should have no effect, we simply replace the last (now
    unused) calcit argument with the new flag.

    Signed-off-by: Florian Westphal
    Reviewed-by: Hannes Frederic Sowa
    Signed-off-by: David S. Miller

    Florian Westphal
     

22 May, 2017

1 commit

  • Found by reviewing the warning about unused policy table.
    The code implies that it meant to check for size, but since
    it unrolled the loop for attribute validation that is never used.
    Instead do explicit check for attribute.

    Compile tested only. Needs review by original author.

    Signed-off-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    stephen hemminger
     

18 Apr, 2017

1 commit

  • Add netlink_ext_ack arg to rtnl_doit_func. Pass extack arg to nlmsg_parse
    for doit functions that call it directly.

    This is the first step to using extended error reporting in rtnetlink.
    >From here individual subsystems can be updated to set netlink_ext_ack as
    needed.

    Signed-off-by: David Ahern
    Signed-off-by: David S. Miller

    David Ahern
     

14 Apr, 2017

1 commit


04 Dec, 2016

1 commit

  • In function dcbnl_cee_fill(), returns the value of variable err on
    errors. However, on some error paths (e.g. nla put fails), its value may
    be 0. It may be better to explicitly set a negative errno to variable
    err before returning.

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188881

    Signed-off-by: Pan Bian
    Signed-off-by: David S. Miller

    Pan Bian
     

09 Oct, 2015

1 commit

  • The Kconfig currently controlling compilation of this code is:

    net/dcb/Kconfig:config DCB
    net/dcb/Kconfig: bool "Data Center Bridging support"

    ...meaning that it currently is not being built as a module by anyone.

    Lets remove the modular code that is essentially orphaned, so that
    when reading the driver there is no doubt it is builtin-only.

    Since module_init translates to device_initcall in the non-modular
    case, the init ordering remains unchanged with this commit. We can
    change to one of the other priority initcalls (subsys?) at any later
    date, if desired.

    We also delete the MODULE_LICENSE tag etc. since all that information
    is (or is now) already contained at the top of the file in the comments.

    Cc: "David S. Miller"
    Cc: Or Gerlitz
    Cc: Anish Bhatt
    Cc: John Fastabend
    Cc: Shani Michaeli
    Cc: netdev@vger.kernel.org
    Signed-off-by: Paul Gortmaker
    Signed-off-by: David S. Miller

    Paul Gortmaker
     

07 Mar, 2015

1 commit

  • As specified in 802.1Qau spec. Add this optional attribute to the
    DCB netlink layer. To allow for application to use the new attribute,
    NIC drivers should implement and register the callbacks ieee_getqcn,
    ieee_setqcn and ieee_getqcnstats.

    The QCN attribute holds a set of parameters for management, and
    a set of statistics to provide informative data on Congestion-Control
    defined by this spec.

    Signed-off-by: Shani Michaeli
    Signed-off-by: Shachar Raindel
    Signed-off-by: Or Gerlitz
    Acked-by: John Fastabend
    Signed-off-by: David S. Miller

    Shani Michaeli
     

17 Nov, 2014

1 commit

  • Solves possible lockup issues that can be seen from firmware DCB agents calling
    into the DCB app api.

    DCB firmware event queues can be tied in with NAPI so that dcb events are
    generated in softIRQ context. This can results in calls to dcb_*app()
    functions which try to take the dcb_lock.

    If the the event triggers while we also have the dcb_lock because lldpad or
    some other agent happened to be issuing a get/set command we could see a cpu
    lockup.

    This code was not originally written with firmware agents in mind, hence
    grabbing dcb_lock from softIRQ context was not considered.

    Signed-off-by: Anish Bhatt
    Signed-off-by: David S. Miller

    Anish Bhatt
     

31 Jul, 2014

1 commit

  • Current explanation of dcb_app->priority is wrong. It says priority is
    expected to be a 3-bit unsigned integer which is only true when working with
    DCBx-IEEE. Use of dcb_app->priority by DCBx-CEE expects it to be 802.1p user
    priority bitmap. Updated accordingly

    This affects the cxgb4 driver, but I will post those changes as part of a
    larger changeset shortly.

    Fixes: 3e29027af4372 ("dcbnl: add support for ieee8021Qaz attributes")
    Signed-off-by: Anish Bhatt
    Acked-by: John Fastabend
    Signed-off-by: David S. Miller

    Anish Bhatt
     

18 Jul, 2014

1 commit


25 Apr, 2014

1 commit

  • It is possible by passing a netlink socket to a more privileged
    executable and then to fool that executable into writing to the socket
    data that happens to be valid netlink message to do something that
    privileged executable did not intend to do.

    To keep this from happening replace bare capable and ns_capable calls
    with netlink_capable, netlink_net_calls and netlink_ns_capable calls.
    Which act the same as the previous calls except they verify that the
    opener of the socket had the desired permissions as well.

    Reported-by: Andy Lutomirski
    Signed-off-by: "Eric W. Biederman"
    Signed-off-by: David S. Miller

    Eric W. Biederman
     

15 Jan, 2014

1 commit

  • The following call chain indicates that dcb_doit() is protected
    under rtnl_lock. So if we use __dev_get_by_name() instead of
    dev_get_by_name() to find interface handlers in it, this would
    help us avoid to change interface reference counter.

    rtnetlink_rcv()
    rtnl_lock()
    netlink_rcv_skb()
    dcb_doit()
    rtnl_unlock()

    Cc: John Fastabend
    Signed-off-by: Ying Xue
    Signed-off-by: David S. Miller

    Ying Xue
     

07 Dec, 2013

1 commit

  • Several files refer to an old address for the Free Software Foundation
    in the file header comment. Resolve by replacing the address with
    the URL so that we do not have to keep
    updating the header comments anytime the address changes.

    CC: John Fastabend
    CC: Alex Duyck
    CC: Marcel Holtmann
    CC: Gustavo Padovan
    CC: Johan Hedberg
    CC: Jamal Hadi Salim
    Signed-off-by: Jeff Kirsher
    Signed-off-by: David S. Miller

    Jeff Kirsher
     

22 Mar, 2013

1 commit


12 Mar, 2013

1 commit


10 Mar, 2013

2 commits

  • The dcb netlink interface leaks stack memory in various places:
    * perm_addr[] buffer is only filled at max with 12 of the 32 bytes but
    copied completely,
    * no in-kernel driver fills all fields of an IEEE 802.1Qaz subcommand,
    so we're leaking up to 58 bytes for ieee_ets structs, up to 136 bytes
    for ieee_pfc structs, etc.,
    * the same is true for CEE -- no in-kernel driver fills the whole
    struct,

    Prevent all of the above stack info leaks by properly initializing the
    buffers/structures involved.

    Signed-off-by: Mathias Krause
    Signed-off-by: David S. Miller

    Mathias Krause
     
  • Add header with function definitions to quiet warnings and avoid future errors.

    Signed-off-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    stephen hemminger
     

11 Dec, 2012

1 commit

  • Allow DCB and net namespace to work together. This is useful if you
    have containers that are bound to 'phys' interfaces that want to
    also manage their DCB attributes.

    The net namespace is taken from sock_net(skb->sk) of the netlink skb.

    CC: "Eric W. Biederman"
    Signed-off-by: John Fastabend
    Signed-off-by: David S. Miller

    John Fastabend
     

19 Nov, 2012

1 commit

  • - In rtnetlink_rcv_msg convert the capable(CAP_NET_ADMIN) check
    to ns_capable(net->user-ns, CAP_NET_ADMIN). Allowing unprivileged
    users to make netlink calls to modify their local network
    namespace.

    - In the rtnetlink doit methods add capable(CAP_NET_ADMIN) so
    that calls that are not safe for unprivileged users are still
    protected.

    Later patches will remove the extra capable calls from methods
    that are safe for unprivilged users.

    Acked-by: Serge Hallyn
    Signed-off-by: "Eric W. Biederman"
    Signed-off-by: David S. Miller

    Eric W. Biederman
     

11 Sep, 2012

1 commit

  • It is a frequent mistake to confuse the netlink port identifier with a
    process identifier. Try to reduce this confusion by renaming fields
    that hold port identifiers portid instead of pid.

    I have carefully avoided changing the structures exported to
    userspace to avoid changing the userspace API.

    I have successfully built an allyesconfig kernel with this change.

    Signed-off-by: "Eric W. Biederman"
    Acked-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    Eric W. Biederman
     

11 Jul, 2012

1 commit


22 Jun, 2012

1 commit

  • A small regression was introduced in the reply command of
    dcbnl_pg_setcfg(). User space apps may be expecting the
    DCB_ATTR_PG_CFG attribute to be returned with the patch
    below TX or RX variants are returned.

    commit 7be994138b188387691322921c08e19bddf6d3c5
    Author: Thomas Graf
    Date: Wed Jun 13 02:54:55 2012 +0000

    dcbnl: Shorten all command handling functions

    This patch reverts this behavior and returns DCB_ATTR_PG_CFG

    Signed-off-by: John Fastabend
    Acked-by: Thomas Graf
    Signed-off-by: David S. Miller

    John Fastabend
     

14 Jun, 2012

7 commits