Skip to contentSkip to conversation

prism54: add support for avs header in

PATCH In review Luis R. Rodriguez 4 participants 7 messages May 24, 2004 – May 27, 2004

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

PATCH 4/14 prism54: add support for avs header in

2004-03-19 Aurelien Alleaume <[email protected]>

* islpci_eth.[c,h], islpci_dev.[c,h], isl_ioctl.[c,h] : added support for avs header in monitor mode. Based on the work of Antonio Eugenio Burriel <[email protected]>. Unified packets header (rfmon_header and rx_annex) for iwspy.j

* Some minor things (oid_mgt.[c,h]).

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

2004-03-19 Aurelien Alleaume <[email protected]>

* islpci_eth.[c,h], islpci_dev.[c,h], isl_ioctl.[c,h] : added support for avs header in monitor mode. Based on the work of Antonio Eugenio Burriel <[email protected]>. Unified packets header (rfmon_header and rx_annex) for iwspy.

* Some minor things (oid_mgt.[c,h]).

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

drivers/net/wireless/prism54/isl_ioctl.c +40 -29
diff -u -r1.145 -r1.148
@@ -1,4 +1,4 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/isl_ioctl.c,v 1.145 2004/03/18 15:27:44 ajfa Exp $
+/*  $Header: /var/lib/cvs/prism54-ng/ksrc/isl_ioctl.c,v 1.148 2004/03/19 23:03:58 ajfa Exp $
  *  
  *  Copyright (C) 2002 Intersil Americas Inc.
  *            (C) 2003,2004 Aurelien Alleaume <[email protected]>
@@ -327,34 +327,15 @@
 {
 	islpci_private *priv = netdev_priv(ndev);
 	int rvalue;
-	u32 c = 0;
+	u32 c;
 
-	/* prepare the structure for the set object */
-	if (fwrq->m < 1000)
-		/* structure value contains a channel indication */
-		c = fwrq->m;
-	else {
-		/* structure contains a frequency indication and fwrq->e = 1 */
-		int f = fwrq->m / 100000;
-
-		if (fwrq->e != 1)
-			return -EINVAL;
-		if ((f >= 2412) && (f <= 2484)) {
-			while ((c < 14) && (f != frequency_list_bg[c]))
-				c++;
-			if (c >= 14)
-				return -EINVAL;
-		} else if ((f >= (int) 5170) && (f <= (int) 5320)) {
-			while ((c < 12) && (f != frequency_list_a[c]))
-				c++;
-			if (c >= 12)
-				return -EINVAL;
-		} else
-			return -EINVAL;
-		c++;
-	}
+	if (fwrq->m  < 1000)
+		/* we have a channel number */
+		c =  fwrq->m;
+	else
+		c = (fwrq->e == 1) ? channel_of_freq(fwrq->m / 100000) : 0;
 
-	rvalue = mgt_set_request(priv, DOT11_OID_CHANNEL, 0, &c);
+	rvalue = c ? mgt_set_request(priv, DOT11_OID_CHANNEL, 0, &c) : -EINVAL;
 
 	/* Call commit handler */
 	return (rvalue ? rvalue : -EINPROGRESS);
@@ -410,7 +391,7 @@
 
 	mgt_commit(priv);
 	priv->ndev->type = (priv->iw_mode == IW_MODE_MONITOR)
-	    ? ARPHRD_IEEE80211 : ARPHRD_ETHER;
+	    ? priv->monitor_type : ARPHRD_ETHER;
 	up_write(&priv->mib_sem);
 
 	return 0;
@@ -1963,6 +1944,28 @@
 }
 
 int
