Skip to content
  1. Apr 28, 2019
    • Johannes Berg's avatar
      netlink: add strict parsing for future attributes · 56738f46
      Johannes Berg authored
      
      
      Unfortunately, we cannot add strict parsing for all attributes, as
      that would break existing userspace. We currently warn about it, but
      that's about all we can do.
      
      For new attributes, however, the story is better: nobody is using
      them, so we can reject bad sizes.
      
      Also, for new attributes, we need not accept them when the policy
      doesn't declare their usage.
      
      David Ahern and I went back and forth on how to best encode this, and
      the best way we found was to have a "boundary type", from which point
      on new attributes have all possible validation applied, and NLA_UNSPEC
      is rejected.
      
      As we didn't want to add another argument to all functions that get a
      netlink policy, the workaround is to encode that boundary in the first
      entry of the policy array (which is for type 0 and thus probably not
      really valid anyway). I put it into the validation union for the rare
      possibility that somebody is actually using attribute 0, which would
      continue to work fine unless they tried to use the extended validation,
      which isn't likely. We also didn't find any in-tree users with type 0.
      
      The reason for setting the "start strict here" attribute is that we
      never really need to start strict from 0, which is invalid anyway (or
      in legacy families where that isn't true, it cannot be set to strict),
      so we can thus reserve the value 0 for "don't do this check" and don't
      have to add the tag to all policies right now.
      
      Thus, policies can now opt in to this validation, which we should do
      for all existing policies, at least when adding new attributes.
      
      Note that entirely *new* policies won't need to set it, as the use
      of that should be using nla_parse()/nlmsg_parse() etc. which anyway
      do fully strict validation now, regardless of this.
      
      So in effect, this patch only covers the "existing command with new
      attribute" case.
      
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      56738f46
    • Johannes Berg's avatar
      netlink: re-add parse/validate functions in strict mode · 3de64403
      Johannes Berg authored
      
      
      This re-adds the parse and validate functions like nla_parse()
      that are now actually strict after the previous rename and were
      just split out to make sure everything is converted (and if not
      compilation of the previous patch would fail.)
      
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3de64403
    • Johannes Berg's avatar
      netlink: make validation more configurable for future strictness · 8cb08174
      Johannes Berg authored
      
      
      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: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8cb08174
    • Johannes Berg's avatar
      netlink: add NLA_MIN_LEN · 6f455f5f
      Johannes Berg authored
      
      
      Rather than using NLA_UNSPEC for this type of thing, use NLA_MIN_LEN
      so we can make NLA_UNSPEC be NLA_REJECT under certain conditions for
      future attributes.
      
      While at it, also use NLA_EXACT_LEN for the struct example.
      
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6f455f5f
    • David S. Miller's avatar
      Merge branch 'nla_nest_start' · f6ad55a6
      David S. Miller authored
      
      
      Michal Kubecek says:
      
      ====================
      make nla_nest_start() add NLA_F_NESTED flag
      
      One of the comments in recent review of the ethtool netlink series pointed
      out that proposed ethnl_nest_start() helper which adds NLA_F_NESTED to
      second argument of nla_nest_start() is not really specific to ethtool
      netlink code. That is hard to argue with as closer inspection revealed that
      exactly the same helper already exists in ipset code (except it's a macro
      rather than an inline function).
      
      Another observation was that even if NLA_F_NESTED flag was introduced in
      2007, only few netlink based interfaces set it in kernel generated messages
      and even many recently added APIs omit it. That is unfortunate as without
      the flag, message parsers not familiar with attribute semantics cannot
      recognize nested attributes and do not see message structure; this affects
      e.g. wireshark dissector or mnl_nlmsg_fprintf() from libmnl.
      
      This is why I'm suggesting to rename existing nla_nest_start() to different
      name (nla_nest_start_noflag) and reintroduce nla_nest_start() as a wrapper
      adding NLA_F_NESTED flag. This is implemented in first patch which is
      mostly generated by spatch. Second patch drops ipset helper macros which
      lose their purpose. Third patch cleans up minor coding style issues found
      by checkpatch.pl in first patch.
      
      We could leave nla_nest_start() untouched and simply add a wrapper adding
      NLA_F_NESTED but that would probably preserve the state when even most new
      code doesn't set the flag.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f6ad55a6
    • Michal Kubecek's avatar
      net: fix two coding style issues · f78c6032
      Michal Kubecek authored
      
      
      This is a simple cleanup addressing two coding style issues found by
      checkpatch.pl in an earlier patch. It's submitted as a separate patch to
      keep the original patch as it was generated by spatch.
      
      Signed-off-by: default avatarMichal Kubecek <mkubecek@suse.cz>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f78c6032
    • Michal Kubecek's avatar
      ipset: drop ipset_nest_start() and ipset_nest_end() · 12ad5f65
      Michal Kubecek authored
      
      
      After the previous commit, both ipset_nest_start() and ipset_nest_end() are
      just aliases for nla_nest_start() and nla_nest_end() so that there is no
      need to keep them.
      
      Signed-off-by: default avatarMichal Kubecek <mkubecek@suse.cz>
      Acked-by: default avatarJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      12ad5f65
    • Michal Kubecek's avatar
      netlink: make nla_nest_start() add NLA_F_NESTED flag · ae0be8de
      Michal Kubecek authored
      
      
      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: default avatarMichal Kubecek <mkubecek@suse.cz>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Acked-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ae0be8de
    • David S. Miller's avatar
      Merge branch 'net-tls-small-code-cleanup' · c7881b4a
      David S. Miller authored
      
      
      Jakub Kicinski says:
      
      ====================
      net/tls: small code cleanup
      
      This small patch set cleans up tls (mostly offload parts).
      Other than avoiding unnecessary error messages - no functional
      changes here.
      
      v2 (Saeed):
       - fix up Review tags;
       - remove the warning on failure completely.
      ====================
      
      Reviewed-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c7881b4a
    • Jakub Kicinski's avatar
      net/tls: byte swap device req TCP seq no upon setting · 63a1c95f
      Jakub Kicinski authored
      
      
      To avoid a sparse warning byteswap the be32 sequence number
      before it's stored in the atomic value.  While at it drop
      unnecessary brackets and use kernel's u64 type.
      
      Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@netronome.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      63a1c95f
    • Jakub Kicinski's avatar
      net/tls: move definition of tls ops into net/tls.h · da68b4ad
      Jakub Kicinski authored
      
      
      There seems to be no reason for tls_ops to be defined in netdevice.h
      which is included in a lot of places.  Don't wrap the struct/enum
      declaration in ifdefs, it trickles down unnecessary ifdefs into
      driver code.
      
      Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@netronome.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      da68b4ad
    • Jakub Kicinski's avatar
      net/tls: remove old exports of sk_destruct functions · 9e995797
      Jakub Kicinski authored
      
      
      tls_device_sk_destruct being set on a socket used to indicate
      that socket is a kTLS device one.  That is no longer true -
      now we use sk_validate_xmit_skb pointer for that purpose.
      Remove the export.  tls_device_attach() needs to be moved.
      
      While at it, remove the dead declaration of tls_sk_destruct().
      
      Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Reviewed-by: default avatarDirk van der Merwe <dirk.vandermerwe@netronome.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@netronome.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9e995797
    • Jakub Kicinski's avatar
      net/tls: don't log errors every time offload can't proceed · e49d268d
      Jakub Kicinski authored
      
      
      Currently when CONFIG_TLS_DEVICE is set each time kTLS
      connection is opened and the offload is not successful
      (either because the underlying device doesn't support
      it or e.g. it's tables are full) a rate limited error
      will be printed to the logs.
      
      There is nothing wrong with failing TLS offload.  SW
      path will process the packets just fine, drop the
      noisy messages.
      
      Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@netronome.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e49d268d
  2. Apr 27, 2019
  3. Apr 26, 2019
    • Heiner Kallweit's avatar
      net: phy: improve genphy_soft_reset · 8c90b795
      Heiner Kallweit authored
      
      
      PHY's behave differently when being reset. Some reset registers to
      defaults, some don't. Some trigger an autoneg restart, some don't.
      
      So let's also set the autoneg restart bit when resetting. Then PHY
      behavior should be more consistent. Clearing BMCR_ISOLATE serves the
      same purpose and is borrowed from genphy_restart_aneg.
      
      BMCR holds the speed / duplex settings in fixed mode. Therefore
      we may have an issue if a soft reset resets BMCR to its default.
      So better call genphy_setup_forced() afterwards in fixed mode.
      We've seen no related complaint in the last >10 yrs, so let's
      treat it as an improvement.
      
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8c90b795
    • Guenter Roeck's avatar
      usbnet: ipheth: Simplify device detection · f7abc061
      Guenter Roeck authored
      
      
      All Apple products use the same protocol for tethering over USB.
      To simplify the code and make it future proof, use
      USB_VENDOR_AND_INTERFACE_INFO() instead of
      USB_DEVICE_AND_INTERFACE_INFO() to automatically detect and support
      all existing and future Apple products using the same interface.
      
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f7abc061
    • David Ahern's avatar
      ipv6: Initialize fib6_result in bpf_ipv6_fib_lookup · e55449e7
      David Ahern authored
      fib6_result is not initialized in bpf_ipv6_fib_lookup and potentially
      passses garbage to the fib lookup which triggers a KASAN warning:
      
      [  262.055450] ==================================================================
      [  262.057640] BUG: KASAN: user-memory-access in fib6_rule_suppress+0x4b/0xce
      [  262.059488] Read of size 8 at addr 00000a20000000b0 by task swapper/1/0
      [  262.061238]
      [  262.061673] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.1.0-rc5+ #56
      [  262.063493] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.1-1 04/01/2014
      [  262.065593] Call Trace:
      [  262.066277]  <IRQ>
      [  262.066848]  dump_stack+0x7e/0xbb
      [  262.067764]  kasan_report+0x18b/0x1b5
      [  262.069921]  __asan_load8+0x7f/0x81
      [  262.070879]  fib6_rule_suppress+0x4b/0xce
      [  262.071980]  fib_rules_lookup+0x275/0x2cd
      [  262.073090]  fib6_lookup+0x119/0x218
      [  262.076457]  bpf_ipv6_fib_lookup+0x39d/0x664
      ...
      
      Initialize fib6_result to 0.
      
      Fixes: b1d40991
      
       ("ipv6: Rename fib6_multipath_select and pass fib6_result")
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e55449e7
    • Gustavo A. R. Silva's avatar
      cnic: Refactor code and mark expected switch fall-through · 950347f5
      Gustavo A. R. Silva authored
      
      
      In preparation to enabling -Wimplicit-fallthrough, refactor code a
      bit and mark switch cases where we are expecting to fall through.
      
      This patch fixes the following warning:
      
      drivers/net/ethernet/broadcom/cnic.c: In function ‘cnic_cm_process_kcqe’:
      drivers/net/ethernet/broadcom/cnic.c:4044:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
          opcode = L4_KCQE_OPCODE_VALUE_CLOSE_COMP;
      drivers/net/ethernet/broadcom/cnic.c:4050:2: note: here
        case L4_KCQE_OPCODE_VALUE_RESET_RECEIVED:
        ^~~~
      
      Warning level 3 was used: -Wimplicit-fallthrough=3
      
      Notice that, in this particular case, the code comment is modified
      in accordance with what GCC is expecting to find.
      
      This patch is part of the ongoing efforts to enable
      -Wimplicit-fallthrough.
      
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      950347f5
    • Gustavo A. R. Silva's avatar
      cxgb4/cxgb4vf_main: Mark expected switch fall-through · 05dd2645
      Gustavo A. R. Silva authored
      
      
      In preparation to enabling -Wimplicit-fallthrough, mark switch
      cases where we are expecting to fall through.
      
      This patch fixes the following warning:
      
      drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c: In function ‘fwevtq_handler’:
      drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c:520:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
         cpl = (void *)p;
         ~~~~^~~~~~~~~~~
      drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c:524:2: note: here
        case CPL_SGE_EGR_UPDATE: {
        ^~~~
      
      Warning level 3 was used: -Wimplicit-fallthrough=3
      
      Notice that, in this particular case, the code comment is modified
      in accordance with what GCC is expecting to find.
      
      This patch is part of the ongoing efforts to enable
      -Wimplicit-fallthrough.
      
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      05dd2645
    • Gustavo A. R. Silva's avatar
      wimax/i2400m/control: Mark expected switch fall-through · 9b8221d4
      Gustavo A. R. Silva authored
      
      
      In preparation to enabling -Wimplicit-fallthrough, mark switch
      cases where we are expecting to fall through.
      
      This patch fixes the following warning:
      
      In file included from drivers/net/wimax/i2400m/debug-levels.h:30,
                       from drivers/net/wimax/i2400m/control.c:86:
      drivers/net/wimax/i2400m/control.c: In function ‘i2400m_report_tlv_system_state’:
      ./include/linux/wimax/debug.h:200:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
       do {         \
          ^
      ./include/linux/wimax/debug.h:404:36: note: in expansion of macro ‘_d_printf’
       #define d_printf(l, _dev, f, a...) _d_printf(l, "", _dev, f, ## a)
                                          ^~~~~~~~~
      drivers/net/wimax/i2400m/control.c:354:3: note: in expansion of macro ‘d_printf’
         d_printf(1, dev, "entering BS-negotiated idle mode\n");
         ^~~~~~~~
      drivers/net/wimax/i2400m/control.c:355:2: note: here
        case I2400M_SS_DISCONNECTING:
        ^~~~
      
      Warning level 3 was used: -Wimplicit-fallthrough=3
      
      This patch is part of the ongoing efforts to enable
      -Wimplicit-fallthrough.
      
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9b8221d4
    • Gustavo A. R. Silva's avatar
      amd-xgbe: Mark expected switch fall-throughs · a36de5b7
      Gustavo A. R. Silva authored
      
      
      In preparation to enabling -Wimplicit-fallthrough, mark switch
      cases where we are expecting to fall through.
      
      This patch fixes the following warnings:
      
      In file included from drivers/net/ethernet/amd/xgbe/xgbe-drv.c:129:
      drivers/net/ethernet/amd/xgbe/xgbe-drv.c: In function ‘xgbe_set_hwtstamp_settings’:
      drivers/net/ethernet/amd/xgbe/xgbe-common.h:1392:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
        (_var) |= (((_val) & ((0x1 << (_width)) - 1)) << (_index)); \
        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/net/ethernet/amd/xgbe/xgbe-common.h:1419:2: note: in expansion of macro ‘SET_BITS’
        SET_BITS((_var),      \
        ^~~~~~~~
      drivers/net/ethernet/amd/xgbe/xgbe-drv.c:1614:3: note: in expansion of macro ‘XGMAC_SET_BITS’
         XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSVER2ENA, 1);
         ^~~~~~~~~~~~~~
      drivers/net/ethernet/amd/xgbe/xgbe-drv.c:1616:2: note: here
        case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
        ^~~~
      In file included from drivers/net/ethernet/amd/xgbe/xgbe-drv.c:129:
      drivers/net/ethernet/amd/xgbe/xgbe-common.h:1392:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
        (_var) |= (((_val) & ((0x1 << (_width)) - 1)) << (_index)); \
        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/net/ethernet/amd/xgbe/xgbe-common.h:1419:2: note: in expansion of macro ‘SET_BITS’
        SET_BITS((_var),      \
        ^~~~~~~~
      drivers/net/ethernet/amd/xgbe/xgbe-drv.c:1625:3: note: in expansion of macro ‘XGMAC_SET_BITS’
         XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSVER2ENA, 1);
         ^~~~~~~~~~~~~~
      drivers/net/ethernet/amd/xgbe/xgbe-drv.c:1627:2: note: here
        case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
        ^~~~
      In file included from drivers/net/ethernet/amd/xgbe/xgbe-drv.c:129:
      drivers/net/ethernet/amd/xgbe/xgbe-common.h:1392:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
        (_var) |= (((_val) & ((0x1 << (_width)) - 1)) << (_index)); \
        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/net/ethernet/amd/xgbe/xgbe-common.h:1419:2: note: in expansion of macro ‘SET_BITS’
        SET_BITS((_var),      \
        ^~~~~~~~
      drivers/net/ethernet/amd/xgbe/xgbe-drv.c:1636:3: note: in expansion of macro ‘XGMAC_SET_BITS’
         XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSVER2ENA, 1);
         ^~~~~~~~~~~~~~
      drivers/net/ethernet/amd/xgbe/xgbe-drv.c:1638:2: note: here
        case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
        ^~~~
      
      Warning level 3 was used: -Wimplicit-fallthrough=3
      
      Notice that, in this particular case, the code comments are modified
      in accordance with what GCC is expecting to find.
      
      This patch is part of the ongoing efforts to enable
      -Wimplicit-fallthrough.
      
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a36de5b7
    • Gustavo A. R. Silva's avatar
      net: socket: Fix missing break in switch statement · 60747828
      Gustavo A. R. Silva authored
      Add missing break statement in order to prevent the code from falling
      through to cases SIOCGSTAMP_NEW and SIOCGSTAMPNS_NEW.
      
      This bug was found thanks to the ongoing efforts to enable
      -Wimplicit-fallthrough.
      
      Fixes: 0768e170
      
       ("net: socket: implement 64-bit timestamps")
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      60747828
    • David S. Miller's avatar
      Merge branch 's390-qeth-cleanups' · 0ff85d6d
      David S. Miller authored
      
      
      Julian Wiedmann says:
      
      ====================
      s390/qeth: updates 2019-04-25
      
      please apply one more patch series for qeth to net-next. Nothing special,
      just a bunch of cleanups.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0ff85d6d
    • Julian Wiedmann's avatar
      s390/qeth: trust non-IP cast type in qeth_l3_fill_header() · 14a1b047
      Julian Wiedmann authored
      
      
      When building the L3 HW header for non-IP packets, trust the cast type
      that was passed as parameter. qeth_l3_get_cast_type() has most likely
      also used h_dest to determine the cast type, so we get the same
      result, and can remove that duplicated code.
      In the unlikely case that we would get a _different_ cast type, then
      that's based off a route lookup and should be considered authoritative.
      
      Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      14a1b047
    • Julian Wiedmann's avatar
      s390/qeth: extract helper to determine L2 cast type · 58aa2491
      Julian Wiedmann authored
      
      
      This de-duplicates the L2 and L3 cast-type code, and makes the L2 code
      a bit more robust by removing the fragile assumption that skb->data
      always points to the Ethernet Header. This would break in code paths
      where we pushed the HW header onto the skb.
      
      Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      58aa2491