Netdev Archive mirror
 help / color / mirror / Atom feed
* [PATCH V3 net 0/7] There are some bugfix for the HNS3 ethernet driver
@ 2024-05-07 13:42 Jijie Shao
  2024-05-07 13:42 ` [PATCH V3 net 1/7] net: hns3: using user configure after hardware reset Jijie Shao
                   ` (7 more replies)
  0 siblings, 8 replies; 16+ messages in thread
From: Jijie Shao @ 2024-05-07 13:42 UTC (permalink / raw
  To: yisen.zhuang, salil.mehta, davem, edumazet, kuba, pabeni, jiri,
	horms
  Cc: shenjian15, wangjie125, liuyonglong, shaojijie, chenhao418,
	netdev, linux-kernel

There are some bugfix for the HNS3 ethernet driver

---
changeLog:
v2 -> v3:
  - Fix coding errors in "net: hns3: using user configure after hardware reset", suggested by Simon Horman
  https://lore.kernel.org/all/20240426100045.1631295-1-shaojijie@huawei.com/
v1 -> v2:
  - Adjust the code sequence to completely eliminate the race window, suggested by Jiri Pirko
  v1: https://lore.kernel.org/all/20240422134327.3160587-1-shaojijie@huawei.com/
---

Jian Shen (1):
  net: hns3: direct return when receive a unknown mailbox message

Peiyang Wang (4):
  net: hns3: using user configure after hardware reset
  net: hns3: change type of numa_node_mask as nodemask_t
  net: hns3: release PTP resources if pf initialization failed
  net: hns3: use appropriate barrier function after setting a bit value

Yonglong Liu (2):
  net: hns3: fix port vlan filter not disabled issue
  net: hns3: fix kernel crash when devlink reload during initialization

 drivers/net/ethernet/hisilicon/hns3/hnae3.h   |  2 +-
 .../hisilicon/hns3/hns3pf/hclge_main.c        | 52 ++++++++++---------
 .../hisilicon/hns3/hns3pf/hclge_main.h        |  5 +-
 .../hisilicon/hns3/hns3pf/hclge_mbx.c         |  7 +--
 .../hisilicon/hns3/hns3vf/hclgevf_main.c      | 20 ++++---
 .../hisilicon/hns3/hns3vf/hclgevf_main.h      |  2 +-
 6 files changed, 47 insertions(+), 41 deletions(-)

-- 
2.30.0


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

* [PATCH V3 net 1/7] net: hns3: using user configure after hardware reset
  2024-05-07 13:42 [PATCH V3 net 0/7] There are some bugfix for the HNS3 ethernet driver Jijie Shao
@ 2024-05-07 13:42 ` Jijie Shao
  2024-05-07 15:20   ` Przemek Kitszel
                     ` (2 more replies)
  2024-05-07 13:42 ` [PATCH V3 net 2/7] net: hns3: direct return when receive a unknown mailbox message Jijie Shao
                   ` (6 subsequent siblings)
  7 siblings, 3 replies; 16+ messages in thread
From: Jijie Shao @ 2024-05-07 13:42 UTC (permalink / raw
  To: yisen.zhuang, salil.mehta, davem, edumazet, kuba, pabeni, jiri,
	horms
  Cc: shenjian15, wangjie125, liuyonglong, shaojijie, chenhao418,
	netdev, linux-kernel

From: Peiyang Wang <wangpeiyang1@huawei.com>

When a reset occurring, it's supposed to recover user's configuration.
Currently, the port info(speed, duplex and autoneg) is stored in hclge_mac
and will be scheduled updated. Consider the case that reset was happened
consecutively. During the first reset, the port info is configured with
a temporary value cause the PHY is reset and looking for best link config.
Second reset start and use pervious configuration which is not the user's.
The specific process is as follows:

+------+               +----+                +----+
| USER |               | PF |                | HW |
+---+--+               +-+--+                +-+--+
    |  ethtool --reset   |                     |
    +------------------->|    reset command    |
    |  ethtool --reset   +-------------------->|
    +------------------->|                     +---+
    |                    +---+                 |   |
    |                    |   |reset currently  |   | HW RESET
    |                    |   |and wait to do   |   |
    |                    |<--+                 |   |
    |                    | send pervious cfg   |<--+
    |                    | (1000M FULL AN_ON)  |
    |                    +-------------------->|
    |                    | read cfg(time task) |
    |                    | (10M HALF AN_OFF)   +---+
    |                    |<--------------------+   | cfg take effect
    |                    |    reset command    |<--+
    |                    +-------------------->|
    |                    |                     +---+
    |                    | send pervious cfg   |   | HW RESET
    |                    | (10M HALF AN_OFF)   |<--+
    |                    +-------------------->|
    |                    | read cfg(time task) |
    |                    |  (10M HALF AN_OFF)  +---+
    |                    |<--------------------+   | cfg take effect
    |                    |                     |   |
    |                    | read cfg(time task) |<--+
    |                    |  (10M HALF AN_OFF)  |
    |                    |<--------------------+
    |                    |                     |
    v                    v                     v

To avoid aboved situation, this patch introduced req_speed, req_duplex,
req_autoneg to store user's configuration and it only be used after
hardware reset and to recover user's configuration

Fixes: f5f2b3e4dcc0 ("net: hns3: add support for imp-controlled PHYs")
Signed-off-by: Peiyang Wang <wangpeiyang1@huawei.com>
Signed-off-by: Jijie Shao <shaojijie@huawei.com>
---
 .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c   | 15 +++++++++------
 .../ethernet/hisilicon/hns3/hns3pf/hclge_main.h   |  3 +++
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index ff6a2ed23ddb..8043f1795dc7 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -1537,6 +1537,9 @@ static int hclge_configure(struct hclge_dev *hdev)
 			cfg.default_speed, ret);
 		return ret;
 	}
+	hdev->hw.mac.req_speed = hdev->hw.mac.speed;
+	hdev->hw.mac.req_autoneg = AUTONEG_ENABLE;
+	hdev->hw.mac.req_duplex = DUPLEX_FULL;
 
 	hclge_parse_link_mode(hdev, cfg.speed_ability);
 
@@ -3342,9 +3345,9 @@ hclge_set_phy_link_ksettings(struct hnae3_handle *handle,
 		return ret;
 	}
 
-	hdev->hw.mac.autoneg = cmd->base.autoneg;
-	hdev->hw.mac.speed = cmd->base.speed;
-	hdev->hw.mac.duplex = cmd->base.duplex;
+	hdev->hw.mac.req_autoneg = cmd->base.autoneg;
+	hdev->hw.mac.req_speed = cmd->base.speed;
+	hdev->hw.mac.req_duplex = cmd->base.duplex;
 	linkmode_copy(hdev->hw.mac.advertising, cmd->link_modes.advertising);
 
 	return 0;
@@ -3377,9 +3380,9 @@ static int hclge_tp_port_init(struct hclge_dev *hdev)
 	if (!hnae3_dev_phy_imp_supported(hdev))
 		return 0;
 
-	cmd.base.autoneg = hdev->hw.mac.autoneg;
-	cmd.base.speed = hdev->hw.mac.speed;
-	cmd.base.duplex = hdev->hw.mac.duplex;
+	cmd.base.autoneg = hdev->hw.mac.req_autoneg;
+	cmd.base.speed = hdev->hw.mac.req_speed;
+	cmd.base.duplex = hdev->hw.mac.req_duplex;
 	linkmode_copy(cmd.link_modes.advertising, hdev->hw.mac.advertising);
 
 	return hclge_set_phy_link_ksettings(&hdev->vport->nic, &cmd);
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
index e821dd2f1528..e3c69be8256f 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
@@ -279,11 +279,14 @@ struct hclge_mac {
 	u8 media_type;	/* port media type, e.g. fibre/copper/backplane */
 	u8 mac_addr[ETH_ALEN];
 	u8 autoneg;
+	u8 req_autoneg;
 	u8 duplex;
+	u8 req_duplex;
 	u8 support_autoneg;
 	u8 speed_type;	/* 0: sfp speed, 1: active speed */
 	u8 lane_num;
 	u32 speed;
+	u32 req_speed;
 	u32 max_speed;
 	u32 speed_ability; /* speed ability supported by current media */
 	u32 module_type; /* sub media type, e.g. kr/cr/sr/lr */
-- 
2.30.0


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

* [PATCH V3 net 2/7] net: hns3: direct return when receive a unknown mailbox message
  2024-05-07 13:42 [PATCH V3 net 0/7] There are some bugfix for the HNS3 ethernet driver Jijie Shao
  2024-05-07 13:42 ` [PATCH V3 net 1/7] net: hns3: using user configure after hardware reset Jijie Shao
@ 2024-05-07 13:42 ` Jijie Shao
  2024-05-07 17:08   ` Markus Elfring
  2024-05-07 13:42 ` [PATCH V3 net 3/7] net: hns3: change type of numa_node_mask as nodemask_t Jijie Shao
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Jijie Shao @ 2024-05-07 13:42 UTC (permalink / raw
  To: yisen.zhuang, salil.mehta, davem, edumazet, kuba, pabeni, jiri,
	horms
  Cc: shenjian15, wangjie125, liuyonglong, shaojijie, chenhao418,
	netdev, linux-kernel

From: Jian Shen <shenjian15@huawei.com>

Currently, the driver didn't return when receive a unknown
mailbox message, and continue checking whether need to
generate a response. It's unnecessary and may be incorrect.

Fixes: bb5790b71bad ("net: hns3: refactor mailbox response scheme between PF and VF")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Jijie Shao <shaojijie@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
index d4a0e0be7a72..59c863306657 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
@@ -1077,12 +1077,13 @@ static void hclge_mbx_request_handling(struct hclge_mbx_ops_param *param)
 
 	hdev = param->vport->back;
 	cmd_func = hclge_mbx_ops_list[param->req->msg.code];
-	if (cmd_func)
-		ret = cmd_func(param);
-	else
+	if (!cmd_func) {
 		dev_err(&hdev->pdev->dev,
 			"un-supported mailbox message, code = %u\n",
 			param->req->msg.code);
+		return;
+	}
+	ret = cmd_func(param);
 
 	/* PF driver should not reply IMP */
 	if (hnae3_get_bit(param->req->mbx_need_resp, HCLGE_MBX_NEED_RESP_B) &&
-- 
2.30.0


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

* [PATCH V3 net 3/7] net: hns3: change type of numa_node_mask as nodemask_t
  2024-05-07 13:42 [PATCH V3 net 0/7] There are some bugfix for the HNS3 ethernet driver Jijie Shao
  2024-05-07 13:42 ` [PATCH V3 net 1/7] net: hns3: using user configure after hardware reset Jijie Shao
  2024-05-07 13:42 ` [PATCH V3 net 2/7] net: hns3: direct return when receive a unknown mailbox message Jijie Shao
@ 2024-05-07 13:42 ` Jijie Shao
  2024-05-07 13:42 ` [PATCH V3 net 4/7] net: hns3: release PTP resources if pf initialization failed Jijie Shao
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: Jijie Shao @ 2024-05-07 13:42 UTC (permalink / raw
  To: yisen.zhuang, salil.mehta, davem, edumazet, kuba, pabeni, jiri,
	horms
  Cc: shenjian15, wangjie125, liuyonglong, shaojijie, chenhao418,
	netdev, linux-kernel

From: Peiyang Wang <wangpeiyang1@huawei.com>

It provides nodemask_t to describe the numa node mask in kernel. To
improve transportability, change the type of numa_node_mask as nodemask_t.

Fixes: 38caee9d3ee8 ("net: hns3: Add support of the HNAE3 framework")
Signed-off-by: Peiyang Wang <wangpeiyang1@huawei.com>
Signed-off-by: Jijie Shao <shaojijie@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
---
 drivers/net/ethernet/hisilicon/hns3/hnae3.h               | 2 +-
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c   | 6 ++++--
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h   | 2 +-
 drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 7 ++++---
 drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h | 2 +-
 5 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
index f19f1e1d1f9f..133c94646c21 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
@@ -897,7 +897,7 @@ struct hnae3_handle {
 		struct hnae3_roce_private_info rinfo;
 	};
 
-	u32 numa_node_mask;	/* for multi-chip support */
+	nodemask_t numa_node_mask; /* for multi-chip support */
 
 	enum hnae3_port_base_vlan_state port_base_vlan_state;
 
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index 8043f1795dc7..ecff9b426527 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -1769,7 +1769,8 @@ static int hclge_vport_setup(struct hclge_vport *vport, u16 num_tqps)
 
 	nic->pdev = hdev->pdev;
 	nic->ae_algo = &ae_algo;
-	nic->numa_node_mask = hdev->numa_node_mask;
+	bitmap_copy(nic->numa_node_mask.bits, hdev->numa_node_mask.bits,
+		    MAX_NUMNODES);
 	nic->kinfo.io_base = hdev->hw.hw.io_base;
 
 	ret = hclge_knic_setup(vport, num_tqps,
@@ -2461,7 +2462,8 @@ static int hclge_init_roce_base_info(struct hclge_vport *vport)
 
 	roce->pdev = nic->pdev;
 	roce->ae_algo = nic->ae_algo;
-	roce->numa_node_mask = nic->numa_node_mask;
+	bitmap_copy(roce->numa_node_mask.bits, nic->numa_node_mask.bits,
+		    MAX_NUMNODES);
 
 	return 0;
 }
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
index e3c69be8256f..3a9186457ad8 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
@@ -894,7 +894,7 @@ struct hclge_dev {
 
 	u16 fdir_pf_filter_count; /* Num of guaranteed filters for this PF */
 	u16 num_alloc_vport;		/* Num vports this driver supports */
-	u32 numa_node_mask;
+	nodemask_t numa_node_mask;
 	u16 rx_buf_len;
 	u16 num_tx_desc;		/* desc num of per tx queue */
 	u16 num_rx_desc;		/* desc num of per rx queue */
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
index 0aa9beefd1c7..b57111252d07 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
@@ -412,7 +412,8 @@ static int hclgevf_set_handle_info(struct hclgevf_dev *hdev)
 
 	nic->ae_algo = &ae_algovf;
 	nic->pdev = hdev->pdev;
-	nic->numa_node_mask = hdev->numa_node_mask;
+	bitmap_copy(nic->numa_node_mask.bits, hdev->numa_node_mask.bits,
+		    MAX_NUMNODES);
 	nic->flags |= HNAE3_SUPPORT_VF;
 	nic->kinfo.io_base = hdev->hw.hw.io_base;
 
@@ -2082,8 +2083,8 @@ static int hclgevf_init_roce_base_info(struct hclgevf_dev *hdev)
 
 	roce->pdev = nic->pdev;
 	roce->ae_algo = nic->ae_algo;
-	roce->numa_node_mask = nic->numa_node_mask;
-
+	bitmap_copy(roce->numa_node_mask.bits, nic->numa_node_mask.bits,
+		    MAX_NUMNODES);
 	return 0;
 }
 
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h
index a73f2bf3a56a..cccef3228461 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h
@@ -236,7 +236,7 @@ struct hclgevf_dev {
 	u16 rss_size_max;	/* HW defined max RSS task queue */
 
 	u16 num_alloc_vport;	/* num vports this driver supports */
-	u32 numa_node_mask;
+	nodemask_t numa_node_mask;
 	u16 rx_buf_len;
 	u16 num_tx_desc;	/* desc num of per tx queue */
 	u16 num_rx_desc;	/* desc num of per rx queue */
-- 
2.30.0


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

* [PATCH V3 net 4/7] net: hns3: release PTP resources if pf initialization failed
  2024-05-07 13:42 [PATCH V3 net 0/7] There are some bugfix for the HNS3 ethernet driver Jijie Shao
                   ` (2 preceding siblings ...)
  2024-05-07 13:42 ` [PATCH V3 net 3/7] net: hns3: change type of numa_node_mask as nodemask_t Jijie Shao
@ 2024-05-07 13:42 ` Jijie Shao
  2024-05-07 17:26   ` Markus Elfring
  2024-05-07 13:42 ` [PATCH V3 net 5/7] net: hns3: use appropriate barrier function after setting a bit value Jijie Shao
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Jijie Shao @ 2024-05-07 13:42 UTC (permalink / raw
  To: yisen.zhuang, salil.mehta, davem, edumazet, kuba, pabeni, jiri,
	horms
  Cc: shenjian15, wangjie125, liuyonglong, shaojijie, chenhao418,
	netdev, linux-kernel

From: Peiyang Wang <wangpeiyang1@huawei.com>

During the PF initialization process, hclge_update_port_info may return an
error code for some reason. At this point,  the ptp initialization has been
completed. To void memory leaks, the resources that are applied by ptp
should be released. Therefore, when hclge_update_port_info returns an error
code, hclge_ptp_uninit is called to release the corresponding resources.

Fixes: eaf83ae59e18 ("net: hns3: add querying fec ability from firmware")
Signed-off-by: Peiyang Wang <wangpeiyang1@huawei.com>
Signed-off-by: Jijie Shao <shaojijie@huawei.com>
Reviewed-by: Hariprasad Kelam <hkelam@marvell.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 4 +++-
 1 file changed, 3 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 ecff9b426527..1d255b3ae988 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -11764,7 +11764,7 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
 
 	ret = hclge_update_port_info(hdev);
 	if (ret)
-		goto err_mdiobus_unreg;
+		goto err_ptp_uninit;
 
 	INIT_KFIFO(hdev->mac_tnl_log);
 
@@ -11815,6 +11815,8 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
 	devl_unlock(hdev->devlink);
 	return 0;
 
+err_ptp_uninit:
+	hclge_ptp_uninit(hdev);
 err_mdiobus_unreg:
 	if (hdev->hw.mac.phydev)
 		mdiobus_unregister(hdev->hw.mac.mdio_bus);
-- 
2.30.0


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

* [PATCH V3 net 5/7] net: hns3: use appropriate barrier function after setting a bit value
  2024-05-07 13:42 [PATCH V3 net 0/7] There are some bugfix for the HNS3 ethernet driver Jijie Shao
                   ` (3 preceding siblings ...)
  2024-05-07 13:42 ` [PATCH V3 net 4/7] net: hns3: release PTP resources if pf initialization failed Jijie Shao
@ 2024-05-07 13:42 ` Jijie Shao
  2024-05-07 13:42 ` [PATCH V3 net 6/7] net: hns3: fix port vlan filter not disabled issue Jijie Shao
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: Jijie Shao @ 2024-05-07 13:42 UTC (permalink / raw
  To: yisen.zhuang, salil.mehta, davem, edumazet, kuba, pabeni, jiri,
	horms
  Cc: shenjian15, wangjie125, liuyonglong, shaojijie, chenhao418,
	netdev, linux-kernel

From: Peiyang Wang <wangpeiyang1@huawei.com>

There is a memory barrier in followed case. When set the port down,
hclgevf_set_timmer will set DOWN in state. Meanwhile, the service task has
different behaviour based on whether the state is DOWN. Thus, to make sure
service task see DOWN, use smp_mb__after_atomic after calling set_bit().

          CPU0                        CPU1
========================== ===================================
hclgevf_set_timer_task()    hclgevf_periodic_service_task()
  set_bit(DOWN,state)         test_bit(DOWN,state)

pf also has this issue.

Fixes: ff200099d271 ("net: hns3: remove unnecessary work in hclgevf_main")
Fixes: 1c6dfe6fc6f7 ("net: hns3: remove mailbox and reset work in hclge_main")
Signed-off-by: Peiyang Wang <wangpeiyang1@huawei.com>
Signed-off-by: Jijie Shao <shaojijie@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c   | 3 +--
 drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index 1d255b3ae988..e3d6a64b4575 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -7957,8 +7957,7 @@ static void hclge_set_timer_task(struct hnae3_handle *handle, bool enable)
 		/* Set the DOWN flag here to disable link updating */
 		set_bit(HCLGE_STATE_DOWN, &hdev->state);
 
-		/* flush memory to make sure DOWN is seen by service task */
-		smp_mb__before_atomic();
+		smp_mb__after_atomic(); /* flush memory to make sure DOWN is seen by service task */
 		hclge_flush_link_update(hdev);
 	}
 }
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
index b57111252d07..08db8e84be4e 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
@@ -2181,8 +2181,7 @@ static void hclgevf_set_timer_task(struct hnae3_handle *handle, bool enable)
 	} else {
 		set_bit(HCLGEVF_STATE_DOWN, &hdev->state);
 
-		/* flush memory to make sure DOWN is seen by service task */
-		smp_mb__before_atomic();
+		smp_mb__after_atomic(); /* flush memory to make sure DOWN is seen by service task */
 		hclgevf_flush_link_update(hdev);
 	}
 }
