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

!11465 【olk 6.6】net: hns3: some bugfixes for netdev

Merge Pull Request from: @chen-hao418 
 
    driver inclusion
    category: bugfix
    bugzilla: https://gitee.com/openeuler/kernel/issues/IAP2LZ

    WangBoe2022:
    net: hns3: don't auto enable misc vector
    Currently, there is a time window between misc irq enabled and service task inited. If an 
    interrupte is reported at this time,it will cause warning,So don't auto enable misc vector when 
    request irq.

    net: hns3: initialize reset_timer before hclgevf_misc_irq_init()
    Currently the misc irq is initialized before reset_timer setup. But it will access the reset_timer 
    in the irq handler. So initialize the reset_timer earlier.


    Jie Wang:
    net: hns3: fix kernel crash when 1588 is sent on HIP08 devices
    Currently, HIP08 devices does not register the ptp devices, so the hdev->ptp is NULL. But the tx 
    process would still try to set hardware time stamp info with SKBTX_HW_TSTAMP flag and cause a 
    kernel crash. 
 
Link:https://gitee.com/openeuler/kernel/pulls/11465

 

Signed-off-by: default avatarZhang Peng <zhangpeng362@huawei.com>
parents 6a54b417 02554582
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
#include <linux/etherdevice.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/netdevice.h>
@@ -3828,6 +3829,7 @@ static int hclge_misc_irq_init(struct hclge_dev *hdev)
	/* this would be explicitly freed in the end */
	snprintf(hdev->misc_vector.name, HNAE3_INT_NAME_LEN, "%s-misc-%s",
		 HCLGE_NAME, pci_name(hdev->pdev));
	irq_set_status_flags(hdev->misc_vector.vector_irq, IRQ_NOAUTOEN);
	ret = request_irq(hdev->misc_vector.vector_irq, hclge_misc_irq_handle,
			  0, hdev->misc_vector.name, hdev);
	if (ret) {
@@ -12585,9 +12587,6 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)

	hclge_init_rxd_adv_layout(hdev);

	/* Enable MISC vector(vector0) */
	hclge_enable_vector(&hdev->misc_vector, true);

	ret = hclge_init_wol(hdev);
	if (ret)
		dev_warn(&pdev->dev,
@@ -12600,6 +12599,10 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
	hclge_state_init(hdev);
	hdev->last_reset_time = jiffies;

	/* Enable MISC vector(vector0) */
	enable_irq(hdev->misc_vector.vector_irq);
	hclge_enable_vector(&hdev->misc_vector, true);

	dev_info(&hdev->pdev->dev, "%s driver initialization finished.\n",
		 HCLGE_DRIVER_NAME);

@@ -13007,7 +13010,7 @@ static void hclge_uninit_ae_dev(struct hnae3_ae_dev *ae_dev)

	/* Disable MISC vector(vector0) */
	hclge_enable_vector(&hdev->misc_vector, false);
	synchronize_irq(hdev->misc_vector.vector_irq);
	disable_irq(hdev->misc_vector.vector_irq);

	/* Disable all hw interrupts */
	hclge_config_mac_tnl_int(hdev, false);
+3 −0
Original line number Diff line number Diff line
@@ -58,6 +58,9 @@ bool hclge_ptp_set_tx_info(struct hnae3_handle *handle, struct sk_buff *skb)
	struct hclge_dev *hdev = vport->back;
	struct hclge_ptp *ptp = hdev->ptp;

	if (!ptp)
		return false;

	if (!test_bit(HCLGE_PTP_FLAG_TX_EN, &ptp->flags) ||
	    test_and_set_bit(HCLGE_STATE_PTP_TX_HANDLING, &hdev->state)) {
		ptp->tx_skipped++;
+1 −1
Original line number Diff line number Diff line
@@ -2359,6 +2359,7 @@ static void hclgevf_state_init(struct hclgevf_dev *hdev)
	clear_bit(HCLGEVF_STATE_RST_FAIL, &hdev->state);

	INIT_DELAYED_WORK(&hdev->service_task, hclgevf_service_task);
	timer_setup(&hdev->reset_timer, hclgevf_reset_timer, 0);

	mutex_init(&hdev->mbx_resp.mbx_mutex);
	sema_init(&hdev->reset_sem, 1);
@@ -3063,7 +3064,6 @@ static int hclgevf_init_hdev(struct hclgevf_dev *hdev)
		 HCLGEVF_DRIVER_NAME);

	hclgevf_task_schedule(hdev, round_jiffies_relative(HZ));
	timer_setup(&hdev->reset_timer, hclgevf_reset_timer, 0);

	return 0;