2007-08-31 04:58:57

by Michael Wu

[permalink] [raw]
Subject: [PATCH 6/6] adm8211: Fix monitor mode

From: Michael Wu <[email protected]>

This patch makes adm8211 deal with a NULL mac addr in monitor mode and
fixes handling of FCS in monitor mode.

Signed-off-by: Michael Wu <[email protected]>
---

drivers/net/wireless/adm8211.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/adm8211.c b/drivers/net/wireless/adm8211.c
index 872b032..be93ba0 100644
--- a/drivers/net/wireless/adm8211.c
+++ b/drivers/net/wireless/adm8211.c
@@ -316,6 +316,11 @@ static void adm8211_set_rx_mode(struct ieee80211_hw *dev,
ADM8211_CSR_WRITE(MAR1, mc_filter[1]);
ADM8211_CSR_READ(NAR);

+ if (flags & IFF_PROMISC)
+ dev->flags |= IEEE80211_HW_RX_INCLUDES_FCS;
+ else
+ dev->flags &= ~IEEE80211_HW_RX_INCLUDES_FCS;
+
ADM8211_RESTORE();
}

@@ -476,11 +481,6 @@ static void adm8211_interrupt_rci(struct ieee80211_hw
*dev)
rx_status.freq = adm8211_channels[priv->channel - 1].freq;
rx_status.phymode = MODE_IEEE80211B;

- /* remove FCS */
- /* TODO: remove this and set flag in ieee80211_hw instead? */
- if (dev->flags & IFF_PROMISC)
- skb_trim(skb, skb->len - FCS_LEN);
-
ieee80211_rx_irqsafe(dev, skb, &rx_status);
}

@@ -1255,6 +1255,9 @@ static void adm8211_hw_init(struct ieee80211_hw *dev)
/* Clear the missed-packet counter. */
ADM8211_CSR_READ(LPC);

+ if (!priv->mac_addr)
+ return;
+
/* set mac address */
ADM8211_CSR_WRITE(PAR0, *(u32 *)priv->mac_addr);
ADM8211_CSR_WRITE(PAR1, *(u16 *)&priv->mac_addr[4]);