Skip to contentSkip to conversation

prism54: Don't allow mib reads while unconfigured

PATCH In review Luis R. Rodriguez 1 participant 1 message May 24, 2004

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

PATCH 10/14 prism54: Don't allow mib reads while unconfigured

2004-04-17 Aurelien Alleaume <[email protected]>

* oid_mgt.c, isl_ioctl.c : Cleanup. Prevented real oid reading before the card is configured with mib values (might be related to
bug #53).

Signature · 1 line
GnuPG Key fingerprint = 113F B290 C6D2 0251 4D84  A34A 6ADD 4937 E20A 525E

2004-04-17 Aurelien Alleaume <[email protected]>

* oid_mgt.c, isl_ioctl.c : Cleanup. Prevented real oid reading before the card is configured with mib values (might be related to bug #53).

Index: linux-2.6.7-rc1/drivers/net/wireless/prism54/isl_ioctl.c
===================================================================
RCS file: /var/lib/cvs/prism54-ng/ksrc/isl_ioctl.c,v retrieving revision 1.151
retrieving revision 1.152

drivers/net/wireless/prism54/isl_ioctl.c +7 -39
diff -u -r1.151 -r1.152
@@ -1,4 +1,4 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/isl_ioctl.c,v 1.151 2004/04/09 11:42:25 ajfa Exp $
+/*  $Header: /var/lib/cvs/prism54-ng/ksrc/isl_ioctl.c,v 1.152 2004/04/17 08:46:04 ajfa Exp $
  *  
  *  Copyright (C) 2002 Intersil Americas Inc.
  *            (C) 2003,2004 Aurelien Alleaume <[email protected]>
@@ -173,14 +173,6 @@
 	prism54_mib_mode_helper(priv, init_mode);
 }
 
-void
-prism54_mib_init_work(islpci_private *priv)
-{
-	down_write(&priv->mib_sem);
-	mgt_commit(priv);
-	up_write(&priv->mib_sem);
-}
-
 /* this will be executed outside of atomic context thanks to
  * schedule_work(), thus we can as well use sleeping semaphore
  * locking */
@@ -195,13 +187,6 @@
 	if (down_interruptible(&priv->stats_sem))
 		return;
 
-/* missing stats are :
- *  iwstatistics.qual.updated
- *  iwstatistics.discard.nwid	    
- *  iwstatistics.discard.fragment	    
- *  iwstatistics.discard.misc
- *  iwstatistics.miss.beacon */
-
 /* Noise floor.
  * I'm not sure if the unit is dBm.
  * Note : If we are not connected, this value seems to be irrelevant. */
@@ -425,7 +410,6 @@
 	/* by default  the card sets this to 20. */
 	sens = vwrq->disabled ? 20 : vwrq->value;
 
-	/* set the ed threshold. */
 	return mgt_set_request(priv, DOT11_OID_EDTHRESHOLD, 0, &sens);
 }
 
@@ -534,9 +518,7 @@
 		i++;
 		data++;
 	}
-
 	range->num_bitrates = i;
-
 	kfree(r.ptr);
 
 	return rvalue;
@@ -575,7 +557,6 @@
 	int rvalue;
 
 	rvalue = mgt_get_request(priv, DOT11_OID_BSSID, 0, NULL, &r);
-
 	memcpy(awrq->sa_data, r.ptr, 6);
 	awrq->sa_family = ARPHRD_ETHER;
 	kfree(r.ptr);
@@ -685,7 +666,6 @@
 			kfree(buf);
 		}
 	}
-
 	return current_ev;
 }
 
@@ -712,7 +692,7 @@
 
 	/* Ask the device for a list of known bss. We can report at most
 	 * IW_MAX_AP=64 to the range struct. But the device won't repport anything
-	 * if you change the value of MAXBSS=24. Anyway 24 AP It is probably enough.
+	 * if you change the value of IWMAX_BSS=24.
 	 */
 	rvalue |= mgt_get_request(priv, DOT11_OID_BSSLIST, 0, NULL, &r);
 	bsslist = r.ptr;
