linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/9] Bug fixes and some minor changes to HNS3 driver
@ 2018-07-16 15:36 Salil Mehta
  2018-07-16 15:36 ` [PATCH net-next 1/9] net: hns3: Modify the order of initializing command queue register Salil Mehta
                   ` (9 more replies)
  0 siblings, 10 replies; 13+ messages in thread
From: Salil Mehta @ 2018-07-16 15:36 UTC (permalink / raw)
  To: davem
  Cc: salil.mehta, yisen.zhuang, lipeng321, mehta.salil, netdev,
	linux-kernel, linuxarm

This patch-set presents some fixes and minor changes to the HNS3 Ethernet Driver.

Fuyun Liang (2):
  net: hns3: Fix for using wrong mask and shift in
    hclge_get_ring_chain_from_mbx
  net: hns3: Fix comments for hclge_get_ring_chain_from_mbx

Huazhong Tan (6):
  net: hns3: Modify the order of initializing command queue register
  net: hns3: Reset net device with rtnl_lock
  net: hns3: Prevent to request reset frequently
  net: hns3: Correct reset event status register
  net: hns3: Fix return value error in hns3_reset_notify_down_enet
  net: hns3: remove unnecessary ring configuration operation while
    resetting

Yunsheng Lin (1):
  net: hns3: Fix for reset_level default assignment probelm

 drivers/net/ethernet/hisilicon/hns3/hns3_enet.c      | 16 ++++++----------
 .../net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c   |  4 ++--
 .../net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c  | 20 +++++++++++++-------
 .../net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h  |  1 +
 .../net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c   | 14 ++++++++------
 5 files changed, 30 insertions(+), 25 deletions(-)

-- 
2.7.4



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

* [PATCH net-next 1/9] net: hns3: Modify the order of initializing command queue register
  2018-07-16 15:36 [PATCH net-next 0/9] Bug fixes and some minor changes to HNS3 driver Salil Mehta
@ 2018-07-16 15:36 ` Salil Mehta
  2018-07-16 15:36 ` [PATCH net-next 2/9] net: hns3: Reset net device with rtnl_lock Salil Mehta
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Salil Mehta @ 2018-07-16 15:36 UTC (permalink / raw)
  To: davem
  Cc: salil.mehta, yisen.zhuang, lipeng321, mehta.salil, netdev,
	linux-kernel, linuxarm, Huazhong Tan

From: Huazhong Tan <tanhuazhong@huawei.com>

According to hardware's description, the head pointer register should
be written before the tail pointer register while doing command queue
initialization.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c
index eca4b23..cf40afc 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c
@@ -119,8 +119,8 @@ static void hclge_cmd_config_regs(struct hclge_cmq_ring *ring)
 		hclge_write_dev(hw, HCLGE_NIC_CSQ_DEPTH_REG,
 				(ring->desc_num >> HCLGE_NIC_CMQ_DESC_NUM_S) |
 				HCLGE_NIC_CMQ_ENABLE);
-		hclge_write_dev(hw, HCLGE_NIC_CSQ_TAIL_REG, 0);
 		hclge_write_dev(hw, HCLGE_NIC_CSQ_HEAD_REG, 0);
+		hclge_write_dev(hw, HCLGE_NIC_CSQ_TAIL_REG, 0);
 	} else {
 		hclge_write_dev(hw, HCLGE_NIC_CRQ_BASEADDR_L_REG,
 				lower_32_bits(dma));
@@ -129,8 +129,8 @@ static void hclge_cmd_config_regs(struct hclge_cmq_ring *ring)
 		hclge_write_dev(hw, HCLGE_NIC_CRQ_DEPTH_REG,
 				(ring->desc_num >> HCLGE_NIC_CMQ_DESC_NUM_S) |
 				HCLGE_NIC_CMQ_ENABLE);
-		hclge_write_dev(hw, HCLGE_NIC_CRQ_TAIL_REG, 0);
 		hclge_write_dev(hw, HCLGE_NIC_CRQ_HEAD_REG, 0);
+		hclge_write_dev(hw, HCLGE_NIC_CRQ_TAIL_REG, 0);
 	}
 }
 
-- 
2.7.4



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