-- 
2.30.0


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

* [PATCH V3 net 6/7] net: hns3: fix port vlan filter not disabled issue
  2024-05-07 13:42 [PATCH V3 net 0/7] There are some bugfix for the HNS3 ethernet driver Jijie Shao
                   ` (4 preceding siblings ...)
  2024-05-07 13:42 ` [PATCH V3 net 5/7] net: hns3: use appropriate barrier function after setting a bit value Jijie Shao
@ 2024-05-07 13:42 ` Jijie Shao
  2024-05-07 17:51   ` Markus Elfring
  2024-05-07 13:42 ` [PATCH V3 net 7/7] net: hns3: fix kernel crash when devlink reload during initialization Jijie Shao
  2024-05-09  9:00 ` [PATCH V3 net 0/7] There are some bugfix for the HNS3 ethernet driver patchwork-bot+netdevbpf
  7 siblings, 1 reply; 16+ messages in thread
From: Jijie Shao @ 2024-05-07 13:42 UTC (permalink / raw
  To: yisen.zhuang, salil.mehta, davem, edumazet, kuba, pabeni, jiri,
	horms
  Cc: shenjian15, wangjie125, liuyonglong, shaojijie, chenhao418,
	netdev, linux-kernel

From: Yonglong Liu <liuyonglong@huawei.com>

According to hardware limitation, for device support modify
VLAN filter state but not support bypass port VLAN filter,
it should always disable the port VLAN filter. but the driver
enables port VLAN filter when initializing, if there is no
VLAN(except VLAN 0) id added, the driver will disable it
in service task. In most time, it works fine. But there is
a time window before the service task shceduled and net device
being registered. So if user adds VLAN at this time, the driver
will not update the VLAN filter state,  and the port VLAN filter
remains enabled.

To fix the problem, if support modify VLAN filter state but not
support bypass port VLAN filter, set the port vlan filter to "off".

Fixes: 184cd221a863 ("net: hns3: disable port VLAN filter when support function level VLAN filter control")
Fixes: 2ba306627f59 ("net: hns3: add support for modify VLAN filter state")
Signed-off-by: Yonglong Liu <liuyonglong@huawei.com>
Signed-off-by: Jijie Shao <shaojijie@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 7 ++++++-
 1 file changed, 6 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 e3d6a64b4575..0773124440e9 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -9910,6 +9910,7 @@ static int hclge_set_vlan_protocol_type(struct hclge_dev *hdev)
 static int hclge_init_vlan_filter(struct hclge_dev *hdev)
 {
 	struct hclge_vport *vport;
+	bool enable = true;
 	int ret;
 	int i;
 
@@ -9929,8 +9930,12 @@ static int hclge_init_vlan_filter(struct hclge_dev *hdev)
 		vport->cur_vlan_fltr_en = true;
 	}
 
+	if (test_bit(HNAE3_DEV_SUPPORT_VLAN_FLTR_MDF_B, hdev->ae_dev->caps) &&
+	    !test_bit(HNAE3_DEV_SUPPORT_PORT_VLAN_BYPASS_B, hdev->ae_dev->caps))
+		enable = false;
+
 	return hclge_set_vlan_filter_ctrl(hdev, HCLGE_FILTER_TYPE_PORT,
-					  HCLGE_FILTER_FE_INGRESS, true, 0);
+					  HCLGE_FILTER_FE_INGRESS, enable, 0);
 }
 
 static int hclge_init_vlan_type(struct hclge_dev *hdev)
