All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* orinoco_cs & IrDA
@ 2001-04-24 18:39 Jean Tourrilhes
  2001-04-24 19:47 ` Alan Cox
  2001-04-25 21:31 ` Linus Torvalds
  0 siblings, 2 replies; 7+ messages in thread
From: Jean Tourrilhes @ 2001-04-24 18:39 UTC (permalink / raw
  To: Linus Torvalds, Alan Cox, Linux kernel mailing list; +Cc: David Gibson

	Hi Linus,

	I've got a question... I would like where to send my driver
patches...

	One month ago, I sent a small update for the orinoco_cs driver
and Wireless Extensions. I didn't put all the changes I had for
orinoco_cs because I believe in small incremental updates limited to a
specific area (even if all the changes are trivial). You ignored my
patch (without feedback), whereas Alan picked it up (if I remember
correctly it was included in his 'patch-2.4.2-ac28').
	So now, what should I do with the rest of my updates and the
new one that have accumulated since ? Should I wait until you grab the
first patch from Alan's tree ? Should I send the new patches directly
to Alan so that he can accumulate a monster patch ? Should I just
accumulate the patches on my web page ?

	Another day, I will also tell you about the IrDA patches...

	Have fun...

	Jean

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: orinoco_cs & IrDA
  2001-04-24 18:39 orinoco_cs & IrDA Jean Tourrilhes
@ 2001-04-24 19:47 ` Alan Cox
  2001-04-24 22:15   ` Jean Tourrilhes
  2001-04-25 21:31 ` Linus Torvalds
  1 sibling, 1 reply; 7+ messages in thread
From: Alan Cox @ 2001-04-24 19:47 UTC (permalink / raw
  To: jt; +Cc: Linus Torvalds, Alan Cox, Linux kernel mailing list, David Gibson

> patch (without feedback), whereas Alan picked it up (if I remember
> correctly it was included in his 'patch-2.4.2-ac28').
> 	So now, what should I do with the rest of my updates and the
> new one that have accumulated since ? Should I wait until you grab the
> first patch from Alan's tree ? Should I send the new patches directly
> to Alan so that he can accumulate a monster patch ? Should I just
> accumulate the patches on my web page ?

Im happy to accumulate them but please send them to Linus too. I tend not to
submit stuff on to Linus where there is an active maintainer and assume the
maintainer will do it when ready.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: orinoco_cs & IrDA
  2001-04-24 19:47 ` Alan Cox
@ 2001-04-24 22:15   ` Jean Tourrilhes
  2001-04-24 22:56     ` Jean Tourrilhes
  0 siblings, 1 reply; 7+ messages in thread
From: Jean Tourrilhes @ 2001-04-24 22:15 UTC (permalink / raw
  To: Alan Cox; +Cc: jt, Linus Torvalds, Linux kernel mailing list, David Gibson

On Tue, Apr 24, 2001 at 08:47:30PM +0100, Alan Cox wrote:
> > patch (without feedback), whereas Alan picked it up (if I remember
> > correctly it was included in his 'patch-2.4.2-ac28').
> > 	So now, what should I do with the rest of my updates and the
> > new one that have accumulated since ? Should I wait until you grab the
> > first patch from Alan's tree ? Should I send the new patches directly
> > to Alan so that he can accumulate a monster patch ? Should I just
> > accumulate the patches on my web page ?
> 
> Im happy to accumulate them but please send them to Linus too. I tend not to
> submit stuff on to Linus where there is an active maintainer and assume the
> maintainer will do it when ready.

	Oups ! Big mea culpa ! Apologies.
	While trying to compile my kernel, I've just realised the the
patch I've downloaded wasn't complete. My browser cut it in the middle
claiming that it was 100% complete.
	Downloaded the patch again (patch-2.4.4-pre6), checked that it
was complete, my patch is in. Oups ! Do I feel stupid...

	Apologies to everybody... Sorry for the confusion...

	Jean

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: orinoco_cs & IrDA
  2001-04-24 22:15   ` Jean Tourrilhes
@ 2001-04-24 22:56     ` Jean Tourrilhes
  2001-04-25  1:25       ` Jean Tourrilhes
  0 siblings, 1 reply; 7+ messages in thread
From: Jean Tourrilhes @ 2001-04-24 22:56 UTC (permalink / raw
  To: Alan Cox; +Cc: jt, Linus Torvalds, Linux kernel mailing list, David Gibson

[-- Attachment #1: Type: text/plain, Size: 899 bytes --]

On Tue, Apr 24, 2001 at 03:15:08PM -0700, Jean Tourrilhes wrote:
> 
[...]
> 	Downloaded the patch again (patch-2.4.4-pre6), checked that it
> was complete, my patch is in. Oups ! Do I feel stupid...

	Let's finish this story. As indicated above, the first
fragment of the patch I sent on month ago is in the kernel. The two
other fragments didn't make it. They are attached...

wireless.v11b.diff :
------------------
	Update the various wireless LAN driver in the kernel to
version 11 (definition already in the kernel). This update is
necessary to avoid crashes in the user space utilities.

orinoco_w11.diff :
----------------
	Same deal for the new orinoco_cs driver.
	I've also added the retry limit setting, but this feature is
not enabled (priv->has_retry = 0).


	Alan : those two are already in your last kernel, please ignore.

	Linus : those are not in your kernel.

	That's it...

	Jean

[-- Attachment #2: wireless.v11b.diff --]
[-- Type: text/plain, Size: 3659 bytes --]

diff -u -p linux/drivers/net/wireless.25/wavelan.c linux/drivers/net/wavelan.c
--- linux/drivers/net/wireless.25/wavelan.c	Wed Mar 28 17:27:27 2001
+++ linux/drivers/net/wavelan.c	Wed Mar 28 17:28:34 2001
@@ -2028,8 +2028,17 @@ static int wavelan_ioctl(struct net_devi
 		if (wrq->u.data.pointer != (caddr_t) 0) {
 			struct iw_range range;
 
-			/* Set the length (useless:  it's constant). */
+			/* Set the length (very important for backward
+			 * compatibility) */
 			wrq->u.data.length = sizeof(struct iw_range);
+
+			/* Set all the info we don't care or don't know
+			 * about to zero */
+			memset(&range, 0, sizeof(range));
+
+			/* Set the Wireless Extension versions */
+			range.we_version_compiled = WIRELESS_EXT;
+			range.we_version_source = 9;
 
 			/* Set information in the range struct.  */
 			range.throughput = 1.6 * 1000 * 1000;	/* don't argue on this ! */
diff -u -p linux/drivers/net/pcmcia/wireless.25/wavelan_cs.c linux/drivers/net/pcmcia/wavelan_cs.c
--- linux/drivers/net/pcmcia/wireless.25/wavelan_cs.c	Wed Mar 28 17:21:02 2001
+++ linux/drivers/net/pcmcia/wavelan_cs.c	Wed Mar 28 17:23:19 2001
@@ -2239,8 +2239,15 @@ wavelan_ioctl(struct net_device *	dev,	/
 	{
 	  struct iw_range	range;
 
-	  /* Set the length (useless : its constant...) */
+	  /* Set the length (very important for backward compatibility) */
 	  wrq->u.data.length = sizeof(struct iw_range);
+
+	  /* Set all the info we don't care or don't know about to zero */
+	  memset(&range, 0, sizeof(range));
+
+	  /* Set the Wireless Extension versions */
+	  range.we_version_compiled = WIRELESS_EXT;
+	  range.we_version_source = 9;	/* Nothing for us in v10 and v11 */
 
 	  /* Set information in the range struct */
 	  range.throughput = 1.4 * 1000 * 1000;	/* don't argue on this ! */
diff -u -p linux/drivers/net/pcmcia/wireless.25/netwave_cs.c linux/drivers/net/pcmcia/netwave_cs.c
--- linux/drivers/net/pcmcia/wireless.25/netwave_cs.c	Wed Mar 28 17:24:40 2001
+++ linux/drivers/net/pcmcia/netwave_cs.c	Wed Mar 28 17:29:39 2001
@@ -710,8 +710,17 @@ static int netwave_ioctl(struct net_devi
        if(wrq->u.data.pointer != (caddr_t) 0) {
 	   struct iw_range	range;
 		   
-	   /* Set the length (useless : its constant...) */
+	   /* Set the length (very important for backward compatibility) */
 	   wrq->u.data.length = sizeof(struct iw_range);
+
+	   /* Set all the info we don't care or don't know about to zero */
+	   memset(&range, 0, sizeof(range));
+
+#if WIRELESS_EXT > 10
+	   /* Set the Wireless Extension versions */
+	   range.we_version_compiled = WIRELESS_EXT;
+	   range.we_version_source = 9;	/* Nothing for us in v10 and v11 */
+#endif /* WIRELESS_EXT > 10 */
 		   
 	   /* Set information in the range struct */
 	   range.throughput = 450 * 1000;	/* don't argue on this ! */
diff -u -p linux/drivers/net/pcmcia/wireless.25/ray_cs.c linux/drivers/net/pcmcia/ray_cs.c
--- linux/drivers/net/pcmcia/wireless.25/ray_cs.c	Wed Mar 28 17:21:57 2001
+++ linux/drivers/net/pcmcia/ray_cs.c	Wed Mar 28 17:30:16 2001
@@ -1332,8 +1332,14 @@ static int ray_dev_ioctl(struct net_devi
 	  struct iw_range	range;
 	  memset((char *) &range, 0, sizeof(struct iw_range));
 
-	  /* Set the length (useless : its constant...) */
+	  /* Set the length (very important for backward compatibility) */
 	  wrq->u.data.length = sizeof(struct iw_range);
+
+#if WIRELESS_EXT > 10
+	  /* Set the Wireless Extension versions */
+	  range.we_version_compiled = WIRELESS_EXT;
+	  range.we_version_source = 9;
+#endif /* WIRELESS_EXT > 10 */
 
 	  /* Set information in the range struct */
 	  range.throughput = 1.1 * 1000 * 1000;	/* Put the right number here */

[-- Attachment #3: orinoco_w11.diff --]
[-- Type: text/plain, Size: 8100 bytes --]

diff -u -p linux/drivers/net/pcmcia/wireless.25/hermes.h linux/drivers/net/pcmcia/hermes.h
--- linux/drivers/net/pcmcia/wireless.25/hermes.h	Wed Mar 28 10:31:35 2001
+++ linux/drivers/net/pcmcia/hermes.h	Wed Mar 28 10:43:20 2001
@@ -196,6 +196,9 @@
 #define		HERMES_RID_CURRENT_BSSID	((uint16_t)0xfd42)
 #define		HERMES_RID_COMMSQUALITY		((uint16_t)0xfd43)
 #define 	HERMES_RID_CURRENT_TX_RATE	((uint16_t)0xfd44)
+#define 	HERMES_RID_SHORT_RETRY_LIMIT	((uint16_t)0xfd48)
+#define 	HERMES_RID_LONG_RETRY_LIMIT	((uint16_t)0xfd49)
+#define 	HERMES_RID_MAX_TX_LIFETIME	((uint16_t)0xfd4A)
 #define		HERMES_RID_WEP_AVAIL		((uint16_t)0xfd4f)
 #define		HERMES_RID_CURRENT_CHANNEL	((uint16_t)0xfdc1)
 #define		HERMES_RID_DATARATES		((uint16_t)0xfdc6)
diff -u -p linux/drivers/net/pcmcia/wireless.25/orinoco_cs.c linux/drivers/net/pcmcia/orinoco_cs.c
--- linux/drivers/net/pcmcia/wireless.25/orinoco_cs.c	Wed Mar 28 10:31:35 2001
+++ linux/drivers/net/pcmcia/orinoco_cs.c	Wed Mar 28 17:16:36 2001
@@ -239,6 +239,7 @@ typedef struct dldwd_priv {
 	int has_wep, has_big_wep;
 	int has_mwo;
 	int has_pm;
+	int has_retry;
 	int broken_reset, broken_allocate;
 	uint16_t channel_mask;
 
@@ -254,6 +255,7 @@ typedef struct dldwd_priv {
 	uint16_t ap_density, rts_thresh;
 	uint16_t tx_rate_ctrl;
 	uint16_t pm_on, pm_mcast, pm_period, pm_timeout;
+	uint16_t retry_short, retry_long, retry_time;
 
 	int promiscuous, allmulti, mc_count;
 
@@ -645,6 +647,24 @@ ESSID in IBSS-Ad-Hoc mode.\n", dev->name
 			goto out;
 	}
 
+	/* Set retry settings - will fail on lot's of firmwares */
+	if (priv->has_retry) {
+		err = hermes_write_wordrec(hw, USER_BAP, HERMES_RID_SHORT_RETRY_LIMIT,
+					   priv->retry_short);
+		if (err) {
+			printk(KERN_WARNING "%s: Can't set retry limit!\n", dev->name);
+			goto out;
+		}
+		err = hermes_write_wordrec(hw, USER_BAP, HERMES_RID_LONG_RETRY_LIMIT,
+					   priv->retry_long);
+		if (err)
+			goto out;
+		err = hermes_write_wordrec(hw, USER_BAP, HERMES_RID_MAX_TX_LIFETIME,
+					   priv->retry_time);
+		if (err)
+			goto out;
+	}
+
 	/* Set promiscuity / multicast*/
 	priv->promiscuous = 0;
 	priv->allmulti = 0;
@@ -1267,6 +1287,7 @@ static int dldwd_init(struct net_device 
 					  Gold cards from the others? */
 		priv->has_mwo = (firmver >= 0x60000);
 		priv->has_pm = (firmver >= 0x40020);
+		priv->has_retry = 0;
 		/* Tested with Lucent firmware :
 		 *	1.16 ; 4.08 ; 4.52 ; 6.04 ; 6.16 => Jean II
 		 * Tested CableTron firmware : 4.32 => Anton */
@@ -1285,6 +1306,7 @@ static int dldwd_init(struct net_device 
 		priv->has_big_wep = 1;
 		priv->has_mwo = 0;
 		priv->has_pm = (firmver >= 0x20000);
+		priv->has_retry = 0;
 		/* Tested with Intel firmware : 1.01 => Jean II */
 		/* Note : firmware 1.01 is *seriously* broken */
 		break;
@@ -1301,6 +1323,7 @@ static int dldwd_init(struct net_device 
 		priv->has_big_wep = 0; /* FIXME */
 		priv->has_mwo = 0;
 		priv->has_pm = (firmver >= 0x20000); /* FIXME */
+		priv->has_retry = 0;
 		break;
 	case 0x6:
 		vendor_str = "LinkSys/D-Link";
@@ -1315,6 +1338,7 @@ static int dldwd_init(struct net_device 
 		priv->has_big_wep = 0;
 		priv->has_mwo = 0;
 		priv->has_pm = (firmver >= 0x20000); /* FIXME */
+		priv->has_retry = 0;
 		break;
 #if 0
 	case 0x???:		/* Could someone help here ??? */
@@ -1330,6 +1354,7 @@ static int dldwd_init(struct net_device 
 		priv->has_big_wep = 1;	/* Probably RID_SYMBOL_KEY_LENGTH */
 		priv->has_mwo = 0;
 		priv->has_pm = (firmver >= 0x20000);
+		priv->has_retry = 0;
 		break;
 #endif
 	default:
@@ -1344,6 +1369,7 @@ static int dldwd_init(struct net_device 
 		priv->has_big_wep = 0;
 		priv->has_mwo = 0;
 		priv->has_pm = 0;
+		priv->has_retry = 0;
 	}
 
 	printk(KERN_INFO "%s: Firmware ID %02X vendor 0x%x (%s) version %d.%02d\n",
@@ -1453,6 +1479,21 @@ static int dldwd_init(struct net_device 
 		}
 	}
 		
+	/* Retry setup */
+	if (priv->has_retry) {
+		err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_SHORT_RETRY_LIMIT, &priv->retry_short);
+		if (err)
+			goto out;
+
+		err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_LONG_RETRY_LIMIT, &priv->retry_long);
+		if (err)
+			goto out;
+
+		err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_MAX_TX_LIFETIME, &priv->retry_time);
+		if (err)
+			goto out;
+	}
+		
 	/* Set up the default configuration */
 	priv->iw_mode = IW_MODE_INFRA;
 	/* By default use IEEE/IBSS ad-hoc mode if we have it */
@@ -1802,6 +1843,11 @@ static int dldwd_ioctl_getiwrange(struct
 
 	/* Much of this shamelessly taken from wvlan_cs.c. No idea
 	 * what it all means -dgibson */
+#if WIRELESS_EXT > 10
+	range.we_version_compiled = WIRELESS_EXT;
+	range.we_version_source = 11;
+#endif /* WIRELESS_EXT > 10 */
+
 	range.min_nwid = range.max_nwid = 0; /* We don't use nwids */
 
 	/* Set available channels/frequencies */
@@ -1881,6 +1927,16 @@ static int dldwd_ioctl_getiwrange(struct
 	range.txpower[0] = 15; /* 15dBm */
 	range.txpower_capa = IW_TXPOW_DBM;
 
+#if WIRELESS_EXT > 10
+	range.retry_capa = IW_RETRY_LIMIT | IW_RETRY_LIFETIME;
+	range.retry_flags = IW_RETRY_LIMIT;
+	range.r_time_flags = IW_RETRY_LIFETIME;
+	range.min_retry = 0;
+	range.max_retry = 65535;	/* ??? */
+	range.min_r_time = 0;
+	range.max_r_time = 65535 * 1000;	/* ??? */
+#endif /* WIRELESS_EXT > 10 */
+
 	if (copy_to_user(rrq->pointer, &range, sizeof(range)))
 		return -EFAULT;
 
@@ -2520,6 +2576,92 @@ static int dldwd_ioctl_getpower(struct n
 	return err;
 }
 
+#if WIRELESS_EXT > 10
+static int dldwd_ioctl_setretry(struct net_device *dev, struct iw_param *rrq)
+{
+	dldwd_priv_t *priv = dev->priv;
+	int err = 0;
+
+
+	dldwd_lock(priv);
+
+	if ((rrq->disabled) || (!priv->has_retry)){
+		err = -EOPNOTSUPP;
+		goto out;
+	} else {
+		if (rrq->flags & IW_RETRY_LIMIT) {
+			if (rrq->flags & IW_RETRY_MAX)
+				priv->retry_long = rrq->value;
+			else if (rrq->flags & IW_RETRY_MIN)
+				priv->retry_short = rrq->value;
+			else {
+				/* No modifier : set both */
+				priv->retry_long = rrq->value;
+				priv->retry_short = rrq->value;
+			}
+		}
+		if (rrq->flags & IW_RETRY_LIFETIME) {
+			priv->retry_time = rrq->value / 1000;
+		}
+		if ((rrq->flags & IW_RETRY_TYPE) == 0) {
+			err = -EINVAL;
+			goto out;
+		}			
+	}
+
+ out:
+	dldwd_unlock(priv);
+
+	return err;
+}
+
+static int dldwd_ioctl_getretry(struct net_device *dev, struct iw_param *rrq)
+{
+	dldwd_priv_t *priv = dev->priv;
+	hermes_t *hw = &priv->hw;
+	int err = 0;
+	uint16_t short_limit, long_limit, lifetime;
+
+	dldwd_lock(priv);
+	
+	err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_SHORT_RETRY_LIMIT, &short_limit);
+	if (err)
+		goto out;
+
+	err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_LONG_RETRY_LIMIT, &long_limit);
+	if (err)
+		goto out;
+
+	err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_MAX_TX_LIFETIME, &lifetime);
+	if (err)
+		goto out;
+
+	rrq->disabled = 0;		/* Can't be disabled */
+
+	/* Note : by default, display the retry number */
+	if ((rrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) {
+		rrq->flags = IW_RETRY_LIFETIME;
+		rrq->value = lifetime * 1000;	/* ??? */
+	} else {
+		/* By default, display the min number */
+		if ((rrq->flags & IW_RETRY_MAX)) {
+			rrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
+			rrq->value = long_limit;
+		} else {
+			rrq->flags = IW_RETRY_LIMIT;
+			rrq->value = short_limit;
+			if(short_limit != long_limit)
+				rrq->flags |= IW_RETRY_MIN;
+		}
+	}
+
+ out:
+	dldwd_unlock(priv);
+
+	return err;
+}
+#endif /* WIRELESS_EXT > 10 */
+
 static int dldwd_ioctl_setport3(struct net_device *dev, struct iwreq *wrq)
 {
 	dldwd_priv_t *priv = dev->priv;
@@ -2857,6 +2999,20 @@ static int dldwd_ioctl(struct net_device
 		wrq->u.txpower.disabled = 0;
 		wrq->u.txpower.flags = IW_TXPOW_DBM;
 		break;
+
+#if WIRELESS_EXT > 10
+	case SIOCSIWRETRY:
+		DEBUG(1, "%s: SIOCSIWRETRY\n", dev->name);
+		err = dldwd_ioctl_setretry(dev, &wrq->u.retry);
+		if (! err)
+			changed = 1;
+		break;
+
+	case SIOCGIWRETRY:
+		DEBUG(1, "%s: SIOCGIWRETRY\n", dev->name);
+		err = dldwd_ioctl_getretry(dev, &wrq->u.retry);
+		break;
+#endif /* WIRELESS_EXT > 10 */
 
 	case SIOCSIWSPY:
 		DEBUG(1, "%s: SIOCSIWSPY\n", dev->name);

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: orinoco_cs & IrDA
  2001-04-24 22:56     ` Jean Tourrilhes
@ 2001-04-25  1:25       ` Jean Tourrilhes
  2001-04-25  1:26         ` Jean Tourrilhes
  0 siblings, 1 reply; 7+ messages in thread
From: Jean Tourrilhes @ 2001-04-25  1:25 UTC (permalink / raw
  To: Alan Cox; +Cc: jt, Linus Torvalds, Linux kernel mailing list, David Gibson

On Tue, Apr 24, 2001 at 03:56:37PM -0700, Jean Tourrilhes wrote:
> On Tue, Apr 24, 2001 at 03:15:08PM -0700, Jean Tourrilhes wrote:
> > 
> [...]
> > 	Downloaded the patch again (patch-2.4.4-pre6), checked that it
> > was complete, my patch is in. Oups ! Do I feel stupid...
> 
> 	Let's finish this story. As indicated above, the first
> fragment of the patch I sent on month ago is in the kernel. The two
> other fragments didn't make it. They are attached...

	Ok, now to the second chapter. These are all the changes
accumulated since the patch I sent one month ago (cf previous e-mail).
	Changes :
		o more Prism2/Symbol compatibility goodies
		o Tested D-Link cards and Lucent firmware 7.28
		o Cleanup, bug fixes from David Gibson
	The whole is tested, as usual... 75% of the patch was on my
web pages for the last month and people seem to have liked it.

	I've made 2 patches, one for 2.4.4-pre6 and one for
2.4.3-ac13. The difference between the two is minor (one line).

	Linus : please have a look at orinoco_v4b.diff (first
attachement). Of course, this patch will apply and work only if you
have applied the patch in my previous e-mail.

	Alan : orinoco_v4b-alan.diff is for you (second attachement).

	Have fun...

	Jean

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: orinoco_cs & IrDA
  2001-04-25  1:25       ` Jean Tourrilhes
@ 2001-04-25  1:26         ` Jean Tourrilhes
  0 siblings, 0 replies; 7+ messages in thread
From: Jean Tourrilhes @ 2001-04-25  1:26 UTC (permalink / raw
  To: Alan Cox; +Cc: jt, Linus Torvalds, Linux kernel mailing list, David Gibson

[-- Attachment #1: Type: text/plain, Size: 918 bytes --]

On Tue, Apr 24, 2001 at 06:25:50PM -0700, Jean Tourrilhes wrote:
> 
> 	Ok, now to the second chapter. These are all the changes
> accumulated since the patch I sent one month ago (cf previous e-mail).
> 	Changes :
> 		o more Prism2/Symbol compatibility goodies
> 		o Tested D-Link cards and Lucent firmware 7.28
> 		o Cleanup, bug fixes from David Gibson
> 	The whole is tested, as usual... 75% of the patch was on my
> web pages for the last month and people seem to have liked it.
> 
> 	I've made 2 patches, one for 2.4.4-pre6 and one for
> 2.4.3-ac13. The difference between the two is minor (one line).
> 
> 	Linus : please have a look at orinoco_v4b.diff (first
> attachement). Of course, this patch will apply and work only if you
> have applied the patch in my previous e-mail.
> 
> 	Alan : orinoco_v4b-alan.diff is for you (second attachement).
> 
> 	Have fun...
> 
> 	Jean

	File attached this time...

	Jean

[-- Attachment #2: orinoco_v4b.diff --]
[-- Type: text/plain, Size: 31250 bytes --]

diff -u -p linux/drivers/net/pcmcia/wireless.25b/hermes.h linux/drivers/net/pcmcia/hermes.h
--- linux/drivers/net/pcmcia/wireless.25b/hermes.h	Tue Apr 24 15:57:48 2001
+++ linux/drivers/net/pcmcia/hermes.h	Tue Apr 24 16:04:34 2001
@@ -35,18 +35,18 @@
 /*
  * Limits and constants
  */
-#define		HERMES_ALLOC_LEN_MIN		((uint16_t)4)
-#define		HERMES_ALLOC_LEN_MAX		((uint16_t)2400)
+#define		HERMES_ALLOC_LEN_MIN		(4)
+#define		HERMES_ALLOC_LEN_MAX		(2400)
 #define		HERMES_LTV_LEN_MAX		(34)
-#define		HERMES_BAP_DATALEN_MAX		((uint16_t)4096)
-#define		HERMES_BAP_OFFSET_MAX		((uint16_t)4096)
-#define		HERMES_PORTID_MAX		((uint16_t)7)
-#define		HERMES_NUMPORTS_MAX		((uint16_t)(HERMES_PORTID_MAX+1))
-#define		HERMES_PDR_LEN_MAX		((uint16_t)260)	/* in bytes, from EK */
-#define		HERMES_PDA_RECS_MAX		((uint16_t)200)	/* a guess */
-#define		HERMES_PDA_LEN_MAX		((uint16_t)1024)	/* in bytes, from EK */
-#define		HERMES_SCANRESULT_MAX		((uint16_t)35)
-#define		HERMES_CHINFORESULT_MAX		((uint16_t)8)
+#define		HERMES_BAP_DATALEN_MAX		(4096)
+#define		HERMES_BAP_OFFSET_MAX		(4096)
+#define		HERMES_PORTID_MAX		(7)
+#define		HERMES_NUMPORTS_MAX		(HERMES_PORTID_MAX+1)
+#define		HERMES_PDR_LEN_MAX		(260)	/* in bytes, from EK */
+#define		HERMES_PDA_RECS_MAX		(200)	/* a guess */
+#define		HERMES_PDA_LEN_MAX		(1024)	/* in bytes, from EK */
+#define		HERMES_SCANRESULT_MAX		(35)
+#define		HERMES_CHINFORESULT_MAX		(8)
 #define		HERMES_FRAME_LEN_MAX		(2304)
 #define		HERMES_MAX_MULTICAST		(16)
 #define		HERMES_MAGIC			(0x7d1f)
@@ -86,122 +86,125 @@
 /*
  * CMD register bitmasks
  */
-#define		HERMES_CMD_BUSY			((uint16_t)0x8000)
-#define		HERMES_CMD_AINFO		((uint16_t)0x7f00)
-#define		HERMES_CMD_MACPORT		((uint16_t)0x0700)
-#define		HERMES_CMD_RECL			((uint16_t)0x0100)
-#define		HERMES_CMD_WRITE		((uint16_t)0x0100)
-#define		HERMES_CMD_PROGMODE		((uint16_t)0x0300)
-#define		HERMES_CMD_CMDCODE		((uint16_t)0x003f)
+#define		HERMES_CMD_BUSY			(0x8000)
+#define		HERMES_CMD_AINFO		(0x7f00)
+#define		HERMES_CMD_MACPORT		(0x0700)
+#define		HERMES_CMD_RECL			(0x0100)
+#define		HERMES_CMD_WRITE		(0x0100)
+#define		HERMES_CMD_PROGMODE		(0x0300)
+#define		HERMES_CMD_CMDCODE		(0x003f)
 
 /*
  * STATUS register bitmasks
  */
-#define		HERMES_STATUS_RESULT		((uint16_t)0x7f00)
-#define		HERMES_STATUS_CMDCODE		((uint16_t)0x003f)
+#define		HERMES_STATUS_RESULT		(0x7f00)
+#define		HERMES_STATUS_CMDCODE		(0x003f)
 
 /*
  * OFFSET refister bitmasks
  */
-#define		HERMES_OFFSET_BUSY		((uint16_t)0x8000)
-#define		HERMES_OFFSET_ERR		((uint16_t)0x4000)
-#define		HERMES_OFFSET_DATAOFF		((uint16_t)0x0ffe)
+#define		HERMES_OFFSET_BUSY		(0x8000)
+#define		HERMES_OFFSET_ERR		(0x4000)
+#define		HERMES_OFFSET_DATAOFF		(0x0ffe)
 
 /*
  * Event register bitmasks (INTEN, EVSTAT, EVACK)
  */
-#define		HERMES_EV_TICK			((uint16_t)0x8000)
-#define		HERMES_EV_WTERR			((uint16_t)0x4000)
-#define		HERMES_EV_INFDROP		((uint16_t)0x2000)
-#define		HERMES_EV_INFO			((uint16_t)0x0080)
-#define		HERMES_EV_DTIM			((uint16_t)0x0020)
-#define		HERMES_EV_CMD			((uint16_t)0x0010)
-#define		HERMES_EV_ALLOC			((uint16_t)0x0008)
-#define		HERMES_EV_TXEXC			((uint16_t)0x0004)
-#define		HERMES_EV_TX			((uint16_t)0x0002)
-#define		HERMES_EV_RX			((uint16_t)0x0001)
+#define		HERMES_EV_TICK			(0x8000)
+#define		HERMES_EV_WTERR			(0x4000)
+#define		HERMES_EV_INFDROP		(0x2000)
+#define		HERMES_EV_INFO			(0x0080)
+#define		HERMES_EV_DTIM			(0x0020)
+#define		HERMES_EV_CMD			(0x0010)
+#define		HERMES_EV_ALLOC			(0x0008)
+#define		HERMES_EV_TXEXC			(0x0004)
+#define		HERMES_EV_TX			(0x0002)
+#define		HERMES_EV_RX			(0x0001)
 
 /*
  * Command codes
  */
 /*--- Controller Commands --------------------------*/
-#define		HERMES_CMD_INIT			((uint16_t)0x00)
-#define		HERMES_CMD_ENABLE		((uint16_t)0x01)
-#define		HERMES_CMD_DISABLE		((uint16_t)0x02)
-#define		HERMES_CMD_DIAG			((uint16_t)0x03)
+#define		HERMES_CMD_INIT			(0x0000)
+#define		HERMES_CMD_ENABLE		(0x0001)
+#define		HERMES_CMD_DISABLE		(0x0002)
+#define		HERMES_CMD_DIAG			(0x0003)
 
 /*--- Buffer Mgmt Commands --------------------------*/
-#define		HERMES_CMD_ALLOC		((uint16_t)0x0A)
-#define		HERMES_CMD_TX			((uint16_t)0x0B)
-#define		HERMES_CMD_CLRPRST		((uint16_t)0x12)
+#define		HERMES_CMD_ALLOC		(0x000A)
+#define		HERMES_CMD_TX			(0x000B)
+#define		HERMES_CMD_CLRPRST		(0x0012)
 
 /*--- Regulate Commands --------------------------*/
-#define		HERMES_CMD_NOTIFY		((uint16_t)0x10)
-#define		HERMES_CMD_INQ			((uint16_t)0x11)
+#define		HERMES_CMD_NOTIFY		(0x0010)
+#define		HERMES_CMD_INQ			(0x0011)
 
 /*--- Configure Commands --------------------------*/
-#define		HERMES_CMD_ACCESS		((uint16_t)0x21)
-#define		HERMES_CMD_DOWNLD		((uint16_t)0x22)
+#define		HERMES_CMD_ACCESS		(0x0021)
+#define		HERMES_CMD_DOWNLD		(0x0022)
 
 /*--- Debugging Commands -----------------------------*/
-#define 	HERMES_CMD_MONITOR		((uint16_t)(0x38))
-#define		HERMES_MONITOR_ENABLE		((uint16_t)(0x0b))
-#define		HERMES_MONITOR_DISABLE		((uint16_t)(0x0f))
+#define 	HERMES_CMD_MONITOR		(0x0038)
+#define		HERMES_MONITOR_ENABLE		(0x000b)
+#define		HERMES_MONITOR_DISABLE		(0x000f)
 
 /*
  * Configuration RIDs
  */
 
-#define		HERMES_RID_CNF_PORTTYPE		((uint16_t)0xfc00)
-#define		HERMES_RID_CNF_MACADDR		((uint16_t)0xfc01)
-#define		HERMES_RID_CNF_DESIRED_SSID	((uint16_t)0xfc02)
-#define		HERMES_RID_CNF_CHANNEL		((uint16_t)0xfc03)
-#define		HERMES_RID_CNF_OWN_SSID		((uint16_t)0xfc04)
-#define		HERMES_RID_CNF_SYSTEM_SCALE	((uint16_t)0xfc06)
-#define		HERMES_RID_CNF_MAX_DATA_LEN	((uint16_t)0xfc07)
-#define		HERMES_RID_CNF_PM_ENABLE	((uint16_t)0xfc09)
-#define		HERMES_RID_CNF_PM_MCAST_RX	((uint16_t)0xfc0b)
-#define		HERMES_RID_CNF_PM_PERIOD	((uint16_t)0xfc0c)
-#define		HERMES_RID_CNF_PM_HOLDOVER	((uint16_t)0xfc0d)
-#define		HERMES_RID_CNF_NICKNAME		((uint16_t)0xfc0e)
-#define		HERMES_RID_CNF_WEP_ON		((uint16_t)0xfc20)
-#define		HERMES_RID_CNF_MWO_ROBUST	((uint16_t)0xfc25)
-#define		HERMES_RID_CNF_PRISM2_WEP_ON	((uint16_t)0xfc28)
-#define		HERMES_RID_CNF_MULTICAST_LIST	((uint16_t)0xfc80)
-#define		HERMES_RID_CNF_CREATEIBSS	((uint16_t)0xfc81)
-#define		HERMES_RID_CNF_FRAG_THRESH	((uint16_t)0xfc82)
-#define		HERMES_RID_CNF_RTS_THRESH	((uint16_t)0xfc83)
-#define		HERMES_RID_CNF_TX_RATE_CTRL	((uint16_t)0xfc84)
-#define		HERMES_RID_CNF_PROMISCUOUS	((uint16_t)0xfc85)
-#define		HERMES_RID_CNF_KEYS		((uint16_t)0xfcb0)
-#define		HERMES_RID_CNF_TX_KEY		((uint16_t)0xfcb1)
-#define		HERMES_RID_CNF_TICKTIME		((uint16_t)0xfce0)
-
-#define		HERMES_RID_CNF_PRISM2_TX_KEY	((uint16_t)0xfc23)
-#define		HERMES_RID_CNF_PRISM2_KEY0	((uint16_t)0xfc24)
-#define		HERMES_RID_CNF_PRISM2_KEY1	((uint16_t)0xfc25)
-#define		HERMES_RID_CNF_PRISM2_KEY2	((uint16_t)0xfc26)
-#define		HERMES_RID_CNF_PRISM2_KEY3	((uint16_t)0xfc27)
-#define		HERMES_RID_CNF_SYMBOL_AUTH_TYPE		((uint16_t)0xfc2A)
-/* This one is read only */
-#define		HERMES_RID_CNF_SYMBOL_KEY_LENGTH	((uint16_t)0xfc2B)
-#define		HERMES_RID_CNF_SYMBOL_BASIC_RATES	((uint16_t)0xfc8A)
+#define		HERMES_RID_CNF_PORTTYPE		(0xfc00)
+#define		HERMES_RID_CNF_MACADDR		(0xfc01)
+#define		HERMES_RID_CNF_DESIRED_SSID	(0xfc02)
+#define		HERMES_RID_CNF_CHANNEL		(0xfc03)
+#define		HERMES_RID_CNF_OWN_SSID		(0xfc04)
+#define		HERMES_RID_CNF_SYSTEM_SCALE	(0xfc06)
+#define		HERMES_RID_CNF_MAX_DATA_LEN	(0xfc07)
+#define		HERMES_RID_CNF_PM_ENABLE	(0xfc09)
+#define		HERMES_RID_CNF_PM_MCAST_RX	(0xfc0b)
+#define		HERMES_RID_CNF_PM_PERIOD	(0xfc0c)
+#define		HERMES_RID_CNF_PM_HOLDOVER	(0xfc0d)
+#define		HERMES_RID_CNF_NICKNAME		(0xfc0e)
+#define		HERMES_RID_CNF_WEP_ON		(0xfc20)
+#define		HERMES_RID_CNF_MWO_ROBUST	(0xfc25)
+#define		HERMES_RID_CNF_PRISM2_WEP_ON	(0xfc28)
+#define		HERMES_RID_CNF_MULTICAST_LIST	(0xfc80)
+#define		HERMES_RID_CNF_CREATEIBSS	(0xfc81)
+#define		HERMES_RID_CNF_FRAG_THRESH	(0xfc82)
+#define		HERMES_RID_CNF_RTS_THRESH	(0xfc83)
+#define		HERMES_RID_CNF_TX_RATE_CTRL	(0xfc84)
+#define		HERMES_RID_CNF_PROMISCUOUS	(0xfc85)
+#define		HERMES_RID_CNF_KEYS		(0xfcb0)
+#define		HERMES_RID_CNF_TX_KEY		(0xfcb1)
+#define		HERMES_RID_CNF_TICKTIME		(0xfce0)
+
+#define		HERMES_RID_CNF_PRISM2_TX_KEY	(0xfc23)
+#define		HERMES_RID_CNF_PRISM2_KEY0	(0xfc24)
+#define		HERMES_RID_CNF_PRISM2_KEY1	(0xfc25)
+#define		HERMES_RID_CNF_PRISM2_KEY2	(0xfc26)
+#define		HERMES_RID_CNF_PRISM2_KEY3	(0xfc27)
+#define		HERMES_RID_CNF_SYMBOL_MANDATORY_BSSID	(0xfc21)
+#define		HERMES_RID_CNF_SYMBOL_AUTH_TYPE		(0xfc2A)
+#define		HERMES_RID_CNF_SYMBOL_BASIC_RATES	(0xfc8A)
+#define		HERMES_RID_CNF_SYMBOL_PREAMBLE		(0xfc8C)
 
 /*
  * Information RIDs
  */
-#define		HERMES_RID_CHANNEL_LIST		((uint16_t)0xfd10)
-#define		HERMES_RID_STAIDENTITY		((uint16_t)0xfd20)
-#define		HERMES_RID_CURRENT_SSID		((uint16_t)0xfd41)
-#define		HERMES_RID_CURRENT_BSSID	((uint16_t)0xfd42)
-#define		HERMES_RID_COMMSQUALITY		((uint16_t)0xfd43)
-#define 	HERMES_RID_CURRENT_TX_RATE	((uint16_t)0xfd44)
-#define 	HERMES_RID_SHORT_RETRY_LIMIT	((uint16_t)0xfd48)
-#define 	HERMES_RID_LONG_RETRY_LIMIT	((uint16_t)0xfd49)
-#define 	HERMES_RID_MAX_TX_LIFETIME	((uint16_t)0xfd4A)
-#define		HERMES_RID_WEP_AVAIL		((uint16_t)0xfd4f)
-#define		HERMES_RID_CURRENT_CHANNEL	((uint16_t)0xfdc1)
-#define		HERMES_RID_DATARATES		((uint16_t)0xfdc6)
+#define		HERMES_RID_CHANNEL_LIST		(0xfd10)
+#define		HERMES_RID_STAIDENTITY		(0xfd20)
+#define		HERMES_RID_CURRENT_SSID		(0xfd41)
+#define		HERMES_RID_CURRENT_BSSID	(0xfd42)
+#define		HERMES_RID_COMMSQUALITY		(0xfd43)
+#define 	HERMES_RID_CURRENT_TX_RATE	(0xfd44)
+#define 	HERMES_RID_SHORT_RETRY_LIMIT	(0xfd48)
+#define 	HERMES_RID_LONG_RETRY_LIMIT	(0xfd49)
+#define 	HERMES_RID_MAX_TX_LIFETIME	(0xfd4A)
+#define		HERMES_RID_WEP_AVAIL		(0xfd4f)
+#define		HERMES_RID_CURRENT_CHANNEL	(0xfdc1)
+#define		HERMES_RID_DATARATES		(0xfdc6)
+#define		HERMES_RID_SYMBOL_PRIMARY_VER	(0xfd03)
+#define		HERMES_RID_SYMBOL_SECONDARY_VER	(0xfd21)
+#define		HERMES_RID_SYMBOL_KEY_LENGTH	(0xfc2B)
 
 /*
  * Frame structures and constants
@@ -216,19 +219,19 @@ typedef struct hermes_frame_desc {
 	uint16_t tx_ctl; /* 0xC */
 } __attribute__ ((packed)) hermes_frame_desc_t;
 
-#define		HERMES_RXSTAT_ERR		((uint16_t)0x0003)
-#define		HERMES_RXSTAT_MACPORT		((uint16_t)0x0700)
-#define		HERMES_RXSTAT_MSGTYPE		((uint16_t)0xE000)
+#define		HERMES_RXSTAT_ERR		(0x0003)
+#define		HERMES_RXSTAT_MACPORT		(0x0700)
+#define		HERMES_RXSTAT_MSGTYPE		(0xE000)
 
-#define		HERMES_RXSTAT_BADCRC		((uint16_t)0x0001)
-#define		HERMES_RXSTAT_UNDECRYPTABLE	((uint16_t)0x0002)
+#define		HERMES_RXSTAT_BADCRC		(0x0001)
+#define		HERMES_RXSTAT_UNDECRYPTABLE	(0x0002)
 
 /* RFC-1042 encoded frame */
-#define		HERMES_RXSTAT_1042		((uint16_t)0x2000)
+#define		HERMES_RXSTAT_1042		(0x2000)
 /* Bridge-tunnel encoded frame */
-#define		HERMES_RXSTAT_TUNNEL		((uint16_t)0x4000)
+#define		HERMES_RXSTAT_TUNNEL		(0x4000)
 /* Wavelan-II Management Protocol frame */
-#define		HERMES_RXSTAT_WMP		((uint16_t)0x6000)
+#define		HERMES_RXSTAT_WMP		(0x6000)
 
 #ifdef __KERNEL__
 
@@ -331,8 +334,6 @@ static inline int hermes_disable_port(he
 	(hermes_read_ltv((hw),(bap),(rid), sizeof(*buf), NULL, (buf)))
 #define HERMES_WRITE_RECORD(hw, bap, rid, buf) \
 	(hermes_write_ltv((hw),(bap),(rid),HERMES_BYTES_TO_RECLEN(sizeof(*buf)),(buf)))
-#define HERMES_WRITE_RECORD_LEN(hw, bap, rid, buf, len) \
-	(hermes_write_ltv((hw),(bap),(rid),HERMES_BYTES_TO_RECLEN(len),(buf)))
 
 static inline int hermes_read_wordrec(hermes_t *hw, int bap, uint16_t rid, uint16_t *word)
 {
diff -u -p linux/drivers/net/pcmcia/wireless.25b/hermes.c linux/drivers/net/pcmcia/hermes.c
--- linux/drivers/net/pcmcia/wireless.25b/hermes.c	Tue Apr 24 15:57:48 2001
+++ linux/drivers/net/pcmcia/hermes.c	Tue Apr 24 16:00:24 2001
@@ -21,6 +21,7 @@ static const char *version = "hermes.c: 
 
 #include <linux/module.h>
 #include <linux/types.h>
+#include <linux/threads.h>
 #include <linux/smp.h>
 #include <asm/io.h>
 #include <linux/ptrace.h>
diff -u -p linux/drivers/net/pcmcia/wireless.25b/orinoco_cs.c linux/drivers/net/pcmcia/orinoco_cs.c
--- linux/drivers/net/pcmcia/wireless.25b/orinoco_cs.c	Tue Apr 24 15:57:48 2001
+++ linux/drivers/net/pcmcia/orinoco_cs.c	Tue Apr 24 17:47:26 2001
@@ -1,4 +1,4 @@
-/* orinoco_cs.c 0.03	- (formerly known as dldwd_cs.c)
+/* orinoco_cs.c 0.04	- (formerly known as dldwd_cs.c)
  *
  * A driver for "Hermes" chipset based PCMCIA wireless adaptors, such
  * as the Lucent WavelanIEEE/Orinoco cards and their OEM (Cabletron/
@@ -97,6 +97,28 @@
  *	o Finish external renaming to orinoco...
  *	o Testing with various Wavelan firmwares
  *
+ * v0.03 -> v0.04 - 30/3/2001 - Jean II
+ *	o Update to Wireless 11 -> add retry limit/lifetime support
+ *	o Tested with a D-Link DWL 650 card, fill in firmware support
+ *	o Warning on Vcc mismatch (D-Link 3.3v card in Lucent 5v only slot)
+ *	o Fixed the Prims2 WEP bugs that I introduced in v0.03 :-(
+ *	  It work on D-Link *only* after a tcpdump. Weird...
+ *	  And still doesn't work on Intel card. Grrrr...
+ *	o Update the mode after a setport3
+ *	o Add preamble setting for Symbol cards (not yet enabled)
+ *	o Don't complain as much about Symbol cards...
+ *
+ * v0.04 -> v0.04b - 22/4/2001 - David Gibson
+ *      o Removed the 'eth' parameter - always use ethXX as the
+ *        interface name instead of dldwdXX.  The other was racy
+ *        anyway.
+ *	o Clean up RID definitions in hermes.h, other cleanups
+ *
+ * v0.04b -> v0.04c - 24/4/2001 - Jean II
+ *	o Tim Hurley <timster@seiki.bliztech.com> reported a D-Link card
+ *	  with vendor 02 and firmware 0.08. Added in the capabilities...
+ *	o Tested Lucent firmware 7.28, everything works...
+ *
  * TODO - Jean II
  *	o inline functions (lot's of candidate, need to reorder code)
  *	o Separate Pcmcia specific code to help Airport/Mini PCI driver
@@ -133,7 +155,7 @@
 
 #ifdef PCMCIA_DEBUG
 static int pc_debug = PCMCIA_DEBUG;
-static char *version = "orinoco_cs.c 0.03 (David Gibson <hermes@gibson.dropbear.id.au>)";
+static char *version = "orinoco_cs.c 0.04 (David Gibson <hermes@gibson.dropbear.id.au>)";
 MODULE_PARM(pc_debug, "i");
 #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
 #define DEBUGMORE(n, args...) do { if (pc_debug>(n)) printk(args); } while (0)
@@ -165,12 +187,12 @@ MODULE_PARM(pc_debug, "i");
 static uint irq_mask = 0xdeb8;
 /* Newer, simpler way of listing specific interrupts */
 static int irq_list[4] = { -1 };
-/* Control device name allocation. 0 -> dldwdX ; 1 -> ethX */
-static int eth = 1;
+/* Do a Pcmcia soft reset (may help some cards) */
+static int reset_cor = 0;
 
 MODULE_PARM(irq_mask, "i");
 MODULE_PARM(irq_list, "1-4i");
-MODULE_PARM(eth, "i");
+MODULE_PARM(reset_cor, "i");
 
 /*====================================================================*/
 
@@ -240,13 +262,14 @@ typedef struct dldwd_priv {
 	int has_mwo;
 	int has_pm;
 	int has_retry;
+	int has_preamble;
 	int broken_reset, broken_allocate;
 	uint16_t channel_mask;
 
 	/* Current configuration */
 	uint32_t iw_mode;
 	int port_type, allow_ibss;
-	uint16_t wep_on, wep_auth, tx_key;
+	uint16_t wep_on, wep_restrict, tx_key;
 	dldwd_keys_t keys;
  	char nick[IW_ESSID_MAX_SIZE+1];
 	char desired_essid[IW_ESSID_MAX_SIZE+1];
@@ -256,6 +279,7 @@ typedef struct dldwd_priv {
 	uint16_t tx_rate_ctrl;
 	uint16_t pm_on, pm_mcast, pm_period, pm_timeout;
 	uint16_t retry_short, retry_long, retry_time;
+	uint16_t preamble;
 
 	int promiscuous, allmulti, mc_count;
 
@@ -665,6 +689,16 @@ ESSID in IBSS-Ad-Hoc mode.\n", dev->name
 			goto out;
 	}
 
+	/* Set preamble - only for Symbol so far... */
+	if (priv->has_preamble) {
+		err = hermes_write_wordrec(hw, USER_BAP, HERMES_RID_CNF_SYMBOL_PREAMBLE,
+					   priv->preamble);
+		if (err) {
+			printk(KERN_WARNING "%s: Can't set preamble!\n", dev->name);
+			goto out;
+		}
+	}
+
 	/* Set promiscuity / multicast*/
 	priv->promiscuous = 0;
 	priv->allmulti = 0;
@@ -692,7 +726,8 @@ static int __dldwd_hw_setup_wep(dldwd_pr
 {
 	hermes_t *hw = &priv->hw;
 	int err = 0;
-	
+	int	extra_wep_flag = 0;
+
 	switch (priv->firmware_type) {
 	case FIRMWARE_TYPE_LUCENT: /* Lucent style WEP */
 		if (priv->wep_on) {
@@ -716,33 +751,53 @@ static int __dldwd_hw_setup_wep(dldwd_pr
 			int keylen;
 			int i;
 			
-			err = hermes_write_wordrec(hw, USER_BAP, HERMES_RID_CNF_PRISM2_TX_KEY,
-						   priv->tx_key);
-			if (err)
-				return err;
-			
-			keybuf[LARGE_KEY_SIZE] = '\0';
-
 			/* Write all 4 keys */
 			for(i = 0; i < MAX_KEYS; i++) {
 				keylen = priv->keys[i].len;
-				keybuf[SMALL_KEY_SIZE] = '\0';
+				keybuf[keylen] = '\0';
 				memcpy(keybuf, priv->keys[i].data, keylen);
-				err = HERMES_WRITE_RECORD_LEN(hw, USER_BAP, HERMES_RID_CNF_PRISM2_KEY0, &keybuf, keylen);
+				err = hermes_write_ltv(hw, USER_BAP,
+						       HERMES_RID_CNF_PRISM2_KEY0 + i,
+						       HERMES_BYTES_TO_RECLEN(keylen + 1),
+						       &keybuf);
 				if (err)
 					return err;
 			}
-			/* Symbol cards : set the authentication :
-			 * 0 -> no encryption, 1 -> open,
-			 * 2 -> shared key, 3 -> shared key 128bit only */
+
+			err = hermes_write_wordrec(hw, USER_BAP, HERMES_RID_CNF_PRISM2_TX_KEY,
+						   priv->tx_key);
+			if (err)
+				return err;
+
+			/* Authentication is where Prism2 and Symbol
+			 * firmware differ... */
 			if (priv->firmware_type == FIRMWARE_TYPE_SYMBOL) {
-				err = hermes_write_wordrec(hw, USER_BAP, HERMES_RID_CNF_SYMBOL_AUTH_TYPE, priv->wep_auth);
+				/* Symbol cards : set the authentication :
+				 * 0 -> no encryption, 1 -> open,
+				 * 2 -> shared key, 3 -> shared key 128bit */
+				if(priv->wep_restrict) {
+					if(priv->keys[priv->tx_key].len >
+					   SMALL_KEY_SIZE)
+						extra_wep_flag = 3;
+					else
+						extra_wep_flag = 2;
+				} else
+					extra_wep_flag = 1;
+				err = hermes_write_wordrec(hw, USER_BAP, HERMES_RID_CNF_SYMBOL_AUTH_TYPE, priv->wep_restrict);
 				if (err)
 					return err;
+			} else {
+				/* Prism2 card : we need to modify master
+				 * WEP setting */
+				if(priv->wep_restrict)
+					extra_wep_flag = 2;
+				else
+					extra_wep_flag = 0;
 			}
 		}
 		
-		err = hermes_write_wordrec(hw, USER_BAP, HERMES_RID_CNF_PRISM2_WEP_ON, priv->wep_on);
+		/* Master WEP setting : on/off */
+		err = hermes_write_wordrec(hw, USER_BAP, HERMES_RID_CNF_PRISM2_WEP_ON, (priv->wep_on | extra_wep_flag));
 		if (err)
 			return err;	
 		break;
@@ -1266,6 +1321,7 @@ static int dldwd_init(struct net_device 
 	}
 
 	firmver = ((uint32_t)priv->firmware_info.major << 16) | priv->firmware_info.minor;
+	DEBUG(2, "%s: firmver = 0x%X\n", dev->name, firmver);
 
 	/* Determine capabilities from the firmware version */
 
@@ -1279,7 +1335,7 @@ static int dldwd_init(struct net_device 
 		priv->firmware_type = FIRMWARE_TYPE_LUCENT;
 		priv->broken_reset = 0;
 		priv->broken_allocate = 0;
-		priv->has_port3 = 1;
+		priv->has_port3 = 1;		/* Still works in 7.28 */
 		priv->has_ibss = (firmver >= 0x60006);
 		priv->has_ibss_any = (firmver >= 0x60010);
 		priv->has_wep = (firmver >= 0x40020);
@@ -1288,27 +1344,51 @@ static int dldwd_init(struct net_device 
 		priv->has_mwo = (firmver >= 0x60000);
 		priv->has_pm = (firmver >= 0x40020);
 		priv->has_retry = 0;
+		priv->has_preamble = 0;
 		/* Tested with Lucent firmware :
-		 *	1.16 ; 4.08 ; 4.52 ; 6.04 ; 6.16 => Jean II
+		 *	1.16 ; 4.08 ; 4.52 ; 6.04 ; 6.16 ; 7.28 => Jean II
 		 * Tested CableTron firmware : 4.32 => Anton */
 		break;
 	case 0x2:
 		vendor_str = "Generic Prism II";
-		/* Note : my Intel card report this value, but I can't do
-		 * much with it, so I guess it's broken - Jean II */
+		/* Some D-Link cards report vendor 0x02... */
 
 		priv->firmware_type = FIRMWARE_TYPE_PRISM2;
 		priv->broken_reset = 0;
-		priv->broken_allocate = (firmver <= 0x10001);
+		priv->broken_allocate = 0;
 		priv->has_port3 = 1;
-		priv->has_ibss = 0; /* FIXME: no idea if this is right */
-		priv->has_wep = (firmver >= 0x20000);
-		priv->has_big_wep = 1;
+		priv->has_ibss = (firmver >= 0x00007); /* FIXME */
+		priv->has_wep = (firmver >= 0x00007); /* FIXME */
+		priv->has_big_wep = 0;
 		priv->has_mwo = 0;
-		priv->has_pm = (firmver >= 0x20000);
+		priv->has_pm = (firmver >= 0x00007); /* FIXME */
 		priv->has_retry = 0;
-		/* Tested with Intel firmware : 1.01 => Jean II */
-		/* Note : firmware 1.01 is *seriously* broken */
+		priv->has_preamble = 0;
+
+		/* Tim Hurley -> D-Link card, vendor 02, firmware 0.08 */
+
+		/* Special case for Symbol cards */
+		if(firmver == 0x10001) {
+			/* Symbol , 3Com AirConnect, Intel, Ericsson WLAN */
+			vendor_str = "Symbol";
+			/* Intel MAC : 00:02:B3:* */
+			/* 3Com MAC : 00:50:DA:* */
+
+			/* FIXME : probably need to use SYMBOL_***ARY_VER
+			 * to get proper firmware version */
+			priv->firmware_type = FIRMWARE_TYPE_SYMBOL;
+			priv->broken_reset = 0;
+			priv->broken_allocate = 1;
+			priv->has_port3 = 1;
+			priv->has_ibss = 1; /* FIXME */
+			priv->has_wep = 1; /* FIXME */
+			priv->has_big_wep = 1;	/* RID_SYMBOL_KEY_LENGTH */
+			priv->has_mwo = 0;
+			priv->has_pm = 1; /* FIXME */
+			priv->has_retry = 0;
+			priv->has_preamble = 0; /* FIXME */
+			/* Tested with Intel firmware : v15 => Jean II */
+		}
 		break;
 	case 0x3:
 		vendor_str = "Samsung";
@@ -1324,39 +1404,27 @@ static int dldwd_init(struct net_device 
 		priv->has_mwo = 0;
 		priv->has_pm = (firmver >= 0x20000); /* FIXME */
 		priv->has_retry = 0;
+		priv->has_preamble = 0;
 		break;
 	case 0x6:
+		/* D-Link DWL 650, ... */
 		vendor_str = "LinkSys/D-Link";
-		/* To check */
+		/* D-Link MAC : 00:40:05:* */
 
 		priv->firmware_type = FIRMWARE_TYPE_PRISM2;
 		priv->broken_reset = 0;
 		priv->broken_allocate = 0;
 		priv->has_port3 = 1;
-		priv->has_ibss = 0; /* FIXME: available in later firmwares */
-		priv->has_wep = (firmver >= 0x20000); /* FIXME */
+		priv->has_ibss = (firmver >= 0x00007); /* FIXME */
+		priv->has_wep = (firmver >= 0x00007); /* FIXME */
 		priv->has_big_wep = 0;
 		priv->has_mwo = 0;
-		priv->has_pm = (firmver >= 0x20000); /* FIXME */
+		priv->has_pm = (firmver >= 0x00007); /* FIXME */
 		priv->has_retry = 0;
+		priv->has_preamble = 0;
+		/* Tested with D-Link firmware 0.07 => Jean II */
+		/* Note : with 0.07, IBSS to a Lucent card seem flaky */
 		break;
-#if 0
-	case 0x???:		/* Could someone help here ??? */
-		vendor_str = "Symbol";
-		/* Symbol , 3Com AirConnect, Ericsson WLAN */
-
-		priv->firmware_type = FIRMWARE_TYPE_SYMBOL;
-		priv->broken_reset = 0;
-		priv->broken_allocate = 0;
-		priv->has_port3 = 1;
-		priv->has_ibss = 0; /* FIXME: available in later firmwares */
-		priv->has_wep = (firmver >= 0x20000); /* FIXME */
-		priv->has_big_wep = 1;	/* Probably RID_SYMBOL_KEY_LENGTH */
-		priv->has_mwo = 0;
-		priv->has_pm = (firmver >= 0x20000);
-		priv->has_retry = 0;
-		break;
-#endif
 	default:
 		vendor_str = "UNKNOWN";
 
@@ -1370,14 +1438,13 @@ static int dldwd_init(struct net_device 
 		priv->has_mwo = 0;
 		priv->has_pm = 0;
 		priv->has_retry = 0;
+		priv->has_preamble = 0;
 	}
 
 	printk(KERN_INFO "%s: Firmware ID %02X vendor 0x%x (%s) version %d.%02d\n",
 	       dev->name, priv->firmware_info.id, priv->firmware_info.vendor,
 	       vendor_str, priv->firmware_info.major, priv->firmware_info.minor);
 	
-	if ((priv->broken_reset) || (priv->broken_allocate))
-		printk(KERN_INFO "%s: Buggy firmware, please upgrade ASAP.\n", dev->name);
 	if (priv->has_port3)
 		printk(KERN_INFO "%s: Ad-hoc demo mode supported.\n", dev->name);
 	if (priv->has_ibss)
@@ -1388,7 +1455,7 @@ static int dldwd_init(struct net_device 
 		if (priv->has_big_wep)
 			printk("\"128\"-bit key.\n");
 		else
-			printk("40-bit key.");
+			printk("40-bit key.\n");
 	}
 
 	/* Get the MAC address */
@@ -1478,7 +1545,7 @@ static int dldwd_init(struct net_device 
 			goto out;
 		}
 	}
-		
+
 	/* Retry setup */
 	if (priv->has_retry) {
 		err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_SHORT_RETRY_LIMIT, &priv->retry_short);
@@ -1494,6 +1561,13 @@ static int dldwd_init(struct net_device 
 			goto out;
 	}
 		
+	/* Preamble setup */
+	if (priv->has_preamble) {
+		err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CNF_SYMBOL_PREAMBLE, &priv->preamble);
+		if (err)
+			goto out;
+	}
+		
 	/* Set up the default configuration */
 	priv->iw_mode = IW_MODE_INFRA;
 	/* By default use IEEE/IBSS ad-hoc mode if we have it */
@@ -1951,7 +2025,7 @@ static int dldwd_ioctl_setiwencode(struc
 	int index = (erq->flags & IW_ENCODE_INDEX) - 1;
 	int setindex = priv->tx_key;
 	int enable = priv->wep_on;
-	int auth = priv->wep_auth;
+	int restricted = priv->wep_restrict;
 	uint16_t xlen = 0;
 	int err = 0;
 	char keybuf[MAX_KEY_SIZE];
@@ -2013,16 +2087,11 @@ static int dldwd_ioctl_setiwencode(struc
 	
 	if (erq->flags & IW_ENCODE_DISABLED)
 		enable = 0;
-	/* Only for symbol cards (so far) - Jean II */
+	/* Only for Prism2 & Symbol cards (so far) - Jean II */
 	if (erq->flags & IW_ENCODE_OPEN)
-		auth = 1;
+		restricted = 0;
 	if (erq->flags & IW_ENCODE_RESTRICTED)
-		auth = 2;	/* If all key are 128 -> should be 3 ??? */
-	/* Agree with master wep setting */
-	if (enable == 0)
-		auth = 0;
-	else if(auth == 0)
-		auth = 1;	/* Encryption require some authentication */
+		restricted = 1;
 
 	if (erq->pointer) {
 		priv->keys[index].len = cpu_to_le16(xlen);
@@ -2031,7 +2100,7 @@ static int dldwd_ioctl_setiwencode(struc
 	}
 	priv->tx_key = setindex;
 	priv->wep_on = enable;
-	priv->wep_auth = auth;
+	priv->wep_restrict = restricted;
 	
  out:
 	dldwd_unlock(priv);
@@ -2058,19 +2127,11 @@ static int dldwd_ioctl_getiwencode(struc
 	erq->flags |= index + 1;
 	
 	/* Only for symbol cards - Jean II */
-	if (priv->firmware_type == FIRMWARE_TYPE_SYMBOL) {
-		switch(priv->wep_auth)	{
-		case 1:
-			erq->flags |= IW_ENCODE_OPEN;
-			break;
-		case 2:
-		case 3:
+	if (priv->firmware_type != FIRMWARE_TYPE_LUCENT) {
+		if(priv->wep_restrict)
 			erq->flags |= IW_ENCODE_RESTRICTED;
-			break;
-		case 0:
-		default:
-			break;
-		}
+		else
+			erq->flags |= IW_ENCODE_OPEN;
 	}
 
 	xlen = le16_to_cpu(priv->keys[index].len);
@@ -2691,6 +2752,10 @@ static int dldwd_ioctl_setport3(struct n
 		err = -EINVAL;
 	}
 
+	if (! err)
+		/* Actually update the mode we are using */
+		set_port_type(priv);
+
 	dldwd_unlock(priv);
 
 	return err;
@@ -3036,7 +3101,13 @@ static int dldwd_ioctl(struct net_device
 				  0, "set_port3" },
 				{ SIOCDEVPRIVATE + 0x3, 0,
 				  IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
-				  "get_port3" }
+				  "get_port3" },
+				{ SIOCDEVPRIVATE + 0x4,
+				  IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+				  0, "set_preamble" },
+				{ SIOCDEVPRIVATE + 0x5, 0,
+				  IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+				  "get_preamble" }
 			};
 
 			err = verify_area(VERIFY_WRITE, wrq->u.data.pointer, sizeof(privtab));
@@ -3080,6 +3151,46 @@ static int dldwd_ioctl(struct net_device
 		err = dldwd_ioctl_getport3(dev, wrq);
 		break;
 
+	case SIOCDEVPRIVATE + 0x4: /* set_preamble */
+		DEBUG(1, "%s: SIOCDEVPRIVATE + 0x4 (set_preamble)\n",
+		      dev->name);
+		if (! capable(CAP_NET_ADMIN)) {
+			err = -EPERM;
+			break;
+		}
+
+		/* 802.11b has recently defined some short preamble.
+		 * Basically, the Phy header has been reduced in size.
+		 * This increase performance, especially at high rates
+		 * (the preamble is transmitted at 1Mb/s), unfortunately
+		 * this give compatibility troubles... - Jean II */
+		if(priv->has_preamble) {
+			int val = *( (int *) wrq->u.name );
+
+			dldwd_lock(priv);
+			if(val)
+				priv->preamble = 1;
+			else
+				priv->preamble = 0;
+			dldwd_unlock(priv);
+			changed = 1;
+		} else
+			err = -EOPNOTSUPP;
+		break;
+
+	case SIOCDEVPRIVATE + 0x5: /* get_preamble */
+		DEBUG(1, "%s: SIOCDEVPRIVATE + 0x5 (get_preamble)\n",
+		      dev->name);
+		if(priv->has_preamble) {
+			int *val = (int *)wrq->u.name;
+
+			dldwd_lock(priv);
+			*val = priv->preamble;
+			dldwd_unlock(priv);
+		} else
+			err = -EOPNOTSUPP;
+		break;
+
 	default:
 		err = -EOPNOTSUPP;
 	}
@@ -3756,6 +3867,44 @@ static void dldwd_detach(dev_link_t * li
 	TRACE_EXIT("dldwd");
 }				/* dldwd_detach */
 
+/*
+ * Do a soft reset of the Pcmcia card using the Configuration Option Register
+ * Can't do any harm, and actually may do some good on some cards...
+ */
+static int dldwd_cor_reset(dev_link_t *link)
+{
+	conf_reg_t reg;
+	u_long default_cor; 
+
+	/* Save original COR value */
+	reg.Function = 0;
+	reg.Action = CS_READ;
+	reg.Offset = CISREG_COR;
+	reg.Value = 0;
+	CardServices(AccessConfigurationRegister, link->handle, &reg);
+	default_cor = reg.Value;
+
+	DEBUG(2, "dldwd : dldwd_cor_reset() : cor=0x%lX\n", default_cor);
+
+	/* Soft-Reset card */
+	reg.Action = CS_WRITE;
+	reg.Offset = CISREG_COR;
+	reg.Value = (default_cor | COR_SOFT_RESET);
+	CardServices(AccessConfigurationRegister, link->handle, &reg);
+
+	/* Wait until the card has acknowledged our reset */
+	mdelay(1);
+
+	/* Restore original COR configuration index */
+	reg.Value = (default_cor & COR_CONFIG_MASK);
+	CardServices(AccessConfigurationRegister, link->handle, &reg);
+
+	/* Wait until the card has finished restarting */
+	mdelay(1);
+
+	return(0);
+}
+
 /*======================================================================
   dldwd_config() is scheduled to run after a CARD_INSERTION event
   is received, to configure the PCMCIA socket, and to make the
@@ -3779,6 +3928,7 @@ static void dldwd_config(dev_link_t * li
 	int last_fn, last_ret;
 	u_char buf[64];
 	config_info_t conf;
+	cistpl_cftable_entry_t dflt = { 0 };
 	cisinfo_t info;
 
 	TRACE_ENTER("dldwd");
@@ -3825,7 +3975,6 @@ static void dldwd_config(dev_link_t * li
 	tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
 	CS_CHECK(GetFirstTuple, handle, &tuple);
 	while (1) {
-		cistpl_cftable_entry_t dflt = { 0 };
 		cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
 		CFG_CHECK(GetTupleData, handle, &tuple);
 		CFG_CHECK(ParseTuple, handle, &tuple, &parse);
@@ -3849,12 +3998,16 @@ static void dldwd_config(dev_link_t * li
 		/*  Note that the CIS values need to be rescaled */
 		if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
 			if (conf.Vcc !=
-			    cfg->vcc.param[CISTPL_POWER_VNOM] /
-			    10000) goto next_entry;
+			    cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) {
+				DEBUG(2, "dldwd_config: Vcc mismatch (conf.Vcc = %d, CIS = %d)\n",  conf.Vcc, cfg->vcc.param[CISTPL_POWER_VNOM] / 10000);
+				goto next_entry;
+			}
 		} else if (dflt.vcc.present & (1 << CISTPL_POWER_VNOM)) {
 			if (conf.Vcc !=
-			    dflt.vcc.param[CISTPL_POWER_VNOM] /
-			    10000) goto next_entry;
+			    dflt.vcc.param[CISTPL_POWER_VNOM] / 10000) {
+				DEBUG(2, "dldwd_config: Vcc mismatch (conf.Vcc = %d, CIS = %d)\n",  conf.Vcc, dflt.vcc.param[CISTPL_POWER_VNOM] / 10000);
+				goto next_entry;
+			}
 		}
 
 		if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
@@ -3945,12 +4098,12 @@ static void dldwd_config(dev_link_t * li
 	ndev->base_addr = link->io.BasePort1;
 	ndev->irq = link->irq.AssignedIRQ;
 
-	/* Instance name : by default, use hermesX, on demand use the
-	 * regular ethX (less risky) - Jean II */
-	if(!eth)
-		sprintf(ndev->name, "hermes%d", priv->instance);
-	else
-		ndev->name[0] = '\0';
+	/* Do a Pcmcia soft reset of the card (optional) */
+	if(reset_cor)
+		dldwd_cor_reset(link);
+
+	/* register_netdev will give us an ethX name */
+	ndev->name[0] = '\0';
 	/* Tell the stack we exist */
 	if (register_netdev(ndev) != 0) {
 		printk(KERN_ERR "orinoco_cs: register_netdev() failed\n");

[-- Attachment #3: orinoco_v4b-alan.diff --]
[-- Type: text/plain, Size: 30805 bytes --]

diff -u -p linux/drivers/net/pcmcia/wireless.25b/hermes.h linux/drivers/net/pcmcia/hermes.h
--- linux/drivers/net/pcmcia/wireless.25b/hermes.h	Tue Apr 24 15:57:48 2001
+++ linux/drivers/net/pcmcia/hermes.h	Tue Apr 24 16:04:34 2001
@@ -35,18 +35,18 @@
 /*
  * Limits and constants
  */
-#define		HERMES_ALLOC_LEN_MIN		((uint16_t)4)
-#define		HERMES_ALLOC_LEN_MAX		((uint16_t)2400)
+#define		HERMES_ALLOC_LEN_MIN		(4)
+#define		HERMES_ALLOC_LEN_MAX		(2400)
 #define		HERMES_LTV_LEN_MAX		(34)
-#define		HERMES_BAP_DATALEN_MAX		((uint16_t)4096)
-#define		HERMES_BAP_OFFSET_MAX		((uint16_t)4096)
-#define		HERMES_PORTID_MAX		((uint16_t)7)
-#define		HERMES_NUMPORTS_MAX		((uint16_t)(HERMES_PORTID_MAX+1))
-#define		HERMES_PDR_LEN_MAX		((uint16_t)260)	/* in bytes, from EK */
-#define		HERMES_PDA_RECS_MAX		((uint16_t)200)	/* a guess */
-#define		HERMES_PDA_LEN_MAX		((uint16_t)1024)	/* in bytes, from EK */
-#define		HERMES_SCANRESULT_MAX		((uint16_t)35)
-#define		HERMES_CHINFORESULT_MAX		((uint16_t)8)
+#define		HERMES_BAP_DATALEN_MAX		(4096)
+#define		HERMES_BAP_OFFSET_MAX		(4096)
+#define		HERMES_PORTID_MAX		(7)
+#define		HERMES_NUMPORTS_MAX		(HERMES_PORTID_MAX+1)
+#define		HERMES_PDR_LEN_MAX		(260)	/* in bytes, from EK */
+#define		HERMES_PDA_RECS_MAX		(200)	/* a guess */
+#define		HERMES_PDA_LEN_MAX		(1024)	/* in bytes, from EK */
+#define		HERMES_SCANRESULT_MAX		(35)
+#define		HERMES_CHINFORESULT_MAX		(8)
 #define		HERMES_FRAME_LEN_MAX		(2304)
 #define		HERMES_MAX_MULTICAST		(16)
 #define		HERMES_MAGIC			(0x7d1f)
@@ -86,122 +86,125 @@
 /*
  * CMD register bitmasks
  */
-#define		HERMES_CMD_BUSY			((uint16_t)0x8000)
-#define		HERMES_CMD_AINFO		((uint16_t)0x7f00)
-#define		HERMES_CMD_MACPORT		((uint16_t)0x0700)
-#define		HERMES_CMD_RECL			((uint16_t)0x0100)
-#define		HERMES_CMD_WRITE		((uint16_t)0x0100)
-#define		HERMES_CMD_PROGMODE		((uint16_t)0x0300)
-#define		HERMES_CMD_CMDCODE		((uint16_t)0x003f)
+#define		HERMES_CMD_BUSY			(0x8000)
+#define		HERMES_CMD_AINFO		(0x7f00)
+#define		HERMES_CMD_MACPORT		(0x0700)
+#define		HERMES_CMD_RECL			(0x0100)
+#define		HERMES_CMD_WRITE		(0x0100)
+#define		HERMES_CMD_PROGMODE		(0x0300)
+#define		HERMES_CMD_CMDCODE		(0x003f)
 
 /*
  * STATUS register bitmasks
  */
-#define		HERMES_STATUS_RESULT		((uint16_t)0x7f00)
-#define		HERMES_STATUS_CMDCODE		((uint16_t)0x003f)
+#define		HERMES_STATUS_RESULT		(0x7f00)
+#define		HERMES_STATUS_CMDCODE		(0x003f)
 
 /*
  * OFFSET refister bitmasks
  */
-#define		HERMES_OFFSET_BUSY		((uint16_t)0x8000)
-#define		HERMES_OFFSET_ERR		((uint16_t)0x4000)
-#define		HERMES_OFFSET_DATAOFF		((uint16_t)0x0ffe)
+#define		HERMES_OFFSET_BUSY		(0x8000)
+#define		HERMES_OFFSET_ERR		(0x4000)
+#define		HERMES_OFFSET_DATAOFF		(0x0ffe)
 
 /*
  * Event register bitmasks (INTEN, EVSTAT, EVACK)
  */
-#define		HERMES_EV_TICK			((uint16_t)0x8000)
-#define		HERMES_EV_WTERR			((uint16_t)0x4000)
-#define		HERMES_EV_INFDROP		((uint16_t)0x2000)
-#define		HERMES_EV_INFO			((uint16_t)0x0080)
-#define		HERMES_EV_DTIM			((uint16_t)0x0020)
-#define		HERMES_EV_CMD			((uint16_t)0x0010)
-#define		HERMES_EV_ALLOC			((uint16_t)0x0008)
-#define		HERMES_EV_TXEXC			((uint16_t)0x0004)
-#define		HERMES_EV_TX			((uint16_t)0x0002)
-#define		HERMES_EV_RX			((uint16_t)0x0001)
+#define		HERMES_EV_TICK			(0x8000)
+#define		HERMES_EV_WTERR			(0x4000)
+#define		HERMES_EV_INFDROP		(0x2000)
+#define		HERMES_EV_INFO			(0x0080)
+#define		HERMES_EV_DTIM			(0x0020)
+#define		HERMES_EV_CMD			(0x0010)
+#define		HERMES_EV_ALLOC			(0x0008)
+#define		HERMES_EV_TXEXC			(0x0004)
+#define		HERMES_EV_TX			(0x0002)
+#define		HERMES_EV_RX			(0x0001)
 
 /*
  * Command codes
  */
 /*--- Controller Commands --------------------------*/
-#define		HERMES_CMD_INIT			((uint16_t)0x00)
-#define		HERMES_CMD_ENABLE		((uint16_t)0x01)
-#define		HERMES_CMD_DISABLE		((uint16_t)0x02)
-#define		HERMES_CMD_DIAG			((uint16_t)0x03)
+#define		HERMES_CMD_INIT			(0x0000)
+#define		HERMES_CMD_ENABLE		(0x0001)
+#define		HERMES_CMD_DISABLE		(0x0002)
+#define		HERMES_CMD_DIAG			(0x0003)
 
 /*--- Buffer Mgmt Commands --------------------------*/
-#define		HERMES_CMD_ALLOC		((uint16_t)0x0A)
-#define		HERMES_CMD_TX			((uint16_t)0x0B)
-#define		HERMES_CMD_CLRPRST		((uint16_t)0x12)
+#define		HERMES_CMD_ALLOC		(0x000A)
+#define		HERMES_CMD_TX			(0x000B)
+#define		HERMES_CMD_CLRPRST		(0x0012)
 
 /*--- Regulate Commands --------------------------*/
-#define		HERMES_CMD_NOTIFY		((uint16_t)0x10)
-#define		HERMES_CMD_INQ			((uint16_t)0x11)
+#define		HERMES_CMD_NOTIFY		(0x0010)
+#define		HERMES_CMD_INQ			(0x0011)
 
 /*--- Configure Commands --------------------------*/
-#define		HERMES_CMD_ACCESS		((uint16_t)0x21)
-#define		HERMES_CMD_DOWNLD		((uint16_t)0x22)
+#define		HERMES_CMD_ACCESS		(0x0021)
+#define		HERMES_CMD_DOWNLD		(0x0022)
 
 /*--- Debugging Commands -----------------------------*/
-#define 	HERMES_CMD_MONITOR		((uint16_t)(0x38))
-#define		HERMES_MONITOR_ENABLE		((uint16_t)(0x0b))
-#define		HERMES_MONITOR_DISABLE		((uint16_t)(0x0f))
+#define 	HERMES_CMD_MONITOR		(0x0038)
+#define		HERMES_MONITOR_ENABLE		(0x000b)
+#define		HERMES_MONITOR_DISABLE		(0x000f)
 
 /*
  * Configuration RIDs
  */
 
-#define		HERMES_RID_CNF_PORTTYPE		((uint16_t)0xfc00)
-#define		HERMES_RID_CNF_MACADDR		((uint16_t)0xfc01)
-#define		HERMES_RID_CNF_DESIRED_SSID	((uint16_t)0xfc02)
-#define		HERMES_RID_CNF_CHANNEL		((uint16_t)0xfc03)
-#define		HERMES_RID_CNF_OWN_SSID		((uint16_t)0xfc04)
-#define		HERMES_RID_CNF_SYSTEM_SCALE	((uint16_t)0xfc06)
-#define		HERMES_RID_CNF_MAX_DATA_LEN	((uint16_t)0xfc07)
-#define		HERMES_RID_CNF_PM_ENABLE	((uint16_t)0xfc09)
-#define		HERMES_RID_CNF_PM_MCAST_RX	((uint16_t)0xfc0b)
-#define		HERMES_RID_CNF_PM_PERIOD	((uint16_t)0xfc0c)
-#define		HERMES_RID_CNF_PM_HOLDOVER	((uint16_t)0xfc0d)
-#define		HERMES_RID_CNF_NICKNAME		((uint16_t)0xfc0e)
-#define		HERMES_RID_CNF_WEP_ON		((uint16_t)0xfc20)
-#define		HERMES_RID_CNF_MWO_ROBUST	((uint16_t)0xfc25)
-#define		HERMES_RID_CNF_PRISM2_WEP_ON	((uint16_t)0xfc28)
-#define		HERMES_RID_CNF_MULTICAST_LIST	((uint16_t)0xfc80)
-#define		HERMES_RID_CNF_CREATEIBSS	((uint16_t)0xfc81)
-#define		HERMES_RID_CNF_FRAG_THRESH	((uint16_t)0xfc82)
-#define		HERMES_RID_CNF_RTS_THRESH	((uint16_t)0xfc83)
-#define		HERMES_RID_CNF_TX_RATE_CTRL	((uint16_t)0xfc84)
-#define		HERMES_RID_CNF_PROMISCUOUS	((uint16_t)0xfc85)
-#define		HERMES_RID_CNF_KEYS		((uint16_t)0xfcb0)
-#define		HERMES_RID_CNF_TX_KEY		((uint16_t)0xfcb1)
-#define		HERMES_RID_CNF_TICKTIME		((uint16_t)0xfce0)
-
-#define		HERMES_RID_CNF_PRISM2_TX_KEY	((uint16_t)0xfc23)
-#define		HERMES_RID_CNF_PRISM2_KEY0	((uint16_t)0xfc24)
-#define		HERMES_RID_CNF_PRISM2_KEY1	((uint16_t)0xfc25)
-#define		HERMES_RID_CNF_PRISM2_KEY2	((uint16_t)0xfc26)
-#define		HERMES_RID_CNF_PRISM2_KEY3	((uint16_t)0xfc27)
-#define		HERMES_RID_CNF_SYMBOL_AUTH_TYPE		((uint16_t)0xfc2A)
-/* This one is read only */
-#define		HERMES_RID_CNF_SYMBOL_KEY_LENGTH	((uint16_t)0xfc2B)
-#define		HERMES_RID_CNF_SYMBOL_BASIC_RATES	((uint16_t)0xfc8A)
+#define		HERMES_RID_CNF_PORTTYPE		(0xfc00)
+#define		HERMES_RID_CNF_MACADDR		(0xfc01)
+#define		HERMES_RID_CNF_DESIRED_SSID	(0xfc02)
+#define		HERMES_RID_CNF_CHANNEL		(0xfc03)
+#define		HERMES_RID_CNF_OWN_SSID		(0xfc04)
+#define		HERMES_RID_CNF_SYSTEM_SCALE	(0xfc06)
+#define		HERMES_RID_CNF_MAX_DATA_LEN	(0xfc07)
+#define		HERMES_RID_CNF_PM_ENABLE	(0xfc09)
+#define		HERMES_RID_CNF_PM_MCAST_RX	(0xfc0b)
+#define		HERMES_RID_CNF_PM_PERIOD	(0xfc0c)
+#define		HERMES_RID_CNF_PM_HOLDOVER	(0xfc0d)
+#define		HERMES_RID_CNF_NICKNAME		(0xfc0e)
+#define		HERMES_RID_CNF_WEP_ON		(0xfc20)
+#define		HERMES_RID_CNF_MWO_ROBUST	(0xfc25)
+#define		HERMES_RID_CNF_PRISM2_WEP_ON	(0xfc28)
+#define		HERMES_RID_CNF_MULTICAST_LIST	(0xfc80)
+#define		HERMES_RID_CNF_CREATEIBSS	(0xfc81)
+#define		HERMES_RID_CNF_FRAG_THRESH	(0xfc82)
+#define		HERMES_RID_CNF_RTS_THRESH	(0xfc83)
+#define		HERMES_RID_CNF_TX_RATE_CTRL	(0xfc84)
+#define		HERMES_RID_CNF_PROMISCUOUS	(0xfc85)
+#define		HERMES_RID_CNF_KEYS		(0xfcb0)
+#define		HERMES_RID_CNF_TX_KEY		(0xfcb1)
+#define		HERMES_RID_CNF_TICKTIME		(0xfce0)
+
+#define		HERMES_RID_CNF_PRISM2_TX_KEY	(0xfc23)
+#define		HERMES_RID_CNF_PRISM2_KEY0	(0xfc24)
+#define		HERMES_RID_CNF_PRISM2_KEY1	(0xfc25)
+#define		HERMES_RID_CNF_PRISM2_KEY2	(0xfc26)
+#define		HERMES_RID_CNF_PRISM2_KEY3	(0xfc27)
+#define		HERMES_RID_CNF_SYMBOL_MANDATORY_BSSID	(0xfc21)
+#define		HERMES_RID_CNF_SYMBOL_AUTH_TYPE		(0xfc2A)
+#define		HERMES_RID_CNF_SYMBOL_BASIC_RATES	(0xfc8A)
+#define		HERMES_RID_CNF_SYMBOL_PREAMBLE		(0xfc8C)
 
 /*
  * Information RIDs
  */
-#define		HERMES_RID_CHANNEL_LIST		((uint16_t)0xfd10)
-#define		HERMES_RID_STAIDENTITY		((uint16_t)0xfd20)
-#define		HERMES_RID_CURRENT_SSID		((uint16_t)0xfd41)
-#define		HERMES_RID_CURRENT_BSSID	((uint16_t)0xfd42)
-#define		HERMES_RID_COMMSQUALITY		((uint16_t)0xfd43)
-#define 	HERMES_RID_CURRENT_TX_RATE	((uint16_t)0xfd44)
-#define 	HERMES_RID_SHORT_RETRY_LIMIT	((uint16_t)0xfd48)
-#define 	HERMES_RID_LONG_RETRY_LIMIT	((uint16_t)0xfd49)
-#define 	HERMES_RID_MAX_TX_LIFETIME	((uint16_t)0xfd4A)
-#define		HERMES_RID_WEP_AVAIL		((uint16_t)0xfd4f)
-#define		HERMES_RID_CURRENT_CHANNEL	((uint16_t)0xfdc1)
-#define		HERMES_RID_DATARATES		((uint16_t)0xfdc6)
+#define		HERMES_RID_CHANNEL_LIST		(0xfd10)
+#define		HERMES_RID_STAIDENTITY		(0xfd20)
+#define		HERMES_RID_CURRENT_SSID		(0xfd41)
+#define		HERMES_RID_CURRENT_BSSID	(0xfd42)
+#define		HERMES_RID_COMMSQUALITY		(0xfd43)
+#define 	HERMES_RID_CURRENT_TX_RATE	(0xfd44)
+#define 	HERMES_RID_SHORT_RETRY_LIMIT	(0xfd48)
+#define 	HERMES_RID_LONG_RETRY_LIMIT	(0xfd49)
+#define 	HERMES_RID_MAX_TX_LIFETIME	(0xfd4A)
+#define		HERMES_RID_WEP_AVAIL		(0xfd4f)
+#define		HERMES_RID_CURRENT_CHANNEL	(0xfdc1)
+#define		HERMES_RID_DATARATES		(0xfdc6)
+#define		HERMES_RID_SYMBOL_PRIMARY_VER	(0xfd03)
+#define		HERMES_RID_SYMBOL_SECONDARY_VER	(0xfd21)
+#define		HERMES_RID_SYMBOL_KEY_LENGTH	(0xfc2B)
 
 /*
  * Frame structures and constants
@@ -216,19 +219,19 @@ typedef struct hermes_frame_desc {
 	uint16_t tx_ctl; /* 0xC */
 } __attribute__ ((packed)) hermes_frame_desc_t;
 
-#define		HERMES_RXSTAT_ERR		((uint16_t)0x0003)
-#define		HERMES_RXSTAT_MACPORT		((uint16_t)0x0700)
-#define		HERMES_RXSTAT_MSGTYPE		((uint16_t)0xE000)
+#define		HERMES_RXSTAT_ERR		(0x0003)
+#define		HERMES_RXSTAT_MACPORT		(0x0700)
+#define		HERMES_RXSTAT_MSGTYPE		(0xE000)
 
-#define		HERMES_RXSTAT_BADCRC		((uint16_t)0x0001)
-#define		HERMES_RXSTAT_UNDECRYPTABLE	((uint16_t)0x0002)
+#define		HERMES_RXSTAT_BADCRC		(0x0001)
+#define		HERMES_RXSTAT_UNDECRYPTABLE	(0x0002)
 
 /* RFC-1042 encoded frame */
-#define		HERMES_RXSTAT_1042		((uint16_t)0x2000)
+#define		HERMES_RXSTAT_1042		(0x2000)
 /* Bridge-tunnel encoded frame */
-#define		HERMES_RXSTAT_TUNNEL		((uint16_t)0x4000)
+#define		HERMES_RXSTAT_TUNNEL		(0x4000)
 /* Wavelan-II Management Protocol frame */
-#define		HERMES_RXSTAT_WMP		((uint16_t)0x6000)
+#define		HERMES_RXSTAT_WMP		(0x6000)
 
 #ifdef __KERNEL__
 
@@ -331,8 +334,6 @@ static inline int hermes_disable_port(he
 	(hermes_read_ltv((hw),(bap),(rid), sizeof(*buf), NULL, (buf)))
 #define HERMES_WRITE_RECORD(hw, bap, rid, buf) \
 	(hermes_write_ltv((hw),(bap),(rid),HERMES_BYTES_TO_RECLEN(sizeof(*buf)),(buf)))
-#define HERMES_WRITE_RECORD_LEN(hw, bap, rid, buf, len) \
-	(hermes_write_ltv((hw),(bap),(rid),HERMES_BYTES_TO_RECLEN(len),(buf)))
 
 static inline int hermes_read_wordrec(hermes_t *hw, int bap, uint16_t rid, uint16_t *word)
 {
diff -u -p linux/drivers/net/pcmcia/wireless.25b/orinoco_cs.c linux/drivers/net/pcmcia/orinoco_cs.c
--- linux/drivers/net/pcmcia/wireless.25b/orinoco_cs.c	Tue Apr 24 15:57:48 2001
+++ linux/drivers/net/pcmcia/orinoco_cs.c	Tue Apr 24 17:47:26 2001
@@ -1,4 +1,4 @@
-/* orinoco_cs.c 0.03	- (formerly known as dldwd_cs.c)
+/* orinoco_cs.c 0.04	- (formerly known as dldwd_cs.c)
  *
  * A driver for "Hermes" chipset based PCMCIA wireless adaptors, such
  * as the Lucent WavelanIEEE/Orinoco cards and their OEM (Cabletron/
@@ -97,6 +97,28 @@
  *	o Finish external renaming to orinoco...
  *	o Testing with various Wavelan firmwares
  *
+ * v0.03 -> v0.04 - 30/3/2001 - Jean II
+ *	o Update to Wireless 11 -> add retry limit/lifetime support
+ *	o Tested with a D-Link DWL 650 card, fill in firmware support
+ *	o Warning on Vcc mismatch (D-Link 3.3v card in Lucent 5v only slot)
+ *	o Fixed the Prims2 WEP bugs that I introduced in v0.03 :-(
+ *	  It work on D-Link *only* after a tcpdump. Weird...
+ *	  And still doesn't work on Intel card. Grrrr...
+ *	o Update the mode after a setport3
+ *	o Add preamble setting for Symbol cards (not yet enabled)
+ *	o Don't complain as much about Symbol cards...
+ *
+ * v0.04 -> v0.04b - 22/4/2001 - David Gibson
+ *      o Removed the 'eth' parameter - always use ethXX as the
+ *        interface name instead of dldwdXX.  The other was racy
+ *        anyway.
+ *	o Clean up RID definitions in hermes.h, other cleanups
+ *
+ * v0.04b -> v0.04c - 24/4/2001 - Jean II
+ *	o Tim Hurley <timster@seiki.bliztech.com> reported a D-Link card
+ *	  with vendor 02 and firmware 0.08. Added in the capabilities...
+ *	o Tested Lucent firmware 7.28, everything works...
+ *
  * TODO - Jean II
  *	o inline functions (lot's of candidate, need to reorder code)
  *	o Separate Pcmcia specific code to help Airport/Mini PCI driver
@@ -133,7 +155,7 @@
 
 #ifdef PCMCIA_DEBUG
 static int pc_debug = PCMCIA_DEBUG;
-static char *version = "orinoco_cs.c 0.03 (David Gibson <hermes@gibson.dropbear.id.au>)";
+static char *version = "orinoco_cs.c 0.04 (David Gibson <hermes@gibson.dropbear.id.au>)";
 MODULE_PARM(pc_debug, "i");
 #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
 #define DEBUGMORE(n, args...) do { if (pc_debug>(n)) printk(args); } while (0)
@@ -165,12 +187,12 @@ MODULE_PARM(pc_debug, "i");
 static uint irq_mask = 0xdeb8;
 /* Newer, simpler way of listing specific interrupts */
 static int irq_list[4] = { -1 };
-/* Control device name allocation. 0 -> dldwdX ; 1 -> ethX */
-static int eth = 1;
+/* Do a Pcmcia soft reset (may help some cards) */
+static int reset_cor = 0;
 
 MODULE_PARM(irq_mask, "i");
 MODULE_PARM(irq_list, "1-4i");
-MODULE_PARM(eth, "i");
+MODULE_PARM(reset_cor, "i");
 
 /*====================================================================*/
 
@@ -240,13 +262,14 @@ typedef struct dldwd_priv {
 	int has_mwo;
 	int has_pm;
 	int has_retry;
+	int has_preamble;
 	int broken_reset, broken_allocate;
 	uint16_t channel_mask;
 
 	/* Current configuration */
 	uint32_t iw_mode;
 	int port_type, allow_ibss;
-	uint16_t wep_on, wep_auth, tx_key;
+	uint16_t wep_on, wep_restrict, tx_key;
 	dldwd_keys_t keys;
  	char nick[IW_ESSID_MAX_SIZE+1];
 	char desired_essid[IW_ESSID_MAX_SIZE+1];
@@ -256,6 +279,7 @@ typedef struct dldwd_priv {
 	uint16_t tx_rate_ctrl;
 	uint16_t pm_on, pm_mcast, pm_period, pm_timeout;
 	uint16_t retry_short, retry_long, retry_time;
+	uint16_t preamble;
 
 	int promiscuous, allmulti, mc_count;
 
@@ -665,6 +689,16 @@ ESSID in IBSS-Ad-Hoc mode.\n", dev->name
 			goto out;
 	}
 
+	/* Set preamble - only for Symbol so far... */
+	if (priv->has_preamble) {
+		err = hermes_write_wordrec(hw, USER_BAP, HERMES_RID_CNF_SYMBOL_PREAMBLE,
+					   priv->preamble);
+		if (err) {
+			printk(KERN_WARNING "%s: Can't set preamble!\n", dev->name);
+			goto out;
+		}
+	}
+
 	/* Set promiscuity / multicast*/
 	priv->promiscuous = 0;
 	priv->allmulti = 0;
@@ -692,7 +726,8 @@ static int __dldwd_hw_setup_wep(dldwd_pr
 {
 	hermes_t *hw = &priv->hw;
 	int err = 0;
-	
+	int	extra_wep_flag = 0;
+
 	switch (priv->firmware_type) {
 	case FIRMWARE_TYPE_LUCENT: /* Lucent style WEP */
 		if (priv->wep_on) {
@@ -716,33 +751,53 @@ static int __dldwd_hw_setup_wep(dldwd_pr
 			int keylen;
 			int i;
 			
-			err = hermes_write_wordrec(hw, USER_BAP, HERMES_RID_CNF_PRISM2_TX_KEY,
-						   priv->tx_key);
-			if (err)
-				return err;
-			
-			keybuf[LARGE_KEY_SIZE] = '\0';
-
 			/* Write all 4 keys */
 			for(i = 0; i < MAX_KEYS; i++) {
 				keylen = priv->keys[i].len;
-				keybuf[SMALL_KEY_SIZE] = '\0';
+				keybuf[keylen] = '\0';
 				memcpy(keybuf, priv->keys[i].data, keylen);
-				err = HERMES_WRITE_RECORD_LEN(hw, USER_BAP, HERMES_RID_CNF_PRISM2_KEY0, &keybuf, keylen);
+				err = hermes_write_ltv(hw, USER_BAP,
+						       HERMES_RID_CNF_PRISM2_KEY0 + i,
+						       HERMES_BYTES_TO_RECLEN(keylen + 1),
+						       &keybuf);
 				if (err)
 					return err;
 			}
-			/* Symbol cards : set the authentication :
-			 * 0 -> no encryption, 1 -> open,
-			 * 2 -> shared key, 3 -> shared key 128bit only */
+
+			err = hermes_write_wordrec(hw, USER_BAP, HERMES_RID_CNF_PRISM2_TX_KEY,
+						   priv->tx_key);
+			if (err)
+				return err;
+
+			/* Authentication is where Prism2 and Symbol
+			 * firmware differ... */
 			if (priv->firmware_type == FIRMWARE_TYPE_SYMBOL) {
-				err = hermes_write_wordrec(hw, USER_BAP, HERMES_RID_CNF_SYMBOL_AUTH_TYPE, priv->wep_auth);
+				/* Symbol cards : set the authentication :
+				 * 0 -> no encryption, 1 -> open,
+				 * 2 -> shared key, 3 -> shared key 128bit */
+				if(priv->wep_restrict) {
+					if(priv->keys[priv->tx_key].len >
+					   SMALL_KEY_SIZE)
+						extra_wep_flag = 3;
+					else
+						extra_wep_flag = 2;
+				} else
+					extra_wep_flag = 1;
+				err = hermes_write_wordrec(hw, USER_BAP, HERMES_RID_CNF_SYMBOL_AUTH_TYPE, priv->wep_restrict);
 				if (err)
 					return err;
+			} else {
+				/* Prism2 card : we need to modify master
+				 * WEP setting */
+				if(priv->wep_restrict)
+					extra_wep_flag = 2;
+				else
+					extra_wep_flag = 0;
 			}
 		}
 		
-		err = hermes_write_wordrec(hw, USER_BAP, HERMES_RID_CNF_PRISM2_WEP_ON, priv->wep_on);
+		/* Master WEP setting : on/off */
+		err = hermes_write_wordrec(hw, USER_BAP, HERMES_RID_CNF_PRISM2_WEP_ON, (priv->wep_on | extra_wep_flag));
 		if (err)
 			return err;	
 		break;
@@ -1266,6 +1321,7 @@ static int dldwd_init(struct net_device 
 	}
 
 	firmver = ((uint32_t)priv->firmware_info.major << 16) | priv->firmware_info.minor;
+	DEBUG(2, "%s: firmver = 0x%X\n", dev->name, firmver);
 
 	/* Determine capabilities from the firmware version */
 
@@ -1279,7 +1335,7 @@ static int dldwd_init(struct net_device 
 		priv->firmware_type = FIRMWARE_TYPE_LUCENT;
 		priv->broken_reset = 0;
 		priv->broken_allocate = 0;
-		priv->has_port3 = 1;
+		priv->has_port3 = 1;		/* Still works in 7.28 */
 		priv->has_ibss = (firmver >= 0x60006);
 		priv->has_ibss_any = (firmver >= 0x60010);
 		priv->has_wep = (firmver >= 0x40020);
@@ -1288,27 +1344,51 @@ static int dldwd_init(struct net_device 
 		priv->has_mwo = (firmver >= 0x60000);
 		priv->has_pm = (firmver >= 0x40020);
 		priv->has_retry = 0;
+		priv->has_preamble = 0;
 		/* Tested with Lucent firmware :
-		 *	1.16 ; 4.08 ; 4.52 ; 6.04 ; 6.16 => Jean II
+		 *	1.16 ; 4.08 ; 4.52 ; 6.04 ; 6.16 ; 7.28 => Jean II
 		 * Tested CableTron firmware : 4.32 => Anton */
 		break;
 	case 0x2:
 		vendor_str = "Generic Prism II";
-		/* Note : my Intel card report this value, but I can't do
-		 * much with it, so I guess it's broken - Jean II */
+		/* Some D-Link cards report vendor 0x02... */
 
 		priv->firmware_type = FIRMWARE_TYPE_PRISM2;
 		priv->broken_reset = 0;
-		priv->broken_allocate = (firmver <= 0x10001);
+		priv->broken_allocate = 0;
 		priv->has_port3 = 1;
-		priv->has_ibss = 0; /* FIXME: no idea if this is right */
-		priv->has_wep = (firmver >= 0x20000);
-		priv->has_big_wep = 1;
+		priv->has_ibss = (firmver >= 0x00007); /* FIXME */
+		priv->has_wep = (firmver >= 0x00007); /* FIXME */
+		priv->has_big_wep = 0;
 		priv->has_mwo = 0;
-		priv->has_pm = (firmver >= 0x20000);
+		priv->has_pm = (firmver >= 0x00007); /* FIXME */
 		priv->has_retry = 0;
-		/* Tested with Intel firmware : 1.01 => Jean II */
-		/* Note : firmware 1.01 is *seriously* broken */
+		priv->has_preamble = 0;
+
+		/* Tim Hurley -> D-Link card, vendor 02, firmware 0.08 */
+
+		/* Special case for Symbol cards */
+		if(firmver == 0x10001) {
+			/* Symbol , 3Com AirConnect, Intel, Ericsson WLAN */
+			vendor_str = "Symbol";
+			/* Intel MAC : 00:02:B3:* */
+			/* 3Com MAC : 00:50:DA:* */
+
+			/* FIXME : probably need to use SYMBOL_***ARY_VER
+			 * to get proper firmware version */
+			priv->firmware_type = FIRMWARE_TYPE_SYMBOL;
+			priv->broken_reset = 0;
+			priv->broken_allocate = 1;
+			priv->has_port3 = 1;
+			priv->has_ibss = 1; /* FIXME */
+			priv->has_wep = 1; /* FIXME */
+			priv->has_big_wep = 1;	/* RID_SYMBOL_KEY_LENGTH */
+			priv->has_mwo = 0;
+			priv->has_pm = 1; /* FIXME */
+			priv->has_retry = 0;
+			priv->has_preamble = 0; /* FIXME */
+			/* Tested with Intel firmware : v15 => Jean II */
+		}
 		break;
 	case 0x3:
 		vendor_str = "Samsung";
@@ -1324,39 +1404,27 @@ static int dldwd_init(struct net_device 
 		priv->has_mwo = 0;
 		priv->has_pm = (firmver >= 0x20000); /* FIXME */
 		priv->has_retry = 0;
+		priv->has_preamble = 0;
 		break;
 	case 0x6:
+		/* D-Link DWL 650, ... */
 		vendor_str = "LinkSys/D-Link";
-		/* To check */
+		/* D-Link MAC : 00:40:05:* */
 
 		priv->firmware_type = FIRMWARE_TYPE_PRISM2;
 		priv->broken_reset = 0;
 		priv->broken_allocate = 0;
 		priv->has_port3 = 1;
-		priv->has_ibss = 0; /* FIXME: available in later firmwares */
-		priv->has_wep = (firmver >= 0x20000); /* FIXME */
+		priv->has_ibss = (firmver >= 0x00007); /* FIXME */
+		priv->has_wep = (firmver >= 0x00007); /* FIXME */
 		priv->has_big_wep = 0;
 		priv->has_mwo = 0;
-		priv->has_pm = (firmver >= 0x20000); /* FIXME */
+		priv->has_pm = (firmver >= 0x00007); /* FIXME */
 		priv->has_retry = 0;
+		priv->has_preamble = 0;
+		/* Tested with D-Link firmware 0.07 => Jean II */
+		/* Note : with 0.07, IBSS to a Lucent card seem flaky */
 		break;
-#if 0
-	case 0x???:		/* Could someone help here ??? */
-		vendor_str = "Symbol";
-		/* Symbol , 3Com AirConnect, Ericsson WLAN */
-
-		priv->firmware_type = FIRMWARE_TYPE_SYMBOL;
-		priv->broken_reset = 0;
-		priv->broken_allocate = 0;
-		priv->has_port3 = 1;
-		priv->has_ibss = 0; /* FIXME: available in later firmwares */
-		priv->has_wep = (firmver >= 0x20000); /* FIXME */
-		priv->has_big_wep = 1;	/* Probably RID_SYMBOL_KEY_LENGTH */
-		priv->has_mwo = 0;
-		priv->has_pm = (firmver >= 0x20000);
-		priv->has_retry = 0;
-		break;
-#endif
 	default:
 		vendor_str = "UNKNOWN";
 
@@ -1370,14 +1438,13 @@ static int dldwd_init(struct net_device 
 		priv->has_mwo = 0;
 		priv->has_pm = 0;
 		priv->has_retry = 0;
+		priv->has_preamble = 0;
 	}
 
 	printk(KERN_INFO "%s: Firmware ID %02X vendor 0x%x (%s) version %d.%02d\n",
 	       dev->name, priv->firmware_info.id, priv->firmware_info.vendor,
 	       vendor_str, priv->firmware_info.major, priv->firmware_info.minor);
 	
-	if ((priv->broken_reset) || (priv->broken_allocate))
-		printk(KERN_INFO "%s: Buggy firmware, please upgrade ASAP.\n", dev->name);
 	if (priv->has_port3)
 		printk(KERN_INFO "%s: Ad-hoc demo mode supported.\n", dev->name);
 	if (priv->has_ibss)
@@ -1388,7 +1455,7 @@ static int dldwd_init(struct net_device 
 		if (priv->has_big_wep)
 			printk("\"128\"-bit key.\n");
 		else
-			printk("40-bit key.");
+			printk("40-bit key.\n");
 	}
 
 	/* Get the MAC address */
@@ -1478,7 +1545,7 @@ static int dldwd_init(struct net_device 
 			goto out;
 		}
 	}
-		
+
 	/* Retry setup */
 	if (priv->has_retry) {
 		err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_SHORT_RETRY_LIMIT, &priv->retry_short);
@@ -1494,6 +1561,13 @@ static int dldwd_init(struct net_device 
 			goto out;
 	}
 		
+	/* Preamble setup */
+	if (priv->has_preamble) {
+		err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CNF_SYMBOL_PREAMBLE, &priv->preamble);
+		if (err)
+			goto out;
+	}
+		
 	/* Set up the default configuration */
 	priv->iw_mode = IW_MODE_INFRA;
 	/* By default use IEEE/IBSS ad-hoc mode if we have it */
@@ -1951,7 +2025,7 @@ static int dldwd_ioctl_setiwencode(struc
 	int index = (erq->flags & IW_ENCODE_INDEX) - 1;
 	int setindex = priv->tx_key;
 	int enable = priv->wep_on;
-	int auth = priv->wep_auth;
+	int restricted = priv->wep_restrict;
 	uint16_t xlen = 0;
 	int err = 0;
 	char keybuf[MAX_KEY_SIZE];
@@ -2013,16 +2087,11 @@ static int dldwd_ioctl_setiwencode(struc
 	
 	if (erq->flags & IW_ENCODE_DISABLED)
 		enable = 0;
-	/* Only for symbol cards (so far) - Jean II */
+	/* Only for Prism2 & Symbol cards (so far) - Jean II */
 	if (erq->flags & IW_ENCODE_OPEN)
-		auth = 1;
+		restricted = 0;
 	if (erq->flags & IW_ENCODE_RESTRICTED)
-		auth = 2;	/* If all key are 128 -> should be 3 ??? */
-	/* Agree with master wep setting */
-	if (enable == 0)
-		auth = 0;
-	else if(auth == 0)
-		auth = 1;	/* Encryption require some authentication */
+		restricted = 1;
 
 	if (erq->pointer) {
 		priv->keys[index].len = cpu_to_le16(xlen);
@@ -2031,7 +2100,7 @@ static int dldwd_ioctl_setiwencode(struc
 	}
 	priv->tx_key = setindex;
 	priv->wep_on = enable;
-	priv->wep_auth = auth;
+	priv->wep_restrict = restricted;
 	
  out:
 	dldwd_unlock(priv);
@@ -2058,19 +2127,11 @@ static int dldwd_ioctl_getiwencode(struc
 	erq->flags |= index + 1;
 	
 	/* Only for symbol cards - Jean II */
-	if (priv->firmware_type == FIRMWARE_TYPE_SYMBOL) {
-		switch(priv->wep_auth)	{
-		case 1:
-			erq->flags |= IW_ENCODE_OPEN;
-			break;
-		case 2:
-		case 3:
+	if (priv->firmware_type != FIRMWARE_TYPE_LUCENT) {
+		if(priv->wep_restrict)
 			erq->flags |= IW_ENCODE_RESTRICTED;
-			break;
-		case 0:
-		default:
-			break;
-		}
+		else
+			erq->flags |= IW_ENCODE_OPEN;
 	}
 
 	xlen = le16_to_cpu(priv->keys[index].len);
@@ -2691,6 +2752,10 @@ static int dldwd_ioctl_setport3(struct n
 		err = -EINVAL;
 	}
 
+	if (! err)
+		/* Actually update the mode we are using */
+		set_port_type(priv);
+
 	dldwd_unlock(priv);
 
 	return err;
@@ -3036,7 +3101,13 @@ static int dldwd_ioctl(struct net_device
 				  0, "set_port3" },
 				{ SIOCDEVPRIVATE + 0x3, 0,
 				  IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
-				  "get_port3" }
+				  "get_port3" },
+				{ SIOCDEVPRIVATE + 0x4,
+				  IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+				  0, "set_preamble" },
+				{ SIOCDEVPRIVATE + 0x5, 0,
+				  IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+				  "get_preamble" }
 			};
 
 			err = verify_area(VERIFY_WRITE, wrq->u.data.pointer, sizeof(privtab));
@@ -3080,6 +3151,46 @@ static int dldwd_ioctl(struct net_device
 		err = dldwd_ioctl_getport3(dev, wrq);
 		break;
 
+	case SIOCDEVPRIVATE + 0x4: /* set_preamble */
+		DEBUG(1, "%s: SIOCDEVPRIVATE + 0x4 (set_preamble)\n",
+		      dev->name);
+		if (! capable(CAP_NET_ADMIN)) {
+			err = -EPERM;
+			break;
+		}
+
+		/* 802.11b has recently defined some short preamble.
+		 * Basically, the Phy header has been reduced in size.
+		 * This increase performance, especially at high rates
+		 * (the preamble is transmitted at 1Mb/s), unfortunately
+		 * this give compatibility troubles... - Jean II */
+		if(priv->has_preamble) {
+			int val = *( (int *) wrq->u.name );
+
+			dldwd_lock(priv);
+			if(val)
+				priv->preamble = 1;
+			else
+				priv->preamble = 0;
+			dldwd_unlock(priv);
+			changed = 1;
+		} else
+			err = -EOPNOTSUPP;
+		break;
+
+	case SIOCDEVPRIVATE + 0x5: /* get_preamble */
+		DEBUG(1, "%s: SIOCDEVPRIVATE + 0x5 (get_preamble)\n",
+		      dev->name);
+		if(priv->has_preamble) {
+			int *val = (int *)wrq->u.name;
+
+			dldwd_lock(priv);
+			*val = priv->preamble;
+			dldwd_unlock(priv);
+		} else
+			err = -EOPNOTSUPP;
+		break;
+
 	default:
 		err = -EOPNOTSUPP;
 	}
@@ -3756,6 +3867,44 @@ static void dldwd_detach(dev_link_t * li
 	TRACE_EXIT("dldwd");
 }				/* dldwd_detach */
 
+/*
+ * Do a soft reset of the Pcmcia card using the Configuration Option Register
+ * Can't do any harm, and actually may do some good on some cards...
+ */
+static int dldwd_cor_reset(dev_link_t *link)
+{
+	conf_reg_t reg;
+	u_long default_cor; 
+
+	/* Save original COR value */
+	reg.Function = 0;
+	reg.Action = CS_READ;
+	reg.Offset = CISREG_COR;
+	reg.Value = 0;
+	CardServices(AccessConfigurationRegister, link->handle, &reg);
+	default_cor = reg.Value;
+
+	DEBUG(2, "dldwd : dldwd_cor_reset() : cor=0x%lX\n", default_cor);
+
+	/* Soft-Reset card */
+	reg.Action = CS_WRITE;
+	reg.Offset = CISREG_COR;
+	reg.Value = (default_cor | COR_SOFT_RESET);
+	CardServices(AccessConfigurationRegister, link->handle, &reg);
+
+	/* Wait until the card has acknowledged our reset */
+	mdelay(1);
+
+	/* Restore original COR configuration index */
+	reg.Value = (default_cor & COR_CONFIG_MASK);
+	CardServices(AccessConfigurationRegister, link->handle, &reg);
+
+	/* Wait until the card has finished restarting */
+	mdelay(1);
+
+	return(0);
+}
+
 /*======================================================================
   dldwd_config() is scheduled to run after a CARD_INSERTION event
   is received, to configure the PCMCIA socket, and to make the
@@ -3779,6 +3928,7 @@ static void dldwd_config(dev_link_t * li
 	int last_fn, last_ret;
 	u_char buf[64];
 	config_info_t conf;
+	cistpl_cftable_entry_t dflt = { 0 };
 	cisinfo_t info;
 
 	TRACE_ENTER("dldwd");
@@ -3825,7 +3975,6 @@ static void dldwd_config(dev_link_t * li
 	tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
 	CS_CHECK(GetFirstTuple, handle, &tuple);
 	while (1) {
-		cistpl_cftable_entry_t dflt = { 0 };
 		cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
 		CFG_CHECK(GetTupleData, handle, &tuple);
 		CFG_CHECK(ParseTuple, handle, &tuple, &parse);
@@ -3849,12 +3998,16 @@ static void dldwd_config(dev_link_t * li
 		/*  Note that the CIS values need to be rescaled */
 		if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
 			if (conf.Vcc !=
-			    cfg->vcc.param[CISTPL_POWER_VNOM] /
-			    10000) goto next_entry;
+			    cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) {
+				DEBUG(2, "dldwd_config: Vcc mismatch (conf.Vcc = %d, CIS = %d)\n",  conf.Vcc, cfg->vcc.param[CISTPL_POWER_VNOM] / 10000);
+				goto next_entry;
+			}
 		} else if (dflt.vcc.present & (1 << CISTPL_POWER_VNOM)) {
 			if (conf.Vcc !=
-			    dflt.vcc.param[CISTPL_POWER_VNOM] /
-			    10000) goto next_entry;
+			    dflt.vcc.param[CISTPL_POWER_VNOM] / 10000) {
+				DEBUG(2, "dldwd_config: Vcc mismatch (conf.Vcc = %d, CIS = %d)\n",  conf.Vcc, dflt.vcc.param[CISTPL_POWER_VNOM] / 10000);
+				goto next_entry;
+			}
 		}
 
 		if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
@@ -3945,12 +4098,12 @@ static void dldwd_config(dev_link_t * li
 	ndev->base_addr = link->io.BasePort1;
 	ndev->irq = link->irq.AssignedIRQ;
 
-	/* Instance name : by default, use hermesX, on demand use the
-	 * regular ethX (less risky) - Jean II */
-	if(!eth)
-		sprintf(ndev->name, "hermes%d", priv->instance);
-	else
-		ndev->name[0] = '\0';
+	/* Do a Pcmcia soft reset of the card (optional) */
+	if(reset_cor)
+		dldwd_cor_reset(link);
+
+	/* register_netdev will give us an ethX name */
+	ndev->name[0] = '\0';
 	/* Tell the stack we exist */
 	if (register_netdev(ndev) != 0) {
 		printk(KERN_ERR "orinoco_cs: register_netdev() failed\n");

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: orinoco_cs & IrDA
  2001-04-24 18:39 orinoco_cs & IrDA Jean Tourrilhes
  2001-04-24 19:47 ` Alan Cox
@ 2001-04-25 21:31 ` Linus Torvalds
  1 sibling, 0 replies; 7+ messages in thread
From: Linus Torvalds @ 2001-04-25 21:31 UTC (permalink / raw
  To: jt; +Cc: Alan Cox, Linux kernel mailing list, David Gibson



On Tue, 24 Apr 2001, Jean Tourrilhes wrote:
>
> 	I've got a question... I would like where to send my driver
> patches...

Probably both me and Alan.

[ General rules follow. Too few people seem to have seen them before ]

Most importantly, when sending patches to me:

 - specify clearly that you really want to see them in the standard
   kernel, and why. I occasionally get patches that just say "this is a
   good idea". I don't apply them. Especially if they are cc'd to somebody
   else too, in which case I pretty much assume that it's a RFC, not a
   "real patch".

 - do NOT send patches in attachements. Send one patch per mail, in
   clear-text under your message, so that I can easily see the patch and
   decide then-and-there whether it looks ok. And if it doesn't look ok,
   and I do a "reply", the patch gets included in the reply so that I can
   point out which part of the patch I dislike.

   Don't worry about sending me five emails. That's FINE. I much prefer
   seeing five consecutive emails from the same person with five distinct
   subject lines and five distinct patches, than seeing one email with
   five attachements to it.

 - if your email system is broken, and you want to send patches as
   attachements to avoid whitspace damage, then please FIX YOUR EMAIL
   SYSTEM INSTEAD.

 - Don't point to web-sites. If I have to move the mouse outside my email
   xterm to work on the email, your email just got ignored.

 - Make your patches one sub-directory under the source tree you're
   working on. In short, your patches should look like something like

	--- clean/fs/inode.c ...
	+++ linux/fs/inode.c ..
	@@ -179,7 +179,7 @@
	...

   so that I can (regardless of where my source tree is) apply them
   with "patch -p1" from my linux top directory. Then I can just do a

	cd v2.4/linux
	patch -p1 < ~/multiple-emails-with-multiple-accepted-patches

   and not have to worry about three patches being based on
   /usr/src/linux, while two others not having a path at all and being
   individual filenames in linux/drivers/net.

 - and finally: re-send. If I had laser-eye surgery the fay you sent the
   patches, I won't have applied them. If I took a day off and spent it
   with the kids at the pool instead, I won't have applied them. If I
   decided that this weekend I'm not going to read email for a change, I
   won't have applied them.

   And when I come back to work a day or two later, I will have several
   hundred other emails to work through. I never go backwards in my
   emails.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2001-04-25 21:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-04-24 18:39 orinoco_cs & IrDA Jean Tourrilhes
2001-04-24 19:47 ` Alan Cox
2001-04-24 22:15   ` Jean Tourrilhes
2001-04-24 22:56     ` Jean Tourrilhes
2001-04-25  1:25       ` Jean Tourrilhes
2001-04-25  1:26         ` Jean Tourrilhes
2001-04-25 21:31 ` Linus Torvalds

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.