rpms/kernel/devel linux-2.6-bcm43xx-promisc.patch, NONE, 1.1 linux-2.6-bcm43xx-txfix.patch, NONE, 1.1 linux-2.6-bcm43xx-version.patch, NONE, 1.1 linux-2.6-bcm43xx.patch, NONE, 1.1 linux-2.6.14-ieee80211-hw-wep.patch, NONE, 1.1 kernel-2.6.spec, 1.1807, 1.1808

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Mon Jan 2 21:57:01 UTC 2006


Author: dwmw2

Update of /cvs/dist/rpms/kernel/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv8346

Modified Files:
	kernel-2.6.spec 
Added Files:
	linux-2.6-bcm43xx-promisc.patch linux-2.6-bcm43xx-txfix.patch 
	linux-2.6-bcm43xx-version.patch linux-2.6-bcm43xx.patch 
	linux-2.6.14-ieee80211-hw-wep.patch 
Log Message:
Add broadcom driver

linux-2.6-bcm43xx-promisc.patch:
 bcm43xx_main.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

--- NEW FILE linux-2.6-bcm43xx-promisc.patch ---
Index: bcm43xx_main.c
===================================================================
--- linux/drivers/net/wireless/bcm43xx/bcm43xx_main.c	(revision 1002)
+++ linux/drivers/net/wireless/bcm43xx/bcm43xx_main.c	(working copy)
@@ -2665,9 +2665,9 @@
 	status = bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD);
 	/* Reset status to infrastructured mode */
 	status &= ~(BCM43xx_SBF_MODE_AP |
-		    BCM43xx_SBF_MODE_MONITOR |
-		    BCM43xx_SBF_MODE_PROMISC);
+		    BCM43xx_SBF_MODE_MONITOR);
 	status |= BCM43xx_SBF_MODE_NOTADHOC;
+	status |= BCM43xx_SBF_MODE_PROMISC;
 
 	switch (iw_mode) {
 	case IW_MODE_MONITOR:
@@ -2767,7 +2767,7 @@
 	value32 |= BCM43xx_SBF_MODE_NOTADHOC;
 	bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS_BITFIELD, value32);
 
-	if ((iw_mode == IW_MODE_MASTER) && (bcm->net_dev->flags & IFF_PROMISC)) {
+	if (1 || (iw_mode == IW_MODE_MASTER) || (bcm->net_dev->flags & IFF_PROMISC)) {
 		value32 = bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD);
 		value32 |= BCM43xx_SBF_MODE_PROMISC;
 		bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS_BITFIELD, value32);
@@ -4113,15 +4113,18 @@
 		if (memcmp(wlhdr->addr1, bcm->net_dev->dev_addr, ETH_ALEN) == 0 ||
 		    memcmp(wlhdr->addr3, bcm->ieee->bssid, ETH_ALEN) == 0 ||
 		    is_broadcast_ether_addr(wlhdr->addr1) ||
-		    is_multicast_ether_addr(wlhdr->addr1))
+		    is_multicast_ether_addr(wlhdr->addr1) ||
+		    bcm->net_dev->flags & IFF_PROMISC)
 			is_packet_for_us = 1;
 		break;
 	case IW_MODE_INFRA:
 	default:
 		if (memcmp(wlhdr->addr3, bcm->ieee->bssid, ETH_ALEN) == 0 ||
 		    memcmp(wlhdr->addr1, bcm->net_dev->dev_addr, ETH_ALEN) == 0 ||
-		    is_broadcast_ether_addr(wlhdr->addr1) ||
-		    is_multicast_ether_addr(wlhdr->addr1))
+		    (memcmp(wlhdr->addr3, bcm->net_dev->dev_addr, ETH_ALEN) &&
+		     (is_broadcast_ether_addr(wlhdr->addr1) ||
+		      is_multicast_ether_addr(wlhdr->addr1) ||
+		      bcm->net_dev->flags & IFF_PROMISC)))
 			is_packet_for_us = 1;
 		break;
 	}

linux-2.6-bcm43xx-txfix.patch:
 bcm43xx.h      |    5 --
 bcm43xx_dma.c  |   26 ++++++++---
 bcm43xx_main.c |  133 +++++++++++++--------------------------------------------
 bcm43xx_main.h |   12 +----
 bcm43xx_pio.c  |    3 +
 5 files changed, 60 insertions(+), 119 deletions(-)

--- NEW FILE linux-2.6-bcm43xx-txfix.patch ---
------------------------------------------------------------------------
r998 | tuxbuesch | 2006-01-02 10:13:10 +0000 (Mon, 02 Jan 2006) | 2 lines

fix stupid endianess bug for xmitstatus flags.

------------------------------------------------------------------------
r995 | tuxbuesch | 2006-01-02 08:39:30 +0000 (Mon, 02 Jan 2006) | 2 lines

fix xmitstatus for wlcore revs < 5 and optimize for revs >= 5.

Index: bcm43xx_pio.c
===================================================================
--- linux/drivers/net/wireless/bcm43xx/bcm43xx_pio.c	(revision 994)
+++ linux/drivers/net/wireless/bcm43xx/bcm43xx_pio.c	(revision 998)
@@ -561,11 +561,14 @@
 		}
 		return;
 	}
+//FIXME
+#if 0
 	if (queue->mmio_base == BCM43xx_MMIO_PIO4_BASE) {
 		bcm43xx_rx_transmitstatus(queue->bcm,
 					  (const struct bcm43xx_hwxmitstatus *)(preamble + 1));
 		return;
 	}
+#endif
 	skb = dev_alloc_skb(len);
 	if (unlikely(!skb)) {
 		pio_rx_error(queue, "out of memory");
Index: bcm43xx_main.h
===================================================================
--- linux/drivers/net/wireless/bcm43xx/bcm43xx_main.h	(revision 994)
+++ linux/drivers/net/wireless/bcm43xx/bcm43xx_main.h	(revision 998)
@@ -131,15 +131,14 @@
 
 /* Transmit Status as received from the hardware. */
 struct bcm43xx_hwxmitstatus {
-	PAD_BYTES(2);
-	PAD_BYTES(2);
-	u16 cookie;
+	PAD_BYTES(4);
+	__le16 cookie;
 	u8 flags;
 	u8 cnt1:4,
 	   cnt2:4;
 	PAD_BYTES(2);
-	u16 seq; //FIXME
-	u16 unknown; //FIXME
+	__le16 seq;
+	__le16 unknown; //FIXME
 } __attribute__((__packed__));
 
 /* Transmit Status in CPU byteorder. */
@@ -226,9 +225,6 @@
 void bcm43xx_tsf_read(struct bcm43xx_private *bcm, u64 *tsf);
 void bcm43xx_tsf_write(struct bcm43xx_private *bcm, u64 tsf);
 
-int FASTCALL(bcm43xx_rx_transmitstatus(struct bcm43xx_private *bcm,
-				       const struct bcm43xx_hwxmitstatus *status));
-
 int FASTCALL(bcm43xx_rx(struct bcm43xx_private *bcm,
 			struct sk_buff *skb,
 			struct bcm43xx_rxhdr *rxhdr));
Index: bcm43xx_dma.c
===================================================================
--- linux/drivers/net/wireless/bcm43xx/bcm43xx_dma.c	(revision 994)
+++ linux/drivers/net/wireless/bcm43xx/bcm43xx_dma.c	(revision 998)
@@ -889,6 +889,26 @@
 
 	sync_descbuffer_for_cpu(ring, meta->dmaaddr, ring->rx_buffersize);
 	skb = meta->skb;
+
+	if (ring->mmio_base == BCM43xx_MMIO_DMA4_BASE) {
+		/* We received an xmit status. */
+		struct bcm43xx_hwxmitstatus *hw = (struct bcm43xx_hwxmitstatus *)skb->data;
+		struct bcm43xx_xmitstatus stat;
+
+		stat.cookie = le16_to_cpu(hw->cookie);
+		stat.flags = hw->flags;
+		stat.cnt1 = hw->cnt1;
+		stat.cnt2 = hw->cnt2;
+		stat.seq = le16_to_cpu(hw->seq);
+		stat.unknown = le16_to_cpu(hw->unknown);
+
+		bcm43xx_debugfs_log_txstat(ring->bcm, &stat);
+		bcm43xx_dma_handle_xmitstatus(ring->bcm, &stat);
+		/* recycle the descriptor buffer. */
+		sync_descbuffer_for_device(ring, meta->dmaaddr, ring->rx_buffersize);
+
+		return;
+	}
 	rxhdr = (struct bcm43xx_rxhdr *)skb->data;
 	len = le16_to_cpu(rxhdr->frame_length);
 	if (len == 0) {
@@ -932,12 +952,6 @@
 	skb_put(skb, len + ring->frameoffset);
 	skb_pull(skb, ring->frameoffset);
 
-	if (ring->mmio_base == BCM43xx_MMIO_DMA4_BASE) {
-		bcm43xx_rx_transmitstatus(ring->bcm,
-					  (const struct bcm43xx_hwxmitstatus *)skb->data);
-		dev_kfree_skb_irq(skb);
-		return;
-	}
 	err = bcm43xx_rx(ring->bcm, skb, rxhdr);
 	if (err) {
 		dev_kfree_skb_irq(skb);
Index: bcm43xx_main.c
===================================================================
--- linux/drivers/net/wireless/bcm43xx/bcm43xx_main.c	(revision 994)
+++ linux/drivers/net/wireless/bcm43xx/bcm43xx_main.c	(revision 998)
@@ -1753,91 +1753,42 @@
 	return err;
 }
 
-/* Read the Transmit Status from MMIO and build the Transmit Status array. */
-static inline int build_transmit_status(struct bcm43xx_private *bcm,
-					struct bcm43xx_hwxmitstatus *status)
-{
-	u32 v170;
-	u32 v174;
-	u8 tmp[2];
-
-	v170 = bcm43xx_read32(bcm, 0x170);
-	if (v170 == 0x00000000)
-		return -1;
-	v174 = bcm43xx_read32(bcm, 0x174);
-
-	/* Internal Sending ID. */
-	status->cookie = cpu_to_le16( (v170 >> 16) & 0x0000FFFF );
-	/* 2 counters (both 4 bits) in the upper byte and flags in the lower byte. */
-	*((u16 *)tmp) = cpu_to_le16( (u16)((v170 & 0xfff0) | ((v170 & 0xf) >> 1)) );
-	status->flags = tmp[0];
-	status->cnt1 = (tmp[1] & 0x0f);
-	status->cnt2 = (tmp[1] & 0xf0) >> 4;
-	/* 802.11 sequence number? */
-	status->seq = cpu_to_le16( (u16)(v174 & 0xffff) );
-	/* Unknown value. */
-	status->unknown = cpu_to_le16( (u16)((v174 >> 16) & 0xff) );
-
-	return 0;
-}
-
-static inline void interpret_transmit_status(struct bcm43xx_private *bcm,
-					     struct bcm43xx_hwxmitstatus *hwstatus)
-{
-	struct bcm43xx_xmitstatus status;
-
-	status.cookie = le16_to_cpu(hwstatus->cookie);
-	status.flags = hwstatus->flags;
-	status.cnt1 = hwstatus->cnt1;
-	status.cnt2 = hwstatus->cnt2;
-	status.seq = le16_to_cpu(hwstatus->seq);
-	status.unknown = le16_to_cpu(hwstatus->unknown);
-
-	bcm43xx_debugfs_log_txstat(bcm, &status);
-
-	if (status.flags & BCM43xx_TXSTAT_FLAG_IGNORE)
-		return;
-	if (!(status.flags & BCM43xx_TXSTAT_FLAG_ACK)) {
-		//TODO: packet was not acked (was lost)
-	}
-	//TODO: There are more (unknown) flags to test. see bcm43xx_main.h
-
-	if (bcm->pio_mode)
-		bcm43xx_pio_handle_xmitstatus(bcm, &status);
-	else
-		bcm43xx_dma_handle_xmitstatus(bcm, &status);
-}
-
 static inline void handle_irq_transmit_status(struct bcm43xx_private *bcm)
 {
+	u32 v0, v1;
+	u16 tmp;
+	struct bcm43xx_xmitstatus stat;
+
 	assert(bcm->current_core->id == BCM43xx_COREID_80211);
+	assert(bcm->current_core->rev >= 5);
 
-	//TODO: In AP mode, this also causes sending of powersave responses.
+	while (1) {
+		v0 = bcm43xx_read32(bcm, BCM43xx_MMIO_XMITSTAT_0);
+		if (!v0)
+			break;
+		v1 = bcm43xx_read32(bcm, BCM43xx_MMIO_XMITSTAT_1);
 
-	if (bcm->current_core->rev < 5) {
-		struct bcm43xx_xmitstatus_queue *q, *tmp;
+		stat.cookie = (v0 >> 16) & 0x0000FFFF;
+		tmp = (u16)((v0 & 0xFFF0) | ((v0 & 0xF) >> 1));
+		stat.flags = tmp & 0xFF;
+		stat.cnt1 = (tmp & 0x0F00) >> 8;
+		stat.cnt2 = (tmp & 0xF000) >> 12;
+		stat.seq = (u16)(v1 & 0xFFFF);
+		stat.unknown = (u16)((v1 >> 16) & 0xFF);
 
-		/* If we received an xmit status, it is already saved
-		 * in the xmit status queue.
-		 */
-		list_for_each_entry_safe(q, tmp, &bcm->xmitstatus_queue, list) {
-			interpret_transmit_status(bcm, &q->status);
-			list_del(&q->list);
-			bcm->nr_xmitstatus_queued--;
-			kfree(q);
-		}
-		assert(bcm->nr_xmitstatus_queued == 0);
-		assert(list_empty(&bcm->xmitstatus_queue));
-	} else {
-		int res;
-		struct bcm43xx_hwxmitstatus transmit_status;
+		bcm43xx_debugfs_log_txstat(bcm, &stat);
 
-		while (1) {
-			res = build_transmit_status(bcm, &transmit_status);
-			if (res)
-				break;
-			interpret_transmit_status(bcm, &transmit_status);
+		if (stat.flags & BCM43xx_TXSTAT_FLAG_IGNORE)
+			continue;
+		if (!(stat.flags & BCM43xx_TXSTAT_FLAG_ACK)) {
+			//TODO: packet was not acked (was lost)
 		}
+		//TODO: There are more (unknown) flags to test. see bcm43xx_main.h
+
+		if (bcm->pio_mode)
+			bcm43xx_pio_handle_xmitstatus(bcm, &stat);
+		else
+			bcm43xx_dma_handle_xmitstatus(bcm, &stat);
 	}
 }
 
@@ -2148,7 +2099,9 @@
 	bcmirq_handled(BCM43xx_IRQ_RX);
 
 	if (reason & BCM43xx_IRQ_XMIT_STATUS) {
-		handle_irq_transmit_status(bcm);
+		if (bcm->current_core->rev >= 5)
+			handle_irq_transmit_status(bcm);
+		//TODO: In AP mode, this also causes sending of powersave responses.
 		bcmirq_handled(BCM43xx_IRQ_XMIT_STATUS);
 	}
 
@@ -4014,29 +3967,6 @@
 	goto out;
 }
 
-int fastcall bcm43xx_rx_transmitstatus(struct bcm43xx_private *bcm,
-				       const struct bcm43xx_hwxmitstatus *status)
-{
-	struct bcm43xx_xmitstatus_queue *q;
-
-	/*XXX: This code is untested, as we currently do not have a rev < 5 card. */
-dprintkl("processing received xmitstatus...\n");
-
-	if (unlikely(bcm->nr_xmitstatus_queued >= 50)) {
-		dprintkl(KERN_ERR PFX "Transmit Status Queue full!\n");
-		return -ENOSPC;
-	}
-	q = kmalloc(sizeof(*q), GFP_ATOMIC);
-	if (unlikely(!q))
-		return -ENOMEM;
-	INIT_LIST_HEAD(&q->list);
-	memcpy(&q->status, status, sizeof(*status));
-	list_add_tail(&q->list, &bcm->xmitstatus_queue);
-	bcm->nr_xmitstatus_queued++;
-
-	return 0;
-}
-
 static inline
 s8 bcm43xx_rssi_postprocess(struct bcm43xx_private *bcm, u8 in_rssi,
 			    int ofdm, int adjust_2053, int adjust_2050)
@@ -4448,7 +4378,6 @@
 	if (modparam_bad_frames_preempt)
 		bcm->bad_frames_preempt = 1;
 	spin_lock_init(&bcm->lock);
-	INIT_LIST_HEAD(&bcm->xmitstatus_queue);
 	tasklet_init(&bcm->isr_tasklet,
 		     (void (*)(unsigned long))bcm43xx_interrupt_tasklet,
 		     (unsigned long)bcm);
Index: bcm43xx.h
===================================================================
--- linux/drivers/net/wireless/bcm43xx/bcm43xx.h	(revision 994)
+++ linux/drivers/net/wireless/bcm43xx/bcm43xx.h	(revision 998)
@@ -51,6 +51,8 @@
 #define BCM43xx_MMIO_SHM_CONTROL	0x160
 #define BCM43xx_MMIO_SHM_DATA		0x164
 #define BCM43xx_MMIO_SHM_DATA_UNALIGNED	0x166
+#define BCM43xx_MMIO_XMITSTAT_0		0x170
+#define BCM43xx_MMIO_XMITSTAT_1		0x174
 #define BCM43xx_MMIO_REV3PLUS_TSF_LOW	0x180 /* core rev >= 3 only */
 #define BCM43xx_MMIO_REV3PLUS_TSF_HIGH	0x184 /* core rev >= 3 only */
 #define BCM43xx_MMIO_DMA1_BASE		0x200
@@ -693,9 +695,6 @@
 	u32 dma_reason[4];
 	/* saved irq enable/disable state bitfield. */
 	u32 irq_savedstate;
-	/* List of received transmitstatus blobs. (only on core.rev < 5) */
-	struct list_head xmitstatus_queue;
-	int nr_xmitstatus_queued;
 	/* Link Quality calculation context. */
 	struct bcm43xx_noise_calculation noisecalc;
 

linux-2.6-bcm43xx-version.patch:
 bcm43xx.h |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

--- NEW FILE linux-2.6-bcm43xx-version.patch ---
--- linux-2.6.14/drivers/net/wireless/bcm43xx/bcm43xx.h~	2005-12-31 00:46:32.000000000 +0000
+++ linux-2.6.14/drivers/net/wireless/bcm43xx/bcm43xx.h	2005-12-31 00:46:35.000000000 +0000
@@ -934,7 +934,7 @@ int bcm43xx_pci_write_config32(struct bc
  * Compatibility stuff follows
  */
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 15)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 14)
 # error "The bcm43xx driver does not support kernels < 2.6.15"
 # error "The driver will _NOT_ compile on your kernel. Please upgrade to the latest 2.6 kernel."
 # error "DO NOT COMPLAIN ABOUT BUGS. UPDATE FIRST AND TRY AGAIN."

linux-2.6-bcm43xx.patch:
 drivers/net/wireless/Kconfig  |    8 ++++++++
 drivers/net/wireless/Makefile |    1 +
 net/ieee80211/Kconfig         |    7 +++++++
 net/ieee80211/Makefile        |    1 +
 4 files changed, 17 insertions(+)

--- NEW FILE linux-2.6-bcm43xx.patch ---
--- linux-2.6.14/drivers/net/wireless/Kconfig~	2005-12-30 23:41:54.000000000 +0000
+++ linux-2.6.14/drivers/net/wireless/Kconfig	2005-12-30 23:53:24.000000000 +0000
@@ -477,6 +477,14 @@ config PRISM54
 
 source "drivers/net/wireless/hostap/Kconfig"
 
+config BCM43XX
+       tristate "Broadcom BCM43xx wireless support"
+       depends on PCI && IEEE80211 && NET_RADIO && IEEE80211_SOFTMAC && EXPERIMENTAL
+	select FW_LOADER
+       ---help---
+	This is an experimental driver for the Broadcom 43xx wireless chip,
+	found in the Apple Airport Extreme and various other devices.
+
 # yes, this works even when no drivers are selected
 config NET_WIRELESS
 	bool
--- linux-2.6.14/drivers/net/wireless/Makefile~	2005-10-28 01:02:08.000000000 +0100
+++ linux-2.6.14/drivers/net/wireless/Makefile	2005-12-30 23:53:43.000000000 +0000
@@ -35,6 +35,7 @@ obj-$(CONFIG_PCMCIA_ATMEL)      += atmel
 obj-$(CONFIG_PRISM54)		+= prism54/
 
 obj-$(CONFIG_HOSTAP)		+= hostap/
+obj-$(CONFIG_BCM43XX)		+= bcm43xx/
 
 # 16-bit wireless PCMCIA client drivers
 obj-$(CONFIG_PCMCIA_RAYCS)	+= ray_cs.o
--- linux-2.6.14/net/ieee80211/Kconfig~	2005-12-30 23:42:06.000000000 +0000
+++ linux-2.6.14/net/ieee80211/Kconfig	2005-12-30 23:51:55.000000000 +0000
@@ -66,3 +66,10 @@ config IEEE80211_CRYPT_TKIP
 	This can be compiled as a modules and it will be called
 	"ieee80211_crypt_tkip".
 
+config IEEE80211_SOFTMAC
+       tristate "IEEE 802.11 softmac"
+       depends on IEEE80211 && EXPERIMENTAL
+       ---help---
+       The softmac layer handles IEEE 802.11 protocol management functions
+	such as scanning, association and similar tasks, which recent hardware
+	often leaves to software rather than implementing it all in hardware.
--- linux-2.6.14/net/ieee80211/Makefile~	2005-12-30 23:42:06.000000000 +0000
+++ linux-2.6.14/net/ieee80211/Makefile	2005-12-30 23:52:26.000000000 +0000
@@ -3,6 +3,7 @@ obj-$(CONFIG_IEEE80211) += ieee80211_cry
 obj-$(CONFIG_IEEE80211_CRYPT_WEP) += ieee80211_crypt_wep.o
 obj-$(CONFIG_IEEE80211_CRYPT_CCMP) += ieee80211_crypt_ccmp.o
 obj-$(CONFIG_IEEE80211_CRYPT_TKIP) += ieee80211_crypt_tkip.o
+obj-$(CONFIG_IEEE80211_SOFTMAC) += softmac/
 ieee80211-objs := \
 	ieee80211_module.o \
 	ieee80211_tx.o \

linux-2.6.14-ieee80211-hw-wep.patch:
 ieee80211_crypt_wep.c |   61 +++++++++++++++++++++++++++++++++++---------------
 ieee80211_tx.c        |    2 -
 ieee80211_wx.c        |    2 -
 3 files changed, 45 insertions(+), 20 deletions(-)

--- NEW FILE linux-2.6.14-ieee80211-hw-wep.patch ---
--- linux-2.6.15-rc7-rc15.ieee80211-orig/net/ieee80211/ieee80211_crypt_wep.c	2005-12-26 11:59:53.051895000 +0100
+++ linux-2.6.15-rc7-rc15/net/ieee80211/ieee80211_crypt_wep.c	2005-12-30 04:11:30.512572000 +0100
@@ -75,22 +75,14 @@
 	kfree(priv);
 }
 
-/* Perform WEP encryption on given skb that has at least 4 bytes of headroom
- * for IV and 4 bytes of tailroom for ICV. Both IV and ICV will be transmitted,
- * so the payload length increases with 8 bytes.
- *
- * WEP frame payload: IV + TX key idx, RC4(data), ICV = RC4(CRC32(data))
- */
-static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+/* Add WEP IV/key info to a frame that has at least 4 bytes of headroom */
+static int prism2_wep_build_iv(struct sk_buff *skb, int hdr_len, void *priv)
 {
 	struct prism2_wep_data *wep = priv;
-	u32 crc, klen, len;
-	u8 key[WEP_KEY_LEN + 3];
-	u8 *pos, *icv;
-	struct scatterlist sg;
-
-	if (skb_headroom(skb) < 4 || skb_tailroom(skb) < 4 ||
-	    skb->len < hdr_len)
+	u32 klen, len;
+	u8 *pos;
+	
+	if (skb_headroom(skb) < 4 || skb->len < hdr_len)
 		return -1;
 
 	len = skb->len - hdr_len;
@@ -112,15 +104,47 @@
 	}
 
 	/* Prepend 24-bit IV to RC4 key and TX frame */
-	*pos++ = key[0] = (wep->iv >> 16) & 0xff;
-	*pos++ = key[1] = (wep->iv >> 8) & 0xff;
-	*pos++ = key[2] = wep->iv & 0xff;
+	*pos++ = (wep->iv >> 16) & 0xff;
+	*pos++ = (wep->iv >> 8) & 0xff;
+	*pos++ = wep->iv & 0xff;
 	*pos++ = wep->key_idx << 6;
 
+	return 0;
+}
+
+/* Perform WEP encryption on given skb that has at least 4 bytes of headroom
+ * for IV and 4 bytes of tailroom for ICV. Both IV and ICV will be transmitted,
+ * so the payload length increases with 8 bytes.
+ *
+ * WEP frame payload: IV + TX key idx, RC4(data), ICV = RC4(CRC32(data))
+ */
+static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+{
+	struct prism2_wep_data *wep = priv;
+	u32 crc, klen, len;
+	u8 *pos, *icv;
+	struct scatterlist sg;
+	u8 key[WEP_KEY_LEN + 3];
+
+	/* other checks are in prism2_wep_build_iv */
+	if (skb_tailroom(skb) < 4)
+		return -1;
+	
+	/* add the IV to the frame */
+	if (prism2_wep_build_iv(skb, hdr_len, priv))
+		return -1;
+	
+	/* Copy the IV into the first 3 bytes of the key */
+	memcpy(key, skb->data + hdr_len, 3);
+
 	/* Copy rest of the WEP key (the secret part) */
 	memcpy(key + 3, wep->key, wep->key_len);
+	
+	len = skb->len - hdr_len - 4;
+	pos = skb->data + hdr_len + 4;
+	klen = 3 + wep->key_len;
 
-	/* Append little-endian CRC32 and encrypt it to produce ICV */
+	/* Append little-endian CRC32 over only the data and encrypt it to produce ICV */
 	crc = ~crc32_le(~0, pos, len);
 	icv = skb_put(skb, 4);
 	icv[0] = crc;
@@ -231,6 +255,7 @@
 	.name = "WEP",
 	.init = prism2_wep_init,
 	.deinit = prism2_wep_deinit,
+	.build_iv = prism2_wep_build_iv,
 	.encrypt_mpdu = prism2_wep_encrypt,
 	.decrypt_mpdu = prism2_wep_decrypt,
 	.encrypt_msdu = NULL,
--- linux-2.6.15-rc7-rc15.ieee80211-orig/net/ieee80211/ieee80211_tx.c	2005-12-26 11:59:53.131895000 +0100
+++ linux-2.6.15-rc7-rc15/net/ieee80211/ieee80211_tx.c	2005-12-29 23:29:16.143304000 +0100
@@ -288,7 +288,7 @@
 	/* Determine total amount of storage required for TXB packets */
 	bytes = skb->len + SNAP_SIZE + sizeof(u16);
 
-	if (host_encrypt)
+	if (host_encrypt || host_build_iv)
 		fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA |
 		    IEEE80211_FCTL_PROTECTED;
 	else
--- linux-2.6.15-rc7-rc15.ieee80211-orig/net/ieee80211/ieee80211_wx.c	2005-12-26 11:59:53.131895000 +0100
+++ linux-2.6.15-rc7-rc15/net/ieee80211/ieee80211_wx.c	2005-12-30 04:02:02.382572000 +0100
@@ -284,7 +284,7 @@
 	};
 	int i, key, key_provided, len;
 	struct ieee80211_crypt_data **crypt;
-	int host_crypto = ieee->host_encrypt || ieee->host_decrypt;
+	int host_crypto = ieee->host_encrypt || ieee->host_decrypt || ieee->host_build_iv;
 
 	IEEE80211_DEBUG_WX("SET_ENCODE\n");
 




Index: kernel-2.6.spec
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/kernel-2.6.spec,v
retrieving revision 1.1807
retrieving revision 1.1808
diff -u -r1.1807 -r1.1808
--- kernel-2.6.spec	1 Jan 2006 20:27:11 -0000	1.1807
+++ kernel-2.6.spec	2 Jan 2006 21:56:59 -0000	1.1808
@@ -183,6 +183,10 @@
 Source10: COPYING.modules
 Source11: genkey
 
+%define BCMVER 20060102
+Source12: ftp://ftp.berlios.de/pub/bcm43xx/snapshots/softmac/ieee80211softmac-%{BCMVER}.tar.bz2
+Source13: ftp://ftp.berlios.de/pub/bcm43xx/snapshots/bcm43xx/bcm43xx-%{BCMVER}.tar.bz2
+
 Source20: kernel-%{kversion}-i586.config
 Source21: kernel-%{kversion}-i686.config
 Source22: kernel-%{kversion}-i686-smp.config
@@ -374,6 +378,13 @@
 Patch2000: linux-2.6-vm-oomkiller-debugging.patch
 Patch2001: linux-2.6-vm-silence-atomic-alloc-failures.patch
 
+# Broadcom wireless driver
+Patch5000: linux-2.6-bcm43xx.patch
+Patch5001: linux-2.6-bcm43xx-version.patch
+Patch5002: linux-2.6-bcm43xx-promisc.patch
+Patch5003: linux-2.6-bcm43xx-txfix.patch
+Patch5004: linux-2.6.14-ieee80211-hw-wep.patch
+
 #
 # 10000 to 20000 is for stuff that has to come last due to the
 # amount of drivers they touch. But only these should go here. 
@@ -873,6 +884,26 @@
 # be merged upstream
 #
 
+# Broadcom BCM43xx wireless driver.
+
+# Extract snapshot tarballs and move them into place.
+tar xvfj %{SOURCE12}
+mv ieee80211softmac-%{BCMVER}/net/*.h include/net
+mv ieee80211softmac-%{BCMVER} net/ieee80211/softmac
+tar xvfj %{SOURCE13}
+mv bcm43xx-%{BCMVER} drivers/net/wireless/bcm43xx
+
+# Patch Kconfig and Makefiles to merge it 'properly'
+%patch5000 -p1
+# Make it accept kernel version 2.6.14, since we're actually 2.6.15-rc
+%patch5001 -p1
+# Fix tx status with core rev < 5 (will be fixed in 20060603 snapshot)
+%patch5002 -p1
+# Operate in promiscuous mode, to make multicast and broadcast RX work
+%patch5003 -p1
+# Handle host_build_iv properly
+%patch5004 -p1
+
 
 #
 # final stuff
@@ -1364,6 +1395,9 @@
 %endif
 
 %changelog
+* Mon Jan 02 2006 David Woodhouse <dwmw2 at redhat.com>
+- Merge experimental Broadcom wireless driver
+
 * Sun Jan 01 2006 Dave Jones <davej at redhat.com>
 - 2.6.15-rc7-git6
 




More information about the fedora-cvs-commits mailing list