Skip to content

Commit 7838f90

Browse files
shijujose4davem330
authored andcommitted
net: hns3: add handling of hw errors of MAC
This patch adds enable and handling of hw errors of the MAC block. Signed-off-by: Shiju Jose <[email protected]> Signed-off-by: Salil Mehta <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f6162d4 commit 7838f90

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ enum hclge_opcode_type {
215215
HCLGE_OPC_SFP_GET_SPEED = 0x7104,
216216

217217
/* Error INT commands */
218+
HCLGE_MAC_COMMON_INT_EN = 0x030E,
218219
HCLGE_TM_SCH_ECC_INT_EN = 0x0829,
219220
HCLGE_COMMON_ECC_INT_CFG = 0x1505,
220221
HCLGE_QUERY_RAS_INT_STS_BD_NUM = 0x1510,

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,18 @@ static const struct hclge_hw_error hclge_qcn_ecc_rint[] = {
210210
{ /* sentinel */ }
211211
};
212212

213+
static const struct hclge_hw_error hclge_mac_afifo_tnl_int[] = {
214+
{ .int_msk = BIT(0), .msg = "egu_cge_afifo_ecc_1bit_err" },
215+
{ .int_msk = BIT(1), .msg = "egu_cge_afifo_ecc_mbit_err" },
216+
{ .int_msk = BIT(2), .msg = "egu_lge_afifo_ecc_1bit_err" },
217+
{ .int_msk = BIT(3), .msg = "egu_lge_afifo_ecc_mbit_err" },
218+
{ .int_msk = BIT(4), .msg = "cge_igu_afifo_ecc_1bit_err" },
219+
{ .int_msk = BIT(5), .msg = "cge_igu_afifo_ecc_mbit_err" },
220+
{ .int_msk = BIT(6), .msg = "lge_igu_afifo_ecc_1bit_err" },
221+
{ .int_msk = BIT(7), .msg = "lge_igu_afifo_ecc_mbit_err" },
222+
{ /* sentinel */ }
223+
};
224+
213225
static void hclge_log_error(struct device *dev, char *reg,
214226
const struct hclge_hw_error *err,
215227
u32 err_sts)
@@ -452,6 +464,27 @@ static int hclge_config_tm_hw_err_int(struct hclge_dev *hdev, bool en)
452464
return ret;
453465
}
454466

467+
static int hclge_config_mac_err_int(struct hclge_dev *hdev, bool en)
468+
{
469+
struct device *dev = &hdev->pdev->dev;
470+
struct hclge_desc desc;
471+
int ret;
472+
473+
/* configure MAC common error interrupts */
474+
hclge_cmd_setup_basic_desc(&desc, HCLGE_MAC_COMMON_INT_EN, false);
475+
if (en)
476+
desc.data[0] = cpu_to_le32(HCLGE_MAC_COMMON_ERR_INT_EN);
477+
478+
desc.data[1] = cpu_to_le32(HCLGE_MAC_COMMON_ERR_INT_EN_MASK);
479+
480+
ret = hclge_cmd_send(&hdev->hw, &desc, 1);
481+
if (ret)
482+
dev_err(dev,
483+
"fail(%d) to configure MAC COMMON error intr\n", ret);
484+
485+
return ret;
486+
}
487+
455488
#define HCLGE_SET_DEFAULT_RESET_REQUEST(reset_type) \
456489
do { \
457490
if (ae_dev->ops->set_default_reset_request) \
@@ -688,6 +721,10 @@ static const struct hclge_hw_blk hw_blk[] = {
688721
.msk = BIT(5), .name = "COMMON",
689722
.config_err_int = hclge_config_common_hw_err_int,
690723
},
724+
{
725+
.msk = BIT(8), .name = "MAC",
726+
.config_err_int = hclge_config_mac_err_int,
727+
},
691728
{ /* sentinel */ }
692729
};
693730

@@ -735,7 +772,9 @@ int hclge_handle_hw_msix_error(struct hclge_dev *hdev,
735772
u32 mpf_bd_num, pf_bd_num, bd_num;
736773
struct hclge_desc desc_bd;
737774
struct hclge_desc *desc;
775+
__le32 *desc_data;
738776
int ret = 0;
777+
u32 status;
739778

740779
/* set default handling */
741780
set_bit(HNAE3_FUNC_RESET, reset_requests);
@@ -774,6 +813,15 @@ int hclge_handle_hw_msix_error(struct hclge_dev *hdev,
774813
goto msi_error;
775814
}
776815

816+
/* log MAC errors */
817+
desc_data = (__le32 *)&desc[1];
818+
status = le32_to_cpu(*desc_data);
819+
if (status) {
820+
hclge_log_error(dev, "MAC_AFIFO_TNL_INT_R",
821+
&hclge_mac_afifo_tnl_int[0], status);
822+
set_bit(HNAE3_GLOBAL_RESET, reset_requests);
823+
}
824+
777825
/* clear all main PF MSIx errors */
778826
hclge_cmd_reuse_desc(&desc[0], false);
779827
desc[0].flag |= cpu_to_le16(HCLGE_CMD_FLAG_NEXT);

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
#define HCLGE_TM_QCN_MEM_ERR_INT_EN 0xFFFFFF
4545
#define HCLGE_NCSI_ERR_INT_EN 0x3
4646
#define HCLGE_NCSI_ERR_INT_TYPE 0x9
47+
#define HCLGE_MAC_COMMON_ERR_INT_EN GENMASK(7, 0)
48+
#define HCLGE_MAC_COMMON_ERR_INT_EN_MASK GENMASK(7, 0)
4749

4850
#define HCLGE_IGU_INT_MASK GENMASK(3, 0)
4951
#define HCLGE_IGU_EGU_TNL_INT_MASK GENMASK(5, 0)

0 commit comments

Comments
 (0)