From nobody Fri Dec 19 18:43:09 2025 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3533A17CA02; Tue, 13 Aug 2024 14:16:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723558609; cv=none; b=IAUl6yVT92n7P+YPmvUPPLZPgaCor8e6xxa6zfLJiVAdYuZDvZTihj+jCIL47Xfn2HnXfHJrklod7CHtfl3GSJcPjcCtGbSM1kf43FQxobWYxhr+GY/l7ayDkfRikexechEd92y3oYoeiKpWRJL14DSDEF6CPZur8KwHzOZAIwU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723558609; c=relaxed/simple; bh=4Bmthb8F8UJB1nnEpKaWxpLVkOm4zy28gVnmbc1oFUA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pVnKEIS4Vah+1ah7bs2cZFAgzvMiIU6kWmxSVQC5205rVFqVHeczF23WJkvEFD56msQPE3gQneGm6eSgtIxDJIjzxfYVFtTOjAdZqzIEpgCQC5UYFT51W5j3LtegPtZQn8hyDncODba7bOtohoq69SGC9K+gpxvn5Tq4HrOi8G4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.190 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4WjtcB0TNsz2CmNl; Tue, 13 Aug 2024 22:11:54 +0800 (CST) Received: from kwepemm000007.china.huawei.com (unknown [7.193.23.189]) by mail.maildlp.com (Postfix) with ESMTPS id EC4B71A0188; Tue, 13 Aug 2024 22:16:44 +0800 (CST) Received: from localhost.localdomain (10.90.30.45) by kwepemm000007.china.huawei.com (7.193.23.189) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Tue, 13 Aug 2024 22:16:44 +0800 From: Jijie Shao To: , , , , , , CC: , , , , , , , , Subject: [PATCH net 3/5] net: hns3: fix a deadlock problem when config TC during resetting Date: Tue, 13 Aug 2024 22:10:22 +0800 Message-ID: <20240813141024.1707252-4-shaojijie@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20240813141024.1707252-1-shaojijie@huawei.com> References: <20240813141024.1707252-1-shaojijie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm000007.china.huawei.com (7.193.23.189) From: Jie Wang When config TC during the reset process, may cause a deadlock, the flow is as below: pf reset start =E2=94=82 =E2=96=BC ...... setup tc =E2=94=82 =E2=94=82 =E2=96=BC =E2=96=BC DOWN: napi_disable() napi_disable()(skip) =E2=94=82 =E2=94=82 =E2=94=82 =E2=96=BC =E2=96=BC ...... ...... =E2=94=82 =E2=94=82 =E2=96=BC =E2=94=82 napi_enable() =E2=94=82 =E2=96=BC UINIT: netif_napi_del() =E2=94=82 =E2=96=BC ...... =E2=94=82 =E2=96=BC INIT: netif_napi_add() =E2=94=82 =E2=96=BC ...... global reset start =E2=94=82 =E2=94=82 =E2=96=BC =E2=96=BC UP: napi_enable()(skip) ...... =E2=94=82 =E2=94=82 =E2=96=BC =E2=96=BC ...... napi_disable() In reset process, the driver will DOWN the port and then UINIT, in this case, the setup tc process will UP the port before UINIT, so cause the problem. Adds a DOWN process in UINIT to fix it. Fixes: bb6b94a896d4 ("net: hns3: Add reset interface implementation in clie= nt") Signed-off-by: Jie Wang Signed-off-by: Jijie Shao --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/= ethernet/hisilicon/hns3/hns3_enet.c index a5fc0209d628..4cbc4d069a1f 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -5724,6 +5724,9 @@ static int hns3_reset_notify_uninit_enet(struct hnae3= _handle *handle) struct net_device *netdev =3D handle->kinfo.netdev; struct hns3_nic_priv *priv =3D netdev_priv(netdev); =20 + if (!test_bit(HNS3_NIC_STATE_DOWN, &priv->state)) + hns3_nic_net_stop(netdev); + if (!test_and_clear_bit(HNS3_NIC_STATE_INITED, &priv->state)) { netdev_warn(netdev, "already uninitialized\n"); return 0; --=20 2.33.0