linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 net-next 0/4] net: hns3: misc updates for -next
@ 2020-05-27  0:59 Huazhong Tan
  2020-05-27  0:59 ` [PATCH V2 net-next 1/4] net: hns3: add a resetting check in hclgevf_init_nic_client_instance() Huazhong Tan
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Huazhong Tan @ 2020-05-27  0:59 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-kernel, salil.mehta, yisen.zhuang, linuxarm, kuba,
	Huazhong Tan

This patchset includes some misc updates for the HNS3 ethernet driver.

#1 adds a resetting check in hclgevf_init_nic_client_instance().
#2 adds a preparatory work for RMDA VF's driver.
#3 removes some unnecessary operations in app loopback.
#4 adds an error log for debugging.

Change log:
V1->V2: removes previous patch#1 which may needs further discussion.

Guangbin Huang (1):
  net: hns3: add a resetting check in hclgevf_init_nic_client_instance()

Huazhong Tan (1):
  net: hns3: add a print for initializing CMDQ when reset pending

Yufeng Mo (2):
  net: hns3: change the order of reinitializing RoCE and NIC client
    during reset
  net: hns3: remove unnecessary MAC enable in app loopback

 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c    |  3 +++
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c   | 11 ++++-------
 drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c |  9 +++++++++
 3 files changed, 16 insertions(+), 7 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH V2 net-next 1/4] net: hns3: add a resetting check in hclgevf_init_nic_client_instance()
  2020-05-27  0:59 [PATCH V2 net-next 0/4] net: hns3: misc updates for -next Huazhong Tan
@ 2020-05-27  0:59 ` Huazhong Tan
  2020-05-27  0:59 ` [PATCH V2 net-next 2/4] net: hns3: change the order of reinitializing RoCE and NIC client during reset Huazhong Tan
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Huazhong Tan @ 2020-05-27  0:59 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-kernel, salil.mehta, yisen.zhuang, linuxarm, kuba,
	Guangbin Huang, Huazhong Tan

From: Guangbin Huang <huangguangbin2@huawei.com>

To prevent from initializing VF NIC client in reset handling state,
this patch adds resetting check in hclgevf_init_nic_client_instance().

Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
index 32341dc..59fcb80 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
@@ -2713,6 +2713,7 @@ static int hclgevf_init_nic_client_instance(struct hnae3_ae_dev *ae_dev,
 					    struct hnae3_client *client)
 {
 	struct hclgevf_dev *hdev = ae_dev->priv;
+	int rst_cnt = hdev->rst_stats.rst_cnt;
 	int ret;
 
 	ret = client->ops->init_instance(&hdev->nic);
@@ -2720,6 +2721,14 @@ static int hclgevf_init_nic_client_instance(struct hnae3_ae_dev *ae_dev,
 		return ret;
 
 	set_bit(HCLGEVF_STATE_NIC_REGISTERED, &hdev->state);
+	if (test_bit(HCLGEVF_STATE_RST_HANDLING, &hdev->state) ||
+	    rst_cnt != hdev->rst_stats.rst_cnt) {
+		clear_bit(HCLGEVF_STATE_NIC_REGISTERED, &hdev->state);
+
+		client->ops->uninit_instance(&hdev->nic, 0);
+		return -EBUSY;
+	}
+
 	hnae3_set_client_init_flag(client, ae_dev, 1);
 
 	if (netif_msg_drv(&hdev->nic))
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH V2 net-next 2/4] net: hns3: change the order of reinitializing RoCE and NIC client during reset
  2020-05-27  0:59 [PATCH V2 net-next 0/4] net: hns3: misc updates for -next Huazhong Tan
  2020-05-27  0:59 ` [PATCH V2 net-next 1/4] net: hns3: add a resetting check in hclgevf_init_nic_client_instance() Huazhong Tan
@ 2020-05-27  0:59 ` Huazhong Tan
  2020-05-27  0:59 ` [PATCH V2 net-next 3/4] net: hns3: remove unnecessary MAC enable in app loopback Huazhong Tan
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Huazhong Tan @ 2020-05-27  0:59 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-kernel, salil.mehta, yisen.zhuang, linuxarm, kuba,
	Yufeng Mo, Huazhong Tan

From: Yufeng Mo <moyufeng@huawei.com>

The HNS RDMA driver will support VF device later, whose
re-initialization should be done after PF's. This patch
changes the order of hclge_reset_prepare_up() and
hclge_notify_roce_client(), so that PF's RoCE client
will be reinitialized before VF's.

Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index b796d3f..6e1e2cf 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -3770,11 +3770,6 @@ static int hclge_reset_rebuild(struct hclge_dev *hdev)
 
 	hclge_clear_reset_cause(hdev);
 