-- 
2.30.0


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

* [PATCH V3 net 7/7] net: hns3: fix kernel crash when devlink reload during initialization
  2024-05-07 13:42 [PATCH V3 net 0/7] There are some bugfix for the HNS3 ethernet driver Jijie Shao
                   ` (5 preceding siblings ...)
  2024-05-07 13:42 ` [PATCH V3 net 6/7] net: hns3: fix port vlan filter not disabled issue Jijie Shao
@ 2024-05-07 13:42 ` Jijie Shao
  2024-05-07 18:05   ` Markus Elfring
  2024-05-09  9:00 ` [PATCH V3 net 0/7] There are some bugfix for the HNS3 ethernet driver patchwork-bot+netdevbpf
  7 siblings, 1 reply; 16+ messages in thread
From: Jijie Shao @ 2024-05-07 13:42 UTC (permalink / raw
  To: yisen.zhuang, salil.mehta, davem, edumazet, kuba, pabeni, jiri,
	horms
  Cc: shenjian15, wangjie125, liuyonglong, shaojijie, chenhao418,
	netdev, linux-kernel

From: Yonglong Liu <liuyonglong@huawei.com>

The devlink reload process will access the hardware resources,
but the register operation is done before the hardware is initialized.
So, processing the devlink reload during initialization may lead to kernel
crash.

This patch fixes this by registering the devlink after
hardware initialization.

Fixes: cd6242991d2e ("net: hns3: add support for registering devlink for VF")
Fixes: 93305b77ffcb ("net: hns3: fix kernel crash when devlink reload during pf initialization")
Signed-off-by: Yonglong Liu <liuyonglong@huawei.com>
Signed-off-by: Jijie Shao <shaojijie@huawei.com>
---
 .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 17 +++++------------
 .../hisilicon/hns3/hns3vf/hclgevf_main.c        | 10 ++++------
 2 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index 0773124440e9..ce60332d83c3 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -11631,16 +11631,10 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
 	if (ret)
 		goto out;
 
-	ret = hclge_devlink_init(hdev);
-	if (ret)
-		goto err_pci_uninit;
-
-	devl_lock(hdev->devlink);
-
 	/* Firmware command queue initialize */
 	ret = hclge_comm_cmd_queue_init(hdev->pdev, &hdev->hw.hw);
 	if (ret)
-		goto err_devlink_uninit;
+		goto err_pci_uninit;
 
 	/* Firmware command initialize */
 	ret = hclge_comm_cmd_init(hdev->ae_dev, &hdev->hw.hw, &hdev->fw_version,
@@ -11808,6 +11802,10 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
 		dev_warn(&pdev->dev,
 			 "failed to wake on lan init, ret = %d\n", ret);
 
+	ret = hclge_devlink_init(hdev);
+	if (ret)
+		goto err_ptp_uninit;
+
 	hclge_state_init(hdev);
 	hdev->last_reset_time = jiffies;
 
@@ -11815,8 +11813,6 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
 		 HCLGE_DRIVER_NAME);
 
 	hclge_task_schedule(hdev, round_jiffies_relative(HZ));
-
-	devl_unlock(hdev->devlink);
 	return 0;
 
 err_ptp_uninit:
@@ -11830,9 +11826,6 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
 	pci_free_irq_vectors(pdev);
 err_cmd_uninit:
 	hclge_comm_cmd_uninit(hdev->ae_dev, &hdev->hw.hw);
-err_devlink_uninit:
-	devl_unlock(hdev->devlink);
-	hclge_devlink_uninit(hdev);
 err_pci_uninit:
 	pcim_iounmap(pdev, hdev->hw.hw.io_base);
 	pci_release_regions(pdev);
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
index 08db8e84be4e..43ee20eb03d1 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
@@ -2845,10 +2845,6 @@ static int hclgevf_init_hdev(struct hclgevf_dev *hdev)
 	if (ret)
 		return ret;
 
-	ret = hclgevf_devlink_init(hdev);
-	if (ret)
-		goto err_devlink_init;
-
 	ret = hclge_comm_cmd_queue_init(hdev->pdev, &hdev->hw.hw);
 	if (ret)
 		goto err_cmd_queue_init;
@@ -2941,6 +2937,10 @@ static int hclgevf_init_hdev(struct hclgevf_dev *hdev)
 
 	hclgevf_init_rxd_adv_layout(hdev);
 
+	ret = hclgevf_devlink_init(hdev);
+	if (ret)
+		goto err_config;
+
 	set_bit(HCLGEVF_STATE_SERVICE_INITED, &hdev->state);
 
 	hdev->last_reset_time = jiffies;
@@ -2960,8 +2960,6 @@ static int hclgevf_init_hdev(struct hclgevf_dev *hdev)
 err_cmd_init:
 	hclge_comm_cmd_uninit(hdev->ae_dev, &hdev->hw.hw);
 err_cmd_queue_init:
-	hclgevf_devlink_uninit(hdev);
-err_devlink_init:
 	hclgevf_pci_uninit(hdev);
 	clear_bit(HCLGEVF_STATE_IRQ_INITED, &hdev->state);
 	return ret;
-- 
2.30.0


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

* Re: [PATCH V3 net 1/7] net: hns3: using user configure after hardware reset
  2024-05-07 13:42 ` [PATCH V3 net 1/7] net: hns3: using user configure after hardware reset Jijie Shao
