Skip to contentSkip to conversation

net/hns3: support RAS process in Kunpeng 930

PATCH Applied Min Hu (Connor) 2 participants 2 messages Apr 19, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/hns3: support RAS process in Kunpeng 930

From: Hongbo Zheng <[email protected]>

Kunpeng 930 uses a new RAS exception reporting solution. The reset type and exception status are reported through firmware. The driver modifies the corresponding code to adapt to the new solution.

---
 drivers/net/hns3/hns3_cmd.c       |   9 +-
 drivers/net/hns3/hns3_cmd.h       |   2 +
 drivers/net/hns3/hns3_ethdev.c    |  11 +-
 drivers/net/hns3/hns3_ethdev.h    |  23 ++-
 drivers/net/hns3/hns3_ethdev_vf.c |   3 +-
 drivers/net/hns3/hns3_intr.c      | 296 +++++++++++++++++++++++++++++++++++++-
 drivers/net/hns3/hns3_intr.h      |  70 +++++++++
 7 files changed, 399 insertions(+), 15 deletions(-)
drivers/net/hns3/hns3_cmd.c +8 -1
index 75d5299..448e657 100644
@@ -237,7 +237,12 @@ hns3_is_special_opcode(uint16_t opcode)
 				  HNS3_OPC_STATS_MAC,
 				  HNS3_OPC_STATS_MAC_ALL,
 				  HNS3_OPC_QUERY_32_BIT_REG,
-				  HNS3_OPC_QUERY_64_BIT_REG};
+				  HNS3_OPC_QUERY_64_BIT_REG,
+				  HNS3_OPC_QUERY_CLEAR_MPF_RAS_INT,
+				  HNS3_OPC_QUERY_CLEAR_PF_RAS_INT,
+				  HNS3_OPC_QUERY_CLEAR_ALL_MPF_MSIX_INT,
+				  HNS3_OPC_QUERY_CLEAR_ALL_PF_MSIX_INT,
+				  HNS3_OPC_QUERY_ALL_ERR_INFO,};
 	uint32_t i;
 
 	for (i = 0; i < ARRAY_SIZE(spec_opcode); i++)
@@ -449,6 +454,8 @@ hns3_parse_capability(struct hns3_hw *hw,
 	if (hns3_get_bit(caps, HNS3_CAPS_UDP_TUNNEL_CSUM_B))
 		hns3_set_bit(hw->capability,
 				HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B, 1);
+	if (hns3_get_bit(caps, HNS3_CAPS_RAS_IMP_B))
+		hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_RAS_IMP_B, 1);
 }
 
 static uint32_t
