netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/3] net: hns3: add some fixes for -net
@ 2021-04-29  8:34 Huazhong Tan
  2021-04-29  8:34 ` [PATCH net 1/3] net: hns3: fix incorrect configuration for igu_egu_hw_err Huazhong Tan
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Huazhong Tan @ 2021-04-29  8:34 UTC (permalink / raw)
  To: davem, kuba
  Cc: netdev, salil.mehta, yisen.zhuang, huangdaode, linuxarm,
	linuxarm, Huazhong Tan

This series adds some fixes for the HNS3 ethernet driver.

Jian Shen (1):
  net: hns3: add check for HNS3_NIC_STATE_INITED in
    hns3_reset_notify_up_enet()

Yufeng Mo (2):
  net: hns3: fix incorrect configuration for igu_egu_hw_err
  net: hns3: initialize the message content in hclge_get_link_mode()

 drivers/net/ethernet/hisilicon/hns3/hns3_enet.c        | 5 +++++
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c | 3 ++-
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.h | 3 ++-
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c | 2 +-
 4 files changed, 10 insertions(+), 3 deletions(-)

-- 
2.7.4


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

* [PATCH net 1/3] net: hns3: fix incorrect configuration for igu_egu_hw_err
  2021-04-29  8:34 [PATCH net 0/3] net: hns3: add some fixes for -net Huazhong Tan
@ 2021-04-29  8:34 ` Huazhong Tan
  2021-04-29  8:34 ` [PATCH net 2/3] net: hns3: initialize the message content in hclge_get_link_mode() Huazhong Tan
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Huazhong Tan @ 2021-04-29  8:34 UTC (permalink / raw)
  To: davem, kuba
  Cc: netdev, salil.mehta, yisen.zhuang, huangdaode, linuxarm,
	linuxarm, Yufeng Mo, Huazhong Tan

From: Yufeng Mo <moyufeng@huawei.com>

According to the UM, the type and enable status of igu_egu_hw_err
should be configured separately. Currently, the type field is
incorrect when disable this error. So fix it by configuring these
two fields separately.

Fixes: bf1faf9415dd ("net: hns3: Add enable and process hw errors from IGU, EGU and NCSI")
Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c | 3 ++-
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.h | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c
index 0ca7f1b..78d3eb1 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c
@@ -753,8 +753,9 @@ static int hclge_config_igu_egu_hw_err_int(struct hclge_dev *hdev, bool en)
 
 	/* configure IGU,EGU error interrupts */
 	hclge_cmd_setup_basic_desc(&desc, HCLGE_IGU_COMMON_INT_EN, false);
+	desc.data[0] = cpu_to_le32(HCLGE_IGU_ERR_INT_TYPE);
 	if (en)
-		desc.data[0] = cpu_to_le32(HCLGE_IGU_ERR_INT_EN);
+		desc.data[0] |= cpu_to_le32(HCLGE_IGU_ERR_INT_EN);
 
 	desc.data[1] = cpu_to_le32(HCLGE_IGU_ERR_INT_EN_MASK);
 
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.h
index 608fe26..d647f3c 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.h
@@ -32,7 +32,8 @@
 #define HCLGE_TQP_ECC_ERR_INT_EN_MASK	0x0FFF
 #define HCLGE_MSIX_SRAM_ECC_ERR_INT_EN_MASK	0x0F000000
 #define HCLGE_MSIX_SRAM_ECC_ERR_INT_EN	0x0F000000
-#define HCLGE_IGU_ERR_INT_EN	0x0000066F
+#define HCLGE_IGU_ERR_INT_EN	0x0000000F
+#define HCLGE_IGU_ERR_INT_TYPE	0x00000660
 #define HCLGE_IGU_ERR_INT_EN_MASK	0x000F
 #define HCLGE_IGU_TNL_ERR_INT_EN    0x0002AABF
 #define HCLGE_IGU_TNL_ERR_INT_EN_MASK  0x003F
-- 
2.7.4


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

* [PATCH net 2/3] net: hns3: initialize the message content in hclge_get_link_mode()
  2021-04-29  8:34 [PATCH net 0/3] net: hns3: add some fixes for -net Huazhong Tan
  2021-04-29  8:34 ` [PATCH net 1/3] net: hns3: fix incorrect configuration for igu_egu_hw_err Huazhong Tan
