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

!3413 Backport bugfixes for hns

Merge Pull Request from: @stinft 
 
Upload four patches.
Juan Zhou (2):
   RDMA/hns: Fix missing parameter check in set_write_notify_param()
   RDMA/hns: Fix memory leak in POE debugfs
 Junxian Huang (2):
   RDMA/hns: Add cap_flag check for check_vf_support()
   RDMA/hns: Fix incorrect bond clear during slave increase event
issue:
1.https://gitee.com/openeuler/kernel/issues/I8OLBT
2.https://gitee.com/openeuler/kernel/issues/I8O0QJ
3.https://gitee.com/openeuler/kernel/issues/I8NZ4Y
4.https://gitee.com/openeuler/kernel/issues/I8N6RR 
 
Link:https://gitee.com/openeuler/kernel/pulls/3413

 

Reviewed-by: default avatarChengchang Tang <tangchengchang@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents 42d7d2ee 5b1f9a56
Loading
Loading
Loading
Loading
+16 −6
Original line number Diff line number Diff line
@@ -790,9 +790,20 @@ static struct hns_roce_bond_group *hns_roce_alloc_bond_grp(struct hns_roce_dev *
	return bond_grp;
}

static bool is_dev_bond_supported(struct hns_roce_dev *hr_dev, int bus_num)
static bool is_dev_bond_supported(struct hns_roce_bond_group *bond_grp,
				  struct net_device *net_dev, int bus_num)
{
	if (!hr_dev || !(hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_BOND))
	struct hns_roce_dev *hr_dev = hns_roce_get_hrdev_by_netdev(net_dev);

	if (!hr_dev) {
		if (bond_grp &&
		    get_netdev_bond_slave_id(net_dev, bond_grp) >= 0)
			return true;
		else
			return false;
	}

	if (!(hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_BOND))
		return false;

	if (hr_dev->is_vf || pci_num_vf(hr_dev->pci_dev) > 0)
@@ -820,10 +831,10 @@ static bool check_unlinking_bond_support(struct hns_roce_bond_group *bond_grp)
}

static bool check_linking_bond_support(struct netdev_lag_upper_info *bond_info,
				       struct hns_roce_bond_group *bond_grp,
				       struct net_device *upper_dev,
				       int bus_num)
{
	struct hns_roce_dev *hr_dev;
	struct net_device *net_dev;
	u8 slave_num = 0;

@@ -832,8 +843,7 @@ static bool check_linking_bond_support(struct netdev_lag_upper_info *bond_info,

	rcu_read_lock();
	for_each_netdev_in_bond_rcu(upper_dev, net_dev) {
		hr_dev = hns_roce_get_hrdev_by_netdev(net_dev);
		if (is_dev_bond_supported(hr_dev, bus_num)) {
		if (is_dev_bond_supported(bond_grp, net_dev, bus_num)) {
			slave_num++;
		} else {
			rcu_read_unlock();
@@ -865,7 +875,7 @@ static enum bond_support_type
		return BOND_NOT_SUPPORT;

	if (info->linking)
		support = check_linking_bond_support(info->upper_info,
		support = check_linking_bond_support(info->upper_info, bond_grp,
						     *upper_dev, bus_num);
	else
		support = check_unlinking_bond_support(bond_grp);
+3 −0
Original line number Diff line number Diff line
@@ -392,6 +392,9 @@ static int set_write_notify_param(struct hns_roce_dev *hr_dev,
			       notify_attr[attr].mem_type))
		return -EOPNOTSUPP;

	if (!hr_dev->notify_tbl || ucmd->notify_idx >= hr_dev->notify_num)
		return -EINVAL;

	hr_cq->flags |= HNS_ROCE_CQ_FLAG_NOTIFY_EN;
	hr_cq->write_notify.notify_addr =
		hr_dev->notify_tbl[ucmd->notify_idx].base_addr;
+1 −5
Original line number Diff line number Diff line
@@ -557,14 +557,10 @@ static void init_poe_ch_debugfs(struct hns_roce_dev *hr_dev, uint8_t index,
				struct dentry *parent)
{
#define POE_CH_NAME_LEN 10
	struct hns_poe_ch_debugfs *dbgfs = &hr_dev->dbgfs.poe_root.poe_ch[index];
	struct hns_roce_poe_ch *poe_ch = &hr_dev->poe_ctx.poe_ch[index];
	struct hns_poe_ch_debugfs *dbgfs;
	char name[POE_CH_NAME_LEN];

	dbgfs = kvzalloc(sizeof(*dbgfs), GFP_KERNEL);
	if (!dbgfs)
		return;

	snprintf(name, sizeof(name), "poe_%u", index);
	dbgfs->root = debugfs_create_dir(name, parent);

+2 −1
Original line number Diff line number Diff line
@@ -7650,7 +7650,8 @@ static int __hns_roce_hw_v2_init_instance(struct hnae3_handle *handle)

	hns_roce_hw_v2_get_cfg(hr_dev, handle);

	if (hr_dev->is_vf && !check_vf_support(hr_dev->pci_dev)) {
	if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_BOND &&
	    hr_dev->is_vf && !check_vf_support(hr_dev->pci_dev)) {
		ret = -EOPNOTSUPP;
		goto error_failed_roce_init;
	}