+prism54_set_prismhdr(struct net_device *ndev, struct iw_request_info *info,
+		     __u32 * uwrq, char *extra)
+{
+	islpci_private *priv = netdev_priv(ndev);
+	priv->monitor_type =
+	    (*uwrq ? ARPHRD_IEEE80211_PRISM : ARPHRD_IEEE80211);
+	if (priv->iw_mode == IW_MODE_MONITOR)
+		priv->ndev->type = priv->monitor_type;
+
+	return 0;
+}
+
+int
+prism54_get_prismhdr(struct net_device *ndev, struct iw_request_info *info,
+		     __u32 * uwrq, char *extra)
+{
+	islpci_private *priv = netdev_priv(ndev);
+	*uwrq = (priv->monitor_type == ARPHRD_IEEE80211_PRISM);
+	return 0;
+}
+
+int
 prism54_set_maxframeburst(struct net_device *ndev, struct iw_request_info *info,
 			  __u32 * uwrq, char *extra)
 {
@@ -2198,6 +2201,9 @@
 #define	PRISM54_SET_OID_STR	SIOCIWFIRSTPRIV+20
 #define	PRISM54_SET_OID_ADDR	SIOCIWFIRSTPRIV+22
 
+#define PRISM54_GET_PRISMHDR	SIOCIWFIRSTPRIV+23
+#define PRISM54_SET_PRISMHDR	SIOCIWFIRSTPRIV+24
+
 #define IWPRIV_SET_U32(n,x)	{ n, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_"x }
 #define IWPRIV_SET_SSID(n,x)	{ n, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 1, 0, "set_"x }
 #define IWPRIV_SET_ADDR(n,x)	{ n, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, "set_"x }
@@ -2212,6 +2218,10 @@
 static const struct iw_priv_args prism54_private_args[] = {
 /*{ cmd, set_args, get_args, name } */
 	{PRISM54_RESET, 0, 0, "reset"},
+	{PRISM54_GET_PRISMHDR, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+	 "get_prismhdr"},
+	{PRISM54_SET_PRISMHDR, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
+	 "set_prismhdr"},
 	{PRISM54_GET_POLICY, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
 	 "getPolicy"},
 	{PRISM54_SET_POLICY, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
@@ -2321,7 +2331,8 @@
 	(iw_handler) prism54_set_raw,
 	(iw_handler) NULL,
 	(iw_handler) prism54_set_raw,
-
+	(iw_handler) prism54_get_prismhdr,
+	(iw_handler) prism54_set_prismhdr,
 };
 
 const struct iw_handler_def prism54_handler_def = {

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

drivers/net/wireless/prism54/isl_oid.h +1 -14
diff -u -r1.5 -r1.6
@@ -1,5 +1,5 @@
 /*
- *  $Id: isl_oid.h,v 1.5 2004/03/18 15:27:44 ajfa Exp $
+ *  $Id: isl_oid.h,v 1.6 2004/03/19 20:54:33 ajfa Exp $
  *  
  *  Copyright (C) 2003 Herbert Valerio Riedel <[email protected]>
  *  Copyright (C) 2004 Luis R. Rodriguez <[email protected]>
@@ -91,19 +91,6 @@
 	u16 mhz[0];
 } __attribute__ ((packed));
 
-struct obj_rx_annex {
-	u8 addr1[ETH_ALEN];
-	u8 addr2[ETH_ALEN];
-	u32 something0;
-	u32 time;
-	u16 something1;
-	u16 rate;
-	u16 freq;
-	u16 something2;
-	u8 rssi;
-	u8 pad[3];
-} __attribute__ ((packed));
-
 /* 
  * in case everything's ok, the inlined function below will be
  * optimized away by the compiler...

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

drivers/net/wireless/prism54/islpci_dev.c +3 -3
diff -u -r1.71 -r1.72
@@ -1,4 +1,4 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_dev.c,v 1.71 2004/03/18 11:44:17 ajfa Exp $
+/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_dev.c,v 1.72 2004/03/19 20:54:33 ajfa Exp $
  *  
  *  Copyright (C) 2002 Intersil Americas Inc.
  *  Copyright (C) 2003 Herbert Valerio Riedel <[email protected]>
@@ -715,9 +715,9 @@
 	priv = netdev_priv(ndev);
 	priv->ndev = ndev;
 	priv->pdev = pdev;
-
+	priv->monitor_type = ARPHRD_IEEE80211;
 	priv->ndev->type = (priv->iw_mode == IW_MODE_MONITOR) ?
-		ARPHRD_IEEE80211: ARPHRD_ETHER;
+		priv->monitor_type : ARPHRD_ETHER;
 
 	/* save the start and end address of the PCI memory area */
 	ndev->mem_start = (unsigned long) priv->device_base;

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

drivers/net/wireless/prism54/islpci_dev.h +3 -1
diff -u -r1.57 -r1.58
@@ -1,4 +1,4 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_dev.h,v 1.57 2004/03/18 15:27:44 ajfa Exp $
+/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_dev.h,v 1.58 2004/03/19 20:54:33 ajfa Exp $
  *  
  *  Copyright (C) 2002 Intersil Americas Inc. 
  *  Copyright (C) 2003 Herbert Valerio Riedel <[email protected]>
@@ -114,6 +114,8 @@
 
 	struct iw_spy_data spy_data; /* iwspy support */
 
+	int monitor_type; /* ARPHRD_IEEE80211 or ARPHRD_IEEE80211_PRISM */
+
 	struct islpci_acl acl;
 
 	/* PCI bus allocation & configuration members */

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

drivers/net/wireless/prism54/islpci_eth.c +78 -21

135 lines not on this page · raw message

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

drivers/net/wireless/prism54/islpci_eth.h +42 -1

52 lines not on this page · raw message

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

drivers/net/wireless/prism54/oid_mgt.c +21 -0
diff -u -r1.9 -r1.11
@@ -31,6 +31,27 @@
 	5240, 5260, 5280, 5300, 5320
 };
 
+int
+channel_of_freq(int f)
+{
+	int c = 0;
+
+	if ((f >= 2412) && (f <= 2484)) {
+		while ((c < 14) && (f != frequency_list_bg[c]))
+			c++;
+		if (c >= 14)
+			return 0;
+	} else if ((f >= (int) 5170) && (f <= (int) 5320)) {
+		while ((c < 12) && (f != frequency_list_a[c]))
+			c++;
+		if (c >= 12)
+			return 0;
+	} else
+		return 0;
+
+	return ++c;
+}
+
 #define OID_STRUCT(name,oid,s,t) [name] = {oid, 0, sizeof(s), t}
 #define OID_STRUCT_C(name,oid,s,t) OID_STRUCT(name,oid,s,t | OID_FLAG_CACHED)
 #define OID_U32(name,oid) OID_STRUCT(name,oid,u32,OID_TYPE_U32)

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

drivers/net/wireless/prism54/oid_mgt.h +2 -1
diff -u -r1.4 -r1.5
@@ -28,9 +28,10 @@
 
 void mgt_clean(islpci_private *);
 
+/* I don't know where to put these 3 */
 extern const int frequency_list_bg[];
-
 extern const int frequency_list_a[];
+int channel_of_freq(int);
 
 void mgt_le_to_cpu(int, void *);
 
#1 lore raw

drivers/net/wireless/prism54/islpci_eth.c line 1

Quoted 6 lines · Luis R. Rodriguez

diff -u -r1.31 -r1.33

drivers/net/wireless/prism54/islpci_eth.c +1 -1
@@ -1,4 +1,4 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_eth.c,v 1.31 2004/03/18 15:27:44 ajfa Exp $
+/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_eth.c,v 1.33 2004/03/19 23:03:58 ajfa Exp $

Please remove CVS substitions from your code, they cause endless patch rejects if I choose to apply (for example) 10 out of 14 patches.

Jeff

#2 lore raw
Quoted 15 lines · Jeff Garzik
Quoted 10 lines · Luis R. Rodriguez

diff -u -r1.31 -r1.33
--- linux-2.6.7-rc1/drivers/net/wireless/prism54/islpci_eth.c 18 Mar 2004
15:27:44 -0000 1.31
+++ linux-2.6.7-rc1/drivers/net/wireless/prism54/islpci_eth.c 19 Mar 2004
23:03:58 -0000 1.33

(quoted diff) +0 -1
@@ -1,4 +1,4 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_eth.c,v 1.31 2004/03/18 

15:27:44 ajfa Exp $
+/* $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_eth.c,v 1.33 2004/03/19 23:03:58 ajfa Exp $

Please remove CVS substitions from your code, they cause endless patch rejects if I choose to apply (for example) 10 out of 14 patches.

Will do. So if you get

--- ksrc/islpci_eth.c
+++ ksrc-new/islpci_eth.c

patches, that'll be OK? I substituted ksrc to linux-2.6.7-rc1/drivers/net/wireless/prism54 thinking that'll ease your job. Sorry for any inconvenience.

Luis

Signature · 1 line
GnuPG Key fingerprint = 113F B290 C6D2 0251 4D84  A34A 6ADD 4937 E20A 525E
#3 lore raw
Quoted 24 lines · Luis R. Rodriguez
Quoted 15 lines · Jeff Garzik
Quoted 10 lines · Luis R. Rodriguez

diff -u -r1.31 -r1.33
--- linux-2.6.7-rc1/drivers/net/wireless/prism54/islpci_eth.c 18 Mar 2004
15:27:44 -0000 1.31
+++ linux-2.6.7-rc1/drivers/net/wireless/prism54/islpci_eth.c 19 Mar 2004
23:03:58 -0000 1.33

(quoted diff) +0 -1
@@ -1,4 +1,4 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_eth.c,v 1.31 2004/03/18 

15:27:44 ajfa Exp $
+/* $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_eth.c,v 1.33 2004/03/19 23:03:58 ajfa Exp $

Please remove CVS substitions from your code, they cause endless patch rejects if I choose to apply (for example) 10 out of 14 patches.

Will do. So if you get

islpci_eth.c +0 -0
Quoted 3 lines

patches, that'll be OK? I substituted ksrc to linux-2.6.7-rc1/drivers/net/wireless/prism54 thinking that'll ease your job. Sorry for any inconvenience.

I think you misunderstand (and I apologize for causing the confusion).

It is _required_ that the patches include the full path in the header. You did this correctly:
--- linux-2.6.7-rc1/drivers/net/wireless/prism54/islpci_eth.c 18 Mar 2004 15:27:44 -0000 1.31
+++ linux-2.6.7-rc1/drivers/net/wireless/prism54/islpci_eth.c 19 Mar 2004

I am referring to the CVS substitution variables embedded in your source code. In this case $Header$.

However, consider what happens when I do:

1) apply patch #1
2) reject patch #2
3) attempt to apply patch #3

If each patch updates the $Header$, then patch #3 cannot be applied because patch(1) will reject it due to the now-incorrect $Header$ line.

The $Header$ _forces_ me to apply your patches in order, all or none. I don't think you want that ;-)

Jeff

#4 lore raw

CVS tags (was Re: [Prism54-devel] Re: [PATCH 4/14 linux-2.6.7-rc1] prism54: add support for avs header in

In reply to Luis R. Rodriguez

islpci_eth.c

Quoted 2 lines · Luis R. Rodriguez
islpci_eth.c +0 -0

I think this was what he referred to:

islpci_eth.c

Quoted 2 lines
islpci_eth.c +1 -1
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_eth.c,v 1.31 2004/03 15:27:44 ajfa Exp $
+/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_eth.c,v 1.33 2004/03/19 23:03:58 ajfa Exp $

as this will almost surely cause rejects (sooner or later) unless 100% of your patches are applied and in the right order.

#5 lore raw

Re: CVS tags (was Re: [Prism54-devel] Re: [PATCH 4/14 linux-2.6.7-rc1] prism54: add support for avs header in

Quoted 9 lines · [email protected] wrote:

islpci_eth.c

Quoted 2 lines · Luis R. Rodriguez
islpci_eth.c +0 -0

I think this was what he referred to:

Quoted 6 lines

islpci_eth.c

Quoted 2 lines
islpci_eth.c +1 -1
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_eth.c,v 1.31 2004/03 15:27:44 ajfa Exp $
+/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_eth.c,v 1.33 2004/03/19 23:03:58 ajfa Exp $

as this will almost surely cause rejects (sooner or later) unless 100% of your patches are applied and in the right order.

Correct.

Jeff

#6 lore raw

Re: CVS tags (was Re: [Prism54-devel] Re: [PATCH 4/14 linux-2.6.7-rc1] prism54: add support for avs header in

In reply to [email protected]
Quoted 11 lines · On May 27, 2004 15:31 -0400, [email protected] wrote:

islpci_eth.c

Quoted 2 lines · Luis R. Rodriguez
islpci_eth.c +0 -0

I think this was what he referred to:

islpci_eth.c

Quoted 2 lines
islpci_eth.c +1 -1
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_eth.c,v 1.31 2004/03 15:27:44 ajfa Exp $
+/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_eth.c,v 1.33 2004/03/19 23:03:58 ajfa Exp $

as this will almost surely cause rejects (sooner or later) unless 100% of your patches are applied and in the right order.

This also causes grief if this file is ever imported again into a CVS-based SCM, unless you remember to do so with -ko.

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/