1. 26 Aug, 2019 9 commits
    • 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
  2. 25 Aug, 2019 1 commit
  3. 24 Aug, 2019 13 commits
  4. 23 Aug, 2019 17 commits