@@ -969,8 +949,6 @@
  * small frame <=>  smaller than the rts threshold
  * This is not really the behavior expected by the wireless tool but it seems
  * to be a common behavior in other drivers.
- * 
- * It seems that playing with this tends to hang the card -> DISABLED
  */
 
 static int
@@ -1002,18 +980,16 @@
 		lifetime = vwrq->value / 1024;
 
 	/* now set what is requested */
-
-	if (slimit != 0)
+	if (slimit)
 		rvalue =
 		    mgt_set_request(priv, DOT11_OID_SHORTRETRIES, 0, &slimit);
-	if (llimit != 0)
+	if (llimit)
 		rvalue |=
 		    mgt_set_request(priv, DOT11_OID_LONGRETRIES, 0, &llimit);
-	if (lifetime != 0)
+	if (lifetime)
 		rvalue |=
 		    mgt_set_request(priv, DOT11_OID_MAXTXLIFETIME, 0,
 				    &lifetime);
-
 	return rvalue;
 }
 
@@ -1109,8 +1085,7 @@
 			}
 		}
 	}
-
-	/* now read the flags     */
+	/* now read the flags */
 	if (dwrq->flags & IW_ENCODE_DISABLED) {
 		/* Encoding disabled, 
 		 * authen = DOT11_AUTH_OS;
@@ -1261,11 +1236,6 @@
 prism54_set_u32(struct net_device *ndev, struct iw_request_info *info,
 		__u32 * uwrq, char *extra)
 {
-	/*
-	   u32 *i = (int *) extra;
-	   int param = *i;
-	   int u = *(i + 1);
-	 */
 	u32 oid = uwrq[0], u = uwrq[1];
 
 	return mgt_set_request((islpci_private *) ndev->priv, oid, 0, &u);
@@ -1836,9 +1806,7 @@
 				     0);
 		break;
 
-		/* Note : the following should never happen since we don't run the card in
-		 * extended mode.
-		 * Note : "mlme" is actually a "struct obj_mlmeex *" here, but this
+		/* Note : "mlme" is actually a "struct obj_mlmeex *" here, but this
 		 * is backward compatible layout-wise with "struct obj_mlme".
 		 */
 

Index: linux-2.6.7-rc1/drivers/net/wireless/prism54/isl_ioctl.h
===================================================================
RCS file: /var/lib/cvs/prism54-ng/ksrc/isl_ioctl.h,v retrieving revision 1.31
retrieving revision 1.32

drivers/net/wireless/prism54/isl_ioctl.h +1 -2
diff -u -r1.31 -r1.32
@@ -1,4 +1,4 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/isl_ioctl.h,v 1.30 2004/01/30 16:24:00 ajfa Exp $
+/*  $Header: /var/lib/cvs/prism54-ng/ksrc/isl_ioctl.h,v 1.32 2004/04/17 08:46:04 ajfa Exp $
  *  
  *  Copyright (C) 2002 Intersil Americas Inc.
  *            (C) 2003 Aurelien Alleaume <[email protected]>
@@ -30,7 +30,6 @@
 #define SUPPORTED_WIRELESS_EXT                  16
 
 void prism54_mib_init(islpci_private *);
-void prism54_mib_init_work(islpci_private *);
 
 struct iw_statistics *prism54_get_wireless_stats(struct net_device *);
 void prism54_update_stats(islpci_private *);

Index: linux-2.6.7-rc1/drivers/net/wireless/prism54/islpci_dev.c
===================================================================
RCS file: /var/lib/cvs/prism54-ng/ksrc/islpci_dev.c,v retrieving revision 1.74
retrieving revision 1.75

drivers/net/wireless/prism54/islpci_dev.c +4 -2
diff -u -r1.74 -r1.75
@@ -1,4 +1,4 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_dev.c,v 1.74 2004/04/07 04:12:12 msw Exp $
+/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_dev.c,v 1.75 2004/04/17 08:46:04 ajfa Exp $
  *  
  *  Copyright (C) 2002 Intersil Americas Inc.
  *  Copyright (C) 2003 Herbert Valerio Riedel <[email protected]>
@@ -387,7 +387,9 @@
 	 * the IRQ line until we know for sure the reset went through */
 	isl38xx_enable_common_interrupts(priv->device_base);
 