@ 2024-05-07 15:20   ` Przemek Kitszel
  2024-05-07 16:51   ` Markus Elfring
  2024-05-08 16:21   ` Simon Horman
  2 siblings, 0 replies; 16+ messages in thread
From: Przemek Kitszel @ 2024-05-07 15:20 UTC (permalink / raw
  To: Jijie Shao, yisen.zhuang, salil.mehta, davem, edumazet, kuba,
	pabeni, jiri, horms
  Cc: shenjian15, wangjie125, liuyonglong, chenhao418, netdev,
	linux-kernel

On 5/7/24 15:42, Jijie Shao wrote:
> From: Peiyang Wang <wangpeiyang1@huawei.com>
> 
> When a reset occurring, it's supposed to recover user's configuration.
> Currently, the port info(speed, duplex and autoneg) is stored in hclge_mac
> and will be scheduled updated. Consider the case that reset was happened
> consecutively. During the first reset, the port info is configured with
> a temporary value cause the PHY is reset and looking for best link config.
> Second reset start and use pervious configuration which is not the user's.

nit: for future submissions please run your commit messages through
spellchecker

> The specific process is as follows:
> 
> +------+               +----+                +----+
> | USER |               | PF |                | HW |
> +---+--+               +-+--+                +-+--+
>      |  ethtool --reset   |                     |
>      +------------------->|    reset command    |
>      |  ethtool --reset   +-------------------->|
>      +------------------->|                     +---+
>      |                    +---+                 |   |
>      |                    |   |reset currently  |   | HW RESET
>      |                    |   |and wait to do   |   |
>      |                    |<--+                 |   |
>      |                    | send pervious cfg   |<--+
>      |                    | (1000M FULL AN_ON)  |
>      |                    +-------------------->|
>      |                    | read cfg(time task) |
>      |                    | (10M HALF AN_OFF)   +---+
>      |                    |<--------------------+   | cfg take effect
>      |                    |    reset command    |<--+
>      |                    +-------------------->|
>      |                    |                     +---+
>      |                    | send pervious cfg   |   | HW RESET
>      |                    | (10M HALF AN_OFF)   |<--+
>      |                    +-------------------->|
>      |                    | read cfg(time task) |
>      |                    |  (10M HALF AN_OFF)  +---+
>      |                    |<--------------------+   | cfg take effect
>      |                    |                     |   |
>      |                    | read cfg(time task) |<--+
>      |                    |  (10M HALF AN_OFF)  |
>      |                    |<--------------------+
>      |                    |                     |
>      v                    v                     v
> 
> To avoid aboved situation, this patch introduced req_speed, req_duplex,
> req_autoneg to store user's configuration and it only be used after
> hardware reset and to recover user's configuration
> 
> Fixes: f5f2b3e4dcc0 ("net: hns3: add support for imp-controlled PHYs")
> Signed-off-by: Peiyang Wang <wangpeiyang1@huawei.com>
> Signed-off-by: Jijie Shao <shaojijie@huawei.com>
> ---
>   .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c   | 15 +++++++++------
>   .../ethernet/hisilicon/hns3/hns3pf/hclge_main.h   |  3 +++
>   2 files changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
> index ff6a2ed23ddb..8043f1795dc7 100644
> --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
> @@ -1537,6 +1537,9 @@ static int hclge_configure(struct hclge_dev *hdev)
>   			cfg.default_speed, ret);
>   		return ret;
>   	}
> +	hdev->hw.mac.req_speed = hdev->hw.mac.speed;
> +	hdev->hw.mac.req_autoneg = AUTONEG_ENABLE;
> +	hdev->hw.mac.req_duplex = DUPLEX_FULL;
>   
>   	hclge_parse_link_mode(hdev, cfg.speed_ability);
>   
> @@ -3342,9 +3345,9 @@ hclge_set_phy_link_ksettings(struct hnae3_handle *handle,
>   		return ret;
>   	}
>   
> -	hdev->hw.mac.autoneg = cmd->base.autoneg;
> -	hdev->hw.mac.speed = cmd->base.speed;
> -	hdev->hw.mac.duplex = cmd->base.duplex;
> +	hdev->hw.mac.req_autoneg = cmd->base.autoneg;
> +	hdev->hw.mac.req_speed = cmd->base.speed;
> +	hdev->hw.mac.req_duplex = cmd->base.duplex;
>   	linkmode_copy(hdev->hw.mac.advertising, cmd->link_modes.advertising);
>   
>   	return 0;
> @@ -3377,9 +3380,9 @@ static int hclge_tp_port_init(struct hclge_dev *hdev)
>   	if (!hnae3_dev_phy_imp_supported(hdev))
>   		return 0;
>   
> -	cmd.base.autoneg = hdev->hw.mac.autoneg;
> -	cmd.base.speed = hdev->hw.mac.speed;
> -	cmd.base.duplex = hdev->hw.mac.duplex;
> +	cmd.base.autoneg = hdev->hw.mac.req_autoneg;
> +	cmd.base.speed = hdev->hw.mac.req_speed;
> +	cmd.base.duplex = hdev->hw.mac.req_duplex;
>   	linkmode_copy(cmd.link_modes.advertising, hdev->hw.mac.advertising);
>   
>   	return hclge_set_phy_link_ksettings(&hdev->vport->nic, &cmd);
> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
> index e821dd2f1528..e3c69be8256f 100644
> --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
> @@ -279,11 +279,14 @@ struct hclge_mac {
>   	u8 media_type;	/* port media type, e.g. fibre/copper/backplane */
>   	u8 mac_addr[ETH_ALEN];
>   	u8 autoneg;
> +	u8 req_autoneg;
>   	u8 duplex;
> +	u8 req_duplex;
>   	u8 support_autoneg;
>   	u8 speed_type;	/* 0: sfp speed, 1: active speed */
>   	u8 lane_num;
>   	u32 speed;
> +	u32 req_speed;
>   	u32 max_speed;
>   	u32 speed_ability; /* speed ability supported by current media */
>   	u32 module_type; /* sub media type, e.g. kr/cr/sr/lr */

Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>

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

* Re: [PATCH V3 net 1/7] net: hns3: using user configure after hardware reset
  2024-05-07 13:42 ` [PATCH V3 net 1/7] net: hns3: using user configure after hardware reset Jijie Shao
  2024-05-07 15:20   ` Przemek Kitszel
@ 2024-05-07 16:51   ` Markus Elfring
  2024-05-08 16:21   ` Simon Horman
  2 siblings, 0 replies; 16+ messages in thread
From: Markus Elfring @ 2024-05-07 16:51 UTC (permalink / raw
  To: Jijie Shao, Peiyang Wang, netdev, kernel-janitors,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Jiri Pirko,
	Paolo Abeni, Salil Mehta, Simon Horman, Yisen Zhuang
  Cc: LKML, Hao Chen, Jie Wang, Przemek Kitszel, Yonglong Liu

Can any wording adjustments be a bit nicer?


> When a reset occurring, it's supposed to recover user's configuration.

An user configuration should be recovered after a reset occurred.


…
> and will be scheduled updated. Consider the case that reset was happened

and the schedule will be updated. Consider also the case that reset happened


…
> To avoid aboved situation, this patch introduced …

* Would you like to avoid another typo here?

* How do you think about to use imperative wordings for improved change descriptions?
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.9-rc7#n94

Regards,
Markus

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

* Re: [PATCH V3 net 2/7] net: hns3: direct return when receive a unknown mailbox message
  2024-05-07 13:42 ` [PATCH V3 net 2/7] net: hns3: direct return when receive a unknown mailbox message Jijie Shao
