Wavelan patch for 2.1.26

Jean Tourrilhes (jt@hplb.hpl.hp.com)
Tue, 25 Feb 1997 12:09:06 +0000 (GMT)


Hi,

If you don't use the Wavelan (or the RoamAbout DS) in 2.1.x,
you can safely ignore this mail...
This patch has already been send to Linus for inclusion in the
next unstable kernel release. As there is some delay in the process,
and as my patch for 2.0.29 as already been put in the wild for a while
now, I thought that it could be nice to make it available as well on
the kernel mailing list, just in case...

What's the changes :
o New wireless extension parameter (sensitivity)
o Module parameters (to comply with the last module modifs)
o Put my name as the Wavelan maintainer (= more mail in my mailbox)
o Other details...

My mailbox is open for all your suggestions...

Jean

----------------------------------

diff -u -p --recursive --new-file kernel-source-2.1.26b/MAINTAINERS linux/MAINTAINERS
--- kernel-source-2.1.26b/MAINTAINERS Sat Feb 8 21:17:41 1997
+++ linux/MAINTAINERS Sat Feb 8 21:19:21 1997
@@ -101,6 +101,11 @@ L: linux-net@vger.rutgers.edu
W: http://www.dgii.com/linux/
S: Maintained

+WAVELAN NETWORK DRIVER & WIRELESS EXTENSIONS
+P: Jean Tourrilhes
+M: jt@hplb.hpl.hp.com
+S: Maintained
+
APM DRIVER
P: Rik Faith & Stephen Rothwell
M: faith@cs.unc.edu, Stephen.Rothwell@canb.auug.org.au
diff -u -p --recursive --new-file kernel-source-2.1.26b/drivers/net/wavelan.h linux/drivers/net/wavelan.h
--- kernel-source-2.1.26b/drivers/net/wavelan.h Sat Jan 4 22:10:54 1997
+++ linux/drivers/net/wavelan.h Mon Feb 10 17:12:52 1997
@@ -225,7 +225,7 @@ struct mmw_t
unsigned char mmw_jam_time; /* jamming time (after collision) */
unsigned char mmw_unused2[1]; /* unused */
unsigned char mmw_thr_pre_set; /* level threshold preset */
- /* Discard all packet with signal < this value (0) */
+ /* Discard all packet with signal < this value (4) */
unsigned char mmw_decay_prm; /* decay parameters */
unsigned char mmw_decay_updat_prm; /* decay update parameterz */
unsigned char mmw_quality_thr; /* quality (z-quotient) threshold */
diff -u -p --recursive --new-file kernel-source-2.1.26b/drivers/net/wavelan.p.h linux/drivers/net/wavelan.p.h
--- kernel-source-2.1.26b/drivers/net/wavelan.p.h Sun Feb 2 19:51:04 1997
+++ linux/drivers/net/wavelan.p.h Mon Feb 10 22:00:01 1997
@@ -139,11 +139,6 @@
* the code
* Loeke Brederveld <lbrederv@wavelan.com> from Lucent has given me
* much needed informations on the Wavelan hardware.
- *
- * Yongguang Zhang <ygz@isl.hrl.hac.com> send me a patch for enabling
- * multicast in the old pcmcia driver. I tried to do the same (with
- * some minor changes) in this driver, but without any luck (I don't
- * know how to enable multicast in the chip...).
*/

/* The original copyrights and litteratures mention others names and
@@ -173,6 +168,7 @@
* Robert Morris (rtm@das.harvard.edu),
* Jean Tourrilhes (jt@hplb.hpl.hp.com),
* Girish Welling (welling@paul.rutgers.edu),
+ * Clark Woodworth <clark@hiway1.exit109.com>
* Yongguang Zhang <ygz@isl.hrl.hac.com>...
*
* Thanks go also to:
@@ -258,6 +254,13 @@
* - Update to wireless extensions changes
* - Silly bug in card initial configuration (psa_conf_status)
*
+ * Changes made for release in 2.1.27 :
+ * ----------------------------------
+ * - Small bug in debug code (probably not the last one...)
+ * - Remove extern kerword for wavelan_probe()
+ * - Level threshold is now a standard wireless extension (version 4 !)
+ * - modules parameters types (new module interface)
+ *
* Wishes & dreams :
* ---------------
* - Encryption stuff
@@ -344,7 +347,7 @@
/************************ CONSTANTS & MACROS ************************/

