r83 - in unstable/rt2570/debian: . patches
benh at alioth.debian.org
benh at alioth.debian.org
Sun Nov 11 23:56:47 UTC 2007
Author: benh
Date: 2007-11-11 23:56:47 +0000 (Sun, 11 Nov 2007)
New Revision: 83
Added:
unstable/rt2570/debian/patches/004_fix_mlme_queue_locking.diff
unstable/rt2570/debian/patches/005_fix_delays.diff
unstable/rt2570/debian/patches/006_fix_probe_148f_2573.diff
Modified:
unstable/rt2570/debian/changelog
unstable/rt2570/debian/patches/series
Log:
Added some more bug fix patches.
Modified: unstable/rt2570/debian/changelog
===================================================================
--- unstable/rt2570/debian/changelog 2007-11-11 23:48:09 UTC (rev 82)
+++ unstable/rt2570/debian/changelog 2007-11-11 23:56:47 UTC (rev 83)
@@ -3,8 +3,14 @@
* New CVS snapshot
- Believed to be SMP-safe (closes: bug#423127)
- Supports Linux 2.6.22 (closes: bug#432533)
+ * Added suggestion of rutilt package
+ * Fixed some race conditions in processing of queued work, with help
+ from Bryan Batten (004_fix_mlme_queue_locking.diff)
+ * Fixed some miscalculated delays (005_fix_delays.diff)
+ * Changed probing code to reject devices which require the rt73 driver
+ (006_fix_probe_148f_2573.diff)
- -- Ben Hutchings <ben at decadent.org.uk> Sat, 29 Sep 2007 21:13:30 +0100
+ -- Ben Hutchings <ben at decadent.org.uk> Sun, 11 Nov 2007 23:55:23 +0000
rt2570 (1.1.0+cvs20070219-2) unstable; urgency=low
Added: unstable/rt2570/debian/patches/004_fix_mlme_queue_locking.diff
===================================================================
--- unstable/rt2570/debian/patches/004_fix_mlme_queue_locking.diff (rev 0)
+++ unstable/rt2570/debian/patches/004_fix_mlme_queue_locking.diff 2007-11-11 23:56:47 UTC (rev 83)
@@ -0,0 +1,250 @@
+--- rt2570.orig/Module/mlme.c
++++ rt2570/Module/mlme.c
+@@ -242,7 +242,6 @@
+ }
+
+ pAd->Mlme.Running = FALSE;
+- NdisAllocateSpinLock(&pAd->Mlme.TaskLock);
+
+ // initialize the two tables
+ // MacTableInit(pAd);
+@@ -350,19 +349,18 @@
+
+ // Only accept MLME and Frame from peer side, no other
+ // (control/data) frame should get into this state machine
+- NdisAcquireSpinLock(&pAd->Mlme.TaskLock);
++ NdisAcquireSpinLock(&pAd->Mlme.Queue.Lock);
+ if(pAd->Mlme.Running)
+ {
+- NdisReleaseSpinLock(&pAd->Mlme.TaskLock);
++ NdisReleaseSpinLock(&pAd->Mlme.Queue.Lock);
+ return;
+ }
+- else
+- {
+- pAd->Mlme.Running = TRUE;
+- }
+- NdisReleaseSpinLock(&pAd->Mlme.TaskLock);
++ pAd->Mlme.Running = TRUE;
++
++ while (MlmeGetHead(&pAd->Mlme.Queue, &Elem)) {
++ smp_read_barrier_depends();
++ if (!Elem->Occupied) break;
+
+- while (TRUE) {
+ if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_MLME_RESET_IN_PROGRESS) ||
+ RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS) ||
+ RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_REMOVE_IN_PROGRESS))
+@@ -371,18 +369,10 @@
+ break;
+ }
+
+- NdisAcquireSpinLock(&pAd->Mlme.Queue.Lock);
+- if (!MlmeDequeue(&pAd->Mlme.Queue, &Elem)) {
+- NdisReleaseSpinLock(&pAd->Mlme.Queue.Lock);
+- break;
+- }
+- NdisReleaseSpinLock(&pAd->Mlme.Queue.Lock);
+-
+- if (pAd->PortCfg.BssType == BSS_MONITOR)
+- continue;
++ NdisReleaseSpinLock(&pAd->Mlme.Queue.Lock);
+
+ //From message type, determine which state machine I should drive
+- switch (Elem->Machine)
++ if (pAd->PortCfg.BssType != BSS_MONITOR) switch (Elem->Machine)
+ {
+ case ASSOC_STATE_MACHINE:
+ StateMachinePerformAction(pAd, &pAd->Mlme.AssocMachine, Elem);
+@@ -408,8 +398,10 @@
+ } // end of switch
+
+ // free MLME element
++ smp_mb();
+ Elem->Occupied = FALSE;
+- Elem->MsgLen = 0;
++ NdisAcquireSpinLock(&pAd->Mlme.Queue.Lock);
++ MlmeDequeue(&pAd->Mlme.Queue);
+ }
+
+ if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_MLME_RESET_IN_PROGRESS))
+@@ -441,9 +433,8 @@
+ RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_MLME_RESET_IN_PROGRESS);
+ }
+
+- NdisAcquireSpinLock(&pAd->Mlme.TaskLock);
+ pAd->Mlme.Running = FALSE;
+- NdisReleaseSpinLock(&pAd->Mlme.TaskLock);
++ NdisReleaseSpinLock(&pAd->Mlme.Queue.Lock);
+
+ }
+
+@@ -465,31 +456,26 @@
+ RTMPCancelTimer(&pAd->Mlme.SyncAux.BeaconTimer);
+ RTMPCancelTimer(&pAd->Mlme.SyncAux.ScanTimer);
+
+- NdisAcquireSpinLock(&pAd->Mlme.TaskLock);
++ NdisAcquireSpinLock(&pAd->Mlme.Queue.Lock);
+ if(pAd->Mlme.Running)
+ {
+- NdisReleaseSpinLock(&pAd->Mlme.TaskLock);
++ NdisReleaseSpinLock(&pAd->Mlme.Queue.Lock);
+ return;
+ }
+ else
+ {
+ pAd->Mlme.Running = TRUE;
+ }
+- NdisReleaseSpinLock(&pAd->Mlme.TaskLock);
+
+ // Remove all Mlme queues elements
+- NdisAcquireSpinLock(&pAd->Mlme.Queue.Lock);
+- while (MlmeDequeue(&pAd->Mlme.Queue, &Elem)) {
+- // free MLME element
+- Elem->Occupied = FALSE;
+- Elem->MsgLen = 0;
++ while (MlmeGetHead(&pAd->Mlme.Queue, &Elem)) {
++ MlmeDequeue(&pAd->Mlme.Queue);
++ Elem->Occupied = FALSE;
+ }
+- NdisReleaseSpinLock(&pAd->Mlme.Queue.Lock);
+
+ // Remove running state
+- NdisAcquireSpinLock(&pAd->Mlme.TaskLock);
+ pAd->Mlme.Running = FALSE;
+- NdisReleaseSpinLock(&pAd->Mlme.TaskLock);
++ NdisReleaseSpinLock(&pAd->Mlme.Queue.Lock);
+
+ RTUSBCleanUpMLMEWaitQueue(pAd);
+ RTUSBCleanUpMLMEBulkOutQueue(pAd);
+@@ -2793,11 +2779,12 @@
+ NdisReleaseSpinLock(&Queue->Lock);
+ DBGPRINT(RT_DEBUG_INFO,"MlmeEnqueue, num=%d\n",Queue->Num);
+
+- Queue->Entry[Tail].Occupied = TRUE;
+ Queue->Entry[Tail].Machine = Machine;
+ Queue->Entry[Tail].MsgType = MsgType;
+ Queue->Entry[Tail].MsgLen = MsgLen;
+ memcpy(Queue->Entry[Tail].Msg, Msg, MsgLen);
++ smp_wmb();
++ Queue->Entry[Tail].Occupied = TRUE;
+ }
+ return TRUE;
+ }
+@@ -2870,19 +2857,20 @@
+ DBGPRINT(RT_DEBUG_INFO, "MlmeEnqueueForRecv, num=%d\n",Queue->Num);
+
+ // OK, we got all the informations, it is time to put things into queue
+- Queue->Entry[Tail].Occupied = TRUE;
+ Queue->Entry[Tail].Machine = Machine;
+ Queue->Entry[Tail].MsgType = MsgType;
+ Queue->Entry[Tail].MsgLen = MsgLen;
+
+ Queue->Entry[Tail].Rssi = Rssi;
+ memcpy(Queue->Entry[Tail].Msg, Msg, MsgLen);
++ smp_wmb();
++ Queue->Entry[Tail].Occupied = TRUE;
+
+ RTUSBMlmeUp(pAd, (&(pAd->mlme_semaphore)));
+
+ return TRUE;
+ }
+-/*! \brief Dequeue a message from the MLME Queue
++/*! \brief Get the first message from the MLME Queue
+ * WARNING: Must be call with Mlme.Queue.Lock held
+ * \param *Queue The MLME Queue
+ * \param *Elem The message dequeued from MLME Queue
+@@ -2893,15 +2881,36 @@
+ IRQL = DISPATCH_LEVEL
+
+ */
+-BOOLEAN MlmeDequeue(
++BOOLEAN MlmeGetHead(
+ IN MLME_QUEUE *Queue,
+ OUT MLME_QUEUE_ELEM **Elem)
+ {
+ if (Queue->Num == 0)
+ return FALSE; //Empty
+
+- *Elem = &Queue->Entry[Queue->Head++];
+- Queue->Head %= MAX_LEN_OF_MLME_QUEUE;
++ *Elem = &Queue->Entry[Queue->Head];
++ DBGPRINT(RT_DEBUG_INFO, "MlmeDequeue, num=%d\n",Queue->Num);
++
++ return TRUE;
++}
++
++/*! \brief Remove the first message from the MLME Queue
++ * WARNING: Must be call with Mlme.Queue.Lock held
++ * \param *Queue The MLME Queue
++ * \return TRUE if a message was remove, FALSE if the queue was empty
++ * \pre
++ * \post
++
++ IRQL = DISPATCH_LEVEL
++
++ */
++BOOLEAN MlmeDequeue(
++ IN MLME_QUEUE *Queue)
++{
++ if (Queue->Num == 0)
++ return FALSE; //Empty
++
++ Queue->Head = (Queue->Head + 1) % MAX_LEN_OF_MLME_QUEUE;
+ Queue->Num--;
+ DBGPRINT(RT_DEBUG_INFO, "MlmeDequeue, num=%d\n",Queue->Num);
+
+@@ -2918,15 +2927,14 @@
+
+ RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_MLME_RESET_IN_PROGRESS);
+
+- NdisAcquireSpinLock(&pAd->Mlme.TaskLock);
++ NdisAcquireSpinLock(&pAd->Mlme.Queue.Lock);
+ if(pAd->Mlme.Running)
+ {
+ DBGPRINT(RT_DEBUG_TRACE, "<== MlmeRestartStateMachine, Mlme is Runing[Queue=%d]!\n", pAd->Mlme.Queue.Num);
+- NdisReleaseSpinLock(&pAd->Mlme.TaskLock);
++ NdisReleaseSpinLock(&pAd->Mlme.Queue.Lock);
+ return;
+ }
+ pAd->Mlme.Running = TRUE;
+- NdisReleaseSpinLock(&pAd->Mlme.TaskLock);
+
+ MlmeQueueDestroy(&pAd->Mlme.Queue);
+
+@@ -2956,9 +2964,8 @@
+ RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_MLME_RESET_IN_PROGRESS);
+
+ // Remove running state
+- NdisAcquireSpinLock(&pAd->Mlme.TaskLock);
+ pAd->Mlme.Running = FALSE;
+- NdisReleaseSpinLock(&pAd->Mlme.TaskLock);
++ NdisReleaseSpinLock(&pAd->Mlme.Queue.Lock);
+
+ DBGPRINT(RT_DEBUG_TRACE, "<== MlmeRestartStateMachine\n");
+ }
+--- rt2570.orig/Module/rt2570sw.h
++++ rt2570/Module/rt2570sw.h
+@@ -1077,7 +1077,6 @@
+ ULONG ChannelQuality; // 0..100, Channel Quality Indication for Roaming
+
+ BOOLEAN Running;
+- spinlock_t TaskLock;
+ MLME_QUEUE Queue;
+
+ UINT ShiftReg;
+@@ -2341,10 +2340,13 @@
+ IN ULONG MsgLen,
+ IN PVOID Msg);
+
+-BOOLEAN MlmeDequeue(
++BOOLEAN MlmeGetHead(
+ IN MLME_QUEUE *Queue,
+ OUT MLME_QUEUE_ELEM **Elem);
+
++BOOLEAN MlmeDequeue(
++ IN MLME_QUEUE *Queue);
++
+ #if 1
+ VOID MlmeRestartStateMachine(
+ IN PRT2570ADAPTER pAd);
Added: unstable/rt2570/debian/patches/005_fix_delays.diff
===================================================================
--- unstable/rt2570/debian/patches/005_fix_delays.diff (rev 0)
+++ unstable/rt2570/debian/patches/005_fix_delays.diff 2007-11-11 23:56:47 UTC (rev 83)
@@ -0,0 +1,42 @@
+--- rt2570.orig/Module/rt2570sw.h
++++ rt2570/Module/rt2570sw.h
+@@ -384,7 +384,7 @@
+ #define CMD_SingleRead 0x0C
+ #define CMD_SingleWrite 0x0D
+
+-#define NdisMSleep mdelay
++#define NdisMSleep msleep
+
+
+ // Assert MACRO to make sure program running
+--- rt2570.orig/Module/rtusb_main.c
++++ rt2570/Module/rtusb_main.c
+@@ -847,7 +847,7 @@
+ }
+ }
+
+- NdisMSleep(500000);
++ NdisMSleep(500);
+ }
+
+ NICResetFromError(pAdapter);
+--- rt2570.orig/Module/rtusb_bulk.c
++++ rt2570/Module/rtusb_bulk.c
+@@ -1386,7 +1386,7 @@
+ usb_kill_urb(pMLMEContext->pUrb);
+
+ // Sleep 200 microsecs to give cancellation time to work
+- NdisMSleep(200);
++ udelay(200);
+ }
+ }
+
+@@ -1405,7 +1405,7 @@
+ usb_kill_urb(pBeaconContext->pUrb);
+
+ // Sleep 200 microsecs to give cancellation time to work
+- NdisMSleep(200);
++ udelay(200);
+ }
+ }
+
Added: unstable/rt2570/debian/patches/006_fix_probe_148f_2573.diff
===================================================================
--- unstable/rt2570/debian/patches/006_fix_probe_148f_2573.diff (rev 0)
+++ unstable/rt2570/debian/patches/006_fix_probe_148f_2573.diff 2007-11-11 23:56:47 UTC (rev 83)
@@ -0,0 +1,39 @@
+--- rt2570.orig/Module/rtusb_main.c
++++ rt2570/Module/rtusb_main.c
+@@ -1853,6 +1853,7 @@
+ {
+ struct usb_device *dev = interface_to_usbdev(intf);
+ PRT2570ADAPTER pAdapter = (PRT2570ADAPTER)NULL;
++ USHORT version = 0;
+ int i;
+ struct net_device *netdev;
+ int res = -ENOMEM;
+@@ -1881,16 +1883,25 @@
+ {
+ //if (!(pAdapter->net = init_etherdev(0, 0) )) {
+ printk("alloc_etherdev failed\n");
+-
+- module_put(THIS_MODULE);
++ usb_put_dev(dev);
+ return res;
+ }
+
+ pAdapter = netdev->priv;
++ pAdapter->usb = dev;
++
++ RTUSBReadMACRegister(pAdapter, MAC_CSR0, &version);
++ if (version == 0 || (le16_to_cpu(version) & 0xfff0) != 0)
++ {
++ printk("ASIC version not matching\n");
++ kfree(netdev);
++ usb_put_dev(dev);
++ return -ENODEV;
++ }
++
+ pAdapter->net = netdev;
+ netif_stop_queue(netdev);
+ pAdapter->config = &dev->config->desc;
+- pAdapter->usb = dev;
+ SET_MODULE_OWNER(pAdapter->net);
+ ether_setup(pAdapter->net);
+ netdev->open = usb_rtusb_open;
Modified: unstable/rt2570/debian/patches/series
===================================================================
--- unstable/rt2570/debian/patches/series 2007-11-11 23:48:09 UTC (rev 82)
+++ unstable/rt2570/debian/patches/series 2007-11-11 23:56:47 UTC (rev 83)
@@ -1 +1,4 @@
000_if_name.diff -p0
+004_fix_mlme_queue_locking.diff
+005_fix_delays.diff
+006_fix_probe_148f_2573.diff
More information about the Pkg-ralink-commits
mailing list