Skip to contentSkip to conversation

igc: Add watchdog

PATCH Superseded Sasha Neftin 1 participant 1 message Aug 23, 2018

Subsystems (2)

v6 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

PATCH v6 11/11 igc: Add watchdog

Code completion, remove obsolete code
Add watchdog methods

Sasha Neftin (v2):
minor cosmetic changes

Sasha Neftin (v3):
resolve conflict and code optimization

Sasha Neftin (v4):
fix update phy info for a watchdog task remove no need media_change type and media_swap method code optimization
address comments
replace e1000_ prefix with igc_ prefix

Sasha Neftin (v5):
remove unused defines

Sasha Neftin (v6):
no changes

---
 drivers/net/ethernet/intel/igc/igc.h         |  12 +
 drivers/net/ethernet/intel/igc/igc_defines.h |  11 +
 drivers/net/ethernet/intel/igc/igc_hw.h      |   1 +
 drivers/net/ethernet/intel/igc/igc_main.c    | 232 +++++++++++++++++++
 4 files changed, 256 insertions(+)
drivers/net/ethernet/intel/igc/igc.h +12 -0
index 599212c89dfd..0be6f81cd228 100644
@@ -33,6 +33,8 @@ extern char igc_driver_version[];
 #define IGC_FLAG_HAS_MSI		BIT(0)
 #define IGC_FLAG_QUEUE_PAIRS		BIT(4)
 #define IGC_FLAG_NEED_LINK_UPDATE	BIT(9)
+#define IGC_FLAG_MEDIA_RESET		BIT(10)
+#define IGC_FLAG_MAS_ENABLE		BIT(12)
 #define IGC_FLAG_HAS_MSIX		BIT(13)
 #define IGC_FLAG_VLAN_PROMISC		BIT(15)
 
@@ -296,6 +298,7 @@ struct igc_adapter {
 
 	/* TX */
 	u16 tx_work_limit;
+	u32 tx_timeout_count;
 	int num_tx_queues;
 	struct igc_ring *tx_ring[IGC_MAX_TX_QUEUES];
 
@@ -354,6 +357,7 @@ struct igc_adapter {
 
 	struct igc_mac_addr *mac_table;
 
+	unsigned long link_check_timeout;
 	struct igc_info ei;
 };
 
@@ -423,6 +427,14 @@ static inline unsigned int igc_rx_pg_order(struct igc_ring *ring)
 	return 0;
 }
 
+static inline s32 igc_read_phy_reg(struct igc_hw *hw, u32 offset, u16 *data)
+{
+	if (hw->phy.ops.read_reg)
+		return hw->phy.ops.read_reg(hw, offset, data);
+
+	return 0;
+}
+
 #define igc_rx_pg_size(_ring) (PAGE_SIZE << igc_rx_pg_order(_ring))
 
 #define IGC_TXD_DCMD	(IGC_ADVTXD_DCMD_EOP | IGC_ADVTXD_DCMD_RS)
drivers/net/ethernet/intel/igc/igc_defines.h +11 -0
index 95d7891a252c..555eb1d6cffd 100644
@@ -69,6 +69,8 @@
 #define IGC_CTRL_RFCE		0x08000000  /* Receive Flow Control enable */
 #define IGC_CTRL_TFCE		0x10000000  /* Transmit flow control enable */
 
+#define IGC_CONNSW_AUTOSENSE_EN	0x1
+
 /* PBA constants */
 #define IGC_PBA_34K		0x0022
 
@@ -97,6 +99,10 @@
 #define CR_1000T_HD_CAPS	0x0100 /* Advertise 1000T HD capability */
 #define CR_1000T_FD_CAPS	0x0200 /* Advertise 1000T FD capability  */
 
+/* 1000BASE-T Status Register */
+#define SR_1000T_REMOTE_RX_STATUS	0x1000 /* Remote receiver OK */
+#define SR_1000T_LOCAL_RX_STATUS	0x2000 /* Local receiver OK */
+
 /* PHY GPY 211 registers */
 #define STANDARD_AN_REG_MASK	0x0007 /* MMD */
 #define ANEG_MULTIGBT_AN_CTRL	0x0020 /* MULTI GBT AN Control Register */
@@ -213,6 +219,11 @@
 #define IGC_QVECTOR_MASK	0x7FFC		/* Q-vector mask */
 #define IGC_ITR_VAL_MASK	0x04		/* ITR value mask */
 
+/* Interrupt Cause Set */
+#define IGC_ICS_LSC		IGC_ICR_LSC       /* Link Status Change */
+#define IGC_ICS_RXDMT0		IGC_ICR_RXDMT0    /* rx desc min. threshold */
+#define IGC_ICS_DRSTA		IGC_ICR_DRSTA     /* Device Reset Aserted */
+
 #define IGC_ICR_DOUTSYNC	0x10000000 /* NIC DMA out of sync */
 #define IGC_EITR_CNT_IGNR	0x80000000 /* Don't reset counters on write */
 #define IGC_IVAR_VALID		0x80
drivers/net/ethernet/intel/igc/igc_hw.h +1 -0
index e8bc4680fc4e..908e2da3a3b7 100644
@@ -226,6 +226,7 @@ struct igc_dev_spec_base {
 	bool clear_semaphore_once;
 	bool module_plugged;
 	u8 media_port;
+	bool mas_capable;
 };
 
 struct igc_hw {
drivers/net/ethernet/intel/igc/igc_main.c +232 -0

272 lines not on this page · raw message

Signature · 1 line
2.18.0