Commit bc80b728 authored by Junxian Huang's avatar Junxian Huang Committed by ZhouJuan
Browse files

RDMA/hns: Simplify the slave uninit logic of RoCE bonding operations

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I6Z4E9



---------------------------------------------------------------

Currently, bond group resource is always associated to a main_hr_dev
whether bond device has been set or not. When setting bond, all slaves,
including the main_hr_dev, will be uninited. Normally, during main_hr_dev
uninit, the bond group resource is also released. However, the bond group
resource should not be released in the case of setting bond.

To avoid releasing bond group resource when setting bond, the code logic
is like:
    1. uninit a not-main_hr_dev slave
    2. register bond device, with the slave in step 1 becoming the new
       main_hr_dev
    3. uninit the original main_hr_dev.
In step 3, the slave is not current main_hr_dev any more, so during its
uninit, bond group resource will not be released. But in general, the
logic is not simple enough to understand.

This patch adds an argument 'bond_cleanup' to
__hns_roce_hw_v2_uninit_instance() in order to indicate whether bond
group resources should be released during RoCE driver uninit. During
driver uninit when setting bond or clearing bond, 'bond_cleanup' is false;
when RoCE driver kernel object is being removed , 'bond_cleanup' is true.

With this change and the previous patch, bonding operations including
bond setting, bond clearing and decreasing slave do not have to concern
about avoiding releasing bond_grp when uniniting hr_dev. The uninit
order is simplified to a more intuitive one: simply uninit all slaves and
then register the bond device.

Signed-off-by: default avatarJunxian Huang <huangjunxian6@hisilicon.com>
parent 9003ac2a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment