1. 27 Aug, 2019 3 commits
  2. 26 Aug, 2019 15 commits
    • Heiner Kallweit's avatar
      r8169: improve DMA handling in rtl_rx · 3c95e501
      Heiner Kallweit authored
      Move the call to dma_sync_single_for_cpu after calling napi_alloc_skb.
      This avoids calling dma_sync_single_for_cpu w/o handing control back
      to device if the memory allocation should fail.
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3c95e501
    • David S. Miller's avatar
      Merge branch 'cls-hw-offload-rtnl' · 72991b56
      David S. Miller authored
      Vlad Buslov says:
      
      ====================
      Refactor cls hardware offload API to support rtnl-independent drivers
      
      Currently, all cls API hardware offloads driver callbacks require caller
      to hold rtnl lock when calling them. This patch set introduces new API
      that allows drivers to register callbacks that are not dependent on rtnl
      lock and unlocked classifiers to offload filters without obtaining rtnl
      lock first, which is intended to allow offloading tc rules in parallel.
      
      Recently, new rtnl registration flag RTNL_FLAG_DOIT_UNLOCKED was added.
      TC rule update handlers (RTM_NEWTFILTER, RTM_DELTFILTER, etc.) are
      already registered with this flag and only take rtnl lock when qdisc or
      classifier requires it. Classifiers can indicate that their ops
      callbacks don't require caller to hold rtnl lock by setting the
      TCF_PROTO_OPS_DOIT_UNLOCKED flag. Unlocked implementation of flower
      classifier is now upstreamed. However, this implementation still obtains
      rtnl lock before calling hardware offloads API.
      
      Implement following cls API changes:
      
      - Introduce new "unlocked_driver_cb" flag to struct flow_block_offload
        to allow registering and unregistering block hardware offload
        callbacks that do not require caller to hold rtnl lock. Drivers that
        doesn't require users of its tc offload callbacks to hold rtnl lock
        sets the flag to true on block bind/unbind. Internally tcf_block is
        extended with additional lockeddevcnt counter that is used to count
        number of devices that require rtnl lock that block is bound to. When
        this counter is zero, tc_setup_cb_*() functions execute callbacks
        without obtaining rtnl lock.
      
      - Extend cls API single hardware rule update tc_setup_cb_call() function
        with tc_setup_cb_add(), tc_setup_cb_replace(), tc_setup_cb_destroy()
        and tc_setup_cb_reoffload() functions. These new APIs are needed to
        move management of block offload counter, filter in hardware counter
        and flag from classifier implementations to cls API, which is now
        responsible for managing them in concurrency-safe manner. Access to
        cb_list from callback execution code is synchronized by obtaining new
        'cb_lock' rw_semaphore in read mode, which allows executing callbacks
        in parallel, but excludes any modifications of data from
        register/unregister code. tcf_block offloads counter type is changed
        to atomic integer to allow updating the counter concurrently.
      
      - Extend classifier ops with new ops->hw_add() and ops->hw_del()
        callbacks which are used to notify unlocked classifiers when filter is
        successfully added or deleted to hardware without releasing cb_lock.
        This is necessary to update classifier state atomically with callback
        list traversal and updating of all relevant counters and allows
        unlocked classifiers to synchronize with concurrent reoffload without
        requiring any changes to driver callback API implementations.
      
      New tc flow_action infrastructure is also modified to allow its user to
      execute without rtnl lock protection. Function tc_setup_flow_action() is
      modified to conditionally obtain rtnl lock before accessing action
      state. Action data that is accessed by reference is either copied or
      reference counted to prevent concurrent action overwrite from
      deallocating it. New function tc_cleanup_flow_action() is introduced to
      cleanup/release all such data obtained by tc_setup_flow_action().
      
      Flower classifier (only unlocked classifier at the moment) is modified
      to use new cls hardware offloads API and no longer obtains rtnl lock
      before calling it.
      ====================
      Acked-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      72991b56
    • Vlad Buslov's avatar
      net: sched: flower: don't take rtnl lock for cls hw offloads API · 918190f5
      Vlad Buslov authored
      Don't manually take rtnl lock in flower classifier before calling cls
      hardware offloads API. Instead, pass rtnl lock status via 'rtnl_held'
      parameter.
      Signed-off-by: default avatarVlad Buslov <vladbu@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      918190f5
    • Vlad Buslov's avatar
      net: sched: copy tunnel info when setting flow_action entry->tunnel · 1444c175
      Vlad Buslov authored
      In order to remove dependency on rtnl lock, modify tc_setup_flow_action()
      to copy tunnel info, instead of just saving pointer to tunnel_key action
      tunnel info. This is necessary to prevent concurrent action overwrite from
      releasing tunnel info while it is being used by rtnl-unlocked driver.
      
      Implement helper tcf_tunnel_info_copy() that is used to copy tunnel info
      with all its options to dynamically allocated memory block. Modify
      tc_cleanup_flow_action() to free dynamically allocated tunnel info.
      Signed-off-by: default avatarVlad Buslov <vladbu@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1444c175
    • Vlad Buslov's avatar
      net: sched: take reference to action dev before calling offloads · 5a6ff4b1
      Vlad Buslov authored
      In order to remove dependency on rtnl lock when calling hardware offload
      API, take reference to action mirred dev when initializing flow_action
      structure in tc_setup_flow_action(). Implement function
      tc_cleanup_flow_action(), use it to release the device after hardware
      offload API is done using it.
      Signed-off-by: default avatarVlad Buslov <vladbu@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5a6ff4b1
    • Vlad Buslov's avatar
      net: sched: take rtnl lock in tc_setup_flow_action() · 9838b20a
      Vlad Buslov authored
      In order to allow using new flow_action infrastructure from unlocked
      classifiers, modify tc_setup_flow_action() to accept new 'rtnl_held'
      argument. Take rtnl lock before accessing tc_action data. This is necessary
      to protect from concurrent action replace.
      Signed-off-by: default avatarVlad Buslov <vladbu@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9838b20a
    • Vlad Buslov's avatar
      net: sched: conditionally obtain rtnl lock in cls hw offloads API · 11bd634d
      Vlad Buslov authored
      In order to remove dependency on rtnl lock from offloads code of
      classifiers, take rtnl lock conditionally before executing driver
      callbacks. Only obtain rtnl lock if block is bound to devices that require
      it.
      
      Block bind/unbind code is rtnl-locked and obtains block->cb_lock while
      holding rtnl lock. Obtain locks in same order in tc_setup_cb_*() functions
      to prevent deadlock.
      Signed-off-by: default avatarVlad Buslov <vladbu@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      11bd634d
    • Vlad Buslov's avatar
      net: sched: add API for registering unlocked offload block callbacks · c9f14470
      Vlad Buslov authored
      Extend struct flow_block_offload with "unlocked_driver_cb" flag to allow
      registering and unregistering block hardware offload callbacks that do not
      require caller to hold rtnl lock. Extend tcf_block with additional
      lockeddevcnt counter that is incremented for each non-unlocked driver
      callback attached to device. This counter is necessary to conditionally
      obtain rtnl lock before calling hardware callbacks in following patches.
      
      Register mlx5 tc block offload callbacks as "unlocked".
      Signed-off-by: default avatarVlad Buslov <vladbu@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c9f14470
    • Vlad Buslov's avatar
      net: sched: notify classifier on successful offload add/delete · a449a3e7
      Vlad Buslov authored
      To remove dependency on rtnl lock, extend classifier ops with new
      ops->hw_add() and ops->hw_del() callbacks. Call them from cls API while
      holding cb_lock every time filter if successfully added to or deleted from
      hardware.
      
      Implement the new API in flower classifier. Use it to manage hw_filters
      list under cb_lock protection, instead of relying on rtnl lock to
      synchronize with concurrent fl_reoffload() call.
      Signed-off-by: default avatarVlad Buslov <vladbu@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a449a3e7
    • Vlad Buslov's avatar
      net: sched: refactor block offloads counter usage · 40119211
      Vlad Buslov authored
      Without rtnl lock protection filters can no longer safely manage block
      offloads counter themselves. Refactor cls API to protect block offloadcnt
      with tcf_block->cb_lock that is already used to protect driver callback
      list and nooffloaddevcnt counter. The counter can be modified by concurrent
      tasks by new functions that execute block callbacks (which is safe with
      previous patch that changed its type to atomic_t), however, block
      bind/unbind code that checks the counter value takes cb_lock in write mode
      to exclude any concurrent modifications. This approach prevents race
      conditions between bind/unbind and callback execution code but allows for
      concurrency for tc rule update path.
      
      Move block offload counter, filter in hardware counter and filter flags
      management from classifiers into cls hardware offloads API. Make functions
      tcf_block_offload_{inc|dec}() and tc_cls_offload_cnt_update() to be cls API
      private. Implement following new cls API to be used instead:
      
        tc_setup_cb_add() - non-destructive filter add. If filter that wasn't
        already in hardware is successfully offloaded, increment block offloads
        counter, set filter in hardware counter and flag. On failure, previously
        offloaded filter is considered to be intact and offloads counter is not
        decremented.
      
        tc_setup_cb_replace() - destructive filter replace. Release existing
        filter block offload counter and reset its in hardware counter and flag.
        Set new filter in hardware counter and flag. On failure, previously
        offloaded filter is considered to be destroyed and offload counter is
        decremented.
      
        tc_setup_cb_destroy() - filter destroy. Unconditionally decrement block
        offloads counter.
      
        tc_setup_cb_reoffload() - reoffload filter to single cb. Execute cb() and
        call tc_cls_offload_cnt_update() if cb() didn't return an error.
      
      Refactor all offload-capable classifiers to atomically offload filters to
      hardware, change block offload counter, and set filter in hardware counter
      and flag by means of the new cls API functions.
      Signed-off-by: default avatarVlad Buslov <vladbu@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      40119211
    • Vlad Buslov's avatar
      net: sched: change tcf block offload counter type to atomic_t · 97394bef
      Vlad Buslov authored
      As a preparation for running proto ops functions without rtnl lock, change
      offload counter type to atomic. This is necessary to allow updating the
      counter by multiple concurrent users when offloading filters to hardware
      from unlocked classifiers.
      Signed-off-by: default avatarVlad Buslov <vladbu@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      97394bef
    • Vlad Buslov's avatar
      net: sched: protect block offload-related fields with rw_semaphore · 4f8116c8
      Vlad Buslov authored
      In order to remove dependency on rtnl lock, extend tcf_block with 'cb_lock'
      rwsem and use it to protect flow_block->cb_list and related counters from
      concurrent modification. The lock is taken in read mode for read-only
      traversal of cb_list in tc_setup_cb_call() and write mode in all other
      cases. This approach ensures that:
      
      - cb_list is not changed concurrently while filters is being offloaded on
        block.
      
      - block->nooffloaddevcnt is checked while holding the lock in read mode,
        but is only changed by bind/unbind code when holding the cb_lock in write
        mode to prevent concurrent modification.
      Signed-off-by: default avatarVlad Buslov <vladbu@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4f8116c8
    • YueHaibing's avatar
      cirrus: cs89x0: remove set but not used variable 'lp' · 0846e161
      YueHaibing authored
      Fixes gcc '-Wunused-but-set-variable' warning:
      
      drivers/net/ethernet/cirrus/cs89x0.c: In function 'cs89x0_platform_probe':
      drivers/net/ethernet/cirrus/cs89x0.c:1847:20: warning:
       variable 'lp' set but not used [-Wunused-but-set-variable]
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Fixes: 6751edeb ("cirrus: cs89x0: Use managed interfaces")
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0846e161
    • David S. Miller's avatar
      Revert "net: mediatek: remove set but not used variable 'status'" · 28894564
      David S. Miller authored
      This reverts commit ee641b0c.
      
      Actually it is not clear whether this register read is not
      needed for it's HW side effects or not.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      28894564
    • Mao Wenan's avatar
      net: mediatek: remove set but not used variable 'status' · ee641b0c
      Mao Wenan authored
      Fixes gcc '-Wunused-but-set-variable' warning:
      drivers/net/ethernet/mediatek/mtk_eth_soc.c: In function mtk_handle_irq:
      drivers/net/ethernet/mediatek/mtk_eth_soc.c:1951:6: warning: variable status set but not used [-Wunused-but-set-variable]
      
      Fixes: 296c9120 ("net: ethernet: mediatek: Add MT7628/88 SoC support")
      Signed-off-by: default avatarMao Wenan <maowenan@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ee641b0c
  3. 25 Aug, 2019 1 commit
  4. 24 Aug, 2019 13 commits
  5. 23 Aug, 2019 8 commits
    • Heiner Kallweit's avatar
      r8169: fix DMA issue on MIPS platform · d4ed7463
      Heiner Kallweit authored
      As reported by Aaro this patch causes network problems on
      MIPS Loongson platform. Therefore revert it.
      
      Fixes: f072218c ("r8169: remove not needed call to dma_sync_single_for_device")
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Reported-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d4ed7463
    • Ido Schimmel's avatar
      drop_monitor: Make timestamps y2038 safe · bd1200b7
      Ido Schimmel authored
      Timestamps are currently communicated to user space as 'struct
      timespec', which is not considered y2038 safe since it uses a 32-bit
      signed value for seconds.
      
      Fix this while the API is still not part of any official kernel release
      by using 64-bit nanoseconds timestamps instead.
      
      Fixes: ca30707d ("drop_monitor: Add packet alert mode")
      Fixes: 5e58109b ("drop_monitor: Add support for packet alert mode for hardware drops")
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bd1200b7
    • Dag Moxnes's avatar
      net/rds: Whitelist rdma_cookie and rx_tstamp for usercopy · bf1867db
      Dag Moxnes authored
      Add the RDMA cookie and RX timestamp to the usercopy whitelist.
      
      After the introduction of hardened usercopy whitelisting
      (https://lwn.net/Articles/727322/), a warning is displayed when the
      RDMA cookie or RX timestamp is copied to userspace:
      
      kernel: WARNING: CPU: 3 PID: 5750 at
      mm/usercopy.c:81 usercopy_warn+0x8e/0xa6
      [...]
      kernel: Call Trace:
      kernel: __check_heap_object+0xb8/0x11b
      kernel: __check_object_size+0xe3/0x1bc
      kernel: put_cmsg+0x95/0x115
      kernel: rds_recvmsg+0x43d/0x620 [rds]
      kernel: sock_recvmsg+0x43/0x4a
      kernel: ___sys_recvmsg+0xda/0x1e6
      kernel: ? __handle_mm_fault+0xcae/0xf79
      kernel: __sys_recvmsg+0x51/0x8a
      kernel: SyS_recvmsg+0x12/0x1c
      kernel: do_syscall_64+0x79/0x1ae
      
      When the whitelisting feature was introduced, the memory for the RDMA
      cookie and RX timestamp in RDS was not added to the whitelist, causing
      the warning above.
      Signed-off-by: default avatarDag Moxnes <dag.moxnes@oracle.com>
      Tested-by: default avatarJenny <jenny.x.xu@oracle.com>
      Acked-by: default avatarSantosh Shilimkar <santosh.shilimkar@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bf1867db
    • Eran Ben Elisha's avatar
      net/mlx5: Fix return code in case of hyperv wrong size read · 87cade29
      Eran Ben Elisha authored
      Return code value could be non deterministic in case of wrong size read.
      With this patch, if such error occurs, set rc to be -EIO.
      
      In addition, mlx5_hv_config_common() supports reading of
      HV_CONFIG_BLOCK_SIZE_MAX bytes only, fix to early return error with
      bad input.
      
      Fixes: 913d14e8 ("net/mlx5: Add wrappers for HyperV PCIe operations")
      Reported-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarEran Ben Elisha <eranbe@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      87cade29
    • Xin Long's avatar
      net: ipv6: fix listify ip6_rcv_finish in case of forwarding · c7a42eb4
      Xin Long authored
      We need a similar fix for ipv6 as Commit 0761680d ("net: ipv4: fix
      listify ip_rcv_finish in case of forwarding") does for ipv4.
      
      This issue can be reprocuded by syzbot since Commit 323ebb61 ("net:
      use listified RX for handling GRO_NORMAL skbs") on net-next. The call
      trace was:
      
        kernel BUG at include/linux/skbuff.h:2225!
        RIP: 0010:__skb_pull include/linux/skbuff.h:2225 [inline]
        RIP: 0010:skb_pull+0xea/0x110 net/core/skbuff.c:1902
        Call Trace:
          sctp_inq_pop+0x2f1/0xd80 net/sctp/inqueue.c:202
          sctp_endpoint_bh_rcv+0x184/0x8d0 net/sctp/endpointola.c:385
          sctp_inq_push+0x1e4/0x280 net/sctp/inqueue.c:80
          sctp_rcv+0x2807/0x3590 net/sctp/input.c:256
          sctp6_rcv+0x17/0x30 net/sctp/ipv6.c:1049
          ip6_protocol_deliver_rcu+0x2fe/0x1660 net/ipv6/ip6_input.c:397
          ip6_input_finish+0x84/0x170 net/ipv6/ip6_input.c:438
          NF_HOOK include/linux/netfilter.h:305 [inline]
          NF_HOOK include/linux/netfilter.h:299 [inline]
          ip6_input+0xe4/0x3f0 net/ipv6/ip6_input.c:447
          dst_input include/net/dst.h:442 [inline]
          ip6_sublist_rcv_finish+0x98/0x1e0 net/ipv6/ip6_input.c:84
          ip6_list_rcv_finish net/ipv6/ip6_input.c:118 [inline]
          ip6_sublist_rcv+0x80c/0xcf0 net/ipv6/ip6_input.c:282
          ipv6_list_rcv+0x373/0x4b0 net/ipv6/ip6_input.c:316
          __netif_receive_skb_list_ptype net/core/dev.c:5049 [inline]
          __netif_receive_skb_list_core+0x5fc/0x9d0 net/core/dev.c:5097
          __netif_receive_skb_list net/core/dev.c:5149 [inline]
          netif_receive_skb_list_internal+0x7eb/0xe60 net/core/dev.c:5244
          gro_normal_list.part.0+0x1e/0xb0 net/core/dev.c:5757
          gro_normal_list net/core/dev.c:5755 [inline]
          gro_normal_one net/core/dev.c:5769 [inline]
          napi_frags_finish net/core/dev.c:5782 [inline]
          napi_gro_frags+0xa6a/0xea0 net/core/dev.c:5855
          tun_get_user+0x2e98/0x3fa0 drivers/net/tun.c:1974
          tun_chr_write_iter+0xbd/0x156 drivers/net/tun.c:2020
      
      Fixes: d8269e2c ("net: ipv6: listify ipv6_rcv() and ip6_rcv_finish()")
      Fixes: 323ebb61 ("net: use listified RX for handling GRO_NORMAL skbs")
      Reported-by: syzbot+eb349eeee854e389c36d@syzkaller.appspotmail.com
      Reported-by: syzbot+4a0643a653ac375612d1@syzkaller.appspotmail.com
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Acked-by: default avatarEdward Cree <ecree@solarflare.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c7a42eb4
    • David S. Miller's avatar
      Merge branch 'r8152-save-EEE' · aa19d1f1
      David S. Miller authored
      Hayes Wang says:
      
      ====================
      r8152: save EEE
      
      v4:
      For patch #2, remove redundant calling of "ocp_reg_write(tp, OCP_EEE_ADV, 0)".
      
      v3:
      For patch #2, fix the mistake caused by copying and pasting.
      
      v2:
      Adjust patch #1. The EEE has been disabled in the beginning of
      r8153_hw_phy_cfg() and r8153b_hw_phy_cfg(), so only check if
      it is necessary to enable EEE.
      
      Add the patch #2 for the helper function.
      
      v1:
      Saving the settings of EEE to avoid they become the default settings
      after reset_resume().
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      aa19d1f1
    • Hayes Wang's avatar
      r8152: add a helper function about setting EEE · e7bde56b
      Hayes Wang authored
      Add a helper function "rtl_eee_enable" for setting EEE. Besides, I
      move r8153_eee_en() and r8153b_eee_en(). And, I remove r8152b_enable_eee(),
      r8153_set_eee(), and r8153b_set_eee().
      Signed-off-by: default avatarHayes Wang <hayeswang@realtek.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e7bde56b
    • Hayes Wang's avatar
      r8152: saving the settings of EEE · f4a93be6
      Hayes Wang authored
      Saving the settings of EEE to avoid they become the default settings
      after reset_resume().
      Signed-off-by: default avatarHayes Wang <hayeswang@realtek.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f4a93be6