-	ret = hclge_reset_prepare_up(hdev);
-	if (ret)
-		return ret;
-
-
 	ret = hclge_notify_roce_client(hdev, HNAE3_INIT_CLIENT);
 	/* ignore RoCE notify error if it fails HCLGE_RESET_MAX_FAIL_CNT - 1
 	 * times
@@ -3783,6 +3778,10 @@ static int hclge_reset_rebuild(struct hclge_dev *hdev)
 	    hdev->rst_stats.reset_fail_cnt < HCLGE_RESET_MAX_FAIL_CNT - 1)
 		return ret;
 
+	ret = hclge_reset_prepare_up(hdev);
+	if (ret)
+		return ret;
+
 	rtnl_lock();
 	ret = hclge_notify_client(hdev, HNAE3_UP_CLIENT);
 	rtnl_unlock();
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH V2 net-next 3/4] net: hns3: remove unnecessary MAC enable in app loopback
  2020-05-27  0:59 [PATCH V2 net-next 0/4] net: hns3: misc updates for -next Huazhong Tan
  2020-05-27  0:59 ` [PATCH V2 net-next 1/4] net: hns3: add a resetting check in hclgevf_init_nic_client_instance() Huazhong Tan
  2020-05-27  0:59 ` [PATCH V2 net-next 2/4] net: hns3: change the order of reinitializing RoCE and NIC client during reset Huazhong Tan
@ 2020-05-27  0:59 ` Huazhong Tan
  2020-05-27  0:59 ` [PATCH V2 net-next 4/4] net: hns3: add a print for initializing CMDQ when reset pending Huazhong Tan
  2020-05-27 21:56 ` [PATCH V2 net-next 0/4] net: hns3: misc updates for -next David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Huazhong Tan @ 2020-05-27  0:59 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-kernel, salil.mehta, yisen.zhuang, linuxarm, kuba,
	Yufeng Mo, Huazhong Tan

From: Yufeng Mo <moyufeng@huawei.com>

Packets will not pass through MAC during app loopback.
Therefore, it is meaningless to enable MAC while doing
app loopback. This patch removes this unnecessary action.

Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index 6e1e2cf..7c9f2ba 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -6583,8 +6583,6 @@ static int hclge_set_app_loopback(struct hclge_dev *hdev, bool en)
 	/* 2 Then setup the loopback flag */
 	loop_en = le32_to_cpu(req->txrx_pad_fcs_loop_en);
 	hnae3_set_bit(loop_en, HCLGE_MAC_APP_LP_B, en ? 1 : 0);
-	hnae3_set_bit(loop_en, HCLGE_MAC_TX_EN_B, en ? 1 : 0);
-	hnae3_set_bit(loop_en, HCLGE_MAC_RX_EN_B, en ? 1 : 0);
 
 	req->txrx_pad_fcs_loop_en = cpu_to_le32(loop_en);
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH V2 net-next 4/4] net: hns3: add a print for initializing CMDQ when reset pending
  2020-05-27  0:59 [PATCH V2 net-next 0/4] net: hns3: misc updates for -next Huazhong Tan
                   ` (2 preceding siblings ...)
  2020-05-27  0:59 ` [PATCH V2 net-next 3/4] net: hns3: remove unnecessary MAC enable in app loopback Huazhong Tan
@ 2020-05-27  0:59 ` Huazhong Tan
  2020-05-27 21:56 ` [PATCH V2 net-next 0/4] net: hns3: misc updates for -next David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Huazhong Tan @ 2020-05-27  0:59 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-kernel, salil.mehta, yisen.zhuang, linuxarm, kuba,
	Huazhong Tan

When initializing CMDQ fails because of reset pending,
there is no hint for debugging, so adds a log for it.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c
index 7f509ef..64a1d0bd 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c
@@ -426,6 +426,9 @@ int hclge_cmd_init(struct hclge_dev *hdev)
 	 * reset may happen when lower level reset is being processed.
 	 */
 	if ((hclge_is_reset_pending(hdev))) {
+		dev_err(&hdev->pdev->dev,
+			"failed to init cmd since reset %#lx pending\n",
+			hdev->reset_pending);
 		ret = -EBUSY;
 		goto err_cmd_init;
 	}
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH V2 net-next 0/4] net: hns3: misc updates for -next
  2020-05-27  0:59 [PATCH V2 net-next 0/4] net: hns3: misc updates for -next Huazhong Tan
                   ` (3 preceding siblings ...)
  2020-05-27  0:59 ` [PATCH V2 net-next 4/4] net: hns3: add a print for initializing CMDQ when reset pending Huazhong Tan
@ 2020-05-27 21:56 ` David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2020-05-27 21:56 UTC (permalink / raw)
  To: tanhuazhong
  Cc: netdev, linux-kernel, salil.mehta, yisen.zhuang, linuxarm, kuba

From: Huazhong Tan <tanhuazhong@huawei.com>
Date: Wed, 27 May 2020 08:59:13 +0800

> This patchset includes some misc updates for the HNS3 ethernet driver.
> 
> #1 adds a resetting check in hclgevf_init_nic_client_instance().
> #2 adds a preparatory work for RMDA VF's driver.
> #3 removes some unnecessary operations in app loopback.
> #4 adds an error log for debugging.
> 
> Change log:
> V1->V2: removes previous patch#1 which may needs further discussion.

Series applied, thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-05-27 21:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27  0:59 [PATCH V2 net-next 0/4] net: hns3: misc updates for -next Huazhong Tan
2020-05-27  0:59 ` [PATCH V2 net-next 1/4] net: hns3: add a resetting check in hclgevf_init_nic_client_instance() Huazhong Tan
2020-05-27  0:59 ` [PATCH V2 net-next 2/4] net: hns3: change the order of reinitializing RoCE and NIC client during reset Huazhong Tan
2020-05-27  0:59 ` [PATCH V2 net-next 3/4] net: hns3: remove unnecessary MAC enable in app loopback Huazhong Tan
2020-05-27  0:59 ` [PATCH V2 net-next 4/4] net: hns3: add a print for initializing CMDQ when reset pending Huazhong Tan
2020-05-27 21:56 ` [PATCH V2 net-next 0/4] net: hns3: misc updates for -next David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).