@ 2024-05-07 17:08   ` Markus Elfring
  0 siblings, 0 replies; 16+ messages in thread
From: Markus Elfring @ 2024-05-07 17:08 UTC (permalink / raw
  To: Jijie Shao, Peiyang Wang, netdev, kernel-janitors,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Jiri Pirko,
	Paolo Abeni, Salil Mehta, Simon Horman, Yisen Zhuang
  Cc: LKML, Hao Chen, Jie Wang, Przemek Kitszel, Yonglong Liu

> Currently, the driver didn't return when receive a unknown
> mailbox message, and continue checking whether need to
> generate a response. It's unnecessary and may be incorrect.

Please improve this change description.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.9-rc7#n94

Regards,
Markus

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

* Re: [PATCH V3 net 4/7] net: hns3: release PTP resources if pf initialization failed
  2024-05-07 13:42 ` [PATCH V3 net 4/7] net: hns3: release PTP resources if pf initialization failed Jijie Shao
@ 2024-05-07 17:26   ` Markus Elfring
  0 siblings, 0 replies; 16+ messages in thread
From: Markus Elfring @ 2024-05-07 17:26 UTC (permalink / raw
  To: Jijie Shao, Peiyang Wang, netdev, kernel-janitors,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Jiri Pirko,
	Paolo Abeni, Salil Mehta, Simon Horman, Yisen Zhuang
  Cc: LKML, Hao Chen, Jie Wang, Przemek Kitszel, Yonglong Liu

…
> code, hclge_ptp_uninit is called to release the corresponding resources.

Wording suggestion:
   Add a jump target so that the corresponding resources are released
   with a hclge_ptp_uninit() call.


See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.9-rc7#n94

Regards,
Markus

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

* Re: [PATCH V3 net 6/7] net: hns3: fix port vlan filter not disabled issue
  2024-05-07 13:42 ` [PATCH V3 net 6/7] net: hns3: fix port vlan filter not disabled issue Jijie Shao