drivers/net/hns3/hns3_cmd.h +2 -0
index e4f5aa6..bf1772d 100644
@@ -252,6 +252,8 @@ enum hns3_opcode_type {
 	HNS3_OPC_QUERY_MSIX_INT_STS_BD_NUM      = 0x1513,
 	HNS3_OPC_QUERY_CLEAR_ALL_MPF_MSIX_INT   = 0x1514,
 	HNS3_OPC_QUERY_CLEAR_ALL_PF_MSIX_INT    = 0x1515,
+	HNS3_OPC_QUERY_ALL_ERR_BD_NUM           = 0x1516,
+	HNS3_OPC_QUERY_ALL_ERR_INFO             = 0x1517,
 	HNS3_OPC_IGU_EGU_TNL_INT_EN             = 0x1803,
 	HNS3_OPC_IGU_COMMON_INT_EN              = 0x1806,
 	HNS3_OPC_TM_QCN_MEM_INT_CFG             = 0x1A14,
drivers/net/hns3/hns3_ethdev.c +6 -5
index 1832d26..cbcc4f4 100644
@@ -324,10 +324,8 @@ hns3_interrupt_handler(void *param)
 		hns3_warn(hw, "received interrupt: vector0_int_stat:0x%x "
 			  "ras_int_stat:0x%x cmdq_int_stat:0x%x",
 			  vector0_int, ras_int, cmdq_int);
-		hns3_handle_msix_error(hns, &hw->reset.request);
-		hns3_handle_ras_error(hns, &hw->reset.request);
 		hns3_handle_mac_tnl(hw);
-		hns3_schedule_reset(hns);
+		hns3_handle_error(hns);
 	} else if (event_cause == HNS3_VECTOR0_EVENT_RST) {
 		hns3_warn(hw, "received reset interrupt");
 		hns3_schedule_reset(hns);
@@ -6284,12 +6282,15 @@ hns3_is_reset_pending(struct hns3_adapter *hns)
 
 	hns3_check_event_cause(hns, NULL);
 	reset = hns3_get_reset_level(hns, &hw->reset.pending);
-	if (hw->reset.level != HNS3_NONE_RESET && hw->reset.level < reset) {
+
+	if (reset != HNS3_NONE_RESET && hw->reset.level != HNS3_NONE_RESET &&
+	    hw->reset.level < reset) {
 		hns3_warn(hw, "High level reset %d is pending", reset);
 		return true;
 	}
 	reset = hns3_get_reset_level(hns, &hw->reset.request);
-	if (hw->reset.level != HNS3_NONE_RESET && hw->reset.level < reset) {
+	if (reset != HNS3_NONE_RESET && hw->reset.level != HNS3_NONE_RESET &&
+	    hw->reset.level < reset) {
 		hns3_warn(hw, "High level reset %d is request", reset);
 		return true;
 	}
drivers/net/hns3/hns3_ethdev.h +19 -4
index 7b7d359..2ee2951 100644
@@ -306,8 +306,9 @@ enum hns3_reset_stage {
 };
 
 enum hns3_reset_level {
-	HNS3_NONE_RESET,
+	HNS3_FLR_RESET,     /* A VF perform FLR reset */
 	HNS3_VF_FUNC_RESET, /* A VF function reset */
+
 	/*
 	 * All VFs under a PF perform function reset.
 	 * Kernel PF driver use mailbox to inform DPDK VF to do reset, the value
@@ -315,6 +316,7 @@ enum hns3_reset_level {
 	 * same.
 	 */
 	HNS3_VF_PF_FUNC_RESET = 2,
+
 	/*
 	 * All VFs under a PF perform FLR reset.
 	 * Kernel PF driver use mailbox to inform DPDK VF to do reset, the value
@@ -328,14 +330,23 @@ enum hns3_reset_level {
 	 * In PF FLR, the register state of VF is not reliable, VF's driver
 	 * should not access the registers of the VF device.
 	 */
-	HNS3_VF_FULL_RESET = 3,
-	HNS3_FLR_RESET,     /* A VF perform FLR reset */
+	HNS3_VF_FULL_RESET,
+
 	/* All VFs under the rootport perform a global or IMP reset */
 	HNS3_VF_RESET,
-	HNS3_FUNC_RESET,    /* A PF function reset */
+
+	/*
+	 * The enumeration value of HNS3_FUNC_RESET/HNS3_GLOBAL_RESET/
+	 * HNS3_IMP_RESET/HNS3_NONE_RESET are also used by firmware, and
+	 * can not be changed.
+	 */
+
+	HNS3_FUNC_RESET = 5,    /* A PF function reset */
+
 	/* All PFs under the rootport perform a global reset */
 	HNS3_GLOBAL_RESET,
 	HNS3_IMP_RESET,     /* All PFs under the rootport perform a IMP reset */
+	HNS3_NONE_RESET,
 	HNS3_MAX_RESET
 };
 
@@ -846,6 +857,7 @@ enum {
 #define HNS3_DEV_SUPPORT_STASH_B		0x7
 #define HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B	0x9
 #define HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B	0xA
+#define HNS3_DEV_SUPPORT_RAS_IMP_B		0xB
 
 #define hns3_dev_dcb_supported(hw) \
 	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_DCB_B)
@@ -882,6 +894,9 @@ enum {
 #define hns3_dev_outer_udp_cksum_supported(hw) \
 	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B)
 
+#define hns3_dev_ras_imp_supported(hw) \
+	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_RAS_IMP_B)
+
 #define HNS3_DEV_PRIVATE_TO_HW(adapter) \
 	(&((struct hns3_adapter *)adapter)->hw)
 #define HNS3_DEV_PRIVATE_TO_PF(adapter) \
drivers/net/hns3/hns3_ethdev_vf.c +2 -1
index 5770c47..b5a91d2 100644
@@ -2465,7 +2465,8 @@ hns3vf_is_reset_pending(struct hns3_adapter *hns)
 	/* Check the registers to confirm whether there is reset pending */
 	hns3vf_check_event_cause(hns, NULL);
 	reset = hns3vf_get_reset_level(hw, &hw->reset.pending);
-	if (hw->reset.level != HNS3_NONE_RESET && hw->reset.level < reset) {
+	if (hw->reset.level != HNS3_NONE_RESET && reset != HNS3_NONE_RESET &&
+	    hw->reset.level < reset) {
 		hns3_warn(hw, "High level reset %d is pending", reset);
 		return true;
 	}
drivers/net/hns3/hns3_intr.c +292 -4

326 lines not on this page · raw message

drivers/net/hns3/hns3_intr.h +70 -0

82 lines not on this page · raw message

Signature · 1 line
2.7.4