Unverified Commit cadde4a9 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!10875 Incorporate some bonding patches as follows(OLK-6.6)

Merge Pull Request from: @cxh269 
 
Incorporate some bonding patches as follows:
 
Junxian Huang (5):
   RDMA/hns: Register notifier block of bonding events in bond_grp
   RDMA/hns: Encapsulate upper event and lowerstate event handlers
   RDMA/hns: Fix UAF in clear bond printing
   RDMA/hns: Fix concurrency issue between bond work and bond event

https://gitee.com/openeuler/kernel/issues/IAH10J?from=project-issue 
 
Link:https://gitee.com/openeuler/kernel/pulls/10875

 

Reviewed-by: default avatarChengchang Tang <tangchengchang@huawei.com>
Signed-off-by: default avatarZhang Peng <zhangpeng362@huawei.com>
parents 392f26f4 1e6f603a
Loading
Loading
Loading
Loading
+507 −431

File changed.

Preview size limit exceeded, changes collapsed.

+5 −5
Original line number Diff line number Diff line
@@ -33,11 +33,10 @@ enum bond_support_type {
};

enum hns_roce_bond_state {
	HNS_ROCE_BOND_NOT_ATTACHED,
	HNS_ROCE_BOND_NOT_BONDED,
	HNS_ROCE_BOND_IS_BONDED,
	HNS_ROCE_BOND_REGISTERING,
	HNS_ROCE_BOND_SLAVE_INC,
	HNS_ROCE_BOND_SLAVE_DEC,
	HNS_ROCE_BOND_SLAVE_CHANGE_NUM,
	HNS_ROCE_BOND_SLAVE_CHANGESTATE,
};

@@ -58,7 +57,6 @@ struct hns_roce_bond_group {
	u8 active_slave_num;
	u32 slave_map;
	u32 active_slave_map;
	u32 slave_map_diff;
	u8 bond_id;
	u8 bus_num;
	struct bonding *bond;
@@ -72,6 +70,7 @@ struct hns_roce_bond_group {
	struct hns_roce_func_info bond_func_info[ROCE_BOND_FUNC_MAX];
	struct delayed_work bond_work;
	struct completion bond_work_done;
	struct notifier_block bond_nb;
};

struct hns_roce_die_info {
@@ -82,11 +81,12 @@ struct hns_roce_die_info {
int hns_roce_bond_init(struct hns_roce_dev *hr_dev);
int hns_roce_bond_event(struct notifier_block *self,
			unsigned long event, void *ptr);
int hns_roce_cleanup_bond(struct hns_roce_bond_group *bond_grp);
void hns_roce_cleanup_bond(struct hns_roce_bond_group *bond_grp);
bool hns_roce_bond_is_active(struct hns_roce_dev *hr_dev);
struct net_device *hns_roce_get_bond_netdev(struct hns_roce_dev *hr_dev);
struct hns_roce_bond_group *hns_roce_get_bond_grp(struct net_device *net_dev,
						  u8 bus_num);
bool is_bond_slave_in_reset(struct hns_roce_bond_group *bond_grp);
void hns_roce_dealloc_bond_grp(void);

#endif
+0 −1
Original line number Diff line number Diff line
@@ -1154,7 +1154,6 @@ struct hns_roce_dev {
	struct hns_roce_dev_debugfs dbgfs;
	atomic64_t *dfx_cnt;
	struct hns_roce_scc_param *scc_param;
	struct notifier_block bond_nb;

	struct list_head mtr_unfree_list; /* list of unfree mtr on this dev */
	struct mutex mtr_unfree_list_mutex; /* protect mtr_unfree_list */
+5 −4
Original line number Diff line number Diff line
@@ -2385,6 +2385,9 @@ static int hns_roce_query_caps(struct hns_roce_dev *hr_dev)
	caps->flags |= le16_to_cpu(resp_d->cap_flags_ex) <<
		       HNS_ROCE_CAP_FLAGS_EX_SHIFT;

	if (hr_dev->is_vf)
		caps->flags &= ~HNS_ROCE_CAP_FLAG_BOND;

	caps->num_cqs = 1 << hr_reg_read(resp_c, PF_CAPS_C_NUM_CQS);
	caps->gid_table_len[0] = hr_reg_read(resp_c, PF_CAPS_C_MAX_GID);
	caps->max_cqes = 1 << hr_reg_read(resp_c, PF_CAPS_C_CQ_DEPTH);
@@ -7552,11 +7555,8 @@ static void hns_roce_hw_v2_uninit_instance(struct hnae3_handle *handle,
	if (handle->rinfo.instance_state == HNS_ROCE_STATE_BOND_UNINIT) {
		bond_grp = hns_roce_get_bond_grp(handle->rinfo.netdev,
						 handle->pdev->bus->number);
		if (bond_grp) {
		if (bond_grp)
			wait_for_completion(&bond_grp->bond_work_done);
			if (bond_grp->bond_state == HNS_ROCE_BOND_NOT_BONDED)
				kfree(bond_grp);
		}
	}

	if (handle->rinfo.instance_state != HNS_ROCE_STATE_INITED)
@@ -7797,6 +7797,7 @@ static int __init hns_roce_hw_v2_init(void)

static void __exit hns_roce_hw_v2_exit(void)
{
	hns_roce_dealloc_bond_grp();
	hnae3_unregister_client(&hns_roce_hw_v2_client);
	hns_roce_cleanup_debugfs();
}
+3 −1
Original line number Diff line number Diff line
@@ -856,7 +856,6 @@ static void hns_roce_unregister_device(struct hns_roce_dev *hr_dev,
	if (!(hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_BOND))
		goto normal_unregister;

	unregister_netdevice_notifier(&hr_dev->bond_nb);
	bond_grp = hns_roce_get_bond_grp(net_dev, bus_num);
	if (!bond_grp)
		goto normal_unregister;
@@ -866,7 +865,10 @@ static void hns_roce_unregister_device(struct hns_roce_dev *hr_dev,
		 * is unregistered, re-initialized the remaining slaves before
		 * the bond resources cleanup.
		 */
		cancel_delayed_work_sync(&bond_grp->bond_work);
		mutex_lock(&bond_grp->bond_mutex);
		bond_grp->bond_state = HNS_ROCE_BOND_NOT_BONDED;
		mutex_unlock(&bond_grp->bond_mutex);
		for (i = 0; i < ROCE_BOND_FUNC_MAX; i++) {
			net_dev = bond_grp->bond_func_info[i].net_dev;
			if (net_dev && net_dev != iboe->netdevs[0])