#ifdef DEBUG_VERSION_SHOW
-static const char *version = "wavelan.c : v12 (wireless extensions) 1/12/96\n";
+static const char *version = "wavelan.c : v15 (wireless extensions) 12/2/97\n";
#endif

/* Watchdog temporisation */
@@ -608,13 +611,13 @@ static unsigned short iobase[] =
};

#ifdef MODULE
-/* Name of the devices (memory allocation) */
-static char devname[4][IFNAMSIZ] = { "", "", "", "" };
-
/* Parameters set by insmod */
static int io[4] = { 0, 0, 0, 0 };
static int irq[4] = { 0, 0, 0, 0 };
-static char * name[4] = { devname[0], devname[1], devname[2], devname[3] };
+static char name[4][IFNAMSIZ] = { "", "", "", "" };
+MODULE_PARM(io, "1-4i");
+MODULE_PARM(irq, "1-4i");
+MODULE_PARM(name, "1-4c" __MODULE_STRING(IFNAMSIZ));
#endif /* MODULE */

#endif /* WAVELAN_P_H */
diff -u -p --recursive --new-file kernel-source-2.1.26b/drivers/net/wavelan.c linux/drivers/net/wavelan.c
--- kernel-source-2.1.26b/drivers/net/wavelan.c Tue Jan 21 20:05:31 1997
+++ linux/drivers/net/wavelan.c Mon Feb 10 20:10:24 1997
@@ -1009,8 +1009,10 @@ wv_mmc_show(device * dev)
mmc_read(ioaddr, 0, (u_char *)&m, sizeof(m));
mmc_out(ioaddr, mmwoff(0, mmw_freeze), 0);

+#ifdef WIRELESS_EXT /* If wireless extension exist in the kernel */
/* Don't forget to update statistics */
lp->wstats.discard.nwid += (m.mmr_wrong_nwid_h << 8) | m.mmr_wrong_nwid_l;
+#endif /* WIRELESS_EXT */