* [PATCH net-next 2/9] net: hns3: Reset net device with rtnl_lock
  2018-07-16 15:36 [PATCH net-next 0/9] Bug fixes and some minor changes to HNS3 driver Salil Mehta
  2018-07-16 15:36 ` [PATCH net-next 1/9] net: hns3: Modify the order of initializing command queue register Salil Mehta
@ 2018-07-16 15:36 ` Salil Mehta
  2018-07-16 15:36 ` [PATCH net-next 3/9] net: hns3: Prevent to request reset frequently Salil Mehta
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Salil Mehta @ 2018-07-16 15:36 UTC (permalink / raw)
  To: davem
  Cc: salil.mehta, yisen.zhuang, lipeng321, mehta.salil, netdev,
	linux-kernel, linuxarm, Huazhong Tan

From: Huazhong Tan <tanhuazhong@huawei.com>

Since current locking was not covering certain code where
netdev was being accessed or manipulated, this patch fixes
it.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index 8bbf4e5..3886290 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -2820,15 +2820,13 @@ static void hclge_clear_reset_cause(struct hclge_dev *hdev)
 static void hclge_reset(struct hclge_dev *hdev)
 {
 	/* perform reset of the stack & ae device for a client */
-
+	rtnl_lock();
 	hclge_notify_client(hdev, HNAE3_DOWN_CLIENT);
 
 	if (!hclge_reset_wait(hdev)) {
-		rtnl_lock();
 		hclge_notify_client(hdev, HNAE3_UNINIT_CLIENT);
 		hclge_reset_ae_dev(hdev->ae_dev);
 		hclge_notify_client(hdev, HNAE3_INIT_CLIENT);
-		rtnl_unlock();
 
 		hclge_clear_reset_cause(hdev);
 	} else {
@@ -2838,6 +2836,7 @@ static void hclge_reset(struct hclge_dev *hdev)
 	}
 
 	hclge_notify_client(hdev, HNAE3_UP_CLIENT);
+	rtnl_unlock();
 }
 
 static void hclge_reset_event(struct hnae3_handle *handle)
-- 
2.7.4



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

* [PATCH net-next 3/9] net: hns3: Prevent to request reset frequently
  2018-07-16 15:36 [PATCH net-next 0/9] Bug fixes and some minor changes to HNS3 driver Salil Mehta
  2018-07-16 15:36 ` [PATCH net-next 1/9] net: hns3: Modify the order of initializing command queue register Salil Mehta
  2018-07-16 15:36 ` [PATCH net-next 2/9] net: hns3: Reset net device with rtnl_lock Salil Mehta
@ 2018-07-16 15:36 ` Salil Mehta
  2018-07-16 15:36 ` [PATCH net-next 4/9] net: hns3: Correct reset event status register Salil Mehta
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Salil Mehta @ 2018-07-16 15:36 UTC (permalink / raw)
  To: davem
  Cc: salil.mehta, yisen.zhuang, lipeng321, mehta.salil, netdev,
	linux-kernel, linuxarm, Huazhong Tan

From: Huazhong Tan <tanhuazhong@huawei.com>

Netdevice reset should not be requested frequently, a new one
must wait a moment since there may be some work not completed.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index 3886290..a1886a3 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -2819,7 +2819,10 @@ static void hclge_clear_reset_cause(struct hclge_dev *hdev)
 
 static void hclge_reset(struct hclge_dev *hdev)
 {
+	struct hnae3_handle *handle;
+
 	/* perform reset of the stack & ae device for a client */
+	handle = &hdev->vport[0].nic;
 	rtnl_lock();
 	hclge_notify_client(hdev, HNAE3_DOWN_CLIENT);
 
@@ -2836,6 +2839,7 @@ static void hclge_reset(struct hclge_dev *hdev)
 	}
 
 	hclge_notify_client(hdev, HNAE3_UP_CLIENT);
+	handle->last_reset_time = jiffies;
 	rtnl_unlock();
 }
 
@@ -2849,8 +2853,13 @@ static void hclge_reset_event(struct hnae3_handle *handle)
 	 * know this if last reset request did not occur very recently (watchdog
 	 * timer = 5*HZ, let us check after sufficiently large time, say 4*5*Hz)
 	 * In case of new request we reset the "reset level" to PF reset.
+	 * And if it is a repeat reset request of the most recent one then we
+	 * want to make sure we throttle the reset request. Therefore, we will
+	 * not allow it again before 3*HZ times.
 	 */
-	if (time_after(jiffies, (handle->last_reset_time + 4 * 5 * HZ)))
+	if (time_before(jiffies, (handle->last_reset_time + 3 * HZ)))
+		return;
+	else if (time_after(jiffies, (handle->last_reset_time + 4 * 5 * HZ)))
 		handle->reset_level = HNAE3_FUNC_RESET;
 
 	dev_info(&hdev->pdev->dev, "received reset event , reset type is %d",
@@ -2862,8 +2871,6 @@ static void hclge_reset_event(struct hnae3_handle *handle)
 
 	if (handle->reset_level < HNAE3_GLOBAL_RESET)
 		handle->reset_level++;
-
-	handle->last_reset_time = jiffies;
 }
 
 static void hclge_reset_subtask(struct hclge_dev *hdev)
-- 
2.7.4



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

* [PATCH net-next 4/9] net: hns3: Correct reset event status register
  2018-07-16 15:36 [PATCH net-next 0/9] Bug fixes and some minor changes to HNS3 driver Salil Mehta
                   ` (2 preceding siblings ...)
  2018-07-16 15:36 ` [PATCH net-next 3/9] net: hns3: Prevent to request reset frequently Salil Mehta
@ 2018-07-16 15:36 ` Salil Mehta
  2018-07-16 15:36 ` [PATCH net-next 5/9] net: hns3: Fix return value error in hns3_reset_notify_down_enet Salil Mehta
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Salil Mehta @ 2018-07-16 15:36 UTC (permalink / raw)
  To: davem
  Cc: salil.mehta, yisen.zhuang, lipeng321, mehta.salil, netdev,
	linux-kernel, linuxarm, Huazhong Tan

From: Huazhong Tan <tanhuazhong@huawei.com>

According to hardware's description, driver should get reset event
from VECTOR0_PF_OTHER_INT_ST(0x20800) instead of
VECTOR0_PF_OTHER_INT_SRC(0x20700).

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 2 +-
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index a1886a3..266c686 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -2495,7 +2495,7 @@ static u32 hclge_check_event_cause(struct hclge_dev *hdev, u32 *clearval)
 	u32 cmdq_src_reg;
 
 	/* fetch the events from their corresponding regs */
-	rst_src_reg = hclge_read_dev(&hdev->hw, HCLGE_MISC_RESET_STS_REG);
+	rst_src_reg = hclge_read_dev(&hdev->hw, HCLGE_MISC_VECTOR_INT_STS);
 	cmdq_src_reg = hclge_read_dev(&hdev->hw, HCLGE_VECTOR0_CMDQ_SRC_REG);
 
 	/* Assumption: If by any chance reset and mailbox events are reported
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
index 20abe82..a5abf8e 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
@@ -89,6 +89,7 @@
 
 /* Reset related Registers */
 #define HCLGE_MISC_RESET_STS_REG	0x20700
+#define HCLGE_MISC_VECTOR_INT_STS	0x20800
 #define HCLGE_GLOBAL_RESET_REG		0x20A00
 #define HCLGE_GLOBAL_RESET_BIT		0x0
 #define HCLGE_CORE_RESET_BIT		0x1
-- 
2.7.4



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

* [PATCH net-next 5/9] net: hns3: Fix return value error in hns3_reset_notify_down_enet
  2018-07-16 15:36 [PATCH net-next 0/9] Bug fixes and some minor changes to HNS3 driver Salil Mehta
                   ` (3 preceding siblings ...)
  2018-07-16 15:36 ` [PATCH net-next 4/9] net: hns3: Correct reset event status register Salil Mehta
@ 2018-07-16 15:36 ` Salil Mehta
  2018-07-16 15:36 ` [PATCH net-next 6/9] net: hns3: remove unnecessary ring configuration operation while resetting Salil Mehta
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Salil Mehta @ 2018-07-16 15:36 UTC (permalink / raw)
  To: davem
  Cc: salil.mehta, yisen.zhuang, lipeng321, mehta.salil, netdev,
	linux-kernel, linuxarm, Huazhong Tan

From: Huazhong Tan <tanhuazhong@huawei.com>

When doing reset, netdev has not been brought up is not an error,
it means that we do not need do the stop operation, so just return
zero.

Fixes: 76ad4f0ee747 ("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC")
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index c211450..8296446 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -3396,7 +3396,7 @@ static int hns3_reset_notify_down_enet(struct hnae3_handle *handle)
 	struct net_device *ndev = kinfo->netdev;
 
 	if (!netif_running(ndev))
-		return -EIO;
+		return 0;
 
 	return hns3_nic_net_stop(ndev);
 }
-- 
2.7.4



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

* [PATCH net-next 6/9] net: hns3: remove unnecessary ring configuration operation while resetting
  2018-07-16 15:36 [PATCH net-next 0/9] Bug fixes and some minor changes to HNS3 driver Salil Mehta
                   ` (4 preceding siblings ...)
  2018-07-16 15:36 ` [PATCH net-next 5/9] net: hns3: Fix return value error in hns3_reset_notify_down_enet Salil Mehta
@ 2018-07-16 15:36 ` Salil Mehta
  2018-07-16 15:36 ` [PATCH net-next 7/9] net: hns3: Fix for reset_level default assignment probelm Salil Mehta
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Salil Mehta @ 2018-07-16 15:36 UTC (permalink / raw)
  To: davem
  Cc: salil.mehta, yisen.zhuang, lipeng321, mehta.salil, netdev,
	linux-kernel, linuxarm, Huazhong Tan

From: Huazhong Tan <tanhuazhong@huawei.com>

The configuration of the ring will be used to reinitialize the
ring after the hardware reset is completed. So we should not
release and reacquire this configuration during reset.

Fixes: bb6b94a896d4 ("net: hns3: Add reset interface implementation in client")
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index 8296446..24f82b7 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -3436,10 +3436,6 @@ static int hns3_reset_notify_init_enet(struct hnae3_handle *handle)
 	/* Carrier off reporting is important to ethtool even BEFORE open */
 	netif_carrier_off(netdev);
 
-	ret = hns3_get_ring_config(priv);
-	if (ret)
-		return ret;
-
 	ret = hns3_nic_init_vector_data(priv);
 	if (ret)
 		return ret;
@@ -3471,10 +3467,6 @@ static int hns3_reset_notify_uninit_enet(struct hnae3_handle *handle)
 	if (ret)
 		netdev_err(netdev, "uninit ring error\n");
 
-	hns3_put_ring_config(priv);
-
-	priv->ring_data = NULL;
-
 	hns3_uninit_mac_addr(netdev);
 
 	return ret;
-- 
2.7.4



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

* [PATCH net-next 7/9] net: hns3: Fix for reset_level default assignment probelm
  2018-07-16 15:36 [PATCH net-next 0/9] Bug fixes and some minor changes to HNS3 driver Salil Mehta
                   ` (5 preceding siblings ...)
  2018-07-16 15:36 ` [PATCH net-next 6/9] net: hns3: remove unnecessary ring configuration operation while resetting Salil Mehta
@ 2018-07-16 15:36 ` Salil Mehta
  2018-07-17  9:37   ` Sergei Shtylyov
  2018-07-16 15:36 ` [PATCH net-next 8/9] net: hns3: Fix for using wrong mask and shift in hclge_get_ring_chain_from_mbx Salil Mehta
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 13+ messages in thread
From: Salil Mehta @ 2018-07-16 15:36 UTC (permalink / raw)
  To: davem
  Cc: salil.mehta, yisen.zhuang, lipeng321, mehta.salil, netdev,
	linux-kernel, linuxarm, Yunsheng Lin

