Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8df591f3 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'hns3-next'



Salil Mehta says:

====================
Adds support of RAS Error Handling in HNS3 Driver

This patch-set adds support related to RAS Error handling to the HNS3
Ethernet PF Driver. Set of errors occurred in the HNS3 hardware are
reported to the driver through the PCIe AER interface. The received
error information is then used to classify the received errors and
then decide the appropriate receovery action depending on the type
of error.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents aeb5e02a 01865a50
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -402,7 +402,7 @@ struct hnae3_ae_ops {
	int (*set_vf_vlan_filter)(struct hnae3_handle *handle, int vfid,
				  u16 vlan, u8 qos, __be16 proto);
	int (*enable_hw_strip_rxvtag)(struct hnae3_handle *handle, bool enable);
	void (*reset_event)(struct hnae3_handle *handle);
	void (*reset_event)(struct pci_dev *pdev, struct hnae3_handle *handle);
	void (*get_channels)(struct hnae3_handle *handle,
			     struct ethtool_channels *ch);
	void (*get_tqps_and_rss_info)(struct hnae3_handle *h,
@@ -429,6 +429,7 @@ struct hnae3_ae_ops {
				struct ethtool_rxnfc *cmd, u32 *rule_locs);
	int (*restore_fd_rules)(struct hnae3_handle *handle);
	void (*enable_fd)(struct hnae3_handle *handle, bool enable);
	pci_ers_result_t (*process_hw_error)(struct hnae3_ae_dev *ae_dev);
};

struct hnae3_dcb_ops {
+49 −1
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
#include <linux/ipv6.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/aer.h>
#include <linux/skbuff.h>
#include <linux/sctp.h>
#include <linux/vermagic.h>
@@ -1613,7 +1614,7 @@ static void hns3_nic_net_timeout(struct net_device *ndev)

	/* request the reset */
	if (h->ae_algo->ops->reset_event)
		h->ae_algo->ops->reset_event(h);
		h->ae_algo->ops->reset_event(h->pdev, h);
}

static const struct net_device_ops hns3_nic_netdev_ops = {
@@ -1771,6 +1772,52 @@ static void hns3_shutdown(struct pci_dev *pdev)
		pci_set_power_state(pdev, PCI_D3hot);
}

static pci_ers_result_t hns3_error_detected(struct pci_dev *pdev,
					    pci_channel_state_t state)
{
	struct hnae3_ae_dev *ae_dev = pci_get_drvdata(pdev);
	pci_ers_result_t ret;

	dev_info(&pdev->dev, "PCI error detected, state(=%d)!!\n", state);

	if (state == pci_channel_io_perm_failure)
		return PCI_ERS_RESULT_DISCONNECT;

	if (!ae_dev) {
		dev_err(&pdev->dev,
			"Can't recover - error happened during device init\n");
		return PCI_ERS_RESULT_NONE;
	}

	if (ae_dev->ops->process_hw_error)
		ret = ae_dev->ops->process_hw_error(ae_dev);
	else
		return PCI_ERS_RESULT_NONE;

	return ret;
}

static pci_ers_result_t hns3_slot_reset(struct pci_dev *pdev)
{
	struct hnae3_ae_dev *ae_dev = pci_get_drvdata(pdev);
	struct device *dev = &pdev->dev;

	dev_info(dev, "requesting reset due to PCI error\n");

	/* request the reset */
	if (ae_dev->ops->reset_event) {
		ae_dev->ops->reset_event(pdev, NULL);
		return PCI_ERS_RESULT_RECOVERED;
	}

	return PCI_ERS_RESULT_DISCONNECT;
}

static const struct pci_error_handlers hns3_err_handler = {
	.error_detected = hns3_error_detected,
	.slot_reset     = hns3_slot_reset,
};

static struct pci_driver hns3_driver = {
	.name     = hns3_driver_name,
	.id_table = hns3_pci_tbl,
@@ -1778,6 +1825,7 @@ static struct pci_driver hns3_driver = {
	.remove   = hns3_remove,
	.shutdown = hns3_shutdown,
	.sriov_configure = hns3_pci_sriov_configure,
	.err_handler    = &hns3_err_handler,
};

/* set default feature to hns3 */
+1 −1
Original line number Diff line number Diff line
@@ -6,6 +6,6 @@
ccflags-y := -Idrivers/net/ethernet/hisilicon/hns3

obj-$(CONFIG_HNS3_HCLGE) += hclge.o
hclge-objs = hclge_main.o hclge_cmd.o hclge_mdio.o hclge_tm.o hclge_mbx.o
hclge-objs = hclge_main.o hclge_cmd.o hclge_mdio.o hclge_tm.o hclge_mbx.o hclge_err.o

hclge-$(CONFIG_HNS3_DCB) += hclge_dcb.o
+22 −0
Original line number Diff line number Diff line
@@ -209,6 +209,28 @@ enum hclge_opcode_type {

	/* Led command */
	HCLGE_OPC_LED_STATUS_CFG	= 0xB000,

	/* Error INT commands */
	HCLGE_TM_SCH_ECC_INT_EN		= 0x0829,
	HCLGE_TM_SCH_ECC_ERR_RINT_CMD	= 0x082d,
	HCLGE_TM_SCH_ECC_ERR_RINT_CE	= 0x082f,
	HCLGE_TM_SCH_ECC_ERR_RINT_NFE	= 0x0830,
	HCLGE_TM_SCH_ECC_ERR_RINT_FE	= 0x0831,
	HCLGE_TM_SCH_MBIT_ECC_INFO_CMD	= 0x0833,
	HCLGE_COMMON_ECC_INT_CFG	= 0x1505,
	HCLGE_IGU_EGU_TNL_INT_QUERY	= 0x1802,
	HCLGE_IGU_EGU_TNL_INT_EN	= 0x1803,
	HCLGE_IGU_EGU_TNL_INT_CLR	= 0x1804,
	HCLGE_IGU_COMMON_INT_QUERY	= 0x1805,
	HCLGE_IGU_COMMON_INT_EN		= 0x1806,
	HCLGE_IGU_COMMON_INT_CLR	= 0x1807,
	HCLGE_TM_QCN_MEM_INT_CFG	= 0x1A14,
	HCLGE_TM_QCN_MEM_INT_INFO_CMD	= 0x1A17,
	HCLGE_PPP_CMD0_INT_CMD		= 0x2100,
	HCLGE_PPP_CMD1_INT_CMD		= 0x2101,
	HCLGE_NCSI_INT_QUERY		= 0x2400,
	HCLGE_NCSI_INT_EN		= 0x2401,
	HCLGE_NCSI_INT_CLR		= 0x2402,
};

#define HCLGE_TQP_REG_OFFSET		0x80000
+1088 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading