Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 27558 | Differences between
and this patch

Collapse All | Expand All

(-)ppc3.orig/drivers/net/wireless/hermes.c (+4 lines)
Lines 184-189 Link Here
184
	if (err)
184
	if (err)
185
		return err;
185
		return err;
186
186
187
        for ( k = 0; k < HERMES_NUMPORTS_MAX; k++) {
188
		hw->port_enabled[k] = 0;
189
	}
190
187
	reg = hermes_read_regn(hw, EVSTAT);
191
	reg = hermes_read_regn(hw, EVSTAT);
188
	k = CMD_INIT_TIMEOUT;
192
	k = CMD_INIT_TIMEOUT;
189
	while ( (! (reg & HERMES_EV_CMD)) && k) {
193
	while ( (! (reg & HERMES_EV_CMD)) && k) {
(-)ppc3.orig/drivers/net/wireless/hermes.h (+39 lines)
Lines 33-38 Link Here
33
#include <linux/if_ether.h>
33
#include <linux/if_ether.h>
34
#include <asm/byteorder.h>
34
#include <asm/byteorder.h>
35
35
36
#define		HFA384x_PORTTYPE_IBSS			((uint16_t)3)
37
#define		HFA384x_WEPFLAGS_DISABLE_TXCRYPT	(0x10)
38
#define		HFA384x_WEPFLAGS_DISABLE_RXCRYPT	(0x80)
39
36
/*
40
/*
37
 * Limits and constants
41
 * Limits and constants
38
 */
42
 */
Lines 149-154 Link Here
149
#define		HERMES_MONITOR_DISABLE		(0x000f)
153
#define		HERMES_MONITOR_DISABLE		(0x000f)
150
154
151
/*
155
/*
156
 * Configuration RIDs
157
 */
158
159
#define		HERMES_RID_CNF_PORTTYPE		(0xfc00)
160
#define		HERMES_RID_CNF_CHANNEL		(0xfc03)
161
#define		HERMES_RID_CNF_PRISM2_WEP_ON	(0xfc28)
162
163
/*-- Status Fields --*/
164
#define		HERMES_RXSTATUS_MSGTYPE		(0xE000)
165
#define		HERMES_RXSTATUS_MACPORT		(0x0700)
166
#define		HERMES_RXSTATUS_UNDECR		(0x0002)
167
#define		HERMES_RXSTATUS_FCSERR		(0x0001)
168
169
/*--------------------------------------------------------------------
170
Communication Frames: Test/Get/Set Field Values for Receive Frames
171
--------------------------------------------------------------------*/
172
#define		HERMES_RXSTATUS_MSGTYPE_GET(value)	(((value) & HERMES_RXSTATUS_MSGTYPE) >> 13)
173
#define		HERMES_RXSTATUS_MSGTYPE_SET(value)	((value) << 13)
174
#define		HERMES_RXSTATUS_MACPORT_GET(value)	(((value) & HERMES_RXSTATUS_MACPORT) >> 8)
175
#define		HERMES_RXSTATUS_MACPORT_SET(value)	((value) << 8)
176
#define		HERMES_RXSTATUS_ISUNDECR(value)	((value) & HERMES_RXSTATUS_UNDECR)
177
#define		HERMES_RXSTATUS_ISFCSERR(value)	((value) & HERMES_RXSTATUS_FCSERR)
178
179
/*--------------------------------------------------------------------
180
Communication Frames: Field Masks for Receive Frames
181
--------------------------------------------------------------------*/
182
/*-- Offsets --------*/
183
#define		HERMES_RX_DATA_LEN_OFF		(44)
184
#define		HERMES_RX_80211HDR_OFF		(14)
185
#define		HERMES_RX_DATA_OFF			(60)
186
187
/*
152
 * Frame structures and constants
188
 * Frame structures and constants
153
 */
189
 */
154
190
Lines 286-291 Link Here
286
#define HERMES_32BIT_REGSPACING	1
322
#define HERMES_32BIT_REGSPACING	1
287
323
288
	u16 inten; /* Which interrupts should be enabled? */
324
	u16 inten; /* Which interrupts should be enabled? */
325
 	uint8_t		port_enabled[HERMES_NUMPORTS_MAX];
289
326
290
#ifdef HERMES_DEBUG_BUFFER
327
#ifdef HERMES_DEBUG_BUFFER
291
	struct hermes_debug_entry dbuf[HERMES_DEBUG_BUFSIZE];
328
	struct hermes_debug_entry dbuf[HERMES_DEBUG_BUFSIZE];
Lines 339-350 Link Here
339
376
340
static inline int hermes_enable_port(hermes_t *hw, int port)
377
static inline int hermes_enable_port(hermes_t *hw, int port)
341
{
378
{
379
        hw->port_enabled[port] = 1;
342
	return hermes_docmd_wait(hw, HERMES_CMD_ENABLE | (port << 8),
380
	return hermes_docmd_wait(hw, HERMES_CMD_ENABLE | (port << 8),
343
				 0, NULL);
381
				 0, NULL);
344
}
382
}
345
383
346
static inline int hermes_disable_port(hermes_t *hw, int port)
384
static inline int hermes_disable_port(hermes_t *hw, int port)
347
{
385
{
386
        hw->port_enabled[port] = 0;
348
	return hermes_docmd_wait(hw, HERMES_CMD_DISABLE | (port << 8), 
387
	return hermes_docmd_wait(hw, HERMES_CMD_DISABLE | (port << 8), 
349
				 0, NULL);
388
				 0, NULL);
350
}
389
}
(-)ppc3.orig/drivers/net/wireless/orinoco.c (-1 / +422 lines)
Lines 1676-1681 Link Here
1676
	struct header_struct hdr;
1676
	struct header_struct hdr;
1677
	struct ethhdr *eh;
1677
	struct ethhdr *eh;
1678
	int err;
1678
	int err;
1679
        struct ieee802_11_hdr hdr80211;
1679
1680
1680
	rxfid = hermes_read_regn(hw, RXFID);
1681
	rxfid = hermes_read_regn(hw, RXFID);
1681
1682
Lines 1692-1697 Link Here
1692
	
1693
	
1693
	if (status & HERMES_RXSTAT_ERR) {
1694
	if (status & HERMES_RXSTAT_ERR) {
1694
		if (status & HERMES_RXSTAT_UNDECRYPTABLE) {
1695
		if (status & HERMES_RXSTAT_UNDECRYPTABLE) {
1696
                    if (dev->type != ARPHRD_ETHER) goto sniffing;
1695
			wstats->discard.code++;
1697
			wstats->discard.code++;
1696
			DEBUG(1, "%s: Undecryptable frame on Rx. Frame dropped.\n",
1698
			DEBUG(1, "%s: Undecryptable frame on Rx. Frame dropped.\n",
1697
			       dev->name);
1699
			       dev->name);
Lines 1702-1708 Link Here
1702
		stats->rx_errors++;
1704
		stats->rx_errors++;
1703
		goto drop;
1705
		goto drop;
1704
	}
1706
	}
1705
1707
sniffing:
1706
	/* For now we ignore the 802.11 header completely, assuming
1708
	/* For now we ignore the 802.11 header completely, assuming
1707
           that the card's firmware has handled anything vital */
1709
           that the card's firmware has handled anything vital */
1708
1710
Lines 1732-1737 Link Here
1732
		stats->rx_errors++;
1734
		stats->rx_errors++;
1733
		goto drop;
1735
		goto drop;
1734
	}
1736
	}
1737
	/* Now handle frame based on port# */
1738
	switch( HERMES_RXSTATUS_MACPORT_GET(status) )
1739
	{
1740
	case 0:
1735
1741
1736
	/* We need space for the packet data itself, plus an ethernet
1742
	/* We need space for the packet data itself, plus an ethernet
1737
	   header, plus 2 bytes so we can align the IP header on a
1743
	   header, plus 2 bytes so we can align the IP header on a
Lines 1808-1813 Link Here
1808
1814
1809
	return;
1815
	return;
1810
1816
1817
	case 7:
1818
        	if ( ! HERMES_RXSTATUS_ISFCSERR(status) ) {
1819
                   if (hermes_bap_pread(hw, IRQ_BAP, &hdr80211, sizeof(hdr80211), 
1820
                                       rxfid, HERMES_RX_80211HDR_OFF)) {
1821
                      stats->rx_errors++;
1822
                   }
1823
                   else {
1824
                        /* Copy to wlansnif skb */
1825
                        orinoco_int_rxmonitor( priv, rxfid, length, &desc, &hdr80211);
1826
                   }
1827
                } else {
1828
                        printk("Received monitor frame: FCSerr set\n");
1829
                }
1830
                break;
1831
1832
	default:
1833
		printk("Received frame on unsupported port=%d\n",
1834
			HERMES_RXSTATUS_MACPORT_GET(status) );
1835
		break;
1836
	}
1811
 drop:	
1837
 drop:	
1812
	stats->rx_dropped++;
1838
	stats->rx_dropped++;
1813
1839
Lines 2450-2455 Link Here
2450
	return err;
2476
	return err;
2451
}
2477
}
2452
2478
2479
//#define SET_MAC_ADDRESS
2480
#ifdef SET_MAC_ADDRESS
2481
static int
2482
orinoco_set_mac_address(struct net_device *dev, void *addr)
2483
{
2484
  struct orinoco_private *priv = dev->priv;
2485
  struct sockaddr *mac = addr;
2486
2487
  /* Copy the address */
2488
  memcpy(dev->dev_addr, mac->sa_data, WLAN_ADDR_LEN);
2489
2490
  /* Reconfig the beast */
2491
  orinoco_reset(priv);
2492
2493
  return 0;
2494
}
2495
#endif	/* SET_MAC_ADDRESS */
2496
2453
static void
2497
static void
2454
orinoco_tx_timeout(struct net_device *dev)
2498
orinoco_tx_timeout(struct net_device *dev)
2455
{
2499
{
Lines 3602-3607 Link Here
3602
	return 0;
3646
	return 0;
3603
}
3647
}
3604
3648
3649
/*----------------------------------------------------------------
3650
* orinoco_wlansniff
3651
*
3652
* Start or stop sniffing.
3653
*
3654
* Arguments:
3655
*	wlandev		wlan device structure
3656
*	msgp		ptr to msg buffer
3657
*
3658
* Returns: 
3659
*	0	success and done
3660
*	<0	success, but we're waiting for something to finish.
3661
*	>0	an error occurred while handling the message.
3662
* Side effects:
3663
*
3664
* Call context:
3665
*	process thread  (usually)
3666
*	interrupt
3667
----------------------------------------------------------------*/
3668
static int orinoco_wlansniff(struct net_device *dev, struct iwreq *wrq)
3669
{
3670
	struct orinoco_private *priv = dev->priv;
3671
3672
	hermes_t		*hw = &(priv->hw);
3673
        hermes_response_t  resp;
3674
	int 			result = 0;
3675
	uint16_t			word;
3676
3677
	int *parms = (int *) wrq->u.name;
3678
	int enable = parms[0] > 0;
3679
	unsigned long flags;
3680
3681
	orinoco_lock(priv, &flags);
3682
3683
	switch (enable)
3684
	{
3685
	case P80211ENUM_truth_false:
3686
		/* Confirm that we're in monitor mode */
3687
		if ( dev->type == ARPHRD_ETHER ) {
3688
			result = -EFAULT;
3689
		}
3690
		/* Disable monitor mode */
3691
	        word =	HERMES_CMD_MONITOR | (HERMES_MONITOR_DISABLE << 8);
3692
	        result = hermes_docmd_wait(hw, word, 0, &resp);
3693
3694
		if ( result ) break;
3695
3696
		/* Disable port 0 */
3697
		result = hermes_disable_port(hw, 0);
3698
		if ( result ) break;
3699
3700
		/* Clear the driver state */
3701
		dev->type = ARPHRD_ETHER;
3702
3703
		/* Restore the wepflags */   //Orinoco doesn't like this
3704
/*
3705
		result = hermes_write_wordrec(hw, USER_BAP,
3706
				HERMES_RID_CNF_PRISM2_WEP_ON, 
3707
				priv->presniff_wepflags);
3708
		if ( result ) break;
3709
3710
*/
3711
		/* Set the port to its prior type and enable (if necessary) */
3712
		if (priv->presniff_port_type != 0 ) {
3713
			word = priv->presniff_port_type;
3714
			result = hermes_write_wordrec(hw, USER_BAP, 
3715
				HERMES_RID_CNF_PORTTYPE, word);
3716
		    if ( result ) break;
3717
3718
			/* Enable the port */
3719
			result = hermes_enable_port(hw, 0);
3720
		    if ( result ) break;
3721
3722
		}
3723
3724
		break;
3725
	case P80211ENUM_truth_true:
3726
             /* Re-initialize the card before changing channel as advised at
3727
              * http://lists.samba.org/pipermail/wireless/2002-June/004491.html
3728
              * by Ian Goldberg.  Implementation by Pat Swieskowski.
3729
              */
3730
//		__orinoco_down(dev);
3731
                hermes_set_irqmask(hw, 0);
3732
		hermes_init(hw);
3733
//		__orinoco_up(dev);
3734
                hermes_set_irqmask(hw, ORINOCO_INTEN);
3735
3736
		// enable re-initialize
3737
//		__orinoco_stop_irqs(priv);
3738
//		hermes_reset(hw);
3739
//		__orinoco_start_irqs(priv, HERMES_EV_RX | HERMES_EV_ALLOC |
3740
//				   HERMES_EV_TX | HERMES_EV_TXEXC |
3741
//				   HERMES_EV_WTERR | HERMES_EV_INFO |
3742
//				   HERMES_EV_INFDROP);
3743
3744
		/* Disable the port (if enabled), only check Port 0 */
3745
		if ( hw->port_enabled[0] ) {
3746
			/* Save macport 0 state */
3747
			result = hermes_read_wordrec(hw, USER_BAP,
3748
					HERMES_RID_CNF_PORTTYPE,
3749
					&(priv->presniff_port_type));
3750
		    if ( result ) break;
3751
3752
			/* Save the wepflags state */
3753
			result = hermes_read_wordrec(hw, USER_BAP,
3754
					HERMES_RID_CNF_PRISM2_WEP_ON,
3755
					&(priv->presniff_wepflags));
3756
		    if ( result ) break;
3757
			result = hermes_disable_port(hw, 0);
3758
		    if ( result ) break;
3759
3760
		}
3761
		else {
3762
			priv->presniff_port_type = 0;
3763
		}
3764
3765
		/* Set the channel we wish to sniff  */
3766
		if (parms[1] > 0 && parms[1] < 15) {
3767
 		  word = parms[1];
3768
		  result = hermes_write_wordrec(hw, USER_BAP, 
3769
				  HERMES_RID_CNF_CHANNEL, word);
3770
		} else {
3771
 		  result = -EFAULT;
3772
		}
3773
3774
		if ( result ) break;
3775
3776
		/* Set the port type to pIbss */
3777
		word = HFA384x_PORTTYPE_IBSS;
3778
		result = hermes_write_wordrec(hw, USER_BAP, 
3779
				HERMES_RID_CNF_PORTTYPE, word);
3780
		if ( result ) break;
3781
3782
/*
3783
  	        if ( (msg->keepwepflags.status == P80211ENUM_msgitem_status_data_ok) && 
3784
                     (msg->keepwepflags.data != P80211ENUM_truth_true)) {
3785
		  // Set the wepflags for no decryption   //Orinoco doesn't like this
3786
	          word = HFA384x_WEPFLAGS_DISABLE_TXCRYPT | 
3787
			     HFA384x_WEPFLAGS_DISABLE_RXCRYPT;
3788
		  result = hermes_write_wordrec(hw, USER_BAP, 
3789
				 HERMES_RID_CNF_PRISM2_WEP_ON, word); //won't work with the bits above
3790
                }
3791
		if ( result ) break;
3792
3793
*/
3794
		/* Enable the port */
3795
		result = hermes_enable_port(hw, 0);
3796
		if ( result ) break;
3797
3798
		/* Enable monitor mode */
3799
	        word =	HERMES_CMD_MONITOR | (HERMES_MONITOR_ENABLE << 8);
3800
	        result = hermes_docmd_wait(hw, word, 0, &resp);
3801
		if ( result ) break;
3802
3803
		/* Set the driver state */
3804
		/* Do we want the prism2 header? */
3805
		if (parms[0] == 1)
3806
		  dev->type = ARPHRD_IEEE80211_PRISM;
3807
		else 
3808
		  dev->type = ARPHRD_IEEE80211;
3809
		break;
3810
	default:
3811
		result = -EFAULT;
3812
		break;
3813
	}
3814
	orinoco_unlock(priv, &flags);
3815
	return result;
3816
3817
}
3818
3605
static int
3819
static int
3606
orinoco_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
3820
orinoco_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
3607
{
3821
{
Lines 3834-3839 Link Here
3834
				{ SIOCIWFIRSTPRIV + 0x7, 0,
4048
				{ SIOCIWFIRSTPRIV + 0x7, 0,
3835
				  IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
4049
				  IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
3836
				  "get_ibssport" },
4050
				  "get_ibssport" },
4051
				{ SIOCIWFIRSTPRIV + 0x8,
4052
				  IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
4053
				  0, "monitor" },
3837
				{ SIOCIWLASTPRIV, 0, 0, "dump_recs" },
4054
				{ SIOCIWLASTPRIV, 0, 0, "dump_recs" },
3838
			};
4055
			};
3839
4056
Lines 3928-3933 Link Here
3928
		err = orinoco_ioctl_getibssport(dev, wrq);
4145
		err = orinoco_ioctl_getibssport(dev, wrq);
3929
		break;
4146
		break;
3930
4147
4148
        case SIOCIWFIRSTPRIV + 0x8: /* set sniff (monitor) mode */ 
4149
		DEBUG(1, "%s: SIOCIWFIRSTPRIV + 0x8 (monitor)\n",
4150
		      dev->name);
4151
		if (! capable(CAP_NET_ADMIN)) {
4152
			err = -EPERM;
4153
			break;
4154
		}
4155
                err = orinoco_wlansniff(dev, wrq);
4156
		break;
4157
3931
	case SIOCIWLASTPRIV:
4158
	case SIOCIWLASTPRIV:
3932
		err = orinoco_debug_dump_recs(priv);
4159
		err = orinoco_debug_dump_recs(priv);
3933
		if (err)
4160
		if (err)
Lines 4149-4154 Link Here
4149
	dev->tx_timeout = orinoco_tx_timeout;
4376
	dev->tx_timeout = orinoco_tx_timeout;
4150
	dev->watchdog_timeo = HZ; /* 1 second timeout */
4377
	dev->watchdog_timeo = HZ; /* 1 second timeout */
4151
	dev->get_stats = orinoco_get_stats;
4378
	dev->get_stats = orinoco_get_stats;
4379
#ifdef SET_MAC_ADDRESS
4380
        dev->set_mac_address = orinoco_set_mac_address;
4381
#endif	/* SET_MAC_ADDRESS */
4152
	dev->get_wireless_stats = orinoco_get_wireless_stats;
4382
	dev->get_wireless_stats = orinoco_get_wireless_stats;
4153
	dev->do_ioctl = orinoco_ioctl;
4383
	dev->do_ioctl = orinoco_ioctl;
4154
	dev->change_mtu = orinoco_change_mtu;
4384
	dev->change_mtu = orinoco_change_mtu;
Lines 4173-4178 Link Here
4173
4403
4174
}
4404
}
4175
4405
4406
/*----------------------------------------------------------------
4407
* orinoco_int_rxmonitor
4408
*
4409
* Helper function for int_rx.  Handles monitor frames.
4410
* Note that this function allocates space for the FCS and sets it
4411
* to 0xffffffff.  The hfa384x doesn't give us the FCS value but the
4412
* higher layers expect it.  0xffffffff is used as a flag to indicate
4413
* the FCS is bogus.
4414
*
4415
* Arguments:
4416
*	dev		wlan device structure
4417
*	rxfid		received FID
4418
*	rxdesc		rx descriptor read from card in int_rx
4419
*
4420
* Returns: 
4421
*	nothing
4422
*
4423
* Side effects:
4424
*	Allocates an skb and passes it up via the PF_PACKET interface.
4425
* Call context:
4426
*	interrupt
4427
----------------------------------------------------------------*/
4428
void orinoco_int_rxmonitor( struct orinoco_private *dev, uint16_t rxfid, int len,
4429
                            struct hermes_rx_descriptor *rxdesc, struct ieee802_11_hdr *hdr)
4430
{
4431
	hermes_t			*hw = &(dev->hw);
4432
	uint32_t				hdrlen = 0;
4433
	uint32_t				datalen = 0;
4434
	uint32_t				skblen = 0;
4435
	p80211msg_lnxind_wlansniffrm_t	*msg;
4436
	struct net_device_stats *stats = &dev->stats;
4437
4438
4439
	uint8_t				*datap;
4440
	uint16_t				fc;
4441
	struct sk_buff			*skb;
4442
4443
	/* Don't forget the status, time, and data_len fields are in host order */
4444
	/* Figure out how big the frame is */
4445
	fc = le16_to_cpu(hdr->frame_ctl);
4446
	switch ( WLAN_GET_FC_FTYPE(fc) )
4447
	{
4448
	case WLAN_FTYPE_DATA:
4449
		if ( WLAN_GET_FC_TODS(fc) && WLAN_GET_FC_FROMDS(fc) ) {
4450
			hdrlen = WLAN_HDR_A4_LEN;
4451
		} else {
4452
			hdrlen = WLAN_HDR_A3_LEN;
4453
		}
4454
		datalen = len;
4455
		break;
4456
	case WLAN_FTYPE_MGMT:
4457
		hdrlen = WLAN_HDR_A3_LEN;
4458
		datalen = len;
4459
		break;
4460
	case WLAN_FTYPE_CTL:
4461
		switch ( WLAN_GET_FC_FSTYPE(fc) )
4462
		{
4463
		case WLAN_FSTYPE_PSPOLL:
4464
		case WLAN_FSTYPE_RTS:
4465
		case WLAN_FSTYPE_CFEND:
4466
		case WLAN_FSTYPE_CFENDCFACK:
4467
			hdrlen = 16;
4468
			break;
4469
		case WLAN_FSTYPE_CTS:
4470
		case WLAN_FSTYPE_ACK:
4471
			hdrlen = 10;
4472
			break;
4473
		}
4474
		datalen = 0;
4475
		break;
4476
	default:
4477
		printk("unknown frm: fc=0x%04x\n", fc);
4478
		return;
4479
	}
4480
4481
	/* Allocate an ind message+framesize skb */
4482
	skblen = sizeof(p80211msg_lnxind_wlansniffrm_t) + 
4483
	  hdrlen + datalen;
4484
	
4485
	/* sanity check the length */
4486
	if ( skblen > 
4487
		(sizeof(p80211msg_lnxind_wlansniffrm_t) + 
4488
		WLAN_HDR_A4_LEN + WLAN_DATA_MAXLEN + WLAN_CRC_LEN) ) {
4489
		printk("overlen frm: len=%d\n", 
4490
			skblen - sizeof(p80211msg_lnxind_wlansniffrm_t));
4491
	}
4492
			
4493
	if ( (skb = dev_alloc_skb(skblen)) == NULL ) {
4494
		printk("alloc_skb failed trying to allocate %d bytes\n", skblen);
4495
		return;
4496
	}
4497
4498
	/* only prepend the prism header if in the right mode */
4499
	if (dev->ndev->type != ARPHRD_IEEE80211_PRISM) {
4500
	  skb_put(skb, skblen - sizeof(p80211msg_lnxind_wlansniffrm_t));
4501
	  datap = skb->data;
4502
	} else {
4503
	  skb_put(skb, skblen);
4504
	  datap = skb->data + sizeof(p80211msg_lnxind_wlansniffrm_t);
4505
	  msg = (p80211msg_lnxind_wlansniffrm_t*)skb->data;
4506
	  
4507
	  /* Initialize the message members */
4508
	  msg->msgcode = DIDmsg_lnxind_wlansniffrm;
4509
	  msg->msglen = sizeof(p80211msg_lnxind_wlansniffrm_t);
4510
	  strcpy(msg->devname, dev->ndev->name);
4511
	  
4512
	  msg->hosttime.did = DIDmsg_lnxind_wlansniffrm_hosttime;
4513
	  msg->hosttime.status = 0;
4514
	  msg->hosttime.len = 4;
4515
	  msg->hosttime.data = jiffies;
4516
	  
4517
	  msg->mactime.did = DIDmsg_lnxind_wlansniffrm_mactime;
4518
	  msg->mactime.status = 0;
4519
	  msg->mactime.len = 4;
4520
	  msg->mactime.data = rxdesc->time;
4521
	  
4522
	  msg->channel.did = DIDmsg_lnxind_wlansniffrm_channel;
4523
	  msg->channel.status = P80211ENUM_msgitem_status_no_value;
4524
	  msg->channel.len = 4;
4525
	  msg->channel.data = 0;
4526
4527
	  msg->rssi.did = DIDmsg_lnxind_wlansniffrm_rssi;
4528
	  msg->rssi.status = P80211ENUM_msgitem_status_no_value;
4529
	  msg->rssi.len = 4;
4530
	  msg->rssi.data = 0;
4531
	  
4532
	  msg->sq.did = DIDmsg_lnxind_wlansniffrm_sq;
4533
	  msg->sq.status = P80211ENUM_msgitem_status_no_value;
4534
	  msg->sq.len = 4;
4535
	  msg->sq.data = 0;
4536
	  
4537
	  msg->signal.did = DIDmsg_lnxind_wlansniffrm_signal;
4538
	  msg->signal.status = 0;
4539
	  msg->signal.len = 4;
4540
	  msg->signal.data = rxdesc->signal;
4541
	  
4542
	  msg->noise.did = DIDmsg_lnxind_wlansniffrm_noise;
4543
	  msg->noise.status = 0;
4544
	  msg->noise.len = 4;
4545
	  msg->noise.data = rxdesc->silence;
4546
4547
	  msg->rate.did = DIDmsg_lnxind_wlansniffrm_rate;
4548
	  msg->rate.status = 0;
4549
	  msg->rate.len = 4;
4550
	  msg->rate.data = rxdesc->rate / 5; /* set to 802.11 units */
4551
  
4552
	  msg->istx.did = DIDmsg_lnxind_wlansniffrm_istx;
4553
	  msg->istx.status = 0;
4554
	  msg->istx.len = 4;
4555
	  msg->istx.data = P80211ENUM_truth_false;
4556
	  
4557
	  msg->frmlen.did = DIDmsg_lnxind_wlansniffrm_frmlen;
4558
	  msg->frmlen.status = 0;
4559
	  msg->frmlen.len = 4;
4560
	  msg->frmlen.data = hdrlen + datalen;
4561
	}	  
4562
4563
	/* Copy the 802.11 header to the skb (ctl frames may be less than a full header) */
4564
	memcpy( datap, &(hdr->frame_ctl), hdrlen);
4565
4566
	/* If any, copy the data from the card to the skb */
4567
	if ( datalen > 0 )
4568
	{
4569
		hermes_bap_pread(hw, IRQ_BAP, datap + hdrlen, (datalen+1)&~1,
4570
				       rxfid, HERMES_RX_DATA_OFF);
4571
4572
		/* check for unencrypted stuff if WEP bit set. */
4573
		if (*(datap+1) & 0x40) // wep set
4574
		  if ((*(datap+hdrlen) == 0xaa) && (*(datap+hdrlen+1) == 0xaa))
4575
		    *(datap+1) &= 0xbf; // clear wep; it's the 802.2 header!
4576
	}
4577
4578
       /* pass it up via the PF_PACKET interface */
4579
       {
4580
	   skb->dev = dev->ndev;
4581
	   skb->dev->last_rx = jiffies;
4582
4583
	   skb->mac.raw = skb->data ;
4584
	   skb->ip_summed = CHECKSUM_NONE;
4585
	   skb->pkt_type = PACKET_OTHERHOST;
4586
	   skb->protocol = htons(ETH_P_80211_RAW);  /* XXX ETH_P_802_2? */
4587
4588
	   stats->rx_packets++;
4589
	   stats->rx_bytes += skb->len;
4590
4591
	   netif_rx(skb);
4592
       }
4593
4594
	return;
4595
}
4596
4176
/********************************************************************/
4597
/********************************************************************/
4177
/* Module initialization                                            */
4598
/* Module initialization                                            */
4178
/********************************************************************/
4599
/********************************************************************/
(-)ppc3.orig/drivers/net/wireless/orinoco.h (+178 lines)
Lines 28-33 Link Here
28
/* To enable debug messages */
28
/* To enable debug messages */
29
//#define ORINOCO_DEBUG		3
29
//#define ORINOCO_DEBUG		3
30
30
31
#ifndef ETH_P_ECONET
32
#define ETH_P_ECONET   0x0018    /* needed for 2.2.x kernels */
33
#endif
34
35
#define ETH_P_80211_RAW        (ETH_P_ECONET + 1)
36
37
#ifndef ARPHRD_IEEE80211
38
#define ARPHRD_IEEE80211 801     /* kernel 2.4.6 */
39
#endif
40
41
#ifndef ARPHRD_IEEE80211_PRISM  /* kernel 2.4.18 */
42
#define ARPHRD_IEEE80211_PRISM 802
43
#endif
44
31
#if (! defined (WIRELESS_EXT)) || (WIRELESS_EXT < 10)
45
#if (! defined (WIRELESS_EXT)) || (WIRELESS_EXT < 10)
32
#error "orinoco driver requires Wireless extensions v10 or later."
46
#error "orinoco driver requires Wireless extensions v10 or later."
33
#endif /* (! defined (WIRELESS_EXT)) || (WIRELESS_EXT < 10) */
47
#endif /* (! defined (WIRELESS_EXT)) || (WIRELESS_EXT < 10) */
Lines 45-50 Link Here
45
				HERMES_EV_TXEXC | HERMES_EV_WTERR | HERMES_EV_INFO | \
59
				HERMES_EV_TXEXC | HERMES_EV_WTERR | HERMES_EV_INFO | \
46
				HERMES_EV_INFDROP )
60
				HERMES_EV_INFDROP )
47
61
62
#define WLAN_DEVNAMELEN_MAX 16
63
64
/* message data item for INT, BOUNDEDINT, ENUMINT */
65
typedef struct p80211item_uint32
66
{
67
	uint32_t		did		__attribute__ ((packed));
68
	uint16_t		status	__attribute__ ((packed));
69
	uint16_t		len		__attribute__ ((packed));
70
	uint32_t		data	__attribute__ ((packed));
71
} __attribute__ ((packed)) p80211item_uint32_t;
72
73
typedef struct p80211msg
74
{
75
	uint32_t	msgcode		__attribute__ ((packed));
76
	uint32_t	msglen		__attribute__ ((packed));
77
	uint8_t	devname[WLAN_DEVNAMELEN_MAX]	__attribute__ ((packed));
78
} __attribute__ ((packed)) p80211msg_t;
79
80
#define DIDmsg_lnxind_wlansniffrm 0x0041
81
#define DIDmsg_lnxind_wlansniffrm_hosttime 0x1041
82
#define DIDmsg_lnxind_wlansniffrm_mactime 0x2041
83
#define DIDmsg_lnxind_wlansniffrm_channel 0x3041
84
#define DIDmsg_lnxind_wlansniffrm_rssi 0x4041
85
#define DIDmsg_lnxind_wlansniffrm_sq 0x5041
86
#define DIDmsg_lnxind_wlansniffrm_signal 0x6041
87
#define DIDmsg_lnxind_wlansniffrm_noise 0x7041
88
#define DIDmsg_lnxind_wlansniffrm_rate 0x8041
89
#define DIDmsg_lnxind_wlansniffrm_istx 0x9041
90
#define DIDmsg_lnxind_wlansniffrm_frmlen 0xA041
91
92
typedef struct p80211msg_lnxind_wlansniffrm
93
{
94
	uint32_t		msgcode;
95
	uint32_t		msglen;
96
	uint8_t		    devname[WLAN_DEVNAMELEN_MAX];
97
	p80211item_uint32_t	hosttime;
98
	p80211item_uint32_t	mactime;
99
	p80211item_uint32_t	channel;
100
	p80211item_uint32_t	rssi;
101
	p80211item_uint32_t	sq;
102
	p80211item_uint32_t	signal;
103
	p80211item_uint32_t	noise;
104
	p80211item_uint32_t	rate;
105
	p80211item_uint32_t	istx;
106
	p80211item_uint32_t	frmlen;
107
} __attribute__ ((packed)) p80211msg_lnxind_wlansniffrm_t;
108
109
#define P80211ENUM_truth_false			0
110
#define P80211ENUM_truth_true			1
111
#define P80211ENUM_resultcode_success		1
112
#define P80211ENUM_resultcode_invalid_parameters	2
113
#define P80211ENUM_resultcode_not_supported	3
114
#define P80211ENUM_resultcode_timeout		4
115
#define P80211ENUM_resultcode_too_many_req	5
116
#define P80211ENUM_resultcode_refused		6
117
#define P80211ENUM_resultcode_bss_already	7
118
#define P80211ENUM_resultcode_invalid_access	8
119
#define P80211ENUM_resultcode_invalid_mibattribute	9
120
#define P80211ENUM_resultcode_cant_set_readonly_mib	10
121
#define P80211ENUM_resultcode_implementation_failure	11
122
#define P80211ENUM_resultcode_cant_get_writeonly_mib	12
123
#define P80211ENUM_msgitem_status_data_ok		0
124
#define P80211ENUM_msgitem_status_no_value		1
125
#define P80211ENUM_msgitem_status_invalid_itemname	2
126
#define P80211ENUM_msgitem_status_invalid_itemdata	3
127
#define P80211ENUM_msgitem_status_missing_itemdata	4
128
#define P80211ENUM_msgitem_status_incomplete_itemdata	5
129
#define P80211ENUM_msgitem_status_invalid_msg_did	6
130
#define P80211ENUM_msgitem_status_invalid_mib_did	7
131
#define P80211ENUM_msgitem_status_missing_conv_func	8
132
#define P80211ENUM_msgitem_status_string_too_long	9
133
#define P80211ENUM_msgitem_status_data_out_of_range	10
134
#define P80211ENUM_msgitem_status_string_too_short	11
135
#define P80211ENUM_msgitem_status_missing_valid_func	12
136
#define P80211ENUM_msgitem_status_unknown		13
137
#define P80211ENUM_msgitem_status_invalid_did		14
138
#define P80211ENUM_msgitem_status_missing_print_func	15
139
140
#define WLAN_GET_FC_FTYPE(n)	(((n) & 0x0C) >> 2)
141
#define WLAN_GET_FC_FSTYPE(n)	(((n) & 0xF0) >> 4)
142
#define WLAN_GET_FC_TODS(n) 	(((n) & 0x0100) >> 8)
143
#define WLAN_GET_FC_FROMDS(n)	(((n) & 0x0200) >> 9)
144
145
/*--- Sizes -----------------------------------------------*/
146
#define WLAN_ADDR_LEN			6
147
#define WLAN_CRC_LEN			4
148
#define WLAN_BSSID_LEN			6
149
#define WLAN_BSS_TS_LEN			8
150
#define WLAN_HDR_A3_LEN			24
151
#define WLAN_HDR_A4_LEN			30
152
#define WLAN_SSID_MAXLEN		32
153
#define WLAN_DATA_MAXLEN		2312
154
155
/*--- Frame Control Field -------------------------------------*/
156
/* Frame Types */
157
#define WLAN_FTYPE_MGMT			0x00
158
#define WLAN_FTYPE_CTL			0x01
159
#define WLAN_FTYPE_DATA			0x02
160
161
/* Frame subtypes */
162
/* Management */
163
#define WLAN_FSTYPE_ASSOCREQ		0x00
164
#define WLAN_FSTYPE_ASSOCRESP		0x01
165
#define WLAN_FSTYPE_REASSOCREQ		0x02
166
#define WLAN_FSTYPE_REASSOCRESP		0x03
167
#define WLAN_FSTYPE_PROBEREQ		0x04 
168
#define WLAN_FSTYPE_PROBERESP		0x05
169
#define WLAN_FSTYPE_BEACON		0x08
170
#define WLAN_FSTYPE_ATIM		0x09
171
#define WLAN_FSTYPE_DISASSOC		0x0a
172
#define WLAN_FSTYPE_AUTHEN		0x0b
173
#define WLAN_FSTYPE_DEAUTHEN		0x0c
174
175
/* Control */
176
#define WLAN_FSTYPE_PSPOLL		0x0a
177
#define WLAN_FSTYPE_RTS			0x0b
178
#define WLAN_FSTYPE_CTS			0x0c
179
#define WLAN_FSTYPE_ACK			0x0d
180
#define WLAN_FSTYPE_CFEND		0x0e
181
#define WLAN_FSTYPE_CFENDCFACK		0x0f
182
183
/* Data */
184
#define WLAN_FSTYPE_DATAONLY		0x00
185
#define WLAN_FSTYPE_DATA_CFACK		0x01
186
#define WLAN_FSTYPE_DATA_CFPOLL		0x02
187
#define WLAN_FSTYPE_DATA_CFACK_CFPOLL	0x03
188
#define WLAN_FSTYPE_NULL		0x04
189
#define WLAN_FSTYPE_CFACK		0x05
190
#define WLAN_FSTYPE_CFPOLL		0x06
191
#define WLAN_FSTYPE_CFACK_CFPOLL	0x07
192
193
/*----------------------------------------------------------------*/
194
/* Magic number, a quick test to see we're getting the desired struct */
195
196
#define P80211_IOCTL_MAGIC	(0x4a2d464dUL)
197
198
/*================================================================*/
199
/* Types */
200
201
/*----------------------------------------------------------------*/
202
/* A ptr to the following structure type is passed as the third */
203
/*  argument to the ioctl system call when issuing a request to */
204
/*  the p80211 module. */
205
206
typedef struct p80211ioctl_req
207
{
208
	char 	name[WLAN_DEVNAMELEN_MAX] __attribute__ ((packed));
209
	void	*data 		__attribute__ ((packed));
210
	uint32_t	magic 	__attribute__ ((packed));
211
	uint16_t	len 	__attribute__ ((packed));
212
	uint32_t	result 	__attribute__ ((packed));
213
} __attribute__ ((packed)) p80211ioctl_req_t;
48
214
49
struct orinoco_private {
215
struct orinoco_private {
50
	void *card;	/* Pointer to card dependant structure */
216
	void *card;	/* Pointer to card dependant structure */
Lines 107-112 Link Here
107
	/* Configuration dependent variables */
273
	/* Configuration dependent variables */
108
	int port_type, createibss;
274
	int port_type, createibss;
109
	int promiscuous, mc_count;
275
	int promiscuous, mc_count;
276
277
	uint16_t		presniff_port_type;
278
	uint16_t		presniff_wepflags;
110
};
279
};
111
280
112
#ifdef ORINOCO_DEBUG
281
#ifdef ORINOCO_DEBUG
Lines 154-157 Link Here
154
	spin_unlock_irqrestore(&priv->lock, *flags);
323
	spin_unlock_irqrestore(&priv->lock, *flags);
155
}
324
}
156
325
326
/*================================================================*/
327
/* Function Declarations */
328
329
struct ieee802_11_hdr;
330
331
void orinoco_int_rxmonitor( struct orinoco_private *dev, uint16_t rxfid, int len,
332
                            struct hermes_rx_descriptor *rxdesc, struct ieee802_11_hdr *hdr);
333
334
157
#endif /* _ORINOCO_H */
335
#endif /* _ORINOCO_H */

Return to bug 27558