@ 2024-05-07 17:51   ` Markus Elfring
  0 siblings, 0 replies; 16+ messages in thread
From: Markus Elfring @ 2024-05-07 17:51 UTC (permalink / raw
  To: Jijie Shao, Yonglong Liu, netdev, kernel-janitors,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Jiri Pirko,
	Paolo Abeni, Salil Mehta, Simon Horman, Yisen Zhuang
  Cc: LKML, Hao Chen, Jie Wang, Przemek Kitszel

…
> will not update the VLAN filter state,  and the port VLAN filter
> remains enabled.

I suggest to use more than 64 characters in further lines of such
a change description.


> To fix the problem, if support modify VLAN filter state but not
> support bypass port VLAN filter, …

I find a few wording adjustments helpful in this changelog.

Regards,
Markus

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

* Re: [PATCH V3 net 7/7] net: hns3: fix kernel crash when devlink reload during initialization
  2024-05-07 13:42 ` [PATCH V3 net 7/7] net: hns3: fix kernel crash when devlink reload during initialization Jijie Shao
@ 2024-05-07 18:05   ` Markus Elfring
  0 siblings, 0 replies; 16+ messages in thread
From: Markus Elfring @ 2024-05-07 18:05 UTC (permalink / raw
  To: Jijie Shao, Yonglong Liu, netdev, kernel-janitors,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Jiri Pirko,
	Paolo Abeni, Salil Mehta, Simon Horman, Yisen Zhuang
  Cc: LKML, Hao Chen, Jie Wang, Przemek Kitszel

…
> This patch fixes this by registering …

Please choose an imperative wording for a better change description.

Regards,
Markus

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

* Re: [PATCH V3 net 1/7] net: hns3: using user configure after hardware reset
  2024-05-07 13:42 ` [PATCH V3 net 1/7] net: hns3: using user configure after hardware reset Jijie Shao
  2024-05-07 15:20   ` Przemek Kitszel
  2024-05-07 16:51   ` Markus Elfring
