[Prism54-devel] [PATCH] reset_on_mgmt_timeo (bugs 56,59)

Denis Vlasenko vda@port.imtp.ilyichevsk.odessa.ua
Sun, 7 Mar 2004 12:09:42 +0200


--Boundary-00=_mTvSAPC6ZUkzxZz
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Sunday 07 March 2004 02:32, Aurelien wrote:
> Hi,
> First, islpci_reset will reset the card and reset ssid and everything
> (and it calls islpci_reset_if and isl38xx_interface_reset).

Aha. Is there code to restore settings (are they remembered anywhere?)
or should I add such code?

Let's think about better names:
islpci_reset -> keep the same name
islpci_reset_if -> merge into islpci_reset
	I see no reason why this code is in separate function
isl38xx_interface_reset -> isl38xx_initiate_reset
	because it basically only starts initialization
	by setting reset bit in hw register

> Now about your patch : this will not help to solve the "NETDEV WATCHDOG:
> ethx: transmit timed out". Moreover it's a bit dangerous, because
> islpci_reset will call islpci_mgt_transaction and you can end up with a
> forever recursive behavior.

Bad, bad, bad.

> To reset the device after a "NETDEV WATCHDOG", look at
> islpci_eth_tx_timeout.

Here is alternative patch. Should work only 2.6, no effect in 2.4
(it uses workqueues). Compile tested only.
--
vda

--Boundary-00=_mTvSAPC6ZUkzxZz
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="!prism54.reset_tx_timeo.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="!prism54.reset_tx_timeo.diff"

diff -urN prism54.20040307/islpci_dev.c prism54/islpci_dev.c
--- prism54.20040307/islpci_dev.c	Sun Mar  7 11:21:19 2004
+++ prism54/islpci_dev.c	Sun Mar  7 12:05:49 2004
@@ -761,6 +761,11 @@
 	if (islpci_alloc_memory(priv))
 		goto do_free_netdev;
 
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41) //vda
+	INIT_WORK(&priv->reset_task, islpci_do_reset_and_wake, priv);
+	priv->reset_task_pending = 0;
+#endif
+
 	/* select the firmware file depending on the device id */
 	switch (pdev->device) {
 	case PCIDEVICE_ISL3890:
@@ -778,7 +783,7 @@
 
 	if (register_netdev(ndev)) {
 		DEBUG(SHOW_ERROR_MESSAGES,
-		      "ERROR: register_netdev() failed \n");
+		      "ERROR: register_netdev() failed\n");
 		goto do_islpci_free_memory;
 	}
 
diff -urN prism54.20040307/islpci_dev.h prism54/islpci_dev.h
--- prism54.20040307/islpci_dev.h	Sun Mar  7 11:21:19 2004
+++ prism54/islpci_dev.h	Sun Mar  7 11:47:42 2004
@@ -192,6 +192,11 @@
 	int num_bss_wpa;
 	struct semaphore wpa_sem;
 	
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41)
+	struct work_struct reset_task; //vda
+	int reset_task_pending;
+#endif
+	
 #ifdef CONFIG_PRISM54_WDS
 	struct wds_priv wdsp;
 #endif
diff -urN prism54.20040307/islpci_eth.c prism54/islpci_eth.c
--- prism54.20040307/islpci_eth.c	Sun Mar  7 11:21:19 2004
+++ prism54/islpci_eth.c	Sun Mar  7 12:00:51 2004
@@ -459,6 +459,17 @@
 	return 0;
 }
 
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41) //vda
+void 
+islpci_do_reset_and_wake(void *data)
+{
+	islpci_private *priv = (islpci_private *) data;
+	islpci_reset(priv, 1 /*int reload_firmware*/);
+	netif_wake_queue(priv->ndev);
+	priv->reset_task_pending = 0;
+}
+#endif
+
 void
 islpci_eth_tx_timeout(struct net_device *ndev)
 {
@@ -473,6 +484,12 @@
 	if (islpci_reset(priv))
 		printk(KERN_ERR "%s: error on TX timeout card reset!\n",
 		       ndev->name);
+#endif
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41) //vda
+	if(!priv->reset_task_pending) {
+		priv->reset_task_pending = 1;
+		schedule_work(&priv->reset_task);
+	}
 #endif
 
 	/* netif_wake_queue(ndev); */
diff -urN prism54.20040307/islpci_eth.h prism54/islpci_eth.h
--- prism54.20040307/islpci_eth.h	Sun Mar  7 11:21:19 2004
+++ prism54/islpci_eth.h	Sun Mar  7 12:04:46 2004
@@ -26,6 +26,9 @@
 void islpci_eth_cleanup_transmit(islpci_private *, isl38xx_control_block *);
 int islpci_eth_transmit(struct sk_buff *, struct net_device *);
 int islpci_eth_receive(islpci_private *);
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41) //vda
+void islpci_do_reset_and_wake(void *data);
+#endif
 void islpci_eth_tx_timeout(struct net_device *);
 
 #endif				/* _ISL_GEN_H */

--Boundary-00=_mTvSAPC6ZUkzxZz--