printk(KERN_DEBUG "##### wavelan modem status registers: #####\n");
#ifdef DEBUG_SHOW_UNUSED
@@ -1548,7 +1550,7 @@ wv_set_frequency(u_short ioaddr, /* i/o
}

/* Setting by channel (same as wfreqsel) */
- /* Warning : each channel is 22MHz wide, so some of the channels
+ /* Warning : each channel is 11MHz wide, so some of the channels
* will interfere... */
if((frequency->e == 0) &&
(frequency->m >= 0) && (frequency->m < BAND_NUM))
@@ -1931,6 +1933,23 @@ wavelan_ioctl(struct device * dev, /* De
}
break;

+ case SIOCSIWSENS:
+ /* Set the level threshold */
+ if(!suser())
+ return -EPERM;
+ psa.psa_thr_pre_set = wrq->u.sensitivity & 0x3F;
+ psa_write(ioaddr, lp->hacr, (char *)&psa.psa_thr_pre_set - (char *)&psa,
+ (unsigned char *) &psa.psa_thr_pre_set, 1);
+ mmc_out(ioaddr, mmwoff(0, mmw_thr_pre_set), psa.psa_thr_pre_set);
+ break;
+
+ case SIOCGIWSENS:
+ /* Read the level threshold */
+ psa_read(ioaddr, lp->hacr, (char *)&psa.psa_thr_pre_set - (char *)&psa,
+ (unsigned char *) &psa.psa_thr_pre_set, 1);
+ wrq->u.sensitivity = psa.psa_thr_pre_set & 0x3F;
+ break;
+
case SIOCGIWRANGE:
/* Basic checking... */
if(wrq->u.data.pointer != (caddr_t) 0)
@@ -1962,6 +1981,7 @@ wavelan_ioctl(struct device * dev, /* De
else
range.num_channels = range.num_frequency = 0;

+ range.sensitivity = 0x3F;
range.max_qual.qual = MMR_SGNL_QUAL;
range.max_qual.level = MMR_SIGNAL_LVL;
range.max_qual.noise = MMR_SILENCE_LVL;
@@ -1980,8 +2000,6 @@ wavelan_ioctl(struct device * dev, /* De
{ /* cmd, set_args, get_args, name */
{ SIOCSIPQTHR, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, 0, "setqualthr" },
{ SIOCGIPQTHR, 0, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, "getqualthr" },
- { SIOCSIPLTHR, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, 0, "setlevelthr" },
- { SIOCGIPLTHR, 0, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, "getlevelthr" },

{ SIOCSIPHISTO, IW_PRIV_TYPE_BYTE | 16, 0, "sethisto" },
{ SIOCGIPHISTO, 0, IW_PRIV_TYPE_INT | 16, "gethisto" },
@@ -1994,7 +2012,7 @@ wavelan_ioctl(struct device * dev, /* De
break;

/* Set the number of ioctl available */
- wrq->u.data.length = 6;
+ wrq->u.data.length = 4;

/* Copy structure to the user buffer */
copy_to_user(wrq->u.data.pointer, (u_char *) priv,
@@ -2115,21 +2133,6 @@ wavelan_ioctl(struct device * dev, /* De
*(wrq->u.name) = psa.psa_quality_thr & 0x0F;
break;

- case SIOCSIPLTHR:
- if(!suser())
- return -EPERM;
- psa.psa_thr_pre_set = *(wrq->u.name) & 0x3F;
- psa_write(ioaddr, lp->hacr, (char *)&psa.psa_thr_pre_set - (char *)&psa,
- (unsigned char *)&psa.psa_thr_pre_set, 1);
- mmc_out(ioaddr, mmwoff(0, mmw_thr_pre_set), psa.psa_thr_pre_set);
- break;
-
- case SIOCGIPLTHR:
- psa_read(ioaddr, lp->hacr, (char *)&psa.psa_thr_pre_set - (char *)&psa,
- (unsigned char *)&psa.psa_thr_pre_set, 1);
- *(wrq->u.name) = psa.psa_thr_pre_set & 0x3F;
- break;
-
#ifdef HISTOGRAM
case SIOCSIPHISTO:
/* Verif if the user is root */
@@ -4016,9 +4019,11 @@ wavelan_config(device * dev)
* the initial value of dev->base_addr.
* We follow the example in drivers/net/ne.c.)
* (called in "Space.c")
+ * As this function is called outside the wavelan module, it should be
+ * declared extern, but it seem to cause troubles...
*/
-
-int wavelan_probe(device * dev)
+/* extern */ int
+wavelan_probe(device * dev)
{
short base_addr;
mac_addr mac; /* Mac address (check wavelan existence) */
diff -u -p --recursive --new-file kernel-source-2.1.26b/include/linux/wireless.h linux/include/linux/wireless.h
--- kernel-source-2.1.26b/include/linux/wireless.h Sat Jan 4 22:11:05 1997
+++ linux/include/linux/wireless.h Mon Feb 10 17:08:35 1997
@@ -1,7 +1,7 @@
/*
* This file define a set of standard wireless extensions
*
- * Version : 3 18.12.96
+ * Version : 4 12.2.97
*
* Authors : Jean Tourrilhes - HPLB - <jt@hplb.hpl.hp.com>
*/
@@ -63,7 +63,7 @@
* (there is some stuff that will be added in the future...)
* I just plan to increment with each new version.
*/
-#define WIRELESS_EXT 3
+#define WIRELESS_EXT 4

/*
* Changes :
@@ -73,6 +73,10 @@
* Alan Cox start some imcompatibles changes. I've integrated a bit more.
* - Encryption renamed to Encode to avoid US regulation problems
* - Frequency changed from float to struct to avoid problems on old 386
+ *
+ * V3 to V4
+ * --------
+ * - Add sensitivity
*/

/* -------------------------- IOCTL LIST -------------------------- */
@@ -86,6 +90,8 @@
#define SIOCGIWFREQ 0x8B05 /* get channel/frequency */
#define SIOCSIWENCODE 0x8B06 /* set encoding info */
#define SIOCGIWENCODE 0x8B07 /* get encoding info */
+#define SIOCSIWSENS 0x8B08 /* set sensitivity */
+#define SIOCGIWSENS 0x8B09 /* get sensitivity */

/* Informative stuff */
#define SIOCSIWRANGE 0x8B0A /* Unused ??? */
@@ -234,6 +240,8 @@ struct iwreq
__u64 code; /* Data used for algorithm */
} encoding;

+ __u32 sensitivity; /* signal level threshold */
+
struct /* For all data bigger than 16 octets */
{
caddr_t pointer; /* Pointer to the data
@@ -271,6 +279,9 @@ struct iw_range
/* Note : this frequency list doesn't need to fit channel numbers */

/* Encoder stuff */
+
+ /* signal level threshold range */
+ __u32 sensitivity;

/* Quality of link & SNR stuff */
struct iw_quality max_qual; /* Quality of the link */