@ 2024-05-08 16:21   ` Simon Horman
  2 siblings, 0 replies; 16+ messages in thread
From: Simon Horman @ 2024-05-08 16:21 UTC (permalink / raw
  To: Jijie Shao
  Cc: yisen.zhuang, salil.mehta, davem, edumazet, kuba, pabeni, jiri,
	shenjian15, wangjie125, liuyonglong, chenhao418, netdev,
	linux-kernel

On Tue, May 07, 2024 at 09:42:18PM +0800, Jijie Shao wrote:
> From: Peiyang Wang <wangpeiyang1@huawei.com>
> 
> When a reset occurring, it's supposed to recover user's configuration.
> Currently, the port info(speed, duplex and autoneg) is stored in hclge_mac
> and will be scheduled updated. Consider the case that reset was happened
> consecutively. During the first reset, the port info is configured with
> a temporary value cause the PHY is reset and looking for best link config.
> Second reset start and use pervious configuration which is not the user's.
> The specific process is as follows:
> 
> +------+               +----+                +----+
> | USER |               | PF |                | HW |
> +---+--+               +-+--+                +-+--+
>     |  ethtool --reset   |                     |
>     +------------------->|    reset command    |
>     |  ethtool --reset   +-------------------->|
>     +------------------->|                     +---+
>     |                    +---+                 |   |
>     |                    |   |reset currently  |   | HW RESET
>     |                    |   |and wait to do   |   |
>     |                    |<--+                 |   |
>     |                    | send pervious cfg   |<--+
>     |                    | (1000M FULL AN_ON)  |
>     |                    +-------------------->|
>     |                    | read cfg(time task) |
>     |                    | (10M HALF AN_OFF)   +---+
>     |                    |<--------------------+   | cfg take effect
>     |                    |    reset command    |<--+
>     |                    +-------------------->|
>     |                    |                     +---+
>     |                    | send pervious cfg   |   | HW RESET
>     |                    | (10M HALF AN_OFF)   |<--+
>     |                    +-------------------->|
>     |                    | read cfg(time task) |
>     |                    |  (10M HALF AN_OFF)  +---+
>     |                    |<--------------------+   | cfg take effect
>     |                    |                     |   |
>     |                    | read cfg(time task) |<--+
>     |                    |  (10M HALF AN_OFF)  |
>     |                    |<--------------------+
>     |                    |                     |
>     v                    v                     v
> 
> To avoid aboved situation, this patch introduced req_speed, req_duplex,
> req_autoneg to store user's configuration and it only be used after
> hardware reset and to recover user's configuration
> 
> Fixes: f5f2b3e4dcc0 ("net: hns3: add support for imp-controlled PHYs")
> Signed-off-by: Peiyang Wang <wangpeiyang1@huawei.com>
> Signed-off-by: Jijie Shao <shaojijie@huawei.com>

Thanks for the update since v1.

Reviewed-by: Simon Horman <horms@kernel.org>


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

* Re: [PATCH V3 net 0/7] There are some bugfix for the HNS3 ethernet driver
  2024-05-07 13:42 [PATCH V3 net 0/7] There are some bugfix for the HNS3 ethernet driver Jijie Shao
                   ` (6 preceding siblings ...)
  2024-05-07 13:42 ` [PATCH V3 net 7/7] net: hns3: fix kernel crash when devlink reload during initialization Jijie Shao
@ 2024-05-09  9:00 ` patchwork-bot+netdevbpf
  7 siblings, 0 replies; 16+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-05-09  9:00 UTC (permalink / raw
  To: Jijie Shao
  Cc: yisen.zhuang, salil.mehta, davem, edumazet, kuba, pabeni, jiri,
	horms, shenjian15, wangjie125, liuyonglong, chenhao418, netdev,
	linux-kernel

Hello:

This series was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Tue, 7 May 2024 21:42:17 +0800 you wrote:
> There are some bugfix for the HNS3 ethernet driver
> 
> ---
> changeLog:
> v2 -> v3:
>   - Fix coding errors in "net: hns3: using user configure after hardware reset", suggested by Simon Horman
>   https://lore.kernel.org/all/20240426100045.1631295-1-shaojijie@huawei.com/
> v1 -> v2:
>   - Adjust the code sequence to completely eliminate the race window, suggested by Jiri Pirko
>   v1: https://lore.kernel.org/all/20240422134327.3160587-1-shaojijie@huawei.com/
> 
> [...]

Here is the summary with links:
  - [V3,net,1/7] net: hns3: using user configure after hardware reset
    https://git.kernel.org/netdev/net/c/05eb60e9648c
  - [V3,net,2/7] net: hns3: direct return when receive a unknown mailbox message
    https://git.kernel.org/netdev/net/c/669554c512d2
  - [V3,net,3/7] net: hns3: change type of numa_node_mask as nodemask_t
    https://git.kernel.org/netdev/net/c/6639a7b95321
  - [V3,net,4/7] net: hns3: release PTP resources if pf initialization failed
    https://git.kernel.org/netdev/net/c/950aa4239989
  - [V3,net,5/7] net: hns3: use appropriate barrier function after setting a bit value
    https://git.kernel.org/netdev/net/c/094c28122852
  - [V3,net,6/7] net: hns3: fix port vlan filter not disabled issue
    https://git.kernel.org/netdev/net/c/f5db7a3b65c8
  - [V3,net,7/7] net: hns3: fix kernel crash when devlink reload during initialization
    https://git.kernel.org/netdev/net/c/35d92abfbad8

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] 16+ messages in thread