From: Yunsheng Lin <linyunsheng@huawei.com>

handle->reset_level is assigned to HNAE3_NONE_RESET when client is
initialized, if a tx timeout happens right after initialization,
then handle->reset_level is not resetted to HNAE3_FUNC_RESET in
hclge_reset_event, which will cause reset event not properly
handled problem.

This patch fixes it by setting handle->reset_level properly when
client is initialized.

Fixes: 6d4c3981a8d8 ("net: hns3: Changes to make enet watchdog timeout func common for PF/VF")
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index 24f82b7..29be96e 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -3085,7 +3085,6 @@ static int hns3_client_init(struct hnae3_handle *handle)
 	priv->dev = &pdev->dev;
 	priv->netdev = netdev;
 	priv->ae_handle = handle;
-	priv->ae_handle->reset_level = HNAE3_NONE_RESET;
 	priv->ae_handle->last_reset_time = jiffies;
 	priv->tx_timeout_count = 0;
 
@@ -3106,6 +3105,11 @@ static int hns3_client_init(struct hnae3_handle *handle)
 	/* Carrier off reporting is important to ethtool even BEFORE open */
 	netif_carrier_off(netdev);
 
+	if (handle->flags & HNAE3_SUPPORT_VF)
+		handle->reset_level = HNAE3_VF_RESET;
+	else
+		handle->reset_level = HNAE3_FUNC_RESET;
+
 	ret = hns3_get_ring_config(priv);
 	if (ret) {
 		ret = -ENOMEM;
-- 
2.7.4



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

* [PATCH net-next 8/9] net: hns3: Fix for using wrong mask and shift in hclge_get_ring_chain_from_mbx
  2018-07-16 15:36 [PATCH net-next 0/9] Bug fixes and some minor changes to HNS3 driver Salil Mehta
                   ` (6 preceding siblings ...)
  2018-07-16 15:36 ` [PATCH net-next 7/9] net: hns3: Fix for reset_level default assignment probelm Salil Mehta
@ 2018-07-16 15:36 ` Salil Mehta
  2018-07-16 15:36 ` [PATCH net-next 9/9] net: hns3: Fix comments for hclge_get_ring_chain_from_mbx Salil Mehta
  2018-07-16 18:18 ` [PATCH net-next 0/9] Bug fixes and some minor changes to HNS3 driver David Miller
  9 siblings, 0 replies; 13+ messages in thread
From: Salil Mehta @ 2018-07-16 15:36 UTC (permalink / raw)
  To: davem
  Cc: salil.mehta, yisen.zhuang, lipeng321, mehta.salil, netdev,
	linux-kernel, linuxarm, Fuyun Liang

From: Fuyun Liang <liangfuyun1@huawei.com>

HCLGE_INT_GL_IDX_M and HCLGE_INT_GL_IDX_S are used to set fireware
cmd. When getting int_gl value from mailbox message, we should use
HNAE3_RING_GL_IDX_M and HNAE3_RING_GL_IDX_S.

Fixes: 79eee4108541 ("net: hns3: add int_gl_idx setup for VF")
Signed-off-by: Fuyun Liang <liangfuyun1@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
index 50ae2f8..9d36bcc 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
@@ -131,8 +131,8 @@ static int hclge_get_ring_chain_from_mbx(
 	hnae3_set_bit(ring_chain->flag, HNAE3_RING_TYPE_B, req->msg[3]);
 	ring_chain->tqp_index =
 			hclge_get_queue_id(vport->nic.kinfo.tqp[req->msg[4]]);
-	hnae3_set_field(ring_chain->int_gl_idx, HCLGE_INT_GL_IDX_M,
-			HCLGE_INT_GL_IDX_S,
+	hnae3_set_field(ring_chain->int_gl_idx, HNAE3_RING_GL_IDX_M,
+			HNAE3_RING_GL_IDX_S,
 			req->msg[5]);
 
 	cur_chain = ring_chain;
@@ -151,8 +151,8 @@ static int hclge_get_ring_chain_from_mbx(
 			[req->msg[HCLGE_MBX_RING_NODE_VARIABLE_NUM * i +
 			HCLGE_MBX_RING_MAP_BASIC_MSG_NUM + 1]]);
 
-		hnae3_set_field(new_chain->int_gl_idx, HCLGE_INT_GL_IDX_M,
-				HCLGE_INT_GL_IDX_S,
+		hnae3_set_field(new_chain->int_gl_idx, HNAE3_RING_GL_IDX_M,
+				HNAE3_RING_GL_IDX_S,
 				req->msg[HCLGE_MBX_RING_NODE_VARIABLE_NUM * i +
 				HCLGE_MBX_RING_MAP_BASIC_MSG_NUM + 2]);
 
-- 
2.7.4



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

* [PATCH net-next 9/9] net: hns3: Fix comments for hclge_get_ring_chain_from_mbx
  2018-07-16 15:36 [PATCH net-next 0/9] Bug fixes and some minor changes to HNS3 driver Salil Mehta
                   ` (7 preceding siblings ...)
  2018-07-16 15:36 ` [PATCH net-next 8/9] net: hns3: Fix for using wrong mask and shift in hclge_get_ring_chain_from_mbx Salil Mehta
@ 2018-07-16 15:36 ` Salil Mehta
  2018-07-16 18:18 ` [PATCH net-next 0/9] Bug fixes and some minor changes to HNS3 driver David Miller
  9 siblings, 0 replies; 13+ messages in thread
From: Salil Mehta @ 2018-07-16 15:36 UTC (permalink / raw)
  To: davem
  Cc: salil.mehta, yisen.zhuang, lipeng321, mehta.salil, netdev,
	linux-kernel, linuxarm, Fuyun Liang

From: Fuyun Liang <liangfuyun1@huawei.com>

Actually, hclge_get_ring_chain_from_mbx is used to get ring type, tqp id,
and int_gl index from mailbox message. So the comments is incorrect. This
patch fixes it.

Fixes: dde1a86e93ca ("net: hns3: Add mailbox support to PF driver")
Signed-off-by: Fuyun Liang <liangfuyun1@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
index 9d36bcc..f34851c 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
@@ -104,13 +104,15 @@ static void hclge_free_vector_ring_chain(struct hnae3_ring_chain_node *head)
 	}
 }
 
-/* hclge_get_ring_chain_from_mbx: get ring type & tqpid from mailbox message
+/* hclge_get_ring_chain_from_mbx: get ring type & tqp id & int_gl idx
+ * from mailbox message
  * msg[0]: opcode
  * msg[1]: <not relevant to this function>
  * msg[2]: ring_num
  * msg[3]: first ring type (TX|RX)
  * msg[4]: first tqp id
- * msg[5] ~ msg[14]: other ring type and tqp id
+ * msg[5]: first int_gl idx
+ * msg[6] ~ msg[14]: other ring type, tqp id and int_gl idx
  */
 static int hclge_get_ring_chain_from_mbx(
 			struct hclge_mbx_vf_to_pf_cmd *req,
-- 
2.7.4



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

* Re: [PATCH net-next 0/9] Bug fixes and some minor changes to HNS3 driver
  2018-07-16 15:36 [PATCH net-next 0/9] Bug fixes and some minor changes to HNS3 driver Salil Mehta
                   ` (8 preceding siblings ...)
  2018-07-16 15:36 ` [PATCH net-next 9/9] net: hns3: Fix comments for hclge_get_ring_chain_from_mbx Salil Mehta
@ 2018-07-16 18:18 ` David Miller
  9 siblings, 0 replies; 13+ messages in thread
From: David Miller @ 2018-07-16 18:18 UTC (permalink / raw)
  To: salil.mehta
  Cc: yisen.zhuang, lipeng321, mehta.salil, netdev, linux-kernel, linuxarm

From: Salil Mehta <salil.mehta@huawei.com>
Date: Mon, 16 Jul 2018 16:36:18 +0100

> This patch-set presents some fixes and minor changes to the HNS3
> Ethernet Driver.

Series applied, thanks.

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

* Re: [PATCH net-next 7/9] net: hns3: Fix for reset_level default assignment probelm
  2018-07-16 15:36 ` [PATCH net-next 7/9] net: hns3: Fix for reset_level default assignment probelm Salil Mehta
@ 2018-07-17  9:37   ` Sergei Shtylyov
  2018-07-18  7:29     ` Salil Mehta
  0 siblings, 1 reply; 13+ messages in thread
From: Sergei Shtylyov @ 2018-07-17  9:37 UTC (permalink / raw)
  To: Salil Mehta, davem
  Cc: yisen.zhuang, lipeng321, mehta.salil, netdev, linux-kernel,
	linuxarm, Yunsheng Lin

Hello!

On 7/16/2018 6:36 PM, Salil Mehta wrote:

> From: Yunsheng Lin <linyunsheng@huawei.com>
> 
> handle->reset_level is assigned to HNAE3_NONE_RESET when client is
> initialized, if a tx timeout happens right after initialization,
> then handle->reset_level is not resetted to HNAE3_FUNC_RESET in

    s/resetted/reset/.

> hclge_reset_event, which will cause reset event not properly
> handled problem.
> 
> This patch fixes it by setting handle->reset_level properly when
> client is initialized.
> 
> Fixes: 6d4c3981a8d8 ("net: hns3: Changes to make enet watchdog timeout func common for PF/VF")
> Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
> Signed-off-by: Peng Li <lipeng321@huawei.com>
> Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
[...]

MBR, Sergei

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

* RE: [PATCH net-next 7/9] net: hns3: Fix for reset_level default assignment probelm
  2018-07-17  9:37   ` Sergei Shtylyov
@ 2018-07-18  7:29     ` Salil Mehta
  0 siblings, 0 replies; 13+ messages in thread
From: Salil Mehta @ 2018-07-18  7:29 UTC (permalink / raw)
  To: Sergei Shtylyov, davem
  Cc: Zhuangyuzeng (Yisen), lipeng (Y),
	mehta.salil, netdev, linux-kernel, Linuxarm, linyunsheng

Hi Sergei,

> -----Original Message-----
> From: netdev-owner@vger.kernel.org [mailto:netdev-
> owner@vger.kernel.org] On Behalf Of Sergei Shtylyov
> Sent: Tuesday, July 17, 2018 10:37 AM
> To: Salil Mehta <salil.mehta@huawei.com>; davem@davemloft.net
> Cc: Zhuangyuzeng (Yisen) <yisen.zhuang@huawei.com>; lipeng (Y)
> <lipeng321@huawei.com>; mehta.salil@opnsrc.net; netdev@vger.kernel.org;
> linux-kernel@vger.kernel.org; Linuxarm <linuxarm@huawei.com>;
> linyunsheng <linyunsheng@huawei.com>
> Subject: Re: [PATCH net-next 7/9] net: hns3: Fix for reset_level
> default assignment probelm
> 
> Hello!
> 
> On 7/16/2018 6:36 PM, Salil Mehta wrote:
> 
> > From: Yunsheng Lin <linyunsheng@huawei.com>
> >
> > handle->reset_level is assigned to HNAE3_NONE_RESET when client is
> > initialized, if a tx timeout happens right after initialization,
> > then handle->reset_level is not resetted to HNAE3_FUNC_RESET in
> 
>     s/resetted/reset/.

Thanks for looking through. Will take care in future submissions.

Best regards
Salil
> 
> > hclge_reset_event, which will cause reset event not properly
> > handled problem.
> >
> > This patch fixes it by setting handle->reset_level properly when
> > client is initialized.
> >
> > Fixes: 6d4c3981a8d8 ("net: hns3: Changes to make enet watchdog
> timeout func common for PF/VF")
> > Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
> > Signed-off-by: Peng Li <lipeng321@huawei.com>
> > Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
> [...]
> 
> MBR, Sergei

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

end of thread, other threads:[~2018-07-18  7:45 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-16 15:36 [PATCH net-next 0/9] Bug fixes and some minor changes to HNS3 driver Salil Mehta
2018-07-16 15:36 ` [PATCH net-next 1/9] net: hns3: Modify the order of initializing command queue register Salil Mehta
2018-07-16 15:36 ` [PATCH net-next 2/9] net: hns3: Reset net device with rtnl_lock Salil Mehta
2018-07-16 15:36 ` [PATCH net-next 3/9] net: hns3: Prevent to request reset frequently Salil Mehta
2018-07-16 15:36 ` [PATCH net-next 4/9] net: hns3: Correct reset event status register Salil Mehta
2018-07-16 15:36 ` [PATCH net-next 5/9] net: hns3: Fix return value error in hns3_reset_notify_down_enet Salil Mehta
2018-07-16 15:36 ` [PATCH net-next 6/9] net: hns3: remove unnecessary ring configuration operation while resetting Salil Mehta
2018-07-16 15:36 ` [PATCH net-next 7/9] net: hns3: Fix for reset_level default assignment probelm Salil Mehta
2018-07-17  9:37   ` Sergei Shtylyov
2018-07-18  7:29     ` Salil Mehta
2018-07-16 15:36 ` [PATCH net-next 8/9] net: hns3: Fix for using wrong mask and shift in hclge_get_ring_chain_from_mbx Salil Mehta
2018-07-16 15:36 ` [PATCH net-next 9/9] net: hns3: Fix comments for hclge_get_ring_chain_from_mbx Salil Mehta
2018-07-16 18:18 ` [PATCH net-next 0/9] Bug fixes and some minor changes to HNS3 driver 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).