1. 19 Aug, 2020 4 commits
    • David S. Miller's avatar
      Merge branch 'Bug-fixes-for-ENA-ethernet-driver' · b4c8998b
      David S. Miller authored
      Shay Agroskin says:
      
      ====================
      Bug fixes for ENA ethernet driver
      
      This series adds the following:
      - Fix undesired call to ena_restore after returning from suspend
      - Fix condition inside a WARN_ON
      - Fix overriding previous value when updating missed_tx statistic
      
      v1->v2:
      - fix bug when calling reset routine after device resources are freed (Jakub)
      
      v2->v3:
      - fix wrong hash in 'Fixes' tag
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b4c8998b
    • Shay Agroskin's avatar
      net: ena: Make missed_tx stat incremental · ccd143e5
      Shay Agroskin authored
      Most statistics in ena driver are incremented, meaning that a stat's
      value is a sum of all increases done to it since driver/queue
      initialization.
      
      This patch makes all statistics this way, effectively making missed_tx
      statistic incremental.
      Also added a comment regarding rx_drops and tx_drops to make it
      clearer how these counters are calculated.
      
      Fixes: 11095fdb ("net: ena: add statistics for missed tx packets")
      Signed-off-by: default avatarShay Agroskin <shayagr@amazon.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ccd143e5
    • Shay Agroskin's avatar
      net: ena: Change WARN_ON expression in ena_del_napi_in_range() · 8b147f6f
      Shay Agroskin authored
      The ena_del_napi_in_range() function unregisters the napi handler for
      rings in a given range.
      This function had the following WARN_ON macro:
      
          WARN_ON(ENA_IS_XDP_INDEX(adapter, i) &&
      	    adapter->ena_napi[i].xdp_ring);
      
      This macro prints the call stack if the expression inside of it is
      true [1], but the expression inside of it is the wanted situation.
      The expression checks whether the ring has an XDP queue and its index
      corresponds to a XDP one.
      
      This patch changes the expression to
          !ENA_IS_XDP_INDEX(adapter, i) && adapter->ena_napi[i].xdp_ring
      which indicates an unwanted situation.
      
      Also, change the structure of the function. The napi handler is
      unregistered for all rings, and so there's no need to check whether the
      index is an XDP index or not. By removing this check the code becomes
      much more readable.
      
      Fixes: 548c4940 ("net: ena: Implement XDP_TX action")
      Signed-off-by: default avatarShay Agroskin <shayagr@amazon.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8b147f6f
    • Shay Agroskin's avatar
      net: ena: Prevent reset after device destruction · 63d4a4c1
      Shay Agroskin authored
      The reset work is scheduled by the timer routine whenever it
      detects that a device reset is required (e.g. when a keep_alive signal
      is missing).
      When releasing device resources in ena_destroy_device() the driver
      cancels the scheduling of the timer routine without destroying the reset
      work explicitly.
      
      This creates the following bug:
          The driver is suspended and the ena_suspend() function is called
      	-> This function calls ena_destroy_device() to free the net device
      	   resources
      	    -> The driver waits for the timer routine to finish
      	    its execution and then cancels it, thus preventing from it
      	    to be called again.
      
          If, in its final execution, the timer routine schedules a reset,
          the reset routine might be called afterwards,and a redundant call to
          ena_restore_device() would be made.
      
      By changing the reset routine we allow it to read the device's state
      accurately.
      This is achieved by checking whether ENA_FLAG_TRIGGER_RESET flag is set
      before resetting the device and making both the destruction function and
      the flag check are under rtnl lock.
      The ENA_FLAG_TRIGGER_RESET is cleared at the end of the destruction
      routine. Also surround the flag check with 'likely' because
      we expect that the reset routine would be called only when
      ENA_FLAG_TRIGGER_RESET flag is set.
      
      The destruction of the timer and reset services in __ena_shutoff() have to
      stay, even though the timer routine is destroyed in ena_destroy_device().
      This is to avoid a case in which the reset routine is scheduled after
      free_netdev() in __ena_shutoff(), which would create an access to freed
      memory in adapter->flags.
      
      Fixes: 8c5c7abd ("net: ena: add power management ops to the ENA driver")
      Signed-off-by: default avatarShay Agroskin <shayagr@amazon.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      63d4a4c1
  2. 18 Aug, 2020 21 commits
    • Colin Ian King's avatar
      net: ipv4: remove duplicate "the the" phrase in Kconfig text · ad664118
      Colin Ian King authored
      The Kconfig help text contains the phrase "the the" in the help
      text. Fix this and reformat the block of help text.
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ad664118
    • Colin Ian King's avatar
      net: mscc: ocelot: remove duplicate "the the" phrase in Kconfig text · 17340552
      Colin Ian King authored
      The Kconfig help text contains the phrase "the the" in the help
      text. Fix this.
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      17340552
    • David S. Miller's avatar
      Merge branch 'ethtool-netlink-bug-fixes' · 0df55a03
      David S. Miller authored
      Maxim Mikityanskiy says:
      
      ====================
      ethtool-netlink bug fixes
      
      This series contains a few bug fixes for ethtool-netlink. These bugs are
      specific for the netlink interface, and the legacy ioctl interface is
      not affected. These patches aim to have the same behavior in
      ethtool-netlink as in the legacy ethtool.
      
      Please also see the sibling series for the userspace tool.
      
      v2 changes: Added Fixes tags.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0df55a03
    • Maxim Mikityanskiy's avatar
      ethtool: Don't omit the netlink reply if no features were changed · f01204ec
      Maxim Mikityanskiy authored
      The legacy ethtool userspace tool shows an error when no features could
      be changed. It's useful to have a netlink reply to be able to show this
      error when __netdev_update_features wasn't called, for example:
      
      1. ethtool -k eth0
         large-receive-offload: off
      2. ethtool -K eth0 rx-fcs on
      3. ethtool -K eth0 lro on
         Could not change any device features
         rx-lro: off [requested on]
      4. ethtool -K eth0 lro on
         # The output should be the same, but without this patch the kernel
         # doesn't send the reply, and ethtool is unable to detect the error.
      
      This commit makes ethtool-netlink always return a reply when requested,
      and it still avoids unnecessary calls to __netdev_update_features if the
      wanted features haven't changed.
      
      Fixes: 0980bfcd ("ethtool: set netdev features with FEATURES_SET request")
      Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@mellanox.com>
      Reviewed-by: default avatarMichal Kubecek <mkubecek@suse.cz>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f01204ec
    • Maxim Mikityanskiy's avatar
      ethtool: Account for hw_features in netlink interface · 2847bfed
      Maxim Mikityanskiy authored
      ethtool-netlink ignores dev->hw_features and may confuse the drivers by
      asking them to enable features not in the hw_features bitmask. For
      example:
      
      1. ethtool -k eth0
         tls-hw-tx-offload: off [fixed]
      2. ethtool -K eth0 tls-hw-tx-offload on
         tls-hw-tx-offload: on
      3. ethtool -k eth0
         tls-hw-tx-offload: on [fixed]
      
      Fitler out dev->hw_features from req_wanted to fix it and to resemble
      the legacy ethtool behavior.
      
      Fixes: 0980bfcd ("ethtool: set netdev features with FEATURES_SET request")
      Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@mellanox.com>
      Reviewed-by: default avatarMichal Kubecek <mkubecek@suse.cz>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2847bfed
    • Maxim Mikityanskiy's avatar
      ethtool: Fix preserving of wanted feature bits in netlink interface · 840110a4
      Maxim Mikityanskiy authored
      Currently, ethtool-netlink calculates new wanted bits as:
      (req_wanted & req_mask) | (old_active & ~req_mask)
      
      It completely discards the old wanted bits, so they are forgotten with
      the next ethtool command. Sample steps to reproduce:
      
      1. ethtool -k eth0
         tx-tcp-segmentation: on # TSO is on from the beginning
      2. ethtool -K eth0 tx off
         tx-tcp-segmentation: off [not requested]
      3. ethtool -k eth0
         tx-tcp-segmentation: off [requested on]
      4. ethtool -K eth0 rx off # Some change unrelated to TSO
      5. ethtool -k eth0
         tx-tcp-segmentation: off # "Wanted on" is forgotten
      
      This commit fixes it by changing the formula to:
      (req_wanted & req_mask) | (old_wanted & ~req_mask),
      where old_active was replaced by old_wanted to account for the wanted
      bits.
      
      The shortcut condition for the case where nothing was changed now
      compares wanted bitmasks, instead of wanted to active.
      
      Fixes: 0980bfcd ("ethtool: set netdev features with FEATURES_SET request")
      Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@mellanox.com>
      Reviewed-by: default avatarMichal Kubecek <mkubecek@suse.cz>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      840110a4
    • Xin Long's avatar
      ipv6: some fixes for ipv6_dev_find() · 4ef1a7cb
      Xin Long authored
      This patch is to do 3 things for ipv6_dev_find():
      
        As David A. noticed,
      
        - rt6_lookup() is not really needed. Different from __ip_dev_find(),
          ipv6_dev_find() doesn't have a compatibility problem, so remove it.
      
        As Hideaki suggested,
      
        - "valid" (non-tentative) check for the address is also needed.
          ipv6_chk_addr() calls ipv6_chk_addr_and_flags(), which will
          traverse the address hash list, but it's heavy to be called
          inside ipv6_dev_find(). This patch is to reuse the code of
          ipv6_chk_addr_and_flags() for ipv6_dev_find().
      
        - dev parameter is passed into ipv6_dev_find(), as link-local
          addresses from user space has sin6_scope_id set and the dev
          lookup needs it.
      
      Fixes: 81f6cb31 ("ipv6: add ipv6_dev_find()")
      Suggested-by: default avatarYOSHIFUJI Hideaki <hideaki.yoshifuji@miraclelinux.com>
      Reported-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4ef1a7cb
    • Jiri Wiesner's avatar
      bonding: fix active-backup failover for current ARP slave · 0410d071
      Jiri Wiesner authored
      When the ARP monitor is used for link detection, ARP replies are
      validated for all slaves (arp_validate=3) and fail_over_mac is set to
      active, two slaves of an active-backup bond may get stuck in a state
      where both of them are active and pass packets that they receive to
      the bond. This state makes IPv6 duplicate address detection fail. The
      state is reached thus:
      1. The current active slave goes down because the ARP target
         is not reachable.
      2. The current ARP slave is chosen and made active.
      3. A new slave is enslaved. This new slave becomes the current active
         slave and can reach the ARP target.
      As a result, the current ARP slave stays active after the enslave
      action has finished and the log is littered with "PROBE BAD" messages:
      > bond0: PROBE: c_arp ens10 && cas ens11 BAD
      The workaround is to remove the slave with "going back" status from
      the bond and re-enslave it. This issue was encountered when DPDK PMD
      interfaces were being enslaved to an active-backup bond.
      
      I would be possible to fix the issue in bond_enslave() or
      bond_change_active_slave() but the ARP monitor was fixed instead to
      keep most of the actions changing the current ARP slave in the ARP
      monitor code. The current ARP slave is set as inactive and backup
      during the commit phase. A new state, BOND_LINK_FAIL, has been
      introduced for slaves in the context of the ARP monitor. This allows
      administrators to see how slaves are rotated for sending ARP requests
      and attempts are made to find a new active slave.
      
      Fixes: b2220cad ("bonding: refactor ARP active-backup monitor")
      Signed-off-by: default avatarJiri Wiesner <jwiesner@suse.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0410d071
    • Miaohe Lin's avatar
      net: handle the return value of pskb_carve_frag_list() correctly · eabe8618
      Miaohe Lin authored
      pskb_carve_frag_list() may return -ENOMEM in pskb_carve_inside_nonlinear().
      we should handle this correctly or we would get wrong sk_buff.
      
      Fixes: 6fa01ccd ("skbuff: Add pskb_extract() helper function")
      Signed-off-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      eabe8618
    • Sumera Priyadarsini's avatar
      net: gianfar: Add of_node_put() before goto statement · 989e4da0
      Sumera Priyadarsini authored
      Every iteration of for_each_available_child_of_node() decrements
      reference count of the previous node, however when control
      is transferred from the middle of the loop, as in the case of
      a return or break or goto, there is no decrement thus ultimately
      resulting in a memory leak.
      
      Fix a potential memory leak in gianfar.c by inserting of_node_put()
      before the goto statement.
      
      Issue found with Coccinelle.
      Signed-off-by: default avatarSumera Priyadarsini <sylphrenadin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      989e4da0
    • David S. Miller's avatar
      Merge branch 'cxgb4-Fix-ethtool-selftest-flits-calculation' · 5680790b
      David S. Miller authored
      Ganji Aravind says:
      
      ====================
      cxgb4: Fix ethtool selftest flits calculation
      
      Patch 1 will fix work request size calculation for loopback selftest.
      
      Patch 2 will fix race between loopback selftest and normal Tx handler.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5680790b
    • Ganji Aravind's avatar
      cxgb4: Fix race between loopback and normal Tx path · c650e048
      Ganji Aravind authored
      Even after Tx queues are marked stopped, there exists a
      small window where the current packet in the normal Tx
      path is still being sent out and loopback selftest ends
      up corrupting the same Tx ring. So, ensure selftest takes
      the Tx lock to synchronize access the Tx ring.
      
      Fixes: 7235ffae ("cxgb4: add loopback ethtool self-test")
      Signed-off-by: default avatarGanji Aravind <ganji.aravind@chelsio.com>
      Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c650e048
    • Ganji Aravind's avatar
      cxgb4: Fix work request size calculation for loopback test · 33595642
      Ganji Aravind authored
      Work request used for sending loopback packet needs to add
      the firmware work request only once. So, fix by using
      correct structure size.
      
      Fixes: 7235ffae ("cxgb4: add loopback ethtool self-test")
      Signed-off-by: default avatarGanji Aravind <ganji.aravind@chelsio.com>
      Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      33595642
    • David S. Miller's avatar
      Merge branch 'sfc-more-EF100-fixes' · ab97a289
      David S. Miller authored
      Edward Cree says:
      
      ====================
      sfc: more EF100 fixes
      
      Fix up some bugs in the initial EF100 submission, and re-fix
       the hash_valid fix which was incomplete.
      
      The reset bugs are currently hard to trigger; they were found
       with an in-progress patch adding ethtool support, whereby
       ethtool --reset reliably reproduces them.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ab97a289
    • Edward Cree's avatar
      sfc: don't free_irq()s if they were never requested · e6a43910
      Edward Cree authored
      If efx_nic_init_interrupt fails, or was never run (e.g. due to an earlier
       failure in ef100_net_open), freeing irqs in efx_nic_fini_interrupt is not
       needed and will cause error messages and stack traces.
      So instead, only do this if efx_nic_init_interrupt successfully completed,
       as indicated by the new efx->irqs_hooked flag.
      
      Fixes: 965b549f ("sfc_ef100: implement ndo_open/close and EVQ probing")
      Signed-off-by: default avatarEdward Cree <ecree@solarflare.com>
      Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e6a43910
    • Edward Cree's avatar
      sfc: null out channel->rps_flow_id after freeing it · 788f920a
      Edward Cree authored
      If an ef100_net_open() fails, ef100_net_stop() may be called without
       channel->rps_flow_id having been written; thus it may hold the address
       freed by a previous ef100_net_stop()'s call to efx_remove_filters().
       This then causes a double-free when efx_remove_filters() is called
       again, leading to a panic.
      To prevent this, after freeing it, overwrite it with NULL.
      
      Fixes: a9dc3d56 ("sfc_ef100: RX filter table management and related gubbins")
      Signed-off-by: default avatarEdward Cree <ecree@solarflare.com>
      Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      788f920a
    • Edward Cree's avatar
      sfc: take correct lock in ef100_reset() · 9cbbc451
      Edward Cree authored
      When downing and upping the ef100 filter table, we need to take a write
       lock on efx->filter_sem, not just a read lock, because we may kfree()
       the table pointers.
      Without this, resets cause a WARN_ON from efx_rwsem_assert_write_locked().
      
      Fixes: a9dc3d56 ("sfc_ef100: RX filter table management and related gubbins")
      Signed-off-by: default avatarEdward Cree <ecree@solarflare.com>
      Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9cbbc451
    • Edward Cree's avatar
      sfc: really check hash is valid before using it · db06ea34
      Edward Cree authored
      Actually hook up the .rx_buf_hash_valid method in EF100's nic_type.
      
      Fixes: 06888543 ("sfc: check hash is valid before using it")
      Reported-by: default avatarMartin Habets <mhabets@solarflare.com>
      Signed-off-by: default avatarEdward Cree <ecree@solarflare.com>
      Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      db06ea34
    • Alvin Šipraga's avatar
      macvlan: validate setting of multiple remote source MAC addresses · 8b61fba5
      Alvin Šipraga authored
      Remote source MAC addresses can be set on a 'source mode' macvlan
      interface via the IFLA_MACVLAN_MACADDR_DATA attribute. This commit
      tightens the validation of these MAC addresses to match the validation
      already performed when setting or adding a single MAC address via the
      IFLA_MACVLAN_MACADDR attribute.
      
      iproute2 uses IFLA_MACVLAN_MACADDR_DATA for its 'macvlan macaddr set'
      command, and IFLA_MACVLAN_MACADDR for its 'macvlan macaddr add' command,
      which demonstrates the inconsistent behaviour that this commit
      addresses:
      
       # ip link add link eth0 name macvlan0 type macvlan mode source
       # ip link set link dev macvlan0 type macvlan macaddr add 01:00:00:00:00:00
       RTNETLINK answers: Cannot assign requested address
       # ip link set link dev macvlan0 type macvlan macaddr set 01:00:00:00:00:00
       # ip -d link show macvlan0
       5: macvlan0@eth0: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 ...
           link/ether 2e:ac:fd:2d:69:f8 brd ff:ff:ff:ff:ff:ff promiscuity 0
           macvlan mode source remotes (1) 01:00:00:00:00:00 numtxqueues 1 ...
      
      With this change, the 'set' command will (rightly) fail in the same way
      as the 'add' command.
      Signed-off-by: default avatarAlvin Šipraga <alsi@bang-olufsen.dk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8b61fba5
    • Linus Torvalds's avatar
      Merge tag 'pstore-v5.9-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · 06a4ec1d
      Linus Torvalds authored
      Pull mailmap update from Kees Cook:
       "This was originally part of my pstore tree, but when I realized that
        mailmap needed re-alphabetizing, I decided to wait until -rc1 to send
        this, as I saw a lot of mailmap additions pending in -next for the
        merge window.
      
        It's a programmatic reordering and the addition of a pstore
        contributor's preferred email address"
      
      * tag 'pstore-v5.9-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        mailmap: Add WeiXiong Liao
        mailmap: Restore dictionary sorting
      06a4ec1d
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 4cf75621
      Linus Torvalds authored
      Pull networking fixes from David Miller:
       "Another batch of fixes:
      
        1) Remove nft_compat counter flush optimization, it generates warnings
           from the refcount infrastructure. From Florian Westphal.
      
        2) Fix BPF to search for build id more robustly, from Jiri Olsa.
      
        3) Handle bogus getopt lengths in ebtables, from Florian Westphal.
      
        4) Infoleak and other fixes to j1939 CAN driver, from Eric Dumazet and
           Oleksij Rempel.
      
        5) Reset iter properly on mptcp sendmsg() error, from Florian
           Westphal.
      
        6) Show a saner speed in bonding broadcast mode, from Jarod Wilson.
      
        7) Various kerneldoc fixes in bonding and elsewhere, from Lee Jones.
      
        8) Fix double unregister in bonding during namespace tear down, from
           Cong Wang.
      
        9) Disable RP filter during icmp_redirect selftest, from David Ahern"
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (75 commits)
        otx2_common: Use devm_kcalloc() in otx2_config_npa()
        net: qrtr: fix usage of idr in port assignment to socket
        selftests: disable rp_filter for icmp_redirect.sh
        Revert "net: xdp: pull ethernet header off packet after computing skb->protocol"
        phylink: <linux/phylink.h>: fix function prototype kernel-doc warning
        mptcp: sendmsg: reset iter on error redux
        net: devlink: Remove overzealous WARN_ON with snapshots
        tipc: not enable tipc when ipv6 works as a module
        tipc: fix uninit skb->data in tipc_nl_compat_dumpit()
        net: Fix potential wrong skb->protocol in skb_vlan_untag()
        net: xdp: pull ethernet header off packet after computing skb->protocol
        ipvlan: fix device features
        bonding: fix a potential double-unregister
        can: j1939: add rxtimer for multipacket broadcast session
        can: j1939: abort multipacket broadcast session when timeout occurs
        can: j1939: cancel rxtimer on multipacket broadcast session complete
        can: j1939: fix support for multipacket broadcast message
        net: fddi: skfp: cfm: Remove seemingly unused variable 'ID_sccs'
        net: fddi: skfp: cfm: Remove set but unused variable 'oldstate'
        net: fddi: skfp: smt: Remove seemingly unused variable 'ID_sccs'
        ...
      4cf75621
  3. 17 Aug, 2020 12 commits
  4. 16 Aug, 2020 3 commits