end of thread, other threads:[~2024-05-09  9:00 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-07 13:42 [PATCH V3 net 0/7] There are some bugfix for the HNS3 ethernet driver Jijie Shao
2024-05-07 13:42 ` [PATCH V3 net 1/7] net: hns3: using user configure after hardware reset Jijie Shao
2024-05-07 15:20   ` Przemek Kitszel
2024-05-07 16:51   ` Markus Elfring
2024-05-08 16:21   ` Simon Horman
2024-05-07 13:42 ` [PATCH V3 net 2/7] net: hns3: direct return when receive a unknown mailbox message Jijie Shao
2024-05-07 17:08   ` Markus Elfring
2024-05-07 13:42 ` [PATCH V3 net 3/7] net: hns3: change type of numa_node_mask as nodemask_t Jijie Shao
2024-05-07 13:42 ` [PATCH V3 net 4/7] net: hns3: release PTP resources if pf initialization failed Jijie Shao
2024-05-07 17:26   ` Markus Elfring
2024-05-07 13:42 ` [PATCH V3 net 5/7] net: hns3: use appropriate barrier function after setting a bit value Jijie Shao
2024-05-07 13:42 ` [PATCH V3 net 6/7] net: hns3: fix port vlan filter not disabled issue Jijie Shao
2024-05-07 17:51   ` Markus Elfring
2024-05-07 13:42 ` [PATCH V3 net 7/7] net: hns3: fix kernel crash when devlink reload during initialization Jijie Shao
2024-05-07 18:05   ` Markus Elfring
2024-05-09  9:00 ` [PATCH V3 net 0/7] There are some bugfix for the HNS3 ethernet driver 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 read-only IMAP folder(s) and NNTP newsgroup(s).