Skip to contentSkip to conversation

qede: Implement ndo_tx_timeout

PATCH In review Denis Bolotin 2 participants 2 messages Dec 22, 2019 – Dec 25, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qede: Implement ndo_tx_timeout

Disable carrier and print TX queue info on TX timeout.

---
 drivers/net/ethernet/qlogic/qede/qede.h      |  1 -
 drivers/net/ethernet/qlogic/qede/qede_main.c | 32 ++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qede/qede.h +0 -1
index c303a92..6837225 100644
@@ -519,7 +519,6 @@ u16 qede_select_queue(struct net_device *dev, struct sk_buff *skb,
 netdev_features_t qede_features_check(struct sk_buff *skb,
 				      struct net_device *dev,
 				      netdev_features_t features);
-void qede_tx_log_print(struct qede_dev *edev, struct qede_fastpath *fp);
 int qede_alloc_rx_buffer(struct qede_rx_queue *rxq, bool allow_lazy);
 int qede_free_tx_pkt(struct qede_dev *edev,
 		     struct qede_tx_queue *txq, int *len);
drivers/net/ethernet/qlogic/qede/qede_main.c +32 -0
index 481b096..b519688 100644
@@ -527,6 +527,37 @@ static int qede_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 	return 0;
 }
 
+static void qede_tx_log_print(struct qede_dev *edev, struct qede_tx_queue *txq)
+{
+	DP_NOTICE(edev,
+		  "Txq[%d]: FW cons [host] %04x, SW cons %04x, SW prod %04x [Jiffies %lu]\n",
+		  txq->index, le16_to_cpu(*txq->hw_cons_ptr),
+		  qed_chain_get_cons_idx(&txq->tx_pbl),
+		  qed_chain_get_prod_idx(&txq->tx_pbl),
+		  jiffies);
+}
+
+static void qede_tx_timeout(struct net_device *dev, unsigned int txqueue)
+{
+	struct qede_dev *edev = netdev_priv(dev);
+	struct qede_tx_queue *txq;
+	int cos;
+
+	netif_carrier_off(dev);
+	DP_NOTICE(edev, "TX timeout on queue %u!\n", txqueue);
+
+	if (!(edev->fp_array[txqueue].type & QEDE_FASTPATH_TX))
+		return;
+
+	for_each_cos_in_txq(edev, cos) {
+		txq = &edev->fp_array[txqueue].txq[cos];
+
+		if (qed_chain_get_cons_idx(&txq->tx_pbl) !=
+		    qed_chain_get_prod_idx(&txq->tx_pbl))
+			qede_tx_log_print(edev, txq);
+	}
+}
+
 static int qede_setup_tc(struct net_device *ndev, u8 num_tc)
 {
 	struct qede_dev *edev = netdev_priv(ndev);
@@ -614,6 +645,7 @@ static int qede_setup_tc_block_cb(enum tc_setup_type type, void *type_data,
 	.ndo_validate_addr = eth_validate_addr,
 	.ndo_change_mtu = qede_change_mtu,
 	.ndo_do_ioctl = qede_ioctl,
+	.ndo_tx_timeout = qede_tx_timeout,
 #ifdef CONFIG_QED_SRIOV
 	.ndo_set_vf_mac = qede_set_vf_mac,
 	.ndo_set_vf_vlan = qede_set_vf_vlan,
Signature · 1 line
1.8.3.1
maintainer
#1 lore raw

From: Denis Bolotin <[email protected]>
Date: Sun, 22 Dec 2019 16:07:22 +0200

Quoted 4 lines

Disable carrier and print TX queue info on TX timeout.

You need to do more than just dump some state.

You have to actually reset the device so that there is a chance that packets can start flowing again.

If the network is the only way administrators can access the machine or see the log messages, your state dump will be seen by no-one unless you reset the device and get it working again.

I'm not applying this, sorry.