@ 2021-04-29  8:34 ` Huazhong Tan
  2021-04-29  8:34 ` [PATCH net 3/3] net: hns3: add check for HNS3_NIC_STATE_INITED in hns3_reset_notify_up_enet() Huazhong Tan
  2021-04-29 22:50 ` [PATCH net 0/3] net: hns3: add some fixes for -net patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Huazhong Tan @ 2021-04-29  8:34 UTC (permalink / raw)
  To: davem, kuba
  Cc: netdev, salil.mehta, yisen.zhuang, huangdaode, linuxarm,
	linuxarm, Yufeng Mo, Huazhong Tan

From: Yufeng Mo <moyufeng@huawei.com>

The message sent to VF should be initialized, otherwise random
value of some contents may cause improper processing by the target.
So add a initialization to message in hclge_get_link_mode().

Fixes: 9194d18b0577 ("net: hns3: fix the problem that the supported port is empty")
Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
index 51a36e7..c3bb16b 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
@@ -535,7 +535,7 @@ static void hclge_get_link_mode(struct hclge_vport *vport,
 	unsigned long advertising;
 	unsigned long supported;
 	unsigned long send_data;
-	u8 msg_data[10];
+	u8 msg_data[10] = {};
 	u8 dest_vfid;
 
 	advertising = hdev->hw.mac.advertising[0];
-- 
2.7.4


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

* [PATCH net 3/3] net: hns3: add check for HNS3_NIC_STATE_INITED in hns3_reset_notify_up_enet()
  2021-04-29  8:34 [PATCH net 0/3] net: hns3: add some fixes for -net Huazhong Tan
  2021-04-29  8:34 ` [PATCH net 1/3] net: hns3: fix incorrect configuration for igu_egu_hw_err Huazhong Tan
  2021-04-29  8:34 ` [PATCH net 2/3] net: hns3: initialize the message content in hclge_get_link_mode() Huazhong Tan
@ 2021-04-29  8:34 ` Huazhong Tan
  2021-04-29 22:50 ` [PATCH net 0/3] net: hns3: add some fixes for -net patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Huazhong Tan @ 2021-04-29  8:34 UTC (permalink / raw)
  To: davem, kuba
  Cc: netdev, salil.mehta, yisen.zhuang, huangdaode, linuxarm,
	linuxarm, Jian Shen, Huazhong Tan

From: Jian Shen <shenjian15@huawei.com>

In some cases, the device is not initialized because reset failed.
If another task calls hns3_reset_notify_up_enet() before reset
retry, it will cause an error since uninitialized pointer access.
So add check for HNS3_NIC_STATE_INITED before calling
hns3_nic_net_open() in hns3_reset_notify_up_enet().

Fixes: bb6b94a896d4 ("net: hns3: Add reset interface implementation in client")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index bf4302a..22ce73e 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -4554,6 +4554,11 @@ static int hns3_reset_notify_up_enet(struct hnae3_handle *handle)
 	struct hns3_nic_priv *priv = netdev_priv(kinfo->netdev);
 	int ret = 0;
 
+	if (!test_bit(HNS3_NIC_STATE_INITED, &priv->state)) {
+		netdev_err(kinfo->netdev, "device is not initialized yet\n");
+		return -EFAULT;
+	}
+
 	clear_bit(HNS3_NIC_STATE_RESETTING, &priv->state);
 
 	if (netif_running(kinfo->netdev)) {
-- 
2.7.4


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

* Re: [PATCH net 0/3] net: hns3: add some fixes for -net
  2021-04-29  8:34 [PATCH net 0/3] net: hns3: add some fixes for -net Huazhong Tan
                   ` (2 preceding siblings ...)
  2021-04-29  8:34 ` [PATCH net 3/3] net: hns3: add check for HNS3_NIC_STATE_INITED in hns3_reset_notify_up_enet() Huazhong Tan
@ 2021-04-29 22:50 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-04-29 22:50 UTC (permalink / raw)
  To: Huazhong Tan
  Cc: davem, kuba, netdev, salil.mehta, yisen.zhuang, huangdaode,
	linuxarm, linuxarm

Hello:

This series was applied to netdev/net.git (refs/heads/master):

On Thu, 29 Apr 2021 16:34:49 +0800 you wrote:
> This series adds some fixes for the HNS3 ethernet driver.
> 
> Jian Shen (1):
>   net: hns3: add check for HNS3_NIC_STATE_INITED in
>     hns3_reset_notify_up_enet()
> 
> Yufeng Mo (2):
>   net: hns3: fix incorrect configuration for igu_egu_hw_err
>   net: hns3: initialize the message content in hclge_get_link_mode()
> 
> [...]

Here is the summary with links:
  - [net,1/3] net: hns3: fix incorrect configuration for igu_egu_hw_err
    https://git.kernel.org/netdev/net/c/2867298dd49e
  - [net,2/3] net: hns3: initialize the message content in hclge_get_link_mode()
    https://git.kernel.org/netdev/net/c/568a54bdf70b
  - [net,3/3] net: hns3: add check for HNS3_NIC_STATE_INITED in hns3_reset_notify_up_enet()
    https://git.kernel.org/netdev/net/c/b4047aac4ec1

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2021-04-29 22:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29  8:34 [PATCH net 0/3] net: hns3: add some fixes for -net Huazhong Tan
2021-04-29  8:34 ` [PATCH net 1/3] net: hns3: fix incorrect configuration for igu_egu_hw_err Huazhong Tan
2021-04-29  8:34 ` [PATCH net 2/3] net: hns3: initialize the message content in hclge_get_link_mode() Huazhong Tan
2021-04-29  8:34 ` [PATCH net 3/3] net: hns3: add check for HNS3_NIC_STATE_INITED in hns3_reset_notify_up_enet() Huazhong Tan
2021-04-29 22:50 ` [PATCH net 0/3] net: hns3: add some fixes for -net patchwork-bot+netdevbpf

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).