-	prism54_mib_init_work(priv);
+	down_write(&priv->mib_sem);
+	mgt_commit(priv);
+	up_write(&priv->mib_sem);
 
 	islpci_set_state(priv, PRV_STATE_READY);
 

Index: linux-2.6.7-rc1/drivers/net/wireless/prism54/islpci_mgt.c
===================================================================
RCS file: /var/lib/cvs/prism54-ng/ksrc/islpci_mgt.c,v retrieving revision 1.44
retrieving revision 1.45

drivers/net/wireless/prism54/islpci_mgt.c +7 -5
diff -u -r1.44 -r1.45
@@ -1,4 +1,4 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_mgt.c,v 1.44 2004/04/09 11:42:25 ajfa Exp $
+/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_mgt.c,v 1.45 2004/04/10 03:16:55 msw Exp $
  *  
  *  Copyright (C) 2002 Intersil Americas Inc.
  *  Copyright 2004 Jens Maurer <[email protected]>
@@ -312,8 +312,9 @@
 		 * size of a receive buffer.  Thus, if this check
 		 * triggers, we likely have kernel heap corruption. */
 		if (frag_len > MGMT_FRAME_SIZE) {
-			printk(KERN_WARNING "%s: Bogus packet size of %d (%#x).\
-n", ndev->name, frag_len, frag_len);
+			printk(KERN_WARNING
+				"%s: Bogus packet size of %d (%#x).\n",
+				ndev->name, frag_len, frag_len);
 			frag_len = MGMT_FRAME_SIZE;
 		}
 
@@ -487,8 +488,9 @@
 		}
 		if (timeleft == 0) {
 			printk(KERN_DEBUG
-			       "%s: timeout waiting for mgmt response %lu, trigging device\n",
-			       ndev->name, timeout_left);
+				"%s: timeout waiting for mgmt response %lu, "
+				"triggering device\n",
+				ndev->name, timeout_left);
 			islpci_trigger(priv);
 		}
 		timeout_left += timeleft - wait_cycle_jiffies;

Index: linux-2.6.7-rc1/drivers/net/wireless/prism54/oid_mgt.c
===================================================================
RCS file: /var/lib/cvs/prism54-ng/ksrc/oid_mgt.c,v retrieving revision 1.14
retrieving revision 1.15

drivers/net/wireless/prism54/oid_mgt.c +40 -21

124 lines not on this page · raw message

Index: linux-2.6.7-rc1/drivers/net/wireless/prism54/prismcompat24.h
===================================================================
RCS file: /var/lib/cvs/prism54-ng/ksrc/prismcompat24.h,v retrieving revision 1.1
retrieving revision 1.2

drivers/net/wireless/prism54/prismcompat24.h +13 -8
diff -u -r1.1 -r1.2
@@ -27,20 +27,25 @@
 #include <linux/config.h>
 #include <linux/tqueue.h>
 
-#define work_struct		tq_struct
-#define INIT_WORK		INIT_TQUEUE
-#define schedule_work		schedule_task
-
-#define irqreturn_t		void
-#define IRQ_HANDLED
-#define IRQ_NONE
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,25)
+#define module_param(x, y, z)	MODULE_PARM(x, "i")
+#else
+#include <linux/moduleparam.h>
+#endif
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,23)
 #define free_netdev(x)		kfree(x)
 #define pci_name(x)		x->slot_name
+#define irqreturn_t		void
+#define IRQ_HANDLED
+#define IRQ_NONE
+#else
+#include <linux/interrupt.h>
 #endif
 
-#define module_param(x, y, z)	MODULE_PARM(x, "i")
+#define work_struct		tq_struct
+#define INIT_WORK		INIT_TQUEUE
+#define schedule_work		schedule_task
 
 #define netdev_priv(x)		x->priv