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

!7126 net: hns3: some bugfixes for hns3 driver

Merge Pull Request from: @chen-hao418 
 
    maillist inclusion
    category: bugfix
    bugzilla: https://gitee.com/openeuler/kernel/issues/I9NZTZ
    CVE: NA

Hao Chen:
net: hns3: revert "net: hns3: fix port vlan filter not disabled problem in dynamic vlan mode"

Yonglong Liu:
net: hns3: fix port vlan filter not disabled issue
net: hns3: fix kernel crash problem in concurrent scenario
net: hns3: fix kernel crash when devlink reload during initialization

Jie Wang:
net: hns3: add cond_resched() to hns3 ring buffer init process

PeiYang Wang:
net: hns3: using user configure after hardware reset
net: hns3: add \n at the end when print msg
net: hns3: don't need to check an unsigned number is less than 0
net: hns3: use appropriate barrier function after setting a bit value
net: hns3: set irq affinity directly
net: hns3: using cpumask_copy when set value to cpumask_t
net: hns3: change type of numa_node_mask as nodemask_t
net: hns3: release PTP resources if pf initialization failed

WangBoe2022:
net: hns3: direct return when receive a unknown mailbox message 
 
Link:https://gitee.com/openeuler/kernel/pulls/7126

 

Signed-off-by: default avatarZhang Peng <zhangpeng362@huawei.com>
parents 87cf1e37 304ea9a0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -952,7 +952,7 @@ struct hnae3_handle {
		struct hnae3_roh_private_info rohinfo;
	};

	u32 numa_node_mask;	/* for multi-chip support */
	nodemask_t numa_node_mask; /* for multi-chip support */

	enum hnae3_port_base_vlan_state port_base_vlan_state;

+5 −1
Original line number Diff line number Diff line
@@ -2688,7 +2688,7 @@ static int hns3_nic_set_features(struct net_device *netdev,
	if ((netdev->features & NETIF_F_HW_TC) > (features & NETIF_F_HW_TC) &&
	    h->ae_algo->ops->cls_flower_active(h)) {
		netdev_err(netdev,
			   "there are offloaded TC filters active, cannot disable HW TC offload");
			   "there are offloaded TC filters active, cannot disable HW TC offload\n");
		return -EINVAL;
	}

@@ -3786,6 +3786,9 @@ static int hns3_alloc_ring_buffers(struct hns3_enet_ring *ring)
		ret = hns3_alloc_and_attach_buffer(ring, i);
		if (ret)
			goto out_buffer_fail;

		if (!(i % HNS3_RESCHED_BD_NUM))
			cond_resched();
	}

	return 0;
@@ -5367,6 +5370,7 @@ int hns3_init_all_ring(struct hns3_nic_priv *priv)
		}

		u64_stats_init(&priv->ring[i].syncp);
		cond_resched();
	}

	return 0;
+2 −0
Original line number Diff line number Diff line
@@ -221,6 +221,8 @@ enum hns3_nic_state {

#define HNS3_FD_QB_FORCE_CNT_MAX		20

#define HNS3_RESCHED_BD_NUM			1024

enum hns3_pkt_l2t_type {
	HNS3_L2_TYPE_UNICAST,
	HNS3_L2_TYPE_MULTICAST,
+4 −4
Original line number Diff line number Diff line
@@ -436,7 +436,7 @@ static void hns3_self_test(struct net_device *ndev,
		data[i] = HNS3_NIC_LB_TEST_UNEXECUTED;

	if (hns3_nic_resetting(ndev)) {
		netdev_err(ndev, "dev resetting!");
		netdev_err(ndev, "dev resetting!\n");
		goto failure;
	}

@@ -868,7 +868,7 @@ static int hns3_get_link_ksettings(struct net_device *netdev,
		break;
	default:

		netdev_warn(netdev, "Unknown media type");
		netdev_warn(netdev, "Unknown media type\n");
		return 0;
	}

@@ -916,7 +916,7 @@ static int hns3_check_ksettings_param(const struct net_device *netdev,
	if (cmd->base.duplex == DUPLEX_HALF &&
	    media_type != HNAE3_MEDIA_TYPE_COPPER) {
		netdev_err(netdev,
			   "only copper port supports half duplex!");
			   "only copper port supports half duplex!\n");
		return -EINVAL;
	}

@@ -1377,7 +1377,7 @@ static int hns3_nway_reset(struct net_device *netdev)
		return 0;

	if (hns3_nic_resetting(netdev)) {
		netdev_err(netdev, "dev resetting!");
		netdev_err(netdev, "dev resetting!\n");
		return -EBUSY;
	}

+3 −10
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ static int nic_invoke_pri_ops(struct net_device *ndev, int opcode,
		return -ENODEV;

	if ((!data && length) || (data && !length)) {
		netdev_err(ndev, "failed to check data and length");
		netdev_err(ndev, "failed to check data and length\n");
		return -EINVAL;
	}

@@ -90,7 +90,7 @@ static int nic_check_pfc_storm_para(u32 dir, u32 enable, u32 period_ms,
	    period_ms > HNS3_PFC_STORM_PARA_PERIOD_MAX ||
	    recovery_period_ms < HNS3_PFC_STORM_PARA_PERIOD_MIN ||
	    recovery_period_ms > HNS3_PFC_STORM_PARA_PERIOD_MAX ||
	    times <= 0)
	    !times)
		return -EINVAL;

	return 0;
@@ -255,14 +255,7 @@ int nic_set_cpu_affinity(struct net_device *ndev, cpumask_t *affinity_mask)
		if (tqp_vector->irq_init_flag != HNS3_VECTOR_INITED)
			continue;

		tqp_vector->affinity_mask = *affinity_mask;

		ret = irq_set_affinity_hint(tqp_vector->vector_irq, NULL);
		if (ret) {
			netdev_err(ndev,
				   "failed to reset affinity hint, ret = %d\n", ret);
			goto err_unlock;
		}
		cpumask_copy(&tqp_vector->affinity_mask, affinity_mask);

		ret = irq_set_affinity_hint(tqp_vector->vector_irq,
					    &tqp_vector->affinity_mask);
Loading